[PATCH] Use EAGAIN for POSIX mq wait in ISR error

Joel Sherrill joel at rtems.org
Fri Jan 24 14:50:23 UTC 2020


Thanks. I have pushed this along with a patch to add this as another error
cause in the POSIX Users Guide

On Sun, Jan 19, 2020 at 9:11 AM Martin Erik Werner <
martinerikwerner at gmail.com> wrote:

> Modify the status code returned by _CORE_message_queue_Submit() when it
> detects a wait bout to happen in an ISR (which would be deadly) to
> return a status which translated to EAGAIN instead of ENOMEM.
>
> (This is only relevant for POSIX message queues, since classic message
> queues cannot block on send.)
>
> The motivation is to match the "most related" errno value returned from
> mq_send() and mq_timedsend() according to POSIX, via opengroup
>
>   [EAGAIN]
>       The O_NONBLOCK flag is set in the message queue description
>       associated with mqdes, and the specified message queue is full.
>
> or via the RTEMS POSIX users documentation
>
>   EAGAIN
>     The message queue is non-blocking, and there is no room on the queue
>     for another message as specified by the mq_maxmsg.
>
> Neither of these matches the case ofi avoided ISR wait perfectly, but
> they seem to be the closest equivalent, unless it is desirable to keep a
> new non-standard error for this case. It is presumed that this is not
> desirable.
>
> The previously returned ENOMEM error value is not documented in either
> the opengroup or the RTEMS POSIX uses documentation.
>
> Based on the discussion in:
> https://lists.rtems.org/pipermail/devel/2020-January/056891.html
> Message-Id: <
> CAF9ehCW5P12ZkZja4UPYTbdBFUyC1VKVL-tU7nyUtvK1Lz2Z3g at mail.gmail.com>
> ---
>  cpukit/include/rtems/score/status.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cpukit/include/rtems/score/status.h
> b/cpukit/include/rtems/score/status.h
> index 34002559aa..fe1f0e87e6 100644
> --- a/cpukit/include/rtems/score/status.h
> +++ b/cpukit/include/rtems/score/status.h
> @@ -90,7 +90,7 @@ typedef enum {
>    STATUS_MESSAGE_INVALID_SIZE =
>      STATUS_BUILD( STATUS_CLASSIC_INVALID_SIZE, EMSGSIZE ),
>    STATUS_MESSAGE_QUEUE_WAIT_IN_ISR =
> -    STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, ENOMEM ),
> +    STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EAGAIN ),
>    STATUS_MESSAGE_QUEUE_WAS_DELETED =
>      STATUS_BUILD( STATUS_CLASSIC_OBJECT_WAS_DELETED, EBADF ),
>    STATUS_MINUS_ONE =
> --
> 2.20.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200124/e463bb1a/attachment.html>


More information about the devel mailing list