ams: mark ams::Result [[nodiscard]] (partially complete).

NOTE: This work is not yet fully complete; kernel is done, but
it was taking an exceedingly long time to get through libstratosphere.
Thus, I've temporarily added -Wno-error=unused-result for libstratosphere/stratosphere.

All warnings should be fixed to do the same thing Nintendo does as relevant, but this
is taking a phenomenally long time and is not actually the most important work to do,
so it can be put off for some time to prioritize other tasks for 21.0.0 support.
This commit is contained in:
Michael Scire
2025-11-11 16:13:25 -07:00
parent 0b9cf32cdc
commit 98e131fcd1
86 changed files with 444 additions and 455 deletions

View File

@@ -20,7 +20,7 @@ namespace ams::cs {
void InitializeTargetIoServer() {
/* Launch target io server. */
os::ProcessId process_id;
scs::LaunchProgram(std::addressof(process_id), ncm::ProgramLocation::Make(ncm::SystemProgramId::DevServer, ncm::StorageId::None), nullptr, 0, 0);
static_cast<void>(scs::LaunchProgram(std::addressof(process_id), ncm::ProgramLocation::Make(ncm::SystemProgramId::DevServer, ncm::StorageId::None), nullptr, 0, 0));
}
}

View File

@@ -35,7 +35,9 @@ namespace ams::erpt::srv {
Attachment::~Attachment() {
this->CloseStream();
if (m_record->RemoveReference()) {
this->DeleteStream(this->FileName().name);
if (R_FAILED(this->DeleteStream(this->FileName().name))) {
/* TODO: Log failure? */
}
delete m_record;
}
}

View File

@@ -81,7 +81,7 @@ namespace ams::erpt::srv {
oaep.Encrypt(cipher, sizeof(cipher), s_key, sizeof(s_key), salt, sizeof(salt));
}
Formatter::AddField(report, FieldId_CipherKey, cipher, sizeof(cipher));
R_TRY(Formatter::AddField(report, FieldId_CipherKey, cipher, s_need_to_store_cipher ? sizeof(cipher) : 1));
std::memset(s_key, 0, sizeof(s_key));
R_RETURN(Formatter::End(report));

View File

@@ -90,16 +90,15 @@ namespace ams::erpt::srv {
Result Context::WriteContextsToReport(Report *report) {
R_TRY(report->Open(ReportOpenType_Create));
ON_SCOPE_EXIT { report->Close(); };
R_TRY(Cipher::Begin(report, ContextRecord::GetRecordCount()));
for (auto it = g_category_list.begin(); it != g_category_list.end(); it++) {
R_TRY(it->AddCategoryToReport(report));
}
Cipher::End(report);
report->Close();
R_SUCCEED();
R_RETURN(Cipher::End(report));
}
Result Context::ClearContext(CategoryId cat) {

View File

@@ -211,7 +211,7 @@ namespace ams::erpt::srv {
Result ContextImpl::InvalidateForcedShutdownDetection() {
/* NOTE: Nintendo does not check the result here. */
erpt::srv::InvalidateForcedShutdownDetection();
static_cast<void>(erpt::srv::InvalidateForcedShutdownDetection());
R_SUCCEED();
}

View File

@@ -228,27 +228,27 @@ namespace ams::erpt::srv {
/* Check if the forced shutdown context exists; if it doesn't, we should create an empty one. */
if (!IsForceShutdownDetected()) {
/* NOTE: Nintendo does not check result here. */
CreateForcedShutdownContext();
static_cast<void>(CreateForcedShutdownContext());
return;
}
/* Load the forced shutdown context. */
/* NOTE: Nintendo does not check that this succeeds. */
LoadForcedShutdownContext();
static_cast<void>(LoadForcedShutdownContext());
/* Create report for the forced shutdown. */
/* NOTE: Nintendo does not check that this succeeds. */
CreateReportForForcedShutdown();
static_cast<void>(CreateReportForForcedShutdown());
/* Clear the forced shutdown categories. */
/* NOTE: Nintendo does not check that this succeeds. */
Context::ClearContext(CategoryId_RunningApplicationInfo);
Context::ClearContext(CategoryId_RunningAppletInfo);
Context::ClearContext(CategoryId_FocusedAppletHistoryInfo);
static_cast<void>(Context::ClearContext(CategoryId_RunningApplicationInfo));
static_cast<void>(Context::ClearContext(CategoryId_RunningAppletInfo));
static_cast<void>(Context::ClearContext(CategoryId_FocusedAppletHistoryInfo));
/* Save the forced shutdown context. */
/* NOTE: Nintendo does not check that this succeeds. */
SaveForcedShutdownContext();
static_cast<void>(SaveForcedShutdownContext());
}
void FinalizeForcedShutdownDetection() {
@@ -265,7 +265,7 @@ namespace ams::erpt::srv {
void SaveForcedShutdownContext() {
/* NOTE: Nintendo does not check that saving the report succeeds. */
SaveForcedShutdownContextImpl();
static_cast<void>(SaveForcedShutdownContextImpl());
}
void SubmitContextForForcedShutdownDetection(const ContextEntry *entry, const u8 *data, u32 data_size) {

View File

@@ -42,7 +42,7 @@ namespace ams::erpt::srv {
/* Close and commit the stream. */
stream.CloseStream();
stream.CommitStream();
R_TRY(stream.CommitStream());
R_SUCCEED();
}

View File

@@ -34,7 +34,9 @@ namespace ams::erpt::srv {
auto *record = std::addressof(*it);
it = s_attachment_list.erase(s_attachment_list.iterator_to(*record));
if (record->RemoveReference()) {
Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name);
if (R_FAILED(Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name))) {
/* TODO: Log failure? */
}
delete record;
}
}
@@ -66,7 +68,9 @@ namespace ams::erpt::srv {
/* Delete the object, if we should. */
if (record->RemoveReference()) {
Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name);
const auto delete_res = Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name);
R_ASSERT(delete_res);
AMS_UNUSED(delete_res);
delete record;
}
} else {
@@ -128,12 +132,13 @@ namespace ams::erpt::srv {
}
if (record->m_info.flags.Test<AttachmentFlag::HasOwner>() && JournalForReports::RetrieveRecord(record->m_info.owner_report_id) != nullptr) {
/* NOTE: Nintendo does not check the result of storing the new record... */
record_guard.Cancel();
StoreRecord(record);
R_TRY(StoreRecord(record));
} else {
/* If the attachment has no owner (or we deleted the report), delete the file associated with it. */
Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name);
const auto delete_res = Stream::DeleteStream(Attachment::FileName(record->m_info.attachment_id).name);
R_ASSERT(delete_res);
AMS_UNUSED(delete_res);
}
}

View File

@@ -29,7 +29,9 @@ namespace ams::erpt::srv {
auto *record = std::addressof(*it);
it = s_record_list.erase(s_record_list.iterator_to(*record));
if (record->RemoveReference()) {
Stream::DeleteStream(Report::FileName(record->m_info.id, false).name);
if (R_FAILED(Stream::DeleteStream(Report::FileName(record->m_info.id, false).name))) {
/* TODO: Log failure? */
}
delete record;
}
}
@@ -65,12 +67,14 @@ namespace ams::erpt::srv {
/* Delete any attachments. */
if (force_delete_attachments || record->m_info.flags.Test<ReportFlag::HasAttachment>()) {
JournalForAttachments::DeleteAttachments(record->m_info.id);
static_cast<void>(JournalForAttachments::DeleteAttachments(record->m_info.id));
}
/* Delete the object, if we should. */
if (record->RemoveReference()) {
Stream::DeleteStream(Report::FileName(record->m_info.id, false).name);
const auto delete_res = Stream::DeleteStream(Report::FileName(record->m_info.id, false).name);
R_ASSERT(delete_res);
AMS_UNUSED(delete_res);
delete record;
}
}
@@ -164,8 +168,7 @@ namespace ams::erpt::srv {
record_guard.Cancel();
/* NOTE: Nintendo does not check the result of storing the new record... */
StoreRecord(record);
R_TRY(StoreRecord(record));
}
cleanup_guard.Cancel();

View File

@@ -56,8 +56,8 @@ namespace ams::erpt::srv {
fs::DisableAutoSaveDataCreation();
/* Extend the system save data. */
/* NOTE: Nintendo does not check result of this. */
ExtendSystemSaveData();
/* NOTE: Nintendo used to not check the result of this; they do now, but . */
static_cast<void>(ExtendSystemSaveData());
R_TRY_CATCH(fs::MountSystemSaveData(ReportStoragePath, SystemSaveDataId)) {
R_CATCH(fs::ResultTargetNotFound) {
@@ -97,7 +97,7 @@ namespace ams::erpt::srv {
}
if (report_count >= MinimumReportCountForCleanup) {
fs::CleanDirectoryRecursively(ReportOnSdStorageRootDirectoryPath);
static_cast<void>(fs::CleanDirectoryRecursively(ReportOnSdStorageRootDirectoryPath));
}
}
@@ -110,7 +110,9 @@ namespace ams::erpt::srv {
AMS_ABORT_UNLESS(ctx != nullptr);
}
Journal::Restore();
if (R_FAILED(Journal::Restore())) {
/* TODO: Nintendo deletes system savedata when this fails. Should we?. */
}
Reporter::UpdatePowerOnTime();
Reporter::UpdateAwakeTime();

View File

@@ -39,11 +39,10 @@ namespace ams::erpt::srv {
m_system_event.Signal();
}
Result ManagerImpl::NotifyAll() {
void ManagerImpl::NotifyAll() {
for (auto &manager : g_manager_list) {
manager.NotifyOne();
}
R_SUCCEED();
}
Result ManagerImpl::GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter) {

View File

@@ -27,7 +27,7 @@ namespace ams::erpt::srv {
private:
void NotifyOne();
public:
static Result NotifyAll();
static void NotifyAll();
public:
Result GetReportList(const ams::sf::OutBuffer &out_list, ReportType type_filter);
Result GetEvent(ams::sf::OutCopyHandle out);

View File

@@ -41,7 +41,9 @@ namespace ams::erpt::srv {
Report::~Report() {
this->CloseStream();
if (m_record->RemoveReference()) {
this->DeleteStream(this->FileName().name);
if (R_FAILED(this->DeleteStream(this->FileName().name))) {
/* TODO: Log failure? */
}
delete m_record;
}
}

View File

@@ -124,29 +124,19 @@ namespace ams::erpt::srv {
if (error_context_total_size == 0) {
return;
}
record->Add(FieldId_ErrorContextTotalSize, error_context_total_size);
static_cast<void>(record->Add(FieldId_ErrorContextTotalSize, error_context_total_size));
/* Set the context. */
if (error_context_size == 0) {
return;
}
record->Add(FieldId_ErrorContextSize, error_context_size);
record->Add(FieldId_ErrorContext, error_context, error_context_size);
static_cast<void>(record->Add(FieldId_ErrorContextSize, error_context_size));
static_cast<void>(record->Add(FieldId_ErrorContext, error_context, error_context_size));
}
constinit os::SdkMutex g_limit_mutex;
constinit bool g_submitted_limit = false;
void SubmitResourceLimitLimitContext() {
std::scoped_lock lk(g_limit_mutex);
if (g_submitted_limit) {
return;
}
ON_SCOPE_EXIT { g_submitted_limit = true; };
void SubmitResourceLimitContexts() {
/* Create and populate the record. */
auto record = std::make_unique<ContextRecord>(CategoryId_ResourceLimitLimitInfo);
auto record = std::make_unique<ContextRecord>(CategoryId_ResourceLimitInfo);
if (record == nullptr) {
return;
}
@@ -165,7 +155,15 @@ namespace ams::erpt::srv {
if (R_FAILED(svc::GetResourceLimitLimitValue(std::addressof(limit_value), handle, svc::LimitableResource_##__RESOURCE__##Max))) { \
return; \
} \
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Limit, limit_value))) { \
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Limit, limit_value))) { \
return; \
} \
\
s64 peak_value; \
if (R_FAILED(svc::GetResourceLimitPeakValue(std::addressof(peak_value), handle, svc::LimitableResource_##__RESOURCE__##Max))) { \
return; \
} \
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Peak, peak_value))) { \
return; \
} \
} while (0)
@@ -178,51 +176,7 @@ namespace ams::erpt::srv {
#undef ADD_RESOURCE
Context::SubmitContextRecord(std::move(record));
g_submitted_limit = true;
}
void SubmitResourceLimitPeakContext() {
/* Create and populate the record. */
auto record = std::make_unique<ContextRecord>(CategoryId_ResourceLimitPeakInfo);
if (record == nullptr) {
return;
}
u64 reslimit_handle_value;
if (R_FAILED(svc::GetInfo(std::addressof(reslimit_handle_value), svc::InfoType_ResourceLimit, svc::InvalidHandle, 0))) {
return;
}
const auto handle = static_cast<svc::Handle>(reslimit_handle_value);
ON_SCOPE_EXIT { R_ABORT_UNLESS(svc::CloseHandle(handle)); };
#define ADD_RESOURCE(__RESOURCE__) \
do { \
s64 peak_value; \
if (R_FAILED(svc::GetResourceLimitPeakValue(std::addressof(peak_value), handle, svc::LimitableResource_##__RESOURCE__##Max))) { \
return; \
} \
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Peak, peak_value))) { \
return; \
} \
} while (0)
ADD_RESOURCE(PhysicalMemory);
ADD_RESOURCE(ThreadCount);
ADD_RESOURCE(EventCount);
ADD_RESOURCE(TransferMemoryCount);
ADD_RESOURCE(SessionCount);
#undef ADD_RESOURCE
Context::SubmitContextRecord(std::move(record));
}
void SubmitResourceLimitContexts() {
SubmitResourceLimitLimitContext();
SubmitResourceLimitPeakContext();
static_cast<void>(Context::SubmitContextRecord(std::move(record)));
}
#else
void SubmitErrorContext(ContextRecord *record, Result result) {
@@ -262,11 +216,11 @@ namespace ams::erpt::srv {
}
if (!found_abort_flag) {
record->Add(FieldId_AbortFlag, false);
static_cast<void>(record->Add(FieldId_AbortFlag, false));
}
if (!found_syslog_flag) {
record->Add(FieldId_HasSyslogFlag, true);
static_cast<void>(record->Add(FieldId_HasSyslogFlag, true));
}
R_TRY(Context::SubmitContextRecord(std::move(record)));
@@ -377,7 +331,7 @@ namespace ams::erpt::srv {
auto report = std::make_unique<Report>(record.get(), redirect_new_reports);
R_UNLESS(report != nullptr, erpt::ResultOutOfMemory());
auto report_guard = SCOPE_GUARD { report->Delete(); };
auto report_guard = SCOPE_GUARD { const auto delete_res = report->Delete(); R_ASSERT(delete_res); AMS_UNUSED(delete_res); };
R_TRY(Context::WriteContextsToReport(report.get()));
R_TRY(report->GetSize(std::addressof(record->m_info.report_size)));
@@ -429,9 +383,9 @@ namespace ams::erpt::srv {
Result Reporter::CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments, erpt::CreateReportOptionFlagSet flags, const ReportId *specified_report_id) {
/* Clear the automatic categories, when we're done with our report. */
ON_SCOPE_EXIT {
Context::ClearContext(CategoryId_ErrorInfo);
Context::ClearContext(CategoryId_ErrorInfoAuto);
Context::ClearContext(CategoryId_ErrorInfoDefaults);
static_cast<void>(Context::ClearContext(CategoryId_ErrorInfo));
static_cast<void>(Context::ClearContext(CategoryId_ErrorInfoAuto));
static_cast<void>(Context::ClearContext(CategoryId_ErrorInfoDefaults));
};
/* Get the context entry pointer. */
@@ -490,28 +444,28 @@ namespace ams::erpt::srv {
R_ABORT_UNLESS(time::GetStandardSteadyClockCurrentTimePoint(std::addressof(steady_clock_current_timepoint)));
/* Add automatic fields. */
auto_record->Add(FieldId_OsVersion, s_os_version, util::Strnlen(s_os_version, sizeof(s_os_version)));
auto_record->Add(FieldId_PrivateOsVersion, s_private_os_version, util::Strnlen(s_private_os_version, sizeof(s_private_os_version)));
auto_record->Add(FieldId_SerialNumber, s_serial_number, util::Strnlen(s_serial_number, sizeof(s_serial_number)));
auto_record->Add(FieldId_ReportIdentifier, identifier_str, util::Strnlen(identifier_str, sizeof(identifier_str)));
auto_record->Add(FieldId_OccurrenceTimestamp, timestamp_user.value);
auto_record->Add(FieldId_OccurrenceTimestampNet, timestamp_network.value);
auto_record->Add(FieldId_ReportVisibilityFlag, type == ReportType_Visible);
auto_record->Add(FieldId_OccurrenceTick, occurrence_tick.GetInt64Value());
auto_record->Add(FieldId_SteadyClockInternalOffset, steady_clock_internal_offset_seconds);
auto_record->Add(FieldId_SteadyClockCurrentTimePointValue, steady_clock_current_timepoint.value);
auto_record->Add(FieldId_ElapsedTimeSincePowerOn, (occurrence_tick - *s_power_on_time).ToTimeSpan().GetSeconds());
auto_record->Add(FieldId_ElapsedTimeSinceLastAwake, (occurrence_tick - *s_awake_time).ToTimeSpan().GetSeconds());
static_cast<void>(auto_record->Add(FieldId_OsVersion, s_os_version, util::Strnlen(s_os_version, sizeof(s_os_version))));
static_cast<void>(auto_record->Add(FieldId_PrivateOsVersion, s_private_os_version, util::Strnlen(s_private_os_version, sizeof(s_private_os_version))));
static_cast<void>(auto_record->Add(FieldId_SerialNumber, s_serial_number, util::Strnlen(s_serial_number, sizeof(s_serial_number))));
static_cast<void>(auto_record->Add(FieldId_ReportIdentifier, identifier_str, util::Strnlen(identifier_str, sizeof(identifier_str))));
static_cast<void>(auto_record->Add(FieldId_OccurrenceTimestamp, timestamp_user.value));
static_cast<void>(auto_record->Add(FieldId_OccurrenceTimestampNet, timestamp_network.value));
static_cast<void>(auto_record->Add(FieldId_ReportVisibilityFlag, type == ReportType_Visible));
static_cast<void>(auto_record->Add(FieldId_OccurrenceTick, occurrence_tick.GetInt64Value()));
static_cast<void>(auto_record->Add(FieldId_SteadyClockInternalOffset, steady_clock_internal_offset_seconds));
static_cast<void>(auto_record->Add(FieldId_SteadyClockCurrentTimePointValue, steady_clock_current_timepoint.value));
static_cast<void>(auto_record->Add(FieldId_ElapsedTimeSincePowerOn, (occurrence_tick - *s_power_on_time).ToTimeSpan().GetSeconds()));
static_cast<void>(auto_record->Add(FieldId_ElapsedTimeSinceLastAwake, (occurrence_tick - *s_awake_time).ToTimeSpan().GetSeconds()));
if (s_initial_launch_settings_completion_time) {
s64 elapsed_seconds;
if (R_SUCCEEDED(time::GetElapsedSecondsBetween(std::addressof(elapsed_seconds), *s_initial_launch_settings_completion_time, steady_clock_current_timepoint))) {
auto_record->Add(FieldId_ElapsedTimeSinceInitialLaunch, elapsed_seconds);
static_cast<void>(auto_record->Add(FieldId_ElapsedTimeSinceInitialLaunch, elapsed_seconds));
}
}
if (s_application_launch_time) {
auto_record->Add(FieldId_ApplicationAliveTime, (occurrence_tick - *s_application_launch_time).ToTimeSpan().GetSeconds());
static_cast<void>(auto_record->Add(FieldId_ApplicationAliveTime, (occurrence_tick - *s_application_launch_time).ToTimeSpan().GetSeconds()));
}
/* Submit applet active duration information. */
@@ -535,7 +489,7 @@ namespace ams::erpt::srv {
#if defined(ATMOSPHERE_OS_HORIZON)
if (hos::GetVersion() >= hos::Version_17_0_0 && flags.Test<CreateReportOptionFlag::SubmitFsInfo>()) {
/* NOTE: Nintendo ignores the result of this call. */
SubmitFsInfo();
static_cast<void>(SubmitFsInfo());
}
#else
AMS_UNUSED(flags);

View File

@@ -36,7 +36,10 @@ namespace ams::erpt::srv {
std::scoped_lock lk(s_fs_commit_mutex);
fs::CommitSaveData(ReportStoragePath);
const auto commit_res = fs::CommitSaveData(ReportStoragePath);
R_ASSERT(commit_res);
AMS_UNUSED(commit_res);
R_SUCCEED();
}
@@ -81,7 +84,7 @@ namespace ams::erpt::srv {
} R_END_TRY_CATCH;
break;
}
fs::SetFileSize(m_file_handle, 0);
R_TRY(fs::SetFileSize(m_file_handle, 0));
} else {
R_UNLESS(mode == StreamMode_Read, erpt::ResultInvalidArgument());
@@ -187,8 +190,13 @@ namespace ams::erpt::srv {
if (m_initialized) {
if (s_can_access_fs) {
if (m_stream_mode == StreamMode_Write) {
this->Flush();
fs::FlushFile(m_file_handle);
const auto self_flush_res = this->Flush();
R_ASSERT(self_flush_res);
AMS_UNUSED(self_flush_res);
const auto file_flush_res = fs::FlushFile(m_file_handle);
R_ASSERT(file_flush_res);
AMS_UNUSED(file_flush_res);
}
fs::CloseFile(m_file_handle);
}

View File

@@ -585,7 +585,7 @@ namespace ams::fs::impl {
}
/* Output. */
OutputAccessLogToSdCardImpl(log_buffer.get(), log_buffer_size - 1);
static_cast<void>(OutputAccessLogToSdCardImpl(log_buffer.get(), log_buffer_size - 1));
}
}
@@ -593,7 +593,7 @@ namespace ams::fs::impl {
if ((g_global_access_log_mode & AccessLogMode_Log) != 0) {
/* TODO: Support logging. */
} else if ((g_global_access_log_mode & AccessLogMode_SdCard) != 0) {
OutputAccessLogToSdCardImpl(log, size - 1);
static_cast<void>(OutputAccessLogToSdCardImpl(log, size - 1));
}
}

View File

@@ -105,7 +105,9 @@ namespace ams::fs {
AMS_ABORT_UNLESS(fsp_object != nullptr);
/* Set the current process. */
fsp_object->SetCurrentProcess({});
const auto scp_res = fsp_object->SetCurrentProcess({});
R_ASSERT(scp_res);
AMS_UNUSED(scp_res);
}
#else
/* On non-horizon, use the system object. */

View File

@@ -107,7 +107,7 @@ namespace ams::fs::impl {
size_t len;
if (R_SUCCEEDED(PathFormatter::IsNormalized(std::addressof(normalized), std::addressof(len), p, m_path_flags)) && normalized) {
/* We can use the input buffer directly. */
out->SetShallowBuffer(p);
R_TRY(out->SetShallowBuffer(p));
} else {
/* Initialize with appropriate slash replacement. */
if (m_path_flags.IsWindowsPathAllowed()) {

View File

@@ -38,7 +38,7 @@ namespace ams::fs {
}
void CloseDirectory(DirectoryHandle handle) {
AMS_FS_IMPL_ACCESS_LOG((delete Get(handle), ResultSuccess()), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE);
static_cast<void>(AMS_FS_IMPL_ACCESS_LOG((delete Get(handle), ResultSuccess()), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE));
}
}

View File

@@ -78,12 +78,12 @@ namespace ams::fs {
int GetFileOpenMode(FileHandle handle) {
const int mode = Get(handle)->GetOpenMode();
AMS_FS_IMPL_ACCESS_LOG(ResultSuccess(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_OPEN_MODE, static_cast<u32>(mode));
static_cast<void>(AMS_FS_IMPL_ACCESS_LOG(ResultSuccess(), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_OPEN_MODE, static_cast<u32>(mode)));
return mode;
}
void CloseFile(FileHandle handle) {
AMS_FS_IMPL_ACCESS_LOG((delete Get(handle), ResultSuccess()), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE);
static_cast<void>(AMS_FS_IMPL_ACCESS_LOG((delete Get(handle), ResultSuccess()), handle, AMS_FS_IMPL_ACCESS_LOG_FORMAT_NONE));
}
Result QueryRange(QueryRangeInfo *out, FileHandle handle, s64 offset, s64 size) {

View File

@@ -63,7 +63,7 @@ namespace ams::fssystem {
void BlockCacheBufferedStorage::Finalize() {
if (m_block_cache_manager.IsInitialized()) {
/* Invalidate all cache entries. */
this->InvalidateAllCacheEntries();
static_cast<void>(this->InvalidateAllCacheEntries());
/* Finalize our block cache manager. */
m_block_cache_manager.Finalize();

View File

@@ -269,9 +269,10 @@ namespace ams::fssystem {
/* Setup the key area encryption keys. */
for (u8 i = 0; i < NcaCryptoConfiguration::KeyGenerationMax; ++i) {
spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(0, i))), nca_crypto_cfg->key_area_encryption_key_source[0], KeySize, i, Option);
spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(1, i))), nca_crypto_cfg->key_area_encryption_key_source[1], KeySize, i, Option);
spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(2, i))), nca_crypto_cfg->key_area_encryption_key_source[2], KeySize, i, Option);
/* NOTE: Nintendo allows these to fail, since the loop tries key generations past the maximum known. */
static_cast<void>(spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(0, i))), nca_crypto_cfg->key_area_encryption_key_source[0], KeySize, i, Option));
static_cast<void>(spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(1, i))), nca_crypto_cfg->key_area_encryption_key_source[1], KeySize, i, Option));
static_cast<void>(spl::GenerateAesKek(std::addressof(GetNcaKekAccessKey(GetKeyTypeValue(2, i))), nca_crypto_cfg->key_area_encryption_key_source[2], KeySize, i, Option));
}
/* Setup the header encryption key. */

View File

@@ -129,11 +129,15 @@ namespace ams::fssystem {
/* Initialize the buffer manager. */
/* TODO FS-REIMPL: os::AllocateMemoryBlock(...); */
util::ConstructAt(g_buffer_manager);
GetReference(g_buffer_manager).Initialize(MaxCacheCount, reinterpret_cast<uintptr_t>(g_buffer_manager_heap), BufferManagerHeapSize, BlockSize);
const auto bm_res = GetReference(g_buffer_manager).Initialize(MaxCacheCount, reinterpret_cast<uintptr_t>(g_buffer_manager_heap), BufferManagerHeapSize, BlockSize);
R_ASSERT(bm_res);
AMS_UNUSED(bm_res);
/* TODO FS-REIMPL: os::AllocateMemoryBlock(...); */
/* TODO FS-REIMPL: fssrv::storage::CreateDeviceAddressSpace(...); */
fssystem::InitializeBufferPool(reinterpret_cast<char *>(g_device_buffer), DeviceBufferSize);
const auto ibp_res = fssystem::InitializeBufferPool(reinterpret_cast<char *>(g_device_buffer), DeviceBufferSize);
R_ASSERT(ibp_res);
AMS_UNUSED(ibp_res);
/* TODO FS-REIMPL: Create Pooled Threads/Stack Usage Reporter, fssystem::RegisterThreadPool. */
@@ -231,11 +235,15 @@ namespace ams::fssystem {
/* Initialize the buffer manager. */
/* TODO FS-REIMPL: os::AllocateMemoryBlock(...); */
util::ConstructAt(g_buffer_manager);
GetReference(g_buffer_manager).Initialize(MaxCacheCount, reinterpret_cast<uintptr_t>(g_buffer_manager_heap), BufferManagerHeapSize, BlockSize);
const auto bm_res = GetReference(g_buffer_manager).Initialize(MaxCacheCount, reinterpret_cast<uintptr_t>(g_buffer_manager_heap), BufferManagerHeapSize, BlockSize);
R_ASSERT(bm_res);
AMS_UNUSED(bm_res);
/* TODO FS-REIMPL: os::AllocateMemoryBlock(...); */
/* TODO FS-REIMPL: fssrv::storage::CreateDeviceAddressSpace(...); */
fssystem::InitializeBufferPool(reinterpret_cast<char *>(g_device_buffer), DeviceBufferSize);
const auto ibp_res = fssystem::InitializeBufferPool(reinterpret_cast<char *>(g_device_buffer), DeviceBufferSize);
R_ASSERT(ibp_res);
AMS_UNUSED(ibp_res);
/* TODO FS-REIMPL: Create Pooled Threads/Stack Usage Reporter, fssystem::RegisterThreadPool. */

View File

@@ -89,7 +89,7 @@ namespace ams::htc::server::driver {
void HtclowDriver::Shutdown(htclow::ChannelId channel) {
/* Shut down the channel. */
m_manager->Shutdown(GetHtclowChannel(channel, m_module_id));
static_cast<void>(m_manager->Shutdown(GetHtclowChannel(channel, m_module_id)));
}
Result HtclowDriver::Send(s64 *out, const void *src, s64 src_size, htclow::ChannelId channel) {

View File

@@ -37,7 +37,7 @@ namespace ams::htc::server::rpc {
u8 m_driver_receive_buffer[4_KB];
u8 m_driver_send_buffer[4_KB];
private:
static void ReceiveThreadEntry(void *arg) { static_cast<HtcmiscRpcServer *>(arg)->ReceiveThread(); }
static void ReceiveThreadEntry(void *arg) { static_cast<void>(static_cast<HtcmiscRpcServer *>(arg)->ReceiveThread()); }
Result ReceiveThread();
public:

View File

@@ -71,8 +71,8 @@ namespace ams::htc::server::rpc {
char m_receive_buffer[BufferSize];
char m_send_buffer[BufferSize];
private:
static void ReceiveThreadEntry(void *arg) { static_cast<RpcClient *>(arg)->ReceiveThread(); }
static void SendThreadEntry(void *arg) { static_cast<RpcClient *>(arg)->SendThread(); }
static void ReceiveThreadEntry(void *arg) { static_cast<void>(static_cast<RpcClient *>(arg)->ReceiveThread()); }
static void SendThreadEntry(void *arg) { static_cast<void>(static_cast<RpcClient *>(arg)->SendThread()); }
Result ReceiveThread();
Result SendThread();

View File

@@ -53,7 +53,7 @@ namespace ams::htcfs {
void ClientImpl::Start() {
/* Create our thread. */
os::CreateThread(std::addressof(m_monitor_thread), ThreadEntry, this, g_monitor_thread_stack, sizeof(g_monitor_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcfsMonitor));
R_ABORT_UNLESS(os::CreateThread(std::addressof(m_monitor_thread), ThreadEntry, this, g_monitor_thread_stack, sizeof(g_monitor_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(htc, HtcfsMonitor)));
/* Set thread name pointer. */
os::SetThreadNamePointer(std::addressof(m_monitor_thread), AMS_GET_SYSTEM_THREAD_NAME(htc, HtcfsMonitor));

View File

@@ -22,7 +22,7 @@ namespace ams::htcfs {
DirectoryServiceObject::DirectoryServiceObject(s32 handle) : m_handle(handle) { /* ... */ }
DirectoryServiceObject::~DirectoryServiceObject() {
htcfs::GetClient().CloseDirectory(m_handle);
static_cast<void>(htcfs::GetClient().CloseDirectory(m_handle));
}
Result DirectoryServiceObject::GetEntryCount(ams::sf::Out<s64> out) {

View File

@@ -22,7 +22,7 @@ namespace ams::htcfs {
FileServiceObject::FileServiceObject(s32 handle) : m_handle(handle) { /* ... */ }
FileServiceObject::~FileServiceObject() {
htcfs::GetClient().CloseFile(m_handle);
static_cast<void>(htcfs::GetClient().CloseFile(m_handle));
}
Result FileServiceObject::ReadFile(ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, ams::fs::ReadOption option) {

View File

@@ -32,15 +32,15 @@ namespace ams::htclow::driver {
m_open_driver = m_debug_driver;
break;
case impl::DriverType::Socket:
m_socket_driver.Open();
R_TRY(m_socket_driver.Open());
m_open_driver = std::addressof(m_socket_driver);
break;
case impl::DriverType::Usb:
m_usb_driver.Open();
R_TRY(m_usb_driver.Open());
m_open_driver = std::addressof(m_usb_driver);
break;
case impl::DriverType::PlainChannel:
//m_plain_channel_driver.Open();
//R_TRY(m_plain_channel_driver.Open());
//m_open_driver = std::addressof(m_plain_channel_driver);
//break;
R_THROW(htclow::ResultUnknownDriverType());

View File

@@ -67,14 +67,20 @@ namespace ams::htclow::driver {
}
void SocketDiscoveryManager::ThreadFunc() {
for (this->DoDiscovery(); !m_driver_closed; this->DoDiscovery()) {
/* Check if the driver is closed five times. */
/* Do discovery. */
static_cast<void>(this->DoDiscovery());
while (!m_driver_closed) {
/* Check if the driver is closed 5 times. */
for (size_t i = 0; i < 5; ++i) {
os::SleepThread(TimeSpan::FromSeconds(1));
if (m_driver_closed) {
return;
}
}
/* Do discovery. */
static_cast<void>(this->DoDiscovery());
}
}

View File

@@ -407,11 +407,11 @@ namespace ams::htclow::driver {
g_usb_break_event.Signal();
os::WaitThread(std::addressof(g_usb_indication_thread));
os::DestroyThread(std::addressof(g_usb_indication_thread));
g_ds_client.DisableDevice();
g_ds_endpoints[1].Finalize();
g_ds_endpoints[0].Finalize();
g_ds_interface.Finalize();
g_ds_client.Finalize();
static_cast<void>(g_ds_client.DisableDevice());
static_cast<void>(g_ds_endpoints[1].Finalize());
static_cast<void>(g_ds_endpoints[0].Finalize());
static_cast<void>(g_ds_interface.Finalize());
static_cast<void>(g_ds_client.Finalize());
g_usb_interface_initialized = false;
}
@@ -454,8 +454,8 @@ namespace ams::htclow::driver {
void CancelUsbSendReceive() {
if (g_usb_interface_initialized) {
g_ds_endpoints[0].Cancel();
g_ds_endpoints[1].Cancel();
static_cast<void>(g_ds_endpoints[0].Cancel());
static_cast<void>(g_ds_endpoints[1].Cancel());
}
}

View File

@@ -34,7 +34,7 @@ namespace ams::htclow {
}
void Channel::Close() {
m_manager->Close(impl::ConvertChannelType(m_channel));
static_cast<void>(m_manager->Close(impl::ConvertChannelType(m_channel)));
}
ChannelState Channel::GetChannelState() {
@@ -72,7 +72,7 @@ namespace ams::htclow {
}
void Channel::Shutdown() {
m_manager->Shutdown(impl::ConvertChannelType(m_channel));
static_cast<void>(m_manager->Shutdown(impl::ConvertChannelType(m_channel)));
}
Result Channel::Receive(s64 *out, void *dst, s64 size, ReceiveOption option) {
@@ -221,7 +221,7 @@ namespace ams::htclow {
/* Perform the wait. */
if (event != nullptr) {
if (os::WaitAny(event, m_manager->GetTaskEvent(task_id)) == 0) {
m_manager->WaitReceiveEnd(task_id);
static_cast<void>(m_manager->WaitReceiveEnd(task_id));
R_THROW(htclow::ResultChannelWaitCancelled());
}
} else {

View File

@@ -64,13 +64,13 @@ namespace ams::htclow {
}
void Worker::ReceiveThread() {
this->ProcessReceive();
static_cast<void>(this->ProcessReceive());
m_driver->CancelSendReceive();
this->Cancel();
}
void Worker::SendThread() {
this->ProcessSend();
static_cast<void>(this->ProcessSend());
m_driver->CancelSendReceive();
this->Cancel();
}
@@ -114,7 +114,9 @@ namespace ams::htclow {
}
/* Process the received packet. */
m_service->ProcessReceivePacket(header, m_receive_packet_body, header.body_size);
if (R_FAILED(m_service->ProcessReceivePacket(header, m_receive_packet_body, header.body_size))) {
/* TODO: PrintIgnorePacket */
}
R_SUCCEED();
}
@@ -129,7 +131,9 @@ namespace ams::htclow {
}
/* Process the received packet. */
m_mux->ProcessReceivePacket(header, m_receive_packet_body, header.body_size);
if (R_FAILED(m_mux->ProcessReceivePacket(header, m_receive_packet_body, header.body_size))) {
/* TODO: PrintIgnorePacket */
}
R_SUCCEED();
}

View File

@@ -71,7 +71,9 @@ namespace ams::htclow::mux {
R_RETURN(m_channel_impl_map[it->second].ProcessReceivePacket(header, body, body_size));
} else {
if (header.packet_type == PacketType_Data || header.packet_type == PacketType_MaxData) {
this->SendErrorPacket(header.channel);
if (R_FAILED(this->SendErrorPacket(header.channel))) {
/* Nintendo doesn't do anything here. */
}
}
R_THROW(htclow::ResultChannelNotExist());
}

View File

@@ -750,7 +750,9 @@ namespace ams::htcs::client {
if (index = this->Find(set->fds[i], std::addressof(error_code)); index >= 0) {
/* Get the primitive, if necessary. */
if (m_socket_list[index].m_primitive == InvalidPrimitive && m_socket_list[index].m_socket != nullptr) {
m_socket_list[index].m_socket->GetPrimitive(std::addressof(m_socket_list[index].m_primitive));
if (R_FAILED(m_socket_list[index].m_socket->GetPrimitive(std::addressof(m_socket_list[index].m_primitive)))) {
/* Nintendo doesn't do anything here? */
}
}
primitive = m_socket_list[index].m_primitive;
@@ -769,7 +771,9 @@ namespace ams::htcs::client {
/* Get the primitive. */
if (index = this->Find(set->fds[i], std::addressof(error_code)); index >= 0) {
m_socket_list[index].m_socket->GetPrimitive(std::addressof(m_socket_list[index].m_primitive));
if (R_FAILED(m_socket_list[index].m_socket->GetPrimitive(std::addressof(m_socket_list[index].m_primitive)))) {
/* Nintendo doesn't do anything here? */
}
primitive = m_socket_list[index].m_primitive;
}

View File

@@ -54,7 +54,7 @@ namespace ams::htcs {
R_ABORT_UNLESS(g_monitor->MonitorManager(process_id));
/* Allocate a tls slot for our last error. */
os::SdkAllocateTlsSlot(std::addressof(g_tls_slot), nullptr);
R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(g_tls_slot), nullptr));
/* Setup the virtual socket collection. */
AMS_ASSERT(buffer != nullptr);
@@ -185,7 +185,7 @@ namespace ams::htcs {
/* Get name. */
HtcsPeerName name;
g_manager->GetPeerNameAny(std::addressof(name));
static_cast<void>(g_manager->GetPeerNameAny(std::addressof(name)));
return name;
}
@@ -196,7 +196,7 @@ namespace ams::htcs {
/* Get name. */
HtcsPeerName name;
g_manager->GetDefaultHostName(std::addressof(name));
static_cast<void>(g_manager->GetDefaultHostName(std::addressof(name)));
return name;
}
@@ -472,7 +472,7 @@ namespace ams::htcs {
s32 close(sf::SharedPointer<tma::ISocket> socket, s32 &last_error) {
s32 res;
socket->Close(std::addressof(last_error), std::addressof(res));
static_cast<void>(socket->Close(std::addressof(last_error), std::addressof(res)));
return res;
}
@@ -484,13 +484,13 @@ namespace ams::htcs {
util::Strlcpy(null_terminated_address.port_name.name, address->port_name.name, PortNameBufferLength);
s32 res;
socket->Bind(std::addressof(last_error), std::addressof(res), null_terminated_address);
static_cast<void>(socket->Bind(std::addressof(last_error), std::addressof(res), null_terminated_address));
return res;
}
s32 listen(sf::SharedPointer<tma::ISocket> socket, s32 backlog_count, s32 &last_error) {
s32 res;
socket->Listen(std::addressof(last_error), std::addressof(res), backlog_count);
static_cast<void>(socket->Listen(std::addressof(last_error), std::addressof(res), backlog_count));
return res;
}
@@ -512,7 +512,7 @@ namespace ams::htcs {
os::WaitSystemEvent(std::addressof(event));
/* End the accept. */
socket->AcceptResults(std::addressof(last_error), std::addressof(res), address, task_id);
static_cast<void>(socket->AcceptResults(std::addressof(last_error), std::addressof(res), address, task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;
@@ -528,13 +528,13 @@ namespace ams::htcs {
s32 fcntl(sf::SharedPointer<tma::ISocket> socket, s32 command, s32 value, s32 &last_error) {
s32 res;
socket->Fcntl(std::addressof(last_error), std::addressof(res), command, value);
static_cast<void>(socket->Fcntl(std::addressof(last_error), std::addressof(res), command, value));
return res;
}
s32 shutdown(sf::SharedPointer<tma::ISocket> socket, s32 how, s32 &last_error) {
s32 res;
socket->Shutdown(std::addressof(last_error), std::addressof(res), how);
static_cast<void>(socket->Shutdown(std::addressof(last_error), std::addressof(res), how));
return res;
}
@@ -546,7 +546,7 @@ namespace ams::htcs {
util::Strlcpy(null_terminated_address.port_name.name, address->port_name.name, PortNameBufferLength);
s32 res;
socket->Connect(std::addressof(last_error), std::addressof(res), null_terminated_address);
static_cast<void>(socket->Connect(std::addressof(last_error), std::addressof(res), null_terminated_address));
return res;
}
@@ -579,7 +579,7 @@ namespace ams::htcs {
os::WaitSystemEvent(std::addressof(event));
/* End the select. */
g_manager->EndSelect(std::addressof(last_error), std::addressof(res), OutArray(read, num_read), OutArray(write, num_write), OutArray(except, num_except), task_id);
static_cast<void>(g_manager->EndSelect(std::addressof(last_error), std::addressof(res), OutArray(read, num_read), OutArray(write, num_write), OutArray(except, num_except), task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;
@@ -614,7 +614,7 @@ namespace ams::htcs {
os::WaitSystemEvent(std::addressof(event));
/* End the receive. */
socket->EndRecv(std::addressof(last_error), std::addressof(res), sf::OutAutoSelectBuffer(buffer, buffer_size), task_id);
static_cast<void>(socket->EndRecv(std::addressof(last_error), std::addressof(res), sf::OutAutoSelectBuffer(buffer, buffer_size), task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;
@@ -675,7 +675,7 @@ namespace ams::htcs {
}
/* End the send. */
socket->EndSend(std::addressof(last_error), std::addressof(res), task_id);
static_cast<void>(socket->EndSend(std::addressof(last_error), std::addressof(res), task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;
@@ -717,7 +717,7 @@ namespace ams::htcs {
os::WaitSystemEvent(std::addressof(event));
/* End the receive. */
socket->RecvResults(std::addressof(last_error), std::addressof(res), sf::OutAutoSelectBuffer(buffer, recv_size), task_id);
static_cast<void>(socket->RecvResults(std::addressof(last_error), std::addressof(res), sf::OutAutoSelectBuffer(buffer, recv_size), task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;
@@ -750,7 +750,7 @@ namespace ams::htcs {
os::WaitSystemEvent(std::addressof(event));
/* End the send. */
socket->SendResults(std::addressof(last_error), std::addressof(res), task_id);
static_cast<void>(socket->SendResults(std::addressof(last_error), std::addressof(res), task_id));
} else {
/* Set error. */
last_error = HTCS_EINTR;

View File

@@ -101,7 +101,7 @@ namespace ams::htcs::impl {
Result HtcsManagerImpl::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) {
/* Start the send. */
u32 task_id{};
os::NativeHandle handle;
os::NativeHandle handle = os::InvalidNativeHandle;
R_TRY(m_service.SendSmallStart(std::addressof(task_id), std::addressof(handle), desc, size, flags));
/* Continue the send. */
@@ -113,14 +113,16 @@ namespace ams::htcs::impl {
R_SUCCEED();
} else {
os::SystemEventType event;
os::AttachReadableHandleToSystemEvent(std::addressof(event), handle, true, os::EventClearMode_ManualClear);
s32 err;
s64 rsize;
m_service.SendSmallResults(std::addressof(err), std::addressof(rsize), task_id, desc);
static_cast<void>(m_service.SendSmallResults(std::addressof(err), std::addressof(rsize), task_id, desc));
os::DestroySystemEvent(std::addressof(event));
if (handle != os::InvalidNativeHandle) {
os::SystemEventType event;
os::AttachReadableHandleToSystemEvent(std::addressof(event), handle, true, os::EventClearMode_ManualClear);
os::DestroySystemEvent(std::addressof(event));
}
R_RETURN(result);
}
@@ -166,7 +168,7 @@ namespace ams::htcs::impl {
if (htcs::ResultCancelled::Includes(result)) {
s32 err;
bool empty;
m_service.SelectEnd(std::addressof(err), std::addressof(empty), Span<int>{}, Span<int>{}, Span<int>{}, task_id);
static_cast<void>(m_service.SelectEnd(std::addressof(err), std::addressof(empty), Span<int>{}, Span<int>{}, Span<int>{}, task_id));
if (handle != os::InvalidNativeHandle) {
os::SystemEventType event;

View File

@@ -211,6 +211,9 @@ namespace ams::htcs::impl {
Result HtcsService::AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc) {
AMS_UNUSED(out_address);
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Finish the task. */
htcs::SocketError err;
s32 ret_desc;
@@ -235,10 +238,14 @@ namespace ams::htcs::impl {
}
Result HtcsService::ReceiveSmallResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc) {
AMS_UNUSED(desc);
/* Verify the task. */
R_TRY(m_rpc_client->VerifyTaskIdWithHandle<rpc::ReceiveSmallTask>(task_id, desc));
/* Continue the task. */
m_rpc_client->ReceiveContinue<rpc::ReceiveSmallTask>(task_id, buffer, buffer_size);
static_cast<void>(m_rpc_client->ReceiveContinue<rpc::ReceiveSmallTask>(task_id, buffer, buffer_size));
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Finish the task. */
htcs::SocketError err;
@@ -274,7 +281,11 @@ namespace ams::htcs::impl {
}
Result HtcsService::SendSmallResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
AMS_UNUSED(desc);
/* Verify the task. */
R_TRY(m_rpc_client->VerifyTaskIdWithHandle<rpc::SendSmallTask>(task_id, desc));
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Finish the task. */
htcs::SocketError err;
@@ -322,6 +333,9 @@ namespace ams::htcs::impl {
/* Verify the task. */
R_TRY(m_rpc_client->VerifyTaskIdWithHandle<rpc::SendTask>(task_id, desc));
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Finish the task. */
htcs::SocketError err;
R_TRY(m_rpc_client->End<rpc::SendTask>(task_id, std::addressof(err), out_size));
@@ -347,6 +361,9 @@ namespace ams::htcs::impl {
/* Verify the task. */
R_TRY(m_rpc_client->VerifyTaskIdWithHandle<rpc::ReceiveTask>(task_id, desc));
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Get the result. */
htcs::SocketError err{};
s64 recv_size{};
@@ -399,6 +416,9 @@ namespace ams::htcs::impl {
}
Result HtcsService::SelectEnd(s32 *out_err, bool *out_empty, Span<int> read_handles, Span<int> write_handles, Span<int> exception_handles, u32 task_id) {
/* Wait for the task to complete. */
this->WaitTask(task_id);
/* Finish the task. */
htcs::SocketError err;
bool empty;