OpenVZ Forum - RDF feed
type: channel
items: [PATCH 1/5] statically initialize struct pid for swapper

[PATCH 1/5] statically initialize struct pid for swapper
type: item
description: From: Sukadev Bhattiprolu <sukadev@us.ibm.com> Subject: [PATCH 1/5] statically initialize struct pid for swapper Statically initialize a struct pid for the swapper process (pid_t == 0) and attach it to init_task. This is needed so task_pid(), task_pgrp() and task_session() interfaces work on the swapper process also. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Cc: Cedric Le Goater <clg@fr.ibm.com> Cc: Dave Hansen <haveblue@us.ibm.com> Cc: Serge Hallyn <serue@us.ibm.com> Cc: Eric Biederman <ebiederm@xmission.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: <containers@lists.osdl.org> Acked-by: Eric W. Biederman <ebiederm@xmission.com> --- include/linux/init_task.h | 27 +++++++++++++++++++++++++++ include/linux/pid.h | 2 ++ kernel/pid.c | 2 ++ 3 files changed, 31 insertions(+) Index: lx26-20-mm2c/include/linux/init_task.h =================================================================== --- lx26-20-mm2c.orig/include/linux/init_task.h 2007-02-28 15:47:44.000000000 -0800 +++ lx26-20-mm2c/include/linux/init_task.h 2007-02-28 15:48:07.000000000 -0800 @@ -96,6 +96,28 @@ extern struct group_info init_groups; #define INIT_PREEMPT_RCU #endif +#define INIT_STRUCT_PID { \ + .count = ATOMIC_INIT(1), \ + .nr = 0, \ + /* Don't put this struct pid in pid_hash */ \ + .pid_chain = { .next = NULL, .pprev = NULL }, \ + .tasks = { \ + { .first = &init_task.pids[PIDTYPE_PID].node }, \ + { .first = &init_task.pids[PIDTYPE_PGID].node }, \ + { .first = &init_task.pids[PIDTYPE_SID].node }, \ + }, \ + .rcu = RCU_HEAD_INIT, \ +} + +#define INIT_PID_LINK(type) \ +{ \ + .node = { \ + .next = NULL, \ + .pprev = &init_struct_pid.tasks[type].first, \ + }, \ + .pid = &init_struct_pid, \ +} + /* * INIT_TASK is used to set up the first task table, touch at * your own risk!. Base=0, limit=0x1fffff (=2MB) @@ -145,6 +167,11 @@ extern struct group_info init_groups; .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ .fs_excl = ATOMIC_INIT(0), \ .pi_lock = SPIN_LOCK_UNLOCKED, \ + .pids = { \ +…
creator: Sukadev Bhattiprolu
date: 2007-03-13T04:42:12-00:00