The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/cloudabi/cloudabi_errno.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2015 Nuxi, https://nuxi.nl/
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  */
   25 
   26 #include <sys/cdefs.h>
   27 __FBSDID("$FreeBSD$");
   28 
   29 #include <sys/param.h>
   30 
   31 #include <contrib/cloudabi/cloudabi_types_common.h>
   32 
   33 #include <compat/cloudabi/cloudabi_util.h>
   34 
   35 /* Converts a FreeBSD errno to a CloudABI errno. */
   36 cloudabi_errno_t
   37 cloudabi_convert_errno(int error)
   38 {
   39         static const int table[] = {
   40                 [E2BIG]                 = CLOUDABI_E2BIG,
   41                 [EACCES]                = CLOUDABI_EACCES,
   42                 [EADDRINUSE]            = CLOUDABI_EADDRINUSE,
   43                 [EADDRNOTAVAIL]         = CLOUDABI_EADDRNOTAVAIL,
   44                 [EAFNOSUPPORT]          = CLOUDABI_EAFNOSUPPORT,
   45                 [EAGAIN]                = CLOUDABI_EAGAIN,
   46                 [EALREADY]              = CLOUDABI_EALREADY,
   47                 [EBADF]                 = CLOUDABI_EBADF,
   48                 [EBADMSG]               = CLOUDABI_EBADMSG,
   49                 [EBUSY]                 = CLOUDABI_EBUSY,
   50                 [ECANCELED]             = CLOUDABI_ECANCELED,
   51                 [ECHILD]                = CLOUDABI_ECHILD,
   52                 [ECONNABORTED]          = CLOUDABI_ECONNABORTED,
   53                 [ECONNREFUSED]          = CLOUDABI_ECONNREFUSED,
   54                 [ECONNRESET]            = CLOUDABI_ECONNRESET,
   55                 [EDEADLK]               = CLOUDABI_EDEADLK,
   56                 [EDESTADDRREQ]          = CLOUDABI_EDESTADDRREQ,
   57                 [EDOM]                  = CLOUDABI_EDOM,
   58                 [EDQUOT]                = CLOUDABI_EDQUOT,
   59                 [EEXIST]                = CLOUDABI_EEXIST,
   60                 [EFAULT]                = CLOUDABI_EFAULT,
   61                 [EFBIG]                 = CLOUDABI_EFBIG,
   62                 [EHOSTUNREACH]          = CLOUDABI_EHOSTUNREACH,
   63                 [EIDRM]                 = CLOUDABI_EIDRM,
   64                 [EILSEQ]                = CLOUDABI_EILSEQ,
   65                 [EINPROGRESS]           = CLOUDABI_EINPROGRESS,
   66                 [EINTR]                 = CLOUDABI_EINTR,
   67                 [EINVAL]                = CLOUDABI_EINVAL,
   68                 [EIO]                   = CLOUDABI_EIO,
   69                 [EISCONN]               = CLOUDABI_EISCONN,
   70                 [EISDIR]                = CLOUDABI_EISDIR,
   71                 [ELOOP]                 = CLOUDABI_ELOOP,
   72                 [EMFILE]                = CLOUDABI_EMFILE,
   73                 [EMLINK]                = CLOUDABI_EMLINK,
   74                 [EMSGSIZE]              = CLOUDABI_EMSGSIZE,
   75                 [EMULTIHOP]             = CLOUDABI_EMULTIHOP,
   76                 [ENAMETOOLONG]          = CLOUDABI_ENAMETOOLONG,
   77                 [ENETDOWN]              = CLOUDABI_ENETDOWN,
   78                 [ENETRESET]             = CLOUDABI_ENETRESET,
   79                 [ENETUNREACH]           = CLOUDABI_ENETUNREACH,
   80                 [ENFILE]                = CLOUDABI_ENFILE,
   81                 [ENOBUFS]               = CLOUDABI_ENOBUFS,
   82                 [ENODEV]                = CLOUDABI_ENODEV,
   83                 [ENOENT]                = CLOUDABI_ENOENT,
   84                 [ENOEXEC]               = CLOUDABI_ENOEXEC,
   85                 [ENOLCK]                = CLOUDABI_ENOLCK,
   86                 [ENOLINK]               = CLOUDABI_ENOLINK,
   87                 [ENOMEM]                = CLOUDABI_ENOMEM,
   88                 [ENOMSG]                = CLOUDABI_ENOMSG,
   89                 [ENOPROTOOPT]           = CLOUDABI_ENOPROTOOPT,
   90                 [ENOSPC]                = CLOUDABI_ENOSPC,
   91                 [ENOSYS]                = CLOUDABI_ENOSYS,
   92                 [ENOTCONN]              = CLOUDABI_ENOTCONN,
   93                 [ENOTDIR]               = CLOUDABI_ENOTDIR,
   94                 [ENOTEMPTY]             = CLOUDABI_ENOTEMPTY,
   95                 [ENOTRECOVERABLE]       = CLOUDABI_ENOTRECOVERABLE,
   96                 [ENOTSOCK]              = CLOUDABI_ENOTSOCK,
   97                 [ENOTSUP]               = CLOUDABI_ENOTSUP,
   98                 [ENOTTY]                = CLOUDABI_ENOTTY,
   99                 [ENXIO]                 = CLOUDABI_ENXIO,
  100                 [EOVERFLOW]             = CLOUDABI_EOVERFLOW,
  101                 [EOWNERDEAD]            = CLOUDABI_EOWNERDEAD,
  102                 [EPERM]                 = CLOUDABI_EPERM,
  103                 [EPIPE]                 = CLOUDABI_EPIPE,
  104                 [EPROTO]                = CLOUDABI_EPROTO,
  105                 [EPROTONOSUPPORT]       = CLOUDABI_EPROTONOSUPPORT,
  106                 [EPROTOTYPE]            = CLOUDABI_EPROTOTYPE,
  107                 [ERANGE]                = CLOUDABI_ERANGE,
  108                 [EROFS]                 = CLOUDABI_EROFS,
  109                 [ESPIPE]                = CLOUDABI_ESPIPE,
  110                 [ESRCH]                 = CLOUDABI_ESRCH,
  111                 [ESTALE]                = CLOUDABI_ESTALE,
  112                 [ETIMEDOUT]             = CLOUDABI_ETIMEDOUT,
  113                 [ETXTBSY]               = CLOUDABI_ETXTBSY,
  114                 [EXDEV]                 = CLOUDABI_EXDEV,
  115                 [ENOTCAPABLE]           = CLOUDABI_ENOTCAPABLE,
  116         };
  117 
  118         /* Unknown error: fall back to returning ENOSYS. */
  119         if (error < 0 || error >= nitems(table) || table[error] == 0)
  120                 return (error == 0 ? 0 : CLOUDABI_ENOSYS);
  121         return (table[error]);
  122 }

Cache object: f409d31971c66483ec2d82058e194180


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.