include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / um / kernel / reboot.c
CommitLineData
1da177e4 1/*
ba180fd4 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
1da177e4
LT
3 * Licensed under the GPL
4 */
5
1da177e4 6#include "linux/sched.h"
5a0e3ad6 7#include "linux/slab.h"
edea1385 8#include "kern_util.h"
1da177e4 9#include "os.h"
77bf4400 10#include "skas.h"
1da177e4 11
5e38291d
EB
12void (*pm_power_off)(void);
13
1da177e4
LT
14static void kill_off_processes(void)
15{
c5d4bb17 16 if (proc_mm)
77bf4400
JD
17 /*
18 * FIXME: need to loop over userspace_pids
19 */
20 os_kill_ptraced_process(userspace_pid[0], 1);
21 else {
22 struct task_struct *p;
23 int pid, me;
24
25 me = os_getpid();
c5d4bb17
JD
26 for_each_process(p) {
27 if (p->mm == NULL)
77bf4400
JD
28 continue;
29
6c738ffa 30 pid = p->mm->context.id.u.pid;
77bf4400
JD
31 os_kill_ptraced_process(pid, 1);
32 }
33 }
1da177e4
LT
34}
35
36void uml_cleanup(void)
37{
ba180fd4 38 kmalloc_ok = 0;
1da177e4 39 do_uml_exitcalls();
026549d2 40 kill_off_processes();
1da177e4
LT
41}
42
43void machine_restart(char * __unused)
44{
ba180fd4 45 uml_cleanup();
6aa802ce 46 reboot_skas();
1da177e4
LT
47}
48
1da177e4
LT
49void machine_power_off(void)
50{
ba180fd4 51 uml_cleanup();
6aa802ce 52 halt_skas();
1da177e4
LT
53}
54
1da177e4
LT
55void machine_halt(void)
56{
57 machine_power_off();
58}