Commit Graph

394 Commits

Author SHA1 Message Date
Chun-Hung Tseng
adb2d21af2 Fix the pdf generation code in Makefile
The current Makefile is missing one more pdflatex pass.

The correct steps are : pdflatex -> bibtex -> pdflatex -> pdflatex [1]. Otherwise, bib items will not be showing properly.

[1] https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#latex-recipes

Signed-off-by: Chun-Hung Tseng <henrybear327@gmail.com>
2022-03-18 19:10:23 +01:00
Jim Huang
60bed94bad
Merge pull request #143 from linD026/master
Improve the description of finding syscall table
2022-03-17 08:13:26 +08:00
linD026
85ee0ec67b Improve the description of finding syscall table
Presently, the representation of showing which version will use the
method to find out the system call table is vague.

Related discussion:
* sysprog21/lkmpg: https://github.com/sysprog21/lkmpg/pull/142
2022-03-17 07:51:59 +08:00
Jim Huang
19521bc60a Refine wording on module loading
Close #134
2022-03-16 14:32:08 +08:00
Jim Huang
356723c824
Merge pull request #141 from steven1lung/master
Fix grammar and typo
2022-03-09 14:23:17 +08:00
Steven Lung
d771c50166 Fix grammar 2022-03-09 14:14:08 +08:00
Jim Huang
ef2939ef61
Merge pull request #140 from steven1lung/master
Fix typo, grammar and remove duplicated words
2022-03-07 17:11:05 +08:00
Steven Lung
5ca9b642a4 Fix typo, grammar and remove duplicated words
Replaced 'a' with 'an' since a vowel sound is after.
2022-03-07 16:56:13 +08:00
Bob Lee
844beed5d7
Fix a logic error in examples/ioctl.c (#137)
Change the "alloc_ret" and "cdev_ret" initial values to non-zero.
According to the source code, "alloc_chrdev_region" and "cdev_add"
return zero on success, and negative code on failure.

So, if the "alloc_chrdev_region" failed, the if condition becomes true,
then we will jump to the label "error" by goto, checking each return
value whether is a success state from both functions mentioned above
and dealing with it properly for exiting the process.

However, it checks the success state by comparing the return value
with zero (means success), and we got "cdev_ret == 0" is true from
the initial value zero, while we didn't execute "cdev_add" yet.
Hence, there was a logic error when the initial value is zero.

Co-authored-by: NOVBobLee <defru04002@gamil.com>
2022-02-21 00:58:47 +08:00
linD026
d8216ff7b6
Fix incoherent ioctl examples (#139)
Previously ioctl.c is a userspace program for chardev2.c and chardev.h [1].
But now, this file is an independent kernel module, and the original code
disappear.
This patch adds back the original userspace code and renames it to
userspace_ioctl.c.

[1] https://tldp.org/LDP/lkmpg/2.4/html/x856.html
2022-02-21 00:53:29 +08:00
Ching-Hua (Vivian) Lin
fb15882377
Add book cover (#136)
Both PDF and HTML generation are supported.
2022-01-09 20:26:07 +08:00
萌新阿岩
5c0f9b0abc
Update Makefile and Add explanation (#133)
Add `PWD := $(CURDIR)` in Makefile and the explanation about `sudo make`
when only having `PWD`.
2021-12-28 20:45:50 +08:00
Jim Huang
785c2fe600
Merge pull request #135 from RinHizakura/master
Revise chardev registration
2021-12-25 14:48:13 +08:00
RinHizakura
2cc4264f72 Introduce the new method for chardev registration
Instead of using the old register_chrdev / unregister_chrdev API,
cdev interface which is newer and would be better for new driver programmers
in most cases. This commit is trying to give the brief overview for
this different interface.
2021-12-23 21:12:14 -08:00
Jim Huang
e4016013b2 modinfo does not require superuser permission 2021-12-04 16:13:22 +00:00
Jim Huang
b4ba4cfc9b
Merge pull request #130 from lyctw/master
Fix typo
2021-11-16 16:01:56 +08:00
lyctw
e2a6fcdae9 Fix typo 2021-11-16 14:50:01 +08:00
Jim Huang
17162018fe
Merge pull request #128 from sudoliyang/patch-2
Fix typo
2021-11-08 22:30:20 +08:00
Jim Huang
19b4d4bd22
Merge pull request #127 from sudoliyang/patch-1
Fix typo
2021-11-08 22:14:16 +08:00
Liyang Zhang
f07d5d564d
Fix typo 2021-11-08 22:10:21 +08:00
Liyang Zhang
f5600a4ead
Fix typo 2021-11-08 22:07:08 +08:00
Jim Huang
d88d0cd227
Merge pull request #123 from fennecJ/patch
Generate contributor list as a modular inclusion
2021-11-08 12:07:57 +08:00
manbing
07a9741f79
Adjust the position of Figure 1 (#126) 2021-11-08 12:06:19 +08:00
fennecJ
af09a8a1e5 Add script to gen contributor list and contrib.tex
This script do mainly 2 things:
1.
Generate file `Contributors` with git log in following format:
Contributor's name,<1-st e-mail>[,<2nd e-mail>][,<3rd e-mail>]...
The 2-nd email and so on are based on file `.mailmap` in the root
directory of the repo.
Note that it will also append contributors in File `Include`; and
will NOT append contributors in File `Exclude`.
If there are new contributors, script will sort `Contributor` after
append new contributors into each file; Otherwise it do nothing.

2.
Generate contrib.tex based on `Contributors` into lib/contrib.tex in
following format:
[name], (reasonable width) % [1-st e-mail]
Which is inspired by The Not So Short Introduction to Latex 2e[1]

We need to maintain `.mailmap`, `Exclude` and `Include` manually.
All Chinese name should be converted into English/Pinyin in `.mailmap`,
otherwise we may need extra pkg for latex to parse Chinese characters.

[1] - https://tobi.oetiker.ch/lshort/lshort.pdf

Close #68
2021-11-03 19:32:48 +08:00
linD026
6b6b6635cf
CI: Introduce Smatch for static analysis (#125)
Smatch[1][2] is a pluggable static analysis for C. It may help us find
out the potential problem of the example code.

Doing with smatch, if set the --file-output flag, it will generate the
{}.c.smatch report for each c file. This will make a little bit
complicated to collect all the report messages. So, here we stay at the
default setting, stdout for the smatch messages.

For more information, see:
- https://lwn.net/Articles/696624/
- https://elinux.org/images/d/d3/Bargmann.pdf

Also, fix the warning from Smatch:

Smatch failed: 1 warning(s), 1 error(s)
lkmpg/examples/procfs2.c:57 procfile_write() error: buffer overflow 'procfs_buffer' 1024 <= 1024
lkmpg/examples/kbleds.c:58 kbleds_init() warn: argument 5 to %lx specifier is cast from pointer

Furthermore, the effect of the write operation in procfs2.c is too
implied. So after writing, print the buffer every time.

Close #122

[1] https://github.com/error27/smatch
[2] https://repo.or.cz/w/smatch.git
2021-11-01 08:20:41 +08:00
tzuyichan
b95f6f5cf6
Fix grammar
in the hope ... will -> in the hope that ... would
get -> got
where are ... gone -> where have ... gone
For those not -> For those who are not
2021-10-27 05:00:05 +08:00
demonsome
67149719a4
Explain inode at the first occurrence (#115)
The explanation of "inode" should appear at the first occurrence to which readers
can refer.
2021-10-25 22:46:02 +08:00
Jim Huang
28018227fc Remove out-of-date syscall information
Close #121
2021-10-14 20:51:09 +08:00
Jim Huang
151a91ecf4 Fix wording 2021-10-10 21:45:12 +08:00
Kellegram
dbac3869c7
Add Manrope variable font (#118)
Manrope is an open-source modern sans-serif font family.
2021-10-10 21:34:25 +08:00
Jim Huang
1cb35ac976
Merge pull request #120 from linD026/master
CI: Introduce GCC static analysis
2021-10-08 20:58:52 +08:00
linD026
d6e1044aa7 CI: introduce GCC static analysis
Since GCC version 10, there has been a new option -fanalyzer for
static analysis. It can make the CI pipeline more comprehensive.

Also, the static analysis updates in GCC 11, but we cannot install
the GCC 11 in ubuntu 20.04 straightforwardly right now, which is
the GitHub workflow environment (see status-check.yaml).
For this reason, we stay at the GCC 10.

Close #117

Reference
- https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Static-Analyzer-Options.html
- https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10
- https://lwn.net/Articles/870290/
- https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11
- 7d73c3e9c5
2021-10-08 19:41:22 +08:00
Jim Huang
b0bbe0121f
Merge pull request #119 from marconi1964/master
Improve grammar
2021-09-29 22:20:49 +08:00
Marconi Jiang
89755e146a Correct English gramma 2021-09-29 06:41:31 -07:00
Jim Huang
0a176fbb19 Simplify the epilog 2021-09-25 19:53:13 +08:00
Jim Huang
707e193cbe Always run "dmesg" with sudo
The dmesg command allows you to review the messages that are stored in the
ring buffer. Some Linux distributions have strict requirements for
dmesg, and you need to use sudo to use dmesg.
2021-09-25 02:09:13 +08:00
Jim Huang
11e40dc8ef Remove unintended code block 2021-09-25 02:06:26 +08:00
Marconi Jiang
a1c3cca6db
Dump the message of hello-5 explicitly (#112)
Close #111
2021-09-25 02:03:44 +08:00
Jim Huang
238921037a
Merge pull request #114 from fennecJ/patch
CI: Keep workflow running even if no release tag found
2021-09-24 15:48:22 +08:00
fennecJ
76c7b0edbd Keep workflow running even if no release tag found
The action we used to delete the old release somehow cannot find the
release tag in forked repo and cause the workflow failed.
To solve this issue, simply setting `fail-if-no-release` option to false
will do the trick.
2021-09-24 13:34:32 +08:00
linD026
0d5ac2a5e2
CI: Enforce status checks once pull requests received (#113)
We tend to reject the pull requests if they fail to pass coding style checks
and static analysis.

See https://www.wesleyhaakman.org/working-with-pull-requests-status-checks-arm-templates-and-github-actions/
2021-09-23 20:01:13 +08:00
linD026
1a6fb67cf2
Fix potential concurrent access problems with VFS (#108)
Since Linux v3.14, the read, write and seek operations of "struct file" are
guaranteed for thread safety [1][2]. This patch added an explanation.

Here are the potential problems:
chardev.c:
- Move the "msg_ptr" pointer into the read function to remove unnecessary usage.
- List the clear states of "already_open" by using mnemonic enumeration.

chardev2.c:
- The "buffer" in the write function is user space data. It cannot use in the
  kernel space.
- Reduce the redundant type transformation.
- List the states of "already_open". Same as chardev.c.

[1] https://lore.kernel.org/lkml/20140303210359.26624.qmail@science.horizon.com/T/#u
[2] 9c225f2655
2021-09-23 12:20:10 +08:00
Jim Huang
027f39c0c1 Denote LWN hyperlink 2021-09-23 00:36:42 +08:00
Jim Huang
37f9a86fec Mention the Online Books Page 2021-09-22 01:38:39 +08:00
Jim Huang
81a1e88c64
Merge pull request #109 from YLowy/master
Fix typo
2021-09-19 20:47:19 +08:00
Ylowy
24257e837e
Typo. 2021-09-19 20:39:56 +08:00
Jim Huang
09e636cc80
Merge pull request #107 from sprowell/master
Fixed parameter name for hello-5.
2021-09-16 04:19:49 +08:00
Stacy Prowell
728b7fd432
Fixed parameter name for hello-5.
Parameters are case-sensitive, so myintArray is different from myintarray, and people who are running the example with copy/paste will find it doesn't work as described in the text.
2021-09-15 16:05:26 -04:00
Jim Huang
7fd696cb95
Merge pull request #106 from linD026/master
CI: Integrate the Sparse into the CI pipeline
2021-09-15 13:27:02 +08:00
linD026
25d82ec47f CI: Integrate the Sparse into the CI pipeline
Sparse[1] is a semantic parser for C language, it can find out the
potential problem of the example code.

[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-15 12:43:56 +08:00