Sign in Join

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

Mailing lists / fpc-devel / 2002-01

missing syscalls

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Unknown author

Hello, developers,
a happy new Year to all of You !

I use fpc 1.0.4 and I missed the following syscalls:

procedure getResUid(var ruid: longint; var euid:longint; var suid:longint);
var
  regs : SysCallregs;
  x: longint;
begin
{ This was only for verifying that values are really set by system call:}
(*
    ruid:=44;
    euid:=45;
    suid:=46;
*)
  regs.reg2:=longint(@ruid);
  regs.reg3:=longint(@euid);
  regs.reg4:=longint(@suid);
{  x:=}SysCall(SysCall_nr_getresuid,regs);
{  writeln('X: ',x);}
  Linuxerror:=errno;
end;
procedure setResUid(var ruid: longint; var euid:longint; var suid:longint);
var
  regs : SysCallregs;
  x: longint;
begin
  regs.reg2:=ruid;
  regs.reg3:=euid;
  regs.reg4:=suid;
{  x:=}
    SysCall(SysCall_nr_setresuid,regs);
{  writeln('X: ',x);}
{
  ruid:=regs.reg2;
  euid:=regs.reg3;
  suid:=regs.reg4;
}
  Linuxerror:=errno;
end;

BTW, why does SysCall store errors in LinuxError? IMHO, it would be nice to make functions of all the syscalls and return error numbers as negative values. This would be inherently thread safe, or do I miss a point here?

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 42 lines
Hello, developers, a happy new Year to all of You ! I use fpc 1.0.4 and I missed the following syscalls: procedure getResUid(var ruid: longint; var euid:longint; var suid:longint); var regs : SysCallregs; x: longint; begin { This was only for verifying that values are really set by system call:} (* ruid:=44; euid:=45; suid:=46; *) regs.reg2:=longint(@ruid); regs.reg3:=longint(@euid); regs.reg4:=longint(@suid); { x:=}SysCall(SysCall_nr_getresuid,regs); { writeln('X: ',x);} Linuxerror:=errno; end; procedure setResUid(var ruid: longint; var euid:longint; var suid:longint); var regs : SysCallregs; x: longint; begin regs.reg2:=ruid; regs.reg3:=euid; regs.reg4:=suid; { x:=} SysCall(SysCall_nr_setresuid,regs); { writeln('X: ',x);} { ruid:=regs.reg2; euid:=regs.reg3; suid:=regs.reg4; } Linuxerror:=errno; end;

I will add these calls.

BTW, why does SysCall store errors in LinuxError? IMHO, it would be nice to make functions of all the syscalls and return error numbers as negative values. This would be inherently thread safe, or do I miss a point here?

It has grown historically, and is a known problem...

I suppose we can make overloaded versions of each call for this which does what you describe...

Michael.

Reply by email