This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.24-562-ga9b0101
- From: azanella at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 28 Dec 2016 22:32:50 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.24-562-ga9b0101
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via a9b0101475c9894f210e20efa9738eba56d33f19 (commit)
via 50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294 (commit)
via 214f017fdfce8d4d05062aa1babe6066d3e39d6f (commit)
via e01f79e4126f5d21a0f83cee83b156fe5ad39940 (commit)
via 8232e7d2097eb8e5ca5548ff1ae3f7257f274a87 (commit)
via 1afc369f1aa153ffcfbc50b4e840bdf5746b705d (commit)
via 38cee35b0c30b4eba605f8402a21251d3da1f512 (commit)
via 0f971840201bcb27247a8d8f53621197396262cd (commit)
via d29f6bcdcc11d81e20c5880f5e1d7588cef950f7 (commit)
via 40c0a780687b3387e02caadc8545b21347cffc7e (commit)
via 59c900c54b8db3638bc5e9e90784552aab4e2df4 (commit)
via 2182a151a7bc0ca971bdfd1bddc4b7180172ac8b (commit)
via 692fe43ae2c91194ca8b1e22ce5edcdcf30986d2 (commit)
via dee23189ae6201b553cf0e0f7ee69ce9be95fbe1 (commit)
via 356c0aabd0191cdd7287ccf1ec8bbaa4862a0823 (commit)
via 1e5834c38a22bc6bee7bae4347f21baee5196724 (commit)
via 63719cf1e378b1a01ec6a36cf0ab7462cfb7a6c6 (commit)
from 5e628dd118807981bdd880731e6fdf019f64a245 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a9b0101475c9894f210e20efa9738eba56d33f19
commit a9b0101475c9894f210e20efa9738eba56d33f19
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Oct 31 11:22:43 2016 -0200
Add SYSV shared memory test
This patch adds a simple SYSV shared memory test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvshm.
* sysvipc/test-sysvshm.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 041262c..60b905d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysvipc/Makefile (tests): Add test-sysvshm.
+ * sysvipc/test-sysvshm.c: New file.
+
* 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.
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 32d64dc..daede74 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,7 +30,7 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
-tests := test-sysvmsg test-sysvsem
+tests := test-sysvmsg test-sysvsem test-sysvshm
include ../Rules
diff --git a/sysvipc/test-sysvshm.c b/sysvipc/test-sysvshm.c
new file mode 100644
index 0000000..5612863
--- /dev/null
+++ b/sysvipc/test-sysvshm.c
@@ -0,0 +1,131 @@
+/* Basic tests for SYSV shared memory functions.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include <support/support.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int shmid;
+
+static void
+remove_shm (void)
+{
+ /* Enforce message queue removal in case of early test failure.
+ Ignore error since the shm may already have being removed. */
+ shmctl (shmid, IPC_RMID, 0);
+}
+
+static void
+do_prepare (int argc, char *argv[])
+{
+ int fd = create_temp_file ("tst-sysvshm.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+#define PREPARE do_prepare
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define CHECK_EQ(v, k) \
+ if ((v) != (k)) \
+ FAIL_EXIT1("%d != %d", v, k)
+
+#define SHM_MODE 0666
+
+static int
+do_test (void)
+{
+ atexit (remove_shm);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ long int pgsz = sysconf (_SC_PAGESIZE);
+ if (pgsz == -1)
+ FAIL_EXIT1 ("sysconf (_SC_PAGESIZE) failed (errno = %d)", errno);
+
+ shmid = shmget(key, pgsz, IPC_CREAT | IPC_EXCL | SHM_MODE);
+ if (shmid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("shmget not supported");
+ FAIL_EXIT1 ("shmget failed (errno=%d)", errno);
+ }
+
+ /* Get shared memory kernel information and do some sanity checks. */
+ struct shmid_ds shminfo;
+ if (shmctl (shmid, IPC_STAT, &shminfo) == -1)
+ FAIL_EXIT1 ("shmctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (shminfo.shm_perm.__key != key)
+ FAIL_EXIT1 ("shmid_ds::shm_perm::key (%d) != %d",
+ (int) shminfo.shm_perm.__key, (int) key);
+ if (shminfo.shm_perm.mode != SHM_MODE)
+ FAIL_EXIT1 ("shmid_ds::shm_perm::mode (%o) != %o",
+ shminfo.shm_perm.mode, SHM_MODE);
+ if (shminfo.shm_segsz != pgsz)
+ FAIL_EXIT1 ("shmid_ds::shm_segsz (%lu) != %lu",
+ (long unsigned) shminfo.shm_segsz, pgsz);
+
+ /* Attach on shared memory and realize some operations. */
+ int *shmem = shmat (shmid, NULL, 0);
+ if (shmem == (void*) -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ shmem[0] = 0x55555555;
+ shmem[32] = 0x44444444;
+ shmem[64] = 0x33333333;
+ shmem[128] = 0x22222222;
+
+ if (shmdt (shmem) == -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ shmem = shmat (shmid, NULL, SHM_RDONLY);
+ if (shmem == (void*) -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ CHECK_EQ (shmem[0], 0x55555555);
+ CHECK_EQ (shmem[32], 0x44444444);
+ CHECK_EQ (shmem[64], 0x33333333);
+ CHECK_EQ (shmem[128], 0x22222222);
+
+ if (shmdt (shmem) == -1)
+ FAIL_EXIT1 ("shmem failed (errno=%d)", errno);
+
+ /* Finally free up the semnaphore resource. */
+ if (shmctl (shmid, IPC_RMID, 0) == -1)
+ FAIL_EXIT1 ("semctl failed (errno=%d)", errno);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294
commit 50a6b4e0e4eff805b3a2b6df1e8c18d57ac40294
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 18:24:53 2016 -0200
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.
diff --git a/ChangeLog b/ChangeLog
index d6505cd..041262c 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 096bf22..4001020 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 b1ea664..0263eee 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 51ce148..3bb5473 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 e75dd43..6d47b11 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 5ebade1..dd07db3 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 7a5666f..932c9cc 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 e8e381b..0000000
--- 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 0ccbffa..0000000
--- 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 bd624fc..2cea696 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 cb1a9f9..45d5ebf 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
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=214f017fdfce8d4d05062aa1babe6066d3e39d6f
commit 214f017fdfce8d4d05062aa1babe6066d3e39d6f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 18:23:11 2016 -0200
Use shmdt syscall for linux implementation
this patch add a direct call to shmdt syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* 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.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmdt):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmdt): Likewise.
* sysdeps/unix/sysv/linux/shmdt.c (shmdt): Use shmdt syscall if it is
defined.
diff --git a/ChangeLog b/ChangeLog
index 9205c82..d6505cd 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 (shmdt): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmdt):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmdt):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmdt): Likewise.
+ * sysdeps/unix/sysv/linux/shmdt.c (shmdt): Use shmdt syscall if it is
+ defined.
+
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldshmctl.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index bf9c8ad..096bf22 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index f50a5cf..b1ea664 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 80244c4..51ce148 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
-shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index d755bfd..e75dd43 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 90bd870..5ebade1 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 8b844f2..7a5666f 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,5 +8,4 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
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
index e93c87a..e8e381b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -2,5 +2,4 @@
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmdt - shmdt i:s __shmdt shmdt
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
index 4d478ce..0ccbffa 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,5 +1,4 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 7224d6f..5f3363e 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -16,12 +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 <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Detach shared memory segment starting at address specified by SHMADDR
from the caller's data segment. */
@@ -29,5 +27,9 @@
int
shmdt (const void *shmaddr)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (shmdt, shmaddr);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmdt, 0, 0, 0, shmaddr);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 18bd588..cb1a9f9 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
-shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e01f79e4126f5d21a0f83cee83b156fe5ad39940
commit e01f79e4126f5d21a0f83cee83b156fe5ad39940
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 18:20:36 2016 -0200
Consolidate Linux shmctl implementation
This patch consolidates the shmctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/shmctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldshmctl.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmctl): Likewise.
* sysdeps/unix/sysv/linux/alpha/shmctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/shmctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Use shmctl syscall
if it is defined.
diff --git a/ChangeLog b/ChangeLog
index 2e2eb6d..9205c82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
+ oldshmctl.
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmctl): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmctl): Likewise.
+ * sysdeps/unix/sysv/linux/alpha/shmctl.c: Remove file.
+ * sysdeps/unix/sysv/linux/arm/shmctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/shmctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/shmctl.c: Use default
+ implementation.
+ * sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Use shmctl syscall
+ if it is defined.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 386b3fd..4bbe9bf 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -17,9 +17,6 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getitimer osf_setitimer osf_utimes \
osf_getrusage osf_wait4
-# Support old ipc control
-sysdep_routines += oldshmctl
-
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/shmctl.c b/sysdeps/unix/sysv/linux/alpha/shmctl.c
deleted file mode 100644
index f73ed6f..0000000
--- a/sysdeps/unix/sysv/linux/alpha/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 9948d2d..bf9c8ad 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/arm/shmctl.c b/sysdeps/unix/sysv/linux/arm/shmctl.c
deleted file mode 100644
index 23c4b8d..0000000
--- a/sysdeps/unix/sysv/linux/arm/shmctl.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <sys/shm.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bits/wordsize.h>
-
-
-int
-__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 0df73a9..80244c4 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index f757f02..d755bfd 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index b0a3a44..90bd870 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/microblaze/shmctl.c b/sysdeps/unix/sysv/linux/microblaze/shmctl.c
deleted file mode 100644
index f73ed6f..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c b/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
index ea0fa94..f835cf8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/shmctl.c
@@ -15,18 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/shm.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
+#include <shlib-compat.h>
-int __shmctl (int shmid, int cmd, struct shmid_ds *buf);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
-int
-__shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, buf);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __shmctl, shmctl, GLIBC_2_0);
+#include <./sysdeps/unix/sysv/linux/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 40ed7c5..4d478ce 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index b2caf75..07725fe 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -16,18 +16,34 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/shm.h>
+#include <stdarg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
-#include <bits/wordsize.h>
#include <shlib-compat.h>
+#include <errno.h>
+
+
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
+#endif
-#include <kernel-features.h>
+/* Provide operations to control over shared memory segments. */
+int
+__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (shmctl, shmid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
+ buf);
+#endif
+}
+versioned_symbol (libc, __new_shmctl, shmctl, DEFAULT_VERSION);
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
struct __old_shmid_ds
{
struct __old_ipc_perm shm_perm; /* operation permission struct */
@@ -43,36 +59,15 @@ struct __old_shmid_ds
struct vm_area_struct *__attaches; /* descriptors for attaches */
};
-struct __old_shminfo
-{
- int shmmax;
- int shmmin;
- int shmmni;
- int shmseg;
- int shmall;
-};
-
-/* Provide operations to control over shared memory segments. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_shmctl (int, int, struct __old_shmid_ds *);
-#endif
-int __new_shmctl (int, int, struct shmid_ds *);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (shmctl, shmid, cmd, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_shmctl, shmid, cmd, 0, buf);
+#endif
}
compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
#endif
-
-int
-__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
-{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
- buf);
-}
-
-versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 8712bb8..18bd588 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
-shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8232e7d2097eb8e5ca5548ff1ae3f7257f274a87
commit 8232e7d2097eb8e5ca5548ff1ae3f7257f274a87
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 18:04:48 2016 -0200
Use shmat syscall for Linux implementation
This patch add a direct call to shmat syscall if it is supported by
kernel features.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
Define to __NR_osf_shmat.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
defined.
diff --git a/ChangeLog b/ChangeLog
index 19c898c..2e2eb6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
+ * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
+ Define to __NR_osf_shmat.
+ * sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
+ defined.
+
* sysvipc/Makefile (tests): Add test-sysvsem.
* sysvipc/test-sysvsem.c: New file.
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index f09222d..2fc3b77 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -29,4 +29,7 @@
#undef __ASSUME_STATFS64
#define __ASSUME_STATFS64 0
+/* Alpha defines SysV ipc shmat syscall with a different name. */
+#define __NR_shmat __NR_osf_shmat
+
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 8d3a042..9948d2d 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 1b2de93..f50a5cf 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index e12fb3e..0df73a9 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,7 +3,6 @@
# SysV APIs
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
# Socket APIs
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index a8fbc44..f757f02 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index eda4e4e..b0a3a44 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index d9afda0..8b844f2 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,6 +8,5 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
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
index 9cbbd38..e93c87a 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -2,6 +2,5 @@
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
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
index 924d182..40ed7c5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
-# File name Caller Syscall name # args Strong name Weak names
+# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-shmat - shmat i:ipi __shmat shmat
-shmctl - shmctl i:iip __shmctl shmctl
-shmdt - shmdt i:s __shmdt shmdt
-shmget - shmget i:iii __shmget shmget
+shmctl - shmctl i:iip __shmctl shmctl
+shmdt - shmdt i:s __shmdt shmdt
+shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 5afc93c..d1ef323 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.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 <sysdep.h>
-#include <unistd.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Attach the shared memory segment associated with SHMID to the data
segment of the calling process. SHMADDR and SHMFLG determine how
@@ -31,17 +28,19 @@
void *
shmat (int shmid, const void *shmaddr, int shmflg)
{
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg);
+#else
INTERNAL_SYSCALL_DECL(err);
unsigned long resultvar;
void *raddr;
- resultvar = INTERNAL_SYSCALL (ipc, err, 5, IPCOP_shmat,
- shmid, shmflg,
- (long int) &raddr,
- (void *) shmaddr);
+ resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg,
+ &raddr, shmaddr);
if (INTERNAL_SYSCALL_ERROR_P (resultvar, err))
return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar,
err));
return raddr;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 573ed07..8712bb8 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
-shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1afc369f1aa153ffcfbc50b4e840bdf5746b705d
commit 1afc369f1aa153ffcfbc50b4e840bdf5746b705d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Oct 31 11:03:07 2016 -0200
Add SYSV semaphore test
This patch adds a simple SYSV semaphore test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvsem.
* sysvipc/test-sysvsem.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 8e59a08..19c898c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysvipc/Makefile (tests): Add test-sysvsem.
+ * sysvipc/test-sysvsem.c: New file.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 73bb9cf..32d64dc 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,7 +30,7 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
-tests := test-sysvmsg
+tests := test-sysvmsg test-sysvsem
include ../Rules
diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c
new file mode 100644
index 0000000..fd9db4f
--- /dev/null
+++ b/sysvipc/test-sysvsem.c
@@ -0,0 +1,116 @@
+/* Basic tests for SYSV semaphore functions.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+
+#include <support/support.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int semid;
+
+static void
+remove_sem (void)
+{
+ /* Enforce message queue removal in case of early test failure.
+ Ignore error since the sem may already have being removed. */
+ semctl (semid, 0, IPC_RMID, 0);
+}
+
+static void
+do_prepare (int argc, char *argv[])
+{
+ int fd = create_temp_file ("tst-sysvsem.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+#define PREPARE do_prepare
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define SEM_MODE 0644
+
+static int
+do_test (void)
+{
+ atexit (remove_sem);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ semid = semget(key, 1, IPC_CREAT | IPC_EXCL | SEM_MODE);
+ if (semid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("msgget not supported");
+ FAIL_EXIT1 ("semget failed (errno=%d)", errno);
+ }
+
+ /* Get semaphore kernel information and do some sanity checks. */
+ struct semid_ds seminfo;
+ if (semctl (semid, 0, IPC_STAT, &seminfo) == -1)
+ FAIL_EXIT1 ("semctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (seminfo.sem_perm.__key != key)
+ FAIL_EXIT1 ("semid_ds::sem_perm::key (%d) != %d",
+ (int) seminfo.sem_perm.__key, (int) key);
+ if (seminfo.sem_perm.mode != SEM_MODE)
+ FAIL_EXIT1 ("semid_ds::sem_perm::mode (%o) != %o",
+ seminfo.sem_perm.mode, SEM_MODE);
+ if (seminfo.sem_nsems != 1)
+ FAIL_EXIT1 ("semid_ds::sem_nsems (%lu) != 1",
+ (long unsigned) seminfo.sem_nsems);
+
+ /* Some lock/unlock basic tests. */
+ struct sembuf sb1 = { 0, 1, 0 };
+ if (semop (semid, &sb1, 1) == -1)
+ FAIL_EXIT1 ("semop failed (errno=%i)", errno);
+
+ struct sembuf sb2 = { 0, -1, 0 };
+ if (semop (semid, &sb2, 1) == -1)
+ FAIL_EXIT1 ("semop failed (errno=%i)", errno);
+
+#ifdef _GNU_SOURCE
+ /* Set a time for half a second. The semaphore operation should timeout
+ with EAGAIN. */
+ struct timespec ts = { 0 /* sec */, 500000000 /* nsec */ };
+ if (semtimedop (semid, &sb2, 1, &ts) != -1
+ || (errno != EAGAIN && errno != ENOSYS))
+ FAIL_EXIT1 ("semtimedop succeed or returned errno != {EAGAIN,ENOSYS} "
+ "(errno=%i)", errno);
+#endif
+
+ /* Finally free up the semnaphore resource. */
+ if (semctl (semid, 0, IPC_RMID, 0) == -1)
+ FAIL_EXIT1 ("semctl failed (errno=%d)", errno);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=38cee35b0c30b4eba605f8402a21251d3da1f512
commit 38cee35b0c30b4eba605f8402a21251d3da1f512
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 17:51:37 2016 -0200
Consolidate Linux semtimedop implementation
This patch consolidates the semtimedop Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semtimedop.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file.
* sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and
add a comment about s390 syscall difference from default one.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop
syscall if it is defined.
diff --git a/ChangeLog b/ChangeLog
index 76ad37d..8e59a08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (semtimedop): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (semtimedop): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (semtimedop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (semtimedop): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (semtimedop): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semtimedop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semtimedop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semtimedop): Likewise.
+ * sysdeps/unix/sysv/linux/m68k/semtimedop.S: Remove file.
+ * sysdeps/unix/sysv/linux/s390/semtimedop.c: Reorganize headers and
+ add a comment about s390 syscall difference from default one.
+ * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use semtimedop
+ syscall if it is defined.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index c20543a..8d3a042 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -4,7 +4,6 @@ shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 3014db8..1b2de93 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -26,7 +26,6 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 54e1778..e12fb3e 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-semtimedop - semtimedop i:ipip semtimedop
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
shmat - shmat i:ipi __shmat shmat
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 8fbcaba..a8fbc44 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -5,7 +5,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index b9271cc..eda4e4e 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -9,7 +9,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
deleted file mode 100644
index b291070..0000000
--- a/sysdeps/unix/sysv/linux/m68k/semtimedop.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Schwab <schwab@suse.de>, 2003.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP 8 /* saved register space */
-#define PARMS 4+SVRSP /* space for 3 saved regs */
-#define SEMID PARMS
-#define SOPS SEMID+4
-#define NSOPS SOPS+4
-#define TIMEOUT NSOPS+4
-
- .text
-ENTRY (semtimedop)
-
- /* Save registers. */
- move.l %d2, %a1
- move.l %d3, -(%sp)
- cfi_adjust_cfa_offset (4)
- move.l %d5, -(%sp)
- cfi_adjust_cfa_offset (4)
- cfi_register (%d2, %a1)
- cfi_rel_offset (%d3, 0)
- cfi_rel_offset (%d5, 4)
-
- move.l #SYSOP_semtimedop, %d1
- move.l SEMID(%sp), %d2
- move.l NSOPS(%sp), %d3
- move.l SOPS(%sp), %d5
- move.l TIMEOUT(%sp), %a0
- move.l #SYS_ify (ipc), %d0
-
- trap #0
-
- /* Restore registers. */
- move.l (%sp)+, %d5
- cfi_adjust_cfa_offset (-4)
- cfi_restore (%d5)
- move.l (%sp)+, %d3
- cfi_adjust_cfa_offset (-4)
- cfi_restore (%d3)
- move.l %a1, %d2
- cfi_restore (%d2)
-
- /* Check for error. */
- tst.l %d0
- jmi SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-PSEUDO_END (semtimedop)
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 3da653d..d9afda0 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -11,4 +11,3 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 720db96..9cbbd38 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -5,4 +5,3 @@
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/s390/semtimedop.c b/sysdeps/unix/sysv/linux/s390/semtimedop.c
index f226953..db43f00 100644
--- a/sysdeps/unix/sysv/linux/s390/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/s390/semtimedop.c
@@ -16,12 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
@@ -29,6 +27,10 @@ int
semtimedop (int semid, struct sembuf *sops, size_t nsops,
const struct timespec *timeout)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semtimedop,
- semid, (int) nsops, timeout, sops);
+ /* The s390 sys_ipc variant has only five parameters instead of six
+ (as for default variant) and the only difference is the handling of
+ SEMTIMEDOP where on s390 the third parameter is used as a pointer
+ to a struct timespec where the generic variant uses fifth parameter. */
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, timeout,
+ sops);
}
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 30ee7fe..4216dda 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -16,12 +16,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
@@ -29,7 +27,10 @@ int
semtimedop (int semid, struct sembuf *sops, size_t nsops,
const struct timespec *timeout)
{
- return INLINE_SYSCALL (ipc, 6, IPCOP_semtimedop,
- semid, (int) nsops, 0, sops,
- timeout);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, nsops, 0, sops,
+ timeout);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d17a186..573ed07 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -10,7 +10,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semtimedop - semtimedop i:ipip semtimedop
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0f971840201bcb27247a8d8f53621197396262cd
commit 0f971840201bcb27247a8d8f53621197396262cd
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 17:01:43 2016 -0200
Use semop syscall for Linux implementation
This patch add a direct call to semop syscall if it is supported by
kernel headers.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semop): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
defined.
diff --git a/ChangeLog b/ChangeLog
index f4de0e3..76ad37d 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 (semop): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semop):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semop): Likewise.
+ * sysdeps/unix/sysv/linux/semop.c (semop): Use semop syscall if it is
+ defined.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 2533263..c20543a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -4,7 +4,6 @@ shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index ef5bd01..3014db8 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -26,7 +26,6 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 485f6fe..54e1778 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
semtimedop - semtimedop i:ipip semtimedop
-semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
shmctl - shmctl i:iip __shmctl shmctl
shmat - shmat i:ipi __shmat shmat
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 685ab93..8fbcaba 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -5,7 +5,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 56200ba..b9271cc 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -9,7 +9,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index a0b8ebf..3da653d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -11,5 +11,4 @@ personality EXTRA personality Ei:i __personality personality
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 374fcc2..720db96 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -5,5 +5,4 @@
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 288e080..924d182 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -5,4 +5,3 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 593eb4c..c179fcc 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -16,17 +16,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/sem.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Perform user-defined atomical operation of array of semaphores. */
int
semop (int semid, struct sembuf *sops, size_t nsops)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semop, semid, (int) nsops, 0, sops);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index d77a7ca..d17a186 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -10,7 +10,6 @@ shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
-semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d29f6bcdcc11d81e20c5880f5e1d7588cef950f7
commit d29f6bcdcc11d81e20c5880f5e1d7588cef950f7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 16:59:55 2016 -0200
Use semget syscall for Linux implementation
This patch add a direct call to semget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall
if it is defined.
diff --git a/ChangeLog b/ChangeLog
index b9e40cc..f4de0e3 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 (semget): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (semget):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semget):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semget): Likewise.
+ * sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall
+ if it is defined.
+
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldsemctl.
* sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index c12620a..2533263 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -6,7 +6,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 4bf4826..ef5bd01 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -28,7 +28,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index f95f1f7..485f6fe 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-semget - semget i:iii __semget semget
semtimedop - semtimedop i:ipip semtimedop
semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 5040ef3..685ab93 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -7,7 +7,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index ca5cba4..56200ba 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -11,7 +11,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index c40bac3..a0b8ebf 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -13,4 +13,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index 7c992d7..374fcc2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -7,4 +7,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 09ab580..288e080 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -6,4 +6,3 @@ shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
-semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index 52189fd..a8876f5 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.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/sem.h>
#include <ipc_priv.h>
-#include <stdlib.h> /* for definition of NULL */
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Return identifier for array of NSEMS semaphores associated with
KEY. */
@@ -30,5 +27,9 @@
int
semget (key_t key, int nsems, int semflg)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (semget, key, nsems, semflg);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semget, key, nsems, semflg, NULL);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index f3a1541..d77a7ca 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -12,7 +12,6 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
-semget - semget i:iii __semget semget
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=40c0a780687b3387e02caadc8545b21347cffc7e
commit 40c0a780687b3387e02caadc8545b21347cffc7e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 16:55:39 2016 -0200
Consolidate Linux semctl implementation
This patch consolidates the semctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/semctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldsemctl.
* sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf
implementation.
* sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl
syscall if it is defined.
* sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
diff --git a/ChangeLog b/ChangeLog
index eb7e751..b9e40cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
+ oldsemctl.
+ * sysdeps/unix/sysv/linux/alpha/semctl.c: Remove file.
+ * sysdeps/unix/sysv/linux/arm/semctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/semctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/semctl.c: Use defaulf
+ implementation.
+ * sysdeps/unix/sysv/linux/semctl.c (__new_semctl): Use semctl
+ syscall if it is defined.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (semctl): Remove.
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (semctl): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (semctl): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (semctl): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (semctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (semctl): Likewise.
+
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* support/check.h (FAIL_UNSUPPORTED): New define.
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index c24dc2e..386b3fd 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getrusage osf_wait4
# Support old ipc control
-sysdep_routines += oldsemctl oldshmctl
+sysdep_routines += oldshmctl
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/semctl.c b/sysdeps/unix/sysv/linux/alpha/semctl.c
deleted file mode 100644
index 4cb834a..0000000
--- a/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 54c1752..c12620a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -7,7 +7,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-oldsemctl EXTRA semctl i:iiii __old_semctl semctl@GLIBC_2.0
sigstack - sigstack 2 sigstack
diff --git a/sysdeps/unix/sysv/linux/arm/semctl.c b/sysdeps/unix/sysv/linux/arm/semctl.c
deleted file mode 100644
index 79d9d3e..0000000
--- a/sysdeps/unix/sysv/linux/arm/semctl.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-int
-__new_semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
-
- va_end (ap);
-
- return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- arg.array);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index ad75223..f95f1f7 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
semop - semop i:ipi __semop semop
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index da2c9ab..5040ef3 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -8,7 +8,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 8056781..ca5cba4 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -12,7 +12,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
# proper socket implementations:
accept - accept Ci:iBN __libc_accept __accept accept
diff --git a/sysdeps/unix/sysv/linux/microblaze/semctl.c b/sysdeps/unix/sysv/linux/microblaze/semctl.c
deleted file mode 100644
index 4cb834a..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/semctl.c b/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
index 1115a25..5a0c2a3 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/semctl.c
@@ -15,39 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-int __semctl (int semid, int semnum, int cmd, ...);
-
-int
-__semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
+#include <shlib-compat.h>
- va_end (ap);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
- return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64,
- arg.array);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __semctl, semctl, GLIBC_2_0);
+#include <sysdeps/unix/sysv/linux/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index f23b379..09ab580 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -7,4 +7,3 @@ shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index ee84a1e..dde2241 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -16,29 +16,12 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <stdarg.h>
#include <sys/sem.h>
+#include <stdarg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
#include <shlib-compat.h>
-
-#include <kernel-features.h>
-
-struct __old_semid_ds
-{
- struct __old_ipc_perm sem_perm; /* operation permission struct */
- __time_t sem_otime; /* last semop() time */
- __time_t sem_ctime; /* last time changed by semctl() */
- struct sem *__sembase; /* ptr to first semaphore in array */
- struct sem_queue *__sem_pending; /* pending operations */
- struct sem_queue *__sem_pending_last; /* last pending operation */
- struct sem_undo *__undo; /* ondo requests on this array */
- unsigned short int sem_nsems; /* number of semaphores in set */
-};
+#include <errno.h>
/* Define a `union semun' suitable for Linux here. */
union semun
@@ -47,26 +30,19 @@ union semun
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
unsigned short int *array; /* array for GETALL & SETALL */
struct seminfo *__buf; /* buffer for IPC_INFO */
- struct __old_semid_ds *__old_buf;
};
-/* Return identifier for array of NSEMS semaphores associated with
- KEY. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_semctl (int semid, int semnum, int cmd, ...);
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
#endif
-int __new_semctl (int semid, int semnum, int cmd, ...);
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
-attribute_compat_text_section
-__old_semctl (int semid, int semnum, int cmd, ...)
+__new_semctl (int semid, int semnum, int cmd, ...)
{
- union semun arg;
+ union semun arg = { 0 };
va_list ap;
/* Get the argument only if required. */
- arg.buf = NULL;
switch (cmd)
{
case SETVAL: /* arg.val */
@@ -83,20 +59,29 @@ __old_semctl (int semid, int semnum, int cmd, ...)
break;
}
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
- &arg);
-}
-compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd | __IPC_64,
+ arg.array);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
+ SEMCTL_ARG_ADDRESS (arg));
#endif
+}
+versioned_symbol (libc, __new_semctl, semctl, DEFAULT_VERSION);
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+/* Since semctl use a variadic argument for semid_ds there is not need to
+ define and tie the compatibility symbol to the old 'union semun'
+ definition. */
int
-__new_semctl (int semid, int semnum, int cmd, ...)
+attribute_compat_text_section
+__old_semctl (int semid, int semnum, int cmd, ...)
{
- union semun arg;
+ union semun arg = { 0 };
va_list ap;
/* Get the argument only if required. */
- arg.buf = NULL;
switch (cmd)
{
case SETVAL: /* arg.val */
@@ -113,8 +98,12 @@ __new_semctl (int semid, int semnum, int cmd, ...)
break;
}
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
- &arg);
+# ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (semctl, semid, semnum, cmd, arg.array);
+# else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semctl, semid, semnum, cmd,
+ SEMCTL_ARG_ADDRESS (arg));
+# endif
}
-
-versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
+compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
deleted file mode 100644
index a9ae4c6..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/sem.h>
-#include <ipc_priv.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-/* Return identifier for array of NSEMS semaphores associated with
- KEY. */
-
-int
-semctl (int semid, int semnum, int cmd, ...)
-{
- union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
-
- /* Get the argument. */
- arg = va_arg (ap, union semun);
-
- va_end (ap);
-
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
- arg.array);
-}
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 75b25a1..f3a1541 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -13,7 +13,6 @@ shmget - shmget i:iii __shmget shmget
semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
-semctl - semctl i:iiii __semctl semctl
syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=59c900c54b8db3638bc5e9e90784552aab4e2df4
commit 59c900c54b8db3638bc5e9e90784552aab4e2df4
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Fri Oct 28 18:35:03 2016 -0200
Add SYSV message queue test
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* test-skeleton.c (FAIL_UNSUPPORTED): New define.
diff --git a/ChangeLog b/ChangeLog
index 87c9636..eb7e751 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysvipc/Makefile (tests): Add test-sysvmsg.
+ * sysvipc/test-sysvmsg.c: New file.
+ * support/check.h (FAIL_UNSUPPORTED): New define.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
diff --git a/support/check.h b/support/check.h
index fb2cd91..92cb5d9 100644
--- a/support/check.h
+++ b/support/check.h
@@ -35,6 +35,11 @@ __BEGIN_DECLS
#define FAIL_EXIT1(...) \
support_exit_failure_impl (1, __FILE__, __LINE__, __VA_ARGS__)
+/* Print failure message and terminate with as unsupported test (exit
+ status of 77). */
+#define FAIL_UNSUPPORTED(...) \
+ support_exit_failure_impl (77, __FILE__, __LINE__, __VA_ARGS__)
+
/* Record a test failure (but continue executing) if EXPR evaluates to
false. */
#define TEST_VERIFY(expr) \
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index 5f3479e..73bb9cf 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -30,6 +30,8 @@ routines := ftok \
semop semget semctl semtimedop \
shmat shmdt shmget shmctl
+tests := test-sysvmsg
+
include ../Rules
CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysvipc/test-sysvmsg.c b/sysvipc/test-sysvmsg.c
new file mode 100644
index 0000000..cd2c488
--- /dev/null
+++ b/sysvipc/test-sysvmsg.c
@@ -0,0 +1,128 @@
+/* Basic tests for SYSV message queue functions.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+
+#include <support/support.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+
+#define TEXTSIZE 32
+struct msgbuf_t
+{
+#ifdef _GNU_SOURCE
+ __syscall_slong_t type;
+#else
+ long type;
+#endif
+ char buf[TEXTSIZE];
+};
+
+#define MSGTYPE 0x01020304
+#define MSGDATA "0123456789"
+
+/* These are for the temporary file we generate. */
+static char *name;
+static int msqid;
+
+static void
+remove_msq (void)
+{
+ /* Enforce message queue removal in case of early test failure.
+ Ignore error since the msgq may already have being removed. */
+ msgctl (msqid, IPC_RMID, NULL);
+}
+
+static void
+do_prepare (int argc, char *argv[])
+{
+ int fd = create_temp_file ("tst-sysvmsg.", &name);
+ if (fd == -1)
+ FAIL_EXIT1 ("cannot create temporary file (errno=%d)", errno);
+}
+
+#define PREPARE do_prepare
+
+/* It is not an extensive test, but rather a functional one aimed to check
+ correct parameter passing on kernel. */
+
+#define MSGQ_MODE 0644
+
+static int
+do_test (void)
+{
+ atexit (remove_msq);
+
+ key_t key = ftok (name, 'G');
+ if (key == -1)
+ FAIL_EXIT1 ("ftok failed");
+
+ msqid = msgget (key, MSGQ_MODE | IPC_CREAT);
+ if (msqid == -1)
+ {
+ if (errno == ENOSYS)
+ FAIL_UNSUPPORTED ("msgget not supported");
+ FAIL_EXIT1 ("msgget failed (errno=%d)", errno);
+ }
+
+ /* Get message queue kernel information and do some sanity checks. */
+ struct msqid_ds msginfo;
+ if (msgctl (msqid, IPC_STAT, &msginfo) == -1)
+ FAIL_EXIT1 ("msgctl with IPC_STAT failed (errno=%d)", errno);
+
+ if (msginfo.msg_perm.__key != key)
+ FAIL_EXIT1 ("msgid_ds::msg_perm::key (%d) != %d",
+ (int) msginfo.msg_perm.__key, (int) key);
+ if (msginfo.msg_perm.mode != MSGQ_MODE)
+ FAIL_EXIT1 ("msgid_ds::msg_perm::mode (%o) != %o",
+ msginfo.msg_perm.mode, MSGQ_MODE);
+ if (msginfo.msg_qnum != 0)
+ FAIL_EXIT1 ("msgid_ds::msg_qnum (%lu) != 0",
+ (long unsigned) msginfo.msg_qnum);
+
+ /* Check if last argument (IPC_NOWAIT) is correctly handled. */
+ struct msgbuf_t msg2rcv = { 0 };
+ if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE,
+ IPC_NOWAIT) == -1
+ && errno != ENOMSG)
+ FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+ struct msgbuf_t msg2snd = { MSGTYPE, MSGDATA };
+ if (msgsnd (msqid, &msg2snd, sizeof (msg2snd.buf), 0) == -1)
+ FAIL_EXIT1 ("msgsnd failed (errno=%d)", errno);
+
+ if (msgrcv (msqid, &msg2rcv, sizeof (msg2rcv.buf), MSGTYPE, 0) == -1)
+ FAIL_EXIT1 ("msgrcv failed (errno=%d)", errno);
+
+ int ret = 0;
+ if (strncmp (msg2snd.buf, msg2rcv.buf, TEXTSIZE) != 0)
+ ret = 1;
+
+ if (msgctl (msqid, IPC_RMID, NULL) == -1)
+ FAIL_EXIT1 ("msgctl failed");
+
+ return ret;
+}
+
+#include <support/test-driver.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2182a151a7bc0ca971bdfd1bddc4b7180172ac8b
commit 2182a151a7bc0ca971bdfd1bddc4b7180172ac8b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Oct 26 11:00:24 2016 -0200
Use msgget syscall for Linux implementation
This patch add a direct call to msgget syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgget): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if
define.
diff --git a/ChangeLog b/ChangeLog
index b494042..87c9636 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 (msgget): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgget):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgget):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgget): Likewise.
+ * sysdeps/unix/sysv/linux/msgget.c (msgget): Use msgget syscall if
+ define.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index ced9c10..54c1752 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-msgget - msgget i:ii __msgget msgget
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 43c464d..4bf4826 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index f65598a..ad75223 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# SysV APIs
-msgget - msgget i:ii __msgget msgget
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 3fbd81a..da2c9ab 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 9edcbe6..8056781 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index ed715ba..c40bac3 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -8,7 +8,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
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
index 4c59a33..7c992d7 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -2,7 +2,6 @@
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index ef98c75..d487f04 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.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/msg.h>
#include <ipc_priv.h>
-#include <stdlib.h> /* for definition of NULL */
-
#include <sysdep.h>
-#include <sys/syscall.h>
+#include <errno.h>
/* Return descriptor for message queue associated with KEY. The MSGFLG
parameter describes how to proceed with clashing of key values. */
@@ -30,5 +27,9 @@
int
msgget (key_t key, int msgflg)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (msgget, key, msgflg);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgget, key, msgflg, 0, NULL);
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 259bdfc..f23b379 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgget - msgget i:ii __msgget msgget
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 2d46bb3..75b25a1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-msgget - msgget i:ii __msgget msgget
pread64 - pread64 Ci:ipii __libc_pread __libc_pread64 __pread64 pread64 __pread pread
preadv64 - preadv Ci:ipii preadv64 preadv
pwrite64 - pwrite64 Ci:ipii __libc_pwrite __libc_pwrite64 __pwrite64 pwrite64 __pwrite pwrite
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=692fe43ae2c91194ca8b1e22ce5edcdcf30986d2
commit 692fe43ae2c91194ca8b1e22ce5edcdcf30986d2
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 25 20:57:55 2016 -0200
Use msgsnd syscall for Linux implementation
This patch add a direct call to msgsnd syscall if it is supported by
kernel features.
hecked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgsnd): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise.
* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
if defined.
diff --git a/ChangeLog b/ChangeLog
index d1dda4d..b494042 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 (msgsnd): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgsnd):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgsnd):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgsnd): Likewise.
+ * sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Use msgsnd syscall
+ if defined.
+
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index ddbd672..ced9c10 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 297f7e7..43c464d 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -24,7 +24,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 6869a48..f65598a 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
semtimedop - semtimedop i:ipip semtimedop
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index e4e40a0..3fbd81a 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index a60e615..9edcbe6 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 99dc33b..ed715ba 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -9,7 +9,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
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
index 07b421d..4c59a33 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -3,7 +3,6 @@
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
shmget - shmget i:iii __shmget shmget
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index 1457e43..53cf3c1 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -16,17 +16,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep-cancel.h>
-#include <sys/syscall.h>
int
__libc_msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return SYSCALL_CANCEL (msgsnd, msqid, msgp, msgsz, msgflg);
+#else
return SYSCALL_CANCEL (ipc, IPCOP_msgsnd, msqid, msgsz, msgflg,
- (void *) msgp);
+ msgp);
+#endif
}
weak_alias (__libc_msgsnd, msgsnd)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 59b93fe..259bdfc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 7192a96..2d46bb3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -3,7 +3,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
msgget - msgget i:ii __msgget msgget
-msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
pread64 - pread64 Ci:ipii __libc_pread __libc_pread64 __pread64 pread64 __pread pread
preadv64 - preadv Ci:ipii preadv64 preadv
pwrite64 - pwrite64 Ci:ipii __libc_pwrite __libc_pwrite64 __pwrite64 pwrite64 __pwrite pwrite
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=dee23189ae6201b553cf0e0f7ee69ce9be95fbe1
commit dee23189ae6201b553cf0e0f7ee69ce9be95fbe1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 25 20:55:09 2016 -0200
Consolidate Linux msgrcv implementation
This patch consolidates the msgrcv Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgrcv.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
* sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise,
* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
if defined.
* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
diff --git a/ChangeLog b/ChangeLog
index 99112e9..d1dda4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (msgctl): Remove.
+ * sysdeps/unix/sysv/linux/arm/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise,
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (msgctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Use msgrcv syscall
+ if defined.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c: Remove file.
+
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index f82c9da..ddbd672 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - osf_shmat i:ipi __shmat shmat
oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 82402b1..297f7e7 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -24,7 +24,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index dea452b..6869a48 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index ead0e99..e4e40a0 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 8a66ca9..a60e615 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index da0fd4e..99dc33b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -9,7 +9,6 @@ personality EXTRA personality Ei:i __personality personality
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index d0d9b9a..07b421d 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -3,7 +3,6 @@
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmdt - shmdt i:s __shmdt shmdt
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index c4dd219..489d629 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -16,33 +16,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* Kludge to work around Linux' restriction of only up to five
- arguments to a system call. */
-struct ipc_kludge
- {
- void *msgp;
- long int msgtyp;
- };
-
ssize_t
__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
int msgflg)
{
- /* The problem here is that Linux' calling convention only allows up to
- fives parameters to a system call. */
- struct ipc_kludge tmp;
-
- tmp.msgp = msgp;
- tmp.msgtyp = msgtyp;
-
- return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return SYSCALL_CANCEL (msgrcv, msqid, msgp, msgsz, msgtyp, msgflg);
+#else
+ return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg,
+ MSGRCV_ARGS (msgp, msgtyp));
+#endif
}
weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 808cbbb..59b93fe 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -2,7 +2,6 @@
# semaphore and shm system calls
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
shmat - shmat i:ipi __shmat shmat
shmctl - shmctl i:iip __shmctl shmctl
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
deleted file mode 100644
index ccaa4ee..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2010-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
- int msgflg)
-{
- return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg,
- msgp, msgtyp);
-}
-weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 4d19d75..7192a96 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -3,7 +3,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
msgget - msgget i:ii __msgget msgget
-msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
pread64 - pread64 Ci:ipii __libc_pread __libc_pread64 __pread64 pread64 __pread pread
preadv64 - preadv Ci:ipii preadv64 preadv
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=356c0aabd0191cdd7287ccf1ec8bbaa4862a0823
commit 356c0aabd0191cdd7287ccf1ec8bbaa4862a0823
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Oct 25 20:38:37 2016 -0200
Consolidate Linux msgctl implementation
This patch consolidates the msgctl Linux implementation in only
one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use
the direct syscall if it is supported, otherwise will use the old ipc
multiplex mechanism.
The patch also simplify header inclusion and reorganize internal
compat symbol to be built only if old ipc is defined.
Checked on x86_64, i686, powerpc64le, aarch64, and armhf.
* sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
oldmsgctl.
* sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
* sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
* sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
implementation.
* sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
if defined.
diff --git a/ChangeLog b/ChangeLog
index 4ba8fee..99112e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove
+ oldmsgctl.
+ * sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file.
+ * sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove.
+ * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl):
+ Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default
+ implementation.
+ * sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall
+ if defined.
+
* sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
definition and define its own.
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 45941b0..c24dc2e 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
osf_getrusage osf_wait4
# Support old ipc control
-sysdep_routines += oldmsgctl oldsemctl oldshmctl
+sysdep_routines += oldsemctl oldshmctl
CFLAGS-ioperm.c = -Wa,-mev6
endif
diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c
deleted file mode 100644
index d65a5b9..0000000
--- a/sysdeps/unix/sysv/linux/alpha/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 0c9efcb..f82c9da 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -1,6 +1,5 @@
# File name Caller Syscall name # args Strong name Weak names
-oldmsgctl EXTRA msgctl i:iip __old_msgctl msgctl@GLIBC_2.0
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c
deleted file mode 100644
index 83c6744..0000000
--- a/sysdeps/unix/sysv/linux/arm/msgctl.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
- The GNU C 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; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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 the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-
-int
-__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
-}
-
-#include <shlib-compat.h>
-versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 5993ab4..dea452b 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -2,7 +2,6 @@
# SysV APIs
msgget - msgget i:ii __msgget msgget
-msgctl - msgctl i:iip __msgctl msgctl
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
semget - semget i:iii __semget semget
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index a95c3dd..ead0e99 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 68b6c9a..8a66ca9 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/microblaze/msgctl.c b/sysdeps/unix/sysv/linux/microblaze/msgctl.c
deleted file mode 100644
index d65a5b9..0000000
--- a/sysdeps/unix/sysv/linux/microblaze/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/arm/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
index c4dc7ff..928c3dc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c
@@ -15,18 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <sys/msg.h>
-#include <ipc_priv.h>
-#include <sysdep.h>
+#include <shlib-compat.h>
-int __msgctl (int msqid, int cmd, struct msqid_ds *buf);
+#undef SHLIB_COMPAT
+#define SHLIB_COMPAT(a, b, c) 0
-int
-__msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf);
-}
+#define DEFAULT_VERSION GLIBC_2_0
-#include <shlib-compat.h>
-versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0);
+#include <sysdeps/unix/sysv/linux/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index e48fbb3..45bf350 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -16,17 +16,30 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
-
#include <sysdep.h>
-#include <string.h>
-#include <sys/syscall.h>
#include <shlib-compat.h>
+#include <errno.h>
+
+#ifndef DEFAULT_VERSION
+# define DEFAULT_VERSION GLIBC_2_2
+#endif
+
+int
+__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0,
+ buf);
+#endif
+}
+versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION);
-#include <kernel-features.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
struct __old_msqid_ds
{
struct __old_ipc_perm msg_perm; /* structure describing operation permission */
@@ -44,27 +57,15 @@ struct __old_msqid_ds
__ipc_pid_t msg_lrpid; /* pid of last msgrcv() */
};
-/* Allows to control internal state and destruction of message queue
- objects. */
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-int __old_msgctl (int, int, struct __old_msqid_ds *);
-#endif
-int __new_msgctl (int, int, struct msqid_ds *);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
int
attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+ return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf);
+#endif
}
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
#endif
-
-int
-__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
-{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
-}
-
-versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 9f03d26..808cbbb 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# semaphore and shm system calls
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 8aed2f4..4d19d75 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -2,7 +2,6 @@
arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl
modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt
-msgctl - msgctl i:iip __msgctl msgctl
msgget - msgget i:ii __msgget msgget
msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1e5834c38a22bc6bee7bae4347f21baee5196724
commit 1e5834c38a22bc6bee7bae4347f21baee5196724
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Nov 7 17:29:30 2016 -0200
Refactor Linux ipc_priv header
Some architectures support the old-style IPC and require IPC_64 equal to
0x100 to be passed along SysV IPC syscalls, while new architectures should
default to new IPC version (without the flags being set).
This patch refactor current ipc_priv.h Linux headers in two directions:
- Remove cross platform references (for instance alpha including powerpc
definition) and add required definition for each required port. The
idea is to avoid tie one architecture definition with another and make
platform change independent.
- Move all common definitions (the ipc syscall commands) on a common
header, ipc_ops.h.
* sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
definition and define its own.
* sysdeps/unix/sysv/linux/ipc_ops.h: New file.
* sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h: Likewise.
* sysdeps/unix/sysv/linux/mips/ipc_priv.h: Remove file.
* sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/ipc_priv.h: Move ipc syscall operation
definitions to common header.
* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Use common syscall
operation from ipc_ops.h.
diff --git a/ChangeLog b/ChangeLog
index e942c29..4ba8fee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/aarch64/ipc_priv.h: New file.
+ * sysdeps/unix/sysv/linux/alpha/ipc_priv.h: Avoid included other arch
+ definition and define its own.
+ * sysdeps/unix/sysv/linux/ipc_ops.h: New file.
+ * sysdeps/unix/sysv/linux/x86_64/ipc_priv.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/ipc_priv.h: Remove file.
+ * sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h: New file.
+ * sysdeps/unix/sysv/linux/ipc_priv.h: Move ipc syscall operation
+ definitions to common header.
+ * sysdeps/unix/sysv/linux/powerpc/ipc_priv.h: Use common syscall
+ operation from ipc_ops.h.
+
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALLS): New define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
diff --git a/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h b/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
new file mode 100644
index 0000000..f73530c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
@@ -0,0 +1,21 @@
+/* Old SysV permission definition for Linux. AArch64 version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/ipc.h> /* For __key_t */
+
+#define __IPC_64 0x0
diff --git a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
index 67883be..06444fc 100644
--- a/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/alpha/ipc_priv.h
@@ -1 +1,32 @@
-#include <sysdeps/unix/sysv/linux/powerpc/ipc_priv.h>
+/* Old SysV permission definition for Linux. Alpha version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/ipc.h> /* For __key_t */
+
+#define __IPC_64 0x100
+
+struct __old_ipc_perm
+{
+ __key_t __key; /* Key. */
+ unsigned int uid; /* Owner's user ID. */
+ unsigned int gid; /* Owner's group ID. */
+ unsigned int cuid; /* Creator's user ID. */
+ unsigned int cgid; /* Creator's group ID. */
+ unsigned int mode; /* Read/write permission. */
+ unsigned short int __seq; /* Sequence number. */
+};
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_ops.h
similarity index 51%
copy from sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
copy to sysdeps/unix/sysv/linux/ipc_ops.h
index baae7ab..ea3028c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_ops.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* The codes for the functions to use the ipc syscall multiplexer.
+ Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,32 +16,15 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
-
-#define __IPC_64 0x100
-
-struct __old_ipc_perm
-{
- __key_t __key; /* Key. */
- unsigned int uid; /* Owner's user ID. */
- unsigned int gid; /* Owner's group ID. */
- unsigned int cuid; /* Creator's user ID. */
- unsigned int cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
-};
-
-
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
+#define IPCOP_semop 1
+#define IPCOP_semget 2
+#define IPCOP_semctl 3
+#define IPCOP_semtimedop 4
+#define IPCOP_msgsnd 11
+#define IPCOP_msgrcv 12
+#define IPCOP_msgget 13
+#define IPCOP_msgctl 14
+#define IPCOP_shmat 21
+#define IPCOP_shmdt 22
+#define IPCOP_shmget 23
+#define IPCOP_shmctl 24
diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h
index 7ded463..9b97f00 100644
--- a/sysdeps/unix/sysv/linux/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/ipc_priv.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Old SysV permission definition for Linux. Default version.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
+#include <sys/ipc.h> /* For __key_t */
#define __IPC_64 0x100
@@ -30,17 +31,9 @@ struct __old_ipc_perm
unsigned short int __seq; /* Sequence number. */
};
+#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
+#define MSGRCV_ARGS(__msgp, __msgtyp) \
+ ((long int []){ (long int) __msgp, __msgtyp })
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/mips/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/ipc_priv.h
deleted file mode 100644
index 67883be..0000000
--- a/sysdeps/unix/sysv/linux/mips/ipc_priv.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/powerpc/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
similarity index 51%
copy from sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
copy to sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
index baae7ab..9f47d89 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Old SysV permission definition for Linux. MIPS64 version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,26 +22,11 @@
struct __old_ipc_perm
{
- __key_t __key; /* Key. */
- unsigned int uid; /* Owner's user ID. */
- unsigned int gid; /* Owner's group ID. */
- unsigned int cuid; /* Creator's user ID. */
- unsigned int cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
+ __key_t __key; /* Key. */
+ int uid; /* Owner's user ID. */
+ int gid; /* Owner's group ID. */
+ int cuid; /* Creator's user ID. */
+ int cgid; /* Creator's group ID. */
+ int mode; /* Read/write permission. */
+ unsigned short int __seq; /* Sequence number. */
};
-
-
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
diff --git a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
index baae7ab..4f72f58 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ipc_priv.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2016 Free Software Foundation, Inc.
+/* Old SysV permission definition for Linux. PowerPC version.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/ipc.h>
+#include <sys/ipc.h> /* For __key_t */
#define __IPC_64 0x100
@@ -30,17 +31,9 @@ struct __old_ipc_perm
unsigned short int __seq; /* Sequence number. */
};
+#define SEMCTL_ARG_ADDRESS(__arg) &__arg.array
-/* The codes for the functions to use the ipc syscall multiplexer. */
-#define IPCOP_semop 1
-#define IPCOP_semget 2
-#define IPCOP_semctl 3
-#define IPCOP_semtimedop 4
-#define IPCOP_msgsnd 11
-#define IPCOP_msgrcv 12
-#define IPCOP_msgget 13
-#define IPCOP_msgctl 14
-#define IPCOP_shmat 21
-#define IPCOP_shmdt 22
-#define IPCOP_shmget 23
-#define IPCOP_shmctl 24
+#define MSGRCV_ARGS(__msgp, __msgtyp) \
+ ((long int []){ (long int) __msgp, __msgtyp })
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
new file mode 100644
index 0000000..386ff8a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
@@ -0,0 +1,41 @@
+/* Old SysV permission definition for Linux. x86_64 version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/ipc.h> /* For __key_t */
+
+#define __IPC_64 0x0
+
+struct __old_ipc_perm
+{
+ __key_t __key; /* Key. */
+ unsigned int uid; /* Owner's user ID. */
+ unsigned int gid; /* Owner's group ID. */
+ unsigned int cuid; /* Creator's user ID. */
+ unsigned int cgid; /* Creator's group ID. */
+ unsigned int mode; /* Read/write permission. */
+ unsigned short int __seq; /* Sequence number. */
+};
+
+/* SPARC semctl multiplex syscall expects the union pointed address, not
+ the union address itself. */
+#define SEMCTL_ARG_ADDRESS(__arg) __arg.array
+
+/* Also for msgrcv it does not use the kludge on final 2 arguments. */
+#define MSGRCV_ARGS(__msgp, __msgtyp) __msgp, __msgtyp
+
+#include <ipc_ops.h>
diff --git a/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
new file mode 100644
index 0000000..d39db53
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
@@ -0,0 +1,32 @@
+/* Old SysV permission definition for Linux. x86_64 version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C 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; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/ipc.h> /* For __key_t */
+
+#define __IPC_64 0x0
+
+struct __old_ipc_perm
+{
+ __key_t __key; /* Key. */
+ unsigned short uid; /* Owner's user ID. */
+ unsigned short gid; /* Owner's group ID. */
+ unsigned short cuid; /* Creator's user ID. */
+ unsigned short cgid; /* Creator's group ID. */
+ unsigned short mode; /* Read/write permission. */
+ unsigned short int __seq; /* Sequence number. */
+};
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=63719cf1e378b1a01ec6a36cf0ab7462cfb7a6c6
commit 63719cf1e378b1a01ec6a36cf0ab7462cfb7a6c6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Nov 2 15:41:15 2016 -0200
Add __ASSUME_DIRECT_SYSVIPC_SYSCALL for Linux
On current minimum supported kernels, the SysV IPC on Linux is provided
by either the ipc syscalls or correspondent wire syscalls. Also, for
architectures that supports wire syscalls all syscalls are supported
in a set (msgct, msgrcv, msgsnd, msgget, semctl, semget, semop, semtimedop,
shmctl, shmat, shmget, shmdt).
The architectures that only supports ipc syscall are:
- i386, m68k, microblaze, mips32, powerpc (powerpc32, powerpc64, and
powerpc64le), s390 (32 and 64 bits), sh, sparc32, and sparc64.
And the architectures that only supports wired syscalls are:
- aarch64, alpha, hppa, ia64, mips64, mips64n32, nios2, tile
(tilepro, tilegx, and tilegx64), and x86_64
Also arm is the only one that supports both wire syscalls and the
ipc, although the ipc one is deprecated.
This patch adds a new define, __ASSUME_DIRECT_SYSVIPC_SYSCALL, that wired
syscalls are supported on the system and the general idea is to use
it where possible.
I also checked the syscall table for all architectures on Linux 4.9
and there is no change on described support for Linux 2.6.32/3.2.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): New define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Undef.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_DIRECT_SYSVIPC_SYSCALL): Likewise.
diff --git a/ChangeLog b/ChangeLog
index 1ad6867..e942c29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2016-12-28 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ * sysdeps/unix/sysv/linux/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): New define.
+ * sysdeps/unix/sysv/linux/i386/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Undef.
+ * sysdeps/unix/sysv/linux/m68k/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+ * sysdeps/unix/sysv/linux/mips/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+ * sysdeps/unix/sysv/linux/s390/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+ * sysdeps/unix/sysv/linux/sh/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/kernel-features.h
+ (__ASSUME_DIRECT_SYSVIPC_SYSCALLS): Likewise.
+
2016-12-28 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc32/power7/memchr.S (__memchr): Avoid an
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 148963c..0a557f8 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -52,3 +52,6 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
#endif
+
+/* i686 only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 1d3b554..19125ce 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -147,3 +147,7 @@
separate syscalls were only added later. */
#define __ASSUME_SENDMSG_SYSCALL 1
#define __ASSUME_RECVMSG_SYSCALL 1
+
+/* Support for SysV IPC through wired syscalls. All supported architectures
+ either support ipc syscall and/or all the ipc correspondent syscalls. */
+#define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 46ec601..b03de4c 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -54,3 +54,6 @@
# undef __ASSUME_REQUEUE_PI
# undef __ASSUME_SET_ROBUST_LIST
#endif
+
+/* m68k only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index b486d90..fae34aa 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -32,6 +32,8 @@
pairs to start with an even-number register. */
#if _MIPS_SIM == _ABIO32
# define __ASSUME_ALIGNED_REGISTER_PAIRS 1
+/* mips32 only supports ipc syscall. */
+# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
#endif
/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 42a53f2..5a84b6b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -52,3 +52,6 @@
#endif
#include_next <kernel-features.h>
+
+/* powerpc only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index b3edee4..10eade3 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -48,3 +48,6 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
#endif
+
+/* s390 only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index d03aafa..9eb8ff4 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -54,4 +54,7 @@
before the offset. */
#define __ASSUME_PRW_DUMMY_ARG 1
+/* sh only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+
#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 69c9c7c..e487efe 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -37,3 +37,6 @@
# undef __ASSUME_REQUEUE_PI
# undef __ASSUME_SET_ROBUST_LIST
#endif
+
+/* sparc only supports ipc syscall. */
+#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 229 ++++++++++++++++++++
support/check.h | 5 +
sysdeps/unix/sysv/linux/aarch64/ipc_priv.h | 21 ++
sysdeps/unix/sysv/linux/alpha/Makefile | 3 -
sysdeps/unix/sysv/linux/alpha/ipc_priv.h | 33 +++-
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/semctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/shmctl.c | 1 -
sysdeps/unix/sysv/linux/alpha/syscalls.list | 13 --
sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ---
sysdeps/unix/sysv/linux/arm/semctl.c | 54 -----
sysdeps/unix/sysv/linux/arm/shmctl.c | 34 ---
sysdeps/unix/sysv/linux/arm/syscalls.list | 12 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 14 --
sysdeps/unix/sysv/linux/hppa/syscalls.list | 14 --
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/ia64/syscalls.list | 14 --
sysdeps/unix/sysv/linux/ipc_ops.h | 30 +++
sysdeps/unix/sysv/linux/ipc_priv.h | 23 +--
sysdeps/unix/sysv/linux/kernel-features.h | 4 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/m68k/semtimedop.S | 69 ------
sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/semctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/shmctl.c | 1 -
sysdeps/unix/sysv/linux/microblaze/syscalls.list | 12 -
sysdeps/unix/sysv/linux/mips/ipc_priv.h | 1 -
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h | 32 +++
sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +-
sysdeps/unix/sysv/linux/mips/mips64/semctl.c | 38 +---
sysdeps/unix/sysv/linux/mips/mips64/shmctl.c | 17 +-
sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 13 --
sysdeps/unix/sysv/linux/msgctl.c | 45 ++--
sysdeps/unix/sysv/linux/msgget.c | 11 +-
sysdeps/unix/sysv/linux/msgrcv.c | 26 +--
sysdeps/unix/sysv/linux/msgsnd.c | 9 +-
sysdeps/unix/sysv/linux/powerpc/ipc_priv.h | 23 +--
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 14 --
sysdeps/unix/sysv/linux/s390/semtimedop.c | 12 +-
sysdeps/unix/sysv/linux/semctl.c | 71 +++----
sysdeps/unix/sysv/linux/semget.c | 11 +-
sysdeps/unix/sysv/linux/semop.c | 10 +-
sysdeps/unix/sysv/linux/semtimedop.c | 13 +-
sysdeps/unix/sysv/linux/sh/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/shmat.c | 17 +-
sysdeps/unix/sysv/linux/shmctl.c | 59 +++---
sysdeps/unix/sysv/linux/shmdt.c | 12 +-
sysdeps/unix/sysv/linux/shmget.c | 13 +-
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h | 41 ++++
sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c | 32 ---
sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c | 54 -----
sysdeps/unix/sysv/linux/x86_64/ipc_priv.h | 32 +++
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 12 -
sysvipc/Makefile | 2 +
sysvipc/test-sysvmsg.c | 128 +++++++++++
sysvipc/test-sysvsem.c | 116 ++++++++++
sysvipc/test-sysvshm.c | 131 +++++++++++
62 files changed, 1002 insertions(+), 656 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/alpha/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/alpha/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/arm/shmctl.c
create mode 100644 sysdeps/unix/sysv/linux/ipc_ops.h
delete mode 100644 sysdeps/unix/sysv/linux/m68k/semtimedop.S
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/semctl.c
delete mode 100644 sysdeps/unix/sysv/linux/microblaze/shmctl.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/ipc_priv.h
create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c
create mode 100644 sysdeps/unix/sysv/linux/x86_64/ipc_priv.h
create mode 100644 sysvipc/test-sysvmsg.c
create mode 100644 sysvipc/test-sysvsem.c
create mode 100644 sysvipc/test-sysvshm.c
hooks/post-receive
--
GNU C Library master sources