mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
protobuf: Convert sa_entry to PB format
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
b75d66e7df
commit
6b9d3affc9
17
cr-restore.c
17
cr-restore.c
@@ -49,6 +49,9 @@
|
||||
#include "inotify.h"
|
||||
#include "pstree.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/sa.pb-c.h"
|
||||
|
||||
static struct pstree_item *me;
|
||||
|
||||
static int restore_task_with_children(void *);
|
||||
@@ -194,7 +197,7 @@ static int prepare_sigactions(int pid)
|
||||
{
|
||||
rt_sigaction_t act, oact;
|
||||
int fd_sigact;
|
||||
struct sa_entry e;
|
||||
SaEntry *e;
|
||||
int sig;
|
||||
int ret = -1;
|
||||
|
||||
@@ -206,14 +209,16 @@ static int prepare_sigactions(int pid)
|
||||
if (sig == SIGKILL || sig == SIGSTOP)
|
||||
continue;
|
||||
|
||||
ret = read_img(fd_sigact, &e);
|
||||
ret = pb_read(fd_sigact, &e, sa_entry);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
||||
ASSIGN_TYPED(act.rt_sa_handler, e.sigaction);
|
||||
ASSIGN_TYPED(act.rt_sa_flags, e.flags);
|
||||
ASSIGN_TYPED(act.rt_sa_restorer, e.restorer);
|
||||
ASSIGN_TYPED(act.rt_sa_mask.sig[0], e.mask);
|
||||
ASSIGN_TYPED(act.rt_sa_handler, e->sigaction);
|
||||
ASSIGN_TYPED(act.rt_sa_flags, e->flags);
|
||||
ASSIGN_TYPED(act.rt_sa_restorer, e->restorer);
|
||||
ASSIGN_TYPED(act.rt_sa_mask.sig[0], e->mask);
|
||||
|
||||
sa_entry__free_unpacked(e, NULL);
|
||||
|
||||
if (sig == SIGCHLD) {
|
||||
sigchld_act = act;
|
||||
|
14
cr-show.c
14
cr-show.c
@@ -35,6 +35,7 @@
|
||||
#include "protobuf/pstree.pb-c.h"
|
||||
#include "protobuf/pipe.pb-c.h"
|
||||
#include "protobuf/pipe-data.pb-c.h"
|
||||
#include "protobuf/sa.pb-c.h"
|
||||
|
||||
#define DEF_PAGES_PER_LINE 6
|
||||
|
||||
@@ -359,22 +360,23 @@ out:
|
||||
|
||||
void show_sigacts(int fd_sigacts, struct cr_options *o)
|
||||
{
|
||||
struct sa_entry e;
|
||||
SaEntry *e;
|
||||
|
||||
pr_img_head(CR_FD_SIGACT);
|
||||
|
||||
while (1) {
|
||||
int ret;
|
||||
|
||||
ret = read_img_eof(fd_sigacts, &e);
|
||||
ret = pb_read_eof(fd_sigacts, &e, sa_entry);
|
||||
if (ret <= 0)
|
||||
goto out;
|
||||
pr_msg("sigaction: 0x%016lx mask: 0x%08lx "
|
||||
"flags: 0x%016lx restorer: 0x%016lx\n",
|
||||
(long)e.sigaction,
|
||||
(long)e.mask,
|
||||
(long)e.flags,
|
||||
(long)e.restorer);
|
||||
(long)e->sigaction,
|
||||
(long)e->mask,
|
||||
(long)e->flags,
|
||||
(long)e->restorer);
|
||||
sa_entry__free_unpacked(e, NULL);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@@ -201,13 +201,6 @@ struct page_entry {
|
||||
u8 data[PAGE_IMAGE_SIZE];
|
||||
} __packed;
|
||||
|
||||
struct sa_entry {
|
||||
u64 sigaction;
|
||||
u64 flags;
|
||||
u64 restorer;
|
||||
u64 mask;
|
||||
} __packed;
|
||||
|
||||
struct itimer_entry {
|
||||
u64 isec;
|
||||
u64 iusec;
|
||||
|
@@ -12,6 +12,9 @@
|
||||
#include "parasite.h"
|
||||
#include "crtools.h"
|
||||
|
||||
#include "protobuf.h"
|
||||
#include "protobuf/sa.pb-c.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -431,7 +434,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
|
||||
{
|
||||
struct parasite_dump_sa_args args;
|
||||
int ret, i, fd;
|
||||
struct sa_entry se;
|
||||
SaEntry se = SA_ENTRY__INIT;
|
||||
|
||||
ret = parasite_execute(PARASITE_CMD_DUMP_SIGACTS, ctl, &args, sizeof(args));
|
||||
if (ret < 0)
|
||||
@@ -448,7 +451,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
|
||||
ASSIGN_TYPED(se.restorer, args.sas[i].rt_sa_restorer);
|
||||
ASSIGN_TYPED(se.mask, args.sas[i].rt_sa_mask.sig[0]);
|
||||
|
||||
if (write_img(fd, &se) < 0)
|
||||
if (pb_write(fd, &se, sa_entry) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,7 @@ PROTO_FILES += tcp-stream.proto
|
||||
PROTO_FILES += sk-packet.proto
|
||||
PROTO_FILES += mnt.proto
|
||||
PROTO_FILES += pipe-data.proto
|
||||
PROTO_FILES += sa.proto
|
||||
|
||||
HDRS := $(patsubst %.proto,%.pb-c.h,$(PROTO_FILES))
|
||||
SRCS := $(patsubst %.proto,%.pb-c.c,$(PROTO_FILES))
|
||||
|
6
protobuf/sa.proto
Normal file
6
protobuf/sa.proto
Normal file
@@ -0,0 +1,6 @@
|
||||
message sa_entry {
|
||||
required uint64 sigaction = 1;
|
||||
required uint64 flags = 2;
|
||||
required uint64 restorer = 3;
|
||||
required uint64 mask = 4;
|
||||
}
|
Reference in New Issue
Block a user