lmkd: Prepare lmkd to support connection from init process
In order to register native services init needs ability to communicate with lmkd. Make liblmkd_utils library available in recovery mode so that init can link to it and add a data socket in lmkd to support additional connection from init. Ensure SOCK_CLOEXEC type for lmkd socket to prevent init children from inheriting it. Bug: 129011369 Test: boot and verify native service registration Change-Id: Iaa4f59282fb10f838f6811571e97d55754b1bd41 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
12ab187885
commit
adb54f81bf
3 changed files with 5 additions and 4 deletions
|
|
@ -48,6 +48,7 @@ cc_library_static {
|
|||
cc_library_static {
|
||||
name: "liblmkd_utils",
|
||||
srcs: ["liblmkd_utils.c"],
|
||||
recovery_available: true,
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
],
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
int lmkd_connect() {
|
||||
return socket_local_client("lmkd",
|
||||
ANDROID_SOCKET_NAMESPACE_RESERVED,
|
||||
SOCK_SEQPACKET);
|
||||
SOCK_SEQPACKET | SOCK_CLOEXEC);
|
||||
}
|
||||
|
||||
int lmkd_register_proc(int sock, struct lmk_procprio *params) {
|
||||
|
|
|
|||
|
|
@ -245,8 +245,8 @@ struct sock_event_handler_info {
|
|||
struct event_handler_info handler_info;
|
||||
};
|
||||
|
||||
/* max supported number of data connections */
|
||||
#define MAX_DATA_CONN 2
|
||||
/* max supported number of data connections (AMS, init, tests) */
|
||||
#define MAX_DATA_CONN 3
|
||||
|
||||
/* socket event handler data */
|
||||
static struct sock_event_handler_info ctrl_sock;
|
||||
|
|
@ -256,7 +256,7 @@ static struct sock_event_handler_info data_sock[MAX_DATA_CONN];
|
|||
static struct event_handler_info vmpressure_hinfo[VMPRESS_LEVEL_COUNT];
|
||||
|
||||
/*
|
||||
* 1 ctrl listen socket, 2 ctrl data socket, 3 memory pressure levels,
|
||||
* 1 ctrl listen socket, 3 ctrl data socket, 3 memory pressure levels,
|
||||
* 1 lmk events + 1 fd to wait for process death
|
||||
*/
|
||||
#define MAX_EPOLL_EVENTS (1 + MAX_DATA_CONN + VMPRESS_LEVEL_COUNT + 1 + 1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue