3 * - By John Hodge (thePowersGang)
10 #include <acess/sys.h>
13 EXPORT int *libc_geterrno()
18 EXPORT char *strerror(int errnum)
20 switch((enum libc_eErrorNumbers)errnum)
22 case EOK: return "Success";
23 case ENOSYS: return "Invalid instruction/syscall";
24 case EINVAL: return "Bad argument(s)";
25 case EBADF: return "Invalid file";
26 case ENOMEM: return "No free memory";
27 case EACCES: return "Not permitted";
28 case EBUSY: return "Resource is busy";
29 case ERANGE: return "Value out of range";
30 case ENOTFOUND: return "Item not found";
31 case EROFS: return "Read only filesystem";
32 case ENOTIMPL: return "Not implimented";
33 case ENOENT: return "No such file or directory";
34 case EEXIST: return "Already exists";
35 case ENFILE: return "Too many open files";
36 case ENOTDIR: return "Not a directory";
37 case EISDIR: return "Is a directory";
38 case EIO: return "IO Error";
39 case EINTR: return "Interrupted";
40 case EWOULDBLOCK: return "Operation would have blocked";
41 case ENODEV: return "No such device";
42 case EADDRNOTAVAIL: return "Address not avaliable";
43 case EINPROGRESS: return "Operation in process";
44 case EPERM: return "Operation not permitted";
45 case ENOTTY: return "Not a TTY";
46 case EAGAIN: return "Try again";
47 case EALREADY: return "Operation was no-op";
48 case EINTERNAL: return "Internal error";
50 _SysDebug("strerror: errnum=%i unk", errnum);
52 return "unknown error";
55 EXPORT int strerror_r(int errnum, char *buf, size_t bufsiz)
57 const char *str = strerror(errnum);
61 strncpy(buf, str, bufsiz);