1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-23 04:12:02 +00:00

kern: KObjectContainer::Register -> void

This commit is contained in:
Michael Scire 2020-12-01 13:49:30 -08:00 committed by SciresM
parent b0debd72a7
commit 783f1077be
15 changed files with 19 additions and 23 deletions

View file

@ -56,8 +56,8 @@ namespace ams::kern {
void Initialize() { MESOSPHERE_ASSERT_THIS(); } void Initialize() { MESOSPHERE_ASSERT_THIS(); }
void Finalize() { MESOSPHERE_ASSERT_THIS(); } void Finalize() { MESOSPHERE_ASSERT_THIS(); }
Result Register(KAutoObjectWithList *obj); void Register(KAutoObjectWithList *obj);
Result Unregister(KAutoObjectWithList *obj); void Unregister(KAutoObjectWithList *obj);
size_t GetOwnedCount(KProcess *owner); size_t GetOwnedCount(KProcess *owner);
}; };

View file

@ -108,7 +108,7 @@ namespace ams::kern {
return obj; return obj;
} }
static Result Register(Derived *obj) { static void Register(Derived *obj) {
return s_container.Register(obj); return s_container.Register(obj);
} }

View file

@ -18,24 +18,20 @@
namespace ams::kern { namespace ams::kern {
Result KAutoObjectWithListContainer::Register(KAutoObjectWithList *obj) { void KAutoObjectWithListContainer::Register(KAutoObjectWithList *obj) {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();
KScopedLightLock lk(this->lock); KScopedLightLock lk(this->lock);
this->object_list.insert(*obj); this->object_list.insert(*obj);
return ResultSuccess();
} }
Result KAutoObjectWithListContainer::Unregister(KAutoObjectWithList *obj) { void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList *obj) {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();
KScopedLightLock lk(this->lock); KScopedLightLock lk(this->lock);
this->object_list.erase(this->object_list.iterator_to(*obj)); this->object_list.erase(this->object_list.iterator_to(*obj));
return ams::svc::ResultNotFound();
} }
size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess *owner) { size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess *owner) {

View file

@ -56,7 +56,7 @@ namespace ams::kern::svc {
R_TRY(code_mem->Initialize(address, size)); R_TRY(code_mem->Initialize(address, size));
/* Register the code memory. */ /* Register the code memory. */
R_TRY(KCodeMemory::Register(code_mem)); KCodeMemory::Register(code_mem);
/* Add the code memory to the handle table. */ /* Add the code memory to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, code_mem)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, code_mem));

View file

@ -43,7 +43,7 @@ namespace ams::kern::svc {
R_TRY(das->Initialize(das_address, das_size)); R_TRY(das->Initialize(das_address, das_size));
/* Register the device address space. */ /* Register the device address space. */
R_TRY(KDeviceAddressSpace::Register(das)); KDeviceAddressSpace::Register(das);
/* Add to the handle table. */ /* Add to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, das)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, das));

View file

@ -81,7 +81,7 @@ namespace ams::kern::svc {
}; };
/* Register the event. */ /* Register the event. */
R_TRY(KEvent::Register(event)); KEvent::Register(event);
/* Add the writable event to the handle table. */ /* Add the writable event to the handle table. */
R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent()))); R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent())));

View file

@ -51,7 +51,7 @@ namespace ams::kern::svc {
R_TRY(event->Initialize(interrupt_id, type)); R_TRY(event->Initialize(interrupt_id, type));
/* Register the event. */ /* Register the event. */
R_TRY(KInterruptEvent::Register(event)); KInterruptEvent::Register(event);
/* Add the event to the handle table. */ /* Add the event to the handle table. */
R_TRY(handle_table.Add(out, event)); R_TRY(handle_table.Add(out, event));

View file

@ -187,7 +187,7 @@ namespace ams::kern::svc {
}; };
/* Register the event. */ /* Register the event. */
R_TRY(KEvent::Register(event)); KEvent::Register(event);
/* Add the readable event to the handle table. */ /* Add the readable event to the handle table. */
R_TRY(handle_table.Add(out_event_handle, std::addressof(event->GetReadableEvent()))); R_TRY(handle_table.Add(out_event_handle, std::addressof(event->GetReadableEvent())));

View file

@ -46,7 +46,7 @@ namespace ams::kern::svc {
port->Initialize(max_sessions, false, 0); port->Initialize(max_sessions, false, 0);
/* Register the port. */ /* Register the port. */
R_TRY(KPort::Register(port)); KPort::Register(port);
/* Register the handle in the table. */ /* Register the handle in the table. */
handle_table.Register(*out_server_handle, std::addressof(port->GetServerPort())); handle_table.Register(*out_server_handle, std::addressof(port->GetServerPort()));
@ -95,7 +95,7 @@ namespace ams::kern::svc {
}; };
/* Register the port. */ /* Register the port. */
R_TRY(KPort::Register(port)); KPort::Register(port);
/* Add the client to the handle table. */ /* Add the client to the handle table. */
R_TRY(handle_table.Add(out_client, std::addressof(port->GetClientPort()))); R_TRY(handle_table.Add(out_client, std::addressof(port->GetClientPort())));

View file

@ -230,7 +230,7 @@ namespace ams::kern::svc {
R_TRY(process->Initialize(params, user_caps, num_caps, process_resource_limit, pool)); R_TRY(process->Initialize(params, user_caps, num_caps, process_resource_limit, pool));
/* Register the process. */ /* Register the process. */
R_TRY(KProcess::Register(process)); KProcess::Register(process);
/* Add the process to the handle table. */ /* Add the process to the handle table. */
R_TRY(handle_table.Add(out, process)); R_TRY(handle_table.Add(out, process));

View file

@ -78,8 +78,8 @@ namespace ams::kern::svc {
/* Initialize the resource limit. */ /* Initialize the resource limit. */
resource_limit->Initialize(); resource_limit->Initialize();
/* Try to register the limit. */ /* Register the limit. */
R_TRY(KResourceLimit::Register(resource_limit)); KResourceLimit::Register(resource_limit);
/* Add the limit to the handle table. */ /* Add the limit to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out_handle, resource_limit)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out_handle, resource_limit));

View file

@ -48,7 +48,7 @@ namespace ams::kern::svc {
}; };
/* Register the session. */ /* Register the session. */
R_TRY(T::Register(session)); T::Register(session);
/* Add the server session to the handle table. */ /* Add the server session to the handle table. */
R_TRY(handle_table.Add(out_server, std::addressof(session->GetServerSession()))); R_TRY(handle_table.Add(out_server, std::addressof(session->GetServerSession())));

View file

@ -117,7 +117,7 @@ namespace ams::kern::svc {
R_TRY(shmem->Initialize(GetCurrentProcessPointer(), size, owner_perm, remote_perm)); R_TRY(shmem->Initialize(GetCurrentProcessPointer(), size, owner_perm, remote_perm));
/* Register the shared memory. */ /* Register the shared memory. */
R_TRY(KSharedMemory::Register(shmem)); KSharedMemory::Register(shmem);
/* Add the shared memory to the handle table. */ /* Add the shared memory to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, shmem)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, shmem));

View file

@ -61,7 +61,7 @@ namespace ams::kern::svc {
thread->GetContext().CloneFpuStatus(); thread->GetContext().CloneFpuStatus();
/* Register the new thread. */ /* Register the new thread. */
R_TRY(KThread::Register(thread)); KThread::Register(thread);
/* Add the thread to the handle table. */ /* Add the thread to the handle table. */
R_TRY(process.GetHandleTable().Add(out, thread)); R_TRY(process.GetHandleTable().Add(out, thread));

View file

@ -111,7 +111,7 @@ namespace ams::kern::svc {
trmem_reservation.Commit(); trmem_reservation.Commit();
/* Register the transfer memory. */ /* Register the transfer memory. */
R_TRY(KTransferMemory::Register(trmem)); KTransferMemory::Register(trmem);
/* Add the transfer memory to the handle table. */ /* Add the transfer memory to the handle table. */
R_TRY(handle_table.Add(out, trmem)); R_TRY(handle_table.Add(out, trmem));