Browse Source

rtl-extra/amiga: fixed SocketBase to be a threadvar, also added Obtain/Release/ReleaseCopyOfSocket() functions, which are required to Amiga to pass socket descriptors among threads (processes)

git-svn-id: trunk@30994 -
Károly Balogh 10 years ago
parent
commit
a8f875e660
1 changed files with 10 additions and 1 deletions
  1. 10 1
      packages/rtl-extra/src/amiga/sockets.pp

+ 10 - 1
packages/rtl-extra/src/amiga/sockets.pp

@@ -110,7 +110,7 @@ Function Accept(Sock:longint;var addr:string;var SockIn,SockOut:File):Boolean;
 //function  fpbind      (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;  maybelibc
 //function  fpbind      (s:cint; addrx : psockaddr; addrlen : tsocklen):cint;  maybelibc
 //function  fpconnect     (s:cint; name  : psockaddr; namelen : tsocklen):cint;  maybelibc
 //function  fpconnect     (s:cint; name  : psockaddr; namelen : tsocklen):cint;  maybelibc
 
 
-var
+threadvar
   SocketBase: PLibrary;
   SocketBase: PLibrary;
 
 
 function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall SocketBase 30;
 function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall SocketBase 30;
@@ -134,6 +134,15 @@ function bsd_inet_addr(const cp: PChar location 'a0'): LongWord; syscall SocketB
 function bsd_gethostbyname(const Name: PChar location 'a0'): PHostEnt; syscall SocketBase 210;
 function bsd_gethostbyname(const Name: PChar location 'a0'): PHostEnt; syscall SocketBase 210;
 function bsd_gethostbyaddr(const Addr: PByte location 'a0'; Len: LongInt location 'd0'; Type_: LongInt location 'd1'): PHostEnt; syscall SocketBase 216;
 function bsd_gethostbyaddr(const Addr: PByte location 'a0'; Len: LongInt location 'd0'; Type_: LongInt location 'd1'): PHostEnt; syscall SocketBase 216;
 
 
+{ Definition for Release(CopyOf)Socket unique id }
+const
+  UNIQUE_ID = -1;
+
+{ Amiga-specific functions for passing socket descriptors between threads (processes) }
+function ObtainSocket(id: LongInt location 'd0'; domain: LongInt location 'd1'; _type: LongInt location 'd2'; protocol: LongInt location 'd3'): LongInt; syscall SocketBase 144;
+function ReleaseSocket(s: LongInt location 'd0'; id: LongInt location 'd1'): LongInt; syscall SocketBase 150;
+function ReleaseCopyOfSocket(s: LongInt location 'd0'; id: LongInt location 'd1'): LongInt; syscall SocketBase 156;
+
 Implementation
 Implementation
 
 
 threadvar internal_socketerror: cint;
 threadvar internal_socketerror: cint;