/* 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.
#define _STRUCTURED_PROC 1
#endif
-#include <stdio.h>
#include <sys/types.h>
#include <sys/procfs.h>
#ifdef HAVE_SYS_PROC_H
#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"
/* 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 */
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
{ 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" },
#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 */
}
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern void _initialize_proc_api (void);
+
void
_initialize_proc_api (void)
{
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,