Skip to contentSkip to conversation

about kernel_thread!

DISCUSSION Zhenyu Wu 2 participants 2 messages Dec 13, 2004

lore
Share & tools
lore

Zhenyu Wu

author
#0 lore raw

Oh, my god. I find another problem, my linux kernel is 2.4.20, and i can't find the function allow_signal at all. BTW, whether there is such funcion in kernel 2.4.20?

Thanks,
Zhenyu Wu

Quoted 6 lines

From: Juergen Quade <[email protected]>
Reply-To:
To: Zhenyu Wu <[email protected]>
Subject: Re: about kernel_thread!
Date:Mon, 13 Dec 2004 13:44:26 +0100

Quoted 7 lines
Quoted 6 lines · Zhenyu Wu

Hello,

I have some confusions on kernel_thread, so I want to get help.

I want to create a thread in a loadable module, then I used the function kernel_thread() in init_module(). Of course, the thread was created, but when

I

Quoted 1 line
Quoted 1 line

remove the module there are errors. I think it is because of the thread I

have

Quoted 1 line
Quoted 1 line

created that have not been killed. So, how can I kill this thread when I

remove

Quoted 12 lines
Quoted 1 line

the module?

You can find sample-code here:
http://ezs.kr.hsnr.de/TreiberBuch/Download/TreiberEntwickeln2004261/6-9-kthread.c

Juergen.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 7 lines · Zhenyu Wu

Oh, my god. I find another problem, my linux kernel is 2.4.20, and i can't find the function allow_signal at all. BTW, whether there is such funcion in kernel 2.4.20?

Thanks,
Zhenyu Wu

Normally we do our own work... However, if you understand macros, these might help you.

//
// Copyright(c) 2004 Analogic Corporation
//
//

//  This program may be distributed under the GNU Public License
//  version 2, as published by the Free Software Foundation, Inc.,
//  59 Temple Place, Suite 330 Boston, MA, 02111.

// //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

#ifndef _CONFIG_H_
#define _CONFIG_H_ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //
// Below are macros to handle different kernel versions.
//
#ifndef IRQ_HANDLED
#define IRQ_HANDLED typedef void irqreturn_t;
#endif

#ifdef KVER6
#define REMAP(a,b,c,d,e) remap_page_range((a), (b), (c), (d), (e)) #define __io_virt(p) ((void *)(p))

#define DAEMONIZE             \
    daemonize("%s", devname); \
    allow_signal(SIGTERM)

#define PCI_FIND_DEVICE(a,b,c) pci_get_device((a),(b),(c)) #else
#define lock_kernel()
#define unlock_kernel()
#define REMAP(a,b,c,d,e) remap_page_range((b), (c), (d), (e))

#define DAEMONIZE                          \
    exit_files(current);                   \
    daemonize();                           \
    spin_lock_irq(&current->sigmask_lock); \
    sigemptyset(&current->blocked);        \
    recalc_sigpending(current);            \
    spin_unlock_irq(&current->sigmask_lock)

#define PCI_FIND_DEVICE(a,b,c) pci_find_device((a),(b),(c)) #endif
#endif

Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.