summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-01 14:51:22 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-01 15:07:51 +0200
commite2b3d7f4853124746178148cf3f2af4e9c23f73d (patch)
treebc7ed2a890769ffb6dcf2127a45cc48fa9e3e11a /sysdeps/mach
parente3a3616dbf620fa9f260a4c1a779efbb15b4a506 (diff)
downloadglibc-e2b3d7f4853124746178148cf3f2af4e9c23f73d.tar.gz
glibc-e2b3d7f4853124746178148cf3f2af4e9c23f73d.tar.xz
glibc-e2b3d7f4853124746178148cf3f2af4e9c23f73d.zip
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.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/i386/bits/types/struct_msqid_ds.h43
-rw-r--r--sysdeps/mach/hurd/i386/bits/types/struct_shmid_ds.h40
2 files changed, 83 insertions, 0 deletions
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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_MSG_H
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <bits/types/time_t.h>
+
+/* 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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/types/struct_shmid_ds.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types/time_t.h>
+
+/* 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 */
+  };