Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: A.R. Index for GDB version 20030708
       [not found] <3F0AD10A.9000908@redhat.com>
@ 2003-07-08 15:36 ` Kris Warkentin
  2003-07-08 18:53   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Warkentin @ 2003-07-08 15:36 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Gdb-Patches@Sources.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;




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A.R. Index for GDB version 20030708
  2003-07-08 15:36 ` A.R. Index for GDB version 20030708 Kris Warkentin
@ 2003-07-08 18:53   ` Andrew Cagney
  2003-07-08 19:38     ` Kris Warkentin
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2003-07-08 18:53 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: Gdb-Patches@Sources.Redhat.Com

> 2003-07-08  Kris Warkentin  <kewarken@qnx.com>
> 
>  * nto-procfs.c: Cleaned up a bunch of ARI hits.
> 

Kris, don't forget, the change log should specify what was changed, not 
why.  For instance:

	...: Include "gdb_dirent.h" instead of <dirent.h", use strict ISO C, 
use safe_strerror.  Clean up ARI hits.

I'd tweak the changelog,

Andrew



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A.R. Index for GDB version 20030708
  2003-07-08 18:53   ` Andrew Cagney
@ 2003-07-08 19:38     ` Kris Warkentin
  0 siblings, 0 replies; 3+ messages in thread
From: Kris Warkentin @ 2003-07-08 19:38 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Gdb-Patches@Sources.Redhat.Com

diff -u -r1.4499 ChangeLog
--- ChangeLog   8 Jul 2003 15:36:44 -0000       1.4499
+++ ChangeLog   8 Jul 2003 19:36:52 -0000
@@ -1,6 +1,9 @@
 2003-07-08  Kris Warkentin  <kewarken@qnx.com>

        * nto-procfs.c: Cleaned up a bunch of ARI hits.
+       Include "gdb_dirent.h" instead of <dirent.h>, replace all instances
+       of strerror with safe_strerror, use ISO C function definitions,
+       and replace instances of sprintf with snprintf.

cheers,

Kris

----- Original Message ----- 
From: "Andrew Cagney" <ac131313@redhat.com>
To: "Kris Warkentin" <kewarken@qnx.com>
Cc: "Gdb-Patches@Sources.Redhat.Com" <gdb-patches@sources.redhat.com>
Sent: Tuesday, July 08, 2003 2:53 PM
Subject: Re: A.R. Index for GDB version 20030708


> > 2003-07-08  Kris Warkentin  <kewarken@qnx.com>
> > 
> >  * nto-procfs.c: Cleaned up a bunch of ARI hits.
> > 
> 
> Kris, don't forget, the change log should specify what was changed, not 
> why.  For instance:
> 
> ...: Include "gdb_dirent.h" instead of <dirent.h", use strict ISO C, 
> use safe_strerror.  Clean up ARI hits.
> 
> I'd tweak the changelog,
> 
> Andrew
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-08 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3F0AD10A.9000908@redhat.com>
2003-07-08 15:36 ` A.R. Index for GDB version 20030708 Kris Warkentin
2003-07-08 18:53   ` Andrew Cagney
2003-07-08 19:38     ` Kris Warkentin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox