[BACK]Return to systm.h CVS log [TXT][DIR] Up to [local] / sys / sys

Annotation of sys/sys/systm.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: systm.h,v 1.72 2007/06/01 19:25:08 deraadt Exp $      */
        !             2: /*     $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $        */
        !             3:
        !             4: /*-
        !             5:  * Copyright (c) 1982, 1988, 1991, 1993
        !             6:  *     The Regents of the University of California.  All rights reserved.
        !             7:  * (c) UNIX System Laboratories, Inc.
        !             8:  * All or some portions of this file are derived from material licensed
        !             9:  * to the University of California by American Telephone and Telegraph
        !            10:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
        !            11:  * the permission of UNIX System Laboratories, Inc.
        !            12:  *
        !            13:  * Redistribution and use in source and binary forms, with or without
        !            14:  * modification, are permitted provided that the following conditions
        !            15:  * are met:
        !            16:  * 1. Redistributions of source code must retain the above copyright
        !            17:  *    notice, this list of conditions and the following disclaimer.
        !            18:  * 2. Redistributions in binary form must reproduce the above copyright
        !            19:  *    notice, this list of conditions and the following disclaimer in the
        !            20:  *    documentation and/or other materials provided with the distribution.
        !            21:  * 3. Neither the name of the University nor the names of its contributors
        !            22:  *    may be used to endorse or promote products derived from this software
        !            23:  *    without specific prior written permission.
        !            24:  *
        !            25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            35:  * SUCH DAMAGE.
        !            36:  *
        !            37:  *     @(#)systm.h     8.4 (Berkeley) 2/23/94
        !            38:  */
        !            39:
        !            40: #ifndef __SYSTM_H__
        !            41: #define __SYSTM_H__
        !            42:
        !            43: #include <sys/queue.h>
        !            44: #include <sys/stdarg.h>
        !            45:
        !            46: /*
        !            47:  * The `securelevel' variable controls the security level of the system.
        !            48:  * It can only be decreased by process 1 (/sbin/init).
        !            49:  *
        !            50:  * Security levels are as follows:
        !            51:  *   -1        permanently insecure mode - always run system in level 0 mode.
        !            52:  *    0        insecure mode - immutable and append-only flags may be turned off.
        !            53:  *     All devices may be read or written subject to permission modes.
        !            54:  *    1        secure mode - immutable and append-only flags may not be changed;
        !            55:  *     raw disks of mounted filesystems, /dev/mem, and /dev/kmem are
        !            56:  *     read-only.
        !            57:  *    2        highly secure mode - same as (1) plus raw disks are always
        !            58:  *     read-only whether mounted or not. This level precludes tampering
        !            59:  *     with filesystems by unmounting them, but also inhibits running
        !            60:  *     newfs while the system is secured.
        !            61:  *
        !            62:  * In normal operation, the system runs in level 0 mode while single user
        !            63:  * and in level 1 mode while multiuser. If level 2 mode is desired while
        !            64:  * running multiuser, it can be set in the multiuser startup script
        !            65:  * (/etc/rc.local) using sysctl(1). If it is desired to run the system
        !            66:  * in level 0 mode while multiuser, initialize the variable securelevel
        !            67:  * in /sys/kern/kern_sysctl.c to -1. Note that it is NOT initialized to
        !            68:  * zero as that would allow the vmunix binary to be patched to -1.
        !            69:  * Without initialization, securelevel loads in the BSS area which only
        !            70:  * comes into existence when the kernel is loaded and hence cannot be
        !            71:  * patched by a stalking hacker.
        !            72:  */
        !            73: extern int securelevel;                /* system security level */
        !            74: extern const char *panicstr;   /* panic message */
        !            75: extern const char version[];           /* system version */
        !            76: extern const char copyright[]; /* system copyright */
        !            77: extern const char ostype[];
        !            78: extern const char osversion[];
        !            79: extern const char osrelease[];
        !            80: extern int cold;               /* cold start flag initialized in locore */
        !            81:
        !            82: extern int ncpus;              /* number of CPUs */
        !            83: extern int nblkdev;            /* number of entries in bdevsw */
        !            84: extern int nchrdev;            /* number of entries in cdevsw */
        !            85:
        !            86: extern int selwait;            /* select timeout address */
        !            87:
        !            88: #ifdef MULTIPROCESSOR
        !            89: #define curpriority (curcpu()->ci_schedstate.spc_curpriority)
        !            90: #else
        !            91: extern u_char curpriority;     /* priority of current process */
        !            92: #endif
        !            93:
        !            94: extern int maxmem;             /* max memory per process */
        !            95: extern int physmem;            /* physical memory */
        !            96:
        !            97: extern dev_t dumpdev;          /* dump device */
        !            98: extern long dumplo;            /* offset into dumpdev */
        !            99:
        !           100: extern dev_t rootdev;          /* root device */
        !           101: extern struct vnode *rootvp;   /* vnode equivalent to above */
        !           102:
        !           103: extern dev_t swapdev;          /* swapping device */
        !           104: extern struct vnode *swapdev_vp;/* vnode equivalent to above */
        !           105:
        !           106: struct proc;
        !           107:
        !           108: typedef int    sy_call_t(struct proc *, void *, register_t *);
        !           109:
        !           110: extern struct sysent {         /* system call table */
        !           111:        short   sy_narg;        /* number of args */
        !           112:        short   sy_argsize;     /* total size of arguments */
        !           113:        sy_call_t *sy_call;     /* implementing function */
        !           114: } sysent[];
        !           115: #if    _BYTE_ORDER == _BIG_ENDIAN
        !           116: #define SCARG(p, k)    ((p)->k.be.datum)       /* get arg from args pointer */
        !           117: #elif  _BYTE_ORDER == _LITTLE_ENDIAN
        !           118: #define SCARG(p, k)    ((p)->k.le.datum)       /* get arg from args pointer */
        !           119: #else
        !           120: #error "what byte order is this machine?"
        !           121: #endif
        !           122:
        !           123: #if defined(_KERNEL) && defined(SYSCALL_DEBUG)
        !           124: void scdebug_call(struct proc *p, register_t code, register_t retval[]);
        !           125: void scdebug_ret(struct proc *p, register_t code, int error, register_t retval[]);
        !           126: #endif /* _KERNEL && SYSCALL_DEBUG */
        !           127:
        !           128: extern int boothowto;          /* reboot flags, from console subsystem */
        !           129:
        !           130: extern void (*v_putc)(int); /* Virtual console putc routine */
        !           131:
        !           132: /*
        !           133:  * General function declarations.
        !           134:  */
        !           135: int    nullop(void *);
        !           136: int    enodev(void);
        !           137: int    enosys(void);
        !           138: int    enoioctl(void);
        !           139: int    enxio(void);
        !           140: int    eopnotsupp(void *);
        !           141:
        !           142: int    lkmenodev(void);
        !           143:
        !           144: struct vnodeopv_desc;
        !           145: void vfs_opv_init(void);
        !           146: void vfs_opv_init_explicit(struct vnodeopv_desc *);
        !           147: void vfs_opv_init_default(struct vnodeopv_desc *);
        !           148: void vfs_op_init(void);
        !           149:
        !           150: int    seltrue(dev_t dev, int which, struct proc *);
        !           151: void   *hashinit(int, int, int, u_long *);
        !           152: int    sys_nosys(struct proc *, void *, register_t *);
        !           153:
        !           154: void   panic(const char *, ...)
        !           155:     __attribute__((__noreturn__,__format__(__kprintf__,1,2)));
        !           156: void   __assert(const char *, const char *, int, const char *)
        !           157:     __attribute__((__noreturn__));
        !           158: int    printf(const char *, ...)
        !           159:     __attribute__((__format__(__kprintf__,1,2)));
        !           160: void   uprintf(const char *, ...)
        !           161:     __attribute__((__format__(__kprintf__,1,2)));
        !           162: int    vprintf(const char *, va_list);
        !           163: int    vsnprintf(char *, size_t, const char *, va_list);
        !           164: int    snprintf(char *buf, size_t, const char *, ...)
        !           165:     __attribute__((__format__(__kprintf__,3,4)));
        !           166: struct tty;
        !           167: void   ttyprintf(struct tty *, const char *, ...)
        !           168:     __attribute__((__format__(__kprintf__,2,3)));
        !           169:
        !           170: void   splassert_fail(int, int, const char *);
        !           171: extern int splassert_ctl;
        !           172:
        !           173: void   tablefull(const char *);
        !           174:
        !           175: int    kcopy(const void *, void *, size_t)
        !           176:                __attribute__ ((__bounded__(__buffer__,1,3)))
        !           177:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           178:
        !           179: void   bcopy(const void *, void *, size_t)
        !           180:                __attribute__ ((__bounded__(__buffer__,1,3)))
        !           181:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           182: void   ovbcopy(const void *, void *, size_t)
        !           183:                __attribute__ ((__bounded__(__buffer__,1,3)))
        !           184:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           185: void   bzero(void *, size_t)
        !           186:                __attribute__ ((__bounded__(__buffer__,1,2)));
        !           187: int    bcmp(const void *, const void *, size_t);
        !           188: void   *memcpy(void *, const void *, size_t)
        !           189:                __attribute__ ((__bounded__(__buffer__,1,3)))
        !           190:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           191: void   *memmove(void *, const void *, size_t)
        !           192:                __attribute__ ((__bounded__(__buffer__,1,3)))
        !           193:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           194: void   *memset(void *, int, size_t)
        !           195:                __attribute__ ((__bounded__(__buffer__,1,3)));
        !           196:
        !           197: int    copystr(const void *, void *, size_t, size_t *)
        !           198:                __attribute__ ((__bounded__(__string__,2,3)));
        !           199: int    copyinstr(const void *, void *, size_t, size_t *)
        !           200:                __attribute__ ((__bounded__(__string__,2,3)));
        !           201: int    copyoutstr(const void *, void *, size_t, size_t *);
        !           202: int    copyin(const void *, void *, size_t)
        !           203:                __attribute__ ((__bounded__(__buffer__,2,3)));
        !           204: int    copyout(const void *, void *, size_t);
        !           205:
        !           206: struct timeval;
        !           207: int    hzto(struct timeval *);
        !           208: int    tvtohz(struct timeval *);
        !           209: void   realitexpire(void *);
        !           210:
        !           211: struct clockframe;
        !           212: void   hardclock(struct clockframe *);
        !           213: void   softclock(void);
        !           214: void   statclock(struct clockframe *);
        !           215:
        !           216: void   initclocks(void);
        !           217: void   inittodr(time_t);
        !           218: void   resettodr(void);
        !           219: void   cpu_initclocks(void);
        !           220:
        !           221: void   startprofclock(struct proc *);
        !           222: void   stopprofclock(struct proc *);
        !           223: void   setstatclockrate(int);
        !           224:
        !           225: void   wdog_register(void *, int (*)(void *, int));
        !           226:
        !           227: /*
        !           228:  * Startup/shutdown hooks.  Startup hooks are functions running after
        !           229:  * the scheduler has started but before any threads have been created
        !           230:  * or root has been mounted. The shutdown hooks are functions to be run
        !           231:  * with all interrupts disabled immediately before the system is
        !           232:  * halted or rebooted.
        !           233:  */
        !           234:
        !           235: struct hook_desc {
        !           236:        TAILQ_ENTRY(hook_desc) hd_list;
        !           237:        void    (*hd_fn)(void *);
        !           238:        void    *hd_arg;
        !           239: };
        !           240: TAILQ_HEAD(hook_desc_head, hook_desc);
        !           241:
        !           242: extern struct hook_desc_head shutdownhook_list, startuphook_list,
        !           243:     mountroothook_list;
        !           244:
        !           245: void   *hook_establish(struct hook_desc_head *, int, void (*)(void *), void *);
        !           246: void   hook_disestablish(struct hook_desc_head *, void *);
        !           247: void   dohooks(struct hook_desc_head *, int);
        !           248:
        !           249: #define HOOK_REMOVE    0x01
        !           250: #define HOOK_FREE      0x02
        !           251:
        !           252: #define startuphook_establish(fn, arg) \
        !           253:        hook_establish(&startuphook_list, 1, (fn), (arg))
        !           254: #define startuphook_disestablish(vhook) \
        !           255:        hook_disestablish(&startuphook_list, (vhook))
        !           256: #define dostartuphooks() dohooks(&startuphook_list, HOOK_REMOVE|HOOK_FREE)
        !           257:
        !           258: #define shutdownhook_establish(fn, arg) \
        !           259:        hook_establish(&shutdownhook_list, 0, (fn), (arg))
        !           260: #define shutdownhook_disestablish(vhook) \
        !           261:        hook_disestablish(&shutdownhook_list, (vhook))
        !           262: #define doshutdownhooks() dohooks(&shutdownhook_list, HOOK_REMOVE)
        !           263:
        !           264: #define mountroothook_establish(fn, arg) \
        !           265:        hook_establish(&mountroothook_list, 0, (fn), (arg))
        !           266: #define mountroothook_disestablish(vhook) \
        !           267:        hook_disestablish(&mountroothook_list, (vhook))
        !           268: #define domountroothooks() dohooks(&mountroothook_list, HOOK_REMOVE|HOOK_FREE)
        !           269:
        !           270: /*
        !           271:  * Power management hooks.
        !           272:  */
        !           273: void   *powerhook_establish(void (*)(int, void *), void *);
        !           274: void   powerhook_disestablish(void *);
        !           275: void   dopowerhooks(int);
        !           276: #define PWR_RESUME 0
        !           277: #define PWR_SUSPEND 1
        !           278: #define PWR_STANDBY 2
        !           279:
        !           280: struct uio;
        !           281: int    uiomove(void *, int, struct uio *);
        !           282:
        !           283: #if defined(_KERNEL)
        !           284: int    setjmp(label_t *);
        !           285: void   longjmp(label_t *);
        !           286: #endif
        !           287:
        !           288: void   consinit(void);
        !           289:
        !           290: void   cpu_startup(void);
        !           291: void   cpu_configure(void);
        !           292: void   diskconf(void);
        !           293:
        !           294: #ifdef GPROF
        !           295: void   kmstartup(void);
        !           296: #endif
        !           297:
        !           298: int nfs_mountroot(void);
        !           299: int dk_mountroot(void);
        !           300: extern int (*mountroot)(void);
        !           301:
        !           302: #include <lib/libkern/libkern.h>
        !           303:
        !           304: #if defined(DDB) || defined(KGDB)
        !           305: /* debugger entry points */
        !           306: void   Debugger(void); /* in DDB only */
        !           307: int    read_symtab_from_file(struct proc *,struct vnode *,const char *);
        !           308: #endif
        !           309:
        !           310: #ifdef BOOT_CONFIG
        !           311: void   user_config(void);
        !           312: #endif
        !           313:
        !           314: #if defined(MULTIPROCESSOR)
        !           315: void   _kernel_lock_init(void);
        !           316: void   _kernel_lock(void);
        !           317: void   _kernel_unlock(void);
        !           318: void   _kernel_proc_lock(struct proc *);
        !           319: void   _kernel_proc_unlock(struct proc *);
        !           320:
        !           321: #define        KERNEL_LOCK_INIT()              _kernel_lock_init()
        !           322: #define        KERNEL_LOCK()                   _kernel_lock()
        !           323: #define        KERNEL_UNLOCK()                 _kernel_unlock()
        !           324: #define        KERNEL_PROC_LOCK(p)             _kernel_proc_lock((p))
        !           325: #define        KERNEL_PROC_UNLOCK(p)           _kernel_proc_unlock((p))
        !           326:
        !           327: #else /* ! MULTIPROCESSOR */
        !           328:
        !           329: #define        KERNEL_LOCK_INIT()              /* nothing */
        !           330: #define        KERNEL_LOCK()                   /* nothing */
        !           331: #define        KERNEL_UNLOCK()                 /* nothing */
        !           332: #define        KERNEL_PROC_LOCK(p)             /* nothing */
        !           333: #define        KERNEL_PROC_UNLOCK(p)           /* nothing */
        !           334:
        !           335: #endif /* MULTIPROCESSOR */
        !           336:
        !           337: #endif /* __SYSTM_H__ */

CVSweb