unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (NetBSD-2.0)
Page:
Section:
Apropos / Subsearch:
optional field

KTHREAD(9)               BSD Kernel Developer's Manual              KTHREAD(9)

NAME
     kthread_create1, kthread_exit, kthread_create -- kernel threads

SYNOPSIS
     #include <&lt;sys/kthread.h>&gt;

     void
     kthread_create(void (*func)(void *), void *arg);

     void
     kthread_exit(int ecode);

     int
     kthread_create1(void (*func)(void *), void *arg, struct proc **newpp,
         const char *fmt, ...);

DESCRIPTION
     Kernel threads are light-weight processes which execute entirely within
     the kernel.  Any process can request the creation of a new kernel thread.
     Kernel threads are not swapped out during memory congestion.  The VM
     space and limits are shared with proc0 (usually swapper).

FUNCTIONS
     kthread_create1(void (*func)(void *), void *arg, struct proc **newpp,
              const char *fmt, ...)
              Fork a kernel thread.  newpp is a pointer the the new proc
              structure for the kernel thread.  The function func is called
              with arguments arg to commence execution.  fmt is a string con-
              taining format information used to display the kernel thread
              name.

     kthread_create(void (*func)(void *), void *arg)
              Register function func to defer creation of the kernel thread.
              Deferral of kernel thread creation is required during system
              startup when kernel thread resources are not available.

     kthread_exit(int ecode)
              Exit from a kernel thread.

RETURN VALUES
     Upon successful completion, kthread_create1() returns 0.  Otherwise, the
     following error values are returned:

     [EAGAIN]  The limit on the total number of system processes would be
               exceeded.

     [EAGAIN]  The limit RLIMIT_NPROC on the total number of processes under
               execution by this user id would be exceeded.

CODE REFERENCES
     This section describes places within the NetBSD source tree where actual
     code implementing or using the kthread framework can be found.  All path-
     names are relative to /usr/src.

     The kthread framework itself is implemented within the file
     sys/kern/kern_kthread.c.  Data structures and function prototypes for the
     framework are located in sys/sys/kthread.h.

SEE ALSO
     driver(9), fork1(9)

HISTORY
     The kthread framework appeared in NetBSD 1.4.

BSD                              July 9, 2000                              BSD