Bug 222049 - [WPE][GTK] Avoid another child setup function in process launcher code
Summary: [WPE][GTK] Avoid another child setup function in process launcher code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-17 10:27 PST by Michael Catanzaro
Modified: 2021-02-18 11:40 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.40 KB, patch)
2021-02-17 10:30 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (3.29 KB, patch)
2021-02-17 10:32 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-02-17 10:27:58 PST
This is a follow-up to bug #220090. Avoiding child setup functions is desirable because it could allow GSubprocess to use posix_spawn() instead of fork() in the future. That's not possible to do if we have code that needs to run between fork() and exec().

In this case, the child setup is used only to unset CLOEXEC. We could simply not set it in the first place. This only fails if a secondary thread decides to launch a subprocess before XDGDBusProxyLauncher::launch returns. That window already exists in many other places (e.g. anywhere else setCloseOnExec is called, such as for IPC::Connection objects). Threads should not do that.

This also fixes a bug where unsetting CLOEXEC would fail if we get unlucky and receive EINTR. A loop is required here. WTF::setCloseOnExec handles that for us.
Comment 1 Michael Catanzaro 2021-02-17 10:30:32 PST
Created attachment 420666 [details]
Patch
Comment 2 Michael Catanzaro 2021-02-17 10:32:11 PST
Created attachment 420667 [details]
Patch
Comment 3 EWS 2021-02-18 11:40:55 PST
Committed r273087: <https://commits.webkit.org/r273087>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 420667 [details].