diff options
Diffstat (limited to 'testing/networkmanager')
-rw-r--r-- | testing/networkmanager/NetworkManager.conf | 2 | ||||
-rw-r--r-- | testing/networkmanager/PKGBUILD | 78 | ||||
-rw-r--r-- | testing/networkmanager/disable_set_hostname.patch | 19 | ||||
-rw-r--r-- | testing/networkmanager/dnsmasq-path.patch | 30 | ||||
-rw-r--r-- | testing/networkmanager/networkmanager.install | 9 | ||||
-rw-r--r-- | testing/networkmanager/nm-polkit-permissive.patch | 12 | ||||
-rw-r--r-- | testing/networkmanager/repair-signals.patch | 37 | ||||
-rw-r--r-- | testing/networkmanager/systemd-fallback.patch | 470 | ||||
-rw-r--r-- | testing/networkmanager/systemd-sleep.patch | 616 |
9 files changed, 0 insertions, 1273 deletions
diff --git a/testing/networkmanager/NetworkManager.conf b/testing/networkmanager/NetworkManager.conf deleted file mode 100644 index c37b59680..000000000 --- a/testing/networkmanager/NetworkManager.conf +++ /dev/null @@ -1,2 +0,0 @@ -[main] -plugins=keyfile diff --git a/testing/networkmanager/PKGBUILD b/testing/networkmanager/PKGBUILD deleted file mode 100644 index 9e763f63f..000000000 --- a/testing/networkmanager/PKGBUILD +++ /dev/null @@ -1,78 +0,0 @@ -# $Id: PKGBUILD 169165 2012-10-18 19:23:13Z jgc $ -# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> -# Maintainer: Jan de Groot <jgc@archlinxu.org> -# Contributor: Wael Nasreddine <gandalf@siemens-mobiles.org> -# Contributor: Tor Krill <tor@krill.nu> -# Contributor: Will Rea <sillywilly@gmail.com> -# Contributor: Valentine Sinitsyn <e_val@inbox.ru> - -pkgname=networkmanager -_pkgname=NetworkManager -pkgver=0.9.6.0 -pkgrel=5 -pkgdesc="Network Management daemon" -arch=('i686' 'x86_64') -license=('GPL') -url="http://www.gnome.org/projects/$_pkgname/" -depends=(dbus-glib iproute2 libnl nss polkit udev wpa_supplicant ppp dhclient - libsoup systemd) -makedepends=(intltool dhcpcd iptables gobject-introspection) -optdepends=('modemmanager: for modem management service' - 'dhcpcd: alternative DHCP client; does not support DHCPv6' - 'iptables: Connection sharing' - 'dnsmasq: Connection sharing' - 'bluez: Bluetooth support' - 'openresolv: resolvconf support') -options=('!libtool') -backup=('etc/NetworkManager/NetworkManager.conf') -install=networkmanager.install -source=(http://ftp.gnome.org/pub/gnome/sources/$_pkgname/${pkgver:0:3}/$_pkgname-$pkgver.tar.xz - NetworkManager.conf disable_set_hostname.patch dnsmasq-path.patch - nm-polkit-permissive.patch repair-signals.patch systemd-sleep.patch) -sha256sums=('3982b623b7b199ac99e2ddd0840fe7d088245a49e3f680237e8baebf0cf86d07' - '44b048804c7c0b8b3b0c29b8632b6ad613c397d0a1635ec918e10c0fbcdadf21' - '25056837ea92e559f09563ed817e3e0cd9333be861b8914e45f62ceaae2e0460' - '65124505048cc8396daf0242c9f5d532fa669b4bbca305998c248ab2329490cb' - 'e23b651a90ef62d515921953b4c6779538d35a737fb74c266b7fce94d62fdb06' - 'a1c65a09e5e8ecb1004ab7922517aa7fbc9700dc61e3b2fd348d3d7c23808ce6' - '24c181ab69e769e703e45f64a552add5df5de22fbcd8899d588add053674420a') - -build() { - cd $_pkgname-$pkgver - - patch -Np1 -i ../disable_set_hostname.patch - patch -Np1 -i ../dnsmasq-path.patch - patch -Np1 -i ../nm-polkit-permissive.patch - patch -Np1 -i ../repair-signals.patch # FS#31115 - patch -Np1 -i ../systemd-sleep.patch - AUTOPOINT="intltoolize -f -c --automake" autoreconf -fi - - ./configure \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --libexecdir=/usr/lib/networkmanager \ - --with-crypto=nss \ - --with-distro=arch \ - --with-dhclient=/usr/sbin/dhclient \ - --with-dhcpcd=/usr/sbin/dhcpcd \ - --with-iptables=/usr/sbin/iptables \ - --with-systemdsystemunitdir=/usr/lib/systemd/system \ - --with-udev-dir=/usr/lib/udev \ - --with-resolvconf=/usr/sbin/resolvconf \ - --with-session-tracking=systemd \ - --disable-static \ - --enable-more-warnings=no \ - --disable-wimax - - make -} - -package() { - cd $_pkgname-$pkgver - make DESTDIR="$pkgdir" install - - install -m644 ../NetworkManager.conf "$pkgdir/etc/NetworkManager/" - - rm -r "$pkgdir/var/run" -} diff --git a/testing/networkmanager/disable_set_hostname.patch b/testing/networkmanager/disable_set_hostname.patch deleted file mode 100644 index ee95dd0e1..000000000 --- a/testing/networkmanager/disable_set_hostname.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -Nur NetworkManager-0.9.0.orig/src/nm-policy.c NetworkManager-0.9.0/src/nm-policy.c ---- NetworkManager-0.9.0.orig/src/nm-policy.c 2011-08-23 06:41:02.099686450 +0000 -+++ NetworkManager-0.9.0/src/nm-policy.c 2011-08-23 06:43:38.227791737 +0000 -@@ -302,6 +302,7 @@ - return; - } - -+#if 0 - /* Try automatically determined hostname from the best device's IP config */ - if (!best4) - best4 = get_best_ip4_device (policy->manager, &best_req4); -@@ -356,6 +357,7 @@ - } - } - -+#endif - /* If no automatically-configured hostname, try using the hostname from - * when NM started up. - */ diff --git a/testing/networkmanager/dnsmasq-path.patch b/testing/networkmanager/dnsmasq-path.patch deleted file mode 100644 index c0e713266..000000000 --- a/testing/networkmanager/dnsmasq-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff -u -r NetworkManager-0.9.2.0/src/dns-manager/nm-dns-dnsmasq.c NetworkManager-0.9.2.0-dnsmasq/src/dns-manager/nm-dns-dnsmasq.c ---- NetworkManager-0.9.2.0/src/dns-manager/nm-dns-dnsmasq.c 2011-10-10 23:38:20.000000000 +0200 -+++ NetworkManager-0.9.2.0-dnsmasq/src/dns-manager/nm-dns-dnsmasq.c 2012-03-06 09:07:24.137460927 +0100 -@@ -52,8 +52,11 @@ - find_dnsmasq (void) - { - static const char *paths[] = { -+ "/usr/local/bin/dnsmasq", - "/usr/local/sbin/dnsmasq", -+ "/usr/bin/dnsmasq", - "/usr/sbin/dnsmasq", -+ "/bin/dnsmasq", - "/sbin/dnsmasq", - NULL - }; -diff -u -r NetworkManager-0.9.2.0/src/dnsmasq-manager/nm-dnsmasq-manager.c NetworkManager-0.9.2.0-dnsmasq/src/dnsmasq-manager/nm-dnsmasq-manager.c ---- NetworkManager-0.9.2.0/src/dnsmasq-manager/nm-dnsmasq-manager.c 2011-04-19 07:06:22.000000000 +0200 -+++ NetworkManager-0.9.2.0-dnsmasq/src/dnsmasq-manager/nm-dnsmasq-manager.c 2012-03-06 09:07:58.603851818 +0100 -@@ -170,8 +170,11 @@ - nm_find_dnsmasq (void) - { - static const char *dnsmasq_binary_paths[] = { -+ "/usr/local/bin/dnsmasq", - "/usr/local/sbin/dnsmasq", -+ "/usr/bin/dnsmasq", - "/usr/sbin/dnsmasq", -+ "/bin/dnsmasq", - "/sbin/dnsmasq", - NULL - }; diff --git a/testing/networkmanager/networkmanager.install b/testing/networkmanager/networkmanager.install deleted file mode 100644 index de40c17ed..000000000 --- a/testing/networkmanager/networkmanager.install +++ /dev/null @@ -1,9 +0,0 @@ -post_upgrade() { - (( $(vercmp 0.8.3 $2) > 0 )) && cat <<MSG -ATTENTION: - /etc/NetworkManager/nm-system-settings.conf has been replaced - by /etc/NetworkManager/NetworkManager.conf. Make sure you move - any custom settings to the new config file. -MSG - true -} diff --git a/testing/networkmanager/nm-polkit-permissive.patch b/testing/networkmanager/nm-polkit-permissive.patch deleted file mode 100644 index 1ac406224..000000000 --- a/testing/networkmanager/nm-polkit-permissive.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up NetworkManager-0.8.997/policy/org.freedesktop.NetworkManager.policy.in.permissive NetworkManager-0.8.997/policy/org.freedesktop.NetworkManager.policy.in ---- NetworkManager-0.8.997/policy/org.freedesktop.NetworkManager.policy.in.permissive 2011-03-24 14:21:35.100912222 -0500 -+++ NetworkManager-0.8.997/policy/org.freedesktop.NetworkManager.policy.in 2011-03-24 14:21:49.916726997 -0500 -@@ -95,7 +95,7 @@ - <_message>System policy prevents modification of network settings for all users</_message> - <defaults> - <allow_inactive>no</allow_inactive> -- <allow_active>auth_admin_keep</allow_active> -+ <allow_active>yes</allow_active> - </defaults> - </action> - diff --git a/testing/networkmanager/repair-signals.patch b/testing/networkmanager/repair-signals.patch deleted file mode 100644 index cf1319dc5..000000000 --- a/testing/networkmanager/repair-signals.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 64342a313ef497fca8a4fb7567900d4a1460065f Mon Sep 17 00:00:00 2001 -From: Alexandre Rostovtsev <tetromino@gentoo.org> -Date: Thu, 13 Sep 2012 09:32:53 +0000 -Subject: core: wait until we daemonized before setting up signals (bgo #683932) - -If we mask signals before daemonizing, the daemon process will not be -able to handle them, and thus would be unkillable with anything other -than SIGKILL. ---- -diff --git a/src/main.c b/src/main.c -index 8bc6d3f..5b82cfa 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -401,10 +401,6 @@ main (int argc, char *argv[]) - exit (1); - } - -- /* Set up unix signal handling */ -- if (!setup_signals ()) -- exit (1); -- - /* Set locale to be able to use environment variables */ - setlocale (LC_ALL, ""); - -@@ -501,6 +497,10 @@ main (int argc, char *argv[]) - wrote_pidfile = TRUE; - } - -+ /* Set up unix signal handling - before creating threads, but after daemonizing! */ -+ if (!setup_signals ()) -+ exit (1); -+ - if (g_fatal_warnings) { - GLogLevelFlags fatal_mask; - --- -cgit v0.9.0.2-2-gbebe diff --git a/testing/networkmanager/systemd-fallback.patch b/testing/networkmanager/systemd-fallback.patch deleted file mode 100644 index f5acc9dc6..000000000 --- a/testing/networkmanager/systemd-fallback.patch +++ /dev/null @@ -1,470 +0,0 @@ -diff -u -Nr NetworkManager-0.9.3.995/configure.ac NetworkManager-0.9.3.995-systemd-fallback/configure.ac ---- NetworkManager-0.9.3.995/configure.ac 2012-03-02 01:05:21.000000000 +0100 -+++ NetworkManager-0.9.3.995-systemd-fallback/configure.ac 2012-03-06 16:55:58.294793902 +0100 -@@ -344,7 +344,7 @@ - case $with_session_tracking in - ck|none) ;; - systemd) -- PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login]) -+ PKG_CHECK_MODULES(SYSTEMD, [libsystemd-daemon libsystemd-login]) - ;; - *) - AC_MSG_ERROR(--with-session-tracking must be one of [none, ck, systemd]) -diff -u -Nr NetworkManager-0.9.3.995/src/nm-session-monitor-systemd.c NetworkManager-0.9.3.995-systemd-fallback/src/nm-session-monitor-systemd.c ---- NetworkManager-0.9.3.995/src/nm-session-monitor-systemd.c 2012-02-27 16:57:16.000000000 +0100 -+++ NetworkManager-0.9.3.995-systemd-fallback/src/nm-session-monitor-systemd.c 2012-03-06 16:55:01.285264295 +0100 -@@ -28,6 +28,10 @@ - #include <glib/gstdio.h> - #include <systemd/sd-login.h> - #include <stdlib.h> -+#include <systemd/sd-daemon.h> -+#include <sys/stat.h> -+#include <gio/gio.h> -+#include "nm-logging.h" - - #include "nm-session-utils.h" - #include "nm-session-monitor.h" -@@ -107,10 +111,20 @@ - return source; - } - -+/********************************************************************/ -+ -+#define CKDB_PATH "/var/run/ConsoleKit/database" -+ - struct _NMSessionMonitor { - GObject parent_instance; - - GSource *sd_source; -+ -+ GKeyFile *database; -+ GFileMonitor *database_monitor; -+ time_t database_mtime; -+ GHashTable *sessions_by_uid; -+ GHashTable *sessions_by_user; - }; - - struct _NMSessionMonitorClass { -@@ -130,6 +144,215 @@ - - /* ---------------------------------------------------------------------------------------------------- */ - -+typedef struct { -+ char *user; -+ uid_t uid; -+ gboolean local; -+ gboolean active; -+} Session; -+ -+static void -+session_free (Session *s) -+{ -+ g_free (s->user); -+ memset (s, 0, sizeof (Session)); -+ g_free (s); -+} -+ -+static gboolean -+check_key (GKeyFile *keyfile, const char *group, const char *key, GError **error) -+{ -+ if (g_key_file_has_key (keyfile, group, key, error)) -+ return TRUE; -+ -+ if (!error) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE, -+ "ConsoleKit database " CKDB_PATH " group '%s' had no '%s' key", -+ group, key); -+ } -+ return FALSE; -+} -+ -+static Session * -+session_new (GKeyFile *keyfile, const char *group, GError **error) -+{ -+ GError *local = NULL; -+ Session *s; -+ const char *uname = NULL; -+ -+ s = g_new0 (Session, 1); -+ g_assert (s); -+ -+ s->uid = G_MAXUINT; /* paranoia */ -+ if (!check_key (keyfile, group, "uid", &local)) -+ goto error; -+ s->uid = (uid_t) g_key_file_get_integer (keyfile, group, "uid", &local); -+ if (local) -+ goto error; -+ -+ if (!check_key (keyfile, group, "is_active", &local)) -+ goto error; -+ s->active = g_key_file_get_boolean (keyfile, group, "is_active", &local); -+ if (local) -+ goto error; -+ -+ if (!check_key (keyfile, group, "is_local", &local)) -+ goto error; -+ s->local = g_key_file_get_boolean (keyfile, group, "is_local", &local); -+ if (local) -+ goto error; -+ -+ if (!nm_session_uid_to_user (s->uid, &uname, error)) -+ return FALSE; -+ s->user = g_strdup (uname); -+ -+ return s; -+ -+error: -+ session_free (s); -+ g_propagate_error (error, local); -+ return NULL; -+} -+ -+static void -+session_merge (Session *src, Session *dest) -+{ -+ g_return_if_fail (src != NULL); -+ g_return_if_fail (dest != NULL); -+ -+ g_warn_if_fail (g_strcmp0 (src->user, dest->user) == 0); -+ g_warn_if_fail (src->uid == dest->uid); -+ -+ dest->local = (dest->local || src->local); -+ dest->active = (dest->active || src->active); -+} -+ -+/********************************************************************/ -+ -+static void -+free_database (NMSessionMonitor *self) -+{ -+ if (self->database != NULL) { -+ g_key_file_free (self->database); -+ self->database = NULL; -+ } -+ -+ g_hash_table_remove_all (self->sessions_by_uid); -+ g_hash_table_remove_all (self->sessions_by_user); -+} -+ -+static gboolean -+reload_database (NMSessionMonitor *self, GError **error) -+{ -+ struct stat statbuf; -+ char **groups = NULL; -+ gsize len = 0, i; -+ Session *s; -+ -+ free_database (self); -+ -+ errno = 0; -+ if (stat (CKDB_PATH, &statbuf) != 0) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ errno == ENOENT ? NM_SESSION_MONITOR_ERROR_NO_DATABASE : NM_SESSION_MONITOR_ERROR_IO_ERROR, -+ "Error statting file " CKDB_PATH ": %s", -+ strerror (errno)); -+ goto error; -+ } -+ self->database_mtime = statbuf.st_mtime; -+ -+ self->database = g_key_file_new (); -+ if (!g_key_file_load_from_file (self->database, CKDB_PATH, G_KEY_FILE_NONE, error)) -+ goto error; -+ -+ groups = g_key_file_get_groups (self->database, &len); -+ if (!groups) { -+ g_set_error_literal (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_IO_ERROR, -+ "Could not load groups from " CKDB_PATH ""); -+ goto error; -+ } -+ -+ for (i = 0; i < len; i++) { -+ Session *found; -+ -+ if (!g_str_has_prefix (groups[i], "Session ")) -+ continue; -+ -+ s = session_new (self->database, groups[i], error); -+ if (!s) -+ goto error; -+ -+ found = g_hash_table_lookup (self->sessions_by_user, (gpointer) s->user); -+ if (found) { -+ session_merge (s, found); -+ session_free (s); -+ } else { -+ /* Entirely new user */ -+ g_hash_table_insert (self->sessions_by_user, (gpointer) s->user, s); -+ g_hash_table_insert (self->sessions_by_uid, GUINT_TO_POINTER (s->uid), s); -+ } -+ } -+ -+ g_strfreev (groups); -+ return TRUE; -+ -+error: -+ if (groups) -+ g_strfreev (groups); -+ free_database (self); -+ return FALSE; -+} -+ -+static gboolean -+ensure_database (NMSessionMonitor *self, GError **error) -+{ -+ gboolean ret = FALSE; -+ -+ if (self->database != NULL) { -+ struct stat statbuf; -+ -+ errno = 0; -+ if (stat (CKDB_PATH, &statbuf) != 0) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ errno == ENOENT ? NM_SESSION_MONITOR_ERROR_NO_DATABASE : NM_SESSION_MONITOR_ERROR_IO_ERROR, -+ "Error statting file " CKDB_PATH " to check timestamp: %s", -+ strerror (errno)); -+ goto out; -+ } -+ -+ if (statbuf.st_mtime == self->database_mtime) { -+ ret = TRUE; -+ goto out; -+ } -+ } -+ -+ ret = reload_database (self, error); -+ -+out: -+ return ret; -+} -+ -+static void -+on_file_monitor_changed (GFileMonitor * file_monitor, -+ GFile * file, -+ GFile * other_file, -+ GFileMonitorEvent event_type, -+ gpointer user_data) -+{ -+ NMSessionMonitor *self = NM_SESSION_MONITOR (user_data); -+ -+ /* throw away cache */ -+ free_database (self); -+ -+ g_signal_emit (self, signals[CHANGED_SIGNAL], 0); -+} -+ - static gboolean - sessions_changed (gpointer user_data) - { -@@ -143,9 +366,50 @@ - static void - nm_session_monitor_init (NMSessionMonitor *monitor) - { -- monitor->sd_source = sd_source_new (); -- g_source_set_callback (monitor->sd_source, sessions_changed, monitor, NULL); -- g_source_attach (monitor->sd_source, NULL); -+ if (sd_booted () > 0) { -+ monitor->sd_source = sd_source_new (); -+ g_source_set_callback (monitor->sd_source, sessions_changed, monitor, NULL); -+ g_source_attach (monitor->sd_source, NULL); -+ -+ monitor->database_monitor = NULL; -+ monitor->database = NULL; -+ } else { -+ monitor->sd_source = NULL; -+ -+ GError *error = NULL; -+ GFile *file; -+ -+ /* Sessions-by-user is responsible for destroying the Session objects */ -+ monitor->sessions_by_user = g_hash_table_new_full (g_str_hash, g_str_equal, -+ NULL, (GDestroyNotify) session_free); -+ monitor->sessions_by_uid = g_hash_table_new (g_direct_hash, g_direct_equal); -+ -+ -+ error = NULL; -+ if (!ensure_database (monitor, &error)) { -+ /* Ignore the first error if the CK database isn't found yet */ -+ if (g_error_matches (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_NO_DATABASE) == FALSE) { -+ nm_log_err (LOGD_CORE, "Error loading " CKDB_PATH ": %s", error->message); -+ } -+ g_error_free (error); -+ } -+ -+ error = NULL; -+ file = g_file_new_for_path (CKDB_PATH); -+ monitor->database_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error); -+ g_object_unref (file); -+ if (monitor->database_monitor == NULL) { -+ nm_log_err (LOGD_CORE, "Error monitoring " CKDB_PATH ": %s", error->message); -+ g_error_free (error); -+ } else { -+ g_signal_connect (monitor->database_monitor, -+ "changed", -+ G_CALLBACK (on_file_monitor_changed), -+ monitor); -+ } -+ } - } - - static void -@@ -158,6 +422,12 @@ - g_source_unref (monitor->sd_source); - } - -+ if (monitor->database_monitor != NULL) -+ g_object_unref (monitor->database_monitor); -+ -+ if (monitor->database != NULL) -+ free_database (monitor); -+ - if (G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize != NULL) - G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object); - } -@@ -206,15 +476,36 @@ - uid_t *out_uid, - GError **error) - { -- uid_t uid; -+ if (monitor->sd_source != NULL) { -+ uid_t uid; - -- if (!nm_session_user_to_uid (username, &uid, error)) -- return FALSE; -+ if (!nm_session_user_to_uid (username, &uid, error)) -+ return FALSE; - -- if (out_uid) -- *out_uid = uid; -+ if (out_uid) -+ *out_uid = uid; - -- return nm_session_monitor_uid_has_session (monitor, uid, NULL, error); -+ return nm_session_monitor_uid_has_session (monitor, uid, NULL, error); -+ } else { -+ Session *s; -+ -+ if (!ensure_database (monitor, error)) -+ return FALSE; -+ -+ s = g_hash_table_lookup (monitor->sessions_by_user, (gpointer) username); -+ if (!s) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, -+ "No session found for user '%s'", -+ username); -+ return FALSE; -+ } -+ -+ if (out_uid) -+ *out_uid = s->uid; -+ return TRUE; -+ } - } - - gboolean -@@ -222,12 +513,31 @@ - const char *username, - GError **error) - { -- uid_t uid; -+ if (monitor->sd_source != NULL) { -+ uid_t uid; - -- if (!nm_session_user_to_uid (username, &uid, error)) -- return FALSE; -+ if (!nm_session_user_to_uid (username, &uid, error)) -+ return FALSE; -+ -+ return nm_session_monitor_uid_active (monitor, uid, error); -+ } else { -+ Session *s; -+ -+ if (!ensure_database (monitor, error)) -+ return FALSE; -+ -+ s = g_hash_table_lookup (monitor->sessions_by_user, (gpointer) username); -+ if (!s) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, -+ "No session found for user '%s'", -+ username); -+ return FALSE; -+ } - -- return nm_session_monitor_uid_active (monitor, uid, error); -+ return s->active; -+ } - } - - gboolean -@@ -236,10 +546,31 @@ - const char **out_user, - GError **error) - { -- if (!nm_session_uid_to_user (uid, out_user, error)) -- return FALSE; -+ if (monitor->sd_source != NULL) { -+ if (!nm_session_uid_to_user (uid, out_user, error)) -+ return FALSE; - -- return sd_uid_get_sessions (uid, FALSE, NULL) > 0; -+ return sd_uid_get_sessions (uid, FALSE, NULL) > 0; -+ } else { -+ Session *s; -+ -+ if (!ensure_database (monitor, error)) -+ return FALSE; -+ -+ s = g_hash_table_lookup (monitor->sessions_by_uid, GUINT_TO_POINTER (uid)); -+ if (!s) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, -+ "No session found for uid %d", -+ uid); -+ return FALSE; -+ } -+ -+ if (out_user) -+ *out_user = s->user; -+ return TRUE; -+ } - } - - gboolean -@@ -247,5 +578,24 @@ - uid_t uid, - GError **error) - { -- return sd_uid_get_sessions (uid, TRUE, NULL) > 0; -+ if (monitor->sd_source != NULL) -+ return sd_uid_get_sessions (uid, TRUE, NULL) > 0; -+ else { -+ Session *s; -+ -+ if (!ensure_database (monitor, error)) -+ return FALSE; -+ -+ s = g_hash_table_lookup (monitor->sessions_by_uid, GUINT_TO_POINTER (uid)); -+ if (!s) { -+ g_set_error (error, -+ NM_SESSION_MONITOR_ERROR, -+ NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, -+ "No session found for uid '%d'", -+ uid); -+ return FALSE; -+ } -+ -+ return s->active; -+ } - } diff --git a/testing/networkmanager/systemd-sleep.patch b/testing/networkmanager/systemd-sleep.patch deleted file mode 100644 index 3470d4654..000000000 --- a/testing/networkmanager/systemd-sleep.patch +++ /dev/null @@ -1,616 +0,0 @@ -From b444d31cba5b8ac0c9771cc5a246dfd3af9dfd00 Mon Sep 17 00:00:00 2001 -From: Matthias Clasen <mclasen@redhat.com> -Date: Tue, 9 Oct 2012 00:36:35 -0400 -Subject: [PATCH] core: factor out the upower suspend/resume code (bgo - #677694) - -Factor the code that listens for upower sleeping and resuming -signals out into a class code NMSleepMonitor. - -core: add a systemd suspend/resume monitor (bgo #677694) - -This implementation uses a delay inhibitor to get systemd to -emit PrepareForSleep, and then emits ::Sleeping and ::Resuming -when receiving the before/after PrepareForSleep emissions. - -core: DBusGConnections are not GObjects - -Introduced in 64fd8eea7706038e5d38c8463a1c765ed9331db2. - -core: fix suspend/resume signal names which the manager listens for - -Introduced in 64fd8eea7706038e5d38c8463a1c765ed9331db2; but honestly -I also thought GObject lower-cased signal names since it munges them -for - and _ too. Apparently not. ---- - configure.ac | 2 +- - src/Makefile.am | 9 +- - src/nm-manager.c | 40 +++----- - src/nm-sleep-monitor-systemd.c | 217 +++++++++++++++++++++++++++++++++++++++++ - src/nm-sleep-monitor-upower.c | 151 ++++++++++++++++++++++++++++ - src/nm-sleep-monitor.h | 46 +++++++++ - 6 files changed, 437 insertions(+), 28 deletions(-) - create mode 100644 src/nm-sleep-monitor-systemd.c - create mode 100644 src/nm-sleep-monitor-upower.c - create mode 100644 src/nm-sleep-monitor.h - -diff --git a/configure.ac b/configure.ac -index e76e193..9152c23 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -327,7 +327,7 @@ PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= 147) - AC_SUBST(GUDEV_CFLAGS) - AC_SUBST(GUDEV_LIBS) - --PKG_CHECK_MODULES(GIO, gio-2.0) -+PKG_CHECK_MODULES(GIO, gio-unix-2.0) - AC_SUBST(GIO_CFLAGS) - AC_SUBST(GIO_LIBS) - -diff --git a/src/Makefile.am b/src/Makefile.am -index b155209..ba7d2d6 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -191,6 +191,7 @@ NetworkManager_SOURCES = \ - nm-session-monitor.h \ - nm-session-utils.c \ - nm-session-utils.h \ -+ nm-sleep-monitor.h \ - nm-connection-provider.h \ - nm-connection-provider.c \ - nm-dispatcher.c \ -@@ -201,13 +202,18 @@ NetworkManager_SOURCES += nm-connectivity.c nm-connectivity.h - endif - - if SESSION_TRACKING_SYSTEMD --NetworkManager_SOURCES += nm-session-monitor-systemd.c -+NetworkManager_SOURCES += \ -+ nm-session-monitor-systemd.c \ -+ nm-sleep-monitor-systemd.c - else - if SESSION_TRACKING_CK - NetworkManager_SOURCES += nm-session-monitor-ck.c - else - NetworkManager_SOURCES += nm-session-monitor-null.c - endif -+ -+# UPower suspend/resume used whenever systemd is not enabled -+NetworkManager_SOURCES += nm-sleep-monitor-upower.c - endif - - nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml -@@ -283,6 +289,7 @@ BUILT_SOURCES = \ - NetworkManager_CPPFLAGS = \ - $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) \ -+ $(GIO_CFLAGS) \ - $(GUDEV_CFLAGS) \ - $(LIBNL_CFLAGS) \ - $(GMODULE_CFLAGS) \ -diff --git a/src/nm-manager.c b/src/nm-manager.c -index 618c4ed..c8ce115 100644 ---- a/src/nm-manager.c -+++ b/src/nm-manager.c -@@ -69,6 +69,7 @@ - #include "nm-device-factory.h" - #include "wifi-utils.h" - #include "nm-enum-types.h" -+#include "nm-sleep-monitor.h" - - #if WITH_CONCHECK - #include "nm-connectivity.h" -@@ -78,8 +79,6 @@ - #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" - #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" - --#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower" -- - static gboolean impl_manager_get_devices (NMManager *manager, - GPtrArray **devices, - GError **err); -@@ -228,7 +227,7 @@ typedef struct { - guint modem_removed_id; - - DBusGProxy *aipd_proxy; -- DBusGProxy *upower_proxy; -+ NMSleepMonitor *sleep_monitor; - - GSList *auth_chains; - -@@ -3288,16 +3287,16 @@ impl_manager_sleep (NMManager *self, - } - - static void --upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data) -+sleeping_cb (DBusGProxy *proxy, gpointer user_data) - { -- nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal"); -+ nm_log_dbg (LOGD_SUSPEND, "Received sleeping signal"); - _internal_sleep (NM_MANAGER (user_data), TRUE); - } - - static void --upower_resuming_cb (DBusGProxy *proxy, gpointer user_data) -+resuming_cb (DBusGProxy *proxy, gpointer user_data) - { -- nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal"); -+ nm_log_dbg (LOGD_SUSPEND, "Received resuming signal"); - _internal_sleep (NM_MANAGER (user_data), FALSE); - } - -@@ -4049,8 +4048,8 @@ dispose (GObject *object) - if (priv->aipd_proxy) - g_object_unref (priv->aipd_proxy); - -- if (priv->upower_proxy) -- g_object_unref (priv->upower_proxy); -+ if (priv->sleep_monitor) -+ g_object_unref (priv->sleep_monitor); - - if (priv->fw_monitor) { - if (priv->fw_monitor_id) -@@ -4372,23 +4371,12 @@ nm_manager_init (NMManager *manager) - } else - nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd D-Bus proxy"); - -- /* upower sleep/wake handling */ -- priv->upower_proxy = dbus_g_proxy_new_for_name (g_connection, -- UPOWER_DBUS_SERVICE, -- "/org/freedesktop/UPower", -- "org.freedesktop.UPower"); -- if (priv->upower_proxy) { -- dbus_g_proxy_add_signal (priv->upower_proxy, "Sleeping", G_TYPE_INVALID); -- dbus_g_proxy_connect_signal (priv->upower_proxy, "Sleeping", -- G_CALLBACK (upower_sleeping_cb), -- manager, NULL); -- -- dbus_g_proxy_add_signal (priv->upower_proxy, "Resuming", G_TYPE_INVALID); -- dbus_g_proxy_connect_signal (priv->upower_proxy, "Resuming", -- G_CALLBACK (upower_resuming_cb), -- manager, NULL); -- } else -- nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy"); -+ /* sleep/wake handling */ -+ priv->sleep_monitor = nm_sleep_monitor_get (); -+ g_signal_connect (priv->sleep_monitor, "sleeping", -+ G_CALLBACK (sleeping_cb), manager); -+ g_signal_connect (priv->sleep_monitor, "resuming", -+ G_CALLBACK (resuming_cb), manager); - - /* Listen for authorization changes */ - nm_auth_changed_func_register (authority_changed_cb, manager); -diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c -new file mode 100644 -index 0000000..70adc89 ---- /dev/null -+++ b/src/nm-sleep-monitor-systemd.c -@@ -0,0 +1,217 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * (C) Copyright 2012 Red Hat, Inc. -+ * Author: Matthias Clasen <mclasen@redhat.com> -+ */ -+ -+#include "config.h" -+#include <errno.h> -+#include <string.h> -+#include <sys/stat.h> -+#include <dbus/dbus-glib-lowlevel.h> -+#include <dbus/dbus-glib.h> -+#include <gio/gio.h> -+#include <gio/gunixfdlist.h> -+ -+#include "nm-logging.h" -+#include "nm-dbus-manager.h" -+ -+#include "nm-sleep-monitor.h" -+ -+#define SD_NAME "org.freedesktop.login1" -+#define SD_PATH "/org/freedesktop/login1" -+#define SD_INTERFACE "org.freedesktop.login1.Manager" -+ -+ -+struct _NMSleepMonitor { -+ GObject parent_instance; -+ -+ GDBusProxy *sd_proxy; -+ gint inhibit_fd; -+}; -+ -+struct _NMSleepMonitorClass { -+ GObjectClass parent_class; -+ -+ void (*sleeping) (NMSleepMonitor *monitor); -+ void (*resuming) (NMSleepMonitor *monitor); -+}; -+ -+ -+enum { -+ SLEEPING, -+ RESUMING, -+ LAST_SIGNAL, -+}; -+static guint signals[LAST_SIGNAL] = {0}; -+ -+G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); -+ -+/********************************************************************/ -+ -+static void -+inhibit_done (GObject *source, -+ GAsyncResult *result, -+ gpointer user_data) -+{ -+ GDBusProxy *sd_proxy = G_DBUS_PROXY (source); -+ NMSleepMonitor *self = user_data; -+ GError *error = NULL; -+ GVariant *res; -+ GUnixFDList *fd_list; -+ -+ res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, result, &error); -+ if (!res) { -+ nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", error->message); -+ g_error_free (error); -+ } else { -+ if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1) -+ nm_log_warn (LOGD_SUSPEND, "Didn't get a single fd back"); -+ -+ self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL); -+ -+ nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", self->inhibit_fd); -+ g_object_unref (fd_list); -+ g_variant_unref (res); -+ } -+} -+ -+static void -+take_inhibitor (NMSleepMonitor *self) -+{ -+ g_assert (self->inhibit_fd == -1); -+ -+ nm_log_dbg (LOGD_SUSPEND, "Taking systemd sleep inhibitor"); -+ g_dbus_proxy_call_with_unix_fd_list (self->sd_proxy, -+ "Inhibit", -+ g_variant_new ("(ssss)", -+ "sleep", -+ g_get_user_name (), -+ "inhibited", -+ "delay"), -+ 0, -+ G_MAXINT, -+ NULL, -+ NULL, -+ inhibit_done, -+ self); -+} -+ -+static gboolean -+drop_inhibitor (NMSleepMonitor *self) -+{ -+ if (self->inhibit_fd >= 0) { -+ nm_log_dbg (LOGD_SUSPEND, "Dropping systemd sleep inhibitor"); -+ close (self->inhibit_fd); -+ self->inhibit_fd = -1; -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+static void -+signal_cb (GDBusProxy *proxy, -+ const gchar *sendername, -+ const gchar *signalname, -+ GVariant *args, -+ gpointer data) -+{ -+ NMSleepMonitor *self = data; -+ gboolean is_about_to_suspend; -+ -+ if (strcmp (signalname, "PrepareForSleep") != 0) -+ return; -+ -+ g_variant_get (args, "(b)", &is_about_to_suspend); -+ nm_log_dbg (LOGD_SUSPEND, "Received PrepareForSleep signal: %d", is_about_to_suspend); -+ -+ if (is_about_to_suspend) { -+ g_signal_emit (self, signals[SLEEPING], 0); -+ drop_inhibitor (self); -+ } else { -+ take_inhibitor (self); -+ g_signal_emit (self, signals[RESUMING], 0); -+ } -+} -+ -+static void -+nm_sleep_monitor_init (NMSleepMonitor *self) -+{ -+ GDBusConnection *bus; -+ -+ self->inhibit_fd = -1; -+ bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); -+ self->sd_proxy = g_dbus_proxy_new_sync (bus, 0, NULL, -+ SD_NAME, SD_PATH, SD_INTERFACE, -+ NULL, NULL); -+ g_object_unref (bus); -+ g_signal_connect (self->sd_proxy, "g-signal", G_CALLBACK (signal_cb), self); -+ take_inhibitor (self); -+} -+ -+static void -+finalize (GObject *object) -+{ -+ NMSleepMonitor *self = NM_SLEEP_MONITOR (object); -+ -+ drop_inhibitor (self); -+ if (self->sd_proxy) -+ g_object_unref (self->sd_proxy); -+ -+ if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL) -+ G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); -+} -+ -+static void -+nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) -+{ -+ GObjectClass *gobject_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ -+ gobject_class->finalize = finalize; -+ -+ signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, -+ NM_TYPE_SLEEP_MONITOR, -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), -+ NULL, /* accumulator */ -+ NULL, /* accumulator data */ -+ g_cclosure_marshal_VOID__VOID, -+ G_TYPE_NONE, 0); -+ signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, -+ NM_TYPE_SLEEP_MONITOR, -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), -+ NULL, /* accumulator */ -+ NULL, /* accumulator data */ -+ g_cclosure_marshal_VOID__VOID, -+ G_TYPE_NONE, 0); -+} -+ -+NMSleepMonitor * -+nm_sleep_monitor_get (void) -+{ -+ static NMSleepMonitor *singleton = NULL; -+ -+ if (singleton) -+ return g_object_ref (singleton); -+ -+ singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, NULL)); -+ return singleton; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -diff --git a/src/nm-sleep-monitor-upower.c b/src/nm-sleep-monitor-upower.c -new file mode 100644 -index 0000000..3c93f66 ---- /dev/null -+++ b/src/nm-sleep-monitor-upower.c -@@ -0,0 +1,151 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * (C) Copyright 2012 Red Hat, Inc. -+ * Author: Matthias Clasen <mclasen@redhat.com> -+ */ -+ -+#include "config.h" -+#include <errno.h> -+#include <string.h> -+#include <sys/stat.h> -+#include <dbus/dbus-glib-lowlevel.h> -+#include <dbus/dbus-glib.h> -+#include <gio/gio.h> -+#include "nm-logging.h" -+#include "nm-dbus-manager.h" -+ -+#include "nm-sleep-monitor.h" -+ -+#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower" -+ -+struct _NMSleepMonitor { -+ GObject parent_instance; -+ -+ DBusGProxy *upower_proxy; -+}; -+ -+struct _NMSleepMonitorClass { -+ GObjectClass parent_class; -+ -+ void (*sleeping) (NMSleepMonitor *monitor); -+ void (*resuming) (NMSleepMonitor *monitor); -+}; -+ -+ -+enum { -+ SLEEPING, -+ RESUMING, -+ LAST_SIGNAL, -+}; -+static guint signals[LAST_SIGNAL] = {0}; -+ -+G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT); -+ -+/********************************************************************/ -+ -+static void -+upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data) -+{ -+ nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal"); -+ g_signal_emit (user_data, signals[SLEEPING], 0); -+} -+ -+static void -+upower_resuming_cb (DBusGProxy *proxy, gpointer user_data) -+{ -+ nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal"); -+ g_signal_emit (user_data, signals[RESUMING], 0); -+} -+ -+static void -+nm_sleep_monitor_init (NMSleepMonitor *self) -+{ -+ NMDBusManager *dbus_mgr; -+ DBusGConnection *bus; -+ -+ dbus_mgr = nm_dbus_manager_get (); -+ bus = nm_dbus_manager_get_connection (dbus_mgr); -+ self->upower_proxy = dbus_g_proxy_new_for_name (bus, -+ UPOWER_DBUS_SERVICE, -+ "/org/freedesktop/UPower", -+ "org.freedesktop.UPower"); -+ if (self->upower_proxy) { -+ dbus_g_proxy_add_signal (self->upower_proxy, "Sleeping", G_TYPE_INVALID); -+ dbus_g_proxy_connect_signal (self->upower_proxy, "Sleeping", -+ G_CALLBACK (upower_sleeping_cb), -+ self, NULL); -+ -+ dbus_g_proxy_add_signal (self->upower_proxy, "Resuming", G_TYPE_INVALID); -+ dbus_g_proxy_connect_signal (self->upower_proxy, "Resuming", -+ G_CALLBACK (upower_resuming_cb), -+ self, NULL); -+ } else -+ nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy"); -+ g_object_unref (dbus_mgr); -+} -+ -+static void -+finalize (GObject *object) -+{ -+ NMSleepMonitor *self = NM_SLEEP_MONITOR (object); -+ -+ if (self->upower_proxy) -+ g_object_unref (self->upower_proxy); -+ -+ if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL) -+ G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize (object); -+} -+ -+static void -+nm_sleep_monitor_class_init (NMSleepMonitorClass *klass) -+{ -+ GObjectClass *gobject_class; -+ -+ gobject_class = G_OBJECT_CLASS (klass); -+ -+ gobject_class->finalize = finalize; -+ -+ signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING, -+ NM_TYPE_SLEEP_MONITOR, -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (NMSleepMonitorClass, sleeping), -+ NULL, /* accumulator */ -+ NULL, /* accumulator data */ -+ g_cclosure_marshal_VOID__VOID, -+ G_TYPE_NONE, 0); -+ signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING, -+ NM_TYPE_SLEEP_MONITOR, -+ G_SIGNAL_RUN_LAST, -+ G_STRUCT_OFFSET (NMSleepMonitorClass, resuming), -+ NULL, /* accumulator */ -+ NULL, /* accumulator data */ -+ g_cclosure_marshal_VOID__VOID, -+ G_TYPE_NONE, 0); -+} -+ -+NMSleepMonitor * -+nm_sleep_monitor_get (void) -+{ -+ static NMSleepMonitor *singleton = NULL; -+ -+ if (singleton) -+ return g_object_ref (singleton); -+ -+ singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, NULL)); -+ return singleton; -+} -+ -+/* ---------------------------------------------------------------------------------------------------- */ -diff --git a/src/nm-sleep-monitor.h b/src/nm-sleep-monitor.h -new file mode 100644 -index 0000000..173e6a1 ---- /dev/null -+++ b/src/nm-sleep-monitor.h -@@ -0,0 +1,46 @@ -+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -+/* This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License along -+ * with this program; if not, write to the Free Software Foundation, Inc., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ * -+ * (C) Copyright 2012 Red Hat, Inc. -+ * Author: Matthias Clasen <mclasen@redhat.com> -+ */ -+ -+#ifndef NM_SLEEP_MONITOR_H -+#define NM_SLEEP_MONITOR_H -+ -+#include <glib-object.h> -+ -+G_BEGIN_DECLS -+ -+#define NM_TYPE_SLEEP_MONITOR (nm_sleep_monitor_get_type ()) -+#define NM_SLEEP_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_SLEEP_MONITOR, NMSleepMonitor)) -+#define NM_SLEEP_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass)) -+#define NM_SLEEP_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass)) -+#define NM_IS_SLEEP_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_SLEEP_MONITOR)) -+#define NM_IS_SLEEP_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_SLEEP_MONITOR)) -+ -+#define NM_SLEEP_MONITOR_SLEEPING "sleeping" -+#define NM_SLEEP_MONITOR_RESUMING "resuming" -+ -+typedef struct _NMSleepMonitor NMSleepMonitor; -+typedef struct _NMSleepMonitorClass NMSleepMonitorClass; -+ -+GType nm_sleep_monitor_get_type (void) G_GNUC_CONST; -+NMSleepMonitor *nm_sleep_monitor_get (void); -+ -+G_END_DECLS -+ -+#endif /* NM_SLEEP_MONITOR_H */ -+ --- -1.7.12.2 - |