klibc-bot for Ben Hutchings
2024-Oct-07 21:36 UTC
[klibc] [klibc:master] syscalls: Remove _KLIBC_SYS_SOCKETCALL config macro
Commit-ID: dcc395811cec4050ab7210d50b722070b2280d4a Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=dcc395811cec4050ab7210d50b722070b2280d4a Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Tue, 1 Oct 2024 21:33:23 +0200 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Wed, 2 Oct 2024 02:59:29 +0200 [klibc] syscalls: Remove _KLIBC_SYS_SOCKETCALL config macro>From Linux 1.3.44 to 2.6.25, the sparc port implemented separatesystem calls for socket(), connect(), etc. in its SunOS personality. The system call numbers were defined in <asm/unistd.h> header even though they were not implemented for native Linux programs. As a workaround for this, commit 8594ecec842d ("[klibc] sparc, sparc64 use sys_socketcall unconditionally") added a macro to override automatic detection of these system calls and defined that on these architectures. No other architecture ever needed this, and since Linux 4.20 all of those system calls are now implemented. We can therefore remove the use of this macro. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/arch/sparc/klibc/archconfig.h | 2 -- usr/include/arch/sparc64/klibc/archconfig.h | 1 - usr/include/klibc/sysconfig.h | 11 ----------- usr/klibc/SYSCALLS.def | 2 -- usr/klibc/accept.c | 2 +- usr/klibc/socketcalls.pl | 8 ++------ 6 files changed, 3 insertions(+), 23 deletions(-) diff --git a/usr/include/arch/sparc/klibc/archconfig.h b/usr/include/arch/sparc/klibc/archconfig.h index bdc8b1e4..e84a02b2 100644 --- a/usr/include/arch/sparc/klibc/archconfig.h +++ b/usr/include/arch/sparc/klibc/archconfig.h @@ -9,8 +9,6 @@ #ifndef _KLIBC_ARCHCONFIG_H #define _KLIBC_ARCHCONFIG_H -#define _KLIBC_SYS_SOCKETCALL 1 /* Use sys_socketcall unconditionally */ - /* So that we can avoid stack trampolines */ #define _KLIBC_NEEDS_SA_RESTORER 1 /* Our restorer will call rt_sigreturn() */ diff --git a/usr/include/arch/sparc64/klibc/archconfig.h b/usr/include/arch/sparc64/klibc/archconfig.h index df5c8064..c469e87f 100644 --- a/usr/include/arch/sparc64/klibc/archconfig.h +++ b/usr/include/arch/sparc64/klibc/archconfig.h @@ -10,6 +10,5 @@ #define _KLIBC_ARCHCONFIG_H #define _KLIBC_NEEDS_SA_RESTORER 1 /* Need a restorer function */ -#define _KLIBC_SYS_SOCKETCALL 1 /* Use sys_socketcall unconditionally */ #endif /* _KLIBC_ARCHCONFIG_H */ diff --git a/usr/include/klibc/sysconfig.h b/usr/include/klibc/sysconfig.h index 636c3c08..c65ac94a 100644 --- a/usr/include/klibc/sysconfig.h +++ b/usr/include/klibc/sysconfig.h @@ -187,17 +187,6 @@ #endif -/* - * _KLIBC_SYS_SOCKETCALL - * - * This architecture (e.g. SPARC) advertises socket-related - * system calls, which are not actually implemented. Use - * socketcalls unconditionally instead. - */ -#ifndef _KLIBC_SYS_SOCKETCALL -# define _KLIBC_SYS_SOCKETCALL 0 -#endif - /* * _KLIBC_ARM_USE_BX * diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def index bbf39c0e..b3b269ca 100644 --- a/usr/klibc/SYSCALLS.def +++ b/usr/klibc/SYSCALLS.def @@ -263,6 +263,4 @@ long kexec_load(void *, unsigned long, struct kexec_segment *, unsigned long); * system calls. */ <?!i386> long socketcall::__socketcall(int, const unsigned long *); -#if ! _KLIBC_SYS_SOCKETCALL #include "SOCKETCALLS.def" -#endif diff --git a/usr/klibc/accept.c b/usr/klibc/accept.c index 60575446..443c2fe9 100644 --- a/usr/klibc/accept.c +++ b/usr/klibc/accept.c @@ -6,7 +6,7 @@ #include <sys/socket.h> -#if !_KLIBC_SYS_SOCKETCALL && defined(__NR_accept4) && !defined(__NR_accept) +#if defined(__NR_accept4) && !defined(__NR_accept) int accept(int socket, struct sockaddr *address, socklen_t *addr_len) { diff --git a/usr/klibc/socketcalls.pl b/usr/klibc/socketcalls.pl index 70ded0b0..8e4fe9fc 100644 --- a/usr/klibc/socketcalls.pl +++ b/usr/klibc/socketcalls.pl @@ -47,15 +47,11 @@ while ( defined($line = <FILE>) ) { print OUT "#include \"socketcommon.h\"\n"; print OUT "\n"; - print OUT "#if _KLIBC_SYS_SOCKETCALL\n"; - print OUT "# define DO_THIS_SOCKETCALL\n"; - print OUT "#else\n"; - print OUT "# if !defined(__NR_${name})"; + print OUT "#if !defined(__NR_${name})"; if ($name eq 'accept') { print OUT " && !defined(__NR_accept4)"; } - print OUT "\n# define DO_THIS_SOCKETCALL\n"; - print OUT "# endif\n"; + print OUT "\n# define DO_THIS_SOCKETCALL\n"; print OUT "#endif\n\n"; print OUT "#if defined(DO_THIS_SOCKETCALL) && defined(SYS_\U${name}\E)\n\n";