summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-08-27 19:23:02 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-08-27 19:23:02 +0000
commitdbee84a1784a929efcd6f0956ead1dbbf6136462 (patch)
tree9a923272682de8c92edf0c951869f11b97d7cd17
parent0a6ce9213e83835ffa8c434a6644b55932715e8c (diff)
Reimplement sys_errlist[] so that it works on sparc, alpha, and mips.
In my opinion, this is a complete waste of good memory and is only done to avoid the anticipated whining by people who think this libary is named uCglibc. At some point this may become a configurable option. And even then, it may not be available in all configs... for instance when system error messages become locale-dependent.
-rw-r--r--libc/string/Makefile2
-rw-r--r--libc/string/wstring.c160
2 files changed, 161 insertions, 1 deletions
diff --git a/libc/string/Makefile b/libc/string/Makefile
index 2ffc0f2b2..6c29bb9ec 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -33,7 +33,7 @@ MOBJW= basename.o bcopy.o bzero.o dirname.o ffs.o memccpy.o memchr.o memcmp.o \
strspn.o strstr.o strtok.o strtok_r.o strerror.o _susv3_strerror_r.o \
_string_syserrmsgs.o _glibc_strerror_r.o \
_string_syssigmsgs.o sys_siglist.o strsignal.o psignal.o \
- __xpg_basename.o strlcat.o strlcpy.o # strcoll.o
+ __xpg_basename.o strlcat.o strlcpy.o sys_errlist.o # strcoll.o
MOBJW2= wcscasecmp.o wcscat.o wcschrnul.o wcschr.o wcscmp.o wcscpy.o wcscspn.o \
wcsdup.o wcslen.o wcsncasecmp.o wcsncat.o wcsncmp.o wcsncpy.o \
diff --git a/libc/string/wstring.c b/libc/string/wstring.c
index 08927edb1..8a8206364 100644
--- a/libc/string/wstring.c
+++ b/libc/string/wstring.c
@@ -230,6 +230,166 @@ const char _string_syserrmsgs[] = {
#endif
/**********************************************************************/
+#ifdef L_sys_errlist
+
+link_warning(_sys_errlist, "sys_nerr and sys_errlist are obsolete and uClibc support for them (in at least some configurations) will probably be unavailable in the near future.")
+
+const char *const sys_errlist[] = {
+ [0] = _string_syserrmsgs + 0,
+ [EPERM] = _string_syserrmsgs + 8,
+ [ENOENT] = _string_syserrmsgs + 32,
+ [ESRCH] = _string_syserrmsgs + 58,
+ [EINTR] = _string_syserrmsgs + 74,
+ [EIO] = _string_syserrmsgs + 98,
+ [ENXIO] = _string_syserrmsgs + 117,
+ [E2BIG] = _string_syserrmsgs + 143,
+ [ENOEXEC] = _string_syserrmsgs + 166,
+ [EBADF] = _string_syserrmsgs + 184,
+ [ECHILD] = _string_syserrmsgs + 204,
+ [EAGAIN] = _string_syserrmsgs + 223,
+ [ENOMEM] = _string_syserrmsgs + 256,
+ [EACCES] = _string_syserrmsgs + 279,
+ [EFAULT] = _string_syserrmsgs + 297,
+ [ENOTBLK] = _string_syserrmsgs + 309,
+ [EBUSY] = _string_syserrmsgs + 331,
+ [EEXIST] = _string_syserrmsgs + 355,
+ [EXDEV] = _string_syserrmsgs + 367,
+ [ENODEV] = _string_syserrmsgs + 393,
+ [ENOTDIR] = _string_syserrmsgs + 408,
+ [EISDIR] = _string_syserrmsgs + 424,
+ [EINVAL] = _string_syserrmsgs + 439,
+ [ENFILE] = _string_syserrmsgs + 456,
+ [EMFILE] = _string_syserrmsgs + 486,
+ [ENOTTY] = _string_syserrmsgs + 506,
+ [ETXTBSY] = _string_syserrmsgs + 537,
+ [EFBIG] = _string_syserrmsgs + 552,
+ [ENOSPC] = _string_syserrmsgs + 567,
+ [ESPIPE] = _string_syserrmsgs + 591,
+ [EROFS] = _string_syserrmsgs + 604,
+ [EMLINK] = _string_syserrmsgs + 626,
+ [EPIPE] = _string_syserrmsgs + 641,
+ [EDOM] = _string_syserrmsgs + 653,
+ [ERANGE] = _string_syserrmsgs + 686,
+ [EDEADLK] = _string_syserrmsgs + 716,
+ [ENAMETOOLONG] = _string_syserrmsgs + 742,
+ [ENOLCK] = _string_syserrmsgs + 761,
+ [ENOSYS] = _string_syserrmsgs + 780,
+ [ENOTEMPTY] = _string_syserrmsgs + 805,
+ [ELOOP] = _string_syserrmsgs + 825,
+ /* _string_syserrmsgs + 859, */
+ [ENOMSG] = _string_syserrmsgs + 860,
+ [EIDRM] = _string_syserrmsgs + 887,
+ [ECHRNG] = _string_syserrmsgs + 906,
+ [EL2NSYNC] = _string_syserrmsgs + 934,
+ [EL3HLT] = _string_syserrmsgs + 959,
+ [EL3RST] = _string_syserrmsgs + 974,
+ [ELNRNG] = _string_syserrmsgs + 988,
+ [EUNATCH] = _string_syserrmsgs + 1013,
+ [ENOCSI] = _string_syserrmsgs + 1042,
+ [EL2HLT] = _string_syserrmsgs + 1069,
+ [EBADE] = _string_syserrmsgs + 1084,
+ [EBADR] = _string_syserrmsgs + 1101,
+ [EXFULL] = _string_syserrmsgs + 1128,
+ [ENOANO] = _string_syserrmsgs + 1142,
+ [EBADRQC] = _string_syserrmsgs + 1151,
+ [EBADSLT] = _string_syserrmsgs + 1172,
+ /* _string_syserrmsgs + 1185, */
+ [EBFONT] = _string_syserrmsgs + 1186,
+ [ENOSTR] = _string_syserrmsgs + 1207,
+ [ENODATA] = _string_syserrmsgs + 1227,
+ [ETIME] = _string_syserrmsgs + 1245,
+ [ENOSR] = _string_syserrmsgs + 1259,
+ [ENONET] = _string_syserrmsgs + 1284,
+ [ENOPKG] = _string_syserrmsgs + 1314,
+ [EREMOTE] = _string_syserrmsgs + 1336,
+ [ENOLINK] = _string_syserrmsgs + 1353,
+ [EADV] = _string_syserrmsgs + 1375,
+ [ESRMNT] = _string_syserrmsgs + 1391,
+ [ECOMM] = _string_syserrmsgs + 1405,
+ [EPROTO] = _string_syserrmsgs + 1433,
+ [EMULTIHOP] = _string_syserrmsgs + 1448,
+ [EDOTDOT] = _string_syserrmsgs + 1467,
+ [EBADMSG] = _string_syserrmsgs + 1486,
+ [EOVERFLOW] = _string_syserrmsgs + 1498,
+ [ENOTUNIQ] = _string_syserrmsgs + 1536,
+ [EBADFD] = _string_syserrmsgs + 1563,
+ [EREMCHG] = _string_syserrmsgs + 1592,
+ [ELIBACC] = _string_syserrmsgs + 1615,
+ [ELIBBAD] = _string_syserrmsgs + 1654,
+ [ELIBSCN] = _string_syserrmsgs + 1691,
+ [ELIBMAX] = _string_syserrmsgs + 1723,
+ [ELIBEXEC] = _string_syserrmsgs + 1771,
+ [EILSEQ] = _string_syserrmsgs + 1809,
+ [ERESTART] = _string_syserrmsgs + 1859,
+ [ESTRPIPE] = _string_syserrmsgs + 1903,
+ [EUSERS] = _string_syserrmsgs + 1922,
+ [ENOTSOCK] = _string_syserrmsgs + 1937,
+ [EDESTADDRREQ] = _string_syserrmsgs + 1968,
+ [EMSGSIZE] = _string_syserrmsgs + 1997,
+ [EPROTOTYPE] = _string_syserrmsgs + 2014,
+ [ENOPROTOOPT] = _string_syserrmsgs + 2045,
+ [EPROTONOSUPPORT] = _string_syserrmsgs + 2068,
+ [ESOCKTNOSUPPORT] = _string_syserrmsgs + 2091,
+ [EOPNOTSUPP] = _string_syserrmsgs + 2117,
+ [EPFNOSUPPORT] = _string_syserrmsgs + 2141,
+ [EAFNOSUPPORT] = _string_syserrmsgs + 2171,
+ [EADDRINUSE] = _string_syserrmsgs + 2212,
+ [EADDRNOTAVAIL] = _string_syserrmsgs + 2235,
+ [ENETDOWN] = _string_syserrmsgs + 2267,
+ [ENETUNREACH] = _string_syserrmsgs + 2283,
+ [ENETRESET] = _string_syserrmsgs + 2306,
+ [ECONNABORTED] = _string_syserrmsgs + 2342,
+ [ECONNRESET] = _string_syserrmsgs + 2375,
+ [ENOBUFS] = _string_syserrmsgs + 2400,
+ [EISCONN] = _string_syserrmsgs + 2426,
+ [ENOTCONN] = _string_syserrmsgs + 2466,
+ [ESHUTDOWN] = _string_syserrmsgs + 2502,
+ [ETOOMANYREFS] = _string_syserrmsgs + 2548,
+ [ETIMEDOUT] = _string_syserrmsgs + 2583,
+ [ECONNREFUSED] = _string_syserrmsgs + 2604,
+ [EHOSTDOWN] = _string_syserrmsgs + 2623,
+ [EHOSTUNREACH] = _string_syserrmsgs + 2636,
+ [EALREADY] = _string_syserrmsgs + 2653,
+ [EINPROGRESS] = _string_syserrmsgs + 2683,
+ [ESTALE] = _string_syserrmsgs + 2709,
+ [EUCLEAN] = _string_syserrmsgs + 2731,
+ [ENOTNAM] = _string_syserrmsgs + 2756,
+ [ENAVAIL] = _string_syserrmsgs + 2784,
+ [EISNAM] = _string_syserrmsgs + 2814,
+ [EREMOTEIO] = _string_syserrmsgs + 2835,
+ [EDQUOT] = _string_syserrmsgs + 2852,
+ [ENOMEDIUM] = _string_syserrmsgs + 2872,
+ [EMEDIUMTYPE] = _string_syserrmsgs + 2888,
+
+#if EDEADLOCK != EDEADLK
+ [EDEADLOCK] = _string_syserrmsgs + 2906,
+#endif
+
+#if EWOULDBLOCK != EAGAIN
+#warning EWOULDBLOCK does not equal EAGAIN
+#endif
+
+ /* For now, ignore the other arch-specific errors. glibc only maps EPROCLIM. */
+
+ /* some other mips errors */
+#ifdef ECANCELED
+#endif
+#ifdef EINIT
+#endif
+#ifdef EREMDEV
+#endif
+
+ /* some other sparc errors */
+#ifdef EPROCLIM
+#endif
+#ifdef ERREMOTE
+#endif
+};
+
+int sys_nerr = sizeof(sys_errlist)/sizeof(sys_errlist[0]);
+
+#endif
+/**********************************************************************/
#ifdef L_wmemcpy
#define L_memcpy
#define Wmemcpy wmemcpy