Linux Programming (Unleashed) (2 SUB)

Linux Programming (Unleashed) (2 SUB)

  • Sams(2000/12発売)
  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 1000 p.
  • 言語 ENG
  • 商品コード 9780672320217
  • DDC分類 005.4469

Full Description


An expert guide written for intermediate to advanced Linux programmers.Covers how to program core systems, user interfaces, device drives, networks, and much more.

Contents

Introduction. What This Book Will Do for You. Intended Audience. What's New in This Edition. How to Read This Book. Typographical Conventions Used in This Book. I. THE LINUX PROGRAMMING TOOLKIT. 1. Linux and Linux Programming in Context. Linux Comes of Age. Linux Yesterday. Linux Today. Linux Tomorrow. Why Linux Programming? What You'll Learn, Appendix By . The Linux Programming Toolkit. Input, Output, Files, and Directories. Processes and Synchronization. Network Programming. Programming the User Interface. Special Topics. Finishing Touches. Summary. 2. Setting Up a Development System. General Considerations. The Motherboard and CPU. Onboard I/O. Processor. BIOS. Memory. Cases and Power Supplies. User Interaction Hardware: Video, Sound, Keyboards, and Mice. Video Cards. Monitors. Sound Cards. Keyboards and Mice. Communication Devices, Ports, and Buses. Modems. Network Interface Cards. SCSI. USB and Firewire (IEEE 1394). Serial Cards. IRDA. PCMCIA Cards. ISA Plug and Play. Storage Devices. Hard Disks. Removable Disks. CD-ROM/DVD. Tape Backup. External Peripherals. Printers. Scanners. Digital Cameras. Home Automation. Complete Systems. Laptops. Development Software. Key Libraries and Header Files. Debuggers. Programming Utilities. Text Editors. Summary. 3. Using the GNU Compiler Collection. Features of GNU CC. Tutorial Example. Common Command-Line Options. Working with Libraries and Include Files. Warning and Error Message Options. Optimization Options. Debugging Options. Architecture-Specific Options. GNU C Extensions. About Portability. GNU Extensions. PGCC: The Pentium Compiler. Summary. 4. Project Management Using GNU make. Why make? Writing Makefiles. Makefile Rules. Phony Targets. Variables. Implicit Rules. Pattern Rules. Comments. Command-Line Options and Arguments. Debugging make. Common make Error Messages. Useful Makefile Targets. Summary. 5. Creating Portable, Self-Configuring Software. Considering Portability. What Is Program Portability? Portability Hints and Tips. Understanding Autoconf. Building configure.in. Structuring the File. Helpful Autoconf Utilities. Built-In Macros. Tests for Alternative Programs. Tests for Library Functions. Tests for Header Files. Tests for Structures. Tests for typedefs. Tests of Compiler Behavior. Tests for System Services. Tests for UNIX Variants. Generic Macros. An Annotated Autoconf Script. Summary. 6. Comparing and Merging Source Code Files. Comparing Files Using the diff Command. diff Command-Line Options and Arguments. Understanding the diff3 Command. Preparing Source Code Patches. patch Command-Line Options. Creating a Patch. Applying a Patch. Summary. 7. Version Control Using RCS and CVS. Basic Terminology. Using the Revision Control System (RCS). Basic RCS Usage. Finding Differences Between RCS Files. Other RCS Commands. Using the Concurrent Versions System (CVS). Advantages over RCS. Setting Up CVS. Checking Out Source Files. Merging Changes into the Repository. Reviewing Changes. Adding and Deleting Files. Resolving File Conflicts. CVS Commands. CVS Options. Summary. 8. Debugging. Compiling for GDB. Using Basic GDB Commands. Starting GDB. Inspecting Code in the Debugger. Examining Data. Setting Breakpoints. Examining and Changing Running Code. Advanced GDB Concepts and Commands. Variable Scope and Context. Traversing the Call Stack. Working with Source Files. Communicating with the Shell. Attaching to a Running Program. Summary. 9. Handling Errors. Error Handling Is the Right Thing. Error-Handling Options. C Language Facilities. assert Yourself. Using the Preprocessor. Standard Library Functions. Using the System Log. System Logging Options. System Logging Functions. User Programs. Summary. 10. Using Libraries Working with Programming Libraries. Library Compatibility. Naming and Numbering Conventions. Commonly Used Libraries. Library Tools. Understanding the nm Command. Understanding the ar Command. Understanding the ldd Command. Understanding ldconfig. Environment Variables and Configuration Files. Writing and Using Static Libraries. Writing and Using Shared Libraries. Using Dynamically Loaded Shared Objects. Understanding the dl Interface. Using the dl Interface. Summary. II. INPUT, OUTPUT, FILES, AND DIRECTORIES. 11. Input and Output. Basic Characteristics and Concepts. The File Mode. Understanding File Descriptors. What Is a File Descriptor? File Descriptor Advantages and Disadvantages. Using File Descriptors. Opening and Closing File Descriptors. Reading and Writing File Descriptors. Shortening Files: Using ftruncate. Positioning the File Pointer: Using lseek. Syncing to Disk: Using fsync. Obtaining File Information: Using fstat. Changing File Ownership: Using fchown. Changing File Permissions: Using fchmod. File Locking: Using flock and fcntl. Using The dup and dup2 Calls. Reading and Writing Multiple Files Simultaneously: Using select. The Swiss Army Knife: Using ioctl. Summary. 12. Working with Files and Directories. The Standard File Functions. Opening and Closing Files. Reading and Writing Files. Getting File Status. Input and Output Calls. Formatted Output. Formatted Input. Character Input and Output. Line Input and Output. File Positioning. Buffer Control. Deleting and Renaming Files. Using Temporary Files. Working with Directories. Finding the Current Directory. Changing Directories. Creating and Deleting Directories. Obtaining Directory Listings. Special ext2 Filesystem Attributes. Summary. III. PROCESSES AND SYNCHRONIZATION. 13. Process Control. The Linux Process Model. Process Attributes. Process Identifiers. Real and Effective IDs. SetUID and SetGID Programs. User and Group Information. Additional Process Information. Creating Processes. Using the system Function. The fork System Call. The exec Family. Using the popen Function. Manipulating Processes. Waiting on Processes-The wait Family. Killing Programs. Signals. What Is a Signal? Sending Signals. Catching Signals. Detecting Signals. Process Scheduling. Summary. 14. Introduction to Threads. What Are Threads? The __clone Function Call. The Pthreads Interface. What Are Pthreads? When to Use Pthreads. The pthread_create Function. The pthread_exit Function. The pthread_join Function. The pthread_atfork Function. Thread Cancellation. Pthread Cleanup Macros. Pthread Conditions. The pthread_equal Function. Thread Attributes. Mutexes. Summary. 15. Accessing System Information. Process Info. The cmdline File. The environ File. The fd Directory. The mem File. stat. The status File. The cwd Symbolic Link. The exe Symbolic Link. The maps File. The root Symbolic Link. The statm File. General System Info. The /proc/cmdline File. The /proc/cpuinfo File. The /proc/devices File. The /proc/dma File. The /proc/file systems File. The /proc/interrupts File. The /proc/ioports File. The /proc/kcore File. The /proc/kmsg File. The /proc/ksyms File. The /proc/loadavg File. The /proc/locks File. The /proc/mdstat File. The /proc/meminfo File. The /proc/misc File. The /proc/modules File. The /proc/mounts File. The /proc/pci File. The /proc/rtc File. The /proc/stat File. The /proc/uptime File. The /proc/version File. The /proc/net Subdirectory. The /proc/scsi Subdirectory. The /proc/sys Subdirectory. Changes to /proc in Upcoming Kernels. Summary. 16. Memory Management. Reviewing C Memory Management. Using the malloc Function. Using the calloc Function. Using the realloc Function. Using the free Function. Using the alloca Function. Memory Mapping Files. Using the mmap Function. Using the munmap Function. Using the msync Function. Using the mprotect Function. Locking Memory. Using the mremap Function. Implementing cat Using Memory Maps. Finding and Fixing Memory Problems. A Problem Child. Electric Fence. Summary. 17. Interprocess Communication. Pipes. Opening and Closing Pipes. Reading and Writing Pipes. A Simpler Way. FIFOs. Understanding FIFOs. Creating a FIFO. Opening and Closing FIFOs. Reading and Writing FIFOs. Introducing System V IPC. Key Concepts of System V IPC. Problems with System V IPC. Linux and System V IPC. Shared Memory. Creating a Shared Memory Segment. Attaching a Shared Memory Segment. Message Queues. Creating and Opening a Queue. Writing a Message to a Queue. Reading Queued Messages. Removing Message Queues. Semaphores. Creating a Semaphore. Controlling and Removing Semaphores. Summary. 18. Daemons. Understanding Daemons. Creating a Daemon. Function Calls. Handling Errors. Communicating with a Daemon. Reading a Configuration File. Adding Signal Handling to a Daemon. Summary. IV. NETWORK PROGRAMMING. 19. TCP/IP and Socket Programming. A Definition of Sockets. Communication Domains. The Basics of Socket Programming. Allocate and Initiate. Connection System Calls. Transfer Data. Close. Client/Server Examples Using Sockets. Server Example. Client Example. Running the Client and Server Examples. Running the Server Example Using a Web Browser as a Client. A Simple Web Server and Sample Web Client. Implementing a Simple Web Server. Implementing a Simple Web Client. Testing the Web Server and Web Client. Running the Simple Web Server Using Netscape Navigator as a Client. Using Sockets with Other Programming Languages. Programming UNIX Domain Sockets with Perl. Tools for Monitoring Socket Activity. Summary. 20. UDP: The User Datagram Protocol. Overview of UDP. UDP Versus TCP. Advantages and Disadvantages of TCP. Advantages and Disadvantages of UDP. Choosing Which Protocol to Use. Implementing a UDP-Based Application Sending Data with UDP. Receiving UDP Data. Minimal Error Checking. Non-Blocking I/O. Summary. 21. Multicast Sockets and Non-Blocking I/O. Configuring Linux to Support Multicast IP. Rebuilding the Linux Kernel for Multicast IP Support. Sample Programs for Multicast IP Broadcast. Broadcasting Data with Multicast IP. Creating a Client to Listen for Multicast IP Broadcasts. Running the Sample Multicast IP Programs. Summary. V. PROGRAMMING THE USER INTERFACE. 22. Terminal Control the Hard Way. The Terminal Interface. Controlling Terminals. Attribute Control Functions. Speed Control Functions. Line Control Functions. Process Control Functions. Using the Terminal Interface. Changing Terminal Modes. Using Terminfo. Terminfo Capabilities. Programming Terminfo. Working with Terminfo Capabilities. Summary. 23. Getting Started with Ncurses. A Short History of Ncurses. Compiling with Ncurses. Debugging Ncurses Programs. About Windows. Ncurses Window Design. Ncurses Function Naming Conventions. Initialization and Termination. Ncurses Initialization Structures. Ncurses Termination. Illustrating Ncurses Initialization and Termination. Input and Output. Output Routines. Input Routines. Color Routines. Window Management. Miscellaneous Utility Functions. Summary. 24. Advanced Ncurses Programming. Additional Ncurses Capabilities. Mouse Support. Menu Support. Form Support. Interacting with Mice. The Mouse API Overview. The Mouse Control Routines. Example Program. Using Menus. The Menu API Overview. The Menu Control Routines. Example Program. Ncurses Forms. The Forms API Overview. The Forms Management Routines. Example Program. Summary. 25. X Windows Programming. X Concepts. The Xlib API. XOpenDisplay. XCreateSimpleWindow and XCreateWindow. Mapping and Unmapping Windows. Destroying Windows. Event Handling. Initializing Graphics Context and Fonts. Drawing in an X Window. A Sample Xlib Program. The X Toolkit API. Getting Started Using the X Toolkit. Setting Widget Arguments Using the X Toolkit. XFree86. DPMS-Display Power Management Signaling. DRI-Direct Render Interface. DGA-Direct Graphics Architecture. XV-X Video. Summary. 26. Athena, Motif, and LessTif Widgets. Using Athena Widgets. The Athena Label Widget. The Athena Command Button Widget. The Athena List Widget. The Athena Text Widget. The Athena Simple Menu Widget. Using Motif Widgets. The Motif Label Widget. The Motif List Widget. The Motif Text Widget. Writing a Custom Athena Widget. Using the fetch_url.c File. Using the URL.h File. Using the URLP.h File. Using the URL.c File. Testing the URLWidget. Using Both Athena and Motif in C++ Programs. Using a C++ Class Library for Athena Widgets. The Component Class. The PaneWindow Class. The Label Class. The Button Class. The Text Class. Summary. 27. GUI Programming Using GTK+. Introduction to GTK+. Handling Events in GTK+. A Short Sample Program Using GTK+. Miscellaneous GTK Widgets. GTK Container Widgets. A GTK+ Program for Displaying XML Files. A Short Introduction to XML. expat, James Clark's XML Parser. Implementing the GTK+ XML Display Program. Running the GTK XML Display Program. A GUI Program Using the Notebook Widget. Implementation of the Notebook Widget Sample Program. Implementing the Drawing Widget. Running the GTK Notebook Widget Sample Program. Using GTK+ with Other Programming Languages. Using GTK+ with C++. Using GTK+ with Perl. Using GTK+ with Python. RAD Tools for GTK+. Summary. 28. GUI Programming Using Qt. Event Handling by Overriding QWidget Class Methods. Overview of the QWidget Class. Implementing the DrawWidget Class. Testing the DrawWidget. Event Handling Using Qt Slots and Signals. Deriving the StateLCDWidget Class. Using Signals and Slots. Running the Signal/Slot Example Program. Implementing the XMLview Program with Qt. SAX2: A Simple API for XML. DOM: The Document Object Model. Summary. 29. 3D Graphics Using OpenGL and Mesa. What You Need for This . Using OpenGL. Programming 3D Graphics. orbits.c. Creating a Window for OpenGL Graphics and Initializing OpenGL. Creating Simple 3D Objects Using GLUT. Placing Objects in 3D Space Using x,y,z Coordinates. Rotating an Object About Any or All of the x-, y-, and z-Axes. Enabling the Use of Material Properties. Enabling Depth Tests. Handling Keyboard Events. Updating OpenGL Graphics for Animation Effects. Orbits Program Listing. Texture Mapping. Generating a Cube with Textured Sides. Creating Texture Maps. Cube Program Listing. Summary. VI. SPECIAL TOPICS. 30. Shell Programming with GNU Bash. Why Bash? Bash Basics. Wildcards. Brace Expansion. Special Characters. Using Bash Variables. Using Bash Operators. String Operators. Pattern-Matching Operators. Flow Control. Conditional Execution: if. Determinate Loops: for. Indeterminate Loops: while and until. Selection Structures: case and select. Shell Functions. Input and Output. I/O Redirectors. String I/O. Command-Line Processing. Processes and Job Control. Shell Signal-Handling. Using trap. Summary. 31. Device Drivers. Types of Drivers. Statically Linked Kernel Device Drivers. Loadable Kernel Modules. Shared Libraries. Unprivileged Usermode Program. Privileged Usermode Programs. Daemons. Character Devices Versus Block Devices. How to Construct the Hardware. Understanding the Workings of a Stepper Motor. Standard or Bidirectional Parallel Port. Setting Up Your Development Environment. Debugging Kernel-Level Drivers. Device Driver Internals. Low-Level Port I/O. Accessing Memory Using DMA. Initiating Interrupts to Utilize Device Drivers. Layering of Device Drivers. Simple Usermode Test Driver. Creating a Kernel Driver. Reviewing the Source Code. Compiling the Driver. Using the Kernel Driver. Future Directions. Other Sources of Information. Summary. VII. FINISHING TOUCHES. 32. Package Management. Understanding tar Files. Creating tar Files. Updating tar Files. Listing the Contents of tar Files. Extracting Files from an Archive. Understanding the install Command. Understanding the Red Hat Package Manager (RPM). What Is RPM? Minimum Requirements. Configuring RPM. Controlling the Build: Using a spec File. Analyzing a spec File. Building the Package. The File Hierarchy Standard. Summary. 33. Documentation. Writing Man Pages. Components of a Man Page. Sample Man Page. Using the groff Command. Linux Conventions. Using DocBook. What Is DocBook? DocBook Tags. A Sample DocBook Document. Generating Output. Summary. 34. Licensing. Introduction and Disclaimer. The MIT/X-Style License. The BSD-Style License. The Artistic License. The GNU General Public Licenses. The GNU General Public License. The GNU Library General Public License. The Open Source Definition. Summary. Index.