unitfork: getfs was deprecated in fpc 2.6.2, use getfilehandle
[lcore.git] / unitfork.pas
old mode 100755 (executable)
new mode 100644 (file)
index cd008da..9e8503f
@@ -3,7 +3,9 @@
     which is included in the package\r
       ----------------------------------------------------------------------------- }\r
 unit unitfork;\r
     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
 interface\r
 \r
 procedure dofork(const programname:string);\r
@@ -17,7 +19,7 @@ uses
   {$ifdef VER1_0}\r
     linux,\r
   {$else}\r
   {$ifdef VER1_0}\r
     linux,\r
   {$else}\r
-    baseunix,unix,unixutil,\r
+    baseunix,unix,unixutil,sockets,\r
   {$endif}\r
   sysutils;\r
 \r
   {$endif}\r
   sysutils;\r
 \r
@@ -63,7 +65,11 @@ begin
     if ioresult <> 0 then exit;\r
   end;\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
   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
 \r
   //debugout('got handle');\r
   {check if locking is possible: it's not if other process still runs}\r