xref: /freebsd/sys/compat/linux/linux_ipc64.h (revision 02e9120893770924227138ba49df1edb3896112a)
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 
29 #ifndef _LINUX_IPC64_H_
30 #define	_LINUX_IPC64_H_
31 
32 /*
33  * The generic ipc64_perm structure.
34  * Note extra padding because this structure is passed back and forth
35  * between kernel and user space.
36  *
37  * Pad space is left for:
38  * - 32-bit mode_t on architectures that only had 16 bit
39  * - 32-bit seq
40  * - 2 miscellaneous 32-bit values
41  */
42 struct l_ipc64_perm
43 {
44 	l_key_t		key;
45 	l_uid_t		uid;
46 	l_gid_t		gid;
47 	l_uid_t		cuid;
48 	l_gid_t		cgid;
49 	l_mode_t	mode;
50 			/* pad if mode_t is ushort: */
51 	unsigned char	__pad1[sizeof(l_int) - sizeof(l_mode_t)];
52 	l_ushort	seq;
53 	l_ushort	__pad2;
54 	l_ulong		__unused1;
55 	l_ulong		__unused2;
56 };
57 
58 /*
59  * The generic msqid64_ds structure fro x86 architecture.
60  * Note extra padding because this structure is passed back and forth
61  * between kernel and user space.
62  *
63  * Pad space is left for:
64  * - 64-bit time_t to solve y2038 problem
65  * - 2 miscellaneous 32-bit values
66  */
67 
68 struct l_msqid64_ds {
69 	struct l_ipc64_perm msg_perm;
70 	l_time_t	msg_stime;	/* last msgsnd time */
71 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
72 	l_ulong		__unused1;
73 #endif
74 	l_time_t	msg_rtime;	/* last msgrcv time */
75 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
76 	l_ulong		__unused2;
77 #endif
78 	l_time_t	msg_ctime;	/* last change time */
79 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
80 	l_ulong		__unused3;
81 #endif
82 	l_ulong		msg_cbytes;	/* current number of bytes on queue */
83 	l_ulong		msg_qnum;	/* number of messages in queue */
84 	l_ulong		msg_qbytes;	/* max number of bytes on queue */
85 	l_pid_t		msg_lspid;	/* pid of last msgsnd */
86 	l_pid_t		msg_lrpid;	/* last receive pid */
87 	l_ulong		__unused4;
88 	l_ulong		__unused5;
89 };
90 
91 /*
92  * The generic semid64_ds structure for x86 architecture.
93  * Note extra padding because this structure is passed back and forth
94  * between kernel and user space.
95  *
96  * Pad space is left for:
97  * - 64-bit time_t to solve y2038 problem
98  * - 2 miscellaneous 32-bit values
99  */
100 
101 struct l_semid64_ds {
102 	struct l_ipc64_perm sem_perm;	/* permissions */
103 	l_time_t	sem_otime;	/* last semop time */
104 #if defined(__amd64__) || defined(__i386__)
105 	l_ulong		__unused1;
106 #endif
107 	l_time_t	sem_ctime;	/* last change time */
108 #if defined(__amd64__) || defined(__i386__)
109 	l_ulong		__unused2;
110 #endif
111 	l_ulong		sem_nsems;	/* no. of semaphores in array */
112 	l_ulong		__unused3;
113 	l_ulong		__unused4;
114 };
115 
116 /*
117  * The generic shmid64_ds structure for x86 architecture.
118  * Note extra padding because this structure is passed back and forth
119  * between kernel and user space.
120  *
121  * Pad space is left for:
122  * - 64-bit time_t to solve y2038 problem
123  * - 2 miscellaneous 32-bit values
124  */
125 
126 struct l_shmid64_ds {
127 	struct l_ipc64_perm shm_perm;	/* operation perms */
128 	l_size_t	shm_segsz;	/* size of segment (bytes) */
129 	l_time_t	shm_atime;	/* last attach time */
130 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
131 	l_ulong		__unused1;
132 #endif
133 	l_time_t	shm_dtime;	/* last detach time */
134 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
135 	l_ulong		__unused2;
136 #endif
137 	l_time_t	shm_ctime;	/* last change time */
138 #if !defined(__LP64__) || defined(COMPAT_LINUX32)
139 	l_ulong		__unused3;
140 #endif
141 	l_pid_t		shm_cpid;	/* pid of creator */
142 	l_pid_t		shm_lpid;	/* pid of last operator */
143 	l_ulong		shm_nattch;	/* no. of current attaches */
144 	l_ulong		__unused4;
145 	l_ulong		__unused5;
146 };
147 
148 struct l_shminfo64 {
149 	l_ulong		shmmax;
150 	l_ulong		shmmin;
151 	l_ulong		shmmni;
152 	l_ulong		shmseg;
153 	l_ulong		shmall;
154 	l_ulong		__unused1;
155 	l_ulong		__unused2;
156 	l_ulong		__unused3;
157 	l_ulong		__unused4;
158 };
159 
160 #endif /* !LINUX_IPC64_H_ */
161