{"action":"created","comment":{"url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/comments/226118670","pull_request_review_id":165866015,"id":226118670,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjExODY3MA==","diff_hunk":"@@ -54,447 +274,920 @@ public long Initialize(ServiceCtx Context)\n             } BsdBufferConfig;\n             */\n \n+            // bsd_error\n             Context.ResponseData.Write(0);\n \n-            //Todo: Stub\n+            Logger.PrintStub(LogClass.ServiceBsd, \"Stubbed.\");\n \n             return 0;\n         }\n \n-        //(u64, pid)\n+        // StartMonitoring(u64, pid)\n         public long StartMonitoring(ServiceCtx Context)\n         {\n-            //Todo: Stub\n+            ulong Unknown0 = Context.RequestData.ReadUInt64();\n+\n+            Logger.PrintStub(LogClass.ServiceBsd, $\"Stubbed. Unknown0: {Unknown0}\");\n \n             return 0;\n         }\n \n-        //(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)\n+        // Socket(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)\n         public long Socket(ServiceCtx Context)\n         {\n-            BsdSocket NewBsdSocket = new BsdSocket\n-            {\n-                Family   = Context.RequestData.ReadInt32(),\n-                Type     = Context.RequestData.ReadInt32(),\n-                Protocol = Context.RequestData.ReadInt32()\n-            };\n+            return SocketInternal(Context, false);\n+        }\n \n-            Sockets.Add(NewBsdSocket);\n+        // SocketExempt(u32 domain, u32 type, u32 protocol) -> (i32 ret, u32 bsd_errno)\n+        public long SocketExempt(ServiceCtx Context)\n+        {\n+            return SocketInternal(Context, true);\n+        }\n \n-            NewBsdSocket.Handle = new Socket((AddressFamily)NewBsdSocket.Family,\n-                                                (SocketType)NewBsdSocket.Type,\n-                                              (ProtocolType)NewBsdSocket.Protocol);\n+        // Open(u32 flags, array<unknown, 0x21> path) -> (i32 ret, u32 bsd_errno)\n+        public long Open(ServiceCtx Context)\n+        {\n+            (long BufferPosition, long BufferSize) = Context.Request.GetBufferType0x21();\n \n-            Context.ResponseData.Write(Sockets.Count - 1);\n-            Context.ResponseData.Write(0);\n+            int Flags = Context.RequestData.ReadInt32();\n+\n+            byte[] RawPath = Context.Memory.ReadBytes(BufferPosition, BufferSize);\n+            string Path    = Encoding.ASCII.GetString(RawPath);\n+\n+            WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+\n+            Logger.PrintStub(LogClass.ServiceBsd, $\"Stubbed. Path: {Path} - \" +\n+                                                  $\"Flags: {Flags}\");\n \n             return 0;\n         }\n \n-        //(u32, u32, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno, buffer<unknown, 0x22, 0>)\n+        // Select(u32 nfds, nn::socket::timeout timeout, buffer<nn::socket::fd_set, 0x21, 0> readfds_in, buffer<nn::socket::fd_set, 0x21, 0> writefds_in, buffer<nn::socket::fd_set, 0x21, 0> errorfds_in) -> (i32 ret, u32 bsd_errno, buffer<nn::socket::fd_set, 0x22, 0> readfds_out, buffer<nn::socket::fd_set, 0x22, 0> writefds_out, buffer<nn::socket::fd_set, 0x22, 0> errorfds_out)\n+        public long Select(ServiceCtx Context)\n+        {\n+            WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+\n+            Logger.PrintStub(LogClass.ServiceBsd, $\"Stubbed.\");\n+\n+            return 0;\n+        }\n+\n+        // Poll(u32 nfds, u32 timeout, buffer<unknown, 0x21, 0> fds) -> (i32 ret, u32 bsd_errno, buffer<unknown, 0x22, 0>)\n         public long Poll(ServiceCtx Context)\n         {\n-            int PollCount = Context.RequestData.ReadInt32();\n-            int TimeOut   = Context.RequestData.ReadInt32();\n+            int FdsCount = Context.RequestData.ReadInt32();\n+            int Timeout  = Context.RequestData.ReadInt32();\n \n-            //https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/poll.h\n-            //https://msdn.microsoft.com/fr-fr/library/system.net.sockets.socket.poll(v=vs.110).aspx\n-            //https://github.com/switchbrew/libnx/blob/e0457c4534b3c37426d83e1a620f82cb28c3b528/nx/source/services/bsd.c#L343\n-            //https://github.com/TuxSH/ftpd/blob/switch_pr/source/ftp.c#L1634\n-            //https://linux.die.net/man/2/poll\n+            (long BufferPosition, long BufferSize) = Context.Request.GetBufferType0x21();\n \n-            byte[] SentBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,\n-                                                         Context.Request.SendBuff[0].Size);\n \n-            int SocketId        = Get32(SentBuffer, 0);\n-            int RequestedEvents = Get16(SentBuffer, 4);\n-            int ReturnedEvents  = Get16(SentBuffer, 6);\n+            if (Timeout < -1 || FdsCount < 0 || (FdsCount * 8) > BufferSize)\n+            {\n+                return WriteBsdResult(Context, -1, LinuxError.EINVAL);\n+            }\n \n-            //Todo: Stub - Need to implemented the Type-22 buffer.\n+            PollEvent[] Events = new PollEvent[FdsCount];\n \n-            Context.ResponseData.Write(1);\n-            Context.ResponseData.Write(0);\n+            for (int i = 0; i < FdsCount; i++)\n+            {\n+                int SocketFd = Context.Memory.ReadInt32(BufferPosition + i * 8);\n \n-            return 0;\n-        }\n+                BsdSocket Socket = RetrieveSocket(SocketFd);\n \n-        //(u32 socket, u32 flags) -> (i32 ret, u32 bsd_errno, buffer<i8, 0x22, 0> message)\n-        public long Recv(ServiceCtx Context)\n-        {\n-            int SocketId    = Context.RequestData.ReadInt32();\n-            int SocketFlags = Context.RequestData.ReadInt32();\n+                if (Socket == null)\n+                {\n+                    return WriteBsdResult(Context, -1, LinuxError.EBADF);\n+                }\n \n-            (long ReceivePosition, long ReceiveLength) = Context.Request.GetBufferType0x22();\n+                PollEvent.EventTypeMask InputEvents  = (PollEvent.EventTypeMask)Context.Memory.ReadInt16(BufferPosition + i * 8 + 4);\n+                PollEvent.EventTypeMask OutputEvents = (PollEvent.EventTypeMask)Context.Memory.ReadInt16(BufferPosition + i * 8 + 6);\n \n-            byte[] ReceivedBuffer = new byte[ReceiveLength];\n+                Events[i] = new PollEvent(SocketFd, Socket, InputEvents, OutputEvents);\n+            }\n \n-            try\n+            List<Socket> ReadEvents  = new List<Socket>();\n+            List<Socket> WriteEvents = new List<Socket>();\n+            List<Socket> ErrorEvents = new List<Socket>();\n+\n+            foreach (PollEvent Event in Events)\n             {\n-                int BytesRead = Sockets[SocketId].Handle.Receive(ReceivedBuffer);\n+                bool IsValidEvent = false;\n+\n+                if ((Event.InputEvents & PollEvent.EventTypeMask.Input) != 0)\n+                {\n+                    ReadEvents.Add(Event.Socket.Handle);\n+                    ErrorEvents.Add(Event.Socket.Handle);\n+\n+                    IsValidEvent = true;\n+                }\n+\n+                if ((Event.InputEvents & PollEvent.EventTypeMask.UrgentInput) != 0)\n+                {\n+                    ReadEvents.Add(Event.Socket.Handle);\n+                    ErrorEvents.Add(Event.Socket.Handle);\n+\n+                    IsValidEvent = true;\n+                }\n+\n+                if ((Event.InputEvents & PollEvent.EventTypeMask.Output) != 0)\n+                {\n+                    WriteEvents.Add(Event.Socket.Handle);\n+                    ErrorEvents.Add(Event.Socket.Handle);\n+\n+                    IsValidEvent = true;\n+                }\n \n-                Context.Memory.WriteBytes(ReceivePosition, ReceivedBuffer);\n+                if ((Event.InputEvents & PollEvent.EventTypeMask.Error) != 0)\n+                {\n+                    ErrorEvents.Add(Event.Socket.Handle);\n+                    IsValidEvent = true;\n+                }\n \n-                Context.ResponseData.Write(BytesRead);\n-                Context.ResponseData.Write(0);\n+                if (!IsValidEvent)\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Poll input event type: {Event.InputEvents}\");\n+                    return WriteBsdResult(Context, -1, LinuxError.EINVAL);\n+                }\n+            }\n+\n+            try\n+            {\n+                System.Net.Sockets.Socket.Select(ReadEvents, WriteEvents, ErrorEvents, Timeout);\n             }\n-            catch (SocketException Ex)\n+            catch (SocketException Exception)\n             {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                return WriteWinSock2Error(Context, (WSAError)Exception.ErrorCode);\n             }\n \n+            for (int i = 0; i < FdsCount; i++)\n+            {\n+                PollEvent Event = Events[i];\n+                Context.Memory.WriteInt32(BufferPosition + i * 8, Event.SocketFd);\n+                Context.Memory.WriteInt16(BufferPosition + i * 8 + 4, (short)Event.InputEvents);\n+\n+                PollEvent.EventTypeMask OutputEvents = 0;\n+\n+                Socket Socket = Event.Socket.Handle;\n+\n+                if (ErrorEvents.Contains(Socket))\n+                {\n+                    OutputEvents |= PollEvent.EventTypeMask.Error;\n+\n+                    if (!Socket.Connected || !Socket.IsBound)\n+                    {\n+                        OutputEvents |= PollEvent.EventTypeMask.Disconnected;\n+                    }\n+                }\n+\n+                if (ReadEvents.Contains(Socket))\n+                {\n+                    if ((Event.InputEvents & PollEvent.EventTypeMask.Input) != 0)\n+                    {\n+                        OutputEvents |= PollEvent.EventTypeMask.Input;\n+                    }\n+                }\n+\n+                if (WriteEvents.Contains(Socket))\n+                {\n+                    OutputEvents |= PollEvent.EventTypeMask.Output;\n+                }\n+\n+                Context.Memory.WriteInt16(BufferPosition + i * 8 + 6, (short)OutputEvents);\n+            }\n+\n+            return WriteBsdResult(Context, ReadEvents.Count + WriteEvents.Count + ErrorEvents.Count, LinuxError.SUCCESS);\n+        }\n+\n+        // Sysctl(buffer<unknown, 0x21, 0>, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno, u32, buffer<unknown, 0x22, 0>)\n+        public long Sysctl(ServiceCtx Context)\n+        {\n+            WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+\n+            Logger.PrintStub(LogClass.ServiceBsd, $\"Stubbed.\");\n+\n             return 0;\n         }\n \n-        //(u32 socket, u32 flags, buffer<i8, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n-        public long Send(ServiceCtx Context)\n+        // Recv(u32 socket, u32 flags) -> (i32 ret, u32 bsd_errno, array<i8, 0x22> message)\n+        public long Recv(ServiceCtx Context)\n         {\n-            int SocketId    = Context.RequestData.ReadInt32();\n-            int SocketFlags = Context.RequestData.ReadInt32();\n+            int         SocketFd    = Context.RequestData.ReadInt32();\n+            SocketFlags SocketFlags = (SocketFlags)Context.RequestData.ReadInt32();\n \n-            (long SentPosition, long SentSize) = Context.Request.GetBufferType0x21();\n+            (long ReceivePosition, long ReceiveLength) = Context.Request.GetBufferType0x22();\n \n-            byte[] SentBuffer = Context.Memory.ReadBytes(SentPosition, SentSize);\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+            int        Result = -1;\n \n-            try\n+            if (Socket != null)\n             {\n-                int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);\n+                if (SocketFlags != SocketFlags.None && (SocketFlags & SocketFlags.OutOfBand) == 0\n+                    && (SocketFlags & SocketFlags.Peek) == 0)\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Recv flags: {SocketFlags}\");\n+                    return WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+                }\n \n-                Context.ResponseData.Write(BytesSent);\n-                Context.ResponseData.Write(0);\n-            }\n-            catch (SocketException Ex)\n-            {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                byte[] ReceivedBuffer = new byte[ReceiveLength];\n+\n+                try\n+                {\n+                    Result = Socket.Handle.Receive(ReceivedBuffer, SocketFlags);\n+                    Errno  = SetResultErrno(Socket.Handle, Result);\n+\n+                    Context.Memory.WriteBytes(ReceivePosition, ReceivedBuffer);\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n             }\n \n-            return 0;\n+            return WriteBsdResult(Context, Result, Errno);\n         }\n \n-        //(u32 socket, u32 flags, buffer<i8, 0x21, 0>, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n-        public long SendTo(ServiceCtx Context)\n+        // RecvFrom(u32 sock, u32 flags) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<i8, 0x22, 0> message, buffer<nn::socket::sockaddr_in, 0x22, 0x10>)\n+        public long RecvFrom(ServiceCtx Context)\n         {\n-            int SocketId    = Context.RequestData.ReadInt32();\n-            int SocketFlags = Context.RequestData.ReadInt32();\n-\n-            byte[] SentBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,\n-                                                         Context.Request.SendBuff[0].Size);\n+            int         SocketFd    = Context.RequestData.ReadInt32();\n+            SocketFlags SocketFlags = (SocketFlags)Context.RequestData.ReadInt32();\n \n-            (long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21(Index: 1);\n+            (long ReceivePosition,     long ReceiveLength)   = Context.Request.GetBufferType0x22();\n+            (long SockAddrInPosition,  long SockAddrInSize)  = Context.Request.GetBufferType0x21();\n+            (long SockAddrOutPosition, long SockAddrOutSize) = Context.Request.GetBufferType0x22(1);\n \n-            byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+            int        Result = -1;\n \n-            if (!Sockets[SocketId].Handle.Connected)\n+            if (Socket != null)\n             {\n+                if (SocketFlags != SocketFlags.None && (SocketFlags & SocketFlags.OutOfBand) == 0\n+                    && (SocketFlags & SocketFlags.Peek) == 0)\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Recv flags: {SocketFlags}\");\n+\n+                    return WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+                }\n+\n+                byte[]   ReceivedBuffer = new byte[ReceiveLength];\n+                EndPoint EndPoint       = ParseSockAddr(Context, SockAddrInPosition, SockAddrInSize);\n+\n                 try\n                 {\n-                    ParseAddrBuffer(SocketId, AddressBuffer);\n+                    Result = Socket.Handle.ReceiveFrom(ReceivedBuffer, ReceivedBuffer.Length, SocketFlags, ref EndPoint);\n+                    Errno  = SetResultErrno(Socket.Handle, Result);\n \n-                    Sockets[SocketId].Handle.Connect(Sockets[SocketId].RemoteEP);\n+                    Context.Memory.WriteBytes(ReceivePosition, ReceivedBuffer);\n+                    WriteSockAddr(Context, SockAddrOutPosition, (IPEndPoint)EndPoint);\n                 }\n-                catch (SocketException Ex)\n+                catch (SocketException Exception)\n                 {\n-                    Context.ResponseData.Write(-1);\n-                    Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n                 }\n             }\n \n-            try\n-            {\n-                int BytesSent = Sockets[SocketId].Handle.Send(SentBuffer);\n+            return WriteBsdResult(Context, Result, Errno);\n+        }\n \n-                Context.ResponseData.Write(BytesSent);\n-                Context.ResponseData.Write(0);\n-            }\n-            catch (SocketException Ex)\n+        // Send(u32 socket, u32 flags, buffer<i8, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n+        public long Send(ServiceCtx Context)\n+        {\n+            int         SocketFd    = Context.RequestData.ReadInt32();\n+            SocketFlags SocketFlags = (SocketFlags)Context.RequestData.ReadInt32();\n+\n+            (long SendPosition, long SendSize) = Context.Request.GetBufferType0x21();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+            int        Result = -1;\n+\n+            if (Socket != null)\n             {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                if (SocketFlags != SocketFlags.None && SocketFlags != SocketFlags.OutOfBand\n+                    && SocketFlags != SocketFlags.Peek && SocketFlags != SocketFlags.DontRoute)\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Send flags: {SocketFlags}\");\n+\n+                    return WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+                }\n+\n+                byte[] SendBuffer = Context.Memory.ReadBytes(SendPosition, SendSize);\n+\n+                try\n+                {\n+                    Result = Socket.Handle.Send(SendBuffer, SocketFlags);\n+                    Errno  = SetResultErrno(Socket.Handle, Result);\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n+\n             }\n \n-            return 0;\n+            return WriteBsdResult(Context, Result, Errno);\n         }\n \n-        //(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<sockaddr, 0x22, 0> addr)\n-        public long Accept(ServiceCtx Context)\n+        // SendTo(u32 socket, u32 flags, buffer<i8, 0x21, 0>, buffer<nn::socket::sockaddr_in, 0x21, 0x10>) -> (i32 ret, u32 bsd_errno)\n+        public long SendTo(ServiceCtx Context)\n         {\n-            int SocketId = Context.RequestData.ReadInt32();\n+            int         SocketFd    = Context.RequestData.ReadInt32();\n+            SocketFlags SocketFlags = (SocketFlags)Context.RequestData.ReadInt32();\n \n-            (long AddrBufferPosition, long AddrBuffSize) = Context.Request.GetBufferType0x22();\n+            (long SendPosition,   long SendSize)   = Context.Request.GetBufferType0x21();\n+            (long BufferPosition, long BufferSize) = Context.Request.GetBufferType0x21(1);\n \n-            Socket HandleAccept = null;\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+            int        Result = -1;\n \n-            Task TimeOut = Task.Factory.StartNew(() =>\n+            if (Socket != null)\n             {\n+                if (SocketFlags != SocketFlags.None && SocketFlags != SocketFlags.OutOfBand\n+                    && SocketFlags != SocketFlags.Peek && SocketFlags != SocketFlags.DontRoute)\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Send flags: {SocketFlags}\");\n+\n+                    return WriteBsdResult(Context, -1, LinuxError.EOPNOTSUPP);\n+                }\n+\n+                byte[]   SendBuffer = Context.Memory.ReadBytes(SendPosition, SendSize);\n+                EndPoint EndPoint   = ParseSockAddr(Context, BufferPosition, BufferSize);\n+\n                 try\n                 {\n-                    HandleAccept = Sockets[SocketId].Handle.Accept();\n+                    Result = Socket.Handle.SendTo(SendBuffer, SendBuffer.Length, SocketFlags, EndPoint);\n+                    Errno  = SetResultErrno(Socket.Handle, Result);\n                 }\n-                catch (SocketException Ex)\n+                catch (SocketException Exception)\n                 {\n-                    Context.ResponseData.Write(-1);\n-                    Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n                 }\n-            });\n \n-            TimeOut.Wait(10000);\n+            }\n+\n+            return WriteBsdResult(Context, Result, Errno);\n+        }\n+\n+        // Accept(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<nn::socket::sockaddr_in, 0x22, 0x10> addr)\n+        public long Accept(ServiceCtx Context)\n+        {\n+            int SocketFd = Context.RequestData.ReadInt32();\n+\n+            (long BufferPos, long BufferSize) = Context.Request.GetBufferType0x22();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n \n-            if (HandleAccept != null)\n+            if (Socket != null)\n             {\n-                BsdSocket NewBsdSocket = new BsdSocket\n-                {\n-                    IpAddress = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint).Address,\n-                    RemoteEP  = ((IPEndPoint)Sockets[SocketId].Handle.LocalEndPoint),\n-                    Handle = HandleAccept\n-                };\n+                Errno = LinuxError.SUCCESS;\n \n-                Sockets.Add(NewBsdSocket);\n+                Socket NewSocket = null;\n \n-                using (MemoryStream MS = new MemoryStream())\n+                try\n                 {\n-                    BinaryWriter Writer = new BinaryWriter(MS);\n-\n-                    Writer.Write((byte)0);\n+                    NewSocket = Socket.Handle.Accept();\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n \n-                    Writer.Write((byte)NewBsdSocket.Handle.AddressFamily);\n+                if (NewSocket == null && Errno == LinuxError.SUCCESS)\n+                {\n+                    Errno = LinuxError.EWOULDBLOCK;\n+                }\n+                else if (Errno == LinuxError.SUCCESS)\n+                {\n+                    BsdSocket NewBsdSocket = new BsdSocket\n+                    {\n+                        Family   = (int)NewSocket.AddressFamily,\n+                        Type     = (int)NewSocket.SocketType,\n+                        Protocol = (int)NewSocket.ProtocolType,\n+                        Handle   = NewSocket,\n+                    };\n \n-                    Writer.Write((short)((IPEndPoint)NewBsdSocket.Handle.LocalEndPoint).Port);\n+                    Sockets.Add(NewBsdSocket);\n \n-                    byte[] IpAddress = NewBsdSocket.IpAddress.GetAddressBytes();\n+                    WriteSockAddr(Context, BufferPos, NewBsdSocket, true);\n \n-                    Writer.Write(IpAddress);\n+                    WriteBsdResult(Context, Sockets.Count - 1, Errno);\n \n-                    Context.Memory.WriteBytes(AddrBufferPosition, MS.ToArray());\n+                    Context.ResponseData.Write(0x10);\n \n-                    Context.ResponseData.Write(Sockets.Count - 1);\n-                    Context.ResponseData.Write(0);\n-                    Context.ResponseData.Write(MS.Length);\n+                    return 0;\n                 }\n             }\n-            else\n-            {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write((int)BsdError.Timeout);\n-            }\n \n-            return 0;\n+            return WriteBsdResult(Context, -1, Errno);\n         }\n \n-        //(u32 socket, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n+        // Bind(u32 socket, buffer<nn::socket::sockaddr_in, 0x21, 0x10> addr) -> (i32 ret, u32 bsd_errno)\n         public long Bind(ServiceCtx Context)\n         {\n-            int SocketId = Context.RequestData.ReadInt32();\n+            int SocketFd = Context.RequestData.ReadInt32();\n \n-            (long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21();\n+            (long BufferPos, long BufferSize) = Context.Request.GetBufferType0x21();\n \n-            byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n \n-            try\n+            if (Socket != null)\n             {\n-                ParseAddrBuffer(SocketId, AddressBuffer);\n+                Errno = LinuxError.SUCCESS;\n+\n+                try\n+                {\n+                    IPEndPoint EndPoint = ParseSockAddr(Context, BufferPos, BufferSize);\n \n-                Context.ResponseData.Write(0);\n-                Context.ResponseData.Write(0);\n+                    Socket.Handle.Bind(EndPoint);\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n             }\n-            catch (SocketException Ex)\n+\n+            return WriteBsdResult(Context, 0, Errno);\n+        }\n+\n+        // Connect(u32 socket, buffer<nn::socket::sockaddr_in, 0x21, 0x10>) -> (i32 ret, u32 bsd_errno)\n+        public long Connect(ServiceCtx Context)\n+        {\n+            int SocketFd = Context.RequestData.ReadInt32();\n+\n+            (long BufferPos, long BufferSize) = Context.Request.GetBufferType0x21();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+\n+            if (Socket != null)\n             {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                Errno = LinuxError.SUCCESS;\n+                try\n+                {\n+                    IPEndPoint EndPoint = ParseSockAddr(Context, BufferPos, BufferSize);\n+\n+                    Socket.Handle.Connect(EndPoint);\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n             }\n \n-            return 0;\n+            return WriteBsdResult(Context, 0, Errno);\n         }\n \n-        //(u32 socket, buffer<sockaddr, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n-        public long Connect(ServiceCtx Context)\n+        // GetPeerName(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<nn::socket::sockaddr_in, 0x22, 0x10> addr)\n+        public long GetPeerName(ServiceCtx Context)\n         {\n-            int SocketId = Context.RequestData.ReadInt32();\n+            int SocketFd = Context.RequestData.ReadInt32();\n \n-            (long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21();\n+            (long BufferPos, long BufferSize) = Context.Request.GetBufferType0x22();\n \n-            byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);\n+            LinuxError  Errno  = LinuxError.EBADF;\n+            BsdSocket Socket = RetrieveSocket(SocketFd);\n \n-            try\n+            if (Socket != null)\n             {\n-                ParseAddrBuffer(SocketId, AddressBuffer);\n+                Errno = LinuxError.SUCCESS;\n+\n+                WriteSockAddr(Context, BufferPos, Socket, true);\n+                WriteBsdResult(Context, 0, Errno);\n+                Context.ResponseData.Write(0x10);\n+            }\n+\n+            return WriteBsdResult(Context, 0, Errno);\n+        }\n+\n+        // GetSockName(u32 socket) -> (i32 ret, u32 bsd_errno, u32 addrlen, buffer<nn::socket::sockaddr_in, 0x22, 0x10> addr)\n+        public long GetSockName(ServiceCtx Context)\n+        {\n+            int SocketFd = Context.RequestData.ReadInt32();\n+\n+            (long BufferPos, long BufferSize) = Context.Request.GetBufferType0x22();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n \n-                Sockets[SocketId].Handle.Connect(Sockets[SocketId].RemoteEP);\n+            if (Socket != null)\n+            {\n+                Errno = LinuxError.SUCCESS;\n \n-                Context.ResponseData.Write(0);\n-                Context.ResponseData.Write(0);\n+                WriteSockAddr(Context, BufferPos, Socket, false);\n+                WriteBsdResult(Context, 0, Errno);\n+                Context.ResponseData.Write(0x10);\n             }\n-            catch (SocketException Ex)\n+\n+            return WriteBsdResult(Context, 0, Errno);\n+        }\n+\n+        // GetSockOpt(u32 socket, u32 level, u32 option_name) -> (i32 ret, u32 bsd_errno, u32, buffer<unknown, 0x22, 0>)\n+        public long GetSockOpt(ServiceCtx Context)\n+        {\n+            int SocketFd   = Context.RequestData.ReadInt32();\n+            int Level      = Context.RequestData.ReadInt32();\n+            int OptionName = Context.RequestData.ReadInt32();\n+\n+            (long BufferPosition, long BufferSize) = Context.Request.GetBufferType0x22();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+\n+            if (Socket != null)\n             {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                Errno = LinuxError.ENOPROTOOPT;\n+\n+                if (Level == 0xFFFF)\n+                {\n+                    Errno = HandleGetSocketOption(Context, Socket, (SocketOptionName)OptionName, BufferPosition, BufferSize);\n+                }\n+                else\n+                {\n+                    Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported GetSockOpt Level: {(SocketOptionLevel)Level}\");\n+                }\n             }\n \n-            return 0;\n+            return WriteBsdResult(Context, 0, Errno);\n         }\n \n-        //(u32 socket, u32 backlog) -> (i32 ret, u32 bsd_errno)\n+        // Listen(u32 socket, u32 backlog) -> (i32 ret, u32 bsd_errno)\n         public long Listen(ServiceCtx Context)\n         {\n-            int SocketId = Context.RequestData.ReadInt32();\n-            int BackLog  = Context.RequestData.ReadInt32();\n+            int SocketFd = Context.RequestData.ReadInt32();\n+            int Backlog  = Context.RequestData.ReadInt32();\n \n-            try\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+\n+            if (Socket != null)\n             {\n-                Sockets[SocketId].Handle.Bind(Sockets[SocketId].RemoteEP);\n-                Sockets[SocketId].Handle.Listen(BackLog);\n+                Errno = LinuxError.SUCCESS;\n \n-                Context.ResponseData.Write(0);\n-                Context.ResponseData.Write(0);\n+                try\n+                {\n+                    Socket.Handle.Listen(Backlog);\n+                }\n+                catch (SocketException Exception)\n+                {\n+                    Errno = ConvertError((WSAError)Exception.ErrorCode);\n+                }\n             }\n-            catch (SocketException Ex)\n+\n+            return WriteBsdResult(Context, 0, Errno);\n+        }\n+\n+        // Ioctl(u32 fd, u32 request, u32 bufcount, buffer<unknown, 0x21, 0>, buffer<unknown, 0x21, 0>, buffer<unknown, 0x21, 0>, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno, buffer<unknown, 0x22, 0>, buffer<unknown, 0x22, 0>, buffer<unknown, 0x22, 0>, buffer<unknown, 0x22, 0>)\n+        public long Ioctl(ServiceCtx Context)\n+        {\n+            int      SocketFd    = Context.RequestData.ReadInt32();\n+            BsdIoctl Cmd         = (BsdIoctl)Context.RequestData.ReadInt32();\n+            int      BufferCount = Context.RequestData.ReadInt32();\n+\n+            LinuxError Errno  = LinuxError.EBADF;\n+            BsdSocket  Socket = RetrieveSocket(SocketFd);\n+\n+            if (Socket != null)\n             {\n-                Context.ResponseData.Write(-1);\n-                Context.ResponseData.Write(Ex.ErrorCode - 10000);\n+                switch (Cmd)\n+                {\n+                    case BsdIoctl.AtMark:\n+                        Errno = LinuxError.SUCCESS;\n+\n+                        (long BufferPosition, long BufferSize) = Context.Request.GetBufferType0x22();\n+\n+                        // FIXME: OOB not implemented.\n+                        Context.Memory.WriteInt32(BufferPosition, 0);\n+                        break;\n+\n+                    default:\n+                        Errno = LinuxError.EOPNOTSUPP;\n+\n+                        Logger.PrintWarning(LogClass.ServiceBsd, $\"Unsupported Ioctl Cmd: {Cmd}\");\n+                        break;\n+                }\n             }\n \n-            return 0;\n+            return WriteBsdResult(Context, 0, Errno);\n         }\n \n-        //(u32 socket, u32 level, u32 option_name, buffer<unknown, 0x21, 0>) -> (i32 ret, u32 bsd_errno)\n-        public long SetSockOpt(ServiceCtx Context)\n+        // Fcntl(u32 socket, u32 cmd, u32 arg) -> (i32 ret, u32 bsd_errno)\n+        public long Fcntl(ServiceCtx Context)\n         {\n-            int SocketId = Context.RequestData.ReadInt32();\n+            int SocketFd = Context.RequestData.ReadInt32();\n+            int Cmd      = Context.RequestData.ReadInt32();\n+            int Arg      = Context.RequestData.ReadInt32();\n \n-            SocketOptionLevel SocketLevel     = (SocketOptionLevel)Context.RequestData.ReadInt32();\n-            SocketOptionName SocketOptionName = (SocketOptionName)Context.RequestData.ReadInt32();\n+            int       Result = 0;","path":"Ryujinx.HLE/HOS/Services/Bsd/IClient.cs","position":1069,"original_position":1069,"commit_id":"e0f1164f611c62c67483e06160464570ac37520c","original_commit_id":"e0f1164f611c62c67483e06160464570ac37520c","user":{"login":"gdkchan","id":5624669,"node_id":"MDQ6VXNlcjU2MjQ2Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/5624669?v=4","gravatar_id":"","url":"https://api.github.com/users/gdkchan","html_url":"https://github.com/gdkchan","followers_url":"https://api.github.com/users/gdkchan/followers","following_url":"https://api.github.com/users/gdkchan/following{/other_user}","gists_url":"https://api.github.com/users/gdkchan/gists{/gist_id}","starred_url":"https://api.github.com/users/gdkchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdkchan/subscriptions","organizations_url":"https://api.github.com/users/gdkchan/orgs","repos_url":"https://api.github.com/users/gdkchan/repos","events_url":"https://api.github.com/users/gdkchan/events{/privacy}","received_events_url":"https://api.github.com/users/gdkchan/received_events","type":"User","site_admin":false},"body":"This is misaligned.","created_at":"2018-10-17T22:44:27Z","updated_at":"2018-10-17T22:45:21Z","html_url":"https://github.com/Ryujinx/Ryujinx/pull/460#discussion_r226118670","pull_request_url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/comments/226118670"},"html":{"href":"https://github.com/Ryujinx/Ryujinx/pull/460#discussion_r226118670"},"pull_request":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460"}}},"pull_request":{"url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460","id":223363333,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzMzYzMzMz","html_url":"https://github.com/Ryujinx/Ryujinx/pull/460","diff_url":"https://github.com/Ryujinx/Ryujinx/pull/460.diff","patch_url":"https://github.com/Ryujinx/Ryujinx/pull/460.patch","issue_url":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/460","number":460,"state":"open","locked":false,"title":"Complete rewrite of bsd IClient","user":{"login":"Thog","id":1760003,"node_id":"MDQ6VXNlcjE3NjAwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1760003?v=4","gravatar_id":"","url":"https://api.github.com/users/Thog","html_url":"https://github.com/Thog","followers_url":"https://api.github.com/users/Thog/followers","following_url":"https://api.github.com/users/Thog/following{/other_user}","gists_url":"https://api.github.com/users/Thog/gists{/gist_id}","starred_url":"https://api.github.com/users/Thog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thog/subscriptions","organizations_url":"https://api.github.com/users/Thog/orgs","repos_url":"https://api.github.com/users/Thog/repos","events_url":"https://api.github.com/users/Thog/events{/privacy}","received_events_url":"https://api.github.com/users/Thog/received_events","type":"User","site_admin":false},"body":"This should provide more accurate behaviours than before.\r\nThis implementation has been tested with ftpd and libtransistor bsd tests.\r\n\r\nThis implementation lacks OOB support.","created_at":"2018-10-16T19:08:29Z","updated_at":"2018-10-17T22:45:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2282321f1146b3edeb8b6f35e19d8070d8855c23","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":826894433,"node_id":"MDU6TGFiZWw4MjY4OTQ0MzM=","url":"https://api.github.com/repos/Ryujinx/Ryujinx/labels/horizon","name":"horizon","color":"7057ff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460/commits","review_comments_url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460/comments","review_comment_url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/460/comments","statuses_url":"https://api.github.com/repos/Ryujinx/Ryujinx/statuses/e0f1164f611c62c67483e06160464570ac37520c","head":{"label":"Thog:rewrite/bsd-socket","ref":"rewrite/bsd-socket","sha":"e0f1164f611c62c67483e06160464570ac37520c","user":{"login":"Thog","id":1760003,"node_id":"MDQ6VXNlcjE3NjAwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1760003?v=4","gravatar_id":"","url":"https://api.github.com/users/Thog","html_url":"https://github.com/Thog","followers_url":"https://api.github.com/users/Thog/followers","following_url":"https://api.github.com/users/Thog/following{/other_user}","gists_url":"https://api.github.com/users/Thog/gists{/gist_id}","starred_url":"https://api.github.com/users/Thog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thog/subscriptions","organizations_url":"https://api.github.com/users/Thog/orgs","repos_url":"https://api.github.com/users/Thog/repos","events_url":"https://api.github.com/users/Thog/events{/privacy}","received_events_url":"https://api.github.com/users/Thog/received_events","type":"User","site_admin":false},"repo":{"id":132176276,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIxNzYyNzY=","name":"Ryujinx","full_name":"Thog/Ryujinx","private":false,"owner":{"login":"Thog","id":1760003,"node_id":"MDQ6VXNlcjE3NjAwMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/1760003?v=4","gravatar_id":"","url":"https://api.github.com/users/Thog","html_url":"https://github.com/Thog","followers_url":"https://api.github.com/users/Thog/followers","following_url":"https://api.github.com/users/Thog/following{/other_user}","gists_url":"https://api.github.com/users/Thog/gists{/gist_id}","starred_url":"https://api.github.com/users/Thog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thog/subscriptions","organizations_url":"https://api.github.com/users/Thog/orgs","repos_url":"https://api.github.com/users/Thog/repos","events_url":"https://api.github.com/users/Thog/events{/privacy}","received_events_url":"https://api.github.com/users/Thog/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Thog/Ryujinx","description":"Experimental Switch emulator written in C#","fork":true,"url":"https://api.github.com/repos/Thog/Ryujinx","forks_url":"https://api.github.com/repos/Thog/Ryujinx/forks","keys_url":"https://api.github.com/repos/Thog/Ryujinx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Thog/Ryujinx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Thog/Ryujinx/teams","hooks_url":"https://api.github.com/repos/Thog/Ryujinx/hooks","issue_events_url":"https://api.github.com/repos/Thog/Ryujinx/issues/events{/number}","events_url":"https://api.github.com/repos/Thog/Ryujinx/events","assignees_url":"https://api.github.com/repos/Thog/Ryujinx/assignees{/user}","branches_url":"https://api.github.com/repos/Thog/Ryujinx/branches{/branch}","tags_url":"https://api.github.com/repos/Thog/Ryujinx/tags","blobs_url":"https://api.github.com/repos/Thog/Ryujinx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Thog/Ryujinx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Thog/Ryujinx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Thog/Ryujinx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Thog/Ryujinx/statuses/{sha}","languages_url":"https://api.github.com/repos/Thog/Ryujinx/languages","stargazers_url":"https://api.github.com/repos/Thog/Ryujinx/stargazers","contributors_url":"https://api.github.com/repos/Thog/Ryujinx/contributors","subscribers_url":"https://api.github.com/repos/Thog/Ryujinx/subscribers","subscription_url":"https://api.github.com/repos/Thog/Ryujinx/subscription","commits_url":"https://api.github.com/repos/Thog/Ryujinx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Thog/Ryujinx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Thog/Ryujinx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Thog/Ryujinx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Thog/Ryujinx/contents/{+path}","compare_url":"https://api.github.com/repos/Thog/Ryujinx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Thog/Ryujinx/merges","archive_url":"https://api.github.com/repos/Thog/Ryujinx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Thog/Ryujinx/downloads","issues_url":"https://api.github.com/repos/Thog/Ryujinx/issues{/number}","pulls_url":"https://api.github.com/repos/Thog/Ryujinx/pulls{/number}","milestones_url":"https://api.github.com/repos/Thog/Ryujinx/milestones{/number}","notifications_url":"https://api.github.com/repos/Thog/Ryujinx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Thog/Ryujinx/labels{/name}","releases_url":"https://api.github.com/repos/Thog/Ryujinx/releases{/id}","deployments_url":"https://api.github.com/repos/Thog/Ryujinx/deployments","created_at":"2018-05-04T18:37:20Z","updated_at":"2018-10-16T18:58:38Z","pushed_at":"2018-10-17T22:26:45Z","git_url":"git://github.com/Thog/Ryujinx.git","ssh_url":"git@github.com:Thog/Ryujinx.git","clone_url":"https://github.com/Thog/Ryujinx.git","svn_url":"https://github.com/Thog/Ryujinx","homepage":null,"size":4483,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"unlicense","name":"The Unlicense","spdx_id":"Unlicense","url":"https://api.github.com/licenses/unlicense","node_id":"MDc6TGljZW5zZTE1"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Ryujinx:master","ref":"master","sha":"0e1e094b7a8f0134831fc4cebdb0841b9c10fe6a","user":{"login":"Ryujinx","id":39036280,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MDM2Mjgw","avatar_url":"https://avatars3.githubusercontent.com/u/39036280?v=4","gravatar_id":"","url":"https://api.github.com/users/Ryujinx","html_url":"https://github.com/Ryujinx","followers_url":"https://api.github.com/users/Ryujinx/followers","following_url":"https://api.github.com/users/Ryujinx/following{/other_user}","gists_url":"https://api.github.com/users/Ryujinx/gists{/gist_id}","starred_url":"https://api.github.com/users/Ryujinx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ryujinx/subscriptions","organizations_url":"https://api.github.com/users/Ryujinx/orgs","repos_url":"https://api.github.com/users/Ryujinx/repos","events_url":"https://api.github.com/users/Ryujinx/events{/privacy}","received_events_url":"https://api.github.com/users/Ryujinx/received_events","type":"Organization","site_admin":false},"repo":{"id":120231691,"node_id":"MDEwOlJlcG9zaXRvcnkxMjAyMzE2OTE=","name":"Ryujinx","full_name":"Ryujinx/Ryujinx","private":false,"owner":{"login":"Ryujinx","id":39036280,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MDM2Mjgw","avatar_url":"https://avatars3.githubusercontent.com/u/39036280?v=4","gravatar_id":"","url":"https://api.github.com/users/Ryujinx","html_url":"https://github.com/Ryujinx","followers_url":"https://api.github.com/users/Ryujinx/followers","following_url":"https://api.github.com/users/Ryujinx/following{/other_user}","gists_url":"https://api.github.com/users/Ryujinx/gists{/gist_id}","starred_url":"https://api.github.com/users/Ryujinx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ryujinx/subscriptions","organizations_url":"https://api.github.com/users/Ryujinx/orgs","repos_url":"https://api.github.com/users/Ryujinx/repos","events_url":"https://api.github.com/users/Ryujinx/events{/privacy}","received_events_url":"https://api.github.com/users/Ryujinx/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Ryujinx/Ryujinx","description":"Experimental Switch emulator written in C#","fork":false,"url":"https://api.github.com/repos/Ryujinx/Ryujinx","forks_url":"https://api.github.com/repos/Ryujinx/Ryujinx/forks","keys_url":"https://api.github.com/repos/Ryujinx/Ryujinx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ryujinx/Ryujinx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ryujinx/Ryujinx/teams","hooks_url":"https://api.github.com/repos/Ryujinx/Ryujinx/hooks","issue_events_url":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/events{/number}","events_url":"https://api.github.com/repos/Ryujinx/Ryujinx/events","assignees_url":"https://api.github.com/repos/Ryujinx/Ryujinx/assignees{/user}","branches_url":"https://api.github.com/repos/Ryujinx/Ryujinx/branches{/branch}","tags_url":"https://api.github.com/repos/Ryujinx/Ryujinx/tags","blobs_url":"https://api.github.com/repos/Ryujinx/Ryujinx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ryujinx/Ryujinx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ryujinx/Ryujinx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ryujinx/Ryujinx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ryujinx/Ryujinx/statuses/{sha}","languages_url":"https://api.github.com/repos/Ryujinx/Ryujinx/languages","stargazers_url":"https://api.github.com/repos/Ryujinx/Ryujinx/stargazers","contributors_url":"https://api.github.com/repos/Ryujinx/Ryujinx/contributors","subscribers_url":"https://api.github.com/repos/Ryujinx/Ryujinx/subscribers","subscription_url":"https://api.github.com/repos/Ryujinx/Ryujinx/subscription","commits_url":"https://api.github.com/repos/Ryujinx/Ryujinx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ryujinx/Ryujinx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ryujinx/Ryujinx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ryujinx/Ryujinx/contents/{+path}","compare_url":"https://api.github.com/repos/Ryujinx/Ryujinx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ryujinx/Ryujinx/merges","archive_url":"https://api.github.com/repos/Ryujinx/Ryujinx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ryujinx/Ryujinx/downloads","issues_url":"https://api.github.com/repos/Ryujinx/Ryujinx/issues{/number}","pulls_url":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls{/number}","milestones_url":"https://api.github.com/repos/Ryujinx/Ryujinx/milestones{/number}","notifications_url":"https://api.github.com/repos/Ryujinx/Ryujinx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ryujinx/Ryujinx/labels{/name}","releases_url":"https://api.github.com/repos/Ryujinx/Ryujinx/releases{/id}","deployments_url":"https://api.github.com/repos/Ryujinx/Ryujinx/deployments","created_at":"2018-02-04T23:07:54Z","updated_at":"2018-10-17T21:02:28Z","pushed_at":"2018-10-17T22:26:47Z","git_url":"git://github.com/Ryujinx/Ryujinx.git","ssh_url":"git@github.com:Ryujinx/Ryujinx.git","clone_url":"https://github.com/Ryujinx/Ryujinx.git","svn_url":"https://github.com/Ryujinx/Ryujinx","homepage":null,"size":4462,"stargazers_count":778,"watchers_count":778,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":106,"mirror_url":null,"archived":false,"open_issues_count":27,"license":{"key":"unlicense","name":"The Unlicense","spdx_id":"Unlicense","url":"https://api.github.com/licenses/unlicense","node_id":"MDc6TGljZW5zZTE1"},"forks":106,"open_issues":27,"watchers":778,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460"},"html":{"href":"https://github.com/Ryujinx/Ryujinx/pull/460"},"issue":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/460"},"comments":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/Ryujinx/Ryujinx/statuses/e0f1164f611c62c67483e06160464570ac37520c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"gdkchan"}}