]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/commands.h
Fix race/corruption with multiple lxc-start, lxc-execute
[mirror_lxc.git] / src / lxc / commands.h
CommitLineData
96fa1ff0
MN
1/*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2009
5 *
6 * Authors:
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
8 *
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.
13 *
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.
18 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef __commands_h
24#define __commands_h
25
26enum {
27 LXC_COMMAND_TTY,
2137dc99 28 LXC_COMMAND_STOP,
e98fe68b 29 LXC_COMMAND_STATE,
81c75799 30 LXC_COMMAND_PID,
d5088cf2 31 LXC_COMMAND_CLONE_FLAGS,
96fa1ff0
MN
32 LXC_COMMAND_MAX,
33};
34
35struct lxc_request {
36 int type;
37 int data;
38};
39
40struct lxc_answer {
41 int fd;
42 int ret; /* 0 on success, -errno on failure */
81c75799 43 pid_t pid;
96fa1ff0
MN
44};
45
46struct lxc_command {
47 struct lxc_request request;
48 struct lxc_answer answer;
49};
50
26b2d152 51extern pid_t get_init_pid(const char *name);
d5088cf2 52extern int lxc_get_clone_flags(const char *name);
43eb6f29 53
d97b36f8
DL
54extern int lxc_command(const char *name, struct lxc_command *command,
55 int *stopped);
724e753c 56
43eb6f29
DL
57extern int lxc_command_connected(const char *name, struct lxc_command *command,
58 int *stopped);
59
724e753c
MN
60struct lxc_epoll_descr;
61struct lxc_handler;
62
d2e30e99 63extern int lxc_command_init(const char *name, struct lxc_handler *handler);
724e753c
MN
64extern int lxc_command_mainloop_add(const char *name, struct lxc_epoll_descr *descr,
65 struct lxc_handler *handler);
66
96fa1ff0 67#endif