Re: kernel_thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for your replay, my friend.
I must remind you I am doing all these in kernel space, what I really
mean is everything is hard coded into Linux source code as an kernel
image instead of a driver or module. I doubt kthread_create() is
available in this sense.
However, I gave it a try and receive the following error while doing
"make zImage":
/home/cyu021/linux/init/main.c:384: undefined reference to `kthread_create'
make: *** [vmlinux] Error 1
Any help would be appreciated.

On 2/23/06, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> On Wed, 2006-02-22 at 23:44 +0800, James Yu wrote:
> > I just found this thread on
> > "http://mail.nl.linux.org/kernelnewbies/2003-09/msg00285.html";
> > and have an exactly opposite question.
> >
> > How do I remove a kernel thread in kernel mode ?
> > I write a C-function in one of the Linux source files and create a
> > kernel thread by invoking kernel_thread() to run the function, like:
> > "kernel_thread(a1, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL);"
> > Function a1 simply invokes printk() to output some message on console.
> > I invoke do_exit(0); at the end of a1, but a1's task_struct still
> > exists in in task_struct list after its execution.
>
> this is why kernel_thread is the wrong API, don't use it!
> Use kthread_create() and friends instead; that is a lot safer and better
> API.
>
>
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux