€•‹‹Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ)/translations/zh_CN/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/zh_TW/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/it_IT/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ja_JP/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ko_KR/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/pt_BR/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/sp_SP/power/userland-swsusp”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ5Documentation for userland software suspend interface”h]”hŒ5Documentation for userland software suspend interface”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒC/var/lib/git/docbuild/linux/Documentation/power/userland-swsusp.rst”h´KubhŒ block_quote”“”)”}”(hŒ)(C) 2006 Rafael J. Wysocki ”h]”hŒenumerated_list”“”)”}”(hhh]”hŒ list_item”“”)”}”(hŒ%2006 Rafael J. Wysocki ”h]”hŒ paragraph”“”)”}”(hŒ$2006 Rafael J. Wysocki ”h]”(hŒ2006 Rafael J. Wysocki <”…””}”(hhÞh²hh³Nh´NubhŒ reference”“”)”}”(hŒ rjw@sisk.pl”h]”hŒ rjw@sisk.pl”…””}”(hhèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:rjw@sisk.pl”uh1hæhhÞubhŒ>”…””}”(hhÞh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhØubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhhÓubah}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œ upperalpha”Œprefix”Œ(”Œsuffix”Œ)”Œstart”Kuh1hÑhhÍubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÝ)”}”(hŒ?First, the warnings at the beginning of swsusp.txt still apply.”h]”hŒ?First, the warnings at the beginning of swsusp.txt still apply.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hŒTSecond, you should read the FAQ in swsusp.txt _now_ if you have not done it already.”h]”hŒTSecond, you should read the FAQ in swsusp.txt _now_ if you have not done it already.”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hh·h²hubhÝ)”}”(hXMNow, to use the userland interface for software suspend you need special utilities that will read/write the system memory snapshot from/to the kernel. Such utilities are available, for example, from . You may want to have a look at them if you are going to develop your own suspend/resume utilities.”h]”(hŒÉNow, to use the userland interface for software suspend you need special utilities that will read/write the system memory snapshot from/to the kernel. Such utilities are available, for example, from <”…””}”(hj7h²hh³Nh´Nubhç)”}”(hŒhttp://suspend.sourceforge.net”h]”hŒhttp://suspend.sourceforge.net”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jAuh1hæhj7ubhŒf>. You may want to have a look at them if you are going to develop your own suspend/resume utilities.”…””}”(hj7h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hh·h²hubhÝ)”}”(hX>The interface consists of a character device providing the open(), release(), read(), and write() operations as well as several ioctl() commands defined in include/linux/suspend_ioctls.h . The major and minor numbers of the device are, respectively, 10 and 231, and they can be read from /sys/class/misc/snapshot/dev.”h]”hX>The interface consists of a character device providing the open(), release(), read(), and write() operations as well as several ioctl() commands defined in include/linux/suspend_ioctls.h . The major and minor numbers of the device are, respectively, 10 and 231, and they can be read from /sys/class/misc/snapshot/dev.”…””}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hX8The device can be open either for reading or for writing. If open for reading, it is considered to be in the suspend mode. Otherwise it is assumed to be in the resume mode. The device cannot be open for simultaneous reading and writing. It is also impossible to have the device open more than once at a time.”h]”hX8The device can be open either for reading or for writing. If open for reading, it is considered to be in the suspend mode. Otherwise it is assumed to be in the resume mode. The device cannot be open for simultaneous reading and writing. It is also impossible to have the device open more than once at a time.”…””}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hŒ‹Even opening the device has side effects. Data structures are allocated, and PM_HIBERNATION_PREPARE / PM_RESTORE_PREPARE chains are called.”h]”hŒ‹Even opening the device has side effects. Data structures are allocated, and PM_HIBERNATION_PREPARE / PM_RESTORE_PREPARE chains are called.”…””}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hŒ2The ioctl() commands recognized by the device are:”h]”hŒ2The ioctl() commands recognized by the device are:”…””}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K"hh·h²hubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ£SNAPSHOT_FREEZE freeze user space processes (the current process is not frozen); this is required for SNAPSHOT_CREATE_IMAGE and SNAPSHOT_ATOMIC_RESTORE to succeed ”h]”(hŒterm”“”)”}”(hŒSNAPSHOT_FREEZE”h]”hŒSNAPSHOT_FREEZE”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´K'hj—ubhŒ definition”“”)”}”(hhh]”hÝ)”}”(hŒ’freeze user space processes (the current process is not frozen); this is required for SNAPSHOT_CREATE_IMAGE and SNAPSHOT_ATOMIC_RESTORE to succeed”h]”hŒ’freeze user space processes (the current process is not frozen); this is required for SNAPSHOT_CREATE_IMAGE and SNAPSHOT_ATOMIC_RESTORE to succeed”…””}”(hj°h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K%hj­ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hj—ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´K'hj’ubj–)”}”(hŒFSNAPSHOT_UNFREEZE thaw user space processes frozen by SNAPSHOT_FREEZE ”h]”(jœ)”}”(hŒSNAPSHOT_UNFREEZE”h]”hŒSNAPSHOT_UNFREEZE”…””}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´K*hjÊubj¬)”}”(hhh]”hÝ)”}”(hŒ3thaw user space processes frozen by SNAPSHOT_FREEZE”h]”hŒ3thaw user space processes frozen by SNAPSHOT_FREEZE”…””}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K*hjÜubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjÊubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´K*hj’h²hubj–)”}”(hXÕSNAPSHOT_CREATE_IMAGE create a snapshot of the system memory; the last argument of ioctl() should be a pointer to an int variable, the value of which will indicate whether the call returned after creating the snapshot (1) or after restoring the system memory state from it (0) (after resume the system finds itself finishing the SNAPSHOT_CREATE_IMAGE ioctl() again); after the snapshot has been created the read() operation can be used to transfer it out of the kernel ”h]”(jœ)”}”(hŒSNAPSHOT_CREATE_IMAGE”h]”hŒSNAPSHOT_CREATE_IMAGE”…””}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´K4hjùubj¬)”}”(hhh]”hÝ)”}”(hX¾create a snapshot of the system memory; the last argument of ioctl() should be a pointer to an int variable, the value of which will indicate whether the call returned after creating the snapshot (1) or after restoring the system memory state from it (0) (after resume the system finds itself finishing the SNAPSHOT_CREATE_IMAGE ioctl() again); after the snapshot has been created the read() operation can be used to transfer it out of the kernel”h]”hX¾create a snapshot of the system memory; the last argument of ioctl() should be a pointer to an int variable, the value of which will indicate whether the call returned after creating the snapshot (1) or after restoring the system memory state from it (0) (after resume the system finds itself finishing the SNAPSHOT_CREATE_IMAGE ioctl() again); after the snapshot has been created the read() operation can be used to transfer it out of the kernel”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjùubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´K4hj’h²hubj–)”}”(hXSNAPSHOT_ATOMIC_RESTORE restore the system memory state from the uploaded snapshot image; before calling it you should transfer the system memory snapshot back to the kernel using the write() operation; this call will not succeed if the snapshot image is not available to the kernel ”h]”(jœ)”}”(hŒSNAPSHOT_ATOMIC_RESTORE”h]”hŒSNAPSHOT_ATOMIC_RESTORE”…””}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´K;hj(ubj¬)”}”(hhh]”hÝ)”}”(hXrestore the system memory state from the uploaded snapshot image; before calling it you should transfer the system memory snapshot back to the kernel using the write() operation; this call will not succeed if the snapshot image is not available to the kernel”h]”hXrestore the system memory state from the uploaded snapshot image; before calling it you should transfer the system memory snapshot back to the kernel using the write() operation; this call will not succeed if the snapshot image is not available to the kernel”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K7hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hj(ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´K;hj’h²hubj–)”}”(hŒ;SNAPSHOT_FREE free memory allocated for the snapshot image ”h]”(jœ)”}”(hŒ SNAPSHOT_FREE”h]”hŒ SNAPSHOT_FREE”…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´K>hjWubj¬)”}”(hhh]”hÝ)”}”(hŒ,free memory allocated for the snapshot image”h]”hŒ,free memory allocated for the snapshot image”…””}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K>hjiubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjWubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´K>hj’h²hubj–)”}”(hŒòSNAPSHOT_PREF_IMAGE_SIZE set the preferred maximum size of the image (the kernel will do its best to ensure the image size will not exceed this number, but if it turns out to be impossible, the kernel will create the smallest image possible) ”h]”(jœ)”}”(hŒSNAPSHOT_PREF_IMAGE_SIZE”h]”hŒSNAPSHOT_PREF_IMAGE_SIZE”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KDhj†ubj¬)”}”(hhh]”hÝ)”}”(hŒØset the preferred maximum size of the image (the kernel will do its best to ensure the image size will not exceed this number, but if it turns out to be impossible, the kernel will create the smallest image possible)”h]”hŒØset the preferred maximum size of the image (the kernel will do its best to ensure the image size will not exceed this number, but if it turns out to be impossible, the kernel will create the smallest image possible)”…””}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KAhj˜ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hj†ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´KDhj’h²hubj–)”}”(hŒ¼SNAPSHOT_GET_IMAGE_SIZE return the actual size of the hibernation image (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful) ”h]”(jœ)”}”(hŒSNAPSHOT_GET_IMAGE_SIZE”h]”hŒSNAPSHOT_GET_IMAGE_SIZE”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KIhjµubj¬)”}”(hhh]”hÝ)”}”(hŒ£return the actual size of the hibernation image (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful)”h]”hŒ£return the actual size of the hibernation image (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful)”…””}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KGhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjµubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´KIhj’h²hubj–)”}”(hŒºSNAPSHOT_AVAIL_SWAP_SIZE return the amount of available swap in bytes (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful) ”h]”(jœ)”}”(hŒSNAPSHOT_AVAIL_SWAP_SIZE”h]”hŒSNAPSHOT_AVAIL_SWAP_SIZE”…””}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KNhjäubj¬)”}”(hhh]”hÝ)”}”(hŒ return the amount of available swap in bytes (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful)”h]”hŒ return the amount of available swap in bytes (the last argument should be a pointer to a loff_t variable that will contain the result if the call is successful)”…””}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KLhjöubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjäubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´KNhj’h²hubj–)”}”(hŒÆSNAPSHOT_ALLOC_SWAP_PAGE allocate a swap page from the resume partition (the last argument should be a pointer to a loff_t variable that will contain the swap page offset if the call is successful) ”h]”(jœ)”}”(hŒSNAPSHOT_ALLOC_SWAP_PAGE”h]”hŒSNAPSHOT_ALLOC_SWAP_PAGE”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KShjubj¬)”}”(hhh]”hÝ)”}”(hŒ¬allocate a swap page from the resume partition (the last argument should be a pointer to a loff_t variable that will contain the swap page offset if the call is successful)”h]”hŒ¬allocate a swap page from the resume partition (the last argument should be a pointer to a loff_t variable that will contain the swap page offset if the call is successful)”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KQhj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´KShj’h²hubj–)”}”(hŒSSNAPSHOT_FREE_SWAP_PAGES free all swap pages allocated by SNAPSHOT_ALLOC_SWAP_PAGE ”h]”(jœ)”}”(hŒSNAPSHOT_FREE_SWAP_PAGES”h]”hŒSNAPSHOT_FREE_SWAP_PAGES”…””}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KWhjBubj¬)”}”(hhh]”hÝ)”}”(hŒ9free all swap pages allocated by SNAPSHOT_ALLOC_SWAP_PAGE”h]”hŒ9free all swap pages allocated by SNAPSHOT_ALLOC_SWAP_PAGE”…””}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KVhjTubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjBubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´KWhj’h²hubj–)”}”(hXçSNAPSHOT_SET_SWAP_AREA set the resume partition and the offset (in units) from the beginning of the partition at which the swap header is located (the last ioctl() argument should point to a struct resume_swap_area, as defined in kernel/power/suspend_ioctls.h, containing the resume device specification and the offset); for swap partitions the offset is always 0, but it is different from zero for swap files (see Documentation/power/swsusp-and-swap-files.rst for details). ”h]”(jœ)”}”(hŒSNAPSHOT_SET_SWAP_AREA”h]”hŒSNAPSHOT_SET_SWAP_AREA”…””}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´Kahjqubj¬)”}”(hhh]”hÝ)”}”(hXÏset the resume partition and the offset (in units) from the beginning of the partition at which the swap header is located (the last ioctl() argument should point to a struct resume_swap_area, as defined in kernel/power/suspend_ioctls.h, containing the resume device specification and the offset); for swap partitions the offset is always 0, but it is different from zero for swap files (see Documentation/power/swsusp-and-swap-files.rst for details).”h]”hXÏset the resume partition and the offset (in units) from the beginning of the partition at which the swap header is located (the last ioctl() argument should point to a struct resume_swap_area, as defined in kernel/power/suspend_ioctls.h, containing the resume device specification and the offset); for swap partitions the offset is always 0, but it is different from zero for swap files (see Documentation/power/swsusp-and-swap-files.rst for details).”…””}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KZhjƒubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjqubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´Kahj’h²hubj–)”}”(hŒSNAPSHOT_PLATFORM_SUPPORT enable/disable the hibernation platform support, depending on the argument value (enable, if the argument is nonzero) ”h]”(jœ)”}”(hŒSNAPSHOT_PLATFORM_SUPPORT”h]”hŒSNAPSHOT_PLATFORM_SUPPORT”…””}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´Kehj ubj¬)”}”(hhh]”hÝ)”}”(hŒuenable/disable the hibernation platform support, depending on the argument value (enable, if the argument is nonzero)”h]”hŒuenable/disable the hibernation platform support, depending on the argument value (enable, if the argument is nonzero)”…””}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kdhj²ubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´Kehj’h²hubj–)”}”(hŒ…SNAPSHOT_POWER_OFF make the kernel transition the system to the hibernation state (eg. ACPI S4) using the platform (eg. ACPI) driver ”h]”(jœ)”}”(hŒSNAPSHOT_POWER_OFF”h]”hŒSNAPSHOT_POWER_OFF”…””}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´KihjÏubj¬)”}”(hhh]”hÝ)”}”(hŒqmake the kernel transition the system to the hibernation state (eg. ACPI S4) using the platform (eg. ACPI) driver”h]”hŒqmake the kernel transition the system to the hibernation state (eg. ACPI S4) using the platform (eg. ACPI) driver”…””}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khhjáubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjÏubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´Kihj’h²hubj–)”}”(hXkSNAPSHOT_S2RAM suspend to RAM; using this call causes the kernel to immediately enter the suspend-to-RAM state, so this call must always be preceded by the SNAPSHOT_FREEZE call and it is also necessary to use the SNAPSHOT_UNFREEZE call after the system wakes up. This call is needed to implement the suspend-to-both mechanism in which the suspend image is first created, as though the system had been suspended to disk, and then the system is suspended to RAM (this makes it possible to resume the system from RAM if there's enough battery power or restore its state on the basis of the saved suspend image otherwise) ”h]”(jœ)”}”(hŒSNAPSHOT_S2RAM”h]”hŒSNAPSHOT_S2RAM”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j›h³hÊh´Kthjþubj¬)”}”(hhh]”hÝ)”}”(hX[suspend to RAM; using this call causes the kernel to immediately enter the suspend-to-RAM state, so this call must always be preceded by the SNAPSHOT_FREEZE call and it is also necessary to use the SNAPSHOT_UNFREEZE call after the system wakes up. This call is needed to implement the suspend-to-both mechanism in which the suspend image is first created, as though the system had been suspended to disk, and then the system is suspended to RAM (this makes it possible to resume the system from RAM if there's enough battery power or restore its state on the basis of the saved suspend image otherwise)”h]”hX]suspend to RAM; using this call causes the kernel to immediately enter the suspend-to-RAM state, so this call must always be preceded by the SNAPSHOT_FREEZE call and it is also necessary to use the SNAPSHOT_UNFREEZE call after the system wakes up. This call is needed to implement the suspend-to-both mechanism in which the suspend image is first created, as though the system had been suspended to disk, and then the system is suspended to RAM (this makes it possible to resume the system from RAM if there’s enough battery power or restore its state on the basis of the saved suspend image otherwise)”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Klhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j«hjþubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•h³hÊh´Kthj’h²hubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhh·h²hh³hÊh´NubhÝ)”}”(hŒ|The device's read() operation can be used to transfer the snapshot image from the kernel. It has the following limitations:”h]”hŒ~The device’s read() operation can be used to transfer the snapshot image from the kernel. It has the following limitations:”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kvhh·h²hubhŒ bullet_list”“”)”}”(hhh]”(h×)”}”(hŒ=you cannot read() more than one virtual memory page at a time”h]”hÝ)”}”(hjHh]”hŒ=you cannot read() more than one virtual memory page at a time”…””}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KyhjFubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjCh²hh³hÊh´Nubh×)”}”(hŒ³read()s across page boundaries are impossible (ie. if you read() 1/2 of a page in the previous call, you will only be able to read() **at most** 1/2 of the page in the next call) ”h]”hÝ)”}”(hŒ²read()s across page boundaries are impossible (ie. if you read() 1/2 of a page in the previous call, you will only be able to read() **at most** 1/2 of the page in the next call)”h]”(hŒ…read()s across page boundaries are impossible (ie. if you read() 1/2 of a page in the previous call, you will only be able to read() ”…””}”(hjah²hh³Nh´NubhŒstrong”“”)”}”(hŒ **at most**”h]”hŒat most”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jihjaubhŒ" 1/2 of the page in the next call)”…””}”(hjah²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kzhj]ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjCh²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jAh³hÊh´Kyhh·h²hubhÝ)”}”(hŒ–The device's write() operation is used for uploading the system memory snapshot into the kernel. It has the same limitations as the read() operation.”h]”hŒ˜The device’s write() operation is used for uploading the system memory snapshot into the kernel. It has the same limitations as the read() operation.”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K~hh·h²hubhÝ)”}”(hX„The release() operation frees all memory allocated for the snapshot image and all swap pages allocated with SNAPSHOT_ALLOC_SWAP_PAGE (if any). Thus it is not necessary to use either SNAPSHOT_FREE or SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are still frozen when the device is being closed).”h]”hX„The release() operation frees all memory allocated for the snapshot image and all swap pages allocated with SNAPSHOT_ALLOC_SWAP_PAGE (if any). Thus it is not necessary to use either SNAPSHOT_FREE or SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are still frozen when the device is being closed).”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hXàCurrently it is assumed that the userland utilities reading/writing the snapshot image from/to the kernel will use a swap partition, called the resume partition, or a swap file as storage space (if a swap file is used, the resume partition is the partition that holds this file). However, this is not really required, as they can use, for example, a special (blank) suspend partition or a file on a partition that is unmounted before SNAPSHOT_CREATE_IMAGE and mounted afterwards.”h]”hXàCurrently it is assumed that the userland utilities reading/writing the snapshot image from/to the kernel will use a swap partition, called the resume partition, or a swap file as storage space (if a swap file is used, the resume partition is the partition that holds this file). However, this is not really required, as they can use, for example, a special (blank) suspend partition or a file on a partition that is unmounted before SNAPSHOT_CREATE_IMAGE and mounted afterwards.”…””}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kˆhh·h²hubhÝ)”}”(hŒßThese utilities MUST NOT make any assumptions regarding the ordering of data within the snapshot image. The contents of the image are entirely owned by the kernel and its structure may be changed in future kernel releases.”h]”hŒßThese utilities MUST NOT make any assumptions regarding the ordering of data within the snapshot image. The contents of the image are entirely owned by the kernel and its structure may be changed in future kernel releases.”…””}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khh·h²hubhÝ)”}”(hXThe snapshot image MUST be written to the kernel unaltered (ie. all of the image data, metadata and header MUST be written in _exactly_ the same amount, form and order in which they have been read). Otherwise, the behavior of the resumed system may be totally unpredictable.”h]”hXThe snapshot image MUST be written to the kernel unaltered (ie. all of the image data, metadata and header MUST be written in _exactly_ the same amount, form and order in which they have been read). Otherwise, the behavior of the resumed system may be totally unpredictable.”…””}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K”hh·h²hubhÝ)”}”(hX¨While executing SNAPSHOT_ATOMIC_RESTORE the kernel checks if the structure of the snapshot image is consistent with the information stored in the image header. If any inconsistencies are detected, SNAPSHOT_ATOMIC_RESTORE will not succeed. Still, this is not a fool-proof mechanism and the userland utilities using the interface SHOULD use additional means, such as checksums, to ensure the integrity of the snapshot image.”h]”hX¨While executing SNAPSHOT_ATOMIC_RESTORE the kernel checks if the structure of the snapshot image is consistent with the information stored in the image header. If any inconsistencies are detected, SNAPSHOT_ATOMIC_RESTORE will not succeed. Still, this is not a fool-proof mechanism and the userland utilities using the interface SHOULD use additional means, such as checksums, to ensure the integrity of the snapshot image.”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K™hh·h²hubhÝ)”}”(hŒ‚The suspending and resuming utilities MUST lock themselves in memory, preferably using mlockall(), before calling SNAPSHOT_FREEZE.”h]”hŒ‚The suspending and resuming utilities MUST lock themselves in memory, preferably using mlockall(), before calling SNAPSHOT_FREEZE.”…””}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hh·h²hubhÝ)”}”(hŒ°The suspending utility MUST check the value stored by SNAPSHOT_CREATE_IMAGE in the memory location pointed to by the last argument of ioctl() and proceed in accordance with it:”h]”hŒ°The suspending utility MUST check the value stored by SNAPSHOT_CREATE_IMAGE in the memory location pointed to by the last argument of ioctl() and proceed in accordance with it:”…””}”(hjóh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K£hh·h²hubhÒ)”}”(hhh]”(h×)”}”(hX“If the value is 1 (ie. the system memory snapshot has just been created and the system is ready for saving it): (a) The suspending utility MUST NOT close the snapshot device _unless_ the whole suspend procedure is to be cancelled, in which case, if the snapshot image has already been saved, the suspending utility SHOULD destroy it, preferably by zapping its header. If the suspend is not to be cancelled, the system MUST be powered off or rebooted after the snapshot image has been saved. (b) The suspending utility SHOULD NOT attempt to perform any file system operations (including reads) on the file systems that were mounted before SNAPSHOT_CREATE_IMAGE has been called. However, it MAY mount a file system that was not mounted at that time and perform some operations on it (eg. use it for saving the image). ”h]”(hÝ)”}”(hŒoIf the value is 1 (ie. the system memory snapshot has just been created and the system is ready for saving it):”h]”hŒoIf the value is 1 (ie. the system memory snapshot has just been created and the system is ready for saving it):”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K§hjubhÒ)”}”(hhh]”(h×)”}”(hXwThe suspending utility MUST NOT close the snapshot device _unless_ the whole suspend procedure is to be cancelled, in which case, if the snapshot image has already been saved, the suspending utility SHOULD destroy it, preferably by zapping its header. If the suspend is not to be cancelled, the system MUST be powered off or rebooted after the snapshot image has been saved.”h]”hÝ)”}”(hXwThe suspending utility MUST NOT close the snapshot device _unless_ the whole suspend procedure is to be cancelled, in which case, if the snapshot image has already been saved, the suspending utility SHOULD destroy it, preferably by zapping its header. If the suspend is not to be cancelled, the system MUST be powered off or rebooted after the snapshot image has been saved.”h]”hXwThe suspending utility MUST NOT close the snapshot device _unless_ the whole suspend procedure is to be cancelled, in which case, if the snapshot image has already been saved, the suspending utility SHOULD destroy it, preferably by zapping its header. If the suspend is not to be cancelled, the system MUST be powered off or rebooted after the snapshot image has been saved.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kªhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjubh×)”}”(hXBThe suspending utility SHOULD NOT attempt to perform any file system operations (including reads) on the file systems that were mounted before SNAPSHOT_CREATE_IMAGE has been called. However, it MAY mount a file system that was not mounted at that time and perform some operations on it (eg. use it for saving the image). ”h]”hÝ)”}”(hXAThe suspending utility SHOULD NOT attempt to perform any file system operations (including reads) on the file systems that were mounted before SNAPSHOT_CREATE_IMAGE has been called. However, it MAY mount a file system that was not mounted at that time and perform some operations on it (eg. use it for saving the image).”h]”hXAThe suspending utility SHOULD NOT attempt to perform any file system operations (including reads) on the file systems that were mounted before SNAPSHOT_CREATE_IMAGE has been called. However, it MAY mount a file system that was not mounted at that time and perform some operations on it (eg. use it for saving the image).”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K±hj1ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjubeh}”(h]”h ]”h"]”h$]”h&]”jŒ loweralpha”jjjjuh1hÑhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjh²hh³Nh´Nubh×)”}”(hŒãIf the value is 0 (ie. the system state has just been restored from the snapshot image), the suspending utility MUST close the snapshot device. Afterwards it will be treated as a regular userland process, so it need not exit. ”h]”hÝ)”}”(hŒâIf the value is 0 (ie. the system state has just been restored from the snapshot image), the suspending utility MUST close the snapshot device. Afterwards it will be treated as a regular userland process, so it need not exit.”h]”hŒâIf the value is 0 (ie. the system state has just been restored from the snapshot image), the suspending utility MUST close the snapshot device. Afterwards it will be treated as a regular userland process, so it need not exit.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¸hjVubah}”(h]”h ]”h"]”h$]”h&]”uh1hÖhjh²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jŒarabic”jhjŒ.”uh1hÑhh·h²hh³hÊh´K§ubhÝ)”}”(hŒ´The resuming utility SHOULD NOT attempt to mount any file systems that could be mounted before suspend and SHOULD NOT attempt to perform any operations involving such file systems.”h]”hŒ´The resuming utility SHOULD NOT attempt to mount any file systems that could be mounted before suspend and SHOULD NOT attempt to perform any operations involving such file systems.”…””}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K½hh·h²hubhÝ)”}”(hŒ-For details, please refer to the source code.”h]”hŒ-For details, please refer to the source code.”…””}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÁhh·h²hubeh}”(h]”Œ5documentation-for-userland-software-suspend-interface”ah ]”h"]”Œ5documentation for userland software suspend interface”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j½Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”j—j”sŒ nametypes”}”j—‰sh}”j”h·sŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”hŒsystem_message”“”)”}”(hhh]”hÝ)”}”(hŒ:Enumerated list start value not ordinal-1: "C" (ordinal 3)”h]”hŒ>Enumerated list start value not ordinal-1: “C†(ordinal 3)”…””}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhj!ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÊŒline”Kuh1jhhÍubaŒtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.