|
Lines 23-33
Link Here
|
| 23 |
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 |
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 24 |
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 |
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 |
.\" |
25 |
.\" |
| 26 |
.\" $FreeBSD: src/share/man/man9/kthread.9,v 1.18 2008/04/29 22:43:15 julian Exp $ |
26 |
.\" $FreeBSD: src/share/man/man9/kthread.9,v 1.18 2008/04/29 22:43:15 julian Exp $ |
| 27 |
.\" |
27 |
.\" |
| 28 |
.Dd October 26, 2007 |
28 |
.Dd August 3, 2008 |
| 29 |
.Dt KTHREAD 9 |
29 |
.Dt KTHREAD 9 |
| 30 |
.Os |
30 |
.Os |
| 31 |
.Sh NAME |
31 |
.Sh NAME |
| 32 |
.Nm kthread_start , |
32 |
.Nm kthread_start , |
| 33 |
.Nm kthread_shutdown , |
33 |
.Nm kthread_shutdown , |
|
Lines 41-64
Link Here
|
| 41 |
.In sys/kthread.h |
41 |
.In sys/kthread.h |
| 42 |
.Ft void |
42 |
.Ft void |
| 43 |
.Fn kthread_start "const void *udata" |
43 |
.Fn kthread_start "const void *udata" |
| 44 |
.Ft void |
44 |
.Ft void |
| 45 |
.Fn kthread_shutdown "void *arg" "int howto" |
45 |
.Fn kthread_shutdown "void *arg" "int howto" |
| 46 |
.Ft int |
|
|
| 47 |
.Fo kthread_add |
| 48 |
.Fa "void (*func)(void *)" "void *arg" "struct proc *procp" |
| 49 |
.Fa "struct thread **newtdpp" "int flags" "int pages" |
| 50 |
.Fa "const char *fmt" ... |
| 51 |
.Fc |
| 52 |
.Ft void |
46 |
.Ft void |
| 53 |
.Fn kthread_exit "void" |
47 |
.Fn kthread_exit "void" |
| 54 |
.Ft int |
48 |
.Ft int |
| 55 |
.Fn kthread_resume "struct thread *td" |
49 |
.Fn kthread_resume "struct thread *td" |
| 56 |
.Ft int |
50 |
.Ft int |
| 57 |
.Fn kthread_suspend "struct thread *td" "int timo" |
51 |
.Fn kthread_suspend "struct thread *td" "int timo" |
| 58 |
.Ft void |
52 |
.Ft void |
| 59 |
.Fn kthread_suspend_check "struct thread *td" |
53 |
.Fn kthread_suspend_check "struct thread *td" |
|
|
54 |
.In sys/unistd.h |
| 55 |
.Ft int |
| 56 |
.Fo kthread_add |
| 57 |
.Fa "void (*func)(void *)" "void *arg" "struct proc *procp" |
| 58 |
.Fa "struct thread **newtdpp" "int flags" "int pages" |
| 59 |
.Fa "const char *fmt" ... |
| 60 |
.Fc |
| 60 |
.Ft int |
61 |
.Ft int |
| 61 |
.Fo kproc_kthread_add |
62 |
.Fo kproc_kthread_add |
| 62 |
.Fa "void (*func)(void *)" "void *arg" |
63 |
.Fa "void (*func)(void *)" "void *arg" |
| 63 |
.Fa "struct proc **procptr" "struct thread **tdptr" |
64 |
.Fa "struct proc **procptr" "struct thread **tdptr" |
| 64 |
.Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." |
65 |
.Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." |
|
Lines 140-151
Link Here
|
| 140 |
If this argument is |
141 |
If this argument is |
| 141 |
.Dv NULL , |
142 |
.Dv NULL , |
| 142 |
then it is ignored. |
143 |
then it is ignored. |
| 143 |
The |
144 |
The |
| 144 |
.Fa flags |
145 |
.Fa flags |
| 145 |
argument specifies a set of flags as described in |
146 |
argument can be set to RFSTOPPED, to leave thread in a stopped state. |
| 146 |
.Xr rfork 2 . |
|
|
| 147 |
The |
147 |
The |
| 148 |
.Fa pages |
148 |
.Fa pages |
| 149 |
argument specifies the size of the new kernel thread's stack in pages. |
149 |
argument specifies the size of the new kernel thread's stack in pages. |
| 150 |
If 0 is used, the default kernel stack size is allocated. |
150 |
If 0 is used, the default kernel stack size is allocated. |
| 151 |
The rest of the arguments form a |
151 |
The rest of the arguments form a |
|
Lines 272-298
Link Here
|
| 272 |
.Pp |
272 |
.Pp |
| 273 |
The |
273 |
The |
| 274 |
.Fn kthread_add |
274 |
.Fn kthread_add |
| 275 |
function will fail if: |
275 |
function will fail if: |
| 276 |
.Bl -tag -width Er |
276 |
.Bl -tag -width Er |
| 277 |
.It Bq Er EAGAIN |
277 |
.It Bq Er ENOMEM |
| 278 |
The system-imposed limit on the total |
278 |
Memmory for thread's stack couldn't be allocated. |
| 279 |
number of processes under execution would be exceeded. |
|
|
| 280 |
The limit is given by the |
| 281 |
.Xr sysctl 3 |
| 282 |
MIB variable |
| 283 |
.Dv KERN_MAXPROC . |
| 284 |
.It Bq Er EINVAL |
| 285 |
The |
| 286 |
.Dv RFCFDG |
| 287 |
flag was specified in the |
| 288 |
.Fa flags |
| 289 |
parameter. |
| 290 |
.El |
279 |
.El |
| 291 |
.Sh SEE ALSO |
280 |
.Sh SEE ALSO |
| 292 |
.Xr rfork 2 , |
|
|
| 293 |
.Xr exit1 9 , |
| 294 |
.Xr kproc 9 , |
281 |
.Xr kproc 9 , |
| 295 |
.Xr SYSINIT 9 , |
282 |
.Xr SYSINIT 9 , |
| 296 |
.Xr wakeup 9 |
283 |
.Xr wakeup 9 |
| 297 |
.Sh HISTORY |
284 |
.Sh HISTORY |
| 298 |
The |
285 |
The |