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
68eb0bde
Commit
68eb0bde
authored
Nov 14, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow specific signal to specific threads
parent
32ee8e46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
daemon.c
jni/core/daemon.c
+8
-0
proc_monitor.c
jni/magiskhide/proc_monitor.c
+13
-1
No files found.
jni/core/daemon.c
View file @
68eb0bde
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <pthread.h>
#include <signal.h>
#include <sys/un.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>
...
@@ -127,6 +128,13 @@ void start_daemon() {
...
@@ -127,6 +128,13 @@ void start_daemon() {
xdup2
(
fd
,
STDERR_FILENO
);
xdup2
(
fd
,
STDERR_FILENO
);
close
(
fd
);
close
(
fd
);
// Block user signals
sigset_t
block_set
;
sigemptyset
(
&
block_set
);
sigaddset
(
&
block_set
,
SIGUSR1
);
sigaddset
(
&
block_set
,
SIGUSR2
);
pthread_sigmask
(
SIG_SETMASK
,
&
block_set
,
NULL
);
struct
sockaddr_un
sun
;
struct
sockaddr_un
sun
;
fd
=
setup_socket
(
&
sun
);
fd
=
setup_socket
(
&
sun
);
...
...
jni/magiskhide/proc_monitor.c
View file @
68eb0bde
...
@@ -149,6 +149,13 @@ exit:
...
@@ -149,6 +149,13 @@ exit:
}
}
void
proc_monitor
()
{
void
proc_monitor
()
{
// Unblock user signals
sigset_t
block_set
;
sigemptyset
(
&
block_set
);
sigaddset
(
&
block_set
,
TERM_THREAD
);
sigaddset
(
&
block_set
,
HIDE_DONE
);
pthread_sigmask
(
SIG_UNBLOCK
,
&
block_set
,
NULL
);
// Register the cancel signal
// Register the cancel signal
struct
sigaction
act
;
struct
sigaction
act
;
memset
(
&
act
,
0
,
sizeof
(
act
));
memset
(
&
act
,
0
,
sizeof
(
act
));
...
@@ -188,7 +195,12 @@ void proc_monitor() {
...
@@ -188,7 +195,12 @@ void proc_monitor() {
xpipe2
(
pipefd
,
O_CLOEXEC
);
xpipe2
(
pipefd
,
O_CLOEXEC
);
logcat_events
[
HIDE_EVENT
]
=
pipefd
[
1
];
logcat_events
[
HIDE_EVENT
]
=
pipefd
[
1
];
for
(
char
*
log
,
*
line
;
xxread
(
pipefd
[
0
],
&
log
,
sizeof
(
log
))
>
0
;
free
(
log
))
{
for
(
char
*
log
,
*
line
;
1
;
free
(
log
))
{
if
(
read
(
pipefd
[
0
],
&
log
,
sizeof
(
log
))
!=
sizeof
(
log
))
{
/* It might be interrupted */
log
=
NULL
;
continue
;
}
char
*
ss
;
char
*
ss
;
if
((
ss
=
strstr
(
log
,
"am_proc_start"
))
&&
(
ss
=
strchr
(
ss
,
'['
)))
{
if
((
ss
=
strstr
(
log
,
"am_proc_start"
))
&&
(
ss
=
strchr
(
ss
,
'['
)))
{
int
pid
,
ret
,
comma
=
0
;
int
pid
,
ret
,
comma
=
0
;
...
...
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