diff mbox

[1/4] Consolidate Linux accept implementation

Message ID 102dbb40-69f8-4358-03b5-3ea9e6961a2e@linaro.org
State New
Headers show

Commit Message

Adhemerval Zanella Netto Feb. 8, 2017, 11:26 p.m. UTC
Thanks for the review.

On 08/02/2017 18:59, Phil Blundell wrote:
> On Mon, 2017-01-30 at 12:02 -0200, Adhemerval Zanella wrote:
>>
>>   2. Define __NR_acccept as default (__ASSUME_ACCEPT_SYSCALL) and
>> undef for
> 
> Too many "c"s in accept?

Ops, fixed on commit message localy.

> 
>> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> index 6811a28..f583ae7 100644
>> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> @@ -27,7 +27,6 @@
>>  # define __ASSUME_BIND_SYSCALL               1
>>  # define __ASSUME_CONNECT_SYSCALL            1
>>  # define __ASSUME_LISTEN_SYSCALL             1
>> -# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
>>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
>>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>> @@ -41,7 +40,10 @@
>>  
>>  #include_next <kernel-features.h>
>>  
>> +#undef __ASSUME_ACCEPT_SYSCALL
>> +
>>  #if __LINUX_KERNEL_VERSION < 0x040300
>> +# undef __ASSUME_ACCCEPT_SYSCALL
> 
> This is a bit odd.  __ASSUME_ACCCEPT_SYSCALL never seems to be defined
> anywhere that I can find, but you are explicitly undefining it for
> these old kernels.  I would have assumed it was a typo for
> __ASSUME_ACCEPT_SYSCALL if you weren't also undefining that one a
> couple of lines further up.  Can you clarify?
> 
> p.

With this patch it is now defined as based on:

Comments

Phil Blundell Feb. 9, 2017, 7:14 p.m. UTC | #1
On Wed, 2017-02-08 at 21:26 -0200, Adhemerval Zanella wrote:
> 
> And this snippet is indeed wrong as you pointed out, m68k (and any
> other
> architecture) just need to undef is for kernel < 4.3 as:
> 
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 6811a28..0f31f86 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -27,7 +27,6 @@
>  # define __ASSUME_BIND_SYSCALL               1
>  # define __ASSUME_CONNECT_SYSCALL            1
>  # define __ASSUME_LISTEN_SYSCALL             1
> -# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
>  # define __ASSUME_GETSOCKOPT_SYSCALL         1
>  # define __ASSUME_SETSOCKOPT_SYSCALL         1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> @@ -42,6 +41,7 @@
>  #include_next <kernel-features.h>
> 
>  #if __LINUX_KERNEL_VERSION < 0x040300
> +# undef __ASSUME_ACCCEPT_SYSCALL
>  # undef __ASSUME_ACCEPT4_SYSCALL
>  # undef __ASSUME_RECVMMSG_SYSCALL
>  # undef __ASSUME_SENDMMSG_SYSCALL

Thanks, that makes sense.  I think you've still got too many "C"s in
"ACCEPT" in that last hunk above though.

p.
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 08485cd..78b091b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -147,6 +147,7 @@ 
    separate syscalls were only added later.  */
 #define __ASSUME_SENDMSG_SYSCALL       1
 #define __ASSUME_RECVMSG_SYSCALL       1
+#define __ASSUME_ACCEPT_SYSCALL                1

 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */

And this snippet is indeed wrong as you pointed out, m68k (and any other
architecture) just need to undef is for kernel < 4.3 as:

diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 6811a28..0f31f86 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -27,7 +27,6 @@ 
 # define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_CONNECT_SYSCALL            1
 # define __ASSUME_LISTEN_SYSCALL             1
-# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
 # define __ASSUME_GETSOCKOPT_SYSCALL         1
 # define __ASSUME_SETSOCKOPT_SYSCALL         1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
@@ -42,6 +41,7 @@ 
 #include_next <kernel-features.h>

 #if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCCEPT_SYSCALL
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
 # undef __ASSUME_SENDMMSG_SYSCALL