From owner-freebsd-bugs Tue Jun 26 20:20:13 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5561F37B406 for ; Tue, 26 Jun 2001 20:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5R3K2313969; Tue, 26 Jun 2001 20:20:02 -0700 (PDT) (envelope-from gnats) Received: from ns.itga.com.au (ns.itga.com.au [202.53.40.210]) by hub.freebsd.org (Postfix) with ESMTP id A1CC237B405 for ; Tue, 26 Jun 2001 20:10:15 -0700 (PDT) (envelope-from gnb@itga.com.au) Received: from lightning.itga.com.au (lightning.itga.com.au [192.168.71.20]) by ns.itga.com.au (8.9.3/8.9.3) with ESMTP id NAA04229 for ; Wed, 27 Jun 2001 13:10:12 +1000 (EST) (envelope-from gnb@itga.com.au) Received: from hellcat.itga.com.au (hellcat.itga.com.au [192.168.71.163]) by lightning.itga.com.au (8.9.3/8.9.3) with ESMTP id NAA25639; Wed, 27 Jun 2001 13:08:57 +1000 (EST) Received: (from gnb@localhost) by hellcat.itga.com.au (8.11.4/8.11.4) id f5R38vB21346; Wed, 27 Jun 2001 13:08:57 +1000 (EST) (envelope-from gnb) Message-Id: <200106270308.f5R38vB21346@hellcat.itga.com.au> Date: Wed, 27 Jun 2001 13:08:57 +1000 (EST) From: Gregory Bond To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/28435: [patch] allow newsyslog to signal process groups Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 28435 >Category: bin >Synopsis: [patch] allow newsyslog to signal process groups >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jun 26 20:20:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Gregory Bond >Release: FreeBSD 4.3-STABLE i386 >Organization: ITG Australia Limited >Environment: System: FreeBSD hellcat.itga.com.au 4.3-STABLE FreeBSD 4.3-STABLE #21: Mon Jun 18 13:41:36 EST 2001 toor@hellcat.itga.com.au:/usr/obj/usr/src/sys/Hellcat i386 >Description: Newsyslog allows signalling of a single process when log files are rotated. But some applications have several processes that need to be signalled. >How-To-Repeat: Examine the source/man page. >Fix: The attached patch (against 4-Stable) allows the use of a negative PID in the pidfile to send the signal to a process group instead of a single process. See the kill(2) man page. Index: newsyslog.8 =================================================================== RCS file: /usr/ncvs/src/usr.sbin/newsyslog/newsyslog.8,v retrieving revision 1.23.2.4 diff -u -r1.23.2.4 newsyslog.8 --- newsyslog.8 2001/04/26 02:37:08 1.23.2.4 +++ newsyslog.8 2001/06/27 02:57:25 @@ -280,7 +280,12 @@ field is present, a .Ar signal_number is sent the process id contained in this -file. This field must start with "/" in order to be recognized +file. If this number is negative, it is treated as (the negative of) +a process group ID and the signal is sent to all members of that +process group. See the +.Xr kill 2 +man page for details. +This field must start with "/" in order to be recognized properly. .It Ar signal_number This optional field specifies Index: newsyslog.c =================================================================== RCS file: /usr/ncvs/src/usr.sbin/newsyslog/newsyslog.c,v retrieving revision 1.25.2.2 diff -u -r1.25.2.2 newsyslog.c --- newsyslog.c 2000/10/20 00:44:27 1.25.2.2 +++ newsyslog.c 2001/06/27 02:55:37 @@ -738,7 +738,8 @@ else { if (fgets(line, BUFSIZ, f)) { pid = atol(line); - if (pid < MIN_PID || pid > MAX_PID) { + if (pid >= 0 && (pid < MIN_PID || pid > MAX_PID) || + pid < 0 && (pid > -MIN_PID || pid < -MAX_PID)) { warnx("preposterous process number: %d", (int) pid); pid = 0; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message