]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/commands.h
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
29 #define LXC_CMD_DATA_MAX (MAXPATHLEN*2)
31 /* https://developer.gnome.org/glib/2.28/glib-Type-Conversion-Macros.html */
32 #define INT_TO_PTR(n) ((void *) (long) (n))
33 #define PTR_TO_INT(p) ((int) (long) (p))
37 LXC_CMD_CONSOLE_WINCH
,
41 LXC_CMD_GET_CLONE_FLAGS
,
43 LXC_CMD_GET_CONFIG_ITEM
,
56 int ret
; /* 0 on success, -errno on failure */
62 struct lxc_cmd_req req
;
63 struct lxc_cmd_rsp rsp
;
66 struct lxc_cmd_console_rsp_data
{
71 extern int lxc_cmd_console_winch(const char *name
, const char *lxcpath
);
72 extern int lxc_cmd_console(const char *name
, int *ttynum
, int *fd
,
75 * Get the 'real' cgroup path (as seen in /proc/self/cgroup) for a container
76 * for a particular subsystem
78 extern char *lxc_cmd_get_cgroup_path(const char *name
, const char *lxcpath
,
79 const char *subsystem
);
80 extern int lxc_cmd_get_clone_flags(const char *name
, const char *lxcpath
);
81 extern char *lxc_cmd_get_config_item(const char *name
, const char *item
, const char *lxcpath
);
82 extern char *lxc_cmd_get_name(const char *hashed_sock
);
83 extern char *lxc_cmd_get_lxcpath(const char *hashed_sock
);
84 extern pid_t
lxc_cmd_get_init_pid(const char *name
, const char *lxcpath
);
85 extern lxc_state_t
lxc_cmd_get_state(const char *name
, const char *lxcpath
);
86 extern int lxc_cmd_stop(const char *name
, const char *lxcpath
);
88 struct lxc_epoll_descr
;
91 extern int lxc_cmd_init(const char *name
, struct lxc_handler
*handler
,
93 extern int lxc_cmd_mainloop_add(const char *name
, struct lxc_epoll_descr
*descr
,
94 struct lxc_handler
*handler
);
95 extern int lxc_try_cmd(const char *name
, const char *lxcpath
);
97 #endif /* __commands_h */