From patchwork Thu Mar 5 01:26:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38419 Received: (qmail 119441 invoked by alias); 5 Mar 2020 01:33:28 -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 119320 invoked by uid 89); 5 Mar 2020 01:33:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy= X-HELO: esa2.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1583372006; x=1614908006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YrOZT8g7QBauZ+zUHMmIanNW1OEekoAu+ljW8SYfOFQ=; b=gWIw7rtwUR7aoui4v+V1lAdt325IeiPnv5gj+KuLQthS/obDkSumSAcS wHW2KXW0uGtoamHfrzpVr0b5XCGH3bSKP27mWXAwzm7CnZnA5ywx1wFgH 1cyBgjlHjD4kZpPT6AKZcZl5mpLdiPVH9kX3oTvmXL3l5REB1nZjOjvN+ oqAYS6DUWCA8Tr++prCfWMCJ08ymZHfTxCfIElHubqVA1rja/FtWCpRpj 3eKuaB/Pm7B2Ue8/BFIVRvuPnrFN9iuu2ivbvBmH2RMonO0xAAbxa8eHD NzdVDV+m16tGeQLpubX3f/dEHFvqq1IVJlfyFByNUgD4Ed+Jbch76xb+N Q==; IronPort-SDR: b4LKYfYnuJSoesJs/2ECSxfAUyjrUmQj5BJMFoxyDxLgnbEHouMEe7PXg8ubNjjGFx2QcvwlJe QafHWqsISDTrjJ8Cu6i8Jp7XK/nXXVIYqvr79M+jgLyxAt9xIRFz5UcnSqSVaXAifmV3H+Xmhu 2aA+cGeGKS+pvZbC/L1vGEWaOn/Evc6NzXqlKxJZU6aYOxJ3gun0AIGAEfu7gctKzXb6EXXRAN JBhEN42R4VTZAtGCXP3v/LExZOztExhXDbhbCY6o1Hu1Po2ZOoRfU4aB9VayexF7W7fe0NN37f rqg= IronPort-SDR: fmXUcgWNFaxL25V6a2VbfmJiqibLSYNDpGYXG+Qrlv2kxXYdXigpJT/BQ/b/sez0AqkO3yZngx 6byfjQQvQOUqijTLBk+Xuwl3vTGxexo4SrXPIBBI+SqcDt/3csu3/754XGdA2kDiJSVxV5qK+L 3Mo9zYxBSUTWIMncgCQipUZ3vsR3r1wf4RlOYfecqPOu5VbHHLVHvKrQ9937g7t3ZlP8TfHiRq x4JiTYhAGOaZItwvoytvDi2HYz4JEwdP+Awo5WkoCS0AMjdXOe9+YGiGUl/yJstBfqqHAMqyoe jiAT5cKChgrIfpOHl9s1lqc0 IronPort-SDR: MOVD1w4UVHGlpQowUG+QHs8M7qBohEZVdSlVJnLmzLSckIW2Iq/igED3weqQbpMXmgfC8ufndS 5eUIwCny+VPWDbjjqj8igl8Cva0PsWfk2GQ/LZnU7iVwkfvqgtnF7Pm7/o3KhfmMiRvgiG0b1M 9QgT+4ynw/cUey1wRAdmDvdtNfkYW6/xDDNJ909Wd8wuVyzxkvzUuQwiAtpo/mGYLPTq/q3Ilm kns+DPnVLHZLoh+WXcJxuECrZSKoXORjctO5H90rYKLMsdf3Dl4lnCuTC/9TtnM/zl6esyoh+L QHI= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v3 1/3] bits/sem.h: Split out struct semid_ds Date: Wed, 4 Mar 2020 17:26:03 -0800 Message-Id: <20200305012605.26870-2-alistair.francis@wdc.com> In-Reply-To: <20200305012605.26870-1-alistair.francis@wdc.com> References: <20200305012605.26870-1-alistair.francis@wdc.com> MIME-Version: 1.0 Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. --- sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/bits/sem.h | 24 +------------ sysdeps/unix/sysv/linux/bits/semid_ds_t.h | 43 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/bits/semid_ds_t.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 60dc5cf9e5..cd6721bdbb 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -86,7 +86,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/siginfo-arch.h bits/siginfo-consts-arch.h \ bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \ bits/procfs-prregset.h bits/mman-map-flags-generic.h \ - bits/msq-pad.h bits/sem-pad.h bits/shmlba.h bits/shm-pad.h \ + bits/msq-pad.h bits/semid_ds_t.h bits/sem-pad.h bits/shmlba.h bits/shm-pad.h \ bits/termios-struct.h bits/termios-c_cc.h \ bits/termios-c_iflag.h bits/termios-c_oflag.h \ bits/termios-baud.h bits/termios-c_cflag.h \ diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index e0f4155c67..5c2f6be4c3 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/semid_ds_t.h b/sysdeps/unix/sysv/linux/bits/semid_ds_t.h new file mode 100644 index 0000000000..baed55ca8b --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/semid_ds_t.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; +};