]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
sync: add LXC_SYNC_ERROR to report errors from another process.
authorAleksandr Mezin <mezin.alexander@gmail.com>
Thu, 24 Mar 2016 11:54:26 +0000 (17:54 +0600)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 17 Nov 2016 23:00:10 +0000 (18:00 -0500)
Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
src/lxc/sync.c
src/lxc/sync.h

index 52e02aeed08e45b203346add0f0528ed125d4589..f06d302f7edbaa2696c6a36b96576038383470b7 100644 (file)
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include <fcntl.h>
 
+#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);
index 930fcb3ea031725745362beb5ea8fdcdc921b7dc..d0aee6fe97ee37be718aad5290ab05481200fe81 100644 (file)
@@ -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);