mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
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.
This commit is contained in:
@ -21,7 +21,6 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <kernel-features.h>
|
||||
|
||||
/* Return a socket of any type. The socket can be used in subsequent
|
||||
ioctl calls to talk to the kernel. */
|
||||
@ -63,24 +62,7 @@ __opensock (void)
|
||||
{
|
||||
assert (last_type != 0);
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
# ifndef __ASSUME_SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec >= 0)
|
||||
# endif
|
||||
{
|
||||
result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
|
||||
# ifndef __ASSUME_SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec == 0)
|
||||
__have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
#ifndef __ASSUME_SOCK_CLOEXEC
|
||||
# ifdef SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec < 0)
|
||||
# endif
|
||||
result = __socket (last_family, last_type, 0);
|
||||
#endif
|
||||
result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
|
||||
if (result != -1 || errno != EAFNOSUPPORT)
|
||||
/* Maybe the socket type isn't supported anymore (module is
|
||||
unloaded). In this case again try to find the type. */
|
||||
@ -115,24 +97,7 @@ __opensock (void)
|
||||
if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25)
|
||||
type = SOCK_SEQPACKET;
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
# ifndef __ASSUME_SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec >= 0)
|
||||
# endif
|
||||
{
|
||||
result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
|
||||
# ifndef __ASSUME_SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec == 0)
|
||||
__have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
#ifndef __ASSUME_SOCK_CLOEXEC
|
||||
# ifdef SOCK_CLOEXEC
|
||||
if (__have_sock_cloexec < 0)
|
||||
# endif
|
||||
result = __socket (afs[cnt].family, type, 0);
|
||||
#endif
|
||||
result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
|
||||
if (result != -1)
|
||||
{
|
||||
/* Found an available family. */
|
||||
|
Reference in New Issue
Block a user