From 23e525e1097f6f993aecd4f0b14d518546b876a4 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 10 Apr 2017 19:18:13 +0200 Subject: [PATCH] syscalls: Add load-linux-module. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build/syscalls.scm (load-linux-module): New procedure. Reimplemented from guile-linux-syscalls.patch. Signed-off-by: Ludovic Courtès --- guix/build/syscalls.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 ." (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."