Re: Is it okay to fork() in a sudo i/o plugin?

Bryan Christ <[email protected]>
Newsgroups gmane.comp.tools.sudo.user
Message-ID <CAPQiZK-5MFKnYiNNQ_+DY4rzB+4Y6PsqsgOtbDXpzjxasE7cQQ@mail.gmail.com>
That certainly a reasonable approach.  At what point is it safe for the
plugin to fork()?

On Mon, Feb 4, 2019, 22:00 Todd C. Miller <[email protected] wrote:

> On Mon, 04 Feb 2019 19:37:13 -0600, Bryan Christ wrote:
>
> > I'm writing a plug-in for sudo using the plugin API.  Since the logging
> > facility of the plug-in will push data to a remote server, I want to
> avoid
> > potential blocking situations.  Is it reasonable to fork() from an I/O
> > plugin?  Obviously I can't install a handler for sigchld to reap
> processes
> > so I perceive that to be a bit of a problem right out of the gate unless
> > sudo already has a handler that I can count on to do that.
>
> When do you want to do the fork?  You could use a single child
> process that you communicate with over a socketpair in the plugin
> and wait for the child in the plugin's close function.  If you do
> non-blocking I/O in the child and buffer things until the remote
> end can consume them you shouldn't have to worry about blocking.
>
>  - todd
>
____________________________________________________________
sudo-users mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.