glib = 2.31.0 Threads and Mutexes
Hello list! There was a change in the threads and mutexes API in glib starting with version 2.31, see http://git.gnome.org/browse/glib/tree/NEWS. Especially g_thread_init(), g_thread_create(), g_mutex_new() and g_mutex_free() are gone. I replaced those as follows: - made g_thread_init conditional, as demonstrated in https://bugs.freedesktop.org/show_bug.cgi?id=42036. - conditionally replaced g_thread_create() with g_thread_new(). NetworkManager never catches errors and threads seem always joinable now, so the change is straight forward replace and satisfy g_thread_new() signature - g_mutex_new() replaced by static declarations of GMutex-es and (conditionally) passing their references where g_mutex_new() used to be called - g_mutex_free() removed (conditionally) I came across this problem while building Gnome3 using jhbuild, so this patch should be against git HEAD (or its equivalent given a central repository). Kind regards Martin diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c index 1d75578..8da58b9 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -32,6 +32,9 @@ #define DBUS_NO_SERVICE_ERROR org.freedesktop.DBus.Error.ServiceDoesNotExist +#if GLIB_CHECK_VERSION (2, 31, 0) +static GMutex callbacks_lock_mutex; +#endif struct libnm_glib_ctx { @@ -453,8 +456,10 @@ _libnm_glib_ctx_free (libnm_glib_ctx *ctx) ctx-dbus_con = NULL; } +#if !GLIB_CHECK_VERSION (2, 31, 0) if (ctx-callbacks_lock) g_mutex_free (ctx-callbacks_lock); +#endif g_slist_foreach (ctx-callbacks, (GFunc)g_free, NULL); g_slist_free (ctx-callbacks); @@ -477,8 +482,12 @@ _libnm_glib_ctx_new (void) goto error; if (!(ctx-g_main_loop = g_main_loop_new (ctx-g_main_ctx, FALSE))) goto error; +#if !GLIB_CHECK_VERSION (2, 31, 0) if (!(ctx-callbacks_lock = g_mutex_new ())) goto error; +#else + ctx-callbacks_lock = callbacks_lock_mutex; +#endif ctx-dbus_watch_interval = 1000; return ctx; @@ -495,14 +504,20 @@ libnm_glib_init (void) libnm_glib_ctx *ctx = NULL; g_type_init (); +#if !GLIB_CHECK_VERSION (2, 31, 0) if (!g_thread_supported ()) g_thread_init (NULL); +#endif dbus_g_thread_init (); if (!(ctx = _libnm_glib_ctx_new ())) return NULL; +#if !GLIB_CHECK_VERSION (2, 31, 0) ctx-thread = g_thread_create (_libnm_glib_dbus_worker, ctx, TRUE, NULL); +#else + ctx-thread = g_thread_new (_libnm_glib_dbus_worker, _libnm_glib_dbus_worker, ctx); +#endif if (!ctx-thread) goto error; diff --git a/src/main.c b/src/main.c index b7c0fd5..0718e91 100644 --- a/src/main.c +++ b/src/main.c @@ -563,8 +563,10 @@ main (int argc, char *argv[]) umask (022); g_type_init (); +#if !GLIB_CHECK_VERSION (2, 31, 0) if (!g_thread_supported ()) g_thread_init (NULL); +#endif dbus_g_thread_init (); #ifndef HAVE_DBUS_GLIB_DISABLE_LEGACY_PROP_ACCESS diff --git a/src/nm-policy-hostname.c b/src/nm-policy-hostname.c index 4fe69c5..0ee1cf9 100644 --- a/src/nm-policy-hostname.c +++ b/src/nm-policy-hostname.c @@ -33,6 +33,11 @@ // +#if GLIB_CHECK_VERSION (2, 31, 0) +static GMutex lock_mutex_v4; +static GMutex lock_mutex_v6; +#endif + struct HostnameThread { GThread *thread; @@ -106,7 +111,9 @@ hostname_thread_free (HostnameThread *ht) nm_log_dbg (LOGD_DNS, (%p) freeing reverse-lookup thread, ht); +#if !GLIB_CHECK_VERSION (2, 31, 0) g_mutex_free (ht-lock); +#endif memset (ht, 0, sizeof (HostnameThread)); g_free (ht); } @@ -123,7 +130,11 @@ hostname4_thread_new (guint32 ip4_addr, ht = g_malloc0 (sizeof (HostnameThread)); g_assert (ht); +#if !GLIB_CHECK_VERSION (2, 31, 0) ht-lock = g_mutex_new (); +#else + ht-lock = lock_mutex_v4; +#endif ht-callback = callback; ht-user_data = user_data; @@ -132,7 +143,11 @@ hostname4_thread_new (guint32 ip4_addr, ht-addr = (struct sockaddr *) ht-addr4; ht-addr_size = sizeof (ht-addr4); +#if !GLIB_CHECK_VERSION (2, 31, 0) ht-thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL); +#else + ht-thread = g_thread_new (hostname_thread_worker, hostname_thread_worker, ht); +#endif if (!ht-thread) { hostname_thread_free (ht); return NULL; @@ -158,7 +173,11 @@ hostname6_thread_new (const struct in6_addr *ip6_addr, ht = g_malloc0 (sizeof (HostnameThread)); g_assert (ht); +#if !GLIB_CHECK_VERSION (2, 31, 0) ht-lock = g_mutex_new (); +#else + ht-lock = lock_mutex_v6; +#endif ht-callback = callback; ht-user_data = user_data; @@ -167,7 +186,11 @@ hostname6_thread_new (const struct in6_addr *ip6_addr, ht-addr = (struct sockaddr *) ht-addr6; ht-addr_size = sizeof (ht-addr6); +#if !GLIB_CHECK_VERSION (2, 31, 0) ht-thread = g_thread_create (hostname_thread_worker, ht, FALSE, NULL); +#else + ht-thread = g_thread_new (hostname_thread_worker, hostname_thread_worker, ht); +#endif if (!ht-thread) { hostname_thread_free (ht); return NULL; diff --git a/src/wimax/iwmxsdk.c
Re: glib = 2.31.0 Threads and Mutexes
On 10/31/2011 10:26 AM, martin...@gmx.net wrote: Hello list! There was a change in the threads and mutexes API in glib starting with version 2.31, see http://git.gnome.org/browse/glib/tree/NEWS. Especially g_thread_init(), g_thread_create(), g_mutex_new() and g_mutex_free() are gone. I replaced those as follows: - made g_thread_init conditional, as demonstrated in https://bugs.freedesktop.org/show_bug.cgi?id=42036. g_thread_init() has been unnecessary since glib 2.24 in any program that uses GObjects. NM claims to only require glib 2.18 right now... I don't know if that's true or not. - g_mutex_new() replaced by static declarations of GMutex-es and (conditionally) passing their references where g_mutex_new() used to be called The right replacement is to replace GMutex *foo; ... foo = g_mutex_new (); ... g_mutex_lock (foo); ... g_mutex_free (foo); with: GMutex foo; ... g_mutex_init (foo); ... g_mutex_lock (foo); ... g_mutex_clear (foo); ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Unable to connect Huawei E173 usb modem
Hello, list. Some day ago I posted this issue. Would deeply appreciate some guidance -a lot of it. :-)) Huawei E173 USB módem for mobile broad band connection. Fedora 15 Linux. usb_modeswitch 1.1.7 -came with the system; yum say it is up to date. lsusb says IDs are: Vendor 12d1, Product 1c24 before switching, 1c23 after doing so. Switching works. At plugging in, led is green; after some seconds it turns blue. Network Manager detects the modem. It shows the Mobile Broadband option and the Predetermined Movistar connection. However, when clicked, it tries to connect but does not. Modem works. I connected through wvdial. This was the connection configuration used: [Dialer Defaults] Modem Type = Analog Modem Modem = /dev/ttyUSB2 Init1 = ATZ Init2 = ATQ0 V1 E1 ISDN = 0 Phone = *99# Username = movistar Password = movistar Baud = 9600 This was the output: -bash-4.2# wvdial -- WvDial: Internet dialer version 1.61 -- Initializing modem. -- Sending: ATZ ATZ OK -- Sending: ATQ0 V1 E1 ATQ0 V1 E1 OK -- Modem initialized. -- Sending: ATDT*99# -- Waiting for carrier. ATDT*99# CONNECT -- Carrier detected. Waiting for prompt. -- Don't know what to do! Starting pppd and hoping for the best. -- Starting pppd at Wed Oct 19 23:48:13 2011 -- Pid of pppd: 6174 -- Using interface ppp0 -- pppd: �J�[08]�J�[08] -- pppd: �J�[08]�J�[08] -- pppd: �J�[08]�J�[08] -- pppd: �J�[08]�J�[08] -- pppd: �J�[08]�J�[08] -- pppd: �J�[08]�J�[08] -- local IP address 10.77.86.214 -- pppd: �J�[08]�J�[08] -- remote IP address 10.64.64.64 -- pppd: �J�[08]�J�[08] -- primary DNS address 200.76.88.11 -- pppd: �J�[08]�J�[08] -- secondary DNS address 200.76.80.11 -- pppd: �J�[08]�J�[08] #here led in modem lighted up ^CCaught signal 2: Attempting to exit gracefully... -- Terminating on signal 15 -- pppd: �J�[08]�J�[08] LED in mode was bright blue while connecting; then it steadily stayed light blue. I didn't know how to use the connection. Firefox said it was out of connection, aswell as Evolution. However, I could ping from a 2nd terminal. Just for information purposes, the following. /etc/usb_modeswitch.d/12d1:1c24 is the configuration file ## ## # Huawei E173 DefaultVendor= 0x12d1 DefaultProduct=0x1c23 TargetVendor= 0x12d1 TargetProduct= 0x1c23 CheckSuccess=16 MessageContent=55534243001106 /lib/udev/rules.d/40-usb_modeswitch.rules has the following rule # Huawei E173 (product 1c24) ATTRS{idVendor}==12d1, ATTRS{idProduct}==1c24, RUN +=usb_modeswitch '%b/%k' As there are 4 ttyUSB* ports created after usb_modeswitching this forum suggested to create another rule. So /etc/udev/rules.d/50-myrules.rules has this rule KERNEL==ttyUSB2, RUN+=/bin/ln -sf /dev/ttyUSB2 /dev/ttyUSB0 This is the whole thread at fedoraforum. Well, as you see, I have searched and studied a lot. But here is where I'm stuck now. :-/ And my client, a friend of mine, is starting to hate me. X-( Best regards Alfredo C. Harvey :-) attachment: face-smile.pngattachment: face-angry.pngattachment: face-uncertain.pngattachment: face-laugh.png___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Persistent 3G connection fails, not sure why
Den 28. okt. 2011 13:59, skrev David Pfeffer: How do we get some attention to this patch and get it applied to the main source? This is a /major/ issue for anyone running a persistent 3G connection. Indeed. I hope someone is willing to have a look at it, if it's not being done already. If 3G internet doesn't work very well with network-manager in Linux, how is it going to compete with Windows and Mac? :-( -- Alexander Karlstad ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Unable to connect Huawei E173 usb modem
Oops. If forgot to link to the forum I took the main information from. This is it. (In Spanish, sorry. It is a blog. Have to go down to the Huawei E173 article.) ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: OpenVpn plugin NeedSecret
On Fri, 2011-10-28 at 18:34 +0200, Francesco Andrisani wrote: Hi, i'm newbie of Network manager, so sorry for any errors. I'm an Debian User. I've downloaded and conpiled Networkmanager-0.9.0 with ModemManager 0.5 and NetworkManager-openvpn-0.9.0 plugin. Network manager work fine. I'm able with my custom python script to use ethernet and gsm at modem. My problem is when i try to start Openvpn (using NM) throught ethernet device. I continuosly see into NM logs: Oct 28 17:16:46 sheevaplug-debian NetworkManager[2327]: info Starting VPN service 'openvpn'... Oct 28 17:16:46 sheevaplug-debian NetworkManager[2327]: info VPN service 'openvpn' started (org.freedesktop.NetworkManager.openvpn), PID 2416 tun: Universal TUN/TAP device driver, 1.6 tun: (C) 1999-2004 Max Krasnyansky m...@qualcomm.com Oct 28 17:16:47 sheevaplug-debian NetworkManager[2327]: info VPN service 'openvpn' appeared; activating connections Oct 28 17:16:47 sheevaplug-debian NetworkManager[2327]: info VPN plugin state changed: 1 Oct 28 17:16:47 sheevaplug-debian NetworkManager[2327]: error [1319822207.127668] [nm-vpn-connection.c:823] plugin_need_secrets_cb(): (355653c0-34d3-4777-ad25-f9a498b7ef8e/VPNconnection) plugin NeedSecret. Oct 28 17:16:47 sheevaplug-debian NetworkManager[2327]: info Policy set 'MyConnection' (eth0) as default for IPv4 routing and DNS. Oct 28 17:16:52 sheevaplug-debian NetworkManager[2327]: info VPN service 'openvpn' disappeared The error message appears to be somewhat cut off; can you grab the full message from [nm-vpn-connection.c:823] plugin_need_secrets_cb() for us? That will have more information about where the problem may lie. It should be something like: (355653c0-34d3-4777-ad25-f9a498b7ef8e/VPNconnection) plugin NeedSecrets request 1 failed: message message2 Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
ANN: NetworkManager 0.9.1.95 (0.9.2-rc1) released
Hi, This weekend I tagged and uploaded NetworkManager 0.9.1.95 (0.9.2-rc1), nm-applet, and the VPN plugins. I'd like to release 0.9.2 very soon so we can start merging all the great stuff we've got lined up for 0.9.4 (bridge, bond, vlan, ipv4/v6 enhancements, nl80211 support, etc). So bang on this release and lets get on the road to 0.9.4. 0.9.2 will be primarily a bugfix release; the best list of changes is the NEWS file here: http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/NEWS http://git.gnome.org/browse/network-manager-applet/tree/NEWS Downloads in the usual spots: http://ftp.gnome.org/pub/gnome/sources/NetworkManager/0.9/ http://ftp.gnome.org/pub/gnome/sources/network-manager-applet/0.9/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openconnect/0.9/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openswan/0.9/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openvpn/0.9/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-pptp/0.9/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-vpnc/0.9/ Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
ANN: NetworkManager 0.8.5.93 (0.8.6-rc2) released
Hi, I've also tagged and uploaded 0.8.5.93 (0.8.6-rc2) which is primarily a bugfix update of the 0.8.x series. There are a bunch of fixes since 0.8.4: http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/NEWS?h=NM_0_8 http://git.gnome.org/browse/network-manager-applet/tree/NEWS?h=NMA_0_8 and it's most likely this code will be the 0.8.6 release, barring any serious bugs. So please test and report any issues and regressions, thanks! Downloads in the usual spots: http://ftp.gnome.org/pub/gnome/sources/NetworkManager/0.8/ http://ftp.gnome.org/pub/gnome/sources/network-manager-applet/0.8/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openconnect/0.8/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openswan/0.8/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-openvpn/0.8/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-pptp/0.8/ http://ftp.gnome.org/pub/gnome/sources/NetworkManager-vpnc/0.8/ Dan ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Show Hidden network from connection file
Hello! I'm trying to write a connection file that is going to be distributed on many computers. It configures a wireless ad hoc connection, everything works fine except that the connection doesn't appears on the nm-applet in gnome, it is only accessible from 'hidden networks'. I would like it to be available from the beginning so i changed the timestamp from 0 to 1 but it didn't showed up. What else or what files can I edit to make the connection looks like it has been already used? Thanks, Marcos. ___ networkmanager-list mailing list networkmanager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list