0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * lxc: linux Container library
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * (C) Copyright IBM Corp. 2007, 2008
9afe19d634946d50eab30e3b90cb5cebcde39eeaDaniel Lezcano * Daniel Lezcano <daniel.lezcano at free.fr>
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * This library is free software; you can redistribute it and/or
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * modify it under the terms of the GNU Lesser General Public
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * License as published by the Free Software Foundation; either
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * version 2.1 of the License, or (at your option) any later version.
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * This library is distributed in the hope that it will be useful,
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * but WITHOUT ANY WARRANTY; without even the implied warranty of
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * Lesser General Public License for more details.
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * You should have received a copy of the GNU Lesser General Public
0ad19a3fc3de5592e2453070a818a5a41687900edlezcano * License along with this library; if not, write to the Free Software
250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77Stéphane Graber * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
eae6543da163348b9ff13fc65119de55b5af62bfdlezcanotypedef enum {
e51d4895129209cec1c15bda2322136a03ec94b2Dwight Engenextern int lxc_monitor_sock_name(const char *lxcpath, struct sockaddr_un *addr);
9e60f51d0d1d295bdd77f2fa848f3046e04e6804Dwight Engenextern int lxc_monitor_fifo_name(const char *lxcpath, char *fifo_path,
e51d4895129209cec1c15bda2322136a03ec94b2Dwight Engenextern void lxc_monitor_send_state(const char *name, lxc_state_t state,
9123e4718d0db98de2a2935cb2d0bcca1997a333Serge Hallyn const char *lxcpath);
1787abcae0f52847ab9eb93e26fccded668a93b3Jean-Tiare LE BIGOTextern void lxc_monitor_send_exit_code(const char *name, int exit_code,
e51d4895129209cec1c15bda2322136a03ec94b2Dwight Engenextern int lxc_monitord_spawn(const char *lxcpath);
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Open the monitoring mechanism for a specific container
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * The function will return an fd corresponding to the events
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Returns a file descriptor on success, < 0 otherwise
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallynextern int lxc_monitor_open(const char *lxcpath);
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Blocking read for the next container state change
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @fd : the file descriptor provided by lxc_monitor_open
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @msg : the variable which will be filled with the state
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Returns 0 if the monitored container has exited, > 0 if
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * data was read, < 0 otherwise
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallynextern int lxc_monitor_read(int fd, struct lxc_msg *msg);
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Blocking read for the next container state change with timeout
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @fd : the file descriptor provided by lxc_monitor_open
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @msg : the variable which will be filled with the state
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @timeout : the timeout in seconds to wait for a state change
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Returns 0 if the monitored container has exited, > 0 if
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * data was read, < 0 otherwise
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallynextern int lxc_monitor_read_timeout(int fd, struct lxc_msg *msg, int timeout);
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Blocking read from multiple monitors for the next container state
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * change with timeout
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @fds : struct pollfd descripting the fds to use
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @nfds : the number of entries in fds
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @msg : the variable which will be filled with the state
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * @timeout : the timeout in seconds to wait for a state change
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * Returns 0 if the monitored container has exited, > 0 if
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallyn * data was read, < 0 otherwise
2366b8a769b9403fda3c4780c84ad87d07b21d7eSerge Hallynextern int lxc_monitor_read_fdset(struct pollfd *fds, nfds_t nfds, struct lxc_msg *msg,