Subject: [bug#67697] [PATCH] syscalls: Define riscv64 syscall ID for clone

From: *~=`'#}+{/[email-masked]
Date: Thu, 7 Dec 2023 17:38:12 +0100

>From 3718cdbb185d16794eb36f9b558f4e9d11220afe Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/[email-masked]>
Date: Thu, 7 Dec 2023 16:15:18 +0000
Subject: [PATCH] syscalls: Define riscv64 syscall ID for clone

* guix/build/syscalls.scm (clone): Add an entry for riscv64.

This allows the use of --container on riscv64. The behavior before and
after is shown below.

(before)
$ guix shell --container --pure hello
accepted connection from pid 3269077, user root
Backtrace:
          19 (apply-smob/0 #<thunk 3f887712e0>)
In ice-9/boot-9.scm:
    724:2 18 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
In ice-9/eval.scm:
    619:8 17 (_ #(#(#<directory (guile-user) 3f88776c80>)))
In guix/ui.scm:
   2275:7 16 (run-guix . _)
  2238:10 15 (run-guix-command _ . _)
In ice-9/boot-9.scm:
  1752:10 14 (with-exception-handler _ _ #:unwind? _ # _)
  1752:10 13 (with-exception-handler _ _ #:unwind? _ # _)
In guix/store.scm:
   661:37 12 (thunk)
   1300:8 11 (call-with-build-handler _ _)
   1300:8 10 (call-with-build-handler #<procedure 3f750cc660 at gui?> ?)
In guix/status.scm:
    815:4  9 (call-with-status-report _ _)
In guix/scripts/environment.scm:
  1078:11  8 (_)
In guix/monads.scm:
    576:2  7 (run-with-store #<store-connection 256.99 3f76831730> _ ?)
In guix/scripts/environment.scm:
    793:8  6 (_ _)
In gnu/build/linux-container.scm:
   397:16  5 (call-with-container (#<<file-system> device: "none?> ?) ?)
   239:15  4 (run-container "/tmp/guix-directory.YvLVVm" (#<<fil?> ?) ?)
In guix/build/syscalls.scm:
  1109:21  3 (_ 2114060305)
In unknown file:
Exception thrown while printing backtrace:
In procedure primitive-call-ip: Wrong type argument in position 1
(expecting PRIMITIVE_P): #<procedure 3f85a21fa0 (_ _ _ _ _ _)>

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong type (expecting exact integer): #f

(after)
$ guix shell --container --pure hello
[env]# hello
Hello, world!

Change-Id: I12b3cb5e2aa248266d006b6e456082f4ddc70e62
---
 guix/build/syscalls.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 0358960..4a0a7f6 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1093,6 +1093,7 @@ (define clone
                        ("armv7l" 120)
                        ("aarch64" 220)
                        ("ppc64le" 120)
+                       ("riscv64" 220)
                        (_ #f))))
     (lambda (flags)
       "Create a new child process by duplicating the current parent process.
-- 
2.40.1