fix(libkernel): name the descriptor select cannot poll
The abort only said "select on descriptors that are not libSceNet sockets", which leaves no way to tell from a title's log what it waited on. It now names the descriptor and says whether libSceNet was loaded. Claude-Session: https://claude.ai/code/session_012SLQbhAiexxW6TtjYToW8a
This commit is contained in:
parent
1f50b91280
commit
cbbccb4930
|
|
@ -10,6 +10,7 @@
|
|||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
|
@ -28,6 +29,11 @@ bool DescriptorSet(const void* set, int descriptor) {
|
|||
return set != nullptr && ((static_cast<const std::uint64_t*>(set)[descriptor / 64] >> (descriptor % 64)) & 1u) != 0;
|
||||
}
|
||||
|
||||
void UnknownDescriptor(int descriptor, bool polled) {
|
||||
const auto what = "select on descriptor " + std::to_string(descriptor) + (polled ? " (not a libSceNet socket)" : " (libSceNet is not loaded)");
|
||||
NotImplemented_nid_no_patch(what.c_str());
|
||||
}
|
||||
|
||||
void ClearDescriptor(void* set, int descriptor) {
|
||||
if (set != nullptr) static_cast<std::uint64_t*>(set)[descriptor / 64] &= ~(std::uint64_t{1} << (descriptor % 64));
|
||||
}
|
||||
|
|
@ -86,7 +92,7 @@ int APS5_VABI select_nid_postfix(int nfds, void* readfds, void* writefds, void*
|
|||
if (devicesReady) waitMilliseconds = 0;
|
||||
if (sockets != 0) {
|
||||
const auto poller = g_socketPoller.load();
|
||||
if (poller == nullptr) NotImplemented_nid_no_patch("select on descriptors that are not libSceNet sockets");
|
||||
if (poller == nullptr) UnknownDescriptor(entries.front().descriptor, false);
|
||||
for (std::size_t index = 0; index < sockets; ++index) entries[index].revents = 0;
|
||||
const int result = poller(entries.data(), static_cast<int>(sockets), waitMilliseconds);
|
||||
if (result < 0) {
|
||||
|
|
@ -98,7 +104,7 @@ int APS5_VABI select_nid_postfix(int nfds, void* readfds, void* writefds, void*
|
|||
}
|
||||
int ready = 0;
|
||||
for (const auto& entry : entries) {
|
||||
if ((entry.revents & KernelSocketPoll::Unknown) != 0) NotImplemented_nid_no_patch("select on descriptors that are not libSceNet sockets");
|
||||
if ((entry.revents & KernelSocketPoll::Unknown) != 0) UnknownDescriptor(entry.descriptor, true);
|
||||
const bool readable = (entry.events & KernelSocketPoll::Readable) != 0 && (entry.revents & (KernelSocketPoll::Readable | KernelSocketPoll::HangUp | KernelSocketPoll::Error)) != 0;
|
||||
const bool writable = (entry.events & KernelSocketPoll::Writable) != 0 && (entry.revents & (KernelSocketPoll::Writable | KernelSocketPoll::Error)) != 0;
|
||||
const bool urgent = (entry.events & KernelSocketPoll::Urgent) != 0 && (entry.revents & KernelSocketPoll::Urgent) != 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue