Linux Programming by Example
暫譯: Linux 範例程式設計

Arnold Robbins

  • 出版商: Prentice Hall
  • 出版日期: 2004-04-12
  • 售價: $1,575
  • 貴賓價: 9.5$1,496
  • 語言: 英文
  • 頁數: 720
  • 裝訂: Paperback
  • ISBN: 0131429647
  • ISBN-13: 9780131429642
  • 相關分類: Linux
  • 立即出貨(限量) (庫存=1)

買這商品的人也買了...

相關主題

商品描述

Description:

Appropriate for all entry-level Linux and Unix programming courses.

This book teaches Linux programming in one of the most effective ways possible: by showing and explaining well-written programs. Arnold Robbins focuses on the fundamental Linux system call APIs that form the core of any significant program, and presents code from production programs that Linux and Unix users already work with every day, ranging from Unix source code to GNU utilities such as ls and cp. The topics and APIs covered include: memory management; file I/O, file meta-information, processes, users and groups, sorting, argument parsing, extended interfaces, internationalization, debugging, and more. Robbins stresses fundamental programming principles, and often presents both higher-level and lower-level approaches to key tasks, helping students understand how things work “under the hood.” He also demonstrates how to address the real-world issues that arise in writing software—notably performance, portability, and robustness. All code examples are downloadable from a companion Web site, and most apply equally well to both Linux and Unix. Where differences exist, the author notes them. Linux Programming by Example: The Fundamentals is intended for students who already understand the basics of C and/or C++

 

Preface.

Audience. What You Will Learn. Small Is Beautiful: Unix Programs. Standards. Features and Power: GNU Programs. Chapter Summary. Typographical Conventions. Where To Get Unix and GNU Source Code. Unix Code. GNU Code.



Table of Contents:

Acknowledgments.


1. Introduction.

The Linux/Unix File Model. The Linux/Unix Process Model. Standard C vs. Original C. Why GNU Programs Are Better. Portability Revisited. Suggested Reading. Summary. Exercises.



2. Arguments, Options, and the Environment

Option and Argument Conventions. Basic Command Line Processing. Option Parsing: getopt() and getopt_long(). The Environment. Summary. Exercises.



3. User-Level Memory Management

Linux/Unix Address Space. Allocating Memory. Summary. Exercises.



4. Files and File I/O.

Introduction. Basic Program Structure. Determining What Went Wrong. Input and Output. Random Access: Moving Around Within A File. Creating Files. Forcing Data to Disk. Setting File Length. Summary. Exercises.



5. Directories and File Metadata.

Directory Contents. Creating and Removing Directories. Reading Directories. File Types and Information. Changing Ownership, Permission, and Modification Times. Summary. Exercises.



6. General Library Interfaces - Part 1

Times and Dates. Sorting and Searching. User and Group Names. Terminals: isatty(). Suggested Reading. Summary. Exercises.



7. Putting It All Together: ls.

V7 ls Options. The V7 ls Code. Summary. Exercises.



8. Filesystems and Directory Walks.

Mounting and Unmounting Filesystems. Filesystem Administration Files. Retrieving Per-filesystem Information. Moving Around In The File Hierarchy. Doing A File Tree Walk: GNU du. Changing The Root Directory: chroot(). Summary. Exercises.



9. Process Management and Pipes.

Process Creation and Management. Process Groups. Basic Interprocess Communication: Pipes and FIFOs. File Descriptor Management. Example: Two Way Pipes In gawk. Suggested Reading. Summary. Exercises.



10. Signals.

Introduction. Signal Actions. Standard C Signals: signal() and raise(). Signal Handlers In Action. The System V Release 3 Signal APIs: sigset() et al. POSIX Signals. Signals For Interprocess Communication. Important Special Purpose Signals. Signals Across fork() and exec(). Summary. Exercises.



11. User and Group ID Numbers and Permissions.

Introduction. Retrieving User and Group Ids. Checking As The Real User: access(). GLIBC Only: Checking As The E_ective User: euidaccess(). Extra Permission Bits For Directories. Setting Real and E_ective Ids. Linux Only: getresuid() and setresuid(). Setuid root: A Security Minefield. Suggested Reading. Summary. Exercises.



12. General Library Interfaces - Part 2.

Stating Assertions: assert(). Low-level Memory: The memXXX() Functions. Temporary Files. Committing Suicide: abort(). Non-local Gotos. Pseudorandom Numbers. Metacharacter Expansions. Regular Expressions. Suggested Reading. Summary. Exercises.



13. Internationalization and Localization.

Locales and the C Library. Dynamic Translation of Program Messages. Can You Spell That For Me Please? Suggested Reading. Summary. Exercises.



14. Extended Interfaces.

Allocating Aligned Memory: posix_memalign() and memalign(). Locking Files. More Precise Times. Advanced Searching With Binary Trees. Summary. Exercises



15. Debugging.

What To Do First? Compiling For Debugging. GDB Basics. Programming For Debugging. Debugging Tools. Software Testing. Debugging Rules. Suggested Reading. Summary. Exercises.



16. Tying It Together - A Project.

Project Description. Suggested Reading.



Appendix A. Teach Yourself Programming in Ten Years.

Why is everyone in such a rush? Teach Yourself Programming in Ten Years. References. Answers. Footnotes.



Appendix B. Caldera Ancient UNIX License.


Appendix C. GNU General Public License.


Preamble.


Terms and Conditions for Copying, Distribution and Modification.


How to Apply These Terms to Your New Programs.


Example Use.


Index

商品描述(中文翻譯)



描述:


適合所有入門級的 Linux 和 Unix 程式設計課程。


本書以最有效的方式教授 Linux 程式設計:透過展示和解釋良好編寫的程式。 Arnold Robbins 專注於構成任何重要程式核心的基本 Linux 系統呼叫 API,並展示來自生產程式的程式碼,這些程式碼是 Linux 和 Unix 使用者每天都在使用的,範圍從 Unix 原始碼到 GNU 工具,如 lscp。所涵蓋的主題和 API 包括:記憶體管理;檔案 I/O、檔案元資訊、進程、使用者和群組、排序、參數解析、擴展介面、國際化、除錯等。Robbins 強調基本的程式設計原則,並經常提供關鍵任務的高階和低階方法,幫助學生理解事物如何在“底層”運作。他還展示了如何解決在編寫軟體時出現的現實問題,特別是性能、可攜性和穩健性。所有程式碼範例都可以從伴隨的網站下載,大多數同樣適用於 Linux 和 Unix。當存在差異時,作者會指出來。Linux Programming by Example: The Fundamentals 旨在針對已經理解 C 和/或 C++ 基礎的學生。


 


前言。



讀者。您將學到的內容。小而美:Unix 程式。標準。特性與力量:GNU 程式。章節摘要。排版慣例。從哪裡獲取 Unix 和 GNU 原始碼。Unix 程式碼。GNU 程式碼。




目錄:


致謝。


1. 介紹。



Linux/Unix 檔案模型。Linux/Unix 進程模型。標準 C 與原始 C。為什麼 GNU 程式更好。可攜性再探。建議閱讀。摘要。練習。




2. 參數、選項和環境



選項和參數慣例。基本命令行處理。選項解析:getopt() 和 getopt_long()。環境。摘要。練習。




3. 使用者級記憶體管理



Linux/Unix 位址空間。分配記憶體。摘要。練習。




4. 檔案和檔案 I/O。



介紹。基本程式結構。確定錯誤所在。輸入和輸出。隨機存取:在檔案內部移動。創建檔案。強制資料寫入磁碟。設定檔案長度。摘要。練習。




5. 目錄和檔案元資料。



目錄內容。創建和刪除目錄。讀取目錄。檔案類型和資訊。更改擁有權、權限和修改時間。摘要。練習。




6. 一般函式庫介面 - 第 1 部分



時間和日期。排序和搜尋。使用者和群組名稱。終端:isatty()。建議閱讀。摘要。練習。




7. 將所有內容整合在一起:ls。



V7 ls 選項。V7 ls 程式碼。摘要。練習。




8. 檔案系統和目錄遍歷。



掛載和卸載檔案系統。檔案系統管理檔案。檢索每個檔案系統資訊。在檔案層級中移動。執行檔案樹遍歷:GNU du。更改根目錄:chroot()。摘要。練習。




9. 進程管理和管道。



進程創建和管理。進程群組。基本的進程間通信:管道和 FIFO。檔案描述符管理。範例:gawk 中的雙向管道。建議閱讀。摘要。練習。




10. 信號。



介紹。信號動作。標準 C 信號:signal() 和 raise()。信號處理器的實際應用。System V Release 3 信號 API:sigset() 等。POSIX 信號。進程間通信的信號。重要的特殊用途信號。跨 fork() 和 exec() 的信號。摘要。練習。




11. 使用者和群組 ID 號碼及權限。



介紹。檢索使用者和群組 ID。以真實使用者身份檢查:access()。僅限 GLIBC:以有效使用者身份檢查:euidaccess()。目錄的額外權限位。設定真實和有效 ID。僅限 Linux:getresuid() 和 setresuid()。setuid root:安全地雷區。建議閱讀。摘要。練習。




12. 一般函式庫介面 - 第 2 部分。



陳述斷言:assert()。低階記憶體:memXXX() 函數。臨時檔案。自殺:abort()。非局部跳轉。偽隨機數。元字符擴展。正則表達式。建議閱讀。摘要。練習。




13. 國際化和本地化。



地區和 C 函式庫。程式訊息的動態翻譯。您能為我拼寫一下嗎?建議閱讀。摘要。練習。




14. 擴展介面。



分配對齊記憶體:posix_memalign() 和 memalign()。鎖定檔案。更精確的時間。使用二元樹的進階搜尋。摘要。練習。




15. 除錯。



首先該做什麼?為除錯編譯。GDB 基礎。為除錯編程。除錯工具。軟體測試。除錯規則。建議閱讀。摘要。練習。




16. 將其綜合 - 一個專案。



專案描述。建議閱讀。




附錄 A. 自學程式設計十年。



為什麼每個人都這麼急?自學程式設計十年。參考文獻。答案。註腳。




附錄 B. Caldera 古老的 UNIX 授權。


附錄 C. GNU 通用公共授權。


前言。


複製、分發和修改的條款和條件。


如何將這些條款應用於您的新程式。


範例使用。


索引