UNIX Systems Programming


The table below was last updated on March 18, 2008.

The Printing column lists the printings of the book that contain the error. This information is correct through the third printing. An error listed as being in all printings in the table may have been corrected in a printing after the third.

To find out which printing of the book you have, look at the page facing the dedication page. The printing number is listed near the bottom of the page just above the ISBN number.

Preface xvii all The name Carlos Cardenas is misspelled. We offer Carlos our deepest appology. (Found by Carlos Cardenas)
Chapter 1 13 all At the end of first paragraph, change "attempts" to "attempt". (Found by Alban Clemenz)
16 all At the end of the paragraph after Figure 1.1: "function returns 1," should be "function returns nonzero,". (Found by Bruno Hertz)
Chapter 3 62 all 4th line from the bottom, remove the last 's' from operating systems.
(Found by Alban Clemenz)
80 all In Example 23, next to last line, the first token should be execmd instead of myexec.
(Found by O. Aydogan)
Chapter 4 98 all Program 4.2, first if in while loop should be:
if (byteswritten < 0)
Also, byteswritten should be initialized to 0. (Found by Felix Finch)
Also, the heading of Program 4.2 should say The copyfile function copies ... (Found by O. Aydogan)
99 all Program 4.4, second line in the body of the for loop should be:
if ((byteswritten == -1) && (errno != EINTR))
100 all Just above Program 4.5, the sentence should read:
Program 4.6 shows a version of copyfile that uses the r_read and r_write functions. (Found by Anket Mathur)
Chapter 6 188 all 5th line from the bottom, change synchronize to synchronizes.
(Found by Alban Clemenz)
198 all In Program 6.8, pipeclient, the include should be string.h instead of strings.h. Also, a newline should be added at the end of the string in the first fprintf.
(Found by T. Sarajian)
201 all In Program 6.10, seqclientbad, the include should be string.h instead of strings.h.
Chapter 8 290
1 In Program 8.14, asyncmonitorsignal.c, add the line
     aiocb.aio_offset += mystatus;
after the line
     totalbytes += mystatus;
Also, initread should block and restore all signals.
Add the following sentence to the last paragraph on page 290:
Since aio_read is not async-signal safe, initread blocks all signals before calling readstart.
(Found by Robert Davies)
297 all In Program 8.16, asyncmonitorpoll.c, add the line
      iops[handle].control.aio_offset += numbytes;
after the line
      *bufp = (char *)iops[handle].control.aio_buf;
(Found by Jay Tobias)
Chapter 9 305 all Example 9.5, The code segment for Example 9.5 should be:
   struct tm *tcurrent;
   time_t current_time;
   current_time = time(NULL);
   tcurrent = localtime(¤t_time);
   printf("%d days have elapsed since Jan 1\n", tcurrent->tm_yday);
(Found by Daniel Zieber)
306 all Example 9.6, the code segment for Example 9.6 should be:
   struct tm tbuffer;
   time_t current_time;
   current_time = time(NULL);
   if (localtime_r(¤t_time, &tbuffer) != NULL)
      printf("%d days have elapsed since Jan 1\n", tbuffer.tm_yday);
(Found by S. Robbins)
318 all Program 9.7, the first line in main should read:
   if (setupinterrupt())
(Found by John Nguyen)
331 all In expiration number 4 in the table at the top of the page, The entry for desired expiration should be 110 instead of 10. (Found by E. Chen)
331 all two references to TIMER_ABSOLUTE should be TIMER_ABSTIME. (Found by E. Chen)
Chapter 10 361 all Example 10.5, 4th line, the comment should refer to Timer 3 rather than Time 1. The line should read:
1000000 3 1000000 Timer 3 preempts 2 to expire at time 5
(Found by A. Rodriguez)
362 all In Program 10.3 (testtime), the reference to catchinterrupt should be catchsetup.
(Found by A. Rodriguez)
Chapter 11 378 all 4th sentence, move the second comma to after the word "last."
Chapter 12 416 all In the synopsis for pthread_equal the prototype should be
      int pthread_equal(pthread_t t1, pthread_t t2);
(Found by S. Robbins and Carlos Cardenas)
429 all In Program 12.9: badparameters.c. The last for loop should contain both if statements and should be:
   for (j = 0; j < NUMTHREADS; j++) {
      if (pthread_equal(pthread_self(), tid[j]))
      if (error = pthread_join(tid[j], NULL))
         fprintf(stderr, "Failed to join thread: %s\n", strerror(error));
(Found by Matthias M. Lathe)
430 1 In the second line after the whichexit.c program, change pthread_exit to return.
Also, in the program whichexit, sizeof(int *) should be sizeof(int) (Found by S. Robbins)
Chapter 13 465 all In the answer to Exercise 13.12 at the top of the page, the reference to executeonce in item 5 should be testandsetonce. (Found by Orjan Sterner)
468 all In the synopsis, pthread_cont_t should be pthread_cond_t. (Found by Sriharsha Mallina)
476 all Program 13.14. See the comment in the Additional Comments section.
Chapter 15 525 1 In Program 15.4, initsemset. In two places the call to semget should have second parameter 1 instead of 2. (Found by S. Robbins)
539-541 all Program 15.9 should contain the function msgread:
int msgread(void *buf, int len) {   /* read into buffer of specified length */
   return msgrcv(queueid, buf, len, 0, 0);
and in Program 15.10, the line with msgrcv should be
      if ((size = msgread(&mymsg, MAXSIZE)) == -1) {
(Found by HyoungJu Lee)
Chapter 18 618 all Table 18.1, in the description of u_accept, hostname should be hostnsize. (Found by S. Robbins)
623 all Program 18.2, remove the continue line after the fork fails
(Found by Anthony Castaldo)
627 all Example 18.18, remove the first line of the code segment:
child = fork();
(Found by Igor Khalfine)
629 all Program 18.5, client2 needs a prototype for copy2files. (Found by Steven Brown)
Appendix A 806 all In example A.15, the define statement should be:
(Found by N. Kalinowski)
807 1 In the last line, comma should be changed to a period.
Appendix B 822 all The second line of the body of the for loop should be:
if ((byteswritten == -1) && (errno != EINTR))
Index 892 all The reference to TIMER_ABSOLUTE should be TIMER_ABSTIME.

If you find any other errors, please send mail to the authors.