From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id oF84LP7fJGZOZwEAqHPOHw:P1 (envelope-from ) for ; Sun, 21 Apr 2024 11:44:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id oF84LP7fJGZOZwEAqHPOHw (envelope-from ) for ; Sun, 21 Apr 2024 11:44:30 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713692670; a=rsa-sha256; cv=none; b=rqhKvy8VHG40nknwbk8lA+IsZA+p8qY0FBTvoK+d+VQOo+TzNv0lVP7S/x9NVuS5596l+b q/e3bXp21KGE/95Zd2eyLU6MjNROrlbdPaLQBUhYsbZD7GH1t5RggOnMPcTBxCbuOgV0sb J5jzX78r68dB6EFP/xzWDZLrG/mhxxDScMGzNNO9glPjoDZfRb/vFX9qrEjfnYTQ7dihGN bJxpUvaDmuBQtMcoZ801W/OQr4Yxkzo4+ArpJipDLzYFkmg3nrX1Jfrzi0IvkiopDeVkN4 /oX7AmOsTx8A5YP2Y8iqcGGBB95J3mxmADlL1NAeBZBje4ih4iiij4DoYGp6UQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713692670; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=tAvs7cOjPKXXmhkBIRDgqlklw+JG1eZTazMj3kkTJAI=; b=NBsR7FJZIMmcxjvxE/7qp00A0tqAYiBNsbe9dqCoZahDOfA9uMRw/DgWcTe9ImbFBZm52R oD2EYUN4GLTxDphwH1K97NDTkRMIIAli4SX4Dq3ZgSR6mGubhHk3uXhEo5EQojAdxgMh2y q7/laL5LpfBvssBZBXIY5TzZe5gVoDw9XaBMHs5cdXJ6nFpVI8whXukuZ/Kn+Oe8xQinMv egZ7X+OcgIuhHxeTQ8rt7depZjE54MCVHaxwzzP0YlAbnNDmhPriqw3hya69NGBDbY9RN5 y+Qk4O29AoWixp3LRMftLccMfWMO/9H5Rxon+NDXZnYtG71zoOt2aWSIcQe8Qw== 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 324B4268FA for ; Sun, 21 Apr 2024 11:44:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryTk0-0005dv-Pr; Sun, 21 Apr 2024 05:44:08 -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 1ryTjk-0005QY-WE for guix-patches@gnu.org; Sun, 21 Apr 2024 05:43:53 -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 1ryTjk-0002mP-1G for guix-patches@gnu.org; Sun, 21 Apr 2024 05:43:52 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryTjz-0006Uw-7E for guix-patches@gnu.org; Sun, 21 Apr 2024 05:44:07 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70494] [PATCH 13/23] syscalls: Add unshare. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 21 Apr 2024 09:44:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70494@debbugs.gnu.org Received: via spool by 70494-submit@debbugs.gnu.org id=B70494.171369262324634 (code B ref 70494); Sun, 21 Apr 2024 09:44:07 +0000 Received: (at 70494) by debbugs.gnu.org; 21 Apr 2024 09:43:43 +0000 Received: from localhost ([127.0.0.1]:41776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryTja-0006Oy-0N for submit@debbugs.gnu.org; Sun, 21 Apr 2024 05:43:42 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryTiz-0006IJ-Bv for 70494@debbugs.gnu.org; Sun, 21 Apr 2024 05:43:07 -0400 Received: from localhost (unknown [IPv6:2a02:6b67:d93b:1:254c:b471:debc:14be]) by mira.cbaines.net (Postfix) with ESMTPSA id 3DBF327BBE9 for <70494@debbugs.gnu.org>; Sun, 21 Apr 2024 10:42:48 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 5488e2bb for <70494@debbugs.gnu.org>; Sun, 21 Apr 2024 09:42:47 +0000 (UTC) From: Christopher Baines Date: Sun, 21 Apr 2024 10:42:31 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <87bk632h36.fsf@cbaines.net> References: <87bk632h36.fsf@cbaines.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -4.88 X-Migadu-Queue-Id: 324B4268FA X-Migadu-Spam-Score: -4.88 X-Migadu-Scanner: mx10.migadu.com X-TUID: voQGvtkgcXT2 * guix/build/syscalls.scm (unshare): New procedure. Change-Id: I7caad207117b17b349290e680277f650c51d2f3b --- guix/build/syscalls.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 487ee68b43..492a229938 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -36,6 +36,7 @@ (define-module (guix build syscalls) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-71) #:use-module (ice-9 rdelim) #:use-module (ice-9 regex) #:use-module (ice-9 match) @@ -121,6 +122,7 @@ (define-module (guix build syscalls) mkdtemp! fdatasync pivot-root + unshare scandir* getxattr setxattr @@ -1183,6 +1185,16 @@ (define pivot-root (list new-root put-old (strerror err)) (list err))))))) +(define unshare + (false-if-exception + (let ((proc (syscall->procedure int "unshare" (list int)))) + (lambda (flags) + (let ((ret err (proc flags))) + (unless (zero? ret) + (throw 'system-error "unshare" "~d ~d: ~A" + (list flags (strerror err)) + (list err)))))))) + ;;; ;;; Opendir & co. -- 2.41.0