This commit is contained in:
georgemoralis 2025-01-18 18:06:43 +02:00
parent 3cab8f2168
commit 50a46b4613
3 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,12 @@
#include "urandom.h" #include "urandom.h"
namespace Core::Devices { namespace Core::Devices {
std::shared_ptr<BaseDevice> URandomDevice::Create(u32 handle, const char*, int, u16) {
return std::shared_ptr<BaseDevice>(
reinterpret_cast<Devices::BaseDevice*>(new URandomDevice(handle)));
}
int URandomDevice::ioctl(u64 cmd, Common::VaCtx* args) { int URandomDevice::ioctl(u64 cmd, Common::VaCtx* args) {
return 0; return 0;
} }

View File

@ -10,6 +10,7 @@ class URandomDevice final : BaseDevice {
u32 handle; u32 handle;
public: public:
static std::shared_ptr<BaseDevice> Create(u32 handle, const char*, int, u16);
explicit URandomDevice(u32 handle) : handle(handle) {} explicit URandomDevice(u32 handle) : handle(handle) {}
~URandomDevice() override = default; ~URandomDevice() override = default;

View File

@ -10,6 +10,7 @@
#include "common/singleton.h" #include "common/singleton.h"
#include "core/devices/logger.h" #include "core/devices/logger.h"
#include "core/devices/nop_device.h" #include "core/devices/nop_device.h"
#include "core/devices/urandom.h"
#include "core/file_sys/fs.h" #include "core/file_sys/fs.h"
#include "core/libraries/kernel/file_system.h" #include "core/libraries/kernel/file_system.h"
#include "core/libraries/kernel/orbis_error.h" #include "core/libraries/kernel/orbis_error.h"
@ -41,6 +42,8 @@ static std::map<std::string, FactoryDevice> available_device = {
{"/dev/deci_stderr", GET_DEVICE_FD(2)}, {"/dev/deci_stderr", GET_DEVICE_FD(2)},
{"/dev/null", GET_DEVICE_FD(0)}, // fd0 (stdin) is a nop device {"/dev/null", GET_DEVICE_FD(0)}, // fd0 (stdin) is a nop device
{"/dev/urandom", &D::URandomDevice::Create }
// clang-format on // clang-format on
}; };