Wall - Linux Programming Unleashed (Sams, 1999).pdf
(
6443 KB
)
Pobierz
Linux Programming Unleashed
Introduction
Linux has always provided a rich programming environment, and it has only grown rich-
er. Two new compilers,
egcs
and
pgcs
, joined the GNU project’s
gcc
, the original Linux
compiler. In fact, as this book went to press, the Free Software Foundation, custodians of
the GNU project, announced that
gcc
would be maintained by the creators and maintain-
ers of
egcs
. A huge variety of editors stand alongside the spartan and much-maligned vi
and emacs’ marvelous complexity. Driven largely by the Linux kernel, GNU’s C library
has evolved so dramatically that a new version, glibc (also known as libc6) has emerged
as the standard C library. Linux hackers have honed the GNU project’s always service-
able development suite into powerful tools. New widget sets have taken their place
beside the old UNIX standbys. Lesstif is a free, source-compatible implementation of
Motif 1.2; KDE, the K Desktop Environment based on the Qt class libraries from
TrollTech, answers the desktop challenge posed by the X Consortium’s CDE (Common
Desktop Environment).
What This Book Will Do for You
In this book, we propose to show you how to program in, on, and for Linux. We’ll
focus almost exclusively on the C language because C is still Linux’s lingua franca.
After introducing you to some essential development tools, we dive right in to
system programming, followed by a section on interprocess communication and network
programming.
After a section devoted to programming Linux’s user interface with both text-based and
graphical tools (the X Window system), a section on specialized topics, including shell
programming, security considerations, and using the GNU project’s
gdb
debugger,
rounds out the technical discussion. We close the book with three chapters on a topic
normally disregarded in programming books: delivering your application to users. These
final chapters show you how to use package management tools such as RPM, how to
create useful documentation, and discuss licensing issues and options. If we’ve done our
job correctly, you should be well prepared to participate in the great sociological and
technological phenomenon called “Linux.”
Intended Audience
Programmers familiar with other operating systems but new to Linux get a solid intro-
duction to programming under Linux. We cover both the tools you will use and the
environment in which you will be working.
2
Linux Programming
U
NLEASHED
Experienced UNIX programmers will find Linux’s programming idioms very familiar.
What we hope to accomplish for this group is to highlight the differences you will
encounter. Maximum portability will be an important topic because Linux runs on an
ever-growing variety of platforms: Intel i386, Sun Sparcs, Digital Alphas, MIPS proces-
sors, Power PCs, and Motorola 68000-based Macintosh computers.
Intermediate C programmers will also gain a lot from this book. In general, program-
ming Linux is similar to programming any other UNIX-like system, so we start you on
the path toward becoming an effective UNIX programmer and introduce you to the pecu-
liarities of Linux/UNIX hacking.
Linux Programming Unleashed
,
Chapter by Chapter
This is not a C tutorial, but you will get a very quick refresher. You will need to be able
to read and understand C code and understand common C idioms. Our selection of tools
rarely strays from the toolbox available from the GNU project. The reason for this is
simple: GNU software is standard equipment in every Linux distribution.
The first seven chapters cover setting up a development system and using the standard
Linux development tools:
•
gcc
•
make
•
autoconf
•
diff
•
patch
• RCS
• emacs
The next section introduces system programming topics. If you are a little rusty on the
standard C library, Chapter 9 will clear the cobwebs. Chapter 10 covers Linux’s file
manipulation routines. Chapter 11 answers the question, “What is a process?” and shows
you the system calls associated with processes and job control. We teach you how to get
system information in Chapter 12, and then get on our editorial soapbox in Chapter 13
and lecture you about why error-checking is A Good Thing. Of course, we’ll show you
how to do it, too. Chapter 14 is devoted to the vagaries of memory management under
Linux.
I
NTRODUCTION
3
We spend four chapters on various approaches to interprocess communication using
pipes, message queues, shared memory, and semaphores. Four more chapters show you
how to write programs based on the TCP/IP network protocol. After a general introduc-
tion to creating and using programming libraries in Chapter 24 (including the transition
from libc5 to libc6), we cover writing device drivers and kernel modules in Chapter 25,
because considerable programming energy is spent providing kernel support for the latest
whiz-bang hardware device or system services.
User interface programming takes up the next eight chapters. Two chapters cover charac-
ter-mode programming; first the hard way with
termcap
and
termios
, and then the easi-
er way using ncurses. After a quick introduction to X in Chapter 28, Chapter 29 focuses
on using the Motif and Athena widget sets. Programming X using the GTK library is
Chapter 30’s subject, followed by Qt (the foundation of KDE) in Chapter 31, and Java
programming in Chapter 32. For good measure, we also cover 3D graphics programming
using OpenGL.
The next section of the book covers three special-purpose topics. Chapter 34 examines
bash
shell programming. We deal with security-related programming issues in Chapter
35, and devote Chapter 36 to debugging with
gdb
.
The book ends by showing you the final steps for turning your programming project over
to the world. Chapter 37 introduces you to
tar
and the RPM package management tool.
Documentation is essential, so we teach you how to write man pages and how to use
some SGML-based documentation tools in Chapter 38. Chapter 39, finally, looks at the
vital issue of software licensing.
4
Programming Toolkit
P
ART
I
I
N
T
HIS
P
ART
• Overview
7
• Setting Up a Development System
13
• Using GNU cc
39
• Project Management Using GNU
make
53
• Creating Self-Configuring Software with
autoconf
65
• Comparing and Merging Source Files
85
• Version Control with RCS
103
• Creating Programs in Emacs
115
The Linux
Plik z chomika:
walbo48
Inne pliki z tego folderu:
Cole - Planetary Science - Science of Planets Around Stars (IOP, 2002).pdf
(8299 KB)
Einstein's Space-Time - An Intro to Special and General Relativity - R. Ferraro (Springer, 2007) WW.pdf
(8617 KB)
Frolov - Black Hole Physics - Basic Concepts and New Developments (Kluwer, 1997).pdf
(26556 KB)
Falcke - The Galactic Black Hole (IOP, 2003).pdf
(19940 KB)
Elements of Space Technology - R. Meyer (AP, 1999) WW.djvu
(2924 KB)
Inne foldery tego chomika:
ksiazki
Schematy spawarek
Amaterske Radio_2009.rar
))) Przyśpiewki weselne
@Excel
Zgłoś jeśli
naruszono regulamin