xref: /freebsd/sys/compat/linux/linux_ipc64.h (revision f1951fd745b894fe6586c298874af98544a5e272)
1 /*-
2  * Copyright (c) 2002 Maxim Sobolev <sobomax@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer
10  *    in this position and unchanged.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30 
31 #ifndef _LINUX_IPC64_H_
32 #define	_LINUX_IPC64_H_
33 
34 /*
35  * The generic ipc64_perm structure.
36  * Note extra padding because this structure is passed back and forth
37  * between kernel and user space.
38  *
39  * Pad space is left for:
40  * - 32-bit mode_t on architectures that only had 16 bit
41  * - 32-bit seq
42  * - 2 miscellaneous 32-bit values
43  */
44 struct l_ipc64_perm
45 {
46 	l_key_t		key;
47 	l_uid_t		uid;
48 	l_gid_t		gid;
49 	l_uid_t		cuid;
50 	l_gid_t		cgid;
51 	l_mode_t	mode;
52 			/* pad if mode_t is ushort: */
53 	unsigned char	__pad1[sizeof(l_int) - sizeof(l_mode_t)];
54 	l_ushort	seq;
55 	l_ushort	__pad2;
56 	l_ulong		__unused1;
57 	l_ulong		__unused2;
58 };
59 
60 /*
61  * The generic msqid64_ds structure fro x86 architecture.
62  * Note extra padding because this structure is passed back and forth
63  * between kernel and user space.
64  *
65  * Pad space is left for:
66  * - 64-bit time_t to solve y2038 problem
67  * - 2 miscellaneous 32-bit values
68  */
69 
70 struct l_msqid64_ds {
71 	struct l_ipc64_perm msg_perm;
72 	l_time_t	msg_stime;	/* last msgsnd time */
73 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
74 	l_ulong		__unused1;
75 #endif
76 	l_time_t	msg_rtime;	/* last msgrcv time */
77 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
78 	l_ulong		__unused2;
79 #endif
80 	l_time_t	msg_ctime;	/* last change time */
81 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
82 	l_ulong		__unused3;
83 #endif
84 	l_ulong		msg_cbytes;	/* current number of bytes on queue */
85 	l_ulong		msg_qnum;	/* number of messages in queue */
86 	l_ulong		msg_qbytes;	/* max number of bytes on queue */
87 	l_pid_t		msg_lspid;	/* pid of last msgsnd */
88 	l_pid_t		msg_lrpid;	/* last receive pid */
89 	l_ulong		__unused4;
90 	l_ulong		__unused5;
91 };
92 
93 /*
94  * The generic semid64_ds structure for x86 architecture.
95  * Note extra padding because this structure is passed back and forth
96  * between kernel and user space.
97  *
98  * Pad space is left for:
99  * - 64-bit time_t to solve y2038 problem
100  * - 2 miscellaneous 32-bit values
101  */
102 
103 struct l_semid64_ds {
104 	struct l_ipc64_perm sem_perm;	/* permissions */
105 	l_time_t	sem_otime;	/* last semop time */
106 	l_ulong		__unused1;
107 	l_time_t	sem_ctime;	/* last change time */
108 	l_ulong		__unused2;
109 	l_ulong		sem_nsems;	/* no. of semaphores in array */
110 	l_ulong		__unused3;
111 	l_ulong		__unused4;
112 };
113 
114 /*
115  * The generic shmid64_ds structure for x86 architecture.
116  * Note extra padding because this structure is passed back and forth
117  * between kernel and user space.
118  *
119  * Pad space is left for:
120  * - 64-bit time_t to solve y2038 problem
121  * - 2 miscellaneous 32-bit values
122  */
123 
124 struct l_shmid64_ds {
125 	struct l_ipc64_perm shm_perm;	/* operation perms */
126 	l_size_t	shm_segsz;	/* size of segment (bytes) */
127 	l_time_t	shm_atime;	/* last attach time */
128 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
129 	l_ulong		__unused1;
130 #endif
131 	l_time_t	shm_dtime;	/* last detach time */
132 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
133 	l_ulong		__unused2;
134 #endif
135 	l_time_t	shm_ctime;	/* last change time */
136 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
137 	l_ulong		__unused3;
138 #endif
139 	l_pid_t		shm_cpid;	/* pid of creator */
140 	l_pid_t		shm_lpid;	/* pid of last operator */
141 	l_ulong		shm_nattch;	/* no. of current attaches */
142 	l_ulong		__unused4;
143 	l_ulong		__unused5;
144 };
145 
146 struct l_shminfo64 {
147 	l_ulong		shmmax;
148 	l_ulong		shmmin;
149 	l_ulong		shmmni;
150 	l_ulong		shmseg;
151 	l_ulong		shmall;
152 	l_ulong		__unused1;
153 	l_ulong		__unused2;
154 	l_ulong		__unused3;
155 	l_ulong		__unused4;
156 };
157 
158 #endif /* !LINUX_IPC64_H_ */
159