From nobody Thu Oct 31 16:34:02 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 4XfV1k3ByZz5c08f; Thu, 31 Oct 2024 16:34:02 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfV1k2fffz4fqf; Thu, 31 Oct 2024 16:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730392442; 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=d3NfX0IdJbvv4hNLYTBuJb2xcdyrImR3MG3vgtD4cRs=; b=uxKqBu25i9Ip5OfiarMf7nNfiJikapJkSiBSY+6CAUXPca/LaU4EYgZPtTY0l+Wix0bY9c oI0vgRB+hnKc6VdznG/0b1e5jnbirKuVgsgYnR8CKpWoLzaliGm6rPjr/M7Jk71ghkXYuL qbOyCK+AdAlKErt2QdNs4QASmRrJAdc6RAIlaSVlpOX+9arUpaOS7j/zoaWBDjVKnXSR3F VaUbI69mBADb5HtUc0hBYA6O6UF4NPSclLJ0A/f3GGoyAyB5ih5kCXyujThQ8e/D1wC1DV oG2R0/B4d+GOvLQTh4M3hgdeu9eXx5R19JrNICI41Q/HbBKq6oMYkH4hgApJMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730392442; 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=d3NfX0IdJbvv4hNLYTBuJb2xcdyrImR3MG3vgtD4cRs=; b=LKz48KtXf27azuoGpv5Ulvvrqe4t5MuXlV8iRFO7Q2VUNiHwAhogMBvq6j0retSgsHRqVp kHBJu9J2OjtSGUtGWE1DaZi3JqNt2AeGVb5jkUjkHtOEnS5HoTkrzGCMDl510KaZ1RjwkE qX5HwiH6dkvt9cMrTUf1glgDT6hCtU8U4xxmhw5SPvWXSvrhWLeGZUp42kNLyDyRINZGUE 3Hrkp3VK+6zHs/wR19bw52u9unc5/eBoXSeA/hEED8qYo+f6VFcQR67M9TvxEGYxQH3MWu ZTw3E/y4mOYAtZM8jmat4WWcPpMQPqkmn1FSJ0NRnYBmirA0hLm10qIU3PvZ2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730392442; a=rsa-sha256; cv=none; b=TPw4hcUwSwAWBVCKV2rDVcfDo59QoT054NEPU2ndk8xBJsu7SYcfoINIjMACVFOdZuGlcr fZSPHUaJZWJ4hzJ7ki3ajwK6t1dglZ69lOXWV2TjGZa+7cUdrWtyDoJtwO0FABmh/k5o5f Fzeiv99d0Cvjv0Ifgbv+c4wy+MuBTallHCCaStWsDsRRcRLJY8xSrKlI+SdSUccEB7z1Ca c4OXOlREzF6Quw4amoKAztmWNwg3OJrvfJi63tIF2TVDM9+wd1+G5DR9+p7f66q6VIoawi a1Tvt6n8tAEbcRxUnn57sX8lppMkCJe89TIDaS2eIowx1l8IB6s0KDEtpOAB4A== 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 4XfV1k2G2MzkWM; Thu, 31 Oct 2024 16:34:02 +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 49VGY2aP032130; Thu, 31 Oct 2024 16:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VGY2tK032127; Thu, 31 Oct 2024 16:34:02 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:34:02 GMT Message-Id: <202410311634.49VGY2tK032127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 12c04071cf18 - main - ndp: Move the global variable repeat into struct ndp_opts 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12c04071cf18d1b00ffcc7058fb01f4393163ede Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=12c04071cf18d1b00ffcc7058fb01f4393163ede commit 12c04071cf18d1b00ffcc7058fb01f4393163ede Author: Zhenlei Huang AuthorDate: 2024-10-31 16:32:13 +0000 Commit: Zhenlei Huang CommitDate: 2024-10-31 16:32:13 +0000 ndp: Move the global variable repeat into struct ndp_opts An upcoming fix for the netlink based implementation requires this refactoring. No functional change intended. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47233 --- usr.sbin/ndp/ndp.c | 9 ++++----- usr.sbin/ndp/ndp.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 9a249a4987a7..6e6f40c3ff64 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -121,7 +121,6 @@ static pid_t pid; static int32_t thiszone; /* time difference with gmt */ static int s = -1; -static int repeat = 0; static char host_buf[NI_MAXHOST]; /* getnameinfo() */ static char ifix_buf[IFNAMSIZ]; /* if_indextoname() */ @@ -249,8 +248,8 @@ main(int argc, char **argv) /*NOTREACHED*/ } mode = 'a'; - repeat = atoi(optarg); - if (repeat < 0) { + opts.repeat = atoi(optarg); + if (opts.repeat < 0) { usage(); /*NOTREACHED*/ } @@ -828,10 +827,10 @@ again: if (buf != NULL) free(buf); - if (repeat) { + if (opts.repeat) { xo_emit("\n"); xo_flush(); - sleep(repeat); + sleep(opts.repeat); goto again; } diff --git a/usr.sbin/ndp/ndp.h b/usr.sbin/ndp/ndp.h index f89ab19a9d3f..7bd4ddcbfdd8 100644 --- a/usr.sbin/ndp/ndp.h +++ b/usr.sbin/ndp/ndp.h @@ -10,6 +10,7 @@ struct ndp_opts { bool tflag; int flags; time_t expire_time; + int repeat; }; extern struct ndp_opts opts;