[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: pthread in kernel modules?
Can anyone point me to any documentation on kernel_thread() ?
I've asked this question before, but without much response.
I found *some* notes about it here:
http://www.brics.dk/~kasperd/comp.os.linux.development.faq.html
But its not mentioned in O'Reilly's 'Linux Device Drivers' book.
neither is it documented here:
http://www.kernelnewbies.org/documents/kdoc/kernel-api/linuxkernelapi.html
In particular I would like to know how to wait on a kernel thread to exit ?
thanks
dom
> -----Original Message-----
> From: Chris Wright [mailto:chris@wirex.com]
> Sent: Monday, December 02, 2002 6:39 PM
> To: Theodore Kim
> Cc: kernelnewbies@nl.linux.org
> Subject: Re: pthread in kernel modules?
>
>
> * Theodore Kim (shkim7@web.dwe.co.kr) wrote:
> > Hi all,
> > ?
> > I was?shocked to see the codelets in some handouts.
> > ?
> > int init_module()
> > {?? pthread_create(abc, NULL, my_thread, NULL); }
> > ?
> > Could this ever be possible?
>
> No (unless kernel is patched to export a function with the above
> prototype, which would be very odd). Nothing from c library or other
> userspace libraries is available in kernel code. You'll find a few
> niceties in the kernel source, for example in lib/string.c, that are
> typically supplied by c library, but nothing like pthreads!
>
> > To the best of my knowledge, only macros and static inline
> functions defined
> > in *.h's and
> > functions that are listed in 'ksyms -a' can be used in kernel module
> > programming...
>
> Yes. From the point of view of the kernel source, if it isn't inline,
> macro or exported via EXPORT_SYMBOL, it isn't available for
> module code.
>
> > I used kernel_thread() several times but never ever though
> of using pthread
> > in kernel modules.
>
> kernel_thread would be the right thing if you want to create
> a thread in
> a module.
>
> -chris
> --
> Linux Security Modules http://lsm.immunix.org
http://lsm.bkbits.net
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/