All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@openvz.org>
To: Kirill Korotaev <dev@openvz.org>
Cc: serue@us.ibm.com, arjan@infradead.org, frankeh@watson.ibm.com,
	clg@fr.ibm.com, haveblue@us.ibm.com, mrmacman_g4@mac.com,
	alan@lxorguk.ukuu.org.uk,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	devel@openvz.org
Subject: [RFC][PATCH 4/7] VPIDs: vpid macros in non-VPID case
Date: Thu, 02 Feb 2006 19:26:28 +0300	[thread overview]
Message-ID: <43E232B4.2090003@openvz.org> (raw)
In-Reply-To: <43E22B2D.1040607@openvz.org>

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

This patch specifies an "interface" to virtual pids. That is
some macros/inlines to obtain pids from tasks, convert pids
to vpids and vice versa and set pids.

Kirill

[-- Attachment #2: diff-vpids-macro --]
[-- Type: text/plain, Size: 2400 bytes --]

--- ./include/linux/pid.h.vpid_macro	2006-01-03 06:21:10.000000000 +0300
+++ ./include/linux/pid.h	2006-02-02 14:32:41.162807472 +0300
@@ -19,6 +19,19 @@ struct pid
 	struct list_head pid_list;
 };
 
+#ifndef CONFIG_VIRTUAL_PIDS
+#define __is_virtual_pid(pid)		0
+#define is_virtual_pid(pid)		0
+#define vpid_to_pid(pid)		(pid)
+#define __vpid_to_pid(pid)		(pid)
+#define pid_type_to_vpid(type, pid)	(pid)
+#define __pid_type_to_vpid(type, pid)	(pid)
+#define comb_vpid_to_pid(pid)		(pid)
+#define comb_pid_to_vpid(pid)		(pid)
+#define alloc_vpid(pid, vpid)		(pid)
+#define free_vpid(vpid)			do { } while (0)
+#endif
+
 #define pid_task(elem, type) \
 	list_entry(elem, struct task_struct, pids[type].pid_list)
 
--- ./include/linux/sched.h.vpid_macro	2006-02-02 14:15:55.455698192 +0300
+++ ./include/linux/sched.h	2006-02-02 14:32:41.164807168 +0300
@@ -1257,6 +1257,78 @@ static inline unsigned long *end_of_stac
 
 #endif
 
+#ifndef CONFIG_VIRTUAL_PIDS
+static inline pid_t virt_pid(struct task_struct *tsk)
+{
+	return tsk->pid;
+}
+
+static inline pid_t virt_tgid(struct task_struct *tsk)
+{
+	return tsk->tgid;
+}
+
+static inline pid_t virt_pgid(struct task_struct *tsk)
+{
+	return tsk->signal->pgrp;
+}
+
+static inline pid_t virt_sid(struct task_struct *tsk)
+{
+	return tsk->signal->session;
+}
+
+static inline pid_t get_task_pid_ve(struct task_struct *tsk,
+		struct task_struct *ve_tsk)
+{
+	return tsk->pid;
+}
+
+static inline pid_t get_task_pid(struct task_struct *tsk)
+{
+	return tsk->pid;
+}
+
+static inline pid_t get_task_tgid(struct task_struct *tsk)
+{
+	return tsk->tgid;
+}
+
+static inline pid_t get_task_pgid(struct task_struct *tsk)
+{
+	return tsk->signal->pgrp;
+}
+
+static inline pid_t get_task_sid(struct task_struct *tsk)
+{
+	return tsk->signal->session;
+}
+
+static inline int set_virt_pid(struct task_struct *tsk, pid_t pid)
+{
+	return 0;
+}
+
+static inline void set_virt_tgid(struct task_struct *tsk, pid_t pid)
+{
+}
+
+static inline void set_virt_pgid(struct task_struct *tsk, pid_t pid)
+{
+}
+
+static inline void set_virt_sid(struct task_struct *tsk, pid_t pid)
+{
+}
+
+static inline pid_t get_task_ppid(struct task_struct *p)
+{
+	if (!pid_alive(p))
+		return 0;
+	return (p->pid > 1 ? p->group_leader->real_parent->tgid : 0);
+}
+#endif
+
 /* set thread flags in other task's structures
  * - see asm/thread_info.h for TIF_xxxx flags available
  */

  parent reply	other threads:[~2006-02-02 16:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 15:54 [RFC][PATCH] VPIDs: Virtualization of PIDs (OpenVZ approach) Kirill Korotaev
2006-02-02 16:16 ` [RFC][PATCH 1/7] VPIDs: add VPID config option Kirill Korotaev
2006-02-02 16:21 ` [RFC][PATCH 2/7] VPIDs: pid/vpid conversions Kirill Korotaev
2006-02-08 20:29   ` Eric W. Biederman
2006-02-08 23:53     ` Alexey Kuznetsov
2006-02-09  0:37       ` Eric W. Biederman
2006-02-09  1:11         ` Alexey Kuznetsov
2006-02-09  1:36           ` Eric W. Biederman
2006-02-09  2:51           ` Serge E. Hallyn
2006-02-09  9:55             ` Alexey Kuznetsov
2006-02-09 19:22               ` Eric W. Biederman
2006-02-20 14:57     ` Kirill Korotaev
2006-02-20 16:56       ` Herbert Poetzl
2006-02-21 16:19         ` Kirill Korotaev
2006-02-21 23:17           ` Herbert Poetzl
2006-02-02 16:24 ` [RFC][PATCH 3/7] VPIDs: fork modifications Kirill Korotaev
2006-02-02 20:08   ` Cedric Le Goater
2006-02-02 16:26 ` Kirill Korotaev [this message]
2006-02-02 16:30 ` [RFC][PATCH 5/7] VPIDs: vpid/pid conversion in VPID enabled case Kirill Korotaev
2006-02-02 17:05   ` Dave Hansen
2006-02-02 19:29     ` Serge E. Hallyn
2006-02-03 10:52     ` Alexey Kuznetsov
2006-02-03 12:48       ` Cedric Le Goater
2006-02-03 14:02         ` Alexey Kuznetsov
2006-02-03 16:25           ` Dave Hansen
2006-02-06 11:24             ` Alexey Kuznetsov
2006-02-03 17:05           ` Cedric Le Goater
2006-02-06  9:48             ` Alexey Kuznetsov
2006-02-06 14:51               ` Serge E. Hallyn
2006-02-06 15:51                 ` Alexey Kuznetsov
2006-02-06 16:24                   ` Serge E. Hallyn
2006-02-07  9:46                   ` Cedric Le Goater
2006-02-07 11:44                     ` Kirill Korotaev
2006-02-07 12:59                       ` Cedric Le Goater
2006-02-07  9:15               ` Cedric Le Goater
2006-02-03 14:05         ` Kirill Korotaev
2006-02-03 15:40           ` Cedric Le Goater
2006-02-03 16:28             ` Kirill Korotaev
2006-02-02 16:31 ` [RFC][PATCH 6/7] VPIDs: small proc VPID export Kirill Korotaev
2006-02-02 16:33 ` [RFC][PATCH 7/7] VPIDs: required VPS interface for VPIDs Kirill Korotaev
2006-02-03  3:01 ` [RFC][PATCH] VPIDs: Virtualization of PIDs (OpenVZ approach) Herbert Poetzl
2006-02-03 10:30   ` Kirill Korotaev
2006-02-03 12:45   ` Alexey Kuznetsov

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=43E232B4.2090003@openvz.org \
    --to=dev@openvz.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=clg@fr.ibm.com \
    --cc=devel@openvz.org \
    --cc=frankeh@watson.ibm.com \
    --cc=haveblue@us.ibm.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrmacman_g4@mac.com \
    --cc=serue@us.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.