Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Support -p <pidfile> option



details:   https://anonhg.NetBSD.org/src/rev/a93d58e4a41e
branches:  trunk
changeset: 819755:a93d58e4a41e
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Dec 16 09:09:38 2016 +0000

description:
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.

diffstat:

 doc/CHANGES              |   3 ++-
 usr.sbin/rtadvd/rtadvd.8 |  12 ++++++++++--
 usr.sbin/rtadvd/rtadvd.c |  12 ++++++++----
 3 files changed, 20 insertions(+), 7 deletions(-)

diffs (103 lines):

diff -r a1869f0ceb2d -r a93d58e4a41e doc/CHANGES
--- a/doc/CHANGES       Fri Dec 16 08:47:36 2016 +0000
+++ b/doc/CHANGES       Fri Dec 16 09:09:38 2016 +0000
@@ -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 @@
        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]
diff -r a1869f0ceb2d -r a93d58e4a41e usr.sbin/rtadvd/rtadvd.8
--- a/usr.sbin/rtadvd/rtadvd.8  Fri Dec 16 08:47:36 2016 +0000
+++ b/usr.sbin/rtadvd/rtadvd.8  Fri Dec 16 09:09:38 2016 +0000
@@ -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 @@
 .\"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
diff -r a1869f0ceb2d -r a93d58e4a41e usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Fri Dec 16 08:47:36 2016 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Fri Dec 16 09:09:38 2016 +0000
@@ -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 @@
        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 @@
                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 @@
        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 @@
 
 #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__);



Home | Main Index | Thread Index | Old Index