summaryrefslogtreecommitdiff
path: root/exec/exec.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-04-27 08:43:17 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-04-29 12:38:58 +0200
commitceffc4581e83ce1299c96a17c9c5352f491d488d (patch)
treeab22d84c19524dbb8a210c35f340cfe93cc8856e /exec/exec.c
parentc62117165e685beba2f210f87d7d88f578a9322e (diff)
exec: abbreviate the task name if necessary
* exec/exec.c (do_exec): If the formatted task name exceeds TASK_NAME_SIZE, abbreviate it.
Diffstat (limited to 'exec/exec.c')
-rw-r--r--exec/exec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 935762e2..b068f5e2 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1168,9 +1168,20 @@ do_exec (file_t file,
goto out;
char *name;
- if (asprintf (&name, "%s(%d)", argv, pid) > 0)
+ int size = asprintf (&name, "%s(%d)", argv, pid);
+ if (size > 0)
{
- task_set_name (newtask, name);
+/* This is an internal implementational detail of the gnumach kernel. */
+#define TASK_NAME_SIZE 32
+ if (size < TASK_NAME_SIZE)
+ task_set_name (newtask, name);
+ else
+ {
+ char *abbr = name + size - TASK_NAME_SIZE + 1;
+ abbr[0] = abbr[1] = abbr[2] = '.';
+ task_set_name (newtask, abbr);
+ }
+#undef TASK_NAME_SIZE
free (name);
}
}