From patchwork Mon Oct 21 08:17:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janneke Nieuwenhuizen X-Patchwork-Id: 32283 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 BD45627BBEA; Mon, 21 Oct 2024 09:18:05 +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 8A83427BBE2 for ; Mon, 21 Oct 2024 09:18:04 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2nbk-0008V4-KZ; Mon, 21 Oct 2024 04:17:44 -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 1t2nbf-0008T1-GN for guix-patches@gnu.org; Mon, 21 Oct 2024 04:17:39 -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 1t2nbf-0003U6-5v for guix-patches@gnu.org; Mon, 21 Oct 2024 04:17:39 -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=yMt0KWvaTQ06WRle/LemMGvmXY6f4LS32lTrlbg0AxA=; b=A3MHAYV5uM2ewCoCwXpkbjdNM4+tQ3Y7DYTouPtMSd0EHbbJnEkkqTdShBoU3z866SyP05KN0EyHMfLNZnTQg0EEANdkSfitscP8mAhKWwXF0ZwtphGZCKHkuZvI9HG58acGFA/TXeZT6tRX86yMVO9cAIZZHemzFRFzqPi0yU+W1PuDYI8jlFHnZ2OhahHJV+fadSArTDEM643teCWhWELdojFaq8Ql3i5hsIKimQ/uEp6dEvaI7SXHdzeU7XP036jAt5cQSSUH7fadTLaQEdQMEGXESMeCI653vCkA9eXqnm++uaCkLWa9XVysqOfhTjp24FekX5G6ThjCT0KSAw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2nc5-0003fw-9k for guix-patches@gnu.org; Mon, 21 Oct 2024 04:18:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73927] [PATCH 04/16] 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: Mon, 21 Oct 2024 08:18:05 +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.172949868214069 (code B ref 73927); Mon, 21 Oct 2024 08:18:05 +0000 Received: (at 73927) by debbugs.gnu.org; 21 Oct 2024 08:18:02 +0000 Received: from localhost ([127.0.0.1]:49996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2nc1-0003ee-PZ for submit@debbugs.gnu.org; Mon, 21 Oct 2024 04:18:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2nbv-0003dN-8j for 73927@debbugs.gnu.org; Mon, 21 Oct 2024 04:17:55 -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 1t2nbP-0003RV-Oi; Mon, 21 Oct 2024 04:17:23 -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=yMt0KWvaTQ06WRle/LemMGvmXY6f4LS32lTrlbg0AxA=; b=BEE1fMiwV+liYCITkl6W q5MM2t6FjVpAaUP94tb/R44QLHH7RV5BIfiMlf4INUvYq2pG61LKuflLIowB1Uqm7gwoV+84V5F6T HdtCoXtQMCSNc+KLkkooZS34hxpRMDfSKVkO9KrhFNm89Mm5WrwOEygwtN4CTrWWwyjpPJVtI/34J 9dp3T7irLzVmmoyLgSu/UKf8I19xHZWMZ/YdxkPeen7WTGYWBHqXXFRCzz1IRIbwpoLNJ8vNoR1xl q0qPV/CVvksccx43GIBkQHi+JcogODfx/JLIRWMz7XmYVL+GFBEGdAY/WwhywxeDSw1LpelYdewNQ kvvic9Zkl71DWg==; From: Janneke Nieuwenhuizen Date: Mon, 21 Oct 2024 10:17:00 +0200 Message-ID: <6e79215c38d44fdae872be726901363d8145317e.1729494414.git.janneke@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: 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): --- 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 819d063673..7c50bc45b1 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -43,6 +43,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) @@ -2644,7 +2645,7 @@ (define swap-service-type (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)) @@ -2652,16 +2653,21 @@ (define swap-service-type (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 44f93f91d1..187a72cbf5 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -843,11 +843,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) (account-service (append (operating-system-accounts os) @@ -869,7 +869,8 @@ (define (hurd-default-essential-services os) (service privileged-program-service-type (append (operating-system-privileged-programs os) (operating-system-setuid-programs os))) - (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."