<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Feb 26, 2018 8:27 AM, "Jakob Viketoft" <<a href="mailto:jakob.viketoft@aacmicrotec.com">jakob.viketoft@aacmicrotec.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Joel,<br>
<br>
From: Joel Sherrill [<a href="mailto:joel@rtems.org">joel@rtems.org</a>]<br>
Sent: Monday, February 26, 2018 12:21<br>
<div class="quoted-text"><br>
> On Feb 26, 2018 5:13 AM, "Jakob Viketoft" <<a href="mailto:jakob.viketoft@aacmicrotec.com">jakob.viketoft@aacmicrotec.<wbr>com</a>> wrote:<br>
</div><div class="quoted-text">>> 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?<br>
<br>
>> It seems like the translation I'm talking about happens in the rtems_deviceio_write() function in cpukit/libcsupport/src/sup_fs_<wbr>deviceio.c<br>
<br>
</div><div class="quoted-text">> Completely random thought as I sit on a plane without code.<br>
<br>
> 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.<br>
<br>
</div>This was my thought as well, I just wanted to bounce it off the RTEMS list and also possibly get official support for a feature as this.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Now boarded on a different plane and have had another round of thinking.</div><div dir="auto"><br></div><div dir="auto">What if an RTEMS status code were added like RTEMS_STATUS_IN_ERRNO and we don't modify the arguments structure. Then a driver could return that status to trip -1 and errno.</div><div dir="auto"><br></div><div dir="auto">Just a thought. I think it would make the code cleaner but another core developer should pipe up. I was up at 3am to catch a flight and could be loopy. :)</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="quoted-text"><br>
> A middle step is to see if any of the unused RTEMS status codes make sense to use and cover your use cases.<br>
<br>
</div>This is the way we do it today. Unfortunately, so many of the different RTEMS codes are translated into the same errno codes which makes it very hard to have an intelligent error reporting/differentiation.<br>
<font color="#888888"><br>
/Jakob</font></blockquote></div><br></div></div></div>