Skip to content

Commit

Permalink
Allow unprivileged flag to be set via libcriu
Browse files Browse the repository at this point in the history
Signed-off-by: Younes Manton <[email protected]>
  • Loading branch information
ymanton committed Oct 19, 2021
1 parent c41dd0f commit 9c23ce1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions criu/cr-service.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (req->has_shell_job)
opts.shell_job = req->shell_job;

if (req->has_unprivileged)
opts.unprivileged = req->unprivileged;

if (req->has_file_locks)
opts.handle_file_locks = req->file_locks;

Expand Down
1 change: 1 addition & 0 deletions images/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ message criu_opts {
optional bool tls_no_cn_verify = 59;
optional string cgroup_yard = 60;
optional criu_pre_dump_mode pre_dump_mode = 61 [default = SPLICE];
optional bool unprivileged = 62;
/* optional bool check_mounts = 128; */
}

Expand Down
11 changes: 11 additions & 0 deletions lib/c/criu.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,17 @@ void criu_set_shell_job(bool shell_job)
criu_local_set_shell_job(global_opts, shell_job);
}

void criu_local_set_unprivileged(criu_opts *opts, bool unprivileged)
{
opts->rpc->has_unprivileged = true;
opts->rpc->unprivileged = unprivileged;
}

void criu_set_unprivileged(bool unprivileged)
{
criu_local_set_unprivileged(global_opts, unprivileged);
}

void criu_local_set_orphan_pts_master(criu_opts *opts, bool orphan_pts_master)
{
opts->rpc->has_orphan_pts_master = true;
Expand Down
1 change: 1 addition & 0 deletions lib/c/criu.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void criu_set_tcp_close(bool tcp_close);
void criu_set_weak_sysctls(bool val);
void criu_set_evasive_devices(bool evasive_devices);
void criu_set_shell_job(bool shell_job);
void criu_set_unprivileged(bool unprivileged);
void criu_set_orphan_pts_master(bool orphan_pts_master);
void criu_set_file_locks(bool file_locks);
void criu_set_track_mem(bool track_mem);
Expand Down

0 comments on commit 9c23ce1

Please sign in to comment.