>From 10ad63dc33ffff31f68b9627212aca291fe39b5e Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 9 May 2019 22:49:28 +0000 Subject: [PATCH 11/12] ipc: prefer SYS_ipc when it is defined Linux v5.1 introduced ipc syscalls on targets where previously only SYS_ipc was available, change the logic such that the ipc code keeps using SYS_ipc which works backward compatibly on older kernels. This changes behaviour on microblaze which had both mechanisms, now SYS_ipc will be used instead of separate syscalls. --- src/ipc/msgctl.c | 2 +- src/ipc/msgget.c | 2 +- src/ipc/msgrcv.c | 2 +- src/ipc/msgsnd.c | 2 +- src/ipc/semctl.c | 2 +- src/ipc/semget.c | 2 +- src/ipc/semop.c | 2 +- src/ipc/semtimedop.c | 2 +- src/ipc/shmat.c | 2 +- src/ipc/shmctl.c | 2 +- src/ipc/shmdt.c | 2 +- src/ipc/shmget.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ipc/msgctl.c b/src/ipc/msgctl.c index ea9b2337..868197f6 100644 --- a/src/ipc/msgctl.c +++ b/src/ipc/msgctl.c @@ -17,7 +17,7 @@ int msgctl(int q, int cmd, struct msqid_ds *buf) buf = &tmp; } #endif -#ifdef SYS_msgctl +#ifndef SYS_ipc int r = __syscall(SYS_msgctl, q, cmd | IPC_64, buf); #else int r = __syscall(SYS_ipc, IPCOP_msgctl, q, cmd | IPC_64, 0, buf, 0); diff --git a/src/ipc/msgget.c b/src/ipc/msgget.c index 9dfbc4ea..30a4b42b 100644 --- a/src/ipc/msgget.c +++ b/src/ipc/msgget.c @@ -4,7 +4,7 @@ int msgget(key_t k, int flag) { -#ifdef SYS_msgget +#ifndef SYS_ipc return syscall(SYS_msgget, k, flag); #else return syscall(SYS_ipc, IPCOP_msgget, k, flag); diff --git a/src/ipc/msgrcv.c b/src/ipc/msgrcv.c index 0a344e56..9d1034b1 100644 --- a/src/ipc/msgrcv.c +++ b/src/ipc/msgrcv.c @@ -4,7 +4,7 @@ ssize_t msgrcv(int q, void *m, size_t len, long type, int flag) { -#ifdef SYS_msgrcv +#ifndef SYS_ipc return syscall_cp(SYS_msgrcv, q, m, len, type, flag); #else return syscall_cp(SYS_ipc, IPCOP_msgrcv, q, len, flag, ((long[]){ (long)m, type })); diff --git a/src/ipc/msgsnd.c b/src/ipc/msgsnd.c index e1abde3a..99bb17e9 100644 --- a/src/ipc/msgsnd.c +++ b/src/ipc/msgsnd.c @@ -4,7 +4,7 @@ int msgsnd(int q, const void *m, size_t len, int flag) { -#ifdef SYS_msgsnd +#ifndef SYS_ipc return syscall_cp(SYS_msgsnd, q, m, len, flag); #else return syscall_cp(SYS_ipc, IPCOP_msgsnd, q, len, flag, m); diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c index 941e2813..ce1fb164 100644 --- a/src/ipc/semctl.c +++ b/src/ipc/semctl.c @@ -33,7 +33,7 @@ int semctl(int id, int num, int cmd, ...) arg.buf = &tmp; } #endif -#ifdef SYS_semctl +#ifndef SYS_ipc int r = __syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf); #else int r = __syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg.buf); diff --git a/src/ipc/semget.c b/src/ipc/semget.c index c4a559db..2cdf626b 100644 --- a/src/ipc/semget.c +++ b/src/ipc/semget.c @@ -11,7 +11,7 @@ int semget(key_t key, int n, int fl) * n fits in the correct (per POSIX) userspace type, so * we have to check here. */ if (n > USHRT_MAX) return __syscall_ret(-EINVAL); -#ifdef SYS_semget +#ifndef SYS_ipc return syscall(SYS_semget, key, n, fl); #else return syscall(SYS_ipc, IPCOP_semget, key, n, fl); diff --git a/src/ipc/semop.c b/src/ipc/semop.c index 8046e437..5f0c7dea 100644 --- a/src/ipc/semop.c +++ b/src/ipc/semop.c @@ -4,7 +4,7 @@ int semop(int id, struct sembuf *buf, size_t n) { -#ifdef SYS_semop +#ifndef SYS_ipc return syscall(SYS_semop, id, buf, n); #else return syscall(SYS_ipc, IPCOP_semop, id, n, 0, buf); diff --git a/src/ipc/semtimedop.c b/src/ipc/semtimedop.c index b0c4cf9f..51e70805 100644 --- a/src/ipc/semtimedop.c +++ b/src/ipc/semtimedop.c @@ -5,7 +5,7 @@ int semtimedop(int id, struct sembuf *buf, size_t n, const struct timespec *ts) { -#ifdef SYS_semtimedop +#ifndef SYS_ipc return syscall(SYS_semtimedop, id, buf, n, ts); #else return syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts); diff --git a/src/ipc/shmat.c b/src/ipc/shmat.c index 38db92f9..8c7407d1 100644 --- a/src/ipc/shmat.c +++ b/src/ipc/shmat.c @@ -2,7 +2,7 @@ #include "syscall.h" #include "ipc.h" -#ifdef SYS_shmat +#ifndef SYS_ipc void *shmat(int id, const void *addr, int flag) { return (void *)syscall(SYS_shmat, id, addr, flag); diff --git a/src/ipc/shmctl.c b/src/ipc/shmctl.c index c951a581..c2b2bb0d 100644 --- a/src/ipc/shmctl.c +++ b/src/ipc/shmctl.c @@ -17,7 +17,7 @@ int shmctl(int id, int cmd, struct shmid_ds *buf) buf = &tmp; } #endif -#ifdef SYS_shmctl +#ifndef SYS_ipc int r = __syscall(SYS_shmctl, id, cmd | IPC_64, buf); #else int r = __syscall(SYS_ipc, IPCOP_shmctl, id, cmd | IPC_64, 0, buf, 0); diff --git a/src/ipc/shmdt.c b/src/ipc/shmdt.c index d4fac8f1..57238137 100644 --- a/src/ipc/shmdt.c +++ b/src/ipc/shmdt.c @@ -4,7 +4,7 @@ int shmdt(const void *addr) { -#ifdef SYS_shmdt +#ifndef SYS_ipc return syscall(SYS_shmdt, addr); #else return syscall(SYS_ipc, IPCOP_shmdt, 0, 0, 0, addr); diff --git a/src/ipc/shmget.c b/src/ipc/shmget.c index b44f9d68..7521b5fa 100644 --- a/src/ipc/shmget.c +++ b/src/ipc/shmget.c @@ -6,7 +6,7 @@ int shmget(key_t key, size_t size, int flag) { if (size > PTRDIFF_MAX) size = SIZE_MAX; -#ifdef SYS_shmget +#ifndef SYS_ipc return syscall(SYS_shmget, key, size, flag); #else return syscall(SYS_ipc, IPCOP_shmget, key, size, flag); -- 2.21.0