aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pid.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/pid.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r--include/linux/pid.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
new file mode 100644
index 000000000000..5b2fcb19d2da
--- /dev/null
+++ b/include/linux/pid.h
@@ -0,0 +1,55 @@
1#ifndef _LINUX_PID_H
2#define _LINUX_PID_H
3
4enum pid_type
5{
6 PIDTYPE_PID,
7 PIDTYPE_TGID,
8 PIDTYPE_PGID,
9 PIDTYPE_SID,
10 PIDTYPE_MAX
11};
12
13struct pid
14{
15 /* Try to keep pid_chain in the same cacheline as nr for find_pid */
16 int nr;
17 struct hlist_node pid_chain;
18 /* list of pids with the same nr, only one of them is in the hash */
19 struct list_head pid_list;
20};
21
22#define pid_task(elem, type) \
23 list_entry(elem, struct task_struct, pids[type].pid_list)
24
25/*
26 * attach_pid() and detach_pid() must be called with the tasklist_lock
27 * write-held.
28 */
29extern int FASTCALL(attach_pid(struct task_struct *task, enum pid_type type, int nr));
30
31extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
32
33/*
34 * look up a PID in the hash table. Must be called with the tasklist_lock
35 * held.
36 */
37extern struct pid *FASTCALL(find_pid(enum pid_type, int));
38
39extern int alloc_pidmap(void);
40extern void FASTCALL(free_pidmap(int));
41extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thread);
42
43#define do_each_task_pid(who, type, task) \
44 if ((task = find_task_by_pid_type(type, who))) { \
45 prefetch((task)->pids[type].pid_list.next); \
46 do {
47
48#define while_each_task_pid(who, type, task) \
49 } while (task = pid_task((task)->pids[type].pid_list.next,\
50 type), \
51 prefetch((task)->pids[type].pid_list.next), \
52 hlist_unhashed(&(task)->pids[type].pid_chain)); \
53 } \
54
55#endif /* _LINUX_PID_H */