X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Fwaiter%2Fwaiter.c;h=1d9a7d8945e1cd992ebf458bcb797a36b016a9e0;hp=89fa9cb77f2dbfa8c9b7ec8b70ceead0ef2163ca;hb=7f4057edddbcb1b18293ebb96475ed37551edc73;hpb=45c7385acbd1299cacfa5cc335ffa6a0f0523980 diff --git a/lib/waiter/waiter.c b/lib/waiter/waiter.c index 89fa9cb..1d9a7d8 100644 --- a/lib/waiter/waiter.c +++ b/lib/waiter/waiter.c @@ -11,14 +11,18 @@ #include "waiter.h" struct waiter { + struct waitset *set; enum { WAITER_IO, WAITER_TIME, - } type; - struct waitset *set; - int fd; - int events; - struct timeval timeout; + } type; + union { + struct { + int fd; + int events; + } io; + struct timeval timeout; + }; waiter_cb callback; void *arg; @@ -90,8 +94,8 @@ struct waiter *waiter_register_io(struct waitset *set, int fd, int events, waiter->type = WAITER_IO; waiter->set = set; - waiter->fd = fd; - waiter->events = events; + waiter->io.fd = fd; + waiter->io.events = events; waiter->callback = callback; waiter->arg = arg; @@ -179,8 +183,8 @@ static void update_waiters(struct waitset *set) if (waiter->type != WAITER_IO) continue; - set->pollfds[i_io].fd = waiter->fd; - set->pollfds[i_io].events = waiter->events; + set->pollfds[i_io].fd = waiter->io.fd; + set->pollfds[i_io].events = waiter->io.events; set->io_waiters[i_io] = waiter; i_io++; }