[CRIU] [PATCH] posix-times: don't fail if /proc/PID/times is absent

Andrew Vagin avagin at parallels.com
Tue Jul 2 08:37:23 EDT 2013


On Tue, Jul 02, 2013 at 07:29:40PM +0400, Pavel Emelyanov wrote:
> On 07/02/2013 07:23 PM, Andrey Vagin wrote:
> > /proc/PID/times was added in 3.10, but FC19 relesead with 3.9.
> > 
> > Usually we support only last version of kernel in the project git, so
> > we can commit it as an additional patch for the fedora package.
> 
> No, it's OK to keep in in HEAD. We do the same e.g. for sock diag.
> 
> > Cc: Adrian Reber <adrian at lisas.de>
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  proc_parse.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/proc_parse.c b/proc_parse.c
> > index 28e2983..57311ec 100644
> > --- a/proc_parse.c
> > +++ b/proc_parse.c
> > @@ -1189,6 +1189,10 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
> >  
> >  	file = fopen_proc(pid, "timers");
> >  	if (file == NULL) {
> > +		if (errno == ENOENT) {
> > +			pr_warn("Dump of posix timers isn't supported by this kernel\n");
> > +			return 0;
> > +		}
> 
> This would result in existing, though empty, posix-timers.img file. Is it difficult
> to avoid that?

We can set timer_n to -1 in this case and then handle this value in
parasite_dump_posix_timers_seized.

Currently we get a file descriptor from cr_fdset, if we will avoid
creating an image file, we will have to open image file in
parasite_dump_posix_timers_seized.

I am not sure that we really need all this code to support one kernel.

> 
> >  		pr_perror("Can't open posix timers file!");
> >  		return -1;
> >  	}
> > 
> 
> 


More information about the CRIU mailing list