guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/05: syscalls: Add load-linux-module.


From: Ludovic Courtès
Subject: 04/05: syscalls: Add load-linux-module.
Date: Tue, 11 Apr 2017 05:13:32 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 23e525e1097f6f993aecd4f0b14d518546b876a4
Author: Mathieu Othacehe <address@hidden>
Date:   Mon Apr 10 19:18:13 2017 +0200

    syscalls: Add load-linux-module.
    
    * guix/build/syscalls.scm (load-linux-module): New procedure. Reimplemented
    from guile-linux-syscalls.patch.
    
    Signed-off-by: Ludovic Courtès <address@hidden>
---
 guix/build/syscalls.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index d1f3cd6..0529c22 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -578,6 +578,18 @@ constants from <sys/mount.h>."
                (list cmd (strerror err))
                (list err))))))
 
+(define-as-needed (load-linux-module data #:optional (options ""))
+  (let ((proc (syscall->procedure int "init_module"
+                                  (list '* unsigned-long '*))))
+    (let-values (((ret err)
+                  (proc (bytevector->pointer data)
+                        (bytevector-length data)
+                        (string->pointer options))))
+      (unless (zero? ret)
+        (throw 'system-error "load-linux-module" "~A"
+               (list (strerror err))
+               (list err))))))
+
 (define (kernel? pid)
   "Return #t if PID designates a \"kernel thread\" rather than a normal
 user-land process."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]