home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / usr / include / sys / systm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-08  |  8.7 KB  |  268 lines  |  [TEXT/R*ch]

  1. /*-
  2.  * Copyright (c) 1982, 1988, 1991 The Regents of the University of California.
  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.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    from: @(#)systm.h    7.17 (Berkeley) 5/25/91
  34.  *    $Id: systm.h,v 1.15 1993/10/06 23:38:19 cgd Exp $
  35.  */
  36.  
  37. #ifndef _SYS_SYSTM_H_
  38. #define _SYS_SYSTM_H_
  39.  
  40. #include "param.h"
  41. #include "types.h"
  42.  
  43. struct sysent {        /* system call table */
  44.     int    sy_narg;    /* number of arguments */
  45.     int    (*sy_call)();    /* implementing function */
  46. };
  47.  
  48. #ifdef KERNEL
  49.  
  50. extern struct sysent sysent[];
  51.  
  52. /* Declare some stuff */
  53. struct proc; struct vnode; 
  54.  
  55. extern const char *panicstr;    /* panic message */
  56. extern char version[];        /* system version */
  57. extern char copyright[];    /* system copyright */
  58.  
  59. extern int nblkdev;        /* number of entries in bdevsw */
  60. extern int nchrdev;        /* number of entries in cdevsw */
  61. extern int nswdev;        /* number of swap devices */
  62. extern int nswap;        /* size of swap space */
  63.  
  64. extern int selwait;        /* select timeout address */
  65.  
  66. extern u_char curpri;        /* priority of current process */
  67.  
  68. extern int maxmem;        /* max memory per process */
  69. extern int physmem;        /* physical memory */
  70.  
  71. extern dev_t dumpdev;        /* dump device */
  72. extern long dumplo;        /* offset into dumpdev */
  73.  
  74. extern dev_t rootdev;        /* root device */
  75. extern struct vnode *rootvp;    /* vnode equivalent to above */
  76.  
  77. extern dev_t swapdev;        /* swapping device */
  78. extern struct vnode *swapdev_vp;/* vnode equivalent to above */
  79.  
  80. extern int boothowto;        /* reboot flags, from console subsystem */
  81. #ifdef    KADB
  82. extern char *bootesym;        /* end of symbol info from boot */
  83. #endif
  84.  
  85. /* insque and remque */
  86. #if defined(__GNUC__) && defined(notyet)
  87. extern __inline__ void
  88. _insque(a, b)
  89.      void *a;
  90.      void *b;
  91. {
  92.   register struct prochd *element = a, *head = b;
  93.     element->ph_link = head->ph_link;
  94.     head->ph_link = (struct proc *)element;
  95.     element->ph_rlink = (struct proc *)head;
  96.     ((struct prochd *)(element->ph_link))->ph_rlink=(struct proc *)element;
  97. }
  98.  
  99. extern __inline__ void
  100. _remque(a)
  101.      void *a;
  102. {
  103.     register struct prochd *element = a;
  104.     ((struct prochd *)(element->ph_link))->ph_rlink = element->ph_rlink;
  105.     ((struct prochd *)(element->ph_rlink))->ph_link = element->ph_link;
  106.     element->ph_rlink = (struct proc *)0;
  107. }
  108. #else
  109. #define insque(q,p)    _insque((caddr_t)q,(caddr_t)p)
  110. #define remque(q)    _remque((caddr_t)q)
  111. #endif /* __GNUC__ */
  112.  
  113. typedef void (*timeout_t) __P((caddr_t));
  114.  
  115. /*
  116.  * General function declarations.
  117.  */
  118. int    nullop();        /* WARNING WILL ROBINSON */
  119. void    voidop();
  120. int    enodev();        /* All these routines are potentially */
  121. int    enoioctl();        /* called with differing arguments. */
  122. int    enxio();        /* For this reason, they cannot be */
  123. int    eopnotsupp();        /* prototyped without causing conflicts. */
  124.  
  125. /* SPL Levels */
  126. int    splhigh __P((void));
  127. int    splclock __P((void));
  128. int    splsoftclock __P((void));
  129. int    splbio __P((void));
  130. int    spltty __P((void));
  131. int    splimp __P((void));
  132. int     splnet __P((void));
  133. int    splnone __P((void));
  134. int    spl0 __P((void));
  135. int    splx __P((int));
  136.  
  137. /* Initialize the world */
  138. void    startrtclock __P((void));
  139. void    consinit __P((void));
  140. void    vm_mem_init __P((void));
  141. void    kmeminit __P((void));
  142. void    cpu_startup __P((void));
  143. void    rqinit __P((void));
  144. void    vm_init_limits __P((struct proc *));
  145. void    vfsinit __P((void));
  146. void    mbinit __P((void));
  147. void    shminit __P((void));
  148. void    ifinit __P((void));
  149. void    domaininit __P((void));
  150. void    swapinit __P((void));
  151. void    enablertclock __P((void));
  152.  
  153. /* Default network interfaces... */
  154. int    slattach __P((void));    /* XXX */
  155. void    loattach __P((void));
  156.  
  157. /* Scheduling */
  158. void    roundrobin __P((caddr_t));
  159. void    schedcpu __P((caddr_t));
  160. void    softclock();
  161. void    setsoftclock __P((void));
  162. void    setpri __P((struct proc *));
  163. void    gatherstats();        /* cannot prototype */
  164. void    remrq __P((struct proc *));
  165. void    setrq __P((struct proc *));
  166. void    setrun __P((struct proc *));
  167. void    vmmeter __P((void));
  168. void    updatepri __P((struct proc *));
  169. void    swtch __P((void));
  170.  
  171. /* Timeouts and sleeps */
  172. void    timeout __P((timeout_t, caddr_t, int));
  173. void    untimeout __P((timeout_t, caddr_t));
  174. void    wakeup __P((caddr_t));
  175. int    tsleep __P((caddr_t, int, const char *, int));
  176. void    sleep __P((caddr_t, int));
  177. void    unsleep __P((struct proc *));
  178.  
  179. /* Select */
  180. int    selscan __P((struct proc *p, fd_set *ibits, fd_set *obits,
  181.         int nfd, int *retval));
  182. int    seltrue __P((int dev, int which, struct proc *p));
  183.  
  184. /*
  185.  * if you want selrecord and selwakeup, and the struct selinfo declaration,
  186.  * include <sys/select.h>
  187.  */
  188.  
  189. /* User data reference */
  190. int    useracc __P((caddr_t, int, int));
  191. int    kernacc __P((caddr_t, int, int));
  192. int    kerncheckprot __P((caddr_t, int, int)); /* more-general kernacc() */
  193. int    copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done));
  194. int    copyinstr __P((void *udaddr, void *kaddr, u_int len, u_int *done));
  195. int    copyoutstr __P((void *kaddr, void *udaddr, u_int len, u_int *done));
  196. int    copyin __P((void *udaddr, void *kaddr, u_int len));
  197. int    copyout __P((void *kaddr, void *udaddr, u_int len));
  198. int    fubyte __P((void *base));
  199. int    fuibyte __P((void *base));
  200. int    subyte __P((void *base, int byte));
  201. int    suibyte __P((void *base, int byte));
  202. int    fuword __P((void *base));
  203. int    fuiword __P((void *base));
  204. int    suword __P((void *base, int word));
  205. int    suiword __P((void *base, int word));
  206.  
  207. /* Miscellaneous */
  208. void    setregs __P((struct proc *p, u_long entry, u_long stack, int *retval));
  209. void    logwakeup __P((void));
  210. void    addlog __P((const char *, ...));
  211. void    log __P((int, const char *, ...));
  212. int    printf __P((const char *, ...));
  213. int    sprintf __P((char *, const char *, ...));
  214. void    uprintf __P((const char *, ...));
  215. void    tablefull __P((char *));
  216.  
  217. /* Extrema */
  218. #if defined(__GNUC__) && defined(__STDC__)
  219. extern __inline__ unsigned int min (unsigned int a, unsigned int b) {
  220.     return (a < b ? a : b);
  221. }
  222. extern __inline__ unsigned int max (unsigned int a, unsigned int b) {
  223.     return (a > b ? a : b);
  224. }
  225. extern __inline__ int imin (int a, int b) {
  226.     return (a < b ? a : b);
  227. }
  228. extern __inline__ int imax (int a, int b) {
  229.     return (a > b ? a : b);
  230. }
  231. #else
  232. unsigned int    min __P((unsigned int, unsigned int));
  233. unsigned int    max __P((unsigned int, unsigned int));
  234. int    imin __P((int, int));
  235. int    imax __P((int, int));
  236. #endif
  237.  
  238. /* routines which never return */
  239. __dead void    sched __P((void));
  240. __dead void    kexit __P((struct proc *, int)); /* change from exit, so it
  241.                           * doesn't conflict w/ANSI
  242.                           */
  243. __dead void    cpu_exit __P((struct proc *));
  244. __dead void    panic __P((const char *));
  245. __dead void    boot __P((int));
  246.  
  247. /* string functions */
  248. size_t    strlen __P((const char *));
  249. int    strcmp __P((const char *, const char *));
  250. char   *strncpy __P((char *, const char *, int));
  251. char   *strcat __P((char *, const char *));
  252. char   *strcpy __P((char *, const char *));
  253. void    bcopy __P((void *from, void *to, u_int len));
  254. void    ovbcopy __P((void *from, void *to, u_int len));
  255. void    bzero __P((void *, u_int));
  256. int    bcmp __P((void *str1, void *str2, u_int len));
  257. int    scanc __P((unsigned size, u_char *cp, u_char *table, int mask));
  258. int    skpc __P((int, u_int, u_char *));
  259. int    locc __P((int, unsigned, u_char *));
  260. int    ffs __P((long));
  261.  
  262. /* Debugger entry points */
  263. int    Debugger __P((void));    /* in DDB only */
  264. int    read_symtab_from_file __P((struct proc *,struct vnode *,const char *));
  265.  
  266. #endif /* KERNEL */
  267. #endif /* _SYS_SYSTM_H_ */
  268.