[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

User-space notification of process end



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 _at_ aarnet.edu.au
Australian Academic & Research Network   www.aarnet.edu.au


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: