From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix /proc pathname sizes on Solaris
Date: Mon, 17 Sep 2018 14:11:00 -0000 [thread overview]
Message-ID: <yddlg80nrhk.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]
I'm slowly working my way through the gdb patches from the
solaris-userland repo
https://github.com/oracle/solaris-userland/tree/master/components/gdb/patches
Some of them are pretty obvious and should be able to go in (such as
this one and the next), while others are either incomplete
(e.g. 008-syscalls.patch, which adds XML descriptions of the Solaris
syscalls, but lacks their registration) or inappropriate in their
current form (unnecessarily intrusive).
This one (001-fix-proc-name-size.patch) should be obvious given the
patches' comment:
# In Solaris, PID_MAX is 999999 (6 digit pid).
# In Solaris, lwpid_t is an unsigned int, so theoretically the lwp id
# could be 10 digits.
Two questions about procedure here:
* AFAIK Oracle has a corporate copyright assignment on file, so the
patches should be covered. Even if that were not the case, this one
and the next are certainly below the 15-line limit for non-trivial
patches.
* Given the code isn't mine, how should we handle attribution? I
suspect the engineer who committed the patch to github is the author,
but don't know for certain. Should I attribute it to her in the
ChangeLog?
Tested on i386-pc-solaris2.11. Ok for master?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-06-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* procfs.c (MAX_PROC_NAME_SIZE): Allow for 6-digit PID_MAX and
uint_t lwpid_t.
(create_procinfo): Print pids in /proc without leading zeros.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-proc-pathname-size.patch --]
[-- Type: text/x-patch, Size: 855 bytes --]
# HG changeset patch
# Parent e6140f0a7128422be8a7e2a148da8de516d676d8
Fix /proc pathname sizes on Solaris
diff --git a/gdb/procfs.c b/gdb/procfs.c
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -233,7 +233,7 @@ enum { READ_WATCHFLAG = WA_READ,
#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/999999/lwp/0123456789/lwpstatus")
typedef struct procinfo {
struct procinfo *next;
@@ -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);
pi->next = parent->thread_list;
parent->thread_list = pi;
}
next reply other threads:[~2018-09-17 14:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 14:11 Rainer Orth [this message]
2018-09-17 18:35 ` Joel Brobecker
2018-09-17 19:27 ` Rainer Orth
2018-09-19 9:04 ` Rainer Orth
2018-09-19 13:21 ` Joel Brobecker
2018-09-19 12:58 ` Tom Tromey
2018-09-19 13:28 ` Rainer Orth
2018-09-19 15:16 ` Pedro Alves
2018-09-19 17:42 ` Rainer Orth
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=yddlg80nrhk.fsf@CeBiTec.Uni-Bielefeld.DE \
--to=ro@cebitec.uni-bielefeld.de \
--cc=gdb-patches@sourceware.org \
/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