Exemplo n.º 1
0
/**
 *  Main kernel entry function to restart a checkpointed task.
 *  @author Geoffroy Vallée, Matthieu Fertré
 *
 *  @param app          Application
 *  @param pid		Pid of the task to restart
 *  @param flags	Option flags
 *
 *  @return		New task if success, PTR_ERR if failure
 */
struct task_struct *restart_process(struct app_struct *app, pid_t pid,
				    int flags)
{
	struct epm_action action;
	struct task_struct *task;

	/* Check if the process has not been already restarted */
	if (find_task_by_kpid(pid) != NULL)
		return ERR_PTR(-EALREADY);

	action.type = EPM_RESTART;
	action.restart.appid = app->app_id;
	action.restart.shared = CR_LINK_ONLY;
	action.restart.app = app;
	action.restart.flags = flags;

	BUG_ON(!action.restart.app);

	task = restart_task(&action, pid, app->app_id, app->chkpt_sn);
	if (IS_ERR(task))
		epm_error(&action, PTR_ERR(task), NULL,
			  "Fail to restart process %d",
			  pid);

	return task;
}
Exemplo n.º 2
0
static inline long __get_appid_from_local_pid(pid_t pid)
{
	struct task_struct * task;

	rcu_read_lock();
	task = find_task_by_kpid(pid);
	rcu_read_unlock();
	if (task)
		return __get_appid_from_task(task);

	return -ESRCH;
}