[Suspend2][ 07/13] [Suspend2] Set NoFreeze flag on a userspace helper.

From: Nigel Cunningham
Date: Tue Jun 27 2006 - 01:03:31 EST


Set the NoFreeze flag on a userspace helper (userui or storage manager) so
that it can continue to function while we're doing I/O.

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

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

diff --git a/kernel/power/netlink.c b/kernel/power/netlink.c
index 0aaf90e..7f06f7c 100644
--- a/kernel/power/netlink.c
+++ b/kernel/power/netlink.c
@@ -127,3 +127,28 @@ static void send_whether_debugging(struc
&is_debugging, sizeof(int));
}

+/*
+ * Set the PF_NOFREEZE flag on the given process to ensure it can run whilst we
+ * are suspending.
+ */
+static int nl_set_nofreeze(struct user_helper_data *uhd, int pid)
+{
+ struct task_struct *t;
+
+ read_lock(&tasklist_lock);
+ if ((t = find_task_by_pid(pid)) == NULL) {
+ read_unlock(&tasklist_lock);
+ printk("Strange. Can't find the userspace task %d.\n", pid);
+ return -EINVAL;
+ }
+
+ t->flags |= PF_NOFREEZE;
+
+ read_unlock(&tasklist_lock);
+ uhd->pid = pid;
+
+ suspend_send_netlink_message(uhd, NETLINK_MSG_NOFREEZE_ACK, NULL, 0);
+
+ return 0;
+}
+

--
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/