Skip to content

Commit

Permalink
Restart syscalls interrupted by SIGPROF when possible
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Ivanov <ivadmi5@gmail.com>
  • Loading branch information
funbringer committed Oct 25, 2022
1 parent a280c9e commit 04e8fb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/profiler.rs
Expand Up @@ -374,7 +374,9 @@ impl Profiler {
let handler = signal::SigHandler::SigAction(perf_signal_handler);
let sigaction = signal::SigAction::new(
handler,
signal::SaFlags::SA_SIGINFO,
// SA_RESTART will only restart a syscall when it's safe to do so,
// e.g. when it's a blocking read(2) or write(2). See man 7 signal.
signal::SaFlags::SA_SIGINFO | signal::SaFlags::SA_RESTART,
signal::SigSet::empty(),
);
unsafe { signal::sigaction(signal::SIGPROF, &sigaction) }?;
Expand Down

0 comments on commit 04e8fb9

Please sign in to comment.