From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EMxeCz+wbmelcAAAqHPOHw:P1 (envelope-from ) for ; Fri, 27 Dec 2024 13:48:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id EMxeCz+wbmelcAAAqHPOHw (envelope-from ) for ; Fri, 27 Dec 2024 14:48:47 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QWR0fbE6; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="mH/Gtq62"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735307319; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=RODtBBEoM10Oq9lzWCv9S5fzn89/X7P9PzvzggLXhXCTfEpaRAGgB3rsSF58+0vXkP5+CO mFX1MisHEjk/ig1IIedNNSLNVWGEUrpdhUFmlPiKFGjUhjKLFhGk+9FyRxGYQ/7j0z27W1 kIToacc6KP307vznO/0PcTxWwAaME11HKYmAv7E0lBMPpFw2IgeaxGMl2yVVR7VSvdfMlS GLTHOu5el4DChUQpvIjo+2OxEgwhKQ3bcxZJZZQnFmjtkhiyQ9HTOomU6ZbQ6F79uHnd2w 9tcosUkMZdiZ5EmKcMqzvkzl/aNKyjZpPmo4/+xjA1QpZMtVdzXjEajcyWrHRw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=QWR0fbE6; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b="mH/Gtq62"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735307319; a=rsa-sha256; cv=none; b=TvxqR3uJws3/haeofBtBKjSXXTCZywBsfP7eE5NFoH5bai0/5Kk26wbgDcLLwAFz/bjbeK npvjhdoeGCwbuyvGu7MIE9IyTRkevZ7oUnkTf9fPcBWjdBkurfsNcNfvZ2ph76Lg1g1xm7 +QthOOpSFB5XShFiYiWZa3cGXpjuy6VQVqPu89qoiwgto7qthWOOgS/msAl5yJGYV2vnqq R2+m3jVFV9+hIEuxP53VxSXjnWaYPq2zqNPIaacJNRIlC0Jo6Sw/C/XcixZSsmePx6pD4/ muI71YhpKd9vSeFZGVsM+StG8MnwXYYPaPz8ZSNcGqk4vmRidGU3Cqwqyu9u3Q== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7B260871C7 for ; Fri, 27 Dec 2024 14:48:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRAhK-00071l-W3; Fri, 27 Dec 2024 08:48:15 -0500 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 ) id 1tR3ao-0001sF-KB for guix-patches@gnu.org; Fri, 27 Dec 2024 01:13:02 -0500 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 ) id 1tR3ao-0007xE-Bz for guix-patches@gnu.org; Fri, 27 Dec 2024 01:13:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=QWR0fbE6eHVh8EFYXRleBvF8LzAhWmeXXcfxOH39jck+Mza1i+H9SFEnaj6xWVq5d7Rdoy7TNzWxlZNx71PLPU5g9fBN+BCZ+Fg436Dj9fB8+K/LXvXb7LXnY8imoxFxnPznIoAtGH57z5vbqqMSRQiU2P15PqgZEqD2Fz/0dJqGRU+rKPdy/Y8vldfKVUs5QvKANZdx6Rc8NOe3DeKx/4Rf2G2pWJuOJiHmoRy5riWlB9TgNJLkjTbpjut9iNlU0N2/Heo5k7Bm594KU+p7v86MOuIn+N+GxF3XCd424+ChS5Ey/6+lBMppJ8kjubCmQjF7KQ+Nua0B9PHLN88lOA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tR3ao-0004xj-5A for guix-patches@gnu.org; Fri, 27 Dec 2024 01:13:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75133] [PATCH] syscalls: Add implementation of statfs for guile-static. Resent-From: Noah Evans Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 27 Dec 2024 06:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75133 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75133@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173527993418986 (code B ref -1); Fri, 27 Dec 2024 06:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Dec 2024 06:12:14 +0000 Received: from localhost ([127.0.0.1]:44429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR3a1-0004w6-PZ for submit@debbugs.gnu.org; Fri, 27 Dec 2024 01:12:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:40132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQtXP-0005rd-Oo for submit@debbugs.gnu.org; Thu, 26 Dec 2024 14:28:52 -0500 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 ) id 1tQtXO-0004MS-NH for guix-patches@gnu.org; Thu, 26 Dec 2024 14:28:50 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQtXM-00080D-RO for guix-patches@gnu.org; Thu, 26 Dec 2024 14:28:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso6482793f8f.2 for ; Thu, 26 Dec 2024 11:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735241326; x=1735846126; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=mH/Gtq62RLkDM64pY2/x/VwiWu6JrLoGd/qooEW+jMrdH5ieJXpW042fdh6VY1j0x6 /6yjHL0XpiwPJzmhJNdSq16LW3aKuNvJJJ55WYTa9uIapY1RzZEnElBI4IMdZ0XRlQEd mX+/TM9PKwHQAR4mqfzU/r+vQoZGiqxhaVeyeNXPujBkmYQPtkETIHZuRW00Mn06iFpm G9wj+ShJQbHiKHFZIUd68y51VcB3u9Xi9N7a8J5/+uFKAMZAyzQgIyEBj5aeGAk3b4DE WuE/TvlA+buk2I6uD4CqJDA3V5AVBYD1BtM7aLe8CmCXbA60/Ah3hevZ5Pb2psBbnl5W KkZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735241326; x=1735846126; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v3ETJi45b6f7Qk88yK2m5z5Vwo9fJH4+3kMls+ScJGo=; b=c3HuEXJR6kw0iPWvvjWlVBUaD68fkwllWT7p0Q1TTQwhNS+9PK9HKhcXwCLmoFvBJu CCxzgiNjDS3q6ZYBSJXQ2ivhtmuRM9HCmrmBnx3QCGnnIdLX/aMTBcYvsRq2msZWiouD V8xgG2m0p8KKWhe5NC8hQpf/PhwBTDPy/lT46dbLg+oHwcPvhkESnBUsilzM/atcqFSI uw2nrcWuMciaOdFdsQ/UAe4vzMG9AgpZDazAvKRZ7fqQTfKbcAswMG59INmxcoZ/ZR3w cfinsv1OwRGzK2MiFKqU0lLIfNbdAfPpDLYSZiRgFM8q+nRODkeimMWWWHGUPtGWw5DX G/hg== X-Gm-Message-State: AOJu0YxKWR6JrAzNgh+DuC9Ifd+4J/SlEtYhKIluo1Gts4kIzq+8xblL zJbio0Bn/sfKjh8nYPFv4d5EPtmvilx6i6GXAmN9sPsMPdX75cQFl6QfYpEsp1O/YvPsWIntvjt ub86uFhZouufcdX5TkM7XyrNtGmdQwpYU3eY= X-Gm-Gg: ASbGncsI1klyTAbzHCohjGD7yie+ySaSpSaPdW1KyIiUYS+DrlHseWftslgb1d5ZCRS duyN9R9fBgO4Xs0VfRWlgUsk106AduBIJPlv7k2msiQNh5mEYg+g= X-Google-Smtp-Source: AGHT+IF4GwXpc0qu6Z/K5+l62rwNFESfCFSrqfB95cfE6p2Z9r6HPLGPFgwLDmvTsjZccv1IMqusgFqj6iT1GkUDtSM= X-Received: by 2002:a05:6000:713:b0:386:3903:86eb with SMTP id ffacd0b85a97d-38a221f1fd1mr19609750f8f.23.1735241326126; Thu, 26 Dec 2024 11:28:46 -0800 (PST) MIME-Version: 1.0 From: Noah Evans Date: Thu, 26 Dec 2024 14:28:35 -0500 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=noahevans256@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 27 Dec 2024 01:12:12 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 27 Dec 2024 08:48:13 -0500 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -1.77 X-Spam-Score: -1.77 X-Migadu-Queue-Id: 7B260871C7 X-TUID: 9QZRdo6xo9HB * guix/build/syscalls.scm (statfs): Add implementation for calling from guile-static. * gnu/packages/patches/guile-3.0-linux-syscalls.patch, gnu/packages/patches/guile-linux-syscalls.patch (statfs-raw): C Function to support above. This is needed when bind mounting filesystems from the initrd guile, or els= e you get an error like this: https://lists.gnu.org/archive/html/help-guix/2021-07/msg00050.html Change-Id: Ibc8f1f27648add90639bd391aff8d61c6a23b884 --- .../patches/guile-3.0-linux-syscalls.patch | 34 ++++++++++++++++++- .../patches/guile-linux-syscalls.patch | 34 ++++++++++++++++++- guix/build/syscalls.scm | 30 ++++++++++------ 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/gnu/packages/patches/guile-3.0-linux-syscalls.patch b/gnu/packages/patches/guile-3.0-linux-syscalls.patch index 0d27f77ee2..1332d31241 100644 --- a/gnu/packages/patches/guile-3.0-linux-syscalls.patch +++ b/gnu/packages/patches/guile-3.0-linux-syscalls.patch @@ -6,7 +6,7 @@ a statically-linked Guile in an initrd that doesn't have libc.so around. diff --git a/libguile/posix.c b/libguile/posix.c --- a/libguile/posix.c +++ b/libguile/posix.c -@@ -2375,6 +2375,336 @@ scm_init_popen (void) +@@ -2375,6 +2375,368 @@ scm_init_popen (void) } #endif /* HAVE_START_CHILD */ @@ -339,6 +339,38 @@ diff --git a/libguile/posix.c b/libguile/posix.c +} +#undef FUNC_NAME +#endif ++ ++#include ++ ++SCM_DEFINE (scm_statfs_raw, "statfs-raw", 1, 0, 0, ++ (SCM filesystem), ++ "Return a bytevector describing @var{filesystem}") ++#define FUNC_NAME s_scm_statfs_raw ++{ ++ int err; ++ char *c_filesystem; ++ SCM bv; ++ ++ c_filesystem =3D scm_to_locale_string (filesystem); ++ ++ bv =3D scm_c_make_bytevector (sizeof (struct statfs)); ++ struct statfs *bv_pointer =3D scm_to_pointer (scm_bytevector_to_pointer (bv, scm_from_int (0))); ++ ++ err =3D statfs (c_filesystem, bv_pointer); ++ if (err !=3D 0) ++ err =3D errno; ++ ++ free (c_filesystem); ++ ++ if (err !=3D 0) ++ { ++ errno =3D err; ++ SCM_SYSERROR; ++ } ++ ++ return bv; ++} ++#undef FUNC_NAME + void scm_init_posix () diff --git a/gnu/packages/patches/guile-linux-syscalls.patch b/gnu/packages/patches/guile-linux-syscalls.patch index 12cddff47b..04645caeb8 100644 --- a/gnu/packages/patches/guile-linux-syscalls.patch +++ b/gnu/packages/patches/guile-linux-syscalls.patch @@ -7,7 +7,7 @@ diff --git a/libguile/posix.c b/libguile/posix.c index b0fcad5fd..1343186e3 100644 --- a/libguile/posix.c +++ b/libguile/posix.c -@@ -2341,6 +2341,335 @@ scm_init_popen (void) +@@ -2341,6 +2341,367 @@ scm_init_popen (void) } #endif /* HAVE_START_CHILD */ @@ -339,6 +339,38 @@ index b0fcad5fd..1343186e3 100644 +} +#undef FUNC_NAME +#endif ++ ++#include ++ ++SCM_DEFINE (scm_statfs_raw, "statfs-raw", 1, 0, 0, ++ (SCM filesystem), ++ "Return a bytevector describing @var{filesystem}") ++#define FUNC_NAME s_scm_statfs_raw ++{ ++ int err; ++ char *c_filesystem; ++ SCM bv; ++ ++ c_filesystem =3D scm_to_locale_string (filesystem); ++ ++ bv =3D scm_c_make_bytevector (sizeof (struct statfs)); ++ struct statfs *bv_pointer =3D scm_to_pointer (scm_bytevector_to_pointer (bv, scm_from_int (0))); ++ ++ err =3D statfs (c_filesystem, bv_pointer); ++ if (err !=3D 0) ++ err =3D errno; ++ ++ free (c_filesystem); ++ ++ if (err !=3D 0) ++ { ++ errno =3D err; ++ SCM_SYSERROR; ++ } ++ ++ return bv; ++} ++#undef FUNC_NAME + void scm_init_posix () diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 2c20edf058..e2af4efd12 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2021 Chris Marusich ;;; Copyright =C2=A9 2021 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2022 Oleg Pykhalov +;;; Copyright =C2=A9 2024 Noah Evans ;;; ;;; This file is part of GNU Guix. ;;; @@ -930,18 +931,25 @@ (define-c-struct %statfs ; (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int (if musl-libc? "statfs" "statfs64") '(* *)))) - (lambda (file) - "Return a data structure describing the file system + (if (module-defined? the-scm-module 'statfs-raw) + (lambda (file) + "Return a data structure describing the file system mounted at FILE." - (let*-values (((stat) (make-bytevector sizeof-statfs)) - ((ret err) (proc (string->pointer file) - (bytevector->pointer stat)))) - (if (zero? ret) - (read-statfs stat) - (throw 'system-error "statfs" "~A: ~A" - (list file (strerror err)) - (list err))))))) + (read-statfs ((module-ref the-scm-module 'statfs-raw) file))) + (let ((proc (syscall->procedure int + (if musl-libc? "statfs" "statfs64") + '(* *)))) + (lambda (file) + "Return a data structure describing the file syste= m +mounted at FILE." + (let*-values (((stat) (make-bytevector sizeof-statfs)) + ((ret err) (proc (string->pointer file) + (bytevector->pointer stat)))) + (if (zero? ret) + (read-statfs stat) + (throw 'system-error "statfs" "~A: ~A" + (list file (strerror err)) + (list err)))))))) (define (free-disk-space file) "Return the free disk space, in bytes, on the file system that hosts FIL= E." base-commit: f03a0e2d19f95eb0961472842540970c2f7605f1 --=20 2.46.0