X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/2d2676149292e4e388bb102a41a3d64349ac88ed..90c7057fc0ae5d85a6443e7633642ef43553ab28:/unixstuff.inc?ds=inline diff --git a/unixstuff.inc b/unixstuff.inc index 120f8f1..dca63ce 100755 --- a/unixstuff.inc +++ b/unixstuff.inc @@ -22,7 +22,8 @@ {$else} result := invalue; {$endif} - end; + end; + {$define need_v6constants} {$else} {$define sigprocmask := fpsigprocmask} @@ -46,53 +47,54 @@ 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; - function SendTo(Sock: LongInt; const Buf;BufLen: LongInt;Flags: LongInt;var Addr;AddrLen: LongInt):LongInt; - begin - result := fpsendto(sock,@buf,buflen,flags,@addr,addrlen); - end; - function RecvFrom(Sock: LongInt;var Buf;Buflen: LongInt;Flags: LongInt;var Addr;var addrlen: Longint):LongInt; - begin - result := fprecvfrom(sock,@buf,buflen,flags,@addr,@addrlen); - end; - {$define socket := fpsocket} - function Bind(Sock: LongInt;const Addr;AddrLen: LongInt):Boolean; - begin - result := fpbind(sock,@addr,addrlen) = 0; - end; - function SetSocketOptions(Sock: LongInt;Level: LongInt;OptName: LongInt;const OptVal;optlen: LongInt):LongInt; - begin - result := fpsetsockopt(sock,level,optname,@optval,optlen); - end; - function Connect(Sock: LongInt;const Addr;Addrlen: LongInt):Boolean; - begin - result := fpconnect(sock,@addr,addrlen) >= 0; - end; - function listen(Sock: LongInt;MaxConnect: LongInt):Boolean; - begin - result := fplisten(sock,maxconnect) = 0; - end; - function GetPeerName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt; - begin - result := fpgetpeername(sock,@addr,@addrlen); - end; - function GetSocketName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt; - begin - result := fpgetpeername(sock,@addr,@addrlen); - end; - function Accept(Sock: LongInt; var Addr; var Addrlen: LongInt):LongInt; - begin - result := fpaccept(sock,@addr,@addrlen); - end; + function SendTo(Sock: LongInt; const Buf;BufLen: LongInt;Flags: LongInt;var Addr;AddrLen: LongInt):LongInt; + begin + result := fpsendto(sock,@buf,buflen,flags,@addr,addrlen); + end; + function RecvFrom(Sock: LongInt;var Buf;Buflen: LongInt;Flags: LongInt;var Addr;var addrlen: Longint):LongInt; + begin + result := fprecvfrom(sock,@buf,buflen,flags,@addr,@addrlen); + end; + {$define socket := fpsocket} + function Bind(Sock: LongInt;const Addr;AddrLen: LongInt):Boolean; + begin + result := fpbind(sock,@addr,addrlen) = 0; + end; + function SetSocketOptions(Sock: LongInt;Level: LongInt;OptName: LongInt;const OptVal;optlen: LongInt):LongInt; + begin + result := fpsetsockopt(sock,level,optname,@optval,optlen); + end; + function Connect(Sock: LongInt;const Addr;Addrlen: LongInt):Boolean; + begin + result := fpconnect(sock,@addr,addrlen) >= 0; + end; + function listen(Sock: LongInt;MaxConnect: LongInt):Boolean; + begin + result := fplisten(sock,maxconnect) = 0; + end; + function GetPeerName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt; + begin + result := fpgetpeername(sock,@addr,@addrlen); + end; + function GetSocketName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt; + begin + result := fpgetsockname(sock,@addr,@addrlen); + end; + function Accept(Sock: LongInt; var Addr; var Addrlen: LongInt):LongInt; + begin + result := fpaccept(sock,@addr,@addrlen); + end; {$endif} {$endif} {$ifdef ver2_0} const IPPROTO_UDP=17; IPPROTO_ICMP=1; + {$define need_v6constants} {$endif} {$ifdef ver1_9} const @@ -110,6 +112,7 @@ result := invalue; {$endif} end; + {$define need_v6constants} {$endif} procedure gettimeofday(var tv:ttimeval);inline; begin @@ -147,4 +150,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} + +