xref: /freebsd/sys/i386/linux/linux.h (revision 48991a368427cadb9cdac39581d1676c29619c52)
1 /*-
2  * Copyright (c) 1994-1995 S�ren Schmidt
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 withough 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  *	$Id: linux.h,v 1.1 1995/06/25 17:32:32 sos Exp $
29  */
30 
31 #ifndef _I386_LINUX_LINUX_H_
32 #define _I386_LINUX_LINUX_H_
33 
34 typedef unsigned short linux_uid_t;
35 typedef unsigned short linux_gid_t;
36 typedef unsigned short linux_dev_t;
37 typedef unsigned long linux_ino_t;
38 typedef unsigned short linux_mode_t;
39 typedef unsigned short linux_nlink_t;
40 typedef long linux_time_t;
41 typedef long linux_clock_t;
42 typedef char * linux_caddr_t;
43 typedef long linux_off_t;
44 typedef struct {
45 	long val[2];
46 } linux_fsid_t;
47 typedef int linux_pid_t;
48 typedef unsigned long linux_sigset_t;
49 typedef void (*linux_handler_t)(int);
50 typedef struct {
51 	void (*sa_handler)(int);
52 	linux_sigset_t sa_mask;
53 	unsigned long sa_flags;
54 	void (*sa_restorer)(void);
55 } linux_sigaction_t;
56 typedef int linux_key_t;
57 
58 extern int bsd_to_linux_signal[];
59 extern int linux_to_bsd_signal[];
60 
61 /* misc defines */
62 #define LINUX_NAME_MAX		255
63 
64 /* signal numbers */
65 #define LINUX_SIGHUP		 1
66 #define LINUX_SIGINT		 2
67 #define LINUX_SIGQUIT		 3
68 #define LINUX_SIGILL		 4
69 #define LINUX_SIGTRAP		 5
70 #define LINUX_SIGABRT		 6
71 #define LINUX_SIGIOT		 6
72 #define LINUX_SIGUNUSED	 	 7
73 #define LINUX_SIGFPE		 8
74 #define LINUX_SIGKILL		 9
75 #define LINUX_SIGUSR1		10
76 #define LINUX_SIGSEGV		11
77 #define LINUX_SIGUSR2		12
78 #define LINUX_SIGPIPE		13
79 #define LINUX_SIGALRM		14
80 #define LINUX_SIGTERM		15
81 #define LINUX_SIGSTKFLT		16
82 #define LINUX_SIGCHLD		17
83 #define LINUX_SIGCONT		18
84 #define LINUX_SIGSTOP		19
85 #define LINUX_SIGTSTP		20
86 #define LINUX_SIGTTIN		21
87 #define LINUX_SIGTTOU		22
88 #define LINUX_SIGIO		23
89 #define LINUX_SIGPOLL		LINUX_SIGIO
90 #define LINUX_SIGURG		LINUX_SIGIO
91 #define LINUX_SIGXCPU		24
92 #define LINUX_SIGXFSZ		25
93 #define LINUX_SIGVTALRM		26
94 #define LINUX_SIGPROF		27
95 #define LINUX_SIGWINCH		28
96 #define LINUX_SIGLOST		29
97 #define LINUX_SIGPWR		30
98 #define LINUX_SIGBUS		LINUX_SIGUNUSED
99 #define LINUX_NSIG		32
100 
101 /* sigaction flags */
102 #define LINUX_SA_NOCLDSTOP	0x00000001
103 #define LINUX_SA_ONSTACK	0x08000000
104 #define LINUX_SA_RESTART	0x10000000
105 #define LINUX_SA_INTERRUPT	0x20000000
106 #define LINUX_SA_NOMASK		0x40000000
107 #define LINUX_SA_ONESHOT	0x80000000
108 
109 /* sigprocmask actions */
110 #define LINUX_SIG_BLOCK		0
111 #define LINUX_SIG_UNBLOCK	1
112 #define LINUX_SIG_SETMASK	2
113 
114 /* termio commands */
115 #define LINUX_TCGETS		0x5401
116 #define LINUX_TCSETS		0x5402
117 #define LINUX_TCSETSW		0x5403
118 #define LINUX_TCSETSF		0x5404
119 #define LINUX_TCGETA		0x5405
120 #define LINUX_TCSETA		0x5406
121 #define LINUX_TCSETAW		0x5407
122 #define LINUX_TCSETAF		0x5408
123 #define LINUX_TCSBRK		0x5409
124 #define LINUX_TCXONC		0x540A
125 #define LINUX_TCFLSH		0x540B
126 #define LINUX_TIOCEXCL		0x540C
127 #define LINUX_TIOCNXCL		0x540D
128 #define LINUX_TIOCSCTTY		0x540E
129 #define LINUX_TIOCGPGRP		0x540F
130 #define LINUX_TIOCSPGRP		0x5410
131 #define LINUX_TIOCOUTQ		0x5411
132 #define LINUX_TIOCSTI		0x5412
133 #define LINUX_TIOCGWINSZ	0x5413
134 #define LINUX_TIOCSWINSZ	0x5414
135 #define LINUX_TIOCMGET		0x5415
136 #define LINUX_TIOCMBIS		0x5416
137 #define LINUX_TIOCMBIC		0x5417
138 #define LINUX_TIOCMSET		0x5418
139 #define LINUX_TIOCGSOFTCAR	0x5419
140 #define LINUX_TIOCSSOFTCAR	0x541A
141 #define LINUX_FIONREAD		0x541B
142 #define LINUX_TIOCINQ		FIONREAD
143 #define LINUX_TIOCLINUX		0x541C
144 #define LINUX_TIOCCONS		0x541D
145 #define LINUX_TIOCGSERIAL	0x541E
146 #define LINUX_TIOCSSERIAL	0x541F
147 #define LINUX_TIOCPKT		0x5420
148 #define LINUX_FIONBIO		0x5421
149 #define LINUX_TIOCNOTTY		0x5422
150 #define LINUX_TIOCSETD		0x5423
151 #define LINUX_TIOCGETD		0x5424
152 #define LINUX_TCSBRKP		0x5425
153 #define LINUX_TIOCTTYGSTRUCT	0x5426
154 #define LINUX_FIONCLEX		0x5450
155 #define LINUX_FIOCLEX		0x5451
156 #define LINUX_FIOASYNC		0x5452
157 #define LINUX_TIOCSERCONFIG	0x5453
158 #define LINUX_TIOCSERGWILD	0x5454
159 #define LINUX_TIOCSERSWILD	0x5455
160 #define LINUX_TIOCGLCKTRMIOS	0x5456
161 #define LINUX_TIOCSLCKTRMIOS	0x5457
162 
163 /* line disciplines */
164 #define LINUX_N_TTY		0
165 #define LINUX_N_SLIP		1
166 #define LINUX_N_MOUSE		2
167 #define LINUX_N_PPP		3
168 
169 /* Linux termio c_cc values */
170 #define LINUX_VINTR		0
171 #define LINUX_VQUIT		1
172 #define LINUX_VERASE		2
173 #define LINUX_VKILL		3
174 #define LINUX_VEOF		4
175 #define LINUX_VTIME		5
176 #define LINUX_VMIN		6
177 #define LINUX_VSWTC		7
178 #define LINUX_NCC		8
179 
180 /* Linux termios c_cc values */
181 #define LINUX_VSTART		8
182 #define LINUX_VSTOP		9
183 #define LINUX_VSUSP 		10
184 #define LINUX_VEOL		11
185 #define LINUX_VREPRINT		12
186 #define LINUX_VDISCARD		13
187 #define LINUX_VWERASE		14
188 #define LINUX_VLNEXT		15
189 #define LINUX_VEOL2		16
190 #define LINUX_NCCS		17
191 
192 /* Linux c_iflag masks */
193 #define LINUX_IGNBRK		0x0000001
194 #define LINUX_BRKINT		0x0000002
195 #define LINUX_IGNPAR		0x0000004
196 #define LINUX_PARMRK		0x0000008
197 #define LINUX_INPCK		0x0000010
198 #define LINUX_ISTRIP		0x0000020
199 #define LINUX_INLCR		0x0000040
200 #define LINUX_IGNCR		0x0000080
201 #define LINUX_ICRNL		0x0000100
202 #define LINUX_IUCLC		0x0000200
203 #define LINUX_IXON		0x0000400
204 #define LINUX_IXANY		0x0000800
205 #define LINUX_IXOFF		0x0001000
206 #define LINUX_IMAXBEL		0x0002000
207 
208 /* Linux c_oflag masks */
209 #define LINUX_OPOST		0x0000001
210 #define LINUX_OLCUC		0x0000002
211 #define LINUX_ONLCR		0x0000004
212 #define LINUX_OCRNL		0x0000008
213 #define LINUX_ONOCR		0x0000010
214 #define LINUX_ONLRET		0x0000020
215 #define LINUX_OFILL		0x0000040
216 #define LINUX_OFDEL		0x0000080
217 #define LINUX_NLDLY		0x0000100
218 
219 #define LINUX_NL0		0x0000000
220 #define LINUX_NL1		0x0000100
221 #define LINUX_CRDLY		0x0000600
222 #define LINUX_CR0		0x0000000
223 #define LINUX_CR1		0x0000200
224 #define LINUX_CR2		0x0000400
225 #define LINUX_CR3		0x0000600
226 #define LINUX_TABDLY		0x0001800
227 #define LINUX_TAB0		0x0000000
228 #define LINUX_TAB1		0x0000800
229 #define LINUX_TAB2		0x0001000
230 #define LINUX_TAB3		0x0001800
231 #define LINUX_XTABS		0x0001800
232 #define LINUX_BSDLY		0x0002000
233 #define LINUX_BS0		0x0000000
234 #define LINUX_BS1		0x0002000
235 #define LINUX_VTDLY		0x0004000
236 #define LINUX_VT0		0x0000000
237 #define LINUX_VT1		0x0004000
238 #define LINUX_FFDLY		0x0008000
239 #define LINUX_FF0		0x0000000
240 #define LINUX_FF1		0x0008000
241 
242 #define LINUX_CBAUD		0x0000100f
243 #define LINUX_B0		0x00000000
244 #define LINUX_B50		0x00000001
245 #define LINUX_B75		0x00000002
246 #define LINUX_B110		0x00000003
247 #define LINUX_B134		0x00000004
248 #define LINUX_B150		0x00000005
249 #define LINUX_B200		0x00000006
250 #define LINUX_B300		0x00000007
251 #define LINUX_B600		0x00000008
252 #define LINUX_B1200		0x00000009
253 #define LINUX_B1800		0x0000000a
254 #define LINUX_B2400		0x0000000b
255 #define LINUX_B4800		0x0000000c
256 #define LINUX_B9600		0x0000000d
257 #define LINUX_B19200		0x0000000e
258 #define LINUX_B38400		0x0000000f
259 #define LINUX_EXTA		LINUX_B19200
260 #define LINUX_EXTB		LINUX_B38400
261 #define LINUX_CBAUDEX		0x00001000
262 #define LINUX_B57600		0x00001001
263 #define LINUX_B115200		0x00001002
264 
265 #define LINUX_CSIZE		0x00000030
266 #define LINUX_CS5		0x00000000
267 #define LINUX_CS6		0x00000010
268 #define LINUX_CS7		0x00000020
269 #define LINUX_CS8		0x00000030
270 #define LINUX_CSTOPB		0x00000040
271 #define LINUX_CREAD		0x00000080
272 #define LINUX_PARENB		0x00000100
273 #define LINUX_PARODD		0x00000200
274 #define LINUX_HUPCL		0x00000400
275 #define LINUX_CLOCAL		0x00000800
276 #define LINUX_CRTSCTS		0x80000000
277 
278 /* Linux c_lflag masks */
279 #define LINUX_ISIG		0x00000001
280 #define LINUX_ICANON		0x00000002
281 #define LINUX_XCASE		0x00000004
282 #define LINUX_ECHO		0x00000008
283 #define LINUX_ECHOE		0x00000010
284 #define LINUX_ECHOK		0x00000020
285 #define LINUX_ECHONL		0x00000040
286 #define LINUX_NOFLSH		0x00000080
287 #define LINUX_TOSTOP		0x00000100
288 #define LINUX_ECHOCTL		0x00000200
289 #define LINUX_ECHOPRT		0x00000400
290 #define LINUX_ECHOKE		0x00000800
291 #define LINUX_FLUSHO		0x00001000
292 #define LINUX_PENDIN		0x00002000
293 #define LINUX_IEXTEN		0x00008000
294 
295 /* open/fcntl flags */
296 #define LINUX_O_RDONLY		00
297 #define LINUX_O_WRONLY		01
298 #define LINUX_O_RDWR		02
299 #define LINUX_O_CREAT		0100
300 #define LINUX_O_EXCL		0200
301 #define LINUX_O_NOCTTY		0400
302 #define LINUX_O_TRUNC		01000
303 #define LINUX_O_APPEND		02000
304 #define LINUX_O_NONBLOCK	04000
305 #define LINUX_O_NDELAY		LINUX_O_NONBLOCK
306 #define LINUX_O_SYNC		010000
307 #define LINUX_FASYNC		020000
308 
309 /* fcntl flags */
310 #define LINUX_F_DUPFD		0
311 #define LINUX_F_GETFD		1
312 #define LINUX_F_SETFD		2
313 #define LINUX_F_GETFL		3
314 #define LINUX_F_SETFL		4
315 #define LINUX_F_GETLK		5
316 #define LINUX_F_SETLK		6
317 #define LINUX_F_SETLKW		7
318 #define LINUX_F_SETOWN		8
319 #define LINUX_F_GETOWN		9
320 
321 #define LINUX_F_RDLCK		0
322 #define LINUX_F_WRLCK		1
323 #define LINUX_F_UNLCK		2
324 
325 /* mmap options */
326 #define LINUX_MAP_SHARED	0x0001
327 #define LINUX_MAP_PRIVATE	0x0002
328 #define LINUX_MAP_FIXED		0x0010
329 #define LINUX_MAP_ANON		0x0020
330 
331 /* SystemV ipc defines */
332 #define LINUX_SEMOP		1
333 #define LINUX_SEMGET		2
334 #define LINUX_SEMCTL		3
335 #define LINUX_MSGSND		11
336 #define LINUX_MSGRCV		12
337 #define LINUX_MSGGET		13
338 #define LINUX_MSGCTL		14
339 #define LINUX_SHMAT		21
340 #define LINUX_SHMDT		22
341 #define LINUX_SHMGET		23
342 #define LINUX_SHMCTL		24
343 
344 #define LINUX_IPC_RMID		0
345 #define LINUX_IPC_SET		1
346 #define LINUX_IPC_STAT		2
347 #define LINUX_IPC_INFO		3
348 
349 #define LINUX_SHM_LOCK		11
350 #define LINUX_SHM_UNLOCK	12
351 #define LINUX_SHM_STAT		13
352 #define LINUX_SHM_INFO		14
353 
354 #define LINUX_SHM_RDONLY	0x1000
355 #define LINUX_SHM_RND		0x2000
356 #define LINUX_SHM_REMAP		0x4000
357 
358 /* Socket defines */
359 #define LINUX_SOCKET 		1
360 #define LINUX_BIND		2
361 #define LINUX_CONNECT 		3
362 #define LINUX_LISTEN 		4
363 #define LINUX_ACCEPT 		5
364 #define LINUX_GETSOCKNAME	6
365 #define LINUX_GETPEERNAME	7
366 #define LINUX_SOCKETPAIR	8
367 #define LINUX_SEND		9
368 #define LINUX_RECV		10
369 #define LINUX_SENDTO 		11
370 #define LINUX_RECVFROM 		12
371 #define LINUX_SHUTDOWN 		13
372 #define LINUX_SETSOCKOPT	14
373 #define LINUX_GETSOCKOPT	15
374 
375 #define LINUX_AF_UNSPEC		0
376 #define LINUX_AF_UNIX		1
377 #define LINUX_AF_INET		2
378 #define LINUX_AF_AX25		3
379 #define LINUX_AF_IPX		4
380 #define LINUX_AF_APPLETALK	5
381 
382 #define LINUX_SOL_SOCKET	1
383 #define LINUX_SOL_IP		0
384 #define LINUX_SOL_IPX		256
385 #define LINUX_SOL_AX25		257
386 #define LINUX_SOL_TCP		6
387 #define LINUX_SOL_UDP		17
388 
389 #define LINUX_SO_DEBUG		1
390 #define LINUX_SO_REUSEADDR	2
391 #define LINUX_SO_TYPE		3
392 #define LINUX_SO_ERROR		4
393 #define LINUX_SO_DONTROUTE	5
394 #define LINUX_SO_BROADCAST	6
395 #define LINUX_SO_SNDBUF		7
396 #define LINUX_SO_RCVBUF		8
397 #define LINUX_SO_KEEPALIVE	9
398 #define LINUX_SO_OOBINLINE	10
399 #define LINUX_SO_NO_CHECK	11
400 #define LINUX_SO_PRIORITY	12
401 #define LINUX_SO_LINGER		13
402 
403 #define LINUX_IP_TOS		1
404 #define LINUX_IP_TTL		2
405 
406 #ifdef KERNEL
407 caddr_t	ua_alloc_init __P((int len));
408 caddr_t	ua_alloc __P((int len));
409 #endif
410 
411 #endif /* !_I386_LINUX_LINUX_H_ */
412