Skip to main content

create_user_thread

Function create_user_thread 

Source
pub fn create_user_thread(
    entry_ctx: UserEntryContext,
    entry: u64,
    stack_top: u64,
    arg0: u64,
    flags: u64,
    tls_base: u64,
) -> Result<Arc<Task>, SyscallError>
Expand description

Core of SYS_THREAD_CREATE and /thread/create.

Validates arguments with the exact same rules as the raw syscall, builds the child task, registers it as a child of the current task, and returns it (the caller decides what to expose: TID via syscall return value, or kernel-owned stack + TID via the scheme).

stack_top is supplied by the caller (raw path). For the scheme path use create_user_thread_with_kernel_stack instead, which allocates the user stack in the kernel.