fix(libkernel): route updated socket descriptors by table
This commit is contained in:
parent
c33036eefe
commit
eb2b360f0b
|
|
@ -472,8 +472,6 @@ int File::DuplicateFrom(int fd, int start) {
|
|||
#else
|
||||
const int duplicate = ::fcntl(fd, F_DUPFD, start);
|
||||
if (duplicate < 0) return PosixFailure(SceErrorFromErrno(errno) & 0xffff);
|
||||
if (duplicate >= GuestSockets::FirstDescriptor)
|
||||
throw std::runtime_error("fcntl: host descriptor reached the guest socket range");
|
||||
if (File::IsRandomDevice(fd)) File::RememberRandomDevice(duplicate);
|
||||
File::ShareDescriptor(fd, duplicate);
|
||||
return duplicate;
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ int GuestSockets::Poll(KernelSocketPoll::Entry* entries, int count, int timeoutM
|
|||
|
||||
extern "C" {
|
||||
int APS5_VABI fcntl_nid_postfix(int descriptor, int command, ...) {
|
||||
if (descriptor < GuestSockets::FirstDescriptor) {
|
||||
if (!GuestSockets::IsOpen(descriptor)) {
|
||||
const auto type = File::FcntlArgumentOf(command);
|
||||
std::intptr_t argument = 0;
|
||||
if (type != File::FcntlArgument::None) {
|
||||
|
|
@ -917,7 +917,7 @@ int APS5_VABI getpeername_nid_postfix(int descriptor, void* address, std::uint32
|
|||
return 0;
|
||||
}
|
||||
int APS5_VABI ioctl_nid_postfix(int descriptor, std::uint64_t request, void* argument) {
|
||||
if (descriptor < GuestSockets::FirstDescriptor) return File::Ioctl(descriptor, request, argument);
|
||||
if (!GuestSockets::IsOpen(descriptor)) return File::Ioctl(descriptor, request, argument);
|
||||
const auto socket = Lookup(descriptor);
|
||||
if (!socket) return -1;
|
||||
if (!argument) return Fail(14);
|
||||
|
|
|
|||
Loading…
Reference in New Issue