0132198576 Fusco FMptgmedia.pearsoncmg.com/images/9780132198578/index/0132198576… · cscope, 211...
Transcript of 0132198576 Fusco FMptgmedia.pearsoncmg.com/images/9780132198578/index/0132198576… · cscope, 211...
A
a command, vi, 151.a extension, 73a modifier, print and x, gdb, 543ABI (Application Binary Interface)
incompatible, 97–98for system calls, 225
abort function, 589–590accept function, 388, 391Acrobat Reader, 131Add/remove feature in revision control, 191addr2line utility, 588–589Adopted processes, 243Advanced Programmable Interrupt Controller
(APIC), 462–463Advisory locks, 362Affinity masks, 507–509aic79xx module, 137–138alarm function, 237all target, 77Ampersands (&) in Ex mode, 159Analyzing code
cflow for, 207–210compiler for, 214–216ctags for, 210
Anonymous mapping, 73, 302, 308Anticipatory I/O scheduler, 284–285API (Application Programming Interface), 225APIC (Advanced Programmable Interrupt
Controller), 462–463Apostrophes (‘)
Ex mode, 159vi, 149–150
Application Binary Interface (ABI)incompatible, 97–98for system calls, 225
Application performance, 475gcov, 491–494gprof, 488–491instruction efficiency, 480–484ltrace, 484–485OProfile, 494–501processor architecture, 476–480strace, 485–487time, 475–476
Application Programming Interface (API), 225Application timing, 255–256apropos command, 118, 122apt-cache command, 35apt-get command, 35apt-key command, 35apt-setup command, 35Apt tool, 34–35ar files, 5, 12Archive files, 4–5
extracting, 11identifying, 6–7querying, 7–11
as scheduler, 285ascii man page, 113Assembly language
inline, 292in linker process, 68system calls in, 224–225
assert function, 589–590astyle artistic style, 206–207attach command, gdb, 553
Index
597
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 597
598 Index
Attaching running processes, 553__attribute__ directive, 524–525Authentication, 19–21
digital signatures for, 21–25problems in, 25–26
Autocompletion feature, 145Kate, 183vi and Vim, 147, 169
autoconf script, 82Autoindentation
Emacs, 171Vim, 167
automake tool, 77Automatic indenting, 145Automatic storage, 338Automatic variables, 57–58auxv files, 344awatch watchpoints, 540awk script, 322
B
b command, vi, 150b suffix, x, gdb, 545Background processes, 244Backticks (`), 49, 60–61backtrace command, gdb, 542, 555backtrace_symbols function, 588Backtraces, 587–589basename function, make, 60basic.S listing, 224bcopy function, 112Beautifiers and browsers, source code,
203–204astyle, 206–207cflow, 207–210compiler, 214–216cscope, 211ctags, 210Doxygen, 212–213indent code, 204–206
Big Endian byte order, 424, 426
Binaries, miscellaneous, 324–326Binary packages, 14–16Binary semaphores, 403—bindir option, 75binutils package, 569Black box for debugging, 584–587Block devices, 257–258, 274–276Blocked signals, 373Blocking
in process scheduler, 228–229timing with, 248–249
Bookmarks, 175boot man page, 113bootparam man page, 113Braces ({})
matching, 144, 182missing, 93–94variables, 52
Branching in revision control, 192break command, gdb, 531, 558breakpoint command, gdb, 532Breakpoints
conditional, 534–535gdb, 531–532setting, 535–537syntax, 532–534and templates, 548–549
brk system call, 310Browsing and building code
Emacs, 175–176Vim, 164–166
Brute-force man page matching, 110bsd autoindentation style, 171BSD syntax, 435Buffers
Emacs, 173file streams, 516–517file systems, 517–519I/O devices, 276–280overflows, 555–556, 571–572stack, 338text editor, 145trace, 584–587
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 598
Index 599
Builds, 41–42alternative approaches, 43–44background, 42documentation, 135–136errors and warnings, 78
build stage, 83–86compiler errors, 86–88compiler warnings, 88–98configure stage, 82–83linker errors, 98–100Makefile mistakes, 79–82
GNU tools, 43, 74–77imake, 42–43libraries for, 69–73linking, 67–69make program. See make program and
Makefilesprocess, 74
Bus contention, 459–461Bus error (SIGBUS) signal, 554bvi editor, 180, 421–422bzip2 tool, 4
C
C commandEmacs, 173vi, 153
C languagecompiler warnings, 93–94file streams, 516–517preprocessor, 81
C++ languagebreakpoints, 535–537compiler warnings, 95–98STL, 549–551and templates, 548–549
c modifier, print and x, gdb, 543cache-miss.c listing, 478–480Cache misses, 458, 481, 483cachegrind tool, 480–481
CachesCPU, 291–295I/O devices, 276–280memory, 295–296multiprocessor performance, 504
call command, gdb, 547call function, make, 63callgrind tool, 580cb filter, 204cfile command, Vim, 166CFLAGS, 66cflow command, 207–210cfq scheduler, 285–286Change commands, vi, 153Character devices, 257–258, 273–274charsets man page, 113Check in in revision control, 191Check out in revision control, 191–192chrt command, 236–237CISC (Complex Instruction Set Computer)
processors, 501–502Clean blocks, 280clean target, 77Client/server example
local sockets, 387–392network sockets, 392–393
client_un.c listing, 390–392clock function, 249–251clock_getres function, 253clock_gettime function, 251–252CLOCK_ IDs, 252–253clock_t type, 249–251Clock ticks, 249, 253–255CLOCKS_PER_SEC macro, 249clone system call, 320Closing
device drivers, 257POSIX message queues, 398
cmdline file, in /proc, 344, 593cnext command, Vim, 166Code. See Source codeCoherency, memory, 295–296Coloring, stack, 339
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 599
600 Index
Command mode, vi, 147–148Communication, interprocess. See Interprocess
communication (IPC)Compatibility
ABI, 97–98text editor, 146
Compilercode analysis, 214–216errors, 86–88warnings, 88–89
C, 93–94C++, 95–98format, 91–93, 525–526implicit declarations, 89–91
Complete Fair Queuing I/O scheduler (CFQ),285
Complex Instruction Set Computer (CISC)processors, 501–502
Concurrent Version System (CVS), 190–193,201
Conditional breakpoints, 532, 534–535Conditional constructs, 64–66configure.in file, 77configure script
build process, 74–77errors in, 82–83
Conflicts in revision control, 201CONFORMING TO man section, 112Cons project, 44Containers, 549Contention, bus, 459–461continue command, gdb, 532, 558control.tar.gz file, 32Cooperative multitasking, 227Copy on write technique, 319–320Core dumps, 589–591core-file command, gdb, 554Core files, debugging, 553–557coreutils info page, 119Corruption
memory, 578–579stack, 555–556
Counters, semaphore, 402–403cpio files, 5, 8, 11
cpp info page, 119CPPFLAGS variable, 82–83cppsym.c listing, 536cprev command, Vim, 166CPU
cache, 291–295multicore, 505–506multiprocessing, 456–458parallelism, 501–504utilization
affinity masks for, 507–509vs. efficiency, 458–459vmstat for, 469
CPU_ macros, 508cpu_idle function, 458cpu_set_t type, 508–509crazy-malloc.c listing, 303–304crazy-malloc2.c listing, 308–310crazy-malloc3.c listing, 312–315Cross-references
help, 121–122man pages, 111
cscope tool, 211ctags command, 164–166, 210Ctrl key
vi, 151, 154Vim, 161, 165
Cursor movement commandsEmacs, 173vi, 149–151
Cut commandsEmacs, 174vi, 155–158
CVS (Concurrent Version System), 190–193,201
cwd file, in /proc, 344, 593
D
d commandEx mode, 159, 161vi, 155
d modifier, print and x, gdb, 543
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 600
Index 601
-d option, GCC, 214–215data.tar.gz file, 32—datadir option, 75dbgprintf function, 586dd command, 246–247, 475–476deadline scheduler, 284–285Debian distribution
contents, 28–33package format for, 14updating, 34–35
Debugging, 513–514backtraces for, 587–589black box for, 584–587core dumps, 589–591GNU. See gdb debuggerIPC. See Interprocess communication (IPC)memory issues. See Memorypreprocessor macros, 214–216printf for. See printf functionprocfs for, 416, 591–594shared objects. See Shared objectsshell commands, 85–86signals for, 590–591
Declaration warnings, 89–91Decrypted passwords in memory, 343Default editors, 143–144Default shared object locations, 564–565#define directive, 520–521delete command
Ex mode, 160gdb, 532
Delete commandsEmacs, 174vi, 155–158
delete operator, C++, 572Dependencies
compiler, 214make program, 45–48, 79package, 13, 27–28in updates, 38
Deprecated features, 96–97Desktop help tools, 120Destructors, 95
detach command, gdb, 553/dev directory, 9, 241, 260–263devfs, 266Device Independent (DVI) system, 124Devices and device drivers, 257, 272–273
block, 257–258, 274–276buffer cache, 276–280bus contention, 459–461character, 257–258, 273–274file-system, 259file-system cache, 276–281interrupts, 461–462kernel modules, 259–260lspci for, 464–467network, 259nodes, 257, 260–262
major numbers, 264–265minor numbers, 263–264sources, 266–271
PIC vs. APIC, 462–463slots, 463–467
diff command, 193–197diff3 command, 198–201diffstat command, 123Digital signatures
authentication with, 21–25ELF files, 324renaming functions based on, 99
-dir option, 197Direct Memory Access (DMA), 295Dirty blocks, 280Dirty caches, 296display command, gdb, 551–552Displaying
expressions, 551–552variable values, 542–547
distclean target, 77Distribution formats, 3DMA (Direct Memory Access), 295do/while loops, 522–523doc-linux package, 121DocBook format, 126–127, 138docbook-utils package, 126
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 601
602 Index
Document Type Definition (DTD), 126Documentation. See also Help
builds, 135–136code, 212–213cross referencing and indexing, 121–122Emacs commands, 172formats, 124–131
Dollar signs ($), Ex mode, 159Domains, socket, 383down command, gdb, 542Doxyfile file, 212–213Doxygen tool, 212–213dpkg command, 32Drivers. See Devices and device driversDTD (Document Type Definition), 126Dual-core CPUs, 505–506Dumping
core files, 553–557file data, 420–426
DVI (Device Independent) format, 124dvipdf tool, 125Dynamic libraries, 69–73, 561Dynamic linker, 69, 300, 562–565Dynamic priority, 230–231
E
e command, Ex mode, 161-E option, GCC, 214–215echo command, 50ECOFF format, 324edit command, Ex mode, 160Editing source files. See Text editorsEF_ALLOW_MALLOC_0 variable, 582ef, Electric Fence tool, 581EF_PROTECT_BELOW variable, 583Effective scheduler priority, 231Electric Fence tool, 581–583Elevator algorithms, 282–284ELF format, 324ellemtel autoindentation style, 171else clause, 65
.emacs file, 177–178Emacs text editor, 143, 146, 170
browsing and building code, 175–176commands and shortcuts, 172–173cursor movement, 173deleting, cutting, and pasting, 174features, 170GUI mode, 179modes, 170–172search and replace, 174–175settings, 177–178text mode menus, 176–177for vi users, 178–179
environ file, in /proc, 344, 592ENVIRONMENT man section, 111–112error function, 63errorformat setting, 168Errors and warnings, build process, 78
build stage, 83–86compiler errors, 86–88compiler warnings, 88–98configure stage, 82–83linker, 98–100Makefile, 79–82
etags utility, 175etime format, 349evince tool, 124, 130Ex mode, 158–163Exact matching for man pages, 110Exception conditions, 370exe file, in /proc, 345, 593exec function
child processes, 318, 320, 330, 332, 334chrt, 238control transfer, 320–321
Executablesobject files, 324profiling
gcov for, 491–494gprof for, 488–491OProfile for, 494–501
scripts, 321–323Execution parallelism, 502
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 602
Index 603
execve function, 320–326expandtabs setting, 167.exrc file, 166–167Extracting archive files, 11
F
f command, vi, 156f modifier, print and x, gdb, 543factorial.c listing, 555–556FAQs, 133fcntl function, 335FD_CLOEXEC flag, 335fd directory, 336
description, 345for open files, 594for pipes, 437
fdatasync function, 281, 518–519Fedora distribution
GUI-enabled vim package for, 169man pages in, 107package format for, 14
fflush function, 517, 519fg command, 244Fibonacci function, 205Field groups with top, 450FIFO (first in, first out)
pipes, 437–438scheduling, 236–237
file command, 6–7, 418–419, 554File descriptors, 331–336
leaked, 415limits, 337–338lsof command, 336–337
file-ipc-better.c listing, 360–362file-ipc-naive.c listing, 358–360File streams, 516–517File systems
buffering, 517–519caches, 276–280drivers, 259I/O, 274–276
filedat.c listing, 420–422Files
dumping, 420–426locking, 362permissions, 8–10
Filesystem Hierarchy Standard, 121for man pages, 105overview, 113
filter function, 62filter-out function, 62Filters, Synaptic, 37Finding
info pages, 118man pages
with apropos, 107–110with whatis, 110–111
open source tools, 2–3processes, 352–353
findstring function, 62firefox package, 23First in, first out (FIFO)
pipes, 437–438scheduling, 236–237
Fixed scheduler priority, 230flawfinder tool, 571Floating-point error (SIGFPE) signal, 553Floating-point types with printf, 526flock function, 413Flushing caches, 296Folding in Kate text editor, 183Footprint, process, 329–331fopen function, 362Forcing core dumps, 589–591Foreground processes, 244fork-file.c listing, 332–336fork function, 238, 242, 318, 320, 332, 334Forks, timing in, 255Formats
help documentation, 124–131man pages, 105package, 14printf, 91–92, 525–526process information, 349–351
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 603
604 Index
fprintf function, 91Fragmented memory, 305–306frame command, gdb, 542free command, 449, 452–453, 572Frequency, tick, 253–255Frontside bus (FSB), 456–458fsync function, 281, 517–519ftok function, 413ftpd function, 320ftruncate function, 366–367full device, 262funalloc.c listing, 579–580Functions
calling from gdb, 547declarations, 90hook, 178renaming, 99signal safe, 370user-defined, 63–64variable manipulation, 60wrapper, 523–525
fuser command, 417–418
G
G command, vi, 149g suffix, x, gdb, 545GCC. See GNU Compiler Collection (GCC)gcc info page, 119gcc project, 76gcore function, 590gcov tool, 491–494gdb debugger, 529–530
attaching to running process with, 553for core files, 553–557with Electric Fence, 582inspecting and manipulating data with gdb,
541–542C++ STL, 549–551display command, 551–552function calling, 547
print, 542–547templates, 548–549
for multithreaded programs, 557–558for optimized code, 558–561running code with, 530–531stopping and restarting execution with,
531–532breakpoints, 532–537watchpoints, 537–541
Gedit text editor, 184–185GENERATE_ tags, Doxygen, 213Gentoo distribution, 14getprotoent function, 384getrlimit function, 314–315, 340–342getrusage function, 250–251, 255, 328, 342Ghostscript tools, 129–130glibc, 569–570
MALLOC_CHECK_ for, 573memusage, 574–576mtrace, 573–574
glibc-utils package, 574–576gmon.out file, 498–499gnome-help tool, 107, 117, 120gnome-terminal, 176gnometerminal window, 171GNU arch tool, 190gnu autoindentation style, 171GNU Compiler Collection (GCC)
build tools, 43, 74–77C compiler warnings, 93–94C++ compiler warnings, 95–98code analysis, 214debugger. See gdb debuggerGhostscript tools, 129–130heap, 305–307info pages, 115–119
GNU Privacy Guard (GPG), 22–25gprof tool, 488–491, 498–499Graphviz tool, 212groff language tool, 131gs command, 130gstack script, 587
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 604
Index 605
GUI text editors, 143, 182–183Emacs, 179Gedit, 184–185Kate and Kwrite, 183–184NEdit, 184–186SciTE, 186–187vi, 147Vim, 147, 168–169
gvim program, 168gvimdiff tool, 198–199gzip tool, 4, 7
H
h command, vi, 149h suffix, x, gdb, 545Hard limits, 340Hard real-time application, 236Hashes, 19–20HAVE_DOT tag, Doxygen, 213Heap memory
analysis, 579–581libraries for, 305–307overflows, 571–572, 581–583and virtual memory, 308–310
helgrind function, 580hello-sync.c listing, 405hello-unsync.c listing, 403–404Help, 103
cross referencing and indexing, 121–122documentation formats, 124–131Internet information sources, 131–134kernel information, 134–138miscellaneous documentation, 138online tools, 103–104
desktop, 120info pages, 115–119man pages. See man pages
package queries, 122–123/usr/share/doc directory, 121
help command, Ex mode, 161
hexdump command, 424–425hier man page, 113Hints, cache, 294–295hog.c listing, 448Hook functions, 178Hotplug feature, 266–268HOWTO documents, 133HTML for documentation, 127–129htons macro, 392Hyperthreading feature, 339, 505Hypertransport connections, 460HZ macro, 253
I
i command, vi, 151–152i modifier, print and x, gdb, 543IA32 architecture, 92ifdef conditional, 64, 66ifeq conditional, 64–66ifndef conditional, 64ifneq conditional, 64Illegal instruction (SIGILL) signal, 435, 554imake program, 42Implicit declarations, 89–91Implicit Makefile rules, 52–57in_addr structure, 393INADDR_ANY macro, 392Include files, 87Incompatible ABI, 97–98Incremental search mode, 175indent command, 204–206Indentation
code beautifiers, 204–206Emacs, 171
IndexesEmacs, 175help, 121–122Vim, 164–166
info command, gdb, 532, 536, 540, 542, 548,557
0132198576_Fusco_Index.qxd 2/14/07 3:53 PM Page 605
606 Index
info pages, 104, 115recommended, 119searching, 118viewing, 115–118
init function, 242, 317–318, 320Initializers, reordered, C++, 95–96Inline assembly, 292Inline functions, 523, 559Inline synchronization, 521Inodes, 440–442insecure.c listing, 342–343Insert commands, vi, 151–152Insert mode
vi, 147Vim, 161–162
Inspecting and manipulating data, gdbdebugger, 541–542
C++ standard template library, 549–551display command, 551–552function calling, 547print, 542–547templates, 548–549
install target, 77–78Installation scripts, 27–28Instantiation, 548Instructions
efficiency, 480–484latency, 503–504
Interactive processes, 230Internationalization, text editor, 188–189Internet information sources, 131–134Interprocess communication (IPC), 357
debugging, 415dumping file data, 420–426inodes, 440–442open files, 415–420pipes, 437–438POSIX, 431–434signals, 434–437sockets, 438–440System V, 426–431
message queues, 393POSIX, 397–402System V, 393–397
pipes, 381–382plain files, 358–363semaphores, 402–407
POSIX, 407–410System V, 410–412
shared memory, 363POSIX, 364–367System V, 367–370
signals, 370–371handling, 371–373masks for, 373–376real-time, 376–378sending, 371sigqueue and sigaction, 378–381
sockets, 382client/server, 387–393creating, 383–385debugging, 438–440example, 385–387
Interruptible process state, 239Interrupts
device, 461–462sar for, 473
Interrupts per second information, 469Invalidating cache entries, 295I/O
buffering, 517–519devices, 272–273
block devices and file systems, 274–276buffer cache and file-system cache, 276–280character, 273–274
informationsar for, 472–473vmstat for, 468–469
scheduler, 282–286I/O APIC, 462iostat tool, 473–475IPC. See Interprocess communication (IPC)
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 606
Index 607
IPC_PRIVATE macro, 393ipcrm command, 426, 430ipcs command, 370, 426, 428–430IPPROTO_ flags for socket protocols, 385Iterators, C++, 550
J
j command, vi, 149jadetex package, 126java autoindentation style, 171JBellz Trojan, 17–18Jed text editor, 181–182Jiffies, 253Jobs, process, 346Joe text editor, 181–182
K
k command, vi, 149Kate text editor, 183–184Kconfig files, 136kdvi tool, 124Kernel, 221–222
clock ticks, 253–255devices and device drivers. See Devices and
device driversinformation about, 134–138I/O scheduler, 282–286memory management. See Memory; Virtual
memoryprocess scheduler. See Process scheduleruser mode vs. kernel mode, 222–226
Kernel modules, 259–260Kernel space, 222–223, 226Kernel threads, 281Key mapping, vi, 148khelpcenter program, 107, 117–118, 120kill function, 354, 371, 378–380, 531, 591kmem device, 262
kmsg device, 262Knoppix distribution
GUI-enabled vim package for, 169man pages in, 107package format for, 14
.ko extension, 260konqueror tool, 130K&R autoindentation style, 171kswapd thread, 449kvim program, 168–169Kwrite text editor, 183
L
l command, vi, 149L1 cache, 291, 481–482L2 cache, 291–292, 482–483L3 cache, 292Labels in revision control, 192LAPIC (Local APIC), 462Last in, first out (LIFO) buffers, 338Latency
instruction, 503–504scheduling, 235
LaTeX system, 124Lazy TLB flushing, 290LBA (logical block addressing), 258ld command, 67LD_LIBRARY_PATH variable, 564ld info page, 119LD_PRELOAD variable, 564–565, 581–582ldconfig command, 564, 568ldd command, 68–69, 562–563, 566LDFLAGS variable, 82–83ldlinux.so linker, 564Leaks
file descriptors, 415memory, 570
mtrace for, 573–574valgrind for, 577–578
Leaky.c listing, 577–578
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 607
608 Index
Leaning toothpick syndrome, 163Least recently used (LRU) pages, 448less program, 116libc info page, 119—libdir option, 75Libraries
for builds, 69–73for heap, 305–307naming convention, 73STL, 549–551
librt library, 433Lifetime, variable, 52LIFO (last in, first out) buffers, 338Line buffering, 515–516#line directives, 215Linker errors, 98–100Linking builds, 67–69lint program, 88–89Linus Elevator algorithm, 282–284linux autoindentation style, 171Linux Documentation Project, 133listen function, 388, 391Listen sockets, 388Listing shared objects, 566–567Little Endian byte order, 424, 426Local APIC (LAPIC), 462Local sockets
client/server example, 387–392debugging, 439
Locating shared objects, 564–565Locked memory, 310–315, 339–340lockf function, 360, 362Logical block addressing (LBA), 258LRU (least recently used) pages, 448ls command, 418lsof command, 336–337
in debugging, 416–417inodes, 441pipes, 437semaphores, 434shared memory, 428sockets, 438–439
lspci tool, 464–467ltrace command, 434, 484–485
Mm command, vi, 154Macros
debugging, 214–216do/while in, 522–523POSIX scheduling policy, 238printf, 519–521
madvise function, 295–296magic field, 325Magic numbers, 324–326mailing-list archive (MARC), 134Mailing lists, 134Major device numbers, 264–265Major page faults, 289, 447make program and Makefiles, 42, 44–45.
See also Buildsconditional constructs, 64–66dependencies, 214error detection by, 84–86install stage, 77–78minimal, 52–57mistakes, 79–82, 84rules and dependencies, 45–48sources, 66–67targets, 77–78user-defined functions, 63–64variables
automatic, 57–58defining, 48–49in implicit rules, 53–55manipulating, 59–63referencing and modifying, 52white space and newlines in, 50–51
Vim, 166make target, 77makeinfo program, 125–126makeprg setting, 168makewhatis tool, 122MALLOC_CHECK_ variable, 573malloc function, 303–304
overcommitment by, 309–310and overflow, 572page table mappings with, 446–447with pointers, 569
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 608
Index 609
MALLOC_TRACE variable, 574mallopt function, 307Malware, 17–18man pages, 103–105
contents, 111–112organization, 105–107recommended, 112–114searching
with apropos, 107–110with whatis, 110–111
Mandatory locks, 362mandb version, 122—mandir option, 76Mandriva distribution, 14Mangling, name, 99MAP_ANONYMOUS flag, 308map command, Ex mode, 160Maps, memory, 592
anonymous, 73, 302, 308virtual memory, 329–330
maps file, in /proc, 345MARC (mailing-list archive), 134Masks
affinity, 507–509magic numbers, 325signals, 435
massif tool, 579–581md5sum command, 20–21, 33md5sums file, 33mebibytes, 114mem driver, 258, 261–262, 264mem file, in /proc, 345memcheck function, 577memcpy function, 112Memory
debugging, 569–570buffer overflows, 571–572corruption, 578–579heap analysis, 579–581heap overflow, 581–583leaks, 570, 573–574, 577–578MALLOC_CHECK_, 573mtrace, 573–574
pointers, 569–570statistics, 574–576Valgrind tools, 576–581
decrypted passwords in, 343kernel modes, 222for libraries, 71locked, 310–315, 339–340mapping, 73, 302, 308, 592for processes, 303–310
resident and locked, 339–340usage, 353–354
system, 310in system performance, 446
page faults, 446–448swapping, 448–456
text editors, 187–188virtual. See Virtual memoryvmstat information, 468
Memory coherency, 295–296Memory leaks, 570
mtrace for, 573–574valgrind for, 577–578
Memory Management Unit (MMU), 288–289,581
Memory-related ps formats, 350memset function, 533memusage function, 574–576memusagestat function, 576mepis distribution, 14Merging revision changes, 192–197Message queues, IPC, 393
POSIX, 397–402, 432–433System V, 393–397, 429–430
Meta keys, 171Metadata, 5Minibuffer mode, 173Minimal Makefiles, 52–57Minor device numbers, 263–264Minor page faults, 289, 447Minus signs (-), vi, 149Missing braces, 93–94Missing include files, 87Missing parentheses, 93
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 609
610 Index
Missing public keys, 24–25Missing tabs, 79–80mkfifo function, 382mkfs command, 274mknod command, 260–261, 382mkswap command, 298mlock function, 310–311mlockall function, 311mmap function
devices, 274–275memory coherency, 295–296memory fragmentation, 306–308pointers, 570shared memory, 364
MMU (Memory Management Unit), 288–289,581
Modeless text editors, 170Modes
Emacs, 170–172vi, 147–148
Modifyingprocess affinity, 508variables, 52
modinfo command, 137–138Modules
documentation, 137–138kernel, 259–260
monotone tool, 190mostlyclean target, 77Motherboards, multiprocessor, 504–505mount command, 276mounts file, in /proc, 345mpg123 program, 17–18mpstat tool, 473–475mq_close function, 398mq_getattr function, 398mq_notify function, 433mq_open function, 397–398mq_receive function, 399, 402mq_send function, 399mq_setattr function, 398–399mq_unlink function, 398–399mqueue file system, 433
mqueuepseudo file system, 432MS_INVALIDATE flag, 296MS_SYNC flag, 296msg_receive function, 402msgctl function, 394msgget function, 393–394msgrcv function, 396–397msgsnd function, 394msync function, 295–296, 364Multicore CPUs, 505–506Multiprocessor performance, 501
Frontside Bus, 456–458SMP hardware, 501
CPU parallelism, 501–504motherboards, 504–505multicore CPUs, 505–506SMT, 505
SMP programming, 506affinity masks, 507–509scheduler, 506–507
Multitaskingcooperative, 227preemptive, 228process. See Process scheduler
Multithreaded programs, 557–558munlock function, 310munmap function, 364muntrace function, 574
N
n command, vi, 150-N flag, diff, 195Names
finding processes by, 352–353in libraries, 73in man pages, 106mangling, 99package, 28sending process signals by, 354–355
Nano text editor, 181–182
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 610
Index 611
nasty.c listing, 533Native POSIX Threads Library (NPTL), 509ncurses library, 450NEdit text editor, 184–186netstat command, 438–440Network devices, 259Network sockets
client/server example, 392–393debugging, 441
Network Time Protocol (NTP) package, 127new-corrupt.cpp listing, 578–579, 581new operator, 572Newlines
printf, 515–516in variables, 50–51
Newsgroups, 134next command, gdb, 531, 558nice command, 234–235, 238nm command
for linking, 72for symbols, 99, 567–568
Nodes, device, 257, 260–262major numbers, 264–265minor numbers, 263–264sources, 266–271
Nonvirtual destructors, 95noop scheduler, 282–284NPTL (Native POSIX Threads Library), 509NTP (Network Time Protocol) package, 127null device, 262Null pointer arguments, 93Number of buffers per session feature, 147NVRAM driver, 264nvram module, 267–268
O
o command, vi, 151o modifier, print and x, gdb, 543objdump command, 559–560, 567–568Object files, executable, 324
Octal dump command, 425–426od command, 425–426off_t type, 525Official package names, 28offset field for magic numbers, 325Offsets, memory pages, 288Online help tools, 103–104
desktop, 120info pages, 115–119man pages. See man pages
OOM (out-of-memory) killer, 297, 309oom_adj file, in /proc, 345oom_score file, in /proc, 345opannotate tool, 496, 499opcontrol tool, 495–497Open files
information for, 593IPC debugging, 415–420
open functiondevice drivers, 257permissions for, 332
Open source tools, 1archive files, 4–5
extracting, 11identifying, 6–7querying, 7–11
defined, 2distribution formats, 3finding, 2–3packages. See Packagessignificance, 2–3
Opening POSIX message queues, 397–398OpenSSH source code, 18operator man page, 113opgprof tool, 496, 498–499opreport tool, 496, 498.oprofile file, 496OProfile profiler, 494–495
for applications, 497–500opcontrol tool, 495–497remarks, 500–501
oprofiled tool, 496–498Opteron CPUs, 504–505
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 611
612 Index
Optimized code, debugging, 558–561Out-of-memory (OOM) killer, 297, 309Out-of-order steps in optimized code, 559Output modifiers, print and x, gdb, 543–544Overcommit, memory, 309–310Overflow
buffer, 555–556, 571–572heap, 581–583stack, 338, 555–556
Overlays, shared objects for, 562overrun.c listing, 540–541
P
p command, vi, 155-p option, patch, 197Packages
contents, 27–33package managers, 12–14queries, 29–30, 122–123security for, 17–26source and binary, 14–16updating, 33–39working with, 16–17
PAE (Physical Address Extension), 302Page faults, 289, 446–448Page tables, 289Pages in virtual memory. See Virtual memoryParallel bus, 463, 465Parallelism, CPU, 501–504Parentheses ()
macros, 520missing, 93
Partitions, swap, 297–298Passwords in memory, 343Pasting
Emacs, 174vi, 155–158
patch command, 193–197Patching, libraries for, 70patsubst function, 60, 62Pattern rules, 55pause function, 242
pax utility, 5PCI bus, 459, 463–465PCI Express (PCIe) connections, 460–461,
463PCI-X bus, 463PDF (Portable Document Format), 130–131PDF_HYPERLINKS tag, Doxygen, 213pdflatex tool, 125pdflush daemon, 281Percent signs (%)
Ex mode, 159vi, 149
Performance, 445application. See Application performancemultiprocessor. See Multiprocessor perform-
anceprintf, 514–515system. See System performance
Periods (.)Ex mode, 159vi, 154
Permissions, 8–10, 332permute.cpp listing, 551–552PF_ flags for socket domains, 383pgrep command, 352–353Physical Address Extension (PAE), 302PIC (Programmable Interrupt Controller),
462–463Pico text editor, 181–182PID directory, 344–345PIDs
with gdb, 553System V memory, 428System V message queues, 430
pinfo command, 117pipe function, 381–382Pipelines, 502–505Pipes, IPC, 381–382, 437–438pkg-config tool, 567pkgtool package manager, 13–14pkill command, 354–355Plain files for IPC, 358–363Plus signs (+), vi, 149pmap function, 299–301, 305, 353–354, 592
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 612
Index 613
Pointersfreeing, 569–570null arguments, 93
Polling in IPC, 376pop command, vi, 165Popping, stack, 338port device, 262Portable Document Format (PDF), 130–131portage package manager, 13–14Position-independent code, 563POSIX API
IPC debugging, 431–434library, 69message queues, 397–402, 432–433semaphores, 407–410, 433–434shared memory, 364–367, 431–432
posix-msgq-ex.c listing, 399–402posix_sem.c listing, 407–410, 433–434posix-shm.c listing, 365–367Postmortem debugging, 554PostScript language, 129–130Pound signs (#)
Ex mode, 163macros, 520–521
Preemptable kernels, 229Preemption in process scheduler, 228–229Preemptive multitasking, 228Prefetching, cache, 294—prefix option, 75Preprocessor macros
debugging, 214–216printf, 519–521
print command, gdb, 541–547print_trace function, 588–589printf function, 514
bufferingand file streams, 516–517and file systems, 517–519
format warnings, 91–92, 525–526gdb, 541performance effects, 514–515preprocessor help, 519–521remarks, 528–529synchronization issues, 515–516
tips, 527–528wrapper functions, 523–525
Prioritiesprocess scheduler
and fairness, 229–233and nice, 234–235real-time, 235–237
queued messages, 397/proc directory, 268–269, 344–346/proc/cpuinfo file, 477–478/proc/pid/fd directory, 437Process scheduler, 226
blocking, preemption, and yielding in,228–229
overview, 226–227priorities
and fairness, 229–233and nice, 234–235real-time, 235–237
process states, 239–245real-time processes, 238–239timing, 246–249
applications, 255–256kernel clock tick, 253–255system time units, 249–253
Processes, 317–318clone, 320communication between. See Interprocess
communication (IPC)copy on write, 319–320environment, 592–593exec, 320–321executable object files, 324executable scripts, 321–323file descriptors, 331–338finding, 352–353footprints, 329–331fork and vfork, 318information for
displaying, 346–348formats for, 349–351sar for, 471–472vmstat for, 468
limits, 340–343
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 613
614 Index
Processes, continuedmemory for, 303–310
resident and locked, 339–340usage, 353–354virtual, 298–302
miscellaneous binaries, 324–326and procfs, 343–346real-time, 238–239scheduling. See Process schedulersignals for, 354–355stack for, 338–339states, 239
sleeping vs. running, 240–241stopped, 243–245zombies and Wait, 241–243
synchronizing, 327–329Processor architecture
instruction efficiency, 480–484x86info for, 476–480
procfs file systemfor debugging, 416, 442, 591–594process information provided by, 343–346vs. sysfs, 268–269
procps package, 346, 349–351Profiling executables
gcov for, 491–494gprof for, 488–491OProfile for, 494–501
profme.c listing, 488–491—program-prefix option, 76—program-suffix option, 76Programmable Interrupt Controller (PIC),
462–463Projects in revision control, 191Protected output, 403Protocols, socket, 384–385ps function, 235, 243
for finding processes, 352–353formats, 349–351options, 233overview, 346–348for semaphores, 431for states, 239–240
Pseudotargets, 47–48pthread_create function, 320, 509pthread_self function, 509pthread_setaffinity_np function, 509pthread_setschedparam function, 238Public keys, missing, 24–25Pushing, stack, 338Put commands, vi, 155–158python autoindentation style, 171
Q
q command, Ex mode, 161Quad-core CPUs, 506Quantum, 228, 237Queries
archive file, 7–11package, 29–30, 122–123
queryformat option, 30Question marks (?)
Ex mode, 159vi, 150
Queues, message, 393POSIX, 397–402, 432–433System V, 393–397, 429–430
quit command, vi, 160
R
-R flag, patch, 195Race conditions, 334, 357raise function, 380, 591ramdisk device
memory for, 310vs. tmpfs, 280
random device, 262rbreak command, gdb, 549RCS (Revision Control System), 190–191Read operations
blocking, 248–249character devices, 273POSIX message queues, 399
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 614
Index 615
Readabilityautomatic variables for, 57–58indentation, 204–206
readelf command, 567–569README files, 121, 123, 135Real-time applications, 235–236Real-time priorities, 235–236
FIFO scheduling, 236–237round-robin scheduling, 237
Real-time processes, 238–239Real-time signals, 376–378Reaping processes, 327Red Hat distribution
package format, 14updating, 37–39
Reduced Instruction Set Computer (RISC)processors, 501–502
Referencing variables, 52regex man page, 114register pseudofile, 325Registers
SMT, 505vi, 157
Regular expressionsman pages, 110text editors, 145
Removing POSIX message queues, 398–399Renaming functions, 99renice command, 234Reordered initializers, 95–96Repeated vi commands, 148Resident memory, 339–340Restarting execution with gdb, 531–532
breakpoints, 532–537watchpoints, 537–541
Reviewing revision changes, 193–197Revision control, 189
basics, 189–190diff and patch, 193–197RCS, 190–191reviewing and merging changes, 193–197terms, 191–193
Revision Control System (RCS), 190–191
RISC (Reduced Instruction Set Computer)processors, 501–502
RLIMIT_ flags, 341–342rlimit structure, 314, 340–341rmmod command, 260, 267root file, in /proc, 345Round-robin scheduling, 237RPM (RPM Package Manager) package, 13–14
contents, 28–31updating, 35–36
rpm utility, 23rpm2cpio command, 31rt-sig.c listing, 377–378Rules, Makefiles, 45–48, 52–57run command, gdb, 531runex script, 232Running out of process memory, 303–310Running processes, 239
attaching to, 553vs. sleeping, 240–241
rwatch command, gdb, 540
S
S command, vi, 153s modifier, print and x, gdb, 543SA_SIGINFO flag, 379sar tool, 469–470
interrupt activity, 473I/O information, 472–473process information, 471–472remarks, 473–474virtual memory information, 470–471
—sbindir, configure, 75scanf function, 92SCHED_FIFO macro, 238–239sched_getaffinity function, 508SCHED_OTHER macro, 238SCHED_RR macro, 238sched_setaffinity function, 508sched_setscheduler function, 238–239sched_yield function, 228
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 615
616 Index
SchedulerI/O, 282–286process. See Process schedulerSMP programming, 506–507
Scheduler-lock feature, 558Scheduler-related process formats, 351schedutils package, 507SciTE text editor, 186–187Scons project, 44Scope, make variable, 52Scripts
executable, 321–323installation, 27–28typos in, 323
SCSI devices, 263, 269–271Search and replace feature
Emacs, 174–175Ex mode, 163
Searchinginfo pages, 118man pages
with apropos, 107–110with whatis, 110–111
Securitykernel modes for, 222packages, 17–26shared objects, 565
SEE ALSO man section, 111Segmentation violation signal. See SIGSEGV
(segmentation violation) signalselect function, 388self directory, in /proc, 336sem_destroy function, 410sem_init function, 410sem_open function, 408–410sem_post function, 407sem_t type, 433sem_unlink function, 409sem_wait function, 406Semaphores, IPC, 402–407
POSIX, 407–410, 433–434System V, 410–412, 430–431
semop function, 412semtimedop function, 431Sending signals to processes, 371server_un.c listing, 388–390set command
Ex mode, 160gdb, 547
set args command, gdb, 530–531set scheduler-lock command, gdb, 558setaffinity functions, 509setgid bit, 8–10setrlimit function, 312, 314–315, 339–342Settings
Emacs, 177–178vi, 166–168
setuid bit, 8–10setvbuf function, 516–517, 519SGML Document Type Definition, 126Shared memory, IPC, 363
POSIX, 364–367, 431–432System V, 367–370, 426–429
Shared objects, 561creating, 563listing, 566–567locating, 564–565security with, 565symbols in, 567–569unused, 567using, 562
Shell commandsdebugging. See DebuggingMakefiles, 79–80syntax errors, 85–86
shell function, make, 60shiftwidth setting, 167shm_open function, 364, 366–367, 369shm_unlink function, 364shmat function, 368shmctl function, 368shmdt function, 368shmget function, 368–369Shortcuts, Emacs, 172–173
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 616
Index 617
SI_ flags used with struct siginfo, 381Side effects, printf, 528–529side-effects.c listing, 528–529SIGABRT signal, 554, 589sigaction function, 372–373, 378–381sigaddset function, 373SIGBUS signal, 554SIGCHLD signal, 243, 327, 375–376, 378SIGCONT signal, 244–245, 591sigdelset function, 373SIGFPE signal, 553sighander_t type, 372SIGILL signal, 435, 554siginfo structure, 380SIGINT signal, 436sigismember function, 373SIGKILL signal, 244, 372signal system call, 379, 532Signal safe functions, 370Signals
for debugging information, 590–591IPC, 370–371
debugging, 434–437handling, 371–373masks for, 373–376real-time, 376–378sending, 371sigqueue and sigaction, 378–381
for processes, 354–355Signatures
authentication with, 21–25ELF files, 324renaming functions based on, 99
sigpending function, 376sigprocmask.c listing, 374–376sigprocmask function, 373sigqueue function, 378–381SIGQUIT signal, 240SIGRTMAX macro, 376SIGRTMIN macro, 376, 378
SIGSEGV (segmentation violation) signalcore files, 553with Electric Fence, 583heap overflow, 572invalid addresses, 289pointers, 569stack overflow, 338, 342, 571
sigset_t type, 373SIGSTOP signal, 372, 591sigsuspend function, 376SIGTERM signal, 240, 244SIGTSTP signal, 244SIGTTIN signal, 244–245SIGTTOU signal, 245Single-stepping, 55864-bit types with printf, 525–526Size
container, 550executables, 72memory pages, 288
size method, 550skill command, 354–355Slackware distribution, 14Slashes (/)
Ex mode, 159vi, 150
sleep command, 246Sleeping process state, 240–241Slots, device, 463–467smaps file, in /proc, 345SMP. See Symmetric Multiprocessing System
(SMP) computersSMT (Symmetric Multithreading), 505snprintf function, 91.so extension, 73SOCK_ socket types, 384sockaddr structure, 393sockaddr_un structure, 391socket system call, 383, 387socketpair.c listing, 385–387socketpair system call, 385–387
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 617
618 Index
Socketsdomains, 383IPC, 382
client/server, 387–393creating, 383–385debugging, 438–440example, 385–387
protocols, 384–385types, 383
Soft limits, 340Soft real-time applications, 236son-of-hog.c listing, 451–456sort function, make, 62Source code, 141
analysiscflow, 207–210compiler for, 214–216ctags, 210
beautifiers and browsers, 203–204astyle, 206–207cflow, 207–210compiler, 214–216cscope, 211ctags, 210Doxygen, 212–213indent code, 204–206
code coverage, 491–494editing. See Text editorspackages, 14–16revision control, 189
basics, 189–190diff and patch, 193–197RCS, 190–191reviewing and merging changes, 193–197terms, 191–193
VPATH for, 66–67SourceForge.net site, 132–133Spaces in scripts, 323Split windows in SciTE, 187sprintf function, 91Square brackets ([]), vi, 149ssh-keygen tool, 115
sshd daemon, 320, 331–332Stack coloring, 339Stacks
corruption, 555–556overflow, 338, 342, 571for processes, 338–339tag, 164–166
Stale caches, 295Stalls, pipeline, 503–504Standard Template Library (STL), 549–551start command, gdb, 531Starved requests, 284stat command, 419–420, 442stat file, in /proc, 345States, process, 239
sleeping vs. running, 240–241stopped, 243–245zombies and Wait, 241–243
Static libraries, 69Static linking, 71–73Static priority, 231Static storage, 338statm file, in /proc, 345status file, in /proc, 345stdarg.h file, 524stdout stream, 516step command, gdb, 531, 558sticky bit, 8, 11STL (Standard Template Library), 549–551Stopped process state, 239, 243–245Stopping execution with gdb, 531–532
breakpoints, 532–537watchpoints, 537–541
strace commandfor program performance, 485–487purpose, 225for signals, 436–437timing with, 246–248, 360
strace package, 132strftime function, 92String types
for file data dumps, 422–423with printf, 526
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 618
Index 619
strings command, 422–423strip function, make, 62Stroustrup autoindentation style, 171strptime function, 92stty command, 245subst function, make, 62substitute command, vi, 163Substitution references, 59Subversion tool, 190, 201Suffix rules for object code, 54–55suffixes man page, 114summer-proj.c listing, 492summer-proj.c.gcov listing, 493–494Superscalar units, 502swapoff command, 297, 452swapon command, 297, 452Swapped memory. See Virtual memoryswapvals function, C++ template example, 548Switched fabric architectures, 460Symbols in shared objects, 567–569Symmetric Multiprocessing System (SMP)
computers, 295, 457hardware, 501
CPU parallelism, 501–504motherboards, 504–505multicore CPUs, 505–506
programming, 506affinity masks, 507–509scheduler, 506–507
Symmetric Multithreading (SMT), 505Synaptic tool, 36–37sync system call, 106, 281Synchronization
caches, 296inline, 521printf issues, 515–516processes, 327–329
Syntax highlighting, 144, 147syntax setting, 168/sys directory, in /proc, 268–269syscall function, 224–225sysconf function, 249, 254, 337sysfs feature, 268–272
sysstat packageiostat and mpstat, 474–475sar, 469–474
sysstat service, 472–474System calls, 223–226System memory, 310System performance, 445
CPU utilization, 456–459devices and interrupts, 459–467memory issues, 446
page faults, 446–448swapping, 448–456
sysstat packageiostat and mpstat, 474–475sar, 469–474
virtual-memory status, 467–469System software installation, 18System time units, 249–253System V API
IPC debugging, 426–431message queues, 393–397, 402, 429–430semaphores, 410–412, 430–431shared memory, 367–370, 426–429
sysv-msgq-example.c listing, 394–396sysv_sem.c listing, 410–412sysv-shm.c listing, 368–370
T
t command, vi, 156t modifier, print and x, gdb, 543Tab completion, gdb, 537Tab expansion, vi, 147Tabs, Makefiles, 79–80tabstop setting, 167tag command, vi, 165Tags, Vim, 164–166tags command, vi, 165Tape archive (tar) files, 4–6, 8, 12Targets, make, 77taskset command, 507tbreak command, gdb, 531
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 619
620 Index
Templates, C++, 548–549Temporary variables, 560Terminal-based text editors, 143tetex-bin package, 125tex command, 126TeX system, 124texi2dvi tool, 126Texinfo language, 115, 125–126Text editors, 141
categories, 142–143clones, 179–182default, 143–144Emacs. See Emacs text editorfeatures, 144–146GUI, 182–187memory usage, 187–188summary, 188–189vi. See vi text editor; Vim text editor
Text functions, 62–63Text mode menus, 176–177Text substitution patterns, 5932-bit types with printf, 525–526Thrashing, 297, 310–311, 455Thread Affinity API, 509Threads
affinity masks, 509gdb for, 557–558hyperthreading technology, 339kernel, 281timing, 255
3G/1G kernel split, 222, 329Throughput, pipeline, 503Ticks, 249, 253–255time command, 246, 256, 447, 475–476Time formats, 349–350times function, 250–251timespec structure, 226, 251–252timeval structure, 250–251Timing in process scheduler, 246–249
applications, 255–256kernel clock tick, 253–255system time units, 249–253
TLB (Translation Lookaside Buffer), 289–291TLDP FAQs, 133
tmpfs file systemmounting, 367vs. ramdisk, 280semaphores, 433shared objects, 431
tms structure, 250tnext command, vi, 165–166top command, 450–456tostop setting, 245tprevious command, vi, 165trace-buffer.c listing, 584–587Translation Lookaside Buffer (TLB), 289–291troff language, 104, 124, 131Trojans, 17–18tselect command, vi, 165Typos in scripts, 323
U
u command, vi, 152, 154u modifier, print and x, gdb, 543Ubuntu distribution
GUI-enabled vim package for, 169man pages in, 107package format for, 14
udev package, 128, 266–268ulimit function, 315, 339, 589UML_LOOK tag, 213Underruns, 583Undo feature, 147undocumented man page, 123Unified L2 cache, 482Uninitialized variables, 94Uninstall features, 13uninstall target, 77–78Uninterruptible process state, 239–241units man page, 114Unnamed semaphores, 409–410Unused shared objects, 567Unused variables, 559up command, gdb, 542up2date tool, 34, 37–39
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 620
Index 621
Updating packages, 33–39Upgrading packages, 13urandom device, 262uri man page, 114url man page, 114urn man page, 114USE_PDFLATEX tag, Doxygen, 213Usenet, 134User-defined functions, 63–64USER_HZ macro, 254User mode vs. kernel mode, 222–226User space
kernel modes, 222–223, 226memory management. See Memory; Virtual
memory
V
Valgrind tools, 576–577heap analysis, 579–581instruction efficiency, 480–484memory corruption, 578–579memory leaks, 577–578remarks, 580
Variablesdisplaying values of, 542–547make program
automatic, 57–58defining, 48–49in implicit rules, 53–55manipulating, 59–63referencing and modifying, 52white space and newlines in, 50–51
in optimized code, 559–560uninitialized, 94
Vectors, 549vfork system call, 318, 320vfprintf function, 524vi text editor, 143, 146. See also Vim text editor
change commands, 153command mode, 147–148cursor movement commands, 149–151cut, paste, and delete commands, 155–158
Ex mode, 158–161features, 147for info pages, 116–117insert commands, vi, 151–152miscellaneous commands, vi, 154modes, vi, 147–148settings, 166–168
vi users, Emacs for, 178–179vim-gnome package, 168–169vim-gtk package, 169Vim text editor, 143, 146, 181–182
browsing and building code, 164–166features, 147GUI mode, 168–169insert mode, 161–162
vim-X11 package, 168–169.vimrc file, 166–167Viper mode, Emacs, 178Virtual memory, 286–287
caches, 291–296coherency, 295–296and heap, 308–310map, 329–330MMU for, 288–289for processes, 298–302sar for, 470–471status, 467–469swap space, 296–298swapping, 448–456TLB, 289–291
Viruses, 17–18vmstat command, 278–279, 467–469volatile keyword, 561VPATH variable, 66–67, 80–82vprintf function, 524vsprintf function, 524
W
w commandEx mode, 161vi, 150
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 621
622 Index
w suffix, x, gdb, 545Wait for zero operation, 412wait system call, 241–243, 327–329Wait states, socket, 438wait3 system call, 327–328wait4 system call, 327–328waitpid system call, 327–328, 334-Wall option, 89–92Warnings, compiler, 88–89
C, 93–94C++, 95–98format, 91–93, 525–526implicit declarations, 89–91
watch command, gdb, 532, 538watch watchpoints, gdb, 540watchpoint command, gdb, 537Watchpoints, gdb, 537–541wchan file, in /proc, 345-Wformat-nonliteral option, gcc, 92-Wformat-y2k option, gcc, 92whatis command, 110–111, 541, 550White space, 50–51whitesmith autoindentation style, 171Windows text editor compatibility, 146WNOHANG flag, 328–329word function, make, 63wordlist function, make, 63words function, make, 63WordStar text editor, 180Wrapper functions, 523–525wrapscan setting, 167Write back, cache, 293–294Write combining, cache, 294write command, vi, 160write function, 366Write operations
blocking, 248–249character devices, 273CPU, 293–294Ex, 160POSIX message queues, 399shared memory, 366
Write through, cache, 294WUNTRACED flag, 328www.gnu.org site, 131–132
X
x commandEx mode, 161gdb, 541–547
x modifier, print and x, gdb, 543x86info tool, 476–480Xandros distribution, 14xdvi tool, 124xinetd daemon, 320, 441xit command, Ex mode, 160xman tool, 107xpdf tool, 130xxd command, 423–424xxdiff tool, 198, 201–202
Y
y command, vi, 155Yank commands, 155–156Yellowdog Updater Modified (yum), 34–36yelp tool, 120Yielding in process scheduler, 228–229
Z
zb command, vi, 154zero device, 262Zile text editor, 181–182.zip files, 6Zombie process state, 239, 241–243zt command, vi, 154zz command, vi, 154
0132198576_Fusco_Index.qxd 2/13/07 4:03 PM Page 622