
On 17 Oct 2007, at 10:58 am, John Goerzen wrote:
Do you mean FD_CLOEXEC, which can be set with fcntl()? If so, it's not defined in POSIX according to the Linux manpage. I couldn't find CLOSE_ON_EXEC in either open(2) or fcntl(2).
F_GETFD and F_SETFD are the things to look for; FD_CLOEXEC is a fancy way of saying 1 in historic UNIXes. The OSF/1 /usr/include/sys/ fcntl.h says that FD_CLOEXEC is "POSIX REQUIRED". This facility is most certainly part of the Single Unix Specification. The MacOS 10.4 manual page for fcntl() doesn't mention FD_CLOEXEC, but it *does* mention F_GETFD and F_SETFD and identifies the close-on-execute flag as being the "low-order bit" of that flags word, so what may possibly be missing from some editions of POSIX is the *name* FD_CLOEXEC but not the facility (F_SETFD) or the value (1).