"Yury V. Zaytsev" <y...@shurup.com> wrote:

>  ...
>  bash-5.1$ gcc mmap-full.c
>  bash-5.1$ export XPG_SUS_ENV=ON
>  bash-5.1$ ./a.out
>  bash-5.1$ echo $?
>  0
>  bash-5.1$ unset XPG_SUS_ENV
>  bash-5.1$ ./a.out
>  bash-5.1$ echo $?
>  10
>
> ... all controlled by a variable at runtime
> ... nothing one can do at the build time, only runtime control.

Never say never :)

One could, at build time, include code to do something like (untested):

  if (strcmp(getenv("XPG_SUS_ENV", "ON")) != 0)
  {
    setenv("XPG_SUS_ENV", "ON", 1);
  }

(and yes, if AIX has already tested XPG_SUS_ENV before this gets
control, it might also be necessary for the program to re-exec
itself).

> ... for my use case, it's better to just get rid of mmap altogether.

Indeed.

Reply via email to