Linux Programming by Example

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程式設計範例:基礎》是一本適合所有初學者的Linux和Unix程式設計課程的書籍。這本書以展示和解釋寫得很好的程式的方式來教授Linux程式設計,是一種非常有效的方法。作者Arnold Robbins專注於形成任何重要程式核心的基本Linux系統呼叫API,並呈現了從Unix原始碼到GNU工具(如ls和cp)等每天都在Linux和Unix使用者中使用的生產程式的程式碼。所涵蓋的主題和API包括:記憶體管理、檔案輸入/輸出、檔案元資訊、程序、使用者和群組、排序、參數解析、擴展介面、國際化、除錯等等。Robbins強調基本的程式設計原則,並經常提供高層次和低層次的方法來完成關鍵任務,幫助學生了解事情是如何在底層運作的。他還展示了如何解決撰寫軟體時出現的現實問題,特別是性能、可移植性和穩健性。所有程式碼範例都可以從附帶的網站下載,並且大多數同樣適用於Linux和Unix。如果存在差異,作者會加以註明。《Linux程式設計範例:基礎》適用於已經了解C和/或C++基礎的學生。

前言:
本書的目標讀者、你將學到什麼、小即是美:Unix程式、標準、功能和強大性:GNU程式、章節摘要、印刷慣例、獲取Unix和GNU原始碼的來源、Unix原始碼、GNU原始碼。

目錄:
致謝、1. 簡介、Linux/Unix檔案模型、Linux/Unix程序模型、標準C vs. 原始C、為何GNU程式更好、可移植性再探討、建議閱讀、摘要、練習題、2. 參數、選項和環境、選項和參數的慣例、基本命令行處理、選項解析:getopt()和getopt_long()、環境、摘要、練習題、3. 使用者級記憶體管理、Linux/Unix位址空間、分配記憶體、摘要、練習題、4. 檔案和檔案輸入/輸出、介紹、基本程式結構、確定出錯原因、輸入和輸出、隨機存取:在檔案中移動、建立檔案、強制資料寫入磁碟、設定檔案長度、摘要、練習題、5. 目錄和檔案元資訊、目錄內容、建立和刪除目錄、讀取目錄、檔案類型和資訊、更改擁有者、權限和修改時間、摘要、練習題、6. 通用程式庫介面 - 第一部分、時間和日期、排序和搜尋、使用者和群組名稱、終端:isatty()、建議閱讀、摘要、練習題、7. 綜合應用:ls、V7 ls選項、V7 ls程式碼、摘要、練習題、8. 檔案系統和目錄```