Date: Wed, 21 Dec 2005 18:41:40 +0300 From: Michael Bushkov <bushman@rsu.ru> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: freebsd-current@FreeBSD.org, Ceri Davies <ceri@submonkey.net> Subject: [PATCH] pidfile_check() possible function Message-ID: <43A977B4.6080200@rsu.ru> In-Reply-To: <20051220140927.GA1671@garage.freebsd.pl> References: <436A0C73.3010405@rsu.ru> <20051103140221.GF29387@submonkey.net> <43A009CB.2090800@rsu.ru> <20051219130928.GE63860@submonkey.net> <20051219135019.GF63860@submonkey.net> <43A6CC9E.6040109@rsu.ru> <20051219152505.GI63860@submonkey.net> <002c01c604c4$60ebe010$0100a8c0@jersey> <20051219183137.GA1103@odin.ac.hmc.edu> <43A7D4A6.6000607@rsu.ru> <20051220140927.GA1671@garage.freebsd.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43A977B4.6080200>