Module Name:    src
Committed By:   ozaki-r
Date:           Fri Dec 16 09:09:39 UTC 2016

Modified Files:
        src/doc: CHANGES
        src/usr.sbin/rtadvd: rtadvd.8 rtadvd.c

Log Message:
Support -p <pidfile> option

It's needed to avoid using /var/run/rtadvd.pid on ATF tests and
run multiple instances of rump.rtadvd on a test.


To generate a diff of this commit:
cvs rdiff -u -r1.2224 -r1.2225 src/doc/CHANGES
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/rtadvd/rtadvd.8
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/rtadvd/rtadvd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2224 src/doc/CHANGES:1.2225
--- src/doc/CHANGES:1.2224	Thu Dec 15 12:51:02 2016
+++ src/doc/CHANGES	Fri Dec 16 09:09:38 2016
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2224 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2225 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -433,3 +433,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	ptrace(2): Add hardware assisted breakpoint/watchpoint API:
 		PT_READ_WATCHPOINT, PT_WRITE_WATCHPOINT and
 		PT_COUNT_WATCHPOINTS [kamil 20161215]
+	rtadvd(8): Support -p <pidfile> option. [ozaki-r 20161216]

Index: src/usr.sbin/rtadvd/rtadvd.8
diff -u src/usr.sbin/rtadvd/rtadvd.8:1.24 src/usr.sbin/rtadvd/rtadvd.8:1.25
--- src/usr.sbin/rtadvd/rtadvd.8:1.24	Thu Dec 13 21:49:38 2012
+++ src/usr.sbin/rtadvd/rtadvd.8	Fri Dec 16 09:09:38 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rtadvd.8,v 1.24 2012/12/13 21:49:38 wiz Exp $
+.\"	$NetBSD: rtadvd.8,v 1.25 2016/12/16 09:09:38 ozaki-r Exp $
 .\"	$KAME: rtadvd.8,v 1.24 2002/05/31 16:16:08 jinmei Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 13, 2006
+.Dd December 16, 2016
 .Dt RTADVD 8
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Op Fl DdfRs
 .Op Fl c Ar configfile
 .Op Fl M Ar ifname
+.Op Fl p Ar pidfile
 .Ar interface ...
 .Sh DESCRIPTION
 .Nm
@@ -140,6 +141,13 @@ option, which enables routing renumberin
 .\"Enables mobile IPv6 support.
 .\"This changes the content of router advertisement option, as well as
 .\"permitted configuration directives.
+.It Fl p Ar pidfile
+Specify an alternate location,
+.Ar pidfile ,
+for the PID file.
+By default,
+.Pa /var/run/rtadvd.pid
+is used.
 .It Fl R
 Accept router renumbering requests.
 If you enable it, an

Index: src/usr.sbin/rtadvd/rtadvd.c
diff -u src/usr.sbin/rtadvd/rtadvd.c:1.51 src/usr.sbin/rtadvd/rtadvd.c:1.52
--- src/usr.sbin/rtadvd/rtadvd.c:1.51	Wed Nov 11 07:48:41 2015
+++ src/usr.sbin/rtadvd/rtadvd.c	Fri Dec 16 09:09:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.c,v 1.51 2015/11/11 07:48:41 ozaki-r Exp $	*/
+/*	$NetBSD: rtadvd.c,v 1.52 2016/12/16 09:09:38 ozaki-r Exp $	*/
 /*	$KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -180,9 +180,10 @@ main(int argc, char *argv[])
 	int i, ch;
 	int fflag = 0, logopt;
 	struct passwd *pw;
+	const char *pidfilepath = NULL;
 
 	/* get command line options and arguments */
-#define OPTIONS "c:dDfM:Rs"
+#define OPTIONS "c:dDfM:p:Rs"
 	while ((ch = getopt(argc, argv, OPTIONS)) != -1) {
 #undef OPTIONS
 		switch (ch) {
@@ -201,6 +202,9 @@ main(int argc, char *argv[])
 		case 'M':
 			mcastif = optarg;
 			break;
+		case 'p':
+			pidfilepath = optarg;
+			break;
 		case 'R':
 			fprintf(stderr, "rtadvd: "
 				"the -R option is currently ignored.\n");
@@ -217,7 +221,7 @@ main(int argc, char *argv[])
 	if (argc == 0) {
 		fprintf(stderr,
 			"usage: rtadvd [-DdfRs] [-c conffile]"
-			" [-M ifname] interface ...\n");
+			" [-M ifname] [-p pidfile] interface ...\n");
 		exit(1);
 	}
 
@@ -262,7 +266,7 @@ main(int argc, char *argv[])
 
 #ifdef __NetBSD__
 	/* record the current PID */
-	if (pidfile(NULL) < 0) {
+	if (pidfile(pidfilepath) < 0) {
 		syslog(LOG_ERR,
 		    "<%s> failed to open the pid log file, run anyway.",
 		    __func__);

Reply via email to