blob: 24cedfe9f8089b95ade572142edfbabcabf3dfda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
commit 9948e87495f1c52d52aabd6d3465fc9431ff6b43
Author: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Sun Apr 27 08:43:17 2014 +0200
exec: abbreviate the task name if necessary
* exec/exec.c (do_exec): If the formatted task name exceeds
TASK_NAME_SIZE, abbreviate it.
diff --git a/exec/exec.c b/exec/exec.c
index 935762e..b068f5e 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);
}
}
|