1 | /* Old SysV permission definition for Linux. Default version. |
2 | Copyright (C) 1995-2023 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #include <sys/ipc.h> /* For __key_t */ |
20 | #include <kernel-features.h> |
21 | |
22 | #ifdef __ASSUME_SYSVIPC_DEFAULT_IPC_64 |
23 | # define __IPC_64 0x0 |
24 | #else |
25 | # define __IPC_64 0x100 |
26 | #endif |
27 | |
28 | #ifndef __OLD_IPC_ID_TYPE |
29 | # define __OLD_IPC_ID_TYPE unsigned short int |
30 | #endif |
31 | #ifndef __OLD_IPC_MODE_TYPE |
32 | # define __OLD_IPC_MODE_TYPE unsigned short int |
33 | #endif |
34 | |
35 | struct __old_ipc_perm |
36 | { |
37 | __key_t __key; /* Key. */ |
38 | __OLD_IPC_ID_TYPE uid; /* Owner's user ID. */ |
39 | __OLD_IPC_ID_TYPE gid; /* Owner's group ID. */ |
40 | __OLD_IPC_ID_TYPE cuid; /* Creator's user ID. */ |
41 | __OLD_IPC_ID_TYPE cgid; /* Creator's group ID. */ |
42 | __OLD_IPC_MODE_TYPE mode; /* Read/write permission. */ |
43 | unsigned short int __seq; /* Sequence number. */ |
44 | }; |
45 | |
46 | #define SEMCTL_ARG_ADDRESS(__arg) &__arg.array |
47 | |
48 | #define MSGRCV_ARGS(__msgp, __msgtyp) \ |
49 | ((long int []){ (long int) __msgp, __msgtyp }) |
50 | |
51 | /* This macro is required to handle the s390 variants, which passes the |
52 | arguments in a different order than default. */ |
53 | #define SEMTIMEDOP_IPC_ARGS(__nsops, __sops, __timeout) \ |
54 | (__nsops), 0, (__sops), (__timeout) |
55 | |
56 | /* Linux SysV ipc does not provide new syscalls for 64-bit time support on |
57 | 32-bit architectures, but rather split the timestamp into high and low; |
58 | storing the high value in previously unused fields. */ |
59 | #if (__WORDSIZE == 32 \ |
60 | && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) |
61 | # define __IPC_TIME64 1 |
62 | #else |
63 | # define __IPC_TIME64 0 |
64 | #endif |
65 | |
66 | #if __IPC_TIME64 || defined __ASSUME_SYSVIPC_BROKEN_MODE_T |
67 | # define IPC_CTL_NEED_TRANSLATION 1 |
68 | #else |
69 | # define IPC_CTL_NEED_TRANSLATION 0 |
70 | #endif |
71 | |
72 | #include <ipc_ops.h> |
73 | |