[git commit master] CLOEXEC: use open(CLOEXEC) if exist; do not check fcntl(FD_CLOEXEC) failure

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 5 22:05:32 UTC 2009


On Saturday 05 September 2009 23:55, Mike Frysinger wrote:
> On Saturday 05 September 2009 17:55:26 Denys Vlasenko wrote:
> > >On Saturday 05 September 2009 16:04:36 Denys Vlasenko wrote:
> > >> +#ifndef O_CLOEXEC
> > >> +# define O_CLOEXEC 0
> > >> +#endif
> > >
> > >it should be defined by the C library headers.  if it isnt, then the port
> > >needs updating and the build should fail.  so please drop this cruft.
> >
> > You probably was thinking about FD_CLOEXEC. :)
> >
> > Yes, FD_CLOEXEC must exist.
> >
> > O_CLOEXEC is a new, Linux specific open() flag.
> > And currently it is not yet defined, since there are many
> > old kernels in the wild which won't understand that.
> 
> no, i'm thinking of O_CLOEXEC.  i know what the flag is for, and it should be 
> defined in bits/fcntl.h for every port.
> -mike

Currently, it is not defined on any arch:


# grep -rC1 'define.*O_CLOEXEC' .
./libc/misc/utmp/utent.c-#ifndef O_CLOEXEC
./libc/misc/utmp/utent.c:# define O_CLOEXEC 0
./libc/misc/utmp/utent.c-#endif
--
./libc/misc/dirent/opendir.c-#ifndef O_CLOEXEC
./libc/misc/dirent/opendir.c:# define O_CLOEXEC 0
./libc/misc/dirent/opendir.c-#endif
--
./libc/pwd_grp/lckpwdf.c-#ifndef O_CLOEXEC
./libc/pwd_grp/lckpwdf.c:# define O_CLOEXEC 0
./libc/pwd_grp/lckpwdf.c-#endif
--
./libc/sysdeps/linux/sh/bits/fcntl.h-# if 0
./libc/sysdeps/linux/sh/bits/fcntl.h:# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/sh/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/arm/bits/fcntl.h-# if 0
./libc/sysdeps/linux/arm/bits/fcntl.h:# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/arm/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/i386/bits/fcntl.h-# if 0
./libc/sysdeps/linux/i386/bits/fcntl.h:# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/i386/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/ia64/bits/fcntl.h-# if 0
./libc/sysdeps/linux/ia64/bits/fcntl.h:# define O_CLOEXEC       02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/ia64/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/alpha/bits/fcntl.h-# if 0
./libc/sysdeps/linux/alpha/bits/fcntl.h:# define O_CLOEXEC      010000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/alpha/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/sparc/bits/fcntl.h-# if 0
./libc/sysdeps/linux/sparc/bits/fcntl.h:# define O_CLOEXEC      0x400000 /* Set close_on_exit.  */
./libc/sysdeps/linux/sparc/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/x86_64/bits/fcntl.h-# if 0
./libc/sysdeps/linux/x86_64/bits/fcntl.h:# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/x86_64/bits/fcntl.h-# endif
--
./libc/sysdeps/linux/powerpc/bits/fcntl.h-# if 0
./libc/sysdeps/linux/powerpc/bits/fcntl.h:# define O_CLOEXEC    02000000 /* Set close_on_exec.  */
./libc/sysdeps/linux/powerpc/bits/fcntl.h-# endif


--
vda


More information about the uClibc mailing list