Practical Linux Programming: Device Drivers, Embedded Systems and the Internet

by Marty Leisner

Title: Practical Linux Programming: Device Drivers, Embedded Systems and the InternetAuthor: Ashfaq A. KhanPublisher: Charles River MediaISBN: 1-58450-096-4Price: $49.95

I became quite curious when I first saw the title of this book. I've been doing embedded systems for 15 years, sometimes writing device drivers, and have an extensive background in network programming.

The book contains chapters on:

  • installing Red Hat

  • installing a virtual web server using DNS, Postgres and apache, using virtual hosts to provide different functionality

  • writing simple device drivers, some of which control the parallel port

  • tasks and interprocess communication (pipes, FIFO, semaphores, message queues, sockets)

  • Perl programming

  • SQL using Postgres

  • shell script programming

  • fixed point arithmetic and Transcendental Functions

  • some sample embedded system design projects

The book is full of examples, and it comes with a CD of the examples. The books has a glossary but no bibliography.

I was surprised, to say the least, when I looked at the title and TOC contents. Most of the topics require several books on my bookshelf, but the author attempted to cover all of them in one book. The attempt, however, falls far short of complete and thorough coverage. In addition, the book is sprinkled with typos and errors. This is far and away the major problem with the book.

I liked the way the lines of code are numbered, followed by a discussion that refers to the line number(s). But they could have made better use of the print medium by using a different and smaller font for the line numbers, which would have made the listings easier to read. As it stands, there is one space between the numbers and the start of the listing, so it looks like this:

        ...
        148) }
        149) init init_module(void)
        150) {
        ...

In addition, the listings don't have any blank lines, which makes them difficult to read.

In the chapter on fixed point math, one listing has 555 lines, with no blank lines or indentation. Look at the listing on the disk, however, you see indentation and blank lines, a far more readable presentation. (I just happened to notice it's a DOS file--with CR-EOL, not a UNIX file with only EOL characters). This chapter was fairly good overall. But when building embedded systems without floating point hardware, its very useful to know how to look at a problem as an integer problem and not as a floating point problem. I've never used fixed point math in my career (but it's nice to know).

The accompanying CD has only 22MB of information on it, so there's extra space they could fill up with all types of useful stuff, as well as links to various sites on the Internet. Furthermore, more than 18MB are third-party packages you could easily get off the Internet, including dodabase, cups, esp print pro and anjuta.

Two other files on the CD are called "About the CD.rtf" and "In this CD.doc". I could read the RTF file with a recent version of OpenOffice, but the .doc file crashed. I find it interesting you need to use Microsoft products for a book about Linux!

Another problem is I'm not sure whether this book is for wizards or newbies. In many (but not all) cases where it discusses an example on the CD, it spends half a page showing the mount, mkdir, cp and cd sequences. Once? Maybe. But sprinkled throughout the book? And this book discusses writing device drivers? I was scratching my head by this point.

It seems important spaces were deleted randomly all over the book. Discussing message queues, in the structure msqid_ds, the book has the elements:

        time_tmsg_stime;
        time_tmsg_rtime;
        time_tmsg_ctime;

Of course this means:

        time_t msg_stime;
        time_t msg_rtime;
        time_t msg_ctime;

But the reader is supposed to be in learning mode, not correcting mode.

I'm from a minimalist school of programming: only do what is necessary for the task at hand. In a 40-line example to demonstrate fork, the headers <sys/socket.h>, <arpa/inet.h> and <netdb.h> are included. I have no idea why. In addition, the fork example is linked with -lpq -lcrypt--again I have no idea why. To top that off, what the example actually outputs isn't what is in the book (there's a bug in the code of a meaningless program). Be warned, your coworkers may use this book as an excuse to do bizarre things.

It's unusual for a technical book to be published without an email address to contact the author or the publisher, but this book has neither. This fact is doubly interesting considering the number of typos and errors I found. The publisher's web site lists errata for the book, but it is small and talks about minor errors. It seems every time I open up the book while I'm writing this review, I find typos.

In summary, the books covers a lot of ground. But it covers everything so sparsely that it seems good for building and running only the contrived examples. Overall, I'm very disappointed with the book. I'm glad I didn't use it to try to learn a topic.

Marty Leisner has been using Linux for the last 7 years, GNU software for 15 years and UNIX for 20 years. He's a professional programmer, often building embedded systems, hopefully in the future with Linux.

Load Disqus comments

Firstwave Cloud