public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Glen Turner <glen.turner@aarnet.edu.au>
To: linux-kernel@vger.kernel.org
Subject: User-space notification of process end
Date: Tue, 03 Feb 2004 14:18:02 +1030	[thread overview]
Message-ID: <1075780082.6747.23.camel@andromache> (raw)


Hi,

I am writing a application which needs to know fairly
promptly if a daemon has died.  I'd prefer not to
alter the daemon source code or to run the program
as a non-daemon child of a daemon watcher process.

I tried using fnctl(..., F_NOTIFY, ...) as
follows

  f = open("/proc/123", O_RDONLY);
  signal(SIGIO, handler);
  fcntl(f, F_NOTIFY, DN_DELETE | DN_RENAME);
  F_ZERO(&f_set);
  F_SET(f, &f_set);
  select(1, NULL, NULL, &f_set, NULL);

hoping I'd see the /proc/<processid>/* files being
removed at process end.

But procfs doesn't seem to support fnctl(.., F_NOTIFY, ...)
for parameters other than DN_ACCESS.  This doesn't seem
to be limited to my code (the dnotify program, which has
much better signal handling, has the same behavior).

Suggestions, particularly ones which don't require polling
for the existence of the watched process, are welcome.

uname -r says 2.4.22-1.2149.nptl, which is the latest
Fedora Core 1 kernel.  I'm willing to try 2.6 if that
supports F_NOTIFY on /proc.

Thanks,
Glen

-- 
Glen Turner         Tel: (08) 8303 3936 or +61 8 8303 3936 
Network Engineer          Email: glen.turner@aarnet.edu.au
Australian Academic & Research Network   www.aarnet.edu.au



             reply	other threads:[~2004-02-03  3:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-03  3:48 Glen Turner [this message]
2004-02-04  7:44 ` User-space notification of process end Paul Jackson

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=1075780082.6747.23.camel@andromache \
    --to=glen.turner@aarnet.edu.au \
    --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