From: John Hodge Date: Sat, 10 May 2014 09:06:05 +0000 (+0800) Subject: Usermode/libc - Add C99 errno values, fix compile error in strtoi X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f923ed326dcf796de44508d4eb1c812ab357a3ca;p=tpg%2Facess2.git Usermode/libc - Add C99 errno values, fix compile error in strtoi --- diff --git a/Usermode/Libraries/libc.so_src/errno.c b/Usermode/Libraries/libc.so_src/errno.c index 6f954574..d651ccc6 100644 --- a/Usermode/Libraries/libc.so_src/errno.c +++ b/Usermode/Libraries/libc.so_src/errno.c @@ -21,13 +21,16 @@ EXPORT char *strerror(int errnum) switch((enum libc_eErrorNumbers)errnum) { case EOK: return "Success"; + case ERANGE: return "Value out of range"; + case EDOM: return "Value out of domain"; + case EILSEQ: return "Illegal character sequence"; + case ENOSYS: return "Invalid instruction/syscall"; case EINVAL: return "Bad argument(s)"; case EBADF: return "Invalid file"; case ENOMEM: return "No free memory"; case EACCES: return "Not permitted"; case EBUSY: return "Resource is busy"; - case ERANGE: return "Value out of range"; case ENOTFOUND: return "Item not found"; case EROFS: return "Read only filesystem"; case ENOTIMPL: return "Not implimented"; @@ -46,6 +49,7 @@ EXPORT char *strerror(int errnum) case ENOTTY: return "Not a TTY"; case EAGAIN: return "Try again"; case EFBIG: return "File too big"; + case E2BIG: return "Value too big"; case EALREADY: return "Operation was no-op"; case EAFNOSUPPORT: return "Address family not supported"; case EINTERNAL: return "Internal error"; diff --git a/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h b/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h index f9436547..5813cc56 100755 --- a/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h +++ b/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h @@ -1,13 +1,16 @@ enum libc_eErrorNumbers { EOK, + EDOM, // (C99) Value out of domain + EILSEQ, // (C99) Illegal multi-byte sequence + ERANGE, // (C99) Value out of range + ENOSYS, // Invalid Instruction EINVAL, // Invalid Paramater EBADF, // Bad FD ENOMEM, // No free memory EACCES, // Not permitted EBUSY, // Resource is busy - ERANGE, // Value out of range ENOTFOUND, // Item not found EROFS, // Read only ENOTIMPL, // Not implemented @@ -29,6 +32,7 @@ enum libc_eErrorNumbers { EALREADY, // Operation was a NOP EFBIG, // File too large + E2BIG, // Argument list too large // psockets EAFNOSUPPORT, diff --git a/Usermode/Libraries/libc.so_src/strtoi.c b/Usermode/Libraries/libc.so_src/strtoi.c index 4fd2da5b..9864fd57 100644 --- a/Usermode/Libraries/libc.so_src/strtoi.c +++ b/Usermode/Libraries/libc.so_src/strtoi.c @@ -12,7 +12,7 @@ unsigned long long strtoull(const char *str, char **end, int base) { - long long ret = 0; + unsigned long long ret = 0; if( !str || base < 0 || base > 36 || base == 1 ) { if(end) @@ -138,7 +138,7 @@ long long strtoll(const char *str, char **end, int base) //_SysDebug("strtoll - neg=%i,ret=%llu", neg, ret); if( neg ) { - if( -ret < LLONG_MIN ) { + if( ret + LLONG_MIN > 0 ) { errno = ERANGE; return LLONG_MIN; }