From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwsqN-0002Se-8n for guix-patches@gnu.org; Sat, 08 Apr 2017 12:04:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwsqK-0003tO-1B for guix-patches@gnu.org; Sat, 08 Apr 2017 12:04:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwsqJ-0003tC-TL for guix-patches@gnu.org; Sat, 08 Apr 2017 12:04:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cwsqJ-0004Mw-M8 for guix-patches@gnu.org; Sat, 08 Apr 2017 12:04:03 -0400 Subject: bug#26341: [PATCH 4/5] build: syscalls: Add load-linux-module. Resent-Message-ID: From: Mathieu Othacehe Date: Sat, 8 Apr 2017 18:03:28 +0200 Message-Id: <20170408160329.4068-5-m.othacehe@gmail.com> In-Reply-To: <20170408160329.4068-1-m.othacehe@gmail.com> References: <20170408160329.4068-1-m.othacehe@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26341@debbugs.gnu.org * guix/build/syscalls.scm (load-linux-module): New procedure. Reimplemented from guile-linux-syscalls.patch. Add to #:replace list. --- guix/build/syscalls.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 42071e7b1..14d97fb61 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -148,6 +148,7 @@ RB_SW_SUSPEND RB_KEXEC reboot + load-linux-module IFF_UP IFF_BROADCAST IFF_LOOPBACK @@ -577,6 +578,22 @@ constants from ." (throw 'system-error "reboot" "~S: ~A" (list cmd (strerror err)) (list err)))))))) + +(define load-linux-module + (static-or-ffi + 'load-linux-module + (let ((proc (syscall->procedure int "init_module" + (list '* unsigned-long '*)))) + (lambda* (data #:optional (options "")) + (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." -- 2.12.2