Commit ea720ff1 by Aleksandr Mezin

sync: add LXC_SYNC_ERROR to report errors from another process.

parent 28711463
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include "sync.h"
#include "log.h" #include "log.h"
#include "start.h" #include "start.h"
...@@ -46,6 +47,12 @@ static int __sync_wait(int fd, int sequence) ...@@ -46,6 +47,12 @@ static int __sync_wait(int fd, int sequence)
if (!ret) if (!ret)
return 0; return 0;
if (sync == LXC_SYNC_ERROR) {
ERROR("An error occurred in another process "
"(expected sequence number %d)", sequence);
return -1;
}
if (sync != sequence) { if (sync != sequence) {
ERROR("invalid sequence number %d. expected %d", ERROR("invalid sequence number %d. expected %d",
sync, sequence); sync, sequence);
......
...@@ -32,6 +32,7 @@ enum { ...@@ -32,6 +32,7 @@ enum {
LXC_SYNC_POST_CGROUP, LXC_SYNC_POST_CGROUP,
LXC_SYNC_RESTART, LXC_SYNC_RESTART,
LXC_SYNC_POST_RESTART, LXC_SYNC_POST_RESTART,
LXC_SYNC_ERROR = -1 /* Used to report errors from another process */
}; };
int lxc_sync_init(struct lxc_handler *handler); int lxc_sync_init(struct lxc_handler *handler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment