[fpc-devel]Linux RTL: getitimer / setitimer
Judison
jueca at brturbo.com
Sat Nov 16 19:25:38 CET 2002
Hi all,
I can't find getitimer and setitimer in linux RTL, (present in BSD rtl)
How can I use this in my project?
I try'ed this code below, but it does not compile, how do I to use SysCall and SysCallRegs ?
TIA,
Your friend,
Judison
{$PACKRECORDS C}
type
TTimeVal = record
tv_sec: longint;
tv_usec: longint;
end;
TITimerVal = record
interval: TTimeVal;
value: TTimeVal;
end;
const
ITimer_Real = 0;
ITimer_Virtual = 1;
ITimer_Prof = 2;
// int getitimer(int which, struct itimerval *value);
// int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);
function getitimer(which: longint; var value: TITimerVal): longint;
var
regs: SysCallregs;
begin
regs.reg2:=which;
regs.reg3:=longint(@value);
Result := SysCall(SysCall_nr_getitimer,regs);
end;
function setitimer(which: longint; const value: TITimerVal; var ovalue: TITimerVal): longint;
var
regs: SysCallregs;
begin
regs.reg2:=which;
regs.reg3:=longint(@value);
regs.reg4:=longint(@ovalue);
Result := SysCall(SysCall_nr_setitimer,regs);
end;
More information about the fpc-devel
mailing list