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

Andrew Vagin avagin at parallels.com
Tue Jul 2 09:15:49 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.

Actually it isn't the same, because if sock diag fails for one type of
sockets and a process has sockets of this type, crtools dump will fail.

And one more point is that socket diag can be disabled in a kernel
config, and crtools should be ready for such cases.

> 
> > 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?
> 
> >  		pr_perror("Can't open posix timers file!");
> >  		return -1;
> >  	}
> > 
> 
> 


More information about the CRIU mailing list