]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/commands_utils.h
commands: mv lxc_make_abstract_socket_name()
[mirror_lxc.git] / src / lxc / commands_utils.h
CommitLineData
92e35018
CB
1/* liblxcapi
2 *
3 * Copyright © 2017 Christian Brauner <christian.brauner@ubuntu.com>.
4 * Copyright © 2017 Canonical Ltd.
5 *
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.
9 *
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.
14 *
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.
18 */
19
20#ifndef __LXC_COMMANDS_UTILS_H
21#define __LXC_COMMANDS_UTILS_H
22
23#include <stdio.h>
24
25#include "state.h"
26
bbf5cf35
CB
27int lxc_make_abstract_socket_name(char *path, int len, const char *lxcname,
28 const char *lxcpath,
29 const char *hashed_sock_name,
30 const char *suffix);
31
92e35018
CB
32/* lxc_cmd_sock_get_state Register a new state client fd in the container's
33 * in-memory handler and retrieve the requested
34 * states.
35 *
36 * @param[in] name Name of container to connect to.
37 * @param[in] lxcpath The lxcpath in which the container is running.
38 * @param[in] states The states to wait for.
39 * @return Return < 0 on error
40 * < MAX_STATE current container state
41 */
42extern int lxc_cmd_sock_get_state(const char *name, const char *lxcpath,
43 lxc_state_t states[MAX_STATE], int timeout);
44
45/* lxc_cmd_sock_rcv_state Retrieve the requested state from a state client
46 * fd registerd in the container's in-memory
47 * handler.
48 *
49 * @param[int] state_client_fd The state client fd from which the state can be
50 * received.
51 * @return Return < 0 on error
52 * < MAX_STATE current container state
53 */
54extern int lxc_cmd_sock_rcv_state(int state_client_fd, int timeout);
55
56#endif /* __LXC_COMMANDS_UTILS_H */