You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
81 lines
2.5 KiB
# --- T2-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# T2 SDE: package/.../runit/forced_reboot.patch |
|
# Copyright (C) 2006 The T2 SDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- T2-COPYRIGHT-NOTE-END --- |
|
|
|
--- runit-1.3.1/package/commands 2005-08-24 22:14:39.000000000 +0200 |
|
+++ runit-1.3.1/package/commands 2006-04-09 00:47:27.000000000 +0200 |
|
@@ -11,3 +11,4 @@ |
|
svwaitdown |
|
svwaitup |
|
utmpset |
|
+forced_reboot |
|
diff -Nudr admin.orig/runit-1.3.1/src/forced.c admin/runit-1.3.1/src/forced.c |
|
--- runit-1.3.1/src/forced_reboot.c 1970-01-01 01:00:00.000000000 +0100 |
|
+++ runit-1.3.1/src/forced_reboot.c 2006-04-09 00:45:35.000000000 +0200 |
|
@@ -0,0 +1,38 @@ |
|
+#include <unistd.h> |
|
+#include "reboot_system.h" |
|
+#include "strerr.h" |
|
+ |
|
+#ifndef RB_AUTOBOOT |
|
+#error "RB_AUTOBOOT undefined" |
|
+#endif |
|
+ |
|
+int r =0; |
|
+ |
|
+int main(int argc, char **argv) { |
|
+ char *progname; |
|
+ sync(); |
|
+ if ((progname = strrchr(argv[0], '/')) == NULL) |
|
+ progname = argv[0]; |
|
+ else |
|
+ progname++; |
|
+ |
|
+ if (strcmp(progname,"forced_reboot")==0) |
|
+ r =reboot_system(RB_AUTOBOOT); |
|
+ else { |
|
+#ifdef RB_POWER_OFF |
|
+ r =reboot_system(RB_POWER_OFF); |
|
+ if (r) strerr_die2sys(100, *argv, ": fatal: "); |
|
+#endif |
|
+#ifdef RB_HALT_SYSTEM |
|
+ r =reboot_system(RB_HALT_SYSTEM); |
|
+#else |
|
+# ifdef RB_HALT |
|
+ r =reboot_system(RB_HALT); |
|
+# else |
|
+ r =reboot_system(RB_AUTOBOOT); |
|
+# endif |
|
+#endif |
|
+ } |
|
+ if (r) strerr_die2sys(100, *argv, ": fatal: "); |
|
+ _exit(0); |
|
+ } |
|
--- runit-1.3.1/src/Makefile 2005-08-24 22:14:39.000000000 +0200 |
|
+++ runit-1.3.1/src/Makefile 2006-04-09 00:50:04.000000000 +0200 |
|
@@ -1,4 +1,4 @@ |
|
-IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset |
|
+IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset forced_reboot |
|
|
|
default: sysdeps $(IT) |
|
|
|
@@ -466,3 +466,7 @@ |
|
wait_pid.o: compile error.h haswaitp.h wait_pid.c |
|
./compile wait_pid.c |
|
|
|
+forced_reboot: load forced_reboot.o unix.a byte.a |
|
+ ./load forced_reboot unix.a byte.a -static |
|
+forced_reboot.o: compile forced_reboot.c reboot_system.h |
|
+ ./compile forced_reboot.c
|
|
|