Patchwork [v2,2/2] Use direct socket syscalls for new kernels on sparc

login
register
mail settings
Submitter Aurelien Jarno
Date March 2, 2016, 8:25 a.m.
Message ID <1456907123-6199-3-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/11165/
State New
Headers show

Comments

Aurelien Jarno - March 2, 2016, 8:25 a.m.
Direct socket syscalls have been added in kernel 4.4 on sparc for
bind, listen and setsockopt. Other direct socket syscalls were present
before kernel 3.2 and are listed directly in syscalls.list, so there is
no need to add them there.

Changelog:
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_BIND_SYSCALL):
	New macro.
	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_LISTEN_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_SETSOCKOPT_SYSCALL):
	Likewise.
---
 ChangeLog                                       | 7 +++++++
 sysdeps/unix/sysv/linux/sparc/kernel-features.h | 7 +++++++
 2 files changed, 14 insertions(+)
Joseph Myers - March 2, 2016, 2:52 p.m.
On Wed, 2 Mar 2016, Aurelien Jarno wrote:

> Direct socket syscalls have been added in kernel 4.4 on sparc for
> bind, listen and setsockopt. Other direct socket syscalls were present
> before kernel 3.2 and are listed directly in syscalls.list, so there is
> no need to add them there.

Listed directly in syscalls.list for sparc64.  Don't they need __ASSUME_* 
adding for sparc32?

(In a few years' time we'll be able to assume 4.4 everywhere, eliminate 
all socketcall support and use entries in sysdeps/unix/syscalls.list for 
many of these syscalls.)
Aurelien Jarno - March 3, 2016, 7:58 a.m.
On 2016-03-02 14:52, Joseph Myers wrote:
> On Wed, 2 Mar 2016, Aurelien Jarno wrote:
> 
> > Direct socket syscalls have been added in kernel 4.4 on sparc for
> > bind, listen and setsockopt. Other direct socket syscalls were present
> > before kernel 3.2 and are listed directly in syscalls.list, so there is
> > no need to add them there.
> 
> Listed directly in syscalls.list for sparc64.  Don't they need __ASSUME_* 
> adding for sparc32?

Yes, I think they need that. I looked at the exact list, and it seems
that the send syscall is not provided on sparc. Does it means we should
also define __ASSUME_SENDTO_FOR_SEND_SYSCALL and remove it from
syscalls.list?
Joseph Myers - March 3, 2016, 10:42 p.m.
On Thu, 3 Mar 2016, Aurelien Jarno wrote:

> On 2016-03-02 14:52, Joseph Myers wrote:
> > On Wed, 2 Mar 2016, Aurelien Jarno wrote:
> > 
> > > Direct socket syscalls have been added in kernel 4.4 on sparc for
> > > bind, listen and setsockopt. Other direct socket syscalls were present
> > > before kernel 3.2 and are listed directly in syscalls.list, so there is
> > > no need to add them there.
> > 
> > Listed directly in syscalls.list for sparc64.  Don't they need __ASSUME_* 
> > adding for sparc32?
> 
> Yes, I think they need that. I looked at the exact list, and it seems
> that the send syscall is not provided on sparc. Does it means we should
> also define __ASSUME_SENDTO_FOR_SEND_SYSCALL and remove it from
> syscalls.list?

If the non-socketcall way of implementing a socket function on a given 
architecture involves use of a different syscall, then the appropriate one 
of __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL, __ASSUME_SENDTO_FOR_SEND_SYSCALL, 
__ASSUME_RECVFROM_FOR_RECV_SYSCALL should be defined under the relevant 
conditions for the syscall in question to be available (and there should 
not be a syscalls.list entry for the syscall that does not exist).  I have 
not reviewed exactly what is right for sparc32 and sparc64 in this regard.
>

Patch

diff --git a/ChangeLog b/ChangeLog
index f01786b..65aef07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@ 
 
 	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (bind, listen,
 	setsockopt): Remove.
+	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
+	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_BIND_SYSCALL):
+	New macro.
+	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_LISTEN_SYSCALL):
+	Likewise.
+	[__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_SETSOCKOPT_SYSCALL):
+	Likewise.
 
 2016-03-01  H.J. Lu  <hongjiu.lu@intel.com>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 3a7baa7..6a40cfc 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -32,6 +32,13 @@ 
 #define __ASSUME_SENDMMSG_SYSCALL	1
 #define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL	1
 
+/* Direct socketcalls available for SPARC in 4.4.  */
+#if __LINUX_KERNEL_VERSION >= 0x040400
+# define __ASSUME_BIND_SYSCALL		1
+# define __ASSUME_LISTEN_SYSCALL	1
+# define __ASSUME_SETSOCKOPT_SYSCALL	1
+#endif
+
 #include_next <kernel-features.h>
 
 /* 32-bit SPARC kernels do not support