From nobody Mon May 18 19:51:15 2026 X-Original-To: dev-commits-src-main@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 4gK7hz5Rsxz6cgXR for ; Mon, 18 May 2026 19:51:15 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gK7hz2R4kz3TSk for ; Mon, 18 May 2026 19:51:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779133875; 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=FCvJ80FbhCF+pe97TGfyU7y7ZOJeS7y3XCgQKDUXTcM=; b=XJw2LsvKWCGMH/AnRs0tAh6oa2KI8dxMyfQtUPXdO2A0jfo3cMTx6VCeAH76BDXrwOP1a2 7zTlcvGpLQjpu9eznv/tmuEzsYOxx2ZQwITno0WFKt+hQQD10gHCbcA/vcXc80lNoHow/N Wk9/7F2g8ASNExRbMhJu2fdzaDhG7gGquNphZJGnJyLOZ1WsSUSwjCsdpenjjr9o+tQfkr x7FRvNf1CgfLTTd691JoHpGjr20juVvxJZwgSfU7oqX88uMG7rA3W7Ug/4RiARn7/mMJ3b pLV9IcGeEZxii+T1HuZFQaKpfHCO46YWqkP40PsFtevhcukvQBZxlegU11qoRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779133875; a=rsa-sha256; cv=none; b=NojPb8mywjh9io0o7z5u7cWx9wgaQZ/aQ/Dw0xsNAXxymC1aPVwjn6l9yq0YwnobvnBJrW 6Xy+uf2uBmkNFe/aV8aD01D8L2GpPbpOpgTdguz+a+1FI2WYNnk8Izu1W0r4oPgOhwfBVy EXfjmA/av6aBCLPVoWB7+YhCSvfWf2GnNScRBd7wRPeSzhN8Yf0HOMWkPQTwZHTWJo+/Dd xPrXT5xnYeEYPz/xzSZW5qsf0cbWHXQPWoO6nGoFrf3bSVy5Bs2EF2P4cJsThks8ftE/MN My5IOCRKFcCFL3gv90kcwbPDXb41+gqIkOEl2qEZ+wEYJ4iWaDx/4yaLXHKd9w== 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=1779133875; 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=FCvJ80FbhCF+pe97TGfyU7y7ZOJeS7y3XCgQKDUXTcM=; b=bJ9NMNaphceIoRjaFt4VCzJSt84KSCsPeOalMUPQvL2GG51lGUCwMyIYGhUsZMgQTaSt1B gczI1sJdhjW6VDzca0kXL966uODEw0AjIdVp4wtRvpJOLSFaukFuNcJf6NpwFQ5ckQGinL Wb1E25O2UoDP28cJKH9+pJ6y0sZt8/nK03j9oM4Y4d/kAif7Fu2GTtFZ6gdm+5yfAnS33A gxmxsOyKh++TZ2HUmBv/sNZsqsfo6pHD+/b3vahP9KnuQVN6Nbvmrwbg+5H+yCEDBiT6ck j3463wyHBrCOXmWs9t01zeZgu6UaDi1c095W3+1k9smy6O7WD0mfmXwKmsMeAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gK7hz1z4GzjDF for ; Mon, 18 May 2026 19:51:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 388f6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 18 May 2026 19:51:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9306d0449ba6 - main - ctld: Simplify pidfile rename handling in conf::apply List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9306d0449ba6fffadf08d5ab61aea596369e03f4 Auto-Submitted: auto-generated Date: Mon, 18 May 2026 19:51:15 +0000 Message-Id: <6a0b6db3.388f6.68a76091@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9306d0449ba6fffadf08d5ab61aea596369e03f4 commit 9306d0449ba6fffadf08d5ab61aea596369e03f4 Author: John Baldwin AuthorDate: 2026-05-18 19:49:57 +0000 Commit: John Baldwin CommitDate: 2026-05-18 19:49:57 +0000 ctld: Simplify pidfile rename handling in conf::apply Explicitly copy the pidfile path from the initial configuration file to the kernel-derived configuration to avoid having to check if the old path is empty as a special case in conf::apply(). Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D56533 --- usr.sbin/ctld/ctld.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc index 24b02a936670..9bdf15976911 100644 --- a/usr.sbin/ctld/ctld.cc +++ b/usr.sbin/ctld/ctld.cc @@ -1973,22 +1973,14 @@ conf::apply(struct conf *oldconf) log_init(conf_debug); } - /* - * Rename the pidfile if the pathname changes. On startup, - * oldconf created via conf_new_from_kernel will not contain a - * valid pidfile_path. - */ - if (!oldconf->conf_pidfile_path.empty()) { - if (oldconf->conf_pidfile_path != conf_pidfile_path) { - /* pidfile has changed. rename it */ - log_debugx("moving pidfile to %s", + /* Rename the pidfile if the pathname changes. */ + if (oldconf->conf_pidfile_path != conf_pidfile_path) { + log_debugx("moving pidfile to %s", conf_pidfile_path.c_str()); + if (rename(oldconf->conf_pidfile_path.c_str(), + conf_pidfile_path.c_str()) != 0) { + log_err(1, "renaming pidfile %s -> %s", + oldconf->conf_pidfile_path.c_str(), conf_pidfile_path.c_str()); - if (rename(oldconf->conf_pidfile_path.c_str(), - conf_pidfile_path.c_str()) != 0) { - log_err(1, "renaming pidfile %s -> %s", - oldconf->conf_pidfile_path.c_str(), - conf_pidfile_path.c_str()); - } } } @@ -2748,6 +2740,9 @@ main(int argc, char **argv) newconf->set_debug(debug); } + /* Reuse the pidfile path from the configuration file. */ + oldconf->set_pidfile_path(newconf->pidfile_path()); + if (!newconf->add_pports(kports)) log_errx(1, "Error associating physical ports; exiting");