summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/misc.c15
-rw-r--r--include/errno.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/common/misc.c b/common/misc.c
index 43c1a0c..6754696 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -75,13 +75,13 @@ int errno;
EXPORT_SYMBOL(errno);
-const char *errno_str(void)
+const char *strerror(int errnum)
{
static char errno_string[10];
#ifdef CONFIG_ERRNO_MESSAGES
char *str;
- switch(-errno) {
+ switch(errnum) {
case 0 : str = "No error"; break;
case EPERM : str = "Operation not permitted"; break;
case ENOENT : str = "No such file or directory"; break;
@@ -145,16 +145,23 @@ const char *errno_str(void)
case EREMOTEIO : str = "Remote I/O error"; break;
#endif
default:
- sprintf(errno_string, "error %d", errno);
+ sprintf(errno_string, "error %d", errnum);
return errno_string;
};
return str;
#else
- sprintf(errno_string, "error %d", errno);
+ sprintf(errno_string, "error %d", errnum);
+
return errno_string;
#endif
}
+EXPORT_SYMBOL(strerror);
+
+const char *errno_str(void)
+{
+ return strerror(-errno);
+}
EXPORT_SYMBOL(errno_str);
void perror(const char *s)
diff --git a/include/errno.h b/include/errno.h
index 5661426..025816e 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -7,5 +7,6 @@ extern int errno;
void perror(const char *s);
const char *errno_str(void);
+const char *strerror(int errnum);
#endif /* __ERRNO_H */