On Tue, May 08, 2018 at 03:39:20PM -0700, Andrew Morton wrote:
> On Sat, 5 May 2018 03:04:14 +0300 Alexey Dobriyan <adobri...@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.

Reply via email to