--- libaitsched/src/hooks.c 2011/08/05 15:52:00 1.1.1.1 +++ libaitsched/src/hooks.c 2011/08/11 12:56:53 1.1.1.1.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.1.1.1 2011/08/05 15:52:00 misho Exp $ +* $Id: hooks.c,v 1.1.1.1.2.2 2011/08/11 12:56:53 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -119,29 +119,28 @@ sched_hook_cancel(void *task, void *arg __unused) struct sched_IO *io; sched_task_t *t = task; struct kevent chg[1]; - struct timespec timeout; + struct timespec timeout = { 0, 0 }; if (!t || !t->task_root || !ROOT_DATA(t->task_root) || !ROOT_DATLEN(t->task_root)) return (void*) -1; else io = ROOT_DATA(t->task_root); - timespecclear(&timeout); switch (t->task_type) { case taskREAD: if (FD_ISSET(TASK_FD(t), &io->wfd)) - EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_ADD, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); else - EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_DELETE, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_DELETE, 0, 0, (intptr_t) &TASK_FD(t)); kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout); FD_CLR(TASK_FD(t), &io->rfd); break; case taskWRITE: if (FD_ISSET(TASK_FD(t), &io->rfd)) - EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_ADD, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); else - EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_DELETE, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_DELETE, 0, 0, (intptr_t) &TASK_FD(t)); kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout); FD_CLR(TASK_FD(t), &io->wfd); @@ -165,7 +164,7 @@ sched_hook_read(void *task, void *arg __unused) struct sched_IO *io; sched_task_t *t = task; struct kevent chg[1]; - struct timespec timeout; + struct timespec timeout = { 0, 0 }; if (!t || !t->task_root || !ROOT_DATA(t->task_root) || !ROOT_DATLEN(t->task_root)) return (void*) -1; @@ -177,8 +176,7 @@ sched_hook_read(void *task, void *arg __unused) else FD_SET(TASK_FD(t), &io->rfd); - timespecclear(&timeout); - EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_ADD, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_READ, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { LOGERR; return (void*) -1; @@ -199,7 +197,7 @@ sched_hook_write(void *task, void *arg __unused) struct sched_IO *io; sched_task_t *t = task; struct kevent chg[1]; - struct timespec timeout; + struct timespec timeout = { 0, 0 }; if (!t || !t->task_root || !ROOT_DATA(t->task_root) || !ROOT_DATLEN(t->task_root)) return (void*) -1; @@ -211,8 +209,7 @@ sched_hook_write(void *task, void *arg __unused) else FD_SET(TASK_FD(t), &io->wfd); - timespecclear(&timeout); - EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_ADD, 0, 0, &TASK_FD(t)); + EV_SET(&chg[0], TASK_FD(t), EVFILT_WRITE, EV_ADD, 0, 0, (intptr_t) &TASK_FD(t)); if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { LOGERR; return (void*) -1; @@ -307,7 +304,7 @@ retry: goto retry; } - timespecclear(&nw); + nw.tv_sec = nw.tv_nsec = 0; /* Go and catch the cat into pipes ... */ for (i = 0; i < en; i++) { memcpy(evt, &res[i], sizeof evt);