]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: move lxc-checkpoint to API symbols only
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 12 Jan 2018 13:02:10 +0000 (14:02 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 6 Feb 2018 20:03:33 +0000 (21:03 +0100)
Closes #2073.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_checkpoint.c
src/lxc/tools/tool_utils.c
src/lxc/tools/tool_utils.h

index 8f93934b3733e7b6167d83c0e5d3ce84d10955a5..f3f9e74150a03cce5e87c1a9055787f18046ef61 100644 (file)
@@ -1,5 +1,4 @@
 /*
- *
  * Copyright © 2014 Tycho Andersen <tycho.andersen@canonical.com>.
  * Copyright © 2014 Canonical Ltd.
  *
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <stdio.h>
+#define _GNU_SOURCE
 #include <errno.h>
+#include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
 #include <lxc/lxccontainer.h>
 
-#include "log.h"
-#include "config.h"
-#include "lxc.h"
 #include "arguments.h"
-#include "utils.h"
+#include "tool_utils.h"
 
 static char *checkpoint_dir = NULL;
 static bool stop = false;
@@ -253,8 +251,6 @@ int main(int argc, char *argv[])
        if (lxc_log_init(&log))
                exit(EXIT_FAILURE);
 
-       lxc_log_options_no_override();
-
        /* REMOVE IN LXC 3.0 */
        setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
 
index 39b38816154f5703d7be27d402c6ba122e441c6b..4b4dad0b444e01c59c3ee8c21518aebbc21251b0 100644 (file)
@@ -276,6 +276,24 @@ out:
 
 #endif
 
+int wait_for_pid(pid_t pid)
+{
+       int status, ret;
+
+again:
+       ret = waitpid(pid, &status, 0);
+       if (ret == -1) {
+               if (errno == EINTR)
+                       goto again;
+               return -1;
+       }
+       if (ret != pid)
+               goto again;
+       if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+               return -1;
+       return 0;
+}
+
 int lxc_wait_for_pid_status(pid_t pid)
 {
        int status, ret;
index 9f0e6a01fdad71cec106f5ca3a9c233eb2cea256..f900f037c39a2799a994466d746b6f35a076eed0 100644 (file)
@@ -123,6 +123,7 @@ static inline int lxc_caps_init(void) {
 }
 #endif
 
+extern int wait_for_pid(pid_t pid);
 extern int lxc_wait_for_pid_status(pid_t pid);
 extern int lxc_safe_int(const char *numstr, int *converted);
 extern int lxc_safe_long(const char *numstr, long int *converted);