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

Denys Vlasenko dvlasenk at redhat.com
Mon Apr 16 09:58:39 UTC 2012


On 04/15/2012 10:22 PM, 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.

It probably won't - modulo bugs. And strace is a _debugging_ tool.
It might be used exactly because someone chases a bug.
Let's show the user the full, non-truncated value.

-- 
vda




More information about the Strace-devel mailing list