Commit 2f7cfa7a authored by topjohnwu's avatar topjohnwu

Link binaries when daemon started

parent bdcb813e
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mount.h>
#include "magisk.h" #include "magisk.h"
#include "utils.h" #include "utils.h"
...@@ -46,6 +47,15 @@ static void request_handler(int client) { ...@@ -46,6 +47,15 @@ static void request_handler(int client) {
write_int(client, VERSION_CODE); write_int(client, VERSION_CODE);
close(client); close(client);
break; break;
case POST_FS:
// TODO: post-fs
break;
case POST_FS_DATA:
// TODO: post-fs-data
break;
case LATE_START_SERVICE:
// TODO: late_start service
break;
case TEST: case TEST:
s = read_string(client); s = read_string(client);
LOGI("%s\n", s); LOGI("%s\n", s);
...@@ -107,6 +117,11 @@ void start_daemon() { ...@@ -107,6 +117,11 @@ void start_daemon() {
// Unlock all blocks for rw // Unlock all blocks for rw
unlock_blocks(); unlock_blocks();
// Setup links under /sbin
mount(NULL, "/", NULL, MS_REMOUNT, NULL);
create_links(NULL, "/sbin");
mount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL);
// Loop forever to listen to requests // Loop forever to listen to requests
while(1) { while(1) {
request_handler(xaccept(fd, NULL, NULL)); request_handler(xaccept(fd, NULL, NULL));
......
...@@ -14,6 +14,9 @@ typedef enum { ...@@ -14,6 +14,9 @@ typedef enum {
SUPERUSER, SUPERUSER,
CHECK_VERSION, CHECK_VERSION,
CHECK_VERSION_CODE, CHECK_VERSION_CODE,
POST_FS,
POST_FS_DATA,
LATE_START_SERVICE,
TEST TEST
} client_request; } client_request;
...@@ -35,4 +38,18 @@ void write_string(int fd, const char* val); ...@@ -35,4 +38,18 @@ void write_string(int fd, const char* val);
void monitor_logs(); void monitor_logs();
/**************
* MagiskHide *
**************/
void launch_magiskhide(int client);
void stop_magiskhide(int client);
/*************
* Superuser *
*************/
void su_daemon_receiver(int client);
#endif #endif
...@@ -62,18 +62,4 @@ int resetprop_main(int argc, char *argv[]); ...@@ -62,18 +62,4 @@ int resetprop_main(int argc, char *argv[]);
} }
#endif #endif
/**************
* MagiskHide *
**************/
void launch_magiskhide(int client);
void stop_magiskhide(int client);
/*************
* Superuser *
*************/
void su_daemon_receiver(int client);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment