2 Copyright � 1995-2001, The AROS Development Team. All rights reserved.
3 $Id: coldreboot.c 18441 2003-07-07 20:01:00Z hkiel $
5 Desc: ShutdownA() - Shut down the operating system.
9 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include <proto/rtas.h>
13 static int rtas_call(struct ExecBase
*SysBase
, const char *method
, int nargs
, int nret
, void *output
, ...)
16 void *RTASBase
= OpenResource("rtas.resource");
19 va_start(args
, output
);
20 retval
= RTASCall(method
, nargs
, nret
, output
, args
);
26 /*****************************************************************************
30 AROS_LH1(ULONG
, ShutdownA
,
33 AROS_LHA(ULONG
, action
, D0
),
36 struct ExecBase
*, SysBase
, 173, Exec
)
39 This function will shut down the operating system.
43 * SD_ACTION_POWEROFF - power off the machine.
44 * SD_ACTION_COLDREBOOT - cold reboot the machine (not only AROS).
47 This function does not return in case of success. Otherwise is returns
51 It can be quite harmful to call this function. It may be possible that
52 you will lose data from other tasks not having saved, or disk buffers
53 not being flushed. Plus you could annoy the (other) users.
62 ******************************************************************************/
66 void *RTASBase
= OpenResource("rtas.resource");
70 if (action
== SD_ACTION_COLDREBOOT
)
71 rtas_call(SysBase
, "system-reboot", 0, 1, NULL
);
72 else if (action
==SD_ACTION_POWEROFF
)
73 rtas_call(SysBase
, "power-off", 2, 1, NULL
, -1, -1);