monitor.c revision 2366b8a769b9403fda3c4780c84ad87d07b21d7e
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * lxc: linux Container library
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * (C) Copyright IBM Corp. 2007, 2008
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * Daniel Lezcano <daniel.lezcano at free.fr>
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * Dwight Engen <dwight.engen@oracle.com>
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * This library is free software; you can redistribute it and/or
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * modify it under the terms of the GNU Lesser General Public
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * License as published by the Free Software Foundation; either
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * version 2.1 of the License, or (at your option) any later version.
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * This library is distributed in the hope that it will be useful,
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * but WITHOUT ANY WARRANTY; without even the implied warranty of
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * Lesser General Public License for more details.
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * You should have received a copy of the GNU Lesser General Public
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * License along with this library; if not, write to the Free Software
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <stddef.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <poll.h>
#include "error.h"
#include "af_unix.h"
#include "log.h"
#include "lxclock.h"
#include "state.h"
#include "monitor.h"
#include "utils.h"
int do_mkdirp)
int ret;
char *rundir;
if (!rundir)
if (do_mkdirp) {
if (ret < 0) {
return ret;
if (ret < 0)
if (fd < 0) {
int ret;
char *path;
/* addr.sun_path is only 108 bytes, so we hash the full name and
if (ret < 0)
if (fd < 0) {
goto err1;
if (ret < 0) {
goto err1;
return fd;
err1:
return ret;
int timeout)
int ret;
else if (ret == 0)
for (i = 0; i < nfds; i++) {
if (ret <= 0) {
return ret;
char * const args[] = {
(char *)lxcpath,
NULL,
if (pid1 < 0) {
if (pid1) {
if (pid2 < 0) {
if (pid2) {
if (setsid() < 0) {
close(0);