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
23d3e569
Commit
23d3e569
authored
May 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new util function
parent
6785dc49
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
bootstages.cpp
native/jni/core/bootstages.cpp
+3
-4
hide_utils.cpp
native/jni/magiskhide/hide_utils.cpp
+1
-4
utils.h
native/jni/utils/include/utils.h
+1
-0
misc.cpp
native/jni/utils/misc.cpp
+11
-0
No files found.
native/jni/core/bootstages.cpp
View file @
23d3e569
...
...
@@ -525,7 +525,7 @@ static void dump_logs() {
rename
(
LOGFILE
,
LOGFILE
".bak"
);
log_dump
=
true
;
// Start a daemon thread and wait indefinitely
new_daemon_thread
([](
auto
)
->
void
*
{
new_daemon_thread
([](
)
->
void
{
int
fd
=
xopen
(
LOGFILE
,
O_WRONLY
|
O_APPEND
|
O_CREAT
|
O_CLOEXEC
,
0644
);
exec_t
exec
{
.
fd
=
fd
,
...
...
@@ -535,10 +535,9 @@ static void dump_logs() {
close
(
fd
);
if
(
pid
<
0
)
{
log_dump
=
false
;
return
nullptr
;
}
}
else
{
waitpid
(
pid
,
nullptr
,
0
);
return
nullptr
;
}
});
}
...
...
native/jni/magiskhide/hide_utils.cpp
View file @
23d3e569
...
...
@@ -322,10 +322,7 @@ void auto_start_magiskhide() {
db_settings
dbs
;
get_db_settings
(
dbs
,
HIDE_CONFIG
);
if
(
dbs
[
HIDE_CONFIG
])
{
new_daemon_thread
([](
auto
)
->
void
*
{
launch_magiskhide
(
-
1
);
return
nullptr
;
});
new_daemon_thread
([]()
->
void
{
launch_magiskhide
(
-
1
);
});
}
}
...
...
native/jni/utils/include/utils.h
View file @
23d3e569
...
...
@@ -208,6 +208,7 @@ int parse_int(S __s) { return parse_int(__s.data()); }
int
new_daemon_thread
(
void
*
(
*
start_routine
)
(
void
*
),
void
*
arg
=
nullptr
,
const
pthread_attr_t
*
attr
=
nullptr
);
int
new_daemon_thread
(
std
::
function
<
void
()
>
&&
fn
);
struct
exec_t
{
bool
err
=
false
;
...
...
native/jni/utils/misc.cpp
View file @
23d3e569
...
...
@@ -200,6 +200,17 @@ int new_daemon_thread(void *(*start_routine) (void *), void *arg, const pthread_
return
ret
;
}
static
void
*
proxy_routine
(
void
*
fp
)
{
auto
fn
=
reinterpret_cast
<
std
::
function
<
void
()
>*>
(
fp
);
(
*
fn
)();
delete
fn
;
return
nullptr
;
}
int
new_daemon_thread
(
std
::
function
<
void
()
>
&&
fn
)
{
return
new_daemon_thread
(
proxy_routine
,
new
std
::
function
<
void
()
>
(
std
::
move
(
fn
)));
}
static
char
*
argv0
;
static
size_t
name_len
;
void
init_argv0
(
int
argc
,
char
**
argv
)
{
...
...
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