Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str_error.c

    r9af1c61 rb14d9f9  
    4141#define NOERR_LEN  64
    4242
    43 // TODO: this file should be generated from errno declarations
    44 
    45 static const char* err_name[] = {
    46         "EOK",
    47         "ENOENT",
    48         "ENOMEM",
    49         "ELIMIT",
    50         "EREFUSED",
    51         "EFORWARD",
    52         "EPERM",
    53         "EHANGUP",
    54         "EPARTY",
    55         "EEXIST",
    56         "EBADMEM",
    57         "ENOTSUP",
    58         "EADDRNOTAVAIL",
    59         "ETIMEOUT",
    60         "EINVAL",
    61         "EBUSY",
    62         "EOVERFLOW",
    63         "EINTR"
    64 };
    65 
    6643static const char* err_desc[] = {
    6744        "No error",
    6845        "No such entry",
    6946        "Not enough memory",
    70         "Limit exceeded",
     47        "Limit exceeded", 
    7148        "Connection refused",
    7249        "Forwarding error",
     
    8764static fibril_local char noerr[NOERR_LEN];
    8865
    89 const char *str_error_name(errno_t e)
    90 {
    91         if ((e <= 0) && (e >= MIN_ERRNO))
    92                 return err_name[-e];
    93 
    94         /* Ad hoc descriptions of error codes interesting for USB. */
    95         // FIXME: integrate these as first-class error values
    96         switch (e) {
    97                 case ENOFS:
    98                         return "ENOFS";
    99                 case EBADCHECKSUM:
    100                         return "EBADCHECKSUM";
    101                 case ESTALL:
    102                         return "ESTALL";
    103                 case EAGAIN:
    104                         return "EAGAIN";
    105                 case EEMPTY:
    106                         return "EEMPTY";
    107                 default:
    108                         break;
    109         }
    110 
    111         snprintf(noerr, NOERR_LEN, "(%d)", (int)e);
    112         return noerr;
    113 }
    114 
    115 const char *str_error(errno_t e)
     66const char *str_error(const int e)
    11667{
    11768        if ((e <= 0) && (e >= MIN_ERRNO))
     
    13586        }
    13687
    137         snprintf(noerr, NOERR_LEN, "Unknown error code (%d)", (int)e);
     88        snprintf(noerr, NOERR_LEN, "Unkown error code %d", e);
    13889        return noerr;
    13990}
Note: See TracChangeset for help on using the changeset viewer.