Avoid "format not a string literal" warnings
[deliverable/binutils-gdb.git] / gdb / proc-events.c
index b3a3181662d5ad0f8cde1908d0d45cdefb6baf9f..b291d317fe454b85d4486e4f7c8d542a72f9216b 100644 (file)
@@ -1,7 +1,6 @@
 /* Machine-independent support for SVR4 /proc (process file system)
 
 /* Machine-independent support for SVR4 /proc (process file system)
 
-   Copyright (C) 1999, 2000, 2004, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2016 Free Software Foundation, Inc.
 
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
 
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
@@ -35,7 +34,6 @@
 #define _STRUCTURED_PROC 1
 #endif
 
 #define _STRUCTURED_PROC 1
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/procfs.h>
 #ifdef HAVE_SYS_SYSCALL_H
 #include <sys/types.h>
 #include <sys/procfs.h>
 #ifdef HAVE_SYS_SYSCALL_H
@@ -45,6 +43,8 @@
 #include <sys/fault.h>
 #endif
 
 #include <sys/fault.h>
 #endif
 
+#include "proc-utils.h"
+
 /* Much of the information used in the /proc interface, particularly
    for printing status information, is kept as tables of structures of
    the following form.  These tables can be used to map numeric values
 /* Much of the information used in the /proc interface, particularly
    for printing status information, is kept as tables of structures of
    the following form.  These tables can be used to map numeric values
@@ -61,51 +61,12 @@ struct trans
 
 /* Pretty print syscalls.  */
 
 
 /* Pretty print syscalls.  */
 
-/* Ugh -- UnixWare and Solaris spell these differently!  */
-
-#ifdef  SYS_lwpcreate
-#define SYS_lwp_create SYS_lwpcreate
-#endif
-
-#ifdef  SYS_lwpexit
-#define SYS_lwp_exit SYS_lwpexit
-#endif
-
-#ifdef  SYS_lwpwait
-#define SYS_lwp_wait SYS_lwpwait
-#endif
-
-#ifdef  SYS_lwpself
-#define SYS_lwp_self SYS_lwpself
-#endif
-
-#ifdef  SYS_lwpinfo
-#define SYS_lwp_info SYS_lwpinfo
-#endif
-
-#ifdef  SYS_lwpprivate
-#define SYS_lwp_private SYS_lwpprivate
-#endif
-
-#ifdef  SYS_lwpkill
-#define SYS_lwp_kill SYS_lwpkill
-#endif
-
-#ifdef  SYS_lwpsuspend
-#define SYS_lwp_suspend SYS_lwpsuspend
-#endif
-
-#ifdef  SYS_lwpcontinue
-#define SYS_lwp_continue SYS_lwpcontinue
-#endif
-
-
 /* Syscall translation table.  */
 
 #define MAX_SYSCALLS 262       /* Pretty arbitrary.  */
 static char *syscall_table[MAX_SYSCALLS];
 
 /* Syscall translation table.  */
 
 #define MAX_SYSCALLS 262       /* Pretty arbitrary.  */
 static char *syscall_table[MAX_SYSCALLS];
 
-void
+static void
 init_syscall_table (void)
 {
 #ifdef SYS_BSD_getime
 init_syscall_table (void)
 {
 #ifdef SYS_BSD_getime
@@ -1434,47 +1395,47 @@ proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
 \f
 /* Prettyprint signals.  */
 
 \f
 /* Prettyprint signals.  */
 
-/* Signal translation table.  */
+/* Signal translation table, ordered ANSI-standard signals first,
+   other signals second, with signals in each block ordered by their
+   numerical values on a typical POSIX platform.  */
 
 static struct trans signal_table[] = 
 {
   { 0,      "<no signal>", "no signal" }, 
 
 static struct trans signal_table[] = 
 {
   { 0,      "<no signal>", "no signal" }, 
+
+  /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
+     are ANSI-standard signals and are always available.  */
+
+  { SIGINT, "SIGINT", "Interrupt (rubout)" },
+  { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
+  { SIGABRT, "SIGABRT", "used by abort()" },   /* replaces SIGIOT */
+  { SIGFPE, "SIGFPE", "Floating point exception" },
+  { SIGSEGV, "SIGSEGV", "Segmentation violation" },
+  { SIGTERM, "SIGTERM", "Software termination signal from kill" },
+
+  /* All other signals need preprocessor conditionals.  */
+
 #ifdef SIGHUP
   { SIGHUP, "SIGHUP", "Hangup" },
 #endif
 #ifdef SIGHUP
   { SIGHUP, "SIGHUP", "Hangup" },
 #endif
-#ifdef SIGINT
-  { SIGINT, "SIGINT", "Interrupt (rubout)" },
-#endif
 #ifdef SIGQUIT
   { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
 #endif
 #ifdef SIGQUIT
   { SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
 #endif
-#ifdef SIGILL
-  { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
-#endif
 #ifdef SIGTRAP
   { SIGTRAP, "SIGTRAP", "Trace trap" },                /* not reset when caught */
 #endif
 #ifdef SIGTRAP
   { SIGTRAP, "SIGTRAP", "Trace trap" },                /* not reset when caught */
 #endif
-#ifdef SIGABRT
-  { SIGABRT, "SIGABRT", "used by abort()" },   /* replaces SIGIOT */
-#endif
 #ifdef SIGIOT
   { SIGIOT, "SIGIOT", "IOT instruction" },
 #endif
 #ifdef SIGEMT
   { SIGEMT, "SIGEMT", "EMT instruction" },
 #endif
 #ifdef SIGIOT
   { SIGIOT, "SIGIOT", "IOT instruction" },
 #endif
 #ifdef SIGEMT
   { SIGEMT, "SIGEMT", "EMT instruction" },
 #endif
-#ifdef SIGFPE
-  { SIGFPE, "SIGFPE", "Floating point exception" },
-#endif
 #ifdef SIGKILL
   { SIGKILL, "SIGKILL", "Kill" },      /* Solaris: cannot be caught/ignored */
 #endif
 #ifdef SIGBUS
   { SIGBUS, "SIGBUS", "Bus error" },
 #endif
 #ifdef SIGKILL
   { SIGKILL, "SIGKILL", "Kill" },      /* Solaris: cannot be caught/ignored */
 #endif
 #ifdef SIGBUS
   { SIGBUS, "SIGBUS", "Bus error" },
 #endif
-#ifdef SIGSEGV
-  { SIGSEGV, "SIGSEGV", "Segmentation violation" },
-#endif
 #ifdef SIGSYS
   { SIGSYS, "SIGSYS", "Bad argument to system call" },
 #endif
 #ifdef SIGSYS
   { SIGSYS, "SIGSYS", "Bad argument to system call" },
 #endif
@@ -1484,9 +1445,6 @@ static struct trans signal_table[] =
 #ifdef SIGALRM
   { SIGALRM, "SIGALRM", "Alarm clock" },
 #endif
 #ifdef SIGALRM
   { SIGALRM, "SIGALRM", "Alarm clock" },
 #endif
-#ifdef SIGTERM
-  { SIGTERM, "SIGTERM", "Software termination signal from kill" },
-#endif
 #ifdef SIGUSR1
   { SIGUSR1, "SIGUSR1", "User defined signal 1" },
 #endif
 #ifdef SIGUSR1
   { SIGUSR1, "SIGUSR1", "User defined signal 1" },
 #endif
@@ -1515,7 +1473,8 @@ static struct trans signal_table[] =
   { SIGIO, "SIGIO", "Socket I/O possible" },   /* alias for SIGPOLL */
 #endif
 #ifdef SIGSTOP
   { SIGIO, "SIGIO", "Socket I/O possible" },   /* alias for SIGPOLL */
 #endif
 #ifdef SIGSTOP
-  { SIGSTOP, "SIGSTOP", "Stop, not from tty" },        /* cannot be caught or ignored */
+  { SIGSTOP, "SIGSTOP", "Stop, not from tty" },        /* cannot be caught or
+                                                  ignored */
 #endif
 #ifdef SIGTSTP
   { SIGTSTP, "SIGTSTP", "User stop from tty" },
 #endif
 #ifdef SIGTSTP
   { SIGTSTP, "SIGTSTP", "User stop from tty" },
This page took 0.025166 seconds and 4 git commands to generate.