]>
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>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <sys/param.h>
28 #include <sys/socket.h>
35 #include "namespace.h"
44 struct lxc_conf
*conf
;
45 struct lxc_operations
*ops
;
51 int ttysock
[2]; // socketpair for child->parent tty fd passing
52 bool backgrounded
; // indicates whether should we close std{in,out,err} on start
55 /* The socketpair() fds used to wait on successful daemonized
58 int state_socket_pair
[2];
59 struct lxc_list state_clients
;
62 struct lxc_operations
{
63 int (*start
)(struct lxc_handler
*, void *);
64 int (*post_start
)(struct lxc_handler
*, void *);
69 lxc_state_t states
[MAX_STATE
];
72 extern int lxc_poll(const char *name
, struct lxc_handler
*handler
);
73 extern int lxc_set_state(const char *name
, struct lxc_handler
*handler
, lxc_state_t state
);
74 extern void lxc_abort(const char *name
, struct lxc_handler
*handler
);
75 extern struct lxc_handler
*lxc_init_handler(const char *name
,
76 struct lxc_conf
*conf
,
79 extern void lxc_free_handler(struct lxc_handler
*handler
);
80 extern int lxc_init(const char *name
, struct lxc_handler
*handler
);
81 extern void lxc_fini(const char *name
, struct lxc_handler
*handler
);
83 /* lxc_check_inherited: Check for any open file descriptors and close them if
85 * @param[in] conf The container's configuration.
86 * @param[in] closeall Whether we should close all open file descriptors.
87 * @param[in] fds_to_ignore Array of file descriptors to ignore.
88 * @param[in] len_fds Length of fds_to_ignore array.
90 extern int lxc_check_inherited(struct lxc_conf
*conf
, bool closeall
,
91 int *fds_to_ignore
, size_t len_fds
);
92 int __lxc_start(const char *, struct lxc_handler
*, struct lxc_operations
*,
93 void *, const char *, bool);
95 extern void resolve_clone_flags(struct lxc_handler
*handler
);