After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 562501 - Watch for stopped child processes (waitpid's WUNTRACED)
Watch for stopped child processes (waitpid's WUNTRACED)
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 701538 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-11-27 22:07 UTC by Mark Seaborn
Modified: 2018-05-24 11:38 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Add g_child_watch_source_include_stops() (6.49 KB, patch)
2008-11-27 22:09 UTC, Mark Seaborn
none Details | Review
Add "include_stops" argument to gobject.child_watch_add() (5.81 KB, patch)
2008-12-06 17:40 UTC, Mark Seaborn
needs-work Details | Review

Description Mark Seaborn 2008-11-27 22:07:09 UTC
glib's event loop currently provides no way to find out when child processes have been stopped with SIGSTOP, something which is important for shells.  glib doesn't make waitpid()'s WUNTRACED flag available and it sets the SA_NOCLDSTOP flag on the SIGCHLD signal handler.

Here is a patch to allow child watches to report child-stopped statuses.  The existing g_child_watch_add_full() doesn't have a flags argument, so I added a g_child_watch_source_include_stops() function to set a flag on a GChildWatchSource.  This interface could be improved.  Should I add variants of g_child_watch_add() and g_child_watch_add_full() that report stopped processes?

The patch removes setting of SA_NOCLDSTOP, even when the new child watches are not used.  This means the main loop will be woken up by SIGCHLD in more cases, but that shouldn't be a big problem; it will still not busy-wait.
Comment 1 Mark Seaborn 2008-11-27 22:09:13 UTC
Created attachment 123577 [details] [review]
Add g_child_watch_source_include_stops()
Comment 2 Mark Seaborn 2008-12-06 17:40:47 UTC
Created attachment 124061 [details] [review]
Add "include_stops" argument to gobject.child_watch_add()

This patch makes the interface available in the Python bindings in pygobject by adding an "include_stops" argument to gobject.child_watch_add().  Would you prefer if I opened a separate bug for this?
Comment 3 Matthias Clasen 2008-12-07 19:55:21 UTC
Sounds like a vaguely reasonable idea, even though I have my doubts that 'writing shells' is a very common use case for the GLib mainloop. I think we only want to change the signal flags to include stops if include_stops() has been called, though. 

Some more areas that need work:

- missing win32 implentation
- missing documentation, including updates for the current child watch docs, which only talk about children that are exiting

Comment 4 Dan Winship 2013-06-04 23:37:58 UTC
*** Bug 701538 has been marked as a duplicate of this bug. ***
Comment 5 GNOME Infrastructure Team 2018-05-24 11:38:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/175.