#4505 closed defect (fixed)

posix_devctl() should return the errno directly not -1 and set errno

Reported by: Joel Sherrill Owned by: Ryan Long <ryan.long@…>
Priority: normal Milestone: 5.2
Component: posix Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Joel Sherrill)

The RTEMS implementation of posix_devctl() from POSIX 1003.26 does not return error codes as required by the standard.

"Upon successful completion, posix_devctl() shall return zero; otherwise an error number shall be returned to indicate the error. The value returned via the dev_info_ptr argument is driver dependent."

It should return the errno value and not -1 and set the errno variable. The current behavior is wrong but understandable because the implementation is a wrapper for close() and ioctl() which do set errno and return -1.

Change History (2)

comment:1 Changed on 08/24/21 at 18:35:37 by Joel Sherrill

Description: modified (diff)

comment:2 Changed on 09/20/21 at 19:08:11 by Ryan Long <ryan.long@…>

Owner: set to Ryan Long <ryan.long@…>
Resolution: fixed
Status: newclosed

In e9712e78/rtems:

pxcdevctl: Adjust for standard (5 branch)

psxdevctl is supposed to return the value in errno. Before, it was
returning -1 and setting errno. Changed the tests to reflect these
changes. Added code from RRADE's posix_devctl.c.

Closes #4505

Note: See TracTickets for help on using tickets.