From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc: test /proc/*/fd a bit (+ PF_KTHREAD is ABI!)
Date: Wed, 9 May 2018 19:34:07 +0300 [thread overview]
Message-ID: <20180509163407.GA16034@avx2> (raw)
In-Reply-To: <20180508153920.9e74e1ab86a8b10e8ddf09a0@linux-foundation.org>
On Tue, May 08, 2018 at 03:39:20PM -0700, Andrew Morton wrote:
> On Sat, 5 May 2018 03:04:14 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > This field is struct task_struct::flags in decimal!
> > Check is done by testing PF_KTHREAD flags like we do in kernel.
> >
> > PF_KTREAD value is a part of userspace ABI !!!
>
> erk. Well if there's a need the we could export and support some
> stable interface. I wonder how ps determines this.
Turned out ps (from procps-ng) reads /proc/*/cmdline and if read()
returns 0 prints [] brackets. This is unreliable as
execve("", NULL, NULL);
exists and processes can empty their argv/envp area.
It can do sorting based on "flags" field, so we hopefully can just mask
most of the bits.
At least it deals with ->comm containing ')' right.
prev parent reply other threads:[~2018-05-09 16:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-05 0:04 [PATCH] proc: test /proc/*/fd a bit (+ PF_KTHREAD is ABI!) Alexey Dobriyan
2018-05-08 22:39 ` Andrew Morton
2018-05-09 16:34 ` Alexey Dobriyan [this message]
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=20180509163407.GA16034@avx2 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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