[PATCH] device: avoid signals sent to the mbim-proxy process
aleksander at aleksander.es
Sun Aug 6 11:13:40 UTC 2017
If e.g. mbim-proxy is started by ModemManager and we send a Ctrl+C to
it, the signal would be propagated to the mbim-proxy process and we
would kill it right away, while leaving ModemManager still around
wondering why the socket to the proxy got a HUP.
Avoid this, by making sure the mbim-proxy gets its own process group.
Eric, adding you in CC because I got this issue while testing your ModemManager patch to act on proxy crashes. I was running MM in --debug mode and sent a Ctrl-C to stop it, and that actually ended up killing the proxy underneath and your reprobe logic hitting in... :)
What do you guys think? I believe this is reasonable, the proxy should really be a complete independent spawn not tied to the process which originated it.
The same change would be applicable to qmi-proxy.
src/libmbim-glib/mbim-device.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index 68544af..4b7d431 100644
@@ -1077,6 +1077,13 @@ wait_for_proxy_cb (GTask *task)
+ if (setpgid (0, 0) < 0)
+ g_warning ("couldn't setup proxy specific process group");
create_iochannel_with_socket (GTask *task)
@@ -1138,7 +1145,7 @@ create_iochannel_with_socket (GTask *task)
NULL, /* envp */
G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
- NULL, /* child_setup */
+ (GSpawnChildSetupFunc) spawn_child_setup,
NULL, /* child_setup_user_data */
More information about the libmbim-devel