Subversion Repositories Kolibri OS

Rev

Rev 6476 | Rev 6908 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6476 Rev 6907
Line 13... Line 13...
13
;;         GNU GENERAL PUBLIC LICENSE                              ;;
13
;;         GNU GENERAL PUBLIC LICENSE                              ;;
14
;;          Version 2, June 1991                                   ;;
14
;;          Version 2, June 1991                                   ;;
15
;;                                                                 ;;
15
;;                                                                 ;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 17... Line 17...
17
 
17
 
Line 18... Line 18...
18
$Revision: 6476 $
18
$Revision: 6907 $
Line 19... Line 19...
19
 
19
 
20
struct  SOCKET
20
struct  SOCKET
Line 291... Line 291...
291
;                                                                 ;
291
;                                                                 ;
292
;-----------------------------------------------------------------;
292
;-----------------------------------------------------------------;
293
align 4
293
align 4
294
socket_open:
294
socket_open:
Line 295... Line 295...
295
 
295
 
Line 296... Line 296...
296
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_open: domain=%u type=%u protocol=%x ", ecx, edx, esi
296
        DEBUGF  1, "SOCKET_open: domain=%u type=%u protocol=%x\n ", ecx, edx, esi
297
 
297
 
298
        push    ecx edx esi
298
        push    ecx edx esi
299
        call    socket_alloc
299
        call    socket_alloc
Line 690... Line 690...
690
        ret
690
        ret
Line 691... Line 691...
691
 
691
 
692
  .block:
692
  .block:
693
        test    [eax + SOCKET.options], SO_NONBLOCK
693
        test    [eax + SOCKET.options], SO_NONBLOCK
694
        jnz     .wouldblock
-
 
-
 
694
        jnz     .wouldblock
695
 
695
        DEBUGF  1, "Calling socket_block at 695\n"
696
        call    socket_block
696
        call    socket_block
Line 697... Line 697...
697
        jmp     .loop
697
        jmp     .loop
698
 
698
 
Line 728... Line 728...
728
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_close: socknum=%u\n", ecx
728
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_close: socknum=%u\n", ecx
Line 729... Line 729...
729
 
729
 
730
        call    socket_num_to_ptr
730
        call    socket_num_to_ptr
731
        test    eax, eax
731
        test    eax, eax
-
 
732
        jz      .invalid
Line 732... Line 733...
732
        jz      .invalid
733
        DEBUGF  1, "SOCKET_close: socknum=%x\n", eax
Line 733... Line 734...
733
 
734
 
Line 759... Line 760...
759
  @@:
760
  @@:
760
        ret
761
        ret
Line 761... Line 762...
761
 
762
 
-
 
763
 
762
 
764
  .invalid:
763
  .invalid:
765
        DEBUGF  1, "SOCKET_close: INVALID!\n"
764
        mov     dword[esp+20], EINVAL
766
        mov     dword[esp+20], EINVAL
Line 789... Line 791...
789
        call    socket_num_to_ptr
791
        call    socket_num_to_ptr
790
        test    eax, eax
792
        test    eax, eax
791
        jz      .invalid
793
        jz      .invalid
Line 792... Line 794...
792
 
794
 
-
 
795
  .loop:
-
 
796
        pushf
793
  .loop:
797
        cli
794
        push    edi
798
        push    edi
795
        call    [eax + SOCKET.rcv_proc]
799
        call    [eax + SOCKET.rcv_proc]
Line 796... Line 800...
796
        pop     edi
800
        pop     edi
Line 804... Line 808...
804
        test    edi, MSG_DONTWAIT
808
        test    edi, MSG_DONTWAIT
805
        jnz     .return_err
809
        jnz     .return_err
Line 806... Line 810...
806
 
810
 
807
        test    [eax + SOCKET.options], SO_NONBLOCK
811
        test    [eax + SOCKET.options], SO_NONBLOCK
808
        jnz     .return_err
-
 
-
 
812
        jnz     .return_err
809
 
813
        DEBUGF  1, "Calling socket_block at 813\n"
-
 
814
        call    socket_block
810
        call    socket_block
815
        popf
Line 811... Line 816...
811
        jmp     .loop
816
        jmp     .loop
812
 
817
 
813
 
818
 
814
  .invalid:
819
  .invalid:
815
        push    EINVAL
820
        push    EINVAL
816
        pop     ebx
821
        pop     ebx
-
 
822
  .return_err:
817
  .return_err:
823
        mov     ecx, -1
818
        mov     ecx, -1
824
  .return:
819
  .return:
825
        popf
Line 820... Line 826...
820
        mov     [esp+20], ebx
826
        mov     [esp+20], ebx
Line 1823... Line 1829...
1823
;                                                                 ;
1829
;                                                                 ;
1824
;-----------------------------------------------------------------;
1830
;-----------------------------------------------------------------;
1825
align 4
1831
align 4
1826
socket_block:
1832
socket_block:
Line 1827... Line 1833...
1827
 
1833
 
Line 1828... Line 1834...
1828
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_block: %x\n", eax
1834
        DEBUGF  1, "SOCKET_block: %x\n", eax
Line 1829... Line 1835...
1829
 
1835
 
1830
        push    eax
1836
        push    eax
Line 1848... Line 1854...
1848
        popf
1854
        popf
Line 1849... Line 1855...
1849
 
1855
 
1850
        call    change_task
1856
        call    change_task
Line 1851... Line 1857...
1851
        pop     eax
1857
        pop     eax
Line 1852... Line 1858...
1852
 
1858
 
Line 1853... Line 1859...
1853
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_block: continuing\n"
1859
        DEBUGF  1, "SOCKET_block: continuing: %x\n", eax
Line 1916... Line 1922...
1916
; Socket and thread exists and socket is of blocking type
1922
; Socket and thread exists and socket is of blocking type
1917
; We'll try to unblock it.
1923
; We'll try to unblock it.
1918
        and     [eax + SOCKET.state], not SS_BLOCKED    ; Clear the 'socket is blocked' flag
1924
        and     [eax + SOCKET.state], not SS_BLOCKED    ; Clear the 'socket is blocked' flag
1919
        mov     [esi + TASKDATA.state], 0               ; Run the thread
1925
        mov     [esi + TASKDATA.state], 0               ; Run the thread
Line 1920... Line 1926...
1920
 
1926
 
1921
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_notify: Unblocked socket!\n"
1927
        DEBUGF  1, "SOCKET_notify: Unblocked socket!\n"
1922
        pop     esi ecx ebx
1928
        pop     esi ecx ebx
Line 1923... Line 1929...
1923
        ret
1929
        ret