CLEANUP: drop support for USE_MY_ACCEPT4

The accept4() syscall has been present for a while now, there is no more
reason for maintaining our own arch-specific syscall implementation for
systems lacking it in libc but having it in the kernel.
This commit is contained in:
Willy Tarreau 2020-03-10 07:02:46 +01:00
parent c3e926bf3b
commit 618ac6ea52
4 changed files with 1 additions and 90 deletions

View File

@ -39,7 +39,6 @@
# USE_LUA : enable Lua support.
# USE_FUTEX : enable use of futex on kernel 2.6. Automatic.
# USE_ACCEPT4 : enable use of accept4() on linux. Automatic.
# USE_MY_ACCEPT4 : use own implementation of accept4() if glibc < 2.10.
# USE_PRCTL : enable use of prctl(). Automatic.
# USE_ZLIB : enable zlib library support.
# USE_SLZ : enable slz library instead of zlib (pick at most one).
@ -290,7 +289,7 @@ use_opts = USE_EPOLL USE_KQUEUE USE_MY_EPOLL USE_MY_SPLICE USE_NETFILTER \
USE_STATIC_PCRE USE_STATIC_PCRE2 USE_TPROXY USE_LINUX_TPROXY \
USE_LINUX_SPLICE USE_LIBCRYPT USE_CRYPT_H \
USE_GETADDRINFO USE_OPENSSL USE_LUA USE_FUTEX USE_ACCEPT4 \
USE_MY_ACCEPT4 USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS \
USE_ZLIB USE_SLZ USE_CPU_AFFINITY USE_TFO USE_NS \
USE_DL USE_RT USE_DEVICEATLAS USE_51DEGREES USE_WURFL USE_SYSTEMD \
USE_OBSOLETE_LINKER USE_PRCTL USE_THREAD_DUMP USE_EVPORTS

View File

@ -1,69 +0,0 @@
/*
* include/common/accept4.h
* Definition of the accept4 system call for older Linux libc.
*
* Copyright 2000-2012 Willy Tarreau <w@1wt.eu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _COMMON_ACCEPT4_H
#define _COMMON_ACCEPT4_H
#if defined (__linux__) && defined(USE_ACCEPT4)
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <common/syscall.h>
/* On recent Linux kernels, the accept4() syscall may be used to avoid an fcntl()
* call to set O_NONBLOCK on the resulting socket. It was introduced in Linux
* 2.6.28 and is not present in older libcs.
*/
#ifndef SOCK_NONBLOCK
#define SOCK_NONBLOCK O_NONBLOCK
#endif
#if defined(USE_MY_ACCEPT4) || (!defined(SYS_ACCEPT4) && !defined(__NR_accept4))
#if ACCEPT4_USE_SOCKETCALL
static inline _syscall2(int, socketcall, int, call, unsigned long *, args);
static int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
{
unsigned long args[4];
args[0] = (unsigned long)sockfd;
args[1] = (unsigned long)addr;
args[2] = (unsigned long)addrlen;
args[3] = (unsigned long)flags;
return socketcall(SYS_ACCEPT4, args);
}
#else
static inline _syscall4(int, accept4, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags);
#endif /* ACCEPT4_USE_SOCKETCALL etc... */
#endif /* USE_MY_ACCEPT4 */
#endif /* __linux__ && USE_ACCEPT4 */
#endif /* _COMMON_ACCEPT4_H */
/*
* Local variables:
* c-indent-level: 8
* c-basic-offset: 8
* End:
*/

View File

@ -130,24 +130,6 @@
#endif /* $arch */
#endif /* __NR_splice */
/* accept4() appeared in Linux 2.6.28, but it might not be in all libcs. Some
* archs have it as a native syscall, other ones use the socketcall instead.
*/
#ifndef __NR_accept4
#if defined(__x86_64__)
#define __NR_accept4 288
#elif defined(__sparc__) || defined(__sparc64__)
#define __NR_accept4 323
#elif defined(__arm__) || defined(__thumb__)
#define __NR_accept4 (__NR_SYSCALL_BASE+366)
#else
#define ACCEPT4_USE_SOCKETCALL 1
#ifndef SYS_ACCEPT4
#define SYS_ACCEPT4 18
#endif /* SYS_ACCEPT4 */
#endif /* $arch */
#endif /* __NR_accept4 */
#endif /* __linux__ */
#endif /* _COMMON_SYSCALL_H */

View File

@ -18,7 +18,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <common/accept4.h>
#include <common/cfgparse.h>
#include <common/config.h>
#include <common/errors.h>