Source-Changes-HG archive

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

[src/trunk]: src/sbin/devpubd Add one-shot mode.



details:   https://anonhg.NetBSD.org/src/rev/088ea7bcad2a
branches:  trunk
changeset: 745181:088ea7bcad2a
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Feb 24 11:45:30 2020 +0000

description:
Add one-shot mode.

diffstat:

 sbin/devpubd/devpubd.8 |   8 +++++---
 sbin/devpubd/devpubd.c |  16 +++++++++++-----
 2 files changed, 16 insertions(+), 8 deletions(-)

diffs (85 lines):

diff -r eecd62ce92ac -r 088ea7bcad2a sbin/devpubd/devpubd.8
--- a/sbin/devpubd/devpubd.8    Mon Feb 24 00:47:38 2020 +0000
+++ b/sbin/devpubd/devpubd.8    Mon Feb 24 11:45:30 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: devpubd.8,v 1.5 2016/09/11 01:38:00 sevan Exp $
+.\"    $NetBSD: devpubd.8,v 1.6 2020/02/24 11:45:30 mlelstv Exp $
 .\"
 .\" Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .Nd device publish daemon for automatic device node creation
 .Sh SYNOPSIS
 .Nm
-.Op Fl f
+.Op Fl 1f
 .Sh DESCRIPTION
 .Nm
 listens on
@@ -48,7 +48,9 @@
 .Fl f
 is specified,
 .Nm
-does not go into the background.
+does not go into the background. With the option
+.Fl 1
+it will also exit after the initial setup of device nodes.
 .Pp
 .Nm
 runs
diff -r eecd62ce92ac -r 088ea7bcad2a sbin/devpubd/devpubd.c
--- a/sbin/devpubd/devpubd.c    Mon Feb 24 00:47:38 2020 +0000
+++ b/sbin/devpubd/devpubd.c    Mon Feb 24 11:45:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $        */
+/*     $NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2011-2015\
 Jared D. McNeill <jmcneill%invisible.ca@localhost>. All rights reserved.");
-__RCSID("$NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $");
+__RCSID("$NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $");
 
 #include <sys/queue.h>
 #include <sys/types.h>
@@ -252,7 +252,7 @@
 __dead static void
 usage(void)
 {
-       fprintf(stderr, "usage: %s [-f]\n", getprogname());
+       fprintf(stderr, "usage: %s [-1f]\n", getprogname());
        exit(EXIT_FAILURE);
 }
 
@@ -260,12 +260,17 @@
 main(int argc, char *argv[])
 {
        bool fflag = false;
+       bool once = false;
        int ch;
 
        setprogname(argv[0]);
 
-       while ((ch = getopt(argc, argv, "fh")) != -1) {
+       while ((ch = getopt(argc, argv, "1fh")) != -1) {
                switch (ch) {
+               case '1':
+                       fflag = true;
+                       once = true;
+                       break;
                case 'f':
                        fflag = true;
                        break;
@@ -295,7 +300,8 @@
                }
        }
 
-       devpubd_eventloop();
+       if (!once)
+               devpubd_eventloop();
 
        return EXIT_SUCCESS;
 }



Home | Main Index | Thread Index | Old Index