diff options
author | Roland McGrath <roland@gnu.org> | 2007-08-10 21:54:57 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2007-08-10 21:54:57 +0000 |
commit | 4839a27f7344c276a2084712b65b1cc5ca3d2da4 (patch) | |
tree | 53edf35eaf212bb29ce1ba8adb3349ec79157d08 /sysdeps | |
parent | a7db33c68fffef1bbc9894a1dab7e52b8bc7bdef (diff) | |
download | glibc-4839a27f7344c276a2084712b65b1cc5ca3d2da4.tar glibc-4839a27f7344c276a2084712b65b1cc5ca3d2da4.tar.gz glibc-4839a27f7344c276a2084712b65b1cc5ca3d2da4.tar.bz2 glibc-4839a27f7344c276a2084712b65b1cc5ca3d2da4.zip |
Updated to fedora-glibc-20070810T2152
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/strtold_l.c | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/bits/fcntl.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/shm_open.c | 55 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/fcntl.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S | 2 |
5 files changed, 48 insertions, 21 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c index d84c0aee24..670d80ce02 100644 --- a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c +++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c @@ -57,10 +57,12 @@ libc_hidden_proto (STRTOF) #ifdef __LONG_DOUBLE_MATH_OPTIONAL # include <math_ldbl_opt.h> # ifdef USE_WIDE_CHAR -long_double_symbol (libc, __new_wcstold_l, wcstold_l); +weak_alias (____new_wcstold_l, ___new_wcstold_l); +long_double_symbol (libc, ___new_wcstold_l, wcstold_l); long_double_symbol (libc, ____new_wcstold_l, __wcstold_l); # else -long_double_symbol (libc, __new_strtold_l, strtold_l); +weak_alias (____new_strtold_l, ___new_strtold_l); +long_double_symbol (libc, ___new_strtold_l, strtold_l); long_double_symbol (libc, ____new_strtold_l, __strtold_l); # endif #endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h index f17dc2bdc1..b4f49cf633 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux. - Copyright (C) 1995-2000, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2000,2004,2005,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,7 @@ # define O_NOFOLLOW 0200000 /* Do not follow links. */ # define O_DIRECT 02000000 /* Direct disk access. */ # define O_NOATIME 04000000 /* Do not set atime. */ +# define O_CLOEXEC 010000000 /* Set close_on_exec. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c index 0d40632e5f..0628427680 100644 --- a/sysdeps/unix/sysv/linux/shm_open.c +++ b/sysdeps/unix/sysv/linux/shm_open.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-2004,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,6 +46,11 @@ static const char defaultdir[] = "/dev/shm/"; __libc_once_define (static, once); +#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC +static bool have_o_cloexec; +#endif + + /* Determine where the shmfs is mounted (if at all). */ static void where_is_shmfs (void) @@ -160,6 +165,10 @@ shm_open (const char *name, int oflag, mode_t mode) __mempcpy (__mempcpy (fname, mountpoint.dir, mountpoint.dirlen), name, namelen + 1); +#ifdef O_CLOEXEC + oflag |= O_CLOEXEC; +#endif + /* And get the file descriptor. XXX Maybe we should test each descriptor whether it really is for a file on the shmfs. If this is what should be done the whole function @@ -168,23 +177,37 @@ shm_open (const char *name, int oflag, mode_t mode) fd = open (fname, oflag | O_NOFOLLOW, mode); if (fd != -1) { - /* We got a descriptor. Now set the FD_CLOEXEC bit. */ - int flags = fcntl (fd, F_GETFD, 0); - - if (__builtin_expect (flags, 0) >= 0) +#if !defined O_CLOEXEC || !defined __ASSUME_O_CLOEXEC +# ifdef O_CLOEXEC + if (have_o_cloexec <= 0) +# endif { - flags |= FD_CLOEXEC; - flags = fcntl (fd, F_SETFD, flags); - } - - if (flags == -1) - { - /* Something went wrong. We cannot return the descriptor. */ - int save_errno = errno; - close (fd); - fd = -1; - __set_errno (save_errno); + /* We got a descriptor. Now set the FD_CLOEXEC bit. */ + int flags = fcntl (fd, F_GETFD, 0); + + if (__builtin_expect (flags, 0) >= 0) + { +# ifndef O_CLOEXEC + if (have_o_cloexec == 0) + have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1; + if (have_o_cloexec < 0) +# endif + { + flags |= FD_CLOEXEC; + flags = fcntl (fd, F_SETFD, flags); + } + } + + if (flags == -1) + { + /* Something went wrong. We cannot return the descriptor. */ + int save_errno = errno; + close (fd); + fd = -1; + __set_errno (save_errno); + } } +#endif } else if (__builtin_expect (errno == EISDIR, 0)) /* It might be better to fold this error with EINVAL since diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h index d68bfeb0ef..2307a2353d 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h @@ -1,5 +1,5 @@ /* O_*, F_*, FD_* bit values for Linux/SPARC. - Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006 + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -49,6 +49,7 @@ # define O_NOFOLLOW 0x20000 /* don't follow links */ # define O_DIRECT 0x100000 /* direct disk access hint */ # define O_NOATIME 0x200000 /* Do not set atime. */ +# define O_CLOEXEC 0x400000 /* Set close_on_exit. */ #endif #ifdef __USE_LARGEFILE64 diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S index 8d74d53a76..a950990627 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S +++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S @@ -38,7 +38,7 @@ ENTRY (sched_getcpu) movq $VSYSCALL_ADDR_vgetcpu, %rax callq *%rax - cmpq $-4095, %rdi + cmpq $-4095, %rax jae SYSCALL_ERROR_LABEL movl (%rsp), %eax |