* commit of the syscall based linux support for pwrite/writev, still under

{$ifdef linux}. This to fix x86_64 breakage.

git-svn-id: trunk@2731 -
This commit is contained in:
marco 2006-03-04 12:40:45 +00:00
parent e176f81527
commit 24c0b496dd
2 changed files with 45 additions and 5 deletions

View File

@ -533,12 +533,50 @@ end;
function Fppread(fd: cint; buf: pchar; nbytes : size_t; offset:Toff): ssize_t; [public, alias : 'FPC_SYSC_PREAD'];
begin
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,offset,0);
{$ifdef CPU64}
Fppread:=do_syscall(syscall_nr_pread64,Fd,TSysParam(buf),nbytes,TSysParam(OffSet});
{$else}
Fppread:=do_syscall(syscall_nr_pread,Fd,TSysParam(buf),nbytes,
{$ifdef 64bitfs}
{$ifdef FPC_BIG_ENDIAN} hi(offset),lo(offset){$endif}
{$ifdef FPC_LITTLE_ENDIAN} lo(offset),hi(offset){$endif}
{$else}
{$ifdef FPC_BIG_ENDIAN} 0,lo(offset){$endif}
{$ifdef FPC_LITTLE_ENDIAN} lo(offset),0{$endif}
{$endif}
);
{$endif}
end;
function Fppwrite(fd: cint;buf:pchar; nbytes : size_t; offset:Toff): ssize_t; [public, alias : 'FPC_SYSC_PWRITE'];
begin
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,offset,0);
{$ifdef CPU64}
Fppwrite:=do_syscall(syscall_nr_pwrite64,Fd,TSysParam(buf),nbytes,TSysParam(OffSet});
{$else}
Fppwrite:=do_syscall(syscall_nr_pwrite,Fd,TSysParam(buf),nbytes,
// ,0 = possible alignment here.
{$ifdef 64bitfs}
{$ifdef FPC_BIG_ENDIAN} hi(offset),lo(offset){$endif}
{$ifdef FPC_LITTLE_ENDIAN} lo(offset),hi(offset){$endif}
{$else}
{$ifdef FPC_BIG_ENDIAN} 0,lo(offset){$endif}
{$ifdef FPC_LITTLE_ENDIAN} lo(offset),0{$endif}
{$endif}
);
{$endif}
end;
function Fpreadv(fd: cint; const iov : piovec; iovcnt : cint):ssize_t; [public, alias : 'FPC_SYSC_READV'];
begin
Fpreadv:=do_syscall(syscall_nr_readv,Fd,TSysParam(iov),iovcnt);
end;
function Fpwritev(fd: cint; const iov : piovec; iovcnt : cint):ssize_t; [public, alias : 'FPC_SYSC_WRITEV'];
begin
Fpwritev:=do_syscall(syscall_nr_writev,Fd,TSysParam(iov),iovcnt);
end;

View File

@ -80,11 +80,13 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FpRead (fd : cInt; buf: pChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_READ';
{$ifdef linux}
Function FppRead (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;
Function FpPRead (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;
function FpReadV (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
{$endif}
Function FpWrite (fd : cInt; buf:pChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_WRITE';
Function FpWrite (fd : cInt; buf:pChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_WRITE';
{$ifdef linux}
Function FppWrite (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSsize;
Function FpPWrite (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize;
function FpWriteV (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
{$endif}
Function FpLseek (fd : cInt; offset : TOff; whence : cInt): TOff; external name 'FPC_SYSC_LSEEK';
Function FpTime (var tloc : TTime): TTime; external name 'FPC_SYSC_TIME';