mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-17 07:12:32 -08:00
Avoid hardcoding max fd size
Android changed max fd limit to 32768 since Android 9:
cb5fccc83c
Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <sys/mount.h>
|
||||
#include <sys/resource.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unwind.h>
|
||||
#include <span>
|
||||
@@ -217,6 +218,7 @@ DCL_HOOK_FUNC(static int, pthread_attr_destroy, void *target) {
|
||||
|
||||
ZygiskContext::ZygiskContext(JNIEnv *env, void *args) :
|
||||
env(env), args{args}, process(nullptr), pid(-1), flags(0), info_flags(0),
|
||||
allowed_fds([] static { rlimit r{32768, 32768}; getrlimit(RLIMIT_NOFILE, &r); return r.rlim_max; }()),
|
||||
hook_info_lock(PTHREAD_MUTEX_INITIALIZER) { g_ctx = this; }
|
||||
|
||||
ZygiskContext::~ZygiskContext() {
|
||||
|
||||
Reference in New Issue
Block a user