std.process - POSIX specific callback
dennis luehring
dl.soluz at gmx.net
Thu Jun 6 23:26:00 PDT 2013
are you talking about http://linux.die.net/man/3/pthread_atfork
funktionality?
Am 06.06.2013 18:05, schrieb nazriel:
> Would it be possible to add to std.process.Config POSIX specific
> callback which would be called after fork()?
>
> It is currently main blocker in switching dpaste-be from handmade
> process handling module to std.process.
>
> It could look something like this.
>
> struct Config {
> // current fields
> void delegate() posixCallback;
> }
>
> // ...
>
> int i = fork();
> if (i > 0)
> {
> //...
> if (config.posixCallback !is null)
> config.posixCallback();
> //...
> }
>
> Such construct would allow for various child process
> manipulation, for instance
> dropping root privileges or setting limits via setrmlimit.
>
> Example:
>
> config.posixCallback = {
> setguid(ourGUID);
> setgroups(ourGROUPS);
> setuid(ourUID);
>
> setrmlimit(NFORK, 123);
> };
>
>
> AFAIK we already have Windows specific flag related to spawning
> console for GUI apps.
>
> I can make pull request ASAP when I get reasonable name for field.
>
> Lars? ;)
>
More information about the Digitalmars-d
mailing list