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
9275975b
Commit
9275975b
authored
Jan 26, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-organize functions
parent
b3e0d5ba
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
22 deletions
+22
-22
log_daemon.cpp
native/jni/daemon/log_daemon.cpp
+2
-2
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+1
-1
cpio.cpp
native/jni/magiskboot/cpio.cpp
+1
-1
utils.h
native/jni/utils/include/utils.h
+16
-16
misc.cpp
native/jni/utils/misc.cpp
+2
-2
No files found.
native/jni/daemon/log_daemon.cpp
View file @
9275975b
...
...
@@ -86,7 +86,7 @@ static void *logcat_thread(void *) {
char
line
[
4096
];
while
(
1
)
{
// Start logcat
log_pid
=
exec_
array
(
false
,
&
log_fd
,
nullptr
,
log_cmd
.
data
());
log_pid
=
exec_
command
(
false
,
&
log_fd
,
nullptr
,
log_cmd
.
data
());
FILE
*
logs
=
fdopen
(
log_fd
,
"r"
);
while
(
fgets
(
line
,
sizeof
(
line
),
logs
))
{
if
(
line
[
0
]
==
'-'
)
...
...
@@ -107,7 +107,7 @@ static void *logcat_thread(void *) {
LOGI
(
"magisklogd: logcat output EOF"
);
// Clear buffer
log_pid
=
exec_
array
(
false
,
nullptr
,
nullptr
,
clear_cmd
.
data
());
log_pid
=
exec_
command
(
false
,
nullptr
,
nullptr
,
clear_cmd
.
data
());
waitpid
(
log_pid
,
nullptr
,
0
);
}
}
...
...
native/jni/magiskboot/bootimg.cpp
View file @
9275975b
...
...
@@ -44,7 +44,7 @@ boot_img::~boot_img() {
#define CHROMEOS_RET 2
#define ELF32_RET 3
#define ELF64_RET 4
#define pos_align() pos = align(pos, page_size())
#define pos_align() pos =
do_
align(pos, page_size())
int
boot_img
::
parse_image
(
const
char
*
image
)
{
mmap_ro
(
image
,
(
void
**
)
&
map_addr
,
&
map_size
);
...
...
native/jni/magiskboot/cpio.cpp
View file @
9275975b
...
...
@@ -10,7 +10,7 @@
using
namespace
std
;
#define parse_align() lseek(fd, align(lseek(fd, 0, SEEK_CUR), 4), SEEK_SET)
#define parse_align() lseek(fd,
do_
align(lseek(fd, 0, SEEK_CUR), 4), SEEK_SET)
static
uint32_t
x8u
(
char
*
hex
)
{
uint32_t
val
,
inpos
=
8
,
outpos
;
...
...
native/jni/utils/include/utils.h
View file @
9275975b
...
...
@@ -12,19 +12,6 @@
#include <sys/stat.h>
#ifdef __cplusplus
#include <string>
#include <vector>
#define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != string::npos)
#define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
std
::
vector
<
std
::
string
>
file_to_vector
(
const
char
*
filename
);
char
*
strdup2
(
const
char
*
s
,
size_t
*
size
=
nullptr
);
int
exec_array
(
bool
err
,
int
*
fd
,
void
(
*
pre_exec
)(),
const
char
**
argv
);
int
exec_command
(
bool
err
,
int
*
fd
,
void
(
*
cb
)(),
const
char
*
argv0
,
...);
extern
"C"
{
#endif
...
...
@@ -94,7 +81,6 @@ int xpoll(struct pollfd *fds, nfds_t nfds, int timeout);
unsigned
get_shell_uid
();
unsigned
get_system_uid
();
unsigned
get_radio_uid
();
int
exec_command_sync
(
const
char
*
argv0
,
...);
int
fork_dont_care
();
void
gen_rand_str
(
char
*
buf
,
int
len
);
int
strend
(
const
char
*
s1
,
const
char
*
s2
);
...
...
@@ -109,8 +95,8 @@ int __fsetxattr(int fd, const char *name, const void *value, size_t size, int fl
// file.cpp
#define align(p, a) (((p) + (a) - 1) / (a) * (a))
#define align_off(p, a) (align(p, a) - (p))
#define
do_
align(p, a) (((p) + (a) - 1) / (a) * (a))
#define align_off(p, a) (
do_
align(p, a) - (p))
extern
const
char
**
excl_list
;
...
...
@@ -148,6 +134,20 @@ void write_zero(int fd, size_t size);
#ifdef __cplusplus
}
#include <string>
#include <vector>
#define str_contains(s, ss) ((ss) != nullptr && (s).find(ss) != string::npos)
#define str_starts(s, ss) ((ss) != nullptr && (s).compare(0, strlen(ss), ss) == 0)
std
::
vector
<
std
::
string
>
file_to_vector
(
const
char
*
filename
);
char
*
strdup2
(
const
char
*
s
,
size_t
*
size
=
nullptr
);
int
exec_command
(
bool
err
,
int
*
fd
,
void
(
*
pre_exec
)(),
const
char
**
argv
);
int
exec_command
(
bool
err
,
int
*
fd
,
void
(
*
cb
)(),
const
char
*
argv0
,
...);
int
exec_command_sync
(
const
char
*
argv0
,
...);
#endif
#endif
native/jni/utils/misc.cpp
View file @
9275975b
...
...
@@ -161,7 +161,7 @@ int __fsetxattr(int fd, const char *name, const void *value, size_t size, int fl
*fd >= 0 -> STDOUT (or STDERR) will be redirected to *fd
*pre_exec -> A callback function called after forking, before execvp
*/
int
exec_
array
(
bool
err
,
int
*
fd
,
void
(
*
pre_exec
)(
void
),
const
char
**
argv
)
{
int
exec_
command
(
bool
err
,
int
*
fd
,
void
(
*
pre_exec
)(
void
),
const
char
**
argv
)
{
int
pipefd
[
2
],
outfd
=
-
1
;
if
(
fd
)
{
...
...
@@ -207,7 +207,7 @@ static int v_exec_command(bool err, int *fd, void (*cb)(void), const char *argv0
for
(
const
char
*
arg
=
va_arg
(
argv
,
char
*
);
arg
;
arg
=
va_arg
(
argv
,
char
*
))
args
.
push_back
(
arg
);
args
.
push_back
(
nullptr
);
int
pid
=
exec_
array
(
err
,
fd
,
cb
,
args
.
data
());
int
pid
=
exec_
command
(
err
,
fd
,
cb
,
args
.
data
());
return
pid
;
}
...
...
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