xref: /freebsd/sys/i386/linux/linux.h (revision 2a4a1db342263067035ce69a4017c645da63455d)
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 <sys/signal.h> /* for sigval union */
35 
36 #include <i386/linux/linux_syscall.h>
37 
38 /*
39  * debugging support
40  */
41 extern u_char linux_debug_map[];
42 #define ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43 #define ARGS(nm, fmt)	"linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
44 #define LMSG(fmt)	"linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
45 
46 #ifdef MALLOC_DECLARE
47 MALLOC_DECLARE(M_LINUX);
48 #endif
49 
50 /*
51  * Provide a separate set of types for the Linux types.
52  */
53 typedef int		l_int;
54 typedef int32_t		l_long;
55 typedef int64_t		l_longlong;
56 typedef short		l_short;
57 typedef unsigned int	l_uint;
58 typedef uint32_t	l_ulong;
59 typedef uint64_t	l_ulonglong;
60 typedef unsigned short	l_ushort;
61 
62 typedef char		*l_caddr_t;
63 typedef l_long		l_clock_t;
64 typedef l_int		l_daddr_t;
65 typedef l_ushort	l_dev_t;
66 typedef l_uint		l_gid_t;
67 typedef l_ushort	l_gid16_t;
68 typedef l_ulong		l_ino_t;
69 typedef l_int		l_key_t;
70 typedef l_longlong	l_loff_t;
71 typedef l_ushort	l_mode_t;
72 typedef l_long		l_off_t;
73 typedef l_int		l_pid_t;
74 typedef l_uint		l_size_t;
75 typedef l_long		l_suseconds_t;
76 typedef l_long		l_time_t;
77 typedef l_uint		l_uid_t;
78 typedef l_ushort	l_uid16_t;
79 
80 typedef struct {
81 	l_int		val[2];
82 } l_fsid_t;
83 
84 typedef struct {
85 	l_time_t	tv_sec;
86 	l_suseconds_t	tv_usec;
87 } l_timeval;
88 
89 #define	l_fd_set	fd_set
90 
91 /*
92  * Miscellaneous
93  */
94 #define	LINUX_NAME_MAX		255
95 #define	LINUX_MAX_UTSNAME	65
96 
97 #define	LINUX_CTL_MAXNAME	10
98 
99 struct l___sysctl_args
100 {
101 	l_int		*name;
102 	l_int		nlen;
103 	void		*oldval;
104 	l_size_t	*oldlenp;
105 	void		*newval;
106 	l_size_t	newlen;
107 	l_ulong		__spare[4];
108 };
109 
110 /* Scheduling policies */
111 #define	LINUX_SCHED_OTHER	0
112 #define	LINUX_SCHED_FIFO	1
113 #define	LINUX_SCHED_RR		2
114 
115 /* Resource limits */
116 #define	LINUX_RLIMIT_CPU	0
117 #define	LINUX_RLIMIT_FSIZE	1
118 #define	LINUX_RLIMIT_DATA	2
119 #define	LINUX_RLIMIT_STACK	3
120 #define	LINUX_RLIMIT_CORE	4
121 #define	LINUX_RLIMIT_RSS	5
122 #define	LINUX_RLIMIT_NPROC	6
123 #define	LINUX_RLIMIT_NOFILE	7
124 #define	LINUX_RLIMIT_MEMLOCK	8
125 #define	LINUX_RLIMIT_AS		9       /* address space limit */
126 
127 #define	LINUX_RLIM_NLIMITS	10
128 
129 struct l_rlimit {
130 	l_ulong rlim_cur;
131 	l_ulong rlim_max;
132 };
133 
134 /* mmap options */
135 #define	LINUX_MAP_SHARED	0x0001
136 #define	LINUX_MAP_PRIVATE	0x0002
137 #define	LINUX_MAP_FIXED		0x0010
138 #define	LINUX_MAP_ANON		0x0020
139 #define	LINUX_MAP_GROWSDOWN	0x0100
140 
141 /*
142  * stat family of syscalls
143  */
144 struct l_timespec {
145 	l_ulong		tv_sec;
146 	l_ulong		tv_nsec;
147 };
148 
149 struct l_newstat {
150 	l_ushort	st_dev;
151 	l_ushort	__pad1;
152 	l_ulong		st_ino;
153 	l_ushort	st_mode;
154 	l_ushort	st_nlink;
155 	l_ushort	st_uid;
156 	l_ushort	st_gid;
157 	l_ushort	st_rdev;
158 	l_ushort	__pad2;
159 	l_ulong		st_size;
160 	l_ulong		st_blksize;
161 	l_ulong		st_blocks;
162 	struct l_timespec	st_atimespec;
163 	struct l_timespec	st_mtimespec;
164 	struct l_timespec	st_ctimespec;
165 	l_ulong		__unused4;
166 	l_ulong		__unused5;
167 };
168 
169 struct l_stat64 {
170 	l_ushort	st_dev;
171 	u_char		__pad0[10];
172 	l_ulong		__st_ino;
173 	l_uint		st_mode;
174 	l_uint		st_nlink;
175 	l_ulong		st_uid;
176 	l_ulong		st_gid;
177 	l_ushort	st_rdev;
178 	u_char		__pad3[10];
179 	l_longlong	st_size;
180 	l_ulong		st_blksize;
181 	l_ulong		st_blocks;
182 	l_ulong		__pad4;
183 	struct l_timespec	st_atimespec;
184 	struct l_timespec	st_mtimespec;
185 	struct l_timespec	st_ctimespec;
186 	l_ulonglong	st_ino;
187 };
188 
189 struct l_new_utsname {
190 	char	sysname[LINUX_MAX_UTSNAME];
191 	char	nodename[LINUX_MAX_UTSNAME];
192 	char	release[LINUX_MAX_UTSNAME];
193 	char	version[LINUX_MAX_UTSNAME];
194 	char	machine[LINUX_MAX_UTSNAME];
195 	char	domainname[LINUX_MAX_UTSNAME];
196 };
197 
198 /*
199  * Signalling
200  */
201 #define	LINUX_SIGHUP		1
202 #define	LINUX_SIGINT		2
203 #define	LINUX_SIGQUIT		3
204 #define	LINUX_SIGILL		4
205 #define	LINUX_SIGTRAP		5
206 #define	LINUX_SIGABRT		6
207 #define	LINUX_SIGIOT		LINUX_SIGABRT
208 #define	LINUX_SIGBUS		7
209 #define	LINUX_SIGFPE		8
210 #define	LINUX_SIGKILL		9
211 #define	LINUX_SIGUSR1		10
212 #define	LINUX_SIGSEGV		11
213 #define	LINUX_SIGUSR2		12
214 #define	LINUX_SIGPIPE		13
215 #define	LINUX_SIGALRM		14
216 #define	LINUX_SIGTERM		15
217 #define	LINUX_SIGSTKFLT		16
218 #define	LINUX_SIGCHLD		17
219 #define	LINUX_SIGCONT		18
220 #define	LINUX_SIGSTOP		19
221 #define	LINUX_SIGTSTP		20
222 #define	LINUX_SIGTTIN		21
223 #define	LINUX_SIGTTOU		22
224 #define	LINUX_SIGURG		23
225 #define	LINUX_SIGXCPU		24
226 #define	LINUX_SIGXFSZ		25
227 #define	LINUX_SIGVTALRM		26
228 #define	LINUX_SIGPROF		27
229 #define	LINUX_SIGWINCH		28
230 #define	LINUX_SIGIO		29
231 #define	LINUX_SIGPOLL		LINUX_SIGIO
232 #define	LINUX_SIGPWR		30
233 #define	LINUX_SIGUNUSED		31
234 
235 #define	LINUX_SIGTBLSZ		31
236 #define	LINUX_NSIG_WORDS	2
237 #define	LINUX_NBPW		32
238 #define	LINUX_NSIG		(LINUX_NBPW * LINUX_NSIG_WORDS)
239 
240 /* sigaction flags */
241 #define	LINUX_SA_NOCLDSTOP	0x00000001
242 #define	LINUX_SA_NOCLDWAIT	0x00000002
243 #define	LINUX_SA_SIGINFO	0x00000004
244 #define	LINUX_SA_RESTORER	0x04000000
245 #define	LINUX_SA_ONSTACK	0x08000000
246 #define	LINUX_SA_RESTART	0x10000000
247 #define	LINUX_SA_INTERRUPT	0x20000000
248 #define	LINUX_SA_NOMASK		0x40000000
249 #define	LINUX_SA_ONESHOT	0x80000000
250 
251 /* sigprocmask actions */
252 #define	LINUX_SIG_BLOCK		0
253 #define	LINUX_SIG_UNBLOCK	1
254 #define	LINUX_SIG_SETMASK	2
255 
256 /* sigset_t macros */
257 #define	LINUX_SIGEMPTYSET(set)		(set).__bits[0] = (set).__bits[1] = 0
258 #define	LINUX_SIGISMEMBER(set, sig)	SIGISMEMBER(set, sig)
259 #define	LINUX_SIGADDSET(set, sig)	SIGADDSET(set, sig)
260 
261 /* sigaltstack */
262 #define LINUX_MINSIGSTKSZ	2048
263 #define LINUX_SS_ONSTACK	1
264 #define LINUX_SS_DISABLE	2
265 
266 int linux_to_bsd_sigaltstack(int lsa);
267 int bsd_to_linux_sigaltstack(int bsa);
268 
269 typedef void	(*l_handler_t)(l_int);
270 typedef l_ulong	l_osigset_t;
271 
272 typedef struct {
273 	l_uint	__bits[LINUX_NSIG_WORDS];
274 } l_sigset_t;
275 
276 typedef struct {
277 	l_handler_t	lsa_handler;
278 	l_osigset_t	lsa_mask;
279 	l_ulong		lsa_flags;
280 	void	(*lsa_restorer)(void);
281 } l_osigaction_t;
282 
283 typedef struct {
284 	l_handler_t	lsa_handler;
285 	l_ulong		lsa_flags;
286 	void	(*lsa_restorer)(void);
287 	l_sigset_t	lsa_mask;
288 } l_sigaction_t;
289 
290 typedef struct {
291 	void		*ss_sp;
292 	l_int		ss_flags;
293 	l_size_t	ss_size;
294 } l_stack_t;
295 
296 /* The Linux sigcontext, pretty much a standard 386 trapframe. */
297 struct l_sigcontext {
298 	l_int		sc_gs;
299 	l_int		sc_fs;
300 	l_int		sc_es;
301 	l_int		sc_ds;
302 	l_int		sc_edi;
303 	l_int		sc_esi;
304 	l_int		sc_ebp;
305 	l_int		sc_esp;
306 	l_int		sc_ebx;
307 	l_int		sc_edx;
308 	l_int		sc_ecx;
309 	l_int		sc_eax;
310 	l_int		sc_trapno;
311 	l_int		sc_err;
312 	l_int		sc_eip;
313 	l_int		sc_cs;
314 	l_int		sc_eflags;
315 	l_int		sc_esp_at_signal;
316 	l_int		sc_ss;
317 	l_int		sc_387;
318 	l_int		sc_mask;
319 	l_int		sc_cr2;
320 };
321 
322 struct l_ucontext {
323 	l_ulong		uc_flags;
324 	void		*uc_link;
325 	l_stack_t	uc_stack;
326 	struct l_sigcontext	uc_mcontext;
327         l_sigset_t	uc_sigmask;
328 };
329 
330 #define LINUX_SI_MAX_SIZE     128
331 #define LINUX_SI_PAD_SIZE     ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
332 
333 typedef struct l_siginfo {
334 	l_int		lsi_signo;
335 	l_int		lsi_errno;
336 	l_int		lsi_code;
337 	union {
338 		l_int	_pad[LINUX_SI_PAD_SIZE];
339 
340 		struct {
341 			l_pid_t		_pid;
342 			l_uid16_t	_uid;
343 		} _kill;
344 
345 		struct {
346 			l_uint		_timer1;
347 			l_uint		_timer2;
348 		} _timer;
349 
350 		struct {
351 			l_pid_t		_pid;		/* sender's pid */
352 			l_uid16_t	_uid;		/* sender's uid */
353 			union sigval _sigval;
354 		} _rt;
355 
356 		struct {
357 			l_pid_t		_pid;		/* which child */
358 			l_uid16_t	_uid;		/* sender's uid */
359 			l_int		_status;	/* exit code */
360 			l_clock_t	_utime;
361 			l_clock_t	_stime;
362 		} _sigchld;
363 
364 		struct {
365 			void		*_addr; /* faulting insn/memory ref. */
366 		} _sigfault;
367 
368 		struct {
369 			l_int		_band;  /* POLL_IN,POLL_OUT,POLL_MSG */
370 			l_int		_fd;
371 		} _sigpoll;
372 	} _sifields;
373 } l_siginfo_t;
374 
375 #define lsi_pid          _sifields._kill._pid
376 #define lsi_uid          _sifields._kill._uid
377 #define lsi_status       _sifields._sigchld._status
378 #define lsi_utime        _sifields._sigchld._utime
379 #define lsi_stime        _sifields._sigchld._stime
380 #define lsi_value        _sifields._rt._sigval
381 #define lsi_int          _sifields._rt._sigval.sival_int
382 #define lsi_ptr          _sifields._rt._sigval.sival_ptr
383 #define lsi_addr         _sifields._sigfault._addr
384 #define lsi_band         _sifields._sigpoll._band
385 #define lsi_fd           _sifields._sigpoll._fd
386 
387 struct l_fpreg {
388 	u_int16_t significand[4];
389 	u_int16_t exponent;
390 };
391 
392 struct l_fpxreg {
393 	u_int16_t significand[4];
394 	u_int16_t exponent;
395 	u_int16_t padding[3];
396 };
397 
398 struct l_xmmreg {
399 	u_int32_t element[4];
400 };
401 
402 struct l_fpstate {
403 	/* Regular FPU environment */
404 	u_int32_t		cw;
405 	u_int32_t		sw;
406 	u_int32_t		tag;
407 	u_int32_t		ipoff;
408 	u_int32_t		cssel;
409 	u_int32_t		dataoff;
410 	u_int32_t		datasel;
411 	struct l_fpreg		_st[8];
412 	u_int16_t		status;
413 	u_int16_t		magic;  /* 0xffff = regular FPU data */
414 
415 	/* FXSR FPU environment */
416 	u_int32_t		_fxsr_env[6]; /* env is ignored */
417 	u_int32_t		mxcsr;
418 	u_int32_t		reserved;
419 	struct l_fpxreg		_fxsr_st[8];  /* reg data is ignored */
420 	struct l_xmmreg		_xmm[8];
421 	u_int32_t		padding[56];
422 };
423 
424 /*
425  * We make the stack look like Linux expects it when calling a signal
426  * handler, but use the BSD way of calling the handler and sigreturn().
427  * This means that we need to pass the pointer to the handler too.
428  * It is appended to the frame to not interfere with the rest of it.
429  */
430 struct l_sigframe {
431 	l_int			sf_sig;
432 	struct l_sigcontext	sf_sc;
433 	struct l_fpstate	sf_fpstate;
434 	l_uint			sf_extramask[LINUX_NSIG_WORDS-1];
435 	l_handler_t		sf_handler;
436 };
437 
438 struct l_rt_sigframe {
439 	l_int			sf_sig;
440 	l_siginfo_t 		*sf_siginfo;
441 	struct l_ucontext	*sf_ucontext;
442 	l_siginfo_t		sf_si;
443 	struct l_ucontext 	sf_sc;
444 	l_handler_t 		sf_handler;
445 };
446 
447 extern int bsd_to_linux_signal[];
448 extern int linux_to_bsd_signal[];
449 extern struct sysentvec linux_sysvec;
450 extern struct sysentvec elf_linux_sysvec;
451 
452 /*
453  * Pluggable ioctl handlers
454  */
455 struct linux_ioctl_args;
456 struct thread;
457 
458 typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_args *);
459 
460 struct linux_ioctl_handler {
461 	linux_ioctl_function_t *func;
462 	int	low, high;
463 };
464 
465 int	linux_ioctl_register_handler(struct linux_ioctl_handler *h);
466 int	linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
467 
468 /*
469  * open/fcntl flags
470  */
471 #define	LINUX_O_RDONLY		00
472 #define	LINUX_O_WRONLY		01
473 #define	LINUX_O_RDWR		02
474 #define	LINUX_O_CREAT		0100
475 #define	LINUX_O_EXCL		0200
476 #define	LINUX_O_NOCTTY		0400
477 #define	LINUX_O_TRUNC		01000
478 #define	LINUX_O_APPEND		02000
479 #define	LINUX_O_NONBLOCK	04000
480 #define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
481 #define	LINUX_O_SYNC		010000
482 #define	LINUX_FASYNC		020000
483 
484 #define	LINUX_F_DUPFD		0
485 #define	LINUX_F_GETFD		1
486 #define	LINUX_F_SETFD		2
487 #define	LINUX_F_GETFL		3
488 #define	LINUX_F_SETFL		4
489 #define	LINUX_F_GETLK		5
490 #define	LINUX_F_SETLK		6
491 #define	LINUX_F_SETLKW		7
492 #define	LINUX_F_SETOWN		8
493 #define	LINUX_F_GETOWN		9
494 
495 #define	LINUX_F_RDLCK		0
496 #define	LINUX_F_WRLCK		1
497 #define	LINUX_F_UNLCK		2
498 
499 /*
500  * mount flags
501  */
502 #define LINUX_MS_RDONLY         0x0001
503 #define LINUX_MS_NOSUID         0x0002
504 #define LINUX_MS_NODEV          0x0004
505 #define LINUX_MS_NOEXEC         0x0008
506 #define LINUX_MS_REMOUNT        0x0020
507 
508 /*
509  * SystemV IPC defines
510  */
511 #define	LINUX_SEMOP		1
512 #define	LINUX_SEMGET		2
513 #define	LINUX_SEMCTL		3
514 #define	LINUX_MSGSND		11
515 #define	LINUX_MSGRCV		12
516 #define	LINUX_MSGGET		13
517 #define	LINUX_MSGCTL		14
518 #define	LINUX_SHMAT		21
519 #define	LINUX_SHMDT		22
520 #define	LINUX_SHMGET		23
521 #define	LINUX_SHMCTL		24
522 
523 #define	LINUX_IPC_RMID		0
524 #define	LINUX_IPC_SET		1
525 #define	LINUX_IPC_STAT		2
526 #define	LINUX_IPC_INFO		3
527 
528 #define	LINUX_SHM_LOCK		11
529 #define	LINUX_SHM_UNLOCK	12
530 #define	LINUX_SHM_STAT		13
531 #define	LINUX_SHM_INFO		14
532 
533 #define	LINUX_SHM_RDONLY	0x1000
534 #define	LINUX_SHM_RND		0x2000
535 #define	LINUX_SHM_REMAP		0x4000
536 
537 /* semctl commands */
538 #define	LINUX_GETPID		11
539 #define	LINUX_GETVAL		12
540 #define	LINUX_GETALL		13
541 #define	LINUX_GETNCNT		14
542 #define	LINUX_GETZCNT		15
543 #define	LINUX_SETVAL		16
544 #define	LINUX_SETALL		17
545 #define	LINUX_SEM_STAT		18
546 #define	LINUX_SEM_INFO		19
547 
548 union l_semun {
549 	l_int		val;
550 	struct l_semid_ds	*buf;
551 	l_ushort	*array;
552 	struct l_seminfo	*__buf;
553 	void		*__pad;
554 };
555 
556 /*
557  * Socket defines
558  */
559 #define	LINUX_SOCKET 		1
560 #define	LINUX_BIND		2
561 #define	LINUX_CONNECT 		3
562 #define	LINUX_LISTEN 		4
563 #define	LINUX_ACCEPT 		5
564 #define	LINUX_GETSOCKNAME	6
565 #define	LINUX_GETPEERNAME	7
566 #define	LINUX_SOCKETPAIR	8
567 #define	LINUX_SEND		9
568 #define	LINUX_RECV		10
569 #define	LINUX_SENDTO 		11
570 #define	LINUX_RECVFROM 		12
571 #define	LINUX_SHUTDOWN 		13
572 #define	LINUX_SETSOCKOPT	14
573 #define	LINUX_GETSOCKOPT	15
574 #define	LINUX_SENDMSG		16
575 #define	LINUX_RECVMSG		17
576 
577 #define	LINUX_AF_UNSPEC		0
578 #define	LINUX_AF_UNIX		1
579 #define	LINUX_AF_INET		2
580 #define	LINUX_AF_AX25		3
581 #define	LINUX_AF_IPX		4
582 #define	LINUX_AF_APPLETALK	5
583 
584 #define	LINUX_SOL_SOCKET	1
585 #define	LINUX_SOL_IP		0
586 #define	LINUX_SOL_IPX		256
587 #define	LINUX_SOL_AX25		257
588 #define	LINUX_SOL_TCP		6
589 #define	LINUX_SOL_UDP		17
590 
591 #define	LINUX_SO_DEBUG		1
592 #define	LINUX_SO_REUSEADDR	2
593 #define	LINUX_SO_TYPE		3
594 #define	LINUX_SO_ERROR		4
595 #define	LINUX_SO_DONTROUTE	5
596 #define	LINUX_SO_BROADCAST	6
597 #define	LINUX_SO_SNDBUF		7
598 #define	LINUX_SO_RCVBUF		8
599 #define	LINUX_SO_KEEPALIVE	9
600 #define	LINUX_SO_OOBINLINE	10
601 #define	LINUX_SO_NO_CHECK	11
602 #define	LINUX_SO_PRIORITY	12
603 #define	LINUX_SO_LINGER		13
604 
605 #define	LINUX_IP_TOS		1
606 #define	LINUX_IP_TTL		2
607 #define	LINUX_IP_HDRINCL	3
608 #define	LINUX_IP_OPTIONS	4
609 
610 #define	LINUX_IP_MULTICAST_IF		32
611 #define	LINUX_IP_MULTICAST_TTL		33
612 #define	LINUX_IP_MULTICAST_LOOP		34
613 #define	LINUX_IP_ADD_MEMBERSHIP		35
614 #define	LINUX_IP_DROP_MEMBERSHIP	36
615 
616 struct l_sockaddr {
617 	l_ushort	sa_family;
618 	char		sa_data[14];
619 };
620 
621 struct l_ifmap {
622 	l_ulong		mem_start;
623 	l_ulong		mem_end;
624 	l_ushort	base_addr;
625 	u_char		irq;
626 	u_char		dma;
627 	u_char		port;
628 };
629 
630 #define	LINUX_IFHWADDRLEN	6
631 #define	LINUX_IFNAMSIZ		16
632 
633 struct l_ifreq {
634 	union {
635 		char	ifrn_name[LINUX_IFNAMSIZ];
636 	} ifr_ifrn;
637 
638 	union {
639 		struct l_sockaddr	ifru_addr;
640 		struct l_sockaddr	ifru_dstaddr;
641 		struct l_sockaddr	ifru_broadaddr;
642 		struct l_sockaddr	ifru_netmask;
643 		struct l_sockaddr	ifru_hwaddr;
644 		l_short		ifru_flags[1];
645 		l_int		ifru_metric;
646 		l_int		ifru_mtu;
647 		struct l_ifmap	ifru_map;
648 		char		ifru_slave[LINUX_IFNAMSIZ];
649 		l_caddr_t	ifru_data;
650 	} ifr_ifru;
651 };
652 
653 #define	ifr_name	ifr_ifrn.ifrn_name	/* interface name */
654 #define	ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address */
655 
656 /*
657  * poll()
658  */
659 #define	LINUX_POLLIN		0x0001
660 #define	LINUX_POLLPRI		0x0002
661 #define	LINUX_POLLOUT		0x0004
662 #define	LINUX_POLLERR		0x0008
663 #define	LINUX_POLLHUP		0x0010
664 #define	LINUX_POLLNVAL		0x0020
665 #define	LINUX_POLLRDNORM	0x0040
666 #define	LINUX_POLLRDBAND	0x0080
667 #define	LINUX_POLLWRNORM	0x0100
668 #define	LINUX_POLLWRBAND	0x0200
669 #define	LINUX_POLLMSG		0x0400
670 
671 struct l_pollfd {
672 	l_int		fd;
673 	l_short		events;
674 	l_short		revents;
675 };
676 
677 #endif /* !_I386_LINUX_LINUX_H_ */
678