mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
ipmi: fixed respond sync, get message, try get message, try send message event: detach event emitter from file signals: basic implementation linker: fixed zero symbol relocation, fixed exec relocation shared_cv/mutex: implement eintr response support shared_cv: fixed possible loop instead of wait ipmi: implement invoke async, respond async, get result, get client app id, client get name rpcsx-os: add safemode flag
61 lines
1.7 KiB
C++
61 lines
1.7 KiB
C++
#include "io-device.hpp"
|
|
#include "orbis/KernelAllocator.hpp"
|
|
#include "orbis/error/ErrorCode.hpp"
|
|
#include "orbis/file.hpp"
|
|
#include "orbis/uio.hpp"
|
|
#include "orbis/utils/Logs.hpp"
|
|
#include <span>
|
|
#include <unistd.h>
|
|
|
|
struct EvlgFile : orbis::File {};
|
|
struct EvlgDevice : IoDevice {
|
|
int outputFd;
|
|
|
|
EvlgDevice(int outputFd)
|
|
: outputFd(outputFd) {}
|
|
|
|
orbis::ErrorCode open(orbis::Ref<orbis::File> *file, const char *path,
|
|
std::uint32_t flags, std::uint32_t mode,
|
|
orbis::Thread *thread) override;
|
|
};
|
|
|
|
static orbis::ErrorCode evlg_ioctl(orbis::File *file, std::uint64_t request,
|
|
void *argp, orbis::Thread *thread) {
|
|
|
|
ORBIS_LOG_FATAL("Unhandled evlg ioctl", request);
|
|
return {};
|
|
}
|
|
|
|
static orbis::ErrorCode evlg_write(orbis::File *file, orbis::Uio *uio,
|
|
orbis::Thread *thread) {
|
|
auto dev = dynamic_cast<EvlgDevice *>(file->device.get());
|
|
|
|
for (auto vec : std::span(uio->iov, uio->iovcnt)) {
|
|
uio->offset += vec.len;
|
|
::write(dev->outputFd, vec.base, vec.len);
|
|
::write(2, vec.base, vec.len);
|
|
}
|
|
return {};
|
|
}
|
|
|
|
static const orbis::FileOps fileOps = {
|
|
.ioctl = evlg_ioctl,
|
|
.write = evlg_write,
|
|
};
|
|
|
|
orbis::ErrorCode EvlgDevice::open(orbis::Ref<orbis::File> *file,
|
|
const char *path, std::uint32_t flags,
|
|
std::uint32_t mode,
|
|
orbis::Thread *thread) {
|
|
auto newFile = orbis::knew<EvlgFile>();
|
|
newFile->ops = &fileOps;
|
|
newFile->device = this;
|
|
|
|
*file = newFile;
|
|
return {};
|
|
}
|
|
|
|
IoDevice *createEvlgCharacterDevice(int outputFd) {
|
|
return orbis::knew<EvlgDevice>(outputFd);
|
|
}
|