aboutsummaryrefslogtreecommitdiff
path: root/proc/mgt.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-08-15 09:38:04 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-09-15 22:51:37 +0200
commitc62a440d866ccd8259b408ec59a2c16069e0ce0c (patch)
treea22a7e1a71283f4cc23f6d536b34b50234289607 /proc/mgt.c
parentcc22fd1612ff8ff5b93575fef487e3900fadba2c (diff)
downloadhurd-c62a440d866ccd8259b408ec59a2c16069e0ce0c.tar.gz
hurd-c62a440d866ccd8259b408ec59a2c16069e0ce0c.tar.bz2
hurd-c62a440d866ccd8259b408ec59a2c16069e0ce0c.zip
proc: keep track of {start,end}_code
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.
Diffstat (limited to 'proc/mgt.c')
-rw-r--r--proc/mgt.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/proc/mgt.c b/proc/mgt.c
index 6a10e915..c093b8fe 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -210,6 +210,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;
}
@@ -903,3 +912,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;
+}