+#
+## Function for fileposition initialization.
+#
+## This function is used to get the cursor position of the end of file (EOF) of
+## a specified file.
+#
+## In order to prevent from permanently read and keep files opened, or dealing
+## with huge logfiles, at initialization time of the worker processes, the file will
+## be opened once and the cursor position of the end of file (EOF) get stored.
+#
+sub _initFileposition ($) {
+ my $file = $_[0];
+
+ # Open the file.
+ open(FILE, $file) or die "Could not open $file. $!";
+
+ # Just seek to the end of the file (EOF).
+ seek(FILE, 0, 2);
+
+ # Get and store the position.
+ my $position = tell(FILE),
+
+ # Close the file again.
+ close(FILE);
+
+ # Return the position.
+ return $position;
+}
+