home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / network / src_1218.zip / PROC.H < prev    next >
Text File  |  1990-11-10  |  3KB  |  81 lines

  1. #ifndef    _PROC_H
  2. #define    _PROC_H
  3.  
  4. #include <setjmp.h>
  5.  
  6. #ifndef _MBUF_H
  7. #include "mbuf.h"
  8. #endif
  9.  
  10. #ifndef    _TIMER_H
  11. #include "timer.h"
  12. #endif
  13.  
  14. #define    OUTBUFSIZE    512    /* Size to be malloc'ed for outbuf */
  15.  
  16. /* Kernel process control block */
  17. #define    PHASH    16        /* Number of wait table hash chains */
  18. struct proc {
  19.     struct proc *prev;    /* Process table pointers */
  20.     struct proc *next;    
  21.  
  22.     jmp_buf env;        /* Process state */
  23.     char i_state;        /* Process interrupt state */
  24.  
  25.     unsigned short state;
  26. #define    READY    0
  27. #define    WAITING    1
  28. #define    SUSPEND    2
  29.     void *event;        /* Wait event */
  30.     int16 *stack;        /* Process stack */
  31.     unsigned stksize;    /* Size of same */
  32.     char *name;        /* Arbitrary user-assigned name */
  33.     int retval;        /* Return value from next pwait() */
  34.     struct timer alarm;    /* Alarm clock timer */
  35.     struct mbuf *outbuf;    /* Terminal output buffer */
  36.     int input;        /* standard input socket */
  37.     int output;        /* standard output socket */
  38.     int iarg;        /* Copy of iarg */
  39.     void *parg1;        /* Copy of parg1 */
  40.     void *parg2;        /* Copy of parg2 */
  41.     int freeargs;        /* Free args on termination if set */
  42. };
  43. #define NULLPROC (struct proc *)0
  44. extern struct proc *Waittab[];    /* Head of wait list */
  45. extern struct proc *Rdytab;    /* Head of ready list */
  46. extern struct proc *Curproc;    /* Currently running process */
  47. extern struct proc *Susptab;    /* Suspended processes */
  48. extern int Stkchk;        /* Stack checking flag */
  49.  
  50. /* In  kernel.c: */
  51. void alert __ARGS((struct proc *pp,int val));
  52. void chname __ARGS((struct proc *pp,char *newname));
  53. void killproc __ARGS((struct proc *pp));
  54. void killself __ARGS((void));
  55. struct proc *mainproc __ARGS((char *name));
  56. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  57.     void (*pc) __ARGS((int,void *,void *)),
  58.     int iarg,void *parg1,void *parg2,int freeargs));
  59. int psignal __ARGS((void *event,int n));
  60. int pwait __ARGS((void *event));
  61. void resume __ARGS((struct proc *pp));
  62. void suspend __ARGS((struct proc *pp));
  63.  
  64. /* In ksubr.c: */
  65. void chkstk __ARGS((void));
  66. void kinit __ARGS((void));
  67. unsigned phash __ARGS((void *event));
  68. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  69.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  70. #ifdef    AMIGA
  71. void init_psetup __ARGS((struct proc *pp));
  72. #endif
  73.  
  74. /* Stack background fill value for high water mark checking */
  75. #define    STACKPAT    0x55aa
  76.  
  77. /* Value stashed in location 0 to detect null pointer dereferences */
  78. #define    NULLPAT        0xdead
  79.  
  80. #endif    /* _PROC_H */
  81.