times(2) misbehaviour

Denys Vlasenko vda.linux at googlemail.com
Thu Apr 24 23:50:11 UTC 2008

On Thursday 24 April 2008 21:43, Will Newton wrote:
> >  > 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.
> >
> >  Just delete the check for error.
> The check is in generic syscall wrappers. glibc does exactly the same thing.

I propose creating another wrapper for syscalls which never fail.

> >  My take is that this syscall should be considered
> >  as "never returning errors".
> syscalls do return errors!

What error can this particular syscall return? I see only one:
EINVAL, when user passed invalid pointer to "struct tms".
In this case, the program is buggy anyway.
It probably won't help one iota that libc will pass EINVAL
back in errno in this case. So why should we do that?

> >  The only programs which will see the difference are buggy already
> >  since they pass invalid pointer to kernel.
> The case I am interested in is when a valid pointer is passed in but
> the value of the low 32bits of jiffies_64 returned is being
> interpreted as an error.

Yes, I understand that.
I propose to fix it by interpreting all posiible return values
as non-errors.

More information about the uClibc mailing list