This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v2 09/16] Use semop syscall for Linux implementation
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Wed, 2 Nov 2016 17:26:46 -0200
- Subject: [PATCH v2 09/16] Use semop syscall for Linux implementation
- Authentication-results: sourceware.org; auth=none
- References: <1478114813-3526-1-git-send-email-adhemerval.zanella@linaro.org>
Changes from previous version:
- Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the
wired syscall or the ipc one.
--
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/semop.c (semop): Use semop syscall if it is
defined.
---
ChangeLog | 3 +++
sysdeps/unix/sysv/linux/semop.c | 10 ++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 593eb4c..bd57009 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_SYSVIPC_SYSCALL
+ return INLINE_SYSCALL_CALL (semop, semid, sops, nsops);
+#else
+ return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops);
+#endif
}
--
2.7.4