* More POSIX updates. Small changes to lseek and ftruncate in osposix.inc

Initial versions of the type includefiles
This commit is contained in:
marco 2002-08-04 04:29:34 +00:00
parent 5b4ccaedf6
commit 6088d82362
4 changed files with 207 additions and 27 deletions

View File

@ -128,32 +128,19 @@ begin
end;
function sys_lseek(fd : cint; offset : off_t; whence : cint): off_t;
{
this one is special for the return value being 64-bit..
hi/lo offset not yet tested.
{this one is special for the return value being 64-bit..
Have to test on 5.x to make it fully 64-bit}
NetBSD: ok, but implicit return value in edx:eax
FreeBSD: same implementation as NetBSD.
}
begin
{ugly implicit returnvalue}
do_syscall(syscall_nr___syscall,syscall_nr_lseek,0,longint(fd),0,Offset,0,Whence);
do_syscall(syscall_nr___syscall,syscall_nr_lseek,0,longint(fd),0,lo(Offset),{0} hi(offset),Whence);
end;
{ old code:
asm
pushl Whence
pushl $0 // high dword
pushl Off
pushl $0
pushl F
pushl $0 // Your guess is as good as mine. Pointer to ret val?
pushl $0xc7 // Actual lseek syscall number.
movl $0xc6,%eax
call actualsyscall
addl $28,%esp
mov %ebx,Errno
end;
}
function sys_read(fd: cint; buf: pchar; nbytes : size_t): ssize_t;
begin
@ -356,14 +343,14 @@ begin
do_syscall(syscall_nr_sigaction,longint(sig),longint(@act),longint(@oact));
end;
(*=================== MOVED from syslinux.inc ========================*)
(*=================== MOVED from sysunix.inc ========================*)
function sys_ftruncate(fd : cint; flength : off_t): cint;
{ See notes lseek. This one is completely similar.
{this one is special for the return value being 64-bit..}
}
begin
Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate,0,fd,0,flength,0);
Do_syscall(syscall_nr___syscall,syscall_nr_ftruncate,0,fd,0,lo(flength),hi(flength));
end;
function sys_fstat(fd : cint; var sb : stat): cint;
@ -440,7 +427,7 @@ function sys_access(const pathname : pchar; amode : cint): cint;
The test is done with the real user-ID, instead of the effective.
If access is denied, or an error occurred, false is returned.
If access is granted, true is returned.
Errors other than no access,are reported in linuxerror.
Errors other than no access,are reported in unixerror.
}
begin
@ -459,7 +446,7 @@ function sys_access(const pathname : pathstr; amode : cint): cint;
The test is done with the real user-ID, instead of the effective.
If access is denied, or an error occurred, false is returned.
If access is granted, true is returned.
Errors other than no access,are reported in linuxerror.
Errors other than no access,are reported in unixerror.
}
begin
@ -537,7 +524,11 @@ end;
{
$Log$
Revision 1.1 2002-08-03 19:34:19 marco
Revision 1.2 2002-08-04 04:29:34 marco
* More POSIX updates. Small changes to lseek and ftruncate in osposix.inc
Initial versions of the type includefiles
Revision 1.1 2002/08/03 19:34:19 marco
* Initial *BSD versions. Seems that OpenBSD doesn't need much change,
NetBSD may need some fixes to stat record and ftruncate and lseek.
It is all close together, and it should be doable to have just one copy

63
rtl/freebsd/ptypes.inc Normal file
View File

@ -0,0 +1,63 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2001 by Free Pascal development team
This file implements all the base types and limits required
for a minimal POSIX compliant subset required to port the compiler
to a new OS.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{***********************************************************************}
{ POSIX TYPE DEFINITIONS }
{***********************************************************************}
type
{ the following type definitions are compiler dependant }
{ and system dependant }
cint8 = shortint;
cuint8 = byte;
cuint16= word;
cint16 = smallint;
cint32 = longint;
cuint32= cardinal;
cint64 = int64;
{$ifndef VER_1_0}
cuint64= qword;
{$endif}
cint = longint; { minimum range is : 32-bit }
cuint = Cardinal; { minimum range is : 32-bit }
clong = longint;
culong = Cardinal;
dev_t = cuint32; { used for device numbers }
gid_t = cuint32; { used for group IDs }
ino_t = clong; { used for file serial numbers }
mode_t = cuint16; { used for file attributes }
nlink_t = cuint16; { used for link counts }
off_t = cint64; { used for file sizes }
pid_t = cint32; { used as process identifier }
size_t = cuint32; { as definied in the C standard}
ssize_t = cint32; { used by function for returning number of bytes }
uid_t = cuint32; { used for user ID type }
time_t = clong; { used for returning the time }
socklen_t= cuint32;
CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
ARG_MAX = 65536; {4096} { Maximum number of argument size }
NAME_MAX = 255; {14} { Maximum number of bytes in filename }
PATH_MAX = 1024; {255} { Maximum number of bytes in pathname }
SYS_NMLN = 32; {BSD utsname struct limit}

63
rtl/netbsd/ptypes.inc Normal file
View File

@ -0,0 +1,63 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2001 by Free Pascal development team
This file implements all the base types and limits required
for a minimal POSIX compliant subset required to port the compiler
to a new OS.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{***********************************************************************}
{ POSIX TYPE DEFINITIONS }
{***********************************************************************}
type
{ the following type definitions are compiler dependant }
{ and system dependant }
cint8 = shortint;
cuint8 = byte;
cuint16= word;
cint16 = smallint;
cint32 = longint;
cuint32= cardinal;
cint64 = int64;
{$ifndef VER_1_0}
cuint64= qword;
{$endif}
cint = longint; { minimum range is : 32-bit }
cuint = Cardinal; { minimum range is : 32-bit }
clong = longint;
culong = Cardinal;
dev_t = cuint32; { used for device numbers }
gid_t = cuint32; { used for group IDs }
ino_t = clong; { used for file serial numbers }
mode_t = cuint32; { used for file attributes }
nlink_t = cuint32; { used for link counts }
off_t = cint64; { used for file sizes }
pid_t = cint32; { used as process identifier }
size_t = cuint32; { as definied in the C standard}
ssize_t = cint32; { used by function for returning number of bytes }
uid_t = cuint32; { used for user ID type }
time_t = clong; { used for returning the time }
socklen_t= cuint32;
CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
ARG_MAX = (256*1024); {4096} { Maximum number of argument size }
NAME_MAX = 255; {14} { Maximum number of bytes in filename }
PATH_MAX = 1024; {255} { Maximum number of bytes in pathname }
SYS_NMLN = 32; {BSD utsname struct limit}

63
rtl/openbsd/ptypes.inc Normal file
View File

@ -0,0 +1,63 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2001 by Free Pascal development team
This file implements all the base types and limits required
for a minimal POSIX compliant subset required to port the compiler
to a new OS.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{***********************************************************************}
{ POSIX TYPE DEFINITIONS }
{***********************************************************************}
type
{ the following type definitions are compiler dependant }
{ and system dependant }
cint8 = shortint;
cuint8 = byte;
cuint16= word;
cint16 = smallint;
cint32 = longint;
cuint32= cardinal;
cint64 = int64;
{$ifndef VER_1_0}
cuint64= qword;
{$endif}
cint = longint; { minimum range is : 32-bit }
cuint = Cardinal; { minimum range is : 32-bit }
clong = longint;
culong = Cardinal;
dev_t = cint32; { used for device numbers }
gid_t = cuint32; { used for group IDs }
ino_t = cuint32; { used for file serial numbers }
mode_t = cuint16; { used for file attributes }
nlink_t = cuint16; { used for link counts }
off_t = cint64; { used for file sizes }
pid_t = cint32; { used as process identifier }
size_t = cuint32; { as definied in the C standard}
ssize_t = cint32; { used by function for returning number of bytes }
uid_t = cuint32; { used for user ID type }
time_t = clong; { used for returning the time }
socklen_t= cuint32;
CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
ARG_MAX = 256*1024;{4096} { Maximum number of argument size }
NAME_MAX = 255; {14} { Maximum number of bytes in filename }
PATH_MAX = 1024; {255} { Maximum number of bytes in pathname }
SYS_NMLN = 256; {BSD utsname struct limit}