home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / PROC.H < prev    next >
C/C++ Source or Header  |  1994-08-26  |  3KB  |  87 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. #ifdef LINUX
  51. #define psignal j_psignal
  52. #endif
  53.   
  54. /* In  kernel.c: */
  55. void alert __ARGS((struct proc *pp,int val));
  56. void chname __ARGS((struct proc *pp,char *newname));
  57. void killproc __ARGS((struct proc *pp));
  58. void killself __ARGS((void));
  59. struct proc *mainproc __ARGS((char *name));
  60. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  61. void (*pc) __ARGS((int,void *,void *)),
  62. int iarg,void *parg1,void *parg2,int freeargs));
  63. int psignal __ARGS((void *event,int n));
  64. int pwait __ARGS((void *event));
  65. void resume __ARGS((struct proc *pp));
  66. void suspend __ARGS((struct proc *pp));
  67.   
  68. /* In ksubr.c: */
  69. void chkstk __ARGS((void));
  70. void kinit __ARGS((void));
  71. int stkutil __ARGS((struct proc *pp));
  72. unsigned phash __ARGS((void *event));
  73. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  74. void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  75. #ifdef  AMIGA
  76. void init_psetup __ARGS((struct proc *pp));
  77. #endif
  78.   
  79. /* Stack background fill value for high water mark checking */
  80. #define STACKPAT    0x55aa
  81.   
  82. /* Value stashed in location 0 to detect null pointer dereferences */
  83. #define NULLPAT     0xdead
  84.   
  85. #endif  /* _PROC_H */
  86.   
  87.