xref: /freebsd/sys/compat/freebsd32/freebsd32_ipc.h (revision 957f014dc076a7f74ed0c8c8699e6f39b55785e7)
1d43c6fa4SJohn Baldwin /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
37f2d13d6SPedro F. Giffuni  *
4d43c6fa4SJohn Baldwin  * Copyright (c) 2002 Doug Rabson
5d43c6fa4SJohn Baldwin  * All rights reserved.
6d43c6fa4SJohn Baldwin  *
7d43c6fa4SJohn Baldwin  * Redistribution and use in source and binary forms, with or without
8d43c6fa4SJohn Baldwin  * modification, are permitted provided that the following conditions
9d43c6fa4SJohn Baldwin  * are met:
10d43c6fa4SJohn Baldwin  * 1. Redistributions of source code must retain the above copyright
11d43c6fa4SJohn Baldwin  *    notice, this list of conditions and the following disclaimer.
12d43c6fa4SJohn Baldwin  * 2. Redistributions in binary form must reproduce the above copyright
13d43c6fa4SJohn Baldwin  *    notice, this list of conditions and the following disclaimer in the
14d43c6fa4SJohn Baldwin  *    documentation and/or other materials provided with the distribution.
15d43c6fa4SJohn Baldwin  *
16d43c6fa4SJohn Baldwin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17d43c6fa4SJohn Baldwin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18d43c6fa4SJohn Baldwin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19d43c6fa4SJohn Baldwin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20d43c6fa4SJohn Baldwin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21d43c6fa4SJohn Baldwin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22d43c6fa4SJohn Baldwin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23d43c6fa4SJohn Baldwin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24d43c6fa4SJohn Baldwin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25d43c6fa4SJohn Baldwin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26d43c6fa4SJohn Baldwin  * SUCH DAMAGE.
27d43c6fa4SJohn Baldwin  */
28d43c6fa4SJohn Baldwin 
29d43c6fa4SJohn Baldwin #ifndef _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
30d43c6fa4SJohn Baldwin #define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
31d43c6fa4SJohn Baldwin 
32d43c6fa4SJohn Baldwin struct ipc_perm32 {
33b648d480SJohn Baldwin 	uid_t		cuid;
34b648d480SJohn Baldwin 	gid_t		cgid;
35b648d480SJohn Baldwin 	uid_t		uid;
36b648d480SJohn Baldwin 	gid_t		gid;
37b648d480SJohn Baldwin 	mode_t		mode;
38d43c6fa4SJohn Baldwin 	uint16_t	seq;
39d43c6fa4SJohn Baldwin 	uint32_t	key;
40d43c6fa4SJohn Baldwin };
41d43c6fa4SJohn Baldwin 
423c39e0d8SJohn Baldwin struct semid_ds32 {
433c39e0d8SJohn Baldwin 	struct ipc_perm32 sem_perm;
4493e48a30SBrooks Davis 	uint32_t	__sem_base;
453c39e0d8SJohn Baldwin 	unsigned short	sem_nsems;
46*957f014dSBrooks Davis 	time32_t	sem_otime;
47*957f014dSBrooks Davis 	time32_t	sem_ctime;
483c39e0d8SJohn Baldwin };
493c39e0d8SJohn Baldwin 
500fd25723SBrooks Davis #ifdef _KERNEL
510fd25723SBrooks Davis struct semid_kernel32 {
520fd25723SBrooks Davis 	/* Data structure exposed to user space. */
530fd25723SBrooks Davis 	struct semid_ds32	u;
540fd25723SBrooks Davis 
550fd25723SBrooks Davis 	/* Kernel-private components of the semaphore. */
560fd25723SBrooks Davis 	int32_t			label;
570fd25723SBrooks Davis 	int32_t			cred;
580fd25723SBrooks Davis };
590fd25723SBrooks Davis #endif /* _KERNEL */
600fd25723SBrooks Davis 
613c39e0d8SJohn Baldwin union semun32 {
623c39e0d8SJohn Baldwin 	int		val;
633c39e0d8SJohn Baldwin 	uint32_t	buf;
643c39e0d8SJohn Baldwin 	uint32_t	array;
653c39e0d8SJohn Baldwin };
663c39e0d8SJohn Baldwin 
673c39e0d8SJohn Baldwin struct msqid_ds32 {
683c39e0d8SJohn Baldwin 	struct ipc_perm32 msg_perm;
6993e48a30SBrooks Davis 	uint32_t	__msg_first;
7093e48a30SBrooks Davis 	uint32_t	__msg_last;
713c39e0d8SJohn Baldwin 	uint32_t	msg_cbytes;
723c39e0d8SJohn Baldwin 	uint32_t	msg_qnum;
733c39e0d8SJohn Baldwin 	uint32_t	msg_qbytes;
743c39e0d8SJohn Baldwin 	pid_t		msg_lspid;
753c39e0d8SJohn Baldwin 	pid_t		msg_lrpid;
76*957f014dSBrooks Davis 	time32_t	msg_stime;
77*957f014dSBrooks Davis 	time32_t	msg_rtime;
78*957f014dSBrooks Davis 	time32_t	msg_ctime;
793c39e0d8SJohn Baldwin };
803c39e0d8SJohn Baldwin 
810fd25723SBrooks Davis #ifdef _KERNEL
820fd25723SBrooks Davis struct msqid_kernel32 {
830fd25723SBrooks Davis 	/* Data structure exposed to user space. */
840fd25723SBrooks Davis 	struct msqid_ds32	u;
850fd25723SBrooks Davis 
860fd25723SBrooks Davis 	/* Kernel-private components of the message queue. */
870fd25723SBrooks Davis 	uint32_t		label;
880fd25723SBrooks Davis 	uint32_t		cred;
890fd25723SBrooks Davis };
900fd25723SBrooks Davis #endif
910fd25723SBrooks Davis 
92d43c6fa4SJohn Baldwin struct shmid_ds32 {
93d43c6fa4SJohn Baldwin 	struct ipc_perm32 shm_perm;
94d43c6fa4SJohn Baldwin 	int32_t		shm_segsz;
95b648d480SJohn Baldwin 	pid_t		shm_lpid;
96b648d480SJohn Baldwin 	pid_t		shm_cpid;
97f63cd251SEd Schouten 	unsigned int	shm_nattch;
98*957f014dSBrooks Davis 	time32_t	shm_atime;
99*957f014dSBrooks Davis 	time32_t	shm_dtime;
100*957f014dSBrooks Davis 	time32_t	shm_ctime;
101d43c6fa4SJohn Baldwin };
102d43c6fa4SJohn Baldwin 
1030fd25723SBrooks Davis #ifdef _KERNEL
1040fd25723SBrooks Davis struct shmid_kernel32 {
1050fd25723SBrooks Davis 	struct shmid_ds32	u;
106da7fc5c3SJohn Baldwin 	int32_t			object;
107da7fc5c3SJohn Baldwin 	int32_t			label;
108da7fc5c3SJohn Baldwin 	int32_t			cred;
1090fd25723SBrooks Davis };
1100fd25723SBrooks Davis #endif
1110fd25723SBrooks Davis 
112d43c6fa4SJohn Baldwin struct shm_info32 {
113d43c6fa4SJohn Baldwin 	int32_t		used_ids;
114d43c6fa4SJohn Baldwin 	uint32_t	shm_tot;
115d43c6fa4SJohn Baldwin 	uint32_t	shm_rss;
116d43c6fa4SJohn Baldwin 	uint32_t	shm_swp;
117d43c6fa4SJohn Baldwin 	uint32_t	swap_attempts;
118d43c6fa4SJohn Baldwin 	uint32_t	swap_successes;
119d43c6fa4SJohn Baldwin };
120d43c6fa4SJohn Baldwin 
121d43c6fa4SJohn Baldwin struct shminfo32 {
122d43c6fa4SJohn Baldwin 	uint32_t	shmmax;
123d43c6fa4SJohn Baldwin 	uint32_t	shmmin;
124d43c6fa4SJohn Baldwin 	uint32_t	shmmni;
125d43c6fa4SJohn Baldwin 	uint32_t	shmseg;
126d43c6fa4SJohn Baldwin 	uint32_t	shmall;
127d43c6fa4SJohn Baldwin };
128d43c6fa4SJohn Baldwin 
129b648d480SJohn Baldwin #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
130b648d480SJohn Baldwin     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
1313b0cd7e5SBrooks Davis struct ipc_perm_old32 {
132b648d480SJohn Baldwin 	uint16_t	cuid;
133b648d480SJohn Baldwin 	uint16_t	cgid;
134b648d480SJohn Baldwin 	uint16_t	uid;
135b648d480SJohn Baldwin 	uint16_t	gid;
136b648d480SJohn Baldwin 	uint16_t	mode;
137b648d480SJohn Baldwin 	uint16_t	seq;
138b648d480SJohn Baldwin 	uint32_t	key;
139b648d480SJohn Baldwin };
140b648d480SJohn Baldwin 
1413b0cd7e5SBrooks Davis struct semid_ds_old32 {
1423b0cd7e5SBrooks Davis 	struct ipc_perm_old32 sem_perm;
14393e48a30SBrooks Davis 	uint32_t	__sem_base;
144b648d480SJohn Baldwin 	unsigned short	sem_nsems;
145*957f014dSBrooks Davis 	time32_t	sem_otime;
146b648d480SJohn Baldwin 	int32_t		sem_pad1;
147*957f014dSBrooks Davis 	time32_t	sem_ctime;
148b648d480SJohn Baldwin 	int32_t		sem_pad2;
149b648d480SJohn Baldwin 	int32_t		sem_pad3[4];
150b648d480SJohn Baldwin };
151b648d480SJohn Baldwin 
1523b0cd7e5SBrooks Davis struct msqid_ds_old32 {
1533b0cd7e5SBrooks Davis 	struct ipc_perm_old32 msg_perm;
15493e48a30SBrooks Davis 	uint32_t	__msg_first;
15593e48a30SBrooks Davis 	uint32_t	__msg_last;
156b648d480SJohn Baldwin 	uint32_t	msg_cbytes;
157b648d480SJohn Baldwin 	uint32_t	msg_qnum;
158b648d480SJohn Baldwin 	uint32_t	msg_qbytes;
159b648d480SJohn Baldwin 	pid_t		msg_lspid;
160b648d480SJohn Baldwin 	pid_t		msg_lrpid;
161*957f014dSBrooks Davis 	time32_t	msg_stime;
162b648d480SJohn Baldwin 	int32_t		msg_pad1;
163*957f014dSBrooks Davis 	time32_t	msg_rtime;
164b648d480SJohn Baldwin 	int32_t		msg_pad2;
165*957f014dSBrooks Davis 	time32_t	msg_ctime;
166b648d480SJohn Baldwin 	int32_t		msg_pad3;
167b648d480SJohn Baldwin 	int32_t		msg_pad4[4];
168b648d480SJohn Baldwin };
169b648d480SJohn Baldwin 
1703b0cd7e5SBrooks Davis struct shmid_ds_old32 {
1713b0cd7e5SBrooks Davis 	struct ipc_perm_old32 shm_perm;
172b648d480SJohn Baldwin 	int32_t		shm_segsz;
173b648d480SJohn Baldwin 	pid_t		shm_lpid;
174b648d480SJohn Baldwin 	pid_t		shm_cpid;
175b648d480SJohn Baldwin 	int16_t		shm_nattch;
176*957f014dSBrooks Davis 	time32_t	shm_atime;
177*957f014dSBrooks Davis 	time32_t	shm_dtime;
178*957f014dSBrooks Davis 	time32_t	shm_ctime;
179b648d480SJohn Baldwin 	uint32_t	shm_internal;
180b648d480SJohn Baldwin };
1814cfc39cfSKonstantin Belousov 
182e5b09976SBrooks Davis union semun_old32 {
183e5b09976SBrooks Davis 	int		val;
184e5b09976SBrooks Davis 	uint32_t	buf;
185e5b09976SBrooks Davis 	uint32_t	array;
186e5b09976SBrooks Davis };
187e5b09976SBrooks Davis 
1883b0cd7e5SBrooks Davis void	freebsd32_ipcperm_old_in(struct ipc_perm_old32 *ip32,
1894cfc39cfSKonstantin Belousov 	    struct ipc_perm *ip);
1904cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_old_out(struct ipc_perm *ip,
1913b0cd7e5SBrooks Davis 	    struct ipc_perm_old32 *ip32);
192b648d480SJohn Baldwin #endif
193b648d480SJohn Baldwin 
1944cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip);
1954cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32);
1964cfc39cfSKonstantin Belousov 
197d43c6fa4SJohn Baldwin #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */
198