Link binaries when daemon started

This commit is contained in:
topjohnwu 2017-04-15 19:02:07 +08:00
parent bdcb813ee6
commit 2f7cfa7ab2
3 changed files with 32 additions and 14 deletions

View File

@ -13,6 +13,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include "magisk.h"
#include "utils.h"
@ -46,6 +47,15 @@ static void request_handler(int client) {
write_int(client, VERSION_CODE);
close(client);
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:
s = read_string(client);
LOGI("%s\n", s);
@ -107,6 +117,11 @@ void start_daemon() {
// Unlock all blocks for rw
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
while(1) {
request_handler(xaccept(fd, NULL, NULL));

View File

@ -14,6 +14,9 @@ typedef enum {
SUPERUSER,
CHECK_VERSION,
CHECK_VERSION_CODE,
POST_FS,
POST_FS_DATA,
LATE_START_SERVICE,
TEST
} client_request;
@ -35,4 +38,18 @@ void write_string(int fd, const char* val);
void monitor_logs();
/**************
* MagiskHide *
**************/
void launch_magiskhide(int client);
void stop_magiskhide(int client);
/*************
* Superuser *
*************/
void su_daemon_receiver(int client);
#endif

View File

@ -62,18 +62,4 @@ int resetprop_main(int argc, char *argv[]);
}
#endif
/**************
* MagiskHide *
**************/
void launch_magiskhide(int client);
void stop_magiskhide(int client);
/*************
* Superuser *
*************/
void su_daemon_receiver(int client);
#endif