Module Name: src
Committed By: mlelstv
Date: Mon Feb 24 11:45:30 UTC 2020
Modified Files:
src/sbin/devpubd: devpubd.8 devpubd.c
Log Message:
Add one-shot mode.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/devpubd.8 \
src/sbin/devpubd/devpubd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/devpubd/devpubd.8
diff -u src/sbin/devpubd/devpubd.8:1.5 src/sbin/devpubd/devpubd.8:1.6
--- src/sbin/devpubd/devpubd.8:1.5 Sun Sep 11 01:38:00 2016
+++ src/sbin/devpubd/devpubd.8 Mon Feb 24 11:45:30 2020
@@ -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 @@ When
.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
Index: src/sbin/devpubd/devpubd.c
diff -u src/sbin/devpubd/devpubd.c:1.5 src/sbin/devpubd/devpubd.c:1.6
--- src/sbin/devpubd/devpubd.c:1.5 Thu Feb 6 19:20:21 2020
+++ src/sbin/devpubd/devpubd.c Mon Feb 24 11:45:30 2020
@@ -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 <[email protected]>
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2011-2015\
Jared D. McNeill <[email protected]>. 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 @@ devpubd_init(void)
__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 @@ int
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 @@ main(int argc, char *argv[])
}
}
- devpubd_eventloop();
+ if (!once)
+ devpubd_eventloop();
return EXIT_SUCCESS;
}