]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/compat/freebsd32/freebsd32_ipc.h
Import DTS files for riscv from Linux 5.4
[FreeBSD/FreeBSD.git] / sys / compat / freebsd32 / freebsd32_ipc.h
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2002 Doug Rabson
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30
31 #ifndef _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
32 #define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
33
34 struct ipc_perm32 {
35         uid_t           cuid;
36         gid_t           cgid;
37         uid_t           uid;
38         gid_t           gid;
39         mode_t          mode;
40         uint16_t        seq;
41         uint32_t        key;
42 };
43
44 struct semid_ds32 {
45         struct ipc_perm32 sem_perm;
46         uint32_t        __sem_base;
47         unsigned short  sem_nsems;
48         int32_t         sem_otime;
49         int32_t         sem_ctime;
50 };
51
52 #ifdef _KERNEL
53 struct semid_kernel32 {
54         /* Data structure exposed to user space. */
55         struct semid_ds32       u;
56
57         /* Kernel-private components of the semaphore. */
58         int32_t                 label;
59         int32_t                 cred;
60 };
61 #endif /* _KERNEL */
62
63
64 union semun32 {
65         int             val;
66         uint32_t        buf;
67         uint32_t        array;
68 };
69
70 struct msqid_ds32 {
71         struct ipc_perm32 msg_perm;
72         uint32_t        __msg_first;
73         uint32_t        __msg_last;
74         uint32_t        msg_cbytes;
75         uint32_t        msg_qnum;
76         uint32_t        msg_qbytes;
77         pid_t           msg_lspid;
78         pid_t           msg_lrpid;
79         int32_t         msg_stime;
80         int32_t         msg_rtime;
81         int32_t         msg_ctime;
82 };
83
84 #ifdef _KERNEL
85 struct msqid_kernel32 {
86         /* Data structure exposed to user space. */
87         struct msqid_ds32       u;
88
89         /* Kernel-private components of the message queue. */
90         uint32_t                label;
91         uint32_t                cred;
92 };
93 #endif
94
95 struct shmid_ds32 {
96         struct ipc_perm32 shm_perm;
97         int32_t         shm_segsz;
98         pid_t           shm_lpid;
99         pid_t           shm_cpid;
100         unsigned int    shm_nattch;
101         int32_t         shm_atime;
102         int32_t         shm_dtime;
103         int32_t         shm_ctime;
104 };
105
106 #ifdef _KERNEL
107 struct shmid_kernel32 {
108         struct shmid_ds32        u;
109         int32_t                 *object;
110         int32_t                 *label;
111         int32_t                 *cred;
112 };
113 #endif
114
115 struct shm_info32 {
116         int32_t         used_ids;
117         uint32_t        shm_tot;
118         uint32_t        shm_rss;
119         uint32_t        shm_swp;
120         uint32_t        swap_attempts;
121         uint32_t        swap_successes;
122 };
123
124 struct shminfo32 {
125         uint32_t        shmmax;
126         uint32_t        shmmin;
127         uint32_t        shmmni;
128         uint32_t        shmseg;
129         uint32_t        shmall;
130 };
131
132 #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
133     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
134 struct ipc_perm32_old {
135         uint16_t        cuid;
136         uint16_t        cgid;
137         uint16_t        uid;
138         uint16_t        gid;
139         uint16_t        mode;
140         uint16_t        seq;
141         uint32_t        key;
142 };
143
144 struct semid_ds32_old {
145         struct ipc_perm32_old sem_perm;
146         uint32_t        __sem_base;
147         unsigned short  sem_nsems;
148         int32_t         sem_otime;
149         int32_t         sem_pad1;
150         int32_t         sem_ctime;
151         int32_t         sem_pad2;
152         int32_t         sem_pad3[4];
153 };
154
155 struct msqid_ds32_old {
156         struct ipc_perm32_old msg_perm;
157         uint32_t        __msg_first;
158         uint32_t        __msg_last;
159         uint32_t        msg_cbytes;
160         uint32_t        msg_qnum;
161         uint32_t        msg_qbytes;
162         pid_t           msg_lspid;
163         pid_t           msg_lrpid;
164         int32_t         msg_stime;
165         int32_t         msg_pad1;
166         int32_t         msg_rtime;
167         int32_t         msg_pad2;
168         int32_t         msg_ctime;
169         int32_t         msg_pad3;
170         int32_t         msg_pad4[4];
171 };
172
173 struct shmid_ds32_old {
174         struct ipc_perm32_old shm_perm;
175         int32_t         shm_segsz;
176         pid_t           shm_lpid;
177         pid_t           shm_cpid;
178         int16_t         shm_nattch;
179         int32_t         shm_atime;
180         int32_t         shm_dtime;
181         int32_t         shm_ctime;
182         uint32_t        shm_internal;
183 };
184
185 void    freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32,
186             struct ipc_perm *ip);
187 void    freebsd32_ipcperm_old_out(struct ipc_perm *ip,
188             struct ipc_perm32_old *ip32);
189 #endif
190
191 void    freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip);
192 void    freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32);
193
194 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */