2
0
Эх сурвалжийг харах

* Make error constants cross platform.

git-svn-id: trunk@5977 -
daniel 18 жил өмнө
parent
commit
e6438fe23d

+ 5 - 5
rtl/inc/sockets.inc

@@ -48,7 +48,7 @@ begin
 {$else}
               r:=send(handle,bufptr^,bufpos,0);
 {$endif}
-            until (r<>-1) or (errno<>EsysEINTR);
+            until (r<>-1) or (socketerror<>EsockEINTR);
             bufend:=r;
             def_error:=101; {File write error.}
           end;
@@ -60,19 +60,19 @@ begin
 {$else}
               r:=recv(handle,bufptr^,bufsize,0);
 {$endif}
-            until (r<>-1) or (errno<>EsysEINTR);
+            until (r<>-1) or (socketerror<>EsockEINTR);
             bufend:=r;
             def_error:=100; {File read error.}
           end;
       end;
       if r=-1 then
         case errno of
-          EsysEBADF:
+          EsockEBADF:
 {          EsysENOTSOCK:}   {Why is this constant not defined? (DM)}
             inoutres:=6;    {Invalid file handle.}
-          EsysEFAULT:
+          EsockEFAULT:
             inoutres:=217;
-          EsysEINVAL:
+          EsockEINVAL:
             inoutres:=218;
         else
           inoutres:=def_error;

+ 5 - 0
rtl/os2/sockets.pas

@@ -96,6 +96,11 @@ Const
 
   PF_MAX       = so32dll.PF_MAX;
 
+const EsockEINTR  = SOCEINTR;
+      EsockEBADF  = SOCEBADF;
+      EsockEFAULT = SOCEFAULT;
+      EsockEINVAL = SOCEINVAL;
+
 
 Type
   cushort=word;

+ 6 - 2
rtl/unix/sockets.pp

@@ -14,7 +14,7 @@ unit Sockets;
 Interface
 
 {$ifdef Unix}
-Uses UnixType;
+Uses baseunix,UnixType;
 {$endif}
 
 {$ifdef FreeBSD}
@@ -37,6 +37,10 @@ type
                   path:array[0..107] of char;    //104 total for freebsd.
                   end;
 
+const EsockEINTR  = EsysEINTR;
+      EsockEBADF  = EsysEBADF;
+      EsockEFAULT = EsysEFAULT;
+      EsockEINVAL = EsysEINVAL;
 
 { unix socket specific functions }
 Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint);
@@ -52,7 +56,7 @@ Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:File):Boolean;
 
 Implementation
 
-Uses BaseUnix,{$ifndef FPC_USE_LIBC}SysCall{$else}initc{$endif};
+Uses {$ifndef FPC_USE_LIBC}SysCall{$else}initc{$endif};
 
 { Include filerec and textrec structures }
 {$i filerec.inc}

+ 4 - 0
rtl/win/sockets.pp

@@ -27,6 +27,10 @@ Type
   tsocklen= cint;
   psocklen= ^tsocklen;
 
+const EsockEINTR  = WSAEINTR;
+      EsockEBADF  = WSAEBADF;
+      EsockEFAULT = WSAEFAULT;
+      EsockEINVAL = WSAEINVAL;
 
 {$i socketsh.inc}
 {$i fpwinsockh.inc}