[Cbe-oss-dev] libspe: errno handling

Gerhard Stenzel gerhard.stenzel at de.ibm.com
Fri May 11 17:39:54 EST 2007


Hi Jeremy,

> Hi libspe-ers,
>
> We have a whole heap of this sort of construct in libspe:
>
>    priv->fd_spe_dir = spu_create(/* args omitted */);
>
>    if (priv->fd_spe_dir < 0) {
>       /* error handling code omitted*/
>       errno = EFAULT;
>       return NULL;
>    }
>
> ie, we overwrite the kernel's errno with something else.
>
> Is there a reason for this? generally, leaving errno as-is will give
> users a much better idea of what went wrong.
>

please see libspe spec, Chapter 1 Overview, page 1:
"The SPE Runtime Management Library (libspe) is the standardized low-level
application programming interface (API) that enables application access to
the Cell/B.E. SPEs. This library provides an API that is neutral with
respect to the underlying operating system and its methods to manage SPEs."

The "libspe on linux" implementation has to implement the libspe
specification, and this might sometimes include overwriting the kernel's
errno.

I think, a few simple guidelines apply here:
Where it is possible/necessary to change the implementation while still
staying within the specification, we can change it.
Where the implementation does not implement the specification, we have to
change the implementation, because it is a bug.
Where the specification does not fulfill our needs, we need to
change/extend the specification following the change process.

What do you think?

Best regards,

Gerhard Stenzel, Linux on Cell Development, LTC
-----------------------------------------------------------------------------------------------------------------------------------

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Herbert
Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart,
HRB 243294




More information about the cbe-oss-dev mailing list