From nobody Wed Dec 27 14:49:20 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 4T0ZKq01VZz55lql; Wed, 27 Dec 2023 14:49:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4T0ZKp3V55z3G6K; Wed, 27 Dec 2023 14:49:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.17.1/8.17.1) with ESMTP id 3BREnKnX002613; Wed, 27 Dec 2023 16:49:23 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 3BREnKnX002613 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 3BREnKSK002612; Wed, 27 Dec 2023 16:49:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 27 Dec 2023 16:49:20 +0200 From: Konstantin Belousov To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6ac7c9f06ae9 - main - daemon: remove redundant parameter from listen_child() Message-ID: References: <202312270608.3BR688vs024888@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <202312270608.3BR688vs024888@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4T0ZKp3V55z3G6K On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote: > 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)); This line is the style regression. > } > 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); And this one probably too. > if (rv > 0) { > unsigned char *cp; >