mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-11-23 14:40:14 +00:00
Add ioctl to filemanagement
This commit is contained in:
parent
e59a6fcd5d
commit
47d91e05f0
@ -4,6 +4,7 @@
|
||||
#include "Interface/HLE/FileManagement.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace FEXCore {
|
||||
@ -12,6 +13,7 @@ class STDFD final : public FD {
|
||||
public:
|
||||
STDFD(FEXCore::Context::Context *ctx, int32_t fd, const char *pathname, int32_t flags, mode_t mode)
|
||||
: FD (ctx, fd, pathname, flags, mode) {
|
||||
HostFD = fd;
|
||||
}
|
||||
|
||||
ssize_t writev(int fd, void *iov, int iovcnt) override {
|
||||
@ -49,10 +51,6 @@ public:
|
||||
LogMan::Msg::ERR("%s", reinterpret_cast<char*>(buf));
|
||||
return count;
|
||||
}
|
||||
|
||||
uint64_t read(int fd, void *buf, size_t count) {
|
||||
return ::read(HostFD, buf, count);
|
||||
}
|
||||
};
|
||||
|
||||
uint64_t FD::read(int fd, void *buf, size_t count) {
|
||||
@ -96,6 +94,10 @@ int FD::close(int fd) {
|
||||
return ::close(HostFD);
|
||||
}
|
||||
|
||||
int FD::ioctl(int fd, uint64_t request, void *args) {
|
||||
return ::ioctl(HostFD, request, args);
|
||||
}
|
||||
|
||||
FileManager::FileManager(FEXCore::Context::Context *ctx)
|
||||
: CTX {ctx} {
|
||||
|
||||
@ -227,6 +229,15 @@ uint64_t FileManager::Openat([[maybe_unused]] int dirfs, const char *pathname, i
|
||||
return fd;
|
||||
}
|
||||
|
||||
uint64_t FileManager::Ioctl(int fd, uint64_t request, void *args) {
|
||||
auto FD = FDMap.find(fd);
|
||||
if (FD == FDMap.end()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return FD->second->ioctl(fd, request, args);
|
||||
}
|
||||
|
||||
int32_t FileManager::FindHostFD(int fd) {
|
||||
auto FD = FDMap.find(fd);
|
||||
if (FD == FDMap.end()) {
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
int openat(int dirfd, const char *pathname, int flags, mode_t mode);
|
||||
int fstat(int fd, struct stat *buf);
|
||||
int close(int fd);
|
||||
int ioctl(int fd, uint64_t request, void *args);
|
||||
|
||||
int GetHostFD() const { return HostFD; }
|
||||
|
||||
@ -61,6 +62,8 @@ public:
|
||||
uint64_t Access(const char *pathname, int mode);
|
||||
uint64_t Readlink(const char *pathname, char *buf, size_t bufsiz);
|
||||
uint64_t Openat(int dirfs, const char *pathname, int flags, uint32_t mode);
|
||||
uint64_t Ioctl(int fd, uint64_t request, void *args);
|
||||
|
||||
|
||||
int32_t FindHostFD(int fd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user