[lxc-devel] [PATCH 14/24] Make utmpx.h optional
Serge Hallyn
serge.hallyn at canonical.com
Tue Jan 8 18:21:19 UTC 2013
Quoting Stéphane Graber (stgraber at ubuntu.com):
> This adds code detecting the presence of utmpx.h and in its absence, turns the
> utmp related functions into no-ops.
>
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> configure.ac | 2 +-
> src/lxc/utmp.c | 9 +++++++++
> src/lxc/utmp.h | 9 +++++++++
> 3 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index bc2ddc4..0d50bec 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -221,7 +221,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
> AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
>
> # Check for some headers
> -AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h])
> +AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h])
>
> # Check for some syscalls functions
> AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
> diff --git a/src/lxc/utmp.c b/src/lxc/utmp.c
> index a7b9b52..f32ed63 100644
> --- a/src/lxc/utmp.c
> +++ b/src/lxc/utmp.c
> @@ -21,6 +21,10 @@
> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
>
> +#include "config.h"
> +
> +#ifdef HAVE_UTMPX_H
> +
> #include <stdio.h>
> #include <unistd.h>
> #include <errno.h>
> @@ -37,7 +41,10 @@
> #include "mainloop.h"
> #include "lxc.h"
> #include "log.h"
> +
> +#ifndef __USE_GNU
> #define __USE_GNU
> +#endif
> #include <utmpx.h>
> #undef __USE_GNU
>
> @@ -410,3 +417,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr,
> else
> return 0;
> }
> +
> +#endif
> diff --git a/src/lxc/utmp.h b/src/lxc/utmp.h
> index ac3eee4..1bd7c23 100644
> --- a/src/lxc/utmp.h
> +++ b/src/lxc/utmp.h
> @@ -21,8 +21,17 @@
> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
>
> +#include "config.h"
> +
> struct lxc_handler;
> struct lxc_epoll_descr;
>
> +#ifdef HAVE_UTMPX_H
> int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
> struct lxc_handler *handler);
> +#else
> +static inline int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
> + struct lxc_handler *handler) {
> + return -1;
> +}
> +#endif
> --
> 1.8.0
>
>
> ------------------------------------------------------------------------------
> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
> and more. Get SQL Server skills now (including 2012) with LearnDevNow -
> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only - learn more at:
> http://p.sf.net/sfu/learnmore_122512
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
More information about the lxc-devel
mailing list