xref: /freebsd/sys/i386/linux/linux.h (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
1 /*-
2  * Copyright (c) 1994-1996 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 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 _I386_LINUX_LINUX_H_
32 #define _I386_LINUX_LINUX_H_
33 
34 #include <i386/linux/linux_syscall.h>
35 
36 typedef unsigned short linux_uid_t;
37 typedef unsigned short linux_gid_t;
38 typedef unsigned short linux_dev_t;
39 typedef unsigned long linux_ino_t;
40 typedef unsigned short linux_mode_t;
41 typedef unsigned short linux_nlink_t;
42 typedef long linux_time_t;
43 typedef long linux_clock_t;
44 typedef char * linux_caddr_t;
45 typedef long linux_off_t;
46 typedef struct {
47 	long val[2];
48 } linux_fsid_t;
49 typedef int linux_pid_t;
50 typedef int linux_key_t;
51 
52 /*
53  * Signal stuff...
54  */
55 typedef void (*linux_handler_t)(int);
56 
57 typedef unsigned long linux_osigset_t;
58 
59 typedef struct {
60 	unsigned int	__bits[2];
61 } linux_sigset_t;
62 
63 typedef struct {
64 	void		(*lsa_handler)(int);
65 	linux_osigset_t	lsa_mask;
66 	unsigned long	lsa_flags;
67 	void		(*lsa_restorer)(void);
68 } linux_osigaction_t;
69 
70 typedef struct {
71 	void		(*lsa_handler)(int);
72 	unsigned long	lsa_flags;
73 	void		(*lsa_restorer)(void);
74 	linux_sigset_t	lsa_mask;
75 } linux_sigaction_t;
76 
77 /*
78  * The Linux sigcontext, pretty much a standard 386 trapframe.
79  */
80 
81 struct linux_sigcontext {
82 	int	sc_gs;
83 	int	sc_fs;
84 	int     sc_es;
85 	int     sc_ds;
86 	int     sc_edi;
87 	int     sc_esi;
88 	int     sc_ebp;
89 	int	sc_esp;
90 	int     sc_ebx;
91 	int     sc_edx;
92 	int     sc_ecx;
93 	int     sc_eax;
94 	int     sc_trapno;
95 	int     sc_err;
96 	int     sc_eip;
97 	int     sc_cs;
98 	int     sc_eflags;
99 	int     sc_esp_at_signal;
100 	int     sc_ss;
101 	int	sc_387;
102 	int	sc_mask;
103 	int	sc_cr2;
104 };
105 
106 /*
107  * We make the stack look like Linux expects it when calling a signal
108  * handler, but use the BSD way of calling the handler and sigreturn().
109  * This means that we need to pass the pointer to the handler too.
110  * It is appended to the frame to not interfere with the rest of it.
111  */
112 
113 struct linux_sigframe {
114 	int	sf_sig;
115 	struct	linux_sigcontext sf_sc;
116 	void	(*sf_handler)(int);
117 };
118 
119 extern int bsd_to_linux_signal[];
120 extern int linux_to_bsd_signal[];
121 
122 /* signal numbers */
123 #define LINUX_SIGHUP		 1
124 #define LINUX_SIGINT		 2
125 #define LINUX_SIGQUIT		 3
126 #define LINUX_SIGILL		 4
127 #define LINUX_SIGTRAP		 5
128 #define LINUX_SIGABRT		 6
129 #define LINUX_SIGIOT		 6
130 #define LINUX_SIGBUS		 7
131 #define LINUX_SIGFPE		 8
132 #define LINUX_SIGKILL		 9
133 #define LINUX_SIGUSR1		10
134 #define LINUX_SIGSEGV		11
135 #define LINUX_SIGUSR2		12
136 #define LINUX_SIGPIPE		13
137 #define LINUX_SIGALRM		14
138 #define LINUX_SIGTERM		15
139 #define LINUX_SIGSTKFLT		16
140 #define LINUX_SIGCHLD		17
141 #define LINUX_SIGCONT		18
142 #define LINUX_SIGSTOP		19
143 #define LINUX_SIGTSTP		20
144 #define LINUX_SIGTTIN		21
145 #define LINUX_SIGTTOU		22
146 #define LINUX_SIGURG		23
147 #define LINUX_SIGXCPU		24
148 #define LINUX_SIGXFSZ		25
149 #define LINUX_SIGVTALRM		26
150 #define LINUX_SIGPROF		27
151 #define LINUX_SIGWINCH		28
152 #define LINUX_SIGIO		29
153 #define LINUX_SIGPOLL		LINUX_SIGIO
154 #define LINUX_SIGPWR		30
155 #define LINUX_SIGUNUSED		31
156 #define LINUX_NSIG		64
157 #define LINUX_SIGTBLSZ		31
158 
159 /* sigaction flags */
160 #define LINUX_SA_NOCLDSTOP	0x00000001
161 #define LINUX_SA_NOCLDWAIT      0x00000002
162 #define LINUX_SA_SIGINFO        0x00000004
163 #define LINUX_SA_RESTORER       0x04000000
164 #define LINUX_SA_ONSTACK	0x08000000
165 #define LINUX_SA_RESTART	0x10000000
166 #define LINUX_SA_INTERRUPT	0x20000000
167 #define LINUX_SA_NOMASK		0x40000000
168 #define LINUX_SA_ONESHOT	0x80000000
169 
170 /* sigprocmask actions */
171 #define LINUX_SIG_BLOCK		0
172 #define LINUX_SIG_UNBLOCK	1
173 #define LINUX_SIG_SETMASK	2
174 
175 #define LINUX_SIGEMPTYSET(set)		(set).__bits[0] = (set).__bits[1] = 0
176 #define LINUX_SIGISMEMBER(set, sig)	SIGISMEMBER(set, sig)
177 #define LINUX_SIGADDSET(set, sig)	SIGADDSET(set, sig)
178 
179 extern char linux_sigcode[];
180 extern int linux_szsigcode;
181 extern const char linux_emul_path[];
182 
183 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
184 extern struct sysentvec linux_sysvec;
185 extern struct sysentvec elf_linux_sysvec;
186 
187 /* dummy struct definitions */
188 struct image_params;
189 struct trapframe;
190 
191 #define LINUX_MAX_UTSNAME	65
192 struct linux_new_utsname {
193     char sysname[LINUX_MAX_UTSNAME];
194     char nodename[LINUX_MAX_UTSNAME];
195     char release[LINUX_MAX_UTSNAME];
196     char version[LINUX_MAX_UTSNAME];
197     char machine[LINUX_MAX_UTSNAME];
198     char domainname[LINUX_MAX_UTSNAME];
199 };
200 
201 /* misc defines */
202 #define LINUX_NAME_MAX		255
203 
204 /* resource limits */
205 #define LINUX_RLIMIT_CPU        0
206 #define LINUX_RLIMIT_FSIZE      1
207 #define LINUX_RLIMIT_DATA       2
208 #define LINUX_RLIMIT_STACK      3
209 #define LINUX_RLIMIT_CORE       4
210 #define LINUX_RLIMIT_RSS        5
211 #define LINUX_RLIMIT_NPROC      6
212 #define LINUX_RLIMIT_NOFILE     7
213 #define LINUX_RLIMIT_MEMLOCK    8
214 #define LINUX_RLIMIT_AS         9       /* address space limit */
215 
216 #define LINUX_RLIM_NLIMITS      10
217 
218 /* keyboard defines */
219 #define LINUX_KIOCSOUND		0x4B2F
220 #define LINUX_KDMKTONE		0x4B30
221 #define LINUX_KDGETLED		0x4B31
222 #define LINUX_KDSETLED		0x4B32
223 #define LINUX_LED_SCR		0x01
224 #define LINUX_LED_NUM		0x02
225 #define LINUX_LED_CAP		0x04
226 
227 #define LINUX_KDGKBMODE         0x4B44
228 #define LINUX_KDSKBMODE         0x4B45
229 #define LINUX_KDSETMODE		0x4B3A
230 #define LINUX_KDGETMODE		0x4B3B
231 #define LINUX_KD_TEXT		0x0
232 #define LINUX_KD_GRAPHICS	0x1
233 #define LINUX_KD_TEXT0		0x2
234 #define LINUX_KD_TEXT1		0x3
235 
236 #define LINUX_KBD_RAW           0
237 #define LINUX_KBD_XLATE         1
238 #define LINUX_KBD_MEDIUMRAW     2
239 
240 /* termio commands */
241 #define LINUX_TCGETS		0x5401
242 #define LINUX_TCSETS		0x5402
243 #define LINUX_TCSETSW		0x5403
244 #define LINUX_TCSETSF		0x5404
245 #define LINUX_TCGETA		0x5405
246 #define LINUX_TCSETA		0x5406
247 #define LINUX_TCSETAW		0x5407
248 #define LINUX_TCSETAF		0x5408
249 #define LINUX_TCSBRK		0x5409
250 #define LINUX_TCXONC		0x540A
251 #define LINUX_TCFLSH		0x540B
252 #define LINUX_TIOCEXCL		0x540C
253 #define LINUX_TIOCNXCL		0x540D
254 #define LINUX_TIOCSCTTY		0x540E
255 #define LINUX_TIOCGPGRP		0x540F
256 #define LINUX_TIOCSPGRP		0x5410
257 #define LINUX_TIOCOUTQ		0x5411
258 #define LINUX_TIOCSTI		0x5412
259 #define LINUX_TIOCGWINSZ	0x5413
260 #define LINUX_TIOCSWINSZ	0x5414
261 #define LINUX_TIOCMGET		0x5415
262 #define LINUX_TIOCMBIS		0x5416
263 #define LINUX_TIOCMBIC		0x5417
264 #define LINUX_TIOCMSET		0x5418
265 #define LINUX_TIOCGSOFTCAR	0x5419
266 #define LINUX_TIOCSSOFTCAR	0x541A
267 #define LINUX_FIONREAD		0x541B
268 #define LINUX_TIOCINQ		FIONREAD
269 #define LINUX_TIOCLINUX		0x541C
270 #define LINUX_TIOCCONS		0x541D
271 #define LINUX_TIOCGSERIAL	0x541E
272 #define LINUX_TIOCSSERIAL	0x541F
273 #define LINUX_TIOCPKT		0x5420
274 #define LINUX_FIONBIO		0x5421
275 #define LINUX_TIOCNOTTY		0x5422
276 #define LINUX_TIOCSETD		0x5423
277 #define LINUX_TIOCGETD		0x5424
278 #define LINUX_TCSBRKP		0x5425
279 #define LINUX_TIOCTTYGSTRUCT	0x5426
280 #define LINUX_FIONCLEX		0x5450
281 #define LINUX_FIOCLEX		0x5451
282 #define LINUX_FIOASYNC		0x5452
283 #define LINUX_TIOCSERCONFIG	0x5453
284 #define LINUX_TIOCSERGWILD	0x5454
285 #define LINUX_TIOCSERSWILD	0x5455
286 #define LINUX_TIOCGLCKTRMIOS	0x5456
287 #define LINUX_TIOCSLCKTRMIOS	0x5457
288 #define LINUX_VT_OPENQRY        0x5600
289 #define LINUX_VT_GETMODE        0x5601
290 #define LINUX_VT_SETMODE        0x5602
291 #define LINUX_VT_GETSTATE       0x5603
292 #define LINUX_VT_RELDISP        0x5605
293 #define LINUX_VT_ACTIVATE       0x5606
294 #define LINUX_VT_WAITACTIVE     0x5607
295 
296 /* arguments for tcflow() and LINUX_TCXONC */
297 #define LINUX_TCOOFF          0
298 #define LINUX_TCOON           1
299 #define LINUX_TCIOFF          2
300 #define LINUX_TCION           3
301 
302 /* arguments for tcflush() and LINUX_TCFLSH */
303 #define LINUX_TCIFLUSH        0
304 #define LINUX_TCOFLUSH        1
305 #define LINUX_TCIOFLUSH       2
306 
307 /* line disciplines */
308 #define LINUX_N_TTY		0
309 #define LINUX_N_SLIP		1
310 #define LINUX_N_MOUSE		2
311 #define LINUX_N_PPP		3
312 
313 /* Linux termio c_cc values */
314 #define LINUX_VINTR		0
315 #define LINUX_VQUIT		1
316 #define LINUX_VERASE		2
317 #define LINUX_VKILL		3
318 #define LINUX_VEOF		4
319 #define LINUX_VTIME		5
320 #define LINUX_VMIN		6
321 #define LINUX_VSWTC		7
322 #define LINUX_NCC		8
323 
324 /* Linux termios c_cc values */
325 #define LINUX_VSTART		8
326 #define LINUX_VSTOP		9
327 #define LINUX_VSUSP 		10
328 #define LINUX_VEOL		11
329 #define LINUX_VREPRINT		12
330 #define LINUX_VDISCARD		13
331 #define LINUX_VWERASE		14
332 #define LINUX_VLNEXT		15
333 #define LINUX_VEOL2		16
334 #define LINUX_NCCS		19
335 
336 #define LINUX_POSIX_VDISABLE	'\0'
337 
338 /* Linux c_iflag masks */
339 #define LINUX_IGNBRK		0x0000001
340 #define LINUX_BRKINT		0x0000002
341 #define LINUX_IGNPAR		0x0000004
342 #define LINUX_PARMRK		0x0000008
343 #define LINUX_INPCK		0x0000010
344 #define LINUX_ISTRIP		0x0000020
345 #define LINUX_INLCR		0x0000040
346 #define LINUX_IGNCR		0x0000080
347 #define LINUX_ICRNL		0x0000100
348 #define LINUX_IUCLC		0x0000200
349 #define LINUX_IXON		0x0000400
350 #define LINUX_IXANY		0x0000800
351 #define LINUX_IXOFF		0x0001000
352 #define LINUX_IMAXBEL		0x0002000
353 
354 /* Linux c_oflag masks */
355 #define LINUX_OPOST		0x0000001
356 #define LINUX_OLCUC		0x0000002
357 #define LINUX_ONLCR		0x0000004
358 #define LINUX_OCRNL		0x0000008
359 #define LINUX_ONOCR		0x0000010
360 #define LINUX_ONLRET		0x0000020
361 #define LINUX_OFILL		0x0000040
362 #define LINUX_OFDEL		0x0000080
363 #define LINUX_NLDLY		0x0000100
364 
365 #define LINUX_NL0		0x0000000
366 #define LINUX_NL1		0x0000100
367 #define LINUX_CRDLY		0x0000600
368 #define LINUX_CR0		0x0000000
369 #define LINUX_CR1		0x0000200
370 #define LINUX_CR2		0x0000400
371 #define LINUX_CR3		0x0000600
372 #define LINUX_TABDLY		0x0001800
373 #define LINUX_TAB0		0x0000000
374 #define LINUX_TAB1		0x0000800
375 #define LINUX_TAB2		0x0001000
376 #define LINUX_TAB3		0x0001800
377 #define LINUX_XTABS		0x0001800
378 #define LINUX_BSDLY		0x0002000
379 #define LINUX_BS0		0x0000000
380 #define LINUX_BS1		0x0002000
381 #define LINUX_VTDLY		0x0004000
382 #define LINUX_VT0		0x0000000
383 #define LINUX_VT1		0x0004000
384 #define LINUX_FFDLY		0x0008000
385 #define LINUX_FF0		0x0000000
386 #define LINUX_FF1		0x0008000
387 
388 #define LINUX_CBAUD		0x0000100f
389 #define LINUX_B0		0x00000000
390 #define LINUX_B50		0x00000001
391 #define LINUX_B75		0x00000002
392 #define LINUX_B110		0x00000003
393 #define LINUX_B134		0x00000004
394 #define LINUX_B150		0x00000005
395 #define LINUX_B200		0x00000006
396 #define LINUX_B300		0x00000007
397 #define LINUX_B600		0x00000008
398 #define LINUX_B1200		0x00000009
399 #define LINUX_B1800		0x0000000a
400 #define LINUX_B2400		0x0000000b
401 #define LINUX_B4800		0x0000000c
402 #define LINUX_B9600		0x0000000d
403 #define LINUX_B19200		0x0000000e
404 #define LINUX_B38400		0x0000000f
405 #define LINUX_EXTA		LINUX_B19200
406 #define LINUX_EXTB		LINUX_B38400
407 #define LINUX_CBAUDEX		0x00001000
408 #define LINUX_B57600		0x00001001
409 #define LINUX_B115200		0x00001002
410 
411 #define LINUX_CSIZE		0x00000030
412 #define LINUX_CS5		0x00000000
413 #define LINUX_CS6		0x00000010
414 #define LINUX_CS7		0x00000020
415 #define LINUX_CS8		0x00000030
416 #define LINUX_CSTOPB		0x00000040
417 #define LINUX_CREAD		0x00000080
418 #define LINUX_PARENB		0x00000100
419 #define LINUX_PARODD		0x00000200
420 #define LINUX_HUPCL		0x00000400
421 #define LINUX_CLOCAL		0x00000800
422 #define LINUX_CRTSCTS		0x80000000
423 
424 /* Linux c_lflag masks */
425 #define LINUX_ISIG		0x00000001
426 #define LINUX_ICANON		0x00000002
427 #define LINUX_XCASE		0x00000004
428 #define LINUX_ECHO		0x00000008
429 #define LINUX_ECHOE		0x00000010
430 #define LINUX_ECHOK		0x00000020
431 #define LINUX_ECHONL		0x00000040
432 #define LINUX_NOFLSH		0x00000080
433 #define LINUX_TOSTOP		0x00000100
434 #define LINUX_ECHOCTL		0x00000200
435 #define LINUX_ECHOPRT		0x00000400
436 #define LINUX_ECHOKE		0x00000800
437 #define LINUX_FLUSHO		0x00001000
438 #define LINUX_PENDIN		0x00002000
439 #define LINUX_IEXTEN		0x00008000
440 
441 /* open/fcntl flags */
442 #define LINUX_O_RDONLY		00
443 #define LINUX_O_WRONLY		01
444 #define LINUX_O_RDWR		02
445 #define LINUX_O_CREAT		0100
446 #define LINUX_O_EXCL		0200
447 #define LINUX_O_NOCTTY		0400
448 #define LINUX_O_TRUNC		01000
449 #define LINUX_O_APPEND		02000
450 #define LINUX_O_NONBLOCK	04000
451 #define LINUX_O_NDELAY		LINUX_O_NONBLOCK
452 #define LINUX_O_SYNC		010000
453 #define LINUX_FASYNC		020000
454 
455 /* fcntl flags */
456 #define LINUX_F_DUPFD		0
457 #define LINUX_F_GETFD		1
458 #define LINUX_F_SETFD		2
459 #define LINUX_F_GETFL		3
460 #define LINUX_F_SETFL		4
461 #define LINUX_F_GETLK		5
462 #define LINUX_F_SETLK		6
463 #define LINUX_F_SETLKW		7
464 #define LINUX_F_SETOWN		8
465 #define LINUX_F_GETOWN		9
466 
467 #define LINUX_F_RDLCK		0
468 #define LINUX_F_WRLCK		1
469 #define LINUX_F_UNLCK		2
470 
471 /* mmap options */
472 #define LINUX_MAP_SHARED	0x0001
473 #define LINUX_MAP_PRIVATE	0x0002
474 #define LINUX_MAP_FIXED		0x0010
475 #define LINUX_MAP_ANON		0x0020
476 #define LINUX_MAP_GROWSDOWN     0x0100
477 
478 /* SystemV ipc defines */
479 #define LINUX_SEMOP		1
480 #define LINUX_SEMGET		2
481 #define LINUX_SEMCTL		3
482 #define LINUX_MSGSND		11
483 #define LINUX_MSGRCV		12
484 #define LINUX_MSGGET		13
485 #define LINUX_MSGCTL		14
486 #define LINUX_SHMAT		21
487 #define LINUX_SHMDT		22
488 #define LINUX_SHMGET		23
489 #define LINUX_SHMCTL		24
490 
491 #define LINUX_IPC_RMID		0
492 #define LINUX_IPC_SET		1
493 #define LINUX_IPC_STAT		2
494 #define LINUX_IPC_INFO		3
495 
496 #define LINUX_SHM_LOCK		11
497 #define LINUX_SHM_UNLOCK	12
498 #define LINUX_SHM_STAT		13
499 #define LINUX_SHM_INFO		14
500 
501 #define LINUX_SHM_RDONLY	0x1000
502 #define LINUX_SHM_RND		0x2000
503 #define LINUX_SHM_REMAP		0x4000
504 
505 /* semctl Command Definitions. */
506 #define	LINUX_GETPID		11
507 #define	LINUX_GETVAL		12
508 #define	LINUX_GETALL		13
509 #define	LINUX_GETNCNT		14
510 #define	LINUX_GETZCNT		15
511 #define	LINUX_SETVAL		16
512 #define	LINUX_SETALL		17
513 
514 /* Socket defines */
515 #define LINUX_SOCKET 		1
516 #define LINUX_BIND		2
517 #define LINUX_CONNECT 		3
518 #define LINUX_LISTEN 		4
519 #define LINUX_ACCEPT 		5
520 #define LINUX_GETSOCKNAME	6
521 #define LINUX_GETPEERNAME	7
522 #define LINUX_SOCKETPAIR	8
523 #define LINUX_SEND		9
524 #define LINUX_RECV		10
525 #define LINUX_SENDTO 		11
526 #define LINUX_RECVFROM 		12
527 #define LINUX_SHUTDOWN 		13
528 #define LINUX_SETSOCKOPT	14
529 #define LINUX_GETSOCKOPT	15
530 #define LINUX_SENDMSG		16
531 #define LINUX_RECVMSG		17
532 
533 #define LINUX_AF_UNSPEC		0
534 #define LINUX_AF_UNIX		1
535 #define LINUX_AF_INET		2
536 #define LINUX_AF_AX25		3
537 #define LINUX_AF_IPX		4
538 #define LINUX_AF_APPLETALK	5
539 
540 #define LINUX_SOL_SOCKET	1
541 #define LINUX_SOL_IP		0
542 #define LINUX_SOL_IPX		256
543 #define LINUX_SOL_AX25		257
544 #define LINUX_SOL_TCP		6
545 #define LINUX_SOL_UDP		17
546 
547 #define LINUX_SO_DEBUG		1
548 #define LINUX_SO_REUSEADDR	2
549 #define LINUX_SO_TYPE		3
550 #define LINUX_SO_ERROR		4
551 #define LINUX_SO_DONTROUTE	5
552 #define LINUX_SO_BROADCAST	6
553 #define LINUX_SO_SNDBUF		7
554 #define LINUX_SO_RCVBUF		8
555 #define LINUX_SO_KEEPALIVE	9
556 #define LINUX_SO_OOBINLINE	10
557 #define LINUX_SO_NO_CHECK	11
558 #define LINUX_SO_PRIORITY	12
559 #define LINUX_SO_LINGER		13
560 
561 #define LINUX_IP_TOS		1
562 #define LINUX_IP_TTL		2
563 #define LINUX_IP_HDRINCL	3
564 #define LINUX_IP_OPTIONS	4
565 
566 #define LINUX_IP_MULTICAST_IF		32
567 #define LINUX_IP_MULTICAST_TTL		33
568 #define LINUX_IP_MULTICAST_LOOP		34
569 #define LINUX_IP_ADD_MEMBERSHIP		35
570 #define LINUX_IP_DROP_MEMBERSHIP	36
571 
572 /* Sound system defines */
573 #define LINUX_SNDCTL_SEQ_RESET		0x5100
574 #define LINUX_SNDCTL_SEQ_SYNC		0x5101
575 #define LINUX_SNDCTL_SYNTH_INFO		0x5102
576 #define LINUX_SNDCTL_SEQ_CTRLRATE	0x5103
577 #define LINUX_SNDCTL_SEQ_GETOUTCOUNT	0x5104
578 #define LINUX_SNDCTL_SEQ_GETINCOUNT	0x5105
579 #define LINUX_SNDCTL_SEQ_PERCMODE	0x5106
580 #define LINUX_SNDCTL_FM_LOAD_INSTR	0x5107
581 #define LINUX_SNDCTL_SEQ_TESTMIDI	0x5108
582 #define LINUX_SNDCTL_SEQ_RESETSAMPLES	0x5109
583 #define LINUX_SNDCTL_SEQ_NRSYNTHS	0x510A
584 #define LINUX_SNDCTL_SEQ_NRMIDIS	0x510B
585 #define LINUX_SNDCTL_MIDI_INFO		0x510C
586 #define LINUX_SNDCTL_SEQ_TRESHOLD	0x510D
587 #define LINUX_SNDCTL_SYNTH_MEMAVL	0x510E
588 #define LINUX_SNDCTL_DSP_RESET		0x5000
589 #define LINUX_SNDCTL_DSP_SYNC		0x5001
590 #define LINUX_SNDCTL_DSP_SPEED		0x5002
591 #define LINUX_SNDCTL_DSP_STEREO		0x5003
592 #define LINUX_SNDCTL_DSP_GETBLKSIZE	0x5004
593 #define LINUX_SNDCTL_DSP_SETBLKSIZE	0x5004
594 #define LINUX_SNDCTL_DSP_SETFMT		0x5005
595 #define LINUX_SOUND_PCM_WRITE_CHANNELS	0x5006
596 #define LINUX_SOUND_PCM_WRITE_FILTER	0x5007
597 #define LINUX_SNDCTL_DSP_POST		0x5008
598 #define LINUX_SNDCTL_DSP_SUBDIVIDE	0x5009
599 #define LINUX_SNDCTL_DSP_SETFRAGMENT	0x500A
600 #define LINUX_SNDCTL_DSP_GETFMTS	0x500B
601 #define LINUX_SNDCTL_DSP_GETOSPACE	0x500C
602 #define LINUX_SNDCTL_DSP_GETISPACE	0x500D
603 #define LINUX_SNDCTL_DSP_NONBLOCK	0x500E
604 #define LINUX_SNDCTL_DSP_GETCAPS	0x500F
605 #define LINUX_SNDCTL_DSP_GETTRIGGER	0x5010
606 #define LINUX_SNDCTL_DSP_SETTRIGGER	0x5010
607 #define LINUX_SNDCTL_DSP_GETIPTR	0x5011
608 #define LINUX_SNDCTL_DSP_GETOPTR	0x5012
609 #define LINUX_SOUND_MIXER_WRITE_VOLUME	0x4d00
610 #define LINUX_SOUND_MIXER_WRITE_BASS	0x4d01
611 #define LINUX_SOUND_MIXER_WRITE_TREBLE	0x4d02
612 #define LINUX_SOUND_MIXER_WRITE_SYNTH	0x4d03
613 #define LINUX_SOUND_MIXER_WRITE_PCM	0x4d04
614 #define LINUX_SOUND_MIXER_WRITE_SPEAKER	0x4d05
615 #define LINUX_SOUND_MIXER_WRITE_LINE	0x4d06
616 #define LINUX_SOUND_MIXER_WRITE_MIC	0x4d07
617 #define LINUX_SOUND_MIXER_WRITE_CD	0x4d08
618 #define LINUX_SOUND_MIXER_WRITE_IMIX	0x4d09
619 #define LINUX_SOUND_MIXER_WRITE_ALTPCM	0x4d0A
620 #define LINUX_SOUND_MIXER_WRITE_RECLEV	0x4d0B
621 #define LINUX_SOUND_MIXER_WRITE_IGAIN	0x4d0C
622 #define LINUX_SOUND_MIXER_WRITE_OGAIN	0x4d0D
623 #define LINUX_SOUND_MIXER_WRITE_LINE1	0x4d0E
624 #define LINUX_SOUND_MIXER_WRITE_LINE2	0x4d0F
625 #define LINUX_SOUND_MIXER_WRITE_LINE3	0x4d10
626 #define LINUX_SOUND_MIXER_READ_DEVMASK	0x4dfe
627 
628 #define LINUX_OSS_GETVERSION		0x4d76
629 
630 /* Socket system defines */
631 #define LINUX_FIOSETOWN			0x8901
632 #define LINUX_SIOCSPGRP			0x8902
633 #define LINUX_FIOGETOWN			0x8903
634 #define LINUX_SIOCGPGRP			0x8904
635 #define LINUX_SIOCATMARK		0x8905
636 #define LINUX_SIOCGSTAMP		0x8906
637 #define LINUX_SIOCGIFCONF		0x8912
638 #define LINUX_SIOCGIFFLAGS		0x8913
639 #define LINUX_SIOCGIFADDR		0x8915
640 #define LINUX_SIOCGIFDSTADDR		0x8917
641 #define LINUX_SIOCGIFBRDADDR		0x8919
642 #define LINUX_SIOCGIFNETMASK		0x891b
643 #define LINUX_SIOCGIFHWADDR		0x8927
644 #define LINUX_SIOCADDMULTI		0x8931
645 #define LINUX_SIOCDELMULTI		0x8932
646 
647 struct linux_sockaddr
648 {
649     unsigned short	sa_family;
650     char		sa_data[14];
651 };
652 
653 struct linux_ifmap
654 {
655     unsigned long	mem_start;
656     unsigned long	mem_end;
657     unsigned short	base_addr;
658     unsigned char	irq;
659     unsigned char	dma;
660     unsigned char	port;
661 };
662 
663 struct linux_ifreq
664 {
665 #define LINUX_IFHWADDRLEN     6
666 #define LINUX_IFNAMSIZ        16
667     union
668     {
669 	char    ifrn_name[LINUX_IFNAMSIZ];		/* if name, e.g. "en0" */
670     } ifr_ifrn;
671 
672     union {
673 	struct linux_sockaddr	ifru_addr;
674 	struct linux_sockaddr	ifru_dstaddr;
675 	struct linux_sockaddr	ifru_broadaddr;
676 	struct linux_sockaddr	ifru_netmask;
677 	struct linux_sockaddr	ifru_hwaddr;
678 	short			ifru_flags;
679 	int			ifru_metric;
680 	int			ifru_mtu;
681 	struct linux_ifmap	ifru_map;
682 	char			ifru_slave[LINUX_IFNAMSIZ];	/* Just fits the size */
683 	caddr_t			ifru_data;
684     } ifr_ifru;
685 };
686 
687 #define ifr_name	ifr_ifrn.ifrn_name		/* interface name       */
688 #define ifr_hwaddr	ifr_ifru.ifru_hwaddr		/* MAC address          */
689 
690 
691 /* serial_struct values for TIOC[GS]SERIAL ioctls */
692 #define LINUX_ASYNC_CLOSING_WAIT_INF  0
693 #define LINUX_ASYNC_CLOSING_WAIT_NONE 65535
694 
695 #define LINUX_PORT_UNKNOWN    0
696 #define LINUX_PORT_8250       1
697 #define LINUX_PORT_16450      2
698 #define LINUX_PORT_16550      3
699 #define LINUX_PORT_16550A     4
700 #define LINUX_PORT_CIRRUS     5
701 #define LINUX_PORT_16650      6
702 #define LINUX_PORT_MAX        6
703 
704 #define LINUX_ASYNC_HUP_NOTIFY		0x0001
705 #define LINUX_ASYNC_FOURPORT  		0x0002
706 #define LINUX_ASYNC_SAK       		0x0004
707 #define LINUX_ASYNC_SPLIT_TERMIOS 	0x0008
708 #define LINUX_ASYNC_SPD_MASK  		0x0030
709 #define LINUX_ASYNC_SPD_HI    		0x0010
710 #define LINUX_ASYNC_SPD_VHI   		0x0020
711 #define LINUX_ASYNC_SPD_CUST  		0x0030
712 #define LINUX_ASYNC_SKIP_TEST 		0x0040
713 #define LINUX_ASYNC_AUTO_IRQ  		0x0080
714 #define LINUX_ASYNC_SESSION_LOCKOUT 	0x0100
715 #define LINUX_ASYNC_PGRP_LOCKOUT    	0x0200
716 #define LINUX_ASYNC_CALLOUT_NOHUP   	0x0400
717 #define LINUX_ASYNC_FLAGS     		0x0FFF
718 
719 /* cdrom */
720 #define LINUX_CDROMPAUSE		0x5301
721 #define LINUX_CDROMRESUME		0x5302
722 #define LINUX_CDROMPLAYMSF		0x5303
723 #define LINUX_CDROMPLAYTRKIND		0x5304
724 #define LINUX_CDROMREADTOCHDR		0x5305
725 #define LINUX_CDROMREADTOCENTRY		0x5306
726 #define LINUX_CDROMSTOP			0x5307
727 #define LINUX_CDROMSTART		0x5308
728 #define LINUX_CDROMEJECT		0x5309
729 #define LINUX_CDROMVOLCTRL		0x530a
730 #define LINUX_CDROMSUBCHNL		0x530b
731 #define LINUX_CDROMREADMODE2		0x530c
732 #define LINUX_CDROMREADMODE1		0x530d
733 #define LINUX_CDROMREADAUDIO		0x530e
734 #define LINUX_CDROMEJECT_SW		0x530f
735 #define LINUX_CDROMMULTISESSION		0x5310
736 #define LINUX_CDROM_GET_UPC		0x5311
737 #define LINUX_CDROMRESET		0x5312
738 #define LINUX_CDROMVOLREAD		0x5313
739 #define LINUX_CDROMREADRAW		0x5314
740 #define LINUX_CDROMREADCOOKED		0x5315
741 #define LINUX_CDROMSEEK			0x5316
742 #define LINUX_CDROMPLAYBLK		0x5317
743 #define LINUX_CDROMREADALL		0x5318
744 #define LINUX_CDROMCLOSETRAY		0x5319
745 #define LINUX_CDROMLOADFROMSLOT		0x531a
746 
747 #define LINUX_CDROM_LBA                 0x01
748 #define LINUX_CDROM_MSF                 0x02
749 
750 /* Scheduling policies */
751 #define LINUX_SCHED_OTHER		0
752 #define LINUX_SCHED_FIFO		1
753 #define LINUX_SCHED_RR			2
754 
755 #endif /* !_I386_LINUX_LINUX_H_ */
756