diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-21 14:58:21 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-23 14:35:41 +0100 |
commit | 4473d16e7cdad08eccad95f5920e1aa171d5512d (patch) | |
tree | da7d02778bdbd10503e0326909b6691114564883 /exec | |
parent | c3936e8c1b40cbe2e88c7930a99728cab95d2528 (diff) |
exec: provide a meaningful name for new tasks
The name will be used in error messages printed by the kernel. This
makes attributing the errors to processes possible.
* exec/exec.c (do_exec): Set the name of the new task.
Diffstat (limited to 'exec')
-rw-r--r-- | exec/exec.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/exec/exec.c b/exec/exec.c index fad94926..e693f633 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -1151,14 +1151,29 @@ do_exec (file_t file, } boot->user_entry = e.entry; /* already adjusted in `load' */ - /* Set the start_code and end_code values for this process. - /hurd/exec is used to start /hurd/proc, so at this point there is + /* /hurd/exec is used to start /hurd/proc, so at this point there is no proc server, so we need to be careful here. */ if (boot->portarray[INIT_PORT_PROC] != MACH_PORT_NULL) - e.error = proc_set_code (boot->portarray[INIT_PORT_PROC], - e.start_code, e.end_code); - if (e.error) - goto out; + { + /* Set the start_code and end_code values for this process. */ + e.error = proc_set_code (boot->portarray[INIT_PORT_PROC], + e.start_code, e.end_code); + if (e.error) + goto out; + + pid_t pid; + e.error = proc_task2pid (boot->portarray[INIT_PORT_PROC], + newtask, &pid); + if (e.error) + goto out; + + char *name; + if (asprintf (&name, "%s(%d)", argv, pid) > 0) + { + task_set_name (newtask, name); + free (name); + } + } /* Create the initial thread. */ e.error = thread_create (newtask, &thread); |