xref: /freebsd/sys/compat/freebsd32/freebsd32_ipc.h (revision e5b0997650582504139835fdaad07d166127e5fc)
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;
4693e48a30SBrooks 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 
633c39e0d8SJohn Baldwin union semun32 {
643c39e0d8SJohn Baldwin 	int		val;
653c39e0d8SJohn Baldwin 	uint32_t	buf;
663c39e0d8SJohn Baldwin 	uint32_t	array;
673c39e0d8SJohn Baldwin };
683c39e0d8SJohn Baldwin 
693c39e0d8SJohn Baldwin struct msqid_ds32 {
703c39e0d8SJohn Baldwin 	struct ipc_perm32 msg_perm;
7193e48a30SBrooks Davis 	uint32_t	__msg_first;
7293e48a30SBrooks Davis 	uint32_t	__msg_last;
733c39e0d8SJohn Baldwin 	uint32_t	msg_cbytes;
743c39e0d8SJohn Baldwin 	uint32_t	msg_qnum;
753c39e0d8SJohn Baldwin 	uint32_t	msg_qbytes;
763c39e0d8SJohn Baldwin 	pid_t		msg_lspid;
773c39e0d8SJohn Baldwin 	pid_t		msg_lrpid;
783c39e0d8SJohn Baldwin 	int32_t		msg_stime;
793c39e0d8SJohn Baldwin 	int32_t		msg_rtime;
803c39e0d8SJohn Baldwin 	int32_t		msg_ctime;
813c39e0d8SJohn Baldwin };
823c39e0d8SJohn Baldwin 
830fd25723SBrooks Davis #ifdef _KERNEL
840fd25723SBrooks Davis struct msqid_kernel32 {
850fd25723SBrooks Davis 	/* Data structure exposed to user space. */
860fd25723SBrooks Davis 	struct msqid_ds32	u;
870fd25723SBrooks Davis 
880fd25723SBrooks Davis 	/* Kernel-private components of the message queue. */
890fd25723SBrooks Davis 	uint32_t		label;
900fd25723SBrooks Davis 	uint32_t		cred;
910fd25723SBrooks Davis };
920fd25723SBrooks Davis #endif
930fd25723SBrooks Davis 
94d43c6fa4SJohn Baldwin struct shmid_ds32 {
95d43c6fa4SJohn Baldwin 	struct ipc_perm32 shm_perm;
96d43c6fa4SJohn Baldwin 	int32_t		shm_segsz;
97b648d480SJohn Baldwin 	pid_t		shm_lpid;
98b648d480SJohn Baldwin 	pid_t		shm_cpid;
99f63cd251SEd Schouten 	unsigned int	shm_nattch;
100d43c6fa4SJohn Baldwin 	int32_t		shm_atime;
101d43c6fa4SJohn Baldwin 	int32_t		shm_dtime;
102d43c6fa4SJohn Baldwin 	int32_t		shm_ctime;
103d43c6fa4SJohn Baldwin };
104d43c6fa4SJohn Baldwin 
1050fd25723SBrooks Davis #ifdef _KERNEL
1060fd25723SBrooks Davis struct shmid_kernel32 {
1070fd25723SBrooks Davis 	struct shmid_ds32	 u;
1080fd25723SBrooks Davis 	int32_t			*object;
1090fd25723SBrooks Davis 	int32_t			*label;
1100fd25723SBrooks Davis 	int32_t			*cred;
1110fd25723SBrooks Davis };
1120fd25723SBrooks Davis #endif
1130fd25723SBrooks Davis 
114d43c6fa4SJohn Baldwin struct shm_info32 {
115d43c6fa4SJohn Baldwin 	int32_t		used_ids;
116d43c6fa4SJohn Baldwin 	uint32_t	shm_tot;
117d43c6fa4SJohn Baldwin 	uint32_t	shm_rss;
118d43c6fa4SJohn Baldwin 	uint32_t	shm_swp;
119d43c6fa4SJohn Baldwin 	uint32_t	swap_attempts;
120d43c6fa4SJohn Baldwin 	uint32_t	swap_successes;
121d43c6fa4SJohn Baldwin };
122d43c6fa4SJohn Baldwin 
123d43c6fa4SJohn Baldwin struct shminfo32 {
124d43c6fa4SJohn Baldwin 	uint32_t	shmmax;
125d43c6fa4SJohn Baldwin 	uint32_t	shmmin;
126d43c6fa4SJohn Baldwin 	uint32_t	shmmni;
127d43c6fa4SJohn Baldwin 	uint32_t	shmseg;
128d43c6fa4SJohn Baldwin 	uint32_t	shmall;
129d43c6fa4SJohn Baldwin };
130d43c6fa4SJohn Baldwin 
131b648d480SJohn Baldwin #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
132b648d480SJohn Baldwin     defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
133b648d480SJohn Baldwin struct ipc_perm32_old {
134b648d480SJohn Baldwin 	uint16_t	cuid;
135b648d480SJohn Baldwin 	uint16_t	cgid;
136b648d480SJohn Baldwin 	uint16_t	uid;
137b648d480SJohn Baldwin 	uint16_t	gid;
138b648d480SJohn Baldwin 	uint16_t	mode;
139b648d480SJohn Baldwin 	uint16_t	seq;
140b648d480SJohn Baldwin 	uint32_t	key;
141b648d480SJohn Baldwin };
142b648d480SJohn Baldwin 
143b648d480SJohn Baldwin struct semid_ds32_old {
144b648d480SJohn Baldwin 	struct ipc_perm32_old sem_perm;
14593e48a30SBrooks Davis 	uint32_t	__sem_base;
146b648d480SJohn Baldwin 	unsigned short	sem_nsems;
147b648d480SJohn Baldwin 	int32_t		sem_otime;
148b648d480SJohn Baldwin 	int32_t		sem_pad1;
149b648d480SJohn Baldwin 	int32_t		sem_ctime;
150b648d480SJohn Baldwin 	int32_t		sem_pad2;
151b648d480SJohn Baldwin 	int32_t		sem_pad3[4];
152b648d480SJohn Baldwin };
153b648d480SJohn Baldwin 
154b648d480SJohn Baldwin struct msqid_ds32_old {
155b648d480SJohn Baldwin 	struct ipc_perm32_old msg_perm;
15693e48a30SBrooks Davis 	uint32_t	__msg_first;
15793e48a30SBrooks Davis 	uint32_t	__msg_last;
158b648d480SJohn Baldwin 	uint32_t	msg_cbytes;
159b648d480SJohn Baldwin 	uint32_t	msg_qnum;
160b648d480SJohn Baldwin 	uint32_t	msg_qbytes;
161b648d480SJohn Baldwin 	pid_t		msg_lspid;
162b648d480SJohn Baldwin 	pid_t		msg_lrpid;
163b648d480SJohn Baldwin 	int32_t		msg_stime;
164b648d480SJohn Baldwin 	int32_t		msg_pad1;
165b648d480SJohn Baldwin 	int32_t		msg_rtime;
166b648d480SJohn Baldwin 	int32_t		msg_pad2;
167b648d480SJohn Baldwin 	int32_t		msg_ctime;
168b648d480SJohn Baldwin 	int32_t		msg_pad3;
169b648d480SJohn Baldwin 	int32_t		msg_pad4[4];
170b648d480SJohn Baldwin };
171b648d480SJohn Baldwin 
172b648d480SJohn Baldwin struct shmid_ds32_old {
173b648d480SJohn Baldwin 	struct ipc_perm32_old shm_perm;
174b648d480SJohn Baldwin 	int32_t		shm_segsz;
175b648d480SJohn Baldwin 	pid_t		shm_lpid;
176b648d480SJohn Baldwin 	pid_t		shm_cpid;
177b648d480SJohn Baldwin 	int16_t		shm_nattch;
178b648d480SJohn Baldwin 	int32_t		shm_atime;
179b648d480SJohn Baldwin 	int32_t		shm_dtime;
180b648d480SJohn Baldwin 	int32_t		shm_ctime;
181b648d480SJohn Baldwin 	uint32_t	shm_internal;
182b648d480SJohn Baldwin };
1834cfc39cfSKonstantin Belousov 
184*e5b09976SBrooks Davis union semun_old32 {
185*e5b09976SBrooks Davis 	int		val;
186*e5b09976SBrooks Davis 	uint32_t	buf;
187*e5b09976SBrooks Davis 	uint32_t	array;
188*e5b09976SBrooks Davis };
189*e5b09976SBrooks Davis 
1904cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32,
1914cfc39cfSKonstantin Belousov 	    struct ipc_perm *ip);
1924cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_old_out(struct ipc_perm *ip,
1934cfc39cfSKonstantin Belousov 	    struct ipc_perm32_old *ip32);
194b648d480SJohn Baldwin #endif
195b648d480SJohn Baldwin 
1964cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip);
1974cfc39cfSKonstantin Belousov void	freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32);
1984cfc39cfSKonstantin Belousov 
199d43c6fa4SJohn Baldwin #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */
200