TProcess OnForkEven without parameters
Original Reporter info from Mantis: clicio
-
Reporter name: Carlos Clicio
Original Reporter info from Mantis: clicio
- Reporter name: Carlos Clicio
Description:
Hi , when i´m starting a new process with tprocess and need to use the evente OnForkEvent just before the child process start doing its job , for example to change the efective user id just in the child process. I havent foud a way to pass parameters or a class to the event. So i have a suggestion to change the definition of TProcessForkEvent from procedure to procedure ( obj : TObject ); in process.pp and in process.inc change the call to pass an argument FForkEvent(self);
With this i can define a TProcess child class with new properties and use them in OnForkEvent as follows :
TMyProc = class(TProcess)
private
UserId, GroupID : integer;
public
end;
....
So if this could be added to the new version it would be great.
Best Regards
procedure AfterFork(Obj : TObject);
var
Wproc : TMyProc;
begin
Wproc := TMyproc(obj);
if (WProc.UserId <> 0) and (WProc.GroupID <> 0) then
begin
fpsetregid(wproc.GroupID,wproc.GroupID);
fpsetreuid(wproc.UserId,wproc.UserId);
end;
end;
Programa := TMyProc.Create(nil);
try
Programa.userid := UserId;
programa.groupid := GroupId;
OnForkEvent := @AfterFork;
....
Mantis conversion info:
- Mantis ID: 25404
- OS: Linux Debian
- OS Build: 6
- Platform: Intel
- Version: 2.6.2
- Fixed in version: 3.0.0
- Fixed in revision: 26752 (#dafd3c39)
- Monitored by: » crossbuilder (Burkhard Carstens)
- Target version: 3.0.0