Browse Source

--- Merging r37135 into '.':
C utils/fpcm/revision.inc
C rtl/objpas/sysutils/filutil.inc
U rtl/objpas/sysutils/filutilh.inc
U rtl/win/sysutils.pp
U rtl/unix/sysutils.pp
--- Recording mergeinfo for merge of r37135 into '.':
U .
Summary of conflicts:
Text conflicts: 2

# revisions: 37135

git-svn-id: branches/fixes_3_0@37138 -

marco 8 years ago
parent
commit
7be5479e9e
4 changed files with 22 additions and 0 deletions
  1. 6 0
      rtl/objpas/sysutils/filutil.inc
  2. 1 0
      rtl/objpas/sysutils/filutilh.inc
  3. 7 0
      rtl/unix/sysutils.pp
  4. 8 0
      rtl/win/sysutils.pp

+ 6 - 0
rtl/objpas/sysutils/filutil.inc

@@ -542,3 +542,9 @@ begin
   InternalFindClose(f.FindHandle{$ifdef USEFINDDATA},f.FindData{$endif});
 end;
 
+{$ifndef SYSUTILS_HAS_FILEFLUSH_IMPL}
+function FileFlush(Handle: THandle): Boolean;
+begin
+  Result:= False;
+end;
+{$endif}

+ 1 - 0
rtl/objpas/sysutils/filutilh.inc

@@ -168,6 +168,7 @@ Function FileRead (Handle : THandle; out Buffer; Count : longint) : Longint;
 Function FileWrite (Handle : THandle; const Buffer; Count : Longint) : Longint;
 Function FileSeek (Handle : THandle; FOffset, Origin: Longint) : Longint;
 Function FileSeek (Handle : THandle; FOffset: Int64; Origin: Longint) : Int64;
+function FileFlush(Handle: THandle): Boolean; 
 Procedure FileClose (Handle : THandle);
 Function FileTruncate (Handle : THandle;Size: Int64) : boolean;
 Function FindNext (Var Rslt : TRawByteSearchRec) : Longint;

+ 7 - 0
rtl/unix/sysutils.pp

@@ -38,6 +38,9 @@ interface
 {$DEFINE HAS_LOCALTIMEZONEOFFSET}
 {$DEFINE HAS_GETTICKCOUNT64}
 
+// this target has an fileflush implementation, don't include dummy
+{$DEFINE SYSUTILS_HAS_FILEFLUSH_IMPL}
+
 { used OS file system APIs use ansistring }
 {$define SYSUTILS_HAS_ANSISTR_FILEUTIL_IMPL}
 { OS has an ansistring/single byte environment variable API }
@@ -458,6 +461,10 @@ begin
   FileOpen:=DoFileLocking(FileOpen, Mode);
 end;
 
+function FileFlush(Handle: THandle): Boolean;
+begin
+  Result:= fpfsync(handle)=0;
+end;
 
 Function FileCreate (Const FileName : RawByteString) : Longint;
 

+ 8 - 0
rtl/win/sysutils.pp

@@ -37,6 +37,9 @@ uses
 {$DEFINE HAS_GETTICKCOUNT64}
 {$DEFINE OS_FILESETDATEBYNAME}
 
+// this target has an fileflush implementation, don't include dummy
+{$DEFINE SYSUTILS_HAS_FILEFLUSH_IMPL}
+
 { used OS file system APIs use unicodestring }
 {$define SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL}
 { OS has an ansistring/single byte environment variable API }
@@ -283,6 +286,11 @@ const
                FILE_SHARE_READ or FILE_SHARE_WRITE);
 
 
+function FileFlush(Handle: THandle): Boolean;
+begin
+  Result:= FlushFileBuffers(Handle);
+end;
+
 Function FileOpen (Const FileName : unicodestring; Mode : Integer) : THandle;
 begin
   result := CreateFileW(PWideChar(FileName), dword(AccessMode[Mode and 3]),