Exemplo n.º 1
0
static int cr_export_now_file(struct epm_action *action, ghost_t *ghost,
			      struct task_struct *task,
			      union export_args *args)
{
	int r, supported;

	supported = can_checkpoint_file(args->file_args.file);

	r = ghost_write(ghost, &supported, sizeof(supported));
	if (r)
		goto error;

	if (supported)
		r = regular_file_export(action, ghost, task,
					args->file_args.index,
					args->file_args.file);

error:
	if (r) {
		char *buffer, *filename;
		filename = alloc_filename(args->file_args.file, &buffer);
		if (!IS_ERR(filename)) {
			ckpt_err(action, r,
				 "Fail to save information needed to reopen "
				 "file %s as fd %d of process %d (%s)",
				 filename, args->file_args.index,
				 task_pid_knr(task), task->comm);
			free_filename(buffer);
		} else {
			ckpt_err(action, r,
				 "Fail to save information needed to reopen "
				 "fd %d of process %d (%s)",
				 args->file_args.index,
				 task_pid_knr(task), task->comm);
		}
	}

	return r;
}
static int cr_export_now_file(struct epm_action *action, ghost_t *ghost,
			      struct task_struct *task,
			      union export_args *args)
{
	int r, supported;

	supported = can_checkpoint_file(args->file_args.file);

	r = ghost_write(ghost, &supported, sizeof(supported));
	if (r) {
		epm_error_saving_file(action, r, task,
				      args->file_args.file,
				      args->file_args.index);
		goto error;
	}

	if (supported)
		r = regular_file_export(action, ghost, task,
					args->file_args.index,
					args->file_args.file);

error:
	return r;
}