Shutdown()

LONG Shutdown(mode)

LONG 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.
Parameters On mode equal to SHUT_HALT (0L), the system will shutdown then enter a halted condition.

On mode equal to SHUT_BOOT (1L), the system will reboot the machine after shutting everything down.

On mode equal to SHUT_COLD (2L), the system will act the same as with the SHUT_BOOT mode, except that a cold start rather than the warm start will be performed.

That last mode is recognized as of FreeMiNT version 1.15.5, older versions of the kernel will treat the SHUT_BOOT and SHUT_COLD values equally.

All other values of mode are reserved for future definition.

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

Older versions of MiNT contained a bug that might cause the system to crash, if you called Shutdown() while both GEM AES and virtual console daemon were present.

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