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$
   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)p->p_pid 
   42 #define LMSG(fmt)       "linux(%ld): "fmt"\n", (long)p->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 linker_set;
  293 struct linux_ioctl_args;
  294 struct proc;
  295 
  296 typedef int linux_ioctl_function_t(struct proc *, struct linux_ioctl_args *);
  297 
  298 struct linux_ioctl_handler {
  299         linux_ioctl_function_t *func;
  300         int     low, high;
  301 };
  302 
  303 int     linux_ioctl_register_handler(struct linux_ioctl_handler *h);
  304 int     linux_ioctl_register_handlers(struct linker_set *s);
  305 int     linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
  306 int     linux_ioctl_unregister_handlers(struct linker_set *s);
  307 
  308 /*
  309  * open/fcntl flags
  310  */
  311 #define LINUX_O_RDONLY          00
  312 #define LINUX_O_WRONLY          01
  313 #define LINUX_O_RDWR            02
  314 #define LINUX_O_NONBLOCK        04
  315 #define LINUX_O_APPEND          010
  316 #define LINUX_O_CREAT           01000
  317 #define LINUX_O_TRUNC           02000
  318 #define LINUX_O_EXCL            04000
  319 #define LINUX_O_NOCTTY          010000
  320 #define LINUX_O_NDELAY          LINUX_O_NONBLOCK
  321 #define LINUX_O_SYNC            040000
  322 
  323 #define LINUX_FASYNC            020000
  324 
  325 /* fcntl flags */
  326 #define LINUX_F_DUPFD           0
  327 #define LINUX_F_GETFD           1
  328 #define LINUX_F_SETFD           2
  329 #define LINUX_F_GETFL           3
  330 #define LINUX_F_SETFL           4
  331 #define LINUX_F_SETOWN          5
  332 #define LINUX_F_GETOWN          6
  333 #define LINUX_F_GETLK           7
  334 #define LINUX_F_SETLK           8
  335 #define LINUX_F_SETLKW          9
  336 #define LINUX_F_SETSIG          10
  337 #define LINUX_F_GETSIG          11
  338 
  339 #define LINUX_F_RDLCK           1
  340 #define LINUX_F_WRLCK           2
  341 #define LINUX_F_UNLCK           8
  342 
  343 /*
  344  * mount flags
  345  */
  346 #define LINUX_MS_RDONLY         0x0001
  347 #define LINUX_MS_NOSUID         0x0002
  348 #define LINUX_MS_NODEV          0x0004
  349 #define LINUX_MS_NOEXEC         0x0008
  350 #define LINUX_MS_REMOUNT        0x0020
  351         
  352 /*
  353  * SystemV IPC defines
  354  */
  355 #define LINUX_SEMOP             1
  356 #define LINUX_SEMGET            2
  357 #define LINUX_SEMCTL            3
  358 #define LINUX_MSGSND            11
  359 #define LINUX_MSGRCV            12
  360 #define LINUX_MSGGET            13
  361 #define LINUX_MSGCTL            14
  362 #define LINUX_SHMAT             21
  363 #define LINUX_SHMDT             22
  364 #define LINUX_SHMGET            23
  365 #define LINUX_SHMCTL            24
  366 
  367 #define LINUX_IPC_RMID          0
  368 #define LINUX_IPC_SET           1
  369 #define LINUX_IPC_STAT          2
  370 #define LINUX_IPC_INFO          3
  371 
  372 #define LINUX_SHM_LOCK          11
  373 #define LINUX_SHM_UNLOCK        12
  374 #define LINUX_SHM_STAT          13
  375 #define LINUX_SHM_INFO          14
  376 
  377 #define LINUX_SHM_RDONLY        0x1000
  378 #define LINUX_SHM_RND           0x2000
  379 #define LINUX_SHM_REMAP         0x4000
  380 
  381 /* semctl commands */
  382 #define LINUX_GETPID            11
  383 #define LINUX_GETVAL            12
  384 #define LINUX_GETALL            13
  385 #define LINUX_GETNCNT           14
  386 #define LINUX_GETZCNT           15
  387 #define LINUX_SETVAL            16
  388 #define LINUX_SETALL            17
  389 #define LINUX_SEM_STAT          18
  390 #define LINUX_SEM_INFO          19
  391 
  392 union l_semun {
  393         l_int           val;
  394         struct l_semid_ds       *buf;
  395         l_ushort        *array;
  396         struct l_seminfo        *__buf;
  397         void            *__pad;
  398 };
  399 
  400 /*
  401  * Socket defines
  402  */
  403 #define LINUX_SOCKET            1
  404 #define LINUX_BIND              2
  405 #define LINUX_CONNECT           3
  406 #define LINUX_LISTEN            4
  407 #define LINUX_ACCEPT            5
  408 #define LINUX_GETSOCKNAME       6
  409 #define LINUX_GETPEERNAME       7
  410 #define LINUX_SOCKETPAIR        8
  411 #define LINUX_SEND              9
  412 #define LINUX_RECV              10
  413 #define LINUX_SENDTO            11
  414 #define LINUX_RECVFROM          12
  415 #define LINUX_SHUTDOWN          13
  416 #define LINUX_SETSOCKOPT        14
  417 #define LINUX_GETSOCKOPT        15
  418 #define LINUX_SENDMSG           16
  419 #define LINUX_RECVMSG           17
  420 
  421 #define LINUX_AF_UNSPEC         0
  422 #define LINUX_AF_UNIX           1
  423 #define LINUX_AF_INET           2
  424 #define LINUX_AF_AX25           3
  425 #define LINUX_AF_IPX            4
  426 #define LINUX_AF_APPLETALK      5
  427 
  428 #define LINUX_SOL_SOCKET        1
  429 #define LINUX_SOL_IP            0
  430 #define LINUX_SOL_TCP           6
  431 #define LINUX_SOL_UDP           17
  432 #define LINUX_SOL_IPX           256
  433 #define LINUX_SOL_AX25          257
  434 
  435 #define LINUX_SO_DEBUG          1
  436 #define LINUX_SO_REUSEADDR      2
  437 #define LINUX_SO_TYPE           3
  438 #define LINUX_SO_ERROR          4
  439 #define LINUX_SO_DONTROUTE      5
  440 #define LINUX_SO_BROADCAST      6
  441 #define LINUX_SO_SNDBUF         7
  442 #define LINUX_SO_RCVBUF         8
  443 #define LINUX_SO_KEEPALIVE      9
  444 #define LINUX_SO_OOBINLINE      10
  445 #define LINUX_SO_NO_CHECK       11
  446 #define LINUX_SO_PRIORITY       12
  447 #define LINUX_SO_LINGER         13
  448 
  449 #define LINUX_IP_TOS            1
  450 #define LINUX_IP_TTL            2
  451 #define LINUX_IP_HDRINCL        3
  452 #define LINUX_IP_OPTIONS        4
  453 
  454 #define LINUX_IP_MULTICAST_IF           32
  455 #define LINUX_IP_MULTICAST_TTL          33
  456 #define LINUX_IP_MULTICAST_LOOP         34
  457 #define LINUX_IP_ADD_MEMBERSHIP         35
  458 #define LINUX_IP_DROP_MEMBERSHIP        36
  459 
  460 struct l_sockaddr {
  461         l_ushort        sa_family;
  462         char            sa_data[14];
  463 };
  464 
  465 struct l_ifmap {
  466         l_ulong         mem_start;
  467         l_ulong         mem_end;
  468         l_ushort        base_addr; 
  469         u_char          irq;
  470         u_char          dma;
  471         u_char          port;
  472 };
  473 
  474 #define LINUX_IFHWADDRLEN       6
  475 #define LINUX_IFNAMSIZ          16
  476 
  477 struct l_ifreq {
  478         union {
  479                 char    ifrn_name[LINUX_IFNAMSIZ];    /* if name, e.g. "en0" */
  480         } ifr_ifrn;
  481 
  482         union {
  483                 struct l_sockaddr       ifru_addr;
  484                 struct l_sockaddr       ifru_dstaddr;
  485                 struct l_sockaddr       ifru_broadaddr;
  486                 struct l_sockaddr       ifru_netmask;
  487                 struct l_sockaddr       ifru_hwaddr;
  488                 l_short         ifru_flags[1];
  489                 l_int           ifru_metric;
  490                 l_int           ifru_mtu;
  491                 struct l_ifmap  ifru_map;
  492                 char            ifru_slave[LINUX_IFNAMSIZ];
  493                 l_caddr_t       ifru_data;
  494         } ifr_ifru;
  495 };
  496 
  497 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name */
  498 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address */
  499 
  500 
  501 extern char linux_sigcode[];
  502 extern int linux_szsigcode;
  503 
  504 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
  505 extern struct sysentvec linux_sysvec;
  506 extern struct sysentvec elf_linux_sysvec;
  507 
  508 /* dummy struct definitions */
  509 struct image_params;
  510 struct trapframe;
  511 
  512 /*
  513  * poll()
  514  */
  515 #define LINUX_POLLIN            0x0001
  516 #define LINUX_POLLPRI           0x0002
  517 #define LINUX_POLLOUT           0x0004
  518 #define LINUX_POLLERR           0x0008
  519 #define LINUX_POLLHUP           0x0010
  520 #define LINUX_POLLNVAL          0x0020
  521 #define LINUX_POLLRDNORM        0x0040
  522 #define LINUX_POLLRDBAND        0x0080
  523 #define LINUX_POLLWRNORM        0x0100
  524 #define LINUX_POLLWRBAND        0x0200
  525 #define LINUX_POLLMSG           0x0400
  526 
  527 struct l_pollfd {
  528         l_int           fd;
  529         l_short         events;
  530         l_short         revents;
  531 };
  532 
  533 #endif /* !_ALPHA_LINUX_LINUX_H_ */

Cache object: 3c776615bf5537b3b0f017418ff4d76b


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