This enables `LXC` to make complete use of the unified cgroup hierarchy. With
this extension it is possible to run `LXC` containers on systems that use
a pure unified cgroup layout.
+
+# init\_pidfd
+
+This adds a new API function `init_pidfd()` which allows to retrieve a pidfd for the container's init process allowing process management interactions such as sending signal to be completely reliable and rac-e free.
WRAP_API(pid_t, lxcapi_init_pid)
+static int do_lxcapi_init_pidfd(struct lxc_container *c)
+{
+ if (!c)
+ return ret_errno(EBADF);
+
+ return lxc_cmd_get_init_pidfd(c->name, c->config_path);
+}
+
+WRAP_API(int, lxcapi_init_pidfd)
+
static bool load_config_locked(struct lxc_container *c, const char *fname)
{
if (!c->lxc_conf)
c->console = lxcapi_console;
c->console_getfd = lxcapi_console_getfd;
c->init_pid = lxcapi_init_pid;
+ c->init_pidfd = lxcapi_init_pidfd;
c->load_config = lxcapi_load_config;
c->want_daemonize = lxcapi_want_daemonize;
c->want_close_all_fds = lxcapi_want_close_all_fds;
* \return file descriptor for container's seccomp filter
*/
int (*seccomp_notify_fd)(struct lxc_container *c);
+
+ /*!
+ * \brief Retrieve a pidfd for the container's init process.
+ *
+ * \param c Container.
+ *
+ * \return pidfd of init process of the container.
+ */
+ int (*init_pidfd)(struct lxc_container *c);
};
/*!