From ee379181d3b6b89c23a660d027caa9c2d027aa7d Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 19 Dec 2014 00:28:04 +0100 Subject: Update systemd support from several GSD commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Msg: Backout change from using free() to g_free() in systemd patch Commit: f1f7bddf007c950608f5f8c5a771a7fb2ab187d5 From: Chris Kühl Msg: Require systemd 38 or greater when using --enable-systemd Commit: ff551c6974cfa0801a368ee5c2406ce941ac8cab From: Chris Kühl Msg: build: Disallow building with systemd v43 due to C++ incompatibility Commit: 8a17cd6ff6b0ab4979c6ed8426724ce355d23679 From: Chris Kühl Msg: Check for logind, not for systemd Commit: 4cf87daa48a8ab606afe5e3c2ac54c8f6276ba98 From: Martin Pitt --- configure.ac | 16 +++++++++++----- src/procdialogs.cpp | 6 +----- src/proctable.cpp | 5 ++--- src/util.h | 3 +++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 0edfd3b..411a977 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,9 @@ GIOMM_REQUIRED=2.26.0 GLIBMM_REQUIRED=2.22 LIBXML_REQUIRED=2.0 RSVG_REQUIRED=2.35 +SYSTEMD_REQUIRED=38 +# systemd v43 used the C++ keyword 'class' as a function parameter. This breaks the build for C++ programs. +SYSTEMD_EXCLUDED=43 AC_MSG_CHECKING([which gtk+ version to compile against]) AC_ARG_WITH([gtk], @@ -65,11 +68,14 @@ PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=" PKG_CHECK_MODULES(PROCMAN,$GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED libgtop-2.0 >= $LIBGTOP_REQUIRED libwnck-$LIBWNCK_API_VERSION >= $LIBWNCK_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED mate-icon-theme >= $MATE_ICON_THEME_REQUIRED gtkmm-$GTKMM_API_VERSION >= $GTKMM_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED librsvg-2.0 >= $RSVG_REQUIRED glibmm-2.4 >= $GLIBMM_REQUIRED giomm-2.4 >= $GIOMM_REQUIRED) have_systemd=no -AC_ARG_ENABLE(systemd, AS_HELP_STRING([--disable-systemd], [disable systemd support])) -if test "x$enable_systemd" != "xno"; then - PKG_CHECK_MODULES(SYSTEMD, [ libsystemd-daemon libsystemd-login ], - [AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is available]) have_systemd=yes], have_systemd=no) - if test "x$have_systemd" = xno -a "x$enable_systemd" = xyes; then +AC_ARG_ENABLE(systemd, AS_HELP_STRING([--disable-systemd], [disable systemd support]),,enable_systemd=no) + if test "x$enable_systemd" != "xno"; then + PKG_CHECK_MODULES(SYSTEMD, [ libsystemd-login >= $SYSTEMD_REQUIRED ], + [ PKG_CHECK_MODULES(SYSTEMD_EX, [ libsystemd-login = $SYSTEMD_EXCLUDED ], + AC_MSG_ERROR([*** systemd v43 found but it has a bug in its header files (uses C++ keyword)]), # Can't use systemd v43 + [AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is available]) have_systemd=yes])], + have_systemd=no) +if test "x$have_systemd" = xno; then AC_MSG_ERROR([*** systemd support requested but libraries not found]) fi fi diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp index 7d7aace..95b2527 100644 --- a/src/procdialogs.cpp +++ b/src/procdialogs.cpp @@ -25,10 +25,6 @@ #include #include -#ifdef HAVE_SYSTEMD -#include -#endif - #include "procdialogs.h" #include "proctable.h" #include "callbacks.h" @@ -479,7 +475,7 @@ create_field_page(GtkWidget *tree, const char* text) column_id == COL_SEAT || column_id == COL_OWNER) #ifdef HAVE_SYSTEMD - && sd_booted() <= 0 + && !LOGIND_RUNNING() #endif ) continue; diff --git a/src/proctable.cpp b/src/proctable.cpp index 25b1f36..20f0db5 100644 --- a/src/proctable.cpp +++ b/src/proctable.cpp @@ -45,7 +45,6 @@ #include #ifdef HAVE_SYSTEMD -#include #include #endif @@ -488,7 +487,7 @@ proctable_new (ProcData * const procdata) } #ifdef HAVE_SYSTEMD - if (sd_booted() <= 0) + if (!LOGIND_RUNNING()) #endif { GtkTreeViewColumn *column; @@ -756,7 +755,7 @@ get_process_systemd_info(ProcInfo *info) #ifdef HAVE_SYSTEMD uid_t uid; - if (sd_booted() <= 0) + if (!LOGIND_RUNNING()) return; free(info->unit); diff --git a/src/util.h b/src/util.h index 22a9a14..26aed19 100644 --- a/src/util.h +++ b/src/util.h @@ -28,6 +28,9 @@ inline int procman_cmp(T x, T y) #define PROCMAN_CMP(X, Y) procman_cmp((X), (Y)) #define PROCMAN_RCMP(X, Y) procman_cmp((Y), (X)); +/* check if logind is running */ +#define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0) + GtkWidget* procman_make_label_for_mmaps_or_ofiles(const char *format, const char *process_name, -- cgit v1.2.1