Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start-stop-daemon, supervise-daemon: use close_range with musl #645

Merged
merged 4 commits into from
Sep 13, 2023

Commits on Sep 5, 2023

  1. supervise-daemon: rename HAVE_CLOSE_RANGE_EXEC to HAVE_CLOSE_RANGE

    Use HAVE_CLOSE_RANGE to tell if system provides a close_range(2)
    wrapper, which better explains the purpose.
    
    Add a compat inline which returns -1 if close_range is unavailable.
    ncopa committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    3b401d1 View commit details
    Browse the repository at this point in the history
  2. misc: add cloexec_fds_from() helper function

    Move logic to set file descriptors to a cloexec_fds_from() function in
    misc.c so it can be shared by both supervisor-daemon and
    start-stop-daemon, and hide the details behind.
    ncopa committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    e237f6d View commit details
    Browse the repository at this point in the history
  3. start-stop-daemon: set fds to CLOEXEC instead of closing

    Set file descriptors to CLOEXEC instead of closing them before exec,
    similar to what we do in supervise-daemon.
    
    Use the share cloexec_fds_from() helper for this.
    
    closefrom() is no longer used so remove the test.
    ncopa committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    fd1b63f View commit details
    Browse the repository at this point in the history
  4. misc: add syscall fallback for close_range for musl libc

    Add fallback for the close_range syscall wrapper. This is needed for
    musl libc, which currently does not have a close_range wrapper.
    
    Also set errno on errors.
    ncopa committed Sep 5, 2023
    Configuration menu
    Copy the full SHA
    d2cea9a View commit details
    Browse the repository at this point in the history