[PATCH v2 2/2] ioctl console test v2

Bran S archsbran at gmail.com
Wed Mar 18 16:25:20 UTC 2020


On Wed, 18 Mar 2020 at 02:49, Eugene Syromiatnikov <esyr at redhat.com> wrote:
>
> On Tue, Mar 17, 2020 at 09:52:48PM +0530, Bran S wrote:
> > On Mon, 16 Mar 2020 at 15:56, Eugene Syromiatnikov <esyr at redhat.com> wrote:
> > >
> > > On Mon, Mar 16, 2020 at 03:37:07PM +0530, Bran S wrote:
> > > > There can be any number of subreapers right ?
> > >
> > > In a system? Yes, but the processes are re-parented to the closest one
> > > up in the process tree hierarchy, so the subreaper a process
> > > is to be re-parented to is pretty much determined.
> > >
> >
> > So we follow the hierarchy upwards and for each pid we check if it is
> > a subreaper if yes then the ppid should match to it.
> > Is that correct ? If not please point me in the direction so as to
> > find the subreaper's process id.
>
> Well, I can only repeat the Dmitry's suggestion[1] to check out
> the documentation for the respective prctl(2) options.
>
> [1] https://lists.strace.io/pipermail/strace-devel/2020-March/009500.html

I think I am missing something obvious here. PR_GET_CHILD_SUBREAPER
tells if current process is a subreaper.
----
    int ret;
    unsigned long arg2;
    ret = prctl(PR_GET_CHILD_SUBREAPER, &arg2);

    printf("ret: %d\n", ret);
    printf("arg2: %d\n", arg2);
----
How can it be used to confirm that the ppid process is a subreaper is
unclear to me ? I will look through it all once again with fresh eyes.
On a sidenote: Is there a difference between subreaper and child
subreaper ? I think they are similar terms.


More information about the Strace-devel mailing list