mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 07:08:29 +02:00
haiku: update baseunix unit, remove syscalls code, flock() and nanosleep() is actually supported on Haiku for a long time now, so lets use it
git-svn-id: trunk@40823 -
This commit is contained in:
parent
66dc27d6b6
commit
e547dfa837
@ -25,39 +25,22 @@ Uses UnixType;
|
||||
|
||||
{$packrecords C}
|
||||
|
||||
{$ifndef FPC_USE_LIBC}
|
||||
{$define FPC_USE_SYSCALL}
|
||||
{$endif}
|
||||
|
||||
{$i errno.inc} { Error numbers }
|
||||
{$i ostypes.inc}
|
||||
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
const clib = 'root';
|
||||
const netlib = 'network';
|
||||
{$i oscdeclh.inc}
|
||||
{$ELSE}
|
||||
{$i bunxh.inc} { Functions}
|
||||
{$ENDIF}
|
||||
const
|
||||
clib = 'root';
|
||||
netlib = 'network';
|
||||
|
||||
function fpgeterrno:longint;
|
||||
procedure fpseterrno(err:longint);
|
||||
{$i oscdeclh.inc}
|
||||
|
||||
{$ifndef ver1_0}
|
||||
property errno : cint read fpgeterrno write fpseterrno;
|
||||
{$endif}
|
||||
function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
|
||||
procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
|
||||
property errno : cint read fpgeterrno write fpseterrno;
|
||||
|
||||
{$i bunxovlh.inc}
|
||||
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
{$ifdef beos}
|
||||
function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
|
||||
Function fpFlock (var fd : text; mode : longint) : cint;
|
||||
Function fpFlock (var fd : File; mode : longint) : cint;
|
||||
Function fpFlock (fd, mode : longint) : cint;
|
||||
Function FpNanoSleep (req : ptimespec;rem : ptimespec):cint;
|
||||
{$endif}
|
||||
{$endif}
|
||||
function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
|
||||
|
||||
{$i genfunch.inc}
|
||||
|
||||
@ -73,7 +56,7 @@ Const
|
||||
|
||||
// MAP_ANON(YMOUS) is OS dependant but used in the RTL and in ostypes.inc
|
||||
// Under BSD without -YMOUS, so alias it:
|
||||
MAP_ANON = MAP_ANONYMOUS;
|
||||
MAP_ANON = MAP_ANONYMOUS;
|
||||
|
||||
PROT_READ = $1; { page can be read }
|
||||
PROT_WRITE = $2; { page can be written }
|
||||
@ -90,70 +73,18 @@ Uses Sysctl;
|
||||
{$I gensigset.inc} // general sigset funcs implementation.
|
||||
{$I genfdset.inc} // general fdset funcs.
|
||||
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
{$i oscdecl.inc} // implementation of wrappers in oscdeclh.inc
|
||||
{$else}
|
||||
{$i syscallh.inc} // do_syscall declarations themselves
|
||||
{$i sysnr.inc} // syscall numbers.
|
||||
{$i bsyscall.inc} // cpu specific syscalls
|
||||
{$i bunxsysc.inc} // syscalls in system unit.
|
||||
// {$i settimeo.inc}
|
||||
{$endif}
|
||||
{$i settimeo.inc}
|
||||
{$i oscdecl.inc} // implementation of wrappers in oscdeclh.inc
|
||||
|
||||
{$i osmacro.inc} { macro implenenations }
|
||||
{$i bunxovl.inc} { redefs and overloads implementation }
|
||||
|
||||
{$ifndef ver1_0}
|
||||
function fpgeterrno:longint; external name 'FPC_SYS_GETERRNO';
|
||||
procedure fpseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
|
||||
{$else}
|
||||
// workaround for 1.0.10 bugs.
|
||||
|
||||
function intgeterrno:longint; external name 'FPC_SYS_GETERRNO';
|
||||
procedure intseterrno(err:longint); external name 'FPC_SYS_SETERRNO';
|
||||
|
||||
function fpgeterrno:longint;
|
||||
begin
|
||||
fpgeterrno:=intgeterrno;
|
||||
end;
|
||||
|
||||
procedure fpseterrno(err:longint);
|
||||
begin
|
||||
intseterrno(err);
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
function stime(t: ptime_t): cint; cdecl; external clib name 'stime';
|
||||
|
||||
function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
|
||||
begin
|
||||
fpsettimeofday := settimeofday(tp, tzp);
|
||||
fpsettimeofday:=stime(@tp^.tv_sec);
|
||||
end;
|
||||
|
||||
Function fpFlock (var fd : File; mode : longint) : cint;
|
||||
begin
|
||||
{$warning TODO BeOS fpFlock implementation}
|
||||
end;
|
||||
|
||||
Function fpFlock (var fd : Text; mode : longint) : cint;
|
||||
begin
|
||||
{$warning TODO BeOS fpFlock implementation}
|
||||
end;
|
||||
|
||||
Function fpFlock (fd, mode : longint) : cint;
|
||||
begin
|
||||
{$warning TODO BeOS fpFlock implementation}
|
||||
end;
|
||||
|
||||
function snooze(microseconds : bigtime_t) : status_t; cdecl; external 'root' name 'snooze';
|
||||
|
||||
Function FpNanoSleep (req : ptimespec;rem : ptimespec):cint;
|
||||
begin
|
||||
case snooze((req^.tv_nsec div 1000) + (req^.tv_sec * 1000 * 1000)) of
|
||||
B_OK : FpNanoSleep := 0;
|
||||
B_INTERRUPTED : FpNanoSleep := - 1;
|
||||
else
|
||||
FpNanoSleep := - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -126,7 +126,7 @@ const
|
||||
Function FPSigaction (sig: cInt; act :pSigActionRec;oact:pSigActionRec):cint;cdecl; external clib name 'sigaction';
|
||||
{$ifdef beos}
|
||||
{$ifdef haiku}
|
||||
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external 'network' name 'select';
|
||||
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external 'network' name 'select';
|
||||
Function FpPoll (fds: ppollfd; nfds: cuint; timeout: clong): cint; cdecl; external clib name 'poll';
|
||||
{$else}
|
||||
Function FPSelect (N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; cdecl; external 'net' name 'select';
|
||||
@ -144,9 +144,8 @@ const
|
||||
{$linklib aio}
|
||||
Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external 'rt' name 'nanosleep';
|
||||
{$else solaris}
|
||||
{$ifndef beos}
|
||||
{$if not defined(beos) or defined(haiku)}
|
||||
Function FPnanosleep (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
|
||||
{$else}
|
||||
{$endif}
|
||||
{$endif solaris}
|
||||
Function fpSymlink (oldname,newname:pchar):cint; cdecl; external clib name 'symlink';
|
||||
@ -159,7 +158,7 @@ const
|
||||
function fpmunmap (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
|
||||
|
||||
function fpgetenv (name : pchar):pchar; cdecl; external clib name 'getenv';
|
||||
{$ifndef beos}
|
||||
{$ifndef beos}
|
||||
function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
|
||||
{$else}
|
||||
// function fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
|
||||
|
@ -18,7 +18,7 @@ type filedesarray=array[0..1] of cint;
|
||||
{$if defined(solaris) or defined(aix)}
|
||||
Function fpFlock (fd,mode : longint) : cint;{$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
|
||||
{$else solaris or aix}
|
||||
{$ifndef beos}
|
||||
{$if not defined(beos) or defined(haiku)}
|
||||
Function fpFlock (fd,mode : longint) : cint; cdecl; external clib name 'flock';
|
||||
{$endif beos}
|
||||
{$endif solaris or aix}
|
||||
|
Loading…
Reference in New Issue
Block a user