Merge pull request #3181 from wwylele/ipc-handle-split

ipc_helper: split PushMoveObjects and PushCopyObjects
This commit is contained in:
B3n30 2017-12-04 18:49:42 +01:00 committed by GitHub
commit 3249187ad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View file

@ -114,7 +114,10 @@ public:
void PushMoveHandles(H... handles);
template <typename... O>
void PushObjects(Kernel::SharedPtr<O>... pointers);
void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
template <typename... O>
void PushMoveObjects(Kernel::SharedPtr<O>... pointers);
void PushCurrentPIDHandle();
@ -187,7 +190,12 @@ inline void RequestBuilder::PushMoveHandles(H... handles) {
}
template <typename... O>
inline void RequestBuilder::PushObjects(Kernel::SharedPtr<O>... pointers) {
inline void RequestBuilder::PushCopyObjects(Kernel::SharedPtr<O>... pointers) {
PushCopyHandles(context->AddOutgoingHandle(std::move(pointers))...);
}
template <typename... O>
inline void RequestBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
PushMoveHandles(context->AddOutgoingHandle(std::move(pointers))...);
}

View file

@ -206,7 +206,7 @@ void File::OpenLinkFile(Kernel::HLERequestContext& ctx) {
ClientConnected(std::get<SharedPtr<ServerSession>>(sessions));
rb.Push(RESULT_SUCCESS);
rb.PushObjects(std::get<SharedPtr<ClientSession>>(sessions));
rb.PushMoveObjects(std::get<SharedPtr<ClientSession>>(sessions));
}
File::~File() {}

View file

@ -66,7 +66,7 @@ void SRV::EnableNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
rb.PushObjects(notification_semaphore);
rb.PushCopyObjects(notification_semaphore);
LOG_WARNING(Service_SRV, "(STUBBED) called");
}
@ -114,7 +114,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
(*session)->GetObjectId());
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(session.Code());
rb.PushObjects(std::move(session).Unwrap());
rb.PushMoveObjects(std::move(session).Unwrap());
} else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) {
LOG_WARNING(Service_SRV, "called service=%s -> ERR_MAX_CONNECTIONS_REACHED", name.c_str());
// TODO(Subv): Put the caller guest thread to sleep until this port becomes available again.
@ -204,7 +204,7 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
rb.PushObjects(port.Unwrap());
rb.PushMoveObjects(port.Unwrap());
}
SRV::SRV(std::shared_ptr<ServiceManager> service_manager)