[bug#77943,1/2] services: shepherd: Provide the right #:kernel-log-file on the Hurd.
Message ID | OXtLjpU--F-9@tutamail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 598CA27BC49; Sun, 17 Aug 2025 19:48:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E03E827BC4A for <patchwork@mira.cbaines.net>; Sun, 17 Aug 2025 19:48:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1uniQH-0006Ql-Mb; Sun, 17 Aug 2025 14:48:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uniQF-0006Qc-B4 for guix-patches@gnu.org; Sun, 17 Aug 2025 14:48:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uniQF-0005uW-3I for guix-patches@gnu.org; Sun, 17 Aug 2025 14:48:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=GXmh8i8ezdgQxfAE8S1nPvURAxoNJRK42CWSbbPas8c=; b=V+nWMQ+WvkDF9AsJasxI/+rtf0aDyC8KGDJM67h0atKlA8yKCYqZnnwCm286H6yEtRfr7rhVwrvLdJsNv9mg4Q+yB5VdZTXUFE7CfqFEcjzeIYbqylTOVEnRo/Pdsolo5i+8O3VuBRec7JRyK1TnJUma5HA7Dxo83p7+MAKS8T+sN7LMrooAZPL3CSGe5HHIAkRXzADP4zJQRv+mpvC1G8JU0mKmwMWfi5bZQVYsiTwzNOBNgNmzVieuBHwwSvYQfUXGMktgzgGZfpt3CAlX9JoleudsWqwhDe/0+WsJepx0mgzduF4U7S4fz2NY76EkZzU2wNliiM8KtIyaATdBXg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1uniQE-0004nu-Ic for guix-patches@gnu.org; Sun, 17 Aug 2025 14:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77943] [PATCH 1/2] services: shepherd: Provide the right #:kernel-log-file on the Hurd. Resent-From: yelninei@tutamail.com Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 17 Aug 2025 18:48:02 +0000 Resent-Message-ID: <handler.77943.B77943.175545644518405@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77943 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Cc: 77943 <77943@debbugs.gnu.org> Received: via spool by 77943-submit@debbugs.gnu.org id=B77943.175545644518405 (code B ref 77943); Sun, 17 Aug 2025 18:48:02 +0000 Received: (at 77943) by debbugs.gnu.org; 17 Aug 2025 18:47:25 +0000 Received: from localhost ([127.0.0.1]:47925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1uniPc-0004mm-HY for submit@debbugs.gnu.org; Sun, 17 Aug 2025 14:47:24 -0400 Received: from mail.w13.tutanota.de ([185.205.69.213]:55910) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <yelninei@tutamail.com>) id 1uniPZ-0004mT-1i for 77943@debbugs.gnu.org; Sun, 17 Aug 2025 14:47:22 -0400 Received: from tutadb.w10.tutanota.de (w10.api.tuta.com [IPv6:fd:ac::d:10]) by mail.w13.tutanota.de (Postfix) with ESMTP id 12B70B3B28C7 for <77943@debbugs.gnu.org>; Sun, 17 Aug 2025 20:46:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1755456404; s=s1; d=tutamail.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=GXmh8i8ezdgQxfAE8S1nPvURAxoNJRK42CWSbbPas8c=; b=s+VV8B7MDzYvXYirmMIc9g4tcrylNqFIy/GJwKF+iwdihXxXnjtwJY0y+bkwC9Kg XZGcMRT5fAEHPUQbQnPJZweYjgVCA2h4UV3aA9qKskBdtIqN9cKJQsA6YhRMXi6t/Cx LLpjxDLBQhFF7oBUFwA3Lp1BHa3y6AHsWObKb+vEeHaG26zJRZ2l3wW05xJ/I9F+SuM /qnBK+gDmkj1cewv7XlaNX8A9azGonfmCcysb0FTBbh8hzjaRV2eOWWkIcl+gAOfKoT tJU2y4vVnyqLVICsdm72KQ/N/A2HIKB8CaWqoRTRBy746++mcY0mGC6Ntnf7wDeVIpW /DF0Z5NGFQ== Date: Sun, 17 Aug 2025 20:46:44 +0200 (CEST) Message-ID: <OXtLjpU--F-9@tutamail.com> In-Reply-To: <87sehqq8ys.fsf@gnu.org> References: <cover.1745163830.git.ludo@gnu.org> <ee2ded1a592d8f91595c26c08f6f9f047d74b4f2.1745163830.git.ludo@gnu.org> <OPRqyKU--F-9@tutamail.com> <87cybmp4q6.fsf@gnu.org> <OSK14Qd--F-9@tutamail.com> <87frg7kbm3.fsf@gnu.org> <OSPKyE1--F-9@tutamail.com> <OWf4UUz--F-9@tutamail.com> <87sehqq8ys.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Reply-to: yelninei@tutamail.com X-ACL-Warn: , yelninei--- via Guix-patches <guix-patches@gnu.org> From: yelninei--- via Guix-patches via <guix-patches@gnu.org> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#77943,1/2] services: shepherd: Provide the right #:kernel-log-file on the Hurd.
|
|
Commit Message
yelninei--- via Guix-patches via
Aug. 17, 2025, 6:46 p.m. UTC
Hi. Aug 17, 2025, 15:19 by ludo@gnu.org: > > > So you have a patch for /hurd/streamio and a C reproducer? (Maybe you > sent it already and I haven’t seen.) > No i have not sent this: Something like this fixes the D_WOULD_BLOCK errno. --8<---------------cut here---------------start------------->8--- --8<---------------cut here---------------end--------------->8--- Some c code that runs fgets in a loop until an error --8<---------------cut here---------------start------------->8--- #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <stdlib.h> #include <string.h> #define _PATH_KLOG "/dev/klog" int main () { ssize_t n; int fd; fd = open(_PATH_KLOG, O_RDONLY | O_NONBLOCK | O_CLOEXEC); if (fd < 0) { perror("open"); exit(EXIT_FAILURE); } FILE* file = fdopen(fd, "r"); char* line; int line_max = 1024; line = malloc(line_max +1); if(line == NULL) { perror("malloc"); exit(EXIT_FAILURE); } // The first read always fails with EWOUDLBLOCK fgets(line, line_max +1 , file); perror("fgets"); errno = 0; while(fgets(line, line_max +1 , file) != NULL) { printf("%s", line); } perror("fgets"); free(line); close(fd); exit(EXIT_SUCCESS); } --8<---------------cut here---------------end--------------->8--- I am using `(cross-gcc-toolchain "i586-pc-gnu")` to get a cross compiler with a bit of a hack to remove the %hurd-system supported-system restriction from the hurd and mach headers. >> However this does not really help the shepherd syslog because guile's >> read-line blocks forever waiting for a terminating newline. Also guile >> is unaware that further attempts to read would EWOULDBLOCK as "(select >> (vector port) #() #() 0)" indicates that reading is possible but then >> actually trying to a get a char blocks. >> > > Ah but I think that’s fine: shepherd, suspendable ports are enabled (via > Fibers), which means that read attempts that return EAGAIN or > EWOULDBLOCK result in the calling fiber being suspended. > > You would need to try this for real, but it should be fine. > It is fine in the sense that fibers suspends the system-log successfully at the "end" of /dev/klog. However It is not fine because it will never wake up it up again. According to the c example it now returns EWOULDBLOCK as expected.From testing around a bit I think it might be (@ (ice-9 rdelim) read-line) waiting for a terminating newline. And again when I retried this just now there was the noticable delay with anything shepherd when the shepherd-syslog is running (default (system-log-configuration) configuration) > Thanks! > > Ludo’. >
diff --git a/trans/streamio.c b/trans/streamio.c index e42ff908..93057146 100644 --- a/trans/streamio.c +++ b/trans/streamio.c @@ -1049,6 +1049,8 @@ device_read_reply_inband (mach_port_t reply, kern_return_t errorcode, input_pending = 0; err = errorcode; + if (err == D_WOULD_BLOCK) + err = EWOULDBLOCK; if (!err) { if (datalen == 0)