suspend-0.80-fix-s2both-resume-hacks.diff 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Index: b/suspend.c
  2. ===================================================================
  3. --- a/suspend.c
  4. +++ b/suspend.c
  5. @@ -1772,11 +1772,10 @@ int suspend_system(int snapshot_fd, int
  6. if (error)
  7. goto Shutdown;
  8. reset_signature(resume_fd);
  9. free_swap_pages(snapshot_fd);
  10. free_snapshot(snapshot_fd);
  11. - s2ram_resume();
  12. goto Unfreeze;
  13. }
  14. Shutdown:
  15. #endif
  16. close(resume_fd);
  17. @@ -2268,11 +2267,11 @@ int main(int argc, char *argv[])
  18. struct stat stat_buf;
  19. int resume_fd, snapshot_fd, vt_fd, orig_vc = -1, suspend_vc = -1;
  20. int test_fd = -1;
  21. dev_t resume_dev;
  22. int orig_loglevel, orig_swappiness, ret;
  23. - struct rlimit rlim;
  24. + struct rlimit rlim, rlim_saved;
  25. static char chroot_path[MAX_STR_LEN];
  26. my_name = basename(argv[0]);
  27. /* Make sure the 0, 1, 2 descriptors are open before opening the
  28. @@ -2500,19 +2499,19 @@ int main(int argc, char *argv[])
  29. goto Restore_console;
  30. }
  31. splash.progress(5);
  32. +#ifdef CONFIG_ENCRYPT
  33. + if (do_encrypt && ! use_RSA)
  34. + splash.read_password(password, 1);
  35. +#endif
  36. #ifdef CONFIG_BOTH
  37. /* If s2ram_hacks returns != 0, better not try to suspend to RAM */
  38. if (s2ram)
  39. s2ram = !s2ram_hacks();
  40. #endif
  41. -#ifdef CONFIG_ENCRYPT
  42. - if (do_encrypt && ! use_RSA)
  43. - splash.read_password(password, 1);
  44. -#endif
  45. open_printk();
  46. orig_loglevel = get_kernel_console_loglevel();
  47. set_kernel_console_loglevel(suspend_loglevel);
  48. @@ -2522,18 +2521,25 @@ int main(int argc, char *argv[])
  49. sync();
  50. splash.progress(10);
  51. + getrlimit(RLIMIT_NOFILE, &rlim_saved);
  52. rlim.rlim_cur = 0;
  53. rlim.rlim_max = 0;
  54. setrlimit(RLIMIT_NOFILE, &rlim);
  55. setrlimit(RLIMIT_NPROC, &rlim);
  56. setrlimit(RLIMIT_CORE, &rlim);
  57. ret = suspend_system(snapshot_fd, resume_fd, test_fd);
  58. + setrlimit(RLIMIT_NOFILE, &rlim_saved);
  59. +#ifdef CONFIG_BOTH
  60. + if (s2ram)
  61. + s2ram_resume();
  62. +#endif
  63. +
  64. if (orig_loglevel >= 0)
  65. set_kernel_console_loglevel(orig_loglevel);
  66. close_printk();