From patchwork Fri Oct 25 09:39:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 69448 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F0E5427BBEA; Fri, 25 Oct 2024 10:42:04 +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=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 65AD227BBE2 for ; Fri, 25 Oct 2024 10:42:04 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4Gp4-0002PY-Kj; Fri, 25 Oct 2024 05:41:34 -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 ) id 1t4Gp2-0002P7-L6 for guix-patches@gnu.org; Fri, 25 Oct 2024 05:41:32 -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 ) id 1t4Gp2-0003tF-Al for guix-patches@gnu.org; Fri, 25 Oct 2024 05:41:32 -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:Date:From:To:Subject; bh=dTzYYFac8op+rYUIIHwt/QGBGUyoFWbx3ZMvObbec1E=; b=tEcDkAvmR2UF1l0y1FLNCwFZb4sphSx6MC3PK6QwsCVqHYkIUDTTY19b4qiAIMUNKI2LYdqenLwBVpetK5UF5ezY7x9XkCQnsejRiSvffuqTrMrTPHcVXsrZE5yWsxB7UqNmCKeMP4WHPeJ6tOiCKocHy7LnSm7f18a/Jt7167YtpqOUh1uWu5t/TzbsSPy4iIzsAXah94BbiayHlJxxW5Peho7GOR5dgo/ygd6EjpfqeTbS7EmxCqkJecVRbZSrvyMJj8O9kDiVhcIb19K/Gr4iYkM/27ZEfu39FRMsXicVn6DCfiH5BhTb0k9JYaN0b35coVtK+4l/LlTuMQoaLw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4GpY-00026A-3U for guix-patches@gnu.org; Fri, 25 Oct 2024 05:42:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73927] [PATCH v3 05/17] system: hurd: Add swap-services to hurd-default-essential-services. Resent-From: Janneke Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Oct 2024 09:42:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73927 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73927@debbugs.gnu.org Received: via spool by 73927-submit@debbugs.gnu.org id=B73927.17298492867883 (code B ref 73927); Fri, 25 Oct 2024 09:42:04 +0000 Received: (at 73927) by debbugs.gnu.org; 25 Oct 2024 09:41:26 +0000 Received: from localhost ([127.0.0.1]:37325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4Gow-000234-0v for submit@debbugs.gnu.org; Fri, 25 Oct 2024 05:41:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4Gok-00020j-0j for 73927@debbugs.gnu.org; Fri, 25 Oct 2024 05:41:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4Go8-0003nA-SB; Fri, 25 Oct 2024 05:40:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=dTzYYFac8op+rYUIIHwt/QGBGUyoFWbx3ZMvObbec1E=; b=hs0SBYvtQ+GZN13JE50k OI4p8ifv6WPF5p37lOxbbTs/gornym8NEdVP2FMhX17ApsYZ49XRyVcx4gczlGUwh4jAW0SVZTkmj padwYBVE1u9NV0hQV+mfX3M/bIgzvSVzyH94Jzn/+HzQawKgYY17qJHlZW9SfFIuIrYVfK5BVl44h g2bAA7zRNjOLsRCezLIAUj99NaFRobUlwxwdBabjbI2FKlJJwxzz3JDbDf5qkegG9BCVF7ll1XAbY 4HXyS8eozjcc4761L/A01LCHdXh1pE02qXM4ynRBeV+9UuYjWf0luyhx/XmMJWH3kM7jwj+L+3uhY +cGV0ytLxy8+jQ==; From: Janneke Nieuwenhuizen Date: Fri, 25 Oct 2024 11:39:57 +0200 Message-ID: <20241025094011.8540-6-janneke@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241025094011.8540-1-janneke@gnu.org> References: <20241025094011.8540-1-janneke@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 * gnu/services/base.scm (swap-service-type): Do not include 'udev' requirement for the Hurd. Use system* with "swapon", "swapoff" for the Hurd. * gnu/system.scm (hurd-default-essential-services): Add swap-services. * gnu/services/base.scm (swap-service-type): Change-Id: I1d4d445c614921752dc84aa0dd6ff42cdbf62aa8 --- gnu/services/base.scm | 20 +++++++++++++------- gnu/system.scm | 13 +++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d0a57a8807..6201dea4b8 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -44,6 +44,7 @@ (define-module (gnu services base) #:autoload (guix diagnostics) (warning formatted-message &fix-hint) #:autoload (guix i18n) (G_) #:use-module (guix combinators) + #:use-module (guix utils) #:use-module (gnu services) #:use-module (gnu services admin) #:use-module (gnu services shepherd) @@ -2647,7 +2648,7 @@ (define device-lookup (with-imported-modules (source-module-closure '((gnu build file-systems))) (shepherd-service (provision (list (swap->shepherd-service-name swap))) - (requirement `(udev ,@requirements)) + (requirement `(,@(if (target-hurd?) '() '(udev)) ,@requirements)) (documentation "Enable the given swap space.") (modules `((gnu build file-systems) ,@%default-modules)) @@ -2655,16 +2656,21 @@ (define device-lookup (let ((device #$device-lookup)) (and device (begin - (restart-on-EINTR (swapon device - #$(if (swap-space? swap) - (swap-space->flags-bit-mask - swap) - 0))) + #$(if (target-hurd?) + #~(system* "swapon" device) + #~(restart-on-EINTR + (swapon device + #$(if (swap-space? swap) + (swap-space->flags-bit-mask + swap) + 0)))) #t))))) (stop #~(lambda _ (let ((device #$device-lookup)) (when device - (restart-on-EINTR (swapoff device))) + #$(if (target-hurd?) + #~(system* "swapoff" device) + #~(restart-on-EINTR (swapoff device)))) #f))) (respawn? #f)))) (description "Turn on the virtual memory swap area."))) diff --git a/gnu/system.scm b/gnu/system.scm index c19730b331..533a4154d6 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -845,11 +845,11 @@ (define (hurd-default-essential-services os) (let ((host-name (operating-system-host-name os)) (hosts-file (%operating-system-hosts-file os)) (entries (operating-system-directory-base-entries os))) - (list (service system-service-type entries) - %boot-service - %hurd-startup-service - %activation-service - (service shepherd-root-service-type) + (cons* (service system-service-type entries) + %boot-service + %hurd-startup-service + %activation-service + (service shepherd-root-service-type) (service user-processes-service-type) ;; Make sure that privileged-programs activation script @@ -873,7 +873,8 @@ (define (hurd-default-essential-services os) (list `("hosts" ,hosts-file))) (service hosts-service-type (local-host-entries host-name))) - (service profile-service-type (operating-system-packages os))))) + (service profile-service-type (operating-system-packages os)) + (swap-services os)))) (define* (operating-system-services os) "Return all the services of OS, including \"essential\" services."