which is included in the package\r
       ----------------------------------------------------------------------------- }\r
 unit unitfork;\r
-\r
+{$ifdef fpc}\r
+  {$mode delphi}\r
+{$endif}\r
 interface\r
 \r
 procedure dofork(const programname:string);\r
   {$ifdef VER1_0}\r
     linux,\r
   {$else}\r
-    baseunix,unix,unixutil,\r
+    baseunix,unix,unixutil,sockets,\r
   {$endif}\r
   sysutils;\r
 \r
     if ioresult <> 0 then exit;\r
   end;\r
 \r
+  {$IF FPC_FULLVERSION>=20602}\r
+  handle := getfilehandle(pidfile);\r
+  {$else}\r
   handle := getfs(pidfile);\r
+  {$endif}\r
 \r
   //debugout('got handle');\r
   {check if locking is possible: it's not if other process still runs}\r