Muutke küpsiste eelistusi

Mac OS X Internals: A Systems Approach (paperback) [Pehme köide]

  • Formaat: Paperback / softback, 1680 pages, kõrgus x laius x paksus: 241x178x74 mm, kaal: 2280 g
  • Ilmumisaeg: 15-Feb-2016
  • Kirjastus: Addison Wesley
  • ISBN-10: 0134426541
  • ISBN-13: 9780134426549
Teised raamatud teemal:
  • Formaat: Paperback / softback, 1680 pages, kõrgus x laius x paksus: 241x178x74 mm, kaal: 2280 g
  • Ilmumisaeg: 15-Feb-2016
  • Kirjastus: Addison Wesley
  • ISBN-10: 0134426541
  • ISBN-13: 9780134426549
Teised raamatud teemal:
Mac OS X was released in March 2001, but many components, such as Mach and BSD, are considerably older. Understanding the design, implementation, and workings of Mac OS X requires examination of several technologies that differ in their age, origins, philosophies, and roles.

Mac OS X Internals: A Systems Approach is the first book that dissects the internals of the system, presenting a detailed picture that grows incrementally as you read. For example, you will learn the roles of the firmware, the bootloader, the Mach and BSD kernel components (including the process, virtual memory, IPC, and file system layers), the object-oriented I/O Kit driver framework, user libraries, and other core pieces of software. You will learn how these pieces connect and work internally, where they originated, and how they evolved. The book also covers several key areas of the Intel-based Macintosh computers.

A solid understanding of system internals is immensely useful in design, development, and debugging for programmers of various skill levels. System programmers can use the book as a reference and to construct a better picture of how the core system works. Application programmers can gain a deeper understanding of how their applications interact with the system. System administrators and power users can use the book to harness the power of the rich environment offered by Mac OS X. Finally, members of the Windows, Linux, BSD, and other Unix communities will find the book valuable in comparing and contrasting Mac OS X with their respective systems.

Mac OS X Internals focuses on the technical aspects of OS X and is so full of extremely useful information and programming examples that it will definitely become a mandatory tool for every Mac OS X programmer.

Note - this paperback edition is a two-volume set and contains all the content from the original single-volume hardcover publication.

Arvustused

 "Overall, I recommend this book to anyone that wants a deeper understanding of the internals of the Macintosh. If you are a developer, this is a must-have book."--Justin Williams, Founder, Maczealots.com

 

"It's a book that every administrator and developer of almost any kind of hardware and software would want to own. It explains the how as opposed to the what of OS X more clearly, thoroughly and intelligently than any other book on the market."--Mark Sealey, Contributing Editor, ThinkSecret.com

Volume 1
Preface
xxv
Acknowledgments
xxxi
About the Author
xxxiii
Chapter 1 Origins of Mac OS X
1(42)
1.1 Apple's Quest for the Operating System
2(7)
1.1.1 Star Trek
3(1)
1.1.2 Raptor
4(1)
1.1.3 NuKernel
4(1)
1.1.4 TaIOS
4(1)
1.1.5 Copland
5(1)
1.1.6 Gershwin
6(1)
1.1.7 BeOS
7(2)
1.1.8 Plan A
9(1)
1.2 The NeXT
Chapter
9(6)
1.2.1 NEXTSTEP
10(3)
1.2.2 OPENSTEP
13(2)
1.3 The Mach Factor
15(9)
1.3.1 Rochester's Intelligent Gateway
16(1)
1.3.2 Accent
17(1)
1.3.3 Mach
18(5)
1.3.4 MkLinux
23(1)
1.3.5 Musical Names
24(1)
1.4 Strategies
24(7)
1.4.1 Mac OS 8 and 9
25(2)
1.4.2 Rhapsody
27(4)
1.5 Toward Mac OS X
31(12)
1.5.1 Mac OS X Server 1.x
31(1)
1.5.2 Mac OS X Developer Previews
31(3)
1.5.3 Mac OS X Public Beta
34(2)
1.5.4 Mac OS X 10.x
36(7)
Chapter 2 An Overview of Mac OS X
43(112)
2.1 Firmware
46(1)
2.2 Bootloader
46(1)
2.3 Darwin
46(2)
2.3.1 Darwin Packages
47(1)
2.3.2 The Benefits of Darwin
47(1)
2.3.3 Darwin and Mac OS X
48(1)
2.4 The xnu Kernel
48(9)
2.4.1 Mach
49(1)
2.4.2 BSD
50(3)
2.4.3 The I/O Kit
53(1)
2.4.4 The libkern Library
54(1)
2.4.5 The libsa Library
55(1)
2.4.6 The Platform Expert
56(1)
2.4.7 Kernel Extensions
57(1)
2.5 A User-Space View of the File System
57(4)
2.5.1 File System Domains
57(2)
2.5.2 The /system/Library/ Directory
59(2)
2.6 The Runtime Architecture
61(13)
2.6.1 Mach-O Files
62(4)
2.6.2 Fat Binaries
66(1)
2.6.3 Linking
67(7)
2.7 The C Library
74(2)
2.8 Bundles and Frameworks
76(13)
2.8.1 Bundles
76(5)
2.8.2 Property List Files
81(1)
2.8.3 Frameworks
82(4)
2.8.4 Prebinding
86(3)
2.9 Core Services
89(1)
2.10 Application Services
90(11)
2.10.1 Graphics and Multimedia Services
91(10)
2.10.2 Other Application Services
101(1)
2.11 Application Environments
101(16)
2.11.1 BSD
102(1)
2.11.2 The X Window System
103(1)
2.11.3 Carbon
103(4)
2.11.4 Cocoa
107(6)
2.11.5 WebObjects
113(1)
2.11.6 Java
113(1)
2.11.7 QuickTime
114(1)
2.11.8 Classic
114(2)
2.11.9 Rosetta
116(1)
2.12 User Interface
117(4)
2.12.1 Visual Effects
118(1)
2.12.2 Resolution-Independent User Interface
118(1)
2.12.3 Productivity Features
119(1)
2.12.4 Universal Access Support
120(1)
2.13 Programming
121(10)
2.13.1 Xcode
122(2)
2.13.2 Compilers and Libraries
124(1)
2.13.3 Interpreters
125(4)
2.13.4 Tools
129(2)
2.14 Security
131(14)
2.14.1 Kernel-Space Security
133(1)
2.14.2 User-Space Security
134(5)
2.14.3 System Administration
139(4)
2.14.4 The Auditing System
143(2)
2.15 Mac OS X Server
145(8)
2.15.1 Xgrid
146(4)
2.15.2 Xsan
150(3)
2.16 Networking
153(2)
Chapter 3 Inside an Apple
155(108)
3.1 The Power Mac G5
156(10)
3.1.1 The U3H System Controller
157(2)
3.1.2 The K2 I/O Device Controller
159(1)
3.1.3 PCI-X and PCI Express
159(3)
3.1.4 HyperTransport
162(2)
3.1.5 Elastic I/O Interconnect
164(2)
3.2 The G5: Lineage and Roadmap
166(8)
3.2.1 Fundamental Aspects of the G5
167(2)
3.2.2 New POWER Generations
169(2)
3.2.3 The PowerPC 970, 970FX, and 970MP
171(2)
3.2.4 The Intel Core Duo
173(1)
3.3 The PowerPC 970FX
174(50)
3.3.1 At a Glance
174(1)
3.3.2 Caches
175(6)
3.3.3 Memory Management Unit (MMU)
181(4)
3.3.4 Miscellaneous Internal Buffers and Queues
185(1)
3.3.5 Prefetching
186(2)
3.3.6 Registers
188(6)
3.3.7 Rename Registers
194(3)
3.3.8 Instruction Set
197(5)
3.3.9 The 970FX Core
202(10)
3.3.10 AltiVec
212(7)
3.3.11 Power Management
219(3)
3.3.12 64-bit Architecture
222(2)
3.3.13 Softpatch Facility
224(1)
3.4 Software Conventions
224(16)
3.4.1 Byte Ordering
225(1)
3.4.2 Register Usage
226(4)
3.4.3 Stack Usage
230(8)
3.4.4 Function Parameters and Return Values
238(2)
3.5 Examples
240(23)
3.5.1 A Recursive Factorial Function
241(3)
3.5.2 An Atomic Compare-and-Store Function
244(2)
3.5.3 Function Rerouting
246(10)
3.5.4 Cycle-Accurate Simulation of the 970FX
256(7)
Chapter 4 The Firmware and the Bootloader
263(118)
4.1 Introduction
263(3)
4.1.1 Varieties of Firmware
264(1)
4.1.2 Preferential Storage
265(1)
4.2 A Whole New World
266(5)
4.2.1 "New" Is Good News
268(1)
4.2.2 Modern Boot ROM (PowerPC)
269(2)
4.3 Power-On Reset
271(1)
4.4 Open Firmware
272(7)
4.4.1 Interacting with Open Firmware
274(4)
4.4.2 Open Firmware Emulators
278(1)
4.5 Forth
279(10)
4.5.1 Cells
279(1)
4.5.2 Stacks
279(2)
4.5.3 Words
281(1)
4.5.4 Dictionary
282(6)
4.5.5 Debugging
288(1)
4.6 The Device Tree
289(9)
4.6.1 Properties
292(4)
4.6.2 Methods
296(1)
4.6.3 Data
297(1)
4.7 Open Firmware Interfaces
298(2)
4.7.1 The User Interface
299(1)
4.7.2 The Client Interface
299(1)
4.7.3 The Device Interface
300(1)
4.8 Programming Examples
300(24)
4.8.1 Dumping NVRAM Contents
300(1)
4.8.2 Determining Screen Dimensions
301(1)
4.8.3 Working with Colors
302(1)
4.8.4 Drawing a Color-Filled Rectangle
303(1)
4.8.5 Creating an Animated Solution to the "Towers of Hanoi" Problem
303(11)
4.8.6 Fabricating and Using a Mouse Pointer
314(3)
4.8.7 Stealing a Font
317(3)
4.8.8 Implementing a Clock
320(2)
4.8.9 Drawing Images
322(1)
4.8.10 Creating Windows
323(1)
4.9 Firmware Boot Sequence
324(4)
4.9.1 The Script
326(1)
4.9.2 Snag Keys
327(1)
4.10 BootX
328(12)
4.10.1 File Format
328(2)
4.10.2 Structure
330(1)
4.10.3 Operation
331(9)
4.11 Alternate Booting Scenarios
340(9)
4.11.1 Booting an Alternate Kernel
341(3)
4.11.2 Booting from a Software RAID Device
344(2)
4.11.3 Booting over a Network
346(3)
4.12 Firmware Security
349(3)
4.12.1 Managing Firmware Security
349(3)
4.12.2 Recovering the Open Firmware Password
352(1)
4.13 Launching the Kernel
352(1)
4.14 The BootCache Optimization
353(2)
4.15 Boot-Time Kernel Arguments
355(7)
4.16 The Extensible Firmware Interface
362(19)
4.16.1 Legacy Pains
362(3)
4.16.2 A New Beginning
365(1)
4.16.3 EFI
366(3)
4.16.4 A Sampling of EFI
369(9)
4.16.5 The Benefits of EFI
378(3)
Chapter 5 Kernel and User-Level Startup
381(120)
5.1 Arranging for the Kernel to Execute
382(6)
5.1.1 Exceptions and Exception Vectors
383(2)
5.1.2 Kernel Symbols
385(2)
5.1.3 Run Kernel Run
387(1)
5.2 Low-Level Processor Initialization
388(17)
5.2.1 Per-Processor Data
390(2)
5.2.2 Reset Types
392(3)
5.2.3 Processor Types
395(3)
5.2.4 Memory Patching
398(2)
5.2.5 Processor-Specific Initialization
400(1)
5.2.6 Other Early Initialization
401(4)
5.3 High-Level Processor Initialization
405(16)
5.3.1 Before Virtual Memory
407(2)
5.3.2 Low-Level Virtual Memory Initialization
409(6)
5.3.3 After Virtual Memory
415(6)
5.4 Mach Subsystem Initialization
421(11)
5.4.1 Scheduler Initialization
421(2)
5.4.2 High-Level Virtual Memory Subsystem Initialization
423(6)
5.4.3 IPC Initialization
429(1)
5.4.4 Finishing VM and IPC Initialization
430(1)
5.4.5 Initializing Miscellaneous Subsystems
430(1)
5.4.6 Tasks and Threads
431(1)
5.4.7 Launching the Kernel Bootstrap Thread
431(1)
5.5 The First Thread
432(3)
5.6 I/O Kit Initialization
435(8)
5.7 BSD Initialization
443(26)
5.7.1 Miscellaneous BSD Initialization (Part 1)
445(2)
5.7.2 File System Initialization
447(1)
5.7.3 Miscellaneous BSD Initialization (Part 2)
448(2)
5.7.4 Networking Subsystem Initialization
450(3)
5.7.5 Miscellaneous BSD Initialization (Part 3)
453(2)
5.7.6 Mounting the Root File System
455(9)
5.7.7 Creating Process
464(2)
5.7.8 Shared Memory Regions
466(3)
5.8 Launching the First User-Space Program
469(1)
5.9 Slave Processors
470(2)
5.10 User-Level Startup
472(29)
5.10.1 Launchd
472(13)
5.10.2 Multiuser Startup
485(10)
5.10.3 Single-User Startup
495(1)
5.10.4 Installation Startup
496(5)
Chapter 6 The xnu Kernel
501(182)
6.1 xnu Source
501(9)
6.2 Mach
510(9)
6.2.1 Kernel Fundamentals
511(7)
6.2.2 Exception Handling
518(1)
6.3 A Flavor of the Mach APIs
519(10)
6.3.1 Displaying Host Information
519(3)
6.3.2 Accessing the Kernel's Clock Services
522(2)
6.3.3 Using a Clock Service to Ring an Alarm
524(2)
6.3.4 Displaying Host Statistics
526(3)
6.4 Entering the Kernel
529(14)
6.4.1 Types of Control Transfer
531(2)
6.4.2 Implementing System Entry Mechanisms
533(10)
6.5 Exception Processing
543(10)
6.5.1 Hardware Interrupts
549(2)
6.5.2 Miscellaneous Traps
551(2)
6.5.3 System Calls
553(1)
6.6 System Call Processing
553(4)
6.7 System Call Categories
557(44)
6.7.1 BSD System Calls
557(19)
6.7.2 Mach Traps
576(8)
6.7.3 I/O Kit Traps
584(1)
6.7.4 PowerPC-Only System Calls
584(3)
6.7.5 Ultra-Fast Traps
587(7)
6.7.6 The Commpage
594(7)
6.8 Kernel Support for Debugging, Diagnostics, and Tracing
601(58)
6.8.1 GDB (Network-Based or FireWire-Based Debugging)
601(2)
6.8.2 KDB (Serial-Line-Based Debugging)
603(1)
6.8.3 CHUD Support
604(8)
6.8.4 Kernel Profiling (kgmon and gprof)
612(5)
6.8.5 Per-Process Kernel Tracing (ktrace (2) and kdump)
617(2)
6.8.6 Auditing Support
619(6)
6.8.7 Fine-Grained Kernel Event Tracing (kdebug)
625(13)
6.8.8 Low-Level Diagnostics and Debugging Interfaces
638(11)
6.8.9 Low-Level Kernel Tracing
649(10)
6.9 Virtual Machine Monitor
659(17)
6.9.1 Features
660(1)
6.9.2 Using the VMM Facility
661(1)
6.9.3 Example: Running Code in a Virtual Machine
662(14)
6.10 Compiling the Kernel
676(7)
6.10.1 Retrieving Prerequisite Packages
677(1)
6.10.2 Compiling Prerequisite Packages
677(3)
6.10.3 Compiling the xnu Package
680(1)
6.10.4 DarwinBuild
681(2)
Chapter 7 Processes
683(152)
7.1 Processes: From Early UNIX to Mac OS X
684(3)
7.1.1 Mac OS X Process Limits
685(1)
7.1.2 Mac OS X Execution Flavors
686(1)
7.2 Mach Abstractions, Data Structures, and APIs
687(39)
7.2.1 Summary of Relationships
687(2)
7.2.2 Processor Sets
689(3)
7.2.3 Processors
692(10)
7.2.4 Tasks and the Task API
702(3)
7.2.5 Threads
705(7)
7.2.6 Thread-Related Abstractions
712(14)
7.3 Many Threads of a New System
726(48)
7.3.1 Mach Tasks and Threads
727(19)
7.3.2 BSD Processes
746(13)
7.3.3 POSIX Threads (Pthreads)
759(3)
7.3.4 Java Threads
762(1)
7.3.5 The NSTask Cocoa Class
763(1)
7.3.6 The NSThread Cocoa Class
764(3)
7.3.7 The Carbon Process Manager
767(2)
7.3.8 Carbon Multiprocessing Services
769(3)
7.3.9 The Carbon Thread Manager
772(2)
7.4 Scheduling
774(38)
7.4.1 Scheduling Infrastructure Initialization
775(14)
7.4.2 Scheduler Operation
789(13)
7.4.3 Scheduling Policies
802(10)
7.5 The execve ( ) System Call
812(16)
7.5.1 Mach-O Binaries
815(10)
7.5.2 Fat (Universal) Binaries
825(1)
7.5.3 Interpreter Scripts
825(3)
7.6 Launching Applications
828(7)
7.6.1 Mapping Entities to Handlers
828(2)
7.6.2 Uniform Type Identifiers
830(5)
Volume 2
Chapter 8 Memory
835(186)
8.1 Looking Back
835(3)
8.1.1 Virtual Memory and UNIX
836(1)
8.1.2 Virtual Memory and Personal Computing
836(1)
8.1.3 Roots of the Mac OS X Virtual Memory Subsystem
837(1)
8.2 An Overview of Mac OS X Memory Management
838(8)
8.2.1 Reading Kernel Memory from User Space
841(4)
8.2.2 Querying Physical Memory Size
845(1)
8.3 Mach VM
846(22)
8.3.1 Overview
847(2)
8.3.2 Task Address Spaces
849(1)
8.3.3 VM Maps
849(2)
8.3.4 VM Map Entries
851(1)
8.3.5 VM Objects
851(2)
8.3.6 Pagers
853(9)
8.3.7 Copy-on-Write
862(3)
8.3.8 The Physical Map (Pmap)
865(3)
8.4 Resident Memory
868(9)
8.4.1 The vm_page Structure
868(1)
8.4.2 Searching for Resident Pages
869(1)
8.4.3 Resident Page Queues
870(1)
8.4.4 Page Replacement
871(1)
8.4.5 Physical Memory Bookkeeping
872(4)
8.4.6 Page Faults
876(1)
8.5 Virtual Memory Initialization during Bootstrap
877(1)
8.6 The Mach VM User-Space Interface
878(15)
8.6.1 mach_vm_map ()
881(3)
8.6.2 mach_vm_remap ()
884(1)
8.6.3 mach_vm_allocate ( )
885(1)
8.6.4 mach_vm_deallocate ()
885(1)
8.6.5 mach_vm_protect ()
886(1)
8.6.6 mach_vm_inherit ( )
886(1)
8.6.7 mach_vm_read ()
887(1)
8.6.8 mach-vm_write ()
888(1)
8.6.9 mach_vm_copy ()
888(1)
8.6.10 mach_vm_wire
889(1)
8.6.11 mach_vm_behavior_set ()
889(2)
8.6.12 mach_vm_msync ()
891(1)
8.6.13 Statistics
892(1)
8.7 Using the Mach VM Interfaces
893(14)
8.7.1 Controlling Memory Inheritance
893(3)
8.7.2 Debugging the Mach VM Subsystem
896(1)
8.7.3 Protecting Memory
897(2)
8.7.4 Accessing Another Task's Memory
899(2)
8.7.5 Naming and Sharing Memory
901(6)
8.8 Kernel and User Address Space Layouts
907(5)
8.9 Universal Page Lists (UPLs)
912(1)
8.10 Unified Buffer Cache (UBC)
913(5)
8.10.1 The UBC Interface
914(2)
8.10.2 The NFS Buffer Cache
916(2)
8.11 The Dynamic Pager Program
918(3)
8.12 The Update Daemon
921(1)
8.13 System Shared Memory
922(20)
8.13.1 Applications of Shared Memory
922(5)
8.13.2 Implementation of the Shared Memory Server Subsystem
927(5)
8.13.3 The Loading of Shared Object Files by the Dynamic Linker
932(4)
8.13.4 The Use of shared_region_map_file_np ( ) by a System Application
936(5)
8.13.5 A Note on Prebinding
941(1)
8.14 Task Working Set Detection and Maintenance
942(6)
8.14.1 The TWS Mechanism
943(1)
8.14.2 TWS Implementation
944(4)
8.15 Memory Allocation in User Space
948(32)
8.15.1 A Historical Break
949(2)
8.15.2 Memory Allocator Internals
951(15)
8.15.3 The malloc( ) Routine
966(2)
8.15.4 The Largest Single Allocation (32-bit)
968(2)
8.15.5 The Largest Single Allocation (64-bit)
970(1)
8.15.6 Enumerating All Pointers
971(3)
8.15.7 Displaying Scalable Zone Statistics
974(2)
8.15.8 Logging Malloc Operations
976(3)
8.15.9 Intercepting the Malloc Layer
979(1)
8.16 Memory Allocation in the Kernel
980(21)
8.16.1 Page-Level Allocation
980(3)
8.16.2 kmem_alloc
983(2)
8.16.3 The Mach Zone Allocator
985(7)
8.16.4 The Kalloc Family
992(1)
8.16.5 The OSMalloc Family
993(2)
8.16.6 Memory Allocation in the I/O Kit
995(2)
8.16.7 Memory Allocation in the Kernel's BSD Portion
997(3)
8.16.8 Memory Allocation in libkern's C++ Environment
1000(1)
8.17 Memory-Mapped Files
1001(4)
8.18 64-bit Computing
1005(16)
8.18.1 Reasons for 64-bit Computing
1010(4)
8.18.2 Mac OS X 10.4: 64-bit User Address Spaces
1014(5)
8.18.3 Why Not to Use 64-bit Executables
1019(1)
8.18.4 The 64-bit "Scene"
1019(2)
Chapter 9 Interprocess Communication
1021(212)
9.1 Introduction
1021(4)
9.1.1 The Evolution of IPC
1023(1)
9.1.2 IPC in Mac OS X
1024(1)
9.2 Mach IPC: An Overview
1025(16)
9.2.1 Mach Ports
1027(4)
9.2.2 Mach IPC Messages
1031(10)
9.3 Mach IPC: The Mac OS X Implementation
1041(19)
9.3.1 IPC Spaces
1041(3)
9.3.2 The Anatomy of a Mach Port
1044(4)
9.3.3 Tasks and IPC
1048(3)
9.3.4 Threads and IPC
1051(1)
9.3.5 Port Allocation
1052(5)
9.3.6 Messaging Implementation
1057(3)
9.3.7 IPC Subsystem Initialization
1060(1)
9.4 Name and Bootstrap Servers
1060(20)
9.4.1 The Network Message Server
1063(1)
9.4.2 The Bootstrap Server
1064(4)
9.4.3 The Bootstrap Server API
1068(12)
9.5 Using Mach IPC
1080(14)
9.5.1 A Simple Client-Server Example
1080(4)
9.5.2 Dead Names
1084(1)
9.5.3 Port Sets
1085(2)
9.5.4 Interposition
1087(3)
9.5.5 Transferring Out-of-Line Memory and Port Rights
1090(4)
9.6 MIG
1094(18)
9.6.1 MIG Specification Files
1095(5)
9.6.2 Using MIG to Create a Client-Server System
1100(8)
9.6.3 MIG in the Kernel
1108(4)
9.7 Mach Exceptions
1112(17)
9.7.1 Programmer-Visible Aspects of Mach's Exception-Handling Facility
1115(3)
9.7.2 The Mach Exception-Handling Chain
1118(5)
9.7.3 Example: A Mach Exception Handler
1123(6)
9.8 Signals
1129(16)
9.8.1 Reliability
1131(1)
9.8.2 The Number of Signals
1131(1)
9.8.3 Application-Defined Signals
1132(1)
9.8.4 Signal-Based Notification of Asynchronous I/O
1132(3)
9.8.5 Signals and Multithreading
1135(1)
9.8.6 Signal Actions
1135(3)
9.8.7 Signal Generation and Delivery
1138(3)
9.8.8 Mach Exceptions and Unix Signals Living Together
1141(3)
9.8.9 Exceptions, Signals, and Debugging
1144(1)
9.8.10 The ptrace () System Cali
1144(1)
9.9 Pipes
1145(3)
9.10 Named Pipes (Fifos)
1147(1)
9.11 File Descriptor Passing
1148(7)
9.12 XSI IPC
1155(1)
9.13 POSIX IPC
1156(8)
9.13.1 POSIX Semaphores
1156(4)
9.13.2 POSIX Shared Memory
1160(4)
9.14 Distributed Objects
1164(8)
9.15 Apple Events
1172(9)
9.15.1 Tiling Application Windows Using Apple Events in AppleScript
1175(1)
9.15.2 Building and Sending an Apple Event in a C Program
1176(3)
9.15.3 Causing the System to Sleep by Sending an Apple Event
1179(2)
9.16 Notifications
1181(16)
9.16.1 Foundation Notifications
1181(3)
9.16.2 The notify (3) API
1184(7)
9.16.3 Kernel Event Notification Mechanism (kqueue (2))
1191(5)
9.16.4 Core Foundation Notifications
1196(1)
9.16.5 Fsevents
1196(1)
9.16.6 Kauth
1197(1)
9.17 Core Foundation IPC
1197(13)
9.17.1 Notifications
1197(4)
9.17.2 The Run Loop
1201(9)
9.18 Synchronization
1210(23)
9.18.1 Interfaces for Atomic Operations
1213(1)
9.18.2 Low-Level Locking
1213(5)
9.18.3 BSD Condition Variables
1218(1)
9.18.4 Mach Lock Sets
1218(1)
9.18.5 Mach Semaphores
1219(3)
9.18.6 Pthreads Synchronization Interfaces
1222(1)
9.18.7 Locking in the I/O Kit
1223(1)
9.18.8 Funnels
1223(7)
9.18.9 SPLs
1230(1)
9.18.10 Advisory-Mode File Locking
1230(3)
Chapter 10 Extending the Kernel
1233(112)
10.1 A Driver down the Memory Lane
1233(2)
10.1.1 Driver Programming Considered Difficult
1234(1)
10.1.2 Good Inheritance
1234(1)
10.1.3 Everything Is a File
1235(1)
10.1.4 There Is More to Extending the Kernel Than Driving Devices
1235(1)
10.2 The I/O Kit
1235(22)
10.2.1 Embedded C++
1237(2)
10.2.2 I/O Kit Class Hierarchy
1239(1)
10.2.3 I/O Kit Families
1239(3)
10.2.4 I/O Kit Drivers
1242(1)
10.2.5 Nubs
1242(1)
10.2.6 General I/O Kit Classes
1243(3)
10.2.7 The Work Loop
1246(5)
10.2.8 The I/O Registry
1251(2)
10.2.9 The I/O Catalog
1253(1)
10.2.10 I/O Kit Initialization
1253(2)
10.2.11 Driver Matching in the I/O Kit
1255(2)
10.3 DART
1257(2)
10.4 Dynamically Extending the Kernel
1259(10)
10.4.1 The Structure of a Kernel Extension
1259(1)
10.4.2 Creation of Kernel Extensions
1260(6)
10.4.3 Management of Kernel Extensions
1266(1)
10.4.4 Automatic Loading of Kernel Extensions
1267(2)
10.5 Communicating with the Kernel
1269(2)
10.6 Creating Kernel Extensions
1271(17)
10.6.1 A Generic Kernel Extension
1271(5)
10.6.2 Implementing Sysctl Variables Using a Generic Kext
1276(4)
10.6.3 I/O Kit Device Driver Kext
1280(8)
10.7 A Programming Tour of the I/O Kit's Functionality
1288(33)
10.7.1 Rotating a Framebuffer
1288(5)
10.7.2 Accessing Framebuffer Memory
1293(1)
10.7.3 Retrieving the List of Firmware Variables
1294(2)
10.7.4 Retrieving Information about Loaded Kernel Extensions
1296(1)
10.7.5 Retrieving Accelerometer Data from the Sudden Motion Sensor
1297(6)
10.7.6 Listing PCI Devices
1303(1)
10.7.7 Retrieving the Computer's Serial Number and Model Information
1304(1)
10.7.8 Retrieving Temperature Sensor Readings
1305(4)
10.7.9 Retrieving MAC Addresses of Ethernet Interfaces
1309(1)
10.7.10 Implementing an Encrypted Disk Filter Scheme
1310(11)
10.8 Debugging
1321(24)
10.8.1 Kernel Panics
1322(2)
10.8.2 Remote Core Dumps
1324(1)
10.8.3 Logging
1325(3)
10.8.4 Debugging by Using GDB
1328(3)
10.8.5 Debugging by Using KDB
1331(7)
10.8.6 Miscellaneous Debugging Tools
1338(1)
10.8.7 Stabs
1338(7)
Chapter 11 File Systems
1345(126)
11.1 Disks and Partitions
1345(8)
11.1.1 The Apple Partitioning Scheme
1349(3)
11.1.2 PC-Style Partitioning
1352(1)
11.1.3 GUID-Based Partitioning
1352(1)
11.2 Disk Arbitration
1353(9)
11.2.1 Retrieving a Disk's Description
1355(2)
11.2.2 Participating in Disk Mounting Decisions
1357(2)
11.2.3 Receiving Media Notifications from the I/O Kit
1359(3)
11.3 The Implementation of Disk Devices
1362(4)
11.4 Disk Images
1366(8)
11.4.1 Using the hdiutil Program
1367(3)
11.4.2 RAM Disks
1370(1)
11.4.3 The BSD Vnode Disk Driver
1370(1)
11.4.4 Creating a Virtual Disk from Scratch
1371(3)
11.5 Files and File Descriptors
1374(2)
11.6 The VFS Layer
1376(10)
11.7 File System Types
1386(23)
11.7.1 HFS Plus and HFS
1388(1)
11.7.2 ISO 9660
1388(2)
11.7.3 MS-DOS
1390(1)
11.7.4 NTFS
1391(1)
11.7.5 UDF
1391(1)
11.7.6 UFS
1391(2)
11.7.7 AFP
1393(2)
11.7.8 FTP
1395(1)
11.7.9 NFS
1396(1)
11.7.10 SMB/CIFS
1397(1)
11.7.11 WebDAV
1397(1)
11.7.12 cddafs
1398(2)
11.7.13 deadfs
1400(1)
11.7.14 devfs
1401(1)
11.7.15 fdesc
1402(1)
11.7.16 specfs and fifofs
1403(1)
11.7.17 synthfs
1404(1)
11.7.18 union
1405(2)
11.7.19 volfs
1407(2)
11.8 Spotlight
1409(32)
11.8.1 Spotlight's Architecture
1410(6)
11.8.2 The Fsevents Mechanism
1416(12)
11.8.3 Importing Metadata
1428(3)
11.8.4 Querying Spotlight
1431(8)
11.8.5 Spotlight Command-Line Tools
1439(1)
11.8.6 Overcoming Granularity Limitations
1440(1)
11.9 Access Control Lists
1441(4)
11.10 The Kauth Authorization Subsystem
1445(26)
11.10.1 Kauth Concepts
1446(4)
11.10.2 Implementation
1450(3)
11.10.3 A Vnode-Level File System Activity Monitor
1453(18)
Chapter 12 The HFS Plus File System
1471(116)
12.1 Analysis Tools
1474(3)
12.1.1 HFSDebug
1474(2)
12.1.2 Interface for Retrieving File System Attributes
1476(1)
12.1.3 Mac OS X Command-Line Tools
1476(1)
12.1.4 HFS+ Source and Technical Note TN1150
1477(1)
12.2 Fundamental Concepts
1477(14)
12.2.1 Volumes
1477(1)
12.2.2 Allocation Blocks
1477(3)
12.2.3 Extents
1480(1)
12.2.4 File Forks
1480(1)
12.2.5 Clumps
1481(1)
12.2.6 B-Trees
1481(10)
12.3 The Structure of an HFS+ Volume
1491(2)
12.4 Reserved Areas
1493(1)
12.5 The Volume Header
1493(8)
12.5.1 Viewing the Volume Header
1494(6)
12.5.2 Viewing a Volume Control Block
1500(1)
12.6 The HFS Wrapper
1501(4)
12.7 Special Files
1505(26)
12.7.1 The Allocation File
1505(5)
12.7.2 The Catalog File
1510(9)
12.7.3 The Extents Overflow File
1519(5)
12.7.4 The Attributes File
1524(6)
12.7.5 The Startup File
1530(1)
12.8 Examining HFS+ Features
1531(27)
12.8.1 Case Sensitivity
1531(1)
12.8.2 Filename Encodings
1532(2)
12.8.3 Permissions
1534(4)
12.8.4 Journaling
1538(8)
12.8.5 Quotas
1546(1)
12.8.6 Hard Links
1547(5)
12.8.7 Unlinking Open Files
1552(1)
12.8.8 Symbolic Links
1553(1)
12.8.9 Aliases
1554(2)
12.8.10 Resource Forks
1556(2)
12.9 Optimizations
1558(12)
12.9.1 On-the-Fly Defragmentation
1558(3)
12.9.2 The Metadata Zone
1561(1)
12.9.3 Hot File Clustering
1562(8)
12.10 Miscellaneous Features
1570(5)
12.10.1 Special System Calls
1570(1)
12.10.2 Freezing and Thawing a Volume
1571(1)
12.10.3 Extending and Shrinking a Volume
1572(1)
12.10.4 Volume Notifications
1572(2)
12.10.5 Support for Sparse Devices
1574(1)
12.11 Comparing Mac OS X File Systems
1575(7)
12.12 Comparing HFS+ and NTFS
1582(5)
Appendix A Mac OS X on x86-Based Macintosh Computers
1587(12)
A.1 Hardware Differences
1587(2)
A.2 Firmware and Booting
1589(1)
A.3 Partitioning
1590(1)
A.4 Universal Binaries
1591(1)
A.5 Rosetta
1592(2)
A.6 Byte Ordering
1594(1)
A.7 Miscellaneous Changes
1594(5)
A.7.1 No Dual-Mapped Kernel Address Space
1594(1)
A.7.2 Nonexecutable Stack
1595(1)
A.7.3 Thread Creation
1596(1)
A.7.4 System Calls
1597(1)
A.7.5 No /dev/mem or /dev/kmem
1597(1)
A.7.6 A New I/O Kit Plane
1598(1)
Index
1599
Amit Singh is an operating systems researcher, programmer, and author. He manages the Macintosh engineering team at Google. Previously, Amit has worked on operating systems at IBM Research, Bell Laboratories, and a Silicon Valley startup doing cutting-edge work in the area of virtualization. He also created and maintains osxbook.com and kernelthread.com. Amit often writes and releases open source software, such as MacFUSE, a Mac OS X implementation of the FUSE (File System in USEr Space) mechanism.