SPUG: tracking PIDs

Andrew Sweger andrew at sweger.net
Tue Aug 27 12:13:15 CDT 2002


On Mon, 26 Aug 2002, Jonathan Gardner wrote:

> There is a small chance that the child has been long dead and you have cycled 
> through the available PIDs, and a different process is running as that PID, 
> but what can you do about that?

If a somewhat unique value (other than a PID) is included in the command
line of each process spawned in this particular system, this value's
existence can be checked in /proc/$pid/cmdline on systems that support
procfs. So, along with tracking PIDs, these unique values would also need
to be tracked. If the PID is still alive (via the kill 0 test), check the
cmdline to see if it still matches the previously recorded signature.

-- 
Andrew B. Sweger -- The great thing about multitasking is that several
                                things can go wrong at once.


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list