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
8b84039f
Commit
8b84039f
authored
Feb 15, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run service scripts actually in parallel
parent
9430dbb9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
bootstages.cpp
native/jni/core/bootstages.cpp
+24
-12
No files found.
native/jni/core/bootstages.cpp
View file @
8b84039f
...
@@ -294,9 +294,8 @@ node_entry *node_entry::extract(const char *name) {
...
@@ -294,9 +294,8 @@ node_entry *node_entry::extract(const char *name) {
***********/
***********/
static
void
set_path
()
{
static
void
set_path
()
{
char
buffer
[
512
];
sprintf
(
buf
,
BBPATH
":%s"
,
getenv
(
"PATH"
));
sprintf
(
buffer
,
BBPATH
":%s"
,
getenv
(
"PATH"
));
setenv
(
"PATH"
,
buf
,
1
);
setenv
(
"PATH"
,
buffer
,
1
);
}
}
static
void
set_mirror_path
()
{
static
void
set_mirror_path
()
{
...
@@ -311,19 +310,25 @@ static void set_mirror_path() {
...
@@ -311,19 +310,25 @@ static void set_mirror_path() {
static
void
exec_common_script
(
const
char
*
stage
)
{
static
void
exec_common_script
(
const
char
*
stage
)
{
DIR
*
dir
;
DIR
*
dir
;
struct
dirent
*
entry
;
struct
dirent
*
entry
;
snprintf
(
buf2
,
PATH_MAX
,
"%s/%s.d"
,
SECURE_DIR
,
stage
);
sprintf
(
buf2
,
SECURE_DIR
"/%s.d"
,
stage
);
if
(
!
(
dir
=
xopendir
(
buf2
)))
if
(
!
(
dir
=
xopendir
(
buf2
)))
return
;
return
;
chdir
(
buf2
);
chdir
(
buf2
);
bool
pfs
=
strcmp
(
stage
,
"post-fs-data"
)
==
0
;
while
((
entry
=
xreaddir
(
dir
)))
{
while
((
entry
=
xreaddir
(
dir
)))
{
if
(
entry
->
d_type
==
DT_REG
)
{
if
(
entry
->
d_type
==
DT_REG
)
{
if
(
access
(
entry
->
d_name
,
X_OK
)
==
-
1
)
if
(
access
(
entry
->
d_name
,
X_OK
)
==
-
1
)
continue
;
continue
;
LOGI
(
"%s.d: exec [%s]
\n
"
,
stage
,
entry
->
d_name
);
LOGI
(
"%s.d: exec [%s]
\n
"
,
stage
,
entry
->
d_name
);
exec_t
exec
{
.
pre_exec
=
strcmp
(
stage
,
"post-fs-data"
)
?
set_path
:
set_mirror_path
};
exec_t
exec
{
.
pre_exec
=
pfs
?
set_mirror_path
:
set_path
,
.
fork
=
pfs
?
xfork
:
fork_dont_care
};
if
(
pfs
)
exec_command_sync
(
exec
,
MIRRDIR
"/system/bin/sh"
,
entry
->
d_name
);
exec_command_sync
(
exec
,
MIRRDIR
"/system/bin/sh"
,
entry
->
d_name
);
else
exec_command
(
exec
,
MIRRDIR
"/system/bin/sh"
,
entry
->
d_name
);
}
}
}
}
...
@@ -332,14 +337,21 @@ static void exec_common_script(const char* stage) {
...
@@ -332,14 +337,21 @@ static void exec_common_script(const char* stage) {
}
}
static
void
exec_module_script
(
const
char
*
stage
)
{
static
void
exec_module_script
(
const
char
*
stage
)
{
for
(
const
auto
&
m
:
module_list
)
{
bool
pfs
=
strcmp
(
stage
,
"post-fs-data"
)
==
0
;
const
auto
module
=
m
.
c_str
();
for
(
auto
&
m
:
module_list
)
{
snprintf
(
buf2
,
PATH_MAX
,
"%s/%s/%s.sh"
,
MODULEROOT
,
module
,
stage
);
const
char
*
module
=
m
.
c_str
();
sprintf
(
buf2
,
MODULEROOT
"/%s/%s.sh"
,
module
,
stage
);
if
(
access
(
buf2
,
F_OK
)
==
-
1
)
if
(
access
(
buf2
,
F_OK
)
==
-
1
)
continue
;
continue
;
LOGI
(
"%s: exec [%s.sh]
\n
"
,
module
,
stage
);
LOGI
(
"%s: exec [%s.sh]
\n
"
,
module
,
stage
);
exec_t
exec
{
.
pre_exec
=
strcmp
(
stage
,
"post-fs-data"
)
?
set_path
:
set_mirror_path
};
exec_t
exec
{
.
pre_exec
=
pfs
?
set_mirror_path
:
set_path
,
.
fork
=
pfs
?
xfork
:
fork_dont_care
};
if
(
pfs
)
exec_command_sync
(
exec
,
MIRRDIR
"/system/bin/sh"
,
buf2
);
exec_command_sync
(
exec
,
MIRRDIR
"/system/bin/sh"
,
buf2
);
else
exec_command
(
exec
,
MIRRDIR
"/system/bin/sh"
,
buf2
);
}
}
}
}
...
...
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