diff options
author | rsc <rsc> | 2007-08-08 08:38:11 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-08 08:38:11 +0000 |
commit | 7366e042d9a7a21397115ca49c0d9344a9365ada (patch) | |
tree | b7012b4ddb0dfbb292fe62c23bdaecb1f2616b83 /sysfile.c | |
parent | 7e89fb90bd0beb91e5d67af362d6a8a3a1b4c626 (diff) | |
download | xv6-labs-7366e042d9a7a21397115ca49c0d9344a9365ada.tar.gz xv6-labs-7366e042d9a7a21397115ca49c0d9344a9365ada.tar.bz2 xv6-labs-7366e042d9a7a21397115ca49c0d9344a9365ada.zip |
save process name for debugging
Diffstat (limited to 'sysfile.c')
-rw-r--r-- | sysfile.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -322,7 +322,7 @@ sys_exec(void) struct elfhdr elf; struct proghdr ph; char *mem = 0; - char *path, *s; + char *path, *s, *last; uint argv; if(argstr(0, &path) < 0 || argint(1, (int*)&argv) < 0) @@ -399,6 +399,12 @@ sys_exec(void) } *(uint*)(mem + p1) = 0; + // Save name for debugging. + for(last=s=path; *s; s++) + if(*s == '/') + last = s+1; + safestrcpy(cp->name, last, sizeof cp->name); + // commit to the new image. kfree(cp->mem, cp->sz); cp->sz = sz; @@ -419,7 +425,7 @@ sys_exec(void) } iput(ip); - + cp->tf->eip = elf.entry; cp->tf->esp = sp; setupsegs(cp); |