## Automatically generated incremental diff
## From:   linux-2.4.28-bk2
## To:     linux-2.4.28-bk3
## Robot:  $Id: make-incremental-diff,v 1.12 2004/01/06 07:19:36 hpa Exp $

diff -urN linux-2.4.28-bk2/Makefile linux-2.4.28-bk3/Makefile
--- linux-2.4.28-bk2/Makefile	2004-11-20 02:57:09.143161921 -0800
+++ linux-2.4.28-bk3/Makefile	2004-11-20 02:57:11.414255007 -0800
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 28
-EXTRAVERSION = -bk2
+EXTRAVERSION = -bk3
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
diff -urN linux-2.4.28-bk2/fs/exec.c linux-2.4.28-bk3/fs/exec.c
--- linux-2.4.28-bk2/fs/exec.c	2004-02-18 05:36:31.000000000 -0800
+++ linux-2.4.28-bk3/fs/exec.c	2004-11-20 02:57:11.464257057 -0800
@@ -563,12 +563,29 @@
 	tsk->tgid = tsk->pid;
 }
 
+void get_task_comm(char *buf, struct task_struct *tsk)
+{
+	/* buf must be at least sizeof(tsk->comm) in size */
+	task_lock(tsk);
+	memcpy(buf, tsk->comm, sizeof(tsk->comm));
+	task_unlock(tsk);
+}
+
+void set_task_comm(struct task_struct *tsk, char *buf)
+{
+	task_lock(tsk);
+	strncpy(tsk->comm, buf, sizeof(tsk->comm));
+	tsk->comm[sizeof(tsk->comm)-1]='\0';
+	task_unlock(tsk);
+}
+
 int flush_old_exec(struct linux_binprm * bprm)
 {
 	char * name;
 	int i, ch, retval;
 	struct signal_struct * oldsig;
 	struct files_struct * files;
+	char tcomm[sizeof(current->comm)];
 
 	/*
 	 * Make sure we have a private signal table
@@ -610,10 +627,11 @@
 		if (ch == '/')
 			i = 0;
 		else
-			if (i < 15)
-				current->comm[i++] = ch;
+			if (i < (sizeof(tcomm) - 1))
+				tcomm[i++] = ch;
 	}
-	current->comm[i] = '\0';
+	tcomm[i] = '\0';
+	set_task_comm(current, tcomm);
 
 	flush_thread();
 
diff -urN linux-2.4.28-bk2/fs/proc/array.c linux-2.4.28-bk3/fs/proc/array.c
--- linux-2.4.28-bk2/fs/proc/array.c	2003-11-28 10:26:21.000000000 -0800
+++ linux-2.4.28-bk3/fs/proc/array.c	2004-11-20 02:57:11.472257385 -0800
@@ -86,10 +86,13 @@
 {
 	int i;
 	char * name;
+	char tcomm[sizeof(p->comm)];
+
+	get_task_comm(tcomm, p);
 
 	ADDBUF(buf, "Name:\t");
-	name = p->comm;
-	i = sizeof(p->comm);
+	name = tcomm;
+	i = sizeof(tcomm);
 	do {
 		unsigned char c = *name;
 		name++;
@@ -308,6 +311,7 @@
 	int res;
 	pid_t ppid;
 	struct mm_struct *mm;
+	char tcomm[sizeof(task->comm)];
 
 	state = *get_task_state(task);
 	vsize = eip = esp = 0;
@@ -333,6 +337,8 @@
 		up_read(&mm->mmap_sem);
 	}
 
+	get_task_comm(tcomm, task);
+
 	wchan = get_wchan(task);
 
 	collect_sigign_sigcatch(task, &sigign, &sigcatch);
@@ -350,7 +356,7 @@
 %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
 %lu %lu %lu %lu %lu %lu %lu %lu %d %d\n",
 		task->pid,
-		task->comm,
+		tcomm,
 		state,
 		ppid,
 		task->pgrp,
diff -urN linux-2.4.28-bk2/include/linux/sched.h linux-2.4.28-bk3/include/linux/sched.h
--- linux-2.4.28-bk2/include/linux/sched.h	2004-11-17 03:54:22.000000000 -0800
+++ linux-2.4.28-bk3/include/linux/sched.h	2004-11-20 02:57:11.479257671 -0800
@@ -800,6 +800,9 @@
 extern int do_execve(char *, char **, char **, struct pt_regs *);
 extern int do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long);
 
+extern void set_task_comm(struct task_struct *tsk, char *from);
+extern void get_task_comm(char *to, struct task_struct *tsk);
+
 extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
 extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
 extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
