[Suspend2][ 12/13] [Suspend2] Start a userspace helper.

From: Nigel Cunningham
Date: Tue Jun 27 2006 - 00:58:48 EST


Attempt to start a userspace helper and set up the netlink socket
connection to it.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

kernel/power/netlink.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/kernel/power/netlink.c b/kernel/power/netlink.c
index d7a3a90..0a379c3 100644
--- a/kernel/power/netlink.c
+++ b/kernel/power/netlink.c
@@ -344,3 +344,29 @@ int suspend2_launch_userspace_program(ch
return retval;
}

+int suspend_netlink_setup(struct user_helper_data *uhd)
+{
+ if (netlink_prepare(uhd) < 0) {
+ printk("Netlink prepare failed.\n");
+ return 1;
+ }
+
+ if (suspend2_launch_userspace_program(uhd->program, uhd->netlink_id) < 0) {
+ printk("Launch userspace program failed.\n");
+ suspend_netlink_close(uhd);
+ return 1;
+ }
+
+ /* Wait 2 seconds for the userspace process to make contact */
+ wait_for_completion_timeout(&uhd->wait_for_process, 2*HZ);
+
+ if (uhd->pid == -1) {
+ printk("%s: Failed to contact userspace process.\n",
+ uhd->name);
+ suspend_netlink_close(uhd);
+ return 1;
+ }
+
+ return 0;
+}
+#endif

--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/