aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2017-04-10 19:18:13 +0200
committerLudovic Courtès <ludo@gnu.org>2017-04-11 11:13:26 +0200
commit23e525e1097f6f993aecd4f0b14d518546b876a4 (patch)
tree09d548b6c21bb2f6a6eae1f33ecdcecc0b65eed6
parentc5cd4fad09af1c68d07c7d93608a18b8261d4a4e (diff)
downloadpatches-23e525e1097f6f993aecd4f0b14d518546b876a4.tar
patches-23e525e1097f6f993aecd4f0b14d518546b876a4.tar.gz
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 <ludo@gnu.org>
-rw-r--r--guix/build/syscalls.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index d1f3cd65c4..0529c228a5 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."