2023-09-10 04:08:26 +08:00
|
|
|
// A mdoule concerned with the exec side of fork/exec.
|
|
|
|
// This concerns posix_spawn support, and async-signal
|
|
|
|
// safe code which happens in between fork and exec.
|
|
|
|
|
|
|
|
mod flog_safe;
|
2023-09-10 04:08:41 +08:00
|
|
|
pub mod postfork;
|
|
|
|
pub mod spawn;
|
2023-10-09 05:22:27 +08:00
|
|
|
use crate::proc::Job;
|
|
|
|
use libc::{SIGINT, SIGQUIT};
|
2023-09-10 04:08:41 +08:00
|
|
|
|
|
|
|
/// Get the list of signals which should be blocked for a given job.
|
|
|
|
/// Return true if at least one signal was set.
|
2023-10-09 05:22:27 +08:00
|
|
|
pub fn blocked_signals_for_job(job: &Job, sigmask: &mut libc::sigset_t) -> bool {
|
2023-09-10 04:08:41 +08:00
|
|
|
// Block some signals in background jobs for which job control is turned off (#6828).
|
|
|
|
if !job.is_foreground() && !job.wants_job_control() {
|
|
|
|
unsafe {
|
2023-10-09 05:22:27 +08:00
|
|
|
libc::sigaddset(sigmask, SIGINT);
|
|
|
|
libc::sigaddset(sigmask, SIGQUIT);
|
2023-09-10 04:08:41 +08:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
false
|
|
|
|
}
|