On 10/22/2014 07:09 AM, Dejan Muhamedagic wrote: > 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. And a little worrisome for these strategies...
Here is what I see for timestamps that look to be about the time of system boot: -r-------- 1 root root 0 Oct 21 15:42 environ lrwxrwxrwx 1 root root 0 Oct 21 15:42 root -> / -r--r--r-- 1 root root 0 Oct 21 15:42 limits dr-x------ 2 root root 0 Oct 21 15:42 fd lrwxrwxrwx 1 root root 0 Oct 21 15:42 exe -> /sbin/init -r--r--r-- 1 root root 0 Oct 21 15:42 stat -r--r--r-- 1 root root 0 Oct 21 15:42 cgroup -r--r--r-- 1 root root 0 Oct 21 15:42 cmdline servidor:/proc/1 $ ls -l /var/log/boot.log -rw-r--r-- 1 root root 5746 Oct 21 15:42 /var/log/boot.log servidor:/proc/1 $ ls -ld . dr-xr-xr-x 9 root root 0 Oct 21 15:42 . So, you can open file descriptors (fd), change your environment and cmdline and (soft) limits. You can't change your exe, or root. Cgroup is new, and I suspect you can't change it. I suspect that the directory timestamp (/proc//<pid>/) won't change either. I wonder if it will change on BSD or Solaris or AIX. /proc info for AIX: http://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.files/proc.htm It doesn't say anything about file timestamps. Solaris info is here: http://docs.oracle.com/cd/E23824_01/html/821-1473/proc-4.html#scrolltoc It also doesn't mention timestamps. FreeBSD is here: http://www.unix.com/man-page/freebsd/5/procfs/
_______________________________________________________ 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/