* User-space notification of process end
@ 2004-02-03 3:48 Glen Turner
2004-02-04 7:44 ` Paul Jackson
0 siblings, 1 reply; 2+ messages in thread
From: Glen Turner @ 2004-02-03 3:48 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: User-space notification of process end
2004-02-03 3:48 User-space notification of process end Glen Turner
@ 2004-02-04 7:44 ` Paul Jackson
0 siblings, 0 replies; 2+ messages in thread
From: Paul Jackson @ 2004-02-04 7:44 UTC (permalink / raw)
To: Glen Turner; +Cc: linux-kernel
> I am writing a application which needs to know fairly promptly if a
> daemon has died. I'd prefer not to ... run the program as a non-daemon
> child of a daemon watcher process.
Why not a watcher process, if I may ask. That is, I'd be tempted to
stash a copy of the daemon's executable, and in place of the original
executalbe put a piece of code that fork/exec'd the stashed copy, waited
for the exit, and notified you as need be.
The available operations on files in the /proc file system tend to
be a very limited subset of those on regular files; so I am not
surprised that F_NOTIFY didn't work.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-04 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-03 3:48 User-space notification of process end Glen Turner
2004-02-04 7:44 ` Paul Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox