/[gentoo-x86]/net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch
Gentoo

Contents of /net-misc/networkmanager/files/networkmanager-0.9.1.95-glib-2.31.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Feb 1 07:46:37 2012 UTC (2 years, 5 months ago) by tetromino
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Install nm-interfaces service to provide net dependency for openrc only when nm is connected (inspired by Xake's solution in bug #252137). Correctly deal with single quotes in /etc/conf.d/hostname. Do not create /var/run/NetworkManager, it's not needed in Gentoo (bug #401019, thanks to Maxim Kammerer). Drop old.

(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)

1 From 4d1d3b9935fca45ff98e1e705ce74540d234c41b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
3 Date: Mon, 31 Oct 2011 11:50:28 +0100
4 Subject: [PATCH] core: fix building for GLib thread API changes (GLib >=
5 2.31.0) (bgo #662695)
6
7 ---
8 src/main.c | 9 +++++++++
9 src/nm-policy-hostname.c | 45 ++++++++++++++++++++++++++++++++++-----------
10 2 files changed, 43 insertions(+), 11 deletions(-)
11
12 diff --git a/src/main.c b/src/main.c
13 index b7c0fd5..12a0b89 100644
14 --- a/src/main.c
15 +++ b/src/main.c
16 @@ -563,9 +563,18 @@ main (int argc, char *argv[])
17 umask (022);
18
19 g_type_init ();
20 +
21 +/*
22 + * Threading is always enabled starting from GLib 2.31.0.
23 + * See also http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html.
24 + */
25 +#if !GLIB_CHECK_VERSION (2,31,0)
26 if (!g_thread_supported ())
27 g_thread_init (NULL);
28 dbus_g_thread_init ();
29 +#else
30 + dbus_threads_init_default ();
31 +#endif
32
33 #ifndef HAVE_DBUS_GLIB_DISABLE_LEGACY_PROP_ACCESS
34 #error HAVE_DBUS_GLIB_DISABLE_LEGACY_PROP_ACCESS not defined
35 diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c
36 index 4fe69c5..f98aa9c 100644
37 --- a/src/nm-policy-hostname.c
38 +++ b/src/nm-policy-hostname.c
39 @@ -15,7 +15,7 @@
40 * with this program; if not, write to the Free Software Foundation, Inc.,
41 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
42 *
43 - * Copyright (C) 2004 - 2010 Red Hat, Inc.
44 + * Copyright (C) 2004 - 2011 Red Hat, Inc.
45 * Copyright (C) 2007 - 2008 Novell, Inc.
46 */
47
48 @@ -36,7 +36,11 @@
49 struct HostnameThread {
50 GThread *thread;
51
52 +#if GLIB_CHECK_VERSION (2,31,0)
53 + GMutex lock;
54 +#else
55 GMutex *lock;
56 +#endif
57 gboolean dead;
58 int ret;
59
60 @@ -50,6 +54,25 @@ struct HostnameThread {
61 gpointer user_data;
62 };
63
64 +/*
65 + * GMutex API has changed:
66 + * http://developer.gnome.org/glib/2.31/glib-Threads.html#GMutex
67 + * http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html
68 +*/
69 +#if GLIB_CHECK_VERSION (2,31,0)
70 +#define X_MUTEX_LOCK(mutex) g_mutex_lock (&(mutex))
71 +#define X_MUTEX_UNLOCK(mutex) g_mutex_unlock (&(mutex))
72 +#define X_MUTEX_INIT(mutex) g_mutex_init (&(mutex))
73 +#define X_MUTEX_CLEAR(mutex) g_mutex_clear (&(mutex))
74 +#define X_THREAD_CREATE(func,data) g_thread_try_new ("hostname-thread", func, data, NULL);
75 +#else
76 +#define X_MUTEX_LOCK(mutex) g_mutex_lock (mutex)
77 +#define X_MUTEX_UNLOCK(mutex) g_mutex_unlock (mutex)
78 +#define X_MUTEX_INIT(mutex) mutex = g_mutex_new ()
79 +#define X_MUTEX_CLEAR(mutex) g_mutex_free (mutex)
80 +#define X_THREAD_CREATE(func,data) g_thread_create (func, data, FALSE, NULL);
81 +#endif
82 +
83 static gboolean
84 hostname_thread_run_cb (gpointer user_data)
85 {
86 @@ -72,12 +95,12 @@ hostname_thread_worker (gpointer data)
87
88 nm_log_dbg (LOGD_DNS, "(%p) starting address reverse-lookup", ht);
89
90 - g_mutex_lock (ht->lock);
91 + X_MUTEX_LOCK (ht->lock);
92 if (ht->dead) {
93 - g_mutex_unlock (ht->lock);
94 + X_MUTEX_UNLOCK (ht->lock);
95 return (gpointer) NULL;
96 }
97 - g_mutex_unlock (ht->lock);
98 + X_MUTEX_UNLOCK (ht->lock);
99
100 ht->ret = getnameinfo (ht->addr, ht->addr_size, ht->hostname, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
101 if (ht->ret == 0) {
102 @@ -106,7 +129,7 @@ hostname_thread_free (HostnameThread *ht)
103
104 nm_log_dbg (LOGD_DNS, "(%p) freeing reverse-lookup thread", ht);
105
106 - g_mutex_free (ht->lock);
107 + X_MUTEX_CLEAR (ht->lock);
108 memset (ht, 0, sizeof (HostnameThread));
109 g_free (ht);
110 }
111 @@ -123,7 +146,7 @@ hostname4_thread_new (guint32 ip4_addr,
112 ht = g_malloc0 (sizeof (HostnameThread));
113 g_assert (ht);
114
115 - ht->lock = g_mutex_new ();
116 + X_MUTEX_INIT (ht->lock);
117 ht->callback = callback;
118 ht->user_data = user_data;
119
120 @@ -132,7 +155,7 @@ hostname4_thread_new (guint32 ip4_addr,
121 ht->addr = (struct sockaddr *) &ht->addr4;
122 ht->addr_size = sizeof (ht->addr4);
123
124 - ht->thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL);
125 + ht->thread = X_THREAD_CREATE (hostname_thread_worker, ht);
126 if (!ht->thread) {
127 hostname_thread_free (ht);
128 return NULL;
129 @@ -158,7 +181,7 @@ hostname6_thread_new (const struct in6_addr *ip6_addr,
130 ht = g_malloc0 (sizeof (HostnameThread));
131 g_assert (ht);
132
133 - ht->lock = g_mutex_new ();
134 + X_MUTEX_INIT (ht->lock);
135 ht->callback = callback;
136 ht->user_data = user_data;
137
138 @@ -167,7 +190,7 @@ hostname6_thread_new (const struct in6_addr *ip6_addr,
139 ht->addr = (struct sockaddr *) &ht->addr6;
140 ht->addr_size = sizeof (ht->addr6);
141
142 - ht->thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL);
143 + ht->thread = X_THREAD_CREATE (hostname_thread_worker, ht);
144 if (!ht->thread) {
145 hostname_thread_free (ht);
146 return NULL;
147 @@ -189,9 +212,9 @@ hostname_thread_kill (HostnameThread *ht)
148
149 nm_log_dbg (LOGD_DNS, "(%p) stopping reverse-lookup thread", ht);
150
151 - g_mutex_lock (ht->lock);
152 + X_MUTEX_LOCK (ht->lock);
153 ht->dead = TRUE;
154 - g_mutex_unlock (ht->lock);
155 + X_MUTEX_UNLOCK (ht->lock);
156 }
157
158 gboolean
159 --
160 1.7.7.2

  ViewVC Help
Powered by ViewVC 1.1.20