Manual Page Result
0
Command: _lwp_create | Section: 2 | Source: NetBSD | File: _lwp_create.2
_LWP_CREATE(2) FreeBSD System Calls Manual _LWP_CREATE(2)
NAME
_lwp_create - create a new light-weight process
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <lwp.h>
int
_lwp_create(ucontext_t *context, unsigned long flags, lwpid_t *new_lwp);
DESCRIPTION
_lwp_create() causes creation of a new light-weight process, or LWP, and
adds it to the current process. The context argument specifies the
initial execution context for the new LWP including signal mask, stack,
and machine registers. The signal stack of the newly created light-
weight process is reset to disabled. If this context specifies invalid
register values (for example privilege escalation by setting machine
dependent bits forbidden for user processes), or does not specify cpu
register values (uc_flags does not have the _UC_CPU bit set), the call
will fail and errno will be set to EINVAL.
The following flags affect the creation of the new LWP:
LWP_DETACHED The LWP is created detached. The resources associated with
a detached LWP will be automatically reclaimed by the
system when the LWP exits. Otherwise, a terminated LWP's
resources will not be reclaimed until its status is
reported to another LWP via _lwp_wait(2).
LWP_SUSPENDED
The LWP is created suspended, and will not begin execution
until it is resumed by another LWP via _lwp_continue(2).
The LWP ID of the new LWP is stored in the location pointed to by
new_lwp.
RETURN VALUES
The _lwp_create() function returns the value 0 if successful; otherwise
the value -1 is returned and the global variable errno is set to indicate
the error.
ERRORS
_lwp_create() will fail and no LWP will be created if:
[EAGAIN] The system-imposed limit on the total number of LWPs
under execution would be exceeded. This limit is
configuration-dependent.
[EFAULT] The address pointed to by context or new_lwp is
outside the process's allocated address space.
[EINVAL] The ucontext_t passed is invalid.
[ENOMEM] There is insufficient swap space for the new LWP.
SEE ALSO
_lwp_continue(2), _lwp_exit(2), _lwp_wait(2), _lwp_makecontext(3)
HISTORY
The _lwp_create() system call first appeared in NetBSD 2.0.
FreeBSD 14.1-RELEASE-p8 April 21, 2017 FreeBSD 14.1-RELEASE-p8