Permalink
Browse files

most Sockets.pp definitions are inlined in SynFPCSock to avoid Lazaru…

…s problems

(part 2/2)
  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Sep 21, 2018
1 parent 49448a8 commit 563dfb436bcc41cd0171136bfcd3726c74480a97
Showing with 38 additions and 4 deletions.
  1. +37 −3 SynFPCSock.pas
  2. +1 −1 SynopseCommit.inc
@@ -98,7 +98,7 @@ interface
{$endif}
termio,
netdb,
Sockets,
Sockets, // most definitions are inlined in SynFPCSock to avoid Lazarus problems with Sockets.pp
SynFPCLinux,
{$else}
{$ifdef KYLIX3}
@@ -150,6 +150,9 @@ procedure DestroySocketInterface;
PSockAddrIn6 = ^TSockAddrIn6;
TSockAddrIn6 = sockets.TInetSockAddr6;
TSockAddr = sockets.TSockAddr;
PSockAddr = sockets.PSockAddr;
const
FIONREAD = termio.FIONREAD;
FIONBIO = termio.FIONBIO;
@@ -167,6 +170,10 @@ procedure DestroySocketInterface;
IP_ADD_MEMBERSHIP = sockets.IP_ADD_MEMBERSHIP; { ip_mreq; add an IP group membership }
IP_DROP_MEMBERSHIP = sockets.IP_DROP_MEMBERSHIP; { ip_mreq; drop an IP group membership }
SHUT_RD = sockets.SHUT_RD;
SHUT_WR = sockets.SHUT_WR;
SHUT_RDWR = sockets.SHUT_RDWR;
SOL_SOCKET = sockets.SOL_SOCKET;
SO_DEBUG = sockets.SO_DEBUG;
@@ -215,7 +222,9 @@ procedure DestroySocketInterface;
{ Address families. }
AF_UNSPEC = 0; { unspecified }
AF_LOCAL = 1;
AF_INET = 2; { internetwork: UDP, TCP, etc. }
AF_UNIX = AF_LOCAL;
AF_MAX = 24;
{ Protocol families, same as address families for now. }
@@ -393,7 +402,7 @@ procedure SET_LOOPBACK_ADDR6 (const a: PInAddr6);
var
in6addr_any, in6addr_loopback : TInAddr6;
{$ifdef FPC}
{$ifdef FPC} // some functions inlined redirection to Sockets.pp
procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet); inline;
function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean; inline;
@@ -403,10 +412,15 @@ procedure FD_ZERO(var FDSet: TFDSet); inline;
function ResolveIPToName(const IP: string; Family,SockProtocol,SockType: integer): string;
function ResolvePort(const Port: string; Family,SockProtocol,SockType: integer): Word;
function fpbind(s:cint; addrx: psockaddr; addrlen: tsocklen): cint; inline;
function fplisten(s:cint; backlog : cint): cint; inline;
function fprecv(s:cint; buf: pointer; len: size_t; Flags: cint): ssize_t; inline;
function fpsend(s:cint; msg:pointer; len:size_t; flags:cint): ssize_t; inline;
{$endif FPC}
const
// we assume that the OS has IP6 compatibility
// we assume that the Posix OS has IP6 compatibility
SockEnhancedApi = true;
SockWship6Api = true;
@@ -669,6 +683,26 @@ procedure FD_ZERO(var fdset: TFDSet);
fpFD_ZERO(fdset);
end;
function fpbind(s:cint; addrx: psockaddr; addrlen: tsocklen): cint;
begin
result := sockets.fpbind(s, addrx, addrlen);
end;
function fplisten(s:cint; backlog : cint): cint;
begin
result := sockets.fplisten(s, backlog);
end;
function fprecv(s:cint; buf: pointer; len: size_t; Flags: cint): ssize_t;
begin
result := sockets.fprecv(s, buf, len, Flags);
end;
function fpsend(s:cint; msg:pointer; len:size_t; flags:cint): ssize_t;
begin
result := sockets.fpsend(s, msg, len, flags);
end;
{$endif FPC}
function SizeOfVarSin(sin: TVarSin): integer;
@@ -1 +1 @@
'1.18.4806'
'1.18.4807'

0 comments on commit 563dfb4

Please sign in to comment.