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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ams::erpt::srv {
|
||||
|
||||
/* Close and commit the stream. */
|
||||
stream.CloseStream();
|
||||
stream.CommitStream();
|
||||
R_TRY(stream.CommitStream());
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user