kernel/error: Add error code for the handle table being full

This replaces the lingering 3DS constant with the proper one, and
utilizes it within HandleTable's Create() member function.
merge-requests/60/head
Lioncash 2018-08-25 05:44:51 +07:00
parent b8be5524bc
commit 81ca46dd17
3 changed files with 4 additions and 4 deletions

@ -11,7 +11,6 @@ namespace Kernel {
namespace ErrCodes { namespace ErrCodes {
enum { enum {
// TODO(Subv): Remove these 3DS OS error codes. // TODO(Subv): Remove these 3DS OS error codes.
OutOfHandles = 19,
SessionClosedByRemote = 26, SessionClosedByRemote = 26,
PortNameTooLong = 30, PortNameTooLong = 30,
NoPendingSessions = 35, NoPendingSessions = 35,
@ -20,6 +19,7 @@ enum {
// Confirmed Switch OS error codes // Confirmed Switch OS error codes
InvalidAddress = 102, InvalidAddress = 102,
HandleTableFull = 105,
InvalidMemoryState = 106, InvalidMemoryState = 106,
InvalidMemoryPermissions = 108, InvalidMemoryPermissions = 108,
InvalidProcessorId = 113, InvalidProcessorId = 113,
@ -37,7 +37,7 @@ enum {
// double check that the code matches before re-using the constant. // double check that the code matches before re-using the constant.
// TODO(bunnei): Replace these with correct errors for Switch OS // TODO(bunnei): Replace these with correct errors for Switch OS
constexpr ResultCode ERR_OUT_OF_HANDLES(-1); constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull);
constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1);
constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1);
constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1);

@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
u16 slot = next_free_slot; u16 slot = next_free_slot;
if (slot >= generations.size()) { if (slot >= generations.size()) {
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
return ERR_OUT_OF_HANDLES; return ERR_HANDLE_TABLE_FULL;
} }
next_free_slot = generations[slot]; next_free_slot = generations[slot];

@ -47,7 +47,7 @@ public:
/** /**
* Allocates a handle for the given object. * Allocates a handle for the given object.
* @return The created Handle or one of the following errors: * @return The created Handle or one of the following errors:
* - `ERR_OUT_OF_HANDLES`: the maximum number of handles has been exceeded. * - `ERR_HANDLE_TABLE_FULL`: the maximum number of handles has been exceeded.
*/ */
ResultVal<Handle> Create(SharedPtr<Object> obj); ResultVal<Handle> Create(SharedPtr<Object> obj);