Skip to main content

execute_syscall

Function execute_syscall 

Source
pub fn execute_syscall(
    current_task: &mut CurrentTask,
    error_context: &mut Option<ErrorContext>,
)
Expand description

Executes the syscall for current_task.

Stores an ErrorContext in error_context if the system call returned an error, and leaves it unchanged otherwise, so that the most recent failure is preserved across successful syscalls.

error_context is an out-parameter rather than an Option<ErrorContext> return value because of that preservation requirement: a returned None must not overwrite the previous ErrorContext, so the return value cannot be constructed directly in *error_context. It would instead go through a separate hidden return slot that is written on every syscall and copied into *error_context on error. With the out-parameter, the common Ok path does not touch error_context at all.