The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/421

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes: #420.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 1bdeec69b9a1c3b890019c09ce4016b665e3bb78 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Mon, 6 Jul 2020 11:05:14 +0200
Subject: [PATCH] bindings: provide lxcfs_clone() as wrapper around
 lxcfs_raw_clone()

Closes: #420.
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/bindings.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/bindings.h b/src/bindings.h
index 4ab4f72..e260902 100644
--- a/src/bindings.h
+++ b/src/bindings.h
@@ -104,6 +104,20 @@ static inline int install_signal_handler(int signo,
        return sigaction(signo, &action, NULL);
 }
 
-extern pid_t lxcfs_clone(int (*fn)(void *), void *arg, int flags);
+extern pid_t lxcfs_raw_clone(unsigned long flags, int *pidfd);
+
+static inline pid_t lxcfs_clone(int (*fn)(void *), void *arg, int flags)
+{
+       pid_t pid;
+
+       pid = lxcfs_raw_clone(flags, NULL);
+       if (pid < 0)
+               return -1;
+
+       if (pid == 0)
+               _exit(fn(arg));
+
+       return pid;
+}
 
 #endif /* __LXCFS_BINDINGS_H */
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to