Re: [Qemu-devel] [PATCH v3 7/7] poll-linux: Add timerfd support

2015-04-16 Thread Stefan Hajnoczi
On Thu, Apr 16, 2015 at 12:57:36PM +0800, Fam Zheng wrote: > +static int qemu_poll_timerfd(QEMUPoll *qpoll, int64_t timeout_ns) > +{ > +int r; > +struct itimerspec its = { { 0 } }; > + > +if (timeout_ns > 0) { > +its.it_value.tv_sec = timeout_ns / 10LL; > +its.it

[Qemu-devel] [PATCH v3 7/7] poll-linux: Add timerfd support

2015-04-15 Thread Fam Zheng
In qemu_poll_timerfd, we arm the timerfd with timeout_ns. The timerfd is also watched by epollfd, so that when there is no other events, epoll_wait will still return on time, even though we pass -1 (wait infinitely). Signed-off-by: Fam Zheng --- poll-linux.c | 84