From nobody Tue Jul 09 19:46:18 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WJWhB4vR5z5QyGM; Tue, 09 Jul 2024 19:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJWhB42rYz4sLy; Tue, 9 Jul 2024 19:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5WCn89N2O2hKApuQLAwwkR44AzTGfK0Clk5/X+iuFU=; b=x+RhTd250hHait3++DETaUBZStVbwVbnSxGgfmpLVB6pM1nbXPiG3hqKgGNe8b0YQUXXmd lFiPvYd9ijcBntSs1MaCV+9RzeCPLwP4g8YlEQhvRCejNo2SDJmutP6/kXbYr/yaWzS+e6 00/ledI3K0CYEKyanX+9yDpWovs5xqd0Qly4dGg8BY4/soOGo5HLzoi76+/qe7n4Mh+qh5 z14iaGIHXEzR2zme06FgKHrT8bnaJZ/rQrjRN8QOliqq+1yKewqi7X8i6gehCW/IzCV8UZ SGC2hn39Hb4u6KSV9EG5lMW/95sGKVEKiwnPdKbm/lmPHFukQ51aySEtO5oMrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720554378; a=rsa-sha256; cv=none; b=num/RQIReC0ufrmR2v612f8KP2DyQSHLu9BDjx+PXSYWyTlhyX5YVnHtgMkUansu+Jq8om 8lCbIiuzYq72qH3kuwAfGWQHSNhYRBkdsis12GfPBUoqCSJTFCJU0VwfmgYc8iEAGX4CgT fNXNPxR/W7pIUJWEXJvT+2xX7hpnrpVDQJJZYsrwvcmLiR00Kj7zSt6ES7ezFrwD16TSON 4riHBYCrMj5HlKEF8ButdIh/CWermM1tgy7LqpTW3HlqbSntrBTV/96UnKjY152/xHFZgw tR9tgZMdVYJKJ2XeOGmEqbp22f+rkkQQ8MKjUZi58dDoxQ+B8aePlcoNqGnfZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720554378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5WCn89N2O2hKApuQLAwwkR44AzTGfK0Clk5/X+iuFU=; b=oluIsYt2iH23TnO7n8tbbhA2yT4Hf1ure5tbpx5tif3LTG5IAmh5oBXMDNH+HqRJFZuVgo Kc5Ecq1hcpXeRmIOAkKb/mo/WP0Lr7NgSASO9oie/uaagTYiqSEdPL08YvC3VoAqbtmd1u 7E32XCL158z2nigDssJkl2JmfHrsp4ErOQeHhHZddd9l1JFv0k8ZLzjGcVliDXkytmat3d F1ANe9uPXfjJrXrE+SBwj9quB1oRSFY/my/0aXClrQIn2+Z++P5A6nSxoHUOsTRZnfuM6T HRCMNKurBoeN5gNLouzKhQeaRqR6N47G3KW86VESl1kCYJn/dOhynXs6JxehmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WJWhB3fB8znBx; Tue, 9 Jul 2024 19:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 469JkIdn089822; Tue, 9 Jul 2024 19:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 469JkIhP089819; Tue, 9 Jul 2024 19:46:18 GMT (envelope-from git) Date: Tue, 9 Jul 2024 19:46:18 GMT Message-Id: <202407091946.469JkIhP089819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 77439cd18f34 - main - nfsd: Add option to disable going into daemon mode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77439cd18f342fa4f206d4fb35d40c1d02e1bf8c Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=77439cd18f342fa4f206d4fb35d40c1d02e1bf8c commit 77439cd18f342fa4f206d4fb35d40c1d02e1bf8c Author: Joyu Liao AuthorDate: 2024-07-09 19:44:38 +0000 Commit: Rick Macklem 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 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);