source: rtems/cpukit/libfs/src/imfs/deviceerrno.c @ 78d1190

4.115
Last change on this file since 78d1190 was 78d1190, checked in by Joel Sherrill <joel.sherrill@…>, on 03/14/11 at 16:24:00

2011-03-14 Joel Sherrill <joel.sherrill@…>

  • libfs/src/imfs/deviceerrno.c: Add RTEMS_INVALID_CLOCK, RTEMS_INVALID_NODE, and RTEMS_NOT_CONFIGURED.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  IMFS Device Node Handlers
3 *
4 *  This file contains the set of handlers used to map operations on
5 *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
6 *
7 *  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <errno.h>
22
23#include <rtems.h>
24#include <rtems/libio.h>
25
26static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
27  [RTEMS_SUCCESSFUL]               = 0,
28  [RTEMS_TASK_EXITTED]             = EIO,
29  [RTEMS_MP_NOT_CONFIGURED]        = EIO,
30  [RTEMS_INVALID_NAME]             = EINVAL,
31  [RTEMS_INVALID_ID]               = EIO,
32  [RTEMS_TOO_MANY]                 = EIO,
33  [RTEMS_TIMEOUT]                  = ETIMEDOUT,
34  [RTEMS_OBJECT_WAS_DELETED]       = EIO,
35  [RTEMS_INVALID_SIZE]             = EIO,
36  [RTEMS_INVALID_ADDRESS]          = EIO,
37  [RTEMS_INVALID_NUMBER]           = EBADF,
38  [RTEMS_NOT_DEFINED]              = EIO,
39  [RTEMS_RESOURCE_IN_USE]          = EBUSY,
40  [RTEMS_UNSATISFIED]              = ENODEV,
41  [RTEMS_INCORRECT_STATE]          = EIO,
42  [RTEMS_ALREADY_SUSPENDED]        = EIO,
43  [RTEMS_ILLEGAL_ON_SELF]          = EIO,
44  [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
45  [RTEMS_CALLED_FROM_ISR]          = EIO,
46  [RTEMS_INVALID_PRIORITY]         = EIO,
47  [RTEMS_INVALID_CLOCK]            = EINVAL,
48  [RTEMS_INVALID_NODE]             = EINVAL,
49  [RTEMS_NOT_CONFIGURED]           = ENOSYS,
50  [RTEMS_NOT_OWNER_OF_RESOURCE]    = EPERM,
51  [RTEMS_NOT_IMPLEMENTED]          = ENOSYS,
52  [RTEMS_INTERNAL_ERROR]           = EIO,
53  [RTEMS_NO_MEMORY]                = ENOMEM,
54  [RTEMS_IO_ERROR]                 = EIO,
55  [RTEMS_PROXY_BLOCKING]           = EIO
56};
57
58int rtems_deviceio_errno(rtems_status_code sc)
59{
60  if (sc == RTEMS_SUCCESSFUL) {
61    return 0;
62  } else {
63    int eno = EINVAL;
64
65    if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
66      eno = status_code_to_errno [sc];
67    }
68
69    errno = eno;
70
71    return -1;
72  }
73}
Note: See TracBrowser for help on using the repository browser.