From: "Kris Warkentin" <kewarken@qnx.com>
To: "Andrew Cagney" <ac131313@redhat.com>
Cc: "Gdb-Patches@Sources.Redhat.Com" <gdb-patches@sources.redhat.com>
Subject: Re: A.R. Index for GDB version 20030708
Date: Tue, 08 Jul 2003 15:36:00 -0000 [thread overview]
Message-ID: <04e801c34566$c685e3f0$0202040a@catdog> (raw)
In-Reply-To: <3F0AD10A.9000908@redhat.com>
----- Original Message -----
From: "Andrew Cagney" <ac131313@redhat.com>
To: "Kris Warkentin" <kewarken@qnx.com>
Sent: Tuesday, July 08, 2003 10:11 AM
Subject: A.R. Index for GDB version 20030708
> Mostly yours I believe :-)
> <http://sources.redhat.com/gdb/current/ari/#gdb/nto-procfs.c,dirent.h>
Applied:
ChangeLog
2003-07-08 Kris Warkentin <kewarken@qnx.com>
* nto-procfs.c: Cleaned up a bunch of ARI hits.
Index: nto-procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-procfs.c,v
retrieving revision 1.1
diff -u -r1.1 nto-procfs.c
--- nto-procfs.c 4 Jul 2003 15:48:57 -0000 1.1
+++ nto-procfs.c 8 Jul 2003 15:33:29 -0000
@@ -30,7 +30,7 @@
#include <sys/procfs.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
-#include <dirent.h>
+#include <gdb_dirent.h>
#include <sys/netmgr.h>
#include "gdb_string.h"
@@ -97,7 +97,7 @@
is required is because QNX node descriptors are transient so
we have to re-acquire them every time. */
static unsigned
-nto_node()
+nto_node(void)
{
unsigned node;
@@ -140,7 +140,7 @@
if (errno == ENOTSUP)
printf_filtered ("QNX Net Manager not found.\n");
printf_filtered ("Invalid QNX node %s: error %d (%s).\n", nodestr,
- errno, strerror (errno));
+ errno, safe_strerror (errno));
xfree (nodestr);
nodestr = NULL;
nto_procfs_node = ND_LOCAL_NODE;
@@ -153,7 +153,7 @@
*endstr = 0;
}
}
- sprintf (nto_procfs_path, "%s%s", nodestr ? nodestr : "", "/proc");
+ snprintf (nto_procfs_path, PATH_MAX - 1, "%s%s", nodestr ? nodestr : "",
"/proc");
if (nodestr)
xfree (nodestr);
@@ -161,7 +161,7 @@
if (fd == -1)
{
printf_filtered ("Error opening %s : %d (%s)\n", nto_procfs_path,
errno,
- strerror (errno));
+ safe_strerror (errno));
error ("Invalid procfs arg");
}
@@ -169,7 +169,7 @@
if (devctl (fd, DCMD_PROC_SYSINFO, sysinfo, sizeof buffer, 0) != EOK)
{
printf_filtered ("Error getting size: %d (%s)\n", errno,
- strerror (errno));
+ safe_strerror (errno));
close (fd);
error ("Devctl failed.");
}
@@ -180,7 +180,7 @@
if (!sysinfo)
{
printf_filtered ("Memory error: %d (%s)\n", errno,
- strerror (errno));
+ safe_strerror (errno));
close (fd);
error ("alloca failed.");
}
@@ -189,7 +189,7 @@
if (devctl (fd, DCMD_PROC_SYSINFO, sysinfo, total_size, 0) != EOK)
{
printf_filtered ("Error getting sysinfo: %d (%s)\n", errno,
- strerror (errno));
+ safe_strerror (errno));
close (fd);
error ("Devctl failed.");
}
@@ -270,8 +270,8 @@
dp = opendir (nto_procfs_path);
if (dp == NULL)
{
- printf ("failed to opendir \"%s\" - %d (%s)", nto_procfs_path, errno,
- strerror (errno));
+ fprintf_unfiltered (gdb_stderr, "failed to opendir \"%s\" - %d (%s)",
+ nto_procfs_path, errno, safe_strerror (errno));
return;
}
@@ -289,7 +289,7 @@
closedir (dp);
return;
}
- sprintf (buf, "%s/%s/as", nto_procfs_path, dirp->d_name);
+ snprintf (buf, 511, "%s/%s/as", nto_procfs_path, dirp->d_name);
pid = atoi (dirp->d_name);
}
while (pid == 0);
@@ -298,8 +298,8 @@
fd = open (buf, O_RDONLY);
if (fd == -1)
{
- printf ("failed to open %s - %d (%s)\n", buf, errno,
- strerror (errno));
+ fprintf_unfiltered (gdb_stderr, "failed to open %s - %d (%s)\n",
+ buf, errno, safe_strerror (errno));
closedir (dp);
return;
}
@@ -307,8 +307,9 @@
pidinfo = (procfs_info *) buf;
if (devctl (fd, DCMD_PROC_INFO, pidinfo, sizeof (buf), 0) != EOK)
{
- printf ("devctl DCMD_PROC_INFO failed - %d (%s)\n", errno,
- strerror (errno));
+ fprintf_unfiltered (gdb_stderr,
+ "devctl DCMD_PROC_INFO failed - %d (%s)\n", errno,
+ safe_strerror (errno));
break;
}
num_threads = pidinfo->num_threads;
@@ -544,13 +545,13 @@
{
procfs_status status;
struct sigevent event;
- char path[100];
+ char path[PATH_MAX];
- sprintf (path, "%s/%d/as", nto_procfs_path, PIDGET (ptid));
+ snprintf (path, PATH_MAX - 1, "%s/%d/as", nto_procfs_path, PIDGET
(ptid));
ctl_fd = open (path, O_RDWR);
if (ctl_fd == -1)
error ("Couldn't open proc file %s, error %d (%s)", path, errno,
- strerror (errno));
+ safe_strerror (errno));
if (devctl (ctl_fd, DCMD_PROC_STOP, &status, sizeof (status), 0) != EOK)
error ("Couldn't stop process");
@@ -572,7 +573,7 @@
/* Ask the user what to do when an interrupt is received. */
static void
-interrupt_query ()
+interrupt_query (void)
{
target_terminal_ours ();
@@ -887,7 +888,7 @@
}
static void
-procfs_mourn_inferior ()
+procfs_mourn_inferior (void)
{
if (!ptid_equal (inferior_ptid, null_ptid))
{
@@ -1053,7 +1054,7 @@
sigprocmask (SIG_BLOCK, &set, NULL);
if (pid == -1)
- error ("Error spawning %s: %d (%s)", argv[0], errno, strerror (errno));
+ error ("Error spawning %s: %d (%s)", argv[0], errno, safe_strerror
(errno));
if (fds[0] != STDIN_FILENO)
close (fds[0]);
@@ -1084,13 +1085,13 @@
}
static void
-procfs_stop ()
+procfs_stop (void)
{
devctl (ctl_fd, DCMD_PROC_STOP, NULL, 0, 0);
}
static void
-procfs_kill_inferior ()
+procfs_kill_inferior (void)
{
target_mourn_inferior ();
}
@@ -1098,7 +1099,7 @@
/* Store register REGNO, or all registers if REGNO == -1, from the contents
of REGISTERS. */
static void
-procfs_prepare_to_store ()
+procfs_prepare_to_store (void)
{
}
@@ -1169,7 +1170,7 @@
if (err != EOK)
fprintf_unfiltered (gdb_stderr,
"Warning unable to write regset %d: %s\n",
- regno, strerror (err));
+ regno, safe_strerror (err));
}
}
else
@@ -1193,7 +1194,7 @@
if (err != EOK)
fprintf_unfiltered (gdb_stderr,
"Warning unable to write regset %d: %s\n", regno,
- strerror (err));
+ safe_strerror (err));
}
}
@@ -1242,19 +1243,19 @@
pid = ptid_get_pid (ptid);
tid = ptid_get_tid (ptid);
- n = sprintf (buf, "process %d", pid);
+ n = snprintf (buf, 1023, "process %d", pid);
#if 0 /* NYI */
tip = procfs_thread_info (pid, tid);
if (tip != NULL)
- sprintf (&buf[n], " (state = 0x%02x)", tip->state);
+ snprintf (&buf[n], 1023, " (state = 0x%02x)", tip->state);
#endif
return buf;
}
static void
-init_procfs_ops ()
+init_procfs_ops (void)
{
procfs_ops.to_shortname = "procfs";
procfs_ops.to_longname = "QNX Neutrino procfs child process";
@@ -1307,7 +1308,7 @@
#define OSTYPE_NTO 1
void
-_initialize_procfs ()
+_initialize_procfs (void)
{
sigset_t set;
next parent reply other threads:[~2003-07-08 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3F0AD10A.9000908@redhat.com>
2003-07-08 15:36 ` Kris Warkentin [this message]
2003-07-08 18:53 ` Andrew Cagney
2003-07-08 19:38 ` Kris Warkentin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='04e801c34566$c685e3f0$0202040a@catdog' \
--to=kewarken@qnx.com \
--cc=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox