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.
15 sockevent_proc_init(void)
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
)
37 sockevent_freeprocs
= spr
->spr_next
;
44 * Free up a previously allocated socket process suspension entry for reuse.
47 sockevent_proc_free(struct sockevent_proc
* spr
)
50 spr
->spr_next
= sockevent_freeprocs
;
51 sockevent_freeprocs
= spr
;