Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Dec 2005 15:09:27 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Michael Bushkov <bushman@rsu.ru>
Cc:        freebsd-current@FreeBSD.org, Ceri Davies <ceri@submonkey.net>
Subject:   Re: pidfile_check() possible function
Message-ID:  <20051220140927.GA1671@garage.freebsd.pl>
In-Reply-To: <43A7D4A6.6000607@rsu.ru>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Tue, Dec 20, 2005 at 12:53:42PM +0300, Michael Bushkov wrote:
+> Hi!
+> I've just had a situation, where I want to know the pid of the already running daemon, but i don't want to create the pidfile in case if there is no daemon running. Such a 
+> situation can occur if the daemon has some kind of controlling program. This program should be able to know the pid of the daemon (to send a signal, or for some logging 
+> purposes).
+> With current pidfile API I don't see an appropriate way to do it. Pidfile_open() call can provide us with the PID. But if there is no daemon, this call will create the 
+> pidfile - and we'll have to use pidfile_remove() to do the cleanup. This behaviour doesn't seem to be appropriate.
+> Is it possible to introduce some function to return the pid of the already running daemon or (-1), for example, if no daemon exists. Possible syntax can be:
+> int pidfile_check(pid_t *pidptr);
+> 
+> What do you think about that?

Maybe... This function is not enough for sure, as you need to provide
file to look for pid at least.
Take a look at takepid() function in usr.bin/pkill/pkill.c to see how
pkill(1) is doing this.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDqBCXForvXbEpPzQRAma3AKDwUQrq46oumKm+/haW7W7PibfhQQCghfjD
NjLCrdlWLjNmrom9C2vPMb4=
=t1WS
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051220140927.GA1671>