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.2/sys/sys/systm.h 120610 2003-09-30 20:54:12Z mux $
   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/cdefs.h>
   49 #include <sys/queue.h>
   50 #include <sys/stdint.h>         /* for people using printf mainly */
   51 
   52 extern int securelevel;         /* system security level (see init(8)) */
   53 extern int suser_enabled;       /* suser() is permitted to return 0 */
   54 
   55 extern int cold;                /* nonzero if we are doing a cold boot */
   56 extern const char *panicstr;    /* panic message */
   57 extern char version[];          /* system version */
   58 extern char copyright[];        /* system copyright */
   59 extern int kstack_pages;        /* number of kernel stack pages */
   60 extern int uarea_pages;         /* number of user struct pages */
   61 
   62 extern int nswap;               /* size of swap space */
   63 
   64 extern u_int nselcoll;          /* select collisions since boot */
   65 extern struct mtx sellock;      /* select lock variable */
   66 extern struct cv selwait;       /* select conditional variable */
   67 
   68 extern long physmem;            /* physical memory */
   69 
   70 extern dev_t rootdev;           /* root device */
   71 extern dev_t rootdevs[2];       /* possible root devices */
   72 extern char *rootdevnames[2];   /* names of possible root devices */
   73 extern struct vnode *rootvp;    /* vnode equivalent to above */
   74 
   75 extern int boothowto;           /* reboot flags, from console subsystem */
   76 extern int bootverbose;         /* nonzero to print verbose messages */
   77 
   78 extern int maxusers;            /* system tune hint */
   79 
   80 #ifdef  INVARIANTS              /* The option is always available */
   81 #define KASSERT(exp,msg) do {                                           \
   82         if (__predict_false(!(exp)))                                    \
   83                 panic msg;                                              \
   84 } while (0)
   85 #else
   86 #define KASSERT(exp,msg)
   87 #endif
   88 
   89 #ifndef CTASSERT                /* Allow lint to override */
   90 #define CTASSERT(x)             _CTASSERT(x, __LINE__)
   91 #define _CTASSERT(x, y)         __CTASSERT(x, y)
   92 #define __CTASSERT(x, y)        typedef char __assert ## y[(x) ? 1 : -1]
   93 #endif
   94 
   95 /*
   96  * XXX the hints declarations are even more misplaced than most declarations
   97  * in this file, since they are needed in one file (per arch) and only used
   98  * in two files.
   99  * XXX most of these variables should be const.
  100  */
  101 extern int envmode;
  102 extern int hintmode;            /* 0 = off. 1 = config, 2 = fallback */
  103 extern int dynamic_kenv;
  104 extern struct sx kenv_lock;
  105 extern char *kern_envp;
  106 extern char static_env[];
  107 extern char static_hints[];     /* by config for now */
  108 
  109 extern char **kenvp;
  110 
  111 /*
  112  * General function declarations.
  113  */
  114 
  115 struct clockframe;
  116 struct malloc_type;
  117 struct mtx;
  118 struct proc;
  119 struct kse;
  120 struct socket;
  121 struct thread;
  122 struct tty;
  123 struct ucred;
  124 struct uio;
  125 struct _jmp_buf;
  126 
  127 int     setjmp(struct _jmp_buf *);
  128 void    longjmp(struct _jmp_buf *, int) __dead2;
  129 void    Debugger(const char *msg) __nonnull(1);
  130 int     dumpstatus(vm_offset_t addr, off_t count);
  131 int     nullop(void);
  132 int     eopnotsupp(void);
  133 int     ureadc(int, struct uio *);
  134 void    hashdestroy(void *, struct malloc_type *, u_long);
  135 void    *hashinit(int count, struct malloc_type *type, u_long *hashmask);
  136 void    *phashinit(int count, struct malloc_type *type, u_long *nentries);
  137 
  138 #ifdef RESTARTABLE_PANICS
  139 void    panic(const char *, ...) __printflike(1, 2);
  140 #else
  141 void    panic(const char *, ...) __dead2 __printflike(1, 2);
  142 #endif
  143 
  144 void    backtrace(void);
  145 void    cpu_boot(int);
  146 void    cpu_rootconf(void);
  147 extern uint32_t crc32_tab[];
  148 uint32_t crc32(const void *buf, size_t size);
  149 void    critical_enter(void);
  150 void    critical_exit(void);
  151 void    init_param1(void);
  152 void    init_param2(long physpages);
  153 void    init_param3(long kmempages);
  154 void    tablefull(const char *);
  155 int     kvprintf(char const *, void (*)(int, void*), void *, int,
  156             __va_list) __printflike(1, 0);
  157 void    log(int, const char *, ...) __printflike(2, 3);
  158 void    log_console(struct uio *);
  159 int     printf(const char *, ...) __printflike(1, 2);
  160 int     snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
  161 int     sprintf(char *buf, const char *, ...) __printflike(2, 3);
  162 int     uprintf(const char *, ...) __printflike(1, 2);
  163 int     vprintf(const char *, __va_list) __printflike(1, 0);
  164 int     vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
  165 int     vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); 
  166 int     vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
  167 int     ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
  168 int     sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
  169 int     vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2);
  170 long    strtol(const char *, char **, int) __nonnull(1);
  171 u_long  strtoul(const char *, char **, int) __nonnull(1);
  172 quad_t  strtoq(const char *, char **, int) __nonnull(1);
  173 u_quad_t strtouq(const char *, char **, int) __nonnull(1);
  174 void    tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);
  175 
  176 #define ovbcopy(f, t, l) bcopy((f), (t), (l))
  177 void    bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2);
  178 void    bzero(void *buf, size_t len) __nonnull(1);
  179 
  180 void    *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);
  181 
  182 int     copystr(const void *kfaddr, void *kdaddr, size_t len,
  183             size_t *lencopied) __nonnull(1) __nonnull(2);
  184 int     copyinstr(const void *udaddr, void *kaddr, size_t len,
  185             size_t *lencopied) __nonnull(1) __nonnull(2);
  186 int     copyin(const void *udaddr, void *kaddr, size_t len) __nonnull(1) __nonnull(2);
  187 int     copyout(const void *kaddr, void *udaddr, size_t len) __nonnull(1) __nonnull(2);
  188 
  189 int     fubyte(const void *base);
  190 long    fuword(const void *base);
  191 int     fuword16(void *base);
  192 int32_t fuword32(const void *base);
  193 int64_t fuword64(const void *base);
  194 int     subyte(void *base, int byte);
  195 int     suword(void *base, long word);
  196 int     suword16(void *base, int word);
  197 int     suword32(void *base, int32_t word);
  198 int     suword64(void *base, int64_t word);
  199 intptr_t casuptr(intptr_t *p, intptr_t old, intptr_t new);
  200 
  201 void    realitexpire(void *);
  202 
  203 void    hardclock(struct clockframe *frame);
  204 void    hardclock_process(struct clockframe *frame);
  205 void    softclock(void *);
  206 void    statclock(struct clockframe *frame);
  207 void    profclock(struct clockframe *frame);
  208 
  209 void    startprofclock(struct proc *);
  210 void    stopprofclock(struct proc *);
  211 void    cpu_startprofclock(void);
  212 void    cpu_stopprofclock(void);
  213 
  214 /* flags for suser() and suser_cred() */
  215 #define PRISON_ROOT     1
  216 
  217 int     suser(struct thread *td);
  218 int     suser_cred(struct ucred *cred, int flag);
  219 int     cr_cansee(struct ucred *u1, struct ucred *u2);
  220 int     cr_canseesocket(struct ucred *cred, struct socket *so);
  221 
  222 char    *getenv(const char *name);
  223 void    freeenv(char *env);
  224 int     getenv_int(const char *name, int *data);
  225 int     getenv_string(const char *name, char *data, int size);
  226 int     getenv_quad(const char *name, quad_t *data);
  227 int     setenv(const char *name, const char *value);
  228 int     unsetenv(const char *name);
  229 int     testenv(const char *name);
  230 
  231 #ifdef APM_FIXUP_CALLTODO 
  232 struct timeval;
  233 void    adjust_timeout_calltodo(struct timeval *time_change); 
  234 #endif /* APM_FIXUP_CALLTODO */ 
  235 
  236 #include <sys/libkern.h>
  237 
  238 /* Initialize the world */
  239 void    consinit(void);
  240 void    cpu_initclocks(void);
  241 void    usrinfoinit(void);
  242 
  243 /* Finalize the world. */
  244 void    shutdown_nice(int);
  245 
  246 /*
  247  * Kernel to clock driver interface.
  248  */
  249 void    inittodr(time_t base);
  250 void    resettodr(void);
  251 void    startrtclock(void);
  252 
  253 /* Timeouts */
  254 typedef void timeout_t(void *); /* timeout function type */
  255 #define CALLOUT_HANDLE_INITIALIZER(handle)      \
  256         { NULL }
  257 
  258 void    callout_handle_init(struct callout_handle *);
  259 struct  callout_handle timeout(timeout_t *, void *, int);
  260 void    untimeout(timeout_t *, void *, struct callout_handle);
  261 caddr_t kern_timeout_callwheel_alloc(caddr_t v);
  262 void    kern_timeout_callwheel_init(void);
  263 
  264 /* Stubs for obsolete functions that used to be for interrupt  management */
  265 static __inline void            spl0(void)              { return; }
  266 static __inline intrmask_t      splbio(void)            { return 0; }
  267 static __inline intrmask_t      splcam(void)            { return 0; }
  268 static __inline intrmask_t      splclock(void)          { return 0; }
  269 static __inline intrmask_t      splhigh(void)           { return 0; }
  270 static __inline intrmask_t      splimp(void)            { return 0; }
  271 static __inline intrmask_t      splnet(void)            { return 0; }
  272 static __inline intrmask_t      splsoftcam(void)        { return 0; }
  273 static __inline intrmask_t      splsoftclock(void)      { return 0; }
  274 static __inline intrmask_t      splsofttty(void)        { return 0; }
  275 static __inline intrmask_t      splsoftvm(void)         { return 0; }
  276 static __inline intrmask_t      splsofttq(void)         { return 0; }
  277 static __inline intrmask_t      splstatclock(void)      { return 0; }
  278 static __inline intrmask_t      spltty(void)            { return 0; }
  279 static __inline intrmask_t      splvm(void)             { return 0; }
  280 static __inline void            splx(intrmask_t ipl __unused)   { return; }
  281 
  282 /*
  283  * Various callout lists.
  284  */
  285 
  286 /*
  287  * Not exactly a callout LIST, but a callout entry.
  288  * Allow an external module to define a hardware watchdog tickler.
  289  * Normally a process would do this, but there are times when the
  290  * kernel needs to be able to hold off the watchdog, when the process
  291  * is not active, e.g., when dumping core.
  292  */
  293 typedef void (*watchdog_tickle_fn)(void);
  294 
  295 extern watchdog_tickle_fn       wdog_tickler;
  296 
  297 /* 
  298  * Common `proc' functions are declared here so that proc.h can be included
  299  * less often.
  300  */
  301 int     msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg,
  302             int timo);
  303 void    abortsleep(struct thread *td);
  304 #define tsleep(chan, pri, wmesg, timo)  msleep(chan, NULL, pri, wmesg, timo)
  305 void    wakeup(void *chan) __nonnull(1);
  306 void    wakeup_one(void *chan) __nonnull(1);
  307 
  308 /*
  309  * Common `dev_t' stuff are declared here to avoid #include poisoning
  310  */
  311 
  312 int major(dev_t x);
  313 int minor(dev_t x);
  314 dev_t makedev(int x, int y);
  315 udev_t dev2udev(dev_t x);
  316 dev_t udev2dev(udev_t x, int b);
  317 int uminor(udev_t dev);
  318 int umajor(udev_t dev);
  319 udev_t makeudev(int x, int y);
  320 
  321 /* XXX: Should be void nanodelay(u_int nsec); */
  322 void    DELAY(int usec);
  323 
  324 #endif /* !_SYS_SYSTM_H_ */

Cache object: 6134eed2180ac1b9f24756b947a2198e


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