1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-17 17:36:44 +00:00

kern: implement SvcCloseHandle

This commit is contained in:
Michael Scire 2020-07-09 15:25:01 -07:00
parent 7400a8ff68
commit d0d8914f28
6 changed files with 31 additions and 3 deletions

View file

@ -29,6 +29,8 @@ namespace ams::kern {
constexpr KClientSession() : parent() { /* ... */ }
virtual ~KClientSession() { /* ... */ }
virtual void Destroy() override;
void Initialize(KSession *parent) {
/* Set member variables. */
this->parent = parent;

View file

@ -36,6 +36,8 @@ namespace ams::kern {
constexpr KServerSession() : parent(), request_list(), current_request(), lock() { /* ... */ }
virtual ~KServerSession() { /* ... */ }
virtual void Destroy() override;
void Initialize(KSession *p) { this->parent = p; }
constexpr const KSession *GetParent() const { return this->parent; }

View file

@ -17,6 +17,13 @@
namespace ams::kern {
void KClientSession::Destroy() {
MESOSPHERE_ASSERT_THIS();
this->parent->OnClientClosed();
this->parent->Close();
}
void KClientSession::OnServerClosed() {
MESOSPHERE_ASSERT_THIS();
}

View file

@ -17,6 +17,16 @@
namespace ams::kern {
void KServerSession::Destroy() {
MESOSPHERE_ASSERT_THIS();
this->parent->OnServerClosed();
/* TODO: this->CleanupRequests(); */
this->parent->Close();
}
Result KServerSession::OnRequest(KSessionRequest *request) {
MESOSPHERE_UNIMPLEMENTED();
}

View file

@ -21,6 +21,9 @@ namespace ams::kern {
MESOSPHERE_ASSERT_THIS();
/* Increment reference count. */
/* Because reference count is one on creation, this will result */
/* in a reference count of two. Thus, when both server and client are closed */
/* this object will be destroyed. */
this->Open();
/* Create our sub sessions. */

View file

@ -21,14 +21,18 @@ namespace ams::kern::svc {
namespace {
Result CloseHandle(ams::svc::Handle handle) {
/* Remove the handle. */
R_UNLESS(GetCurrentProcess().GetHandleTable().Remove(handle), svc::ResultInvalidHandle());
return ResultSuccess();
}
}
/* ============================= 64 ABI ============================= */
Result CloseHandle64(ams::svc::Handle handle) {
MESOSPHERE_PANIC("Stubbed SvcCloseHandle64 was called.");
return CloseHandle(handle);
}
Result ResetSignal64(ams::svc::Handle handle) {
@ -50,7 +54,7 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */
Result CloseHandle64From32(ams::svc::Handle handle) {
MESOSPHERE_PANIC("Stubbed SvcCloseHandle64From32 was called.");
return CloseHandle(handle);
}
Result ResetSignal64From32(ams::svc::Handle handle) {