Skip to contentSkip to conversation

Pid ns helpers for signals

PATCH In review sukadev-r/[email protected] 1 participant 1 message Sep 11, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Pid ns helpers for signals

Define some helper functions that will be used to implement signal semantics with multiple pid namespaces.

is_current_in_ancestor_pid_ns(task)

TRUE iff active pid namespace of 'current' is an ancestor of active pid namespace of @task.

is_current_in_same_or_ancestor_pid_ns(task)

TRUE iff active pid namespace of 'current' is either same as or an ancestor of active pid namespace of @task.

pid_ns_equal(tsk)
TRUE if active pid ns of @tsk is same as active pid ns of 'current'.

Changelog: [Oleg Nesterov]: Renamed helpers. Dropped reference to pid and
pid-namespace since they are stable for current callers.

---
 include/linux/pid.h |   12 +++++++++
 kernel/pid.c        |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
include/linux/pid.h +12 -0
Index: 2.6.23-rc4-mm1/include/linux/pid.h
===================================================================
@@ -124,6 +124,18 @@ extern struct pid *alloc_pid(struct pid_
 extern void FASTCALL(free_pid(struct pid *pid));
 extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
 
+static inline struct pid_namespace *pid_active_ns(struct pid *pid)
+{
+	if (!pid)
+		return NULL;
+
+	return pid->numbers[pid->level].ns;
+}
+
+extern int pid_ns_equal(struct task_struct *tsk);
+extern int is_current_in_ancestor_pid_ns(struct task_struct *tsk);
+extern int is_current_in_same_or_ancestor_pid_ns(struct task_struct *tsk);
+
 /*
  * the helpers to get the pid's id seen from different namespaces
  *
kernel/pid.c +63 -0

69 lines not on this page · raw message