From: William Lee Irwin III <wli@holomorphy.com>
To: Kirill Korotaev <kksx@mail.ru>
Cc: akpm@osdl.org, torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: [5/7] back out renaming of struct pid
Date: Wed, 1 Sep 2004 10:33:27 -0700 [thread overview]
Message-ID: <20040901173327.GI5492@holomorphy.com> (raw)
In-Reply-To: <20040901173218.GH5492@holomorphy.com>
On Wed, Sep 01, 2004 at 10:32:18AM -0700, William Lee Irwin III wrote:
> Now that the basic syntactic issues with the macros have been dealt
> with, the semantic issue of properly terminating the list iteration
> remains. The following patch introduces a local variable __list__ in
> do_each_task_pid() to store the virtual address of the list head of the
> leader of the collision chain so that the iteration may be properly
> terminated.
The renaming of struct pid was spurious; the following patch backs out
this renaming.
Index: kirill-2.6.9-rc1-mm2/kernel/sys.c
===================================================================
--- kirill-2.6.9-rc1-mm2.orig/kernel/sys.c 2004-09-01 08:44:05.794680744 -0700
+++ kirill-2.6.9-rc1-mm2/kernel/sys.c 2004-09-01 09:29:03.608550696 -0700
@@ -1165,7 +1165,7 @@
asmlinkage long sys_setsid(void)
{
- struct pid_struct *pid;
+ struct pid *pid;
int err = -EPERM;
if (!thread_group_leader(current))
Index: kirill-2.6.9-rc1-mm2/kernel/pid.c
===================================================================
--- kirill-2.6.9-rc1-mm2.orig/kernel/pid.c 2004-09-01 08:44:05.779683024 -0700
+++ kirill-2.6.9-rc1-mm2/kernel/pid.c 2004-09-01 09:31:25.972908024 -0700
@@ -148,10 +148,10 @@
return -1;
}
-fastcall struct pid_struct *find_pid(enum pid_type type, int nr)
+struct pid * fastcall find_pid(enum pid_type type, int nr)
{
struct hlist_node *elem;
- struct pid_struct *pid;
+ struct pid *pid;
hlist_for_each_entry(pid, elem,
&pid_hash[type][pid_hashfn(nr)], hash_list) {
@@ -163,7 +163,7 @@
int fastcall attach_pid(task_t *task, enum pid_type type, int nr)
{
- struct pid_struct *pid, *task_pid;
+ struct pid *pid, *task_pid;
task_pid = &task->pids[type];
pid = find_pid(type, nr);
@@ -182,7 +182,7 @@
static inline int __detach_pid(task_t *task, enum pid_type type)
{
- struct pid_struct *pid, *pid_next;
+ struct pid *pid, *pid_next;
int nr;
pid = &task->pids[type];
@@ -190,7 +190,7 @@
hlist_del(&pid->hash_list);
if (!list_empty(&pid->pid_list)) {
pid_next = list_entry(pid->pid_list.next,
- struct pid_struct, pid_list);
+ struct pid, pid_list);
/* insert next pid from pid_list to hash */
hlist_add_head(&pid_next->hash_list,
&pid_hash[type][pid_hashfn(pid_next->nr)]);
@@ -218,11 +218,11 @@
task_t *find_task_by_pid_type(int type, int nr)
{
- struct pid_struct *pid = find_pid(type, nr);
+ struct pid *pid = find_pid(type, nr);
- if (!pid)
- return NULL;
- return pid_task(&pid->pid_list, type);
+ if (pid)
+ return pid_task(&pid->pid_list, type);
+ return NULL;
}
EXPORT_SYMBOL(find_task_by_pid_type);
Index: kirill-2.6.9-rc1-mm2/include/linux/sched.h
===================================================================
--- kirill-2.6.9-rc1-mm2.orig/include/linux/sched.h 2004-09-01 08:44:05.775683632 -0700
+++ kirill-2.6.9-rc1-mm2/include/linux/sched.h 2004-09-01 09:28:56.542624880 -0700
@@ -503,7 +503,7 @@
struct task_struct *group_leader; /* threadgroup leader */
/* PID/PID hash table linkage. */
- struct pid_struct pids[PIDTYPE_MAX];
+ struct pid pids[PIDTYPE_MAX];
wait_queue_head_t wait_chldexit; /* for wait4() */
struct completion *vfork_done; /* for vfork() */
Index: kirill-2.6.9-rc1-mm2/include/linux/pid.h
===================================================================
--- kirill-2.6.9-rc1-mm2.orig/include/linux/pid.h 2004-09-01 09:12:08.394886632 -0700
+++ kirill-2.6.9-rc1-mm2/include/linux/pid.h 2004-09-01 09:28:48.595832976 -0700
@@ -10,7 +10,7 @@
PIDTYPE_MAX
};
-struct pid_struct
+struct pid
{
/* Try to keep hash_list in the same cacheline as nr for find_pid */
int nr;
@@ -34,7 +34,7 @@
* look up a PID in the hash table. Must be called with the tasklist_lock
* held.
*/
-extern struct pid_struct *FASTCALL(find_pid(enum pid_type, int));
+struct pid *FASTCALL(find_pid(enum pid_type, int));
extern int alloc_pidmap(void);
extern void FASTCALL(free_pidmap(int));
next prev parent reply other threads:[~2004-09-01 17:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-01 11:46 [PATCH] obscure pid implementation fix (v2) Kirill Korotaev
2004-09-01 15:36 ` William Lee Irwin III
2004-09-01 15:38 ` William Lee Irwin III
2004-09-01 16:58 ` William Lee Irwin III
2004-09-01 17:27 ` [1/7] make do_each_task_pid()/while_each_task_pid() typecheck William Lee Irwin III
2004-09-01 17:28 ` [2/7] make do_each_task_pid()/while_each_task_pid() require a semicolon following them William Lee Irwin III
2004-09-01 17:30 ` [3/7] make do_each_task_pid()/while_each_task_pid() parenthesize their arguments William Lee Irwin III
2004-09-01 17:32 ` [4/7] fix loop termination condition in do_each_task_pid()/while_each_task_pid() William Lee Irwin III
2004-09-01 17:33 ` William Lee Irwin III [this message]
2004-09-01 17:35 ` [6/7] back out renaming of ->pid_chain William Lee Irwin III
2004-09-01 17:37 ` [7/7] remove casting of __detach_pid() results to void William Lee Irwin III
2004-09-01 17:48 ` [1/7] make do_each_task_pid()/while_each_task_pid() typecheck Linus Torvalds
2004-09-01 17:59 ` [1/1] rework of Kirill Korotaev's pidhashing patch William Lee Irwin III
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=20040901173327.GI5492@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=kksx@mail.ru \
--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