Hiten Pandya wrote:

> Ok, I cant find any man page called shutdown_kproc in either 4.3 or 4.4.
> Anyway, he wants to destroy a "thread", and not an "internal" daemon/process.
>
> To destroy a kernel thread, you need to make use of the kthread_exit()
> operation.  It is prototyped as follows:
>
> void kthread_exit(ecode);
>
> The *ecode* arg to kthread_exit() is used to specify the return code of
> the thread which you are going to terminate.
>
> Additonal Information can be found from:
> kthread(9)  -- (available in FreeBSD 5.0)
> sys/kthread.h
>
> HTH.
>
> Hiten
> [EMAIL PROTECTED], [EMAIL PROTECTED]
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message

Ok, I found the way! :-)
On loading my kernel module, I call kthread_create to create the thread
(kproc_start is only a wrapper to it). Doing this, I also obtain the pid of new
process: this one enters in a loop as shown below:

while (var == 0) {
    kproc_suspend_loop(procp);
    .....
    tsleep(procp, PUSER, "procslp", hz);
}
kthread_exit(0);

On unloading this module, I set to 1 'var' and let the thread exits.

I hope this the right way to do it.
Thanx to everyone, guy :-)

Ferruccio

PS: oohh my english......


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to