summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-02-01 22:33:15 +0100
committerLennart Poettering <lennart@poettering.net>2012-02-01 22:33:15 +0100
commit5d6b158473100a7a85e790f8ead0b826baa13b5e (patch)
treeb85b3165d677dcccb639b6678023206edce2fdc3 /src/util.c
parenta6927d7ffc18c51fbb9940f5f1e89f5c7695ed63 (diff)
exec: include path name of binary we are about to execute when renaming forked off processes
Immediately after forking off a process change the comm name and argv[0] to "(foobar)" where "foobar" is the basename of the path we are about to execute. This should be useful when charting boot progress.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/util.c b/src/util.c
index ce7f1c9f84..58a0aebad3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3263,11 +3263,15 @@ fallback:
void rename_process(const char name[8]) {
assert(name);
- prctl(PR_SET_NAME, name);
+ /* This is a like a poor man's setproctitle(). It changes the
+ * comm field, argv[0], and also the glibc's internally used
+ * name of the process. For the first one a limit of 16 chars
+ * applies, to the second one usually one of 10 (i.e. length
+ * of "/sbin/init"), to the third one one of 7 (i.e. length of
+ * "systemd"). If you pass a longer string it will be
+ * truncated */
- /* This is a like a poor man's setproctitle(). The string
- * passed should fit in 7 chars (i.e. the length of
- * "systemd") */
+ prctl(PR_SET_NAME, name);
if (program_invocation_name)
strncpy(program_invocation_name, name, strlen(program_invocation_name));