Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
bb156710
Commit
bb156710
authored
May 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sleep when there is nothing to wait
parent
21984fac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
proc_monitor.cpp
native/jni/magiskhide/proc_monitor.cpp
+17
-9
No files found.
native/jni/magiskhide/proc_monitor.cpp
View file @
bb156710
...
...
@@ -70,19 +70,15 @@ static int parse_ppid(int pid) {
return
ppid
;
}
static
long
xptrace
(
bool
log
,
int
request
,
pid_t
pid
,
void
*
addr
,
void
*
data
)
{
static
inline
long
xptrace
(
int
request
,
pid_t
pid
,
void
*
addr
,
void
*
data
)
{
long
ret
=
ptrace
(
request
,
pid
,
addr
,
data
);
if
(
log
&&
ret
==
-
1
)
if
(
ret
<
0
)
PLOGE
(
"ptrace %d"
,
pid
);
return
ret
;
}
static
long
xptrace
(
int
request
,
pid_t
pid
,
void
*
addr
,
void
*
data
)
{
return
xptrace
(
true
,
request
,
pid
,
addr
,
data
);
}
static
long
xptrace
(
int
request
,
pid_t
pid
,
void
*
addr
=
nullptr
,
intptr_t
data
=
0
)
{
return
xptrace
(
true
,
request
,
pid
,
addr
,
reinterpret_cast
<
void
*>
(
data
));
static
inline
long
xptrace
(
int
request
,
pid_t
pid
,
void
*
addr
=
nullptr
,
intptr_t
data
=
0
)
{
return
xptrace
(
request
,
pid
,
addr
,
reinterpret_cast
<
void
*>
(
data
));
}
static
bool
parse_packages_xml
(
string_view
s
)
{
...
...
@@ -254,6 +250,7 @@ static void inotify_event(int) {
uid_proc_map
.
clear
();
file_readline
(
"/data/system/packages.xml"
,
parse_packages_xml
,
true
);
}
else
if
(
event
->
mask
&
IN_ACCESS
)
{
LOGD
(
"proc_monitor: app_process access
\n
"
);
check_zygote
();
}
}
...
...
@@ -409,8 +406,19 @@ void proc_monitor() {
for
(;;)
{
const
int
pid
=
waitpid
(
-
1
,
&
status
,
__WALL
|
__WNOTHREAD
);
if
(
pid
<
0
)
if
(
pid
<
0
)
{
if
(
errno
==
ECHILD
)
{
/* This mean we have nothing to wait, sleep
* and wait till signal interruption */
LOGD
(
"proc_monitor: nothing to monitor, wait for signal
\n
"
);
struct
timespec
timespec
=
{
.
tv_sec
=
INT_MAX
,
.
tv_nsec
=
0
};
nanosleep
(
&
timespec
,
nullptr
);
}
continue
;
}
bool
detach
=
false
;
RunFinally
detach_task
([
&
]()
->
void
{
if
(
detach
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment