[PATCH] pidfile_check() possible function

From: Michael Bushkov <bushman_at_rsu.ru>
Date: Wed, 21 Dec 2005 18:41:40 +0300
Hi!
I've made a sample implementation of pidfile_check() function based on 
pkill's takepid() function. It's interface is like this:
int pidfile_check(const char *path, int pidfilelock, pid_t *pidptr);

The patch is here:
http://rsu.ru/~bushman/libpidfile.patch

pidfile_check returns 0 if the pidfile owner seems to be active and (-1) 
otherwise (in case of failure errno would also be set).

The path argument is the path of the pidfile. If pidfilelock is not 0, 
the function will attempt to lock the file to check if the pidfile owner 
is currently running. If pidptr is not NULL and pidfile owner seems to 
be active, it's pid will be placed in pidptr.

Looking forward for your comments and suggestions!
Michael Bushkov
Received on Wed Dec 21 2005 - 14:36:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:49 UTC