mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 20:39:13 +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}
|
{$else}
|
||||||
r:=send(handle,bufptr^,bufpos,0);
|
r:=send(handle,bufptr^,bufpos,0);
|
||||||
{$endif}
|
{$endif}
|
||||||
until (r<>-1) or (errno<>EsysEINTR);
|
until (r<>-1) or (socketerror<>EsockEINTR);
|
||||||
bufend:=r;
|
bufend:=r;
|
||||||
def_error:=101; {File write error.}
|
def_error:=101; {File write error.}
|
||||||
end;
|
end;
|
||||||
@ -60,19 +60,19 @@ begin
|
|||||||
{$else}
|
{$else}
|
||||||
r:=recv(handle,bufptr^,bufsize,0);
|
r:=recv(handle,bufptr^,bufsize,0);
|
||||||
{$endif}
|
{$endif}
|
||||||
until (r<>-1) or (errno<>EsysEINTR);
|
until (r<>-1) or (socketerror<>EsockEINTR);
|
||||||
bufend:=r;
|
bufend:=r;
|
||||||
def_error:=100; {File read error.}
|
def_error:=100; {File read error.}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if r=-1 then
|
if r=-1 then
|
||||||
case errno of
|
case errno of
|
||||||
EsysEBADF:
|
EsockEBADF:
|
||||||
{ EsysENOTSOCK:} {Why is this constant not defined? (DM)}
|
{ EsysENOTSOCK:} {Why is this constant not defined? (DM)}
|
||||||
inoutres:=6; {Invalid file handle.}
|
inoutres:=6; {Invalid file handle.}
|
||||||
EsysEFAULT:
|
EsockEFAULT:
|
||||||
inoutres:=217;
|
inoutres:=217;
|
||||||
EsysEINVAL:
|
EsockEINVAL:
|
||||||
inoutres:=218;
|
inoutres:=218;
|
||||||
else
|
else
|
||||||
inoutres:=def_error;
|
inoutres:=def_error;
|
||||||
|
@ -96,6 +96,11 @@ Const
|
|||||||
|
|
||||||
PF_MAX = so32dll.PF_MAX;
|
PF_MAX = so32dll.PF_MAX;
|
||||||
|
|
||||||
|
const EsockEINTR = SOCEINTR;
|
||||||
|
EsockEBADF = SOCEBADF;
|
||||||
|
EsockEFAULT = SOCEFAULT;
|
||||||
|
EsockEINVAL = SOCEINVAL;
|
||||||
|
|
||||||
|
|
||||||
Type
|
Type
|
||||||
cushort=word;
|
cushort=word;
|
||||||
|
@ -14,7 +14,7 @@ unit Sockets;
|
|||||||
Interface
|
Interface
|
||||||
|
|
||||||
{$ifdef Unix}
|
{$ifdef Unix}
|
||||||
Uses UnixType;
|
Uses baseunix,UnixType;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef FreeBSD}
|
{$ifdef FreeBSD}
|
||||||
@ -37,6 +37,10 @@ type
|
|||||||
path:array[0..107] of char; //104 total for freebsd.
|
path:array[0..107] of char; //104 total for freebsd.
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const EsockEINTR = EsysEINTR;
|
||||||
|
EsockEBADF = EsysEBADF;
|
||||||
|
EsockEFAULT = EsysEFAULT;
|
||||||
|
EsockEINVAL = EsysEINVAL;
|
||||||
|
|
||||||
{ unix socket specific functions }
|
{ unix socket specific functions }
|
||||||
Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint);
|
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
|
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 }
|
{ Include filerec and textrec structures }
|
||||||
{$i filerec.inc}
|
{$i filerec.inc}
|
||||||
|
@ -27,6 +27,10 @@ Type
|
|||||||
tsocklen= cint;
|
tsocklen= cint;
|
||||||
psocklen= ^tsocklen;
|
psocklen= ^tsocklen;
|
||||||
|
|
||||||
|
const EsockEINTR = WSAEINTR;
|
||||||
|
EsockEBADF = WSAEBADF;
|
||||||
|
EsockEFAULT = WSAEFAULT;
|
||||||
|
EsockEINVAL = WSAEINVAL;
|
||||||
|
|
||||||
{$i socketsh.inc}
|
{$i socketsh.inc}
|
||||||
{$i fpwinsockh.inc}
|
{$i fpwinsockh.inc}
|
||||||
|
Loading…
Reference in New Issue
Block a user