summaryrefslogtreecommitdiff
path: root/Cytore.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Cytore.hpp')
-rw-r--r--Cytore.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Cytore.hpp b/Cytore.hpp
index fb17aaa..a682a9c 100644
--- a/Cytore.hpp
+++ b/Cytore.hpp
@@ -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) {