From patchwork Mon May 1 13:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 68596 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9AD3C3858002 for ; Mon, 1 May 2023 13:10:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 65D523858D39 for ; Mon, 1 May 2023 13:09:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65D523858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 60D1F20186; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wWwDg7FAoFKm; Mon, 1 May 2023 15:09:53 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 3534E2015E; Mon, 1 May 2023 15:09:53 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1ptTHs-00G8pO-2S; Mon, 01 May 2023 15:09:52 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 1/3] hurd 64bit: Fix flock fields types Date: Mon, 1 May 2023 15:09:48 +0200 Message-Id: <20230501130950.3847171-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The standards want l_type and l_whence to be short ints, see BZ 23081. We can leave them ints on i386 for ABI compatibility, but avoid hitting the issue on 64bit. --- sysdeps/mach/hurd/Makefile | 2 + sysdeps/mach/hurd/bits/fcntl.h | 28 +---------- sysdeps/mach/hurd/bits/types/struct_flock.h | 46 +++++++++++++++++++ .../mach/hurd/i386/bits/types/struct_flock.h | 46 +++++++++++++++++++ 4 files changed, 95 insertions(+), 27 deletions(-) create mode 100644 sysdeps/mach/hurd/bits/types/struct_flock.h create mode 100644 sysdeps/mach/hurd/i386/bits/types/struct_flock.h diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 8fb6baf09e..b585d57b78 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -209,6 +209,8 @@ sysdep_routines += f_setlk close_nocancel close_nocancel_nostatus \ xstat fxstat lxstat xstat64 fxstat64 lxstat64 \ xmknod xmknodat \ fxstatat fxstatat64 + +sysdep_headers += bits/types/struct_flock.h endif ifeq (misc, $(subdir)) diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h index c24a819e02..74450b5c6a 100644 --- a/sysdeps/mach/hurd/bits/fcntl.h +++ b/sysdeps/mach/hurd/bits/fcntl.h @@ -190,33 +190,7 @@ #include - -/* The structure describing an advisory lock. This is the type of the third - argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ -struct flock - { - int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - int l_whence; /* Where `l_start' is relative to (like `lseek'). */ -#ifndef __USE_FILE_OFFSET64 - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ -#else - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ -#endif - __pid_t l_pid; /* Process holding the lock. */ - }; - -#ifdef __USE_LARGEFILE64 -struct flock64 - { - int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off64_t l_start; /* Offset where the lock begins. */ - __off64_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; -#endif +#include /* Values for the `l_type' field of a `struct flock'. */ #define F_RDLCK 1 /* Read lock. */ diff --git a/sysdeps/mach/hurd/bits/types/struct_flock.h b/sysdeps/mach/hurd/bits/types/struct_flock.h new file mode 100644 index 0000000000..9161c2cee4 --- /dev/null +++ b/sysdeps/mach/hurd/bits/types/struct_flock.h @@ -0,0 +1,46 @@ +/* flock structure. Generic version. + Copyright (C) 1993-2023 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 structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif diff --git a/sysdeps/mach/hurd/i386/bits/types/struct_flock.h b/sysdeps/mach/hurd/i386/bits/types/struct_flock.h new file mode 100644 index 0000000000..24305b0a25 --- /dev/null +++ b/sysdeps/mach/hurd/i386/bits/types/struct_flock.h @@ -0,0 +1,46 @@ +/* flock structure. i386 version. + Copyright (C) 1993-2023 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 structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct flock + { + int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif From patchwork Mon May 1 13:09:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 68597 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0566C38582BD for ; Mon, 1 May 2023 13:10:10 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 2BAAE3858D28 for ; Mon, 1 May 2023 13:09:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BAAE3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 5A00320184; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qP1pOWGo1EsB; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 2618520181; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1ptTHt-00G8pT-2X; Mon, 01 May 2023 15:09:53 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 2/3] hurd 64bit: Fix ipc_perm fields types Date: Mon, 1 May 2023 15:09:49 +0200 Message-Id: <20230501130950.3847171-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501130950.3847171-1-samuel.thibault@ens-lyon.org> References: <20230501130950.3847171-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The standards want uid/cuid to be uid_t, gid/cgid to be gid_t and mode to be mode_t, see BZ 23082. We can leave them short ints on i386 for ABI compatibility, but avoid hitting the issue on 64bit. bits/ipc.h ends up being exactly the same in sysdeps/gnu/ and sysdeps/unix/sysv/linux/, so remove the latter. --- sysdeps/gnu/Makefile | 4 +++ sysdeps/gnu/bits/ipc-perm.h | 33 +++++++++++++++++++++ sysdeps/gnu/bits/ipc.h | 13 +-------- sysdeps/mach/hurd/i386/bits/ipc-perm.h | 33 +++++++++++++++++++++ sysdeps/unix/sysv/linux/Makefile | 1 - sysdeps/unix/sysv/linux/bits/ipc.h | 40 -------------------------- 6 files changed, 71 insertions(+), 53 deletions(-) create mode 100644 sysdeps/gnu/bits/ipc-perm.h create mode 100644 sysdeps/mach/hurd/i386/bits/ipc-perm.h delete mode 100644 sysdeps/unix/sysv/linux/bits/ipc.h diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index e3ba3d0ff5..4798ff692b 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -44,3 +44,7 @@ librt-sysdep_routines += rt-unwind-resume librt-shared-only-routines += rt-unwind-resume CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables endif + +ifeq ($(subdir),sysvipc) +sysdep_headers += bits/ipc-perm.h +endif diff --git a/sysdeps/gnu/bits/ipc-perm.h b/sysdeps/gnu/bits/ipc-perm.h new file mode 100644 index 0000000000..f5a7d7b134 --- /dev/null +++ b/sysdeps/gnu/bits/ipc-perm.h @@ -0,0 +1,33 @@ +/* struct ipc_perm definition. + Copyright (C) 1995-2023 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_IPC_H +# error "Never use directly; include instead." +#endif + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + }; diff --git a/sysdeps/gnu/bits/ipc.h b/sysdeps/gnu/bits/ipc.h index e41c11c3de..b62beb1323 100644 --- a/sysdeps/gnu/bits/ipc.h +++ b/sysdeps/gnu/bits/ipc.h @@ -37,15 +37,4 @@ /* Special key values. */ #define IPC_PRIVATE ((__key_t) 0) /* Private key. */ - -/* Data structure used to pass permission information to IPC operations. */ -struct ipc_perm - { - __key_t __key; /* Key. */ - unsigned short int uid; /* Owner's user ID. */ - unsigned short int gid; /* Owner's group ID. */ - unsigned short int cuid; /* Creator's user ID. */ - unsigned short int cgid; /* Creator's group ID. */ - unsigned short int mode; /* Read/write permission. */ - unsigned short int __seq; /* Sequence number. */ - }; +#include diff --git a/sysdeps/mach/hurd/i386/bits/ipc-perm.h b/sysdeps/mach/hurd/i386/bits/ipc-perm.h new file mode 100644 index 0000000000..06300a8b61 --- /dev/null +++ b/sysdeps/mach/hurd/i386/bits/ipc-perm.h @@ -0,0 +1,33 @@ +/* struct ipc_perm definition. + Copyright (C) 1995-2023 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_IPC_H +# error "Never use directly; include instead." +#endif + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + unsigned short int uid; /* Owner's user ID. */ + unsigned short int gid; /* Owner's group ID. */ + unsigned short int cuid; /* Creator's user ID. */ + unsigned short int cgid; /* Creator's group ID. */ + unsigned short int mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + }; diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 0160be8790..5d83fa3f90 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -125,7 +125,6 @@ sysdep_headers += \ bits/epoll.h \ bits/eventfd.h \ bits/inotify.h \ - bits/ipc-perm.h \ bits/mman-linux.h \ bits/mman-map-flags-generic.h \ bits/mman-shared.h \ diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h deleted file mode 100644 index b62beb1323..0000000000 --- a/sysdeps/unix/sysv/linux/bits/ipc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 1995-2023 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_IPC_H -# error "Never use directly; include instead." -#endif - -#include - -/* Mode bits for `msgget', `semget', and `shmget'. */ -#define IPC_CREAT 01000 /* Create key if key does not exist. */ -#define IPC_EXCL 02000 /* Fail if key exists. */ -#define IPC_NOWAIT 04000 /* Return error on wait. */ - -/* Control commands for `msgctl', `semctl', and `shmctl'. */ -#define IPC_RMID 0 /* Remove identifier. */ -#define IPC_SET 1 /* Set `ipc_perm' options. */ -#define IPC_STAT 2 /* Get `ipc_perm' options. */ -#ifdef __USE_GNU -# define IPC_INFO 3 /* See ipcs. */ -#endif - -/* Special key values. */ -#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ - -#include From patchwork Mon May 1 13:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 68598 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94A5D3857011 for ; Mon, 1 May 2023 13:10:35 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 27F943858C5F for ; Mon, 1 May 2023 13:09:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27F943858C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 5C95B20181; Mon, 1 May 2023 15:09:55 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WyucTsY8Henv; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 71CCD2015E; Mon, 1 May 2023 15:09:54 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1ptTHu-00G8pX-08; Mon, 01 May 2023 15:09:54 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 3/3] hurd 64bit: Fix struct msqid_ds and shmid_ds fields Date: Mon, 1 May 2023 15:09:50 +0200 Message-Id: <20230501130950.3847171-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501130950.3847171-1-samuel.thibault@ens-lyon.org> References: <20230501130950.3847171-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The standards want msg_lspid/msg_lrpid/shm_cpid/shm_lpid to be pid_t, see BZ 23083 and 23085. We can leave them __rpc_pid_t on i386 for ABI compatibility, but avoid hitting the issue on 64bit. --- sysdeps/gnu/Makefile | 4 +- sysdeps/gnu/bits/msq.h | 20 +-------- sysdeps/gnu/bits/shm.h | 16 +------ sysdeps/gnu/bits/types/struct_msqid_ds.h | 42 ++++++++++++++++++ sysdeps/gnu/bits/types/struct_shmid_ds.h | 39 +++++++++++++++++ .../hurd/i386/bits/types/struct_msqid_ds.h | 43 +++++++++++++++++++ .../hurd/i386/bits/types/struct_shmid_ds.h | 40 +++++++++++++++++ sysdeps/unix/sysv/linux/Makefile | 2 - 8 files changed, 169 insertions(+), 37 deletions(-) create mode 100644 sysdeps/gnu/bits/types/struct_msqid_ds.h create mode 100644 sysdeps/gnu/bits/types/struct_shmid_ds.h create mode 100644 sysdeps/mach/hurd/i386/bits/types/struct_msqid_ds.h create mode 100644 sysdeps/mach/hurd/i386/bits/types/struct_shmid_ds.h diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index 4798ff692b..d8d2b6e39f 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -46,5 +46,7 @@ CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables endif ifeq ($(subdir),sysvipc) -sysdep_headers += bits/ipc-perm.h +sysdep_headers += bits/ipc-perm.h \ + bits/types/struct_msqid_ds.h \ + bits/types/struct_shmid_ds.h endif diff --git a/sysdeps/gnu/bits/msq.h b/sysdeps/gnu/bits/msq.h index f85c9231e9..a507c56cc9 100644 --- a/sysdeps/gnu/bits/msq.h +++ b/sysdeps/gnu/bits/msq.h @@ -32,25 +32,7 @@ typedef unsigned short int msgqnum_t; typedef unsigned short int msglen_t; - -/* Structure of record for one message inside the kernel. - The type `struct msg' is opaque. */ -struct msqid_ds -{ - struct ipc_perm msg_perm; /* structure describing operation permission */ - struct msg *__msg_first; /* pointer to first message on queue */ - struct msg *__msg_last; /* pointer to last message on queue */ - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgrcv command */ - __time_t msg_ctime; /* time of last change */ - struct __wait_queue *__wwait; /* ??? */ - struct __wait_queue *__rwait; /* ??? */ - unsigned short int __msg_cbytes;/* current number of bytes on queue */ - msgqnum_t msg_qnum; /* number of messages currently on queue */ - msglen_t msg_qbytes; /* max number of bytes allowed on queue */ - __ipc_pid_t msg_lspid; /* pid of last msgsnd() */ - __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ -}; +#include #ifdef __USE_MISC diff --git a/sysdeps/gnu/bits/shm.h b/sysdeps/gnu/bits/shm.h index 43f1362bc5..8908e910f7 100644 --- a/sysdeps/gnu/bits/shm.h +++ b/sysdeps/gnu/bits/shm.h @@ -45,21 +45,7 @@ extern int __getpagesize (void) __THROW __attribute__ ((__const__)); /* Type to count number of attaches. */ typedef unsigned short int shmatt_t; -/* Data structure describing a shared memory segment. */ -struct shmid_ds - { - struct ipc_perm shm_perm; /* operation permission struct */ - size_t shm_segsz; /* size of segment in bytes */ - __time_t shm_atime; /* time of last shmat() */ - __time_t shm_dtime; /* time of last shmdt() */ - __time_t shm_ctime; /* time of last change by shmctl() */ - __ipc_pid_t shm_cpid; /* pid of creator */ - __ipc_pid_t shm_lpid; /* pid of last shmop */ - shmatt_t shm_nattch; /* number of current attaches */ - unsigned short int __shm_npages; /* size of segment (pages) */ - unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ - struct __vm_area_struct *__attaches; /* descriptors for attaches */ - }; +#include #ifdef __USE_MISC diff --git a/sysdeps/gnu/bits/types/struct_msqid_ds.h b/sysdeps/gnu/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..0044df7370 --- /dev/null +++ b/sysdeps/gnu/bits/types/struct_msqid_ds.h @@ -0,0 +1,42 @@ +/* Generic implementation of the SysV message struct msqid_ds for GNU. + Copyright (C) 2020-2023 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_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + struct msg *__msg_first; /* pointer to first message on queue */ + struct msg *__msg_last; /* pointer to last message on queue */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + struct __wait_queue *__wwait; /* ??? */ + struct __wait_queue *__rwait; /* ??? */ + unsigned short int __msg_cbytes;/* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ +}; diff --git a/sysdeps/gnu/bits/types/struct_shmid_ds.h b/sysdeps/gnu/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..e221696fdf --- /dev/null +++ b/sysdeps/gnu/bits/types/struct_shmid_ds.h @@ -0,0 +1,39 @@ +/* Generic implementation of the shared memory struct shmid_ds for GNU. + Copyright (C) 2020-2023 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_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned short int __shm_npages; /* size of segment (pages) */ + unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct __vm_area_struct *__attaches; /* descriptors for attaches */ + }; diff --git a/sysdeps/mach/hurd/i386/bits/types/struct_msqid_ds.h b/sysdeps/mach/hurd/i386/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..35168682d4 --- /dev/null +++ b/sysdeps/mach/hurd/i386/bits/types/struct_msqid_ds.h @@ -0,0 +1,43 @@ +/* Machine-dependent of the SysV message struct msqid_ds for GNU Hurd. + i386 version. + Copyright (C) 2020-2023 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_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + struct msg *__msg_first; /* pointer to first message on queue */ + struct msg *__msg_last; /* pointer to last message on queue */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + struct __wait_queue *__wwait; /* ??? */ + struct __wait_queue *__rwait; /* ??? */ + unsigned short int __msg_cbytes;/* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __ipc_pid_t msg_lspid; /* pid of last msgsnd() */ + __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ +}; diff --git a/sysdeps/mach/hurd/i386/bits/types/struct_shmid_ds.h b/sysdeps/mach/hurd/i386/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..a12e274744 --- /dev/null +++ b/sysdeps/mach/hurd/i386/bits/types/struct_shmid_ds.h @@ -0,0 +1,40 @@ +/* Generic implementation of the shared memory struct shmid_ds for GNU Hurd. + i386 version. + Copyright (C) 2020-2023 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_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __ipc_pid_t shm_cpid; /* pid of creator */ + __ipc_pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned short int __shm_npages; /* size of segment (pages) */ + unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct __vm_area_struct *__attaches; /* descriptors for attaches */ + }; diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 5d83fa3f90..e73684d443 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -156,13 +156,11 @@ sysdep_headers += \ bits/timerfd.h \ bits/types/struct_msqid64_ds.h \ bits/types/struct_msqid64_ds_helper.h \ - bits/types/struct_msqid_ds.h \ bits/types/struct_semid64_ds.h \ bits/types/struct_semid64_ds_helper.h \ bits/types/struct_semid_ds.h \ bits/types/struct_shmid64_ds.h \ bits/types/struct_shmid64_ds_helper.h \ - bits/types/struct_shmid_ds.h \ scsi/scsi.h \ scsi/scsi_ioctl.h \ scsi/sg.h \