README (41681) | README (66549) |
---|---|
1# Copyright (c) 1998 Rajesh Vaidheeswarran 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 44 unchanged lines hidden (view full) --- 53# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59# SUCH DAMAGE. 60# | 1# Copyright (c) 1998 Rajesh Vaidheeswarran 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions 6# are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. --- 44 unchanged lines hidden (view full) --- 53# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59# SUCH DAMAGE. 60# |
61# $FreeBSD: head/share/examples/kld/cdev/README 66549 2000-10-02 14:14:07Z sobomax $ 62# |
|
61 621.0 Overview 63 64 This is the README file for the sample kld module 65 that mimics a character device driver. 66 67 A kld module may be used to load any data or 68 program into the kernel that can be made available by --- 9 unchanged lines hidden (view full) --- 78 This is not enforced, so you may use the kld module 79 any way you see fit. 80 81 As with the loadable system calls, it may be desirable to 82 allow the module loader to replace an *existing* entry to 83 try out changes to kernel code without rebuilding and 84 booting from the new kernel. 85 | 63 641.0 Overview 65 66 This is the README file for the sample kld module 67 that mimics a character device driver. 68 69 A kld module may be used to load any data or 70 program into the kernel that can be made available by --- 9 unchanged lines hidden (view full) --- 80 This is not enforced, so you may use the kld module 81 any way you see fit. 82 83 As with the loadable system calls, it may be desirable to 84 allow the module loader to replace an *existing* entry to 85 try out changes to kernel code without rebuilding and 86 booting from the new kernel. 87 |
88 The idea behind this example is to show some interaction 89 with the device driver. Therefore the flow of the code that 90 this driver is aimed at is as follows: |
|
86 | 91 |
92 open(2) -> ioctl(2) -> write(2) -> read(2) -> close(2). 93 94 We will first open the device in the /dev/ directory; then 95 we will send an ioctl message to it using ioctl(2) call; 96 then write a small string via the write(2) call. This string 97 we write to the device will be stored in a static buffer, 98 and later will be accessible via the read(2) call. Finally, 99 we will close(2) our open()'d device so that we may no 100 longer make read or write calls on it. 101 |
|
872.0 Directions 88 89 To test the module, do the following: 90 91 cd module 92 make load 93 94 A load message (the copyright) will be printed on the console. --- 22 unchanged lines hidden --- | 1022.0 Directions 103 104 To test the module, do the following: 105 106 cd module 107 make load 108 109 A load message (the copyright) will be printed on the console. --- 22 unchanged lines hidden --- |