From ab5352d3f1da44f6ef6107c68cd43263f2425bdb Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 27 Sep 2003 13:45:58 +0000 Subject: [PATCH] * fpnanosleep exported in baseunix * fpnanosleep has pointer arguments to be C compliant --- rtl/bsd/bunxfunc.inc | 96 ++++++++++++++++++----------------- rtl/bsd/ossysc.inc | 9 ++-- rtl/bsd/ossysch.inc | 8 ++- rtl/bsd/ostypes.inc | 65 ++++++++++++------------ rtl/freebsd/ptypes.inc | 13 ++++- rtl/linux/bunxfunc.inc | 110 +++++++++++++++++++++-------------------- rtl/linux/ossysc.inc | 17 ++++--- rtl/linux/ossysch.inc | 8 ++- rtl/linux/ostypes.inc | 31 ++++++------ rtl/linux/ptypes.inc | 30 +++++++---- 10 files changed, 211 insertions(+), 176 deletions(-) diff --git a/rtl/bsd/bunxfunc.inc b/rtl/bsd/bunxfunc.inc index 13d5d69b96..18804b13b1 100644 --- a/rtl/bsd/bunxfunc.inc +++ b/rtl/bsd/bunxfunc.inc @@ -16,13 +16,13 @@ **********************************************************************} -{$i syscallh.inc} // do_syscall declarations themselves -{$i sysnr.inc} // syscall numbers. -{$i ossysch.inc} // external interface to syscalls in system unit. -{$i genfuncs.inc} // generic calls. (like getenv) +{$i syscallh.inc} // do_syscall declarations themselves +{$i sysnr.inc} // syscall numbers. +{$i ossysch.inc} // external interface to syscalls in system unit. +{$i genfuncs.inc} // generic calls. (like getenv) -{$I gensigset.inc} // general sigset funcs implementation. +{$I gensigset.inc} // general sigset funcs implementation. {$I genfdset.inc} // general fdset funcs. { $ ifndef ver1_0} @@ -126,7 +126,7 @@ function sigblock(mask:cuint):cint; var nset,oset: sigset_t; begin - FPsigemptyset(nset); + FPsigemptyset(nset); nset[0]:=mask; sigblock:= FPsigprocmask(SIG_BLOCK,@nset,@oset); // SIG_BLOCK=1 if sigblock=0 Then @@ -139,7 +139,7 @@ function sigpause(sigmask:cint):cint; var nset: sigset_t; begin - FPsigemptyset(nset); + FPsigemptyset(nset); nset[0]:=sigmask; sigpause:= FPsigsuspend(nset); end; @@ -155,21 +155,21 @@ function FPsleep(seconds:cuint):cuint; var time_to_sleep,time_remaining : timespec; begin - { - * Avoid overflow when `seconds' is huge. This assumes that - * the maximum value for a time_t is >= INT_MAX. - } - if seconds > high(cint) Then - FPsleep:= (seconds - high(cint)) + FPsleep(HIGH(cint)); + { + * Avoid overflow when `seconds' is huge. This assumes that + * the maximum value for a time_t is >= INT_MAX. + } + if seconds > high(cint) Then + FPsleep:= (seconds - high(cint)) + FPsleep(HIGH(cint)); - time_to_sleep.tv_sec := seconds; - time_to_sleep.tv_nsec := 0; - if (FPnanosleep(time_to_sleep, time_remaining) <> -1) Then - Exit(0); - if (geterrno <> ESysEINTR) Then - Exit (seconds); { best guess } - FPsleep:= time_remaining.tv_sec; - if (time_remaining.tv_nsec <> 0) Then + time_to_sleep.tv_sec := seconds; + time_to_sleep.tv_nsec := 0; + if (FPnanosleep(@time_to_sleep, @time_remaining) <> -1) Then + Exit(0); + if (geterrno <> ESysEINTR) Then + Exit (seconds); { best guess } + FPsleep:= time_remaining.tv_sec; + if (time_remaining.tv_nsec <> 0) Then inc(FPsleep); End; @@ -220,27 +220,27 @@ function GetDomainName(Name:PChar; NameLen:Cint):cint; [public,alias:'FPC_SYSC_G Const Mib_GetDomainName : array[0..1] of cint=(CTL_KERN,KERN_NISDOMAINNAME); VAR - tsize : size_t; + tsize : size_t; begin - tsize := namelen; - if (FPsysctl(@Mib_GetDomainname, 2, name, @tsize, NIL, 0) = -1) Then + tsize := namelen; + if (FPsysctl(@Mib_GetDomainname, 2, name, @tsize, NIL, 0) = -1) Then GetDomainName:=-1 Else GetDomainName:=0; -end; +end; function GetHostName(Name:PChar; NameLen:Cint):cint;[public,alias:'FPC_SYSC_GETHOSTNAME']; Const Mib_GetHostName : array[0..1] of cint=(CTL_KERN,KERN_HOSTNAME); Var - tsize : size_t; + tsize : size_t; begin - tsize := namelen; - if (FPsysctl(@Mib_GetHostName, 2, name, @tsize, NIL, 0) = -1) Then - GetHostName:=-1 - Else - GetHostName:=0; + tsize := namelen; + if (FPsysctl(@Mib_GetHostName, 2, name, @tsize, NIL, 0) = -1) Then + GetHostName:=-1 + Else + GetHostName:=0; End; const WAIT_ANY = -1; @@ -374,7 +374,7 @@ begin tv[0].tv_sec :=times^.actime; tv[1].tv_sec :=times^.modtime; tv[0].tv_usec:=0; - tv[1].tv_usec:=0; + tv[1].tv_usec:=0; tvp:=@tv; end; FPutime:=do_syscall(syscall_nr_utimes,longint(path),longint(tvp)); @@ -416,7 +416,7 @@ Begin FPexecv:=do_syscall(syscall_nr_Execve,longint(path),longint(argv),longint(envp)); End; -CONST RUSAGE_SELF = 0; +CONST RUSAGE_SELF = 0; RUSAGE_CHILDREN = -1; function FPgetrusage(who:cint;var ru : rusage):cint; @@ -432,7 +432,7 @@ var ru : rusage; CONST CLK_TCK=128; -function CONVTCK(r:timeval):clock_t; +function CONVTCK(r:timeval):clock_t; { * Convert usec to clock ticks; could do (usec * CLK_TCK) / 1000000, * but this would overflow if we switch to nanosec. @@ -443,17 +443,17 @@ end; begin - if (FPgetrusage(RUSAGE_SELF, ru) < 0) Then - exit(clock_t(-1)); - buffer.tms_utime := CONVTCK(ru.ru_utime); - buffer.tms_stime := CONVTCK(ru.ru_stime); - if (FPgetrusage(RUSAGE_CHILDREN, ru) < 0) Then - exit(clock_t(-1)); - buffer.tms_cutime := CONVTCK(ru.ru_utime); - buffer.tms_cstime := CONVTCK(ru.ru_stime); - if do_syscall(syscall_nr_gettimeofday,longint(@t),0)<>0 Then - exit(clock_t(-1)); - FPtimes:=clock_t(CONVTCK(t)); + if (FPgetrusage(RUSAGE_SELF, ru) < 0) Then + exit(clock_t(-1)); + buffer.tms_utime := CONVTCK(ru.ru_utime); + buffer.tms_stime := CONVTCK(ru.ru_stime); + if (FPgetrusage(RUSAGE_CHILDREN, ru) < 0) Then + exit(clock_t(-1)); + buffer.tms_cutime := CONVTCK(ru.ru_utime); + buffer.tms_cstime := CONVTCK(ru.ru_stime); + if do_syscall(syscall_nr_gettimeofday,longint(@t),0)<>0 Then + exit(clock_t(-1)); + FPtimes:=clock_t(CONVTCK(t)); end; Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cint; @@ -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 diff --git a/rtl/bsd/ossysc.inc b/rtl/bsd/ossysc.inc index 051eee4d4d..f878bf2985 100644 --- a/rtl/bsd/ossysc.inc +++ b/rtl/bsd/ossysc.inc @@ -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. diff --git a/rtl/bsd/ossysch.inc b/rtl/bsd/ossysch.inc index fb595ae5e5..c9e2536b7f 100644 --- a/rtl/bsd/ossysch.inc +++ b/rtl/bsd/ossysch.inc @@ -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 diff --git a/rtl/bsd/ostypes.inc b/rtl/bsd/ostypes.inc index bd8ad8814e..f4e2e0f7d6 100644 --- a/rtl/bsd/ostypes.inc +++ b/rtl/bsd/ostypes.inc @@ -22,13 +22,6 @@ } Type - timespec = packed record - tv_sec : time_t; - tv_nsec : clong; - end; - - ptimespec= ^timespec; - timezone = packed record minuteswest, dsttime : cint; @@ -37,25 +30,25 @@ Type TTimeZone = timezone; rusage = packed record - ru_utime : timeval; { user time used } - ru_stime : timeval; { system time used } - ru_maxrss : clong; { max resident set size } - ru_ixrss : clong; { integral shared memory size } - ru_idrss : clong; { integral unshared data " } - ru_isrss : clong; { integral unshared stack " } - ru_minflt : clong; { page reclaims } - ru_majflt : clong; { page faults } - ru_nswap : clong; { swaps } - ru_inblock : clong; { block input operations } - ru_oublock : clong; { block output operations } - ru_msgsnd : clong; { messages sent } - ru_msgrcv : clong; { messages received } - ru_nsignals : clong; { signals received } - ru_nvcsw : clong; { voluntary context switches } - ru_nivcsw : clong; { involuntary " } - end; -// #define ru_last ru_nivcsw -// #define ru_first ru_ixrss + ru_utime : timeval; { user time used } + ru_stime : timeval; { system time used } + ru_maxrss : clong; { max resident set size } + ru_ixrss : clong; { integral shared memory size } + ru_idrss : clong; { integral unshared data " } + ru_isrss : clong; { integral unshared stack " } + ru_minflt : clong; { page reclaims } + ru_majflt : clong; { page faults } + ru_nswap : clong; { swaps } + ru_inblock : clong; { block input operations } + ru_oublock : clong; { block output operations } + ru_msgsnd : clong; { messages sent } + ru_msgrcv : clong; { messages received } + ru_nsignals : clong; { signals received } + ru_nvcsw : clong; { voluntary context switches } + ru_nivcsw : clong; { involuntary " } + end; +// #define ru_last ru_nivcsw +// #define ru_first ru_ixrss { auto generated by a c prog, statmacr.c} @@ -63,18 +56,22 @@ Const S_IFMT = 61440; S_IFIFO = 4096; S_IFCHR = 8192; - S_IFDIR = 16384; - S_IFBLK = 24576; - S_IFREG = 32768; - S_IFLNK = 40960; - S_IFSOCK= 49152; - S_IFWHT = 57344; - S_ISVTX = 512; + S_IFDIR = 16384; + S_IFBLK = 24576; + S_IFREG = 32768; + S_IFLNK = 40960; + S_IFSOCK= 49152; + S_IFWHT = 57344; + S_ISVTX = 512; { $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 diff --git a/rtl/freebsd/ptypes.inc b/rtl/freebsd/ptypes.inc index ee890073c5..148e720d6b 100644 --- a/rtl/freebsd/ptypes.inc +++ b/rtl/freebsd/ptypes.inc @@ -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 diff --git a/rtl/linux/bunxfunc.inc b/rtl/linux/bunxfunc.inc index 64f3c85bb2..a3b7ef081e 100644 --- a/rtl/linux/bunxfunc.inc +++ b/rtl/linux/bunxfunc.inc @@ -16,15 +16,15 @@ **********************************************************************} -{$i syscallh.inc} // do_syscall declarations themselves -{$i sysnr.inc} // syscall numbers. +{$i syscallh.inc} // do_syscall declarations themselves +{$i sysnr.inc} // syscall numbers. {$i ostypes.inc} -{$i ossysch.inc} // external interface to syscalls in system unit. +{$i ossysch.inc} // external interface to syscalls in system unit. //{$i genfuncs.inc} -{$i bunxmacr.inc} // macro's. +{$i bunxmacr.inc} // macro's. -{$I gensigset.inc} // general sigset funcs implementation. +{$I gensigset.inc} // general sigset funcs implementation. {$I genfdset.inc} Function fpKill(Pid:pid_t;Sig:cint):cint; @@ -87,8 +87,8 @@ Type end; Const ITimer_Real =0; - ITimer_Virtual =1; - ITimer_Prof =2; + ITimer_Virtual =1; + ITimer_Prof =2; Function SetITimer(Which : Longint;Const value : ItimerVal; var VarOValue:ItimerVal):Longint; @@ -106,7 +106,7 @@ Function fpalarm(Seconds: cuint):cuint; Var it,oitv : Itimerval; retval : cuint; - + Begin // register struct itimerval *itp = ⁢ @@ -115,7 +115,7 @@ Begin it.it_value.tv_usec:=0; it.it_value.tv_sec:=seconds; If SetITimer(ITIMER_REAL,it,oitv)<0 Then - Exit(0); // different from *BSD! + Exit(0); // different from *BSD! retval:= oitv.it_value.tv_usec; if retval<>0 Then @@ -124,7 +124,7 @@ Begin End; // The following versions are for internal use _ONLY_ -// This because it works for the first 32 signals _ONLY_, but that +// This because it works for the first 32 signals _ONLY_, but that // is enough since they are depreciated, and for legacy applications // anyway. @@ -133,7 +133,7 @@ function sigblock(mask:cuint):cint; var nset,oset: TSigSet; begin - fpsigemptyset(nset); + fpsigemptyset(nset); // fpsigaddset(nset,mask); needs _mask_ nset[0]:=mask; sigblock:= fpsigprocmask(SIG_BLOCK,@nset,@oset); // SIG_BLOCK=1 @@ -146,7 +146,7 @@ function sigpause(sigmask:cint):cint; var nset: TSigSet; begin - fpsigemptyset(nset); + fpsigemptyset(nset); nset[0]:=sigmask; sigpause:= fpsigsuspend(nset); end; @@ -166,41 +166,41 @@ var time_to_sleep,time_remaining : timespec; oact : sigactionrec; begin - time_to_sleep.tv_sec := seconds; - time_to_sleep.tv_nsec := 0; - fpsigemptyset(nset); + time_to_sleep.tv_sec := seconds; + time_to_sleep.tv_nsec := 0; + fpsigemptyset(nset); fpsigaddset (nset,SIGCHLD); - if fpsigprocmask(SIG_BLOCK,@nset,@oset)=0 Then + if fpsigprocmask(SIG_BLOCK,@nset,@oset)=0 Then exit(cuint(-1)); - if fpsigismember(oset,SIGCHLD)<>0 Then + if fpsigismember(oset,SIGCHLD)<>0 Then Begin - fpsigemptyset(nset); + fpsigemptyset(nset); fpsigaddset (nset,SIGCHLD); - if fpsigaction(SIGCHLD,NIL,@oact)<0 Then - begin - oerrno:=geterrno; - fpsigprocmask(SIG_SETMASK,@oset,NIL); - seterrno(oerrno); - exit(cuint(-1)); - End; - if oact.sa_handler=signalhandler(SIG_IGN) Then - Begin - fpsleep:=fpnanosleep(time_to_sleep, @time_remaining); - oerrno:=geterrno; - fpsigprocmask(SIG_SETMASK,@oset,NIL); - seterrno(oerrno); - End - Else - Begin - fpsigprocmask(SIG_SETMASK,@oset,NIL); - fpsleep:=fpnanosleep(time_to_sleep, @time_remaining) - End; - end - else - fpsleep:=fpnanosleep(time_to_sleep, @time_remaining); - if fpsleep<>0 Then - if time_remaining.tv_nsec>=500000000 Then - inc(fpsleep); + if fpsigaction(SIGCHLD,NIL,@oact)<0 Then + begin + oerrno:=geterrno; + fpsigprocmask(SIG_SETMASK,@oset,NIL); + seterrno(oerrno); + exit(cuint(-1)); + End; + if oact.sa_handler=signalhandler(SIG_IGN) Then + Begin + fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining); + oerrno:=geterrno; + fpsigprocmask(SIG_SETMASK,@oset,NIL); + seterrno(oerrno); + End + Else + Begin + fpsigprocmask(SIG_SETMASK,@oset,NIL); + fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining) + End; + end + else + fpsleep:=fpnanosleep(@time_to_sleep, @time_remaining); + if fpsleep<>0 Then + if time_remaining.tv_nsec>=500000000 Then + inc(fpsleep); End; function fpuname(var name:utsname):cint; [public,alias:'FPC_SYSC_UNAME']; @@ -209,33 +209,33 @@ begin fpuname:=Do_Syscall(syscall_nr_uname,TSysParam(@name)); end; -Function fpGetDomainName(Name:PChar; NameLen:size_t):cint; +Function fpGetDomainName(Name:PChar; NameLen:size_t):cint; Var - srec : utsname; - tsize : size_t; + srec : utsname; + tsize : size_t; Begin if fpuname(srec)<0 Then exit(-1); tsize:=strlen(@srec.domain[0]); if tsize>(namelen-1) Then - tsize:=namelen-1; + tsize:=namelen-1; move(srec.domain[0],name[0],tsize); name[namelen-1]:=#0; fpgetDomainName:=0; -End; +End; function fpGetHostName(Name:PChar; NameLen:size_t):cint; Var - srec : utsname; - tsize : size_t; + srec : utsname; + tsize : size_t; begin if fpuname(srec)<0 Then exit(-1); tsize:=strlen(@srec.nodename[0]); if tsize>(namelen-1) Then - tsize:=namelen-1; + tsize:=namelen-1; move(srec.nodename[0],name[0],tsize); name[namelen-1]:=#0; fpgethostName:=0; @@ -419,7 +419,7 @@ Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cin have changed. } -Var +Var SelectArray : Array[1..5] of longint; begin @@ -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 diff --git a/rtl/linux/ossysc.inc b/rtl/linux/ossysc.inc index 6708ce2168..94990b6e04 100644 --- a/rtl/linux/ossysc.inc +++ b/rtl/linux/ossysc.inc @@ -103,7 +103,7 @@ end; function Fpmkdir(path : pchar; mode: mode_t):cint; [public, alias : 'FPC_SYSC_MKDIR']; -begin +begin Fpmkdir:=do_syscall(syscall_nr_mkdir,TSysParam(path),TSysParam(mode)); end; @@ -385,7 +385,7 @@ begin sbrk:=Fpmmap(0,Size,3,MAP_PRIVATE+MAP_ANONYMOUS,-1,0); if sbrk=pointer(-1) then sbrk:=nil - else + else errno:=0; end; @@ -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 diff --git a/rtl/linux/ossysch.inc b/rtl/linux/ossysch.inc index 3b3e1f4ce9..589b14387c 100644 --- a/rtl/linux/ossysch.inc +++ b/rtl/linux/ossysch.inc @@ -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 diff --git a/rtl/linux/ostypes.inc b/rtl/linux/ostypes.inc index bcc6d110fc..72856eeadd 100644 --- a/rtl/linux/ostypes.inc +++ b/rtl/linux/ostypes.inc @@ -3,7 +3,7 @@ This file is part of the Free Pascal run time library. Copyright (c) 1999-2000 by Michael Van Canneyt, member of the Free Pascal development team. - + OS dependant types internal to the Linux RTL. See the file COPYING.FPC, included in this distribution, @@ -34,30 +34,23 @@ Type } SysCallRegs = record - reg1, - reg2, - reg3, - reg4, - reg5, - reg6 : longint; - end; + reg1, + reg2, + reg3, + reg4, + reg5, + reg6 : longint; + end; PSysCallRegs= ^SysCallRegs; TSysCallRegs= SysCallRegs; - ptimespec = ^timespec; - timespec = packed record - tv_sec : time_t; - tv_nsec : clong; - end; - - timezone = packed record minuteswest,dsttime:longint; end; ptimezone =^timezone; TTimeZone = timezone; -Const // generated by statmacr.c +Const // generated by statmacr.c S_IFMT = 61440; { type of file mask} S_IFIFO = 4096; { named pipe (fifo)} S_IFCHR = 8192; { character special} @@ -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 diff --git a/rtl/linux/ptypes.inc b/rtl/linux/ptypes.inc index dfca17ccf5..8d65bc0d78 100644 --- a/rtl/linux/ptypes.inc +++ b/rtl/linux/ptypes.inc @@ -34,7 +34,7 @@ introduction) Type -{$ifndef VER_1_0} // maybe wrong (kernel vs libc) +{$ifndef VER_1_0} // maybe wrong (kernel vs libc) dev_t = cuint64; { used for device numbers } {$else} dev_t = int64; @@ -42,8 +42,8 @@ Type TDev = dev_t; pDev = ^dev_t; - kDev_t = cushort; // Linux has two different device conventions - TkDev = KDev_t; // kernel and glibc. This is kernel. + kDev_t = cushort; // Linux has two different device conventions + TkDev = KDev_t; // kernel and glibc. This is kernel. pkDev = ^kdev_t; gid_t = cuint32; { used for group IDs } @@ -78,7 +78,7 @@ Type TPid = pid_t; pPid = ^pid_t; - {$ifdef 64bitarch} + {$ifdef 64bitarch} size_t = cuint64; { as definied in the C standard} ssize_t = cint64; { used by function for returning number of bytes } clock_t = cuint64; @@ -97,7 +97,7 @@ Type pClock = ^clock_t; TTime = time_t; pTime = ^time_t; - + uid_t = cuint32; { used for user ID type } TUid = uid_t; pUid = ^uid_t; @@ -107,12 +107,18 @@ Type pSockLen = ^socklen_t; timeval = packed record - tv_sec, - tv_usec:clong; - end; + tv_sec, + tv_usec:clong; + end; 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 } @@ -121,11 +127,15 @@ CONST ARG_MAX = 131072; {4096} { Maximum number of argument size } NAME_MAX = 255; {14} { Maximum number of bytes in filename } PATH_MAX = 4095; {255} { Maximum number of bytes in pathname } - SYS_NMLM = 65; + SYS_NMLM = 65; { $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