git: 8789e3b0214e - main - rpcbind: Add flag for foreground mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 20 Sep 2023 15:41:32 UTC
The branch main has been updated by stevek: URL: https://cgit.FreeBSD.org/src/commit/?id=8789e3b0214e1bea8452d62b41ac2e32547686a4 commit 8789e3b0214e1bea8452d62b41ac2e32547686a4 Author: Stephen J. Kiernan <stevek@FreeBSD.org> AuthorDate: 2023-08-31 16:59:41 +0000 Commit: Stephen J. Kiernan <stevek@FreeBSD.org> CommitDate: 2023-09-20 15:40:52 +0000 rpcbind: Add flag for foreground mode Added the -N flag to enable foreground mode. It is useful to be able to run rpcbind in foreground mode when starting from launcher applications. The existing debug flag is not sufficient as it enables additional debug messages. Update man page to document the added flag. Reviewed by: imp Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D41674 --- usr.sbin/rpcbind/rpcbind.8 | 9 +++++++-- usr.sbin/rpcbind/rpcbind.c | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.sbin/rpcbind/rpcbind.8 b/usr.sbin/rpcbind/rpcbind.8 index c0efb1e838ef..270cab88823c 100644 --- a/usr.sbin/rpcbind/rpcbind.8 +++ b/usr.sbin/rpcbind/rpcbind.8 @@ -1,7 +1,7 @@ .\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4 .\" Copyright 1989 AT&T .\" Copyright 1991 Sun Microsystems, Inc. -.Dd April 19, 2017 +.Dd August 31, 2023 .Dt RPCBIND 8 .Os .Sh NAME @@ -9,7 +9,7 @@ .Nd universal addresses to RPC program number mapper .Sh SYNOPSIS .Nm -.Op Fl 6adiLlswW +.Op Fl 6adiLlNswW .Op Fl h Ar bindip .Sh DESCRIPTION The @@ -122,6 +122,11 @@ Without this flag, local connections are only allowed over a local socket, .Pa /var/run/rpcbind.sock . .It Fl l Turn on libwrap connection logging. +.It Fl N +Run in foreground mode. +In this mode, +.Nm +will not fork when it starts. .It Fl s Cause .Nm diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index 0f7da00198a9..31064558fb6c 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -94,6 +94,7 @@ int oldstyle_local = 0; #ifdef LIBWRAP int libwrap = 0; #endif +int nofork = 0; int verboselog = 0; static char **hosts = NULL; @@ -226,7 +227,7 @@ main(int argc, char *argv[]) } else { printf("\n"); } - } else { + } else if (!nofork) { if (daemon(0, 0)) err(1, "fork failed"); } @@ -809,7 +810,7 @@ parseargs(int argc, char *argv[]) #else #define WRAPOP "" #endif - while ((c = getopt(argc, argv, "6adh:iLls" WRAPOP WSOP)) != -1) { + while ((c = getopt(argc, argv, "6adh:iLlNs" WRAPOP WSOP)) != -1) { switch (c) { case '6': ipv6_only = 1; @@ -839,6 +840,9 @@ parseargs(int argc, char *argv[]) case 'l': verboselog = 1; break; + case 'N': + nofork = 1; + break; case 's': runasdaemon = 1; break;