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
6ce37b44
Commit
6ce37b44
authored
Sep 26, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logging
parent
9cb1cf75
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
bootstages.c
jni/daemon/bootstages.c
+10
-7
log_monitor.c
jni/daemon/log_monitor.c
+1
-1
logging.h
jni/include/logging.h
+1
-4
misc.c
jni/utils/misc.c
+1
-1
No files found.
jni/daemon/bootstages.c
View file @
6ce37b44
...
@@ -315,7 +315,7 @@ static void clone_skeleton(struct node_entry *node) {
...
@@ -315,7 +315,7 @@ static void clone_skeleton(struct node_entry *node) {
// Copy symlinks directly
// Copy symlinks directly
cp_afc
(
buf2
,
buf
);
cp_afc
(
buf2
,
buf
);
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
LOG
D
(
"cplink: %s -> %s
\n
"
,
buf2
,
buf
);
LOG
I
(
"cplink: %s -> %s
\n
"
,
buf2
,
buf
);
#else
#else
LOGI
(
"cplink: %s
\n
"
,
buf
);
LOGI
(
"cplink: %s
\n
"
,
buf
);
#endif
#endif
...
@@ -414,7 +414,7 @@ static void mount_mirrors() {
...
@@ -414,7 +414,7 @@ static void mount_mirrors() {
xmkdir_p
(
MIRRDIR
"/system"
,
0755
);
xmkdir_p
(
MIRRDIR
"/system"
,
0755
);
xmount
(
buf
,
MIRRDIR
"/system"
,
"ext4"
,
MS_RDONLY
,
NULL
);
xmount
(
buf
,
MIRRDIR
"/system"
,
"ext4"
,
MS_RDONLY
,
NULL
);
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
LOG
D
(
"mount: %s -> %s
\n
"
,
buf
,
MIRRDIR
"/system"
);
LOG
I
(
"mount: %s -> %s
\n
"
,
buf
,
MIRRDIR
"/system"
);
#else
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/system"
);
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/system"
);
#endif
#endif
...
@@ -426,7 +426,7 @@ static void mount_mirrors() {
...
@@ -426,7 +426,7 @@ static void mount_mirrors() {
xmkdir_p
(
MIRRDIR
"/vendor"
,
0755
);
xmkdir_p
(
MIRRDIR
"/vendor"
,
0755
);
xmount
(
buf
,
MIRRDIR
"/vendor"
,
"ext4"
,
MS_RDONLY
,
NULL
);
xmount
(
buf
,
MIRRDIR
"/vendor"
,
"ext4"
,
MS_RDONLY
,
NULL
);
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
LOG
D
(
"mount: %s -> %s
\n
"
,
buf
,
MIRRDIR
"/vendor"
);
LOG
I
(
"mount: %s -> %s
\n
"
,
buf
,
MIRRDIR
"/vendor"
);
#else
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/vendor"
);
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
#endif
...
@@ -437,7 +437,7 @@ static void mount_mirrors() {
...
@@ -437,7 +437,7 @@ static void mount_mirrors() {
if
(
!
seperate_vendor
)
{
if
(
!
seperate_vendor
)
{
symlink
(
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
symlink
(
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
LOG
D
(
"link: %s -> %s
\n
"
,
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
LOG
I
(
"link: %s -> %s
\n
"
,
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
#else
#else
LOGI
(
"link: %s
\n
"
,
MIRRDIR
"/vendor"
);
LOGI
(
"link: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
#endif
...
@@ -563,10 +563,10 @@ void post_fs_data(int client) {
...
@@ -563,10 +563,10 @@ void post_fs_data(int client) {
monitor_logs
();
monitor_logs
();
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
//
Start debug logs in new process
//
Log everything initially
debug_log_fd
=
xopen
(
DEBUG_LOG
,
O_WRONLY
|
O_CREAT
|
O_CLOEXEC
|
O_TRUNC
,
0644
);
debug_log_fd
=
xopen
(
DEBUG_LOG
,
O_WRONLY
|
O_CREAT
|
O_CLOEXEC
|
O_TRUNC
,
0644
);
debug_log_pid
=
exec_command
(
0
,
&
debug_log_fd
,
NULL
,
"logcat"
,
"-v"
,
"brief"
,
NULL
);
xwrite
(
debug_log_fd
,
"Boot logs:
\n
"
,
11
);
close
(
debug_log_fd
);
debug_log_pid
=
exec_command
(
0
,
&
debug_log_fd
,
NULL
,
"logcat"
,
"-v"
,
"thread"
,
NULL
);
#endif
#endif
LOGI
(
"** post-fs-data mode running
\n
"
);
LOGI
(
"** post-fs-data mode running
\n
"
);
...
@@ -769,5 +769,8 @@ core_only:
...
@@ -769,5 +769,8 @@ core_only:
// Stop recording the boot logcat after every boot task is done
// Stop recording the boot logcat after every boot task is done
kill
(
debug_log_pid
,
SIGTERM
);
kill
(
debug_log_pid
,
SIGTERM
);
waitpid
(
debug_log_pid
,
NULL
,
0
);
waitpid
(
debug_log_pid
,
NULL
,
0
);
// Then start to log Magisk verbosely
xwrite
(
debug_log_fd
,
"
\n
Verbose logs:
\n
"
,
15
);
debug_log_pid
=
exec_command
(
0
,
&
debug_log_fd
,
NULL
,
"logcat"
,
"-v"
,
"thread"
,
"-s"
,
"Magisk"
,
NULL
);
#endif
#endif
}
}
jni/daemon/log_monitor.c
View file @
6ce37b44
...
@@ -26,7 +26,7 @@ static void *logger_thread(void *args) {
...
@@ -26,7 +26,7 @@ static void *logger_thread(void *args) {
while
(
1
)
{
while
(
1
)
{
// Start logcat
// Start logcat
log_pid
=
exec_command
(
0
,
&
log_fd
,
NULL
,
"logcat"
,
"-
s"
,
"Magisk"
,
"-v"
,
"thread
"
,
NULL
);
log_pid
=
exec_command
(
0
,
&
log_fd
,
NULL
,
"logcat"
,
"-
v"
,
"thread"
,
"Magisk:I"
,
"*:S
"
,
NULL
);
if
(
log_pid
>
0
)
if
(
log_pid
>
0
)
waitpid
(
log_pid
,
NULL
,
0
);
waitpid
(
log_pid
,
NULL
,
0
);
// For some reason it went here, clear buffer and restart
// For some reason it went here, clear buffer and restart
...
...
jni/include/logging.h
View file @
6ce37b44
...
@@ -23,13 +23,10 @@ static inline void exit_proc() { exit(1); }
...
@@ -23,13 +23,10 @@ static inline void exit_proc() { exit(1); }
static
inline
void
exit_thread
()
{
pthread_exit
(
NULL
);
}
static
inline
void
exit_thread
()
{
pthread_exit
(
NULL
);
}
static
inline
void
do_nothing
()
{}
static
inline
void
do_nothing
()
{}
// Dummy function to depress debug message
static
inline
void
stub
(
const
char
*
fmt
,
...)
{}
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#else
#else
#define LOGD(...)
stub(__VA_ARGS__)
#define LOGD(...)
{}
#endif
#endif
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
...
...
jni/utils/misc.c
View file @
6ce37b44
...
@@ -312,7 +312,7 @@ int mkdir_p(const char *pathname, mode_t mode) {
...
@@ -312,7 +312,7 @@ int mkdir_p(const char *pathname, mode_t mode) {
int
bind_mount
(
const
char
*
from
,
const
char
*
to
)
{
int
bind_mount
(
const
char
*
from
,
const
char
*
to
)
{
int
ret
=
xmount
(
from
,
to
,
NULL
,
MS_BIND
,
NULL
);
int
ret
=
xmount
(
from
,
to
,
NULL
,
MS_BIND
,
NULL
);
#ifdef MAGISK_DEBUG
#ifdef MAGISK_DEBUG
LOG
D
(
"bind_mount: %s -> %s
\n
"
,
from
,
to
);
LOG
I
(
"bind_mount: %s -> %s
\n
"
,
from
,
to
);
#else
#else
LOGI
(
"bind_mount: %s
\n
"
,
to
);
LOGI
(
"bind_mount: %s
\n
"
,
to
);
#endif
#endif
...
...
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