mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Menage <pmenage@ensim.com>
To: "Mattias Engdegård" <f91-men@nada.kth.se>
Cc: pmenage@ensim.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] Pollable /proc/<pid>/ - avoid SIGCHLD/poll() races
Date: Thu, 04 Oct 2001 13:39:36 -0700	[thread overview]
Message-ID: <E15pFHM-0002H1-00@pmenage-dt.ensim.com> (raw)
In-Reply-To: Your message of "Thu, 04 Oct 2001 16:18:20 +0200." <200110041418.QAA17395@my.nada.kth.se>

>I don't think it's contrived --- writing not a byte, but the pid and
>return status of the dead child to a pipe is an old but useful trick.
>It gives a natural serialisation of child deaths, and also eliminates
>the common race where a child dies before its parent has recorded its
>pid in a data structure. See it as a safe way of converting an
>asynchronous signal to a queued event.

Except that this enhancement is not completely safe, as if you get more
than 1024 children reaped (assuming you send two bytes of pid and two
bytes of status) between checks of the pipe, you'll lose notifications.
Admittedly this should be a problem in the sshd case, but it's not a
perfect solution in general. 

At least if you're only using the pipe to stop select() from blocking,
you don't care about overflowing the pipe as there's no important
information in there anyway.

Paul


  reply	other threads:[~2001-10-04 20:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-04  7:52 Paul Menage
2001-10-04  8:59 ` Christoph Rohland
2001-10-04  9:31   ` Paul Menage
2001-10-04 10:25     ` Christoph Rohland
2001-10-13 15:44     ` Jamie Lokier
2001-10-04 14:18 ` Mattias Engdegård
2001-10-04 20:39   ` Paul Menage [this message]
2001-10-05  9:36     ` Mattias Engdegård
2001-10-13 15:36   ` Jamie Lokier
2001-10-14  2:25     ` John Alvord

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=E15pFHM-0002H1-00@pmenage-dt.ensim.com \
    --to=pmenage@ensim.com \
    --cc=f91-men@nada.kth.se \
    --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

all inboxes | Powered by JetHome®