Function restart_syscall

Source
pub unsafe fn restart_syscall() -> Retval
Expand description

Restart System Call

This system call continues an interrupted system call with the same parameters it was initially called, adjusted only for the time difference between the original syscall and now.

This system call is used by the kernel itself to resume system calls of frozen processes. Whenever a system call is interrupted, the kernel saves the system call parameters and restarts the system call with the same parameters once the task is resumed again. However, for system calls that take relative time-frames as arguments, the kernel usually needs to adjust these relative time-frames for the elapsed time. For those system calls, the kernel refrains from restarting the system call directly and instead changes the system call number of the to-be-restarted call to this system call. When this system call is then invoked, the kernel fetches the original system call and its parameters from its internal state, adjusts the relative timeout, and then restarts the original system call.

There is usually no reason why you would ever invoke this system call from user-space. Moreover, even when the kernel triggers a syscall restart with this system call, it never leaves kernel space, and thus user-space should never see this system call at all. Tracing debuggers might see it, though. And they are the only ones that might reasonable interfere with it.

If no system call is to be resumed, this system call returns EINTR. Otherwise, it resumes the original system call with adjusted relative time parameters and returns the result of the resumed system call.