getitem.c,v
来自「TCP-IP红宝书源代码」· C,V 代码 · 共 75 行
C,V
75 行
head 1.2;
access;
symbols;
locks
dls:1.2; strict;
comment @ * @;
1.2
date 97.09.21.19.29.30; author dls; state Dist;
branches;
next 1.1;
1.1
date 94.05.06.03.12.23; author dls; state Works;
branches;
next ;
desc
@@
1.2
log
@pre-3e code
@
text
@/* getitem.c - getfirst, getlast */
#include <conf.h>
#include <kernel.h>
#include <q.h>
/*------------------------------------------------------------------------
* getfirst -- remove and return the first process on a list
*------------------------------------------------------------------------
*/
int getfirst(head)
int head; /* q index of head of list */
{
int proc; /* first process on the list */
if ((proc=q[head].qnext) < NPROC)
return( dequeue(proc) );
else
return(EMPTY);
}
/*------------------------------------------------------------------------
* getlast -- remove and return the last process from a list
*------------------------------------------------------------------------
*/
int getlast(tail)
int tail; /* q index of tail of list */
{
int proc; /* last process on the list */
if ((proc=q[tail].qprev) < NPROC)
return( dequeue(proc) );
else
return(EMPTY);
}
@
1.1
log
@Initial revision
@
text
@@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?