_LWP_CREATE(2) | System Calls Manual | _LWP_CREATE(2) |
_lwp_create
—
#include <lwp.h>
int
_lwp_create
(ucontext_t
*context, unsigned long
flags, lwpid_t
*new_lwp);
_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
LWP_SUSPENDED
The LWP ID of the new LWP is stored in the location pointed to by new_lwp.
_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.
_lwp_create
() will fail and no LWP will be created if:
EAGAIN
]EFAULT
]EINVAL
]ENOMEM
]_lwp_create
() system call first appeared in
NetBSD 2.0.
April 21, 2017 | NetBSD 10.1 |