|
Linux
Application
Development |
Michael K. Johnson
Erik W. Troan
|
ISBN: 0-201-30821-5
Errata and Updates
Recent items are kept here in order of discovery. This page is
updated quite often, so if you visit it often, you will find all
the newest items together in one place.
Older items are kept here in order by page number on a per-printing
basis, to make it easy for you to find them, and if you wish, apply
them to your copy.
Please send any further errata items to lad-comments@awl.com.
Sixth Printing (January 2000), Fifth Printing (May 1999) and earlier
Ordered by discovery:
- Page 285, third text paragraph, SIGINTR should be SIGINT.
- Page 270, first code display, int pid_t should be pid_t.
- Page 248, table 13.1, many of the "Default Action"
descriptions are incorrect. You can download, print, cut, and
paste a replacement page or use
this abbreviated table which contains corrections only.
Signal | Default Action |
SIGALRM | Terminate |
SIGBUS | Terminate |
SIGHUP | Terminate |
SIGINT | Terminate |
SIGIO | Terminate |
SIGPIPE | Terminate |
SIGPROF | Terminate |
SIGPWR | Terminate |
SIGTRAP | Terminate, core |
SIGWINCH | Ignored |
SIGUSR1 | Terminate |
SIGUSR2 | Terminate |
SIGXCPU | Terminate |
SIGXFSZ | Terminate |
SIGVTALRM | Terminate |
- Page 102, the summaries for setfsuid() and setfsgid
are incomplete. Add
It returns the previous fsuid.
and
It returns the previous fsgid.
respectively.
In addition, in the setfsgid() line,
"fsuid" should be "fsgid".
- Page 522, Fourth entry from the bottom ("[Matthew, 1996]"),
"Niel" should be "Neil".
- Page 358, the timer macros take struct timeval * rather
than struct timeval arguments, so the declaration lines should
read
timerclear(struct timeval *)
timerisset(struct timeval *)
timercmp(struct timeval *t0, struct timeval *t1, operator)
- Page 403, last line of text,
"seventh row and the nineteenth column:"
should be
"eighth row and the twentieth column (counting from zero):
- Page 75, line 7, "-fPICto" should be "-fPIC to".
- Page 188 line 6, and page 489 code line 415, should read
while (!getcwd(buf, len) && errno == ERANGE) {
- Page 177, first paragraph, last sentence should be changed to
"Only the root user has
ever been allowed to
create hard links to directories, but doing so was generally a bad idea,
because most file systems and several utilities do not handle it very well;
it is now entirely disallowed."
- Page 400, Table 20.9, second line, "^[0" should be
"^[O" (letter 'O', not number zero).
- Page 124, sixth paragraph, first word, "setsid" should
be "setpgid"
- Page 160, first paragraph, "This set of files includes devices
and regular files." should be "This set of files includes local
block devices and regular files."
- Page 229, second paragraph, "...tell it to try." should be
"...tell it to try again."
- Page 246, the first code display is wrong. The corrected
display should read:
src = someString;
while (*src)
*dest++ = *src++;
- Page 411, second code display,
pmatch = alloca(sizeof(regmatch_t) * p.re_nsub);
should be
pmatch = alloca(sizeof(regmatch_t) * (p.re_nsub+1));
if (regexec(&p, string, p.re_nsub, pmatch, 0)) {
should be
if (regexec(&p, string, p.re_nsub+1, pmatch, 0)) {
and
for (i=0; i < p.re_nsub; i++) {
should be
for (i=0; i <= p.re_nsub; i++) {
These changes are reflected in the file match.c in the source archive.
Fourth Printing (March 1999) and earlier
Ordered by page number:
- Page 101, second to last line, "effective gid" should be
"effective uid".
- Page 188, second paragraph from the bottom, PATH_MAX
is incorrectly said to be found via <unistd.h>; it
is really found via <limits.h>.
Third Printing (September 1998) and earlier
Ordered by page number:
- Page 23, first paragraph; and Page 522, fourth entry: "Heckman"
should be "Hekman".
- Page 38, seventh line from the bottom,
OBJS = $(OBJS1) $(OBJS1) $(OBJS1)
should be
OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
- Pages 63, 64, and 75 have instances of a single back quote character in
a monospace font. Unfortunately, the monospace font we used does not
distinguish between back quotes and forward quotes. The three lines
in question were meant to read (note that your web browser may have
the same problem; this is a common problem with monospace fonts)
export MPRPC=`mprpc program`
$ export MPRPC=`mprpc broken-fixed`
LD_LIBRARY_PATH=`pwd` ./usehello
For future printings, those have been changed to read
export MPRPC=$(mprpc program)
$ export MPRPC=$(mprpc broken-fixed)
LD_LIBRARY_PATH=$(pwd) ./usehello
- Pages 80 and 81, ``signed integer'' should be ``signed word''.
- Pages 96, 97, and 102, NGROUP should be NGROUPS_MAX.
- Page 104, second code display,
extern char ** environ[];
should be
extern char * environ[];
- Page 114, second line, argv[0]] should be argv[0].
- Page 136, sixth line from bottom, .program should be
.argv[0]
- Page 207, Figure 12.1, the top line of each terminal session
has a "u" character instead of a "#" prompt,
and Terminal 3 says that it is running mpx-nonblock instead of
mpx-blocks, which conflicts with the text. If you wish, you can
print a copy of Figure 12.1 on a PostScript
printer and paste it into your copy of LAD.
- Page 208, mpx-nonblock.c line 3 should read
#include <errno.h>
Page 209, line 29 should read
if ((i < 0) && (errno != EAGAIN)) {
line 32 should read
} else if (i > 0) {
First paragraph, second sentence ("Unfortunately, ... pipe!") should read
"A nonblocking read() from a pipe with no writers
returns 0 bytes; from a pipe with writers but no data read() returns
EAGAIN."
- Page 279, code line 181; and page 285, line 1 should read:
sts.c_iflag &= ~(BRKINT | ICRNL);
This fixes a subtle bug that only shows up in a few circumstances.
- Page 287, first line, getopt should be poptGetNextOpt
- Page 335, third line,
int recvmsg(int fd, const struct msghdr * msg, unsigned int flags);
should be
int recvmsg(int fd, struct msghdr * msg, unsigned int flags);
- Page 372, third line, time() should be time(NULL)
- Page 401, the up, down, left, and right arrow codes each have
one too many "[" characters.
- Page 411, bottom code example, the commas in the for
expression should be semicolons.
- Page 425, the last paragraph says that the code sample slcharset.c
demonstrates the use of SLsmg_draw_box(), which is false.
Emend line 15 to read
SLsmg_draw_box(0, col, 20, 38);
to make the statement true.
Second Printing (May 1998) and earlier
Ordered by page number:
- Page 35, line 4 foo.c should be simply foo
- Page 44, third paragraph,
"redirection with >, >, and >>"
should be
"redirection with <, >, and >>"
- Page 69, footnote, the correct URLs are
ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ELF.doc.tar.gz
and
ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz
(the "GCC" should be in upper case).
- Page 86, first paragraph, "open()" should be "read()".
- Page 100, line 13, "...changed to uid." should be
"...changed to euid."
- Page 109, 7th line from the top, "first field" should be "second field".
- Pages 111 (last line), 138 (last full paragraph),
148 (second paragraph), 149 (first line of table), 153 (first paragraph),
167 (middle of page), 195 (last paragraph),
217 (second paragraph), 221 (last paragraph), 223 (second paragraph),
243 (second paragraph), 409 (middle of page), and 410 (middle of page),
"logically", "logical", or "Logically" should be "bitwise" or "Bitwise".
- Page 113, second paragraph, "passed to the child process" should
read "passed to the new program".
- Page 136, end of page,
execvp(newJob.progs[0].program, newJob.progs[0].argv);
fprintf(stderr, "exec() of %s failed: %s\",
newJob.progs[0].program,
should be
execvp(newJob.progs[0].argv[0], newJob.progs[0].argv);
fprintf(stderr, "exec() of %s failed: %s\n",
newJob.progs[0].argv[0],
- Page 170, first paragraph, last line, "long" should be "int", and
code line 16, "long" should be "int".
- Pages 191 (bottom) and 192 (top), "opendir() fails
if the directory exists..." should read "opendir()
succeeds only if the directory exists..."
- Page 195, 3rd and 7th lines from the bottom, braces are missing
from the struct glob_t definition. It should read
typedef struct {
...
} glob_t
- Page 200, first code display, all three instances of "continue;"
should be "return 0;".
- Page 205, fourth line from the bottom, "(a system call..." should read
"(a read() system call..."
- Page 213 (line 34 of mpx-select.c),
maxfd = fds[0] > fds[1] ? fds[0] : fds[0];
should be
maxfd = fds[0] > fds[1] ? fds[0] : fds[1];
This has been corrected in the on-line source code.
- Page 217, second to last paragraph, "PROC_EXEC" should
be "PROT_EXEC".
- Page 225, code segment,
perror("unexpected error checking lock %s");
should be
perror("unexpected error checking lock");
- Page 229 (first line of code), locks.c should be lock.c.
- Page 244, second to last paragraph, "the the" should be "the" and
"dest" should be "src".
- Page 261, first text paragraph, both instances of "-1" should be "0".
- Page 273, third code display, ots should be ts:
tcsetattr(STDIN_FILENO, TCSAFLUSH, &ots);
should be
tcsetattr(STDIN_FILENO, TCSAFLUSH, &ts);
- Page 278, line 138, the last 0 should be 'n', so the
whole line should be
{ "noflow", 'n', 0, 0, 'n' },
- Page 280, line 227 should read
poptFreeContext(optCon);
- Page 337, line 24, "/* The parent process..." should read
"/* The child process..."
- Pages 338 and 339, lines 59 and 103, cmsg->cmsg_data
should be CMSG_DATA(cmsg). An appropriate change, defining
CMSG_DATA on the libc version 5 systems, which do not provide a definition,
has been made in the sockutil.h header file, which is only available
online and not in the book text.
- Page 341, the end of the second-to-last paragraph should read
"...from network order to the host byte ordering." (The order was
reversed in the text.)
- Page 342, 6th line from the end, <netinet.h/in.h>
should be <netinet/in.h>
- Page 345, paragraph beginning h_aliases should start with
"h_addrtype tells the type..."
- Page 345, second to last paragraph ends "struct inaddr",
should end "struct in_addr" instead.
- Page 351, tserver.c line 20 should read
size_t addrLength = sizeof(struct sockaddr_in);
- Page 358, third line from bottom, "g1" should read "t1".
- Page 379, last full code line,
ioctl(fd, KDMKTONE, ((1193180/hertz)<<16 | ticks)
should be
ioctl(fd, KDMKTONE, (ticks<<16 | (1193180/hertz)));
- Page 392, last code segment, "CTRL" should read
CTRLCHAR".
- Page 403 (sixth line from the bottom), "second and third bytes"
should be "third and fourth bytes".
- Page 408 (first line), the character \ before the word
"Causes" is missing. (A \ is the last item in the
list.)
- Pages 410 through 413, a whole comedy of errors...
Top of page 410:
if (regcomp(&p, "(^(.*[^\])#.*$)|(^[^#]+$)",
should be
if (regcomp(&p, "(^(.*[^\\])#.*$)|(^[^#]+$)",
Page 411, line 9, "\i+1" should be "\i"
Page 411, bottom code example, regmatch_t *pmatch; should
be followed by int i; and int removed from the
following for expression, and the commas should be semicolons.
Page 412, first line should be proceeded by the missing line
submatch[matchlen] = '\0';
Page 413,
errbuf_size = regerror(errcode, &preg, NULL, 0)
should be
errbuf_size = regerror(errcode, preg, NULL, 0);
and
regerror(errcode, &preg, errbuf, errbuf_size);
should be
regerror(errcode, preg, errbuf, errbuf_size);
sigh.
A new program, match.c, has been added to the source archives to demonstrate
in a working program how regular expressions work.
- Page 462, loadhello.c incorrectly identifies itself as usehello.c.
- Page 480, code line 60,
globfree(&cmd->progs[i].globResult);
should be
if (cmd->progs[i].freeGlob) globfree(&cmd->progs[i].globResult);
- Page 519, first word, ln should be ld.
First Printing (April 1998) only
Ordered by page number:
- Page 9 (bottom), The best thing about standards is that there are
so many to choose from incorrectly attributed anonymously. The correct
attribution is "Andrew Tanenbaum, Computer Networks, Prentice Hall, 1981,
page 168." Our apologies to Andy.
- Page 243 (bottom), sa_restore should be sa_restorer.
- Page 244, the second code display has src and dest
reversed. The corrected display should read:
src = someString;
while (*src)
*dest++ = *src++;
- Pages 403 (bottom) and 404 (top), the n and e
arguments to the echo command should be -n and
-e, respectively.