On Wed, Oct 22, 2014 at 06:50:37AM -0600, Alan Robertson wrote:
> On 10/22/2014 03:33 AM, Dejan Muhamedagic wrote:
> > Hi Alan,
> >
> > On Mon, Oct 20, 2014 at 02:52:13PM -0600, Alan Robertson wrote:
> >> For the Assimilation code I use the full pathname of the binary from
> >> /proc to tell if it's "one of mine".  That's not perfect if you're using
> >> an interpreted language.  It works quite well for compiled languages.
> > Yes, though not perfect, that may be good enough. I supposed that
> > the probability that the very same program gets the same recycled
> > pid is rather low. (Or is it?)
> From my 'C' code I could touch the lock file to match the timestamp of
> the /proc/pid/stat (or /proc/pid/exe) symlink -- and verify that they
> match.  If there is no /proc/pid/stat, then you won't get that extra
> safeguard.  But as you suggest, it decreases the probability by orders
> of magnitude even without the
> 
> The /proc/pid/exe symlink appears to have the same timestamp as
> /proc/pid/stat

Hmm, not here:

$ sudo ls -lt /proc/1
...
lrwxrwxrwx 1 root root 0 Aug 27 13:51 exe -> /sbin/init
dr-x------ 2 root root 0 Aug 27 13:51 fd
-r--r--r-- 1 root root 0 Aug 27 13:20 cmdline
-r--r--r-- 1 root root 0 Aug 27 13:18 stat

And the process (init) has been running since July:

$ ps auxw | grep -w [i]nit
root         1  0.0  0.0  10540   780 ?        Ss   Jul07   1:03 init [3]

Interesting.

> Does anyone know which OSes have either or both of those /proc names?

Nope, not me.

Cheers,

Dejan

>     -- AlanRobertson
>        al...@unix.sh
> 
> 
> _______________________________________________________
> 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/
_______________________________________________________
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/

Reply via email to