Changes in uspace/lib/c/generic/str_error.c [9af1c61:b14d9f9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str_error.c
r9af1c61 rb14d9f9 41 41 #define NOERR_LEN 64 42 42 43 // TODO: this file should be generated from errno declarations44 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 66 43 static const char* err_desc[] = { 67 44 "No error", 68 45 "No such entry", 69 46 "Not enough memory", 70 "Limit exceeded", 47 "Limit exceeded", 71 48 "Connection refused", 72 49 "Forwarding error", … … 87 64 static fibril_local char noerr[NOERR_LEN]; 88 65 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) 66 const char *str_error(const int e) 116 67 { 117 68 if ((e <= 0) && (e >= MIN_ERRNO)) … … 135 86 } 136 87 137 snprintf(noerr, NOERR_LEN, "Unk nown error code (%d)", (int)e);88 snprintf(noerr, NOERR_LEN, "Unkown error code %d", e); 138 89 return noerr; 139 90 }
Note:
See TracChangeset
for help on using the changeset viewer.