Skip to contentSkip to conversation

2.4: get_pid() typo fix

PATCH In review Robert Love 2 participants 2 messages Oct 6, 2002 – Oct 7, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4: get_pid() typo fix

Magnificent Marcelo,

Fix a typo in the comment of getpid() - we return current->tgid these days, not current->pid. Additionally, add some new comments explaining exactly why we return the tgid and how this works.

Patch is against 2.4.20-pre9, please apply.

Robert Love

kernel/timer.c +10 -2
diff -urN linux-2.4.20-pre9/kernel/timer.c linux/kernel/timer.c
@@ -740,10 +740,18 @@
  * The Alpha uses getxpid, getxuid, and getxgid instead.  Maybe this
  * should be moved into arch/i386 instead?
  */
- 
+
+/**
+ * sys_getpid - return the thread group id of the current process
+ *
+ * Note, despite the name, this returns the tgid not the pid.  The tgid and
+ * the pid are identical unless CLONE_THREAD was specified on clone() in
+ * which case the tgid is the same in all threads of the same group.
+ *
+ * This is SMP safe as current->tgid does not change.
+ */
 asmlinkage long sys_getpid(void)
 {
-	/* This is SMP safe - current->pid doesn't change */
 	return current->tgid;
 }
 
#1 lore raw
Quoted 1 line · Robert Love

Magnificent Marcelo,

^^^^^^^^^^^
Is this affects probability of patch being accepted? If yes, which is the best? ;-)
--
vda