[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/17] proc: keep track of {start,end}_code
From: |
Justus Winter |
Subject: |
[PATCH 14/17] proc: keep track of {start,end}_code |
Date: |
Thu, 15 Aug 2013 09:38:04 +0200 |
Any executable segments loaded from the ELF binary are in this range.
* proc/proc.h (struct proc): Add {start,end}_code.
* proc/mgt.h (S_proc_set_code): New function.
* proc/mgt.h (S_proc_get_code): New function.
---
proc/mgt.c | 39 +++++++++++++++++++++++++++++++++++++++
proc/proc.h | 2 ++
2 files changed, 41 insertions(+)
diff --git a/proc/mgt.c b/proc/mgt.c
index 6e72233..656cc25 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -211,6 +211,15 @@ S_proc_child (struct proc *parentp,
childp->p_parent->p_pid, childp->p_pgrp->pg_pgid,
!childp->p_pgrp->pg_orphcnt);
childp->p_parentset = 1;
+
+ /* If these are not set in the child, it was probably fork(2)ed. If
+ so, it inherits the values of its parent. */
+ if (! childp->start_code && ! childp->end_code)
+ {
+ childp->start_code = parentp->start_code;
+ childp->end_code = parentp->end_code;
+ }
+
return 0;
}
@@ -939,3 +948,33 @@ S_proc_is_important (struct proc *callerp,
return 0;
}
+
+/* Implement proc_set_code as described in <hurd/process.defs>. */
+error_t
+S_proc_set_code (struct proc *callerp,
+ vm_address_t start_code,
+ vm_address_t end_code)
+{
+ if (!callerp)
+ return EOPNOTSUPP;
+
+ callerp->start_code = start_code;
+ callerp->end_code = end_code;
+
+ return 0;
+}
+
+/* Implement proc_get_code as described in <hurd/process.defs>. */
+error_t
+S_proc_get_code (struct proc *callerp,
+ vm_address_t *start_code,
+ vm_address_t *end_code)
+{
+ if (!callerp)
+ return EOPNOTSUPP;
+
+ *start_code = callerp->start_code;
+ *end_code = callerp->end_code;
+
+ return 0;
+}
diff --git a/proc/proc.h b/proc/proc.h
index 1073045..a3e0c9a 100644
--- a/proc/proc.h
+++ b/proc/proc.h
@@ -65,6 +65,8 @@ struct proc
/* Miscellaneous information */
vm_address_t p_argv, p_envp;
+ vm_address_t start_code; /* all executable segments are in this range */
+ vm_address_t end_code;
int p_status; /* to return via wait */
int p_sigcode;
struct rusage p_rusage; /* my usage if I'm dead, to return via wait */
--
1.7.10.4
- Re: [PATCH 06/17] proc: add proc_mark_important server code, (continued)
- [PATCH 07/17] hurd: add proc_mark_important, Justus Winter, 2013/08/15
- [PATCH 08/17] init: Mark all of inits children and init itself as important, Justus Winter, 2013/08/15
- [PATCH 09/17] libdiskfs: register libdiskfs-based translators as important, Justus Winter, 2013/08/15
- [PATCH 11/17] libtrivfs: register libtrivfs-based translators as important, Justus Winter, 2013/08/15
- [PATCH 10/17] libnetfs: register libnetfs-based translators as important, Justus Winter, 2013/08/15
- [PATCH 12/17] mach-defpager: register mach-defpager translators as important, Justus Winter, 2013/08/15
- [PATCH 13/17] trans: register symlink translators as important, Justus Winter, 2013/08/15
- [PATCH 15/17] hurd: add proc_{get,set}_code, Justus Winter, 2013/08/15
- [PATCH 16/17] exec: keep track of the range where executable segments are mapped, Justus Winter, 2013/08/15
- [PATCH 14/17] proc: keep track of {start,end}_code,
Justus Winter <=
- [PATCH 17/17] Build fixes: Build processUser.o and link against it, Justus Winter, 2013/08/15
- [PATCH 1/2] Hurd: make reboot() send messages to both pid 1 and 2, Justus Winter, 2013/08/15