From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1792) id C04E33858C5F; Mon, 1 May 2023 13:08:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C04E33858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682946488; bh=Bp/WSi75NCX13JVHVfohRMIb5t3DNerNg2183SDAXrs=; h=From:To:Subject:Date:From; b=Wl/cE6lqufOpgdbQqZK3PPyxpWoU0w4ktYzn8lm8xBZDmYG8Fv5poce8Dxgx4eMyI 4ebVjLfBcUl0pQpK+DjjEeC8LP0gQWsta32kiax19tkM/y8AEpU1cvJTnILek6dPq3 TCcj6LQ/eNPGoUkIifPsEv22j1zGP7OZ9TDhGuI8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Samuel Thibault To: glibc-cvs@sourceware.org Subject: [glibc] hurd 64bit: Fix struct msqid_ds and shmid_ds fields X-Act-Checkin: glibc X-Git-Author: Samuel Thibault X-Git-Refname: refs/heads/master X-Git-Oldrev: e3a3616dbf620fa9f260a4c1a779efbb15b4a506 X-Git-Newrev: e2b3d7f4853124746178148cf3f2af4e9c23f73d Message-Id: <20230501130808.C04E33858C5F@sourceware.org> Date: Mon, 1 May 2023 13:08:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e2b3d7f4853124746178148cf3f2af4e9c23f73d commit e2b3d7f4853124746178148cf3f2af4e9c23f73d Author: Samuel Thibault Date: Mon May 1 14:51:22 2023 +0200 hurd 64bit: Fix struct msqid_ds and shmid_ds fields 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. Diff: --- 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 ++++++++++++++++++++ .../mach/hurd/i386/bits/types/struct_msqid_ds.h | 43 ++++++++++++++++++++++ .../mach/hurd/i386/bits/types/struct_shmid_ds.h | 40 ++++++++++++++++++++ sysdeps/unix/sysv/linux/Makefile | 2 - 8 files changed, 169 insertions(+), 37 deletions(-) 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 \