[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] kern: make the parent of a task available via task_info
From: |
Justus Winter |
Subject: |
[PATCH 2/2] kern: make the parent of a task available via task_info |
Date: |
Thu, 5 Sep 2013 16:57:43 +0200 |
XXX: this most likely subverts the security of your system. DO NOT
APPLY.
* include/mach/task_info.h (struct task_basic_info): Add parent_task.
* kern/task.c (task_info): Include a port to parent_task.
---
include/mach/task_info.h | 2 ++
kern/task.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/include/mach/task_info.h b/include/mach/task_info.h
index 5607178..dc520a9 100644
--- a/include/mach/task_info.h
+++ b/include/mach/task_info.h
@@ -37,6 +37,7 @@
#include <mach/machine/vm_types.h>
#include <mach/time_value.h>
+#include <mach/port.h>
/*
* Generic information structure to allow for expansion.
@@ -61,6 +62,7 @@ struct task_basic_info {
time_value_t system_time; /* total system run time for
terminated threads */
time_value_t creation_time; /* creation time stamp */
+ mach_port_t parent_task; /* parent of the task */
};
typedef struct task_basic_info task_basic_info_data_t;
diff --git a/kern/task.c b/kern/task.c
index 0c0be99..4d98132 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -750,6 +750,9 @@ kern_return_t task_info(
basic_info->system_time.microseconds
= task->total_system_time.microseconds;
basic_info->creation_time = task->creation_time;
+ task_reference(task->parent_task);
+ basic_info->parent_task
+ = convert_task_to_port(task->parent_task);
task_unlock(task);
if (*task_info_count > TASK_BASIC_INFO_COUNT)
--
1.7.10.4
- Hacking gnumach to track parental relationship of tasks, Justus Winter, 2013/09/05
- [PATCH 1/2] kern: track the parent of a task, Justus Winter, 2013/09/05
- [PATCH 2/2] kern: make the parent of a task available via task_info,
Justus Winter <=
- Re: Hacking gnumach to track parental relationship of tasks, Ludovic Courtès, 2013/09/05
- Re: Hacking gnumach to track parental relationship of tasks, Justus Winter, 2013/09/06
- Re: Hacking gnumach to track parental relationship of tasks, Ludovic Courtès, 2013/09/06
- Re: Hacking gnumach to track parental relationship of tasks, Justus Winter, 2013/09/06
- Re: Hacking gnumach to track parental relationship of tasks, Ludovic Courtès, 2013/09/07
- Re: Hacking gnumach to track parental relationship of tasks, Justus Winter, 2013/09/07
- Re: Hacking gnumach to track parental relationship of tasks, Ludovic Courtès, 2013/09/07
- Re: Hacking gnumach to track parental relationship of tasks, Samuel Thibault, 2013/09/09
- Re: Hacking gnumach to track parental relationship of tasks, Ludovic Courtès, 2013/09/09
- Re: Hacking gnumach to track parental relationship of tasks, Samuel Thibault, 2013/09/09