POSIX and return codes...

Joel Sherrill joel at rtems.org
Mon Feb 26 11:21:48 UTC 2018


On Feb 26, 2018 5:13 AM, "Jakob Viketoft" <jakob.viketoft at aacmicrotec.com>
wrote:

Hello!

We have a number of drivers in our BSP which all use the POSIX access
methods to try and keep a clean interface etc. However, we also seem to
stumble into a return error code translation issue. RTEMS seems to have a
very few defined errno's and translate the relatively scarce amount of
RTEMS error codes into an even sparser selection of errno codes.

We would like our drivers to be a bit communicative when encountering an
error and the available error codes are very few due to the translation
happening. Is there some way of forwarding a wider variety of errno numbers?

E.g. could it be possible for the translation mechanism to look if there is
already an errno defined and then return this instead of doing the error
code translation?

It seems like the translation I'm talking about happens in the
rtems_deviceio_write() function in cpukit/libcsupport/src/sup_fs_deviceio.c

Are we doing it wrong or could there be some amendments to allow for bigger
freedom here? All suggestions are appreciated.


Completely random thought as I sit on a plane without code.

Add a field to the arguments structure for errno. See it to zero before the
call. If it is set to non-zero after the call, then the driver wanted to
return errno directly. Otherwise translate.

A middle step is to see if any of the unused RTEMS status codes make sense
to use and cover your use cases.


We're currently running 4.11, but will probably move up to 5 soonish.

        /Jakob
_______________________________________________
devel mailing list
devel at rtems.org
http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180226/41d612bf/attachment-0002.html>


More information about the devel mailing list