Switch to Bionic's pidfd wrappers.
Bug: http://b/172518739 Test: treehugger Change-Id: Ib6cac8f31ec64343c6eec6b82dac52888890c688
This commit is contained in:
parent
858e8c6373
commit
84623bef7b
16
lmkd.cpp
16
lmkd.cpp
|
|
@ -30,6 +30,7 @@
|
|||
#include <sys/epoll.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/pidfd.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
|
|
@ -147,15 +148,6 @@
|
|||
|
||||
#define LMKD_REINIT_PROP "lmkd.reinit"
|
||||
|
||||
static inline int sys_pidfd_open(pid_t pid, unsigned int flags) {
|
||||
return syscall(__NR_pidfd_open, pid, flags);
|
||||
}
|
||||
|
||||
static inline int sys_pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
|
||||
unsigned int flags) {
|
||||
return syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
|
||||
}
|
||||
|
||||
/* default to old in-kernel interface if no memory pressure events */
|
||||
static bool use_inkernel_interface = true;
|
||||
static bool has_inkernel_module;
|
||||
|
|
@ -1135,7 +1127,7 @@ static void cmd_procprio(LMKD_CTRL_PACKET packet, int field_count, struct ucred
|
|||
int pidfd = -1;
|
||||
|
||||
if (pidfd_supported) {
|
||||
pidfd = TEMP_FAILURE_RETRY(sys_pidfd_open(params.pid, 0));
|
||||
pidfd = TEMP_FAILURE_RETRY(pidfd_open(params.pid, 0));
|
||||
if (pidfd < 0) {
|
||||
ALOGE("pidfd_open for pid %d failed; errno=%d", params.pid, errno);
|
||||
return;
|
||||
|
|
@ -2103,7 +2095,7 @@ static int kill_one_process(struct proc* procp, int min_oom_score, enum kill_rea
|
|||
r = kill(pid, SIGKILL);
|
||||
} else {
|
||||
start_wait_for_proc_kill(pidfd);
|
||||
r = sys_pidfd_send_signal(pidfd, SIGKILL, NULL, 0);
|
||||
r = pidfd_send_signal(pidfd, SIGKILL, NULL, 0);
|
||||
}
|
||||
|
||||
TRACE_KILL_END();
|
||||
|
|
@ -3117,7 +3109,7 @@ static int init(void) {
|
|||
}
|
||||
|
||||
/* check if kernel supports pidfd_open syscall */
|
||||
pidfd = TEMP_FAILURE_RETRY(sys_pidfd_open(getpid(), 0));
|
||||
pidfd = TEMP_FAILURE_RETRY(pidfd_open(getpid(), 0));
|
||||
if (pidfd < 0) {
|
||||
pidfd_supported = (errno != ENOSYS);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue