Remove building with NOCRYPTO option
[minix3.git] / minix / lib / libsockevent / sockevent_proc.c
blobdf5e3a91f2ef4ab992cae5cc4b44b7dc7e2b6438
1 /* libsockevent - sockevent_proc.c - process suspension state management */
3 #include <minix/drivers.h>
4 #include <minix/sockdriver.h>
6 #include "sockevent_proc.h"
8 static struct sockevent_proc sockevent_procs[NR_PROCS];
9 static struct sockevent_proc *sockevent_freeprocs;
12 * Initialize the process suspension table.
14 void
15 sockevent_proc_init(void)
17 unsigned int slot;
19 for (slot = 0; slot < __arraycount(sockevent_procs); slot++) {
20 sockevent_procs[slot].spr_next = sockevent_freeprocs;
21 sockevent_freeprocs = &sockevent_procs[slot];
26 * Allocate and return a new socket process suspension entry. Return NULL if
27 * no entries are available.
29 struct sockevent_proc *
30 sockevent_proc_alloc(void)
32 struct sockevent_proc *spr;
34 if ((spr = sockevent_freeprocs) == NULL)
35 return NULL;
37 sockevent_freeprocs = spr->spr_next;
38 spr->spr_next = NULL;
40 return spr;
44 * Free up a previously allocated socket process suspension entry for reuse.
46 void
47 sockevent_proc_free(struct sockevent_proc * spr)
50 spr->spr_next = sockevent_freeprocs;
51 sockevent_freeprocs = spr;