|
|
1.1 root 1: /* insert.c - insert */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <q.h>
6:
7: /*------------------------------------------------------------------------
8: * insert.c -- insert an process into a q list in key order
9: *------------------------------------------------------------------------
10: */
11: int insert(proc, head, key)
12: int proc; /* process to insert */
13: int head; /* q index of head of list */
14: int key; /* key to use for this process */
15: {
16: int next; /* runs through list */
17: int prev;
18:
19: next = q[head].qnext;
20: while (q[next].qkey < key) /* tail has MAXSHORT as key */
21: next = q[next].qnext;
22: q[proc].qnext = next;
23: q[proc].qprev = prev = q[next].qprev;
24: q[proc].qkey = key;
25: q[prev].qnext = proc;
26: q[next].qprev = proc;
27: return(OK);
28: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.