4 {$define tv_sec := sec}
\r
5 {$define tv_usec := usec}
\r
6 function dup(const original:integer):integer;inline;
\r
8 linux.dup(original,result);
\r
10 {$define gettimeofdaysec := gettimeofday}
\r
14 function ntohs(invalue:word):word;inline;
\r
16 invaluebytes : array[0..1] of byte absolute invalue;
\r
17 resultbytes : array[0..1] of byte absolute result;
\r
19 {$ifdef endian_little}
\r
20 resultbytes[0] := invaluebytes[1];
\r
21 resultbytes[1] := invaluebytes[0];
\r
28 {$define sigprocmask := fpsigprocmask}
\r
29 {$define sigaction := fpsigaction}
\r
30 {$define fdclose := fpclose}
\r
31 {$define fcntl := fpfcntl}
\r
32 {$define fdwrite := fpwrite}
\r
33 {$define fdread := fpread}
\r
34 {$define fdopen := fpopen}
\r
35 {$define select := fpselect}
\r
36 {$define linuxerror := fpgeterrno}
\r
37 {$define fork := fpfork}
\r
38 {$define getpid := fpgetpid}
\r
39 {$define getenv := fpgetenv}
\r
40 {$define chmod := fpchmod}
\r
41 {$define dup2 := fpdup2}
\r
43 {$define flock := fpflock}
\r
45 procedure Execl(Todo:string);inline;
\r
49 p := unixutil.StringToPPChar(Todo,1);
\r
50 if (p=nil) or (p^=nil) then exit;
\r
53 function SendTo(Sock: LongInt; const Buf;BufLen: LongInt;Flags: LongInt;var Addr;AddrLen: LongInt):LongInt;
55 result := fpsendto(sock,@buf,buflen,flags,@addr,addrlen);
57 function RecvFrom(Sock: LongInt;var Buf;Buflen: LongInt;Flags: LongInt;var Addr;var addrlen: Longint):LongInt;
59 result := fprecvfrom(sock,@buf,buflen,flags,@addr,@addrlen);
61 {$define socket := fpsocket}
62 function Bind(Sock: LongInt;const Addr;AddrLen: LongInt):Boolean;
64 result := fpbind(sock,@addr,addrlen) = 0;
66 function SetSocketOptions(Sock: LongInt;Level: LongInt;OptName: LongInt;const OptVal;optlen: LongInt):LongInt;
68 result := fpsetsockopt(sock,level,optname,@optval,optlen);
70 function Connect(Sock: LongInt;const Addr;Addrlen: LongInt):Boolean;
72 result := fpconnect(sock,@addr,addrlen) >= 0;
74 function listen(Sock: LongInt;MaxConnect: LongInt):Boolean;
76 result := fplisten(sock,maxconnect) = 0;
78 function GetPeerName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt;
80 result := fpgetpeername(sock,@addr,@addrlen);
82 function GetSocketName(Sock: LongInt; var Addr;var Addrlen: LongInt):LongInt;
84 result := fpgetpeername(sock,@addr,@addrlen);
86 function Accept(Sock: LongInt; var Addr; var Addrlen: LongInt):LongInt;
88 result := fpaccept(sock,@addr,@addrlen);
101 function ntohs(invalue:word):word;inline;
\r
103 invaluebytes : array[0..1] of byte absolute invalue;
\r
104 resultbytes : array[0..1] of byte absolute result;
\r
106 {$ifdef endian_little}
\r
107 resultbytes[0] := invaluebytes[1];
\r
108 resultbytes[1] := invaluebytes[0];
\r
114 procedure gettimeofday(var tv:ttimeval);inline;
\r
116 fpgettimeofday(@tv,nil);
\r
118 function gettimeofdaysec : longint;
\r
123 result := tv.tv_sec;
\r
126 //a function is used here rather than a define to prevent issues with tlasio.dup
\r
127 function dup(const original:integer):integer;inline;
\r
129 result := fpdup(original);
\r
131 function octal(invalue:longint):longint;
\r
138 while invalue <> 0 do begin
\r
139 a := invalue mod 10;
\r
140 result := result + (a shl (i*3));
\r
142 invalue := invalue div 10;
\r
147 sys_eintr=esyseintr;
\r