|
@@ -35,6 +35,7 @@
|
|
|
#include <ctype.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <errno.h>
|
|
|
+#include <signal.h>
|
|
|
|
|
|
#ifdef WANT_WIDE
|
|
|
#include <wchar.h>
|
|
@@ -60,16 +61,28 @@ typedef unsigned char __string_uchar_t;
|
|
|
|
|
|
* have to be changed! */
|
|
|
|
|
|
+#define _SYS_NERR 125
|
|
|
+#define _SYS_ERRMSG_MAXLEN 50
|
|
|
+
|
|
|
+extern const char _string_syserrmsgs[];
|
|
|
+
|
|
|
+#define _SYS_NSIG 32
|
|
|
+#define _SYS_SIGMSG_MAXLEN 25
|
|
|
+
|
|
|
+extern const char _string_syssigmsgs[];
|
|
|
+
|
|
|
+
|
|
|
#if _SYS_ERRMSG_MAXLEN < __UIM_BUFLEN_INT + 14
|
|
|
#define _STRERROR_BUFSIZE (__UIM_BUFLEN_INT + 14)
|
|
|
#else
|
|
|
#define _STRERROR_BUFSIZE _SYS_ERRMSG_MAXLEN
|
|
|
#endif
|
|
|
|
|
|
-#define _SYS_NERR 125
|
|
|
-#define _SYS_ERRMSG_MAXLEN 50
|
|
|
-
|
|
|
-extern const char _string_syserrmsgs[];
|
|
|
+#if _SYS_SIGMSG_MAXLEN < __UIM_BUFLEN_INT + 14
|
|
|
+#define _STRSIGNAL_BUFSIZE (__UIM_BUFLEN_INT + 14)
|
|
|
+#else
|
|
|
+#define _STRSIGNAL_BUFSIZE _SYS_SIGMSG_MAXLEN
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
#ifdef L__string_syserrmsgs
|
|
@@ -1727,3 +1740,180 @@ size_t strlcpy(register char *__restrict dst,
|
|
|
|
|
|
#endif
|
|
|
|
|
|
+#ifdef L__string_syssigmsgs
|
|
|
+
|
|
|
+const char _string_syssigmsgs[] = {
|
|
|
+ "\0"
|
|
|
+ "Hangup\0"
|
|
|
+ "Interrupt\0"
|
|
|
+ "Quit\0"
|
|
|
+ "Illegal instruction\0"
|
|
|
+ "Trace/breakpoint trap\0"
|
|
|
+ "Aborted\0"
|
|
|
+ "Bus error\0"
|
|
|
+ "Floating point exception\0"
|
|
|
+ "Killed\0"
|
|
|
+ "User defined signal 1\0"
|
|
|
+ "Segmentation fault\0"
|
|
|
+ "User defined signal 2\0"
|
|
|
+ "Broken pipe\0"
|
|
|
+ "Alarm clock\0"
|
|
|
+ "Terminated\0"
|
|
|
+ "Stack fault\0"
|
|
|
+ "Child exited\0"
|
|
|
+ "Continued\0"
|
|
|
+ "Stopped (signal)\0"
|
|
|
+ "Stopped\0"
|
|
|
+ "Stopped (tty input)\0"
|
|
|
+ "Stopped (tty output)\0"
|
|
|
+ "Urgent I/O condition\0"
|
|
|
+ "CPU time limit exceeded\0"
|
|
|
+ "File size limit exceeded\0"
|
|
|
+ "Virtual timer expired\0"
|
|
|
+ "Profiling timer expired\0"
|
|
|
+ "Window changed\0"
|
|
|
+ "I/O possible\0"
|
|
|
+ "Power failure\0"
|
|
|
+ "Bad system call"
|
|
|
+};
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+#ifdef L_sys_siglist
|
|
|
+
|
|
|
+const char *const sys_siglist[_NSIG] = {
|
|
|
+ NULL,
|
|
|
+ _string_syssigmsgs + 1,
|
|
|
+ _string_syssigmsgs + 8,
|
|
|
+ _string_syssigmsgs + 18,
|
|
|
+ _string_syssigmsgs + 23,
|
|
|
+ _string_syssigmsgs + 43,
|
|
|
+ _string_syssigmsgs + 65,
|
|
|
+ _string_syssigmsgs + 73,
|
|
|
+ _string_syssigmsgs + 83,
|
|
|
+ _string_syssigmsgs + 108,
|
|
|
+ _string_syssigmsgs + 115,
|
|
|
+ _string_syssigmsgs + 137,
|
|
|
+ _string_syssigmsgs + 156,
|
|
|
+ _string_syssigmsgs + 178,
|
|
|
+ _string_syssigmsgs + 190,
|
|
|
+ _string_syssigmsgs + 202,
|
|
|
+ _string_syssigmsgs + 213,
|
|
|
+ _string_syssigmsgs + 225,
|
|
|
+ _string_syssigmsgs + 238,
|
|
|
+ _string_syssigmsgs + 248,
|
|
|
+ _string_syssigmsgs + 265,
|
|
|
+ _string_syssigmsgs + 273,
|
|
|
+ _string_syssigmsgs + 293,
|
|
|
+ _string_syssigmsgs + 314,
|
|
|
+ _string_syssigmsgs + 335,
|
|
|
+ _string_syssigmsgs + 359,
|
|
|
+ _string_syssigmsgs + 384,
|
|
|
+ _string_syssigmsgs + 406,
|
|
|
+ _string_syssigmsgs + 430,
|
|
|
+ _string_syssigmsgs + 445,
|
|
|
+ _string_syssigmsgs + 458,
|
|
|
+ _string_syssigmsgs + 472,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+ NULL,
|
|
|
+};
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef L_strsignal
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+char *strsignal(int signum)
|
|
|
+{
|
|
|
+ register char *s;
|
|
|
+ int i;
|
|
|
+ static char buf[_STRSIGNAL_BUFSIZE];
|
|
|
+ static const char unknown[15] = {
|
|
|
+ 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' '
|
|
|
+ };
|
|
|
+
|
|
|
+ if (((unsigned int) signum) < _SYS_NSIG) {
|
|
|
+
|
|
|
+ * so rather than keeping an array of pointers for the different
|
|
|
+ * messages, just run through the buffer until we find the
|
|
|
+ * correct string. */
|
|
|
+ for (s = (char *) _string_syssigmsgs, i = signum ; i ; ++s) {
|
|
|
+ if (!*s) {
|
|
|
+ --i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (*s) {
|
|
|
+ goto DONE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ s = _int10tostr(buf+sizeof(buf)-1, signum) - sizeof(unknown);
|
|
|
+ memcpy(s, unknown, sizeof(unknown));
|
|
|
+
|
|
|
+ DONE:
|
|
|
+ return s;
|
|
|
+}
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef L_psignal
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+void psignal(int signum, register const char *message)
|
|
|
+{
|
|
|
+
|
|
|
+ * friends are used as well. It is also possible that the calling
|
|
|
+ * program could buffer stderr, or reassign it. */
|
|
|
+
|
|
|
+ register const char *sep;
|
|
|
+
|
|
|
+ sep = ": ";
|
|
|
+ if (!(message && *message)) {
|
|
|
+ message = (sep += 2);
|
|
|
+ }
|
|
|
+
|
|
|
+#if 1
|
|
|
+ fprintf(stderr, "%s%s%s\n", message, sep, strsignal(signum));
|
|
|
+#else
|
|
|
+
|
|
|
+ __STDIO_THREADLOCK(stderr);
|
|
|
+ _stdio_fdout(STDERR_FILENO, message, sep, strsignal(signum));
|
|
|
+ __STDIO_THREADUNLOCK(stderr);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+#endif
|
|
|
+
|