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 207-212 Link Here
207
/* Define to 1 if libsystemd-login is available */
207
/* Define to 1 if libsystemd-login is available */
208
#undef SESSION_TRACKING_SYSTEMD
208
#undef SESSION_TRACKING_SYSTEMD
209
209
210
/* Define to 1 if libelogin is available */
211
#undef SESSION_TRACKING_ELOGIND
212
210
/* The size of `dev_t', as computed by sizeof. */
213
/* The size of `dev_t', as computed by sizeof. */
211
#undef SIZEOF_DEV_T
214
#undef SIZEOF_DEV_T
212
215
Lines 219-224 Link Here
219
/* Define to 1 to use systemd suspend api */
222
/* Define to 1 to use systemd suspend api */
220
#undef SUSPEND_RESUME_SYSTEMD
223
#undef SUSPEND_RESUME_SYSTEMD
221
224
225
/* Define to 1 to use elogind suspend api */
226
#undef SUSPEND_RESUME_ELOGIND
227
222
/* Define to 1 to use UPower suspend api */
228
/* Define to 1 to use UPower suspend api */
223
#undef SUSPEND_RESUME_UPOWER
229
#undef SUSPEND_RESUME_UPOWER
224
230
(-)a/configure.ac (-8 / +35 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" -o "$use_elogind" = "auto"; then
460
    PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [have_elogind=no])])
461
else
462
    have_elogind=no
463
fi
464
if test "$use_elogind" = "yes" -a "$have_elogind" = "no"; then
465
    AC_MSG_ERROR([You must have libelogind installed to build with elogind support.])
466
fi
467
if test "$have_elogind" = "yes"; then
468
    AC_DEFINE([SESSION_TRACKING_ELOGIND], 1, [Define to 1 if libelogin is available])
469
    session_tracking="$session_tracking, elogind"
470
fi
471
457
if test "$use_consolekit" = "yes"; then
472
if test "$use_consolekit" = "yes"; then
458
	AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available])
473
	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])
474
	AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database])
Lines 461-467 Link Here
461
fi
476
fi
462
session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
477
session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
463
478
464
AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd|consolekit], [Build NetworkManager with specific suspend/resume support]))
479
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
480
if test "z$with_suspend_resume" = "z"; then
466
    PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
481
    PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
467
                     [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
482
                     [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
484
        # Use systemd if it's new enough
470
        with_suspend_resume="systemd"
485
        with_suspend_resume="systemd"
471
    else
486
    else
487
        PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes],
488
                        [PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes], [have_elogind_inhibit=no])])
489
        if test "z${have_elogind_inhibit}" = "zyes"; then
490
            # Use elogind if it's new enough
491
            with_suspend_resume="elogind"
492
        else
472
        if test "$use_consolekit" = "yes"; then
493
        if test "$use_consolekit" = "yes"; then
473
                # Use consolekit suspend if session tracking is consolekit
494
                # Use consolekit suspend if session tracking is consolekit
474
                with_suspend_resume="consolekit"
495
                with_suspend_resume="consolekit"
Lines 478-483 Link Here
478
        fi
499
        fi
479
    fi
500
    fi
480
fi
501
fi
502
fi
481
503
482
case $with_suspend_resume in
504
case $with_suspend_resume in
483
    upower)
505
    upower)
Lines 488-498 Link Here
488
                          [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
510
                          [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
489
        AC_DEFINE([SUSPEND_RESUME_SYSTEMD], 1, [Define to 1 to use systemd suspend api])
511
        AC_DEFINE([SUSPEND_RESUME_SYSTEMD], 1, [Define to 1 to use systemd suspend api])
490
        ;;
512
        ;;
513
    elogind)
514
        PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219],,
515
                          [PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219])])
516
        AC_DEFINE([SUSPEND_RESUME_ELOGIND], 1, [Define to 1 to use elogind suspend api])
517
        ;;
491
    consolekit)
518
    consolekit)
492
        AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api])
519
        AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api])
493
        ;;
520
        ;;
494
    *)
521
    *)
495
        AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, consolekit])
522
        AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, elogind, consolekit])
496
        ;;
523
        ;;
497
esac
524
esac
498
525
(-)a/src/nm-sleep-monitor.c (-2 / +2 lines)
Lines 38-44 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"
Lines 60-66 Link Here
60
60
61
#else
61
#else
62
62
63
#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
63
#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER
64
64
65
#endif
65
#endif
66
66
(-)a/src/nm-session-monitor.c (+17 lines)
Lines 32-37 Link Here
32
#ifdef SESSION_TRACKING_SYSTEMD
32
#ifdef SESSION_TRACKING_SYSTEMD
33
#include <systemd/sd-login.h>
33
#include <systemd/sd-login.h>
34
#endif
34
#endif
35
#ifdef SESSION_TRACKING_ELOGIND
36
#include <elogind/sd-login.h>
37
/* Re-Use SESSION_TRACKING_SYSTEMD as elogind substitutes systemd-login */
38
#define SESSION_TRACKING_SYSTEMD 1
39
#endif
35
40
36
/********************************************************************/
41
/********************************************************************/
37
42
Lines 103-109 Link Here
103
	status = sd_uid_get_sessions (uid, active, NULL);
108
	status = sd_uid_get_sessions (uid, active, NULL);
104
109
105
	if (status < 0)
110
	if (status < 0)
111
#ifdef SESSION_TRACKING_ELOGIND
112
		_LOGE ("failed to get elogind sessions for uid %d: %d", uid, status);
113
#else
106
		_LOGE ("failed to get systemd sessions for uid %d: %d", uid, status);
114
		_LOGE ("failed to get systemd sessions for uid %d: %d", uid, status);
115
#endif /* SESSION_TRACKING_ELOGIND */
107
116
108
	return status > 0;
117
	return status > 0;
109
}
118
}
Lines 130-136 Link Here
130
		return;
139
		return;
131
140
132
	if ((status = sd_login_monitor_new (NULL, &monitor->sd.monitor)) < 0) {
141
	if ((status = sd_login_monitor_new (NULL, &monitor->sd.monitor)) < 0) {
142
#ifdef SESSION_TRACKING_ELOGIND
143
		_LOGE ("failed to create elogind monitor: %d", status);
144
#else
133
		_LOGE ("failed to create systemd login monitor: %d", status);
145
		_LOGE ("failed to create systemd login monitor: %d", status);
146
#endif /* SESSION_TRACKING_ELOGIND */
134
		return;
147
		return;
135
	}
148
	}
136
149
Lines 375-381 Link Here
375
{
388
{
376
#ifdef SESSION_TRACKING_SYSTEMD
389
#ifdef SESSION_TRACKING_SYSTEMD
377
	st_sd_init (monitor);
390
	st_sd_init (monitor);
391
#ifdef SESSION_TRACKING_ELOGIND
392
	_LOGD ("using elogind session tracking");
393
#else
378
	_LOGD ("using systemd-logind session tracking");
394
	_LOGD ("using systemd-logind session tracking");
395
#endif /* SESSION_TRACKING_ELOGIND */
379
#endif
396
#endif
380
397
381
#ifdef SESSION_TRACKING_CONSOLEKIT
398
#ifdef SESSION_TRACKING_CONSOLEKIT

Return to bug 607352