Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 607352 | Differences between
and this patch

Collapse All | Expand All

(-)a/config.h.in (+6 lines)
Lines 204-209 Link Here
204
/* Define to 1 if ConsoleKit is available */
204
/* Define to 1 if ConsoleKit is available */
205
#undef SESSION_TRACKING_CONSOLEKIT
205
#undef SESSION_TRACKING_CONSOLEKIT
206
206
207
/* Define to 1 if libelogin is available */
208
#undef SESSION_TRACKING_ELOGIND
209
207
/* Define to 1 if libsystemd-login is available */
210
/* Define to 1 if libsystemd-login is available */
208
#undef SESSION_TRACKING_SYSTEMD
211
#undef SESSION_TRACKING_SYSTEMD
209
212
Lines 216-221 Link Here
216
/* Define to 1 to use ConsoleKit2 suspend api */
219
/* Define to 1 to use ConsoleKit2 suspend api */
217
#undef SUSPEND_RESUME_CONSOLEKIT
220
#undef SUSPEND_RESUME_CONSOLEKIT
218
221
222
/* Define to 1 to use elogind suspend api */
223
#undef SUSPEND_RESUME_ELOGIND
224
219
/* Define to 1 to use systemd suspend api */
225
/* Define to 1 to use systemd suspend api */
220
#undef SUSPEND_RESUME_SYSTEMD
226
#undef SUSPEND_RESUME_SYSTEMD
221
227
(-)a/configure.ac (-8 / +38 lines)
Lines 426-439 Link Here
426
	[Support systemd session tracking]))
426
	[Support systemd session tracking]))
427
AC_ARG_WITH(consolekit, AS_HELP_STRING([--with-consolekit=yes|no],
427
AC_ARG_WITH(consolekit, AS_HELP_STRING([--with-consolekit=yes|no],
428
	[Support consolekit session tracking]))
428
	[Support consolekit session tracking]))
429
AC_ARG_WITH(session-tracking, AS_HELP_STRING([--with-session-tracking=systemd|consolekit|no],
429
AC_ARG_WITH(session-tracking, AS_HELP_STRING([--with-session-tracking=systemd|elogind|consolekit|no],
430
	[Compatibility option to choose one session tracking module]))
430
	[Compatibility option to choose one session tracking module]))
431
# backwards compatibility
431
# backwards compatibility
432
AS_IF([test "$with_session_tracking" = "ck"], [use_consolekit="yes" use_systemd_logind="no"])
432
AS_IF([test "$with_session_tracking" = "ck"], [use_consolekit="yes" use_systemd_logind="no" use_elogind="no"])
433
AS_IF([test "$with_session_tracking" = "consolekit"], [use_consolekit="yes" use_systemd_logind="no"])
433
AS_IF([test "$with_session_tracking" = "consolekit"], [use_consolekit="yes" use_systemd_logind="no" use_elogind="no"])
434
AS_IF([test "$with_session_tracking" = "systemd"], [use_consolekit="no" use_systemd_logind="yes"])
434
AS_IF([test "$with_session_tracking" = "systemd"], [use_consolekit="no" use_systemd_logind="yes" use_elogind="no"])
435
AS_IF([test "$with_session_tracking" = "no"], [use_consolekit="no" use_systemd_logind="no"])
435
AS_IF([test "$with_session_tracking" = "elogind"], [use_consolekit="no" use_systemd_logind="no" use_elogind="yes"])
436
AS_IF([test "$with_session_tracking" = "none"], [use_consolekit="no" use_systemd_logind="no"])
436
AS_IF([test "$with_session_tracking" = "no"], [use_consolekit="no" use_systemd_logind="no" use_elogind="no"])
437
AS_IF([test "$with_session_tracking" = "none"], [use_consolekit="no" use_systemd_logind="no" use_elogind="no"])
437
# current options
438
# current options
438
AS_IF([test -n "$with_systemd_logind" ], [use_systemd_logind="$with_systemd_logind"])
439
AS_IF([test -n "$with_systemd_logind" ], [use_systemd_logind="$with_systemd_logind"])
439
AS_IF([test -n "$with_consolekit" ], [use_consolekit="$with_consolekit"])
440
AS_IF([test -n "$with_consolekit" ], [use_consolekit="$with_consolekit"])
Lines 454-459 Link Here
454
	AC_DEFINE([SESSION_TRACKING_SYSTEMD], 1, [Define to 1 if libsystemd-login is available])
455
	AC_DEFINE([SESSION_TRACKING_SYSTEMD], 1, [Define to 1 if libsystemd-login is available])
455
	session_tracking="$session_tracking, systemd-logind"
456
	session_tracking="$session_tracking, systemd-logind"
456
fi
457
fi
458
459
if test "$use_elogind" = "yes" -a "$have_systemd_logind" = "yes"; then
460
    AC_MSG_ERROR([Cannot enable systemd-logind together with elogind.])
461
fi
462
if test "$use_elogind" = "yes"; then
463
    PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [have_elogind=no])])
464
else
465
    have_elogind=no
466
fi
467
if test "$use_elogind" = "yes" -a "$have_elogind" = "no"; then
468
    AC_MSG_ERROR([You must have libelogind installed to build with elogind support.])
469
fi
470
if test "$have_elogind" = "yes"; then
471
    AC_DEFINE([SESSION_TRACKING_ELOGIND], 1, [Define to 1 if libelogin is available])
472
    session_tracking="$session_tracking, elogind"
473
fi
474
457
if test "$use_consolekit" = "yes"; then
475
if test "$use_consolekit" = "yes"; then
458
	AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available])
476
	AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available])
459
	AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database])
477
	AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database])
Lines 461-467 Link Here
461
fi
479
fi
462
session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
480
session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
463
481
464
AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd|consolekit], [Build NetworkManager with specific suspend/resume support]))
482
AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd|elogind|consolekit], [Build NetworkManager with specific suspend/resume support]))
465
if test "z$with_suspend_resume" = "z"; then
483
if test "z$with_suspend_resume" = "z"; then
466
    PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
484
    PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
467
                     [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
485
                     [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
Lines 469-474 Link Here
469
        # Use systemd if it's new enough
487
        # Use systemd if it's new enough
470
        with_suspend_resume="systemd"
488
        with_suspend_resume="systemd"
471
    else
489
    else
490
        PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes],
491
                        [PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes], [have_elogind_inhibit=no])])
492
        if test "z${have_elogind_inhibit}" = "zyes"; then
493
            # Use elogind if it's new enough
494
            with_suspend_resume="elogind"
495
        else
472
        if test "$use_consolekit" = "yes"; then
496
        if test "$use_consolekit" = "yes"; then
473
                # Use consolekit suspend if session tracking is consolekit
497
                # Use consolekit suspend if session tracking is consolekit
474
                with_suspend_resume="consolekit"
498
                with_suspend_resume="consolekit"
Lines 478-483 Link Here
478
        fi
502
        fi
479
    fi
503
    fi
480
fi
504
fi
505
fi
481
506
482
case $with_suspend_resume in
507
case $with_suspend_resume in
483
    upower)
508
    upower)
Lines 488-498 Link Here
488
                          [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
513
                          [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
489
        AC_DEFINE([SUSPEND_RESUME_SYSTEMD], 1, [Define to 1 to use systemd suspend api])
514
        AC_DEFINE([SUSPEND_RESUME_SYSTEMD], 1, [Define to 1 to use systemd suspend api])
490
        ;;
515
        ;;
516
    elogind)
517
        PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219],,
518
                          [PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219])])
519
        AC_DEFINE([SUSPEND_RESUME_ELOGIND], 1, [Define to 1 to use elogind suspend api])
520
        ;;
491
    consolekit)
521
    consolekit)
492
        AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api])
522
        AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api])
493
        ;;
523
        ;;
494
    *)
524
    *)
495
        AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, consolekit])
525
        AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, elogind, consolekit])
496
        ;;
526
        ;;
497
esac
527
esac
498
528
(-)a/src/nm-sleep-monitor.c (-2 / +6 lines)
Lines 38-50 Link Here
38
#define USE_UPOWER                      1
38
#define USE_UPOWER                      1
39
#define _NMLOG_PREFIX_NAME              "sleep-monitor-up"
39
#define _NMLOG_PREFIX_NAME              "sleep-monitor-up"
40
40
41
#elif defined (SUSPEND_RESUME_SYSTEMD)
41
#elif defined (SUSPEND_RESUME_SYSTEMD) || defined (SUSPEND_RESUME_ELOGIND)
42
42
43
#define SUSPEND_DBUS_NAME               "org.freedesktop.login1"
43
#define SUSPEND_DBUS_NAME               "org.freedesktop.login1"
44
#define SUSPEND_DBUS_PATH               "/org/freedesktop/login1"
44
#define SUSPEND_DBUS_PATH               "/org/freedesktop/login1"
45
#define SUSPEND_DBUS_INTERFACE          "org.freedesktop.login1.Manager"
45
#define SUSPEND_DBUS_INTERFACE          "org.freedesktop.login1.Manager"
46
#define USE_UPOWER                      0
46
#define USE_UPOWER                      0
47
#if defined (SUSPEND_RESUME_SYSTEMD)
47
#define _NMLOG_PREFIX_NAME              "sleep-monitor-sd"
48
#define _NMLOG_PREFIX_NAME              "sleep-monitor-sd"
49
#else
50
#define _NMLOG_PREFIX_NAME              "sleep-monitor-el"
51
#endif
48
52
49
#elif defined(SUSPEND_RESUME_CONSOLEKIT)
53
#elif defined(SUSPEND_RESUME_CONSOLEKIT)
50
54
Lines 60-66 Link Here
60
64
61
#else
65
#else
62
66
63
#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
67
#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
64
68
65
#endif
69
#endif
66
70
(-)a/src/nm-session-monitor.c (-3 / +15 lines)
Lines 29-36 Link Here
29
#include "nm-session-monitor.h"
29
#include "nm-session-monitor.h"
30
#include "NetworkManagerUtils.h"
30
#include "NetworkManagerUtils.h"
31
31
32
#if defined (SESSION_TRACKING_SYSTEMD) && defined (SESSION_TRACKING_ELOGIND)
33
#error Cannot build both systemd-logind and elogind support
34
#endif
35
32
#ifdef SESSION_TRACKING_SYSTEMD
36
#ifdef SESSION_TRACKING_SYSTEMD
33
#include <systemd/sd-login.h>
37
#include <systemd/sd-login.h>
38
#define LOGIND_NAME "systemd-logind"
39
#endif
40
41
#ifdef SESSION_TRACKING_ELOGIND
42
#include <elogind/sd-login.h>
43
#define LOGIND_NAME "elogind"
44
/* Re-Use SESSION_TRACKING_SYSTEMD as elogind substitutes systemd-login */
45
#define SESSION_TRACKING_SYSTEMD 1
34
#endif
46
#endif
35
47
36
/********************************************************************/
48
/********************************************************************/
Lines 103-109 Link Here
103
	status = sd_uid_get_sessions (uid, active, NULL);
115
	status = sd_uid_get_sessions (uid, active, NULL);
104
116
105
	if (status < 0)
117
	if (status < 0)
106
		_LOGE ("failed to get systemd sessions for uid %d: %d", uid, status);
118
		_LOGE ("failed to get "LOGIND_NAME" sessions for uid %d: %d", uid, status);
107
119
108
	return status > 0;
120
	return status > 0;
109
}
121
}
Lines 130-136 Link Here
130
		return;
142
		return;
131
143
132
	if ((status = sd_login_monitor_new (NULL, &monitor->sd.monitor)) < 0) {
144
	if ((status = sd_login_monitor_new (NULL, &monitor->sd.monitor)) < 0) {
133
		_LOGE ("failed to create systemd login monitor: %d", status);
145
		_LOGE ("failed to create "LOGIND_NAME" monitor: %d", status);
134
		return;
146
		return;
135
	}
147
	}
136
148
Lines 375-381 Link Here
375
{
387
{
376
#ifdef SESSION_TRACKING_SYSTEMD
388
#ifdef SESSION_TRACKING_SYSTEMD
377
	st_sd_init (monitor);
389
	st_sd_init (monitor);
378
	_LOGD ("using systemd-logind session tracking");
390
	_LOGD ("using "LOGIND_NAME" session tracking");
379
#endif
391
#endif
380
392
381
#ifdef SESSION_TRACKING_CONSOLEKIT
393
#ifdef SESSION_TRACKING_CONSOLEKIT

Return to bug 607352