<<

0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 597

Index

A Application Binary Interface (ABI) incompatible, 97–98 a , , 151 for system calls, 225 .a extension, 73 Application performance, 475 a modifier, print and x, gdb, 543 gcov, 491–494 ABI (Application Binary Interface) gprof, 488–491 incompatible, 97–98 instruction efficiency, 480–484 for system calls, 225 ltrace, 484–485 abort function, 589–590 OProfile, 494–501 accept function, 388, 391 processor architecture, 476–480 Acrobat Reader, 131 strace, 485–487 Add/remove feature in revision control, 191 , 475–476 addr2line utility, 588–589 Application Programming Interface (API), 225 Adopted processes, 243 Application timing, 255–256 Advanced Programmable Interrupt Controller apropos command, 118, 122 (APIC), 462–463 apt-cache command, 35 Advisory locks, 362 apt-get command, 35 Affinity masks, 507–509 apt-key command, 35 aic79xx module, 137–138 apt-setup command, 35 alarm function, 237 Apt tool, 34–35 all target, 77 files, 5, 12 Ampersands (&) in mode, 159 Archive files, 4–5 Analyzing code extracting, 11 cflow for, 207–210 identifying, 6–7 compiler for, 214–216 querying, 7–11 for, 210 as scheduler, 285 Anonymous mapping, 73, 302, 308 ascii , 113 Anticipatory I/O scheduler, 284–285 Assembly language API (Application Programming Interface), 225 inline, 292 APIC (Advanced Programmable Interrupt in linker process, 68 Controller), 462–463 system calls in, 224–225 Apostrophes (‘) assert function, 589–590 Ex mode, 159 astyle artistic style, 206–207 vi, 149–150 attach command, gdb, 553

597 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 598

598 Index

Attaching running processes, 553 Binaries, miscellaneous, 324–326 __attribute__ directive, 524–525 Binary packages, 14–16 Authentication, 19–21 Binary semaphores, 403 digital signatures for, 21–25 —bindir option, 75 problems in, 25–26 binutils package, 569 Autocompletion feature, 145 Black box for debugging, 584–587 Kate, 183 Block devices, 257–258, 274–276 vi and Vim, 147, 169 Blocked signals, 373 autoconf script, 82 Blocking Autoindentation in process scheduler, 228–229 Emacs, 171 timing with, 248–249 Vim, 167 Bookmarks, 175 automake tool, 77 boot man page, 113 Automatic indenting, 145 bootparam man page, 113 Automatic storage, 338 Braces ({}) Automatic variables, 57–58 matching, 144, 182 auxv files, 344 missing, 93–94 awatch watchpoints, 540 variables, 52 script, 322 Branching in revision control, 192 break command, gdb, 531, 558 breakpoint command, gdb, 532 Breakpoints B conditional, 534–535 b command, vi, 150 gdb, 531–532 b suffix, x, gdb, 545 setting, 535–537 Background processes, 244 syntax, 532–534 Backticks (`), 49, 60–61 and templates, 548–549 backtrace command, gdb, 542, 555 brk system call, 310 backtrace_symbols function, 588 Browsing and building code Backtraces, 587–589 Emacs, 175–176 function, , 60 Vim, 164–166 basic.S listing, 224 Brute-force man page matching, 110 bcopy function, 112 bsd autoindentation style, 171 Beautifiers and browsers, source code, BSD syntax, 435 203–204 Buffers astyle, 206–207 Emacs, 173 cflow, 207–210 streams, 516–517 compiler, 214–216 file systems, 517–519 cscope, 211 I/O devices, 276–280 ctags, 210 overflows, 555–556, 571–572 Doxygen, 212–213 stack, 338 indent code, 204–206 text editor, 145 Big Endian byte order, 424, 426 trace, 584–587 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 599

Index 599

Builds, 41–42 Caches alternative approaches, 43–44 CPU, 291–295 background, 42 I/O devices, 276–280 documentation, 135–136 memory, 295–296 errors and warnings, 78 multiprocessor performance, 504 build stage, 83–86 call command, gdb, 547 compiler errors, 86–88 call function, make, 63 compiler warnings, 88–98 callgrind tool, 580 configure stage, 82–83 cb filter, 204 linker errors, 98–100 cfile command, Vim, 166 Makefile mistakes, 79–82 CFLAGS, 66 GNU tools, 43, 74–77 cflow command, 207–210 imake, 42–43 cfq scheduler, 285–286 libraries for, 69–73 Change commands, vi, 153 linking, 67–69 Character devices, 257–258, 273–274 make program. See make program and charsets man page, 113 Makefiles Check in in revision control, 191 process, 74 Check out in revision control, 191–192 Bus contention, 459–461 chrt command, 236–237 Bus error (SIGBUS) , 554 CISC (Complex Instruction Set ) bvi editor, 180, 421–422 processors, 501–502 bzip2 tool, 4 Clean blocks, 280 clean target, 77 Client/server example local sockets, 387–392 network sockets, 392–393 client_un.c listing, 390–392 C command clock function, 249–251 Emacs, 173 clock_getres function, 253 vi, 153 clock_gettime function, 251–252 C language CLOCK_ IDs, 252–253 compiler warnings, 93–94 clock_t , 249–251 file streams, 516–517 Clock ticks, 249, 253–255 preprocessor, 81 CLOCKS_PER_SEC macro, 249 C++ language clone system call, 320 breakpoints, 535–537 Closing compiler warnings, 95–98 device drivers, 257 STL, 549–551 POSIX message queues, 398 and templates, 548–549 cmdline file, in /proc, 344, 593 c modifier, print and x, gdb, 543 cnext command, Vim, 166 cache-miss.c listing, 478–480 Code. See Source code Cache misses, 458, 481, 483 Coherency, memory, 295–296 cachegrind tool, 480–481 Coloring, stack, 339 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 600

600 Index

Command mode, vi, 147–148 cpp info page, 119 Communication, interprocess. See Interprocess CPPFLAGS variable, 82–83 communication (IPC) cppsym.c listing, 536 Compatibility cprev command, Vim, 166 ABI, 97–98 CPU text editor, 146 cache, 291–295 Compiler multicore, 505–506 code analysis, 214–216 multiprocessing, 456–458 errors, 86–88 parallelism, 501–504 warnings, 88–89 utilization C, 93–94 affinity masks for, 507–509 C++, 95–98 vs. efficiency, 458–459 format, 91–93, 525–526 for, 469 implicit declarations, 89–91 CPU_ macros, 508 Complete Fair Queuing I/O scheduler (CFQ), cpu_idle function, 458 285 cpu_set_t type, 508–509 Complex Instruction Set Computer (CISC) crazy-malloc.c listing, 303–304 processors, 501–502 crazy-malloc2.c listing, 308–310 Concurrent Version System (CVS), 190–193, crazy-malloc3.c listing, 312–315 201 Cross-references Conditional breakpoints, 532, 534–535 help, 121–122 Conditional constructs, 64–66 man pages, 111 configure.in file, 77 cscope tool, 211 configure script ctags command, 164–166, 210 build process, 74–77 Ctrl key errors in, 82–83 vi, 151, 154 Conflicts in revision control, 201 Vim, 161, 165 CONFORMING TO man section, 112 Cursor movement commands Cons project, 44 Emacs, 173 Containers, 549 vi, 149–151 Contention, bus, 459–461 commands continue command, gdb, 532, 558 Emacs, 174 control.tar.gz file, 32 vi, 155–158 Cooperative multitasking, 227 CVS (Concurrent Version System), 190–193, Copy on technique, 319–320 201 Core dumps, 589–591 cwd file, in /proc, 344, 593 core-file command, gdb, 554 Core files, debugging, 553–557 coreutils info page, 119 D Corruption memory, 578–579 d command stack, 555–556 Ex mode, 159, 161 Counters, semaphore, 402–403 vi, 155 cpio files, 5, 8, 11 d modifier, print and x, gdb, 543 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 601

Index 601

-d option, GCC, 214–215 detach command, gdb, 553 data.tar.gz file, 32 /dev directory, 9, 241, 260–263 —datadir option, 75 devfs, 266 dbgprintf function, 586 Device Independent (DVI) system, 124 command, 246–247, 475–476 Devices and device drivers, 257, 272–273 deadline scheduler, 284–285 block, 257–258, 274–276 Debian distribution buffer cache, 276–280 contents, 28–33 bus contention, 459–461 package format for, 14 character, 257–258, 273–274 updating, 34–35 file-system, 259 Debugging, 513–514 file-system cache, 276–281 backtraces for, 587–589 interrupts, 461–462 black box for, 584–587 kernel modules, 259–260 core dumps, 589–591 lspci for, 464–467 GNU. See gdb debugger network, 259 IPC. See Interprocess communication (IPC) nodes, 257, 260–262 memory issues. See Memory major numbers, 264–265 preprocessor macros, 214–216 minor numbers, 263–264 for. See printf function sources, 266–271 procfs for, 416, 591–594 PIC vs. APIC, 462–463 shared objects. See Shared objects slots, 463–467 shell commands, 85–86 command, 193–197 signals for, 590–591 diff3 command, 198–201 Declaration warnings, 89–91 diffstat command, 123 Decrypted passwords in memory, 343 Digital signatures Default editors, 143–144 authentication with, 21–25 Default shared object locations, 564–565 ELF files, 324 #define directive, 520–521 renaming functions based on, 99 delete command -dir option, 197 Ex mode, 160 Direct Memory Access (DMA), 295 gdb, 532 Dirty blocks, 280 Delete commands Dirty caches, 296 Emacs, 174 display command, gdb, 551–552 vi, 155–158 Displaying delete operator, C++, 572 expressions, 551–552 Dependencies variable values, 542–547 compiler, 214 distclean target, 77 make program, 45–48, 79 Distribution formats, 3 package, 13, 27–28 DMA (Direct Memory Access), 295 in updates, 38 do/while loops, 522–523 Deprecated features, 96–97 doc- package, 121 Desktop help tools, 120 DocBook format, 126–127, 138 Destructors, 95 docbook-utils package, 126 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 602

602 Index

Document Type Definition (DTD), 126 .emacs file, 177–178 Documentation. See also Help Emacs text editor, 143, 146, 170 builds, 135–136 browsing and building code, 175–176 code, 212–213 commands and shortcuts, 172–173 cross referencing and indexing, 121–122 cursor movement, 173 Emacs commands, 172 deleting, cutting, and pasting, 174 formats, 124–131 features, 170 Dollar signs ($), Ex mode, 159 GUI mode, 179 Domains, socket, 383 modes, 170–172 down command, gdb, 542 search and replace, 174–175 Doxyfile file, 212–213 settings, 177–178 Doxygen tool, 212–213 text mode menus, 176–177 dpkg command, 32 for vi users, 178–179 Drivers. See Devices and device drivers environ file, in /proc, 344, 592 DTD (Document Type Definition), 126 ENVIRONMENT man section, 111–112 Dual-core CPUs, 505–506 error function, 63 Dumping errorformat setting, 168 core files, 553–557 Errors and warnings, build process, 78 file data, 420–426 build stage, 83–86 DVI (Device Independent) format, 124 compiler errors, 86–88 dvipdf tool, 125 compiler warnings, 88–98 Dynamic libraries, 69–73, 561 configure stage, 82–83 Dynamic linker, 69, 300, 562–565 linker, 98–100 Dynamic priority, 230–231 Makefile, 79–82 etags utility, 175 etime format, 349 evince tool, 124, 130 E Ex mode, 158–163 e command, Ex mode, 161 Exact matching for man pages, 110 -E option, GCC, 214–215 Exception conditions, 370 command, 50 exe file, in /proc, 345, 593 ECOFF format, 324 exec function edit command, Ex mode, 160 child processes, 318, 320, 330, 332, 334 Editing source files. See Text editors chrt, 238 EF_ALLOW_MALLOC_0 variable, 582 control transfer, 320–321 ef, Fence tool, 581 Executables EF_PROTECT_BELOW variable, 583 object files, 324 Effective scheduler priority, 231 profiling Electric Fence tool, 581–583 gcov for, 491–494 Elevator algorithms, 282–284 gprof for, 488–491 ELF format, 324 OProfile for, 494–501 ellemtel autoindentation style, 171 scripts, 321–323 else clause, 65 Execution parallelism, 502 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 603

Index 603

execve function, 320–326 filedat.c listing, 420–422 expandtabs setting, 167 Files .exrc file, 166–167 dumping, 420–426 Extracting archive files, 11 locking, 362 permissions, 8–10 Filesystem Hierarchy Standard, 121 for man pages, 105 F overview, 113 f command, vi, 156 filter function, 62 f modifier, print and x, gdb, 543 filter-out function, 62 factorial.c listing, 555–556 Filters, Synaptic, 37 FAQs, 133 Finding fcntl function, 335 info pages, 118 FD_CLOEXEC flag, 335 man pages fd directory, 336 with apropos, 107–110 description, 345 with whatis, 110–111 for open files, 594 open source tools, 2–3 for pipes, 437 processes, 352–353 fdatasync function, 281, 518–519 findstring function, 62 Fedora distribution firefox package, 23 GUI-enabled vim package for, 169 First in, first out (FIFO) man pages in, 107 pipes, 437–438 package format for, 14 scheduling, 236–237 fflush function, 517, 519 Fixed scheduler priority, 230 fg command, 244 flawfinder tool, 571 Fibonacci function, 205 Floating-point error (SIGFPE) signal, 553 Field groups with , 450 Floating-point types with printf, 526 FIFO (first in, first out) flock function, 413 pipes, 437–438 Flushing caches, 296 scheduling, 236–237 Folding in Kate text editor, 183 file command, 6–7, 418–419, 554 Footprint, process, 329–331 File descriptors, 331–336 fopen function, 362 leaked, 415 Forcing core dumps, 589–591 limits, 337–338 Foreground processes, 244 lsof command, 336–337 fork-file.c listing, 332–336 file-ipc-better.c listing, 360–362 fork function, 238, 242, 318, 320, 332, 334 file-ipc-naive.c listing, 358–360 Forks, timing in, 255 File streams, 516–517 Formats File systems help documentation, 124–131 buffering, 517–519 man pages, 105 caches, 276–280 package, 14 drivers, 259 printf, 91–92, 525–526 I/O, 274–276 process information, 349–351 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 604

604 Index

fprintf function, 91 print, 542–547 Fragmented memory, 305–306 templates, 548–549 frame command, gdb, 542 for multithreaded programs, 557–558 free command, 449, 452–453, 572 for optimized code, 558–561 Frequency, tick, 253–255 running code with, 530–531 Frontside bus (FSB), 456–458 stopping and restarting execution with, fsync function, 281, 517–519 531–532 ftok function, 413 breakpoints, 532–537 ftpd function, 320 watchpoints, 537–541 ftruncate function, 366–367 Gedit text editor, 184–185 full device, 262 GENERATE_ tags, Doxygen, 213 funalloc.c listing, 579–580 Gentoo distribution, 14 Functions getprotoent function, 384 calling from gdb, 547 getrlimit function, 314–315, 340–342 declarations, 90 getrusage function, 250–251, 255, 328, 342 hook, 178 Ghostscript tools, 129–130 renaming, 99 glibc, 569–570 signal safe, 370 MALLOC_CHECK_ for, 573 user-defined, 63–64 memusage, 574–576 variable manipulation, 60 mtrace, 573–574 wrapper, 523–525 glibc-utils package, 574–576 command, 417–418 gmon.out file, 498–499 -help tool, 107, 117, 120 gnome-terminal, 176 G gnometerminal window, 171 GNU arch tool, 190 G command, vi, 149 autoindentation style, 171 g suffix, x, gdb, 545 GNU Compiler Collection (GCC) GCC. See GNU Compiler Collection (GCC) build tools, 43, 74–77 gcc info page, 119 C compiler warnings, 93–94 gcc project, 76 C++ compiler warnings, 95–98 gcore function, 590 code analysis, 214 gcov tool, 491–494 debugger. See gdb debugger gdb debugger, 529–530 Ghostscript tools, 129–130 attaching to running process with, 553 heap, 305–307 for core files, 553–557 info pages, 115–119 with Electric Fence, 582 GNU Privacy Guard (GPG), 22–25 inspecting and manipulating data with gdb, gprof tool, 488–491, 498–499 541–542 Graphviz tool, 212 C++ STL, 549–551 groff language tool, 131 display command, 551–552 gs command, 130 function calling, 547 gstack script, 587 0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 605

Index 605

GUI text editors, 143, 182–183 hexdump command, 424–425 Emacs, 179 hier man page, 113 Gedit, 184–185 Hints, cache, 294–295 Kate and Kwrite, 183–184 hog.c listing, 448 NEdit, 184–186 Hook functions, 178 SciTE, 186–187 Hotplug feature, 266–268 vi, 147 HOWTO documents, 133 Vim, 147, 168–169 HTML for documentation, 127–129 gvim program, 168 htons macro, 392 gvimdiff tool, 198–199 Hyperthreading feature, 339, 505 gzip tool, 4, 7 Hypertransport connections, 460 HZ macro, 253

H I h command, vi, 149 h suffix, x, gdb, 545 i command, vi, 151–152 Hard limits, 340 i modifier, print and x, gdb, 543 Hard real-time application, 236 IA32 architecture, 92 Hashes, 19–20 ifdef conditional, 64, 66 HAVE_DOT tag, Doxygen, 213 ifeq conditional, 64–66 Heap memory ifndef conditional, 64 analysis, 579–581 ifneq conditional, 64 libraries for, 305–307 Illegal instruction (SIGILL) signal, 435, 554 overflows, 571–572, 581–583 imake program, 42 and virtual memory, 308–310 Implicit declarations, 89–91 helgrind function, 580 Implicit Makefile rules, 52–57 hello-sync.c listing, 405 in_addr structure, 393 hello-unsync.c listing, 403–404 INADDR_ANY macro, 392 Help, 103 Include files, 87 cross referencing and indexing, 121–122 Incompatible ABI, 97–98 documentation formats, 124–131 Incremental search mode, 175 Internet information sources, 131–134 indent command, 204–206 kernel information, 134–138 Indentation miscellaneous documentation, 138 code beautifiers, 204–206 online tools, 103–104 Emacs, 171 desktop, 120 Indexes info pages, 115–119 Emacs, 175 man pages. See man pages help, 121–122 package queries, 122–123 Vim, 164–166 /usr/share/doc directory, 121 info command, gdb, 532, 536, 540, 542, 548, help command, Ex mode, 161 557 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 606

606 Index

info pages, 104, 115 message queues, 393 recommended, 119 POSIX, 397–402 searching, 118 System V, 393–397 viewing, 115–118 pipes, 381–382 init function, 242, 317–318, 320 plain files, 358–363 Initializers, reordered, C++, 95–96 semaphores, 402–407 Inline assembly, 292 POSIX, 407–410 Inline functions, 523, 559 System V, 410–412 Inline synchronization, 521 shared memory, 363 Inodes, 440–442 POSIX, 364–367 insecure.c listing, 342–343 System V, 367–370 Insert commands, vi, 151–152 signals, 370–371 Insert mode handling, 371–373 vi, 147 masks for, 373–376 Vim, 161–162 real-time, 376–378 Inspecting and manipulating data, gdb sending, 371 debugger, 541–542 sigqueue and sigaction, 378–381 C++ standard template library, 549–551 sockets, 382 display command, 551–552 client/server, 387–393 function calling, 547 creating, 383–385 print, 542–547 debugging, 438–440 templates, 548–549 example, 385–387 install target, 77–78 Interruptible process state, 239 Installation scripts, 27–28 Interrupts Instantiation, 548 device, 461–462 Instructions sar for, 473 efficiency, 480–484 Interrupts per second information, 469 latency, 503–504 Invalidating cache entries, 295 Interactive processes, 230 I/O Internationalization, text editor, 188–189 buffering, 517–519 Internet information sources, 131–134 devices, 272–273 Interprocess communication (IPC), 357 block devices and file systems, 274–276 debugging, 415 buffer cache and file-system cache, 276–280 dumping file data, 420–426 character, 273–274 inodes, 440–442 information open files, 415–420 sar for, 472–473 pipes, 437–438 vmstat for, 468–469 POSIX, 431–434 scheduler, 282–286 signals, 434–437 I/O APIC, 462 sockets, 438–440 iostat tool, 473–475 System V, 426–431 IPC. See Interprocess communication (IPC) 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 607

Index 607

IPC_PRIVATE macro, 393 kmsg device, 262 ipcrm command, 426, 430 Knoppix distribution ipcs command, 370, 426, 428–430 GUI-enabled vim package for, 169 IPPROTO_ flags for socket protocols, 385 man pages in, 107 Iterators, C++, 550 package format for, 14 .ko extension, 260 konqueror tool, 130 K& autoindentation style, 171 J kswapd thread, 449 j command, vi, 149 kvim program, 168–169 jadetex package, 126 Kwrite text editor, 183 java autoindentation style, 171 JBellz Trojan, 17–18 Jed text editor, 181–182 L Jiffies, 253 Jobs, process, 346 l command, vi, 149 Joe text editor, 181–182 L1 cache, 291, 481–482 L2 cache, 291–292, 482–483 L3 cache, 292 Labels in revision control, 192 K LAPIC (Local APIC), 462 k command, vi, 149 Last in, first out (LIFO) buffers, 338 Kate text editor, 183–184 Latency Kconfig files, 136 instruction, 503–504 kdvi tool, 124 scheduling, 235 Kernel, 221–222 LaTeX system, 124 clock ticks, 253–255 Lazy TLB flushing, 290 devices and device drivers. See Devices and LBA (logical block addressing), 258 device drivers ld command, 67 information about, 134–138 LD_LIBRARY_PATH variable, 564 I/O scheduler, 282–286 ld info page, 119 memory management. See Memory; Virtual LD_PRELOAD variable, 564–565, 581–582 memory ldconfig command, 564, 568 process scheduler. See Process scheduler ldd command, 68–69, 562–563, 566 user mode vs. kernel mode, 222–226 LDFLAGS variable, 82–83 Kernel modules, 259–260 ldlinux.so linker, 564 Kernel space, 222–223, 226 Leaks Kernel threads, 281 file descriptors, 415 Key mapping, vi, 148 memory, 570 khelpcenter program, 107, 117–118, 120 mtrace for, 573–574 function, 354, 371, 378–380, 531, 591 valgrind for, 577–578 kmem device, 262 Leaky.c listing, 577–578 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 608

608 Index

Leaning toothpick syndrome, 163 M Least recently used (LRU) pages, 448 m command, vi, 154 less program, 116 Macros libc info page, 119 debugging, 214–216 —libdir option, 75 do/while in, 522–523 Libraries POSIX scheduling policy, 238 for builds, 69–73 printf, 519–521 for heap, 305–307 madvise function, 295–296 naming convention, 73 magic field, 325 STL, 549–551 Magic numbers, 324–326 librt library, 433 mailing-list archive (MARC), 134 Lifetime, variable, 52 Mailing lists, 134 LIFO (last in, first out) buffers, 338 Major device numbers, 264–265 Line buffering, 515–516 Major page faults, 289, 447 #line directives, 215 make program and Makefiles, 42, 44–45. Linker errors, 98–100 See also Builds Linking builds, 67–69 conditional constructs, 64–66 lint program, 88–89 dependencies, 214 Linus Elevator algorithm, 282–284 error detection by, 84–86 linux autoindentation style, 171 install stage, 77–78 Linux Documentation Project, 133 minimal, 52–57 listen function, 388, 391 mistakes, 79–82, 84 Listen sockets, 388 rules and dependencies, 45–48 Listing shared objects, 566–567 sources, 66–67 Little Endian byte order, 424, 426 targets, 77–78 Local APIC (LAPIC), 462 user-defined functions, 63–64 Local sockets variables client/server example, 387–392 automatic, 57–58 debugging, 439 defining, 48–49 Locating shared objects, 564–565 in implicit rules, 53–55 Locked memory, 310–315, 339–340 manipulating, 59–63 lockf function, 360, 362 referencing and modifying, 52 Logical block addressing (LBA), 258 white space and newlines in, 50–51 LRU (least recently used) pages, 448 Vim, 166 command, 418 make target, 77 lsof command, 336–337 makeinfo program, 125–126 in debugging, 416–417 makeprg setting, 168 inodes, 441 makewhatis tool, 122 pipes, 437 MALLOC_CHECK_ variable, 573 semaphores, 434 malloc function, 303–304 shared memory, 428 overcommitment by, 309–310 sockets, 438–439 and overflow, 572 lspci tool, 464–467 page table mappings with, 446–447 ltrace command, 434, 484–485 with pointers, 569 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 609

Index 609

MALLOC_TRACE variable, 574 pointers, 569–570 mallopt function, 307 statistics, 574–576 Malware, 17–18 Valgrind tools, 576–581 man pages, 103–105 decrypted passwords in, 343 contents, 111–112 kernel modes, 222 organization, 105–107 for libraries, 71 recommended, 112–114 locked, 310–315, 339–340 searching mapping, 73, 302, 308, 592 with apropos, 107–110 for processes, 303–310 with whatis, 110–111 resident and locked, 339–340 Mandatory locks, 362 usage, 353–354 mandb version, 122 system, 310 —mandir option, 76 in system performance, 446 Mandriva distribution, 14 page faults, 446–448 Mangling, name, 99 swapping, 448–456 MAP_ANONYMOUS flag, 308 text editors, 187–188 map command, Ex mode, 160 virtual. See Virtual memory Maps, memory, 592 vmstat information, 468 anonymous, 73, 302, 308 Memory coherency, 295–296 virtual memory, 329–330 Memory leaks, 570 maps file, in /proc, 345 mtrace for, 573–574 MARC (mailing-list archive), 134 valgrind for, 577–578 Masks Memory Management Unit (MMU), 288–289, affinity, 507–509 581 magic numbers, 325 Memory-related formats, 350 signals, 435 memset function, 533 massif tool, 579–581 memusage function, 574–576 md5sum command, 20–21, 33 memusagestat function, 576 md5sums file, 33 mepis distribution, 14 mebibytes, 114 Merging revision changes, 192–197 mem driver, 258, 261–262, 264 Message queues, IPC, 393 mem file, in /proc, 345 POSIX, 397–402, 432–433 memcheck function, 577 System V, 393–397, 429–430 memcpy function, 112 Meta keys, 171 Memory Metadata, 5 debugging, 569–570 Minibuffer mode, 173 buffer overflows, 571–572 Minimal Makefiles, 52–57 corruption, 578–579 Minor device numbers, 263–264 heap analysis, 579–581 Minor page faults, 289, 447 heap overflow, 581–583 Minus signs (-), vi, 149 leaks, 570, 573–574, 577–578 Missing braces, 93–94 MALLOC_CHECK_, 573 Missing include files, 87 mtrace, 573–574 Missing parentheses, 93 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 610

610 Index

Missing public keys, 24–25 mqueuepseudo file system, 432 Missing tabs, 79–80 MS_INVALIDATE flag, 296 mkfifo function, 382 MS_SYNC flag, 296 mkfs command, 274 msg_receive function, 402 mknod command, 260–261, 382 msgctl function, 394 mkswap command, 298 msgget function, 393–394 mlock function, 310–311 msgrcv function, 396–397 mlockall function, 311 msgsnd function, 394 mmap function msync function, 295–296, 364 devices, 274–275 Multicore CPUs, 505–506 memory coherency, 295–296 Multiprocessor performance, 501 memory fragmentation, 306–308 Frontside Bus, 456–458 pointers, 570 SMP hardware, 501 shared memory, 364 CPU parallelism, 501–504 MMU (Memory Management Unit), 288–289, motherboards, 504–505 581 multicore CPUs, 505–506 Modeless text editors, 170 SMT, 505 Modes SMP programming, 506 Emacs, 170–172 affinity masks, 507–509 vi, 147–148 scheduler, 506–507 Modifying Multitasking process affinity, 508 cooperative, 227 variables, 52 preemptive, 228 modinfo command, 137–138 process. See Process scheduler Modules Multithreaded programs, 557–558 documentation, 137–138 munlock function, 310 kernel, 259–260 munmap function, 364 tool, 190 muntrace function, 574 mostlyclean target, 77 Motherboards, multiprocessor, 504–505 mount command, 276 mounts file, in /proc, 345 N mpg123 program, 17–18 n command, vi, 150 mpstat tool, 473–475 -N flag, diff, 195 mq_close function, 398 Names mq_getattr function, 398 finding processes by, 352–353 mq_notify function, 433 in libraries, 73 mq_open function, 397–398 in man pages, 106 mq_receive function, 399, 402 mangling, 99 mq_send function, 399 package, 28 mq_setattr function, 398–399 sending process signals by, 354–355 mq_unlink function, 398–399 Nano text editor, 181–182 mqueue file system, 433 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 611

Index 611

nasty.c listing, 533 Octal dump command, 425–426 Native POSIX Threads Library (NPTL), 509 command, 425–426 ncurses library, 450 off_t type, 525 NEdit text editor, 184–186 Official package names, 28 netstat command, 438–440 offset field for magic numbers, 325 Network devices, 259 Offsets, memory pages, 288 Network sockets Online help tools, 103–104 client/server example, 392–393 desktop, 120 debugging, 441 info pages, 115–119 Network Time Protocol (NTP) package, 127 man pages. See man pages new-corrupt.cpp listing, 578–579, 581 OOM (out-of-memory) killer, 297, 309 new operator, 572 oom_adj file, in /proc, 345 Newlines oom_score file, in /proc, 345 printf, 515–516 opannotate tool, 496, 499 in variables, 50–51 opcontrol tool, 495–497 Newsgroups, 134 Open files next command, gdb, 531, 558 information for, 593 command, 234–235, 238 IPC debugging, 415–420 command open function for linking, 72 device drivers, 257 for symbols, 99, 567–568 permissions for, 332 Nodes, device, 257, 260–262 Open source tools, 1 major numbers, 264–265 archive files, 4–5 minor numbers, 263–264 extracting, 11 sources, 266–271 identifying, 6–7 Nonvirtual destructors, 95 querying, 7–11 noop scheduler, 282–284 defined, 2 NPTL (Native POSIX Threads Library), 509 distribution formats, 3 NTP (Network Time Protocol) package, 127 finding, 2–3 null device, 262 packages. See Packages Null pointer arguments, 93 significance, 2–3 Number of buffers per session feature, 147 Opening POSIX message queues, 397–398 NVRAM driver, 264 OpenSSH source code, 18 nvram module, 267–268 operator man page, 113 opgprof tool, 496, 498–499 opreport tool, 496, 498 .oprofile file, 496 O OProfile profiler, 494–495 for applications, 497–500 o command, vi, 151 opcontrol tool, 495–497 o modifier, print and x, gdb, 543 remarks, 500–501 objdump command, 559–560, 567–568 oprofiled tool, 496–498 Object files, executable, 324 Opteron CPUs, 504–505 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 612

612 Index

Optimized code, debugging, 558–561 utility, 5 Out-of-memory (OOM) killer, 297, 309 PCI bus, 459, 463–465 Out-of-order steps in optimized code, 559 PCI Express (PCIe) connections, 460–461, Output modifiers, print and x, gdb, 543–544 463 Overcommit, memory, 309–310 PCI-X bus, 463 Overflow PDF (Portable Document Format), 130–131 buffer, 555–556, 571–572 PDF_HYPERLINKS tag, Doxygen, 213 heap, 581–583 pdflatex tool, 125 stack, 338, 555–556 pdflush daemon, 281 Overlays, shared objects for, 562 Percent signs (%) overrun.c listing, 540–541 Ex mode, 159 vi, 149 Performance, 445 P application. See Application performance multiprocessor. See Multiprocessor perform- p command, vi, 155 ance -p option, , 197 printf, 514–515 Packages system. See System performance contents, 27–33 Periods (.) package managers, 12–14 Ex mode, 159 queries, 29–30, 122–123 vi, 154 security for, 17–26 Permissions, 8–10, 332 source and binary, 14–16 permute.cpp listing, 551–552 updating, 33–39 PF_ flags for socket domains, 383 working with, 16–17 command, 352–353 PAE (Physical Address Extension), 302 Physical Address Extension (PAE), 302 Page faults, 289, 446–448 PIC (Programmable Interrupt Controller), Page tables, 289 462–463 Pages in virtual memory. See Virtual memory Pico text editor, 181–182 Parallel bus, 463, 465 PID directory, 344–345 Parallelism, CPU, 501–504 PIDs Parentheses () with gdb, 553 macros, 520 System V memory, 428 missing, 93 System V message queues, 430 Partitions, swap, 297–298 pinfo command, 117 Passwords in memory, 343 pipe function, 381–382 Pasting Pipelines, 502–505 Emacs, 174 Pipes, IPC, 381–382, 437–438 vi, 155–158 pkg-config tool, 567 patch command, 193–197 pkgtool package manager, 13–14 Patching, libraries for, 70 pkill command, 354–355 patsubst function, 60, 62 Plain files for IPC, 358–363 Pattern rules, 55 Plus signs (+), vi, 149 pause function, 242 pmap function, 299–301, 305, 353–354, 592 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 613

Index 613

Pointers tips, 527–528 freeing, 569–570 wrapper functions, 523–525 null arguments, 93 Priorities Polling in IPC, 376 process scheduler pop command, vi, 165 and fairness, 229–233 Popping, stack, 338 and nice, 234–235 port device, 262 real-time, 235–237 Portable Document Format (PDF), 130–131 queued messages, 397 portage package manager, 13–14 /proc directory, 268–269, 344–346 Position-independent code, 563 /proc/cpuinfo file, 477–478 POSIX API /proc/pid/fd directory, 437 IPC debugging, 431–434 Process scheduler, 226 library, 69 blocking, preemption, and yielding in, message queues, 397–402, 432–433 228–229 semaphores, 407–410, 433–434 overview, 226–227 shared memory, 364–367, 431–432 priorities posix-msgq-ex.c listing, 399–402 and fairness, 229–233 posix_sem.c listing, 407–410, 433–434 and nice, 234–235 posix-shm.c listing, 365–367 real-time, 235–237 Postmortem debugging, 554 process states, 239–245 PostScript language, 129–130 real-time processes, 238–239 Pound signs (#) timing, 246–249 Ex mode, 163 applications, 255–256 macros, 520–521 kernel clock tick, 253–255 Preemptable kernels, 229 system time units, 249–253 Preemption in process scheduler, 228–229 Processes, 317–318 Preemptive multitasking, 228 clone, 320 Prefetching, cache, 294 communication between. See Interprocess —prefix option, 75 communication (IPC) Preprocessor macros copy on write, 319–320 debugging, 214–216 environment, 592–593 printf, 519–521 exec, 320–321 print command, gdb, 541–547 executable object files, 324 print_trace function, 588–589 executable scripts, 321–323 printf function, 514 file descriptors, 331–338 buffering finding, 352–353 and file streams, 516–517 footprints, 329–331 and file systems, 517–519 fork and vfork, 318 format warnings, 91–92, 525–526 information for gdb, 541 displaying, 346–348 performance effects, 514–515 formats for, 349–351 preprocessor help, 519–521 sar for, 471–472 remarks, 528–529 vmstat for, 468 synchronization issues, 515–516 limits, 340–343 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 614

614 Index

Processes, continued Pseudotargets, 47–48 memory for, 303–310 pthread_create function, 320, 509 resident and locked, 339–340 pthread_self function, 509 usage, 353–354 pthread_setaffinity_np function, 509 virtual, 298–302 pthread_setschedparam function, 238 miscellaneous binaries, 324–326 Public keys, missing, 24–25 and procfs, 343–346 Pushing, stack, 338 real-time, 238–239 Put commands, vi, 155–158 scheduling. See Process scheduler python autoindentation style, 171 signals for, 354–355 stack for, 338–339 states, 239 Q sleeping vs. running, 240–241 stopped, 243–245 q command, Ex mode, 161 zombies and , 241–243 Quad-core CPUs, 506 synchronizing, 327–329 Quantum, 228, 237 Processor architecture Queries instruction efficiency, 480–484 archive file, 7–11 x86info for, 476–480 package, 29–30, 122–123 procfs file system queryformat option, 30 for debugging, 416, 442, 591–594 Question marks (?) process information provided by, 343–346 Ex mode, 159 vs. sysfs, 268–269 vi, 150 procps package, 346, 349–351 Queues, message, 393 Profiling executables POSIX, 397–402, 432–433 gcov for, 491–494 System V, 393–397, 429–430 gprof for, 488–491 quit command, vi, 160 OProfile for, 494–501 profme.c listing, 488–491 —program-prefix option, 76 R —program-suffix option, 76 -R flag, patch, 195 Programmable Interrupt Controller (PIC), Race conditions, 334, 357 462–463 raise function, 380, 591 Projects in revision control, 191 ramdisk device Protected output, 403 memory for, 310 Protocols, socket, 384–385 vs. tmpfs, 280 ps function, 235, 243 random device, 262 for finding processes, 352–353 rbreak command, gdb, 549 formats, 349–351 RCS (), 190–191 options, 233 Read operations overview, 346–348 blocking, 248–249 for semaphores, 431 character devices, 273 for states, 239–240 POSIX message queues, 399 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 615

Index 615

Readability RISC (Reduced Instruction Set Computer) automatic variables for, 57–58 processors, 501–502 indentation, 204–206 RLIMIT_ flags, 341–342 readelf command, 567–569 rlimit structure, 314, 340–341 README files, 121, 123, 135 rmmod command, 260, 267 Real-time applications, 235–236 root file, in /proc, 345 Real-time priorities, 235–236 Round-robin scheduling, 237 FIFO scheduling, 236–237 RPM (RPM Package Manager) package, 13–14 round-robin scheduling, 237 contents, 28–31 Real-time processes, 238–239 updating, 35–36 Real-time signals, 376–378 rpm utility, 23 Reaping processes, 327 rpm2cpio command, 31 Red Hat distribution rt-sig.c listing, 377–378 package format, 14 Rules, Makefiles, 45–48, 52–57 updating, 37–39 run command, gdb, 531 Reduced Instruction Set Computer (RISC) runex script, 232 processors, 501–502 Running out of process memory, 303–310 Referencing variables, 52 Running processes, 239 regex man page, 114 attaching to, 553 register pseudofile, 325 vs. sleeping, 240–241 Registers rwatch command, gdb, 540 SMT, 505 vi, 157 Regular expressions S man pages, 110 text editors, 145 S command, vi, 153 Removing POSIX message queues, 398–399 s modifier, print and x, gdb, 543 Renaming functions, 99 SA_SIGINFO flag, 379 renice command, 234 sar tool, 469–470 Reordered initializers, 95–96 interrupt activity, 473 Repeated vi commands, 148 I/O information, 472–473 Resident memory, 339–340 process information, 471–472 Restarting execution with gdb, 531–532 remarks, 473–474 breakpoints, 532–537 virtual memory information, 470–471 watchpoints, 537–541 —sbindir, configure, 75 Reviewing revision changes, 193–197 scanf function, 92 Revision control, 189 SCHED_FIFO macro, 238–239 basics, 189–190 sched_getaffinity function, 508 diff and patch, 193–197 SCHED_OTHER macro, 238 RCS, 190–191 SCHED_RR macro, 238 reviewing and merging changes, 193–197 sched_setaffinity function, 508 terms, 191–193 sched_setscheduler function, 238–239 Revision Control System (RCS), 190–191 sched_yield function, 228 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 616

616 Index

Scheduler semop function, 412 I/O, 282–286 semtimedop function, 431 process. See Process scheduler Sending signals to processes, 371 SMP programming, 506–507 server_un.c listing, 388–390 Scheduler-lock feature, 558 set command Scheduler-related process formats, 351 Ex mode, 160 schedutils package, 507 gdb, 547 SciTE text editor, 186–187 set args command, gdb, 530–531 Scons project, 44 set scheduler-lock command, gdb, 558 Scope, make variable, 52 setaffinity functions, 509 Scripts setgid bit, 8–10 executable, 321–323 setrlimit function, 312, 314–315, 339–342 installation, 27–28 Settings typos in, 323 Emacs, 177–178 SCSI devices, 263, 269–271 vi, 166–168 Search and replace feature setuid bit, 8–10 Emacs, 174–175 setvbuf function, 516–517, 519 Ex mode, 163 SGML Document Type Definition, 126 Searching Shared memory, IPC, 363 info pages, 118 POSIX, 364–367, 431–432 man pages System V, 367–370, 426–429 with apropos, 107–110 Shared objects, 561 with whatis, 110–111 creating, 563 Security listing, 566–567 kernel modes for, 222 locating, 564–565 packages, 17–26 security with, 565 shared objects, 565 symbols in, 567–569 SEE ALSO man section, 111 unused, 567 Segmentation violation signal. See SIGSEGV using, 562 (segmentation violation) signal Shell commands select function, 388 debugging. See Debugging self directory, in /proc, 336 Makefiles, 79–80 sem_destroy function, 410 syntax errors, 85–86 sem_init function, 410 shell function, make, 60 sem_open function, 408–410 shiftwidth setting, 167 sem_post function, 407 shm_open function, 364, 366–367, 369 sem_t type, 433 shm_unlink function, 364 sem_unlink function, 409 shmat function, 368 sem_wait function, 406 shmctl function, 368 Semaphores, IPC, 402–407 shmdt function, 368 POSIX, 407–410, 433–434 shmget function, 368–369 System V, 410–412, 430–431 Shortcuts, Emacs, 172–173 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 617

Index 617

SI_ flags used with struct siginfo, 381 SIGSEGV (segmentation violation) signal Side effects, printf, 528–529 core files, 553 side-effects.c listing, 528–529 with Electric Fence, 583 SIGABRT signal, 554, 589 heap overflow, 572 sigaction function, 372–373, 378–381 invalid addresses, 289 sigaddset function, 373 pointers, 569 SIGBUS signal, 554 stack overflow, 338, 342, 571 SIGCHLD signal, 243, 327, 375–376, 378 sigset_t type, 373 SIGCONT signal, 244–245, 591 SIGSTOP signal, 372, 591 sigdelset function, 373 sigsuspend function, 376 SIGFPE signal, 553 SIGTERM signal, 240, 244 sighander_t type, 372 SIGTSTP signal, 244 SIGILL signal, 435, 554 SIGTTIN signal, 244–245 siginfo structure, 380 SIGTTOU signal, 245 SIGINT signal, 436 Single-stepping, 558 sigismember function, 373 64-bit types with printf, 525–526 SIGKILL signal, 244, 372 Size signal system call, 379, 532 container, 550 Signal safe functions, 370 executables, 72 Signals memory pages, 288 for debugging information, 590–591 size method, 550 IPC, 370–371 skill command, 354–355 debugging, 434–437 Slackware distribution, 14 handling, 371–373 Slashes (/) masks for, 373–376 Ex mode, 159 real-time, 376–378 vi, 150 sending, 371 command, 246 sigqueue and sigaction, 378–381 Sleeping process state, 240–241 for processes, 354–355 Slots, device, 463–467 Signatures smaps file, in /proc, 345 authentication with, 21–25 SMP. See Symmetric Multiprocessing System ELF files, 324 (SMP) renaming functions based on, 99 SMT (Symmetric Multithreading), 505 sigpending function, 376 snprintf function, 91 sigprocmask.c listing, 374–376 .so extension, 73 sigprocmask function, 373 SOCK_ socket types, 384 sigqueue function, 378–381 sockaddr structure, 393 SIGQUIT signal, 240 sockaddr_un structure, 391 SIGRTMAX macro, 376 socket system call, 383, 387 SIGRTMIN macro, 376, 378 socketpair.c listing, 385–387 socketpair system call, 385–387 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 618

618 Index

Sockets sshd daemon, 320, 331–332 domains, 383 Stack coloring, 339 IPC, 382 Stacks client/server, 387–393 corruption, 555–556 creating, 383–385 overflow, 338, 342, 571 debugging, 438–440 for processes, 338–339 example, 385–387 tag, 164–166 protocols, 384–385 Stale caches, 295 types, 383 Stalls, pipeline, 503–504 Soft limits, 340 Standard Template Library (STL), 549–551 Soft real-time applications, 236 start command, gdb, 531 son-of-hog.c listing, 451–456 Starved requests, 284 function, make, 62 stat command, 419–420, 442 Source code, 141 stat file, in /proc, 345 analysis States, process, 239 cflow, 207–210 sleeping vs. running, 240–241 compiler for, 214–216 stopped, 243–245 ctags, 210 zombies and Wait, 241–243 beautifiers and browsers, 203–204 Static libraries, 69 astyle, 206–207 Static linking, 71–73 cflow, 207–210 Static priority, 231 compiler, 214–216 Static storage, 338 cscope, 211 statm file, in /proc, 345 ctags, 210 status file, in /proc, 345 Doxygen, 212–213 stdarg.h file, 524 indent code, 204–206 stdout stream, 516 code coverage, 491–494 step command, gdb, 531, 558 editing. See Text editors sticky bit, 8, 11 packages, 14–16 STL (Standard Template Library), 549–551 revision control, 189 Stopped process state, 239, 243–245 basics, 189–190 Stopping execution with gdb, 531–532 diff and patch, 193–197 breakpoints, 532–537 RCS, 190–191 watchpoints, 537–541 reviewing and merging changes, 193–197 strace command terms, 191–193 for program performance, 485–487 VPATH for, 66–67 purpose, 225 SourceForge.net site, 132–133 for signals, 436–437 Spaces in scripts, 323 timing with, 246–248, 360 windows in SciTE, 187 strace package, 132 sprintf function, 91 strftime function, 92 Square brackets ([]), vi, 149 String types ssh-keygen tool, 115 for file data dumps, 422–423 with printf, 526 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 619

Index 619

command, 422–423 sysstat package function, make, 62 iostat and mpstat, 474–475 Stroustrup autoindentation style, 171 sar, 469–474 strptime function, 92 sysstat service, 472–474 stty command, 245 System calls, 223–226 subst function, make, 62 System memory, 310 substitute command, vi, 163 System performance, 445 Substitution references, 59 CPU utilization, 456–459 Subversion tool, 190, 201 devices and interrupts, 459–467 Suffix rules for object code, 54–55 memory issues, 446 suffixes man page, 114 page faults, 446–448 summer-proj.c listing, 492 swapping, 448–456 summer-proj.c.gcov listing, 493–494 sysstat package Superscalar units, 502 iostat and mpstat, 474–475 swapoff command, 297, 452 sar, 469–474 swapon command, 297, 452 virtual-memory status, 467–469 Swapped memory. See Virtual memory System software installation, 18 swapvals function, C++ template example, 548 System time units, 249–253 Switched fabric architectures, 460 System V API Symbols in shared objects, 567–569 IPC debugging, 426–431 Symmetric Multiprocessing System (SMP) message queues, 393–397, 402, 429–430 computers, 295, 457 semaphores, 410–412, 430–431 hardware, 501 shared memory, 367–370, 426–429 CPU parallelism, 501–504 sysv-msgq-example.c listing, 394–396 motherboards, 504–505 sysv_sem.c listing, 410–412 multicore CPUs, 505–506 sysv-shm.c listing, 368–370 programming, 506 affinity masks, 507–509 scheduler, 506–507 Symmetric Multithreading (SMT), 505 T Synaptic tool, 36–37 t command, vi, 156 sync system call, 106, 281 t modifier, print and x, gdb, 543 Synchronization Tab completion, gdb, 537 caches, 296 Tab expansion, vi, 147 inline, 521 Tabs, Makefiles, 79–80 printf issues, 515–516 tabstop setting, 167 processes, 327–329 tag command, vi, 165 Syntax highlighting, 144, 147 Tags, Vim, 164–166 syntax setting, 168 tags command, vi, 165 /sys directory, in /proc, 268–269 Tape archive (tar) files, 4–6, 8, 12 syscall function, 224–225 Targets, make, 77 sysconf function, 249, 254, 337 taskset command, 507 sysfs feature, 268–272 tbreak command, gdb, 531 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 620

620 Index

Templates, C++, 548–549 tmpfs file system Temporary variables, 560 mounting, 367 Terminal-based text editors, 143 vs. ramdisk, 280 tetex-bin package, 125 semaphores, 433 tex command, 126 shared objects, 431 TeX system, 124 tms structure, 250 texi2dvi tool, 126 tnext command, vi, 165–166 Texinfo language, 115, 125–126 top command, 450–456 Text editors, 141 tostop setting, 245 categories, 142–143 tprevious command, vi, 165 clones, 179–182 trace-buffer.c listing, 584–587 default, 143–144 Translation Lookaside Buffer (TLB), 289–291 Emacs. See Emacs text editor troff language, 104, 124, 131 features, 144–146 Trojans, 17–18 GUI, 182–187 tselect command, vi, 165 memory usage, 187–188 Typos in scripts, 323 summary, 188–189 vi. See vi text editor; Vim text editor Text functions, 62–63 Text mode menus, 176–177 U Text substitution patterns, 59 u command, vi, 152, 154 32-bit types with printf, 525–526 u modifier, print and x, gdb, 543 Thrashing, 297, 310–311, 455 Ubuntu distribution Thread Affinity API, 509 GUI-enabled vim package for, 169 Threads man pages in, 107 affinity masks, 509 package format for, 14 gdb for, 557–558 udev package, 128, 266–268 hyperthreading technology, 339 ulimit function, 315, 339, 589 kernel, 281 UML_LOOK tag, 213 timing, 255 Underruns, 583 3G/1G kernel split, 222, 329 Undo feature, 147 Throughput, pipeline, 503 undocumented man page, 123 Ticks, 249, 253–255 Unified L2 cache, 482 time command, 246, 256, 447, 475–476 Uninitialized variables, 94 Time formats, 349–350 Uninstall features, 13 times function, 250–251 uninstall target, 77–78 timespec structure, 226, 251–252 Uninterruptible process state, 239–241 timeval structure, 250–251 units man page, 114 Timing in process scheduler, 246–249 Unnamed semaphores, 409–410 applications, 255–256 Unused shared objects, 567 kernel clock tick, 253–255 Unused variables, 559 system time units, 249–253 up command, gdb, 542 TLB (Translation Lookaside Buffer), 289–291 up2date tool, 34, 37–39 TLDP FAQs, 133 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 621

Index 621

Updating packages, 33–39 Ex mode, 158–161 Upgrading packages, 13 features, 147 urandom device, 262 for info pages, 116–117 uri man page, 114 insert commands, vi, 151–152 url man page, 114 miscellaneous commands, vi, 154 urn man page, 114 modes, vi, 147–148 USE_PDFLATEX tag, Doxygen, 213 settings, 166–168 Usenet, 134 vi users, Emacs for, 178–179 User-defined functions, 63–64 vim-gnome package, 168–169 USER_HZ macro, 254 vim-gtk package, 169 User mode vs. kernel mode, 222–226 Vim text editor, 143, 146, 181–182 User space browsing and building code, 164–166 kernel modes, 222–223, 226 features, 147 memory management. See Memory; Virtual GUI mode, 168–169 memory insert mode, 161–162 vim-X11 package, 168–169 .vimrc file, 166–167 V Viper mode, Emacs, 178 Virtual memory, 286–287 Valgrind tools, 576–577 caches, 291–296 heap analysis, 579–581 coherency, 295–296 instruction efficiency, 480–484 and heap, 308–310 memory corruption, 578–579 map, 329–330 memory leaks, 577–578 MMU for, 288–289 remarks, 580 for processes, 298–302 Variables sar for, 470–471 displaying values of, 542–547 status, 467–469 make program swap space, 296–298 automatic, 57–58 swapping, 448–456 defining, 48–49 TLB, 289–291 in implicit rules, 53–55 Viruses, 17–18 manipulating, 59–63 vmstat command, 278–279, 467–469 referencing and modifying, 52 volatile keyword, 561 white space and newlines in, 50–51 VPATH variable, 66–67, 80–82 in optimized code, 559–560 vprintf function, 524 uninitialized, 94 vsprintf function, 524 Vectors, 549 vfork system call, 318, 320 vfprintf function, 524 vi text editor, 143, 146. See also Vim text editor W change commands, 153 w command command mode, 147–148 Ex mode, 161 cursor movement commands, 149–151 vi, 150 cut, , and delete commands, 155–158 0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 622

622 Index

w suffix, x, gdb, 545 Write through, cache, 294 Wait for zero operation, 412 WUNTRACED flag, 328 wait system call, 241–243, 327–329 www.gnu.org site, 131–132 Wait states, socket, 438 wait3 system call, 327–328 wait4 system call, 327–328 waitpid system call, 327–328, 334 X -Wall option, 89–92 x command Warnings, compiler, 88–89 Ex mode, 161 C, 93–94 gdb, 541–547 C++, 95–98 x modifier, print and x, gdb, 543 format, 91–93, 525–526 x86info tool, 476–480 implicit declarations, 89–91 Xandros distribution, 14 watch command, gdb, 532, 538 xdvi tool, 124 watch watchpoints, gdb, 540 xinetd daemon, 320, 441 watchpoint command, gdb, 537 xit command, Ex mode, 160 Watchpoints, gdb, 537–541 xman tool, 107 wchan file, in /proc, 345 xpdf tool, 130 -Wformat-nonliteral option, gcc, 92 xxd command, 423–424 -Wformat-y2k option, gcc, 92 xxdiff tool, 198, 201–202 whatis command, 110–111, 541, 550 White space, 50–51 whitesmith autoindentation style, 171 Windows text editor compatibility, 146 Y WNOHANG flag, 328–329 word function, make, 63 y command, vi, 155 wordlist function, make, 63 Yank commands, 155–156 words function, make, 63 Yellowdog Updater Modified (yum), 34–36 WordStar text editor, 180 yelp tool, 120 Wrapper functions, 523–525 Yielding in process scheduler, 228–229 wrapscan setting, 167 Write back, cache, 293–294 Write combining, cache, 294 write command, vi, 160 Z write function, 366 zb command, vi, 154 Write operations zero device, 262 blocking, 248–249 Zile text editor, 181–182 character devices, 273 .zip files, 6 CPU, 293–294 Zombie process state, 239, 241–243 Ex, 160 zt command, vi, 154 POSIX message queues, 399 zz command, vi, 154 shared memory, 366