### Shutdown()

LONG Shutdown(mode)

LONG mode;

| Shutdown() kills all processes, syncs filesystems then halts or reboots the system.
Opcode | 337 (0x0151)
Availability | This function is available under all MiNT versions integrated with MultiTOS.
Parameters | On mode equal to SHUT_HALT (0L), the system will shut down and then switch the power off, whenever possible. If this is not possible, the system will simply 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. On mode equal to SHUT_NOPOWEROFF (3L), the system will shutdown and enter a halted condition without switching the power off. SHUT_HALT is available on all MiNT versions. As of FreeMiNT 1.16.0 this mode has been extended and is now able to shut the power off on machines which have such a facility (CT060). SHUT_COLD mode is recognized as of FreeMiNT version 1.15.5, older versions of the kernel will treat the SHUT_COLD as SHUT_BOOT. SHUT_NOPOWEROFF mode operates as SHUT_BOOT on versions of FreeMiNT prior to 1.16.0. 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 Value | Shutdown() 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.
Comments | You need root privileges to shut the system down.
See Also | Sync()