|
|
1.1 root 1: /* pinit.c - pinit */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <mark.h>
6: #include <ports.h>
7:
8: #ifdef MEMMARK
9: MARKER ptmark;
10: #endif
11: struct ptnode *ptfree; /* list of free queue nodes */
12: struct pt ports[NPORTS];
13: int ptnextp;
14:
15: /*------------------------------------------------------------------------
16: * pinit -- initialize all ports
17: *------------------------------------------------------------------------
18: */
19: SYSCALL pinit(maxmsgs)
20: int maxmsgs;
21: {
22: int i;
23: struct ptnode *next, *prev;
24:
1.1.1.2 ! root 25: #ifdef DEBUG
! 26: dotrace("pinit", &maxmsgs, 1);
! 27: #endif
! 28: if ( (ptfree=getmem(maxmsgs*sizeof(struct ptnode)))==SYSERR ) {
! 29: kprintf("pinit - insufficient memory");
! 30: return SYSERR;
1.1 root 31: }
1.1.1.2 ! root 32: for (i=0 ; i<NPORTS ; i++)
! 33: ports[i].ptstate = PTFREE;
1.1 root 34: ptnextp = NPORTS - 1;
35:
36: /* link up free list of message pointer nodes */
37:
38: for ( prev=next=ptfree ; --maxmsgs > 0 ; prev=next )
39: prev->ptnext = ++next;
40: prev->ptnext = (struct ptnode *)NULL;
41: return(OK);
42: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.