X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/95f6f73e86d09b2f277a669fc23aec9f5be9ce5d..2c3a30778bb5a281c10736470058b5a63575a516:/unixstuff.inc diff --git a/unixstuff.inc b/unixstuff.inc old mode 100755 new mode 100644 index f5de6d4..1a9a97b --- a/unixstuff.inc +++ b/unixstuff.inc @@ -22,7 +22,8 @@ {$else} result := invalue; {$endif} - end; + end; + {$define need_v6constants} {$else} {$define sigprocmask := fpsigprocmask} @@ -42,11 +43,22 @@ {$ifndef ver1_9_2} {$define flock := fpflock} {$ifndef ver1_9_4} - procedure Execl(Todo:string);inline; + //beware: this is needed because FPC_FULLVERSION >= 30200 breaks delphi 6 even inside an ifdef it shouldn't process + {$ifdef fpc} + {$ifdef ver3} + {$ifndef ver3_0}{$ifndef ver3_1}{$define fpc_3_2_or_later}{$endif}{$endif} + {$endif} + {$ifdef ver4}{$define fpc_3_2_or_later}{$endif} + {$endif} + {$ifdef fpc_3_2_or_later} + procedure Execl(Todo:rawbytestring);inline; + {$else} + procedure Execl(Todo:string);inline; + {$endif} var p : ppchar; begin - p := unixutil.StringToPPChar(Todo,1); + p := unixutil.StringToPPChar(Todo,0); if (p=nil) or (p^=nil) then exit; fpexecv(p^,p); end; @@ -81,7 +93,7 @@ end; function GetSocketName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt; begin - result := fpgetpeername(sock,@addr,@addrlen); + result := fpgetsockname(sock,@addr,@addrlen); end; function Accept(Sock: LongInt; var Addr; var Addrlen: LongInt):LongInt; begin @@ -93,6 +105,7 @@ const IPPROTO_UDP=17; IPPROTO_ICMP=1; + {$define need_v6constants} {$endif} {$ifdef ver1_9} const @@ -110,6 +123,7 @@ result := invalue; {$endif} end; + {$define need_v6constants} {$endif} procedure gettimeofday(var tv:ttimeval);inline; begin @@ -147,4 +161,22 @@ sys_eintr=esyseintr; {$endif} + {$ifdef need_v6constants} + {$ifdef linux} + //the below values are only known correct on linux, I don't support + //1.0.x on any other unix platform atm anyway --plugwash + const + IPPROTO_IPV6 = 41; + IPV6_V6ONLY = 26; + {$endif} + {$endif} + {$ifdef freebsd} + //freepascal doesn't seem to define IPV6_V6ONLY on freebsd, the definition + //here is taken from the include files of a freebsd 8 system + const + IPV6_V6ONLY = 27; + {$endif} + {$endif} + +