Changeset 6a44ee4 in mainline for uspace/lib/c/generic/str_error.c


Ignore:
Timestamp:
2011-07-20T15:26:21Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
efcebe1
Parents:
25bef0ff (diff), a701812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r25bef0ff r6a44ee4  
    3333 */
    3434
     35#include <errno.h>
    3536#include <str_error.h>
    3637#include <stdio.h>
     
    6364static fibril_local char noerr[NOERR_LEN];
    6465
    65 const char *str_error(const int errno)
     66const char *str_error(const int e)
    6667{
    67         if ((errno <= 0) && (errno >= MIN_ERRNO))
    68                 return err_desc[-errno];
     68        if ((e <= 0) && (e >= MIN_ERRNO))
     69                return err_desc[-e];
    6970       
    70         snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno);
     71        /* Ad hoc descriptions of error codes interesting for USB. */
     72        // FIXME: integrate these as first-class error values
     73        switch (e) {
     74                case EBADCHECKSUM:
     75                        return "Bad checksum";
     76                case ESTALL:
     77                        return "Operation stalled";
     78                case EAGAIN:
     79                        return "Resource temporarily unavailable";
     80                case EEMPTY:
     81                        return "Resource is empty";
     82                default:
     83                        break;
     84        }
     85
     86        snprintf(noerr, NOERR_LEN, "Unkown error code %d", e);
    7187        return noerr;
    7288}
Note: See TracChangeset for help on using the changeset viewer.