mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Offset pid_set by 1
PID starts at 1, not 0
This commit is contained in:
parent
ade1597e03
commit
b14a260827
@ -289,5 +289,4 @@ void test_proc_monitor() {
|
||||
if (procfp == nullptr && (procfp = opendir("/proc")) == nullptr)
|
||||
exit(1);
|
||||
proc_monitor();
|
||||
exit(0);
|
||||
}
|
||||
|
@ -35,7 +35,16 @@ static map<int, vector<string_view>> uid_proc_map; /* uid -> list of process */
|
||||
pthread_mutex_t monitor_lock;
|
||||
|
||||
#define PID_MAX 32768
|
||||
static bitset<PID_MAX> attaches; /* true if pid is monitored */
|
||||
struct pid_set {
|
||||
bitset<PID_MAX>::const_reference operator[](size_t pos) const { return set[pos - 1]; }
|
||||
bitset<PID_MAX>::reference operator[](size_t pos) { return set[pos - 1]; }
|
||||
void reset() { set.reset(); }
|
||||
private:
|
||||
bitset<PID_MAX> set;
|
||||
};
|
||||
|
||||
// true if pid is monitored
|
||||
pid_set attaches;
|
||||
|
||||
/********
|
||||
* Utils
|
||||
|
Loading…
Reference in New Issue
Block a user