[PATCH 1/2] Cast clock_t type to unsigned long

H.J. Lu hjl.tools at gmail.com
Sun Apr 15 20:49:47 UTC 2012


On Sun, Apr 15, 2012 at 1:30 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Sunday 15 April 2012 16:22:06 H.J. Lu wrote:
>> On Sun, Apr 15, 2012 at 12:03 PM, Mike Frysinger <vapier at gentoo.org> wrote:
>> > On Sunday 15 April 2012 14:17:13 H.J. Lu wrote:
>> >> Linux kernel v3.4 adds x32 support whose clock_t is long long.  This
>> >> patch casts clock_t type to unsigned long for "%lu".
>> >
>> > shouldn't we cast it to long long then and use %llu ?
>>
>> It also works for x32.
>>
>> I don't think it makes a difference in practice.  I doubt clock_t value
>> returns by those system calls can overflow 32bit integer.
>
> famous last words!
>
> seriously though, if clock_t is known to be 64bits, then we should be decoding
> it accordingly.  otherwise, i'd question why it was declared 64bits in the
> first place instead of keeping it as 32.

We want to use the same "times" system call for both x32 and x86-64.
Since times use "clock_t", we changed x32 clock_t from 32bit to 64bit.


-- 
H.J.




More information about the Strace-devel mailing list