From c6e6aa8850473a822847fb5bde1fa4b82c40341d Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 21 Feb 2011 15:05:32 +0000 Subject: [PATCH] mark forked process as such in the kernel p_name . helps debugging output; you can see the difference between parent and child easily (it's sometimes confusing to see an expected endpoint number with an unexpected name, i.e. before exec()) . when processes crash after fork and before exec, it's an instant hint that that's what's going on, instead of it being the parent (endpoint numbers don't usually convey this) . name returns to 'normal' after exec(), so *F isn't visible normally at all. (Except for for RS which forks apparently.) --- kernel/system/do_fork.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/system/do_fork.c b/kernel/system/do_fork.c index eac87ea00..0b6236196 100644 --- a/kernel/system/do_fork.c +++ b/kernel/system/do_fork.c @@ -34,6 +34,7 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr) struct mem_map *map_ptr; /* virtual address of map inside caller (PM) */ int gen, r; int p_proc; + int namelen; if(!isokendpt(m_ptr->PR_ENDPT, &p_proc)) return EINVAL; @@ -84,6 +85,12 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr) rpc->p_virt_left = 0; /* disable, clear the process-virtual timers */ rpc->p_prof_left = 0; + /* Mark process name as being a forked copy */ + namelen = strlen(rpc->p_name); +#define FORKSTR "*F" + if(namelen+strlen(FORKSTR) < sizeof(rpc->p_name)) + strcat(rpc->p_name, FORKSTR); + /* the child process is not runnable until it's scheduled. */ RTS_SET(rpc, RTS_NO_QUANTUM); reset_proc_accounting(rpc);