1
0
mirror of https://github.com/bashrc/LKMPG.git synced 2018-06-11 03:06:54 +02:00

Stuff to do

This commit is contained in:
Bob Mottram
2016-03-09 17:40:31 +00:00
parent fa7d4ce334
commit afd2e66883
2 changed files with 11 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2016-03-09 Wed 17:30 -->
<!-- 2016-03-09 Wed 17:40 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>The Linux Kernel Module Programming Guide</title>
@@ -1928,7 +1928,7 @@ Here a simple example showing how to use a <b>/proc</b> file. This is the HelloW
</p>
<p>
The <b>/proc/helloworld</b> is created when the module is loaded with the function create_proc_entry. The return value is a 'struct proc_dir_entry <b>', and it will be used to configure the file */proc/helloworld</b> (for example, the owner of this file). A null return value means that the creation has failed.
The <b>/proc/helloworld</b> is created when the module is loaded with the function <b>proc_create</b>. The return value is a <b>struct proc_dir_entry</b> , and it will be used to configure the file <b>/proc/helloworld</b> (for example, the owner of this file). A null return value means that the creation has failed.
</p>
<p>
@@ -2400,6 +2400,10 @@ Seq_file provides basic functions for file_operations, as seq_read, seq_lseek, a
<div id="outline-container-orgheadline55" class="outline-4">
<h4 id="orgheadline55">Example: procfs4.c</h4>
<div class="outline-text-4" id="text-orgheadline55">
<p>
TODO: this will be out of date because of create_proc_entry
</p>
<div class="org-src-container">
<pre class="src src-c"><span class="org-doc">/**</span>
@@ -3467,7 +3471,7 @@ hostname:~/lkmpg-examples/09-BlockingProcesses#
<h3 id="orgheadline65">Example: sleep.c</h3>
<div class="outline-text-3" id="text-orgheadline65">
<p>
TODO: this will be out of date
TODO: this will be out of date because of create_proc_entry
</p>
<div class="org-src-container">

View File

@@ -1053,7 +1053,7 @@ Because we don't get called when the file is opened or closed, there's nowhere f
Here a simple example showing how to use a */proc* file. This is the HelloWorld for the */proc* filesystem. There are three parts: create the file */proc/ helloworld* in the function init_module, return a value (and a buffer) when the file */proc/helloworld* is read in the callback function *procfs_read*, and delete the file */proc/helloworld* in the function cleanup_module.
The */proc/helloworld* is created when the module is loaded with the function create_proc_entry. The return value is a 'struct proc_dir_entry *', and it will be used to configure the file */proc/helloworld* (for example, the owner of this file). A null return value means that the creation has failed.
The */proc/helloworld* is created when the module is loaded with the function *proc_create*. The return value is a *struct proc_dir_entry* , and it will be used to configure the file */proc/helloworld* (for example, the owner of this file). A null return value means that the creation has failed.
Each time, everytime the file */proc/helloworld* is read, the function procfs_read is called. Two parameters of this function are very important: the buffer (the first parameter) and the offset (the third one). The content of the buffer will be returned to the application which read it (for example the cat command). The offset is the current position in the file. If the return value of the function isn't null, then this function is called again. So be careful with this function, if it never returns zero, the read function is called endlessly.
@@ -1475,6 +1475,8 @@ digraph seq_file {
Seq_file provides basic functions for file_operations, as seq_read, seq_lseek, and some others. But nothing to write in the /proc file. Of course, you can still use the same way as in the previous example.
*** Example: procfs4.c
TODO: this will be out of date because of create_proc_entry
#+BEGIN_SRC c
/**
* procfs4.c - create a "file" in /proc
@@ -2416,7 +2418,7 @@ hostname:~/lkmpg-examples/09-BlockingProcesses#
#+END_SRC
** Example: sleep.c
TODO: this will be out of date
TODO: this will be out of date because of create_proc_entry
#+BEGIN_SRC c
/*