The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/emulation/linux/i386/linux.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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.9 2006/10/23 21:50:32 dillon Exp $
   30  */
   31 
   32 #ifndef _EMULATION_LINUX_ARCH_LINUX_H_
   33 #define _EMULATION_LINUX_ARCH_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 #if 0
   48 #define LINUX_DEBUG     1
   49 #endif
   50 
   51 #ifdef MALLOC_DECLARE
   52 MALLOC_DECLARE(M_LINUX);
   53 #endif
   54 
   55 #define PTRIN(v)        (void *)(v)
   56 #define PTROUT(v)       (l_uintptr_t)(v)
   57 
   58 /*
   59  * Provide a separate set of types for the Linux types.
   60  */
   61 typedef int             l_int;
   62 typedef int32_t         l_long;
   63 typedef int64_t         l_longlong;
   64 typedef short           l_short;
   65 typedef unsigned int    l_uint;
   66 typedef uint32_t        l_ulong;
   67 typedef uint64_t        l_ulonglong;
   68 typedef unsigned short  l_ushort;
   69 
   70 typedef l_ulong         l_uintptr_t;
   71 typedef char            *l_caddr_t;
   72 typedef l_long          l_clock_t;
   73 typedef l_int           l_daddr_t;
   74 typedef l_ushort        l_dev_t;
   75 typedef l_uint          l_gid_t;
   76 typedef l_ushort        l_gid16_t;
   77 typedef l_ulong         l_ino_t;
   78 typedef l_int           l_key_t;
   79 typedef l_longlong      l_loff_t;
   80 typedef l_ushort        l_mode_t;
   81 typedef l_long          l_off_t;
   82 typedef l_int           l_pid_t;
   83 typedef l_uint          l_size_t;
   84 typedef l_long          l_suseconds_t;
   85 typedef l_long          l_time_t;
   86 typedef l_uint          l_uid_t;
   87 typedef l_ushort        l_uid16_t;
   88 typedef l_int           l_timer_t;
   89 typedef l_int           l_mqd_t;
   90 
   91 typedef struct {
   92         l_int           val[2];
   93 } l_fsid_t;
   94 
   95 typedef struct {
   96         l_time_t        tv_sec;
   97         l_suseconds_t   tv_usec;
   98 } l_timeval;
   99 
  100 #define l_fd_set        fd_set
  101 
  102 /*
  103  * Miscellaneous
  104  */
  105 #define LINUX_NAME_MAX          255
  106 #define LINUX_MAX_UTSNAME       65
  107 
  108 #define LINUX_CTL_MAXNAME       10
  109 
  110 struct l___sysctl_args
  111 {
  112         l_int           *name;
  113         l_int           nlen;
  114         void            *oldval;
  115         l_size_t        *oldlenp;
  116         void            *newval;
  117         l_size_t        newlen;
  118         l_ulong         __spare[4];
  119 };
  120 
  121 /* Scheduling policies */
  122 #define LINUX_SCHED_OTHER       0
  123 #define LINUX_SCHED_FIFO        1
  124 #define LINUX_SCHED_RR          2
  125 
  126 /* Resource limits */
  127 #define LINUX_RLIMIT_CPU        0
  128 #define LINUX_RLIMIT_FSIZE      1
  129 #define LINUX_RLIMIT_DATA       2
  130 #define LINUX_RLIMIT_STACK      3
  131 #define LINUX_RLIMIT_CORE       4
  132 #define LINUX_RLIMIT_RSS        5
  133 #define LINUX_RLIMIT_NPROC      6
  134 #define LINUX_RLIMIT_NOFILE     7
  135 #define LINUX_RLIMIT_MEMLOCK    8
  136 #define LINUX_RLIMIT_AS         9       /* address space limit */
  137 
  138 #define LINUX_RLIM_NLIMITS      10
  139 
  140 struct l_rlimit {
  141         l_ulong rlim_cur;
  142         l_ulong rlim_max;
  143 };
  144 
  145 /* mmap options */
  146 #define LINUX_MAP_SHARED        0x0001
  147 #define LINUX_MAP_PRIVATE       0x0002
  148 #define LINUX_MAP_FIXED         0x0010
  149 #define LINUX_MAP_ANON          0x0020
  150 #define LINUX_MAP_GROWSDOWN     0x0100
  151 
  152 /*
  153  * stat family of syscalls
  154  */
  155 struct l_timespec {
  156         l_time_t        tv_sec;
  157         l_long          tv_nsec;
  158 };
  159 
  160 struct l_newstat {
  161         l_ushort        st_dev;
  162         l_ushort        __pad1;
  163         l_ulong         st_ino;
  164         l_ushort        st_mode;
  165         l_ushort        st_nlink;
  166         l_ushort        st_uid;
  167         l_ushort        st_gid;
  168         l_ushort        st_rdev;
  169         l_ushort        __pad2;
  170         l_ulong         st_size;
  171         l_ulong         st_blksize;
  172         l_ulong         st_blocks;
  173         struct l_timespec       st_atimespec;
  174         struct l_timespec       st_mtimespec;
  175         struct l_timespec       st_ctimespec;
  176         l_ulong         __unused4;
  177         l_ulong         __unused5;
  178 };
  179 
  180 struct l_stat64 {
  181         l_ushort        st_dev;
  182         u_char          __pad0[10];
  183         l_ulong         __st_ino;
  184         l_uint          st_mode;
  185         l_uint          st_nlink;
  186         l_ulong         st_uid;
  187         l_ulong         st_gid;
  188         l_ushort        st_rdev;
  189         u_char          __pad3[10];
  190         l_longlong      st_size;
  191         l_ulong         st_blksize;
  192         l_ulong         st_blocks;
  193         l_ulong         __pad4;
  194         struct l_timespec       st_atimespec;
  195         struct l_timespec       st_mtimespec;
  196         struct l_timespec       st_ctimespec;
  197         l_ulonglong     st_ino;
  198 };
  199 
  200 struct l_statfs64 {
  201         l_int           f_type;
  202         l_int           f_bsize;
  203         uint64_t        f_blocks;
  204         uint64_t        f_bfree;
  205         uint64_t        f_bavail;
  206         uint64_t        f_files;
  207         uint64_t        f_ffree;
  208         l_fsid_t        f_fsid;
  209         l_int           f_namelen;
  210         l_int           f_spare[6];
  211 };
  212 
  213 struct l_new_utsname {
  214         char    sysname[LINUX_MAX_UTSNAME];
  215         char    nodename[LINUX_MAX_UTSNAME];
  216         char    release[LINUX_MAX_UTSNAME];
  217         char    version[LINUX_MAX_UTSNAME];
  218         char    machine[LINUX_MAX_UTSNAME];
  219         char    domainname[LINUX_MAX_UTSNAME];
  220 };
  221 
  222 /*
  223  * Signalling
  224  */
  225 #define LINUX_SIGHUP            1
  226 #define LINUX_SIGINT            2
  227 #define LINUX_SIGQUIT           3
  228 #define LINUX_SIGILL            4
  229 #define LINUX_SIGTRAP           5
  230 #define LINUX_SIGABRT           6
  231 #define LINUX_SIGIOT            LINUX_SIGABRT
  232 #define LINUX_SIGBUS            7
  233 #define LINUX_SIGFPE            8
  234 #define LINUX_SIGKILL           9
  235 #define LINUX_SIGUSR1           10
  236 #define LINUX_SIGSEGV           11
  237 #define LINUX_SIGUSR2           12
  238 #define LINUX_SIGPIPE           13
  239 #define LINUX_SIGALRM           14
  240 #define LINUX_SIGTERM           15
  241 #define LINUX_SIGSTKFLT         16
  242 #define LINUX_SIGCHLD           17
  243 #define LINUX_SIGCONT           18
  244 #define LINUX_SIGSTOP           19
  245 #define LINUX_SIGTSTP           20
  246 #define LINUX_SIGTTIN           21
  247 #define LINUX_SIGTTOU           22
  248 #define LINUX_SIGURG            23
  249 #define LINUX_SIGXCPU           24
  250 #define LINUX_SIGXFSZ           25
  251 #define LINUX_SIGVTALRM         26
  252 #define LINUX_SIGPROF           27
  253 #define LINUX_SIGWINCH          28
  254 #define LINUX_SIGIO             29
  255 #define LINUX_SIGPOLL           LINUX_SIGIO
  256 #define LINUX_SIGPWR            30
  257 #define LINUX_SIGSYS            31
  258 
  259 #define LINUX_SIGTBLSZ          31
  260 #define LINUX_NSIG_WORDS        2
  261 #define LINUX_NBPW              32
  262 #define LINUX_NSIG              (LINUX_NBPW * LINUX_NSIG_WORDS)
  263 
  264 /* sigaction flags */
  265 #define LINUX_SA_NOCLDSTOP      0x00000001
  266 #define LINUX_SA_NOCLDWAIT      0x00000002
  267 #define LINUX_SA_SIGINFO        0x00000004
  268 #define LINUX_SA_RESTORER       0x04000000
  269 #define LINUX_SA_ONSTACK        0x08000000
  270 #define LINUX_SA_RESTART        0x10000000
  271 #define LINUX_SA_INTERRUPT      0x20000000
  272 #define LINUX_SA_NOMASK         0x40000000
  273 #define LINUX_SA_ONESHOT        0x80000000
  274 
  275 /* sigprocmask actions */
  276 #define LINUX_SIG_BLOCK         0
  277 #define LINUX_SIG_UNBLOCK       1
  278 #define LINUX_SIG_SETMASK       2
  279 
  280 /* sigset_t macros */
  281 #define LINUX_SIGEMPTYSET(set)          (set).__bits[0] = (set).__bits[1] = 0
  282 #define LINUX_SIGISMEMBER(set, sig)     SIGISMEMBER(set, sig)
  283 #define LINUX_SIGADDSET(set, sig)       SIGADDSET(set, sig)
  284 
  285 /* sigaltstack */
  286 #define LINUX_MINSIGSTKSZ       2048
  287 #define LINUX_SS_ONSTACK        1
  288 #define LINUX_SS_DISABLE        2
  289 
  290 int linux_to_bsd_sigaltstack(int lsa);
  291 int bsd_to_linux_sigaltstack(int bsa);
  292 
  293 typedef void    (*l_handler_t)(l_int);
  294 typedef l_ulong l_osigset_t;
  295 
  296 typedef struct {
  297         l_uint  __bits[LINUX_NSIG_WORDS];
  298 } l_sigset_t;
  299 
  300 typedef struct {
  301         l_handler_t     lsa_handler;
  302         l_osigset_t     lsa_mask;
  303         l_ulong         lsa_flags;
  304         void    (*lsa_restorer)(void);
  305 } l_osigaction_t;
  306 
  307 typedef struct {
  308         l_handler_t     lsa_handler;
  309         l_ulong         lsa_flags;
  310         void    (*lsa_restorer)(void);
  311         l_sigset_t      lsa_mask;
  312 } l_sigaction_t;
  313 
  314 typedef struct {
  315         void            *ss_sp;
  316         l_int           ss_flags;
  317         l_size_t        ss_size;
  318 } l_stack_t;
  319 
  320 /* The Linux sigcontext, pretty much a standard 386 trapframe. */
  321 struct l_sigcontext {
  322         l_int           sc_gs;
  323         l_int           sc_fs;
  324         l_int           sc_es;
  325         l_int           sc_ds;
  326         l_int           sc_edi;
  327         l_int           sc_esi;
  328         l_int           sc_ebp;
  329         l_int           sc_esp;
  330         l_int           sc_ebx;
  331         l_int           sc_edx;
  332         l_int           sc_ecx;
  333         l_int           sc_eax;
  334         l_int           sc_trapno;
  335         l_int           sc_err;
  336         l_int           sc_eip;
  337         l_int           sc_cs;
  338         l_int           sc_eflags;
  339         l_int           sc_esp_at_signal;
  340         l_int           sc_ss;
  341         l_int           sc_387;
  342         l_int           sc_mask;
  343         l_int           sc_cr2;
  344 };
  345 
  346 struct l_ucontext {
  347         l_ulong         uc_flags;
  348         void            *uc_link;
  349         l_stack_t       uc_stack;
  350         struct l_sigcontext     uc_mcontext;
  351         l_sigset_t      uc_sigmask;
  352 };
  353 
  354 #define LINUX_SI_MAX_SIZE     128
  355 #define LINUX_SI_PAD_SIZE     ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
  356 
  357 typedef struct l_siginfo {
  358         l_int           lsi_signo;
  359         l_int           lsi_errno;
  360         l_int           lsi_code;
  361         union {
  362                 l_int   _pad[LINUX_SI_PAD_SIZE];
  363 
  364                 struct {
  365                         l_pid_t         _pid;
  366                         l_uid16_t       _uid;
  367                 } _kill;
  368 
  369                 struct {
  370                         l_uint          _timer1;
  371                         l_uint          _timer2;
  372                 } _timer;
  373 
  374                 struct {
  375                         l_pid_t         _pid;           /* sender's pid */
  376                         l_uid16_t       _uid;           /* sender's uid */
  377                         union sigval _sigval;
  378                 } _rt;
  379 
  380                 struct {
  381                         l_pid_t         _pid;           /* which child */
  382                         l_uid16_t       _uid;           /* sender's uid */
  383                         l_int           _status;        /* exit code */
  384                         l_clock_t       _utime;
  385                         l_clock_t       _stime;
  386                 } _sigchld;
  387 
  388                 struct {
  389                         void            *_addr; /* faulting insn/memory ref. */
  390                 } _sigfault;
  391 
  392                 struct {
  393                         l_int           _band;  /* POLL_IN,POLL_OUT,POLL_MSG */
  394                         l_int           _fd;
  395                 } _sigpoll;
  396         } _sifields;
  397 } l_siginfo_t;
  398 
  399 #define lsi_pid          _sifields._kill._pid
  400 #define lsi_uid          _sifields._kill._uid
  401 #define lsi_status       _sifields._sigchld._status
  402 #define lsi_utime        _sifields._sigchld._utime
  403 #define lsi_stime        _sifields._sigchld._stime
  404 #define lsi_value        _sifields._rt._sigval
  405 #define lsi_int          _sifields._rt._sigval.sival_int
  406 #define lsi_ptr          _sifields._rt._sigval.sival_ptr
  407 #define lsi_addr         _sifields._sigfault._addr
  408 #define lsi_band         _sifields._sigpoll._band
  409 #define lsi_fd           _sifields._sigpoll._fd
  410 
  411 struct l_fpreg {
  412         u_int16_t significand[4];
  413         u_int16_t exponent;
  414 };
  415 
  416 struct l_fpxreg {
  417         u_int16_t significand[4];
  418         u_int16_t exponent;
  419         u_int16_t padding[3];
  420 };
  421 
  422 struct l_xmmreg {
  423         u_int32_t element[4];
  424 };
  425 
  426 struct l_fpstate {
  427         /* Regular FPU environment */
  428         u_int32_t               cw;
  429         u_int32_t               sw;
  430         u_int32_t               tag;
  431         u_int32_t               ipoff;
  432         u_int32_t               cssel;
  433         u_int32_t               dataoff;
  434         u_int32_t               datasel;
  435         struct l_fpreg          _st[8];
  436         u_int16_t               status;
  437         u_int16_t               magic;  /* 0xffff = regular FPU data */
  438 
  439         /* FXSR FPU environment */
  440         u_int32_t               _fxsr_env[6]; /* env is ignored */
  441         u_int32_t               mxcsr;
  442         u_int32_t               reserved;
  443         struct l_fpxreg         _fxsr_st[8];  /* reg data is ignored */
  444         struct l_xmmreg         _xmm[8];
  445         u_int32_t               padding[56];
  446 };
  447 
  448 /*
  449  * We make the stack look like Linux expects it when calling a signal
  450  * handler, but use the BSD way of calling the handler and sigreturn().
  451  * This means that we need to pass the pointer to the handler too.
  452  * It is appended to the frame to not interfere with the rest of it.
  453  */
  454 struct l_sigframe {
  455         l_int                   sf_sig;
  456         struct l_sigcontext     sf_sc;
  457         struct l_fpstate        sf_fpstate;
  458         l_uint                  sf_extramask[LINUX_NSIG_WORDS-1];
  459         l_handler_t             sf_handler;
  460 };
  461 
  462 struct l_rt_sigframe {
  463         l_int                   sf_sig;
  464         l_siginfo_t             *sf_siginfo;
  465         struct l_ucontext       *sf_ucontext;
  466         l_siginfo_t             sf_si;
  467         struct l_ucontext       sf_sc;
  468         l_handler_t             sf_handler;
  469 };
  470 
  471 extern int bsd_to_linux_signal[];
  472 extern int linux_to_bsd_signal[];
  473 extern struct sysentvec linux_sysvec;
  474 extern struct sysentvec elf_linux_sysvec;
  475 
  476 /*
  477  * Pluggable ioctl handlers
  478  */
  479 
  480 extern struct ioctl_map linux_ioctl_map;
  481 
  482 /*
  483  * open/fcntl flags
  484  */
  485 #define LINUX_O_RDONLY          00
  486 #define LINUX_O_WRONLY          01
  487 #define LINUX_O_RDWR            02
  488 #define LINUX_O_CREAT           0100
  489 #define LINUX_O_EXCL            0200
  490 #define LINUX_O_NOCTTY          0400
  491 #define LINUX_O_TRUNC           01000
  492 #define LINUX_O_APPEND          02000
  493 #define LINUX_O_NONBLOCK        04000
  494 #define LINUX_O_NDELAY          LINUX_O_NONBLOCK
  495 #define LINUX_O_SYNC            010000
  496 #define LINUX_FASYNC            020000
  497 #define LINUX_O_DIRECTORY       00200000
  498 
  499 #define LINUX_F_DUPFD           0
  500 #define LINUX_F_GETFD           1
  501 #define LINUX_F_SETFD           2
  502 #define LINUX_F_GETFL           3
  503 #define LINUX_F_SETFL           4
  504 #define LINUX_F_GETLK           5
  505 #define LINUX_F_SETLK           6
  506 #define LINUX_F_SETLKW          7
  507 #define LINUX_F_SETOWN          8
  508 #define LINUX_F_GETOWN          9
  509 
  510 #define LINUX_F_GETLK64         12
  511 #define LINUX_F_SETLK64         13
  512 #define LINUX_F_SETLKW64        14
  513 
  514 #define LINUX_F_RDLCK           0
  515 #define LINUX_F_WRLCK           1
  516 #define LINUX_F_UNLCK           2
  517 
  518 /*
  519  * mount flags
  520  */
  521 #define LINUX_MS_RDONLY         0x0001
  522 #define LINUX_MS_NOSUID         0x0002
  523 #define LINUX_MS_NODEV          0x0004
  524 #define LINUX_MS_NOEXEC         0x0008
  525 #define LINUX_MS_REMOUNT        0x0020
  526         
  527 /*
  528  * SystemV IPC defines
  529  */
  530 #define LINUX_SEMOP             1
  531 #define LINUX_SEMGET            2
  532 #define LINUX_SEMCTL            3
  533 #define LINUX_MSGSND            11
  534 #define LINUX_MSGRCV            12
  535 #define LINUX_MSGGET            13
  536 #define LINUX_MSGCTL            14
  537 #define LINUX_SHMAT             21
  538 #define LINUX_SHMDT             22
  539 #define LINUX_SHMGET            23
  540 #define LINUX_SHMCTL            24
  541 
  542 #define LINUX_IPC_RMID          0
  543 #define LINUX_IPC_SET           1
  544 #define LINUX_IPC_STAT          2
  545 #define LINUX_IPC_INFO          3
  546 
  547 #define LINUX_SHM_LOCK          11
  548 #define LINUX_SHM_UNLOCK        12
  549 #define LINUX_SHM_STAT          13
  550 #define LINUX_SHM_INFO          14
  551 
  552 #define LINUX_SHM_RDONLY        0x1000
  553 #define LINUX_SHM_RND           0x2000
  554 #define LINUX_SHM_REMAP         0x4000
  555 
  556 /* semctl commands */
  557 #define LINUX_GETPID            11
  558 #define LINUX_GETVAL            12
  559 #define LINUX_GETALL            13
  560 #define LINUX_GETNCNT           14
  561 #define LINUX_GETZCNT           15
  562 #define LINUX_SETVAL            16
  563 #define LINUX_SETALL            17
  564 #define LINUX_SEM_STAT          18
  565 #define LINUX_SEM_INFO          19
  566 
  567 union l_semun {
  568         l_int           val;
  569         struct l_semid_ds       *buf;
  570         l_ushort        *array;
  571         struct l_seminfo        *__buf;
  572         void            *__pad;
  573 };
  574 
  575 /*
  576  * Socket defines
  577  */
  578 #define LINUX_SOCKET            1
  579 #define LINUX_BIND              2
  580 #define LINUX_CONNECT           3
  581 #define LINUX_LISTEN            4
  582 #define LINUX_ACCEPT            5
  583 #define LINUX_GETSOCKNAME       6
  584 #define LINUX_GETPEERNAME       7
  585 #define LINUX_SOCKETPAIR        8
  586 #define LINUX_SEND              9
  587 #define LINUX_RECV              10
  588 #define LINUX_SENDTO            11
  589 #define LINUX_RECVFROM          12
  590 #define LINUX_SHUTDOWN          13
  591 #define LINUX_SETSOCKOPT        14
  592 #define LINUX_GETSOCKOPT        15
  593 #define LINUX_SENDMSG           16
  594 #define LINUX_RECVMSG           17
  595 
  596 #define LINUX_AF_UNSPEC         0
  597 #define LINUX_AF_UNIX           1
  598 #define LINUX_AF_INET           2
  599 #define LINUX_AF_AX25           3
  600 #define LINUX_AF_IPX            4
  601 #define LINUX_AF_APPLETALK      5
  602 
  603 #define LINUX_SOL_SOCKET        1
  604 #define LINUX_SOL_IP            0
  605 #define LINUX_SOL_IPX           256
  606 #define LINUX_SOL_AX25          257
  607 #define LINUX_SOL_TCP           6
  608 #define LINUX_SOL_UDP           17
  609 
  610 #define LINUX_SO_DEBUG          1
  611 #define LINUX_SO_REUSEADDR      2
  612 #define LINUX_SO_TYPE           3
  613 #define LINUX_SO_ERROR          4
  614 #define LINUX_SO_DONTROUTE      5
  615 #define LINUX_SO_BROADCAST      6
  616 #define LINUX_SO_SNDBUF         7
  617 #define LINUX_SO_RCVBUF         8
  618 #define LINUX_SO_KEEPALIVE      9
  619 #define LINUX_SO_OOBINLINE      10
  620 #define LINUX_SO_NO_CHECK       11
  621 #define LINUX_SO_PRIORITY       12
  622 #define LINUX_SO_LINGER         13
  623 #define LINUX_SO_PEERCRED       17
  624 #define LINUX_SO_RCVLOWAT       18
  625 #define LINUX_SO_SNDLOWAT       19
  626 #define LINUX_SO_RCVTIMEO       20
  627 #define LINUX_SO_SNDTIMEO       21
  628 #define LINUX_SO_TIMESTAMP      29
  629 #define LINUX_SO_ACCEPTCONN     30
  630 
  631 #define LINUX_IP_TOS            1
  632 #define LINUX_IP_TTL            2
  633 #define LINUX_IP_HDRINCL        3
  634 #define LINUX_IP_OPTIONS        4
  635 
  636 #define LINUX_IP_MULTICAST_IF           32
  637 #define LINUX_IP_MULTICAST_TTL          33
  638 #define LINUX_IP_MULTICAST_LOOP         34
  639 #define LINUX_IP_ADD_MEMBERSHIP         35
  640 #define LINUX_IP_DROP_MEMBERSHIP        36
  641 
  642 struct l_sockaddr {
  643         l_ushort        sa_family;
  644         char            sa_data[14];
  645 };
  646 
  647 struct l_ifmap {
  648         l_ulong         mem_start;
  649         l_ulong         mem_end;
  650         l_ushort        base_addr;
  651         u_char          irq;
  652         u_char          dma;
  653         u_char          port;
  654 };
  655 
  656 #define LINUX_IFHWADDRLEN       6
  657 #define LINUX_IFNAMSIZ          16
  658 
  659 struct l_ifreq {
  660         union {
  661                 char    ifrn_name[LINUX_IFNAMSIZ];
  662         } ifr_ifrn;
  663 
  664         union {
  665                 struct l_sockaddr       ifru_addr;
  666                 struct l_sockaddr       ifru_dstaddr;
  667                 struct l_sockaddr       ifru_broadaddr;
  668                 struct l_sockaddr       ifru_netmask;
  669                 struct l_sockaddr       ifru_hwaddr;
  670                 l_short         ifru_flags[1];
  671                 l_int           ifru_metric;
  672                 l_int           ifru_ivalue;
  673                 l_int           ifru_mtu;
  674                 struct l_ifmap  ifru_map;
  675                 char            ifru_slave[LINUX_IFNAMSIZ];
  676                 l_caddr_t       ifru_data;
  677         } ifr_ifru;
  678 };
  679 
  680 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name */
  681 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address */
  682 #define ifr_ifindex     ifr_ifru.ifru_ivalue    /* Interface index */
  683 #define ifr_ifmetric    ifr_ifru.ifru_metric    /* Interface index */
  684 
  685 /*
  686  * poll()
  687  */
  688 #define LINUX_POLLIN            0x0001
  689 #define LINUX_POLLPRI           0x0002
  690 #define LINUX_POLLOUT           0x0004
  691 #define LINUX_POLLERR           0x0008
  692 #define LINUX_POLLHUP           0x0010
  693 #define LINUX_POLLNVAL          0x0020
  694 #define LINUX_POLLRDNORM        0x0040
  695 #define LINUX_POLLRDBAND        0x0080
  696 #define LINUX_POLLWRNORM        0x0100
  697 #define LINUX_POLLWRBAND        0x0200
  698 #define LINUX_POLLMSG           0x0400
  699 
  700 struct l_pollfd {
  701         l_int           fd;
  702         l_short         events;
  703         l_short         revents;
  704 };
  705 
  706 struct l_user_desc {
  707         l_uint          entry_number;
  708         l_uint          base_addr;
  709         l_uint          limit;
  710         l_uint          seg_32bit:1;
  711         l_uint          contents:2;
  712         l_uint          read_exec_only:1;
  713         l_uint          limit_in_pages:1;
  714         l_uint          seg_not_present:1;
  715         l_uint          useable:1;
  716 };
  717 
  718 struct l_desc_struct {
  719         unsigned long   a, b;
  720 };
  721 
  722 
  723 #define LINUX_LOWERWORD 0x0000ffff
  724 
  725 /*
  726  * Macros which does the same thing as those in Linux include/asm-um/ldt-i386.h.
  727  * These convert Linux user space descriptor to machine one.
  728  */
  729 #define LINUX_LDT_entry_a(info)                                 \
  730         ((((info)->base_addr & LINUX_LOWERWORD) << 16) |        \
  731         ((info)->limit & LINUX_LOWERWORD))
  732 
  733 #define LINUX_ENTRY_B_READ_EXEC_ONLY    9
  734 #define LINUX_ENTRY_B_CONTENTS          10
  735 #define LINUX_ENTRY_B_SEG_NOT_PRESENT   15
  736 #define LINUX_ENTRY_B_BASE_ADDR         16
  737 #define LINUX_ENTRY_B_USEABLE           20
  738 #define LINUX_ENTRY_B_SEG32BIT          22
  739 #define LINUX_ENTRY_B_LIMIT             23
  740 
  741 #define LINUX_LDT_entry_b(info)                                                 \
  742         (((info)->base_addr & 0xff000000) |                                     \
  743         ((info)->limit & 0xf0000) |                                             \
  744         ((info)->contents << LINUX_ENTRY_B_CONTENTS) |                          \
  745         (((info)->seg_not_present == 0) << LINUX_ENTRY_B_SEG_NOT_PRESENT) |     \
  746         (((info)->base_addr & 0x00ff0000) >> LINUX_ENTRY_B_BASE_ADDR) |         \
  747         (((info)->read_exec_only == 0) << LINUX_ENTRY_B_READ_EXEC_ONLY) |       \
  748         ((info)->seg_32bit << LINUX_ENTRY_B_SEG32BIT) |                         \
  749         ((info)->useable << LINUX_ENTRY_B_USEABLE) |                            \
  750         ((info)->limit_in_pages << LINUX_ENTRY_B_LIMIT) | 0x7000)
  751 
  752 #define LINUX_LDT_empty(info)           \
  753         ((info)->base_addr == 0 &&      \
  754         (info)->limit == 0 &&           \
  755         (info)->contents == 0 &&        \
  756         (info)->seg_not_present == 1 && \
  757         (info)->read_exec_only == 1 &&  \
  758         (info)->seg_32bit == 0 &&       \
  759         (info)->limit_in_pages == 0 &&  \
  760         (info)->useable == 0)
  761 
  762 /*
  763  * Macros for converting segments.
  764  * They do the same as those in arch/i386/kernel/process.c in Linux.
  765  */
  766 #define LINUX_GET_BASE(desc)                            \
  767         ((((desc)->a >> 16) & LINUX_LOWERWORD) |        \
  768         (((desc)->b << 16) & 0x00ff0000) |              \
  769         ((desc)->b & 0xff000000))
  770 
  771 #define LINUX_GET_LIMIT(desc)                   \
  772         (((desc)->a & LINUX_LOWERWORD) |        \
  773         ((desc)->b & 0xf0000))
  774 
  775 #define LINUX_GET_32BIT(desc)           \
  776         (((desc)->b >> LINUX_ENTRY_B_SEG32BIT) & 1)
  777 #define LINUX_GET_CONTENTS(desc)        \
  778         (((desc)->b >> LINUX_ENTRY_B_CONTENTS) & 3)
  779 #define LINUX_GET_WRITABLE(desc)        \
  780         (((desc)->b >> LINUX_ENTRY_B_READ_EXEC_ONLY) & 1)
  781 #define LINUX_GET_LIMIT_PAGES(desc)     \
  782         (((desc)->b >> LINUX_ENTRY_B_LIMIT) & 1)
  783 #define LINUX_GET_PRESENT(desc)         \
  784         (((desc)->b >> LINUX_ENTRY_B_SEG_NOT_PRESENT) & 1)
  785 #define LINUX_GET_USEABLE(desc)         \
  786         (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
  787 
  788 #define LINUX_CLOCK_REALTIME            0
  789 #define LINUX_CLOCK_MONOTONIC           1
  790 #define LINUX_CLOCK_PROCESS_CPUTIME_ID  2
  791 #define LINUX_CLOCK_THREAD_CPUTIME_ID   3
  792 #define LINUX_CLOCK_REALTIME_HR         4
  793 #define LINUX_CLOCK_MONOTONIC_HR        5
  794 
  795 #define LINUX_CLONE_VM                  0x00000100
  796 #define LINUX_CLONE_FS                  0x00000200
  797 #define LINUX_CLONE_FILES               0x00000400
  798 #define LINUX_CLONE_SIGHAND             0x00000800
  799 #define LINUX_CLONE_PID                 0x00001000      /* No longer exist in Linux */
  800 #define LINUX_CLONE_VFORK               0x00004000
  801 #define LINUX_CLONE_PARENT              0x00008000
  802 #define LINUX_CLONE_THREAD              0x00010000
  803 #define LINUX_CLONE_SETTLS              0x00080000
  804 #define LINUX_CLONE_PARENT_SETTID       0x00100000
  805 #define LINUX_CLONE_CHILD_CLEARTID      0x00200000
  806 #define LINUX_CLONE_CHILD_SETTID        0x01000000
  807 
  808 #define LINUX_THREADING_FLAGS                                   \
  809         (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES |  \
  810         LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
  811 
  812 #define LINUX_AT_FDCWD                  -100
  813 #define LINUX_AT_SYMLINK_NOFOLLOW       0x100
  814 #define LINUX_AT_REMOVEDIR              0x200
  815 
  816 #define LINUX_MREMAP_MAYMOVE    1
  817 #define LINUX_MREMAP_FIXED      2
  818 
  819 #define LINUX_UTIME_NOW (-1)
  820 #define LINUX_UTIME_OMIT (-2)
  821 #endif /* !_EMULATION_LINUX_ARCH_LINUX_H_ */

Cache object: 4606476e5185edabcdade56fa989f6b2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.