mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
kern: implement SvcCloseHandle
This commit is contained in:
parent
7400a8ff68
commit
d0d8914f28
6 changed files with 31 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue