svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
kthread(9)
In the older family of functions was renamed to be the family of
functions, as they were previously misnamed and actually produced
kernel processes. This new family of functions was added to pro‐
duce kernel threads. See the man page for more information on
the renamed calls. Also note that the function appears in both
pages as its functionality is split. The function is used to
start daemons such as and the and is intended to be called from
The argument is actually a pointer to a which describes the ker‐
nel thread that should be created: struct kthread_desc {
char *arg0;
void (*func)(void); struct
thread **global_threadpp; }; The structure members are used by
as follows: String to be used for the name of the thread. This
string will be copied into the member of the new threads' The
main function for this kernel thread to run. A pointer to a
pointer that should be updated to point to the newly created
thread's structure. If this variable is then it is ignored. The
thread will be a subthread of (PID 0). The function is used to
create a kernel thread. The new thread runs in kernel mode only.
It is added to the process specified by the argument, or if that
is to The argument specifies the function that the thread should
execute. The argument is an arbitrary pointer that is passed in
as the only argument to when it is called by the new thread. The
pointer points to a pointer that is to be updated to point to the
newly created thread. If this argument is then it is ignored.
The argument may be set to to leave the thread in a stopped
state. The caller must call to start the thread. The argument
specifies the size of the new kernel thread's stack in pages. If
0 is used, the default kernel stack size is allocated. The rest
of the arguments form a argument list that is used to build the
name of the new thread and is stored in the member of the new
thread's The function is much like the function above except that
if the kproc does not already exist, it is created. This func‐
tion is better documented in the manual page. The function is
used to terminate kernel threads. It should be called by the
main function of the kernel thread rather than letting the main
function return to its caller. The and functions are used to
suspend and resume a kernel thread. During the main loop of its
execution, a kernel thread that wishes to allow itself to be sus‐
pended should call in order to check if the it has been asked to
suspend. If it has, it will until it is told to resume. Once it
has been told to resume it will return allowing execution of the
kernel thread to continue. The other two functions are used to
notify a kernel thread of a suspend or resume request. The argu‐
ment points to the of the kernel thread to suspend or resume.
For the argument specifies a timeout to wait for the kernel
thread to acknowledge the suspend request and suspend itself.
The function is meant to be registered as a shutdown event for
kernel threads that need to be suspended voluntarily during sys‐
tem shutdown so as not to interfere with system shutdown activi‐
ties. The actual suspension of the kernel thread is done with
The and functions return zero on success and non-zero on failure.
This example demonstrates the use of a and the functions and to
run the process. static struct thread *bufdaemonthread;
static struct kthread_desc buf_kp = { "bufdaemon",
buf_daemon, &bufdaemonthread }; SYSINIT(bufdae‐
mon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kthread_start,
&buf_kp)
static void buf_daemon() { ... /* *
This process needs to be suspended prior to shutdown sync.
*/ EVENTHANDLER_REGISTER(shutdown_pre_sync,
kthread_shutdown, bufdaemonthread, SHUT‐
DOWN_PRI_LAST); ... for (;;) {
kthread_suspend_check(); ...
} } The and functions will fail if: The argument does not
reference a kernel thread. The function will fail if: Memory for
a thread's stack could not be allocated. The function first ap‐
peared in where it created a whole process. It was converted to
create threads in The and functions were introduced in and were
converted to threads in The call was renamed to in The old func‐
tionality of creating a kernel process was renamed to Prior to
the and functions were named and respectively.