| _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 priviledge
  escalation by setting machine dependend 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:
The LWP ID of the new LWP is stored in the location pointed to by new_lwp.
_lwp_create() returns a
  value of 0. Otherwise, a value of -1 is returned and errno is set to one of
  the values documented below.
_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 9.4 |