From 66d13287061c91dce7bfa6edb3d324f51c2c7489 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Fri, 12 Jul 2013 14:49:00 +0000 Subject: [PATCH] Bugfixes in kernel related to forking of sockets. git-svn-id: svn://kolibrios.org@3817 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/network/socket.inc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/kernel/trunk/network/socket.inc b/kernel/trunk/network/socket.inc index 1c107a48c5..a871edc8ca 100644 --- a/kernel/trunk/network/socket.inc +++ b/kernel/trunk/network/socket.inc @@ -754,15 +754,15 @@ SOCKET_accept: ; Ok, we got a socket ptr mov eax, [esi] -; Convert it to a socket number - call SOCKET_ptr_to_num - jz .invalid ; FIXME ? - ; Change thread ID to that of the current thread mov ebx, [TASK_BASE] mov ebx, [ebx + TASKDATA.pid] mov [eax + SOCKET.TID], ebx +; Convert it to a socket number + call SOCKET_ptr_to_num + jz .invalid ; FIXME ? + ; and return it to caller mov [esp+32], eax ret @@ -1894,8 +1894,7 @@ SOCKET_notify: shl ecx, 8 or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK - DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Raised a network event!\n" - + DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_notify: poking thread %u!\n", eax jmp .done .unblock: @@ -2152,7 +2151,8 @@ SOCKET_fork: pop eax ; Copy structure from current socket to new -; We start at PID to preserve the socket num, and the 2 pointers at beginning of socket +; We start at PID to preserve the socket num, 2 pointers and mutex +; TID will be filled in later lea esi, [ebx + SOCKET.PID] lea edi, [eax + SOCKET.PID] mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4 @@ -2160,6 +2160,12 @@ SOCKET_fork: and [eax + SOCKET.options], not SO_ACCEPTCON +; Notify owner of parent socket + push eax + mov eax, ebx + call SOCKET_notify + pop eax + ret .fail2: