summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoraiju <aiju@phicode.de>2011-05-18 04:17:27 +0000
committeraiju <aiju@phicode.de>2011-05-18 04:17:27 +0000
commit27dc8032ab5f4d2e8dabb2070827385f2832ac3c (patch)
treebb4ad60ba0e633c80fbd8cb36487a4d84f191520 /sys
parent7aee021b1327cd31279c0215475fa9eccb15fddc (diff)
added scram(8)
Diffstat (limited to 'sys')
-rw-r--r--sys/man/8/fshalt17
-rw-r--r--sys/src/cmd/scram.c20
2 files changed, 34 insertions, 3 deletions
diff --git a/sys/man/8/fshalt b/sys/man/8/fshalt
index 25b9e4b61..67cb53268 100644
--- a/sys/man/8/fshalt
+++ b/sys/man/8/fshalt
@@ -1,6 +1,6 @@
.TH FSHALT 8
.SH NAME
-fshalt, reboot \- halt any local file systems and optionally reboot the system
+fshalt, scram, reboot \- halt any local file systems and optionally shut down or reboot the system
.SH SYNOPSIS
.B fshalt
[
@@ -8,6 +8,8 @@ fshalt, reboot \- halt any local file systems and optionally reboot the system
]
.br
.B reboot
+.br
+.B scram
.SH DESCRIPTION
.I Fshalt
syncs all local
@@ -25,6 +27,9 @@ If given
.BR -r ,
.I fshalt
will then reboot the machine.
+Else it will invoke
+.I scram
+to shut down the machine.
The halting and rebooting is done by copying all necessary
commands into a
.IR ramfs (4)
@@ -35,6 +40,9 @@ local file systems.
.PP
.I Reboot
restarts the machine it is invoked on.
+.PP
+.I Scram
+shuts down the machine it is invoked on.
.SH SOURCE
.B /rc/bin/fshalt
.br
@@ -43,6 +51,9 @@ restarts the machine it is invoked on.
.IR cons (3),
.IR reboot (8)
.SH BUGS
-On standalone machines, it will be impossible to do anything
+On standalone machines, it will be impossible to do anything if scram fails
after invoking bare
-.LR fshalt .
+.IR fshalt .
+
+.I Scram
+is limited to the PC and requires APM.
diff --git a/sys/src/cmd/scram.c b/sys/src/cmd/scram.c
new file mode 100644
index 000000000..f61a08841
--- /dev/null
+++ b/sys/src/cmd/scram.c
@@ -0,0 +1,20 @@
+#include <u.h>
+#include </386/include/ureg.h>
+typedef struct Ureg Ureg;
+#include <libc.h>
+
+void
+main()
+{
+ Ureg ureg;
+ int fd;
+
+ fd = open("/dev/apm", OWRITE);
+ if(fd < 0) sysfatal("%r");
+ memset(&ureg, 0, sizeof ureg);
+ ureg.ax = 0x5307;
+ ureg.bx = 0x0001;
+ ureg.cx = 0x0003;
+ ureg.trap = 0x15;
+ write(fd, &ureg, sizeof ureg);
+}