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/kernel/priv.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 #ifndef PRIV_H
    2 #define PRIV_H
    3 
    4 /* Declaration of the system privileges structure. It defines flags, system 
    5  * call masks, an synchronous alarm timer, I/O privileges, pending hardware 
    6  * interrupts and notifications, and so on.
    7  * System processes each get their own structure with properties, whereas all 
    8  * user processes share one structure. This setup provides a clear separation
    9  * between common and privileged process fields and is very space efficient. 
   10  *
   11  * Changes:
   12  *   Jul 01, 2005       Created.  (Jorrit N. Herder)    
   13  */
   14 #include <minix/com.h>
   15 #include "protect.h"
   16 #include "const.h"
   17 #include "type.h"
   18  
   19 struct priv {
   20   proc_nr_t s_proc_nr;          /* number of associated process */
   21   sys_id_t s_id;                /* index of this system structure */
   22   short s_flags;                /* PREEMTIBLE, BILLABLE, etc. */
   23 
   24   short s_trap_mask;            /* allowed system call traps */
   25   sys_map_t s_ipc_from;         /* allowed callers to receive from */
   26   sys_map_t s_ipc_to;           /* allowed destination processes */
   27   long s_call_mask;             /* allowed kernel calls */
   28 
   29   sys_map_t s_notify_pending;   /* bit map with pending notifications */
   30   irq_id_t s_int_pending;       /* pending hardware interrupts */
   31   sigset_t s_sig_pending;       /* pending signals */
   32 
   33   timer_t s_alarm_timer;        /* synchronous alarm timer */ 
   34   struct far_mem s_farmem[NR_REMOTE_SEGS];  /* remote memory map */
   35   reg_t *s_stack_guard;         /* stack guard word for kernel tasks */
   36 };
   37 
   38 /* Guard word for task stacks. */
   39 #define STACK_GUARD     ((reg_t) (sizeof(reg_t) == 2 ? 0xBEEF : 0xDEADBEEF))
   40 
   41 /* Bits for the system property flags. */
   42 #define PREEMPTIBLE     0x01    /* kernel tasks are not preemptible */
   43 #define BILLABLE        0x04    /* some processes are not billable */
   44 #define SYS_PROC        0x10    /* system processes are privileged */
   45 #define SENDREC_BUSY    0x20    /* sendrec() in progress */
   46 
   47 /* Magic system structure table addresses. */
   48 #define BEG_PRIV_ADDR (&priv[0])
   49 #define END_PRIV_ADDR (&priv[NR_SYS_PROCS])
   50 
   51 #define priv_addr(i)      (ppriv_addr)[(i)]
   52 #define priv_id(rp)       ((rp)->p_priv->s_id)
   53 #define priv(rp)          ((rp)->p_priv)
   54 
   55 #define id_to_nr(id)    priv_addr(id)->s_proc_nr
   56 #define nr_to_id(nr)    priv(proc_addr(nr))->s_id
   57 
   58 /* The system structures table and pointers to individual table slots. The 
   59  * pointers allow faster access because now a process entry can be found by 
   60  * indexing the psys_addr array, while accessing an element i requires a 
   61  * multiplication with sizeof(struct sys) to determine the address. 
   62  */
   63 EXTERN struct priv priv[NR_SYS_PROCS];          /* system properties table */
   64 EXTERN struct priv *ppriv_addr[NR_SYS_PROCS];   /* direct slot pointers */
   65 
   66 /* Unprivileged user processes all share the same privilege structure.
   67  * This id must be fixed because it is used to check send mask entries.
   68  */
   69 #define USER_PRIV_ID    0
   70 
   71 /* Make sure the system can boot. The following sanity check verifies that
   72  * the system privileges table is large enough for the number of processes
   73  * in the boot image. 
   74  */
   75 #if (NR_BOOT_PROCS > NR_SYS_PROCS)
   76 #error NR_SYS_PROCS must be larger than NR_BOOT_PROCS
   77 #endif
   78 
   79 #endif /* PRIV_H */

Cache object: 28438071a560c2bf65aeb187cc3ed22c


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