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/alpha/linux/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: releng/5.2/sys/alpha/linux/linux.h 113575 2003-04-16 20:04:47Z jhb $
   29  */
   30 
   31 #ifndef _ALPHA_LINUX_LINUX_H_
   32 #define _ALPHA_LINUX_LINUX_H_
   33 
   34 #include <alpha/linux/linux_syscall.h>
   35 
   36 /*
   37  * debugging support
   38  */
   39 extern u_char linux_debug_map[]; 
   40 #define ldebug(name)    isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
   41 #define ARGS(nm, fmt)   "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid 
   42 #define LMSG(fmt)       "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid 
   43 
   44 #ifdef MALLOC_DECLARE
   45 MALLOC_DECLARE(M_LINUX);
   46 #endif
   47 
   48 typedef int             l_int;
   49 typedef int64_t         l_long;
   50 typedef int64_t         l_longlong;
   51 typedef short           l_short;
   52 typedef unsigned int    l_uint;
   53 typedef uint64_t        l_ulong;
   54 typedef uint64_t        l_ulonglong;
   55 typedef unsigned short  l_ushort;
   56 
   57 typedef char            *l_caddr_t;
   58 typedef l_long          l_clock_t;
   59 typedef l_int           l_daddr_t;
   60 typedef l_uint          l_dev_t;
   61 typedef l_uint          l_gid_t;
   62 typedef l_ushort        l_gid16_t;
   63 typedef l_uint          l_ino_t;
   64 typedef l_int           l_key_t;
   65 typedef l_long          l_loff_t;
   66 typedef l_uint          l_mode_t;
   67 typedef l_long          l_off_t;
   68 typedef l_int           l_pid_t;
   69 typedef l_ulong         l_size_t;
   70 typedef l_long          l_suseconds_t;
   71 typedef l_long          l_time_t;
   72 typedef l_uint          l_uid_t;
   73 typedef l_ushort        l_uid16_t;
   74 
   75 typedef struct {
   76         l_int           val[2];
   77 } l_fsid_t;
   78 
   79 typedef struct {
   80         l_time_t        tv_sec;
   81         l_suseconds_t   tv_usec;
   82 } l_timeval;
   83 
   84 #define l_fd_set        fd_set
   85 
   86 /*
   87  * Miscellaneous
   88  */
   89 #define LINUX_NAME_MAX          255
   90 #define LINUX_MAX_UTSNAME       65
   91 
   92 #define LINUX_CTL_MAXNAME       10
   93 
   94 struct l___sysctl_args
   95 {
   96         l_int           *name;
   97         l_int           nlen;
   98         void            *oldval;
   99         l_size_t        *oldlenp;
  100         void            *newval;
  101         l_size_t        newlen;
  102         l_ulong         __spare[4];
  103 };
  104 
  105 /* Scheduling policies */
  106 #define LINUX_SCHED_OTHER       0
  107 #define LINUX_SCHED_FIFO        1
  108 #define LINUX_SCHED_RR          2
  109 
  110 /* Resource limits */
  111 #define LINUX_RLIMIT_CPU        0
  112 #define LINUX_RLIMIT_FSIZE      1
  113 #define LINUX_RLIMIT_DATA       2
  114 #define LINUX_RLIMIT_STACK      3
  115 #define LINUX_RLIMIT_CORE       4
  116 #define LINUX_RLIMIT_RSS        5
  117 #define LINUX_RLIMIT_AS         7       /* address space limit */
  118 #define LINUX_RLIMIT_NPROC      8
  119 #define LINUX_RLIMIT_NOFILE     6
  120 #define LINUX_RLIMIT_MEMLOCK    9
  121 
  122 #define LINUX_RLIM_NLIMITS      10
  123 
  124 /* mmap options */
  125 #define LINUX_MAP_SHARED        0x0001
  126 #define LINUX_MAP_PRIVATE       0x0002
  127 #define LINUX_MAP_ANON          0x0010
  128 #define LINUX_MAP_FIXED         0x0100
  129 #define LINUX_MAP_GROWSDOWN     0x1000
  130 
  131 /*
  132  * stat family of syscalls
  133  */
  134 struct l_timespec {
  135         l_ulong         tv_sec;
  136 };
  137 
  138 struct l_newstat {
  139         l_uint          st_dev;
  140         l_uint          st_ino;
  141         l_uint          st_mode;
  142         l_uint          st_nlink;
  143         l_uint          st_uid;
  144         l_uint          st_gid;
  145         l_uint          st_rdev;
  146         l_long          st_size;
  147         struct l_timespec       st_atimespec;
  148         struct l_timespec       st_mtimespec;
  149         struct l_timespec       st_ctimespec;
  150         l_uint          st_blksize;
  151         l_int           st_blocks;
  152         l_uint          st_flags;
  153         l_uint          st_gen;
  154 };
  155 
  156 struct l_new_utsname {
  157         char    sysname[LINUX_MAX_UTSNAME];
  158         char    nodename[LINUX_MAX_UTSNAME];
  159         char    release[LINUX_MAX_UTSNAME];
  160         char    version[LINUX_MAX_UTSNAME];
  161         char    machine[LINUX_MAX_UTSNAME];
  162         char    domainname[LINUX_MAX_UTSNAME];
  163 };
  164 
  165 /*
  166  * Signalling
  167  */
  168 #define LINUX_SIGHUP            1
  169 #define LINUX_SIGINT            2
  170 #define LINUX_SIGQUIT           3
  171 #define LINUX_SIGILL            4
  172 #define LINUX_SIGTRAP           5
  173 #define LINUX_SIGABRT           6
  174 #define LINUX_SIGIOT            LINUX_SIGABRT
  175 #define LINUX_SIGBUS            7
  176 #define LINUX_SIGFPE            8
  177 #define LINUX_SIGKILL           9
  178 #define LINUX_SIGUSR1           10
  179 #define LINUX_SIGSEGV           11
  180 #define LINUX_SIGUSR2           12
  181 #define LINUX_SIGPIPE           13
  182 #define LINUX_SIGALRM           14
  183 #define LINUX_SIGTERM           15
  184 #define LINUX_SIGSTKFLT         16
  185 #define LINUX_SIGCHLD           17
  186 #define LINUX_SIGCONT           18
  187 #define LINUX_SIGSTOP           19
  188 #define LINUX_SIGTSTP           20
  189 #define LINUX_SIGTTIN           21
  190 #define LINUX_SIGTTOU           22
  191 #define LINUX_SIGURG            23
  192 #define LINUX_SIGXCPU           24
  193 #define LINUX_SIGXFSZ           25
  194 #define LINUX_SIGVTALRM         26
  195 #define LINUX_SIGPROF           27
  196 #define LINUX_SIGWINCH          28
  197 #define LINUX_SIGIO             29
  198 #define LINUX_SIGPOLL           LINUX_SIGIO
  199 #define LINUX_SIGPWR            30
  200 #define LINUX_SIGUNUSED         31
  201 
  202 #define LINUX_SIGTBLSZ          31
  203 #define LINUX_NSIG_WORDS        2
  204 #define LINUX_NBPW              32
  205 #define LINUX_NSIG              (LINUX_NBPW * LINUX_NSIG_WORDS)
  206 
  207 /* sigaction flags */
  208 #define LINUX_SA_ONSTACK        0x00000001
  209 #define LINUX_SA_RESTART        0x00000002
  210 #define LINUX_SA_NOCLDSTOP      0x00000004
  211 #define LINUX_SA_NODEFER        0x00000008
  212 #define LINUX_SA_RESETHAND      0x00000010
  213 #define LINUX_SA_NOCLDWAIT      0x00000020
  214 #define LINUX_SA_SIGINFO        0x00000040
  215 #define LINUX_SA_RESTORER       0x04000000
  216 #define LINUX_SA_INTERRUPT      0x20000000
  217 #define LINUX_SA_NOMASK         LINUX_SA_NODEFER
  218 #define LINUX_SA_ONESHOT        LINUX_SA_RESETHAND
  219 
  220 /* sigprocmask actions */
  221 #define LINUX_SIG_BLOCK         0
  222 #define LINUX_SIG_UNBLOCK       1
  223 #define LINUX_SIG_SETMASK       2
  224 
  225 /* sigset_t macros */
  226 #define LINUX_SIGEMPTYSET(set)          (set).__bits[0] = (set).__bits[1] = 0
  227 #define LINUX_SIGISMEMBER(set, sig)     SIGISMEMBER(set, sig)
  228 #define LINUX_SIGADDSET(set, sig)       SIGADDSET(set, sig)
  229 
  230 #define LINUX_MINSIGSTKSZ       4096
  231 
  232 typedef void    (*l_handler_t)(l_int);
  233 typedef l_ulong l_osigset_t;
  234 
  235 typedef struct {
  236         l_uint  __bits[LINUX_NSIG_WORDS];
  237 } l_sigset_t;
  238 
  239 typedef struct {
  240         l_handler_t     lsa_handler;
  241         l_osigset_t     lsa_mask;
  242         l_ulong         lsa_flags;
  243         void    (*lsa_restorer)(void);
  244 } l_osigaction_t;
  245 
  246 typedef struct {
  247         l_handler_t     lsa_handler;
  248         l_ulong         lsa_flags;
  249         void    (*lsa_restorer)(void);
  250         l_sigset_t      lsa_mask;
  251 } l_sigaction_t;
  252 
  253 /*
  254  * The Linux sigcontext
  255  */
  256 struct l_sigcontext {
  257         l_long          sc_onstack;
  258         l_long          sc_mask;
  259         l_long          sc_pc;
  260         l_long          sc_ps;
  261         l_long          sc_regs[32];
  262         l_long          sc_ownedfp;
  263         l_long          sc_fpregs[32];
  264         l_ulong         sc_fpcr;
  265         l_ulong         sc_fp_control;
  266         l_ulong         sc_reserved1, sc_reserved2;
  267         l_ulong         sc_ssize;
  268         char            *sc_sbase;
  269         l_ulong         sc_traparg_a0;
  270         l_ulong         sc_traparg_a1;
  271         l_ulong         sc_traparg_a2;
  272         l_ulong         sc_fp_trap_pc;
  273         l_ulong         sc_fp_trigger_sum;
  274         l_ulong         sc_fp_trigger_inst;
  275 };
  276 
  277 /*
  278  * We make the stack look like Linux expects it when calling a signal
  279  * handler, but use the BSD way of calling the handler and sigreturn().
  280  * This means that we need to pass the pointer to the handler too.
  281  * It is appended to the frame to not interfere with the rest of it.
  282  */
  283 struct l_sigframe {
  284         l_int                   sf_sig;
  285         struct l_sigcontext     sf_sc;
  286         l_handler_t             sf_handler;
  287 };
  288 
  289 /*
  290  * Pluggable ioctl handlers
  291  */
  292 struct linux_ioctl_args;
  293 struct thread;
  294 
  295 typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_args *);
  296 
  297 struct linux_ioctl_handler {
  298         linux_ioctl_function_t *func;
  299         int     low, high;
  300 };
  301 
  302 int     linux_ioctl_register_handler(struct linux_ioctl_handler *h);
  303 int     linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
  304 
  305 /*
  306  * open/fcntl flags
  307  */
  308 #define LINUX_O_RDONLY          00
  309 #define LINUX_O_WRONLY          01
  310 #define LINUX_O_RDWR            02
  311 #define LINUX_O_NONBLOCK        04
  312 #define LINUX_O_APPEND          010
  313 #define LINUX_O_CREAT           01000
  314 #define LINUX_O_TRUNC           02000
  315 #define LINUX_O_EXCL            04000
  316 #define LINUX_O_NOCTTY          010000
  317 #define LINUX_O_NDELAY          LINUX_O_NONBLOCK
  318 #define LINUX_O_SYNC            040000
  319 
  320 #define LINUX_FASYNC            020000
  321 
  322 /* fcntl flags */
  323 #define LINUX_F_DUPFD           0
  324 #define LINUX_F_GETFD           1
  325 #define LINUX_F_SETFD           2
  326 #define LINUX_F_GETFL           3
  327 #define LINUX_F_SETFL           4
  328 #define LINUX_F_SETOWN          5
  329 #define LINUX_F_GETOWN          6
  330 #define LINUX_F_GETLK           7
  331 #define LINUX_F_SETLK           8
  332 #define LINUX_F_SETLKW          9
  333 #define LINUX_F_SETSIG          10
  334 #define LINUX_F_GETSIG          11
  335 
  336 #define LINUX_F_RDLCK           1
  337 #define LINUX_F_WRLCK           2
  338 #define LINUX_F_UNLCK           8
  339 
  340 /*
  341  * mount flags
  342  */
  343 #define LINUX_MS_RDONLY         0x0001
  344 #define LINUX_MS_NOSUID         0x0002
  345 #define LINUX_MS_NODEV          0x0004
  346 #define LINUX_MS_NOEXEC         0x0008
  347 #define LINUX_MS_REMOUNT        0x0020
  348         
  349 /*
  350  * SystemV IPC defines
  351  */
  352 #define LINUX_SEMOP             1
  353 #define LINUX_SEMGET            2
  354 #define LINUX_SEMCTL            3
  355 #define LINUX_MSGSND            11
  356 #define LINUX_MSGRCV            12
  357 #define LINUX_MSGGET            13
  358 #define LINUX_MSGCTL            14
  359 #define LINUX_SHMAT             21
  360 #define LINUX_SHMDT             22
  361 #define LINUX_SHMGET            23
  362 #define LINUX_SHMCTL            24
  363 
  364 #define LINUX_IPC_RMID          0
  365 #define LINUX_IPC_SET           1
  366 #define LINUX_IPC_STAT          2
  367 #define LINUX_IPC_INFO          3
  368 
  369 #define LINUX_SHM_LOCK          11
  370 #define LINUX_SHM_UNLOCK        12
  371 #define LINUX_SHM_STAT          13
  372 #define LINUX_SHM_INFO          14
  373 
  374 #define LINUX_SHM_RDONLY        0x1000
  375 #define LINUX_SHM_RND           0x2000
  376 #define LINUX_SHM_REMAP         0x4000
  377 
  378 /* semctl commands */
  379 #define LINUX_GETPID            11
  380 #define LINUX_GETVAL            12
  381 #define LINUX_GETALL            13
  382 #define LINUX_GETNCNT           14
  383 #define LINUX_GETZCNT           15
  384 #define LINUX_SETVAL            16
  385 #define LINUX_SETALL            17
  386 #define LINUX_SEM_STAT          18
  387 #define LINUX_SEM_INFO          19
  388 
  389 union l_semun {
  390         l_int           val;
  391         struct l_semid_ds       *buf;
  392         l_ushort        *array;
  393         struct l_seminfo        *__buf;
  394         void            *__pad;
  395 };
  396 
  397 /*
  398  * Socket defines
  399  */
  400 #define LINUX_SOCKET            1
  401 #define LINUX_BIND              2
  402 #define LINUX_CONNECT           3
  403 #define LINUX_LISTEN            4
  404 #define LINUX_ACCEPT            5
  405 #define LINUX_GETSOCKNAME       6
  406 #define LINUX_GETPEERNAME       7
  407 #define LINUX_SOCKETPAIR        8
  408 #define LINUX_SEND              9
  409 #define LINUX_RECV              10
  410 #define LINUX_SENDTO            11
  411 #define LINUX_RECVFROM          12
  412 #define LINUX_SHUTDOWN          13
  413 #define LINUX_SETSOCKOPT        14
  414 #define LINUX_GETSOCKOPT        15
  415 #define LINUX_SENDMSG           16
  416 #define LINUX_RECVMSG           17
  417 
  418 #define LINUX_AF_UNSPEC         0
  419 #define LINUX_AF_UNIX           1
  420 #define LINUX_AF_INET           2
  421 #define LINUX_AF_AX25           3
  422 #define LINUX_AF_IPX            4
  423 #define LINUX_AF_APPLETALK      5
  424 #define LINUX_AF_INET6          10
  425 
  426 #define LINUX_SOL_SOCKET        1
  427 #define LINUX_SOL_IP            0
  428 #define LINUX_SOL_TCP           6
  429 #define LINUX_SOL_UDP           17
  430 #define LINUX_SOL_IPX           256
  431 #define LINUX_SOL_AX25          257
  432 
  433 #define LINUX_SO_DEBUG          1
  434 #define LINUX_SO_REUSEADDR      2
  435 #define LINUX_SO_TYPE           3
  436 #define LINUX_SO_ERROR          4
  437 #define LINUX_SO_DONTROUTE      5
  438 #define LINUX_SO_BROADCAST      6
  439 #define LINUX_SO_SNDBUF         7
  440 #define LINUX_SO_RCVBUF         8
  441 #define LINUX_SO_KEEPALIVE      9
  442 #define LINUX_SO_OOBINLINE      10
  443 #define LINUX_SO_NO_CHECK       11
  444 #define LINUX_SO_PRIORITY       12
  445 #define LINUX_SO_LINGER         13
  446 
  447 #define LINUX_IP_TOS            1
  448 #define LINUX_IP_TTL            2
  449 #define LINUX_IP_HDRINCL        3
  450 #define LINUX_IP_OPTIONS        4
  451 
  452 #define LINUX_IP_MULTICAST_IF           32
  453 #define LINUX_IP_MULTICAST_TTL          33
  454 #define LINUX_IP_MULTICAST_LOOP         34
  455 #define LINUX_IP_ADD_MEMBERSHIP         35
  456 #define LINUX_IP_DROP_MEMBERSHIP        36
  457 
  458 struct l_sockaddr {
  459         l_ushort        sa_family;
  460         char            sa_data[14];
  461 };
  462 
  463 struct l_ifmap {
  464         l_ulong         mem_start;
  465         l_ulong         mem_end;
  466         l_ushort        base_addr; 
  467         u_char          irq;
  468         u_char          dma;
  469         u_char          port;
  470 };
  471 
  472 #define LINUX_IFHWADDRLEN       6
  473 #define LINUX_IFNAMSIZ          16
  474 
  475 struct l_ifreq {
  476         union {
  477                 char    ifrn_name[LINUX_IFNAMSIZ];    /* if name, e.g. "en0" */
  478         } ifr_ifrn;
  479 
  480         union {
  481                 struct l_sockaddr       ifru_addr;
  482                 struct l_sockaddr       ifru_dstaddr;
  483                 struct l_sockaddr       ifru_broadaddr;
  484                 struct l_sockaddr       ifru_netmask;
  485                 struct l_sockaddr       ifru_hwaddr;
  486                 l_short         ifru_flags[1];
  487                 l_int           ifru_metric;
  488                 l_int           ifru_mtu;
  489                 struct l_ifmap  ifru_map;
  490                 char            ifru_slave[LINUX_IFNAMSIZ];
  491                 l_caddr_t       ifru_data;
  492         } ifr_ifru;
  493 };
  494 
  495 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name */
  496 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address */
  497 
  498 
  499 extern char linux_sigcode[];
  500 extern int linux_szsigcode;
  501 
  502 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
  503 extern struct sysentvec linux_sysvec;
  504 extern struct sysentvec elf_linux_sysvec;
  505 
  506 /* dummy struct definitions */
  507 struct image_params;
  508 struct trapframe;
  509 
  510 /*
  511  * poll()
  512  */
  513 #define LINUX_POLLIN            0x0001
  514 #define LINUX_POLLPRI           0x0002
  515 #define LINUX_POLLOUT           0x0004
  516 #define LINUX_POLLERR           0x0008
  517 #define LINUX_POLLHUP           0x0010
  518 #define LINUX_POLLNVAL          0x0020
  519 #define LINUX_POLLRDNORM        0x0040
  520 #define LINUX_POLLRDBAND        0x0080
  521 #define LINUX_POLLWRNORM        0x0100
  522 #define LINUX_POLLWRBAND        0x0200
  523 #define LINUX_POLLMSG           0x0400
  524 
  525 struct l_pollfd {
  526         l_int           fd;
  527         l_short         events;
  528         l_short         revents;
  529 };
  530 
  531 #endif /* !_ALPHA_LINUX_LINUX_H_ */

Cache object: cdf9ae1656047c6455397465444e626d


[ 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.