Changeset 7d7c50de in rtems for cpukit/rtems/src/status.c


Ignore:
Timestamp:
May 25, 2018, 12:09:46 PM (19 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
b8774933
Parents:
75933d5d
git-author:
Sebastian Huber <sebastian.huber@…> (05/25/18 12:09:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/05/18 05:08:40)
Message:

rtems: Move _Status_Object_name_errors_to_status

Move _Status_Object_name_errors_to_status to a separate file to avoid a
dependency on errno. Dependencies to errno are hard to be removed by
the linker garbage collection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/status.c

    r75933d5d r7d7c50de  
    1515
    1616#include <rtems/rtems/statusimpl.h>
    17 #include <errno.h>
    1817
    1918const rtems_status_code _Status_Object_name_errors_to_status[] = {
     
    2928  RTEMS_INVALID_NODE
    3029};
    31 
    32 static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
    33   [RTEMS_SUCCESSFUL]               = 0,
    34   [RTEMS_TASK_EXITTED]             = EIO,
    35   [RTEMS_MP_NOT_CONFIGURED]        = EIO,
    36   [RTEMS_INVALID_NAME]             = EINVAL,
    37   [RTEMS_INVALID_ID]               = EIO,
    38   [RTEMS_TOO_MANY]                 = EIO,
    39   [RTEMS_TIMEOUT]                  = ETIMEDOUT,
    40   [RTEMS_OBJECT_WAS_DELETED]       = EIO,
    41   [RTEMS_INVALID_SIZE]             = EIO,
    42   [RTEMS_INVALID_ADDRESS]          = EIO,
    43   [RTEMS_INVALID_NUMBER]           = EBADF,
    44   [RTEMS_NOT_DEFINED]              = EIO,
    45   [RTEMS_RESOURCE_IN_USE]          = EBUSY,
    46   [RTEMS_UNSATISFIED]              = ENODEV,
    47   [RTEMS_INCORRECT_STATE]          = EIO,
    48   [RTEMS_ALREADY_SUSPENDED]        = EIO,
    49   [RTEMS_ILLEGAL_ON_SELF]          = EIO,
    50   [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
    51   [RTEMS_CALLED_FROM_ISR]          = EIO,
    52   [RTEMS_INVALID_PRIORITY]         = EIO,
    53   [RTEMS_INVALID_CLOCK]            = EINVAL,
    54   [RTEMS_INVALID_NODE]             = EINVAL,
    55   [RTEMS_NOT_CONFIGURED]           = ENOSYS,
    56   [RTEMS_NOT_OWNER_OF_RESOURCE]    = EPERM,
    57   [RTEMS_NOT_IMPLEMENTED]          = ENOSYS,
    58   [RTEMS_INTERNAL_ERROR]           = EIO,
    59   [RTEMS_NO_MEMORY]                = ENOMEM,
    60   [RTEMS_IO_ERROR]                 = EIO,
    61   [RTEMS_PROXY_BLOCKING]           = EIO
    62 };
    63 
    64 int rtems_status_code_to_errno(rtems_status_code sc)
    65 {
    66   if (sc == RTEMS_SUCCESSFUL) {
    67     return 0;
    68   } else {
    69     int eno = EINVAL;
    70 
    71     if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
    72       eno = status_code_to_errno [sc];
    73     }
    74 
    75     errno = eno;
    76 
    77     return -1;
    78   }
    79 }
Note: See TracChangeset for help on using the changeset viewer.