[Suspend2][ 15/20] [Suspend2] Attempt to freeze processes.

Nigel Cunningham
2006-06-26T22:36:46Z

Call the freezer code to get processes frozen, and abort suspending if that
fails. May be called multiple times as we thaw kernel space (only) if we
need to free memory to meet constraints.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

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

diff --git a/kernel/power/prepare_image.c b/kernel/power/prepare_image.c
index a23722d..12d715a 100644
--- a/kernel/power/prepare_image.c
+++ b/kernel/power/prepare_image.c
@@ -491,3 +491,26 @@ static int update_image(void)
(header_storage_needed() + main_storage_needed(1, 1)));
}

+/* attempt_to_freeze
+ *
+ * Try to freeze processes.
+ */
+
+static int attempt_to_freeze(void)
+{
+ int result;
+
+ /* Stop processes before checking again */
+ thaw_processes(FREEZER_ALL_THREADS);
+ suspend_prepare_status(CLEAR_BAR, "Freezing processes");
+ result = freeze_processes();
+
+ if (result) {
+ set_result_state(SUSPEND_ABORTED);
+ set_result_state(SUSPEND_FREEZING_FAILED);
+ } else
+ are_frozen = 1;
+
+ return result;