* pwrite/writev for *BSD + FPC_USE_LIBC. Requires IOVEC et al to be defined in ostypes.inc

git-svn-id: trunk@2734 -
This commit is contained in:
marco 2006-03-04 14:21:42 +00:00
parent 8f6b52d482
commit 6f0e817973
4 changed files with 62 additions and 9 deletions

View File

@ -533,3 +533,53 @@ begin
fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
end;
function Fppread(fd: cint; buf: pchar; nbytes : size_t; offset:Toff): ssize_t; [public, alias : 'FPC_SYSC_PREAD'];
begin
{$ifdef CPU64}
Fppread:=do_syscall(syscall_nr_pread,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
{$ifdef CPU64}
Fppwrite:=do_syscall(syscall_nr_pwrite,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

@ -88,8 +88,6 @@ const
syscall_nr_getpriority =100;
syscall_nr_setsockopt =105;
syscall_nr_gettimeofday =116;
syscall_nr_readv =120;
syscall_nr_writev =121;
syscall_nr_fchown =123;
syscall_nr_fchmod =124;
@ -112,8 +110,7 @@ const
syscall_nr_uname =164;
syscall_nr_rtprio =166;
syscall_nr_pread =173;
syscall_nr_pwrite =174;
syscall_nr_ntp_adjtime =176;
syscall_nr_setegid =182;
syscall_nr_seteuid =183;
@ -228,7 +225,11 @@ syscall_nr_getdirentries =196;
}
{More or less checked BSD syscalls}
{More or less checked/in use FreeBSD syscalls}
syscall_nr_readv =120;
syscall_nr_writev =121;
syscall_nr_pread =173;
syscall_nr_pwrite =174;
syscall_nr_semsys =169;
syscall_nr_msgsys =170;
syscall_nr_shmsys =171;

View File

@ -79,15 +79,12 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function FpClose (fd : cInt): cInt; external name 'FPC_SYSC_CLOSE';
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 FpReadV (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
{$endif}
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 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';
Function FpFtruncate (fd : cInt; flength : TOff): cInt; external name 'FPC_SYSC_FTRUNCATE';

View File

@ -112,3 +112,8 @@ Type TGrpArr = Array [0..0] of TGid; { C style array workarounds}
Function fpLstat (path:pchar;Info:pstat):cint; cdecl; external clib name 'lstat';
function FpStat (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat';
{$endif linux}
Function FpPRead (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize; cdecl; external clib name 'pread';
function FpReadV (fd: cint; const iov : piovec; iovcnt : cint):TSSize; cdecl; external clib name 'readv';
Function FpPWrite (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize; cdecl; external clib name 'pwrite';
function FpWriteV (fd: cint; const iov : piovec; iovcnt : cint):TSSize; cdecl; external clib name 'writev';