Re: Why does getppid() still return old parent pid after setsid()?

Liste des GroupesRevenir à cu programmer 
Sujet : Re: Why does getppid() still return old parent pid after setsid()?
De : Muttley (at) *nospam* DastartdlyHQ.org
Groupes : comp.unix.programmer
Date : 13. Nov 2024, 09:12:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vh1n0t$241cn$1@dont-email.me>
References : 1 2
On Tue, 12 Nov 2024 21:24:52 -0000 (UTC)
Kaz Kylheku <643-408-1753@kylheku.com> boring babbled:
On 2024-11-08, Muttley@DastartdlyHQ.org <Muttley@DastartdlyHQ.org> wrote:
I've tried this code on both MacOS and Linux yet the child process getppid()
still returns its original parent process instead of "1" for init which is
what I'd expect. Isn't setsid() supposed to completely detach the child or
have I misunderstood?
>
No; it's because you put a 1 second delay into the parent to keep it
alive, whereas the child calls getppid() without any such timed
scheduling delay.

True, I fixed it soon after, should have been the child that executed it.
But it doesn't make any difference but now I know why.


Date Sujet#  Auteur
8 Nov 24 * Why does getppid() still return old parent pid after setsid()?20Muttley
8 Nov 24 +* Re: Why does getppid() still return old parent pid after setsid()?2Lew Pitcher
9 Nov 24 i`- Re: Why does getppid() still return old parent pid after setsid()?1Lawrence D'Oliveiro
9 Nov 24 +* Re: Why does getppid() still return old parent pid after setsid()?12Kenny McCormack
9 Nov 24 i+* Re: Why does getppid() still return old parent pid after setsid()?2Lew Pitcher
9 Nov 24 ii`- Re: Why does getppid() still return old parent pid after setsid()?1Lew Pitcher
11 Nov 24 i+* Re: Why does getppid() still return old parent pid after setsid()?7Muttley
11 Nov 24 ii+- Re: Why does getppid() still return old parent pid after setsid()?1Lew Pitcher
11 Nov 24 ii`* Re: Why does getppid() still return old parent pid after setsid()?5Lawrence D'Oliveiro
12 Nov 24 ii `* Re: Why does getppid() still return old parent pid after setsid()?4Kenny McCormack
13 Nov 24 ii  `* Re: Why does getppid() still return old parent pid after setsid()?3Richard Harnden
13 Nov 24 ii   `* Re: Why does getppid() still return old parent pid after setsid()?2Lew Pitcher
13 Nov 24 ii    `- Re: Why does getppid() still return old parent pid after setsid()?1Richard Harnden
11 Nov 24 i`* Re: Why does getppid() still return old parent pid after setsid()?2Lew Pitcher
11 Nov 24 i `- Re: Why does getppid() still return old parent pid after setsid()?1Kenny McCormack
11 Nov 24 +- Re: Why does getppid() still return old parent pid after setsid()?1Rainer Weikusat
12 Nov 24 +* Re: Why does getppid() still return old parent pid after setsid()?2Geoff Clare
12 Nov 24 i`- Re: Why does getppid() still return old parent pid after setsid()?1Muttley
12 Nov 24 `* Re: Why does getppid() still return old parent pid after setsid()?2Kaz Kylheku
13 Nov 24  `- Re: Why does getppid() still return old parent pid after setsid()?1Muttley

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal