[CRIU] [PATCH 3/4] test: poll -- Use gettimeofday syscall directly

Cyrill Gorcunov gorcunov at gmail.com
Thu Mar 26 01:53:00 PDT 2015


On Thu, Mar 26, 2015 at 11:42:27AM +0300, Andrew Vagin wrote:
> On Thu, Mar 26, 2015 at 11:23:14AM +0300, Cyrill Gorcunov wrote:
> > The gettimeofday uses /etc/localtime (thanks avagin@
> > for the hint) which is not present in namespace tests.
> > So lets use syscall directly and make test pass in
> > namespace environment as well.
> 
> gettimeofday() doesn't fail if /etc/localtime doesn't exist.

Wait, I'm confused now. You've been saying me that 'cause
/etc/localtime doesn't exist in ns the poll test fails.
Once I changed gettimeofday to syscall version, the test
passes, which I don't understand then. Is it a side effect
of someone else accesing /etc/localtime?

> >  
> > +#ifdef __x86_64__
> > +#define __NR_gettimeofday 96
> > +#else
> > +#define __NR_gettimeofday 78
> > +#endif
> 
> gettimeofday() is an old syscall, so you don't need to define
> __NR_gettimeofday.
> 
> #include <unistd.h>

yup, thanks

> 
> We don't need to set errno here.
> 
> man 2 syscall
> syscall() stores any error
>        code returned by the system call in errno(3) if an error occurs

fixed in updated version I've sent

	Cyrill


More information about the CRIU mailing list