drv_thread_create(3D)
drv_thread_create, drv_thread_exit - create a kernel thread
As shipped in IRIX 6.5.30. Added in IRIX 6.5.19.
NAME drv_thread_create, drv_thread_exit - create a kernel thread SYNOPSIS #include <sys/ddi.h> #include <sys/types.h> int drv_thread_create(char * name, ulong_t stack_size, uint_t flags, short pri, st_func_t func, void * arg0, void * arg1, void * arg2, void * arg2); void drv_thread_exit(void); Arguments name Name of the thread, must be 13 or less characters in length stack_size Optionally specified stack size, 0 lets the kernel decide flags Currently unused pri Optionally specified priority, < 0 lets the kernel decide func Starting function for the thread args Four optional arguments to pass to the starting function DESCRIPTION drv_thread_create creates a kernel service thread. Service threads are threads that spend their entire life in the kernel and never need to execute user-mode code. Service threads are one of the three thread types in the IRIX kernel; user threads and interrupt threads are the others. A service thread can execute any kernel code exported in the Device Driver Interface which does not result in a switch to user-mode execution. It is most often useful for performing daemon-like activities within the kernel e.g. swapping, large page coalescing, and partition state management. Semaphores or other kernel synchronization methods can be used by the service thread to sleep while waiting for wakeup from other sections of kernel or driver code. Service threads may exit by returning from their starting function or by calling drv_thread_exit. They should not be holding any locks when they do so, and they should free all the kernel memory that they've allocated for themselves to help prevent memory leaks. USAGE Service threads are created with a call to drv_thread_create. The name parameter is a pointer to a character string which must be no longer than 13 characters including the NULL terminating character. It will be appended to "ST_" to easily identify the thread as a driver launched system thread. The only other mandatory argument is the starting function func. It will be passed the four arguments specified at startup. The optional stack_size argument allows the calling driver to specify that a specific size stack be created for the thread. If stack_size is set to 0 then the kernel will create a default size stack. Likewise the pri argument allows the setting of the thread's scheduling priority. If set to a negative value then the kernel will choose a priority in the system thread priority band. See the realtime(5) man page for more information on selecting priority. The flags argument is currently unused. The thread's stack size and scheduling priority can be custimized through the XThread Control Interface (XTCI) in the irix.sm file. drv_thread_create will return either 0 to indicate success or an error code on failure. drv_thread_exit will not return. HISTORY drv_thread_create() and drv_thread_exit() were added in IRIX 6.5.17. SEE ALSO realtime()