mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-23 17:28:36 +00:00
Refactor daemon connection
This commit is contained in:
@@ -9,20 +9,17 @@
|
||||
|
||||
#include <socket.hpp>
|
||||
|
||||
// Daemon command code flags/masks
|
||||
enum : int {
|
||||
SYNC_FLAG = (1 << 30),
|
||||
DAEMON_CODE_MASK = std::numeric_limits<int>::max() >> 1
|
||||
};
|
||||
|
||||
// Daemon command codes
|
||||
enum : int {
|
||||
START_DAEMON = SYNC_FLAG | 0,
|
||||
CHECK_VERSION = SYNC_FLAG | 1,
|
||||
CHECK_VERSION_CODE = SYNC_FLAG | 2,
|
||||
GET_PATH = SYNC_FLAG | 3,
|
||||
STOP_DAEMON = SYNC_FLAG | 4,
|
||||
SUPERUSER = 5,
|
||||
enum class DaemonRequest: int {
|
||||
START_DAEMON,
|
||||
CHECK_VERSION,
|
||||
CHECK_VERSION_CODE,
|
||||
GET_PATH,
|
||||
STOP_DAEMON,
|
||||
|
||||
_SYNC_BARRIER_,
|
||||
|
||||
SUPERUSER,
|
||||
POST_FS_DATA,
|
||||
LATE_START,
|
||||
BOOT_COMPLETE,
|
||||
@@ -30,16 +27,16 @@ enum : int {
|
||||
SQLITE_CMD,
|
||||
REMOVE_MODULES,
|
||||
ZYGISK_REQUEST,
|
||||
ZYGISK_PASSTHROUGH,
|
||||
DAEMON_CODE_END,
|
||||
END,
|
||||
};
|
||||
|
||||
// Return codes for daemon
|
||||
enum : int {
|
||||
DAEMON_ERROR = -1,
|
||||
DAEMON_SUCCESS = 0,
|
||||
enum class DaemonResponse: int {
|
||||
ERROR = -1,
|
||||
OK = 0,
|
||||
ROOT_REQUIRED,
|
||||
DAEMON_LAST
|
||||
INVALID_REQUEST,
|
||||
END
|
||||
};
|
||||
|
||||
struct module_info {
|
||||
@@ -55,7 +52,7 @@ extern int app_process_32;
|
||||
extern int app_process_64;
|
||||
extern std::vector<module_info> *module_list;
|
||||
|
||||
int connect_daemon(bool create = false);
|
||||
int connect_daemon(DaemonRequest req, bool create = false);
|
||||
|
||||
// Poll control
|
||||
using poll_callback = void(*)(pollfd*);
|
||||
@@ -81,5 +78,4 @@ void zygisk_handler(int client, const sock_cred *cred);
|
||||
|
||||
// Denylist
|
||||
void initialize_denylist();
|
||||
int disable_deny();
|
||||
int denylist_cli(int argc, char **argv);
|
||||
|
Reference in New Issue
Block a user