The previous example wasn't reliably demonstrating the danger of missing null terminators because the stack happened to contain a '\0' byte immediately after the array, making the broken code appear to work. Added memset() to fill the stack with non-zero values before declaring the unterminated array. This ensures the broken example actually exhibits undefined behavior by reading past the array boundary, making the lesson about null terminators clear and visible. Changes: - Added garbage array filled with 'Z' characters using memset() - This forces printf() to read past the broken array until finding '\0' - Readers now see actual garbage output demonstrating why null terminators are required in C strings |
||
|---|---|---|
| content | ||
| examples | ||
| public/images | ||
| scripts | ||
| src/chapters | ||
| translations/pt_BR | ||
| LICENSE | ||
| README.md | ||
FreeBSD Device Drivers: From First Steps to Kernel Mastery
🌐 Live Site
Production URL: https://freebsd.edsonbrandi.com
Repository: https://github.com/ebrandi/FDD-book
📖 About the Book
"FreeBSD Device Drivers: From First Steps to Kernel Mastery" - is a comprehensive, community-driven guide to writing device drivers for FreeBSD. The book covers everything from basic concepts to advanced topics like interrupt handling, DMA, and performance optimization.
What You'll Learn
- Foundation & Environment: UNIX fundamentals, C programming, and development setup
- Core Driver Development: Building your first device driver and understanding kernel modules
- Advanced System Programming: Concurrency, synchronization, and memory management
- Hardware Integration: PCI drivers, interrupts, DMA, and power management
- Debugging & Optimization: FreeBSD-specific debugging tools and performance tuning
- Professional Development: Portable drivers, specialized hardware, and open-source contribution
Project Structure
FDD-book/
├── content/ # Book content (Markdown files)
│ ├── appendices/ # Appendix markdown files
│ └── chapters/ # Chapter markdown files by part
├── examples/ # Book Code Examples
│ ├── appendices/ # Source Code from appendices
│ └── chapters/ # Source Code from appendices
├── translations/ # Book content translated
│ └── pt_BR/ # Content in pt_BR
│ ├── appendices/ #
│ └── chapters/ #
└── scripts/ # Utility scripts
📝 Content Management
Adding New Chapters
-
Create a new markdown file in the appropriate part directory:
content/chapters/part1/chapter-07.md -
Add YAML frontmatter:
--- title: "Chapter Title" description: "Chapter description" chapter: 7 part: 1 status: "draft" # planned, draft, revised, complete estimatedReadTime: 15 lastUpdated: "2025-01-14" author: "Author Name" reviewer: "Reviewer Name" --- -
Write your content in Markdown format
Adding New Appendices
-
Create a new markdown file in the appendices directory:
content/appendices/appendix-f.md -
Add YAML frontmatter:
--- title: "Appendix Title" description: "Appendix description" status: "draft" estimatedReadTime: 10 lastUpdated: "2025-01-14" author: "Author Name" reviewer: "Reviewer Name" ---
Content Status Types
planned: Content is planned but not yet starteddraft: Initial content written, needs reviewrevised: Content reviewed and revisedcomplete: Content finalized and ready for publication
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for detailed information.
Ways to Contribute
- Content: Add new chapters, improve existing content
- Review: Technical review and proofreading
- Translation: Help translate the book to other languages
- Code: Improve the website and add features
- Issues: Report bugs and suggest improvements
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test your changes, use the scripts/build-book.sh to generate the PDF/EPUB
- Commit your changes:
git commit -m "Add your feature" - Push to your fork:
git push origin feature/your-feature - Create a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- The FreeBSD development community
- All contributors and reviewers
- The open-source community for tools and inspiration
📞 Support
- Website: https://freebsd.edsonbrandi.com
- Repository: https://github.com/ebrandi/FDD-book
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Author: Edson Brandi (ebrandi@FreeBSD.org)
Website: https://freebsd.edsonbrandi.com
Repository: https://github.com/ebrandi/FDD-book