60 #define SU_WAIT_CMP(x, y) \
61 (((x).ident - (y).ident) ? ((x).ident - (y).ident) : ((x).flags - (y).flags))
64 #define SU_WAIT_IN (EVFILT_READ)
66 #define SU_WAIT_OUT (EVFILT_WRITE)
68 #define SU_WAIT_CONNECT (EVFILT_WRITE)
70 #define SU_WAIT_ERR (EV_ERROR)
72 #define SU_WAIT_HUP (EV_EOF)
74 #define SU_WAIT_ACCEPT (EVFILT_READ)
77 #define SU_WAIT_FOREVER (-1)
79 #define SU_WAIT_TIMEOUT (-2)
82 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0, 0, 0, NULL }
85 #define SU_WAIT_MAX (0x7fffffff)
87 #elif SU_HAVE_POLL || DOCUMENTATION_ONLY
89 #define SU_WAIT_CMP(x, y) \
90 (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
93 #define SU_WAIT_IN (POLLIN)
95 #define SU_WAIT_OUT (POLLOUT)
97 #define SU_WAIT_CONNECT (POLLOUT)
99 #define SU_WAIT_ERR (POLLERR)
101 #define SU_WAIT_HUP (POLLHUP)
103 #define SU_WAIT_ACCEPT (POLLIN)
106 #define SU_WAIT_FOREVER (-1)
108 #define SU_WAIT_TIMEOUT (-2)
111 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
114 #define SU_WAIT_MAX (0x7fffffff)
116 #elif SU_HAVE_WINSOCK
118 #define SU_WAIT_CMP(x, y) ((intptr_t)(x) - (intptr_t)(y))
120 #define SU_WAIT_IN (FD_READ)
121 #define SU_WAIT_OUT (FD_WRITE)
122 #define SU_WAIT_CONNECT (FD_CONNECT)
123 #define SU_WAIT_ERR (0)
124 #define SU_WAIT_HUP (FD_CLOSE)
125 #define SU_WAIT_ACCEPT (FD_ACCEPT)
127 #define SU_WAIT_FOREVER (WSA_INFINITE)
128 #define SU_WAIT_TIMEOUT (WSA_WAIT_TIMEOUT)
130 #define SU_WAIT_INIT NULL
132 #define SU_WAIT_MAX (64)
138 #define POLLPRI 0x002
139 #define POLLOUT 0x004
142 #define POLLRDNORM 0x040
143 #define POLLRDBAND 0x080
144 #define POLLWRNORM 0x100
145 #define POLLWRBAND 0x200
149 #define POLLERR 0x008
150 #define POLLHUP 0x010
151 #define POLLNVAL 0x020
153 #define SU_WAIT_CMP(x, y) \
154 (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
156 #define SU_WAIT_IN POLLIN
157 #define SU_WAIT_OUT POLLOUT
158 #define SU_WAIT_CONNECT POLLOUT
159 #define SU_WAIT_ERR POLLERR
160 #define SU_WAIT_HUP POLLHUP
161 #define SU_WAIT_ACCEPT POLLIN
162 #define SU_WAIT_FOREVER (-1)
163 #define SU_WAIT_TIMEOUT (-2)
165 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
168 #define SU_WAIT_MAX (0x7fffffff)
180 #elif SU_HAVE_WINSOCK
193 typedef unsigned long int nfds_t;
200 int poll (
struct pollfd *__fds, nfds_t __nfds,
int __timeout);
205 typedef int su_success_t;
212 #ifndef SU_ROOT_MAGIC_T
223 #define SU_ROOT_MAGIC_T void
238 #ifndef SU_WAKEUP_ARG_T
249 #define SU_WAKEUP_ARG_T void
286 #ifndef SU_PREPOLL_MAGIC_T
297 #define SU_PREPOLL_MAGIC_T void
323 #error SU_TIMER_T defined
326 #ifndef SU_TIMER_ARG_T
330 #define SU_TIMER_ARG_T void
344 #ifndef SU_TIMER_QUEUE_T
345 #define SU_TIMER_QUEUE_T su_timer_t *
348 typedef SU_TIMER_QUEUE_T su_timer_queue_t;
363 #define SU_TASK_R_INIT {{ NULL, NULL }}
366 typedef _su_task_t
const *_su_task_r;
375 #define SU_MSG_ARG_T void
394 #define SU_MSG_R_INIT { NULL }
412 #define SU_CLONE_T struct su_clone_s
419 #define SU_CLONE_R_INIT {NULL}
438 #if !HAVE_WIN32 && (SU_HAVE_POLL || HAVE_SELECT)
452 __attribute__((__malloc__));
465 int index,
int socket,
int events);
494 __attribute__((__malloc__));
498 __attribute__((__malloc__));
514 SOFIAPUBFUN int su_timer_expire(su_timer_queue_t *
const,
538 int (*
function)(
void *),
void *arg,
568 return msg && *msg != NULL;
571 #define su_msg_is_non_null(msg) ((msg) && (*(msg)) != NULL)
592 typedef su_port_t *su_port_create_f(
void);
593 typedef int su_clone_start_f(
su_root_t *parent,
601 SOFIAPUBFUN su_port_create_f su_default_port_create;
604 SOFIAPUBFUN su_port_create_f su_wsaevent_port_create;
605 SOFIAPUBFUN su_port_create_f su_select_port_create;
606 SOFIAPUBFUN su_port_create_f su_kqueue_port_create;
607 SOFIAPUBFUN su_port_create_f su_devpoll_port_create;
609 SOFIAPUBFUN su_clone_start_f su_default_clone_start;
612 SOFIAPUBFUN su_clone_start_f su_wsaevent_clone_start;
613 SOFIAPUBFUN su_clone_start_f su_select_clone_start;
614 SOFIAPUBFUN su_clone_start_f su_kqueue_clone_start;
615 SOFIAPUBFUN su_clone_start_f su_devpoll_clone_start;