diff options
| author | Felipe Cerqueira <felipec@mpi-sws.org> | 2013-02-12 11:45:17 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-08-07 03:46:53 -0400 |
| commit | 44bbdeefae36fd3926eeccce4e715d91d5ffe6a0 (patch) | |
| tree | 1fa3c348d27ae50204384aa02fcf00765691eacb | |
| parent | a8ffcb17006ab6e278526ae8ab75d15fd08d030f (diff) | |
Hook into fork(), exec(), and exit()
Allow LITMUS^RT to do some work when a process is created or
terminated.
| -rw-r--r-- | fs/exec.c | 3 | ||||
| -rw-r--r-- | kernel/exit.c | 4 | ||||
| -rw-r--r-- | kernel/fork.c | 9 |
3 files changed, 16 insertions, 0 deletions
| @@ -56,6 +56,8 @@ | |||
| 56 | #include <linux/oom.h> | 56 | #include <linux/oom.h> |
| 57 | #include <linux/compat.h> | 57 | #include <linux/compat.h> |
| 58 | 58 | ||
| 59 | #include <litmus/litmus.h> | ||
| 60 | |||
| 59 | #include <asm/uaccess.h> | 61 | #include <asm/uaccess.h> |
| 60 | #include <asm/mmu_context.h> | 62 | #include <asm/mmu_context.h> |
| 61 | #include <asm/tlb.h> | 63 | #include <asm/tlb.h> |
| @@ -1506,6 +1508,7 @@ static int do_execve_common(const char *filename, | |||
| 1506 | goto out_unmark; | 1508 | goto out_unmark; |
| 1507 | 1509 | ||
| 1508 | sched_exec(); | 1510 | sched_exec(); |
| 1511 | litmus_exec(); | ||
| 1509 | 1512 | ||
| 1510 | bprm->file = file; | 1513 | bprm->file = file; |
| 1511 | bprm->filename = filename; | 1514 | bprm->filename = filename; |
diff --git a/kernel/exit.c b/kernel/exit.c index 7bb73f9d09db..ab36666c0875 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -59,6 +59,8 @@ | |||
| 59 | #include <asm/pgtable.h> | 59 | #include <asm/pgtable.h> |
| 60 | #include <asm/mmu_context.h> | 60 | #include <asm/mmu_context.h> |
| 61 | 61 | ||
| 62 | extern void exit_od_table(struct task_struct *t); | ||
| 63 | |||
| 62 | static void exit_mm(struct task_struct * tsk); | 64 | static void exit_mm(struct task_struct * tsk); |
| 63 | 65 | ||
| 64 | static void __unhash_process(struct task_struct *p, bool group_dead) | 66 | static void __unhash_process(struct task_struct *p, bool group_dead) |
| @@ -781,6 +783,8 @@ void do_exit(long code) | |||
| 781 | tty_audit_exit(); | 783 | tty_audit_exit(); |
| 782 | audit_free(tsk); | 784 | audit_free(tsk); |
| 783 | 785 | ||
| 786 | exit_od_table(tsk); | ||
| 787 | |||
| 784 | tsk->exit_code = code; | 788 | tsk->exit_code = code; |
| 785 | taskstats_exit(tsk, group_dead); | 789 | taskstats_exit(tsk, group_dead); |
| 786 | 790 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index 987b28a1f01b..f3de9887929b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -81,6 +81,9 @@ | |||
| 81 | 81 | ||
| 82 | #include <trace/events/sched.h> | 82 | #include <trace/events/sched.h> |
| 83 | 83 | ||
| 84 | #include <litmus/litmus.h> | ||
| 85 | #include <litmus/sched_plugin.h> | ||
| 86 | |||
| 84 | #define CREATE_TRACE_POINTS | 87 | #define CREATE_TRACE_POINTS |
| 85 | #include <trace/events/task.h> | 88 | #include <trace/events/task.h> |
| 86 | 89 | ||
| @@ -238,6 +241,9 @@ void __put_task_struct(struct task_struct *tsk) | |||
| 238 | WARN_ON(tsk == current); | 241 | WARN_ON(tsk == current); |
| 239 | 242 | ||
| 240 | security_task_free(tsk); | 243 | security_task_free(tsk); |
| 244 | |||
| 245 | exit_litmus(tsk); | ||
| 246 | |||
| 241 | exit_creds(tsk); | 247 | exit_creds(tsk); |
| 242 | delayacct_tsk_free(tsk); | 248 | delayacct_tsk_free(tsk); |
| 243 | put_signal_struct(tsk->signal); | 249 | put_signal_struct(tsk->signal); |
| @@ -312,6 +318,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
| 312 | 318 | ||
| 313 | tsk->stack = ti; | 319 | tsk->stack = ti; |
| 314 | 320 | ||
| 321 | /* Don't let the new task be a real-time task. */ | ||
| 322 | litmus_fork(tsk); | ||
| 323 | |||
| 315 | setup_thread_stack(tsk, orig); | 324 | setup_thread_stack(tsk, orig); |
| 316 | clear_user_return_notifier(tsk); | 325 | clear_user_return_notifier(tsk); |
| 317 | clear_tsk_need_resched(tsk); | 326 | clear_tsk_need_resched(tsk); |
