aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-05-05 16:16:12 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 16:36:48 -0700
commit3677209239ed71d2654e73eecfab1dbec2af11a9 (patch)
tree125d9d7553c5f6dc6ad030e4c829a5bf71ab3ef5
parent291c4a75ce7632ee5c565359fb875ba0597f76be (diff)
[PATCH] comments on locking of task->comm
Add some comments about task->comm, to explain what it is near its definition and provide some important pointers to its uses. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/exec.c4
-rw-r--r--include/linux/sched.h7
2 files changed, 8 insertions, 3 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 52acff3f44f..e56ee243702 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -869,9 +869,11 @@ int flush_old_exec(struct linux_binprm * bprm)
if (current->euid == current->uid && current->egid == current->gid)
current->mm->dumpable = 1;
name = bprm->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 < (sizeof(tcomm) - 1))
tcomm[i++] = ch;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5f868a58858..4dbb109022f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -578,7 +578,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 */
int prio, static_prio;
struct list_head run_list;
@@ -661,7 +661,10 @@ struct task_struct {
struct key *thread_keyring; /* keyring private to this thread */
#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 */