times(2) misbehaviour
Will Newton
will.newton at gmail.com
Thu Apr 24 05:39:24 PDT 2008
Hi,
It looks to me as if times(2) is broken with Linux 2.6 on a 32bit
arch. Can anyone confirm if this analysis is correct?
Looking at sys_times in the 2.6 kernel it returns like this:
return (long) jiffies_64_to_clock_t(get_jiffies_64());
On a 32bit arch that takes the bottom 32bits of a 64bit value.
The system call wrappers in uClibc then examine the return code of the
system call and if it is greater than a certain unsigned value assumes
it is an errno value (negative). e.g. for arm:
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
This is effectively testing the bottom 32bits of jiffies_64 against
the largest known errno value which occasionally will be true even
when no error has been returned.
Is this a known issue?
More information about the uClibc
mailing list