#3857 closed defect (fixed)

Use EAGAIN for POSIX mq wait in ISR error

Reported by: Joel Sherrill Owned by: Joel Sherrill
Priority: normal Milestone: 5.1
Component: posix Version: 5
Severity: normal Keywords:
Cc: Martin Erik Werner Blocked By:
Blocking:

Description

POSIX message queues which are about to block in an ISR currently return ENOMEM. This is a status not listed by POSIX. The better status is EAGAIN per https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html.

Change History (3)

comment:1 Changed on Jan 24, 2020 at 2:48:59 PM by Joel Sherrill <joel@…>

In 565df31/rtems-docs:

posix-users/message_passing.rst: Add status for cannot block in ISR

Updates #3857.

comment:2 Changed on Jan 24, 2020 at 2:49:35 PM by Martin Erik Werner <martinerikwerner@…>

Resolution: fixed
Status: assignedclosed

In e225545/rtems:

Use EAGAIN for POSIX mq wait in ISR error

Modify the status code returned by _CORE_message_queue_Submit() when it
detects a wait about 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 API 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 Open Group:

[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 Open Group or the RTEMS POSIX uses documentation. A companion patch
corrects the documentation to include this error condition.

Based on the discussion in:
https://lists.rtems.org/pipermail/devel/2020-January/056891.html

closes #3857.

Message-Id: <CAF9ehCW5P12ZkZja4UPYTbdBFUyC1VKVL-tU7nyUtvK1Lz2Z3g@…>

comment:3 Changed on Feb 1, 2020 at 1:58:17 PM by Sebastian Huber <sebastian.huber@…>

In b4387313/rtems:

psxmsgq03: Adjust test case

Commit e22554535796fc29a7ed7c5e2338128e324a621d changed the error status
from ENOMEM to EAGAIN.

Update #3857.

Note: See TracTickets for help on using tickets.