File:  [XINU] / xinu / sys / insertd.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:19 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19910600, HEAD
Xinu for 68000/68010

/* insertd.c - insertd */

#include <conf.h>
#include <kernel.h>
#include <q.h>

/*------------------------------------------------------------------------
 *  insertd  --  insert process pid in delta list "head", given its key
 *------------------------------------------------------------------------
 */
insertd(pid, head, key)
	int	pid;
	int	head;
	int	key;
{
	int	next;			/* runs through list		*/
	int	prev;			/* follows next through list	*/

#ifdef	DEBUG
	dotrace("insertd", &pid, 3);
#endif
	for(prev=head,next=q[head].qnext ;
	    q[next].qkey < key ; prev=next,next=q[next].qnext)
		key -= q[next].qkey;
	q[pid].qnext = next;
	q[pid].qprev = prev;
	q[pid].qkey  = key;
	q[prev].qnext = pid;
	q[next].qprev = pid;
	if (next < NPROC)
		q[next].qkey -= key;
	return(OK);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.