glib/docs/reference/gio
Sergio Costas c12762a091 GSubprocessLauncher: allow to close passed FDs
By default, when using g_subprocess_launcher_take_fd() to pass an
FD to a child, the GSubprocessLauncher object also takes ownership
of the FD in the parent, and closes it during finalize(). This is
a reasonable assumption in the majority of the cases, but sometimes
it isn't a good idea.

An example is when creating a GSubprocessLauncher in JavaScript:
here, the destruction process is managed by the Garbage Collector,
which means that those sockets will remain opened for some time
after all the references to the object has been droped. This means
that it could be not possible to detect when the child has closed
that same FD, because in order to make that work, both FDs
instances (the one in the parent and the one in the children) must
be closed. This can be a problem in, as an example, a process that
launches a child that communicates with Wayland using an specific
socket (like when using the new API MetaWaylandClient).

Of course, it isn't a valid solution to manually call close() in
the parent process just after the call to spawn(), because the FD
number could be reused in the time between it is manually closed,
and when the object is destroyed and closes again that FD. If that
happens, it will close an incorrect FD.

One solution could be to call run_dispose() from Javascript on the
GSubprocessLauncher object, to force freeing the resources.
Unfortunately, the current code frees them in the finalize()
method, not in dispose() (this is fixed in !1670 (merged) ) but it
isn't a very elegant solution.

This proposal adds a new method, g_subprocess_launcher_close(),
that allows to close the FDs passed to the child. To avoid problems,
after closing an FD with this method, no more spawns are allowed.

Fix: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1677
2020-10-12 20:29:48 +02:00
..
gdbus-object-manager-example docs: Don’t install object manager example separately 2020-02-11 11:47:03 +00:00
xml docs: Change Bugzilla references to GitLab 2018-06-15 13:04:39 +01:00
.gitignore .gitignore updates for gsettings stuff 2010-04-27 17:04:57 -04:00
concat-files-helper.py doc: Split API reference per platform 2019-07-10 10:29:04 -04:00
gapplication.xml New gapplication(1) tool 2013-10-17 10:12:27 -04:00
gdbus-codegen.xml tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
gdbus.xml docs: Change Bugzilla references to GitLab 2018-06-15 13:04:39 +01:00
gio-docs-unix.xml doc: Split API reference per platform 2019-07-10 10:29:04 -04:00
gio-docs-win32.xml doc: Split API reference per platform 2019-07-10 10:29:04 -04:00
gio-docs.xml gversionmacros: Add version macros for GLib 2.68 2020-10-01 14:33:21 +01:00
gio-querymodules.xml docs: Improve man page consistency 2012-08-03 23:36:45 -04:00
gio-sections-common.txt GSubprocessLauncher: allow to close passed FDs 2020-10-12 20:29:48 +02:00
gio-sections-win32.txt doc: Split API reference per platform 2019-07-10 10:29:04 -04:00
gio.xml docs: Mention new gio tool options 2020-04-02 13:23:09 +02:00
glib-compile-resources.xml glib-compile-resources: Add external data option 2018-12-19 16:43:21 +00:00
glib-compile-schemas.xml glib-compile-schemas: Add a --version option 2016-10-06 21:08:25 +01:00
gresource.xml gresource: fix documentation typo 2017-08-22 08:58:56 +01:00
gsettings.xml Add ‘gsettings list-schemas --print-paths’ option 2018-01-05 13:01:03 +00:00
gvfs-overview.odg update the overview image of the gio docs 2009-06-08 17:29:22 +02:00
gvfs-overview.png update the overview image of the gio docs 2009-06-08 17:29:22 +02:00
menu-example.png Add GMenuModel 2011-12-08 18:05:12 -05:00
menu-model.png Add GMenuModel 2011-12-08 18:05:12 -05:00
meson.build docs: Fix configuration with gtk_doc=true and installed_tests=false 2020-03-27 19:33:12 +00:00
migrating-gconf.xml tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
migrating-gdbus.xml doc: Add back gdbus-object-manager-example 2020-01-29 15:40:17 +01:00
migrating-gnome-vfs.xml docs: Change Bugzilla references to GitLab 2018-06-15 13:04:39 +01:00
migrating-posix.xml Remove duplicate copies of migration docs 2010-05-27 13:07:54 -04:00
overview.xml tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
version.xml.in gio/ docs/reference/gio Merged gio-standalone into glib. 2007-11-26 16:13:05 +00:00