summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/sockets/bsd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/sockets/bsd.cpp')
-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) {