Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 884
    • Issues 884
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • GLib
  • Merge requests
  • !2408

Draft: gmain: Use waitid() on pidfds rather than a global SIGCHLD handler

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Philip Withnall requested to merge wip/pwithnall/2216-pidfd-sigchld into main Dec 23, 2021
  • Overview 5
  • Commits 2
  • Pipelines 2
  • Changes 1

When the system supports it (as all Linux kernels ≥ 5.3 should), it’s preferable to use pidfd_open() and waitid() to be notified of child processes exiting or being signalled, rather than installing a default SIGCHLD handler.

A default SIGCHLD handler is global, and can never interact well with other code (from the application or other libraries) which also wants to install a SIGCHLD handler.

This use of pidfd_open() is racy (the PID may be reused between g_child_watch_source_new() being called and pidfd_open() being called), so it doesn’t improve behaviour there. For that, we’d need continuous use of pidfds throughout GLib, from fork/spawn time until here. See #1866 for that.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Helps: #1866 Fixes: #2216

Closes #2216

Edited Jun 21, 2022 by Philip Withnall
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: wip/pwithnall/2216-pidfd-sigchld