From: Aleksandr Mezin Date: Thu, 24 Mar 2016 11:54:26 +0000 (+0600) Subject: sync: add LXC_SYNC_ERROR to report errors from another process. X-Git-Tag: lxc-2.0.0.rc14~8^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea720ff1d0bf82557888b400e8866227f7545cc1;p=thirdparty%2Flxc.git sync: add LXC_SYNC_ERROR to report errors from another process. Signed-off-by: Aleksandr Mezin --- diff --git a/src/lxc/sync.c b/src/lxc/sync.c index 52e02aeed..f06d302f7 100644 --- a/src/lxc/sync.c +++ b/src/lxc/sync.c @@ -27,6 +27,7 @@ #include #include +#include "sync.h" #include "log.h" #include "start.h" @@ -46,6 +47,12 @@ static int __sync_wait(int fd, int sequence) if (!ret) return 0; + if (sync == LXC_SYNC_ERROR) { + ERROR("An error occurred in another process " + "(expected sequence number %d)", sequence); + return -1; + } + if (sync != sequence) { ERROR("invalid sequence number %d. expected %d", sync, sequence); diff --git a/src/lxc/sync.h b/src/lxc/sync.h index 930fcb3ea..d0aee6fe9 100644 --- a/src/lxc/sync.h +++ b/src/lxc/sync.h @@ -32,6 +32,7 @@ enum { LXC_SYNC_POST_CGROUP, LXC_SYNC_RESTART, LXC_SYNC_POST_RESTART, + LXC_SYNC_ERROR = -1 /* Used to report errors from another process */ }; int lxc_sync_init(struct lxc_handler *handler);