From nobody Wed Dec 27 06:08:08 2023 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 4T0Lm93BC8z55BDH; Wed, 27 Dec 2023 06:08:09 +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 4T0Lm92Fzjz3J9K; Wed, 27 Dec 2023 06:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703657289; 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=hfqXAwq81AjzMsPDlE9JNWptBa7hwzZtX0US9vNehak=; b=jYwn8kiQobZejquJwrCI1kIWSJiSx3FXtj3ZZXrWtOaoFApTt+JLjwM9mprGhsAv4yPZ2y JtjjGsb6JWXMP+MWR5uXxnY/5nd2q62ocimD4FS0p/CKFK7tSpjdpccKF8qJDZImcNq/rA 8aOT2HIu9JAVLlKWWvm8uosqLwqIoXh++h88XQs70nT47W/q6wJ9kxVBypmc0DGRZ/giNm fcPP0lJxtcvzaNZMCwyzTJDaRtIOlrOJAMX4iyUdcYycA90YCXooWeDdxaPUXz6r1wHao7 nbpx1Ob4ximmL53aMvg+7EJk+kQ9xs/p0AxtjPpgHSIpDu/2jXQQN73s+LSeag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703657289; a=rsa-sha256; cv=none; b=bDWkEQZw/ziKQaBBeBLABoPygNlyeO7P6DBe8M8buv89KV+UeinyF5BjXRYTBb4T1RzKKa WU+N0CzPnmARSNfytVS0P7H6zGl/VJwKlaT4RR1IgmV/7kkAu6k05FLfVPEd9Z3MTCmHlT Evs1D9WlJ5o/oanAp9jXynzm63cbMdAQTGGbdWf2MjPfPJAny6KvmbC8VvEFwaFM/skgNa xwcCAht5pvDLsl+VhQFMZeL1xHAI65cMHjv7HD75IOux1Qo7wsmzPwFbD+Rd611ub2EUXq TBJBqCIdmKoLlQ+fCxEEPwUds+QW761E73nMmZyU488orLqzZNRJfgJncw1+MA== 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=1703657289; 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=hfqXAwq81AjzMsPDlE9JNWptBa7hwzZtX0US9vNehak=; b=l9QrXGNQ1qg99fhDhvPV7F7kJjFDpuIChPWNmqY59saUA/prY9Cpvb+LaBVKdHlDRfPo1N IzaP/zcW0oPmMfsxlJm+tE8JR9YmG1yPnMblWUNMCUV7o843SNIDOwa/AFDMFojbfn5Yc+ 6rb9IZlGd42+aQN+Hjz66QleCHtuxu2yYbO/juTCNytqOTz595MQgwksOcEMEDmBrDRWuV pTJBW24lxe9xX+qcTm3VcrTf/iJ5pMramFuJw9JeTBNIeHQUBiZgKTC/HSLp92MuFoMkLA tSZLxwCaNJUNTyWLp4AdBlGtWQZ7/8u6l0Da3mjuaxl5dJ293rhlBAQw8evK/A== 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 4T0Lm90h9ZzCRy; Wed, 27 Dec 2023 06:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BR689g8024891; Wed, 27 Dec 2023 06:08:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BR688vs024888; Wed, 27 Dec 2023 06:08:08 GMT (envelope-from git) Date: Wed, 27 Dec 2023 06:08:08 GMT Message-Id: <202312270608.3BR688vs024888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 6ac7c9f06ae9 - main - daemon: remove redundant parameter from listen_child() 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7 commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7 Author: Ihor Antonov AuthorDate: 2023-12-27 06:07:25 +0000 Commit: Kyle Evans CommitDate: 2023-12-27 06:07:25 +0000 daemon: remove redundant parameter from listen_child() state already contains pipe fd Reviewed by: cperciva, kevans --- usr.sbin/daemon/daemon.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 14ea87af646d..ed6239b9fb93 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -93,7 +93,7 @@ struct daemon_state { static void restrict_process(const char *); static int open_log(const char *); static void reopen_log(struct daemon_state *); -static bool listen_child(int, struct daemon_state *); +static bool listen_child(struct daemon_state *); static int get_log_mapping(const char *, const CODE *); static void open_pid_files(struct daemon_state *); static void do_output(const unsigned char *, size_t, struct daemon_state *); @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state) /* child is dead, read all until EOF */ state->pid = -1; state->mode = MODE_NOCHILD; - while (listen_child(state->pipe_fd[0], - state)) - ; + while (listen_child(state)); } continue; case SIGTERM: @@ -486,7 +484,7 @@ daemon_eventloop(struct daemon_state *state) */ if (event.data > 0) { - (void)listen_child(state->pipe_fd[0], state); + (void)listen_child(state); } continue; default: @@ -582,11 +580,9 @@ restrict_process(const char *user) * * Return value of false is assumed to mean EOF or error, and true indicates to * continue reading. - * - * TODO: simplify signature - state contains pipefd */ static bool -listen_child(int fd, struct daemon_state *state) +listen_child(struct daemon_state *state) { static unsigned char buf[LBUF_SIZE]; static size_t bytes_read = 0; @@ -595,7 +591,7 @@ listen_child(int fd, struct daemon_state *state) assert(state != NULL); assert(bytes_read < LBUF_SIZE - 1); - rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1); + rv = read(state->pipe_fd[0], buf + bytes_read, LBUF_SIZE - bytes_read - 1); if (rv > 0) { unsigned char *cp;