1174380Sjhb/*-
2174380Sjhb * Copyright (c) 2002 Doug Rabson
3174380Sjhb * All rights reserved.
4174380Sjhb *
5174380Sjhb * Redistribution and use in source and binary forms, with or without
6174380Sjhb * modification, are permitted provided that the following conditions
7174380Sjhb * are met:
8174380Sjhb * 1. Redistributions of source code must retain the above copyright
9174380Sjhb *    notice, this list of conditions and the following disclaimer.
10174380Sjhb * 2. Redistributions in binary form must reproduce the above copyright
11174380Sjhb *    notice, this list of conditions and the following disclaimer in the
12174380Sjhb *    documentation and/or other materials provided with the distribution.
13174380Sjhb *
14174380Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15174380Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16174380Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17174380Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18174380Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19174380Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20174380Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21174380Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22174380Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23174380Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24174380Sjhb * SUCH DAMAGE.
25174380Sjhb *
26174380Sjhb * $FreeBSD$
27174380Sjhb */
28174380Sjhb
29174380Sjhb#ifndef _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
30174380Sjhb#define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
31174380Sjhb
32174380Sjhbstruct ipc_perm32 {
33194910Sjhb	uid_t		cuid;
34194910Sjhb	gid_t		cgid;
35194910Sjhb	uid_t		uid;
36194910Sjhb	gid_t		gid;
37194910Sjhb	mode_t		mode;
38174380Sjhb	uint16_t	seq;
39174380Sjhb	uint32_t	key;
40174380Sjhb};
41174380Sjhb
42174381Sjhbstruct semid_ds32 {
43174381Sjhb	struct ipc_perm32 sem_perm;
44174381Sjhb	uint32_t	sem_base;
45174381Sjhb	unsigned short	sem_nsems;
46174381Sjhb	int32_t		sem_otime;
47174381Sjhb	int32_t		sem_ctime;
48174381Sjhb};
49174381Sjhb
50174381Sjhbunion semun32 {
51174381Sjhb	int		val;
52174381Sjhb	uint32_t	buf;
53174381Sjhb	uint32_t	array;
54174381Sjhb};
55174381Sjhb
56174381Sjhbstruct msqid_ds32 {
57174381Sjhb	struct ipc_perm32 msg_perm;
58174381Sjhb	uint32_t	msg_first;
59174381Sjhb	uint32_t	msg_last;
60174381Sjhb	uint32_t	msg_cbytes;
61174381Sjhb	uint32_t	msg_qnum;
62174381Sjhb	uint32_t	msg_qbytes;
63174381Sjhb	pid_t		msg_lspid;
64174381Sjhb	pid_t		msg_lrpid;
65174381Sjhb	int32_t		msg_stime;
66174381Sjhb	int32_t		msg_rtime;
67174381Sjhb	int32_t		msg_ctime;
68174381Sjhb};
69174381Sjhb
70174380Sjhbstruct shmid_ds32 {
71174380Sjhb	struct ipc_perm32 shm_perm;
72174380Sjhb	int32_t		shm_segsz;
73194910Sjhb	pid_t		shm_lpid;
74194910Sjhb	pid_t		shm_cpid;
75194910Sjhb	int		shm_nattch;
76174380Sjhb	int32_t		shm_atime;
77174380Sjhb	int32_t		shm_dtime;
78174380Sjhb	int32_t		shm_ctime;
79174380Sjhb};
80174380Sjhb
81174380Sjhbstruct shm_info32 {
82174380Sjhb	int32_t		used_ids;
83174380Sjhb	uint32_t	shm_tot;
84174380Sjhb	uint32_t	shm_rss;
85174380Sjhb	uint32_t	shm_swp;
86174380Sjhb	uint32_t	swap_attempts;
87174380Sjhb	uint32_t	swap_successes;
88174380Sjhb};
89174380Sjhb
90174380Sjhbstruct shminfo32 {
91174380Sjhb	uint32_t	shmmax;
92174380Sjhb	uint32_t	shmmin;
93174380Sjhb	uint32_t	shmmni;
94174380Sjhb	uint32_t	shmseg;
95174380Sjhb	uint32_t	shmall;
96174380Sjhb};
97174380Sjhb
98194910Sjhb#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
99194910Sjhb    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
100194910Sjhbstruct ipc_perm32_old {
101194910Sjhb	uint16_t	cuid;
102194910Sjhb	uint16_t	cgid;
103194910Sjhb	uint16_t	uid;
104194910Sjhb	uint16_t	gid;
105194910Sjhb	uint16_t	mode;
106194910Sjhb	uint16_t	seq;
107194910Sjhb	uint32_t	key;
108194910Sjhb};
109194910Sjhb
110194910Sjhbstruct semid_ds32_old {
111194910Sjhb	struct ipc_perm32_old sem_perm;
112194910Sjhb	uint32_t	sem_base;
113194910Sjhb	unsigned short	sem_nsems;
114194910Sjhb	int32_t		sem_otime;
115194910Sjhb	int32_t		sem_pad1;
116194910Sjhb	int32_t		sem_ctime;
117194910Sjhb	int32_t		sem_pad2;
118194910Sjhb	int32_t		sem_pad3[4];
119194910Sjhb};
120194910Sjhb
121194910Sjhbstruct msqid_ds32_old {
122194910Sjhb	struct ipc_perm32_old msg_perm;
123194910Sjhb	uint32_t	msg_first;
124194910Sjhb	uint32_t	msg_last;
125194910Sjhb	uint32_t	msg_cbytes;
126194910Sjhb	uint32_t	msg_qnum;
127194910Sjhb	uint32_t	msg_qbytes;
128194910Sjhb	pid_t		msg_lspid;
129194910Sjhb	pid_t		msg_lrpid;
130194910Sjhb	int32_t		msg_stime;
131194910Sjhb	int32_t		msg_pad1;
132194910Sjhb	int32_t		msg_rtime;
133194910Sjhb	int32_t		msg_pad2;
134194910Sjhb	int32_t		msg_ctime;
135194910Sjhb	int32_t		msg_pad3;
136194910Sjhb	int32_t		msg_pad4[4];
137194910Sjhb};
138194910Sjhb
139194910Sjhbstruct shmid_ds32_old {
140194910Sjhb	struct ipc_perm32_old shm_perm;
141194910Sjhb	int32_t		shm_segsz;
142194910Sjhb	pid_t		shm_lpid;
143194910Sjhb	pid_t		shm_cpid;
144194910Sjhb	int16_t		shm_nattch;
145194910Sjhb	int32_t		shm_atime;
146194910Sjhb	int32_t		shm_dtime;
147194910Sjhb	int32_t		shm_ctime;
148194910Sjhb	uint32_t	shm_internal;
149194910Sjhb};
150205322Skib
151205322Skibvoid	freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32,
152205322Skib	    struct ipc_perm *ip);
153205322Skibvoid	freebsd32_ipcperm_old_out(struct ipc_perm *ip,
154205322Skib	    struct ipc_perm32_old *ip32);
155194910Sjhb#endif
156194910Sjhb
157205322Skibvoid	freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip);
158205322Skibvoid	freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32);
159205322Skib
160174380Sjhb#endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */
161