NetBSD/sys/modules/examples
rin 2bc4fb1fcb Bump default value of WARNS for modules from 3 to 5, and
explicitly set WARNS for modules that fail with WARNS=5.

Also, turn on -Wno-missing-noreturn for clang for some files.

At the moment, among ~ 360 modules,
- 2 (lua and zfs) need WARNS=0
- 1 (solaris) needs WARNS=1
- 136 need WARNS=3 (mostly due to sign-compare)
- 4 need WARNS=4
- others can be compiled with WARNS=5

Discussed on tech-kern.
2019-02-17 04:05:41 +00:00
..
executor Add a new example kernel module 2018-04-13 20:30:09 +00:00
hello
luahello Fix instructions to match reality. (I renamed the example from the 2015-05-13 22:37:53 +00:00
luareadhappy Bump default value of WARNS for modules from 3 to 5, and 2019-02-17 04:05:41 +00:00
mapper Add a new example kernel module: mapper 2019-01-17 20:47:42 +00:00
panic_string Introduce new example kernel module: panic_string 2018-05-29 16:53:56 +00:00
ping
properties
readhappy Bump default value of WARNS for modules from 3 to 5, and 2019-02-17 04:05:41 +00:00
readhappy_mpsafe Bump default value of WARNS for modules from 3 to 5, and 2019-02-17 04:05:41 +00:00
sysctl Add new example kernel module: sysctl 2018-04-13 01:20:27 +00:00
Makefile Add a new example kernel module: mapper 2019-01-17 20:47:42 +00:00
Makefile.inc
README Add a new example kernel module: mapper 2019-01-17 20:47:42 +00:00

README

	$NetBSD: README,v 1.9 2019/01/17 20:47:42 kamil Exp $

                           Kernel Developer's Manual

DESCRIPTION
     The kernel example dynamic modules.

     This directory contains the following example modules:
     * executor        - basic implementation of callout and RUN_ONCE
     * hello           - the simplest `hello world' module
     * luahello        - the simplest `hello world' Lua module
     * luareadhappy    - demonstrates calling Lua code from C
     * mapper          - basic implementation of mmap
     * panic_string    - shows how panic is being called through a device
     * ping            - basic ioctl(9)
     * properties      - handle incoming properties during the module load
     * readhappy       - basic implementation of read(9) with happy numbers
     * readhappy_mpsafe- demonstrates how to make a module MPSAFE
     * sysctl          - demonstrates adding a sysctl handle dynamically

     To build the examples you need a local copy of NetBSD sources. You also
     need the comp set with toolchain. To build the module just enter a
     directory with example modules and use make(1):

         # make

     To load, unload, and stat the module use modload(8), modunload(8) and
     modstat(8).

     The S parameter in the Makefile files points to src/sys and it can be
     overloaded in this way:

         # make S=/data/netbsd/src/sys

     The code of a module does not need to be in src/sys unless you use
     the autoconf(9) framework.

     A cross-built of a module for a target platform is possible with the
     build.sh framework. You need to generate the toolchain and set
     appropriately PATH to point bin/ in the TOOLDIR path. An example command
     to cross-build a module with the amd64 toolchain is as follows:

        # nbmake-amd64 S=/data/netbsd/src/sys


     The example modules should not be used on a production machine.

     All modules that create a cdevsw should be verified that the major number
     should not conflict with a real device.

SEE ALSO
     modctl(2), module(7), modload(8), modstat(8), modunload(8), module(9),
     intro(9lua)

HISTORY
     An example of handling incoming properties first appeared in NetBSD 5.0
     and was written by Julio Merino with further modifications by Martin
     Husemann, Adam Hamsik, John Nemeth and Mindaugas Rasiukevicius.

     This document and additional modules (hello, readhappy, properties,
     ping, luahello and luareadhappy) first appeared in NetBSD 8.0; they were
     written by Kamil Rytarowski.

     The readhappy_mpsafe, executor and sysctls modules first appeared in NetBSD
     9.0 and were authored by Siddharth Muralee.

     The panic_string module first appeared in NetBSD 9.0 and was authored by
     Harry Pantazis.

     The mapper module first appeared in NetBSD 9.0 and was authored by
     Akul Pillai.

AUTHORS
     This document was written by Kamil Rytarowski.