On Thursday 08 November 2007 02:09, David Miller wrote:
What error? I'd argue it's perfectly sane for application to
assume that times() never fails.
struct tms t;
clock_t start = times(&t);
...
clock_t end = times(&t);
clock_t delta = end - start;
The only error form kernel POV is that passed pointer can be
invalid. But from application POV in the above example it
cannot be true and
if (start == -1)
error("error in times!");
would be and exercise in wasting CPU cycles, producing dead code
and feeding one's paranoia.
And in all realistic scenarios it doesn't need to.
In this particular case, it makes sense to ignore standards and
never return an error. If user indeed passed invalid pointer,
just don't store anything there, but still return valid value.
--
vda
-