git: 77439cd18f34 - main - nfsd: Add option to disable going into daemon mode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Jul 2024 19:46:18 UTC
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=77439cd18f342fa4f206d4fb35d40c1d02e1bf8c commit 77439cd18f342fa4f206d4fb35d40c1d02e1bf8c Author: Joyu Liao <joyul@juniper.net> AuthorDate: 2024-07-09 19:44:38 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2024-07-09 19:44:38 +0000 nfsd: Add option to disable going into daemon mode In our products, we need those options to support our features. Add daemon mode option for mountd, nfsd. Add skip local host binding option for rpcd. Add skip local host binding option for mountd. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/nfsd/nfsd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c index 563a36983547..b6c60ce72834 100644 --- a/usr.sbin/nfsd/nfsd.c +++ b/usr.sbin/nfsd/nfsd.c @@ -68,6 +68,7 @@ #include <getopt.h> static int debug = 0; +static int nofork = 0; #define NFSD_STABLERESTART "/var/db/nfs-stablerestart" #define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" @@ -170,10 +171,10 @@ main(int argc, char **argv) nfsdcnt = DEFNFSDCNT; unregister = reregister = tcpflag = maxsock = 0; bindanyflag = udpflag = connect_type_cnt = bindhostc = 0; - getopt_shortopts = "ah:n:rdtuep:m:V:"; + getopt_shortopts = "ah:n:rdtuep:m:V:N"; getopt_usage = "usage:\n" - " nfsd [-ardtue] [-h bindip]\n" + " nfsd [-ardtueN] [-h bindip]\n" " [-n numservers] [--minthreads #] [--maxthreads #]\n" " [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...," "dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n" @@ -230,6 +231,9 @@ main(int argc, char **argv) NFSDEV_MAXMIRRORS); nfsdargs.mirrorcnt = i; break; + case 'N': + nofork = 1; + break; case 0: lopt = longopts[longindex].name; if (!strcmp(lopt, "minthreads")) { @@ -411,7 +415,7 @@ main(int argc, char **argv) } exit (0); } - if (debug == 0) { + if (debug == 0 && nofork == 0) { daemon(0, 0); (void)signal(SIGHUP, SIG_IGN); (void)signal(SIGINT, SIG_IGN);