]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blob - arch/um/kernel/reboot.c
sched/headers: Prepare for new header dependencies before moving code to <linux/sched...
[mirror_ubuntu-kernels.git] / arch / um / kernel / reboot.c
1 /*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6 #include <linux/sched/signal.h>
7 #include <linux/sched/task.h>
8 #include <linux/spinlock.h>
9 #include <linux/slab.h>
10 #include <linux/oom.h>
11 #include <kern_util.h>
12 #include <os.h>
13 #include <skas.h>
14
15 void (*pm_power_off)(void);
16 EXPORT_SYMBOL(pm_power_off);
17
18 static void kill_off_processes(void)
19 {
20 struct task_struct *p;
21 int pid;
22
23 read_lock(&tasklist_lock);
24 for_each_process(p) {
25 struct task_struct *t;
26
27 t = find_lock_task_mm(p);
28 if (!t)
29 continue;
30 pid = t->mm->context.id.u.pid;
31 task_unlock(t);
32 os_kill_ptraced_process(pid, 1);
33 }
34 read_unlock(&tasklist_lock);
35 }
36
37 void uml_cleanup(void)
38 {
39 kmalloc_ok = 0;
40 do_uml_exitcalls();
41 kill_off_processes();
42 }
43
44 void machine_restart(char * __unused)
45 {
46 uml_cleanup();
47 reboot_skas();
48 }
49
50 void machine_power_off(void)
51 {
52 uml_cleanup();
53 halt_skas();
54 }
55
56 void machine_halt(void)
57 {
58 machine_power_off();
59 }