lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all,

I've been thinking about safely spawning processes in a multithreaded
program lately.
The opinion of POSIX seems to be that `closefrom` is wrong, and that
well-written programs and libraries should always open fd with
O_CLOEXEC set from the start.
To aid this, the "e" specifier to fopen (currently a gnu extension) is
to be featured in the next POSIX standard.
This "e" flag has been widely supported by libcs on posix systems for
many years.
This same feature is available on windows as the "N" flag to fopen.

To prevent issues in multi-threaded applications that use lua,
I suggest that lua automatically append the relevant flag to the fopen 'mode'.
i.e. "e" on POSIX systems and "N" on windows.

Regards,
Daurn.