Re: [PATCH] Fix /proc pathname sizes on Solaris

Joel Brobecker
2018-09-19T13:21:24Z

> I've done some more digging myself: here's what I found:
>
> * The MAX_PROC_NAME_SIZE part (done slightly differently) was originally
> done by Stefan Teleman when he imported gdb 7.6 into the userland repo
> (gdb.procfs.c.patch).
>
> * The change to create_procinfo originated with April Chin when
> importing gdb 7.12.1 later (001-fix-proc-name-size.patch).
>
> * I had to make minor adjustments for master to account for my removal
> of !NEW_PROC_API
>
> So I'm going to attribute the patch to all three of us ;-)

Sounds good :).

> >> @@ -483,7 +483,7 @@ create_procinfo (int pid, int tid)
> >> }
> >> else
> >> {
> >> - sprintf (pi->pathname, "/proc/%05d/lwp/%d", pid, tid);
> >> + sprintf (pi->pathname, "/proc/%d/lwp/%d", pid, tid);
> >
> > I am wondering how this ever worked for processes whose pid had
> > fewer than 5 digits. I was initially concerned that this patch
> > introduced a change of behavior that would create an incompatibility.
> > But looking at Solaris 2.8 and 2.11 systems, I see processes with
> > 3 or 4 digits PIDs, and the path in /proc doesn't have leading zeroes.
>
> Indeed, and Solaris procfs doesn't care if the <pid> part contains
> additional leading zeros or not.
>
> > I also checked whether the file might be used on platforms other than
> > Solaris (see configure.nat), and this does not appear to be the case.
>
> True: I removed support for all other previous users when getting rid of
> !NEW_PROC_API, IRIX and Tru64 UNIX support that had long been obsoleted.

Excellent. An extra confirmation is always nice.

--
Joel