blob: 7a7b61927b195869580d2df34053c66cd9052850 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* ISC license. */
#include <sys/types.h>
#include <errno.h>
#include <skalibs/kolbak.h>
#include <skalibs/unixmessage.h>
int kolbak_enqueue (kolbak_queue *q, unixmessage_handler_func_ref f, void *data)
{
size_t newtail = (q->tail + 1) % q->n ;
if (newtail == q->head) return (errno = ENOBUFS, 0) ;
q->x[q->tail].f = f ;
q->x[q->tail].data = data ;
q->tail = newtail ;
return 1 ;
}
|