MODULE_EXIT(9) Driver Basics MODULE_EXIT(9)NAME
module_exit - driver exit entry point
SYNOPSIS
module_exit(x);
ARGUMENTS
x
function to be run when driver is removed
DESCRIPTION
module_exit will wrap the driver clean-up code with cleanup_module when used with rmmod when the driver is a module. If the driver is
statically compiled into the kernel, module_exit has no effect. There can only be one per module.
COPYRIGHT Kernel Hackers Manual 3.10 June 2014 MODULE_EXIT(9)
Check Out this Related Man Page
DRIVER_MODULE(9) BSD Kernel Developer's Manual DRIVER_MODULE(9)NAME
DRIVER_MODULE -- kernel driver declaration macro
SYNOPSIS
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
DRIVER_MODULE(name, busname, driver_t driver, devclass_t devclass, modeventhand_t evh, void *arg);
MULTI_DRIVER_MODULE(name, busname, driver_t drivers[], devclass_t devclass, modeventhand_t evh, void *arg);
DESCRIPTION
The DRIVER_MODULE() macro declares a kernel driver. DRIVER_MODULE() expands to the real driver declaration, where the phrase name is used as
the naming prefix for the driver and its functions. Note that it is supplied as plain text, and not a char or char *.
busname is the parent bus of the driver (PCI, ISA, PPBUS and others), e.g. 'pci', 'isa', or 'ppbus'.
The identifier used in DRIVER_MODULE() can be different from the driver name. Also, the same driver identifier can exist on different
busses, which is a pretty clean way of making front ends for different cards using the same driver on the same or different busses. For
example, the following is allowed:
DRIVER_MODULE(foo, isa, foo_driver, foo_devclass, NULL, NULL);
DRIVER_MODULE(foo, pci, foo_driver, foo_devclass, NULL, NULL);
driver is the driver of type driver_t, which contains the information about the driver and is therefore one of the two most important parts
of the call to DRIVER_MODULE().
The devclass argument contains the kernel-internal information about the device, which will be used within the kernel driver module.
The evh argument is the event handler which is called when the driver (or module) is loaded or unloaded (see module(9)).
The arg is unused at this time and should be a NULL pointer.
MULTI_DRIVER_MODULE() is a special version of DRIVER_MODULE(), which takes a list of drivers instead of a single driver instance.
SEE ALSO device(9), driver(9), module(9)AUTHORS
This manual page was written by Alexander Langer <alex@FreeBSD.org>.
BSD May 16, 2000 BSD
hi,
one of our customer is facing an issue with jiffies wrap up.
on a 32 bit machine, the variable jiffies count upto 472 days.
the customer's server was up for 472 days ('uptime') and to reproduce
the same, i tried to change the variable HZ in linux-2.6..23.9/include/asm-i386/param.h
from... (0 Replies)
Hi There,
I want to make sure that kmem_cache_alloc is not called concurrently with kmem_cache_destroy on module exit and I want be able to use GFP_KERNEL for the kmem_cache_alloc calls.
Would a read/write lock be good fro this purpose or is there another method I should be using?
Regards,... (0 Replies)
Hello,
I have develop a driver for my hardware and now, I need to handle a IRQ but I does not work.
As I can understand, to handle a irq, it is necessary to make a request_irq(). If the return value is zero, ok, no problem to handle irq.
Here is a easy example of my driver:
#include... (8 Replies)
Hi,
I found on linuxgazette.net/93/bhaskaran.html page very useful sample of virtual driver (not connected to real hardware).
I try to compile it with no effect.
So:
I got fresh Ubuntu 9.10 (kernel 2.6.31-14)
My source is saved in networkAdapter.c file in /usr/src/myModules directory.
I... (21 Replies)
Hey,
I'm currently getting into some kernel module progamming. As a little exercise I want to read the headers out of an ELF file. My code is very simple, here is the important part:
struct file *fp;
/* ... */
fp = filp_open("some/file/on/my/pc", O_RDONLY, 0);
if(fp == NULL) {
... (15 Replies)
Hi I actually wrote a simple module and I need to call a bin file from that module. Could you give me some hints how to do that?
(I tried with stdlib.h and 'system()', but cannot call that function from a module).
Regards. (28 Replies)
cannot generate .ko file on my linux, although it can generate module.symvers.
But when I copy .c file and Makefile to another linux computer, there's no problem.
The strange thing is: make is successfuly executed, and returned 0;
make output:
make -C /lib/modules/2.6.18-92.el5xen/build ... (4 Replies)
I am facing a problem while building the device driver code.
I am using suse linux "2.6.31.5-0.1-desktop" on my Laptop.
I have copied a folder containing self written device driver files from Mandriva linux to my system having Suse Linux.
I copied the entire folder in "/home/netuser/sun/".... (4 Replies)
Hello all ,
i need some help asap
i have a program that keeps killing the machine
when i did google searches and 2 days later i ran strace
it seems the programm keeps making a system call to gettimeofday
to i guess increment a counter ?
gettimeofday({1347986584, 464904}, NULL) = 0... (6 Replies)
I'm a beginner to the Linux programming and trying my hands on some device driver examples while practising. The below code (a trimmed down version of tiny_tty.c from ldd3 book) loads perfectly using insmod and I'm able to see it in /proc/tty/drivers , /proc/modules and device nodes are getting... (1 Reply)
I wrote this kernel module to test the correctness of ndelay() function.
Kernel mdoule:
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/delay.h>
static int __init initialize(void)
{
ktime_t start, end;
s64... (1 Reply)