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