-Wwrite-strings: Fix Solaris "set procfs-file"
[deliverable/binutils-gdb.git] / gdb / proc-api.c
index a08ae541a9d8813be7ac2dfca1ab7e59a869566f..dbadd552bf419b4935819c1e14f5d115ad9f8f32 100644 (file)
@@ -1,7 +1,6 @@
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
 
-   Copyright (C) 1999, 2000, 2001, 2003, 2005, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
 
    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
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/procfs.h>
 #ifdef HAVE_SYS_PROC_H
@@ -44,7 +42,7 @@
 #ifdef HAVE_SYS_USER_H
 #include <sys/user.h>  /* for struct user */
 #endif
-#include <fcntl.h>     /* for O_RDWR etc. */
+#include <fcntl.h>     /* for O_RDWR etc.  */
 #include "gdb_wait.h"
 
 #include "proc-utils.h"
@@ -52,7 +50,7 @@
 /*  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 to
-    their symbolic names and to a string that describes their specific use. */
+    their symbolic names and to a string that describes their specific use.  */
 
 struct trans {
   long value;                   /* The numeric value */
@@ -62,15 +60,14 @@ struct trans {
 
 static int   procfs_trace    = 0;
 static FILE *procfs_file     = NULL;
-static char *procfs_filename = "procfs_trace";
+static char *procfs_filename;
 
 static void
 prepare_to_trace (void)
 {
   if (procfs_trace)                    /* if procfs tracing turned on */
     if (procfs_file == NULL)           /* if output file not yet open */
-      if (procfs_filename != NULL)     /* if output filename known */
-       procfs_file = fopen (procfs_filename, "a");     /* open output file */
+      procfs_file = fopen (procfs_filename, "a");      /* open output file */
 }
 
 static void
@@ -161,7 +158,7 @@ static struct trans ioctl_table[] = {
   { PIOCLDT,       "PIOCLDT",      "get LDT" },
   { PIOCNLDT,      "PIOCNLDT",     "get number of LDT entries" },
 #endif
-#ifdef PIOCLSTATUS                     /* solaris and unixware */
+#ifdef PIOCLSTATUS                     /* solaris */
   { PIOCLSTATUS,   "PIOCLSTATUS",  "get status of all lwps" },
   { PIOCLUSAGE,    "PIOCLUSAGE",   "get resource usage of all lwps" },
   { PIOCOPENLWP,   "PIOCOPENLWP",  "get lwp file descriptor" },
@@ -409,9 +406,6 @@ static struct trans rw_table[] = {
 #ifdef PCREAD                  /* solaris */
   { PCREAD,   "PCREAD",   "read from the address space" },
   { PCWRITE,  "PCWRITE",  "write to the address space" },
-#endif
-#ifdef PCRESET                 /* unixware */
-  { PCRESET,  "PCRESET",  "unset modes" },
 #endif
   { PCRUN,    "PCRUN",    "make process/lwp runnable" },
 #ifdef PCSASRS                 /* solaris 2.7 only */
@@ -775,6 +769,9 @@ proc_prettyfprint_status (long flags, int why, int what, int thread)
 }
 
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern void _initialize_proc_api (void);
+
 void
 _initialize_proc_api (void)
 {
@@ -787,6 +784,7 @@ Show tracing for /proc api calls."), NULL,
                           NULL, /* FIXME: i18n: */
                           &setlist, &showlist);
 
+  procfs_filename = xstrdup ("procfs_trace");
   add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
 Set filename for /proc tracefile."), _("\
 Show filename for /proc tracefile."), NULL,
This page took 0.026353 seconds and 4 git commands to generate.