--- libaitsched/src/hooks.c 2011/08/11 13:23:28 1.1.1.1.2.3 +++ libaitsched/src/hooks.c 2011/08/11 22:55:28 1.1.1.1.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.1.1.1.2.3 2011/08/11 13:23:28 misho Exp $ +* $Id: hooks.c,v 1.1.1.1.2.4 2011/08/11 22:55:28 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -118,7 +118,7 @@ sched_hook_cancel(void *task, void *arg __unused) { struct sched_IO *io; sched_task_t *t = task; - struct kevent chg[1]; + struct kevent chg[2]; struct timespec timeout = { 0, 0 }; if (!t || !t->task_root || !ROOT_DATA(t->task_root) || !ROOT_DATLEN(t->task_root)) @@ -128,6 +128,11 @@ sched_hook_cancel(void *task, void *arg __unused) switch (t->task_type) { case taskREAD: +#ifdef __NetBSD__ + EV_SET(&chg[1], TASK_FD(t), EVFILT_READ, EV_DELETE, 0, 0, (intptr_t) &TASK_FD(t)); +#else + EV_SET(&chg[1], TASK_FD(t), EVFILT_READ, EV_DELETE, 0, 0, &TASK_FD(t)); +#endif if (FD_ISSET(TASK_FD(t), &io->wfd)) #ifdef __NetBSD__ EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); @@ -140,11 +145,16 @@ sched_hook_cancel(void *task, void *arg __unused) #else EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_DELETE, 0, 0, &TASK_FD(t)); #endif - kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout); + kevent(t->task_root->root_kq, chg, 2, NULL, 0, &timeout); FD_CLR(TASK_FD(t), &io->rfd); break; case taskWRITE: +#ifdef __NetBSD__ + EV_SET(&chg[1], TASK_FD(t), EVFILT_WRITE, EV_DELETE, 0, 0, (intptr_t) &TASK_FD(t)); +#else + EV_SET(&chg[1], TASK_FD(t), EVFILT_WRITE, EV_DELETE, 0, 0, &TASK_FD(t)); +#endif if (FD_ISSET(TASK_FD(t), &io->rfd)) #ifdef __NetBSD__ EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); @@ -157,7 +167,7 @@ sched_hook_cancel(void *task, void *arg __unused) #else EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_DELETE, 0, 0, &TASK_FD(t)); #endif - kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout); + kevent(t->task_root->root_kq, chg, 2, NULL, 0, &timeout); FD_CLR(TASK_FD(t), &io->wfd); break;