mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-04 08:32:15 +02:00
Compare commits
2 Commits
fc16f28d0c
...
72b0fe6c1c
Author | SHA1 | Date | |
---|---|---|---|
|
72b0fe6c1c | ||
|
e919b80fa2 |
@ -500,7 +500,7 @@ namespace ams::fs {
|
|||||||
|
|
||||||
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
|
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
|
||||||
|
|
||||||
RomFileTable::FileInfo file_info;
|
RomFileTable::FileInfo file_info{};
|
||||||
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
R_TRY(this->GetFileInfo(std::addressof(file_info), path.GetString()));
|
||||||
|
|
||||||
auto file = std::make_unique<RomFsFile>(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get());
|
auto file = std::make_unique<RomFsFile>(this, m_entry_size + file_info.offset.Get(), m_entry_size + file_info.offset.Get() + file_info.size.Get());
|
||||||
|
@ -288,7 +288,7 @@ namespace ams::htc::server::rpc {
|
|||||||
/* Get a task. */
|
/* Get a task. */
|
||||||
Task *task;
|
Task *task;
|
||||||
u32 task_id{};
|
u32 task_id{};
|
||||||
PacketCategory category;
|
PacketCategory category{};
|
||||||
do {
|
do {
|
||||||
/* Dequeue a task. */
|
/* Dequeue a task. */
|
||||||
R_TRY(m_task_queue.Take(std::addressof(task_id), std::addressof(category)));
|
R_TRY(m_task_queue.Take(std::addressof(task_id), std::addressof(category)));
|
||||||
|
@ -39,7 +39,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Socket(s32 *out_err, s32 *out_desc, bool enable_disconnection_emulation) {
|
void HtcsManager::Socket(s32 *out_err, s32 *out_desc, bool enable_disconnection_emulation) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err, desc;
|
s32 err = -1, desc = -1;
|
||||||
const Result result = m_impl->CreateSocket(std::addressof(err), std::addressof(desc), enable_disconnection_emulation);
|
const Result result = m_impl->CreateSocket(std::addressof(err), std::addressof(desc), enable_disconnection_emulation);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -71,7 +71,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Connect(s32 *out_err, s32 *out_res, const SockAddrHtcs &address, s32 desc) {
|
void HtcsManager::Connect(s32 *out_err, s32 *out_res, const SockAddrHtcs &address, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
const Result result = m_impl->Connect(std::addressof(err), desc, address);
|
const Result result = m_impl->Connect(std::addressof(err), desc, address);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -90,7 +90,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Bind(s32 *out_err, s32 *out_res, const SockAddrHtcs &address, s32 desc) {
|
void HtcsManager::Bind(s32 *out_err, s32 *out_res, const SockAddrHtcs &address, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
const Result result = m_impl->Bind(std::addressof(err), desc, address);
|
const Result result = m_impl->Bind(std::addressof(err), desc, address);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -109,7 +109,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Listen(s32 *out_err, s32 *out_res, s32 backlog_count, s32 desc) {
|
void HtcsManager::Listen(s32 *out_err, s32 *out_res, s32 backlog_count, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
const Result result = m_impl->Listen(std::addressof(err), desc, backlog_count);
|
const Result result = m_impl->Listen(std::addressof(err), desc, backlog_count);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -128,8 +128,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Recv(s32 *out_err, s64 *out_size, char *buffer, size_t size, s32 flags, s32 desc) {
|
void HtcsManager::Recv(s32 *out_err, s64 *out_size, char *buffer, size_t size, s32 flags, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 recv_size;
|
s64 recv_size = -1;
|
||||||
const Result result = m_impl->Receive(std::addressof(err), std::addressof(recv_size), buffer, size, desc, flags);
|
const Result result = m_impl->Receive(std::addressof(err), std::addressof(recv_size), buffer, size, desc, flags);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -148,8 +148,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Send(s32 *out_err, s64 *out_size, const char *buffer, size_t size, s32 flags, s32 desc) {
|
void HtcsManager::Send(s32 *out_err, s64 *out_size, const char *buffer, size_t size, s32 flags, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 send_size;
|
s64 send_size = -1;
|
||||||
const Result result = m_impl->Send(std::addressof(err), std::addressof(send_size), buffer, size, desc, flags);
|
const Result result = m_impl->Send(std::addressof(err), std::addressof(send_size), buffer, size, desc, flags);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -168,7 +168,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Shutdown(s32 *out_err, s32 *out_res, s32 how, s32 desc) {
|
void HtcsManager::Shutdown(s32 *out_err, s32 *out_res, s32 how, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
const Result result = m_impl->Shutdown(std::addressof(err), desc, how);
|
const Result result = m_impl->Shutdown(std::addressof(err), desc, how);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -191,7 +191,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::Fcntl(s32 *out_err, s32 *out_res, s32 command, s32 value, s32 desc) {
|
void HtcsManager::Fcntl(s32 *out_err, s32 *out_res, s32 command, s32 value, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err, res;
|
s32 err = -1, res = -1;
|
||||||
const Result result = m_impl->Fcntl(std::addressof(err), std::addressof(res), desc, command, value);
|
const Result result = m_impl->Fcntl(std::addressof(err), std::addressof(res), desc, command, value);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -210,7 +210,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) {
|
void HtcsManager::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
const Result result = m_impl->AcceptResults(std::addressof(err), out_desc, out_address, task_id, desc);
|
const Result result = m_impl->AcceptResults(std::addressof(err), out_desc, out_address, task_id, desc);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -233,8 +233,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
void HtcsManager::RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 size;
|
s64 size = -1;
|
||||||
const Result result = m_impl->RecvResults(std::addressof(err), std::addressof(size), buffer, buffer_size, task_id, desc);
|
const Result result = m_impl->RecvResults(std::addressof(err), std::addressof(size), buffer, buffer_size, task_id, desc);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -265,8 +265,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
void HtcsManager::SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 size;
|
s64 size = -1;
|
||||||
const Result result = m_impl->SendResults(std::addressof(err), std::addressof(size), task_id, desc);
|
const Result result = m_impl->SendResults(std::addressof(err), std::addressof(size), task_id, desc);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -293,7 +293,7 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
Result HtcsManager::ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
Result HtcsManager::ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s64 size;
|
s64 size = -1;
|
||||||
R_TRY_CATCH(m_impl->ContinueSend(std::addressof(size), buffer, buffer_size, task_id, desc)) {
|
R_TRY_CATCH(m_impl->ContinueSend(std::addressof(size), buffer, buffer_size, task_id, desc)) {
|
||||||
R_CONVERT(htclow::ResultInvalidChannelState, tma::ResultUnknown())
|
R_CONVERT(htclow::ResultInvalidChannelState, tma::ResultUnknown())
|
||||||
R_CONVERT(htc::ResultTaskCancelled, tma::ResultUnknown())
|
R_CONVERT(htc::ResultTaskCancelled, tma::ResultUnknown())
|
||||||
@ -306,8 +306,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
void HtcsManager::EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 size;
|
s64 size = -1;
|
||||||
const Result result = m_impl->EndSend(std::addressof(err), std::addressof(size), task_id, desc);
|
const Result result = m_impl->EndSend(std::addressof(err), std::addressof(size), task_id, desc);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -334,8 +334,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
void HtcsManager::EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
void HtcsManager::EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
s64 size;
|
s64 size = -1;
|
||||||
const Result result = m_impl->EndRecv(std::addressof(err), std::addressof(size), buffer, buffer_size, task_id, desc);
|
const Result result = m_impl->EndRecv(std::addressof(err), std::addressof(size), buffer, buffer_size, task_id, desc);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
@ -367,8 +367,8 @@ namespace ams::htcs::impl {
|
|||||||
|
|
||||||
Result HtcsManager::EndSelect(s32 *out_err, s32 *out_count, Span<int> read_handles, Span<int> write_handles, Span<int> exception_handles, u32 task_id) {
|
Result HtcsManager::EndSelect(s32 *out_err, s32 *out_count, Span<int> read_handles, Span<int> write_handles, Span<int> exception_handles, u32 task_id) {
|
||||||
/* Invoke our implementation. */
|
/* Invoke our implementation. */
|
||||||
s32 err;
|
s32 err = -1;
|
||||||
bool empty;
|
bool empty = false;
|
||||||
const Result result = m_impl->EndSelect(std::addressof(err), std::addressof(empty), read_handles, write_handles, exception_handles, task_id);
|
const Result result = m_impl->EndSelect(std::addressof(err), std::addressof(empty), read_handles, write_handles, exception_handles, task_id);
|
||||||
|
|
||||||
/* Set output. */
|
/* Set output. */
|
||||||
|
@ -107,9 +107,9 @@ namespace ams::mitm::socket::resolver {
|
|||||||
HostName,
|
HostName,
|
||||||
};
|
};
|
||||||
|
|
||||||
ams::socket::InAddrT current_address;
|
ams::socket::InAddrT current_address{};
|
||||||
char current_hostname[0x200];
|
char current_hostname[0x200];
|
||||||
u32 work;
|
u32 work{};
|
||||||
|
|
||||||
State state = State::BeginLine;
|
State state = State::BeginLine;
|
||||||
for (const char *cur = file_data; *cur != '\x00'; ++cur) {
|
for (const char *cur = file_data; *cur != '\x00'; ++cur) {
|
||||||
|
@ -243,29 +243,35 @@ namespace ams::pm::impl {
|
|||||||
const u64 boost_size = normal_boost + mitm_boost;
|
const u64 boost_size = normal_boost + mitm_boost;
|
||||||
|
|
||||||
/* Don't allow all application memory to be taken away. */
|
/* Don't allow all application memory to be taken away. */
|
||||||
R_UNLESS(boost_size <= g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_Application], pm::ResultInvalidSize());
|
R_UNLESS(boost_size < g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_Application], pm::ResultInvalidSize());
|
||||||
|
|
||||||
const u64 new_app_size = g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_Application] - boost_size;
|
const u64 new_app_size = g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_Application] - boost_size;
|
||||||
{
|
{
|
||||||
std::scoped_lock lk(g_resource_limit_lock);
|
std::scoped_lock lk(g_resource_limit_lock);
|
||||||
|
|
||||||
|
const auto cur_boost_size = GetCurrentSystemMemoryBoostSize();
|
||||||
|
|
||||||
if (hos::GetVersion() >= hos::Version_5_0_0) {
|
if (hos::GetVersion() >= hos::Version_5_0_0) {
|
||||||
/* Starting in 5.0.0, PM does not allow for only one of the sets to fail. */
|
/* Starting in 5.0.0, PM does not allow for only one of the sets to fail. */
|
||||||
if (boost_size < GetCurrentSystemMemoryBoostSize()) {
|
if (boost_size < cur_boost_size) {
|
||||||
R_TRY(svc::SetUnsafeLimit(boost_size));
|
R_TRY(svc::SetUnsafeLimit(boost_size));
|
||||||
R_ABORT_UNLESS(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
R_ABORT_UNLESS(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
||||||
} else {
|
} else if (boost_size > cur_boost_size) {
|
||||||
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
||||||
R_ABORT_UNLESS(svc::SetUnsafeLimit(boost_size));
|
R_ABORT_UNLESS(svc::SetUnsafeLimit(boost_size));
|
||||||
|
} else {
|
||||||
|
/* If the boost size is equal, there's nothing to do. */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const u64 new_sys_size = g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_System] + boost_size;
|
const u64 new_sys_size = g_memory_resource_limits[g_memory_arrangement][ResourceLimitGroup_System] + boost_size;
|
||||||
if (boost_size < GetCurrentSystemMemoryBoostSize()) {
|
if (boost_size < cur_boost_size) {
|
||||||
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_System, new_sys_size));
|
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_System, new_sys_size));
|
||||||
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
||||||
|
} else if (boost_size > cur_boost_size) {
|
||||||
|
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
||||||
|
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_System, new_sys_size));
|
||||||
} else {
|
} else {
|
||||||
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_Application, new_app_size));
|
/* If the boost size is equal, there's nothing to do. */
|
||||||
R_TRY(SetMemoryResourceLimitLimitValue(ResourceLimitGroup_System, new_sys_size));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user