mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 05:00:31 +02:00
Sadly these things can't be split without breaking functionality so it turns in to a bit of a mess. SyscallHandler is very much something that is a Linux only construct and shouldn't be in FEXCore itself. Lets the frontend register a Syscallhandler with FEXCore. FEXCore itself is then aware of the current syscall ABI and handles the ABI in an optimal fashion. So it is not a 100% clean break otherwise we would lose performance. The SignalDelegator then needs to move to the frontend since the SyscallHandler requires it for signal based syscalls. The CPU backend signal handling still needs to happen in FEXCore because it is a very tight coupling with the CPU backend. Once we need to support more Signal handling we can give the backends cleaner support to select which specific OS handler to handle.
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <sys/stat.h>
|
|
#include <sys/socket.h>
|
|
#include <poll.h>
|
|
|
|
#include "Tests/LinuxSyscalls/EmulatedFiles/EmulatedFiles.h"
|
|
|
|
namespace FEXCore::Context {
|
|
struct Context;
|
|
}
|
|
|
|
namespace FEX::HLE {
|
|
|
|
class FileManager final {
|
|
public:
|
|
FileManager() = delete;
|
|
FileManager(FileManager &&) = delete;
|
|
|
|
FileManager(FEXCore::Context::Context *ctx);
|
|
~FileManager();
|
|
uint64_t Open(const char *pathname, int flags, uint32_t mode);
|
|
uint64_t Close(int fd);
|
|
uint64_t Stat(const char *pathname, void *buf);
|
|
uint64_t Lstat(const char *path, void *buf);
|
|
uint64_t Access(const char *pathname, int mode);
|
|
uint64_t FAccessat(int dirfd, const char *pathname, int mode, int flags);
|
|
uint64_t Readlink(const char *pathname, char *buf, size_t bufsiz);
|
|
uint64_t Chmod(const char *pathname, mode_t mode);
|
|
uint64_t Readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
|
|
uint64_t Openat(int dirfs, const char *pathname, int flags, uint32_t mode);
|
|
uint64_t Statx(int dirfd, const char *pathname, int flags, uint32_t mask, struct statx *statxbuf);
|
|
uint64_t Mknod(const char *pathname, mode_t mode, dev_t dev);
|
|
|
|
// vfs
|
|
uint64_t Statfs(const char *path, void *buf);
|
|
|
|
std::string *FindFDName(int fd);
|
|
|
|
private:
|
|
FEX::EmulatedFile::EmulatedFDManager EmuFD;
|
|
|
|
std::unordered_map<int32_t, std::string> FDToNameMap;
|
|
std::string PidSelfPath;
|
|
std::string GetEmulatedPath(const char *pathname);
|
|
|
|
FEXCore::Config::Value<std::string> Filename{FEXCore::Config::CONFIG_APP_FILENAME, ""};
|
|
FEXCore::Config::Value<std::string> LDPath{FEXCore::Config::CONFIG_ROOTFSPATH, ""};
|
|
};
|
|
}
|