libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
ioctl_example.c File Reference

An example loadable kernel module (LKM) that can display a message in the /var/log/[kern.log|messages] file when the module is loaded and removed. The module can accept an argument when it is loaded – the name, which appears in the kernel log files. More...

#include "config.h"
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
Include dependency graph for ioctl_example.c:

Go to the source code of this file.

Functions

 MODULE_LICENSE (LIBJMMCG_MODULE_LICENSE)
 The license type – this affects runtime behavior. More...
 
 MODULE_AUTHOR (LIBJMMCG_MODULE_AUTHOR)
 The author – visible when you use modinfo. More...
 
 MODULE_DESCRIPTION (LIBJMMCG_MODULE_DESCRIPTION)
 The description – see modinfo. More...
 
 MODULE_VERSION (LIBJMMCG_MODULE_VERSION)
 The version of the module. More...
 
 module_param (name, charp, S_IRUGO)
 Param desc. charp = char ptr, S_IRUGO can be read/not changed. More...
 
 MODULE_PARM_DESC (name, "The module name to display in /var/log/kern.log")
 Parameter description. More...
 
 module_init (init_the_module)
 A module must use the module_init() module_exit() macros from linux/init.h, which identify the initialization function at insertion time and the cleanup function (as listed above). More...
 
 module_exit (exit_the_module)
 

Detailed Description

An example loadable kernel module (LKM) that can display a message in the /var/log/[kern.log|messages] file when the module is loaded and removed. The module can accept an argument when it is loaded – the name, which appears in the kernel log files.

Details for how to create this came from:

  1. aaaa

Definition in file ioctl_example.c.

Function Documentation

◆ MODULE_AUTHOR()

MODULE_AUTHOR ( LIBJMMCG_MODULE_AUTHOR  )

The author – visible when you use modinfo.

◆ MODULE_DESCRIPTION()

MODULE_DESCRIPTION ( LIBJMMCG_MODULE_DESCRIPTION  )

The description – see modinfo.

◆ module_exit()

module_exit ( exit_the_module  )

◆ module_init()

module_init ( init_the_module  )

A module must use the module_init() module_exit() macros from linux/init.h, which identify the initialization function at insertion time and the cleanup function (as listed above).

◆ MODULE_LICENSE()

MODULE_LICENSE ( LIBJMMCG_MODULE_LICENSE  )

The license type – this affects runtime behavior.

◆ module_param()

module_param ( name  ,
charp  ,
S_IRUGO   
)

Param desc. charp = char ptr, S_IRUGO can be read/not changed.

◆ MODULE_PARM_DESC()

MODULE_PARM_DESC ( name  ,
"The module name to display in /var/log/kern.log"   
)

Parameter description.

◆ MODULE_VERSION()

MODULE_VERSION ( LIBJMMCG_MODULE_VERSION  )

The version of the module.