[CRIU] [PATCH 3/4] test: poll -- Use gettimeofday syscall directly
Christopher Covington
cov at codeaurora.org
Thu Mar 26 06:32:52 PDT 2015
On 03/26/2015 09:12 AM, Cyrill Gorcunov wrote:
> On Thu, Mar 26, 2015 at 09:07:38AM -0400, Christopher Covington wrote:
>> Hi Cyrill,
>>
>> On 03/26/2015 04:23 AM, 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.
>>>
>>> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
>>> ---
>>> test/zdtm/live/static/poll.c | 24 +++++++++++++++++++++---
>>> 1 file changed, 21 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/test/zdtm/live/static/poll.c b/test/zdtm/live/static/poll.c
>>> index 85f545593b6e..db4b427ce3e2 100644
>>> --- a/test/zdtm/live/static/poll.c
>>> +++ b/test/zdtm/live/static/poll.c
>>> @@ -19,6 +19,24 @@
>>> const char *test_doc = "Check poll() timeouts";
>>> const char *test_author = "Cyrill Gorcunov <gorcunov at parallels.com>";
>>>
>>> +#ifdef __x86_64__
>>> +#define __NR_gettimeofday 96
>>> +#else
>>> +#define __NR_gettimeofday 78
>>> +#endif
>>
>> Does SYS_gettimeofday from <sys/syscall.h> not work?
>>
>> http://man7.org/linux/man-pages/man2/syscall.2.html
>
> Hi Christopher, I must admit, I didn't try it. Will try
> and if work -- update, thanks!
I wrote that before reading the whole thread, sorry. Andrew's suggestion of
__NR_gettimeofday from unistd.h sounds better. Poking around a little, it
looks like __NR_ are defined in the Linux kernel source and exported while
SYS_ come from the C library, so I'd expect the former (__NR_) to be more
complete and up to date.
Chris
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
More information about the CRIU
mailing list