unitfork: getfs was deprecated in fpc 2.6.2, use getfilehandle
[lcore.git] / unitfork.pas
old mode 100755 (executable)
new mode 100644 (file)
index 5239fc0..9e8503f
@@ -1,9 +1,11 @@
-{ Copyright (C) 2005 Bas Steendijk and Peter Green
-  For conditions of distribution and use, see copyright notice in zlib_license.txt
-    which is included in the package
-      ----------------------------------------------------------------------------- }
+{ Copyright (C) 2005 Bas Steendijk and Peter Green\r
+  For conditions of distribution and use, see copyright notice in zlib_license.txt\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
@@ -17,9 +19,9 @@ uses
   {$ifdef VER1_0}\r
     linux,\r
   {$else}\r
-    baseunix,unix,unixutil,\r
+    baseunix,unix,unixutil,sockets,\r
   {$endif}\r
-  sysutils;
+  sysutils;\r
 \r
 {$include unixstuff.inc}\r
 \r
@@ -63,7 +65,11 @@ begin
     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