mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: blaisorblade@yahoo.it
To: torvalds@osdl.org
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, blaisorblade@yahoo.it
Subject: [patch 1/1] comments on locking of task->comm
Date: Sat, 12 Mar 2005 19:08:18 +0100	[thread overview]
Message-ID: <20050312180818.54B3097666@zion> (raw)


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

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>
---

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

diff -puN include/linux/sched.h~locking-use-commentary include/linux/sched.h
--- linux-2.6.11/include/linux/sched.h~locking-use-commentary	2005-03-12 19:06:25.000000000 +0100
+++ linux-2.6.11-paolo/include/linux/sched.h	2005-03-12 19:06:25.000000000 +0100
@@ -532,7 +532,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;
@@ -615,7 +615,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 */
diff -puN fs/exec.c~locking-use-commentary fs/exec.c
--- linux-2.6.11/fs/exec.c~locking-use-commentary	2005-03-12 19:06:25.000000000 +0100
+++ linux-2.6.11-paolo/fs/exec.c	2005-03-12 19:06:25.000000000 +0100
@@ -867,9 +867,11 @@ int flush_old_exec(struct linux_binprm *
 	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;
_

                 reply	other threads:[~2005-03-15 19:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050312180818.54B3097666@zion \
    --to=blaisorblade@yahoo.it \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®