/* * IMFS Device Node Handlers * * This file contains the set of handlers used to map operations on * IMFS device nodes onto calls to the RTEMS Classic API IO Manager. * * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id$ */ #if HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* assoc.h not included by rtems.h */ #include /* * Convert RTEMS status to a UNIX errno */ const rtems_assoc_t errno_assoc[] = { { "OK", RTEMS_SUCCESSFUL, 0 }, { "BUSY", RTEMS_RESOURCE_IN_USE, EBUSY }, { "INVALID NAME", RTEMS_INVALID_NAME, EINVAL }, { "NOT IMPLEMENTED", RTEMS_NOT_IMPLEMENTED, ENOSYS }, { "TIMEOUT", RTEMS_TIMEOUT, ETIMEDOUT }, { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM }, { "NO DEVICE", RTEMS_UNSATISFIED, ENODEV }, { "INVALID NUMBER", RTEMS_INVALID_NUMBER, EBADF}, { "NOT RESOURCE OWNER", RTEMS_NOT_OWNER_OF_RESOURCE, EPERM}, { "IO ERROR", RTEMS_IO_ERROR, EIO}, { 0, 0, 0 }, }; int rtems_deviceio_errno(rtems_status_code code) { int rc; if ((rc = rtems_assoc_remote_by_local(errno_assoc, (uint32_t ) code))) { errno = rc; return -1; } return -1; }