From owner-freebsd-ports@FreeBSD.ORG Sun Jun 1 22:00:55 2014 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09B9BB1D for ; Sun, 1 Jun 2014 22:00:55 +0000 (UTC) Received: from mail-in-05.arcor-online.net (mail-in-05.arcor-online.net [151.189.21.45]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx.arcor.de", Issuer "Thawte SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4EF22508 for ; Sun, 1 Jun 2014 22:00:54 +0000 (UTC) Received: from mail-in-15-z2.arcor-online.net (mail-in-15-z2.arcor-online.net [151.189.8.32]) by mx.arcor.de (Postfix) with ESMTP id 740EBE3B9B for ; Sun, 1 Jun 2014 23:30:04 +0200 (CEST) Received: from mail-in-04.arcor-online.net (mail-in-04.arcor-online.net [151.189.21.44]) by mail-in-15-z2.arcor-online.net (Postfix) with ESMTP id 709D933EA1F for ; Sun, 1 Jun 2014 23:30:04 +0200 (CEST) X-Greylist: Passed host: 188.105.80.80 X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-04.arcor-online.net AB131A9D4B Received: from lorvorc.mips.inka.de (dslb-188-105-080-080.pools.arcor-ip.net [188.105.80.80]) by mail-in-04.arcor-online.net (Postfix) with ESMTPS id AB131A9D4B for ; Sun, 1 Jun 2014 23:30:02 +0200 (CEST) Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.14.9/8.14.7) with ESMTP id s51LU2nW067124 for ; Sun, 1 Jun 2014 23:30:02 +0200 (CEST) (envelope-from news@lorvorc.mips.inka.de) Received: (from news@localhost) by lorvorc.mips.inka.de (8.14.9/8.14.9/Submit) id s51LU2A2067123 for freebsd-ports@freebsd.org; Sun, 1 Jun 2014 23:30:02 +0200 (CEST) (envelope-from news) To: freebsd-ports@freebsd.org From: Christian Weisgerber Newsgroups: list.freebsd.ports Subject: Re: [net/openntpd] pidfile support Date: Sun, 1 Jun 2014 21:30:02 +0000 (UTC) Lines: 49 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: lorvorc.mips.inka.de 1401658202 65898 ::1 (1 Jun 2014 21:30:02 GMT) X-Complaints-To: usenet@mips.inka.de User-Agent: slrn/1.0.1 (FreeBSD) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jun 2014 22:00:55 -0000 On 2014-05-31, Tomek WaƂaszek wrote: > I was missing pid file support in OpenNTPD. I've created a patch that > enables pidfile /var/run/ntpd.pid in OpenNTPD and now I can define in the Well, upstream doesn't support a pid file on purpose. (General OpenBSD policy.) The argument is that the pid file construct is inherently unreliable and dangerous: if the daemon dies, the pid file remains and the pid may point to some random other process. > rc script pidfile location. With pidfile location I dont see any more this > annoying message when restarting and stopping: > > [root@vps24009 ~]# /usr/local/etc/rc.d/openntpd stop > Stopping openntpd. > kill: 20188: No such process > kill: 20189: No such process Yes, this is an unfortunate race. The fix would be to match the process name against "ntpd: [priv]", the same way OpenBSD's native rc script does. Unfortunately, this seems to be impossible with rc.subr(8): only the first word of the process is matched against procname. I could override check_process; see below. Not sure how good or bad an idea that is. This is a general issue that should affect other daemons ported from OpenBSD as well, e.g. net/openbgpd. Index: files/openntpd.in =================================================================== --- files/openntpd.in (revision 356166) +++ files/openntpd.in (working copy) @@ -15,6 +15,11 @@ . /etc/rc.subr +check_process() +{ + /bin/pgrep -f 'ntpd: \[priv\]' +} + name=openntpd rcvar=openntpd_enable -- Christian "naddy" Weisgerber naddy@mips.inka.de