aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-02-16 00:29:43 +0100
committerLudovic Courtès <ludo@gnu.org>2013-02-27 20:55:39 +0100
commit9322c6822f3c285212a07f38562c3d6425464e45 (patch)
treef8d2d65c8bfe5262b5364f84bb0e5d136eaa1b87 /gnu/packages/patches
parente7d2c60809827182e9f716ab5de2e5ad77d7c252 (diff)
downloadguix-9322c6822f3c285212a07f38562c3d6425464e45.tar
guix-9322c6822f3c285212a07f38562c3d6425464e45.tar.gz
gnu: guile-static: Add bindings for `reboot'.
* gnu/packages/patches/guile-linux-syscalls.patch: Add `scm_reboot'.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/guile-linux-syscalls.patch46
1 files changed, 44 insertions, 2 deletions
diff --git a/gnu/packages/patches/guile-linux-syscalls.patch b/gnu/packages/patches/guile-linux-syscalls.patch
index c0cb0f6d70..1fb24bde27 100644
--- a/gnu/packages/patches/guile-linux-syscalls.patch
+++ b/gnu/packages/patches/guile-linux-syscalls.patch
@@ -1,10 +1,13 @@
This patch adds bindings to Linux syscalls for which glibc has symbols.
+Using the FFI would have been nice, but that's not an option when using
+a statically-linked Guile in an initrd that doesn't have libc.so around.
+
diff --git a/libguile/posix.c b/libguile/posix.c
-index 324f21b..ace5211 100644
+index 324f21b..cbee94d 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
-@@ -2286,6 +2286,227 @@ scm_init_popen (void)
+@@ -2286,6 +2286,266 @@ scm_init_popen (void)
}
#endif
@@ -92,6 +95,45 @@ index 324f21b..ace5211 100644
+}
+#undef FUNC_NAME
+
++/* Rebooting, halting, and all that. */
++
++#include <sys/reboot.h>
++
++SCM_VARIABLE_INIT (flag_RB_AUTOBOOT, "RB_AUTOBOOT",
++ scm_from_int (RB_AUTOBOOT));
++SCM_VARIABLE_INIT (flag_RB_HALT_SYSTEM, "RB_HALT_SYSTEM",
++ scm_from_int (RB_HALT_SYSTEM));
++SCM_VARIABLE_INIT (flag_RB_ENABLE_CAD, "RB_ENABLE_CAD",
++ scm_from_int (RB_ENABLE_CAD));
++SCM_VARIABLE_INIT (flag_RB_DISABLE_CAD, "RB_DISABLE_CAD",
++ scm_from_int (RB_DISABLE_CAD));
++SCM_VARIABLE_INIT (flag_RB_POWER_OFF, "RB_POWER_OFF",
++ scm_from_int (RB_POWER_OFF));
++SCM_VARIABLE_INIT (flag_RB_SW_SUSPEND, "RB_SW_SUSPEND",
++ scm_from_int (RB_SW_SUSPEND));
++SCM_VARIABLE_INIT (flag_RB_KEXEC, "RB_KEXEC",
++ scm_from_int (RB_KEXEC));
++
++SCM_DEFINE (scm_reboot, "reboot", 0, 1, 0,
++ (SCM command),
++ "Reboot the system. @var{command} must be one of the @code{RB_} "
++ "constants; if omitted, @var{RB_AUTOBOOT} is used, thus "
++ "performing a hard reset.")
++#define FUNC_NAME s_scm_reboot
++{
++ int c_command;
++
++ if (SCM_UNBNDP (command))
++ c_command = RB_AUTOBOOT;
++ else
++ c_command = scm_to_int (command);
++
++ reboot (c_command);
++
++ return SCM_UNSPECIFIED; /* likely unreached */
++}
++#undef FUNC_NAME
++
+/* Linux network interfaces. See <linux/if.h>. */
+
+#include <linux/if.h>