quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

queue.h (678B)


      1 #ifndef QUEUE_H
      2 #define QUEUE_H
      3 
      4 #include <stddef.h>
      5 
      6 #ifdef __linux__
      7 	#include <sys/epoll.h>
      8 
      9 	typedef struct epoll_event queue_event;
     10 #else
     11 	#include <sys/types.h>
     12 	#include <sys/event.h>
     13 	#include <sys/time.h>
     14 
     15 	typedef struct kevent queue_event;
     16 #endif
     17 
     18 enum queue_event_type {
     19 	QUEUE_EVENT_IN,
     20 	QUEUE_EVENT_OUT,
     21 };
     22 
     23 int queue_create(void);
     24 int queue_add_fd(int, int, enum queue_event_type, int, const void *);
     25 int queue_mod_fd(int, int, enum queue_event_type, const void *);
     26 int queue_rem_fd(int, int);
     27 ssize_t queue_wait(int, queue_event *, size_t);
     28 
     29 void *queue_event_get_data(const queue_event *);
     30 
     31 int queue_event_is_error(const queue_event *e);
     32 
     33 #endif /* QUEUE_H */