Re: [PATCH] sched.h: increment TASK_COMM_LEN to 20 bytes

From: Jan Engelhardt
Date: Mon Jul 03 2006 - 08:06:14 EST


>
>We do occasionally hit task_struct.comm[] truncation, when people use
>"too-long-a-name%d" for their kernel thread names. But we seem to manage.
>

Maybe this one can help?

Have kthread_create() print a warning message if the command name is
going to be truncated, for ease of development.

diff --fast -dpru linux-2.6.17~/kernel/kthread.c linux-2.6.17+/kernel/kthread.c
--- linux-2.6.17~/kernel/kthread.c 2006-06-06 02:57:02.000000000 +0200
+++ linux-2.6.17+/kernel/kthread.c 2006-07-01 11:08:57.687698000 +0200
@@ -147,8 +147,11 @@ struct task_struct *kthread_create(int (
if (!IS_ERR(create.result)) {
va_list args;
va_start(args, namefmt);
- vsnprintf(create.result->comm, sizeof(create.result->comm),
- namefmt, args);
+ if(vsnprintf(create.result->comm, sizeof(create.result->comm),
+ namefmt, args) != strlen(create.result->comm))
+ printk(KERN_WARNING "kthread_create: command name of "
+ "pid %d truncated to \"%s\"\n", create.result->pid,
+ create.result->comm);
va_end(args);
}

#<<eof>>


Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/