[PATCH] [42/48] Suspend2 2.1.9.8 for 2.6.12: 618-core.patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



diff -ruNp 619-userspace-nofreeze.patch-old/kernel/power/suspend2_core/userspace-nofreeze.c 619-userspace-nofreeze.patch-new/kernel/power/suspend2_core/userspace-nofreeze.c
--- 619-userspace-nofreeze.patch-old/kernel/power/suspend2_core/userspace-nofreeze.c	1970-01-01 10:00:00.000000000 +1000
+++ 619-userspace-nofreeze.patch-new/kernel/power/suspend2_core/userspace-nofreeze.c	2005-07-04 23:14:19.000000000 +1000
@@ -0,0 +1,69 @@
+/*
+ * kernel/power/suspend2_core/userspace-nofreeze.c
+ *
+ * Mark/unmark userspace processes as PF_NOFREEZE.
+ *
+ * This should be used with extreme caution!
+ *
+ * Initial purpose: make nbd-client about to be NOFREEZE.
+ */
+
+#include <linux/module.h>
+#include <linux/suspend.h>
+#include <asm/tlbflush.h>
+#include "../suspend.h"
+
+int toggle_pid;
+
+/*
+ * toggle_thread_nofreeze
+ *
+ * Toggle a thread's PF_NOFREEZE flag
+ *
+ * Returns:
+ * -1: PID not found
+ *  0: NO_FREEZE cleared.
+ *  1: NO_FREEZE set.
+ */
+static int __toggle_thread_nofreeze(int pid)
+{
+	struct task_struct *p, *g;
+	int result = -1;
+
+	read_lock(&tasklist_lock);
+
+	do_each_thread(g, p) {
+		if (p->pid == pid) {
+			if (p->mm) {
+				p->flags ^=PF_NOFREEZE;
+				result = !!(p->flags & PF_NOFREEZE);
+			} else
+				printk("Cowardly refusing to toggle NOFREEZE on a real kernel thread!");
+		}
+	} while_each_thread(g, p);
+
+	read_unlock(&tasklist_lock);
+
+	return result;
+}
+
+void toggle_thread_nofreeze(void)
+{
+	int result;
+	printk("Seeking %d... ", toggle_pid);
+
+	switch ((result = __toggle_thread_nofreeze(toggle_pid)))
+	{
+		case -1:
+			printk("Can't toggle NO_FREEZE for thread - not found.\n");
+			break;
+		case 0:
+			printk("NO_FREEZE flag cleared.\n");
+			break;
+		case 1:
+			printk("NO_FREEZE flag set.\n");
+			break;
+		default:
+			printk("what does %d mean?!", result);
+	}
+}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux