summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/sockets/bsd.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2023-07-02 00:02:25 +0200
committercomex <comexk@gmail.com>2023-07-02 02:27:35 +0200
commit0e191c271125321589dfdbb09731413550710c9a (patch)
treee0d9e826197d2fd66cc9b7fd8d11cc8c7fd6e3ac /src/core/hle/service/sockets/bsd.cpp
parentMerge remote-tracking branch 'origin/master' into ssl (diff)
downloadyuzu-0e191c271125321589dfdbb09731413550710c9a.tar
yuzu-0e191c271125321589dfdbb09731413550710c9a.tar.gz
yuzu-0e191c271125321589dfdbb09731413550710c9a.tar.bz2
yuzu-0e191c271125321589dfdbb09731413550710c9a.tar.lz
yuzu-0e191c271125321589dfdbb09731413550710c9a.tar.xz
yuzu-0e191c271125321589dfdbb09731413550710c9a.tar.zst
yuzu-0e191c271125321589dfdbb09731413550710c9a.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/sockets/bsd.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp
index 6034cc0b5..e63b0a357 100644
--- a/src/core/hle/service/sockets/bsd.cpp
+++ b/src/core/hle/service/sockets/bsd.cpp
@@ -443,15 +443,28 @@ void BSD::Close(HLERequestContext& ctx) {
}
void BSD::DuplicateSocket(HLERequestContext& ctx) {
+ struct InputParameters {
+ s32 fd;
+ u64 reserved;
+ };
+ static_assert(sizeof(InputParameters) == 0x10);
+
+ struct OutputParameters {
+ s32 ret;
+ Errno bsd_errno;
+ };
+ static_assert(sizeof(OutputParameters) == 0x8);
+
IPC::RequestParser rp{ctx};
- const s32 fd = rp.Pop<s32>();
- [[maybe_unused]] const u64 unused = rp.Pop<u64>();
+ auto input = rp.PopRaw<InputParameters>();
- Expected<s32, Errno> res = DuplicateSocketImpl(fd);
+ Expected<s32, Errno> res = DuplicateSocketImpl(input.fd);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
- rb.Push(res.value_or(0)); // ret
- rb.Push(res ? 0 : static_cast<s32>(res.error())); // bsd errno
+ rb.PushRaw(OutputParameters{
+ .ret = res.value_or(0),
+ .bsd_errno = res ? Errno::SUCCESS : res.error(),
+ });
}
void BSD::EventFd(HLERequestContext& ctx) {