Linux Programming Bible: Table of Contents
Click any chapter number for more details.
Part I: Shell and Basic Tools
- This chapter introduces you to the design of the Linux development environment. You'll learn the goals behind this design, and a bit of history. You'll find out what makes Linux different from other platforms and why this is important for your programs. I also cover documentation sources, such as on-disk manual pages, Perl documentation, GNU info pages, and program documentation sources. Finally, you'll learn where to find more information on topics mentioned online.
Many people don't realize how powerful and important shell programming is in the Linux environment. This chapter begins with an introduction to shell programming and progresses to advanced shell programming topics. You'll learn about variables, return values, substitutions, chaining, conditionals, wildcards & patterns, quoting, redirection, piping, functions, and more. You'll also read about shell utilities such as awk, sed, and tr.
- Regular expressions, basically, are pattern matching tools. However, they are one of the most powerful mechanisms at your disposal for parsing data. One regular expression -- just a few characters -- can take the place of hundreds of lines of code with other languages or algorithms. In this chapter, you will learn what regular expressions are and when to use them. Then, you'll learn about all the different features and intracacies of regular expressions. You'll also learn about use of regular expressions in various Linux languages such as Perl, egrep, sed, and others.
- In order to be productive, every programmer needs to have a good editor and a good environment in which to use. In Linux, the Emacs tools (GNU Emacs and XEmacs) are the most popular development environments. In this chapter, you will learn why the Emacs programs are so important and how to use them to edit text, compile programs, debug code, and even read mail or browse web pages.
- In order to interact with the Linux system, you need to know some details about where information is stored and how services are invoked. In this chapter, you will learn how to access the system's account databases, details about the shadow password system, information about groups and the group file, details about system initialization and shutdown, and information about network configuration.
Part II: The C Environment
- C is at the root of many things in Linux. This chapter will teach you about gcc, the C compiler used by Linux. You'll learn everything from basic compilation to more advanced work with the C environment such as Makefiles, optimizations, pre-processing, linking, and more.
- GNU Make is used to automate building projects. It can be used to simply save a few keystrokes for small projects or to significantly reduce rebuild time for larger projects. In this chapter, you learn how to use make for your projects -- everything from basic automation of simple projects to automatically detecting files to build and dependencies and even recursive Makefiles.
- One of the most important topics in C is that of memory management. When you are writing server programs in Linux, as you will learn about in chapters 18 and 19, it becomes even more important due to the security implications of problems. This chapter covers issues of memory management, including security issues. You'll learn about the differences between dynamically- and statically-allocated memory, security issues including buffer overflow problems, linked lists as a way to deal with these security issues, parsing data in C (including even a rudimentary shell), and more.
- One of the most useful, and yet least frequently covered, topics of Linux programming is working with libraries. Especially important is the dynamic library system on Linux. This chapter provides full and detailed coverage of it, including how to make your own dynamic libraries and how the dynamic loader works.
- Debugging can be a chore, especially with large programs. This chapter shows you how to use gdb, the GNU debugger. You'll learn how to trace the program's execution, how to perform post-mortem analysis with core files, information about breakpoints, and more.
Part III: The Linux Model
- You might think that files and directories are fairly easy to understand, but you might not know some of the more detailed points. In this chapter, you'll learn about things such as get detailed information about files (creation date, inode numbers) with stat(), get information about links, security methods, and stream vs. system call I/O.
- The process model on Linux is the basic unit of multitasking, and you'll learn all about it in this chapter. Topics covered in this chapter include the basics of the process model, attributes of each process, starting and stopping processes, replacing the memory image of one process with another program, duplicating processes, synchronization, atomic operations, deadlock, race conditions, spinning, setuid/setgid, and security internals.
- In this chapter, you will learn about signals, how to send them, why processing signals can be vital to your applications, and how to write signal handlers. You'll also be able to read about some of the side-effects of using signals with system calls and the other potential dangers of signal handlers.
- In this chapter, I cover many different aspects of I/O on Linux. You can read about system call I/O, dangers of poor handling of error conditions and how to correct it. Also covered are asynchronous (non-blocking) calls, multiple file descriptor watches with select() and poll(), memory mapping, and advisory locking.
- This chapter provides you the details that you need to effectively interact with terminals. You'll learn about terminal properties, pseudo terminals as are used with telnet, and full-screen color programming with ncurses.
Part IV: Talking to the World
- One of the most unique and potentially fastest ways to communiate in Linux, shared memory is covered here. You'll learn what it is, how to use it, and what its drawbacks are. In most cases, you'll also need a locking mechanism, and for that purpose semaphores are discussed as well.
- Pipes are one of the most frequently-used methods for communicating between processes on a local system. This chapter will teach you all about pipes and lay some groundwork for the more complex sockets, which are covered in the two chapters following. Among the topics discussed here are creating pipes, using pipes for communication, how to implement redirection in C (as the shell does), setting up pipelines, special communication issues, and named pipes (FIFOs).
- One of the most exciting aspects of programming in Linux is being able to write programs that leverage the Internet to communicate with processes on other computers. This chapter will teach you how to do that. You'll learn about the fundamentals of TCP/IP programming, some of its unique challenges, name resolution, and how to establish a connection for both a client and a server, and how to write some code to be used as a networking library.
- In this section, you'll learn about some more advanced TCP/IP topics. Specifically, you'll learn about the difference between multi-process and multiplexing servers, why you might want to use multiplexing on the client side, how to use select() or poll(), issues that can arise with regard to network trouble, and information about the UDP.
Part V: The Glue: Perl
- This chapter will introduce you to Perl, a language used for many tasks in Linux. Topics covered include its design philosophy, operators, syntax, data structres, flow control, and OOP features.
- This chapter goes into detail about how to get data into your programs, how to parse it, output it, and deal with some special cases that arise. You'll learn about the angle-bracket operator, reading arguments from the command line, regular expression matching and operators like split or join, database tie-ins, serialization, Data::Dumper, special ways to open file handles, and more.
- You can use Perl for CGI programming, and this chapter explains how to use CGI to generate dynamic Web pages, how to get data into CGI scripts, improving performance, using the CGI library, and ways around the connectionless problem.
- SQL databases are being increasingly common, and this chapter will show you how to interact with them from Perl. You'll learn about the DBI API that is frequently used for this access, how it fits into the big picture of data storage, how to use SQL with it, using DBI with CGI, and ways of using databases in your applications.
Part VI: Graphical Interfaces with X
- This chapter will teach you about writing GUI programs in Linux, using the Perl/Tk widget set. You'll learn when to use a GUI, basics of event-driven programming, object placements and attributes, packing, and interface designers.
- In this chapter, you will learn about using GNOME for your graphical interfaces. The topics covered include an introduction, an overview of the components and libraries, windows, and interface design.
Part VII: Putting It All Together
- This chapter discusses how to use CVS to collaborate with others on projects and archive past versions. You'll learn what CVS is, how to configure it, how to manage it, and branches.
- This chapter teaches you why security is so important and how to write secure code in Linux.
- The final chapter in the book covers performance optimizations. You'll learn some ideas for faster code, how to use gperf to perform analysis for speedups, expensive and inexpensive operations, and what the compiler can do to help.
- The Linux Programming Bible also contains an extensive, comprehensive glossary and index. If, as you are reading through the book, you encounter terms you do not recognize, you may quickly look them up here.