]>
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
, size_t pathlen
,
31 const char *hashed_sock_name
,
34 /* lxc_cmd_sock_get_state Register a new state client fd in the container's
35 * in-memory handler and retrieve the requested
38 * @param[in] name Name of container to connect to.
39 * @param[in] lxcpath The lxcpath in which the container is running.
40 * @param[in] states The states to wait for.
41 * @return Return < 0 on error
42 * < MAX_STATE current container state
44 extern int lxc_cmd_sock_get_state(const char *name
, const char *lxcpath
,
45 lxc_state_t states
[MAX_STATE
], int timeout
);
47 /* lxc_cmd_sock_rcv_state Retrieve the requested state from a state client
48 * fd registerd in the container's in-memory
51 * @param[int] state_client_fd The state client fd from which the state can be
53 * @return Return < 0 on error
54 * < MAX_STATE current container state
56 extern int lxc_cmd_sock_rcv_state(int state_client_fd
, int timeout
);
58 /* lxc_add_state_client Add a new state client to the container's
61 * @param[int] state_client_fd The state client fd to add.
62 * @param[int] handler The container's in-memory handler.
63 * @param[in] states The states to wait for.
65 * @return Return < 0 on error
68 extern int lxc_add_state_client(int state_client_fd
,
69 struct lxc_handler
*handler
,
70 lxc_state_t states
[MAX_STATE
]);
72 /* lxc_cmd_connect Connect to the container's command socket.
74 * @param[in] name Name of container to connect to.
75 * @param[in] lxcpath The lxcpath in which the container is running.
76 * @param[in] hashed_sock_name The hashed name of the socket (optional). Can be
79 * @return Return < 0 on error
82 extern int lxc_cmd_connect(const char *name
, const char *lxcpath
,
83 const char *hashed_sock_name
, const char *suffix
);
85 #endif /* __LXC_COMMANDS_UTILS_H */