[CRIU] [PATCH] RPC: make status-fd option available via RPC

Adrian Reber adrian at lisas.de
Mon Feb 6 09:03:02 PST 2017


On Mon, Feb 06, 2017 at 01:23:21PM +0300, Pavel Emelyanov wrote:
> On 02/06/2017 11:52 AM, Adrian Reber wrote:
> > From: Adrian Reber <areber at redhat.com>
> > 
> > As runc uses the RPC interface to run criu it is necessary to expose
> > the newly added status-fd feature via RPC. Using the status-fd interface
> > makes it possible to use lazy migration with runc.
> > 
> > Signed-off-by: Adrian Reber <areber at redhat.com>
> > ---
> >  criu/cr-service.c | 8 ++++++++
> >  images/rpc.proto  | 1 +
> >  2 files changed, 9 insertions(+)
> > 
> > diff --git a/criu/cr-service.c b/criu/cr-service.c
> > index 4bac50d..12cef70 100644
> > --- a/criu/cr-service.c
> > +++ b/criu/cr-service.c
> > @@ -227,6 +227,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
> >  	socklen_t ids_len = sizeof(struct ucred);
> >  	char images_dir_path[PATH_MAX];
> >  	char work_dir_path[PATH_MAX];
> > +	char status_fd[PATH_MAX];
> >  	int i;
> >  
> >  	if (getsockopt(sk, SOL_SOCKET, SO_PEERCRED, &ids, &ids_len)) {
> > @@ -511,6 +512,13 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
> >  		}
> >  	}
> >  
> > +	if (req->has_status_fd) {
> > +		sprintf(status_fd, "/proc/%d/fd/%d", ids.pid, req->status_fd);
> > +		opts.status_fd = open(status_fd, O_WRONLY | O_CREAT, 0600);
> 
> But why O_CREAT is needed here? The path in question should exist.

Too many attempts for such a simple change ;-) You are right. That is
not necessary and a left-over from a previous test. New patch coming.

		Adrian


More information about the CRIU mailing list