Beginning Linux programming /
Matthew, Neil.
Beginning Linux programming / Neil Matthew and Richard Stones. - 4th ed. - Indianapolis, Ind. : Chichester : Wrox ; John Wiley [distributor], c2008. - xxx, 780 p. : ill. ; 24 cm.
"Programmer to programmer." Includes index.
Chapter Xr Getting Started
An Introduction to UNIX, Linux, and GNU
What Is UNIX?
What Is Linux?
The GNU Project and the Free Software Foundation
Linux Distributions
Programming Linux
Linux Programs
Text Editors
The C Compiler
Development System Roadmap
Getting Heip
Summary
Chapter 2: Shell Programming
Why Program with a Shell?
A Bit of Phiiosophy
What Is a Shell?
Pipes and Redirection
Redirecting Output
Redirecting Input
Pipes
The Shell as a Programming Language
Interactive Programs
Creating a Script
Making a Script Executable
Shell Syntax
Variables
Conditions
Control Structures
Functions
Commands
Command Execution
Scanning Directories
opendir
readdir
telldir
seekdir
closedir
Errors
strerror
perror
The /proc File System
Advanced Topics: fcnti and mmap
fcnti
mmap
Summary
Chapter 4: The Linux Environment
Program Arguments
getopt
getopt_long
Environment Variables
Use of Environment Variables
The environ Variable
Time and Date
Temporary Files
User information
Host Information
Logging
Resources and Limits
Summary
Chapter 5: Terminals
Reading from and Writing to the Terminal
Talking to the Terminal
The Terminal Driver and the General Terminal Interface
Overview
Hardware Model
The termlos Structure
Input Modes
Output Modes
Control Modes
Local Modes
Special Control Characters
Terminal Speed
Additional Functions
Terminal Output
Terminal Type
Identify Your Terminal Type
Using terminfo Capabilities
Detecting Keystrokes
Virtual Consoles
Pseudo-Terminals
Summary
Chapter 6: Mana^ng Text-Based Screens with CUrsgg
Compiling with curses
Curses Terminology and Concepts
The Screen
Output to the Screen
Reading from the Screen
Clearing the Screen
Moving the Cursor
Character Attributes
The Keyboard
Keyboard Modes
Keyboard Input
Windows
The WINDOW Structure
Generalized Functions
Moving and Updating a Window
Optimizing Screen Refreshes
Subwindows
The Keypad
Using Color
Redefining Colors
Pads
The CD Collection Application
Starting a New CD Collection Application .
Looking at main
Building the Menu
Database File Manipulation
Querying the CD Database
Summary
Chapter 7: Data Management
Managing Memory
Simple Memory Ailocation
Allocating Lots of Memory
Abusing Memory
The Null Pointer
Freeing Memory
Other Memory Allocation Functions
File Locking
Creating Lock Files
Locking Regions
Use of read and write with Locking
Competing Locks
Other Lock Commands
Deadlocks
Databases
The dbm Database
The dbm Routines
dbm Access Functions
Additional dbm Functions
The CD Application
Updating the Design
The CD Database Application Using dbm
Summary
Chapter 8: MvSOL
installation
MySQL Packages
Post-Install Configuration
Post-Installation Troubleshooting
MySQL Administration
Commands
Creating Users and Giving Them Permissions
Passwords
Creating a Database
Data Types
Creating a Table
Graphical Tools
Accessing MySQL Data from C
Connection Routines
Error Handling
Executing SQL Statements
Miscellaneous Functions
The CD Database Application
Creating the Tables
Adding Some Data
Accessing the Application Data from 0
Summary
Chapter 9: Development Tools
Problems of Multiple Source Files
The make Command and Makefiles
The Syntax of Makefiles
Options and Parameters to make
Comments in a Makefile
Macros in a Makefile
Multiple Targets
Built-in Rules
Suffix and Pattern Rules
Managing Libraries with make
Advanced Topic: Makefiles and Subdirectories
GNU make and gcc
Source Code Control
RCS
sees
Comparing RCS and SCCS
CVS
CVS Front Ends
Subversion
Writing a Manual Page
Distributing Software
The patch Program
Other Distribution Utilities
RPM Packages
Working with RPM Package Files
Installing RPM Packages
Building RPM Packages
Other Package Formats
Development Environments
KDevelop
Other Environments
Summary
Chapter 10: Debugging
Types of Errors
General Debu^ng Techniques
A Program with Bugs
Code Inspection
Instrumentation
Controlled Execution
Debu^ng with gdb
Starting gdb
Running a Program
Stack Trace
Examining Variables
Listing the Program
Setting Breakpoints
Patching with the Debugger
Learning More about gdb
More Debu^ng Tools
Lint: Removing the Ruff from Your Programs
Function Call Tools
Execution Profiling with prof/gprof
Assertions
Memory Debu^ng
ElectricFence
valgrind
Summary
Chapter H: Processes and Signals
What Is a Process?
Process Structure
The Process Table
Viewing Processes
System Processes
Process Scheduling
Starting New Processes
Waiting for a Process
Zombie Processes
Input and Output Redirection
Threads
Signals
Sending Signals
Signal Sets
Summary
Chapter 12: POSIX Threads
What Is a Thread?
Advantages and Drawbacks of Threads
A First Threads Program
Simultaneous Execution
Synchronization
Synchronization with Semaphores
Synchronization with Mutexes
Thread Attributes
Canceling a Thread
Threads In Abundance
Summary
Chapter 13: Inter-Process Communication: Pipes
What Is a Pipe?
Process Pipes
Sending Output to popen
Passing More Data
How popen Is Implemented
The Pipe Call
Parent and Child Processes
Reading Closed Pipes
Pipes Used as Standard Input and Output
Named Pipes: FIFOs
Accessing a FIFO
Advanced Topic: Client/Server Using FIFOs
The CD Database Application
Aims
Implementation
Client Interface Functions
The Server Interface, server.c
The Pipe
Application Summary
Summary
Chapter 14; Semaphores. Shared Memory, and Message Queues
Semaphores
Semaphore Definition
A Theoretical Example
Linux Semaphore Facilities
Using Semaphores
Shared Memory
shmget
shmat
shmdt
shmcti
Message Queues
msgget
msgsnd
msgrcv
msgcti
The CD Database Application
Revising the Server Functions
Revising the Client Functions
iPC Status Commands
Displaying Semaphore Status
Displaying Shared Memory Status
Displaying Message Queue Status
Summary
Chapter 15: Sockets
What is a Socket?
Socket Connections
Socket Attributes
Creating a Socket
Socket Addresses
Naming a Socket
Creating a Socket Queue
Accepting Connections
Requesting Connections
Closing a Socket
Socket Communications
Host and Network Byte Ordering
Network Information
The internet Daemon (xinetd/inetd)
Socket Options
Multiple Clients
select
Multiple Clients
Datagrams
Summary
Chanter 16: Programming GNOME Using GTK+
Introducing X
X Server
X Client
X Protocol
Xlib
Toolkits
Window Managers
Other Ways to Create a GUI — Platform-Independent Windowing APIs
introducing GTK+
GLib Type System
GTK-i- Object System
Introducing GNOME
Installing the GNOME/GTK+ Development Libraries
Events, Signals, and Callbacks
Packing Box Widgets
GTK+ Widgets
GtkWindow
GtkEntry
GtkSpinButton
GtkButton
GtkTreeView
GNOME Widgets
GNOME Menus
pial<^8
GtkDialog
Modal Dialog Box
Nonmodal Dialogs
GtkMessageDialog
CO Database Application
Summary
Chapter 17: Programming KDE Using Ot
Introducing KDE and Qt
installing Qt
Signals and Slots
Qt Widgets
QLineEdit
Qt Buttons
QComboBox
QListView
Dialogs
QDialog
QMessageBox
QlnputDialog
Using qmake to Simplify Writing Makefiles
Menus and Toolbars with KDE
CD Database Application Using KDE/Qt
MainWindow
AddCdDialog
LogonDialog
main.cpp
Summary
Chapter IB: Standards for Linux
The C Programming Language
A Brief History Lesson
The GNU Compiler Collection
gee Options
Interfeces and the Unux Standards Base
LSB Standard Libraries i
LSB Users and Groups
LSB System Initialization
The Fllesystem Hierarchy Standard
Further Reading about Standards
Summary
9788126515714 (pbk.) 0470147628 (pbk.)
Operating systems (Computers)
Systèmes D'exploitation (Ordinateurs)
Computer Operating Systems.
005.268 / MAT/B
Beginning Linux programming / Neil Matthew and Richard Stones. - 4th ed. - Indianapolis, Ind. : Chichester : Wrox ; John Wiley [distributor], c2008. - xxx, 780 p. : ill. ; 24 cm.
"Programmer to programmer." Includes index.
Chapter Xr Getting Started
An Introduction to UNIX, Linux, and GNU
What Is UNIX?
What Is Linux?
The GNU Project and the Free Software Foundation
Linux Distributions
Programming Linux
Linux Programs
Text Editors
The C Compiler
Development System Roadmap
Getting Heip
Summary
Chapter 2: Shell Programming
Why Program with a Shell?
A Bit of Phiiosophy
What Is a Shell?
Pipes and Redirection
Redirecting Output
Redirecting Input
Pipes
The Shell as a Programming Language
Interactive Programs
Creating a Script
Making a Script Executable
Shell Syntax
Variables
Conditions
Control Structures
Functions
Commands
Command Execution
Scanning Directories
opendir
readdir
telldir
seekdir
closedir
Errors
strerror
perror
The /proc File System
Advanced Topics: fcnti and mmap
fcnti
mmap
Summary
Chapter 4: The Linux Environment
Program Arguments
getopt
getopt_long
Environment Variables
Use of Environment Variables
The environ Variable
Time and Date
Temporary Files
User information
Host Information
Logging
Resources and Limits
Summary
Chapter 5: Terminals
Reading from and Writing to the Terminal
Talking to the Terminal
The Terminal Driver and the General Terminal Interface
Overview
Hardware Model
The termlos Structure
Input Modes
Output Modes
Control Modes
Local Modes
Special Control Characters
Terminal Speed
Additional Functions
Terminal Output
Terminal Type
Identify Your Terminal Type
Using terminfo Capabilities
Detecting Keystrokes
Virtual Consoles
Pseudo-Terminals
Summary
Chapter 6: Mana^ng Text-Based Screens with CUrsgg
Compiling with curses
Curses Terminology and Concepts
The Screen
Output to the Screen
Reading from the Screen
Clearing the Screen
Moving the Cursor
Character Attributes
The Keyboard
Keyboard Modes
Keyboard Input
Windows
The WINDOW Structure
Generalized Functions
Moving and Updating a Window
Optimizing Screen Refreshes
Subwindows
The Keypad
Using Color
Redefining Colors
Pads
The CD Collection Application
Starting a New CD Collection Application .
Looking at main
Building the Menu
Database File Manipulation
Querying the CD Database
Summary
Chapter 7: Data Management
Managing Memory
Simple Memory Ailocation
Allocating Lots of Memory
Abusing Memory
The Null Pointer
Freeing Memory
Other Memory Allocation Functions
File Locking
Creating Lock Files
Locking Regions
Use of read and write with Locking
Competing Locks
Other Lock Commands
Deadlocks
Databases
The dbm Database
The dbm Routines
dbm Access Functions
Additional dbm Functions
The CD Application
Updating the Design
The CD Database Application Using dbm
Summary
Chapter 8: MvSOL
installation
MySQL Packages
Post-Install Configuration
Post-Installation Troubleshooting
MySQL Administration
Commands
Creating Users and Giving Them Permissions
Passwords
Creating a Database
Data Types
Creating a Table
Graphical Tools
Accessing MySQL Data from C
Connection Routines
Error Handling
Executing SQL Statements
Miscellaneous Functions
The CD Database Application
Creating the Tables
Adding Some Data
Accessing the Application Data from 0
Summary
Chapter 9: Development Tools
Problems of Multiple Source Files
The make Command and Makefiles
The Syntax of Makefiles
Options and Parameters to make
Comments in a Makefile
Macros in a Makefile
Multiple Targets
Built-in Rules
Suffix and Pattern Rules
Managing Libraries with make
Advanced Topic: Makefiles and Subdirectories
GNU make and gcc
Source Code Control
RCS
sees
Comparing RCS and SCCS
CVS
CVS Front Ends
Subversion
Writing a Manual Page
Distributing Software
The patch Program
Other Distribution Utilities
RPM Packages
Working with RPM Package Files
Installing RPM Packages
Building RPM Packages
Other Package Formats
Development Environments
KDevelop
Other Environments
Summary
Chapter 10: Debugging
Types of Errors
General Debu^ng Techniques
A Program with Bugs
Code Inspection
Instrumentation
Controlled Execution
Debu^ng with gdb
Starting gdb
Running a Program
Stack Trace
Examining Variables
Listing the Program
Setting Breakpoints
Patching with the Debugger
Learning More about gdb
More Debu^ng Tools
Lint: Removing the Ruff from Your Programs
Function Call Tools
Execution Profiling with prof/gprof
Assertions
Memory Debu^ng
ElectricFence
valgrind
Summary
Chapter H: Processes and Signals
What Is a Process?
Process Structure
The Process Table
Viewing Processes
System Processes
Process Scheduling
Starting New Processes
Waiting for a Process
Zombie Processes
Input and Output Redirection
Threads
Signals
Sending Signals
Signal Sets
Summary
Chapter 12: POSIX Threads
What Is a Thread?
Advantages and Drawbacks of Threads
A First Threads Program
Simultaneous Execution
Synchronization
Synchronization with Semaphores
Synchronization with Mutexes
Thread Attributes
Canceling a Thread
Threads In Abundance
Summary
Chapter 13: Inter-Process Communication: Pipes
What Is a Pipe?
Process Pipes
Sending Output to popen
Passing More Data
How popen Is Implemented
The Pipe Call
Parent and Child Processes
Reading Closed Pipes
Pipes Used as Standard Input and Output
Named Pipes: FIFOs
Accessing a FIFO
Advanced Topic: Client/Server Using FIFOs
The CD Database Application
Aims
Implementation
Client Interface Functions
The Server Interface, server.c
The Pipe
Application Summary
Summary
Chapter 14; Semaphores. Shared Memory, and Message Queues
Semaphores
Semaphore Definition
A Theoretical Example
Linux Semaphore Facilities
Using Semaphores
Shared Memory
shmget
shmat
shmdt
shmcti
Message Queues
msgget
msgsnd
msgrcv
msgcti
The CD Database Application
Revising the Server Functions
Revising the Client Functions
iPC Status Commands
Displaying Semaphore Status
Displaying Shared Memory Status
Displaying Message Queue Status
Summary
Chapter 15: Sockets
What is a Socket?
Socket Connections
Socket Attributes
Creating a Socket
Socket Addresses
Naming a Socket
Creating a Socket Queue
Accepting Connections
Requesting Connections
Closing a Socket
Socket Communications
Host and Network Byte Ordering
Network Information
The internet Daemon (xinetd/inetd)
Socket Options
Multiple Clients
select
Multiple Clients
Datagrams
Summary
Chanter 16: Programming GNOME Using GTK+
Introducing X
X Server
X Client
X Protocol
Xlib
Toolkits
Window Managers
Other Ways to Create a GUI — Platform-Independent Windowing APIs
introducing GTK+
GLib Type System
GTK-i- Object System
Introducing GNOME
Installing the GNOME/GTK+ Development Libraries
Events, Signals, and Callbacks
Packing Box Widgets
GTK+ Widgets
GtkWindow
GtkEntry
GtkSpinButton
GtkButton
GtkTreeView
GNOME Widgets
GNOME Menus
pial<^8
GtkDialog
Modal Dialog Box
Nonmodal Dialogs
GtkMessageDialog
CO Database Application
Summary
Chapter 17: Programming KDE Using Ot
Introducing KDE and Qt
installing Qt
Signals and Slots
Qt Widgets
QLineEdit
Qt Buttons
QComboBox
QListView
Dialogs
QDialog
QMessageBox
QlnputDialog
Using qmake to Simplify Writing Makefiles
Menus and Toolbars with KDE
CD Database Application Using KDE/Qt
MainWindow
AddCdDialog
LogonDialog
main.cpp
Summary
Chapter IB: Standards for Linux
The C Programming Language
A Brief History Lesson
The GNU Compiler Collection
gee Options
Interfeces and the Unux Standards Base
LSB Standard Libraries i
LSB Users and Groups
LSB System Initialization
The Fllesystem Hierarchy Standard
Further Reading about Standards
Summary
9788126515714 (pbk.) 0470147628 (pbk.)
Operating systems (Computers)
Systèmes D'exploitation (Ordinateurs)
Computer Operating Systems.
005.268 / MAT/B