Debian Codegraph @

debian/errata.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 <meta name="Author" content="CodeSourcery, LLC">
6 <meta name="description" content="Advaned Linux Programming web site">
7 <link rel="stylesheet" type="text/css" href="alp.css">
8 <title>Advanced Linux Programming</title>
9 </head>
10 <body>
11
12 <a href="http://www.advancedlinuxprogramming.com/"><img border="0" src="images/alp-header.png"></a>
13 <hr size="1" noshade>
14
15
16
17 <h3>Reporting an Error</h3>
18
19 <p>Should you find an error in <span class="title">Advanced Linux
20 Programming</span> that is not already listed here,
21 please send mail to
22 <a href="mailto:[email protected]">[email protected]</a>.</p>
23
24 <h3>Errata for <span class="title">Advanced Linux Programming</span></h3>
25
26 <ul>
27
28 <li>
29 <b>page <i>iv</i> (publication information)</b>
30
31 <p class="heading">Due to an oversight in production, an incorrect copyright notice
32 was included. The copyright notice should read:</p>
33
34 <blockquote>
35 Advanced Linux Programming
36 <br><br>
37 FIRST EDITION: June, 2001
38 <br><br>
39 Copyright &copy; 2001 by New Riders Publishing. This material may be
40 distributed only subject to the terms and conditions set forth in the Open
41 Publication License, Version 1, no options exercised. (The latest version of this license
42 is available at <tt>http://www.opencontent.org/openpub/</tt>).
43 </blockquote>
44 </li>
45
46 <li>
47 <b>page <i>xx</i></b>
48
49 <p>The term &quot;GNU/Linux&quot; is misspelled as &quot;GNU/Liux.&quot;</p>
50 </li>
51
52 <li>
53 <b>page 6</b>
54 <p>In Listing 1.1, add <tt>#include &lt;stdlib.h&gt;</tt> since <tt>atoi</tt> is used.</p>
55 </li>
56
57 <li>
58 <b>page 8</b>
59 <p>The first paragraph of Section 1.2.2 should refer to <tt>reciprocal.cpp</tt>,
60 not <tt>utilties.cpp</tt>.</p>
61 </li>
62
63 <li>
64 <b>page 31</b>
65 <p>In the third paragraph, the third sentence should read:
66 <blockquote>
67 You should still always check for invalid input and produce sensible error
68 messages in response to such input.
69 </blockquote>
70 The words &quot;to such&quot; are missing in the book as printed.
71 </p>
72 </li>
73
74 <li>
75 <b>page 34</b>
76 <p>In the code, the comment for <code>case ENOENT</code> should
77 read <code>PATH does not exist</code>.
78 </p>
79 </li>
80
81 <li>
82 <b>page 38</b>
83 <p>
84 The first sentence in Section 2.3.2 should refer to <q>an archive</q>
85 rather than <q>a archive</q>.
86 </p>
87 </li>
88
89 <li>
90 <b>page 38</b>
91 <p>In the last sentence of the text, omitting the sidebar, the
92 resulting object file is <code>test1.o</code>, not <code>test.o</code>.
93 </p>
94 </li>
95
96 <li>
97 <b>page 39</b>
98 <p>In the first paragraph, the linker stops <em>searching</em>
99 directories.
100 </p>
101 </li>
102
103 <li>
104 <b>page 41</b>
105 <p>In the paragraph beginning with "Static libraries", modify
106 "If decide to link" to "If you decide to link".
107 </p>
108 </li>
109
110 <li>
111 <b>page 41</b>
112 <p>When linking statically, linking in the math library is
113 also required. Thus, the compilation line becomes
114 <code>gcc -static -o tifftest tifftest.c -ltiff -ljpeg -lz -lm</code>.
115 </p>
116 </li>
117
118 <li>
119 <b>page 43</b>
120 <p>The indented line of code near the bottom of the page should refer to <code>my_function</code>, not <code>foo</code>.
121 </p>
122 </li>
123
124 <li>
125 <b>page 48</b>
126 <p>In the first paragraph, the first technique has "considerable risks",
127 not "considerably risks".
128 </p>
129 </li>
130
131 <li>
132 <b>page 53</b>
133 <p>The word &quot;it&quot; in the last sentence of the second paragraph
134 should instead be &quot;is&quot;.
135 In particular, the sentence should read:
136 <blockquote>
137 The default disposition for these signals is to terminate the process
138 and produce a core file.
139 </blockquote>
140
141 <li>
142 <b>page 57</b>
143 <p>The word &quot;is&quot; in the last sentence should instead be &quot;it.&quot;
144 In particular, the sentence should read:
145 <blockquote>
146 Instead, when a child process terminates, it becomes a zombie process.
147 </blockquote>
148
149 <li>
150 <b>page 60</b>
151 <p>The code in <code>clean_up_child_process</code> would not work correctly if there were more
152 than one child process. The Linux kernel will only call the signal handler once if two or more
153 child processes terminate at almost the same time. Therefore, if there is may be more than one child
154 process, the signal handler must repeatedly call <code>waitpid</code> (or one of the other
155 related functions) with the <code>WNOHANG</code> option until <code>waitpid</code> returns zero.</p>
156 </li>
157
158 <li>
159 <b>page 73</b>
160 <p>In the first paragraph, the second argument is for <code>pthread_key_create</code>, not
161 <code>pthread_key_t</code>. Thus, the <code>pthread_key_create</code> function takes two arguments:
162 a pointer to a <code>pthread_key_t</code> variable and a cleanup function.</p>
163 </li>
164
165 <li>
166 <b>page 98</b>
167 <p>The example code for calling <code>shmget</code> should use <code>S_IWUSR</code>, not
168 <code>S_IWUSER</code>. This write permission flag is spelled correctly throughout the
169 rest of the page. For a list of available flags, see the section 2 <code>stat</code> man page.</p>
170 </li>
171
172 <li>
173 <b>page 108</b>
174 <p>In Listing 5.6, the function used to parse the string
175 should be <code>sscanf</code>, not <code>scanf</code>.</p>
176 </li>
177
178 <li>
179 <b>page 110</b>
180 <p>The last sentence of section 5.4.1 should read:
181 <blockquote>
182 Data written to the file descriptor <code>write_fd</code> can be read back from <code>read_fd</code>.
183 </blockquote>
184 <p>
185 The identifiers <code>write_fd</code> and <code>read_fd</code> are
186 swapped in the text as printed.</p>
187 </li>
188
189 <li>
190 <b>page 117</b>
191 <p>In section 5.5.2, the list of system calls should mention
192 <tt>close</tt>, not <tt>closes</tt>.</p>
193 </li>
194
195 <li>
196 <b>page 120</b>
197 <p>In Listing 5.10, <tt>text</tt> should be checked for the
198 <tt>quit</tt> message before it is freed. The consequent of the
199 <tt>strcmp</tt> should be <tt>free (text); return 1</tt>. Its
200 alternative should be <tt>free (text)</tt>. The standalone
201 <tt>free</tt> statement should be omitted.</p>
202 </li>
203
204 <li>
205 <b>page 121</b>
206 <p>In Listing 5.10, the <code>client_name_len</code> variable in
207 the <code>do</code>-loop should be initialized to
208 <code>sizeof(client_name)</code> before being passed to
209 <code>accept</code>.
210 </p>
211 </li>
212
213 <li>
214 <b>page 121</b>
215 <p>In Listing 5.10, the call to <code>bind</code> on the ninth
216 line of this page should cast the second argument to a
217 <code>struct sockaddr *</code>. That is, the <code>bind</code>
218 call should be
219 <blockquote>
220 <code>bind (socket_fd, (struct sockaddr *) &name, SUN_LEN (&name))</code>.
221 </blockquote></p>
222 <p>Similarly, on the nineteenth line, the second argument of
223 <code>accept</code> should be cast:
224 <blockquote>
225 <code>accept (socket_fd, (struct sockaddr *) &client_name, &client_name_len)</code>
226 </blockquote>
227 </p>
228 </li>
229
230 <li>
231 <b>page 122</b>
232 <p>In Listing 5.11, the call to <code>connect</code> on the sixth
233 line from the end should cast the second argument to a
234 <code>struct sockaddr *</code>. That is, the <code>connect</code>
235 call should be
236 <blockquote>
237 <code>connect (socket_fd, (struct sockaddr *) &name, SUN_LEN (&name))</code>.
238 </blockquote></p>
239 </p>
240 </li>
241
242 <li>
243 <b>page 125</b>
244 <p>In Listing 5.12, the call to <code>connect</code> on the second
245 line should cast the second argument to a
246 <code>struct sockaddr *</code>. That is, the <code>connect</code>
247 call should be
248 <blockquote>
249 <code>connect (socket_fd, (struct sockaddr *) &name, sizeof (struct sockaddr_in))</code>.
250 </blockquote></p>
251 </p>
252 </li>
253
254 <li>
255 <b>page 130</b>
256 <p>The third line of the first full paragraph should omit the word "cause".
257 </p>
258 </li>
259
260 <li>
261 <b>page 132</b>
262 <p>The sixth line of the first full paragraph should refer
263 to &quot;the character device&quot;, not the &quot;the block device&quot;.
264 </p>
265 </li>
266
267 <li>
268 <b>page 133</b>
269 <p>In the first footnote, the Windows device name should be <code>LPT1</code>,
270 not <code>LRP1</code>.
271 </li>
272
273 <li>
274 <b>page 133</b>
275 <p>In the second footnote, the ASCII code for a carriage return should be 13, not 14.</p>
276 </li>
277
278 <li>
279 <b>page 149</b>
280 <p>The check for whether or not the read failed should be:</p>
281 <blockquote>
282 <code>if (bytes_read == 0 || bytes_read != sizeof (buffer))</code>
283 </blockquote>
284 <p>
285 Note that the operator for the second half of the conditional should
286 be <code>!=</code> rather than <code>==</code>.
287 </p>
288 </li>
289
290 <li>
291 <b>page 171</b>
292 <p>In the third paragraph, use <code>F_SETLKW</code>, not <code>F_SETLCKW</code>. This
293 <code>LK</code> abbreviation differs from the <code>LCK</code> abbreviation in <code>F_RDLCK</code> and
294 <code>F_WRLCK</code>.
295 </p>
296 </li>
297
298 <li>
299 <b>page 174</b>
300 <p>The first sentence of the third paragraph of section 8.5
301 should end with &quot;pointer to a <code>struct rlimit</code>&quot;, rather
302 than &quot;pointer to a <code>structrlimit</code>&quot; as printed. Note
303 the space between <code>struct</code> and <code>rlimit</code>.</p>
304 </li>
305
306 <li>
307 <b>page 181</b>
308 <p>The description of <code>tv_nsec</code> should read &quot;<code>tv_nsec</code>,
309 an additional number of nanoseconds&quot; rather than &quot;<code>tv_nsec</code>,
310 an additional number of milliseconds.&quot;</p>
311 </li>
312
313 <li>
314 <b>page 183</b>
315 <p>The third parameter in the call to <code>readlink</code> should
316 be <code>sizeof (target_path) - 1</code> to allow for the terminating
317 <code>NUL</code> character.</p>
318 </li>
319
320 <li>
321 <b>page 185</b>
322 <p>The file presented in Listing 8.11 should be named "itimer.c".</p>
323 </li>
324
325 <li>
326 <b>page 186</b>
327 <p>The <code>sysinfo</code> manual page describes <code>struct
328 sysinfo</code>, not <code>structsysinfo</code>.</p>
329 </li>
330
331 <li>
332 <b>page 188</b>
333 <p>The file presented in Listing 8.11 should end with a ".c", i.e.,
334 "print-uname.c".</p>
335 </li>
336
337 <li>
338 <b>page 191</b>
339 <p>The assembly instructions shown corresponding to the <code>asm</code>
340 should be:
341 </p>
342 <blockquote><pre>
343 #APP
344 mycool_asm %ecx, %edx
345 #NOAPP
346 </pre></blockquote>
347 <p>
348 reflecting the fact that <code>foo</code> and <code>bar</code> are
349 in separate registers.
350 </p>
351 </li>
352
353 <li>
354 <b>page 206</b>
355 <p>In the beginning of 10.4.1, the root process impersonates
356 another user, not another process.</p>
357 </li>
358
359 <li>
360 <b>page 212</b>
361 <p>The prototype of the GNU extension <code>getline</code>
362 function differs from that presented. To use the GNU extension,
363 modify the code to</p>
364 <pre>
365 char *username = NULL;
366 size_t username_length = 0;
367 ssize_t characters_read = getline (&username, &username_length, stdin);
368 </pre>
369 <p>If the call fails, <code>characters_read</code> will be <code>-1</code>.
370 Otherwise, <code>username</code> will point to a <code>malloc</code>-allocated
371 buffer with <code>username_length</code> characters.</p>
372 </li>
373
374 <li>
375 <b>page 224</b>
376 <p>The third parameter in the call to <code>readlink</code> should
377 be <code>sizeof (link_target) - 1</code> to allow for the terminating
378 <code>NUL</code> character.</p>
379 </li>
380
381 <li>
382 <b>page 231</b>
383 <p>The third parameter in the first call to <code>write</code> should
384 be <code>strlen (bad_request_response)</code>.</p>
385 </li>
386
387 <li>
388 <b>page 241</b>
389 <p>The <code>error_page</code> string should note a failure to
390 open <code>/etc/issue</code>, not <code>/proc/issue</code>.</p>
391 </li>
392
393 <li>
394 <b>page 245</b>
395 <p>The comment above the <tt>get_group_name</tt> function should
396 say &quot;deallocate with free&quot;, not &quot;allocate with
397 free&quot;.</p>
398 </li>
399
400 <li>
401 <b>page 286</b>
402 <p>The first line inside the while loop is incorrect. It should
403 read:
404 <blockquote>
405 size_t written = write (fd, buffer + count - left_to_write,
406 left_to_write);
407 </blockquote>
408 </p>
409 </li>
410
411 </ul>
412
413 <hr size="1" noshade>
414 <table border="0" cellpadding="0" cellspacing="0" width="100%">
415 <tr>
416 <td align="right" valign="top">
417 <span class="footnote">Problems with this web site?
418 <a href="https://github.com/MentorEmbedded/advancedlinuxprogramming/issues">File an issue on github.</a>
419 </span>
420 </td>
421 </tr>
422 </table>
423 </body>
424 </html>