2013-11-06 14:34:27 +04:00
|
|
|
#ifndef __CR_PID_H__
|
|
|
|
#define __CR_PID_H__
|
|
|
|
|
2013-11-06 17:21:13 +04:00
|
|
|
#include "stdbool.h"
|
|
|
|
|
2013-11-06 14:34:27 +04:00
|
|
|
struct pid {
|
|
|
|
/*
|
|
|
|
* The @real pid is used to fetch tasks during dumping stage,
|
|
|
|
* This is a global pid seen from the context where the dumping
|
|
|
|
* is running.
|
|
|
|
*/
|
|
|
|
pid_t real;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The @virt pid is one which used in the image itself and keeps
|
|
|
|
* the pid value to be restored. This pid fetched from the
|
|
|
|
* dumpee context, because the dumpee might have own pid namespace.
|
|
|
|
*/
|
|
|
|
pid_t virt;
|
|
|
|
};
|
|
|
|
|
2013-11-06 17:21:13 +04:00
|
|
|
/*
|
|
|
|
* When we have to restore a shared resource, we mush select which
|
|
|
|
* task should do it, and make other(s) wait for it. In order to
|
|
|
|
* avoid deadlocks, always make task with lower pid be the restorer.
|
|
|
|
*/
|
|
|
|
static inline bool pid_rst_prio(unsigned pid_a, unsigned pid_b)
|
|
|
|
{
|
|
|
|
return pid_a < pid_b;
|
|
|
|
}
|
|
|
|
|
2013-11-15 14:04:45 +04:00
|
|
|
#endif /* __CR_PID_H__ */
|