From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15590 invoked by alias); 8 Jul 2003 15:36:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15547 invoked from network); 8 Jul 2003 15:36:31 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by sources.redhat.com with SMTP; 8 Jul 2003 15:36:31 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3p2/8.9.3) with ESMTP id LAA18203; Tue, 8 Jul 2003 11:27:53 -0400 Received: from catdog ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with SMTP id LAA14982; Tue, 8 Jul 2003 11:36:31 -0400 Message-ID: <04e801c34566$c685e3f0$0202040a@catdog> From: "Kris Warkentin" To: "Andrew Cagney" Cc: "Gdb-Patches@Sources.Redhat.Com" References: <3F0AD10A.9000908@redhat.com> Subject: Re: A.R. Index for GDB version 20030708 Date: Tue, 08 Jul 2003 15:36:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-SW-Source: 2003-07/txt/msg00154.txt.bz2 ----- Original Message ----- From: "Andrew Cagney" To: "Kris Warkentin" Sent: Tuesday, July 08, 2003 10:11 AM Subject: A.R. Index for GDB version 20030708 > Mostly yours I believe :-) > Applied: ChangeLog 2003-07-08 Kris Warkentin * 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 #include #include -#include +#include #include #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;