# Check for optional headers
AC_CHECK_HEADERS([sys/signalfd.h])
+AC_CHECK_FUNCS([getline],
+ AM_CONDITIONAL(HAVE_GETLINE, true)
+ AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
+ AM_CONDITIONAL(HAVE_GETLINE, false))
+AC_CHECK_FUNCS([fgetln],
+ AM_CONDITIONAL(HAVE_FGETLN, true)
+ AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
+ AM_CONDITIONAL(HAVE_FGETLN, false))
+
# Check for some standard binaries
AC_PROG_GCC_TRADITIONAL
AC_PROG_SED
--- /dev/null
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * Emulate glibc getline() via BSD fgetln().
+ * Note that outsize is not changed unless memory is allocated.
+ */
+ssize_t
+getline(char **outbuf, size_t *outsize, FILE *fp)
+{
+ size_t len;
+ char *buf;
+ buf = fgetln(fp, &len);
+
+ if (buf == NULL)
+ return (-1);
+
+ /* Assumes realloc() accepts NULL for ptr (C99) */
+ if (*outbuf == NULL || *outsize < len + 1) {
+ void *tmp = realloc(*outbuf, len + 1);
+ if (tmp == NULL)
+ return (-1);
+ *outbuf = tmp;
+ *outsize = len + 1;
+ }
+ memcpy(*outbuf, buf, len);
+ (*outbuf)[len] = '\0';
+ return (len);
+}
--- /dev/null
+#ifndef _getline_h
+#define _getline_h
+
+extern ssize_t getline(char **outbuf, size_t *outsize, FILE *fp);
+
+#endif
lxccontainer.h \
lxclock.h
+if !HAVE_GETLINE
+if HAVE_FGETLN
+pkginclude_HEADERS += ../include/getline.h
+endif
+endif
+
sodir=$(libdir)
# use PROGRAMS to avoid complains from automake
so_PROGRAMS = liblxc.so
lxclock.h lxclock.c \
lxccontainer.c lxccontainer.h
+if !HAVE_GETLINE
+if HAVE_FGETLN
+liblxc_so_SOURCES += ../include/getline.c ../include/getline.h
+endif
+endif
+
AM_CFLAGS=-I$(top_srcdir)/src \
-DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \
-DLXCPATH=\"$(LXCPATH)\" \
#include <sys/param.h>
#include <sys/prctl.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
#include <linux/unistd.h>
#if !HAVE_DECL_PR_CAPBSET_DROP
#endif
}
+/* Define getline() if missing from the C library */
+#ifndef HAVE_GETLINE
+#ifdef HAVE_FGETLN
+#include <../include/getline.h>
+#endif
+#endif
+
struct lxc_proc_context_info *lxc_proc_get_context_info(pid_t pid)
{
struct lxc_proc_context_info *info = calloc(1, sizeof(*info));
#include <dirent.h>
#include "parse.h"
+#include "config.h"
#include <lxc/log.h>
+/* Define getline() if missing from the C library */
+#ifndef HAVE_GETLINE
+#ifdef HAVE_FGETLN
+#include <../include/getline.h>
+#endif
+#endif
+
lxc_log_define(lxc_parse, lxc);
static int dir_filter(const struct dirent *dirent)