id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
7,969
fs_ifile.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifile.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/fs/fs_common.hpp> #include <stratosphere/fs/fs_file.hpp> #include <stratosphere/fs/fs_filesystem.hpp> #include <stratosphere/fs/fs_operate_range.hpp> namespace ams::fs::fsa { class IFile { public: virtual ~IFile() { /* ... */ } Result Read(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) { /* Check that we have an output pointer. */ R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); /* If we have nothing to read, just succeed. */ if (size == 0) { *out = 0; R_SUCCEED(); } /* Check that the read is valid. */ R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument()); R_UNLESS(offset >= 0, fs::ResultOutOfRange()); R_UNLESS(util::IsIntValueRepresentable<s64>(size), fs::ResultOutOfRange()); R_UNLESS(util::CanAddWithoutOverflow<s64>(offset, size), fs::ResultOutOfRange()); /* Do the read. */ R_RETURN(this->DoRead(out, offset, buffer, size, option)); } ALWAYS_INLINE Result Read(size_t *out, s64 offset, void *buffer, size_t size) { R_RETURN(this->Read(out, offset, buffer, size, ReadOption::None)); } Result GetSize(s64 *out) { R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); R_RETURN(this->DoGetSize(out)); } Result Flush() { R_RETURN(this->DoFlush()); } Result Write(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) { /* Handle the zero-size case. */ if (size == 0) { if (option.HasFlushFlag()) { R_TRY(this->Flush()); } R_SUCCEED(); } /* Check the write is valid. */ R_UNLESS(buffer != nullptr, fs::ResultNullptrArgument()); R_UNLESS(offset >= 0, fs::ResultOutOfRange()); R_UNLESS(util::IsIntValueRepresentable<s64>(size), fs::ResultOutOfRange()); R_UNLESS(util::CanAddWithoutOverflow<s64>(offset, size), fs::ResultOutOfRange()); R_RETURN(this->DoWrite(offset, buffer, size, option)); } Result SetSize(s64 size) { R_UNLESS(size >= 0, fs::ResultOutOfRange()); R_RETURN(this->DoSetSize(size)); } Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { R_RETURN(this->DoOperateRange(dst, dst_size, op_id, offset, size, src, src_size)); } Result OperateRange(fs::OperationId op_id, s64 offset, s64 size) { R_RETURN(this->DoOperateRange(nullptr, 0, op_id, offset, size, nullptr, 0)); } public: /* TODO: This is a hack to allow the mitm API to work. Find a better way? */ virtual sf::cmif::DomainObjectId GetDomainObjectId() const = 0; protected: Result DryRead(size_t *out, s64 offset, size_t size, const fs::ReadOption &option, OpenMode open_mode) { AMS_UNUSED(option); /* Check that we can read. */ R_UNLESS((open_mode & OpenMode_Read) != 0, fs::ResultReadNotPermitted()); /* Get the file size, and validate our offset. */ s64 file_size = 0; R_TRY(this->DoGetSize(std::addressof(file_size))); R_UNLESS(offset <= file_size, fs::ResultOutOfRange()); *out = static_cast<size_t>(std::min(file_size - offset, static_cast<s64>(size))); R_SUCCEED(); } Result DrySetSize(s64 size, fs::OpenMode open_mode) { AMS_UNUSED(size); /* Check that we can write. */ R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted()); R_SUCCEED(); } Result DryWrite(bool *out_append, s64 offset, size_t size, const fs::WriteOption &option, fs::OpenMode open_mode) { AMS_UNUSED(option); /* Check that we can write. */ R_UNLESS((open_mode & OpenMode_Write) != 0, fs::ResultWriteNotPermitted()); /* Get the file size. */ s64 file_size = 0; R_TRY(this->DoGetSize(&file_size)); /* Determine if we need to append. */ *out_append = false; if (file_size < offset + static_cast<s64>(size)) { R_UNLESS((open_mode & OpenMode_AllowAppend) != 0, fs::ResultFileExtensionWithoutOpenModeAllowAppend()); *out_append = true; } R_SUCCEED(); } private: virtual Result DoRead(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) = 0; virtual Result DoGetSize(s64 *out) = 0; virtual Result DoFlush() = 0; virtual Result DoWrite(s64 offset, const void *buffer, size_t size, const fs::WriteOption &option) = 0; virtual Result DoSetSize(s64 size) = 0; virtual Result DoOperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) = 0; }; }
6,372
C++
.h
118
40.830508
160
0.54817
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,970
fs_ifilesystem.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_ifilesystem.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/fs/fs_common.hpp> #include <stratosphere/fs/fs_filesystem.hpp> #include <stratosphere/fs/fs_filesystem_for_debug.hpp> #include <stratosphere/fs/fs_path.hpp> namespace ams::fs::fsa { /* ACCURATE_TO_VERSION: Unknown */ class IFile; class IDirectory; enum class QueryId { SetConcatenationFileAttribute = 0, UpdateMac = 1, IsSignedSystemPartitionOnSdCardValid = 2, QueryUnpreparedFileInformation = 3, }; class IFileSystem { public: virtual ~IFileSystem() { /* ... */ } Result CreateFile(const fs::Path &path, s64 size, int option) { R_UNLESS(size >= 0, fs::ResultOutOfRange()); R_RETURN(this->DoCreateFile(path, size, option)); } Result CreateFile(const fs::Path &path, s64 size) { R_RETURN(this->CreateFile(path, size, fs::CreateOption_None)); } Result DeleteFile(const fs::Path &path) { R_RETURN(this->DoDeleteFile(path)); } Result CreateDirectory(const fs::Path &path) { R_RETURN(this->DoCreateDirectory(path)); } Result DeleteDirectory(const fs::Path &path) { R_RETURN(this->DoDeleteDirectory(path)); } Result DeleteDirectoryRecursively(const fs::Path &path) { R_RETURN(this->DoDeleteDirectoryRecursively(path)); } Result RenameFile(const fs::Path &old_path, const fs::Path &new_path) { R_RETURN(this->DoRenameFile(old_path, new_path)); } Result RenameDirectory(const fs::Path &old_path, const fs::Path &new_path) { R_RETURN(this->DoRenameDirectory(old_path, new_path)); } Result GetEntryType(DirectoryEntryType *out, const fs::Path &path) { R_RETURN(this->DoGetEntryType(out, path)); } Result OpenFile(std::unique_ptr<IFile> *out_file, const fs::Path &path, OpenMode mode) { R_UNLESS(out_file != nullptr, fs::ResultNullptrArgument()); R_UNLESS((mode & OpenMode_ReadWrite) != 0, fs::ResultInvalidOpenMode()); R_UNLESS((mode & ~OpenMode_All) == 0, fs::ResultInvalidOpenMode()); R_RETURN(this->DoOpenFile(out_file, path, mode)); } Result OpenDirectory(std::unique_ptr<IDirectory> *out_dir, const fs::Path &path, OpenDirectoryMode mode) { R_UNLESS(out_dir != nullptr, fs::ResultNullptrArgument()); R_UNLESS((mode & OpenDirectoryMode_All) != 0, fs::ResultInvalidOpenMode()); R_UNLESS((mode & ~(OpenDirectoryMode_All | OpenDirectoryMode_NotRequireFileSize)) == 0, fs::ResultInvalidOpenMode()); R_RETURN(this->DoOpenDirectory(out_dir, path, mode)); } Result Commit() { R_RETURN(this->DoCommit()); } Result GetFreeSpaceSize(s64 *out, const fs::Path &path) { R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); R_RETURN(this->DoGetFreeSpaceSize(out, path)); } Result GetTotalSpaceSize(s64 *out, const fs::Path &path) { R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); R_RETURN(this->DoGetTotalSpaceSize(out, path)); } Result CleanDirectoryRecursively(const fs::Path &path) { R_RETURN(this->DoCleanDirectoryRecursively(path)); } Result GetFileTimeStampRaw(FileTimeStampRaw *out, const fs::Path &path) { R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); R_RETURN(this->DoGetFileTimeStampRaw(out, path)); } Result QueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, QueryId query, const fs::Path &path) { R_RETURN(this->DoQueryEntry(dst, dst_size, src, src_size, query, path)); } /* These aren't accessible as commands. */ Result CommitProvisionally(s64 counter) { R_RETURN(this->DoCommitProvisionally(counter)); } Result Rollback() { R_RETURN(this->DoRollback()); } Result Flush() { R_RETURN(this->DoFlush()); } protected: /* ...? */ private: virtual Result DoCreateFile(const fs::Path &path, s64 size, int flags) = 0; virtual Result DoDeleteFile(const fs::Path &path) = 0; virtual Result DoCreateDirectory(const fs::Path &path) = 0; virtual Result DoDeleteDirectory(const fs::Path &path) = 0; virtual Result DoDeleteDirectoryRecursively(const fs::Path &path) = 0; virtual Result DoRenameFile(const fs::Path &old_path, const fs::Path &new_path) = 0; virtual Result DoRenameDirectory(const fs::Path &old_path, const fs::Path &new_path) = 0; virtual Result DoGetEntryType(fs::DirectoryEntryType *out, const fs::Path &path) = 0; virtual Result DoOpenFile(std::unique_ptr<fs::fsa::IFile> *out_file, const fs::Path &path, fs::OpenMode mode) = 0; virtual Result DoOpenDirectory(std::unique_ptr<fs::fsa::IDirectory> *out_dir, const fs::Path &path, fs::OpenDirectoryMode mode) = 0; virtual Result DoCommit() = 0; virtual Result DoGetFreeSpaceSize(s64 *out, const fs::Path &path) { AMS_UNUSED(out, path); R_THROW(fs::ResultNotImplemented()); } virtual Result DoGetTotalSpaceSize(s64 *out, const fs::Path &path) { AMS_UNUSED(out, path); R_THROW(fs::ResultNotImplemented()); } virtual Result DoCleanDirectoryRecursively(const fs::Path &path) = 0; virtual Result DoGetFileTimeStampRaw(fs::FileTimeStampRaw *out, const fs::Path &path) { AMS_UNUSED(out, path); R_THROW(fs::ResultNotImplemented()); } virtual Result DoQueryEntry(char *dst, size_t dst_size, const char *src, size_t src_size, fs::fsa::QueryId query, const fs::Path &path) { AMS_UNUSED(dst, dst_size, src, src_size, query, path); R_THROW(fs::ResultNotImplemented()); } /* These aren't accessible as commands. */ virtual Result DoCommitProvisionally(s64 counter) { AMS_UNUSED(counter); R_THROW(fs::ResultNotImplemented()); } virtual Result DoRollback() { R_THROW(fs::ResultNotImplemented()); } virtual Result DoFlush() { R_THROW(fs::ResultNotImplemented()); } }; template<typename T> concept PointerToFileSystem = ::ams::util::RawOrSmartPointerTo<T, ::ams::fs::fsa::IFileSystem>; }
7,829
C++
.h
150
40.16
149
0.583748
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,971
fs_registrar.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_registrar.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/fs/fs_common.hpp> namespace ams::fs::fsa { /* ACCURATE_TO_VERSION: Unknown */ class ICommonMountNameGenerator { public: virtual ~ICommonMountNameGenerator() { /* ... */ } virtual Result GenerateCommonMountName(char *name, size_t name_size) = 0; }; class IFileSystem; Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs); Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator); Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator, bool use_data_cache, bool use_path_cache, bool multi_commit_supported); void Unregister(const char *name); }
1,438
C++
.h
30
44.133333
200
0.731098
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,972
fs_idirectory.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/fs/fsa/fs_idirectory.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/fs/fs_common.hpp> #include <stratosphere/fs/fs_directory.hpp> namespace ams::fs::fsa { /* ACCURATE_TO_VERSION: Unknown */ class IDirectory { public: virtual ~IDirectory() { /* ... */ } Result Read(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) { R_UNLESS(out_count != nullptr, fs::ResultNullptrArgument()); if (max_entries == 0) { *out_count = 0; R_SUCCEED(); } R_UNLESS(out_entries != nullptr, fs::ResultNullptrArgument()); R_UNLESS(max_entries > 0, fs::ResultInvalidArgument()); R_RETURN(this->DoRead(out_count, out_entries, max_entries)); } Result GetEntryCount(s64 *out) { R_UNLESS(out != nullptr, fs::ResultNullptrArgument()); R_RETURN(this->DoGetEntryCount(out)); } public: /* TODO: This is a hack to allow the mitm API to work. Find a better way? */ virtual sf::cmif::DomainObjectId GetDomainObjectId() const = 0; protected: /* ...? */ private: virtual Result DoRead(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) = 0; virtual Result DoGetEntryCount(s64 *out) = 0; }; }
2,023
C++
.h
47
34.553191
100
0.615228
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,973
cs_remote_video_server.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/cs/cs_remote_video_server.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::cs { void InitializeRemoteVideoServer(); }
736
C++
.h
20
34.75
76
0.758766
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,974
cs_hid_server.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/cs/cs_hid_server.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::cs { void InitializeHidServer(); }
728
C++
.h
20
34.35
76
0.756028
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,975
cs_target_io_server.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/cs/cs_target_io_server.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::cs { void InitializeTargetIoServer(); }
733
C++
.h
20
34.6
76
0.757746
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,976
cs_command_processor.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/cs/cs_command_processor.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/scs/scs_command_processor.hpp> #include <stratosphere/vi/vi_layer_stack.hpp> namespace ams::cs { using CommandHeader = scs::CommandHeader; using ResponseHeader = scs::ResponseHeader; class CommandProcessor : public scs::CommandProcessor { public: virtual bool ProcessCommand(const CommandHeader &header, const u8 *body, s32 socket) override; private: void TakeScreenShot(const CommandHeader &header, s32 socket, vi::LayerStack layer_stack); private: static void SendFirmwareVersion(s32 socket, const CommandHeader &header); }; }
1,304
C++
.h
31
38.032258
106
0.739165
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,977
cs_audio_server.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/cs/cs_audio_server.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::cs { void InitializeAudioServer(); }
730
C++
.h
20
34.45
76
0.756719
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,978
pcv_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/pcv/pcv_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/pcv/pcv_types.hpp> namespace ams::pcv { void Initialize(); void Finalize(); Result SetClockEnabled(Module module, bool en); Result SetClockRate(Module module, ClockHz hz); Result SetReset(Module module, bool en); }
934
C++
.h
25
34.8
76
0.752212
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,979
pcv_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/pcv/pcv_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::pcv { using ClockHz = u32; using MicroVolt = s32; using MilliC = s32; /* TODO: Device codes? */ enum Module { Module_Cpu = 0, Module_Gpu = 1, Module_I2s1 = 2, Module_I2s2 = 3, Module_I2s3 = 4, Module_Pwm = 5, Module_I2c1 = 6, Module_I2c2 = 7, Module_I2c3 = 8, Module_I2c4 = 9, Module_I2c5 = 10, Module_I2c6 = 11, Module_Spi1 = 12, Module_Spi2 = 13, Module_Spi3 = 14, Module_Spi4 = 15, Module_Disp1 = 16, Module_Disp2 = 17, Module_Isp = 18, Module_Vi = 19, Module_Sdmmc1 = 20, Module_Sdmmc2 = 21, Module_Sdmmc3 = 22, Module_Sdmmc4 = 23, Module_Owr = 24, Module_Csite = 25, Module_Tsec = 26, Module_Mselect = 27, Module_Hda2codec2x = 28, Module_Actmon = 29, Module_I2cSlow = 30, Module_Sor1 = 31, Module_Sata = 32, Module_Hda = 33, Module_XusbCoreHostSrc = 34, Module_XusbFalconSrc = 35, Module_XusbFsSrc = 36, Module_XusbCoreDevSrc = 37, Module_XusbSsSrc = 38, Module_UartA = 39, Module_UartB = 40, Module_UartC = 41, Module_UartD = 42, Module_Host1x = 43, Module_Entropy = 44, Module_SocTherm = 45, Module_Vic = 46, Module_Nvenc = 47, Module_Nvjpg = 48, Module_Nvdec = 49, Module_Qspi = 50, Module_ViI2c = 51, Module_Tsecb = 52, Module_Ape = 53, Module_AudioDsp = 54, Module_AudioUart = 55, Module_Emc = 56, Module_Plle = 57, Module_PlleHwSeq = 58, Module_Dsi = 59, Module_Maud = 60, Module_Dpaux1 = 61, Module_MipiCal = 62, Module_UartFstMipiCal = 63, Module_Osc = 64, Module_SysBus = 65, Module_SorSafe = 66, Module_XusbSs = 67, Module_XusbHost = 68, Module_XusbDevice = 69, Module_Extperiph1 = 70, Module_Ahub = 71, Module_Hda2hdmicodec = 72, Module_Gpuaux = 73, Module_UsbD = 74, Module_Usb2 = 75, Module_Pcie = 76, Module_Afi = 77, Module_PciExClk = 78, Module_PExUsbPhy = 79, Module_XUsbPadCtl = 80, Module_Apbdma = 81, Module_Usb2TrkClk = 82, Module_XUsbIoPll = 83, Module_XUsbIoPllHwSeq = 84, Module_Cec = 85, Module_Extperiph2 = 86, }; }
4,053
C++
.h
112
28.598214
76
0.455169
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,980
boot2_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/boot2/boot2_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::boot2 { /* Boot2 API. */ /* Normally invoked by PM. */ void LaunchPreSdCardBootProgramsAndBoot2(); /* Normally invoked by boot2. */ void LaunchPostSdCardBootPrograms(); }
883
C++
.h
24
34.125
76
0.742087
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,981
tma_i_htcs_manager.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_htcs_manager.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/htcs/htcs_types.hpp> #include <stratosphere/tma/tma_i_socket.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_HTCS_MANAGER_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, Socket, (sf::Out<s32> out_err, sf::Out<s32> out_sock), (out_err, out_sock)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, Close, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc), (out_err, out_res, desc)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, Connect, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address), (out_err, out_res, desc, address)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, Bind, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, const htcs::SockAddrHtcs &address), (out_err, out_res, desc, address)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, Listen, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 backlog_count), (out_err, out_res, desc, backlog_count)) \ AMS_SF_METHOD_INFO(C, H, 5, Result, Accept, (sf::Out<s32> out_err, sf::Out<s32> out_res, sf::Out<htcs::SockAddrHtcs> out_address, s32 desc), (out_err, out_res, out_address, desc)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, Recv, (sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutBuffer &buffer, s32 desc, s32 flags), (out_err, out_size, buffer, desc, flags)) \ AMS_SF_METHOD_INFO(C, H, 7, Result, Send, (sf::Out<s32> out_err, sf::Out<s64> out_size, s32 desc, const sf::InBuffer &buffer, s32 flags), (out_err, out_size, desc, buffer, flags)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, Shutdown, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 how), (out_err, out_res, desc, how)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, Fcntl, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 desc, s32 command, s32 value), (out_err, out_res, desc, command, value)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, GetPeerNameAny, (sf::Out<htcs::HtcsPeerName> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 11, Result, GetDefaultHostName, (sf::Out<htcs::HtcsPeerName> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, CreateSocketOld, (sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out), (out_err, out)) \ AMS_SF_METHOD_INFO(C, H, 13, Result, CreateSocket, (sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, bool enable_disconnection_emulation), (out_err, out, enable_disconnection_emulation)) \ AMS_SF_METHOD_INFO(C, H, 100, Result, RegisterProcessId, (const sf::ClientProcessId &client_pid), (client_pid)) \ AMS_SF_METHOD_INFO(C, H, 101, Result, MonitorManager, (const sf::ClientProcessId &client_pid), (client_pid)) \ AMS_SF_METHOD_INFO(C, H, 130, Result, StartSelect, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InMapAliasArray<s32> &read_handles, const sf::InMapAliasArray<s32> &write_handles, const sf::InMapAliasArray<s32> &exception_handles, s64 tv_sec, s64 tv_usec), (out_task_id, out_event, read_handles, write_handles, exception_handles, tv_sec, tv_usec)) \ AMS_SF_METHOD_INFO(C, H, 131, Result, EndSelect, (sf::Out<s32> out_err, sf::Out<s32> out_count, const sf::OutMapAliasArray<s32> &read_handles, const sf::OutMapAliasArray<s32> &write_handles, const sf::OutMapAliasArray<s32> &exception_handles, u32 task_id), (out_err, out_count, read_handles, write_handles, exception_handles, task_id)) AMS_SF_DEFINE_INTERFACE(ams::tma, IHtcsManager, AMS_TMA_I_HTCS_MANAGER_INTERFACE_INFO, 0x91ECD04F)
8,155
C++
.h
40
200.65
380
0.353304
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,982
tma_i_directory_accessor.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_directory_accessor.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/sf.hpp> #include <stratosphere/fs/fs_directory.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_DIRECTORY_ACCESSOR_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, GetEntryCount, (ams::sf::Out<s64> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, Read, (ams::sf::Out<s64> out, const ams::sf::OutMapAliasArray<fs::DirectoryEntry> &out_entries), (out, out_entries)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, SetPriorityForDirectory, (s32 priority), (priority)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, GetPriorityForDirectory, (ams::sf::Out<s32> out), (out)) AMS_SF_DEFINE_INTERFACE(ams::tma, IDirectoryAccessor, AMS_TMA_I_DIRECTORY_ACCESSOR_INTERFACE_INFO, 0x070BADB5)
1,802
C++
.h
26
67.076923
177
0.5823
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,983
tma_path.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_path.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/fs/fs_common.hpp> #include <stratosphere/fs/fs_directory.hpp> #include <stratosphere/sf/sf_buffer_tags.hpp> namespace ams::tma { struct Path : ams::sf::LargeData { char str[fs::EntryNameLengthMax + 1]; static constexpr Path Encode(const char *p) { Path path = {}; for (size_t i = 0; i < sizeof(path) - 1; i++) { path.str[i] = p[i]; if (p[i] == '\x00') { break; } } return path; } static constexpr size_t GetLength(const Path &path) { size_t len = 0; for (size_t i = 0; i < sizeof(path) - 1 && path.str[i] != '\x00'; i++) { len++; } return len; } }; static_assert(util::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax + 1); }
1,570
C++
.h
43
29.674419
91
0.605782
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,984
tma_i_file_manager.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_file_manager.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/tma/tma_i_directory_accessor.hpp> #include <stratosphere/tma/tma_i_file_accessor.hpp> #include <stratosphere/tma/tma_path.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_FILE_MANAGER_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, OpenFile, (sf::Out<sf::SharedPointer<tma::IFileAccessor>> out, const tma::Path &path, u32 open_mode, bool case_sensitive), (out, path, open_mode, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, FileExists, (sf::Out<bool> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, DeleteFile, (const tma::Path &path, bool case_sensitive), (path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, RenameFile, (const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive), (old_path, new_path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, GetIOType, (sf::Out<s32> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 5, Result, OpenDirectory, (sf::Out<sf::SharedPointer<tma::IDirectoryAccessor>> out, const tma::Path &path, s32 open_mode, bool case_sensitive), (out, path, open_mode, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, DirectoryExists, (sf::Out<bool> out, const tma::Path &path, bool case_sensitive), (out, path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 7, Result, CreateDirectory, (const tma::Path &path, bool case_sensitive), (path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, DeleteDirectory, (const tma::Path &path, bool recursively, bool case_sensitive), (path, recursively, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, RenameDirectory, (const tma::Path &old_path, const tma::Path &new_path, bool case_sensitive), (old_path, new_path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, CreateFile, (const tma::Path &path, s64 size, bool case_sensitive), (path, size, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 11, Result, GetFileTimeStamp, (sf::Out<u64> out_create, sf::Out<u64> out_access, sf::Out<u64> out_modify, const tma::Path &path, bool case_sensitive), (out_create, out_access, out_modify, path, case_sensitive)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, GetCaseSensitivePath, (const tma::Path &path, const sf::OutBuffer &out), (path, out)) \ AMS_SF_METHOD_INFO(C, H, 13, Result, GetDiskFreeSpaceExW, (sf::Out<s64> out_free, sf::Out<s64> out_total, sf::Out<s64> out_total_free, const tma::Path &path), (out_free, out_total, out_total_free, path)) AMS_SF_DEFINE_INTERFACE(ams::tma, IFileManager, AMS_TMA_I_FILE_MANAGER_INTERFACE_INFO, 0xA15AF3E1) /* Prior to system version 6.0.0, case sensitivity was not parameterized. */ #define AMS_TMA_I_DEPRECATED_FILE_MANAGER_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, OpenFile, (sf::Out<sf::SharedPointer<tma::IFileAccessor>> out, const tma::Path &path, u32 open_mode), (out, path, open_mode)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, FileExists, (sf::Out<bool> out, const tma::Path &path), (out, path)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, DeleteFile, (const tma::Path &path), (path)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, RenameFile, (const tma::Path &old_path, const tma::Path &new_path), (old_path, new_path)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, GetIOType, (sf::Out<s32> out, const tma::Path &path), (out, path)) \ AMS_SF_METHOD_INFO(C, H, 5, Result, OpenDirectory, (sf::Out<sf::SharedPointer<tma::IDirectoryAccessor>> out, const tma::Path &path, s32 open_mode), (out, path, open_mode)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, DirectoryExists, (sf::Out<bool> out, const tma::Path &path), (out, path)) \ AMS_SF_METHOD_INFO(C, H, 7, Result, CreateDirectory, (const tma::Path &path), (path)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, DeleteDirectory, (const tma::Path &path, bool recursively), (path, recursively)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, RenameDirectory, (const tma::Path &old_path, const tma::Path &new_path), (old_path, new_path)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, CreateFile, (const tma::Path &path, s64 size), (path, size)) \ AMS_SF_METHOD_INFO(C, H, 11, Result, GetFileTimeStamp, (sf::Out<u64> out_create, sf::Out<u64> out_access, sf::Out<u64> out_modify, const tma::Path &path), (out_create, out_access, out_modify, path)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, GetCaseSensitivePath, (const tma::Path &path, const sf::OutBuffer &out), (path, out)) \ AMS_SF_METHOD_INFO(C, H, 13, Result, GetDiskFreeSpaceExW, (sf::Out<s64> out_free, sf::Out<s64> out_total, sf::Out<s64> out_total_free, const tma::Path &path), (out_free, out_total, out_total_free, path)) AMS_SF_DEFINE_INTERFACE(ams::tma, IDeprecatedFileManager, AMS_TMA_I_DEPRECATED_FILE_MANAGER_INTERFACE_INFO, 0xA15AF3E1)
8,025
C++
.h
54
145.203704
245
0.484373
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,985
tma_i_socket.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_socket.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/htcs/htcs_types.hpp> #include <stratosphere/tma/tma_i_socket.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_SOCKET_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, Close, (sf::Out<s32> out_err, sf::Out<s32> out_res), (out_err, out_res)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, Connect, (sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address), (out_err, out_res, address)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, Bind, (sf::Out<s32> out_err, sf::Out<s32> out_res, const htcs::SockAddrHtcs &address), (out_err, out_res, address)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, Listen, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 backlog_count), (out_err, out_res, backlog_count)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, Accept, (sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address), (out_err, out, out_address)) \ AMS_SF_METHOD_INFO(C, H, 5, Result, Recv, (sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, s32 flags), (out_err, out_size, buffer, flags)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, Send, (sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::InAutoSelectBuffer &buffer, s32 flags), (out_err, out_size, buffer, flags)) \ AMS_SF_METHOD_INFO(C, H, 7, Result, Shutdown, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 how), (out_err, out_res, how)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, Fcntl, (sf::Out<s32> out_err, sf::Out<s32> out_res, s32 command, s32 value), (out_err, out_res, command, value)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, AcceptStart, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event), (out_task_id, out_event)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, AcceptResults, (sf::Out<s32> out_err, sf::Out<sf::SharedPointer<tma::ISocket>> out, sf::Out<htcs::SockAddrHtcs> out_address, u32 task_id), (out_err, out, out_address, task_id)) \ AMS_SF_METHOD_INFO(C, H, 11, Result, RecvStart, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 mem_size, s32 flags), (out_task_id, out_event, mem_size, flags)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, RecvResults, (sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id), (out_err, out_size, buffer, task_id)) \ AMS_SF_METHOD_INFO(C, H, 13, Result, RecvLargeStart, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s32 unaligned_size_start, s32 unaligned_size_end, s64 aligned_size, sf::CopyHandle &&mem_handle, s32 flags), (out_task_id, out_event, unaligned_size_start, unaligned_size_end, aligned_size, std::move(mem_handle), flags)) \ AMS_SF_METHOD_INFO(C, H, 14, Result, SendStartOld, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &buffer, s32 flags), (out_task_id, out_event, buffer, flags)) \ AMS_SF_METHOD_INFO(C, H, 15, Result, SendLargeStart, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InAutoSelectBuffer &start_buffer, const sf::InAutoSelectBuffer &end_buffer, sf::CopyHandle &&mem_handle, s64 aligned_size, s32 flags), (out_task_id, out_event, start_buffer, end_buffer, std::move(mem_handle), aligned_size, flags)) \ AMS_SF_METHOD_INFO(C, H, 16, Result, SendResults, (sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id), (out_err, out_size, task_id)) \ AMS_SF_METHOD_INFO(C, H, 17, Result, StartSend, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, sf::Out<s64> out_max_size, s64 size, s32 flags), (out_task_id, out_event, out_max_size, size, flags)) \ AMS_SF_METHOD_INFO(C, H, 18, Result, ContinueSendOld, (sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InAutoSelectBuffer &buffer, u32 task_id), (out_size, out_wait, buffer, task_id)) \ AMS_SF_METHOD_INFO(C, H, 19, Result, EndSend, (sf::Out<s32> out_err, sf::Out<s64> out_size, u32 task_id), (out_err, out_size, task_id)) \ AMS_SF_METHOD_INFO(C, H, 20, Result, StartRecv, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, s64 size, s32 flags), (out_task_id, out_event, size, flags)) \ AMS_SF_METHOD_INFO(C, H, 21, Result, EndRecv, (sf::Out<s32> out_err, sf::Out<s64> out_size, const sf::OutAutoSelectBuffer &buffer, u32 task_id), (out_err, out_size, buffer, task_id)) \ AMS_SF_METHOD_INFO(C, H, 22, Result, SendStart, (sf::Out<u32> out_task_id, sf::OutCopyHandle out_event, const sf::InNonSecureAutoSelectBuffer &buffer, s32 flags), (out_task_id, out_event, buffer, flags)) \ AMS_SF_METHOD_INFO(C, H, 23, Result, ContinueSend, (sf::Out<s64> out_size, sf::Out<bool> out_wait, const sf::InNonSecureAutoSelectBuffer &buffer, u32 task_id), (out_size, out_wait, buffer, task_id)) \ AMS_SF_METHOD_INFO(C, H, 130, Result, GetPrimitive, (sf::Out<s32> out), (out)) AMS_SF_DEFINE_INTERFACE(ams::tma, ISocket, AMS_TMA_I_SOCKET_INTERFACE_INFO, 0x34CFC7C1)
10,536
C++
.h
47
220.680851
373
0.365821
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,986
tma_i_file_accessor.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_file_accessor.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/sf.hpp> #include <stratosphere/fs/fs_file.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_FILE_ACCESSOR_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, ReadFile, (ams::sf::Out<s64> out, s64 offset, const ams::sf::OutNonSecureBuffer &buffer, ams::fs::ReadOption option), (out, offset, buffer, option)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, WriteFile, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, ams::fs::WriteOption option), (offset, buffer, option)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, GetFileSize, (ams::sf::Out<s64> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, SetFileSize, (s64 size), (size)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, FlushFile, (), ()) \ AMS_SF_METHOD_INFO(C, H, 5, Result, SetPriorityForFile, (s32 priority), (priority)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, GetPriorityForFile, (ams::sf::Out<s32> out), (out)) AMS_SF_DEFINE_INTERFACE(ams::tma, IFileAccessor, AMS_TMA_I_FILE_ACCESSOR_INTERFACE_INFO, 0x985A04E3)
2,494
C++
.h
29
83.482759
200
0.494925
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,987
tma_i_htc_manager.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/tma/tma_i_htc_manager.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> /* NOTE: Minimum firmware version not enforced for any commands. */ #define AMS_TMA_I_HTC_MANAGER_INTERFACE_INFO(C, H) \ AMS_SF_METHOD_INFO(C, H, 0, Result, GetEnvironmentVariable, (sf::Out<s32> out_size, const sf::OutBuffer &out, const sf::InBuffer &name), (out_size, out, name)) \ AMS_SF_METHOD_INFO(C, H, 1, Result, GetEnvironmentVariableLength, (sf::Out<s32> out_size, const sf::InBuffer &name), (out_size, name)) \ AMS_SF_METHOD_INFO(C, H, 2, Result, GetHostConnectionEvent, (sf::OutCopyHandle out), (out)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, GetHostDisconnectionEvent, (sf::OutCopyHandle out), (out)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, GetHostConnectionEventForSystem, (sf::OutCopyHandle out), (out)) \ AMS_SF_METHOD_INFO(C, H, 5, Result, GetHostDisconnectionEventForSystem, (sf::OutCopyHandle out), (out)) \ AMS_SF_METHOD_INFO(C, H, 6, Result, GetBridgeIpAddress, (const sf::OutBuffer &out), (out)) \ AMS_SF_METHOD_INFO(C, H, 7, Result, GetBridgePort, (const sf::OutBuffer &out), (out)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, SetCradleAttached, (bool attached), (attached)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, GetBridgeSubnetMask, (const sf::OutBuffer &out), (out)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, GetBridgeMacAddress, (const sf::OutBuffer &out), (out)) \ AMS_SF_METHOD_INFO(C, H, 11, Result, GetWorkingDirectoryPath, (const sf::OutBuffer &out, s32 max_len), (out, max_len)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, GetWorkingDirectoryPathSize, (sf::Out<s32> out_size), (out_size)) \ AMS_SF_METHOD_INFO(C, H, 13, Result, RunOnHostStart, (sf::Out<u32> out_id, sf::OutCopyHandle out, const sf::InBuffer &args), (out_id, out, args)) \ AMS_SF_METHOD_INFO(C, H, 14, Result, RunOnHostResults, (sf::Out<s32> out_result, u32 id), (out_result, id)) \ AMS_SF_METHOD_INFO(C, H, 15, Result, SetBridgeIpAddress, (const sf::InBuffer &arg), (arg)) \ AMS_SF_METHOD_INFO(C, H, 16, Result, SetBridgeSubnetMask, (const sf::InBuffer &arg), (arg)) \ AMS_SF_METHOD_INFO(C, H, 17, Result, SetBridgePort, (const sf::InBuffer &arg), (arg)) AMS_SF_DEFINE_INTERFACE(ams::tma, IHtcManager, AMS_TMA_I_HTC_MANAGER_INTERFACE_INFO, 0x8591F069)
4,222
C++
.h
38
107.763158
178
0.478594
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,988
os_system_event_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_system_event_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_common.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct SystemEventType; struct MultiWaitHolderType; Result CreateSystemEvent(SystemEventType *event, EventClearMode clear_mode, bool inter_process); void DestroySystemEvent(SystemEventType *event); void AttachSystemEvent(SystemEventType *event, NativeHandle read_handle, bool read_handle_managed, NativeHandle write_handle, bool write_handle_managed, EventClearMode clear_mode); void AttachReadableHandleToSystemEvent(SystemEventType *event, NativeHandle read_handle, bool manage_read_handle, EventClearMode clear_mode); void AttachWritableHandleToSystemEvent(SystemEventType *event, NativeHandle write_handle, bool manage_write_handle, EventClearMode clear_mode); NativeHandle DetachReadableHandleOfSystemEvent(SystemEventType *event); NativeHandle DetachWritableHandleOfSystemEvent(SystemEventType *event); NativeHandle GetReadableHandleOfSystemEvent(const SystemEventType *event); NativeHandle GetWritableHandleOfSystemEvent(const SystemEventType *event); void SignalSystemEvent(SystemEventType *event); void WaitSystemEvent(SystemEventType *event); bool TryWaitSystemEvent(SystemEventType *event); bool TimedWaitSystemEvent(SystemEventType *event, TimeSpan timeout); void ClearSystemEvent(SystemEventType *event); void InitializeMultiWaitHolder(MultiWaitHolderType *multi_wait_holder, SystemEventType *event); }
2,180
C++
.h
38
53.947368
184
0.807223
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,989
os_multiple_wait_utils.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_multiple_wait_utils.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_message_queue_common.hpp> #include <stratosphere/os/os_multiple_wait_api.hpp> #include <stratosphere/os/os_multiple_wait_types.hpp> namespace ams::os { namespace impl { class AutoMultiWaitHolder { private: MultiWaitHolderType m_holder; public: template<typename T> ALWAYS_INLINE explicit AutoMultiWaitHolder(MultiWaitType *multi_wait, T &&arg) { InitializeMultiWaitHolder(std::addressof(m_holder), std::forward<T>(arg)); LinkMultiWaitHolder(multi_wait, std::addressof(m_holder)); } ALWAYS_INLINE ~AutoMultiWaitHolder() { UnlinkMultiWaitHolder(std::addressof(m_holder)); FinalizeMultiWaitHolder(std::addressof(m_holder)); } ALWAYS_INLINE std::pair<MultiWaitHolderType *, int> ConvertResult(const std::pair<MultiWaitHolderType *, int> result, int index) { if (result.first == std::addressof(m_holder)) { return std::make_pair(static_cast<MultiWaitHolderType *>(nullptr), index); } else { return result; } } }; template<typename F> inline std::pair<MultiWaitHolderType *, int> WaitAnyImpl(F &&func, MultiWaitType *multi_wait, int) { return std::pair<MultiWaitHolderType *, int>(func(multi_wait), -1); } template<typename F, typename T, typename... Args> inline std::pair<MultiWaitHolderType *, int> WaitAnyImpl(F &&func, MultiWaitType *multi_wait, int index, T &&x, Args &&... args) { AutoMultiWaitHolder holder(multi_wait, std::forward<T>(x)); return holder.ConvertResult(WaitAnyImpl(std::forward<F>(func), multi_wait, index + 1, std::forward<Args>(args)...), index); } template<typename F, typename... Args> inline std::pair<MultiWaitHolderType *, int> WaitAnyImpl(F &&func, MultiWaitType *multi_wait, Args &&... args) { return WaitAnyImpl(std::forward<F>(func), multi_wait, 0, std::forward<Args>(args)...); } class TempMultiWait { private: MultiWaitType m_multi_wait; public: ALWAYS_INLINE TempMultiWait() { os::InitializeMultiWait(std::addressof(m_multi_wait)); } ALWAYS_INLINE ~TempMultiWait() { os::FinalizeMultiWait(std::addressof(m_multi_wait)); } MultiWaitType *Get() { return std::addressof(m_multi_wait); } }; template<typename F, typename... Args> inline std::pair<MultiWaitHolderType *, int> WaitAnyImpl(F &&func, Args &&... args) { TempMultiWait temp_multi_wait; return WaitAnyImpl(std::forward<F>(func), temp_multi_wait.Get(), 0, std::forward<Args>(args)...); } using WaitAnyFunction = MultiWaitHolderType * (*)(MultiWaitType *); class NotBoolButInt { private: int m_value; public: constexpr ALWAYS_INLINE NotBoolButInt(int v) : m_value(v) { /* ... */ } constexpr ALWAYS_INLINE operator int() const { return m_value; } explicit operator bool() const = delete; }; } template<typename... Args> requires (sizeof...(Args) > 0) inline std::pair<MultiWaitHolderType *, int> WaitAny(MultiWaitType *multi_wait, Args &&... args) { return impl::WaitAnyImpl(static_cast<impl::WaitAnyFunction>(&::ams::os::WaitAny), multi_wait, std::forward<Args>(args)...); } template<typename... Args> requires (sizeof...(Args) > 0) inline int WaitAny(Args &&... args) { return impl::WaitAnyImpl(static_cast<impl::WaitAnyFunction>(&::ams::os::WaitAny), std::forward<Args>(args)...).second; } template<typename... Args> requires (sizeof...(Args) > 0) inline std::pair<MultiWaitHolderType *, int> TryWaitAny(MultiWaitType *multi_wait, Args &&... args) { return impl::WaitAnyImpl(static_cast<impl::WaitAnyFunction>(&::ams::os::TryWaitAny), multi_wait, std::forward<Args>(args)...); } template<typename... Args> requires (sizeof...(Args) > 0) inline impl::NotBoolButInt TryWaitAny(Args &&... args) { return impl::WaitAnyImpl(static_cast<impl::WaitAnyFunction>(&::ams::os::TryWaitAny), std::forward<Args>(args)...).second; } }
5,265
C++
.h
102
41.088235
146
0.61311
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,990
os_shared_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_shared_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_memory_permission.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct SharedMemoryType; Result CreateSharedMemory(SharedMemoryType *shared_memory, size_t size, MemoryPermission my_perm, MemoryPermission other_perm); void AttachSharedMemory(SharedMemoryType *shared_memory, size_t size, NativeHandle handle, bool managed); void DestroySharedMemory(SharedMemoryType *shared_memory); void *MapSharedMemory(SharedMemoryType *shared_memory, MemoryPermission perm); void UnmapSharedMemory(SharedMemoryType *shared_memory); void *GetSharedMemoryAddress(const SharedMemoryType *shared_memory); size_t GetSharedMemorySize(const SharedMemoryType *shared_memory); NativeHandle GetSharedMemoryHandle(const SharedMemoryType *shared_memory); }
1,503
C++
.h
30
47.133333
131
0.790301
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,991
os_transfer_memory.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_transfer_memory.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_transfer_memory_types.hpp> #include <stratosphere/os/os_transfer_memory_api.hpp> namespace ams::os { class TransferMemory { NON_COPYABLE(TransferMemory); NON_MOVEABLE(TransferMemory); private: TransferMemoryType m_tmem; public: constexpr TransferMemory() : m_tmem{ .state = TransferMemoryType::State_NotInitialized } { /* ... */ } TransferMemory(void *address, size_t size, MemoryPermission perm) { R_ABORT_UNLESS(CreateTransferMemory(std::addressof(m_tmem), address, size, perm)); } TransferMemory(size_t size, NativeHandle handle, bool managed) { this->Attach(size, handle, managed); } ~TransferMemory() { if (m_tmem.state == TransferMemoryType::State_NotInitialized) { return; } DestroyTransferMemory(std::addressof(m_tmem)); } void Attach(size_t size, NativeHandle handle, bool managed) { AttachTransferMemory(std::addressof(m_tmem), size, handle, managed); } NativeHandle Detach() { return DetachTransferMemory(std::addressof(m_tmem)); } Result Map(void **out, MemoryPermission owner_perm) { R_RETURN(MapTransferMemory(out, std::addressof(m_tmem), owner_perm)); } void Unmap() { UnmapTransferMemory(std::addressof(m_tmem)); } operator TransferMemoryType &() { return m_tmem; } operator const TransferMemoryType &() const { return m_tmem; } TransferMemoryType *GetBase() { return std::addressof(m_tmem); } }; }
2,573
C++
.h
64
30.265625
102
0.605611
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,992
os_thread_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_thread_common.hpp> namespace ams::os { struct ThreadType; struct MultiWaitHolderType; Result CreateThread(ThreadType *thread, ThreadFunction function, void *argument, void *stack, size_t stack_size, s32 priority, s32 ideal_core); Result CreateThread(ThreadType *thread, ThreadFunction function, void *argument, void *stack, size_t stack_size, s32 priority); void DestroyThread(ThreadType *thread); void StartThread(ThreadType *thread); ThreadType *GetCurrentThread(); void WaitThread(ThreadType *thread); bool TryWaitThread(ThreadType *thread); void YieldThread(); void SleepThread(TimeSpan time); s32 SuspendThread(ThreadType *thread); s32 ResumeThread(ThreadType *thread); s32 GetThreadSuspendCount(const ThreadType *thread); /* TODO: void GetThreadContext(ThreadContextInfo *out_context, const ThreadType *thread); */ s32 ChangeThreadPriority(ThreadType *thread, s32 priority); s32 GetThreadPriority(const ThreadType *thread); s32 GetThreadCurrentPriority(const ThreadType *thread); void SetThreadName(ThreadType *thread, const char *name); void SetThreadNamePointer(ThreadType *thread, const char *name); const char *GetThreadNamePointer(const ThreadType *thread); s32 GetCurrentProcessorNumber(); s32 GetCurrentCoreNumber(); void SetThreadCoreMask(ThreadType *thread, s32 ideal_core, u64 affinity_mask); void GetThreadCoreMask(s32 *out_ideal_core, u64 *out_affinity_mask, const ThreadType *thread); u64 GetThreadAvailableCoreMask(); ThreadId GetThreadId(const ThreadType *thread); void InitializeMultiWaitHolder(MultiWaitHolderType *holder, ThreadType *thread); }
2,398
C++
.h
48
45.979167
147
0.770253
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,993
os_light_event.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_light_event.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_common.hpp> #include <stratosphere/os/os_light_event_types.hpp> #include <stratosphere/os/os_light_event_api.hpp> namespace ams::os { class LightEvent { NON_COPYABLE(LightEvent); NON_MOVEABLE(LightEvent); private: LightEventType m_event; public: explicit LightEvent(EventClearMode clear_mode) { InitializeLightEvent(std::addressof(m_event), false, clear_mode); } ~LightEvent() { FinalizeLightEvent(std::addressof(m_event)); } void Wait() { return WaitLightEvent(std::addressof(m_event)); } bool TryWait() { return TryWaitLightEvent(std::addressof(m_event)); } bool TimedWait(TimeSpan timeout) { return TimedWaitLightEvent(std::addressof(m_event), timeout); } void Signal() { return SignalLightEvent(std::addressof(m_event)); } void Clear() { return ClearLightEvent(std::addressof(m_event)); } operator LightEventType &() { return m_event; } operator const LightEventType &() const { return m_event; } LightEventType *GetBase() { return std::addressof(m_event); } }; }
2,139
C++
.h
59
27.135593
81
0.606193
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,994
os_sdk_reply_and_receive.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_reply_and_receive.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct MultiWaitHolderType; struct MultiWaitType; Result SdkReplyAndReceive(os::MultiWaitHolderType **out, NativeHandle reply_target, MultiWaitType *multi_wait); }
919
C++
.h
23
37.652174
115
0.767937
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,995
os_argument.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_argument.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { int GetHostArgc(); char **GetHostArgv(); }
746
C++
.h
21
33.285714
76
0.747573
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,996
os_light_message_queue_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_light_message_queue_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_busy_mutex.hpp> #include <stratosphere/os/impl/os_internal_light_event.hpp> namespace ams::os { namespace impl { using LightMessageQueueMutex = InternalBusyMutex; using LightMessageQueueMutexStorage = InternalBusyMutexStorage; } struct LightMessageQueueType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; uintptr_t *buffer; s32 capacity; s32 count; s32 offset; u8 state; mutable impl::LightMessageQueueMutexStorage mutex_queue; mutable impl::InternalLightEventStorage ev_not_full; mutable impl::InternalLightEventStorage ev_not_empty; }; static_assert(std::is_trivial<LightMessageQueueType>::value); }
1,560
C++
.h
41
33.073171
76
0.719205
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,997
os_interrupt_event_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_interrupt_event_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { namespace impl { class MultiWaitObjectList; class InterruptEventImpl; } struct InterruptEventType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> multi_wait_object_list_storage; u8 clear_mode; u8 state; util::TypedStorage<impl::InterruptEventImpl, sizeof(NativeHandle) * 2, alignof(NativeHandle)> impl; }; static_assert(std::is_trivial<InterruptEventType>::value); }
1,491
C++
.h
37
35.72973
152
0.727839
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,998
os_rw_lock_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_rw_lock_common.hpp> namespace ams::os { struct ReaderWriterLockType; void InitializeReaderWriterLock(ReaderWriterLockType *rw_lock); void FinalizeReaderWriterLock(ReaderWriterLockType *rw_lock); void AcquireReadLock(ReaderWriterLockType *rw_lock); bool TryAcquireReadLock(ReaderWriterLockType *rw_lock); void ReleaseReadLock(ReaderWriterLockType *rw_lock); void AcquireWriteLock(ReaderWriterLockType *rw_lock); bool TryAcquireWriteLock(ReaderWriterLockType *rw_lock); void ReleaseWriteLock(ReaderWriterLockType *rw_lock); bool IsReadLockHeld(const ReaderWriterLockType *rw_lock); bool IsWriteLockHeldByCurrentThread(const ReaderWriterLockType *rw_lock); bool IsReaderWriterLockOwnerThread(const ReaderWriterLockType *rw_lock); }
1,485
C++
.h
32
43.21875
77
0.789619
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
7,999
os_interrupt_event.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_interrupt_event.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_common.hpp> #include <stratosphere/os/os_interrupt_event_common.hpp> #include <stratosphere/os/os_interrupt_event_types.hpp> #include <stratosphere/os/os_interrupt_event_api.hpp> namespace ams::os { class InterruptEvent { NON_COPYABLE(InterruptEvent); NON_MOVEABLE(InterruptEvent); private: InterruptEventType m_event; public: explicit InterruptEvent(InterruptName name, EventClearMode clear_mode) { InitializeInterruptEvent(std::addressof(m_event), name, clear_mode); } ~InterruptEvent() { FinalizeInterruptEvent(std::addressof(m_event)); } void Wait() { return WaitInterruptEvent(std::addressof(m_event)); } bool TryWait() { return TryWaitInterruptEvent(std::addressof(m_event)); } bool TimedWait(TimeSpan timeout) { return TimedWaitInterruptEvent(std::addressof(m_event), timeout); } void Clear() { return ClearInterruptEvent(std::addressof(m_event)); } operator InterruptEventType &() { return m_event; } operator const InterruptEventType &() const { return m_event; } InterruptEventType *GetBase() { return std::addressof(m_event); } }; }
2,175
C++
.h
57
29.45614
84
0.633254
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,000
os_rw_lock_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { struct ThreadType; struct ReaderWriterLockType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; struct LockCount { union { s32 _arr[sizeof(impl::InternalCriticalSectionStorage) / sizeof(s32)]; impl::InternalCriticalSectionStorage cs_storage; impl::InternalCriticalSectionStorageTypeForConstantInitialize _storage_for_constant_initialize; }; util::BitPack32 counter; }; static_assert(util::is_pod<LockCount>::value); static_assert(std::is_trivial<LockCount>::value); union { struct { LockCount c; u32 write_lock_count; } aligned; struct { u32 write_lock_count; LockCount c; } not_aligned; } lock_count; u32 reserved_1; u8 state; ThreadType *owner_thread; u32 reserved_2; union { s32 _arr[sizeof(impl::InternalConditionVariableStorage) / sizeof(s32)]; impl::InternalConditionVariableStorage _storage; impl::InternalConditionVariableStorageTypeForConstantInitialize _storage_for_constant_initialize; } cv_read_lock; union { s32 _arr[sizeof(impl::InternalConditionVariableStorage) / sizeof(s32)]; impl::InternalConditionVariableStorage _storage; impl::InternalConditionVariableStorageTypeForConstantInitialize _storage_for_constant_initialize; } cv_write_lock; }; static_assert(std::is_trivial<ReaderWriterLockType>::value); #if defined(ATMOSPHERE_OS_HORIZON) consteval ReaderWriterLockType::LockCount MakeConstantInitializedLockCount() { return {}; } #elif defined(ATMOSPHERE_OS_WINDOWS) || defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) /* If windows/linux, require that the lock counter have guaranteed alignment, so that we may constant-initialize. */ static_assert(alignof(ReaderWriterLockType) == sizeof(u64)); consteval ReaderWriterLockType::LockCount MakeConstantInitializedLockCount() { return ReaderWriterLockType::LockCount { { AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER }, {}, }; } #else #error "Unknown OS for constant initialized RW-lock LockCount" #endif }
3,273
C++
.h
77
34.428571
120
0.674411
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,001
os_shared_memory_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_shared_memory_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct SharedMemoryType { enum State { State_NotInitialized = 0, State_Initialized = 1, State_Mapped = 2, }; u8 state; bool handle_managed; bool allocated; void *address; size_t size; NativeHandle handle; mutable impl::InternalCriticalSectionStorage cs_shared_memory; }; static_assert(std::is_trivial<SharedMemoryType>::value); }
1,272
C++
.h
36
30.416667
76
0.696501
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,002
os_event.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_event.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_common.hpp> #include <stratosphere/os/os_event_types.hpp> #include <stratosphere/os/os_event_api.hpp> namespace ams::os { class Event { NON_COPYABLE(Event); NON_MOVEABLE(Event); private: EventType m_event; public: explicit Event(EventClearMode clear_mode) { InitializeEvent(std::addressof(m_event), false, clear_mode); } ~Event() { FinalizeEvent(std::addressof(m_event)); } void Wait() { return WaitEvent(std::addressof(m_event)); } bool TryWait() { return TryWaitEvent(std::addressof(m_event)); } bool TimedWait(TimeSpan timeout) { return TimedWaitEvent(std::addressof(m_event), timeout); } void Signal() { return SignalEvent(std::addressof(m_event)); } void Clear() { return ClearEvent(std::addressof(m_event)); } operator EventType &() { return m_event; } operator const EventType &() const { return m_event; } EventType *GetBase() { return std::addressof(m_event); } }; }
2,047
C++
.h
59
25.576271
76
0.588861
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,003
os_sdk_thread_local_storage.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_local_storage.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_thread_local_storage.hpp> #include <stratosphere/os/os_sdk_thread_local_storage_api.hpp> namespace ams::os { class SdkThreadLocalStorage { NON_COPYABLE(SdkThreadLocalStorage); NON_MOVEABLE(SdkThreadLocalStorage); private: TlsSlot m_tls_slot; public: SdkThreadLocalStorage() { R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(m_tls_slot), nullptr)); } explicit SdkThreadLocalStorage(TlsDestructor destructor) { R_ABORT_UNLESS(os::SdkAllocateTlsSlot(std::addressof(m_tls_slot), destructor)); } ~SdkThreadLocalStorage() { os::FreeTlsSlot(m_tls_slot); } uintptr_t GetValue() const { return os::GetTlsValue(m_tls_slot); } void SetValue(uintptr_t value) { return os::SetTlsValue(m_tls_slot, value); } TlsSlot GetTlsSlot() const { return m_tls_slot; } }; }
1,647
C++
.h
39
35.333333
95
0.67625
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,004
os_condition_variable_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_condition_variable_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { enum class ConditionVariableStatus { TimedOut = 0, Success = 1, }; }
787
C++
.h
23
31.478261
76
0.733596
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,005
os_light_semaphore.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_light_semaphore.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_light_semaphore_types.hpp> #include <stratosphere/os/os_light_semaphore_api.hpp> namespace ams::os { class LightSemaphore { NON_COPYABLE(LightSemaphore); NON_MOVEABLE(LightSemaphore); private: LightSemaphoreType m_sema; public: explicit LightSemaphore(s32 count, s32 max_count) { InitializeLightSemaphore(std::addressof(m_sema), count, max_count); } ~LightSemaphore() { FinalizeLightSemaphore(std::addressof(m_sema)); } void Acquire() { return os::AcquireLightSemaphore(std::addressof(m_sema)); } bool TryAcquire() { return os::TryAcquireLightSemaphore(std::addressof(m_sema)); } bool TimedAcquire(TimeSpan timeout) { return os::TimedAcquireLightSemaphore(std::addressof(m_sema), timeout); } void Release() { return os::ReleaseLightSemaphore(std::addressof(m_sema)); } void Release(s32 count) { return os::ReleaseLightSemaphore(std::addressof(m_sema), count); } s32 GetCurrentCount() const { return os::GetCurrentLightSemaphoreCount(std::addressof(m_sema)); } operator LightSemaphoreType &() { return m_sema; } operator const LightSemaphoreType &() const { return m_sema; } LightSemaphoreType *GetBase() { return std::addressof(m_sema); } }; }
2,299
C++
.h
58
30.155172
87
0.619219
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,006
os_sdk_thread_info.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_info.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_sdk_thread_info_types.hpp> #include <stratosphere/os/os_sdk_thread_info_api.hpp>
759
C++
.h
18
40.333333
76
0.763514
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,007
os_virtual_address_memory_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_virtual_address_memory_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_virtual_address_memory_common.hpp> namespace ams::os { struct VirtualAddressMemoryResourceUsage { size_t assigned_size; size_t used_size; }; }
870
C++
.h
24
33.541667
76
0.748517
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,008
os_thread.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_thread_common.hpp> #include <stratosphere/os/os_thread_types.hpp> #include <stratosphere/os/os_thread_api.hpp>
812
C++
.h
20
38.85
76
0.766119
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,009
os_common_config.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_common_config.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { #if defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) #define AMS_OS_IMPL_USE_PTHREADS #elif defined(ATMOSPHERE_OS_WINDOWS) //#define AMS_OS_IMPL_USE_PTHREADS #endif }
901
C++
.h
24
34.666667
76
0.740275
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,010
os_memory_heap.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_heap.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_memory_heap_common.hpp> #include <stratosphere/os/os_memory_heap_api.hpp>
774
C++
.h
19
39
76
0.764238
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,011
os_thread_local_storage_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_local_storage_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_memory_common.hpp> namespace ams::os { struct TlsSlot { u32 _value; }; using TlsDestructor = void (*)(uintptr_t arg); constexpr inline size_t TlsSlotCountMax = 16; constexpr inline size_t SdkTlsSlotCountMax = 16; }
976
C++
.h
26
34.692308
76
0.740466
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,012
os_process_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_process_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_native_handle.hpp> #include <stratosphere/os/os_memory_common.hpp> namespace ams::os { Result MapProcessMemory(void **out, NativeHandle handle, u64 process_address, size_t process_size, AddressSpaceGenerateRandomFunction generate_random); void UnmapProcessMemory(void *mapped_memory, NativeHandle handle, u64 process_address, size_t process_size); Result SetProcessMemoryPermission(NativeHandle handle, u64 process_address, u64 process_size, MemoryPermission perm); }
1,162
C++
.h
23
48.173913
155
0.782187
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,013
os_condition_variable_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_condition_variable_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { struct ConditionVariableType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; u8 state; union { s32 _arr[sizeof(impl::InternalConditionVariableStorage) / sizeof(s32)]; impl::InternalConditionVariableStorage _storage; impl::InternalConditionVariableStorageTypeForConstantInitialize _storage_for_constant_initialize; }; }; static_assert(std::is_trivial<ConditionVariableType>::value); }
1,281
C++
.h
33
33.848485
109
0.715205
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,014
os_memory_heap_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_heap_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_memory_heap_common.hpp> namespace ams::os { Result SetMemoryHeapSize(size_t size); uintptr_t GetMemoryHeapAddress(); size_t GetMemoryHeapSize(); Result AllocateMemoryBlock(uintptr_t *out_address, size_t size); void FreeMemoryBlock(uintptr_t address, size_t size); }
1,038
C++
.h
26
37.423077
76
0.760675
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,015
os_thread_local_storage_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_local_storage_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_memory_common.hpp> #include <stratosphere/os/os_thread_local_storage_common.hpp> namespace ams::os { Result AllocateTlsSlot(TlsSlot *out, TlsDestructor destructor); void FreeTlsSlot(TlsSlot slot); uintptr_t GetTlsValue(TlsSlot slot); void SetTlsValue(TlsSlot slot, uintptr_t value); }
1,031
C++
.h
25
38.8
76
0.767
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,016
os_sdk_thread_info_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_info_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> namespace ams::os { enum SdkLastThreadInfoFlag : u32 { SdkLastThreadInfoFlag_ThreadInSystemCall = (1u << 0), }; }
828
C++
.h
22
35.136364
76
0.747198
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,017
os_rw_busy_mutex_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_busy_mutex_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_rw_busy_mutex.hpp> namespace ams::os { struct ReaderWriterBusyMutexType { union { s32 _arr[sizeof(impl::InternalReaderWriterBusyMutexStorage) / sizeof(s32)]; impl::InternalReaderWriterBusyMutexStorage _storage; }; }; static_assert(std::is_trivial<ReaderWriterBusyMutexType>::value); }
1,055
C++
.h
27
35.481481
87
0.739258
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,018
os_condition_variable_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_condition_variable_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_condition_variable_common.hpp> namespace ams::os { struct MutexType; struct ConditionVariableType; void InitializeConditionVariable(ConditionVariableType *cv); void FinalizeConditionVariable(ConditionVariableType *cv); void SignalConditionVariable(ConditionVariableType *cv); void BroadcastConditionVariable(ConditionVariableType *cv); void WaitConditionVariable(ConditionVariableType *cv, MutexType *m); ConditionVariableStatus TimedWaitConditionVariable(ConditionVariableType *cv, MutexType *m, TimeSpan timeout); }
1,257
C++
.h
28
42
114
0.789689
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,019
os_sdk_thread_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_thread_local_storage_common.hpp> namespace ams::os { struct SdkInternalTlsType { uintptr_t sf_inline_context; }; static_assert(util::is_pod<SdkInternalTlsType>::value); static_assert((sizeof(SdkInternalTlsType) % sizeof(uintptr_t)) == 0); constexpr inline size_t SdkInternalTlsCount = sizeof(SdkInternalTlsType) / sizeof(uintptr_t); static_assert(SdkInternalTlsCount <= SdkTlsSlotCountMax); }
1,154
C++
.h
27
39.851852
97
0.755793
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,020
os_memory_fence_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_fence_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #if defined(ATMOSPHERE_OS_HORIZON) #include <stratosphere/os/impl/os_memory_fence_api.os.horizon.hpp> #elif defined(ATMOSPHERE_OS_WINDOWS) || defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) #include <stratosphere/os/impl/os_memory_fence_api.os.generic.hpp> #else #error "Unknown os for os::MemoryFence*" #endif namespace ams::os { ALWAYS_INLINE void FenceMemoryStoreStore() { return impl::FenceMemoryStoreStore(); } ALWAYS_INLINE void FenceMemoryStoreLoad() { return impl::FenceMemoryStoreLoad(); } ALWAYS_INLINE void FenceMemoryStoreAny() { return impl::FenceMemoryStoreAny(); } ALWAYS_INLINE void FenceMemoryLoadStore() { return impl::FenceMemoryLoadStore(); } ALWAYS_INLINE void FenceMemoryLoadLoad() { return impl::FenceMemoryLoadLoad(); } ALWAYS_INLINE void FenceMemoryLoadAny() { return impl::FenceMemoryLoadAny(); } ALWAYS_INLINE void FenceMemoryAnyStore() { return impl::FenceMemoryLoadStore(); } ALWAYS_INLINE void FenceMemoryAnyLoad() { return impl::FenceMemoryLoadLoad(); } ALWAYS_INLINE void FenceMemoryAnyAny() { return impl::FenceMemoryLoadAny(); } }
1,812
C++
.h
35
48.828571
100
0.756635
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,021
os_virtual_address_memory.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_virtual_address_memory.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_virtual_address_memory_common.hpp> #include <stratosphere/os/os_virtual_address_memory_types.hpp> #include <stratosphere/os/os_virtual_address_memory_api.hpp>
860
C++
.h
20
41.25
76
0.772348
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,022
os_cache.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_cache.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { void FlushDataCache(const void *addr, size_t size); void FlushEntireDataCache(); }
785
C++
.h
21
35.190476
76
0.754271
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,023
os_busy_mutex.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_busy_mutex.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_busy_mutex_types.hpp> #include <stratosphere/os/os_busy_mutex_api.hpp> namespace ams::os { class BusyMutex { NON_COPYABLE(BusyMutex); NON_MOVEABLE(BusyMutex); private: BusyMutexType m_mutex; public: constexpr explicit BusyMutex() : m_mutex{::ams::os::BusyMutexType::State_Initialized, nullptr, {{AMS_OS_INTERNAL_BUSY_MUTEX_IMPL_CONSTANT_INITIALIZE_ARRAY_VALUES}}} { /* ... */ } ~BusyMutex() { FinalizeBusyMutex(std::addressof(m_mutex)); } void lock() { return LockBusyMutex(std::addressof(m_mutex)); } void unlock() { return UnlockBusyMutex(std::addressof(m_mutex)); } bool try_lock() { return TryLockBusyMutex(std::addressof(m_mutex)); } ALWAYS_INLINE void Lock() { return this->lock(); } ALWAYS_INLINE void Unlock() { return this->unlock(); } ALWAYS_INLINE bool TryLock() { return this->try_lock(); } operator BusyMutexType &() { return m_mutex; } operator const BusyMutexType &() const { return m_mutex; } BusyMutexType *GetBase() { return std::addressof(m_mutex); } }; }
2,101
C++
.h
56
28.25
190
0.593504
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,024
os_tick.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_tick.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> namespace ams::os { class Tick; /* Tick API. */ Tick GetSystemTick(); Tick GetSystemTickOrdered(); s64 GetSystemTickFrequency(); TimeSpan ConvertToTimeSpan(Tick tick); Tick ConvertToTick(TimeSpan ts); class Tick { private: s64 m_tick; public: constexpr explicit Tick(s64 t = 0) : m_tick(t) { /* ... */ } Tick(TimeSpan ts) : m_tick(ConvertToTick(ts).GetInt64Value()) { /* ... */ } public: constexpr s64 GetInt64Value() const { return m_tick; } TimeSpan ToTimeSpan() const { return ConvertToTimeSpan(*this); } /* Tick arithmetic. */ constexpr Tick &operator+=(Tick rhs) { m_tick += rhs.m_tick; return *this; } constexpr Tick &operator-=(Tick rhs) { m_tick -= rhs.m_tick; return *this; } constexpr Tick operator+(Tick rhs) const { Tick r(*this); return r += rhs; } constexpr Tick operator-(Tick rhs) const { Tick r(*this); return r -= rhs; } constexpr bool operator==(const Tick &rhs) const { return m_tick == rhs.m_tick; } constexpr bool operator!=(const Tick &rhs) const { return !(*this == rhs); } constexpr bool operator<(const Tick &rhs) const { return m_tick < rhs.m_tick; } constexpr bool operator>=(const Tick &rhs) const { return !(*this < rhs); } constexpr bool operator>(const Tick &rhs) const { return m_tick > rhs.m_tick; } constexpr bool operator<=(const Tick &rhs) const { return !(*this > rhs); } }; }
2,442
C++
.h
59
32.830508
88
0.599747
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,025
os_insecure_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_insecure_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_memory_common.hpp> namespace ams::os { Result AllocateInsecureMemory(uintptr_t *out_address, size_t size); void FreeInsecureMemory(uintptr_t address, size_t size); }
855
C++
.h
21
38.47619
76
0.761446
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,026
os_thread_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { constexpr inline s32 ThreadSuspendCountMax = 127; constexpr inline s32 ThreadNameLengthMax = 0x20; constexpr inline s32 ThreadPriorityRangeSize = 32; constexpr inline s32 HighestThreadPriority = 0; constexpr inline s32 DefaultThreadPriority = ThreadPriorityRangeSize / 2; constexpr inline s32 LowestThreadPriority = ThreadPriorityRangeSize - 1; constexpr inline s32 InvalidThreadPriority = 127; constexpr inline s32 LowestSystemThreadPriority = 35; constexpr inline s32 HighestSystemThreadPriority = -12; constexpr inline size_t StackGuardAlignment = 4_KB; constexpr inline size_t ThreadStackAlignment = 4_KB; using ThreadFunction = void (*)(void *); }
1,411
C++
.h
31
42.258065
79
0.763848
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,027
os_thread_local_storage.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_local_storage.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_thread_local_storage_common.hpp> #include <stratosphere/os/os_thread_local_storage_api.hpp> namespace ams::os { class ThreadLocalStorage { NON_COPYABLE(ThreadLocalStorage); NON_MOVEABLE(ThreadLocalStorage); private: TlsSlot m_tls_slot; public: ThreadLocalStorage() { R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(m_tls_slot), nullptr)); } explicit ThreadLocalStorage(TlsDestructor destructor) { R_ABORT_UNLESS(os::AllocateTlsSlot(std::addressof(m_tls_slot), destructor)); } ~ThreadLocalStorage() { os::FreeTlsSlot(m_tls_slot); } uintptr_t GetValue() const { return os::GetTlsValue(m_tls_slot); } void SetValue(uintptr_t value) { return os::SetTlsValue(m_tls_slot, value); } TlsSlot GetTlsSlot() const { return m_tls_slot; } }; }
1,626
C++
.h
39
34.794872
92
0.671944
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,028
os_io_region.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_io_region.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_io_region_types.hpp> #include <stratosphere/os/os_io_region_api.hpp> namespace ams::os { class IoRegion { NON_COPYABLE(IoRegion); NON_MOVEABLE(IoRegion); private: IoRegionType m_io_region; public: constexpr IoRegion() : m_io_region{ .state = IoRegionType::State_NotInitialized } { /* ... */ } IoRegion(NativeHandle io_pool_handle, uintptr_t address, size_t size, MemoryMapping mapping, MemoryPermission permission) { R_ABORT_UNLESS(CreateIoRegion(std::addressof(m_io_region), io_pool_handle, address, size, mapping, permission)); } IoRegion(size_t size, NativeHandle handle, bool managed) { this->AttachHandle(size, handle, managed); } ~IoRegion() { if (m_io_region.state == IoRegionType::State_NotInitialized) { return; } if (m_io_region.state == IoRegionType::State_Mapped) { this->Unmap(); } DestroyIoRegion(std::addressof(m_io_region)); } void AttachHandle(size_t size, NativeHandle handle, bool managed) { AttachIoRegionHandle(std::addressof(m_io_region), size, handle, managed); } NativeHandle GetHandle() const { return GetIoRegionHandle(std::addressof(m_io_region)); } Result Map(void **out, MemoryPermission perm) { R_RETURN(MapIoRegion(out, std::addressof(m_io_region), perm)); } void Unmap() { UnmapIoRegion(std::addressof(m_io_region)); } operator IoRegionType &() { return m_io_region; } operator const IoRegionType &() const { return m_io_region; } IoRegionType *GetBase() { return std::addressof(m_io_region); } }; }
2,744
C++
.h
67
30.61194
135
0.593386
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,029
os_io_region_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_io_region_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_memory_permission.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct IoRegionType; Result CreateIoRegion(IoRegionType *io_region, NativeHandle io_pool_handle, uintptr_t address, size_t size, MemoryMapping mapping, MemoryPermission permission); void AttachIoRegionHandle(IoRegionType *io_region, size_t size, NativeHandle handle, bool managed); os::NativeHandle DetachIoRegionHandle(IoRegionType *io_region); void DestroyIoRegion(IoRegionType *io_region); NativeHandle GetIoRegionHandle(const IoRegionType *io_region); Result MapIoRegion(void **out, IoRegionType *io_region, MemoryPermission perm); void UnmapIoRegion(IoRegionType *io_region); }
1,415
C++
.h
29
45.896552
164
0.778504
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,030
os_thread_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_thread_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_thread_common.hpp> #include <stratosphere/os/os_thread_local_storage_common.hpp> #include <stratosphere/os/os_thread_local_storage_api.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> #include <stratosphere/os/os_sdk_thread_types.hpp> namespace ams::os { namespace impl { class MultiWaitObjectList; } #if !defined(AMS_OS_IMPL_USE_PTHREADS) using ThreadId = u64; #else /* TODO: decide whether using pthread_id_np_t or not more thoroughly. */ #if defined(ATMOSPHERE_OS_MACOS) #define AMS_OS_IMPL_USE_PTHREADID_NP_FOR_THREAD_ID #endif #if defined(AMS_OS_IMPL_USE_PTHREADID_NP_FOR_THREAD_ID) using ThreadId = u64; #else static_assert(sizeof(pthread_t) <= sizeof(u64)); using ThreadId = pthread_t; #endif #endif struct ThreadType { static constexpr u16 Magic = 0xF5A5; enum State { State_NotInitialized = 0, State_Initialized = 1, State_DestroyedBeforeStarted = 2, State_Started = 3, State_Terminated = 4, }; util::TypedStorage<util::IntrusiveListNode> all_threads_node; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> waitlist; uintptr_t reserved[4]; u8 state; bool stack_is_aliased; bool auto_registered; u8 suspend_count; u16 magic; s16 base_priority; u16 version; char name_buffer[ThreadNameLengthMax]; const char *name_pointer; ThreadId thread_id; void *original_stack; void *stack; size_t stack_size; ThreadFunction function; void *initial_fiber; void *current_fiber; void *argument; mutable impl::InternalCriticalSectionStorage cs_thread; mutable impl::InternalConditionVariableStorage cv_thread; /* The following members are arch/os specific. */ #if defined(AMS_OS_IMPL_USE_PTHREADS) mutable uintptr_t tls_value_array[TlsSlotCountMax + SdkTlsSlotCountMax]; mutable impl::InternalCriticalSectionStorage cs_pthread_exit; mutable impl::InternalConditionVariableStorage cv_pthread_exit; bool exited_pthread; pthread_t pthread; u64 affinity_mask; int ideal_core; #elif defined(ATMOSPHERE_OS_HORIZON) /* NOTE: Here, Nintendo stores the TLS array. This is handled by libnx in our case. */ /* However, we need to access certain values in other threads' TLS (Nintendo uses a hardcoded layout for SDK tls members...) */ /* These members are tls slot holders in sdk code, but just normal thread type members under our scheme. */ SdkInternalTlsType sdk_internal_tls; using ThreadImpl = ::Thread; ThreadImpl *thread_impl; ThreadImpl thread_impl_storage; #elif defined(ATMOSPHERE_OS_WINDOWS) mutable uintptr_t tls_value_array[TlsSlotCountMax + SdkTlsSlotCountMax]; NativeHandle native_handle; int ideal_core; u64 affinity_mask; #endif }; static_assert(std::is_trivial<ThreadType>::value); constexpr inline s32 IdealCoreDontCare = -1; constexpr inline s32 IdealCoreUseDefault = -2; constexpr inline s32 IdealCoreNoUpdate = -3; }
4,239
C++
.h
101
34.70297
135
0.674362
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,031
os_transfer_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_transfer_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_memory_permission.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct TransferMemoryType; Result CreateTransferMemory(TransferMemoryType *tmem, void *address, size_t size, MemoryPermission perm); void AttachTransferMemory(TransferMemoryType *tmem, size_t size, NativeHandle handle, bool managed); NativeHandle DetachTransferMemory(TransferMemoryType *tmem); void DestroyTransferMemory(TransferMemoryType *tmem); Result MapTransferMemory(void **out, TransferMemoryType *tmem, MemoryPermission owner_perm); void UnmapTransferMemory(TransferMemoryType *tmem); }
1,323
C++
.h
28
44.464286
109
0.783994
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,032
os_semaphore.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_semaphore.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_semaphore_types.hpp> #include <stratosphere/os/os_semaphore_api.hpp> namespace ams::os { class Semaphore { NON_COPYABLE(Semaphore); NON_MOVEABLE(Semaphore); private: SemaphoreType m_sema; public: explicit Semaphore(s32 count, s32 max_count) { InitializeSemaphore(std::addressof(m_sema), count, max_count); } ~Semaphore() { FinalizeSemaphore(std::addressof(m_sema)); } void Acquire() { return os::AcquireSemaphore(std::addressof(m_sema)); } bool TryAcquire() { return os::TryAcquireSemaphore(std::addressof(m_sema)); } bool TimedAcquire(TimeSpan timeout) { return os::TimedAcquireSemaphore(std::addressof(m_sema), timeout); } void Release() { return os::ReleaseSemaphore(std::addressof(m_sema)); } void Release(s32 count) { return os::ReleaseSemaphore(std::addressof(m_sema), count); } s32 GetCurrentCount() const { return os::GetCurrentSemaphoreCount(std::addressof(m_sema)); } operator SemaphoreType &() { return m_sema; } operator const SemaphoreType &() const { return m_sema; } SemaphoreType *GetBase() { return std::addressof(m_sema); } }; }
2,201
C++
.h
58
28.482759
82
0.602817
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,033
os_virtual_address_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_virtual_address_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_virtual_address_memory_common.hpp> #include <stratosphere/os/os_virtual_address_memory_types.hpp> namespace ams::os { void InitializeVirtualAddressMemory(); Result AllocateAddressRegion(uintptr_t *out, size_t size); Result AllocateMemory(uintptr_t *out, size_t size); Result AllocateMemoryPages(uintptr_t address, size_t size); Result FreeAddressRegion(uintptr_t address); Result FreeMemoryPages(uintptr_t address, size_t size); VirtualAddressMemoryResourceUsage GetVirtualAddressMemoryResourceUsage(); bool IsVirtualAddressMemoryEnabled(); }
1,282
C++
.h
29
41.37931
77
0.776886
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,034
os_sdk_mutex.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_mutex.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> namespace ams::os { class SdkConditionVariable; struct ThreadType; struct SdkMutexType { #if !defined(AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CAN_CHECK_LOCKED_BY_CURRENT_THREAD) os::ThreadType *owner_thread; #endif union { s32 _arr[sizeof(impl::InternalCriticalSectionStorage) / sizeof(s32)]; impl::InternalCriticalSectionStorage _storage; impl::InternalCriticalSectionStorageTypeForConstantInitialize _storage_for_constant_initialize; }; }; static_assert(std::is_trivial<SdkMutexType>::value); void InitializeSdkMutex(SdkMutexType *mutex); void LockSdkMutex(SdkMutexType *mutex); bool TryLockSdkMutex(SdkMutexType *mutex); void UnlockSdkMutex(SdkMutexType *mutex); bool IsSdkMutexLockedByCurrentThread(const SdkMutexType *mutex); class SdkMutex { private: friend class SdkConditionVariable; private: SdkMutexType m_mutex; public: #if defined(AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CAN_CHECK_LOCKED_BY_CURRENT_THREAD) constexpr SdkMutex() : m_mutex{{AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER}} { /* ... */ } #else constexpr SdkMutex() : m_mutex{nullptr, {AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER}} { /* ... */ } #endif ALWAYS_INLINE void Lock() { return os::LockSdkMutex(std::addressof(m_mutex)); } ALWAYS_INLINE bool TryLock() { return os::TryLockSdkMutex(std::addressof(m_mutex)); } ALWAYS_INLINE void Unlock() { return os::UnlockSdkMutex(std::addressof(m_mutex)); } ALWAYS_INLINE bool IsLockedByCurrentThread() const { return os::IsSdkMutexLockedByCurrentThread(std::addressof(m_mutex)); } ALWAYS_INLINE void lock() { return this->Lock(); } ALWAYS_INLINE bool try_lock() { return this->TryLock(); } ALWAYS_INLINE void unlock() { return this->Unlock(); } }; }
2,769
C++
.h
57
41.561404
135
0.689885
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,035
os_barrier_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_barrier_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { struct BarrierType { u16 max_threads; u16 waiting_threads; u32 base_counter_lower; u32 base_counter_upper; impl::InternalCriticalSectionStorage cs_barrier; impl::InternalConditionVariableStorage cv_gathered; }; static_assert(std::is_trivial<BarrierType>::value); }
1,153
C++
.h
30
34.8
76
0.744186
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,036
os_mutex_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_mutex_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_mutex_common.hpp> namespace ams::os { struct MutexType; void InitializeMutex(MutexType *mutex, bool recursive, int lock_level); void FinalizeMutex(MutexType *mutex); void LockMutex(MutexType *mutex); bool TryLockMutex(MutexType *mutex); void UnlockMutex(MutexType *mutex); bool IsMutexLockedByCurrentThread(const MutexType *mutex); }
1,069
C++
.h
27
36.777778
76
0.761353
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,037
os_native_handle_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_native_handle_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_native_handle_types.hpp> namespace ams::os { void CloseNativeHandle(NativeHandle handle); NativeHandle GetCurrentProcessHandle(); }
845
C++
.h
22
36.181818
76
0.766504
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,038
os_process_handle_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_process_handle_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_native_handle.hpp> #include <stratosphere/ncm/ncm_program_id.hpp> namespace ams::os { Result GetProcessId(os::ProcessId *out, NativeHandle handle); ALWAYS_INLINE ProcessId GetProcessId(NativeHandle handle) { ProcessId process_id; R_ABORT_UNLESS(GetProcessId(std::addressof(process_id), handle)); return process_id; } ALWAYS_INLINE ProcessId GetCurrentProcessId() { return GetProcessId(GetCurrentProcessHandle()); } Result GetProgramId(ncm::ProgramId *out, NativeHandle handle); ALWAYS_INLINE ncm::ProgramId GetProgramId(NativeHandle handle) { ncm::ProgramId program_id; R_ABORT_UNLESS(GetProgramId(std::addressof(program_id), handle)); return program_id; } ALWAYS_INLINE ncm::ProgramId GetCurrentProgramId() { return GetProgramId(GetCurrentProcessHandle()); } }
1,552
C++
.h
38
36.5
76
0.737542
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,039
os_memory_fence.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_fence.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_memory_fence_api.hpp>
699
C++
.h
17
39.294118
76
0.760997
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,040
os_sdk_thread_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_thread_types.hpp> #include <stratosphere/os/os_sdk_thread_types.hpp> #include <stratosphere/os/os_thread_local_storage_common.hpp> namespace ams::os { ALWAYS_INLINE SdkInternalTlsType *GetSdkInternalTlsArray(ThreadType *thread = os::GetCurrentThread()) { #if defined(ATMOSPHERE_OS_HORIZON) return std::addressof(thread->sdk_internal_tls); #else return reinterpret_cast<SdkInternalTlsType *>(std::addressof(thread->tls_value_array[TlsSlotCountMax])); #endif } }
1,237
C++
.h
29
39.37931
112
0.75
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,041
os_sdk_thread_info_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_info_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_sdk_thread_info_types.hpp> #include <stratosphere/os/os_thread_types.hpp> namespace ams::os { void GetThreadStackInfo(uintptr_t *out_stack_top, size_t *out_stack_size, const ThreadType *thread); }
881
C++
.h
21
39.952381
104
0.76196
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,042
os_process_code_memory_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_process_code_memory_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_native_handle.hpp> #include <stratosphere/os/os_memory_common.hpp> namespace ams::os { struct ProcessMemoryRegion { u64 address; u64 size; }; Result MapProcessCodeMemory(u64 *out, NativeHandle handle, const ProcessMemoryRegion *regions, size_t num_regions, AddressSpaceGenerateRandomFunction generate_random); Result UnmapProcessCodeMemory(NativeHandle handle, u64 process_code_address, const ProcessMemoryRegion *regions, size_t num_regions); }
1,160
C++
.h
26
41.653846
171
0.768822
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,043
os_busy_mutex_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_busy_mutex_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_busy_mutex.hpp> namespace ams::os { struct ThreadType; struct BusyMutexType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; u8 state; ThreadType *owner_thread; union { s32 _arr[sizeof(impl::InternalBusyMutexStorage) / sizeof(s32)]; impl::InternalBusyMutexStorage _storage; }; }; static_assert(std::is_trivial<BusyMutexType>::value); }
1,189
C++
.h
34
30.088235
76
0.693647
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,044
os_rw_lock_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { constexpr inline s32 ReaderWriterLockCountMax = (1 << (BITSIZEOF(u16) - 1)) - 1; constexpr inline s32 ReaderWriterLockWaiterCountMax = (1 << BITSIZEOF(u8)) - 1; }
870
C++
.h
21
39.285714
90
0.74144
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,045
os_semaphore_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_semaphore_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { namespace impl { class MultiWaitObjectList; } struct SemaphoreType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> waitlist; u8 state; s32 count; s32 max_count; impl::InternalCriticalSectionStorage cs_sema; impl::InternalConditionVariableStorage cv_not_zero; }; static_assert(std::is_trivial<SemaphoreType>::value); }
1,401
C++
.h
37
33.108108
130
0.719557
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,046
os_message_queue_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_message_queue_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_message_queue_common.hpp> namespace ams::os { struct MessageQueueType; struct MultiWaitHolderType; void InitializeMessageQueue(MessageQueueType *mq, uintptr_t *buffer, size_t count); void FinalizeMessageQueue(MessageQueueType *mq); /* Sending (FIFO functionality) */ void SendMessageQueue(MessageQueueType *mq, uintptr_t data); bool TrySendMessageQueue(MessageQueueType *mq, uintptr_t data); bool TimedSendMessageQueue(MessageQueueType *mq, uintptr_t data, TimeSpan timeout); /* Jamming (LIFO functionality) */ void JamMessageQueue(MessageQueueType *mq, uintptr_t data); bool TryJamMessageQueue(MessageQueueType *mq, uintptr_t data); bool TimedJamMessageQueue(MessageQueueType *mq, uintptr_t data, TimeSpan timeout); /* Receive functionality */ void ReceiveMessageQueue(uintptr_t *out, MessageQueueType *mq); bool TryReceiveMessageQueue(uintptr_t *out, MessageQueueType *mq); bool TimedReceiveMessageQueue(uintptr_t *out, MessageQueueType *mq, TimeSpan timeout); /* Peek functionality */ void PeekMessageQueue(uintptr_t *out, const MessageQueueType *mq); bool TryPeekMessageQueue(uintptr_t *out, const MessageQueueType *mq); bool TimedPeekMessageQueue(uintptr_t *out, const MessageQueueType *mq, TimeSpan timeout); void InitializeMultiWaitHolder(MultiWaitHolderType *multi_wait_holder, MessageQueueType *event, MessageQueueWaitType wait_type); }
2,140
C++
.h
41
48.560976
132
0.773097
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,047
os_debug.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_debug.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_debug_types.hpp> #include <stratosphere/os/os_debug_api.hpp>
762
C++
.h
19
38.315789
76
0.762803
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,048
os_rw_busy_mutex.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_busy_mutex.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_rw_busy_mutex_types.hpp> #include <stratosphere/os/os_rw_busy_mutex_api.hpp> namespace ams::os { class ReaderWriterBusyMutex { NON_COPYABLE(ReaderWriterBusyMutex); NON_MOVEABLE(ReaderWriterBusyMutex); private: ReaderWriterBusyMutexType m_rw_mutex; public: constexpr explicit ReaderWriterBusyMutex() : m_rw_mutex{ { AMS_OS_INTERNAL_READER_WRITER_BUSY_MUTEX_IMPL_CONSTANT_INITIALIZER } } { /* ... */ } void AcquireReadLock() { return os::AcquireReadLockBusyMutex(std::addressof(m_rw_mutex)); } void ReleaseReadLock() { return os::ReleaseReadLockBusyMutex(std::addressof(m_rw_mutex)); } void AcquireWriteLock() { return os::AcquireWriteLockBusyMutex(std::addressof(m_rw_mutex)); } void ReleaseWriteLock() { return os::ReleaseWriteLockBusyMutex(std::addressof(m_rw_mutex)); } void lock_shared() { return this->AcquireReadLock(); } void unlock_shared() { return this->ReleaseReadLock(); } void lock() { return this->AcquireWriteLock(); } void unlock() { return this->ReleaseWriteLock(); } operator ReaderWriterBusyMutexType &() { return m_rw_mutex; } operator const ReaderWriterBusyMutexType &() const { return m_rw_mutex; } ReaderWriterBusyMutexType *GetBase() { return std::addressof(m_rw_mutex); } }; }
2,396
C++
.h
61
29.557377
155
0.60922
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,049
os_timer_event_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_timer_event_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_common.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { namespace impl { class MultiWaitObjectList; } struct TimerEventType { using TimeSpanStorage = util::TypedStorage<TimeSpan>; enum State { State_NotInitialized = 0, State_Initialized = 1, }; enum TimerState { TimerState_Stop = 0, TimerState_OneShot = 1, TimerState_Periodic = 2, }; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> multi_wait_object_list_storage; u8 state; u8 clear_mode; bool signaled; u8 timer_state; u32 broadcast_counter_low; u32 broadcast_counter_high; TimeSpanStorage next_time_to_wakeup; TimeSpanStorage first; TimeSpanStorage interval; impl::InternalCriticalSectionStorage cs_timer_event; impl::InternalConditionVariableStorage cv_signaled; }; static_assert(std::is_trivial<TimerEventType>::value); }
1,902
C++
.h
50
32.02
152
0.698206
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,050
os_mutex.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_mutex.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_mutex_common.hpp> #include <stratosphere/os/os_mutex_types.hpp> #include <stratosphere/os/os_mutex_api.hpp> namespace ams::os { class Mutex { NON_COPYABLE(Mutex); NON_MOVEABLE(Mutex); private: MutexType m_mutex; public: constexpr explicit Mutex(bool recursive) : m_mutex{::ams::os::MutexType::State_Initialized, recursive, 0, 0, nullptr, { AMS_OS_INTERNAL_CRITICAL_SECTION_IMPL_CONSTANT_INITIALIZER } } { /* ... */ } ~Mutex() { FinalizeMutex(std::addressof(m_mutex)); } void lock() { return LockMutex(std::addressof(m_mutex)); } void unlock() { return UnlockMutex(std::addressof(m_mutex)); } bool try_lock() { return TryLockMutex(std::addressof(m_mutex)); } bool IsLockedByCurrentThread() const { return IsMutexLockedByCurrentThread(std::addressof(m_mutex)); } ALWAYS_INLINE void Lock() { return this->lock(); } ALWAYS_INLINE void Unlock() { return this->unlock(); } ALWAYS_INLINE bool TryLock() { return this->try_lock(); } operator MutexType &() { return m_mutex; } operator const MutexType &() const { return m_mutex; } MutexType *GetBase() { return std::addressof(m_mutex); } }; }
2,252
C++
.h
60
28.133333
208
0.589073
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,051
os_memory_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { using AddressSpaceGenerateRandomFunction = u64 (*)(u64); enum MemoryPermission { MemoryPermission_None = (0 << 0), MemoryPermission_ReadOnly = (1 << 0), MemoryPermission_WriteOnly = (1 << 1), MemoryPermission_ExecuteOnly = (1 << 2), MemoryPermission_ReadWrite = MemoryPermission_ReadOnly | MemoryPermission_WriteOnly, MemoryPermission_ReadExecute = MemoryPermission_ReadOnly | MemoryPermission_ExecuteOnly, }; #if defined(ATMOSPHERE_OS_HORIZON) using MemoryMapping = svc::MemoryMapping; using enum svc::MemoryMapping; #else enum MemoryMapping : u32 { MemoryMapping_IoRegister = 0, MemoryMapping_Uncached = 1, MemoryMapping_Memory = 2, }; #endif }
1,504
C++
.h
38
34.368421
96
0.693836
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,052
os_semaphore_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_semaphore_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { struct SemaphoreType; struct MultiWaitHolderType; void InitializeSemaphore(SemaphoreType *sema, s32 count, s32 max_count); void FinalizeSemaphore(SemaphoreType *sema); void AcquireSemaphore(SemaphoreType *sema); bool TryAcquireSemaphore(SemaphoreType *sema); bool TimedAcquireSemaphore(SemaphoreType *sema, TimeSpan timeout); void ReleaseSemaphore(SemaphoreType *sema); void ReleaseSemaphore(SemaphoreType *sema, s32 count); s32 GetCurrentSemaphoreCount(const SemaphoreType *sema); void InitializeMultiWaitHolder(MultiWaitHolderType *multi_wait_holder, SemaphoreType *sema); }
1,321
C++
.h
30
40.8
96
0.776911
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,053
os_memory_attribute.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_memory_attribute.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_memory_common.hpp> namespace ams::os { enum MemoryAttribute { MemoryAttribute_Normal, MemoryAttribute_Uncached, }; void SetMemoryAttribute(uintptr_t address, size_t size, MemoryAttribute attr); }
975
C++
.h
26
34.730769
82
0.754497
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,054
os_event_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_event_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { enum EventClearMode { EventClearMode_ManualClear = 0, EventClearMode_AutoClear = 1, }; }
808
C++
.h
23
32.391304
76
0.738186
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,055
os_sdk_thread_local_storage_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_sdk_thread_local_storage_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> #include <stratosphere/os/os_memory_common.hpp> #include <stratosphere/os/os_thread_local_storage_common.hpp> namespace ams::os { Result SdkAllocateTlsSlot(TlsSlot *out, TlsDestructor destructor); }
902
C++
.h
22
39
76
0.770548
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,056
os_timer_event.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_timer_event.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_timer_event_types.hpp> #include <stratosphere/os/os_timer_event_api.hpp> namespace ams::os { class TimerEvent { NON_COPYABLE(TimerEvent); NON_MOVEABLE(TimerEvent); private: TimerEventType m_event; public: explicit TimerEvent(EventClearMode clear_mode) { InitializeTimerEvent(std::addressof(m_event), clear_mode); } ~TimerEvent() { FinalizeTimerEvent(std::addressof(m_event)); } void StartOneShot(TimeSpan first_time) { return StartOneShotTimerEvent(std::addressof(m_event), first_time); } void StartPeriodic(TimeSpan first_time, TimeSpan interval) { return StartPeriodicTimerEvent(std::addressof(m_event), first_time, interval); } void Stop() { return StopTimerEvent(std::addressof(m_event)); } void Wait() { return WaitTimerEvent(std::addressof(m_event)); } bool TryWait() { return TryWaitTimerEvent(std::addressof(m_event)); } void Signal() { return SignalTimerEvent(std::addressof(m_event)); } void Clear() { return ClearTimerEvent(std::addressof(m_event)); } operator TimerEventType &() { return m_event; } operator const TimerEventType &() const { return m_event; } TimerEventType *GetBase() { return std::addressof(m_event); } }; }
2,385
C++
.h
64
27.5
94
0.598873
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,057
os_mutex_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_mutex_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> namespace ams::os { struct ThreadType; struct MutexType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; u8 state; bool is_recursive; s32 lock_level; s32 nest_count; ThreadType *owner_thread; union { s32 _arr[sizeof(impl::InternalCriticalSectionStorage) / sizeof(s32)]; impl::InternalCriticalSectionStorage _storage; impl::InternalCriticalSectionStorageTypeForConstantInitialize _storage_for_constant_initialize; }; }; static_assert(std::is_trivial<MutexType>::value); }
1,382
C++
.h
38
30.947368
107
0.697309
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,058
os_event_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_event_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/impl/os_internal_condition_variable.hpp> namespace ams::os { namespace impl { class MultiWaitObjectList; } struct EventType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> multi_wait_object_list_storage; bool signaled; bool initially_signaled; u8 clear_mode; u8 state; u32 broadcast_counter_low; u32 broadcast_counter_high; impl::InternalCriticalSectionStorage cs_event; impl::InternalConditionVariableStorage cv_signaled; }; static_assert(std::is_trivial<EventType>::value); }
1,524
C++
.h
40
33.025
152
0.71661
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,059
os_condition_variable.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_condition_variable.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_mutex_types.hpp> #include <stratosphere/os/os_condition_variable_common.hpp> #include <stratosphere/os/os_condition_variable_types.hpp> #include <stratosphere/os/os_condition_variable_api.hpp> namespace ams::os { class ConditionVariable { NON_COPYABLE(ConditionVariable); NON_MOVEABLE(ConditionVariable); private: ConditionVariableType m_cv; public: constexpr ConditionVariable() : m_cv{::ams::os::ConditionVariableType::State_Initialized, {AMS_OS_INTERNAL_CONDITION_VARIABLE_IMPL_CONSTANT_INITIALIZER}} { /* ... */ } ~ConditionVariable() { FinalizeConditionVariable(std::addressof(m_cv)); } void Signal() { SignalConditionVariable(std::addressof(m_cv)); } void Broadcast() { BroadcastConditionVariable(std::addressof(m_cv)); } void Wait(ams::os::MutexType &mutex) { WaitConditionVariable(std::addressof(m_cv), std::addressof(mutex)); } ConditionVariableStatus TimedWait(ams::os::MutexType &mutex, TimeSpan timeout) { return TimedWaitConditionVariable(std::addressof(m_cv), std::addressof(mutex), timeout); } operator ConditionVariableType &() { return m_cv; } operator const ConditionVariableType &() const { return m_cv; } ConditionVariableType *GetBase() { return std::addressof(m_cv); } }; }
2,264
C++
.h
53
34.509434
179
0.654388
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,060
os_rw_busy_mutex_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_rw_busy_mutex_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { struct ReaderWriterBusyMutexType; void InitalizeReaderWriterLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex); void AcquireReadLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex); void ReleaseReadLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex); void AcquireWriteLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex); void ReleaseWriteLockBusyMutex(ReaderWriterBusyMutexType *rw_mutex); }
1,110
C++
.h
25
41.6
81
0.79128
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,061
os_native_handle.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_native_handle.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_native_handle_types.hpp> #include <stratosphere/os/os_native_handle_api.hpp>
754
C++
.h
18
40.111111
76
0.764946
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,062
os_transfer_memory_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_transfer_memory_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_critical_section.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { struct TransferMemoryType { enum State { State_NotInitialized = 0, State_Created = 1, State_Mapped = 2, State_Detached = 3, }; u8 state; bool handle_managed; bool allocated; void *address; size_t size; NativeHandle handle; mutable impl::InternalCriticalSectionStorage cs_transfer_memory; }; static_assert(std::is_trivial<TransferMemoryType>::value); }
1,316
C++
.h
37
30.432432
76
0.685535
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,063
os_system_event_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_system_event_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_event_types.hpp> #include <stratosphere/os/os_native_handle.hpp> namespace ams::os { namespace impl { struct InterProcessEventType { enum State { State_NotInitialized = 0, State_Initialized = 1, }; util::TypedStorage<impl::MultiWaitObjectList, sizeof(util::IntrusiveListNode), alignof(util::IntrusiveListNode)> multi_wait_object_list_storage; bool auto_clear; u8 state; bool is_readable_handle_managed; bool is_writable_handle_managed; NativeHandle readable_handle; NativeHandle writable_handle; }; static_assert(std::is_trivial<InterProcessEventType>::value); } struct SystemEventType { enum State { State_NotInitialized = 0, State_InitializedAsEvent = 1, State_InitializedAsInterProcessEvent = 2, }; union { EventType event; impl::InterProcessEventType inter_process_event; }; u8 state; }; static_assert(std::is_trivial<SystemEventType>::value); }
1,878
C++
.h
50
30.38
156
0.653825
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,064
os_random.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_random.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_common_types.hpp> namespace ams::os { void GenerateRandomBytes(void *dst, size_t size); /* Convenience API. */ u32 GenerateRandomU32(u32 max = std::numeric_limits<u32>::max()); u64 GenerateRandomU64(u64 max = std::numeric_limits<u64>::max()); }
943
C++
.h
23
38.478261
76
0.742077
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,065
os_debug_api.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_debug_api.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/os_debug_types.hpp> #include <stratosphere/os/os_tick.hpp> namespace ams::os { void GetCurrentStackInfo(uintptr_t *out_stack, size_t *out_size); void QueryMemoryInfo(MemoryInfo *out); Tick GetIdleTickCount(); int GetFreeThreadCount(); }
957
C++
.h
25
35.8
76
0.756757
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,066
os_virtual_address_memory_common.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_virtual_address_memory_common.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> namespace ams::os { constexpr inline size_t AddressRegionAlignment = 64_KB; }
756
C++
.h
20
35.75
76
0.758527
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,067
os_light_event_types.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_light_event_types.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <vapours.hpp> #include <stratosphere/os/impl/os_internal_light_event.hpp> namespace ams::os { struct LightEventType { bool is_auto_clear; bool is_initialized; impl::InternalLightEventStorage storage; }; static_assert(std::is_trivial<LightEventType>::value); }
958
C++
.h
26
33.730769
76
0.743258
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
8,068
os_light_message_queue.hpp
Atmosphere-NX_Atmosphere/libraries/libstratosphere/include/stratosphere/os/os_light_message_queue.hpp
/* * Copyright (c) Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <stratosphere/os/os_light_message_queue_types.hpp> #include <stratosphere/os/os_light_message_queue_api.hpp> namespace ams::os { class LightMessageQueue { NON_COPYABLE(LightMessageQueue); NON_MOVEABLE(LightMessageQueue); private: LightMessageQueueType m_mq; public: explicit LightMessageQueue(uintptr_t *buf, size_t count) { InitializeLightMessageQueue(std::addressof(m_mq), buf, count); } ~LightMessageQueue() { FinalizeLightMessageQueue(std::addressof(m_mq)); } /* Sending (FIFO functionality) */ void Send(uintptr_t data) { return SendLightMessageQueue(std::addressof(m_mq), data); } bool TrySend(uintptr_t data) { return TrySendLightMessageQueue(std::addressof(m_mq), data); } bool TimedSend(uintptr_t data, TimeSpan timeout) { return TimedSendLightMessageQueue(std::addressof(m_mq), data, timeout); } /* Jamming (LIFO functionality) */ void Jam(uintptr_t data) { return JamLightMessageQueue(std::addressof(m_mq), data); } bool TryJam(uintptr_t data) { return TryJamLightMessageQueue(std::addressof(m_mq), data); } bool TimedJam(uintptr_t data, TimeSpan timeout) { return TimedJamLightMessageQueue(std::addressof(m_mq), data, timeout); } /* Receive functionality */ void Receive(uintptr_t *out) { return ReceiveLightMessageQueue(out, std::addressof(m_mq)); } bool TryReceive(uintptr_t *out) { return TryReceiveLightMessageQueue(out, std::addressof(m_mq)); } bool TimedReceive(uintptr_t *out, TimeSpan timeout) { return TimedReceiveLightMessageQueue(out, std::addressof(m_mq), timeout); } /* Peek functionality */ void Peek(uintptr_t *out) const { return PeekLightMessageQueue(out, std::addressof(m_mq)); } bool TryPeek(uintptr_t *out) const { return TryPeekLightMessageQueue(out, std::addressof(m_mq)); } bool TimedPeek(uintptr_t *out, TimeSpan timeout) const { return TimedPeekLightMessageQueue(out, std::addressof(m_mq), timeout); } operator LightMessageQueueType &() { return m_mq; } operator const LightMessageQueueType &() const { return m_mq; } LightMessageQueueType *GetBase() { return std::addressof(m_mq); } }; }
3,455
C++
.h
80
32.3625
89
0.606259
Atmosphere-NX/Atmosphere
14,324
1,207
54
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false