From patchwork Wed Apr 1 16:53:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38702 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by sourceware.org (Postfix) with ESMTPS id 877A4385DC3E for ; Wed, 1 Apr 2020 17:02:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 877A4385DC3E IronPort-SDR: 4E2BLQQm25P/7G6zFNB+FXb2/Qoa8EbD2FyNk6b6agQbRX1uU9DGI2KocaXRbSvdUYxsLVFin5 S87GQD3gdNhnSxdkCPCheW+hjJMeRYwUHkI0D+k2y9cF2CelHs6bzXY+sYjBjIPVH2PgZ5gZht mxwIWuWDzpweckvnpZBca3FMws3Ruu7kH7Pm6hPZETlpP/2r4WxwwBBkihg/6rtocnV8wIT2A6 JiI0e5xtUEEXAps5+dOlhSA+oJ1ZEGO4xSrVjPGjX1gypqWpqM9HUxHbOl2hF2kXTEtiPQTEYy Xd8= X-URL-LookUp-ScanningError: 1 X-IronPort-AV: E=Sophos;i="5.72,332,1580745600"; d="scan'208";a="236579007" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Apr 2020 01:01:23 +0800 IronPort-SDR: cbO0GkCdehPxWiftglLZ48wflniCXpamEWDpAc38RCzfv4hw/qhbc6B1c3cVg5GLHNJJPLNF7D W/tbmzhuVRhEwm3eELQ/fDEAFLlxnb9qZ8YmWDURwsVy9gUsMvISudO5/yIxfvMkkLiEJN1P7I Br9sl5HY8Y5zPfrux4XFkTI9c/pYs39yaXKYK3y7sI27NCYekxWRQkwVdVcWv1YjSPmZzkWI5f hwNhKpLbye10bL13zHEuozRfN7o6NsYkiuLANZeCXLSopRBSRwCUqNBi2WydLyKRF/9M9NlEpJ qCLGrFAwhwvSRkYjRst/1Y+J Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2020 09:52:29 -0700 IronPort-SDR: ebzX596XoP5n9XYPsLPIR2ElhFNHMYqQNtF+yLdVpIiLG2fIYYE/RESN4APvL5PQCTSWt5E2Iw z2EE56DaFeaC7H4V0tjf1r3ac79FSecxCibSkpOwiJWuUrtZLISTwNFBdB0uQN32x4i/B7AT2q xLh2Y3rQxN0Xfhg8uABRaT9F84H8vGyR4wZrkYxiXb9rv/UVi0aXZ1IYYwJQDvowJRpcwkGR2J PAac4EdFEhK4u1VBhUcUip+rfbgsF2N9jX0A7abje2VjLHo8UnxaUl/a76kQbzhr82MQetlTgV fv4= WDCIronportException: Internal Received: from cnf006887.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.14]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Apr 2020 10:01:03 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v5 1/3] bits/sem.h: Split out struct semid_ds Date: Wed, 1 Apr 2020 09:53:06 -0700 Message-Id: <20200401165308.1913271-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200401165308.1913271-1-alistair.francis@wdc.com> References: <20200401165308.1913271-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 17:02:51 -0000 Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/Makefile | 1 + sysdeps/unix/sysv/linux/bits/sem.h | 24 +---------- .../sysv/linux/bits/types/struct_semid_ds.h | 43 +++++++++++++++++++ 3 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 60dc5cf9e5..bbf1d60fc6 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -92,6 +92,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/termios-baud.h bits/termios-c_cflag.h \ bits/termios-c_lflag.h bits/termios-tcflow.h \ bits/termios-misc.h \ + bits/types/struct_semid_ds.h \ bits/ipc-perm.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index e0f4155c67..0d1813ec67 100644 --- a/sysdeps/unix/sysv/linux/bits/sem.h +++ b/sysdeps/unix/sysv/linux/bits/sem.h @@ -21,6 +21,7 @@ #include #include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -34,29 +35,6 @@ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ - -#if __SEM_PAD_BEFORE_TIME -# define __SEM_PAD_TIME(NAME, RES) \ - __syscall_ulong_t __glibc_reserved ## RES; __time_t NAME -#elif __SEM_PAD_AFTER_TIME -# define __SEM_PAD_TIME(NAME, RES) \ - __time_t NAME; __syscall_ulong_t __glibc_reserved ## RES -#else -# define __SEM_PAD_TIME(NAME, RES) \ - __time_t NAME -#endif - -/* Data structure describing a set of semaphores. */ -struct semid_ds -{ - struct ipc_perm sem_perm; /* operation permission struct */ - __SEM_PAD_TIME (sem_otime, 1); /* last semop() time */ - __SEM_PAD_TIME (sem_ctime, 2); /* last time changed by semctl() */ - __syscall_ulong_t sem_nsems; /* number of semaphores in set */ - __syscall_ulong_t __glibc_reserved3; - __syscall_ulong_t __glibc_reserved4; -}; - /* The user should define a union like the following to use it for arguments for `semctl'. diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000..ba0719e77a --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h @@ -0,0 +1,43 @@ +/* Generic implementation of the semaphore struct semid_ds + Copyright (C) 1995-2020 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 + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#if __SEM_PAD_BEFORE_TIME +# define __SEM_PAD_TIME(NAME, RES) \ + __syscall_ulong_t __glibc_reserved ## RES; __time_t NAME +#elif __SEM_PAD_AFTER_TIME +# define __SEM_PAD_TIME(NAME, RES) \ + __time_t NAME; __syscall_ulong_t __glibc_reserved ## RES +#else +# define __SEM_PAD_TIME(NAME, RES) \ + __time_t NAME +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __SEM_PAD_TIME (sem_otime, 1); /* last semop() time */ + __SEM_PAD_TIME (sem_ctime, 2); /* last time changed by semctl() */ + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; +};