GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DEV_MODULE (9)

NAME

DEV_MODULE - device driver module declaration macro

CONTENTS

Synopsis
Description
Examples
See Also
Authors

SYNOPSIS


.In sys/param.h
.In sys/kernel.h
.In sys/module.h
.In sys/conf.h DEV_MODULE name modeventhand_t evh void *arg

DESCRIPTION

The DEV_MODULE macro declares a device driver kernel module. It fills in a
.Vt moduledata_t structure and then calls DECLARE_MODULE with the correct args, where name is the name of the module and evh (with its argument arg) is the event handler for the module (refer to DECLARE_MODULE(9) for more information). The event handler is supposed to create the device with make_dev on load and to destroy it when it is unloaded using destroy_dev.

EXAMPLES

#include <sys/module.h>
#include <sys/conf.h>

static struct cdevsw foo_devsw = { ... };

static struct cdev *sdev;

static int foo_load(module_t mod, int cmd, void *arg) { int err = 0;

switch (cmd) { case MOD_LOAD: sdev = make_dev(&foo_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "foo"); break; /* Success*/

case MOD_UNLOAD: case MOD_SHUTDOWN: destroy_dev(sdev); break; /* Success*/

default: err = EINVAL; break; }

return(err); }

DEV_MODULE(foo, foo_load, NULL);

SEE ALSO

DECLARE_MODULE(9), destroy_dev(9), make_dev(9), module(9)

AUTHORS

This manual page was written by
.An Alexander Langer Aq alex@FreeBSD.org .
Search for    or go to Top of page |  Section 9 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.