diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-07-28 23:34:19 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2008-07-28 23:34:19 +0000 |
commit | c7045198ca8f4ff5b97205340d51127f8503c2bd (patch) | |
tree | 387ee7a78760f683df6035af28d665e3972aa30b /nptl/sysdeps | |
parent | c83494a925f4b4b716f9ba3abcb5e695d3e2a8a9 (diff) |
Updated to fedora-glibc-20080728T2320cvs/fedora-glibc-2_8_90-10
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r-- | nptl/sysdeps/powerpc/tcb-offsets.sym | 2 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/mq_notify.c | 29 |
2 files changed, 28 insertions, 3 deletions
diff --git a/nptl/sysdeps/powerpc/tcb-offsets.sym b/nptl/sysdeps/powerpc/tcb-offsets.sym index eda43dce8e..8ac133dfd0 100644 --- a/nptl/sysdeps/powerpc/tcb-offsets.sym +++ b/nptl/sysdeps/powerpc/tcb-offsets.sym @@ -15,4 +15,6 @@ MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) PID thread_offsetof (pid) TID thread_offsetof (tid) POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) +#ifndef __ASSUME_PRIVATE_FUTEX PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex) +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c index 2ec11bf686..49ddeae052 100644 --- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c +++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contribute by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -29,6 +29,7 @@ #include <unistd.h> #include <sys/socket.h> #include <not-cancel.h> +#include <kernel-features.h> #ifdef __NR_mq_notify @@ -152,18 +153,40 @@ reset_once (void) static void init_mq_netlink (void) { +#ifdef SOCK_CLOEXEC +# ifndef __ASSUME_SOCK_CLOEXEC + static int have_sock_cloexec; +# else +# define have_sock_cloexec 1 +# endif +#else +# define have_sock_cloexec -1 +# define SOCK_CLOEXEC 0 +#endif + /* This code might be called a second time after fork(). The file descriptor is inherited from the parent. */ if (netlink_socket == -1) { /* Just a normal netlink socket, not bound. */ - netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0); + if (have_sock_cloexec >= 0) + { + netlink_socket = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0); +#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC + if (have_sock_cloexec == 0) + have_sock_cloexec = (netlink_socket != -1 || errno != EINVAL + ? 1 : -1); +#endif + } + if (have_sock_cloexec < 0) + netlink_socket = socket (AF_NETLINK, SOCK_RAW, 0); /* No need to do more if we have no socket. */ if (netlink_socket == -1) return; /* Make sure the descriptor is closed on exec. */ - if (fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0) + if (have_sock_cloexec < 0 + && fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0) goto errout; } |