Merge "Switch to bionic's pidfd_open." am: 680aaa9195
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1646356 Change-Id: Ib5c723f6903cfa22c8b640e1d45184bee5b90afe
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
|
#include <sys/pidfd.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
@@ -1290,14 +1291,8 @@ void android_os_Process_removeAllProcessGroups(JNIEnv* env, jobject clazz)
|
|||||||
return removeAllProcessGroups();
|
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) {
|
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) {
|
if (fd < 0) {
|
||||||
jniThrowErrnoException(env, "nativePidFdOpen", errno);
|
jniThrowErrnoException(env, "nativePidFdOpen", errno);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user