mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-11-23 06:30:01 +00:00
Add pidfd_open syscall helpers
This commit is contained in:
parent
8d60d70553
commit
0dd03e9cb6
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@ out/
|
||||
.vscode/
|
||||
.vs/
|
||||
*.pyc
|
||||
.cache
|
||||
|
@ -59,3 +59,16 @@ if (compiles)
|
||||
add_definitions(-DHAS_SYSCALL_RENAMEAT2=1)
|
||||
endif ()
|
||||
|
||||
check_cxx_source_compiles(
|
||||
"
|
||||
#include <stdio.h>
|
||||
#include <syscall.h>
|
||||
int main() {
|
||||
return ::syscall(SYS_pidfd_open, ::getpid(), 0);
|
||||
}"
|
||||
compiles)
|
||||
if (compiles)
|
||||
message(STATUS "Has pidfd_open helper")
|
||||
add_definitions(-DHAS_SYSCALL_PIDFD_OPEN=1)
|
||||
endif ()
|
||||
|
||||
|
@ -79,5 +79,12 @@ inline int32_t renameat2(int olddirfd, const char *oldpath, int newdirfd, const
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int32_t pidfd_open(pid_t pid, unsigned int flags) {
|
||||
#if defined(DHAS_SYSCALL_PIDFD_OPEN) && DHAS_SYSCALL_PIDFD_OPEN
|
||||
return ::syscall(SYS_pidfd_open, pid_t pid, unsigned int flags);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "FEXHeaderUtils/Syscalls.h"
|
||||
#include "Logger.h"
|
||||
#include "SquashFS.h"
|
||||
|
||||
@ -398,7 +399,7 @@ namespace ProcessPipe {
|
||||
break;
|
||||
}
|
||||
case FEXServerClient::PacketType::TYPE_GET_PID_FD: {
|
||||
int FD = ::syscall(SYS_pidfd_open, ::getpid(), 0);
|
||||
int FD = FHU::Syscalls::pidfd_open(::getpid(), 0);
|
||||
|
||||
SendFDSuccessPacket(Socket, FD);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user