* procfs.c thinks pid's can't be bigger than 99999
@ 2001-07-02 5:47 John Hughes
2001-07-02 11:56 ` Michael Snyder
2001-07-03 12:28 ` Andrew Cagney
0 siblings, 2 replies; 5+ messages in thread
From: John Hughes @ 2001-07-02 5:47 UTC (permalink / raw)
To: gdb-patches
but on some systems, for example UnixWare NSC they
can be quite a lot bigger.
--- procfs.c.orig Tue May 15 02:03:36 2001
+++ procfs.c Mon Jul 2 14:40:05 2001
@@ -295,7 +295,7 @@
# define AS_PROC_NAME_FMT "/proc/%d/as"
# define MAP_PROC_NAME_FMT "/proc/%d/map"
# define STATUS_PROC_NAME_FMT "/proc/%d/status"
-# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
+# define MAX_PROC_NAME_SIZE sizeof("/proc/1048576/lwp/8096/lstatus")
# endif
/* the name of the proc status struct depends on the implementation */
typedef pstatus_t gdb_prstatus_t;
--
John Hughes <john@Calva.COM>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: procfs.c thinks pid's can't be bigger than 99999
2001-07-02 5:47 procfs.c thinks pid's can't be bigger than 99999 John Hughes
@ 2001-07-02 11:56 ` Michael Snyder
2001-07-02 13:43 ` Kevin Buettner
2001-07-03 12:28 ` Andrew Cagney
1 sibling, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2001-07-02 11:56 UTC (permalink / raw)
To: John Hughes; +Cc: gdb-patches
John Hughes wrote:
>
> but on some systems, for example UnixWare NSC they
> can be quite a lot bigger.
>
> --- procfs.c.orig Tue May 15 02:03:36 2001
> +++ procfs.c Mon Jul 2 14:40:05 2001
> @@ -295,7 +295,7 @@
> # define AS_PROC_NAME_FMT "/proc/%d/as"
> # define MAP_PROC_NAME_FMT "/proc/%d/map"
> # define STATUS_PROC_NAME_FMT "/proc/%d/status"
> -# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
> +# define MAX_PROC_NAME_SIZE sizeof("/proc/1048576/lwp/8096/lstatus")
> # endif
> /* the name of the proc status struct depends on the implementation */
> typedef pstatus_t gdb_prstatus_t;
Well, actually, aren't we going to run into trouble if
pids are bigger than 16 bits? Or did Kevin Buettner's
recent changes take care of that?
Other than that, I have no problem with this change.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: procfs.c thinks pid's can't be bigger than 99999
2001-07-02 11:56 ` Michael Snyder
@ 2001-07-02 13:43 ` Kevin Buettner
2001-07-02 15:15 ` Michael Snyder
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Buettner @ 2001-07-02 13:43 UTC (permalink / raw)
To: Michael Snyder, John Hughes; +Cc: gdb-patches
On Jul 2, 11:56am, Michael Snyder wrote:
> John Hughes wrote:
> >
> > but on some systems, for example UnixWare NSC they
> > can be quite a lot bigger.
> >
> > --- procfs.c.orig Tue May 15 02:03:36 2001
> > +++ procfs.c Mon Jul 2 14:40:05 2001
> > @@ -295,7 +295,7 @@
> > # define AS_PROC_NAME_FMT "/proc/%d/as"
> > # define MAP_PROC_NAME_FMT "/proc/%d/map"
> > # define STATUS_PROC_NAME_FMT "/proc/%d/status"
> > -# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
> > +# define MAX_PROC_NAME_SIZE sizeof("/proc/1048576/lwp/8096/lstatus")
> > # endif
> > /* the name of the proc status struct depends on the implementation */
> > typedef pstatus_t gdb_prstatus_t;
>
> Well, actually, aren't we going to run into trouble if
> pids are bigger than 16 bits? Or did Kevin Buettner's
> recent changes take care of that?
My recent changes took care of that.
> Other than that, I have no problem with this change.
I think John's change is a step in the right direction, but the name
is still not large enough. In AIX 5, the pids and tids seem to be
able to occupy all of 32 bits. Therefore, I propose that we use
the following:
#define MAX_PROC_NAME_SIZE sizeof("/proc/1234567890/lwp/1234567890/lstatus")
Note that 2^32-1 is 4294967295 which requires ten digits. Using
"1234567890" makes it obvious that ten digits are needed.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: procfs.c thinks pid's can't be bigger than 99999
2001-07-02 13:43 ` Kevin Buettner
@ 2001-07-02 15:15 ` Michael Snyder
0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2001-07-02 15:15 UTC (permalink / raw)
To: Kevin Buettner; +Cc: John Hughes, gdb-patches
Kevin Buettner wrote:
>
> On Jul 2, 11:56am, Michael Snyder wrote:
>
> > John Hughes wrote:
> > >
> > > but on some systems, for example UnixWare NSC they
> > > can be quite a lot bigger.
> > >
> > > --- procfs.c.orig Tue May 15 02:03:36 2001
> > > +++ procfs.c Mon Jul 2 14:40:05 2001
> > > @@ -295,7 +295,7 @@
> > > # define AS_PROC_NAME_FMT "/proc/%d/as"
> > > # define MAP_PROC_NAME_FMT "/proc/%d/map"
> > > # define STATUS_PROC_NAME_FMT "/proc/%d/status"
> > > -# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
> > > +# define MAX_PROC_NAME_SIZE sizeof("/proc/1048576/lwp/8096/lstatus")
> > > # endif
> > > /* the name of the proc status struct depends on the implementation */
> > > typedef pstatus_t gdb_prstatus_t;
> >
> > Well, actually, aren't we going to run into trouble if
> > pids are bigger than 16 bits? Or did Kevin Buettner's
> > recent changes take care of that?
>
> My recent changes took care of that.
>
> > Other than that, I have no problem with this change.
>
> I think John's change is a step in the right direction, but the name
> is still not large enough. In AIX 5, the pids and tids seem to be
> able to occupy all of 32 bits. Therefore, I propose that we use
> the following:
>
> #define MAX_PROC_NAME_SIZE sizeof("/proc/1234567890/lwp/1234567890/lstatus")
>
> Note that 2^32-1 is 4294967295 which requires ten digits. Using
> "1234567890" makes it obvious that ten digits are needed.
Good, this has my approval.
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: procfs.c thinks pid's can't be bigger than 99999
2001-07-02 5:47 procfs.c thinks pid's can't be bigger than 99999 John Hughes
2001-07-02 11:56 ` Michael Snyder
@ 2001-07-03 12:28 ` Andrew Cagney
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2001-07-03 12:28 UTC (permalink / raw)
To: John Hughes; +Cc: gdb-patches
> but on some systems, for example UnixWare NSC they
> can be quite a lot bigger.
>
> --- procfs.c.orig Tue May 15 02:03:36 2001
> +++ procfs.c Mon Jul 2 14:40:05 2001
> @@ -295,7 +295,7 @@
> # define AS_PROC_NAME_FMT "/proc/%d/as"
> # define MAP_PROC_NAME_FMT "/proc/%d/map"
> # define STATUS_PROC_NAME_FMT "/proc/%d/status"
> -# define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
> +# define MAX_PROC_NAME_SIZE sizeof("/proc/1048576/lwp/8096/lstatus")
> # endif
> /* the name of the proc status struct depends on the implementation */
> typedef pstatus_t gdb_prstatus_t;
Um, I think it would be a lot better to size the buffer dynamically.
xasprintf() is one way of doing that. Anyway, I think the main thing is
to fix the buffer overrun not hide it :-)
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-07-03 12:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02 5:47 procfs.c thinks pid's can't be bigger than 99999 John Hughes
2001-07-02 11:56 ` Michael Snyder
2001-07-02 13:43 ` Kevin Buettner
2001-07-02 15:15 ` Michael Snyder
2001-07-03 12:28 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox