[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] usleep MiNTlib function
On Tue, 2009-11-24 at 21:39 +0100, David Gálvez wrote:
> Hi all!
>
> MiNTlib function usleep( ) (/mintlib/posix/usleep.c) doesn't behave
> as expected under TOS.
>
> Function tries to use Fselect when time > 1000 microseconds, and
> _clock( ) when time is <1000 microseconds or when we are in a system
> without Fselect, as in TOS we don't have Fselect we get an ENOSYS(-32)
> error.
> Later in a "if" statement is compared the value returned by Fselect
> (under TOS value = -32) with "-ENOSYS" that will be 32 (-(-32) = 32),
> so the _clock function won't be called under TOS.
When you are in the MiNTlib, the errno's are positive which means that
ENOSYS is actually 32, so it's negated. This is correct.
> I think we should remove two minus signs, one in:
>
> int r = -ENOSYS (line 23)
>
> and other one in:
>
> if (r == -ENOSYS) (line 28)
Not sure I follow this logic at all.
When r = Fselect() and "r" becomes -32 when Fselect isn't available then
later we compare "r" which is already -32 against ENOSYS which is 32 so
that becomes -ENOSYS which becomes -32, again as mintlib defines
positive error codes so we negate because the kernel negates them
already.
It sounds like you are saying that calling Fselect() returns a positive
32 value which causes the later if (-32 == 32) test to fail. If that was
the case then the mintlib would be very broken as it uses these tests
all over the place.
I don't see a problem. Maybe you can demonstrate with the output of a
sample program to demonstrate what you are seeing ?
Alan.