]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/start.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 * Serge Hallyn <serge@hallyn.com>
9 * Christian Brauner <christian.brauner@ubuntu.com>
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <sys/param.h>
31 #include <sys/socket.h>
36 #include "namespace.h"
40 /* The clone flags that were requested. */
43 /* File descriptor to pin the rootfs for privileged containers. */
46 /* Signal file descriptor. */
49 /* List of file descriptors referring to the namespaces of the
50 * container. Note that these are not necessarily identical to
51 * the "clone_flags" handler field in case namespace inheritance is
56 /* Abstract unix domain SOCK_DGRAM socketpair to pass arbitrary data
57 * between child and parent.
61 /* The socketpair() fds used to wait on successful daemonized startup. */
62 int state_socket_pair
[2];
64 /* Socketpair to synchronize processes during container creation. */
67 /* Pointer to the name of the container. Do not free! */
70 /* Pointer to the path the container. Do not free! */
73 /* Whether the container's startup process euid is 0. */
76 /* Indicates whether should we close std{in,out,err} on start. */
79 /* The child's pid. */
82 /* The signal mask prior to setting up the signal file descriptor. */
85 /* The container's in-memory configuration. */
86 struct lxc_conf
*conf
;
88 /* A set of operations to be performed at various stages of the
91 struct lxc_operations
*ops
;
93 /* This holds the cgroup information. Note that the data here is
94 * specific to the cgroup driver used.
98 /* Data to be passed to handler ops. */
101 /* Current state of the container. */
105 struct lxc_operations
{
106 int (*start
)(struct lxc_handler
*, void *);
107 int (*post_start
)(struct lxc_handler
*, void *);
110 extern int lxc_poll(const char *name
, struct lxc_handler
*handler
);
111 extern int lxc_set_state(const char *name
, struct lxc_handler
*handler
, lxc_state_t state
);
112 extern void lxc_abort(const char *name
, struct lxc_handler
*handler
);
113 extern struct lxc_handler
*lxc_init_handler(const char *name
,
114 struct lxc_conf
*conf
,
117 extern void lxc_free_handler(struct lxc_handler
*handler
);
118 extern int lxc_init(const char *name
, struct lxc_handler
*handler
);
119 extern void lxc_fini(const char *name
, struct lxc_handler
*handler
);
121 /* lxc_check_inherited: Check for any open file descriptors and close them if
123 * @param[in] conf The container's configuration.
124 * @param[in] closeall Whether we should close all open file descriptors.
125 * @param[in] fds_to_ignore Array of file descriptors to ignore.
126 * @param[in] len_fds Length of fds_to_ignore array.
128 extern int lxc_check_inherited(struct lxc_conf
*conf
, bool closeall
,
129 int *fds_to_ignore
, size_t len_fds
);
130 extern int __lxc_start(const char *, struct lxc_handler
*,
131 struct lxc_operations
*, void *, const char *, bool);
133 extern void resolve_clone_flags(struct lxc_handler
*handler
);