times(2) sys call bug?

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Nov 21 19:31:25 EST 2008


On Fri, 2008-11-21 at 10:52 +1100, Paul Mackerras wrote:
> Joakim Tjernlund writes:
> 
> > This little hack changes the kernel sys call handling in an crude
> > way and then it works. Apperently the kernel thinks is an error if the
> > syscall returns a value between -_LAST_ERRNO and -1.
> 
> Try this patch and let me if it fixes it.  If it does I'll push it
> upstream.
> 

It does fix the problem, thanks. You might want to do the same
to time(2)?
This workaround lets you get around the times(2) problem. Perhaps
you want to mention it in the commit msg:

static clock_t
our_times(void)        /* Make times(2) behave rationally on Linux */
{
	clock_t ret;

	errno   = 0;
	ret     = times(NULL);
	if (errno != 0)
		ret = (clock_t) (-errno);
	return ret;
}



More information about the Linuxppc-dev mailing list