Shutdown()

LONG Shutdown(mode)

WORD mode;
Shutdown() kills all processes, syncs filesystems then halts or reboots the system.
Opcode337 (0x0151)
AvailabilityThis function is available under all MiNT versions integrated with MultiTOS.
ParametersIf mode is zero, the system will shutdown then enter a halted condition. On mode equal to 1, the system will reboot the machine after shutting everything down.

All other values of mode are reserved for future definition.

Binding
move.w	mode,-(sp)
move.w	#$0151,-(sp)
trap	#1
addq.l	#4,sp
Return ValueShutdown() returns a negative GEMDOS error code, if failed. On success this call obviously never returns.
Caveats

All current versions of MiNT (including 1.15.x) contain a bug that causes the system to crash, if you call Shutdown() while both GEM AES and virtual console daemon are present.

CommentsYou need root privileges to shut the system down.
See Also Sync()