Sign in Join

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

Mailing lists / fpc-devel / 2002-01

Re: two questions plz help

3 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

I wrote a mutithreaded program using the clone() call. Memory allocation takes place only in the main thread. Preallocated structures like lists are then passed to the child threads. For I/O, I use the function fdopen, fdwrite, fdread, fdclose from the linux unit. This works ok for me.

A week ago I posted the following which contains a remark about thread safe error handling. I append it here, because I did not get any answers:

Show quoted text 45 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; >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

Jonas Maebe
to Unknown author
A week ago I posted the following which contains a remark about thread safe error handling. I append it here, because I did not get any answers:

Michael replied to it. He said the current structure is simply because of historical reasons. It will probably be changed somewhere in the future.

Jonas

Reply by email

Unknown author

I somehow never saw Micheals answer on the list. I tried to search within the mail , but I only get "The requested URL ... was not found on this server". So could someone who has it please kindly post Michaels answer again? Thank you

Reply by email