On Wed, Oct 22, 2014 at 02:11:21PM +0100, Tim Small wrote: > On 22/10/14 13:50, Alan Robertson wrote: > > Does anyone know which OSes have either or both of those /proc names? > > Once again, can I recommend taking a look at the start-stop-daemon > source (see earlier posting), which does this stuff, and includes checks > for Linux/Hurd/Sun/OpenBSD/FreeBSD/NetBSD/DragonFly, and whilst I've > only ever used it on Linux, at the very least the BSD side seems to be > maintained: > > http://anonscm.debian.org/cgit/dpkg/dpkg.git/tree/utils/start-stop-daemon.c
Does not solve the problem I was talking about at all. If you only have a pid, it has the exact same problem, it may miss the "pid dead" event because of pid recycling. If you are more specific (user, parent pid, exe name...) it becomes less and less likely -- but it would still be possible. So you may want to add a similar trick to pid_fd = open(/proc/pid); .... fstat(pid_fd) ... Yet an other crazy idea, at least for linux: do not poll, monitor! --> CONFIG_PROC_EVENTS, subscribe to CN_IDX_PROC, wait for PROC_EVENT_EXIT ;-) No, seriously, that's too much trouble to replace a shell oneliner... If however that would be added to start-stop-daemon, it could drop the funky "algorithm" for the kill -0 polling. (which still would need to be supported, because of old kernels) Lars _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/