/* unregister_poll_functions -- * Unregisters a previously registered event source. * Argument handle is the handle returned by the * registering function below. */ void unregister_poll_functions(void *handle) { poll_functions_t *src, **p = &sources; while ((src = *p) && ((void*)src!=handle)) p = &src->next; if (!src) return; *p = src->next; free(src); async_poll_setup(); }
void *register_poll_functions(int (*spoll)(void), void (*apoll)(void), void (*bwait)(void), void (*ewait)(void), int fd) { poll_functions_t *src = malloc(sizeof(struct poll_functions)); assert(src); src->fd = fd; src->spoll = spoll; src->apoll = apoll; src->bwait = bwait; src->ewait = ewait; src->next = sources; sources = src; async_poll_setup(); return src; }
void * register_poll_functions(int (*spoll)(void), void (*apoll)(void), void (*bwait)(void), void (*ewait)(void), int fd ) { struct poll_functions *src; src = malloc(sizeof(struct poll_functions)); if (! src) error(NIL,"Out of memory", NIL); src->next = sources; src->fd = fd; src->spoll = spoll; src->apoll = apoll; src->bwait = bwait; src->ewait = ewait; sources = src; async_poll_setup(); return src; }