5

I've been using PHP's PCNTL extension for a little while now, but can't figure out what the restart_syscalls parameter of pcntl_signal() does. I tried looking around the Internets, but couldn't find any information. All the documentation says is:

"Specifies whether system call restarting should be used when this signal arrives."

What is "system call restarting"?

Marco Roy
  • 4,004
  • 7
  • 34
  • 50

1 Answers1

2

Suppose you programmed your signal handler to stop a process using signals like:

  • SIGTERM: to terminate a process; it can be blocked, handled, and ignored unlike SIGKILL.
  • SIGKILL: to immediately terminate a process
  • SIGSTOP: to pause the process in its current state

restart_syscalls specifies whether system call restarting should be used when signo arrives. Examples of signo are the three I listed above and there are much more.

This means, if restart_syscalls is set to the default value TRUE, this will restart certain system calls after a process that was stopped by a signal signo. It restarts the interrupted system call with a time argument that is suitably adjusted to account for the time that has already elapsed.

I forward you to this very simple and clear example: pcntl_wait not interrupted by SIGTERM

Community
  • 1
  • 1
Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
  • 5
    Thanks for your explanation & links! It's a bit clearer now, but honestly, I still don't quite understand what "system call restarting" is... :( In fact, I don't understand the whole notion of why a system call would have to be restarted, or what restarting a system call even means/implies. – Marco Roy Apr 20 '16 at 21:26