From 6ff0fd44f50befacc822abeea7c81b411c07aa97 Mon Sep 17 00:00:00 2001 From: Frederic Meyer Date: Wed, 17 Jan 2018 22:03:20 +0100 Subject: [PATCH] bsd: attempt to get past socket() --- src/core/hle/service/bsd/bsd_u.cpp | 20 +++++++++++++++++++- src/core/hle/service/bsd/bsd_u.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/bsd/bsd_u.cpp b/src/core/hle/service/bsd/bsd_u.cpp index e9fde6e861..8132a57815 100644 --- a/src/core/hle/service/bsd/bsd_u.cpp +++ b/src/core/hle/service/bsd/bsd_u.cpp @@ -19,9 +19,27 @@ void BSD_U::RegisterClient(Kernel::HLERequestContext& ctx) { rb.Push(0); } +void BSD_U::Socket(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + u32 domain = rp.Pop(); + u32 type = rp.Pop(); + u32 protocol = rp.Pop(); + + LOG_WARNING(Service, "(STUBBED) called domain=%d type=%d protocol=%d", domain, type, protocol); + + u32 fd = next_fd++; + + IPC::RequestBuilder rb{ctx, 3}; + + rb.Push(fd); + rb.Push(0); // bsd errno (no error) +} + BSD_U::BSD_U() : ServiceFramework("bsd:u") { static const FunctionInfo functions[] = { - {0, &BSD_U::RegisterClient, "RegisterClient"} + {0, &BSD_U::RegisterClient, "RegisterClient"}, + {2, &BSD_U::Socket, "Socket"} }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/bsd/bsd_u.h b/src/core/hle/service/bsd/bsd_u.h index e7d046c6cb..d99b1f9c4c 100644 --- a/src/core/hle/service/bsd/bsd_u.h +++ b/src/core/hle/service/bsd/bsd_u.h @@ -17,6 +17,10 @@ public: private: void RegisterClient(Kernel::HLERequestContext& ctx); + void Socket(Kernel::HLERequestContext& ctx); + + /// Id to use for the next open file descriptor. + u32 next_fd = 1; }; } // namespace BSD