Bugfixes in kernel related to forking of sockets.

git-svn-id: svn://kolibrios.org@3817 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-07-12 14:49:00 +00:00
parent b9648e30e6
commit 66d1328706

View File

@ -754,15 +754,15 @@ SOCKET_accept:
; Ok, we got a socket ptr ; Ok, we got a socket ptr
mov eax, [esi] 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 ; Change thread ID to that of the current thread
mov ebx, [TASK_BASE] mov ebx, [TASK_BASE]
mov ebx, [ebx + TASKDATA.pid] mov ebx, [ebx + TASKDATA.pid]
mov [eax + SOCKET.TID], ebx mov [eax + SOCKET.TID], ebx
; Convert it to a socket number
call SOCKET_ptr_to_num
jz .invalid ; FIXME ?
; and return it to caller ; and return it to caller
mov [esp+32], eax mov [esp+32], eax
ret ret
@ -1894,8 +1894,7 @@ SOCKET_notify:
shl ecx, 8 shl ecx, 8
or [ecx + SLOT_BASE + APPDATA.event_mask], EVENT_NETWORK 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 jmp .done
.unblock: .unblock:
@ -2152,7 +2151,8 @@ SOCKET_fork:
pop eax pop eax
; Copy structure from current socket to new ; 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 esi, [ebx + SOCKET.PID]
lea edi, [eax + SOCKET.PID] lea edi, [eax + SOCKET.PID]
mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4 mov ecx, (SOCKET_QUEUE_LOCATION - SOCKET.PID + 3)/4
@ -2160,6 +2160,12 @@ SOCKET_fork:
and [eax + SOCKET.options], not SO_ACCEPTCON and [eax + SOCKET.options], not SO_ACCEPTCON
; Notify owner of parent socket
push eax
mov eax, ebx
call SOCKET_notify
pop eax
ret ret
.fail2: .fail2: