1: #include "nap.h"
   2: #if NNAP > 0
   3: #include "param.h"
   4: #include <sys/systm.h>
   5: #include <sys/tty.h>
   6: #include <sys/dir.h>
   7: #include <sys/user.h>
   8: #include <sys/proc.h>
   9: 
  10: #define N_NAP   32
  11: #define NAPPRI  31
  12: 
  13: int ttnap[N_NAP];
  14: 
  15: /*ARGSUSED*/
  16: napioctl(dev, cmd, addr, flags)
  17: dev_t   dev;
  18: caddr_t addr;
  19: {
  20:     int wakeup();
  21:     int *ptr;
  22: 
  23:     for(ptr=ttnap; *ptr && (ptr <= &ttnap[N_NAP]); ptr++)
  24:         ;
  25:     if(ptr == &ttnap[N_NAP]) {
  26:         u.u_error = ENXIO;
  27:         return;
  28:     }
  29: 
  30:     *ptr = u.u_procp->p_pid;
  31:     timeout(wakeup, ptr, cmd);
  32:     sleep(ptr, NAPPRI);
  33:     *ptr = 0;
  34: }
  35: 
  36: /*ARGSUSED*/
  37: napclose(dev, flags)
  38: dev_t   dev;
  39: {
  40:     int *ptr;
  41: 
  42:     for(ptr=ttnap; (*ptr != u.u_procp->p_pid) && (ptr <= &ttnap[N_NAP]); ptr++)
  43:         ;
  44:     if(*ptr == u.u_procp->p_pid)
  45:         *ptr = 0;
  46: }
  47: #endif	NNAP

Defined functions

napclose defined in line 37; never used
napioctl defined in line 16; never used

Defined variables

ttnap defined in line 13; used 5 times

Defined macros

NAPPRI defined in line 11; used 1 times
  • in line 32
N_NAP defined in line 10; used 4 times
Last modified: 1983-07-23
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 812
Valid CSS Valid XHTML 1.0 Strict