VirtualBox

Ignore:
Timestamp:
Aug 6, 2022 12:20:33 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152872
Message:

IPRT/nocrt: strerror; atexit fix. bugref:10261

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/err/nocrt-strerror.cpp

    r96039 r96073  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Convert errno to iprt status codes.
     3 * IPRT - No-CRT - Convert errno value to string.
    44 */
    55
     
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
    31 #include <iprt/err.h>
    32 #include "internal/iprt.h"
    33 
    34 #include <iprt/log.h>
     31#define IPRT_NO_CRT_FOR_3RD_PARTY
     32#include "internal/nocrt.h"
     33#include <iprt/nocrt/string.h>
     34#include <iprt/nocrt/errno.h>
    3535#include <iprt/assert.h>
    36 #include <iprt/errno.h>
    37 
    38 
    39 RTDECL(int)  RTErrConvertFromErrno(int iNativeCode)
     36
     37
     38#undef strerror
     39const char *RT_NOCRT(strerror)(int iErrNo)
    4040{
    41     /* very fast check for no error. */
    42     if (iNativeCode == 0)
    43         return VINF_SUCCESS;
    44 
    4541    /*
    4642     * Process error codes.
     
    5046     *
    5147     * This switch is arranged like the Linux i386 errno.h! This switch is mirrored
    52      * by RTErrConvertToErrno.
     48     * by RTErrConvertToErrno and RTErrConvertFromErrno.
    5349     */
    54     switch (iNativeCode)
     50    switch (iErrNo)
    5551    {                                                                           /* Linux number */
     52        case 0: return "no error";
    5653#ifdef EPERM
    57         case EPERM:             return VERR_ACCESS_DENIED;                      /*   1 */
     54        RT_CASE_RET_STR(EPERM);                      /*   1 */
    5855#endif
    5956#ifdef ENOENT
    60         case ENOENT:            return VERR_FILE_NOT_FOUND;
     57        RT_CASE_RET_STR(ENOENT);
    6158#endif
    6259#ifdef ESRCH
    63         case ESRCH:             return VERR_PROCESS_NOT_FOUND;
     60        RT_CASE_RET_STR(ESRCH);
    6461#endif
    6562#ifdef EINTR
    66         case EINTR:             return VERR_INTERRUPTED;
     63        RT_CASE_RET_STR(EINTR);
    6764#endif
    6865#ifdef EIO
    69         case EIO:               return VERR_DEV_IO_ERROR;
     66        RT_CASE_RET_STR(EIO);
    7067#endif
    7168#ifdef ENXIO
    72         case ENXIO:             return VERR_DEV_IO_ERROR; /** @todo fix this duplicate error */
     69        RT_CASE_RET_STR(ENXIO); /** @todo fix this duplicate error */
    7370#endif
    7471#ifdef E2BIG
    75         case E2BIG:             return VERR_TOO_MUCH_DATA;
     72        RT_CASE_RET_STR(E2BIG);
    7673#endif
    7774#ifdef ENOEXEC
    78         case ENOEXEC:           return VERR_BAD_EXE_FORMAT;
     75        RT_CASE_RET_STR(ENOEXEC);
    7976#endif
    8077#ifdef EBADF
    81         case EBADF:             return VERR_INVALID_HANDLE;
     78        RT_CASE_RET_STR(EBADF);
    8279#endif
    8380#ifdef ECHILD
    84         case ECHILD:            return VERR_PROCESS_NOT_FOUND;                  /*  10 */ /** @todo fix duplicate error */
     81        RT_CASE_RET_STR(ECHILD);                  /*  10 */ /** @todo fix duplicate error */
    8582#endif
    8683#ifdef EAGAIN
    87         case EAGAIN:            return VERR_TRY_AGAIN;
     84        RT_CASE_RET_STR(EAGAIN);
    8885#endif
    8986#ifdef ENOMEM
    90         case ENOMEM:            return VERR_NO_MEMORY;
     87        RT_CASE_RET_STR(ENOMEM);
    9188#endif
    9289#ifdef EACCES
    93         case EACCES:            return VERR_ACCESS_DENIED; /** @todo fix duplicate error */
     90        RT_CASE_RET_STR(EACCES); /** @todo fix duplicate error */
    9491#endif
    9592#ifdef EFAULT
    96         case EFAULT:            return VERR_INVALID_POINTER;
     93        RT_CASE_RET_STR(EFAULT);
    9794#endif
    9895#ifdef ENOTBLK
    99         //case ENOTBLK:           return VERR_;
     96        RT_CASE_RET_STR(ENOTBLK);
    10097#endif
    10198#ifdef EBUSY
    102         case EBUSY:             return VERR_RESOURCE_BUSY;
     99        RT_CASE_RET_STR(EBUSY);
    103100#endif
    104101#ifdef EEXIST
    105         case EEXIST:            return VERR_ALREADY_EXISTS;
     102        RT_CASE_RET_STR(EEXIST);
    106103#endif
    107104#ifdef EXDEV
    108         case EXDEV:             return VERR_NOT_SAME_DEVICE;
     105        RT_CASE_RET_STR(EXDEV);
    109106#endif
    110107#ifdef ENODEV
    111         case ENODEV:            return VERR_NOT_SUPPORTED; /** @todo fix duplicate error */
     108        RT_CASE_RET_STR(ENODEV); /** @todo fix duplicate error */
    112109#endif
    113110#ifdef ENOTDIR
    114         case ENOTDIR:           return VERR_PATH_NOT_FOUND;                     /*  20 */
     111        RT_CASE_RET_STR(ENOTDIR);                     /*  20 */
    115112#endif
    116113#ifdef EISDIR
    117         case EISDIR:            return VERR_IS_A_DIRECTORY;
     114        RT_CASE_RET_STR(EISDIR);
    118115#endif
    119116#ifdef EINVAL
    120         case EINVAL:            return VERR_INVALID_PARAMETER;
     117        RT_CASE_RET_STR(EINVAL);
    121118#endif
    122119#ifdef ENFILE
    123         case ENFILE:            return VERR_TOO_MANY_OPEN_FILES; /** @todo fix duplicate error */
     120        RT_CASE_RET_STR(ENFILE); /** @todo fix duplicate error */
    124121#endif
    125122#ifdef EMFILE
    126         case EMFILE:            return VERR_TOO_MANY_OPEN_FILES;
     123        RT_CASE_RET_STR(EMFILE);
    127124#endif
    128125#ifdef ENOTTY
    129         case ENOTTY:            return VERR_INVALID_FUNCTION;
     126        RT_CASE_RET_STR(ENOTTY);
    130127#endif
    131128#ifdef ETXTBSY
    132         case ETXTBSY:           return VERR_SHARING_VIOLATION;
     129        RT_CASE_RET_STR(ETXTBSY);
    133130#endif
    134131#ifdef EFBIG
    135         case EFBIG:             return VERR_FILE_TOO_BIG;
     132        RT_CASE_RET_STR(EFBIG);
    136133#endif
    137134#ifdef ENOSPC
    138         case ENOSPC:            return VERR_DISK_FULL;
     135        RT_CASE_RET_STR(ENOSPC);
    139136#endif
    140137#ifdef ESPIPE
    141         case ESPIPE:            return VERR_SEEK_ON_DEVICE;
     138        RT_CASE_RET_STR(ESPIPE);
    142139#endif
    143140#ifdef EROFS
    144         case EROFS:             return VERR_WRITE_PROTECT;                      /*  30 */
     141        RT_CASE_RET_STR(EROFS);                      /*  30 */
    145142#endif
    146143#ifdef EMLINK
    147         //case EMLINK:
     144         RT_CASE_RET_STR(EMLINK);
    148145#endif
    149146#ifdef EPIPE
    150         case EPIPE:             return VERR_BROKEN_PIPE;
     147        RT_CASE_RET_STR(EPIPE);
    151148#endif
    152149#ifdef EDOM
    153         case EDOM:              return VERR_INVALID_PARAMETER;  /** @todo fix duplicate error */
     150        RT_CASE_RET_STR(EDOM);  /** @todo fix duplicate error */
    154151#endif
    155152#ifdef ERANGE
    156         case ERANGE:            return VERR_INVALID_PARAMETER;  /** @todo fix duplicate error */
     153        RT_CASE_RET_STR(ERANGE);  /** @todo fix duplicate error */
    157154#endif
    158155#ifdef EDEADLK
    159         case EDEADLK:           return VERR_DEADLOCK;
     156        RT_CASE_RET_STR(EDEADLK);
    160157#endif
    161158#ifdef ENAMETOOLONG
    162         case ENAMETOOLONG:      return VERR_FILENAME_TOO_LONG;
     159        RT_CASE_RET_STR(ENAMETOOLONG);
    163160#endif
    164161#ifdef ENOLCK
    165         case ENOLCK:            return VERR_FILE_LOCK_FAILED;
     162        RT_CASE_RET_STR(ENOLCK);
    166163#endif
    167164#ifdef ENOSYS /** @todo map this differently on solaris. */
    168         case ENOSYS:            return VERR_NOT_SUPPORTED;
     165        RT_CASE_RET_STR(ENOSYS);
    169166#endif
    170167#ifdef ENOTEMPTY
    171         case ENOTEMPTY:         return VERR_DIR_NOT_EMPTY;
     168        RT_CASE_RET_STR(ENOTEMPTY);
    172169#endif
    173170#ifdef ELOOP
    174         case ELOOP:             return VERR_TOO_MANY_SYMLINKS;                  /*  40 */
     171        RT_CASE_RET_STR(ELOOP);                  /*  40 */
    175172#endif
    176173        //41??
    177174#ifdef ENOMSG
    178         //case ENOMSG           42      /* No message of desired type */
     175        RT_CASE_RET_STR(ENOMSG);
    179176#endif
    180177#ifdef EIDRM
    181         //case EIDRM            43      /* Identifier removed */
     178        RT_CASE_RET_STR(EIDRM);
    182179#endif
    183180#ifdef ECHRNG
    184         //case ECHRNG           44      /* Channel number out of range */
     181        RT_CASE_RET_STR(ECHRNG);
    185182#endif
    186183#ifdef EL2NSYNC
    187         //case EL2NSYNC 45      /* Level 2 not synchronized */
     184        RT_CASE_RET_STR(EL2NSYNC);
    188185#endif
    189186#ifdef EL3HLT
    190         //case EL3HLT           46      /* Level 3 halted */
     187        RT_CASE_RET_STR(EL3HLT);
    191188#endif
    192189#ifdef EL3RST
    193         //case EL3RST           47      /* Level 3 reset */
     190        RT_CASE_RET_STR(EL3RST);
    194191#endif
    195192#ifdef ELNRNG
    196         //case ELNRNG           48      /* Link number out of range */
     193        RT_CASE_RET_STR(ELNRNG);
    197194#endif
    198195#ifdef EUNATCH
    199         //case EUNATCH          49      /* Protocol driver not attached */
     196        RT_CASE_RET_STR(EUNATCH);
    200197#endif
    201198#ifdef ENOCSI
    202         //case ENOCSI           50      /* No CSI structure available */
     199        RT_CASE_RET_STR(ENOCSI);
    203200#endif
    204201#ifdef EL2HLT
    205         //case EL2HLT           51      /* Level 2 halted */
     202        RT_CASE_RET_STR(EL2HLT);
    206203#endif
    207204#ifdef EBADE
    208         //case EBADE            52      /* Invalid exchange */
     205        RT_CASE_RET_STR(EBADE);
    209206#endif
    210207#ifdef EBADR
    211         //case EBADR            53      /* Invalid request descriptor */
     208        RT_CASE_RET_STR(EBADR);
    212209#endif
    213210#ifdef EXFULL
    214         //case EXFULL           54      /* Exchange full */
     211        RT_CASE_RET_STR(EXFULL);
    215212#endif
    216213#ifdef ENOANO
    217         //case ENOANO           55      /* No anode */
     214        RT_CASE_RET_STR(ENOANO);
    218215#endif
    219216#ifdef EBADRQC
    220         //case EBADRQC          56      /* Invalid request code */
     217        RT_CASE_RET_STR(EBADRQC);
    221218#endif
    222219#ifdef EBADSLT
    223         //case EBADSLT          57      /* Invalid slot */
     220        RT_CASE_RET_STR(EBADSLT);
    224221#endif
    225222        //case 58:
    226223#ifdef EBFONT
    227         //case EBFONT           59      /* Bad font file format */
     224        RT_CASE_RET_STR(EBFONT);
    228225#endif
    229226#ifdef ENOSTR
    230         //case ENOSTR           60      /* Device not a stream */
     227        RT_CASE_RET_STR(ENOSTR);
    231228#endif
    232229#ifdef ENODATA
    233         case ENODATA:           return  VERR_NO_DATA;
     230        RT_CASE_RET_STR(ENODATA);
    234231#endif
    235232#ifdef ETIME
    236         //case ETIME            62      /* Timer expired */
     233        RT_CASE_RET_STR(ETIME);
    237234#endif
    238235#ifdef ENOSR
    239         //case ENOSR            63      /* Out of streams resources */
     236        RT_CASE_RET_STR(ENOSR);
    240237#endif
    241238#ifdef ENONET
    242         case ENONET:            return VERR_NET_NO_NETWORK;
     239        RT_CASE_RET_STR(ENONET);
    243240#endif
    244241#ifdef ENOPKG
    245         //case ENOPKG           65      /* Package not installed */
     242        RT_CASE_RET_STR(ENOPKG);
    246243#endif
    247244#ifdef EREMOTE
    248         //case EREMOTE          66      /* Object is remote */
     245        RT_CASE_RET_STR(EREMOTE);
    249246#endif
    250247#ifdef ENOLINK
    251         //case ENOLINK          67      /* Link has been severed */
     248        RT_CASE_RET_STR(ENOLINK);
    252249#endif
    253250#ifdef EADV
    254         //case EADV             68      /* Advertise error */
     251        RT_CASE_RET_STR(EADV);
    255252#endif
    256253#ifdef ESRMNT
    257         //case ESRMNT           69      /* Srmount error */
     254        RT_CASE_RET_STR(ESRMNT);
    258255#endif
    259256#ifdef ECOMM
    260         //case ECOMM            70      /* Communication error on send */
     257        RT_CASE_RET_STR(ECOMM);
    261258#endif
    262259#ifdef EPROTO
    263         case EPROTO:            return VERR_NET_PROTOCOL_ERROR;
     260        RT_CASE_RET_STR(EPROTO);
    264261#endif
    265262#ifdef EMULTIHOP
    266         //case EMULTIHOP        72      /* Multihop attempted */
     263        RT_CASE_RET_STR(EMULTIHOP);
    267264#endif
    268265#ifdef EDOTDOT
    269         //case EDOTDOT          73      /* RFS specific error */
     266        RT_CASE_RET_STR(EDOTDOT);
    270267#endif
    271268#ifdef EBADMSG
    272         //case EBADMSG          74      /* Not a data message */
     269        RT_CASE_RET_STR(EBADMSG);
    273270#endif
    274271#ifdef EOVERFLOW
    275         case EOVERFLOW:         return VERR_TOO_MUCH_DATA;   /** @todo fix duplicate error */
     272        RT_CASE_RET_STR(EOVERFLOW); /** @todo fix duplicate error? */
    276273#endif
    277274#ifdef ENOTUNIQ
    278         case ENOTUNIQ:          return VERR_NET_NOT_UNIQUE_NAME;
     275        RT_CASE_RET_STR(ENOTUNIQ);
    279276#endif
    280277#ifdef EBADFD
    281         case EBADFD:            return VERR_INVALID_HANDLE; /** @todo fix duplicate error? */
     278        RT_CASE_RET_STR(EBADFD); /** @todo fix duplicate error? */
    282279#endif
    283280#ifdef EREMCHG
    284         //case EREMCHG          78      /* Remote address changed */
     281        RT_CASE_RET_STR(EREMCHG);
    285282#endif
    286283#ifdef ELIBACC
    287         //case ELIBACC          79      /* Can not access a needed shared library */
     284        RT_CASE_RET_STR(ELIBACC);
    288285#endif
    289286#ifdef ELIBBAD
    290         //case ELIBBAD          80      /* Accessing a corrupted shared library */
     287        RT_CASE_RET_STR(ELIBBAD);
    291288#endif
    292289#ifdef ELIBSCN
    293         //case ELIBSCN          81      /* .lib section in a.out corrupted */
     290        RT_CASE_RET_STR(ELIBSCN);
    294291#endif
    295292#ifdef ELIBMAX
    296         //case ELIBMAX          82      /* Attempting to link in too many shared libraries */
     293        RT_CASE_RET_STR(ELIBMAX);
    297294#endif
    298295#ifdef ELIBEXEC
    299         //case ELIBEXEC 83      /* Cannot exec a shared library directly */
     296        RT_CASE_RET_STR(ELIBEXEC);
    300297#endif
    301298#ifdef EILSEQ
    302         case EILSEQ:            return VERR_NO_TRANSLATION;
     299        RT_CASE_RET_STR(EILSEQ);
    303300#endif
    304301#ifdef ERESTART
    305         case ERESTART:          return VERR_INTERRUPTED;/** @todo fix duplicate error?*/
     302        RT_CASE_RET_STR(ERESTART);/** @todo fix duplicate error?*/
    306303#endif
    307304#ifdef ESTRPIPE
    308         //case ESTRPIPE 86      /* Streams pipe error */
     305        RT_CASE_RET_STR(ESTRPIPE);
    309306#endif
    310307#ifdef EUSERS
    311         //case EUSERS           87      /* Too many users */
     308        RT_CASE_RET_STR(EUSERS);
    312309#endif
    313310#ifdef ENOTSOCK
    314         case ENOTSOCK:          return VERR_NET_NOT_SOCKET;
     311        RT_CASE_RET_STR(ENOTSOCK);
    315312#endif
    316313#ifdef EDESTADDRREQ
    317         case EDESTADDRREQ:      return VERR_NET_DEST_ADDRESS_REQUIRED;
     314        RT_CASE_RET_STR(EDESTADDRREQ);
    318315#endif
    319316#ifdef EMSGSIZE
    320         case EMSGSIZE:          return VERR_NET_MSG_SIZE;
     317        RT_CASE_RET_STR(EMSGSIZE);
    321318#endif
    322319#ifdef EPROTOTYPE
    323         case EPROTOTYPE:        return VERR_NET_PROTOCOL_TYPE;
     320        RT_CASE_RET_STR(EPROTOTYPE);
    324321#endif
    325322#ifdef ENOPROTOOPT
    326         case ENOPROTOOPT:       return VERR_NET_PROTOCOL_NOT_AVAILABLE;
     323        RT_CASE_RET_STR(ENOPROTOOPT);
    327324#endif
    328325#ifdef EPROTONOSUPPORT
    329         case EPROTONOSUPPORT:   return VERR_NET_PROTOCOL_NOT_SUPPORTED;
     326        RT_CASE_RET_STR(EPROTONOSUPPORT);
    330327#endif
    331328#ifdef ESOCKTNOSUPPORT
    332         case ESOCKTNOSUPPORT:   return VERR_NET_SOCKET_TYPE_NOT_SUPPORTED;
     329        RT_CASE_RET_STR(ESOCKTNOSUPPORT);
    333330#endif
    334331#ifdef EOPNOTSUPP /** @todo map this differently on solaris. */
    335         case EOPNOTSUPP:        return VERR_NET_OPERATION_NOT_SUPPORTED;
     332        RT_CASE_RET_STR(EOPNOTSUPP);
    336333#endif
    337334#ifdef EPFNOSUPPORT
    338         case EPFNOSUPPORT:      return VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED;
     335        RT_CASE_RET_STR(EPFNOSUPPORT);
    339336#endif
    340337#ifdef EAFNOSUPPORT
    341         case EAFNOSUPPORT:      return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
     338        RT_CASE_RET_STR(EAFNOSUPPORT);
    342339#endif
    343340#ifdef EADDRINUSE
    344         case EADDRINUSE:        return VERR_NET_ADDRESS_IN_USE;
     341        RT_CASE_RET_STR(EADDRINUSE);
    345342#endif
    346343#ifdef EADDRNOTAVAIL
    347         case EADDRNOTAVAIL:     return VERR_NET_ADDRESS_NOT_AVAILABLE;
     344        RT_CASE_RET_STR(EADDRNOTAVAIL);
    348345#endif
    349346#ifdef ENETDOWN
    350         case ENETDOWN:          return VERR_NET_DOWN;
     347        RT_CASE_RET_STR(ENETDOWN);
    351348#endif
    352349#ifdef ENETUNREACH
    353         case ENETUNREACH:       return VERR_NET_UNREACHABLE;
     350        RT_CASE_RET_STR(ENETUNREACH);
    354351#endif
    355352#ifdef ENETRESET
    356         case ENETRESET:         return VERR_NET_CONNECTION_RESET;
     353        RT_CASE_RET_STR(ENETRESET);
    357354#endif
    358355#ifdef ECONNABORTED
    359         case ECONNABORTED:      return VERR_NET_CONNECTION_ABORTED;
     356        RT_CASE_RET_STR(ECONNABORTED);
    360357#endif
    361358#ifdef ECONNRESET
    362         case ECONNRESET:        return VERR_NET_CONNECTION_RESET_BY_PEER;
     359        RT_CASE_RET_STR(ECONNRESET);
    363360#endif
    364361#ifdef ENOBUFS
    365         case ENOBUFS:           return VERR_NET_NO_BUFFER_SPACE;
     362        RT_CASE_RET_STR(ENOBUFS);
    366363#endif
    367364#ifdef EISCONN
    368         case EISCONN:           return VERR_NET_ALREADY_CONNECTED;
     365        RT_CASE_RET_STR(EISCONN);
    369366#endif
    370367#ifdef ENOTCONN
    371         case ENOTCONN:          return VERR_NET_NOT_CONNECTED;
     368        RT_CASE_RET_STR(ENOTCONN);
    372369#endif
    373370#ifdef ESHUTDOWN
    374         case ESHUTDOWN:         return VERR_NET_SHUTDOWN;
     371        RT_CASE_RET_STR(ESHUTDOWN);
    375372#endif
    376373#ifdef ETOOMANYREFS
    377         case ETOOMANYREFS:      return VERR_NET_TOO_MANY_REFERENCES;
     374        RT_CASE_RET_STR(ETOOMANYREFS);
    378375#endif
    379376#ifdef ETIMEDOUT
    380         case ETIMEDOUT:         return VERR_TIMEOUT;
     377        RT_CASE_RET_STR(ETIMEDOUT);
    381378#endif
    382379#ifdef ECONNREFUSED
    383         case ECONNREFUSED:      return VERR_NET_CONNECTION_REFUSED;
     380        RT_CASE_RET_STR(ECONNREFUSED);
    384381#endif
    385382#ifdef EHOSTDOWN
    386         case EHOSTDOWN:         return VERR_NET_HOST_DOWN;
     383        RT_CASE_RET_STR(EHOSTDOWN);
    387384#endif
    388385#ifdef EHOSTUNREACH
    389         case EHOSTUNREACH:      return VERR_NET_HOST_UNREACHABLE;
     386        RT_CASE_RET_STR(EHOSTUNREACH);
    390387#endif
    391388#ifdef EALREADY
    392389# if !defined(ENOLCK) || (EALREADY != ENOLCK)
    393         case EALREADY:          return VERR_NET_ALREADY_IN_PROGRESS;
     390        RT_CASE_RET_STR(EALREADY);
    394391# endif
    395392#endif
    396393#ifdef EINPROGRESS
    397394# if !defined(ENODEV) || (EINPROGRESS != ENODEV)
    398         case EINPROGRESS:       return VERR_NET_IN_PROGRESS;
     395        RT_CASE_RET_STR(EINPROGRESS);
    399396# endif
    400397#endif
    401398#ifdef ESTALE
    402         case ESTALE:            return VERR_STALE_FILE_HANDLE; /* 116: Stale NFS file handle */
     399        RT_CASE_RET_STR(ESTALE); /* 116: Stale NFS file handle */
    403400#endif
    404401#ifdef EUCLEAN
    405         //case EUCLEAN          117     /* Structure needs cleaning */
     402        RT_CASE_RET_STR(EUCLEAN);
    406403#endif
    407404#ifdef ENOTNAM
    408         //case ENOTNAM          118     /* Not a XENIX named type file */
     405        RT_CASE_RET_STR(ENOTNAM);
    409406#endif
    410407#ifdef ENAVAIL
    411         //case ENAVAIL          119     /* No XENIX semaphores available */
     408        RT_CASE_RET_STR(ENAVAIL);
    412409#endif
    413410#ifdef EISNAM
    414         //case EISNAM           120     /* Is a named type file */
     411        RT_CASE_RET_STR(EISNAM);
    415412#endif
    416413#ifdef EREMOTEIO
    417         //case EREMOTEIO        121     /* Remote I/O error */
     414        RT_CASE_RET_STR(EREMOTEIO);
    418415#endif
    419416#ifdef EDQUOT
    420         case EDQUOT:            return VERR_DISK_FULL; /** @todo fix duplicate error */
     417        RT_CASE_RET_STR(EDQUOT); /** @todo fix duplicate error */
    421418#endif
    422419#ifdef ENOMEDIUM
    423         case ENOMEDIUM:         return VERR_MEDIA_NOT_PRESENT;
     420        RT_CASE_RET_STR(ENOMEDIUM);
    424421#endif
    425422#ifdef EMEDIUMTYPE
    426         case EMEDIUMTYPE:       return VERR_MEDIA_NOT_RECOGNIZED;
     423        RT_CASE_RET_STR(EMEDIUMTYPE);
    427424#endif
    428425#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
    429         case EWOULDBLOCK:       return VERR_TRY_AGAIN;
     426        RT_CASE_RET_STR(EWOULDBLOCK);
    430427#endif
    431428
     
    433430
    434431#ifdef EPROCLIM
    435         case EPROCLIM:          return VERR_MAX_PROCS_REACHED;
     432        RT_CASE_RET_STR(EPROCLIM);
    436433#endif
    437434#ifdef EDOOFUS
    438435# if EDOOFUS != EINVAL
    439         case EDOOFUS:           return VERR_INTERNAL_ERROR;
     436        RT_CASE_RET_STR(EDOOFUS);
    440437# endif
    441438#endif
    442439#ifdef ENOTSUP
    443440# ifndef EOPNOTSUPP
    444         case ENOTSUP:           return VERR_NOT_SUPPORTED;
     441        RT_CASE_RET_STR(ENOTSUP);
    445442# else
    446443#  if ENOTSUP != EOPNOTSUPP
    447         case ENOTSUP:           return VERR_NOT_SUPPORTED;
     444        RT_CASE_RET_STR(ENOTSUP);
    448445#  endif
    449446# endif
    450447#endif
    451448        default:
    452             AssertLogRelMsgFailed(("Unhandled error code %d\n", iNativeCode));
    453             return VERR_UNRESOLVED_ERROR;
     449            AssertLogRelMsgFailedReturn(("Unhandled error code %d\n", iErrNo), "unknown-errno-value");
    454450    }
    455451}
    456 RT_EXPORT_SYMBOL(RTErrConvertFromErrno);
    457 
     452RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strerror);
     453
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette