Mercurial > hvf > hvf-old
changeset 509:e06c429ab0eb
lib/errno: added another error code (ECORRUPT) and C-strings for each
The C-strings are currently unused, but the CP shell could probably use
them.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 25 Apr 2011 09:09:26 -0400 |
parents | 8188966f0cc5 |
children | 679ce2a155bf |
files | include/errno.h lib/Makefile lib/errno.c |
diffstat | 3 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/include/errno.h Sat Apr 23 17:45:26 2011 -0400 +++ b/include/errno.h Mon Apr 25 09:09:26 2011 -0400 @@ -18,13 +18,16 @@ #define EUCHECK 8 #define EFAULT 9 #define EPERM 10 +#define ECORRUPT 11 #define PTR_ERR(ptr) ((s64) ptr) -#define ERR_PTR(err) ((void*) err) +#define ERR_PTR(err) ((void*) (long) err) static inline int IS_ERR(void *ptr) { return -1024 < PTR_ERR(ptr) && PTR_ERR(ptr) < 0; } +extern char *errstrings[]; + #endif
--- a/lib/Makefile Sat Apr 23 17:45:26 2011 -0400 +++ b/lib/Makefile Mon Apr 25 09:09:26 2011 -0400 @@ -6,7 +6,8 @@ LIBS=clock.a \ digest.a \ string.a \ - ebcdic.a + ebcdic.a \ + errno.a include ../cp/scripts/Makefile.commands @@ -24,6 +25,9 @@ ebcdic.a: ebcdic.o $(call ar,$@,$^) +errno.a: errno.o + $(call ar,$@,$^) + %.o: %.c $(call c-to-o,$<,$@)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/errno.c Mon Apr 25 09:09:26 2011 -0400 @@ -0,0 +1,15 @@ +#include <errno.h> + +char *errstrings[] = { + [ENOMEM] = "Out of memory", + [EBUSY] = "Resource busy", + [EAGAIN] = "Try again", + [EINVAL] = "Invalid argument", + [EEXIST] = "File already exists", + [ENOENT] = "No such file", + [ESUBENOENT] = "?", + [EUCHECK] = "?", + [EFAULT] = "Invalid memory reference", + [EPERM] = "Permission denied", + [ECORRUPT] = "Curruption detected", +};