<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Paolo 'Blaisorblade' Giarrusso &lt;blaisorblade@yahoo.it&gt;

Add some comments about task-&gt;comm, to explain what it is near its definition
and provide some important pointers to its uses.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso &lt;blaisorblade@yahoo.it&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 fs/exec.c             |    4 +++-
 include/linux/sched.h |    7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff -puN fs/exec.c~comments-on-locking-of-task-comm fs/exec.c
--- 25/fs/exec.c~comments-on-locking-of-task-comm	2005-05-03 16:15:05.000000000 -0700
+++ 25-akpm/fs/exec.c	2005-05-03 16:15:05.000000000 -0700
@@ -869,9 +869,11 @@ int flush_old_exec(struct linux_binprm *
 	if (current-&gt;euid == current-&gt;uid &amp;&amp; current-&gt;egid == current-&gt;gid)
 		current-&gt;mm-&gt;dumpable = 1;
 	name = bprm-&gt;filename;
+
+	/* Copies the binary name from after last slash */
 	for (i=0; (ch = *(name++)) != '\0';) {
 		if (ch == '/')
-			i = 0;
+			i = 0; /* overwrite what we wrote */
 		else
 			if (i &lt; (sizeof(tcomm) - 1))
 				tcomm[i++] = ch;
diff -puN include/linux/sched.h~comments-on-locking-of-task-comm include/linux/sched.h
--- 25/include/linux/sched.h~comments-on-locking-of-task-comm	2005-05-03 16:15:05.000000000 -0700
+++ 25-akpm/include/linux/sched.h	2005-05-03 16:15:05.000000000 -0700
@@ -617,7 +617,7 @@ struct task_struct {
 	unsigned long flags;	/* per process flags, defined below */
 	unsigned long ptrace;
 
-	int lock_depth;		/* Lock depth */
+	int lock_depth;		/* BKL lock depth */
 
 #if defined(CONFIG_SMP) &amp;&amp; defined(__ARCH_WANT_UNLOCKED_CTXSW)
 	int oncpu;
@@ -706,7 +706,10 @@ struct task_struct {
 	unsigned char jit_keyring;	/* default keyring to attach requested keys to */
 #endif
 	int oomkilladj; /* OOM kill score adjustment (bit shift). */
-	char comm[TASK_COMM_LEN];
+	char comm[TASK_COMM_LEN]; /* executable name excluding path
+				     - access with [gs]et_task_comm (which lock
+				       it with task_lock())
+				     - initialized normally by flush_old_exec */
 /* file system info */
 	int link_count, total_link_count;
 /* ipc stuff */
_
</pre></body></html>