mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-03 02:58:31 +02:00
* Make error constants cross platform.
git-svn-id: trunk@5977 -
This commit is contained in:
parent
38062997f4
commit
e6438fe23d
@ -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;
|
||||
|
@ -96,6 +96,11 @@ Const
|
||||
|
||||
PF_MAX = so32dll.PF_MAX;
|
||||
|
||||
const EsockEINTR = SOCEINTR;
|
||||
EsockEBADF = SOCEBADF;
|
||||
EsockEFAULT = SOCEFAULT;
|
||||
EsockEINVAL = SOCEINVAL;
|
||||
|
||||
|
||||
Type
|
||||
cushort=word;
|
||||
|
@ -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}
|
||||
|
@ -27,6 +27,10 @@ Type
|
||||
tsocklen= cint;
|
||||
psocklen= ^tsocklen;
|
||||
|
||||
const EsockEINTR = WSAEINTR;
|
||||
EsockEBADF = WSAEBADF;
|
||||
EsockEFAULT = WSAEFAULT;
|
||||
EsockEINVAL = WSAEINVAL;
|
||||
|
||||
{$i socketsh.inc}
|
||||
{$i fpwinsockh.inc}
|
||||
|
Loading…
Reference in New Issue
Block a user