criu/include/pstree.h
Pavel Emelyanov 990f80dd0f tty: Sanitize slavery and ctl tty setups
We need to do two non-trivial things with ttys -- interconnect
slaves to masters (or to each other) and setup ctl-tty restoring
task.

Now this is done in subsequently depending on each other steps:

1. collect ttys
2. interconnect slaves and mark ctl-tty tasks
3. collect fake fds for tty-ctl tasks
4. setup orphaned slaves

We can relax this logic in two ways:

1. don't split marking ctl-tty tasks and then creating fds for them
   do it in one step at the end
2. don't interconnect slaves with masters and orphaned slaves in
   two steps -- do it in one place after fds are collected

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-14 18:12:59 +04:00

38 lines
1.1 KiB
C

#ifndef PSTREE_H__
#define PSTREE_H__
#include "list.h"
#include "crtools.h"
struct pstree_item {
struct list_head list;
struct pid pid;
struct pstree_item *parent;
struct list_head children; /* array of children */
pid_t pgid;
pid_t sid;
pid_t born_sid;
int state; /* TASK_XXX constants */
int nr_threads; /* number of threads */
struct pid *threads; /* array of threads */
struct rst_info rst[0];
};
extern void free_pstree(struct pstree_item *root_item);
extern struct pstree_item *__alloc_pstree_item(bool rst);
#define alloc_pstree_item() __alloc_pstree_item(false)
#define alloc_pstree_item_with_rst() __alloc_pstree_item(true)
extern struct pstree_item *root_item;
extern struct pstree_item *pstree_item_next(struct pstree_item *item);
#define for_each_pstree_item(pi) \
for (pi = root_item; pi != NULL; pi = pstree_item_next(pi))
extern bool restore_before_setsid(struct pstree_item *child);
extern int prepare_pstree(void);
extern int prepare_pstree_ids(void);
extern int dump_pstree(struct pstree_item *root_item);
struct task_entries;
extern struct task_entries *task_entries;
#endif