]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/commands_utils.h
3 * Copyright © 2017 Christian Brauner <christian.brauner@ubuntu.com>.
4 * Copyright © 2017 Canonical Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef __LXC_COMMANDS_UTILS_H
21 #define __LXC_COMMANDS_UTILS_H
28 int lxc_make_abstract_socket_name(char *path
, int len
, const char *lxcname
,
30 const char *hashed_sock_name
,
33 /* lxc_cmd_sock_get_state Register a new state client fd in the container's
34 * in-memory handler and retrieve the requested
37 * @param[in] name Name of container to connect to.
38 * @param[in] lxcpath The lxcpath in which the container is running.
39 * @param[in] states The states to wait for.
40 * @return Return < 0 on error
41 * < MAX_STATE current container state
43 extern int lxc_cmd_sock_get_state(const char *name
, const char *lxcpath
,
44 lxc_state_t states
[MAX_STATE
], int timeout
);
46 /* lxc_cmd_sock_rcv_state Retrieve the requested state from a state client
47 * fd registerd in the container's in-memory
50 * @param[int] state_client_fd The state client fd from which the state can be
52 * @return Return < 0 on error
53 * < MAX_STATE current container state
55 extern int lxc_cmd_sock_rcv_state(int state_client_fd
, int timeout
);
57 /* lxc_add_state_client Add a new state client to the container's
60 * @param[int] state_client_fd The state client fd to add.
61 * @param[int] handler The container's in-memory handler.
62 * @param[in] states The states to wait for.
64 * @return Return < 0 on error
67 extern int lxc_add_state_client(int state_client_fd
,
68 struct lxc_handler
*handler
,
69 lxc_state_t states
[MAX_STATE
]);
71 /* lxc_cmd_connect Connect to the container's command socket.
73 * @param[in] name Name of container to connect to.
74 * @param[in] lxcpath The lxcpath in which the container is running.
75 * @param[in] hashed_sock_name The hashed name of the socket (optional). Can be
78 * @return Return < 0 on error
81 extern int lxc_cmd_connect(const char *name
, const char *lxcpath
,
82 const char *hashed_sock_name
, const char *suffix
);
84 #endif /* __LXC_COMMANDS_UTILS_H */