mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
Chapter 4 Finished, starting chapter 5
This commit is contained in:
parent
2e9165ae47
commit
a76643c253
2 changed files with 2970 additions and 21 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +1,25 @@
|
|||
---
|
||||
title: "Understanding C for Kernel Programming"
|
||||
author: "Edson Brandi"
|
||||
date: "2025-08-01"
|
||||
status: "planned"
|
||||
title: Understanding C for FreeBSD Kernel Programming
|
||||
author: Edson Brandi
|
||||
date: 2025-08-30
|
||||
status: draft
|
||||
part: 1
|
||||
chapter: 5
|
||||
reviewer: "TBD"
|
||||
translator: "TBD"
|
||||
reviewer: TBD
|
||||
translator: TBD
|
||||
estimatedReadTime: 30
|
||||
---
|
||||
|
||||
planned
|
||||
# Understanding C for FreeBSD Kernel Programming
|
||||
|
||||
In the last chapter, you learned the **language of C**, including its vocabulary of variables and operators, its grammar of control flow and functions, and its tools such as arrays, pointers, and structures. With practice, you can now write and understand complete C programs. That was a huge milestone, you can *speak C*.
|
||||
|
||||
But the kernel is not an ordinary place. Inside FreeBSD, C is spoken with its own **dialect**: the same words, but with special rules, idioms, and constraints. A user-space program may call `malloc()`, `printf()`, or use floating-point numbers without a second thought. In kernel space, those choices are either unavailable or dangerous. Instead, you’ll see `malloc(9)` with flags like `M_WAITOK`, kernel-specific string functions like `strlcpy()`, and strict rules against recursion or floating point.
|
||||
|
||||
Think of it like this: **Chapter 4 taught you the language; Chapter 5 teaches you the dialect spoken inside the FreeBSD kernel.** You already know how to form sentences; now you’ll learn how to be understood in a community with its own culture and expectations.
|
||||
|
||||
This chapter is about making that shift. You’ll see how kernel code adapts C to work under different conditions: no runtime library, limited stack space, and absolute demands for performance and safety. You’ll discover the types, functions, and coding practices that every FreeBSD driver relies on, and you’ll learn how to avoid the mistakes that even experienced C programmers make when they first step into kernel space.
|
||||
|
||||
By the end of this chapter, you won’t just know C, you’ll know how to **think in C the way the FreeBSD kernel thinks in C**, a mindset that will carry you through the rest of this book and into your own driver projects.
|
||||
|
||||
*Continue soon...*
|
||||
|
|
|
|||
Loading…
Reference in a new issue