* fpnanosleep exported in baseunix

* fpnanosleep has pointer arguments to be C compliant
This commit is contained in:
peter 2003-09-27 13:45:58 +00:00
parent f6868f8d48
commit ab5352d3f1
10 changed files with 211 additions and 176 deletions

View File

@ -164,7 +164,7 @@ begin
time_to_sleep.tv_sec := seconds;
time_to_sleep.tv_nsec := 0;
if (FPnanosleep(time_to_sleep, time_remaining) <> -1) Then
if (FPnanosleep(@time_to_sleep, @time_remaining) <> -1) Then
Exit(0);
if (geterrno <> ESysEINTR) Then
Exit (seconds); { best guess }
@ -469,7 +469,11 @@ end;
{
$Log$
Revision 1.3 2003-09-14 20:15:01 marco
Revision 1.4 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.3 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.2 2003/01/05 19:10:05 marco

View File

@ -532,10 +532,10 @@ begin
fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
end;
Function FpNanoSleep(const req : timespec;var rem : timespec) : longint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
Function FpNanoSleep(req : ptimespec;rem : ptimespec) : cint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
begin
{$ifndef darwin}
FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(@req),TSysParam(@rem));
FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(req),TSysParam(rem));
{$else not darwin}
{$warning: TODO: nanosleep!!!}
{$endif not darwin}
@ -599,8 +599,9 @@ end;
{
$Log$
Revision 1.11 2003-09-27 13:04:58 peter
* fpISxxx renamed
Revision 1.12 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.10 2003/09/20 12:38:29 marco
* FCL now compiles for FreeBSD with new 1.1. Now Linux.

View File

@ -24,14 +24,18 @@ Function FpIOCtl(Handle:cint;Ndx: culong;Data: Pointer):cint; external name 'F
Function FpGetPid:LongInt; external name 'FPC_SYSC_GETPID';
//Function FpReadLink(name,linkname:pchar;maxlen:longint):longint; external name 'FPC_SYSC_READLINK';
{ Needed in both POSIX (for implementation of sleep()) as POSIX realtime extensions or Unix/freebsd}
Function FpNanoSleep (const req : timespec;var rem : timespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
Function FpNanoSleep (req : ptimespec;rem : ptimespec) : cint; external name 'FPC_SYSC_NANOSLEEP';
{ can be used for getdir?}
Function Fpgetcwd (path:pchar; siz:size_t):pchar; external name 'FPC_SYSC_GETCWD';
{
$Log$
Revision 1.5 2003-09-20 12:38:29 marco
Revision 1.6 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.5 2003/09/20 12:38:29 marco
* FCL now compiles for FreeBSD with new 1.1. Now Linux.
Revision 1.4 2003/09/16 12:45:49 marco

View File

@ -22,13 +22,6 @@
}
Type
timespec = packed record
tv_sec : time_t;
tv_nsec : clong;
end;
ptimespec= ^timespec;
timezone = packed record
minuteswest,
dsttime : cint;
@ -74,7 +67,11 @@ Const
{
$Log$
Revision 1.4 2003-09-17 11:52:05 marco
Revision 1.5 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.4 2003/09/17 11:52:05 marco
* stat macro fixes voor BSD
Revision 1.3 2003/09/15 07:23:51 marco

View File

@ -82,6 +82,13 @@ type
ptimeval = ^timeval;
TTimeVal = timeval;
timespec = packed record
tv_sec : time_t;
tv_nsec : clong;
end;
ptimespec= ^timespec;
Ttimespec= timespec;
CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
ARG_MAX = 65536; {4096} { Maximum number of argument size }
@ -92,7 +99,11 @@ CONST
{
$Log$
Revision 1.6 2003-09-14 20:15:01 marco
Revision 1.7 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.6 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.5 2003/01/03 13:11:32 marco

View File

@ -185,7 +185,7 @@ begin
End;
if oact.sa_handler=signalhandler(SIG_IGN) Then
Begin
fpsleep:=fpnanosleep(time_to_sleep, @time_remaining);
fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining);
oerrno:=geterrno;
fpsigprocmask(SIG_SETMASK,@oset,NIL);
seterrno(oerrno);
@ -193,11 +193,11 @@ begin
Else
Begin
fpsigprocmask(SIG_SETMASK,@oset,NIL);
fpsleep:=fpnanosleep(time_to_sleep, @time_remaining)
fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining)
End;
end
else
fpsleep:=fpnanosleep(time_to_sleep, @time_remaining);
fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining);
if fpsleep<>0 Then
if time_remaining.tv_nsec>=500000000 Then
inc(fpsleep);
@ -433,7 +433,11 @@ end;
{
$Log$
Revision 1.4 2003-09-17 11:24:46 marco
Revision 1.5 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.4 2003/09/17 11:24:46 marco
* fixes for new macro's
Revision 1.3 2003/09/14 20:15:01 marco

View File

@ -436,16 +436,15 @@ begin
Fpreadlink:=do_syscall(syscall_nr_readlink, TSysParam(name),TSysParam(linkname),maxlen);
end;
Function FpNanoSleep(const req : timespec;rem : ptimespec) : longint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
begin
FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(@req),TSysParam(rem));
FpNanoSleep:=Do_SysCall(syscall_nr_nanosleep,TSysParam(req),TSysParam(rem));
end;
// The following belongs here, but this should be researched more.
// function Fpgetcwd(pt:pchar; _size:size_t):pchar;[public, alias :'FPC_SYSC_GETCWD'];
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias:
'FPC_SYSC_GETTIMEOFDAY'];
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; [public, alias: 'FPC_SYSC_GETTIMEOFDAY'];
begin
fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
@ -455,7 +454,11 @@ end;
{
$Log$
Revision 1.7 2003-09-27 12:58:23 peter
Revision 1.8 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.7 2003/09/27 12:58:23 peter
* mmap returns -1 on error
Revision 1.6 2003/09/27 11:52:35 peter

View File

@ -20,12 +20,16 @@ Function Fpmunmap(adr:pointer;len:size_t):cint; external name 'FPC_SYSC_MUNMAP';
Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint; external name 'FPC_SYSC_IOCTL';
Function FpGetPid:pid_t; external name 'FPC_SYSC_GETPID';
Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name 'FPC_SYSC_READLINK';
Function FpNanoSleep(const req : timespec;rem : ptimespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
Function FpNanoSleep(req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
{
$Log$
Revision 1.4 2003-09-20 15:10:30 marco
Revision 1.5 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.4 2003/09/20 15:10:30 marco
* small fixes. fcl now compiles
Revision 1.3 2003/09/15 20:29:50 marco

View File

@ -44,13 +44,6 @@ Type
PSysCallRegs= ^SysCallRegs;
TSysCallRegs= SysCallRegs;
ptimespec = ^timespec;
timespec = packed record
tv_sec : time_t;
tv_nsec : clong;
end;
timezone = packed record
minuteswest,dsttime:longint;
end;
@ -69,7 +62,11 @@ Const // generated by statmacr.c
{
$Log$
Revision 1.4 2003-09-17 11:24:46 marco
Revision 1.5 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.4 2003/09/17 11:24:46 marco
* fixes for new macro's
Revision 1.3 2003/09/14 20:15:01 marco

View File

@ -113,6 +113,12 @@ Type
ptimeval = ^timeval;
TTimeVal = timeval;
timespec = packed record
tv_sec : time_t;
tv_nsec : clong;
end;
ptimespec = ^timespec;
TTimeSpec = timespec;
CONST
{ System limits, POSIX value in parentheses, used for buffer and stack allocation }
@ -125,7 +131,11 @@ CONST
{
$Log$
Revision 1.4 2003-09-14 20:15:01 marco
Revision 1.5 2003-09-27 13:45:58 peter
* fpnanosleep exported in baseunix
* fpnanosleep has pointer arguments to be C compliant
Revision 1.4 2003/09/14 20:15:01 marco
* Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
Revision 1.3 2002/12/18 16:43:26 marco