]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
ba180fd4 | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
1da177e4 LT |
3 | * Licensed under the GPL |
4 | */ | |
5 | ||
3f07c014 | 6 | #include <linux/sched/signal.h> |
29930025 | 7 | #include <linux/sched/task.h> |
37185b33 AV |
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> | |
1da177e4 | 14 | |
5e38291d | 15 | void (*pm_power_off)(void); |
0834f9cc | 16 | EXPORT_SYMBOL(pm_power_off); |
5e38291d | 17 | |
1da177e4 LT |
18 | static void kill_off_processes(void) |
19 | { | |
d0b5e15f RW |
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); | |
77bf4400 | 33 | } |
d0b5e15f | 34 | read_unlock(&tasklist_lock); |
1da177e4 LT |
35 | } |
36 | ||
37 | void uml_cleanup(void) | |
38 | { | |
ba180fd4 | 39 | kmalloc_ok = 0; |
1da177e4 | 40 | do_uml_exitcalls(); |
026549d2 | 41 | kill_off_processes(); |
1da177e4 LT |
42 | } |
43 | ||
44 | void machine_restart(char * __unused) | |
45 | { | |
ba180fd4 | 46 | uml_cleanup(); |
6aa802ce | 47 | reboot_skas(); |
1da177e4 LT |
48 | } |
49 | ||
1da177e4 LT |
50 | void machine_power_off(void) |
51 | { | |
ba180fd4 | 52 | uml_cleanup(); |
6aa802ce | 53 | halt_skas(); |
1da177e4 LT |
54 | } |
55 | ||
1da177e4 LT |
56 | void machine_halt(void) |
57 | { | |
58 | machine_power_off(); | |
59 | } |