Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c6dd547 authored by Josh Gao's avatar Josh Gao Committed by Automerger Merge Worker
Browse files

Merge "Switch to bionic's pidfd_open." am: 680aaa91 am: 95445c28 am: bc82f0c6

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646356

Change-Id: I357c24ce5ba57d7887dce9e7f58d0e924e59ce85
parents b3db256b bc82f0c6
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include <string.h>
#include <sys/epoll.h>
#include <sys/errno.h>
#include <sys/pidfd.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/syscall.h>
@@ -1316,14 +1317,8 @@ void android_os_Process_removeAllProcessGroups(JNIEnv* env, jobject clazz)
    return removeAllProcessGroups();
}

// Wrapper function to the syscall pidfd_open, which creates a file
// descriptor that refers to the process whose PID is specified in pid.
static inline int sys_pidfd_open(pid_t pid, unsigned int flags) {
    return syscall(__NR_pidfd_open, pid, flags);
}

static jint android_os_Process_nativePidFdOpen(JNIEnv* env, jobject, jint pid, jint flags) {
    int fd = sys_pidfd_open(pid, flags);
    int fd = pidfd_open(pid, flags);
    if (fd < 0) {
        jniThrowErrnoException(env, "nativePidFdOpen", errno);
        return -1;