summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2009-05-21 06:02:17 +0200
committerGuillem Jover <guillem@debian.org>2009-05-21 06:02:17 +0200
commitbfda32490d1ff730322636c97a4ce4d65bbd69c5 (patch)
tree6995fa2d1b206d884b385031221e9b87f74fa15e /utils
parent3bbdfa787d98084a682a404921e8bed6b5be8442 (diff)
downloaddpkg-bfda32490d1ff730322636c97a4ce4d65bbd69c5.tar.gz
s-s-d: Warn if --name argument is longer than supported by kernel
Most kernels have a length limit on the process name stored in-kernel. For now the checks done on Linux compatible procfs might hit this limit and be unable to properly track the correct process. So warn in that case and recommend switching to the more reliable --exec. Closes: #353015, #519128
Diffstat (limited to 'utils')
-rw-r--r--utils/start-stop-daemon.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index b34d1711b..9f87ed39c 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -115,6 +115,11 @@
#include <sys/syscall.h>
#endif
+#if defined(OSLinux)
+/* This comes from TASK_COMM_LEN defined in linux's include/linux/sched.h. */
+#define PROCESS_NAME_SIZE 15
+#endif
+
#if defined(SYS_ioprio_set) && defined(linux)
#define HAVE_IOPRIO_SET
#endif
@@ -842,6 +847,13 @@ parse_options(int argc, char * const *argv)
if (!execname && !pidfile && !userspec && !cmdname)
badusage("need at least one of --exec, --pidfile, --user or --name");
+#ifdef PROCESS_NAME_SIZE
+ if (cmdname && strlen(cmdname) > PROCESS_NAME_SIZE)
+ warning("this system is not able to track process names\n"
+ "longer than %d characters, please use --exec "
+ "instead of --name.\n", PROCESS_NAME_SIZE);
+#endif
+
if (!startas)
startas = execname;