* libc's open() function is a varargs function

git-svn-id: trunk@29585 -
This commit is contained in:
Jonas Maebe 2015-01-30 19:31:25 +00:00
parent eb419b58c5
commit 16183bebfe
3 changed files with 20 additions and 14 deletions

View File

@ -117,11 +117,4 @@ function FpStat(path: pchar; var buf : stat): cint;inline;
FpStat:=__xstat(_STAT_VER,path,buf);
end;
{$ifndef fs32bit}
function FpOpen (path: pchar; flags : cint; mode: TMode):cint; inline;
begin
FpOpen:=__fpopen(path, flags or O_LARGEFILE, mode);
end;
{$endif}
{$endif FPC_USE_LIBC}

View File

@ -52,3 +52,20 @@ begin
FpFcntl:=real_FpFcntl(fildes, cmd, @arg);
end;
{ ********************************************************************* }
{ fpopen }
{ ********************************************************************* }
function real_FpOpen(path: pchar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
function FpOpen (path: pchar; flags : cint; mode: TMode):cint;
begin
{$if defined(linux) and defined(fs32bit)}
flags:=flags or O_LARGEFILE;
{$endif}
{ emulate what the bunxovl(h).inc version of fpopen does. Required because
existing code depends on this (it doesn't always pass a valid mode when
using fmCreate) }
FpOpen:=real_FpOpen(path,flags,mode);
end;

View File

@ -91,13 +91,9 @@ const
Function FpReaddir (var dirp : Dir) : pDirent;cdecl; external clib name 'readdir'+suffix64bit;
Function FpClosedir (var dirp : Dir): cInt; cdecl; external clib name 'closedir'{$ifdef aix}+suffix64bit{$endif};
function FpChdir (path : pchar): cint; cdecl; external clib name 'chdir';
function FpOpen (path: pchar; flags : cint; mode: TMode):cint;
{$if defined(linux) and not defined(fs32bit)}
{ we need a wrapper for linux to automatically pass O_LARGEFILE with flags }
{$ifdef FPC_IS_SYSTEM}forward;{$endif} inline;
function __FpOpen (path: pchar; flags : cint; mode: TMode):cint;
{$endif}
cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
{ emulate the bunxovl version that automatically passes
638 as mode }
function FpOpen (path: pchar; flags : cint; mode: TMode):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
function FpMkdir (path : pchar; mode: TMode):cint; cdecl; external clib name 'mkdir';
function FpUnlink (path: pchar): cint; cdecl; external clib name 'unlink';
function FpRmdir (path : pchar): cint; cdecl; external clib name 'rmdir';