xref: /freebsd/sys/compat/freebsd32/freebsd32_ipc.h (revision 93e48a303a74db9aa4ba9c48cb99f66c8fbeb840)
1d43c6fa4SJohn Baldwin /*-
27f2d13d6SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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  * $FreeBSD$
29d43c6fa4SJohn Baldwin  */
30d43c6fa4SJohn Baldwin 
31d43c6fa4SJohn Baldwin #ifndef _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
32d43c6fa4SJohn Baldwin #define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
33d43c6fa4SJohn Baldwin 
34d43c6fa4SJohn Baldwin struct ipc_perm32 {
35b648d480SJohn Baldwin 	uid_t		cuid;
36b648d480SJohn Baldwin 	gid_t		cgid;
37b648d480SJohn Baldwin 	uid_t		uid;
38b648d480SJohn Baldwin 	gid_t		gid;
39b648d480SJohn Baldwin 	mode_t		mode;
40d43c6fa4SJohn Baldwin 	uint16_t	seq;
41d43c6fa4SJohn Baldwin 	uint32_t	key;
42d43c6fa4SJohn Baldwin };
43d43c6fa4SJohn Baldwin 
443c39e0d8SJohn Baldwin struct semid_ds32 {
453c39e0d8SJohn Baldwin 	struct ipc_perm32 sem_perm;
46*93e48a30SBrooks Davis 	uint32_t	__sem_base;
473c39e0d8SJohn Baldwin 	unsigned short	sem_nsems;
483c39e0d8SJohn Baldwin 	int32_t		sem_otime;
493c39e0d8SJohn Baldwin 	int32_t		sem_ctime;
503c39e0d8SJohn Baldwin };
513c39e0d8SJohn Baldwin 
520fd25723SBrooks Davis #ifdef _KERNEL
530fd25723SBrooks Davis struct semid_kernel32 {
540fd25723SBrooks Davis 	/* Data structure exposed to user space. */
550fd25723SBrooks Davis 	struct semid_ds32	u;
560fd25723SBrooks Davis 
570fd25723SBrooks Davis 	/* Kernel-private components of the semaphore. */
580fd25723SBrooks Davis 	int32_t			label;
590fd25723SBrooks Davis 	int32_t			cred;
600fd25723SBrooks Davis };
610fd25723SBrooks Davis #endif /* _KERNEL */
620fd25723SBrooks Davis 
630fd25723SBrooks Davis 
643c39e0d8SJohn Baldwin union semun32 {
653c39e0d8SJohn Baldwin 	int		val;
663c39e0d8SJohn Baldwin 	uint32_t	buf;
673c39e0d8SJohn Baldwin 	uint32_t	array;
683c39e0d8SJohn Baldwin };
693c39e0d8SJohn Baldwin 
703c39e0d8SJohn Baldwin struct msqid_ds32 {
713c39e0d8SJohn Baldwin 	struct ipc_perm32 msg_perm;
72*93e48a30SBrooks Davis 	uint32_t	__msg_first;
73*93e48a30SBrooks Davis 	uint32_t	__msg_last;
743c39e0d8SJohn Baldwin 	uint32_t	msg_cbytes;
753c39e0d8SJohn Baldwin 	uint32_t	msg_qnum;
763c39e0d8SJohn Baldwin 	uint32_t	msg_qbytes;
773c39e0d8SJohn Baldwin 	pid_t		msg_lspid;
783c39e0d8SJohn Baldwin 	pid_t		msg_lrpid;
793c39e0d8SJohn Baldwin 	int32_t		msg_stime;
803c39e0d8SJohn Baldwin 	int32_t		msg_rtime;
813c39e0d8SJohn Baldwin 	int32_t		msg_ctime;
823c39e0d8SJohn Baldwin };
833c39e0d8SJohn Baldwin 
840fd25723SBrooks Davis #ifdef _KERNEL
850fd25723SBrooks Davis struct msqid_kernel32 {
860fd25723SBrooks Davis 	/* Data structure exposed to user space. */
870fd25723SBrooks Davis 	struct msqid_ds32	u;
880fd25723SBrooks Davis 
890fd25723SBrooks Davis 	/* Kernel-private components of the message queue. */
900fd25723SBrooks Davis 	uint32_t		label;
910fd25723SBrooks Davis 	uint32_t		cred;
920fd25723SBrooks Davis };
930fd25723SBrooks Davis #endif
940fd25723SBrooks Davis 
95d43c6fa4SJohn Baldwin struct shmid_ds32 {
96d43c6fa4SJohn Baldwin 	struct ipc_perm32 shm_perm;
97d43c6fa4SJohn Baldwin 	int32_t		shm_segsz;
98b648d480SJohn Baldwin 	pid_t		shm_lpid;
99b648d480SJohn Baldwin 	pid_t		shm_cpid;
100f63cd251SEd Schouten 	unsigned int	shm_nattch;
101d43c6fa4SJohn Baldwin 	int32_t		shm_atime;
102d43c6fa4SJohn Baldwin 	int32_t		shm_dtime;
103d43c6fa4SJohn Baldwin 	int32_t		shm_ctime;
104d43c6fa4SJohn Baldwin };
105d43c6fa4SJohn Baldwin 
1060fd25723SBrooks Davis #ifdef _KERNEL
1070fd25723SBrooks Davis struct shmid_kernel32 {
1080fd25723SBrooks Davis 	struct shmid_ds32	 u;
1090fd25723SBrooks Davis 	int32_t			*object;
1100fd25723SBrooks Davis 	int32_t			*label;
1110fd25723SBrooks Davis 	int32_t			*cred;
1120fd25723SBrooks Davis };
1130fd25723SBrooks Davis #endif
1140fd25723SBrooks Davis 
115d43c6fa4SJohn Baldwin struct shm_info32 {
116d43c6fa4SJohn Baldwin 	int32_t		used_ids;
117d43c6fa4SJohn Baldwin 	uint32_t	shm_tot;
118d43c6fa4SJohn Baldwin 	uint32_t	shm_rss;
119d43c6fa4SJohn Baldwin 	uint32_t	shm_swp;
120d43c6fa4SJohn Baldwin 	uint32_t	swap_attempts;
121d43c6fa4SJohn Baldwin 	uint32_t	swap_successes;
122d43c6fa4SJohn Baldwin };
123d43c6fa4SJohn Baldwin 
124d43c6fa4SJohn Baldwin struct shminfo32 {
125d43c6fa4SJohn Baldwin 	uint32_t	shmmax;
126d43c6fa4SJohn Baldwin 	uint32_t	shmmin;
127d43c6fa4SJohn Baldwin 	uint32_t	shmmni;
128d43c6fa4SJohn Baldwin 	uint32_t	shmseg;
129d43c6fa4SJohn Baldwin 	uint32_t	shmall;
130d43c6fa4SJohn Baldwin };
131d43c6fa4SJohn Baldwin 
132b648d480SJohn Baldwin #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
133b648d480SJohn Baldwin     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
134b648d480SJohn Baldwin struct ipc_perm32_old {
135b648d480SJohn Baldwin 	uint16_t	cuid;
136b648d480SJohn Baldwin 	uint16_t	cgid;
137b648d480SJohn Baldwin 	uint16_t	uid;
138b648d480SJohn Baldwin 	uint16_t	gid;
139b648d480SJohn Baldwin 	uint16_t	mode;
140b648d480SJohn Baldwin 	uint16_t	seq;
141b648d480SJohn Baldwin 	uint32_t	key;
142b648d480SJohn Baldwin };
143b648d480SJohn Baldwin 
144b648d480SJohn Baldwin struct semid_ds32_old {
145b648d480SJohn Baldwin 	struct ipc_perm32_old sem_perm;
146*93e48a30SBrooks Davis 	uint32_t	__sem_base;
147b648d480SJohn Baldwin 	unsigned short	sem_nsems;
148b648d480SJohn Baldwin 	int32_t		sem_otime;
149b648d480SJohn Baldwin 	int32_t		sem_pad1;
150b648d480SJohn Baldwin 	int32_t		sem_ctime;
151b648d480SJohn Baldwin 	int32_t		sem_pad2;
152b648d480SJohn Baldwin 	int32_t		sem_pad3[4];
153b648d480SJohn Baldwin };
154b648d480SJohn Baldwin 
155b648d480SJohn Baldwin struct msqid_ds32_old {
156b648d480SJohn Baldwin 	struct ipc_perm32_old msg_perm;
157*93e48a30SBrooks Davis 	uint32_t	__msg_first;
158*93e48a30SBrooks Davis 	uint32_t	__msg_last;
159b648d480SJohn Baldwin 	uint32_t	msg_cbytes;
160b648d480SJohn Baldwin 	uint32_t	msg_qnum;
161b648d480SJohn Baldwin 	uint32_t	msg_qbytes;
162b648d480SJohn Baldwin 	pid_t		msg_lspid;
163b648d480SJohn Baldwin 	pid_t		msg_lrpid;
164b648d480SJohn Baldwin 	int32_t		msg_stime;
165b648d480SJohn Baldwin 	int32_t		msg_pad1;
166b648d480SJohn Baldwin 	int32_t		msg_rtime;
167b648d480SJohn Baldwin 	int32_t		msg_pad2;
168b648d480SJohn Baldwin 	int32_t		msg_ctime;
169b648d480SJohn Baldwin 	int32_t		msg_pad3;
170b648d480SJohn Baldwin 	int32_t		msg_pad4[4];
171b648d480SJohn Baldwin };
172b648d480SJohn Baldwin 
173b648d480SJohn Baldwin struct shmid_ds32_old {
174b648d480SJohn Baldwin 	struct ipc_perm32_old shm_perm;
175b648d480SJohn Baldwin 	int32_t		shm_segsz;
176b648d480SJohn Baldwin 	pid_t		shm_lpid;
177b648d480SJohn Baldwin 	pid_t		shm_cpid;
178b648d480SJohn Baldwin 	int16_t		shm_nattch;
179b648d480SJohn Baldwin 	int32_t		shm_atime;
180b648d480SJohn Baldwin 	int32_t		shm_dtime;
181b648d480SJohn Baldwin 	int32_t		shm_ctime;
182b648d480SJohn Baldwin 	uint32_t	shm_internal;
183b648d480SJohn Baldwin };
1844cfc39cfSKonstantin Belousov 
1854cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32,
1864cfc39cfSKonstantin Belousov 	    struct ipc_perm *ip);
1874cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_old_out(struct ipc_perm *ip,
1884cfc39cfSKonstantin Belousov 	    struct ipc_perm32_old *ip32);
189b648d480SJohn Baldwin #endif
190b648d480SJohn Baldwin 
1914cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip);
1924cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32);
1934cfc39cfSKonstantin Belousov 
194d43c6fa4SJohn Baldwin #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */
195