[CRIU] [PATCH] zdtm: test -- Add trivial poll() timeout test

Andrew Vagin avagin at parallels.com
Tue Mar 17 08:05:13 PDT 2015


On Tue, Mar 17, 2015 at 05:05:21PM +0300, Cyrill Gorcunov wrote:
> On Tue, Mar 17, 2015 at 04:37:03PM +0300, Andrew Vagin wrote:
> > > +
> > > +	show_timestamp("Init", time_init.tv_sec, time_init.tv_usec);
> > > +
> > > +	delta = 1;
> > > +	ret = poll(ufds, 2, delta * 1000);
> > 
> > Why do you call poll() here?
> 
> To make sure it's workable on its own.

We don't do this in other tests, so I think we should not do it here too
> 
> > > +
> > > +		show_timestamp("From", time1.tv_sec, time1.tv_usec);
> > > +
> > > +		task_waiter_complete(&t, 1);
> > > +		delta = 5;
> > > +		ret = poll(ufds, 2, delta * 1000);
> > 
> > Can we call poll() in a loop to be sure that the timeout isn't expired
> > during the test?
> 
> You mean to spin until some external sync event from main thread comes?

Yes, I do.

> 
> > > +		show_pollfd(ufds, 2);
> > > +
> > > +		if (ret && errno != EINTR) {
> > 
> > When can we get EINTR here?
> 
> Yes we can i think. Why can't we?

We set all sighandlers with SA_RESTART, so I don't understand when
poll() returns EINTR.

> 
> 	Cyrill


More information about the CRIU mailing list