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.)
This commit is contained in:
Ben Gras 2011-02-21 15:05:32 +00:00
parent 55ccdba0f6
commit c6e6aa8850

View file

@ -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);