From owner-freebsd-current@FreeBSD.ORG Tue Dec 20 09:48:47 2005 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6013916A41F; Tue, 20 Dec 2005 09:48:47 +0000 (GMT) (envelope-from bushman@rsu.ru) Received: from mail.r61.net (mail.r61.net [195.208.245.249]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2759243D64; Tue, 20 Dec 2005 09:48:38 +0000 (GMT) (envelope-from bushman@rsu.ru) Received: from [195.208.252.201] (celsius.cc.rsu.ru [195.208.252.201]) by mail.r61.net (8.13.4/8.13.4) with ESMTP id jBK9mXre003896; Tue, 20 Dec 2005 12:48:34 +0300 (MSK) (envelope-from bushman@rsu.ru) Message-ID: <43A7D4A6.6000607@rsu.ru> Date: Tue, 20 Dec 2005 12:53:42 +0300 From: Michael Bushkov User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051018) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pjd@FreeBSD.org References: <20051102001507.GB14638@odin.ac.hmc.edu> <20051103124027.GE29387@submonkey.net> <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> In-Reply-To: <20051219183137.GA1103@odin.ac.hmc.edu> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.86.2, clamav-milter version 0.86 on asterix.r61.net X-Virus-Status: Clean Cc: freebsd-current@FreeBSD.org, Ceri Davies Subject: pidfile_check() possible function X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2005 09:48:47 -0000 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? With best regards, Michael