Notice: We have migrated to GitLab launching 2024-05-01 see here:

#4506 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: 6.1
Component: posix Version: 6
Severity: normal Keywords:
Cc: Blocked By:

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/21/21 at 19:25:36 by Joel Sherrill

Description: modified (diff)

comment:2 Changed on 09/20/21 at 18:37:56 by Ryan Long <ryan.long@…>

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

In [changeset:"3951d4da6fc4885dd450e5257d7273ab6a392492/rtems" 3951d4d/rtems]:

pxcdevctl: Adjust for standard

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 #4506

Note: See TracTickets for help on using tickets.