mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
[orbis-kernel] Implement basic sys_socketex
Implement sys_socketclose
This commit is contained in:
parent
cea6052e54
commit
76db5849a0
8 changed files with 74 additions and 8 deletions
|
|
@ -1,7 +1,9 @@
|
|||
#include "io-device.hpp"
|
||||
#include "orbis/KernelAllocator.hpp"
|
||||
#include "orbis/utils/Logs.hpp"
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
std::int64_t io_device_instance_close(IoDeviceInstance *instance) { return 0; }
|
||||
|
|
@ -24,6 +26,11 @@ struct HostIoDeviceInstance : IoDeviceInstance {
|
|||
int hostFd;
|
||||
};
|
||||
|
||||
struct SocketDeviceInstance : IoDeviceInstance {
|
||||
orbis::utils::kstring name;
|
||||
int hostFd;
|
||||
};
|
||||
|
||||
static std::int64_t host_io_device_instance_read(IoDeviceInstance *instance,
|
||||
void *data,
|
||||
std::uint64_t size) {
|
||||
|
|
@ -130,3 +137,25 @@ IoDevice *createHostIoDevice(const char *hostPath) {
|
|||
result->hostPath = hostPath;
|
||||
return result;
|
||||
}
|
||||
|
||||
static std::int64_t socket_instance_ioctl(IoDeviceInstance *instance,
|
||||
std::uint64_t request, void *argp) {
|
||||
|
||||
ORBIS_LOG_FATAL("Unhandled socket ioctl", request);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static std::int64_t socket_instance_close(IoDeviceInstance *instance) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
orbis::ErrorCode createSocket(const char *name, int dom, int type, int prot,
|
||||
orbis::Ref<IoDeviceInstance> *instance) {
|
||||
auto s = orbis::knew<SocketDeviceInstance>();
|
||||
s->ioctl = socket_instance_ioctl;
|
||||
s->close = socket_instance_close;
|
||||
s->name = name;
|
||||
s->hostFd = ::socket(dom, type, prot);
|
||||
*instance = s;
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue