diff options
-rw-r--r-- | Cytore.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -26,6 +26,7 @@ #include <sys/mman.h> #include <sys/stat.h> +#include <sys/xattr.h> #include <cstdio> #include <cstdlib> @@ -212,6 +213,13 @@ class File { _assert(unlink(path) == 0); goto open; } + // Ensure com.apple.runningboard.can-suspend-locked xattr is present to keep iOS15+ from killing on suspend + uint8_t value = 0; + int xattrSize = fgetxattr(file_, "com.apple.runningboard.can-suspend-locked", &value, sizeof(value), 0, 0); + if (xattrSize == -1 || value == 0) { + value = 1; + fsetxattr(file_, "com.apple.runningboard.can-suspend-locked", &value, sizeof(value), 0, 0); + } } bool Reserve(size_t capacity) { |