about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2016-10-26 18:24:53 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2016-12-28 20:31:05 -0200
commit50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294 (patch)
treea9e8d61795329162b05005171ada1d62cb997c7d
parent214f017fdfce8d4d05062aa1babe6066d3e39d6f (diff)
downloadglibc-50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294.tar.gz
glibc-50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294.tar.xz
glibc-50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294.zip
Use shmget syscall for linux implementation
this patch add a direct call to shmget syscall if it is supported by
kernel features.

Checked on x86_64, i686, powerpc64le, aarch64, and armhf.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove.
	* sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmget):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmget):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmget): Likewise.
	* sysdeps/unix/sysv/linux/shmget.c (shmget): Use shmget syscall if it
	is defined.
-rw-r--r--ChangeLog14
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/arm/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/generic/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/shmget.c13
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/syscalls.list1
11 files changed, 21 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index d6505cd964..041262c5dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2016-12-28  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmget): Remove.
+	* sysdeps/unix/sysv/linux/arm/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/generic/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmget):
+	Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmget):
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmget): Likewise.
+	* sysdeps/unix/sysv/linux/shmget.c (shmget): Use shmget syscall if it
+	is defined.
+
 	* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmdt): Remove.
 	* sysdeps/unix/sysv/linux/arm/syscalls.list (shmdt): Likewise.
 	* sysdeps/unix/sysv/linux/generic/syscalls.list (shmdt): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 096bf229cc..4001020a6f 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-shmget		-	shmget		i:iii	__shmget	shmget
-
 sigstack	-	sigstack	2	sigstack
 
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index b1ea6641f3..0263eee406 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -21,10 +21,6 @@ fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
 personality	EXTRA	personality	Ei:i	__personality	personality
 
-# Semaphore and shm system calls.  msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget		-	shmget		i:iii	__shmget	shmget
-
 # proper socket implementations:
 accept		-	accept		Ci:iBN	__libc_accept	__accept accept
 bind		-	bind		i:ipi	__bind		bind
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 51ce148159..3bb547303e 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,8 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-# SysV APIs
-shmget		-	shmget		i:iii	__shmget	shmget
-
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index e75dd43566..6d47b11f8a 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,8 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-# semaphore and shm system calls
-shmget		-	shmget		i:iii	__shmget	shmget
-
 # proper socket implementations:
 accept		-	accept		Ci:iBN	__libc_accept	__accept accept
 bind		-	bind		i:ipi	__bind		bind
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 5ebade1121..dd07db3539 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -4,9 +4,6 @@ umount2		-	umount		2	__umount2	umount2
 
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
-# semaphore and shm system calls
-shmget		-	shmget		i:iii	__shmget	shmget
-
 # proper socket implementations:
 accept		-	accept		Ci:iBN	__libc_accept	__accept accept
 bind		-	bind		i:ipi	__bind		bind
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 7a5666f270..932c9cccc8 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -5,7 +5,3 @@ cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 personality	EXTRA	personality	Ei:i	__personality	personality
-
-# Semaphore and shm system calls.  msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget          -       shmget          i:iii   __shmget        shmget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
deleted file mode 100644
index e8e381bde3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-# Semaphore and shm system calls.  msgctl, shmctl, and semctl have C
-# wrappers (to set __IPC_64).
-shmget		-	shmget		i:iii	__shmget	shmget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
deleted file mode 100644
index 0ccbffa47d..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name     Caller  Syscall name    # args  Strong name     Weak names
-
-# semaphore and shm system calls
-shmget          -       shmget          i:iii   __shmget        shmget
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index bd624fc40b..2cea6960d1 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -16,13 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <sys/shm.h>
+#include <sys/msg.h>
 #include <ipc_priv.h>
-#include <stdlib.h>		/* for definition of NULL */
-
 #include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
 
 /* Return an identifier for an shared memory segment of at least size SIZE
    which is associated with KEY.  */
@@ -30,5 +27,9 @@
 int
 shmget (key_t key, size_t size, int shmflg)
 {
-  return INLINE_SYSCALL (ipc, 5, IPCOP_shmget, key, size, shmflg, NULL);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+  return INLINE_SYSCALL_CALL (shmget, key, size, shmflg, NULL);
+#else
+  return INLINE_SYSCALL_CALL (ipc, IPCOP_shmget, key, size, shmflg, NULL);
+#endif
 }
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index cb1a9f97f8..45d5ebf59b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,6 @@ pread64		-	pread64		Ci:ipii	__libc_pread	__libc_pread64 __pread64 pread64 __prea
 preadv64	-	preadv		Ci:ipii	preadv64	preadv
 pwrite64	-	pwrite64	Ci:ipii	__libc_pwrite	__libc_pwrite64 __pwrite64 pwrite64 __pwrite pwrite
 pwritev64	-	pwritev		Ci:ipii	pwritev64	pwritev
-shmget		-	shmget		i:iii	__shmget	shmget
 syscall_clock_gettime	EXTRA	clock_gettime	Ei:ip		__syscall_clock_gettime