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/sys/systm.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) 1982, 1988, 1991, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  * (c) UNIX System Laboratories, Inc.
    5  * All or some portions of this file are derived from material licensed
    6  * to the University of California by American Telephone and Telegraph
    7  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
    8  * the permission of UNIX System Laboratories, Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the University of
   21  *      California, Berkeley and its contributors.
   22  * 4. Neither the name of the University nor the names of its contributors
   23  *    may be used to endorse or promote products derived from this software
   24  *    without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36  * SUCH DAMAGE.
   37  *
   38  *      @(#)systm.h     8.7 (Berkeley) 3/29/95
   39  * $FreeBSD: releng/5.0/sys/sys/systm.h 103083 2002-09-07 22:11:45Z peter $
   40  */
   41 
   42 #ifndef _SYS_SYSTM_H_
   43 #define _SYS_SYSTM_H_
   44 
   45 #include <machine/atomic.h>
   46 #include <machine/cpufunc.h>
   47 #include <sys/callout.h>
   48 #include <sys/queue.h>
   49 
   50 extern int securelevel;         /* system security level (see init(8)) */
   51 extern int suser_enabled;       /* suser() is permitted to return 0 */
   52 
   53 extern int cold;                /* nonzero if we are doing a cold boot */
   54 extern const char *panicstr;    /* panic message */
   55 extern char version[];          /* system version */
   56 extern char copyright[];        /* system copyright */
   57 extern int kstack_pages;        /* number of kernel stack pages */
   58 extern int uarea_pages;         /* number of user struct pages */
   59 
   60 extern int nswap;               /* size of swap space */
   61 
   62 extern u_int nselcoll;          /* select collisions since boot */
   63 extern struct mtx sellock;      /* select lock variable */
   64 extern struct cv selwait;       /* select conditional variable */
   65 
   66 extern long physmem;            /* physical memory */
   67 
   68 extern dev_t rootdev;           /* root device */
   69 extern dev_t rootdevs[2];       /* possible root devices */
   70 extern char *rootdevnames[2];   /* names of possible root devices */
   71 extern struct vnode *rootvp;    /* vnode equivalent to above */
   72 
   73 extern int boothowto;           /* reboot flags, from console subsystem */
   74 extern int bootverbose;         /* nonzero to print verbose messages */
   75 
   76 extern int maxusers;            /* system tune hint */
   77 
   78 #ifdef  INVARIANTS              /* The option is always available */
   79 #define KASSERT(exp,msg)        do { if (!(exp)) panic msg; } while (0)
   80 #else
   81 #define KASSERT(exp,msg)
   82 #endif
   83 
   84 #define CTASSERT(x)             _CTASSERT(x, __LINE__)
   85 #define _CTASSERT(x, y)         __CTASSERT(x, y)
   86 #define __CTASSERT(x, y)        typedef char __assert ## y[(x) ? 1 : -1]
   87 
   88 /*
   89  * XXX the hints declarations are even more misplaced than most declarations
   90  * in this file, since they are needed in one file (per arch) and only used
   91  * in two files.
   92  * XXX most of these variables should be const.
   93  */
   94 extern int envmode;
   95 extern int hintmode;            /* 0 = off. 1 = config, 2 = fallback */
   96 extern int dynamic_kenv;
   97 extern struct sx kenv_lock;
   98 extern char *kern_envp;
   99 extern char static_env[];
  100 extern char static_hints[];     /* by config for now */
  101 
  102 extern char **kenvp;
  103 
  104 /*
  105  * General function declarations.
  106  */
  107 
  108 struct clockframe;
  109 struct malloc_type;
  110 struct mtx;
  111 struct proc;
  112 struct kse;
  113 struct socket;
  114 struct thread;
  115 struct tty;
  116 struct ucred;
  117 struct uio;
  118 struct _jmp_buf;
  119 
  120 int     setjmp(struct _jmp_buf *);
  121 void    longjmp(struct _jmp_buf *, int) __dead2;
  122 void    Debugger(const char *msg);
  123 int     dumpstatus(vm_offset_t addr, off_t count);
  124 int     nullop(void);
  125 int     eopnotsupp(void);
  126 int     seltrue(dev_t dev, int which, struct thread *td);
  127 int     ureadc(int, struct uio *);
  128 void    hashdestroy(void *, struct malloc_type *, u_long);
  129 void    *hashinit(int count, struct malloc_type *type, u_long *hashmask);
  130 void    *phashinit(int count, struct malloc_type *type, u_long *nentries);
  131 
  132 #ifdef RESTARTABLE_PANICS
  133 void    panic(const char *, ...) __printflike(1, 2);
  134 #else
  135 void    panic(const char *, ...) __dead2 __printflike(1, 2);
  136 #endif
  137 
  138 void    cpu_boot(int);
  139 void    cpu_rootconf(void);
  140 extern uint32_t crc32_tab[];
  141 uint32_t crc32(const void *buf, size_t size);
  142 void    critical_enter(void);
  143 void    critical_exit(void);
  144 void    init_param1(void);
  145 void    init_param2(long physpages);
  146 void    tablefull(const char *);
  147 int     kvprintf(char const *, void (*)(int, void*), void *, int,
  148             __va_list) __printflike(1, 0);
  149 void    log(int, const char *, ...) __printflike(2, 3);
  150 void    log_console(struct uio *);
  151 int     printf(const char *, ...) __printflike(1, 2);
  152 int     snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
  153 int     sprintf(char *buf, const char *, ...) __printflike(2, 3);
  154 int     uprintf(const char *, ...) __printflike(1, 2);
  155 int     vprintf(const char *, __va_list) __printflike(1, 0);
  156 int     vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
  157 int     vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
  158 int     ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
  159 int     sscanf(const char *, char const *, ...);
  160 int     vsscanf(const char *, char const *, __va_list);
  161 long    strtol(const char *, char **, int);
  162 u_long  strtoul(const char *, char **, int);
  163 quad_t  strtoq(const char *, char **, int);
  164 u_quad_t strtouq(const char *, char **, int);
  165 void    tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);
  166 
  167 void    bcopy(const void *from, void *to, size_t len);
  168 void    ovbcopy(const void *from, void *to, size_t len);
  169 
  170 #ifdef __i386__
  171 extern void     (*bzero)(void *buf, size_t len);
  172 #else
  173 void    bzero(void *buf, size_t len);
  174 #endif
  175 
  176 void    *memcpy(void *to, const void *from, size_t len);
  177 
  178 int     copystr(const void *kfaddr, void *kdaddr, size_t len,
  179             size_t *lencopied);
  180 int     copyinstr(const void *udaddr, void *kaddr, size_t len,
  181             size_t *lencopied);
  182 int     copyin(const void *udaddr, void *kaddr, size_t len);
  183 int     copyout(const void *kaddr, void *udaddr, size_t len);
  184 
  185 int     fubyte(const void *base);
  186 long    fuword(const void *base);
  187 int     fuword16(void *base);
  188 int32_t fuword32(const void *base);
  189 int64_t fuword64(const void *base);
  190 int     subyte(void *base, int byte);
  191 int     suword(void *base, long word);
  192 int     suword16(void *base, int word);
  193 int     suword32(void *base, int32_t word);
  194 int     suword64(void *base, int64_t word);
  195 
  196 void    realitexpire(void *);
  197 
  198 void    hardclock(struct clockframe *frame);
  199 void    hardclock_process(struct thread *td, int user);
  200 void    softclock(void *);
  201 void    statclock(struct clockframe *frame);
  202 void    statclock_process(struct kse *ke, register_t pc, int user);
  203 
  204 void    startprofclock(struct proc *);
  205 void    stopprofclock(struct proc *);
  206 void    setstatclockrate(int hzrate);
  207 
  208 /* flags for suser() and suser_cred() */
  209 #define PRISON_ROOT     1
  210 
  211 int     suser(struct thread *td);
  212 int     suser_cred(struct ucred *cred, int flag);
  213 int     cr_cansee(struct ucred *u1, struct ucred *u2);
  214 int     cr_canseesocket(struct ucred *cred, struct socket *so);
  215 
  216 char    *getenv(const char *name);
  217 void    freeenv(char *env);
  218 int     getenv_int(const char *name, int *data);
  219 int     getenv_string(const char *name, char *data, int size);
  220 int     getenv_quad(const char *name, quad_t *data);
  221 int     setenv(const char *name, const char *value);
  222 int     unsetenv(const char *name);
  223 int     testenv(const char *name);
  224 
  225 #ifdef APM_FIXUP_CALLTODO 
  226 struct timeval;
  227 void    adjust_timeout_calltodo(struct timeval *time_change); 
  228 #endif /* APM_FIXUP_CALLTODO */ 
  229 
  230 #include <sys/libkern.h>
  231 
  232 /* Initialize the world */
  233 void    consinit(void);
  234 void    cpu_initclocks(void);
  235 void    usrinfoinit(void);
  236 
  237 /* Finalize the world. */
  238 void    shutdown_nice(int);
  239 
  240 /*
  241  * Kernel to clock driver interface.
  242  */
  243 void    inittodr(time_t base);
  244 void    resettodr(void);
  245 void    startrtclock(void);
  246 
  247 /* Timeouts */
  248 typedef void timeout_t(void *); /* timeout function type */
  249 #define CALLOUT_HANDLE_INITIALIZER(handle)      \
  250         { NULL }
  251 
  252 void    callout_handle_init(struct callout_handle *);
  253 struct  callout_handle timeout(timeout_t *, void *, int);
  254 void    untimeout(timeout_t *, void *, struct callout_handle);
  255 caddr_t kern_timeout_callwheel_alloc(caddr_t v);
  256 void    kern_timeout_callwheel_init(void);
  257 
  258 /* Stubs for obsolete functions that used to be for interrupt  management */
  259 static __inline void            spl0(void)              { return; }
  260 static __inline intrmask_t      splbio(void)            { return 0; }
  261 static __inline intrmask_t      splcam(void)            { return 0; }
  262 static __inline intrmask_t      splclock(void)          { return 0; }
  263 static __inline intrmask_t      splhigh(void)           { return 0; }
  264 static __inline intrmask_t      splimp(void)            { return 0; }
  265 static __inline intrmask_t      splnet(void)            { return 0; }
  266 static __inline intrmask_t      splsoftcam(void)        { return 0; }
  267 static __inline intrmask_t      splsoftclock(void)      { return 0; }
  268 static __inline intrmask_t      splsofttty(void)        { return 0; }
  269 static __inline intrmask_t      splsoftvm(void)         { return 0; }
  270 static __inline intrmask_t      splsofttq(void)         { return 0; }
  271 static __inline intrmask_t      splstatclock(void)      { return 0; }
  272 static __inline intrmask_t      spltty(void)            { return 0; }
  273 static __inline intrmask_t      splvm(void)             { return 0; }
  274 static __inline void            splx(intrmask_t ipl __unused)   { return; }
  275 
  276 /*
  277  * Various callout lists.
  278  */
  279 
  280 /* Exit callout list declarations. */
  281 typedef void (*exitlist_fn)(struct proc *procp);
  282 
  283 int     at_exit(exitlist_fn function);
  284 int     rm_at_exit(exitlist_fn function);
  285 
  286 /* Fork callout list declarations. */
  287 typedef void (*forklist_fn)(struct proc *parent, struct proc *child, int flags);
  288 
  289 int     at_fork(forklist_fn function);
  290 int     rm_at_fork(forklist_fn function);
  291 
  292 /* Exec callout list declarations. */
  293 typedef void (*execlist_fn)(struct proc *procp);
  294 
  295 int     at_exec(execlist_fn function);
  296 int     rm_at_exec(execlist_fn function);
  297 
  298 /*
  299  * Not exactly a callout LIST, but a callout entry.
  300  * Allow an external module to define a hardware watchdog tickler.
  301  * Normally a process would do this, but there are times when the
  302  * kernel needs to be able to hold off the watchdog, when the process
  303  * is not active, e.g., when dumping core.
  304  */
  305 typedef void (*watchdog_tickle_fn)(void);
  306 
  307 extern watchdog_tickle_fn       wdog_tickler;
  308 
  309 /* 
  310  * Common `proc' functions are declared here so that proc.h can be included
  311  * less often.
  312  */
  313 int     msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg,
  314             int timo);
  315 void    abortsleep(struct thread *td);
  316 #define tsleep(chan, pri, wmesg, timo)  msleep(chan, NULL, pri, wmesg, timo)
  317 void    wakeup(void *chan);
  318 void    wakeup_one(void *chan);
  319 
  320 /*
  321  * Common `dev_t' stuff are declared here to avoid #include poisoning
  322  */
  323 
  324 int major(dev_t x);
  325 int minor(dev_t x);
  326 dev_t makedev(int x, int y);
  327 udev_t dev2udev(dev_t x);
  328 dev_t udev2dev(udev_t x, int b);
  329 int uminor(udev_t dev);
  330 int umajor(udev_t dev);
  331 udev_t makeudev(int x, int y);
  332 
  333 /* XXX: Should be void nanodelay(u_int nsec); */
  334 void    DELAY(int usec);
  335 
  336 #endif /* !_SYS_SYSTM_H_ */

Cache object: 66dd75aa4bfbbec1d0367b1ffa5c2f78


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