1: /*
   2:  * Copyright (c) 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)kern_proc.c	2.1 (2.11BSD) 1999/8/11
   7:  */
   8: 
   9: #include "param.h"
  10: #include "user.h"
  11: #include "proc.h"
  12: #include "systm.h"
  13: 
  14: /*
  15:  * Is p an inferior of the current process?
  16:  */
  17: inferior(p)
  18:     register struct proc *p;
  19: {
  20: 
  21:     for (; p != u.u_procp; p = p->p_pptr)
  22:         if (p->p_ppid == 0)
  23:             return (0);
  24:     return (1);
  25: }
  26: 
  27: struct proc *
  28: pfind(pid)
  29:     register int pid;
  30: {
  31:     register struct proc *p = pidhash[PIDHASH(pid)];
  32: 
  33:     for (; p; p = p->p_hash)
  34:         if (p->p_pid == pid)
  35:             return (p);
  36:     return ((struct proc *)0);
  37: }
  38: 
  39: /*
  40:  * init the process queues
  41:  */
  42: pqinit()
  43: {
  44:     register struct proc *p;
  45: 
  46:     /*
  47: 	 * most procs are initially on freequeue
  48: 	 *	nb: we place them there in their "natural" order.
  49: 	 */
  50: 
  51:     freeproc = NULL;
  52:     for (p = procNPROC; --p > proc; freeproc = p)
  53:         p->p_nxt = freeproc;
  54: 
  55:     /*
  56: 	 * but proc[0] is special ...
  57: 	 */
  58: 
  59:     allproc = p;
  60:     p->p_nxt = NULL;
  61:     p->p_prev = &allproc;
  62: 
  63:     zombproc = NULL;
  64: }
Last modified: 1999-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2550
Valid CSS Valid XHTML 1.0 Strict