THREAD_FORK(9)
πΈ NAME πΈ
okay bestie, welcome to THREAD_FORK(9) from the Kernel Developerβs Manual π
this is the page for thread_fork β and its whole gig is: create a new thread inside a process. periodt.
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <sys/proc.h>
int
thread_fork(struct proc *p1, void *stack, void *tcb, pid_t *tidptr,
register_t *retval);
π DESCRIPTION π
thread_fork() creates a new thread out of p1, and p1 should be the current thread. This function is literally used to implement the __tfork(3) system call. no cap.
stack, which must not be NULL, will be used as the initial value of the new threadβs stack pointer.
If tcb is not NULL, it will be used as the initial address of the new threadβs TCB (thread control block). iykyk.
If tidptr is not NULL, the TID of the new thread will be copied out there on success. This is guaranteed to be done before the new thread is started. the way thatβs handled before the new thread even starts? iconic.
On successful completion the TID of the new thread will be stored in *retval.
π RETURN VALUES π
Upon successful completion of the operation, thread_fork() returns 0. Otherwise, the following error values are returned:
[EAGAIN]β the system limit on the total number of threads would be exceeded.[ENOMEM]β there is insufficient swap space for the new thread.[EINVAL]β thestackargument wasNULL.
bestie, thatNULLstack is giving βnot itβ β itβs literally theEINVALcase π
π₯ SEE ALSO π₯
go read these too, bestie: __get_tcb(2), fork(2), __tfork(3), tfind(9) π
π¦ HISTORY π¦
The thread_fork() function appeared in OpenBSD 6.1.
okay thatβs the whole page, bestie π«Ά this oneβs footer energy is Debian, dated February 15, 2017. go be iconic with your threads π β¨
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 1998 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms