[patch] easily tweakable comm length

From: pmeda
Date: Tue Jan 11 2005 - 05:15:12 EST



This change still keeps the comm length at 16, but allows easier patching for
local modifications, and also introduces a macro to use instead of magic 16,
where sizeof(comm) is not preferable to use.
Not able to use killall, pidof etc. effectively, when long process names are
used for scripts. Just changing the command length from 16 to 32 breaks a.out
coredump logic. Deamonise and get_task_comm helped in other places in 2.6.10.

Signed-off-by: Prasanna Meda <pmeda@xxxxxxxxxx>

--- a/arch/sparc64/kernel/binfmt_aout32.c Tue Jan 11 09:04:24 2005
+++ b/arch/sparc64/kernel/binfmt_aout32.c Tue Jan 11 09:04:59 2005
@@ -95,7 +95,7 @@
set_fs(KERNEL_DS);
has_dumped = 1;
current->flags |= PF_DUMPCORE;
- strncpy(dump.u_comm, current->comm, sizeof(current->comm));
+ strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
dump.signal = signr;
dump_thread(regs, &dump);

--- a/fs/binfmt_aout.c Tue Jan 11 09:11:56 2005
+++ b/fs/binfmt_aout.c Tue Jan 11 09:14:32 2005
@@ -112,7 +112,7 @@
set_fs(KERNEL_DS);
has_dumped = 1;
current->flags |= PF_DUMPCORE;
- strncpy(dump.u_comm, current->comm, sizeof(current->comm));
+ strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
#ifndef __sparc__
dump.u_ar0 = (void *)(((unsigned long)(&dump.regs)) - ((unsigned long)(&dump)));
#endif
--- a/include/linux/sched.h Tue Jan 11 09:23:56 2005
+++ b/include/linux/sched.h Tue Jan 11 09:27:05 2005
@@ -121,6 +121,9 @@
#define set_current_state(state_value) \
set_mb(current->state, (state_value))

+/* Task command name length */
+#define TASK_COMM_LEN 16
+
/*
* Scheduling policies
*/
@@ -601,7 +604,7 @@
struct key *thread_keyring; /* keyring private to this thread */
#endif
unsigned short used_math;
- char comm[16];
+ char comm[TASK_COMM_LEN];
/* file system info */
int link_count, total_link_count;
/* ipc stuff */
-
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/