Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jul 2003 22:50:18 +0200 (CEST)
From:      Lukas Ertl <l.ertl@univie.ac.at>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/54113: [PATCH] devd(8) doesn't write correct pid into /var/run/devd.pid
Message-ID:  <200307042050.h64KoI9m001049@korben.in.tern>
Resent-Message-ID: <200307042100.h64L0R05095430@freefall.freebsd.org>

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

>Number:         54113
>Category:       bin
>Synopsis:       [PATCH] devd(8) doesn't write correct pid into /var/run/devd.pid
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 04 14:00:27 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Ertl
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Vienna University Computer Center
>Environment:
System: FreeBSD korben 5.1-CURRENT FreeBSD 5.1-CURRENT #20: Fri Jul 4 18:38:33 CEST 2003 le@korben:/usr/obj/usr/src/sys/KORBEN i386


	
>Description:

devd(8) writes its pid into /var/run/devd.pid, but the pid there is 1 
lower than the actual pid of devd. This is because devd is started by
default without the -n switch, so it writes the pidfile before calling
daemon(8).

>How-To-Repeat:

# devd
# cat /var/run/devd.pid
720
# ps auxww | grep devd
root    721  0,0  0,2   772  532  ??  Is   10:22pm   0:00,00 devd

>Fix:

Simply write the pidfile again after calling daemon(3).

--- devd.diff begins here ---
Index: sbin/devd/devd.cc
===================================================================
RCS file: /usr/local/bsdcvs/src/sbin/devd/devd.cc,v
retrieving revision 1.14
diff -u -r1.14 devd.cc
--- sbin/devd/devd.cc	2 May 2003 17:38:08 -0000	1.14
+++ sbin/devd/devd.cc	4 Jul 2003 20:42:21 -0000
@@ -596,6 +596,7 @@
 				if (Dflag)
 					fprintf(stderr, "Calling daemon\n");
 				daemon(0, 0);
+				cfg.drop_pidfile();
 				once++;
 			}
 		}
--- devd.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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