mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 23:59:49 -04:00
ams: support building unit test programs on windows/linux/macos
This commit is contained in:
parent
9a38be201a
commit
64a97576d0
756 changed files with 33359 additions and 9372 deletions
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_session.hpp"
|
||||
|
||||
namespace ams::htcs::client {
|
||||
|
||||
void InitializeSessionManager(tma::IHtcsManager **out_manager, tma::IHtcsManager **out_monitor, u32 num_sessions) {
|
||||
AMS_UNUSED(out_manager, out_monitor, num_sessions);
|
||||
AMS_ABORT("TODO");
|
||||
}
|
||||
|
||||
void FinalizeSessionManager() {
|
||||
AMS_ABORT("TODO");
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ namespace ams::htcs {
|
|||
constinit void *g_buffer = nullptr;
|
||||
constinit size_t g_buffer_size = 0;
|
||||
|
||||
constinit os::TlsSlot g_tls_slot;
|
||||
constinit os::TlsSlot g_tls_slot = {};
|
||||
|
||||
constinit tma::IHtcsManager *g_manager = nullptr;
|
||||
constinit tma::IHtcsManager *g_monitor = nullptr;
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsManagerImpl::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) {
|
||||
/* Start the send. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
os::NativeHandle handle;
|
||||
R_TRY(m_service.SendSmallStart(std::addressof(task_id), std::addressof(handle), desc, size, flags));
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsManagerImpl::StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span<const int> read_handles, Span<const int> write_handles, Span<const int> exception_handles, s64 tv_sec, s64 tv_usec) {
|
||||
/* Start the select. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
os::NativeHandle handle = os::InvalidNativeHandle;
|
||||
const Result result = m_service.SelectStart(std::addressof(task_id), std::addressof(handle), read_handles, write_handles, exception_handles, tv_sec, tv_usec);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace ams::htcs::impl {
|
|||
m_driver->SetDisconnectionEmulationEnabled(enable_disconnection_emulation);
|
||||
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::SocketTask>(std::addressof(task_id)));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -48,7 +48,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::DestroySocket(s32 desc) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::CloseTask>(std::addressof(task_id), desc));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -71,7 +71,7 @@ namespace ams::htcs::impl {
|
|||
R_UNLESS(IsValidName(address.port_name), htcs::ResultInvalidArgument());
|
||||
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ConnectTask>(std::addressof(task_id), desc, address.peer_name, address.port_name));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -93,7 +93,7 @@ namespace ams::htcs::impl {
|
|||
R_UNLESS(IsValidName(address.port_name), htcs::ResultInvalidArgument());
|
||||
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::BindTask>(std::addressof(task_id), desc, address.peer_name, address.port_name));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -110,7 +110,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::Listen(s32 *out_err, s32 desc, s32 backlog_count) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ListenTask>(std::addressof(task_id), desc, backlog_count));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -127,7 +127,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::Receive(s32 *out_err, s64 *out_size, char *buffer, s64 size, s32 desc, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ReceiveTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -141,7 +141,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::Send(s32 *out_err, s64 *out_size, const char *buffer, s64 size, s32 desc, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::SendTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Send the data. */
|
||||
|
@ -162,7 +162,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::Shutdown(s32 *out_err, s32 desc, s32 how) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ShutdownTask>(std::addressof(task_id), desc, static_cast<htcs::ShutdownType>(how)));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -179,7 +179,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::Fcntl(s32 *out_err, s32 *out_res, s32 desc, s32 command, s32 value) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::FcntlTask>(std::addressof(task_id), desc, command, value));
|
||||
|
||||
/* Wait for the task to complete. */
|
||||
|
@ -198,7 +198,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::AcceptTask>(std::addressof(task_id), desc));
|
||||
|
||||
/* Detach the task. */
|
||||
|
@ -224,7 +224,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::ReceiveSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ReceiveSmallTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Detach the task. */
|
||||
|
@ -251,7 +251,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::SendSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::SendSmallTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Detach the task. */
|
||||
|
@ -287,7 +287,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::SendTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Detach the task. */
|
||||
|
@ -333,7 +333,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::ReceiveStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::ReceiveTask>(std::addressof(task_id), desc, size, static_cast<htcs::MessageFlag>(flags)));
|
||||
|
||||
/* Detach the task. */
|
||||
|
@ -348,8 +348,8 @@ namespace ams::htcs::impl {
|
|||
R_TRY(m_rpc_client->VerifyTaskIdWithHandle<rpc::ReceiveTask>(task_id, desc));
|
||||
|
||||
/* Get the result. */
|
||||
htcs::SocketError err;
|
||||
s64 recv_size;
|
||||
htcs::SocketError err{};
|
||||
s64 recv_size{};
|
||||
const Result result = m_rpc_client->GetResult<rpc::ReceiveTask>(task_id, std::addressof(err), std::addressof(recv_size));
|
||||
if (R_FAILED(result) || err != HTCS_ENONE) {
|
||||
/* Finish the task. */
|
||||
|
@ -385,7 +385,7 @@ namespace ams::htcs::impl {
|
|||
|
||||
Result HtcsService::SelectStart(u32 *out_task_id, os::NativeHandle *out_handle, Span<const int> read_handles, Span<const int> write_handles, Span<const int> exception_handles, s64 tv_sec, s64 tv_usec) {
|
||||
/* Begin the task. */
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
R_TRY(m_rpc_client->Begin<rpc::SelectTask>(std::addressof(task_id), read_handles, write_handles, exception_handles, tv_sec, tv_usec));
|
||||
|
||||
/* Detach the task. */
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace ams::htcs::impl::rpc {
|
|||
R_UNLESS(this->IsValid(), htcs::ResultInvalidTask());
|
||||
|
||||
/* Sanity check the spans. */
|
||||
AMS_ASSERT(0 <= read_handles.size() && read_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
AMS_ASSERT(0 <= write_handles.size() && write_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
AMS_ASSERT(0 <= exception_handles.size() && exception_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
AMS_ASSERT(read_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
AMS_ASSERT(write_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
AMS_ASSERT(exception_handles.size() < static_cast<size_t>(SocketCountMax));
|
||||
|
||||
/* Set our arguments. */
|
||||
m_read_handle_count = static_cast<s32>(read_handles.size());
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace ams::htcs::impl::rpc {
|
|||
HtcsPacketCategory category;
|
||||
HtcsPacketType type;
|
||||
s64 body_size;
|
||||
u32 task_id;
|
||||
u32 task_id{};
|
||||
s64 params[5];
|
||||
char data[];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue