proc.h,v
来自「TCP-IP红宝书源代码」· H,V 代码 · 共 127 行
H,V
127 行
head 1.3;
access;
symbols;
locks
dls:1.3; strict;
comment @ * @;
1.3
date 97.09.21.19.26.19; author dls; state Dist;
branches;
next 1.2;
1.2
date 94.05.10.20.48.46; author dls; state Old;
branches;
next 1.1;
1.1
date 94.04.30.18.42.23; author dls; state Dist;
branches;
next ;
desc
@@
1.3
log
@pre-3e code
@
text
@/* proc.h - isbadpid */
/* process table declarations and defined constants */
#ifndef NPROC /* set the number of processes */
#define NPROC 30 /* allowed if not already done */
#endif
#ifndef _NFILE
#define _NFILE 20 /* # of files allowed */
#endif
#define FDFREE -1 /* free file descriptor */
/* process state constants */
#define PRCURR '\001' /* process is currently running */
#define PRFREE '\002' /* process slot is free */
#define PRREADY '\003' /* process is on ready queue */
#define PRRECV '\004' /* process waiting for message */
#define PRSLEEP '\005' /* process is sleeping */
#define PRSUSP '\006' /* process is suspended */
#define PRWAIT '\007' /* process is on semaphore queue*/
#define PRTRECV '\010' /* process is timing a receive */
/* miscellaneous process definitions */
#define PNMLEN 16 /* length of process "name" */
#define NULLPROC 0 /* id of the null process; it */
/* is always eligible to run */
#define BADPID -1 /* used when invalid pid needed */
#define isbadpid(x) (x<=0 || x>=NPROC)
/* process table entry */
struct pentry {
char pstate; /* process state: PRCURR, etc. */
int pprio; /* process priority */
unsigned long pesp; /* saved stack pointer */
STATWORD pirmask; /* saved interrupt mask */
int psem; /* semaphore if process waiting */
WORD pmsg; /* message sent to this process */
char phasmsg; /* nonzero iff pmsg is valid */
int pbase; /* base of run time stack */
int pstklen; /* stack length */
WORD plimit; /* lowest extent of stack */
char pname[PNMLEN]; /* process name */
int pargs; /* initial number of arguments */
WORD paddr; /* initial code address */
WORD pnxtkin; /* next-of-kin notified of death*/
Bool ptcpumode; /* proc is in TCP urgent mode */
short pdevs[2]; /* devices to close upon exit */
int fildes[_NFILE]; /* file - device translation */
};
extern struct pentry proctab[];
extern int numproc; /* currently active processes */
extern int nextproc; /* search point for free slot */
extern int currpid; /* currently executing process */
extern int lastpid; /* currently executing process */
@
1.2
log
@*** empty log message ***
@
text
@d41 1
a41 1
int pesp; /* saved stack pointer */
d63 1
@
1.1
log
@Initial revision
@
text
@a27 1
#define PNREGS 19 /* size of saved register area */
d41 2
a42 1
WORD pregs[PNREGS]; /* saved registers PC, and PS */
d46 1
a46 1
WORD pbase; /* base of run time stack */
d57 1
@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?