diff options
author | Joseph Myers <joseph@codesourcery.com> | 2014-06-20 23:22:08 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2014-06-20 23:22:08 +0000 |
commit | d7109027508c8ef5f4218abc737fcb1a411c2bd3 (patch) | |
tree | 728ba80e4c799382361d2ecc8b9472d1392188fe /nptl | |
parent | d92d8f8a42b5623e98a5f83775015a7907029884 (diff) | |
download | glibc-d7109027508c8ef5f4218abc737fcb1a411c2bd3.tar.gz glibc-d7109027508c8ef5f4218abc737fcb1a411c2bd3.tar.xz glibc-d7109027508c8ef5f4218abc737fcb1a411c2bd3.zip |
Remove __ASSUME_SOCK_CLOEXEC / SOCK_CLOEXEC conditionals in Linux-specific code.
This patch removes conditionals on __ASSUME_SOCK_CLOEXEC, and on SOCK_CLOEXEC being defined, in Linux-specific code, now that all supported Linux kernel versions can be assumed to have this functionality. (The macro is also used in OS-independent code and is not defined for Hurd.) Tested x86_64 that the disassembly of installed shared libraries is unchanged by this patch. * nptl/sysdeps/unix/sysv/linux/mq_notify.c: Do not include <kernel-features.h>. (init_mq_netlink): Remove conditional have_sock_cloexec definitions. Remove code conditional on have_sock_cloexec < 0. (init_mq_netlink) [!SOCK_CLOEXEC]: Remove conditional code. (init_mq_netlink) [!__ASSUME_SOCK_CLOEXEC]: Likewise. * sysdeps/unix/sysv/linux/opensock.c: Do not include <kernel-features.h>. (__opensock) [SOCK_CLOEXEC]: Make code unconditional. (__opensock) [!__ASSUME_SOCK_CLOEXEC]: Remove conditional code.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/mq_notify.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/mq_notify.c b/nptl/sysdeps/unix/sysv/linux/mq_notify.c index 3138ad2c3c..6893d8ced8 100644 --- a/nptl/sysdeps/unix/sysv/linux/mq_notify.c +++ b/nptl/sysdeps/unix/sysv/linux/mq_notify.c @@ -28,7 +28,6 @@ #include <unistd.h> #include <sys/socket.h> #include <not-cancel.h> -#include <kernel-features.h> #include <nptl/pthreadP.h> @@ -153,41 +152,15 @@ 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. */ - 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); + netlink_socket = socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 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 (have_sock_cloexec < 0 - && fcntl (netlink_socket, F_SETFD, FD_CLOEXEC) != 0) - goto errout; } int err = 1; |