. service tells you which device it couldn't stat
[minix3.git] / servers / inet / mq.c
blob863156402884ba895fc4e94b82c2d0f2b7b613bb
1 /*
2 inet/mq.c
4 Created: Jan 3, 1992 by Philip Homburg
6 Copyright 1995 Philip Homburg
7 */
9 #include "inet.h"
10 #include "mq.h"
11 #include "generic/assert.h"
13 THIS_FILE
15 #define MQ_SIZE 128
17 PRIVATE mq_t mq_list[MQ_SIZE];
18 PRIVATE mq_t *mq_freelist;
20 void mq_init()
22 int i;
24 mq_freelist= NULL;
25 for (i= 0; i<MQ_SIZE; i++)
27 mq_list[i].mq_next= mq_freelist;
28 mq_freelist= &mq_list[i];
29 mq_list[i].mq_allocated= 0;
33 mq_t *mq_get()
35 mq_t *mq;
37 mq= mq_freelist;
38 assert(mq != NULL);
40 mq_freelist= mq->mq_next;
41 mq->mq_next= NULL;
42 assert(mq->mq_allocated == 0);
43 mq->mq_allocated= 1;
44 return mq;
47 void mq_free(mq)
48 mq_t *mq;
50 mq->mq_next= mq_freelist;
51 mq_freelist= mq;
52 assert(mq->mq_allocated == 1);
53 mq->mq_allocated= 0;
57 * $PchId: mq.c,v 1.7 1998/10/23 20:10:47 philip Exp $