2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2009
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
24 #ifndef __LXC_COMMANDS_H
25 #define __LXC_COMMANDS_H
28 #include <sys/types.h>
31 #include "lxccontainer.h"
37 LXC_CMD_TERMINAL_WINCH
,
41 LXC_CMD_GET_CLONE_FLAGS
,
43 LXC_CMD_GET_CONFIG_ITEM
,
46 LXC_CMD_ADD_STATE_CLIENT
,
48 LXC_CMD_SERVE_STATE_CLIENTS
,
49 LXC_CMD_SECCOMP_NOTIFY_ADD_LISTENER
,
60 int ret
; /* 0 on success, -errno on failure */
66 struct lxc_cmd_req req
;
67 struct lxc_cmd_rsp rsp
;
70 struct lxc_cmd_console_rsp_data
{
75 struct lxc_cmd_console_log
{
83 extern int lxc_cmd_terminal_winch(const char *name
, const char *lxcpath
);
84 extern int lxc_cmd_console(const char *name
, int *ttynum
, int *fd
,
87 * Get the 'real' cgroup path (as seen in /proc/self/cgroup) for a container
88 * for a particular subsystem
90 extern char *lxc_cmd_get_cgroup_path(const char *name
, const char *lxcpath
,
91 const char *subsystem
);
92 extern int lxc_cmd_get_clone_flags(const char *name
, const char *lxcpath
);
93 extern char *lxc_cmd_get_config_item(const char *name
, const char *item
, const char *lxcpath
);
94 extern char *lxc_cmd_get_name(const char *hashed_sock
);
95 extern char *lxc_cmd_get_lxcpath(const char *hashed_sock
);
96 extern pid_t
lxc_cmd_get_init_pid(const char *name
, const char *lxcpath
);
97 extern int lxc_cmd_get_state(const char *name
, const char *lxcpath
);
98 extern int lxc_cmd_stop(const char *name
, const char *lxcpath
);
100 /* lxc_cmd_add_state_client Register a new state client fd in the container's
103 * @param[in] name Name of container to connect to.
104 * @param[in] lxcpath The lxcpath in which the container is running.
105 * @param[in] states The states to wait for.
106 * @param[out] state_client_fd The state client fd from which the state can be
108 * @return Return < 0 on error
109 * == MAX_STATE when state needs to retrieved
111 * < MAX_STATE current container state
113 extern int lxc_cmd_add_state_client(const char *name
, const char *lxcpath
,
114 lxc_state_t states
[MAX_STATE
],
115 int *state_client_fd
);
116 extern int lxc_cmd_serve_state_clients(const char *name
, const char *lxcpath
,
119 struct lxc_epoll_descr
;
122 extern int lxc_cmd_init(const char *name
, const char *lxcpath
, const char *suffix
);
123 extern int lxc_cmd_mainloop_add(const char *name
, struct lxc_epoll_descr
*descr
,
124 struct lxc_handler
*handler
);
125 extern int lxc_try_cmd(const char *name
, const char *lxcpath
);
126 extern int lxc_cmd_console_log(const char *name
, const char *lxcpath
,
127 struct lxc_console_log
*log
);
128 extern int lxc_cmd_seccomp_notify_add_listener(const char *name
,
131 /* unused */ unsigned int command
,
132 /* unused */ unsigned int flags
);
134 #endif /* __commands_h */