Subject: Re: [PATCH v6 2/2] tr2: log parent process name

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 02 Aug 2021 14:47:13 +0200

On Mon, Aug 02 2021, Ævar Arnfjörð Bjarmason wrote:

> 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.