libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / kernel / shutdown.cpp
blob7759b677de59b89d9850d49fec45a762383ee5cf
1 /*
2 * Copyright 2009, Olivier Coursière. All rights reserved.
3 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
4 * Distributed under the terms of the MIT License.
5 */
8 #include <kernel.h>
9 #include <syscalls.h>
12 status_t
13 system_shutdown(bool reboot)
15 int32 cookie = 0;
16 team_info info;
18 gKernelShutdown = true;
20 // Now shutdown all system services!
21 // TODO: Once we are sure we can shutdown the system on all hardware
22 // checking reboot may not be necessary anymore.
23 if (reboot) {
24 while (get_next_team_info(&cookie, &info) == B_OK) {
25 if (info.team == B_SYSTEM_TEAM)
26 continue;
27 kill_team(info.team);
31 sync();
33 return arch_cpu_shutdown(reboot);
37 // #pragma mark -
40 status_t
41 _user_shutdown(bool reboot)
43 if (geteuid() != 0)
44 return B_NOT_ALLOWED;
45 return system_shutdown(reboot);