[CRIU] [PATCH 4/5] timerfd: Implement c/r procedure

Pavel Emelyanov xemul at parallels.com
Thu Jun 26 14:07:48 PDT 2014


On 06/26/2014 11:12 PM, Cyrill Gorcunov wrote:
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  Makefile.crtools     |   1 +
>  cr-restore.c         |   8 ++
>  files.c              |  13 +++
>  include/proc_parse.h |   2 +
>  include/restorer.h   |   9 +++
>  include/rst_info.h   |   3 +
>  include/timerfd.h    |  20 +++++
>  pie/restorer.c       |  25 ++++++
>  proc_parse.c         |  60 ++++++++++++++
>  timerfd.c            | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  10 files changed, 359 insertions(+)
>  create mode 100644 include/timerfd.h
>  create mode 100644 timerfd.c
> 
> +int prepare_timerfd(struct pstree_item *me)
> +{
> +	struct rst_info *ri = me->rst;
> +	struct fdinfo_list_entry *fle;
> +
> +	rst_timerfd_cpos = rst_mem_cpos(RM_PRIVATE);
> +	rst_timerfd_nr = 0;
> +
> +	list_for_each_entry(fle, &ri->timerfd, ps_list) {
> +		struct file_desc *d = fle->desc;
> +		struct timerfd_info *info;
> +		struct restore_timerfd *t;
> +		TimerfdEntry *tfe;
> +
> +		if (!file_master(d))
> +			continue;
> +
> +		info = container_of(d, struct timerfd_info, d);
> +		tfe = info->tfe;
> +
> +		t = rst_mem_alloc(sizeof(*t), RM_PRIVATE);

Why not in post_open callback of timerfd ops?

> +		if (!t)
> +			return -ENOMEM;
> +
> +		t->fd				= fle->fe->fd;
> +		t->settime_flags		= tfe->settime_flags;
> +		t->val.it_interval.tv_sec	= (time_t)tfe->isec;
> +		t->val.it_interval.tv_nsec	= (long)tfe->insec;
> +		t->val.it_value.tv_sec		= (time_t)tfe->vsec;
> +		t->val.it_value.tv_nsec		= (long)tfe->vnsec;
> +		rst_timerfd_nr++;
> +	}
> +
> +	return 0;
> +}





More information about the CRIU mailing list