Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2002-11

Linux RTL: getitimer / setitimer

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Judison

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;
Marco van de Voort
to Judison
I can't find getitimer and setitimer in linux RTL, (present in BSD rtl) How can I use this in my project?

I'm currently implementing them for the Linux branch too, but that is for the 1.1 (development branch). I'll backport it to the 1.0.x branch as soon as it is verified to work.

I try'ed this code below, but it does not compile, how do I to use SysCall and SysCallRegs ?

The source looks ok at first sight, what line/construct is the problem? Do you include unit unix?

Judison
to Marco van de Voort

Hi,

Show quoted text 7 lines
> I can't find getitimer and setitimer in linux RTL, (present in BSD rtl) > How can I use this in my project? I'm currently implementing them for the Linux branch too, but that is for the 1.1 (development branch). I'll backport it to the 1.0.x branch as soon as it is verified to work.

Plese notify me when I can get this at CVS...

Show quoted text 6 lines
> I try'ed this code below, but it does not compile, how do I to use SysCall > and SysCallRegs ? The source looks ok at first sight, what line/construct is the problem? Do you include unit unix?

I forgot the uses :)
Now it seens to work,
(my real test, to get "allarmed" every X ms does not work, but I'll keep try'n)

Tks ;)

Your friend,
Judison