From patchwork Thu May 16 15:12:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 32713 Received: (qmail 111775 invoked by alias); 16 May 2019 15:13:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 111714 invoked by uid 89); 16 May 2019 15:13:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=fifth, s390linuxgnu, s390-linux-gnu, 2003 X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9m69zKOsap7IrJP/QEjtJNICZJK20PB0qqL5SmbpddU=; b=Gt9EGicjSmAJVO6APx2qvfMgDFWs97k5S4Rk4UNHHq/j51EToNNHmg1dZpqK0LSQIg 4TP8ng5mUfWf9YhqaKb7uPWxIWLMr0PMRKiVE+FtqmhiqpaW0HZxxR2DhmcAK8U4Fm/W A6Qvdm75oEID80GfZ6Z/Ez5qnmXz51gZRzNZLDLiVzrpBuFaMB2XeB0Yl6o2X0ph6RcZ cG94TDSVh9UzPCWNoBwC7kDx1tUeI+z+iwsSfWt7nPS+N8aDkocFye/HvpcrCoVZRu5I VVpOL8kn6rLXhZ3tnK9skh7rSwpDdjZYCL9xHaH+P9W6P40toxebZYdskXOEZkVO4nUM 5uIA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 3/5] sysvipc: Consolidate semtimedop s390 Date: Thu, 16 May 2019 12:12:47 -0300 Message-Id: <20190516151249.19029-3-adhemerval.zanella@linaro.org> In-Reply-To: <20190516151249.19029-1-adhemerval.zanella@linaro.org> References: <20190516151249.19029-1-adhemerval.zanella@linaro.org> This patch consolidates the s390-32 semtimedop implementation by defining a arch-specific SEMTIMEDOP_IPC_ARGS to rearrange the arguments expected by s390 Linux kABI. The idea is to avoid have multiples semtimedop implementation changes for Linux v5.1 change to enable wire-up sysvipc support. Checked with a s390-linux-gnu and checking that resulting semtimedop objects do not change. * sysdeps/unix/sysv/linux/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New define. * sysdpes/unix/sysv/linux/s390/s390-32/ipc_priv.h: New file. * sysdeps/unix/sysv/linux/s390/semtimedop.c: Remove file. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use SEMTIMEDOP_IPC_ARGS for calls with __NR_ipc. --- sysdeps/unix/sysv/linux/ipc_priv.h | 3 ++ .../unix/sysv/linux/s390/s390-32/ipc_priv.h | 29 +++++++++++++++ sysdeps/unix/sysv/linux/s390/semtimedop.c | 36 ------------------- sysdeps/unix/sysv/linux/semtimedop.c | 4 +-- 4 files changed, 34 insertions(+), 38 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h delete mode 100644 sysdeps/unix/sysv/linux/s390/semtimedop.c diff --git a/sysdeps/unix/sysv/linux/ipc_priv.h b/sysdeps/unix/sysv/linux/ipc_priv.h index 65adbb093e..49018c1b28 100644 --- a/sysdeps/unix/sysv/linux/ipc_priv.h +++ b/sysdeps/unix/sysv/linux/ipc_priv.h @@ -34,4 +34,7 @@ struct __old_ipc_perm #define MSGRCV_ARGS(__msgp, __msgtyp) \ ((long int []){ (long int) __msgp, __msgtyp }) +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ + (__nsops), 0, (__sops), (__timeout) + #include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h new file mode 100644 index 0000000000..9d74e92289 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/ipc_priv.h @@ -0,0 +1,29 @@ +/* Arch-specific SysV IPC definitions for Linux. s390 version. + Copyright (C) 2019 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 + . */ + +#include + +/* 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. */ +#undef SEMTIMEDOP_IPC_ARGS +#define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ + (__nsops), (__timeout), (__sops) + +#include diff --git a/sysdeps/unix/sysv/linux/s390/semtimedop.c b/sysdeps/unix/sysv/linux/s390/semtimedop.c deleted file mode 100644 index 772ee432a9..0000000000 --- a/sysdeps/unix/sysv/linux/s390/semtimedop.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2003-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Martin Schwidefsky , 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 - . */ - -#include -#include -#include -#include - -/* Perform user-defined atomical operation of array of semaphores. */ - -int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) -{ - /* 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 961c6d1f0b..1d746c4117 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -30,7 +30,7 @@ semtimedop (int semid, struct sembuf *sops, size_t nsops, #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); + return INLINE_SYSCALL_CALL (ipc, IPCOP_semtimedop, semid, + SEMTIMEDOP_IPC_ARGS (nsops, sops, timeout)); #endif }