2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 22:35:33 +00:00

log: Set log level in parasite

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-10-08 19:56:12 +04:00
parent 3ef0d9735b
commit e2912397b5
3 changed files with 13 additions and 5 deletions

View File

@@ -19,7 +19,7 @@
enum {
PARASITE_CMD_INIT,
PARASITE_CMD_SET_LOGFD,
PARASITE_CMD_CFG_LOG,
PARASITE_CMD_FINI,
PARASITE_CMD_DUMPPAGES_INIT,
@@ -44,6 +44,10 @@ struct parasite_init_args {
struct sockaddr_un p_addr;
};
struct parasite_log_args {
int log_level;
};
struct parasite_dump_pages_args {
VmaEntry vma_entry;
unsigned long nrpages_dumped; /* how many pages are dumped */

View File

@@ -360,12 +360,15 @@ static int parasite_prep_file(int fd, struct parasite_ctl *ctl)
static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid)
{
int ret;
struct parasite_log_args a;
ret = parasite_send_fd(ctl, log_get_fd());
if (ret)
return ret;
ret = parasite_execute(PARASITE_CMD_SET_LOGFD, ctl, NULL, 0);
a.log_level = log_get_loglevel();
ret = parasite_execute(PARASITE_CMD_CFG_LOG, ctl, &a, sizeof(a));
if (ret < 0)
return ret;

View File

@@ -419,13 +419,14 @@ out_send_fd:
return ret;
}
static int parasite_set_logfd()
static int parasite_cfg_log(struct parasite_log_args *args)
{
int ret;
ret = recv_fd(tsock);
if (ret >= 0) {
log_set_fd(ret);
log_set_loglevel(args->log_level);
ret = 0;
}
@@ -459,8 +460,8 @@ int __used parasite_service(unsigned int cmd, void *args)
return init((struct parasite_init_args *) args);
case PARASITE_CMD_FINI:
return fini();
case PARASITE_CMD_SET_LOGFD:
return parasite_set_logfd();
case PARASITE_CMD_CFG_LOG:
return parasite_cfg_log((struct parasite_log_args *) args);
case PARASITE_CMD_DUMPPAGES_INIT:
return dump_pages_init();
case PARASITE_CMD_DUMPPAGES_FINI: