Re: [PATCH v6 2/2] tr2: log parent process name
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 2, 2021, 12:47 UTC
- Message-ID
- <874kc8ovw5.fsf@evledraar.gmail.com>
- In-Reply-To
- <87o8agp29o.fsf@evledraar.gmail.com>
On Mon, Aug 02 2021, Ævar Arnfjörð Bjarmason wrote:
Show 13 quoted lines
> On Wed, Jul 21 2021, Emily Shaffer wrote: > >> Git for Windows also gathers information about more than one generation >> of parent. In Linux further ancestry info can be gathered with procfs, >> but it's unwieldy to do so. > > Having read the win32 get_processes() implementation and read proc(5) I > don't get how it's unweildy to do so on Linux? Perhaps I'm missing some > special-case but this rather simple patch-on-top seems to do the job for > me. This includes the unrelated enum/switch/case change I suggested. > > I can submit it as a patch-on-top with SOB etc, but maybe there's some > subtle reason it won't work properly. It works for me, I get e.g.:
Just a note[...]:
> + strbuf_addf(&procfs_path, "/proc/%d/stat", pid); > + fp = fopen(procfs_path.buf, "r"); > + if (!fp) > + return;
I think this is mostly ready, but is still clearly in POC state needing polishing, e.g. I didn't bother to close "fp" here, but a final patch to implement this approach should of course do that.