service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services.
This commit is contained in:
parent
322349e8cc
commit
1a954b2a59
222 changed files with 1221 additions and 907 deletions
|
@ -827,8 +827,8 @@ void BSD::BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) co
|
|||
rb.PushEnum(bsd_errno);
|
||||
}
|
||||
|
||||
BSD::BSD(Core::System& system, const char* name)
|
||||
: ServiceFramework(name), worker_pool{system, this} {
|
||||
BSD::BSD(Core::System& system_, const char* name)
|
||||
: ServiceFramework{system_, name}, worker_pool{system_, this} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &BSD::RegisterClient, "RegisterClient"},
|
||||
|
@ -873,7 +873,7 @@ BSD::BSD(Core::System& system, const char* name)
|
|||
|
||||
BSD::~BSD() = default;
|
||||
|
||||
BSDCFG::BSDCFG() : ServiceFramework{"bsdcfg"} {
|
||||
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "SetIfUp"},
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Service::Sockets {
|
|||
|
||||
class BSD final : public ServiceFramework<BSD> {
|
||||
public:
|
||||
explicit BSD(Core::System& system, const char* name);
|
||||
explicit BSD(Core::System& system_, const char* name);
|
||||
~BSD() override;
|
||||
|
||||
private:
|
||||
|
@ -176,7 +176,7 @@ private:
|
|||
|
||||
class BSDCFG final : public ServiceFramework<BSDCFG> {
|
||||
public:
|
||||
explicit BSDCFG();
|
||||
explicit BSDCFG(Core::System& system_);
|
||||
~BSDCFG() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace Service::Sockets {
|
||||
|
||||
ETHC_C::ETHC_C() : ServiceFramework{"ethc:c"} {
|
||||
ETHC_C::ETHC_C(Core::System& system_) : ServiceFramework{system_, "ethc:c"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Initialize"},
|
||||
|
@ -23,7 +23,7 @@ ETHC_C::ETHC_C() : ServiceFramework{"ethc:c"} {
|
|||
|
||||
ETHC_C::~ETHC_C() = default;
|
||||
|
||||
ETHC_I::ETHC_I() : ServiceFramework{"ethc:i"} {
|
||||
ETHC_I::ETHC_I(Core::System& system_) : ServiceFramework{system_, "ethc:i"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "GetReadableHandle"},
|
||||
|
|
|
@ -6,17 +6,21 @@
|
|||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Sockets {
|
||||
|
||||
class ETHC_C final : public ServiceFramework<ETHC_C> {
|
||||
public:
|
||||
explicit ETHC_C();
|
||||
explicit ETHC_C(Core::System& system_);
|
||||
~ETHC_C() override;
|
||||
};
|
||||
|
||||
class ETHC_I final : public ServiceFramework<ETHC_I> {
|
||||
public:
|
||||
explicit ETHC_I();
|
||||
explicit ETHC_I(Core::System& system_);
|
||||
~ETHC_I() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace Service::Sockets {
|
||||
|
||||
NSD::NSD(const char* name) : ServiceFramework(name) {
|
||||
NSD::NSD(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{10, nullptr, "GetSettingName"},
|
||||
|
|
|
@ -4,14 +4,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Sockets {
|
||||
|
||||
class NSD final : public ServiceFramework<NSD> {
|
||||
public:
|
||||
explicit NSD(const char* name);
|
||||
explicit NSD(Core::System& system_, const char* name);
|
||||
~NSD() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,25 +7,7 @@
|
|||
|
||||
namespace Service::Sockets {
|
||||
|
||||
void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
|
||||
struct Parameters {
|
||||
u8 use_nsd_resolve;
|
||||
u32 unknown;
|
||||
u64 process_id;
|
||||
};
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto parameters = rp.PopRaw<Parameters>();
|
||||
|
||||
LOG_WARNING(Service,
|
||||
"(STUBBED) called. use_nsd_resolve={}, unknown=0x{:08X}, process_id=0x{:016X}",
|
||||
parameters.use_nsd_resolve, parameters.unknown, parameters.process_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
|
||||
SFDNSRES::SFDNSRES(Core::System& system_) : ServiceFramework{system_, "sfdnsres"} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "SetDnsAddressesPrivate"},
|
||||
{1, nullptr, "GetDnsAddressPrivate"},
|
||||
|
@ -49,4 +31,22 @@ SFDNSRES::SFDNSRES() : ServiceFramework("sfdnsres") {
|
|||
|
||||
SFDNSRES::~SFDNSRES() = default;
|
||||
|
||||
void SFDNSRES::GetAddrInfoRequest(Kernel::HLERequestContext& ctx) {
|
||||
struct Parameters {
|
||||
u8 use_nsd_resolve;
|
||||
u32 unknown;
|
||||
u64 process_id;
|
||||
};
|
||||
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto parameters = rp.PopRaw<Parameters>();
|
||||
|
||||
LOG_WARNING(Service,
|
||||
"(STUBBED) called. use_nsd_resolve={}, unknown=0x{:08X}, process_id=0x{:016X}",
|
||||
parameters.use_nsd_resolve, parameters.unknown, parameters.process_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
} // namespace Service::Sockets
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Sockets {
|
||||
|
||||
class SFDNSRES final : public ServiceFramework<SFDNSRES> {
|
||||
public:
|
||||
explicit SFDNSRES();
|
||||
explicit SFDNSRES(Core::System& system_);
|
||||
~SFDNSRES() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,15 +13,15 @@ namespace Service::Sockets {
|
|||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
||||
std::make_shared<BSD>(system, "bsd:s")->InstallAsService(service_manager);
|
||||
std::make_shared<BSD>(system, "bsd:u")->InstallAsService(service_manager);
|
||||
std::make_shared<BSDCFG>()->InstallAsService(service_manager);
|
||||
std::make_shared<BSDCFG>(system)->InstallAsService(service_manager);
|
||||
|
||||
std::make_shared<ETHC_C>()->InstallAsService(service_manager);
|
||||
std::make_shared<ETHC_I>()->InstallAsService(service_manager);
|
||||
std::make_shared<ETHC_C>(system)->InstallAsService(service_manager);
|
||||
std::make_shared<ETHC_I>(system)->InstallAsService(service_manager);
|
||||
|
||||
std::make_shared<NSD>("nsd:a")->InstallAsService(service_manager);
|
||||
std::make_shared<NSD>("nsd:u")->InstallAsService(service_manager);
|
||||
std::make_shared<NSD>(system, "nsd:a")->InstallAsService(service_manager);
|
||||
std::make_shared<NSD>(system, "nsd:u")->InstallAsService(service_manager);
|
||||
|
||||
std::make_shared<SFDNSRES>()->InstallAsService(service_manager);
|
||||
std::make_shared<SFDNSRES>(system)->InstallAsService(service_manager);
|
||||
}
|
||||
|
||||
} // namespace Service::Sockets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue