patches/uClibc/0.9.30.2/200-clean-up-O_CLOEXEC-handling.patch
author Arnaud Lacombe <lacombar@gmail.com>
Tue Aug 03 06:17:51 2010 +0200 (2010-08-03)
changeset 2064 f5ebe8c429dc
parent 1819 66fcfb3d6745
permissions -rw-r--r--
libc/uClibc: add uClibc 0.9.30.3

This version has been released a couple of month ago, but it never reached
crosstool-ng tree. This may be linked to the fact that the current 0.9.30.2,
once patched, has nothing much different from 0.9.30.3, released.

I'm not including any patch with this upgrade, on purpose.

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
     1 From 74ca5695cd9913691192e075449b8be5794d50f0 Mon Sep 17 00:00:00 2001
     2 From: Mike Frysinger <vapier@gentoo.org>
     3 Date: Thu, 8 Oct 2009 02:51:55 +0000
     4 Subject: [PATCH 12/15] clean up O_CLOEXEC handling
     5 
     6 Drop the "#ifndef O_CLOEXEC" cruft, enable O_CLOEXEC in most fcntl.h
     7 headers, and import __ASSUME_O_CLOEXEC from glibc.
     8 
     9 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
    10 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
    11 ---
    12  libc/pwd_grp/lckpwdf.c                     |    8 +++++++-
    13  libc/sysdeps/linux/alpha/bits/fcntl.h      |    2 --
    14  libc/sysdeps/linux/arm/bits/fcntl.h        |    2 --
    15  libc/sysdeps/linux/avr32/bits/fcntl.h      |    1 +
    16  libc/sysdeps/linux/bfin/bits/fcntl.h       |    2 ++
    17  libc/sysdeps/linux/cris/bits/fcntl.h       |    1 +
    18  libc/sysdeps/linux/frv/bits/fcntl.h        |    2 ++
    19  libc/sysdeps/linux/hppa/bits/fcntl.h       |    1 +
    20  libc/sysdeps/linux/i386/bits/fcntl.h       |    2 --
    21  libc/sysdeps/linux/ia64/bits/fcntl.h       |    2 --
    22  libc/sysdeps/linux/m68k/bits/fcntl.h       |    1 +
    23  libc/sysdeps/linux/microblaze/bits/fcntl.h |    2 ++
    24  libc/sysdeps/linux/mips/bits/fcntl.h       |    1 +
    25  libc/sysdeps/linux/powerpc/bits/fcntl.h    |    2 --
    26  libc/sysdeps/linux/sh/bits/fcntl.h         |    2 --
    27  libc/sysdeps/linux/sh64/bits/fcntl.h       |    2 ++
    28  libc/sysdeps/linux/sparc/bits/fcntl.h      |    2 --
    29  libc/sysdeps/linux/x86_64/bits/fcntl.h     |    2 --
    30  libc/sysdeps/linux/xtensa/bits/fcntl.h     |    1 +
    31  19 files changed, 21 insertions(+), 17 deletions(-)
    32 
    33 diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c
    34 index 0b0fb47..aec6283 100644
    35 --- a/libc/pwd_grp/lckpwdf.c
    36 +++ b/libc/pwd_grp/lckpwdf.c
    37 @@ -75,7 +75,7 @@ lckpwdf (void)
    38    /* Prevent problems caused by multiple threads.  */
    39    __UCLIBC_MUTEX_LOCK(mylock);
    40  
    41 -  lock_fd = open (_PATH_PASSWD, O_WRONLY);
    42 +  lock_fd = open (_PATH_PASSWD, O_WRONLY | O_CLOEXEC);
    43    if (lock_fd == -1) {
    44      /* Cannot create lock file.  */
    45  	goto DONE;
    46 @@ -97,6 +97,12 @@ lckpwdf (void)
    47  	goto DONE;
    48    }
    49  
    50 +#ifndef __ASSUME_O_CLOEXEC
    51 +    /* Make sure file gets correctly closed when process finished.  */
    52 +   fcntl (lock_fd, F_SETFD, FD_CLOEXEC);
    53 +#endif
    54 +
    55 +
    56    /* Now we have to get exclusive write access.  Since multiple
    57       process could try this we won't stop when it first fails.
    58       Instead we set a timeout for the system call.  Once the timer
    59 diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
    60 index 2a6b9ea..649c563 100644
    61 --- a/libc/sysdeps/linux/alpha/bits/fcntl.h
    62 +++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
    63 @@ -50,9 +50,7 @@
    64  # define O_NOFOLLOW	0200000	/* Do not follow links.  */
    65  # define O_DIRECT	02000000 /* Direct disk access.  */
    66  # define O_NOATIME	04000000 /* Do not set atime.  */
    67 -# if 0
    68  # define O_CLOEXEC      010000000 /* Set close_on_exec.  */
    69 -# endif
    70  #endif
    71  
    72  #ifdef __USE_LARGEFILE64
    73 diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
    74 index 86cea4b..7cc5a9d 100644
    75 --- a/libc/sysdeps/linux/arm/bits/fcntl.h
    76 +++ b/libc/sysdeps/linux/arm/bits/fcntl.h
    77 @@ -50,9 +50,7 @@
    78  # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
    79  # define O_DIRECT	0200000	/* Direct disk access.	*/
    80  # define O_NOATIME     01000000 /* Do not set atime.  */
    81 -# if 0
    82  # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
    83 -# endif
    84  #endif
    85  
    86  /* For now Linux has synchronisity options for data and read operations.
    87 diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
    88 index 2301e22..767243e 100644
    89 --- a/libc/sysdeps/linux/avr32/bits/fcntl.h
    90 +++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
    91 @@ -30,6 +30,7 @@
    92  # define O_DIRECTORY	00200000	/* direct disk access */
    93  # define O_NOFOLLOW	00400000	/* don't follow links */
    94  # define O_NOATIME	01000000	/* don't set atime */
    95 +# define O_CLOEXEC	02000000	/* set close_on_exec */
    96  #endif
    97  
    98  #ifdef __USE_LARGEFILE64
    99 diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
   100 index 7d0bcf9..aabf94d 100644
   101 --- a/libc/sysdeps/linux/bfin/bits/fcntl.h
   102 +++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
   103 @@ -48,6 +48,8 @@
   104  # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   105  # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   106  # define O_DIRECT	0200000	/* Direct disk access.	*/
   107 +# define O_NOATIME     01000000 /* don't set atime */
   108 +# define O_CLOEXEC     02000000 /* set close_on_exec */
   109  #endif
   110  
   111  /* For now Linux has synchronisity options for data and read operations.
   112 diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
   113 index a2106ef..29443ba 100644
   114 --- a/libc/sysdeps/linux/cris/bits/fcntl.h
   115 +++ b/libc/sysdeps/linux/cris/bits/fcntl.h
   116 @@ -50,6 +50,7 @@
   117  # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   118  # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   119  # define O_NOATIME	01000000 /* Do not set atime.  */
   120 +# define O_CLOEXEC	02000000 /* set close_on_exec */
   121  #endif
   122  
   123  /* For now Linux has synchronisity options for data and read operations.
   124 diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
   125 index 06e8860..5bff4d3 100644
   126 --- a/libc/sysdeps/linux/frv/bits/fcntl.h
   127 +++ b/libc/sysdeps/linux/frv/bits/fcntl.h
   128 @@ -45,6 +45,8 @@
   129  # define O_DIRECT	 040000	/* Direct disk access.  */
   130  # define O_DIRECTORY	0200000	/* Must be a directory.  */
   131  # define O_NOFOLLOW	0400000	/* Do not follow links.  */
   132 +# define O_NOATIME     01000000 /* don't set atime */
   133 +# define O_CLOEXEC     02000000 /* set close_on_exec */
   134  #endif
   135  
   136  /* For now Linux has synchronisity options for data and read operations.
   137 diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
   138 index cc23bf8..86e3b6f 100644
   139 --- a/libc/sysdeps/linux/hppa/bits/fcntl.h
   140 +++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
   141 @@ -50,6 +50,7 @@
   142  # define O_DIRECTORY	00010000 /* Must be a directory. */
   143  # define O_NOFOLLOW	00000200 /* Do not follow links. */
   144  # define O_NOATIME	04000000 /* Do not set atime. */
   145 +# define O_CLOEXEC	010000000 /* set close_on_exec */
   146  #endif
   147  
   148  #ifdef __USE_LARGEFILE64
   149 diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
   150 index 7f0b552..22e073b 100644
   151 --- a/libc/sysdeps/linux/i386/bits/fcntl.h
   152 +++ b/libc/sysdeps/linux/i386/bits/fcntl.h
   153 @@ -50,9 +50,7 @@
   154  # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   155  # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   156  # define O_NOATIME     01000000 /* Do not set atime.  */
   157 -# if 0
   158  # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   159 -# endif
   160  #endif
   161  
   162  /* For now Linux has synchronisity options for data and read operations.
   163 diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
   164 index d134c4b..85a55f6 100644
   165 --- a/libc/sysdeps/linux/ia64/bits/fcntl.h
   166 +++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
   167 @@ -49,9 +49,7 @@
   168  # define O_DIRECTORY	0200000	/* must be a directory */
   169  # define O_NOFOLLOW	0400000 /* don't follow links */
   170  # define O_NOATIME	01000000 /* Do not set atime.  */
   171 -# if 0
   172  # define O_CLOEXEC	02000000 /* Set close_on_exec.  */
   173 -# endif
   174  #endif
   175  
   176  #ifdef __USE_LARGEFILE64
   177 diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
   178 index d36198d..e564b42 100644
   179 --- a/libc/sysdeps/linux/m68k/bits/fcntl.h
   180 +++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
   181 @@ -49,6 +49,7 @@
   182  # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   183  # define O_DIRECT	0200000	/* Direct disk access.	*/
   184  # define O_NOATIME	01000000 /* Do not set atime.  */
   185 +# define O_CLOEXEC	02000000 /* set close_on_exec */
   186  #endif
   187  
   188  /* For now Linux has synchronisity options for data and read operations.
   189 diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
   190 index c8aeb91..da35209 100644
   191 --- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
   192 +++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
   193 @@ -45,6 +45,8 @@
   194  # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   195  # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   196  # define O_DIRECT	0200000	/* Direct disk access.	*/
   197 +# define O_NOATIME     01000000 /* Do not set atime.  */
   198 +# define O_CLOEXEC     02000000 /* set close_on_exec */
   199  #endif
   200  
   201  /* For now Linux has synchronisity options for data and read operations.
   202 diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
   203 index ef015a4..f0072fd 100644
   204 --- a/libc/sysdeps/linux/mips/bits/fcntl.h
   205 +++ b/libc/sysdeps/linux/mips/bits/fcntl.h
   206 @@ -51,6 +51,7 @@
   207  # define O_DIRECT	0x8000	/* Direct disk access hint.  */
   208  # define O_DIRECTORY	0x10000	/* Must be a directory.	 */
   209  # define O_NOATIME	0x40000	/* Do not set atime.  */
   210 +# define O_CLOEXEC	02000000 /* set close_on_exec */
   211  #endif
   212  
   213  /* For now Linux has no synchronisity options for data and read operations.
   214 diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
   215 index ceb75b4..0759c6a 100644
   216 --- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
   217 +++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
   218 @@ -50,9 +50,7 @@
   219  # define O_DIRECTORY	 040000	/* Must be a directory.	 */
   220  # define O_NOFOLLOW	0100000	/* Do not follow links.	 */
   221  # define O_NOATIME	01000000 /* Do not set atime.  */
   222 -# if 0
   223  # define O_CLOEXEC	02000000 /* Set close_on_exec.  */
   224 -# endif
   225  #endif
   226  
   227  #ifdef __USE_LARGEFILE64
   228 diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
   229 index 570484c..adb7377 100644
   230 --- a/libc/sysdeps/linux/sh/bits/fcntl.h
   231 +++ b/libc/sysdeps/linux/sh/bits/fcntl.h
   232 @@ -50,9 +50,7 @@
   233  # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   234  # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   235  # define O_NOATIME     01000000 /* Do not set atime.  */
   236 -# if 0
   237  # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   238 -# endif
   239  #endif
   240  
   241  /* For now Linux has synchronisity options for data and read operations.
   242 diff --git a/libc/sysdeps/linux/sh64/bits/fcntl.h b/libc/sysdeps/linux/sh64/bits/fcntl.h
   243 index 06e8860..245d35a 100644
   244 --- a/libc/sysdeps/linux/sh64/bits/fcntl.h
   245 +++ b/libc/sysdeps/linux/sh64/bits/fcntl.h
   246 @@ -45,6 +45,8 @@
   247  # define O_DIRECT	 040000	/* Direct disk access.  */
   248  # define O_DIRECTORY	0200000	/* Must be a directory.  */
   249  # define O_NOFOLLOW	0400000	/* Do not follow links.  */
   250 +# define O_NOATIME     01000000 /* Do not set atime.  */
   251 +# define O_CLOEXEC     02000000 /* set close_on_exec */
   252  #endif
   253  
   254  /* For now Linux has synchronisity options for data and read operations.
   255 diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
   256 index 29c09a9..31a6d9b 100644
   257 --- a/libc/sysdeps/linux/sparc/bits/fcntl.h
   258 +++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
   259 @@ -49,9 +49,7 @@
   260  # define O_NOFOLLOW	0x20000 /* don't follow links */
   261  # define O_DIRECT	0x100000 /* direct disk access hint */
   262  # define O_NOATIME	0x200000 /* Do not set atime.  */
   263 -# if 0
   264  # define O_CLOEXEC	0x400000 /* Set close_on_exit.  */
   265 -# endif
   266  #endif
   267  
   268  #ifdef __USE_LARGEFILE64
   269 diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
   270 index be00e4a..f1cf388 100644
   271 --- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
   272 +++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
   273 @@ -50,9 +50,7 @@
   274  # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   275  # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   276  # define O_NOATIME     01000000 /* Do not set atime.  */
   277 -# if 0
   278  # define O_CLOEXEC     02000000 /* Set close_on_exec.  */
   279 -# endif
   280  #endif
   281  
   282  /* For now Linux has synchronisity options for data and read operations.
   283 diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
   284 index a89362e..921a626 100644
   285 --- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
   286 +++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
   287 @@ -50,6 +50,7 @@
   288  # define O_DIRECTORY	0200000	/* Must be a directory.	 */
   289  # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
   290  # define O_NOATIME     01000000 /* Do not set atime.  */
   291 +# define O_CLOEXEC     02000000 /* set close_on_exec */
   292  #endif
   293  
   294  /* For now Linux has synchronisity options for data and read operations.
   295 -- 
   296 1.6.6.1
   297