From nobody Tue Feb 22 00:17:24 2022 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 756CB19DF350; Tue, 22 Feb 2022 00:17:25 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K2fr44ry7z3Lpb; Tue, 22 Feb 2022 00:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645489044; 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=B4AdV4a47Us42MtFlN/89jaAXSme64Hi/WGu51ON6W8=; b=lftms7mA/Xg4LTP4xu5S7XT7pSRUAJvsyI+ngMemDriEj4yghgfFVOKGbBbMAVBAyG4gxl 36U9el4chK75VQ/CwEJOGE6vIrF7NTiYrTuw7r92wAQXBDbIgCgurSHDMFToTSVkYVLBSo EAa7zlxjRHgQkSnN3q8FL688iew3rlmLDuyC93xOoRo9HLnzU8txpe6PHLdatu+YjPRmQy mLr1PEnaoR1npOM1n3NizP/x3s8NNeuV9hgoG/S0kIZY6bmmAF+7kanRKStRe02TABEg+J Phfb6W8naXf5dCy2gsSrBak+cTITfl3unziX5Y8vhmiozR84pUKBB59ziSWWrw== 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 59F8B1A12A; Tue, 22 Feb 2022 00:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21M0HOh1041286; Tue, 22 Feb 2022 00:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21M0HOYM041285; Tue, 22 Feb 2022 00:17:24 GMT (envelope-from git) Date: Tue, 22 Feb 2022 00:17:24 GMT Message-Id: <202202220017.21M0HOYM041285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: de08b5167b07 - main - init(8): use proper boolean type for globals 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de08b5167b078c2eadd2561abeea3be113c1dec1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645489044; 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=B4AdV4a47Us42MtFlN/89jaAXSme64Hi/WGu51ON6W8=; b=Bo+92LxgKyOQCJqiBGIrGfmEZZngdnveGb0j5jcrlhPpwoQ9Z5xgRHRwQ9A9YSXLASEKYd cVT1f0SuySVCS7ozuj/rtmb8YIx89TS42D9knz1ujJeHW4mO8U9Tj1DOX5szXopO5i9SS6 bei4mRDbl3JeJGJwfH/IZemOMhOQy202USPG7bVmlkPfRJ59aRTPICBQm6RtZFyQxnt8yE FWGOVpXFeMQReGi6KgKoea78GnKu+9mGEy75pNJ/4ZUT6b26YSl1qjFdy5LDf8dNqCpqH1 e7JBL6tYlq2jaUQ/SmkNP0ECjSkOBzmcqAnaduXtnk205yDH8QhSym6/Yhcquw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645489044; a=rsa-sha256; cv=none; b=KRApHgi4Bvfv5mbyT5+Gw0az4ejHarM6M9769ZyM9+jPv2bipVLL0u4AzI7tj+giU5Boe6 R+hPdXIbHcM76X8mcIxlemZ3ot46qRls+ZzAKUK48ocfE+l7CBcEYwOsbAS5emuHZxuW+L uwYXrzsfe98e7OuITZnXZ/iyjZeILW0GRS26p0LjzWrb6P7EUhKGBj6Z7iWlNYA9jjJBXg uYfdlBsGNPWXWydExKeLMGtLR8/d5+JxssdIjDB7Dbw9wXgnzQsFpR1qNajGo0+g7rYgFI 4NXKmI2IOqYzWmc7t6qaeP+GQTBi/n5sritHwTnI1sgJwvfwkCyeDHX9Y5Jdkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=de08b5167b078c2eadd2561abeea3be113c1dec1 commit de08b5167b078c2eadd2561abeea3be113c1dec1 Author: Mitchell Horne AuthorDate: 2022-02-21 16:54:49 +0000 Commit: Mitchell Horne CommitDate: 2022-02-22 00:16:13 +0000 init(8): use proper boolean type for globals Now that stdbool.h is included, prefer this. No functional change intended. --- sbin/init/init.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 93a525c46427..813387f63c81 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -134,13 +134,11 @@ static state_func_t reroot_phase_two(void); static state_func_t run_script(const char *); static enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; -#define FALSE 0 -#define TRUE 1 -static int Reboot = FALSE; +static bool Reboot = false; static int howto = RB_AUTOBOOT; -static int devfs; +static bool devfs = false; static char *init_path_argv0; static void transition(state_t); @@ -190,7 +188,7 @@ static int setupargv(session_t *, struct ttyent *); #ifdef LOGIN_CAP static void setprocresources(const char *); #endif -static int clang; +static bool clang; static int start_session_db(void); static void add_session(session_t *); @@ -287,7 +285,7 @@ invalid: while ((c = getopt(argc, argv, "dsfr")) != -1) switch (c) { case 'd': - devfs = 1; + devfs = true; break; case 's': initial_transition = single_user; @@ -364,7 +362,7 @@ invalid: if (stat("/dev", &stst) != 0) warning("Can't stat /dev: %m"); else if (stst.st_dev == root_devno) - devfs++; + devfs = true; } if (devfs) { @@ -1680,7 +1678,7 @@ transition_handler(int sig) case SIGINT: if (sig == SIGWINCH) howto |= RB_POWERCYCLE; - Reboot = TRUE; + Reboot = true; case SIGTERM: if (current_state == read_ttys || current_state == multi_user || current_state == clean_ttys || current_state == catatonia) @@ -1859,7 +1857,7 @@ alrm_handler(int sig) { (void)sig; - clang = 1; + clang = true; } /* @@ -1915,12 +1913,12 @@ death_single(void) if (kill(-1, death_sigs[i]) == -1 && errno == ESRCH) return (state_func_t) single_user; - clang = 0; + clang = false; alarm(DEATH_WATCH); do if ((pid = waitpid(-1, (int *)0, 0)) != -1) collect_child(pid); - while (clang == 0 && errno != ECHILD); + while (!clang && errno != ECHILD); if (errno == ECHILD) return (state_func_t) single_user; @@ -2001,7 +1999,7 @@ runshutdown(void) NULL, 0) == -1 || shutdowntimeout < 2) shutdowntimeout = DEATH_SCRIPT; alarm(shutdowntimeout); - clang = 0; + clang = false; /* * Copied from single_user(). This is a bit paranoid. * Use the same ALRM handler. @@ -2009,7 +2007,7 @@ runshutdown(void) do { if ((wpid = waitpid(-1, &status, WUNTRACED)) != -1) collect_child(wpid); - if (clang == 1) { + if (clang) { /* we were waiting for the sub-shell */ kill(wpid, SIGTERM); warning("timeout expired for %s: %m; going to "