社区
系统维护与使用区
帖子详情
启动时:mounting NFS filesystems 时间过长的问题
mtwaterc
2002-09-08 11:06:29
red hat 7.2,每次启动时,到mounting NFS filesystems 时,要停10分钟左右,在启动服务中,把NFS和NFS LOCKED去掉,问题依然存在,请问该如何解决?3X
...全文
402
2
打赏
收藏
启动时:mounting NFS filesystems 时间过长的问题
red hat 7.2,每次启动时,到mounting NFS filesystems 时,要停10分钟左右,在启动服务中,把NFS和NFS LOCKED去掉,问题依然存在,请问该如何解决?3X
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
linuxnewer
2002-09-09
打赏
举报
回复
1
查看一下fstab中是否有关于nfs的mount?
mistl
2002-09-09
打赏
举报
回复
1
你配了相应的设置没有。
如果你不用NFS,不如不让它启动。
Solaris 10 System Administration Essentials
目录 Chapter 1 Install
ing
the Solaris 10 Operat
ing
System 1 1.1 Methods to Meet Your Needs 1 1.2 The Basics of Solaris Installation 2 1.2.1 Install
ing
Solaris on a SPARC System 6 1.2.2 Install
ing
Solaris on an x86 System 9 1.3 Solaris JumpStart Installation 13 1.3.1 Sett
ing
up a JumpStart Server 13 1.3.2 Creat
ing
a Pro?le Server for Networked Systems 14 1.3.3 Perform
ing
a Custom JumpStart Installation 22 1.4 Upgrad
ing
a Solaris System 25 1.5 Solaris Live Upgrade 26 Chapter 2 Boot, Service Management, and Shutdown 33 2.1 Boot 33 2.1.1 The Bootloader 33 2.1.2 The Kernel 34 2.1.3 User-Mode Programs 34 2.1.4 GRUB Extensions 35 2.1.5 Modify
ing
Boot Behavior 36 2.1.6 Run Levels 37 2.1.7 Troubleshoot
ing
37 2.2 Service Management Facility 39 2.2.1 enabled 40 2.2.2 state, next_state, and state_time 40 2.2.3 logfile 41 2.2.4 dependency 41 2.2.5 How SMF Interacts with Service Implementations 42 2.2.6 The Service Con?guration Facility 44 2.2.7 Health and Troubleshoot
ing
44 2.2.8 Service Manifests 45 2.2.9 Backup and Restore of SCF Data 45 2.3 Shutdown 46 2.3.1 Application-Speci?c Shutdown 46 2.3.2 Application-Independent Shutdown 46 Chapter 3 Software Management: Packages 47 3.1 Manag
ing
Software Packages 47 3.2 What Is a Package? 47 3.2.1 SVR4 Package Content 48 3.2.2 Package Nam
ing
Conventions 49 3.3 Tools for Manag
ing
Software Packages 49 3.4 Install
ing
or Remov
ing
a Software Package with the pkgadd or pkgrm Command 50 3.5 Us
ing
Package Commands to Manage Software Packages 51 3.5.1 How to Install Packages with the pkgadd Command 51 3.5.2 Add
ing
Frequently Installed Packages to a Spool Directory 54 3.5.3 Remov
ing
Software Packages 56 Chapter 4 Software Management: Patches 59 4.1 Manag
ing
Software with Patches 59 4.2 What Is a Patch? 59 4.2.1 Patch Content 60 4.2.2 Patch Number
ing
61 4.3 Patch Management Best Practices 61 4.3.1 Proactive Patch Management Strategy 62 4.3.2 Reactive Patch Management Strategy 68 4.3.3 Security Patch Management Strategy 70 4.3.4 Proactive Patch
ing
When Install
ing
a New System 71 4.3.5 Identify
ing
Patches for Proactive Patch
ing
and Access
ing
Patches 73 4.4 Example of Us
ing
Solaris Live Upgrade to Install Patches 75 4.4.1 Overview of Patch
ing
with Solaris Live Upgrade 75 4.4.2 Plann
ing
for Us
ing
Solaris Live Upgrade 77 4.4.3 How to Apply a Patch When Us
ing
Solaris Live Upgrade for the Solaris 10 8/07 Release 79 4.5 Patch Automation Tools 86 4.6 Overview of Patch Types 88 4.7 Patch README Special Instructions 93 4.7.1 When to Patch in S
ing
le-User Mode 93 4.7.2 When to Reboot After Apply
ing
or Remov
ing
a Patch 94 4.7.3 Patch Metadata for Non-Global Zones 95 4.8 Patch Dependencies (Interrelationships) 96 4.8.1 SUNW_REQUIRES Field for Patch Dependencies 96 4.8.2 SUNW_OBSOLETES Field for Patch Accumulation and Obsolescence 97 4.8.3 SUNW_INCOMPAT Field for Incompatibility 97 Chapter 5 Solaris File Systems 99 5.1 Solaris File System Overview 99 5.1.1
Mount
ing
File Systems 100 5.1.2 Un
mount
ing
File Systems 102 5.1.3 Us
ing
the /etc/vfstab File 103 5.1.4 Determin
ing
a File System Type 104 5.1.5 Monitor
ing
File Systems 105 5.2 UFS File Systems 105 5.2.1 Creat
ing
a UFS File System 106 5.2.2 Back
ing
Up and Restor
ing
UFS File Systems 107 5.2.3 Us
ing
Quotas to Manage Disk Space 108 5.2.4 Check
ing
File System Integrity 110 5.2.5 Us
ing
Access Control Lists 112 5.2.6 Us
ing
UFS Logg
ing
113 5.2.7 Us
ing
Extended File Attributes 115 5.2.8 Us
ing
Multiterabyte UFS File Systems 115 5.2.9 Creat
ing
UFS Snapshots 115 5.3 ZFS File System Administration 117 5.3.1 Us
ing
Pools and File Systems 118 5.3.2 Back
ing
Up a ZFS File System 120 5.3.3 Us
ing
Mirror
ing
and Strip
ing
121 5.3.4 Us
ing
RAID-Z 122 5.3.5 Us
ing
Copy-on-Write and Snapshots 122 5.3.6 Us
ing
File Compression 124 5.3.7 Measur
ing
Performance 124 5.3.8 Expand
ing
a Pool 125 5.3.9 Check
ing
a Pool 126 5.3.10 Replac
ing
a Disk 127 5.4
NFS
File System Administration 127 5.4.1 Find
ing
Available
NFS
File Systems 128 5.4.2
Mount
ing
an
NFS
File System 129 5.4.3 Un
mount
ing
an
NFS
File System 129 5.4.4 Con?gur
ing
Automatic File System Shar
ing
130 5.4.5 Auto
mount
ing
File Systems 130 5.5 Removable Media 133 5.5.1 Us
ing
the PCFS File System 135 5.5.2 Us
ing
the HSFS File System 136 5.6 Pseudo File System Administration 136 5.6.1 Us
ing
Swap Space 136 5.6.2 Us
ing
the TMPFS File System 138 5.6.3 Us
ing
the Loopback File System 139 Chapter 6 Manag
ing
System Processes 141 6.1 Overview 141 6.1.1 State of a Process 143 6.1.2 Process Context 143 6.2 Monitor
ing
the Processes 145 6.2.1 Process Status: ps 146 6.2.2 Grepp
ing
for Process: pgrep 149 6.2.3 Process Statistics Summary: prstat 149 6.2.4 Reap a Zombie Process: preap 151 6.2.5 Temporarily Stop a Process: pstop 152 6.2.6 Resum
ing
a Suspended Process: prun 152 6.2.7 Wait for Process Completion: pwait 152 6.2.8 Process Work
ing
Directory: pwdx 152 6.2.9 Process Arguments: pargs 152 6.2.10 Process File Table: pfiles 153 6.2.11 Process Libraries: pldd 154 6.2.12 Process Tree: ptree 154 6.2.13 Process Stack: pstack 155 6.2.14 Trac
ing
Process: truss 156 6.3 Controll
ing
the Processes 158 6.3.1 The nice and renice Commands 158 6.3.2 Signals 159 6.4 Process Manager 164 6.5 Schedul
ing
Processes 170 6.5.1 cron Utility 171 6.5.2 The at Command 175 Chapter 7 Fault Management 179 7.1 Overview 179 7.2 Fault Noti?cation 181 7.3 Display
ing
Faults 182 7.4 Repair
ing
Faults 184 7.5 Manag
ing
Fault Management Log Files 184 7.5.1 Automatic Log Rotation 185 7.5.2 Manual Log Rotation 186 7.5.3 Log Rotation Failures 187 7.5.4 Examin
ing
Historical Log Files 188 7.6 Manag
ing
fmd and fmd Modules 188 7.6.1 Load
ing
and Unload
ing
Modules 189 7.6.2 fmd Statistics 191 7.6.3 Con?guration Files 192 7.7 Fault Management Directories 193 7.8 Solaris Fault Management Downloadable Resources 193 7.8.1 Solaris FMA Demo Kit 193 7.8.2 Events Registry 194 Chapter 8 Manag
ing
Disks 197 8.1 Hard Disk Drive 197 8.2 Disk Terminology 199 8.3 Disk Device Nam
ing
Conventions 200 8.3.1 Specify
ing
the Disk Subdirectory in Commands 202 8.4 Overview of Disk Management 202 8.4.1 Device Driver 202 8.4.2 Disk Labels (VTOC or EFI) 203 8.4.3 Disk Slices 205 8.4.4 Slice Arrangements on Multiple Disks 207 8.4.5 Partition Table 208 8.4.6 format Utility 210 8.4.7 format Menu and Command Descriptions 211 8.4.8 Partition Menu 213 8.4.9 x86: fdisk Menu 214 8.4.10 Analyze Menu 215 8.4.11 Defect Menu 217 8.5 Disk Management Procedures 217 8.5.1 How to Identify the Disks on a System 218 8.5.2 How to Determine If a Disk Is Formatted 218 8.5.3 How to Format a Disk 219 8.5.4 How to Identify a Defective Sector by Perform
ing
a Surface Analysis 221 8.5.5 How to Repair a Defective Sector 222 8.5.6 How to Display the Partition Table or Slice Information 223 8.5.7 Creat
ing
Disk Slices (Partition
ing
a Disk) and Label
ing
a Disk 224 8.5.8 Creat
ing
a File System On a Disk 228 8.5.9 Additional Commands to Manage Disks 229 Chapter 9 Manag
ing
Devices 235 9.1 Solaris Device Driver Introduction 235 9.2 Analyz
ing
Lack of Device Support 236 9.2.1 Device Does Not Work 236 9.2.2 Obtain
ing
Information About Devices 236 9.2.3 Obtain
ing
Information About Drivers 241 9.2.4 Does the Device Have a Driver? 248 9.2.5 Current Driver Does Not Work 250 9.2.6 Can a Driver for a Similar Device Work? 250 9.3 Install
ing
and Updat
ing
Drivers 251 9.3.1 Back
ing
Up Current Function
ing
Driver Binaries 251 9.3.2 Package Installations 252 9.3.3 Install Time Updates 252 9.3.4 Manual Driver Binary Installation 253 9.3.5 Add
ing
a Device Driver to a Net Installation Image 256 9.3.6 Add
ing
a Device Driver to a CD/DVD Installation Image 262 9.3.7 Swapp
ing
Disks 263 9.4 When Drivers Hang or Panic the System 266 9.4.1 Device Driver Causes the System to Hang 266 9.4.2 Device Driver Causes the System to Panic 268 9.4.3 Device Driver Degrades System Performance 269 9.5 Driver Administration Commands and Files 270 9.5.1 Driver Administration Command Summary 270 9.5.2 Driver Administration File Summary 272 Chapter 10 Solaris Network
ing
275 10.1 Introduction to Network Con?guration 275 10.1.1 Overview of the TCP/IP Network
ing
Stack 275 10.1.2 Con?gur
ing
the Network as Superuser 277 10.2 Sett
ing
Up a Network 277 10.2.1 Components of the XYZ, Inc. Network 277 10.2.2 Con?gur
ing
the Sales Domain 280 10.2.3 Con?gur
ing
the Account
ing
Domain 283 10.2.4 Con?gur
ing
the Multihomed Host 288 10.2.5 Sett
ing
Up a System for Static Rout
ing
296 10.2.6 Con?gur
ing
the Corporate Domain 300 10.2.7 Test
ing
the Network Con?guration 302 10.3 Monitor
ing
Network Performance 304 10.3.1 dladm Command 304 10.3.2 ifconfig Command 305 10.3.3 netstat Command 305 10.3.4 snoop Command 307 10.3.5 traceroute Command 308 Chapter 11 Solaris User Management 309 11.1 Solaris Users, Groups, and Roles 309 11.1.1 File System Object Permissions 310 11.1.2 User Account Components 312 11.1.3 User Management Tools 313 11.1.4 User Management Files 313 11.2 Manag
ing
Users and Groups 314 11.2.1 Start
ing
the Solaris Management Console 314 11.2.2 Add
ing
a Group and a User to Local Files 315 11.2.3 Add
ing
a Group and a User to an NIS Domain 317 11.3 Manag
ing
Roles 318 11.3.1 Chang
ing
root from a User to a Role 318 11.3.2 View
ing
the List of Roles 319 11.3.3 Assign
ing
a Role to a Local User 319 Chapter 12 Solaris Zones 321 12.1 Overview 321 12.2 How Zones Work 323 12.3 Branded Zones 324 12.4 Network Interfaces in Zones 324 12.5 Devices in Zones 325 12.6 Packages and Patches in a Zones Environment 325 12.7 Administer
ing
Zones 326 12.7.1 Zone Con?guration 327 12.7.2 View
ing
a Zone Con?guration 331 12.7.3 Zone Installation and Boot
ing
331 12.7.4 Zone Login Us
ing
the zlogin Command 332 12.8 Halt
ing
, Uninstall
ing
, Mov
ing
, and Clon
ing
Zones 333 12.9 Migrat
ing
a Zone to a New System 334 12.10 Delet
ing
a Zone 336 12.11 List
ing
the Zones on a System 336 12.12 Zones Usage Examples 337 12.12.1 Add
ing
a Dedicated Device to a Non-Global Zone 337 12.12.2 How to Export Home Directories in the Global Zone into a Non-Global Zone 337 12.12.3 Alter
ing
Privileges in a Non-Global Zone 337 12.12.4 Check
ing
the Status of SMF Services 338 12.12.5 Modify
ing
CPU, Swap, and Locked Memory Caps in Zones 338 12.12.6 Us
ing
the Dtrace Program in a Non-Global Zone 339 Chapter 13 Us
ing
Nam
ing
Services 341 13.1 Us
ing
Nam
ing
Services (DNS, NIS, AND LDAP) 341 13.1.1 Nam
ing
Service Cache Daemon (nscd) 342 13.1.2 DNS Nam
ing
Services 342 13.1.3 NIS Nam
ing
Services 342 13.1.4 LDAP Nam
ing
Services 343 13.1.5 Organizational Use of Nam
ing
Services 343 13.1.6 Network Database Sources 344 13.2 Name Service Switch File 347 13.2.1 Con?gur
ing
the Name Service Switch File 347 13.2.2 Database Status and Actions 349 13.3 DNS Setup and Con?guration 350 13.3.1 Resolver Files 350 13.3.2 Steps DNS Clients Use to Resolve Names 350 13.4 NIS Setup and Con?guration 351 13.4.1 Sett
ing
Up NIS Clients 351 13.4.2 Work
ing
with NIS Maps 352 13.5 LDAP Setup and Con?guration 356 13.5.1 Initializ
ing
a Client Us
ing
Per-User Credentials 357 13.5.2 Con?gur
ing
an LDAP Client 359 13.5.3 Us
ing
Pro?les to Initialize an LDAP Client 362 13.5.4 Us
ing
Proxy Credentials to Initialize an LDAP Client 362 13.5.5 Initializ
ing
an LDAP Client Manually 363 13.5.6 Modify
ing
a Manual LDAP Client Con?guration 363 13.5.7 Troubleshoot
ing
LDAP Client Con?guration 364 13.5.8 Uninitializ
ing
an LDAP Client 364 13.5.9 Initializ
ing
the Native LDAP Client 364 13.5.10 LDAP API Entry List
ing
s 368 13.5.11 Troubleshoot
ing
Name Service Information 368 Chapter 14 Solaris Print Administration 369 14.1 Overview of the Solaris Print
ing
Architecture 369 14.2 Key Concepts 370 14.2.1 Printer Categories (Local and Remote Printers) 370 14.2.2 Printer Connections (Directly Attached and Network Attached) 370 14.2.3 Description of a Print Server and a Print Client 371 14.3 Solaris Print
ing
Tools and Services 371 14.3.1 Solaris Print Manager 371 14.3.2 LP Print Service 371 14.3.3 PostScript Printer De?nitions File Manager 372 14.4 Network Protocols 372 14.4.1 Berkeley Software Distribution Protocol 372 14.4.2 Transmission Control Protocol 372 14.4.3 Internet Print
ing
Protocol 373 14.4.4 Server Message Block Protocol 373 14. 5 Plann
ing
for Printer Setup 373 14. 5.1 Print Server Requirements 373 14. 5.2 Locat
ing
Information About Supported Printers 374 14. 5.3 Locat
ing
Information About Available PPD Files 375 14. 5.4 Add
ing
a New PPD File to the System 375 14. 5.5 Add
ing
Printers in a Nam
ing
Service 377 14. 5.6 Printer Support in the Nam
ing
Service Switch 377 14. 5.7 Enabl
ing
Network Listen
ing
Services 378 14.6 Sett
ing
Up Printers with Solaris Printer Manager 379 14.6.1 Assign
ing
Printer De?nitions 379 14.6.2 Start
ing
Solaris Print Manager 380 14.6.3 Sett
ing
Up a New Directly Attached Printer With Solaris Print Manager 381 14.6.4 Sett
ing
Up a New Network-Attached Printer with Solaris Print Manager 381 14.7 Sett
ing
Up a Printer on a Print Client with Solaris Print Manager 385 14.7.1 Add
ing
Printer Access With Solaris Print Manager 385 14.8 Administer
ing
Printers by Us
ing
LP Print Commands 385 14.8.1 Frequently Used LP Print Commands 386 14.8.2 Us
ing
the lpstat Command 386 14.8.3 Disabl
ing
and Enabl
ing
Printers 387 14.8.4 Accept
ing
or Reject
ing
Print Requests 387 14.8.5 Cancel
ing
a Print Request 388 14.8.6 Mov
ing
Print Requests from One Printer to Another Printer 389 14.8.7 Delet
ing
a Printer 390 14.9 Troubleshoot
ing
Print
ing
Problems 392 14.9.1 Troubleshoot
ing
No Output (Noth
ing
Prints) 392 14.9.2 Check
ing
That the Print Scheduler Is Runn
ing
393 14.9.3 Debugg
ing
Print
ing
Problems 393 14.9.4 Check
ing
the Printer Network Connections 394 Index 395
vxworks_kernel_programmers_guide_6.9
PART I: CORE TECHNOLOGIES 1 Overview ...................................................................................................... 3 1.1 Introduction ...................................................................................................................... 3 1.2 Kernel Architecture ......................................................................................................... 3 1.3 Related Documentation Resources .............................................................................. 4 1.4 VxWorks Configuration and Build .............................................................................. 5 2 VxWorks Configuration ............................................................................. 7 2.1 Introduction ...................................................................................................................... 7 2.2 About VxWorks Configuration ................................................................................... 7 2.2.1 Default Configuration and Images ................................................................. 8 2.2.2 Configuration With VxWorks Image Projects ............................................... 8 2.2.3 Configuration With VxWorks Source Build Projects ................................... 8 2.2.4 Configuration and Customization .................................................................. 8 2.2.5 Configuration Tools: Workbench and vxprj .................................................. 9 2.3 VxWorks Image Projects: VIPs .................................................................................... 9 2.3.1 VxWorks Components ...................................................................................... 10 Component Names .......................................................................................... 10 Basic VxWorks Components ............................................................................ 11 2.3.2 Device Driver Selection ................................................................................... 13 2.3.3 Component Bundles and Configuration Profiles ........................................ 14 2.3.4 VxWorks Component Reference .................................................................... 14 2.4 VxWorks Source Build Projects: VSBs ....................................................................... 14 2.4.1 Basic Operat
ing
System VSB Options ........................................................... 16 BSP-Specific Optimizations ............................................................................. 16 VxWorks Kernel Programmer's Guide, 6.9 iv Inconsistent Cache Mode Support .................................................................. 17 System Viewer Instrumentation Support ...................................................... 17 Real-Time Process Support .............................................................................. 17 Object Management Support ........................................................................... 17 Error Detection and Report
ing
Policy Hooks ............................................... 18 Task Switch Hook Support .............................................................................. 18 Task Create Hook Support ............................................................................... 18 CPU Power Management Support ................................................................. 19 Advanced Options ............................................................................................ 19 VxWorks BSP Validation Test Suite Support ................................................. 19 Symmetric Multiprocessor (SMP) Support ................................................... 19 SMP Determinism ............................................................................................. 19 MIPC Support .................................................................................................... 20 WRLOAD Support ............................................................................................ 20 Task-Specific Current Work
ing
Directory ...................................................... 20 Device Name Length ........................................................................................ 20
NFS
V3 Server Optimization ........................................................................... 20 DOSFS Name Length Compatible .................................................................. 21 2.4.2 VSB Profiles ........................................................................................................ 21 2.4.3 Us
ing
VSB Projects to Create VxWorks Systems: Basic Steps .................... 21 2.4.4 Develop
ing
Kernel Applications for VSB Systems ..................................... 21 2.5 VxWorks Without Network
ing
..................................................................................... 22 2.6 Small-Footprint VxWorks Configuration ................................................................... 22 2.6.1 About Small-Footprint VxWorks .................................................................... 22 Kernel Facilities ................................................................................................. 22 Unsupported Facilities ..................................................................................... 23 BSPs ..................................................................................................................... 23 2.6.2 Configur
ing
Small Footprint VxWorks .......................................................... 23 Small-Footprint VSB Profile and Options ...................................................... 24 VSB Options Specific to the Small-Footprint Profile .................................... 24 Small-Footprint VIP Profile and Components .............................................. 25 Optional Components for a Small Footprint VIP Project ............................ 25 2.6.3 Configuration and Build Steps for Small-Footprint VxWorks ................... 25 2.6.4 Writ
ing
Applications for Small-Footprint VxWorks .................................... 26 2.6.5 Example Application ........................................................................................ 26 2.6.6 Debugg
ing
Small-Footprint VxWorks ............................................................ 28 2.7 VxWorks Image Types ................................................................................................... 28 2.7.1 Default VxWorks Images ................................................................................ 29 2.7.2 VxWorks Images for Development and Production Systems ..................... 29 2.7.3 Boot Parameter Configuration for Standalone VxWorks Images .............. 30 2.8 Image Size Considerations ............................................................................................ 30 2.8.1 Boot Loader and Downloadable Image ......................................................... 30 2.8.2 Self-Boot
ing
Image ............................................................................................ 31 Contents v 3 Boot Loader ................................................................................................. 33 3.1 Introduction ...................................................................................................................... 33 3.2 Us
ing
a Default Boot Loader ......................................................................................... 34 3.3 Boot Loader Image Types ............................................................................................... 35 3.4 Boot Loader Shell ............................................................................................................ 35 3.4.1 Boot Loader Shell Commands ......................................................................... 36 3.5 Boot Parameters ............................................................................................................... 39 3.5.1 Display
ing
Current Boot Parameters ............................................................. 40 3.5.2 Description of Boot Parameters ...................................................................... 41 3.5.3 Chang
ing
Boot Parameters Interactively ....................................................... 44 3.6 Reboot
ing
VxWorks ........................................................................................................ 45 3.7 Configur
ing
and Build
ing
Boot Loaders .................................................................... 46 3.7.1 Boot Loader Profiles .......................................................................................... 46 3.7.2 Boot Loader Components ................................................................................ 47 3.7.3 Configur
ing
Boot Parameters Statically ......................................................... 47 3.7.4 Enabl
ing
Network
ing
for Non-Boot Interfaces ............................................. 48 3.7.5 Select
ing
a Boot Device ..................................................................................... 48 3.7.6 Reconfigur
ing
Boot Loader Memory Layout for 32-Bit VxWorks ............. 50 Redefin
ing
the Boot Loader Link Address for Custom Boot Loaders ....... 50 Reconfigur
ing
Memory Layout for a Persistent Memory Region ............. 51 3.7.7 Reconfigur
ing
Boot Loader Memory Layout for 64-Bit VxWorks ............. 53 3.7.8 Build
ing
Boot Loaders ...................................................................................... 53 3.8 Install
ing
Boot Loaders .................................................................................................. 53 3.9 Boot
ing
From a Network ............................................................................................... 53 3.10 Boot
ing
From a Target File System ............................................................................. 55 3.11 Boot
ing
From the Host File System Us
ing
TSFS ..................................................... 55 4 Kernel Applications .................................................................................... 57 4.1 Introduction ...................................................................................................................... 57 4.2 About Kernel Applications ........................................................................................... 58 4.3 Compar
ing
Kernel Applications with RTP Applications ....................................... 59 4.4 C and C++ Libraries ........................................................................................................ 60 VxWorks Kernel Programmer's Guide, 6.9 vi 4.5 Kernel Application Structure ........................................................................................ 60 4.6 VxWorks Header Files .................................................................................................... 61 4.6.1 VxWorks Header File: vxWorks.h ................................................................... 61 4.6.2 Other VxWorks Header Files ........................................................................... 62 4.6.3 ANSI Header Files ............................................................................................ 62 4.6.4 ANSI C++ Header Files .................................................................................... 62 4.6.5 The -I Compiler Flag ......................................................................................... 62 4.6.6 VxWorks Nested Header Files ........................................................................ 62 4.6.7 VxWorks Private Header Files ........................................................................ 63 4.7 Custom Header Files ....................................................................................................... 63 4.8 Static Instantiation of Kernel Objects ......................................................................... 64 4.8.1 About Static Instantiation of Kernel Objects ................................................. 64 Kernel Objects That can be Instantiated Statically ....................................... 65 Static Instantiation and Code Size .................................................................. 65 Advantages of Static Instantiation .................................................................. 65 Applications and Static Instantiation ............................................................. 66 4.8.2 Scope Of Static Declarations ............................................................................ 66 4.8.3 Caveat With Regard to Macro Use .................................................................. 66 4.8.4 Static Instantiation of Tasks ............................................................................. 66 4.8.5 Static Instantiation Of Semaphores ................................................................ 67 4.8.6 Static Instantiation of Message Queues ......................................................... 68 4.8.7 Static Instantiation of Watchdog Timers ........................................................ 68 4.9 Boot-Time Hook Routine Facility ............................................................................... 69 Boot-Time Hook Routine Stubs and Components ....................................... 69 Us
ing
Boot-Time Hook Routine Stubs ........................................................... 70 4.10 Kernel Applications and Kernel Component Requirements ................................. 71 4.11 Build
ing
Kernel Application Modules ....................................................................... 71 4.12 Download
ing
Kernel Application Object Modules to a Target ............................. 72 4.13 Link
ing
Kernel Application Object Modules with VxWorks ................................ 72 4.14 Configur
ing
VxWorks to Run Applications Automatically ................................... 72 5 C++ Development ....................................................................................... 75 5.1 Introduction ...................................................................................................................... 75 5.2 Configur
ing
VxWorks for C++ ..................................................................................... 76 5.3 C++ Header Files ............................................................................................................. 76 Contents vii 5.4 Spawn
ing
Tasks That Use C++ ..................................................................................... 76 5.5 Calls Between C and C++ Code .................................................................................... 77 5.6 C++ Compiler Caveats .................................................................................................... 77 5.7 Us
ing
C++ in Signal Handlers and ISRs ................................................................... 78 5.8 Downloadable Kernel Modules in C++ ..................................................................... 78 5.9 C++ Compiler Differences ............................................................................................ 78 5.9.1 Template Instantiation ...................................................................................... 78 5.9.2 Run-Time Type Information ............................................................................ 80 5.10 Namespaces ...................................................................................................................... 80 5.11 C++ Exception Handl
ing
................................................................................................ 81 5.12 Standard Template Library (STL) ................................................................................ 81 5.13 C++ Demo Example ........................................................................................................ 81 6 Multitask
ing
................................................................................................. 83 6.1 Introduction ...................................................................................................................... 83 6.2 About Tasks and Multitask
ing
..................................................................................... 84 6.2.1 Task States and Transitions .............................................................................. 85 Tasks States and State Symbols ....................................................................... 85 Illustration of Basic Task State Transitions .................................................... 86 6.3 VxWorks System Tasks .................................................................................................. 87 Basic VxWorks Tasks ......................................................................................... 88 Tasks for Optional Components ..................................................................... 91 6.4 Task Schedul
ing
.............................................................................................................. 93 6.4.1 Task Priorities .................................................................................................... 93 6.4.2 VxWorks Traditional Scheduler ...................................................................... 93 Priority-Based Preemptive Schedul
ing
.......................................................... 94 Schedul
ing
and the Ready Queue ................................................................. 94 Round-Robin Schedul
ing
................................................................................. 95 6.5 Task Creation and Management ................................................................................... 97 6.5.1 Task Creation and Activation .......................................................................... 97 Static instantiation of Tasks ............................................................................. 98 6.5.2 Task Names and IDs ......................................................................................... 98 Task Nam
ing
Rules ........................................................................................... 99 Task Name and ID Routines ............................................................................ 99 VxWorks Kernel Programmer's Guide, 6.9 viii 6.5.3 Inter-Process Communication With Public Tasks ......................................... 99 6.5.4 Task Creation Options ...................................................................................... 100 6.5.5 Task Stack ........................................................................................................... 102 Task Stack Protection ........................................................................................ 102 6.5.6 Task Information ............................................................................................... 103 6.5.7 Task Deletion and Deletion Safety .................................................................. 104 6.5.8 Task Execution Control ..................................................................................... 105 6.5.9 Task Schedul
ing
Control .................................................................................. 106 6.5.10 Task
ing
Extensions: Us
ing
Hook Routines .................................................... 107 6.6 Task Error Status: errno .................................................................................................. 108 6.6.1 Layered Definitions of errno ........................................................................... 109 6.6.2 A Separate errno Value for Each Task ............................................................ 109 6.6.3 Error Return Convention ................................................................................. 109 6.6.4 Assignment of Error Status Values ................................................................. 110 6.7 Task Exception Handl
ing
............................................................................................... 110 6.8 Shared Code and Reentrancy ........................................................................................ 111 6.8.1 Dynamic Stack Variables .................................................................................. 112 6.8.2 Guarded Global and Static Variables ............................................................. 112 6.8.3 Task-Specific Variables .................................................................................... 113 Thread-Local Variables: __thread Storage Class ........................................... 113 taskVarLib and Task Variables ........................................................................ 114 6.8.4 Multiple Tasks with the Same Main Routine ................................................ 114 7 Intertask and Interprocess Communication ............................................. 117 7.1 Introduction ...................................................................................................................... 117 7.2 About Intertask and Interprocess Communication .................................................. 118 7.3 Shared Data Structures ................................................................................................... 119 7.4 Interrupt Locks ............................................................................................................... 120 7.5 Task Locks ........................................................................................................................ 121 7.6 Semaphores ...................................................................................................................... 122 7.6.1 Inter-Process Communication With Public Semaphores ............................. 123 7.6.2 Semaphore Creation and Use .......................................................................... 123 Options for Scalable and Inline Semaphore Routines ................................ 125 Static Instantiation of Semaphores ................................................................. 125 Scalable and Inline Semaphore Take and Give Routines ........................... 126 Contents ix 7.6.3 Binary Semaphores ........................................................................................... 126 Mutual Exclusion .............................................................................................. 127 Synchronization ................................................................................................. 128 7.6.4 Mutual-Exclusion Semaphores ....................................................................... 129 Priority Inversion and Priority Inheritance ................................................... 129 Deletion Safety ................................................................................................... 132 Recursive Resource Access .............................................................................. 133 7.6.5 Count
ing
Semaphores ...................................................................................... 134 7.6.6 Read/Write Semaphores ................................................................................. 134 Specification of Read or Write Mode .............................................................. 135 Precedence for Write Access Operations ....................................................... 136 Read/Write Semaphores and System Performance ..................................... 136 7.6.7 Special Semaphore Options ............................................................................. 136 Semaphore Timeout .......................................................................................... 136 Semaphores and Queue
ing
.............................................................................. 137 Semaphores and VxWorks Events .................................................................. 137 7.7 Message Queues .............................................................................................................. 137 7.7.1 Inter-Process Communication With Public Message Queues ..................... 138 7.7.2 Message Creation and Use ............................................................................... 138 Static Instantiation of Message Queues ......................................................... 139 Message Queue Timeout .................................................................................. 139 Message Queue Urgent Messages .................................................................. 140 Message Queues and Queu
ing
Options ........................................................ 140 7.7.3 Display
ing
Message Queue Attributes .......................................................... 141 7.7.4 Servers and Clients with Message Queues .................................................... 141 7.7.5 Message Queues and VxWorks Events .......................................................... 142 7.8 Pipes ................................................................................................................................... 142 7.8.1 Creat
ing
Pipes ................................................................................................... 142 7.8.2 Writ
ing
to Pipes from ISRs ............................................................................... 142 7.8.3 I/O Control Functions ...................................................................................... 143 7.9 VxWorks Events ............................................................................................................... 143 7.9.1 Configur
ing
VxWorks for Events .................................................................... 144 7.9.2 About Event Flags and the Task Events Register ......................................... 144 7.9.3 Receiv
ing
Events ............................................................................................... 145 7.9.4 Send
ing
Events .................................................................................................. 146 7.9.5 Inter-Process Communication With Events .................................................. 148 7.9.6 Events Routines ................................................................................................. 148 7.9.7 Code Example ................................................................................................... 149 7.9.8 Show Routines and Events .............................................................................. 149 VxWorks Kernel Programmer's Guide, 6.9 x 7.10 Inter-Process Communication With Public Objects ................................................. 149 Creat
ing
and Nam
ing
Public and Private Objects ....................................... 150 Example of Inter-process Communication With a Public Semaphore ...... 150 7.11 About VxWorks API Timeout Parameters .................................................................. 152 7.12 About Object Ownership and Resource Reclamation ............................................. 152 8 Signals, ISRs, and Watchdog Timers ........................................................ 155 8.1 Introduction ...................................................................................................................... 155 8.2 Signals .............................................................................................................................. 156 8.2.1 Configur
ing
VxWorks for Signals .................................................................. 157 8.2.2 Basic Signal Routines ........................................................................................ 158 8.2.3 Queued Signal Routines .................................................................................. 159 8.2.4 Signal Events ...................................................................................................... 162 8.2.5 Signal Handlers ................................................................................................. 163 8.3 Interrupt Service Routines: ISRs ................................................................................. 166 8.3.1 Configur
ing
VxWorks for ISRs ........................................................................ 166 Configur
ing
the Interrupt Stack ...................................................................... 166 Add
ing
Show Routine Support ....................................................................... 167 8.3.2 Writ
ing
ISRs ....................................................................................................... 167 Restrictions on ISRs ........................................................................................... 167 Facilities Available for ISRs .............................................................................. 169 Reserv
ing
High Interrupt Levels .................................................................... 170 8.3.3 System Clock ISR Modification ....................................................................... 171 8.3.4 Connect
ing
ISRs to Interrupts ......................................................................... 171 8.3.5 Gett
ing
Information About ISRs ..................................................................... 172 8.3.6 Debugg
ing
ISRs ................................................................................................. 173 8.4 Watchdog Timers ............................................................................................................. 174 Static Instantiation of Watchdog Timers ........................................................ 175 8.4.1 Inter-Process Communication With Public Watchdog Timers ................... 176 9 POSIX Facilities .......................................................................................... 177 9.1 Introduction ...................................................................................................................... 178 9.2 Configur
ing
VxWorks with POSIX Facilities ............................................................ 179 9.2.1 VxWorks Components for POSIX Facilities .................................................. 179 9.3 General POSIX Support ................................................................................................. 180 9.4 POSIX Header Files ........................................................................................................ 181 Contents xi 9.5 POSIX Namespace .......................................................................................................... 183 9.6 POSIX Clocks and Timers ............................................................................................. 183 9.7 POSIX Asynchronous I/O .............................................................................................. 186 9.8 POSIX Advisory File Lock
ing
....................................................................................... 186 9.9 POSIX Page-Lock
ing
Interface ..................................................................................... 186 9.10 POSIX Threads ................................................................................................................ 187 9.10.1 POSIX Thread Attributes ................................................................................. 188 9.10.2 VxWorks-Specific Pthread Attributes ............................................................ 188 9.10.3 Specify
ing
Attributes when Creat
ing
Pthreads ........................................... 189 9.10.4 POSIX Thread Creation and Management .................................................... 190 9.10.5 POSIX Thread Attribute Access ...................................................................... 190 9.10.6 POSIX Thread Private Data ............................................................................. 191 9.10.7 POSIX Thread Cancellation ............................................................................. 192 9.11 POSIX Thread Mutexes and Condition Variables .................................................... 193 9.11.1 Thread Mutexes ................................................................................................. 193 Protocol Mutex Attribute ................................................................................ 194 Priority Ceil
ing
Mutex Attribute .................................................................... 195 9.11.2 Condition Variables .......................................................................................... 195 9.12 POSIX and VxWorks Schedul
ing
................................................................................. 196 9.12.1 Differences in POSIX and VxWorks Schedul
ing
........................................... 197 9.12.2 POSIX and VxWorks Priority Number
ing
..................................................... 198 9.12.3 Default Schedul
ing
Policy ................................................................................ 198 9.12.4 VxWorks Traditional Scheduler ...................................................................... 198 9.12.5 POSIX Threads Scheduler ................................................................................ 199 9.12.6 POSIX Schedul
ing
Routines ............................................................................ 203 9.12.7 Gett
ing
Schedul
ing
Parameters: Priority Limits and Time Slice ................ 204 9.13 POSIX Semaphores ......................................................................................................... 204 9.13.1 Comparison of POSIX and VxWorks Semaphores ....................................... 205 9.13.2 Us
ing
Unnamed Semaphores .......................................................................... 206 9.13.3 Us
ing
Named Semaphores .............................................................................. 208 9.14 POSIX Message Queues ................................................................................................. 211 9.14.1 Comparison of POSIX and VxWorks Message Queues ............................... 212 9.14.2 POSIX Message Queue Attributes .................................................................. 213 9.14.3 Display
ing
Message Queue Attributes .......................................................... 214 VxWorks Kernel Programmer's Guide, 6.9 xii 9.14.4 Communicat
ing
Through a Message Queue ................................................ 215 9.14.5 Notification of Message Arrival ..................................................................... 218 9.15 POSIX Signals .................................................................................................................. 222 9.16 POSIX Memory Management ....................................................................................... 222 10 Memory Management ................................................................................. 223 10.1 Introduction ...................................................................................................................... 223 10.2 32-Bit VxWorks Memory Layout ................................................................................. 224 10.2.1 Display
ing
Information About Memory Layout .......................................... 224 10.2.2 System Memory Map Without RTP Support ................................................ 224 10.2.3 System Memory Map with RTP Support ....................................................... 226 10.2.4 System RAM Autosiz
ing
.................................................................................. 228 10.2.5 Reserved Memory: User-Reserved Memory and Persistent Memory ...... 228 10.3 64-Bit VxWorks Memory Layout ................................................................................. 229 10.3.1 Display
ing
Information About Memory Layout .......................................... 230 10.3.2 Virtual Memory Regions .................................................................................. 230 Kernel System Virtual Memory Region ......................................................... 231 Kernel Virtual Memory Pool Region .............................................................. 232 Kernel Reserved Memory Region ................................................................... 232 Shared User Virtual Memory Region ............................................................. 232 RTP Private Virtual Memory Region .............................................................. 232 10.3.3 Global RAM Pool .............................................................................................. 233 10.3.4 Kernel Memory Map ........................................................................................ 233 Kernel System Memory .................................................................................... 235 Kernel Common Heap ...................................................................................... 235 DMA32 Heap ..................................................................................................... 235 User-Reserved Memory ................................................................................... 235 Persistent Memory ............................................................................................ 235 10.3.5 Reserved Memory Configuration: User-Reserved Memory and Persistent Memory .............................................................................................................. 236 10.3.6 System RAM Autosiz
ing
.................................................................................. 236 10.4 About VxWorks Memory Allocation Facilities ......................................................... 236 10.5 32-Bit VxWorks Heap and Memory Partition Management .................................. 237 10.5.1 Configur
ing
the Kernel Heap and the Memory Partition Manager .......... 238 10.5.2 Basic Heap and Memory Partition Manager ................................................. 238 10.5.3 Full Heap and Memory Partition Manager ................................................... 238 10.6 64-Bit VxWorks Heap and Memory Partition Management .................................. 239 10.6.1 Kernel Common Heap ...................................................................................... 239 Contents xiii 10.6.2 Kernel Proximity Heap ..................................................................................... 240 10.6.3 DMA32 Heap ..................................................................................................... 240 10.7 SMP-Optimized Memory Allocation .......................................................................... 241 10.7.1 Configuration ..................................................................................................... 241 10.7.2 Usage scenarios ................................................................................................. 241 10.8 Memory Pools .................................................................................................................. 242 10.9 POSIX Memory Management ....................................................................................... 242 10.9.1 POSIX Memory Management APIs ................................................................ 243 10.9.2 POSIX Memory Mapp
ing
................................................................................ 244 10.9.3 POSIX Memory Protection ............................................................................... 244 10.9.4 POSIX Memory Lock
ing
.................................................................................. 244 10.10 Memory Mapp
ing
Facilities .......................................................................................... 245 10.10.1 POSIX Memory-Mapped Files ........................................................................ 247 10.10.2 POSIX Shared Memory Objects ...................................................................... 247 10.10.3 Anonymous Memory Mapp
ing
...................................................................... 247 10.10.4 Device Memory Objects ................................................................................... 248 10.10.5 Shared Data Regions ......................................................................................... 249 10.11 Virtual Memory Management ..................................................................................... 249 10.11.1 Configur
ing
Virtual Memory Management .................................................. 250 10.11.2 Manag
ing
Virtual Memory Programmatically ............................................. 251 Modify
ing
Page States ...................................................................................... 252 Mak
ing
Memory Non-Writable ...................................................................... 253 Invalidat
ing
Memory Pages ............................................................................ 255 Lock
ing
TLB Entries .......................................................................................... 255 Page Size Optimization .................................................................................... 255 Sett
ing
Page States in ISRs ............................................................................... 256 10.11.3 Troubleshoot
ing
................................................................................................. 256 10.12 Additional Memory Protection Features ................................................................... 257 10.12.1 Configur
ing
VxWorks for Additional Memory Protection ......................... 257 10.12.2 Stack Overrun and Underrun Detection ........................................................ 258 10.12.3 Non-Executable Task Stack .............................................................................. 258 10.12.4 Text Segment Write Protection ........................................................................ 258 10.12.5 Exception Vector Table Write Protection ........................................................ 259 10.13 Memory Error Detection ................................................................................................ 259 10.13.1 Heap and Partition Memory Instrumentation .............................................. 259 10.13.2 Compiler Instrumentation: 32-Bit VxWorks .................................................. 264 VxWorks Kernel Programmer's Guide, 6.9 xiv 11 I/O System ................................................................................................... 269 11.1 Introduction ...................................................................................................................... 269 11.2 About the VxWorks I/O System ................................................................................... 270 Differences Between VxWorks and Host System I/O ................................. 270 11.3 Configur
ing
VxWorks With I/O Facilities .................................................................. 271 11.4 I/O Devices, Named Files, and File Systems ............................................................ 272 11.5 Remote File System Access From VxWorks ............................................................... 273
NFS
File System Access from VxWorks ......................................................... 273 Non-
NFS
Network File System Access from VxWorks WIth FTP or RSH 273 11.6 Basic I/O ............................................................................................................................ 275 11.6.1 File Descriptors .................................................................................................. 275 File Descriptor Table ......................................................................................... 276 11.6.2 Standard Input, Standard Output, and Standard Error .............................. 276 11.6.3 Standard I/O Redirection ................................................................................ 276 Issues with Standard I/O Redirection ........................................................... 277 11.6.4 Open and Close ................................................................................................. 278 11.6.5 Create and Remove ........................................................................................... 280 11.6.6 Read and Write .................................................................................................. 281 11.6.7 File Truncation ................................................................................................... 281 11.6.8 I/O Control ........................................................................................................ 282 11.6.9 Pend
ing
on Multiple File Descriptors with select( ) ..................................... 282 11.6.10 POSIX File System Routines ............................................................................ 284 11.7 Standard I/O ..................................................................................................................... 285 11.7.1 Configur
ing
VxWorks With Standard I/O .................................................... 285 11.7.2 About printf( ), sprintf( ), and scanf( ) ............................................................ 286 11.7.3 About Standard I/O and Buffer
ing
................................................................ 286 11.7.4 About Standard Input, Standard Output, and Standard Error .................. 287 11.8 Other Formatted I/O ....................................................................................................... 287 11.8.1 Output in Serial I/O Polled Mode: kprintf( ) ................................................ 287 Writ
ing
to User-Defined Storage Media With kprintf( ) and kputs( ) ....... 288 11.8.2 Additional Formatted I/O Routines ............................................................. 289 11.8.3 Message Logg
ing
............................................................................................... 289 11.9 Asynchronous Input/Output ......................................................................................... 289 11.9.1 The POSIX AIO Routines ................................................................................. 290 Contents xv 11.9.2 AIO Control Block ............................................................................................. 291 11.9.3 Us
ing
AIO ........................................................................................................... 292 AIO with Periodic Checks for Completion ................................................... 292 Alternatives for Test
ing
AIO Completion ..................................................... 294 12 Devices ........................................................................................................ 297 12.1 Introduction ...................................................................................................................... 297 12.2 About Devices in VxWorks ........................................................................................... 298 12.3 Serial I/O Devices: Terminal and Pseudo-Terminal Devices .................................. 299 tty Options .......................................................................................................... 299 12.3.1 Raw Mode and Line Mode .............................................................................. 300 12.3.2 tty Special Characters ....................................................................................... 300 12.3.3 I/O Control Functions ...................................................................................... 301 12.4 Pipe Devices ..................................................................................................................... 302 12.5 Pseudo I/O Device ........................................................................................................... 302 12.5.1 I/O Control Functions ...................................................................................... 303 12.6 Null Devices .................................................................................................................... 303 12.7 Block Devices ................................................................................................................... 303 12.7.1 XBD RAM Disk .................................................................................................. 305 12.7.2 SCSI Drivers ....................................................................................................... 306 Configur
ing
SCSI Drivers ................................................................................ 306 Structure of the SCSI Subsystem ..................................................................... 307 Boot
ing
and Initialization ................................................................................ 308 Device-Specific Configuration Options ......................................................... 308 SCSI Configuration Examples ......................................................................... 310 Troubleshoot
ing
................................................................................................. 312 12.8 Extended Block Device Facility: XBD ......................................................................... 313 12.8.1 XBD Disk Partition Manager ........................................................................... 313 12.8.2 XBD Block Device Wrapper ............................................................................. 314 12.8.3 XBD TRFS Component ..................................................................................... 314 12.9 PCMCIA ............................................................................................................................ 315 12.10 Peripheral Component Interconnect: PCI .................................................................. 315 12.11 Network File System (
NFS
) Devices ........................................................................... 315 12.11.1 I/O Control Functions for
NFS
Clients .......................................................... 316 12.12 Non-
NFS
Network Devices ........................................................................................... 317 VxWorks Kernel Programmer's Guide, 6.9 xvi 12.12.1 Creat
ing
Network Devices ............................................................................... 318 12.12.2 I/O Control Functions ...................................................................................... 318 12.13 Sockets ............................................................................................................................... 318 12.14 Internal I/O System Structure ....................................................................................... 319 12.14.1 Drivers ................................................................................................................ 321 The Driver Table and Install
ing
Drivers ........................................................ 322 Example of Install
ing
a Driver ........................................................................ 322 12.14.2 Devices ................................................................................................................ 323 The Device List and Add
ing
Devices ............................................................. 323 Example of Add
ing
Devices ............................................................................ 324 Delet
ing
Devices ................................................................................................ 324 12.14.3 File Descriptors .................................................................................................. 327 File Descriptor Table ......................................................................................... 327 Example of Open
ing
a File ............................................................................... 327 Example of Read
ing
Data from the File ......................................................... 330 Example of Clos
ing
a File ................................................................................. 331 Implement
ing
select( ) ...................................................................................... 331 Cache Coherency ............................................................................................... 334 13 Local File Systems ..................................................................................... 339 13.1 Introduction ...................................................................................................................... 339 13.2 File System Monitor ...................................................................................................... 341 Device Insertion Events .................................................................................... 342 XBD Name Mapp
ing
Facility .......................................................................... 343 13.3 Virtual Root File System: VRFS ................................................................................... 343 13.4 Highly Reliable File System: HRFS ............................................................................ 345 13.4.1 Configur
ing
VxWorks for HRFS ..................................................................... 345 13.4.2 Configur
ing
HRFS ............................................................................................ 346 13.4.3 Creat
ing
an HRFS File System ....................................................................... 347 Overview of HRFS File System Creation ....................................................... 347 HRFS File System Creation Steps ................................................................... 347 13.4.4 HRFS, ATA, and RAM Disk Examples .......................................................... 348 13.4.5 Optimiz
ing
HRFS Performance ...................................................................... 353 13.4.6 Transactional Operations and Commit Policies ......................................... 353 Automatic Commit Policy ............................................................................... 353 High-Speed Commit Policy ............................................................................. 354 Mandatory Commits ......................................................................................... 354 Rollbacks ............................................................................................................. 354 Programmatically Initiat
ing
Commits ........................................................... 354 13.4.7 File Access Time Stamps .................................................................................. 355 Contents xvii 13.4.8 Maximum Number of Files and Directories ................................................. 355 13.4.9 Work
ing
with Directories ................................................................................. 355 Creat
ing
Subdirectories .................................................................................... 355 Remov
ing
Subdirectories ................................................................................. 356 Read
ing
Directory Entries ................................................................................ 356 13.4.10 Work
ing
with Files ............................................................................................ 356 File I/O Routines ............................................................................................... 356 File Link
ing
and Unlink
ing
............................................................................. 356 File Permissions ................................................................................................. 357 13.4.11 I/O Control Functions Supported by HRFS ................................................. 357 13.4.12 Crash Recovery and Volume Consistency ..................................................... 358 Crash Recovery .................................................................................................. 358 Consistency Check
ing
...................................................................................... 358 13.4.13 File Management and Full Devices ................................................................ 358 13.5 MS-DOS-Compatible File System: dosFs .................................................................. 359 13.5.1 Configur
ing
VxWorks for dosFs ..................................................................... 360 13.5.2 Configur
ing
dosFs ............................................................................................ 361 13.5.3 Creat
ing
a dosFs File System ........................................................................... 362 Overview of dosFs File System Creation ....................................................... 362 dosFs File System Creation Steps ................................................................... 363 13.5.4 dosFs, ATA Disk, and RAM Disk Examples ................................................. 365 13.5.5 Optimiz
ing
dosFs Performance ...................................................................... 369 13.5.6 Work
ing
with Volumes and Disks .................................................................. 370 Access
ing
Volume Configuration Information ............................................. 370 Synchroniz
ing
Volumes .................................................................................... 370 13.5.7 Work
ing
with Directories ................................................................................. 370 Creat
ing
Subdirectories .................................................................................... 370 Remov
ing
Subdirectories ................................................................................. 371 Read
ing
Directory Entries ................................................................................ 371 13.5.8 Work
ing
with Files ............................................................................................ 371 File I/O Routines ............................................................................................... 371 File Attributes .................................................................................................... 371 13.5.9 Disk Space Allocation Options ........................................................................ 373 Choos
ing
an Allocation Method ..................................................................... 374 Us
ing
Cluster Group Allocation ..................................................................... 374 Us
ing
Absolutely Contiguous Allocation ...................................................... 374 13.5.10 Crash Recovery and Volume Consistency ..................................................... 376 13.5.11 I/O Control Functions Supported by dosFsLib ............................................ 376 13.5.12 Boot
ing
from a Local dosFs File System Us
ing
SCSI ................................... 378 13.6 Transaction-Based Reliable File System Support for dosFs: TRFS ....................... 380 VxWorks Kernel Programmer's Guide, 6.9 xviii 13.6.1 Configur
ing
VxWorks With TRFS ................................................................... 380 13.6.2 Automatic Instantiation of TRFS .................................................................... 380 13.6.3 Formatt
ing
a Device for TRFS ......................................................................... 381 13.6.4 Us
ing
TRFS in Applications ............................................................................ 382 TRFS Code Examples ....................................................................................... 382 13.7 Raw File System: rawFs ................................................................................................. 383 13.7.1 Configur
ing
VxWorks for rawFs ..................................................................... 383 13.7.2 Creat
ing
a rawFs File System .......................................................................... 383 13.7.3
Mount
ing
rawFs Volumes ................................................................................ 384 13.7.4 rawFs File I/O ................................................................................................... 385 13.7.5 I/O Control Functions Supported by rawFsLib ........................................... 385 13.8 CD-ROM File System: cdromFs ................................................................................... 386 13.8.1 Configur
ing
VxWorks for cdromFs ................................................................ 387 13.8.2 Creat
ing
and Us
ing
cdromFs ........................................................................... 387 13.8.3 I/O Control Functions Supported by cdromFsLib ...................................... 389 13.8.4 Version Numbers ............................................................................................... 390 13.9 Read-Only Memory File System: ROMFS ................................................................. 390 13.9.1 Configur
ing
VxWorks with ROMFS ............................................................... 391 13.9.2 Add
ing
a ROMFS Directory and File Content to VxWorks ........................ 391 13.9.3 Access
ing
Files in ROMFS ............................................................................... 392 13.9.4 Us
ing
ROMFS to Start Applications Automatically .................................... 392 13.10 Target Server File System: TSFS ................................................................................... 392 Socket Support ................................................................................................... 393 Error Handl
ing
.................................................................................................. 394 Configur
ing
VxWorks for TSFS Use ............................................................... 394 Security Considerations ................................................................................... 394 Us
ing
the TSFS to Boot a Target ...................................................................... 395 14 Flash File System Support: TrueFFS ........................................................ 397 14.1 Introduction ...................................................................................................................... 397 14.2 Overview of Implementation Steps ............................................................................ 398 14.3 Creat
ing
a VxWorks System with TrueFFS ................................................................ 400 14.3.1 Select
ing
an MTD .............................................................................................. 400 14.3.2 Identify
ing
the Socket Driver .......................................................................... 400 14.3.3 Configur
ing
VxWorks with TrueFFS and File System ................................. 401 Includ
ing
the Core TrueFFS Component ....................................................... 401 Includ
ing
the MTD Component ...................................................................... 402 Contents xix Includ
ing
the Translation Layer Component ................................................ 402 Includ
ing
the Socket Driver ............................................................................. 403 Includ
ing
the XBD Wrapper Component ...................................................... 403 Includ
ing
File System Components ............................................................... 403 Includ
ing
Utility Components ........................................................................ 403 14.3.4 Build
ing
the System .......................................................................................... 404 14.3.5 Formatt
ing
the Flash ......................................................................................... 404 Formatt
ing
With sysTffsFormat( ) .................................................................. 404 Formatt
ing
With tffsDevFormat( ) .................................................................. 405 14.3.6 Reserv
ing
a Region in Flash for a Boot Image .............................................. 406 Reserv
ing
a Fallow Region .............................................................................. 407 Writ
ing
the Boot Image to Flash ...................................................................... 408 14.3.7
Mount
ing
the Drive .......................................................................................... 409 14.3.8 Creat
ing
a File System ...................................................................................... 409 14.3.9 Test
ing
the Drive ............................................................................................... 410 14.4 Us
ing
TrueFFS Shell Commands ................................................................................. 410 14.5 Us
ing
TrueFFS With HRFS ............................................................................................
Linux System Administrator Guide Version0.9
Linux System Administrator Guide Version0.9
Table of Contents
About This Book.................................................................................................................................................1
1. Acknowledgments................................................................................................................................1
1.1. Joanna's acknowledgments.........................................................................................................1
1.2. Stephen's acknowledgments.......................................................................................................1
1.3. Alex's Acknowledgments...........................................................................................................2
2. Revision History..................................................................................................................................2
3. Source and pre-formatted versions available......................................................................................2
4. Typographical Conventions.................................................................................................................3
Chapter 1. Introduction......................................................................................................................................4
1.1. Linux or GNU/Linux, that is the question........................................................................................5
1.2. Trademarks.......................................................................................................................................5
Chapter 2. Overview of a Linux System...........................................................................................................7
2.1. Various parts of an operat
ing
system................................................................................................7
2.2. Important parts of the kernel.............................................................................................................7
2.3. Major services in a UNIX system.....................................................................................................8
2.3.1. init............................................................................................................................................9
2.3.2. Logins from terminals.............................................................................................................9
2.3.3. Syslog......................................................................................................................................9
2.3.4. Periodic command execution: cron and at............................................................................10
2.3.5. Graphical user interface.........................................................................................................10
2.3.6. Network
ing
............................................................................................................................10
2.3.7. Network logins......................................................................................................................11
2.3.8. Network file systems.............................................................................................................11
2.3.9. Mail.......................................................................................................................................11
2.3.10. Print
ing
................................................................................................................................12
2.3.11. The filesystem layout..........................................................................................................12
Chapter 3. Overview of the Directory Tree....................................................................................................13
3.1. Background.....................................................................................................................................13
3.2. The root filesystem.........................................................................................................................14
3.3. The/etc directory............................................................................................................................15
3.4. The/dev directory...........................................................................................................................17
3.5. The/usr filesystem..........................................................................................................................19
3.6. The/var filesystem..........................................................................................................................19
3.7. The/proc filesystem........................................................................................................................20
Chapter 4. Hardware, Devices, and Tools......................................................................................................22
4.1. Hardware Utilities...........................................................................................................................22
4.1.1. The MAKEDEV Script.........................................................................................................22
4.1.2. The mknod command............................................................................................................22
4.1.3. The lspci command...............................................................................................................23
4.1.4. The lsdev command...............................................................................................................23
4.1.5. The lsusb command...............................................................................................................23
4.1.6. The lsraid command..............................................................................................................23
4.1.7. The hdparm command...........................................................................................................23
4.1.8. More Hardware Resources....................................................................................................23
i
The Linux System Administrator's Guide
Table of Contents
Chapter 4. Hardware, Devices, and Tools
4.2. Kernel Modules...............................................................................................................................23
4.2.1. lsmod.....................................................................................................................................24
4.2.2. insmod...................................................................................................................................24
4.2.3. depmod..................................................................................................................................24
4.2.4. rmmod...................................................................................................................................24
4.2.5. modprobe...............................................................................................................................24
Chapter 5. Us
ing
Disks and Other Storage Media.........................................................................................25
5.1. Two kinds of devices......................................................................................................................25
5.2. Hard disks.......................................................................................................................................26
5.3. Storage Area Networks - Draft......................................................................................................28
5.4. Network Attached Storage - Draft.................................................................................................28
5.4.1.
NFS
........................................................................................................................................29
5.4.2. CIFS.......................................................................................................................................29
5.5. Floppies...........................................................................................................................................29
5.6. CD-ROMs......................................................................................................................................30
5.7. Tapes...............................................................................................................................................31
5.8. Formatt
ing
.......................................................................................................................................31
5.9. Partitions.........................................................................................................................................32
5.9.1. The MBR, boot sectors and partition table............................................................................33
5.9.2. Extended and logical partitions.............................................................................................33
5.9.3. Partition types........................................................................................................................34
5.9.4. Partition
ing
a hard disk..........................................................................................................35
5.9.5. Device files and partitions.....................................................................................................36
5.10.
Filesystems
....................................................................................................................................36
5.10.1. What are
filesystems
?..........................................................................................................36
5.10.2.
Filesystems
galore...............................................................................................................37
5.10.3. Which filesystem should be used?......................................................................................39
5.10.4. Creat
ing
a filesystem...........................................................................................................39
5.10.5. Filesystem block size...........................................................................................................40
5.10.6. Filesystem comparison........................................................................................................41
5.10.7.
Mount
ing
and un
mount
ing
..................................................................................................42
5.10.8. Filesystem Security.............................................................................................................45
5.10.9. Check
ing
filesystem integrity with fsck..............................................................................45
5.10.10. Check
ing
for disk errors with badblocks...........................................................................46
5.10.11. Fight
ing
fragmentation?....................................................................................................46
5.10.12. Other tools for all
filesystems
...........................................................................................47
5.10.13. Other tools for the ext2/ext3 filesystem............................................................................47
5.11. Disks without
filesystems
.............................................................................................................48
5.12. Allocat
ing
disk space....................................................................................................................49
5.12.1. Partition
ing
schemes............................................................................................................49
5.12.2. Logical Volume Manager (LVM).......................................................................................50
5.12.3. Space requirements..............................................................................................................50
5.12.4. Examples of hard disk allocation........................................................................................50
5.12.5. Add
ing
more disk space for Linux......................................................................................51
5.12.6. Tips for sav
ing
disk space...................................................................................................51
ii
The Linux System Administrator's Guide
Table of Contents
Chapter 6. Memory Management...................................................................................................................52
6.1. What is virtual memory?.................................................................................................................52
6.2. Creat
ing
a swap space.....................................................................................................................52
6.3. Us
ing
a swap space.........................................................................................................................53
6.4. Shar
ing
swap spaces with other operat
ing
systems........................................................................54
6.5. Allocat
ing
swap space.....................................................................................................................55
6.6. The buffer cache.............................................................................................................................56
Chapter 7. System Monitor
ing
.........................................................................................................................58
7.1. System Resources...........................................................................................................................58
7.1.1. The top command..................................................................................................................58
7.1.2. The iostat command..............................................................................................................59
7.1.3. The ps command...................................................................................................................60
7.1.4. The vmstat command............................................................................................................61
7.1.5. The lsof command.................................................................................................................61
7.1.6. Find
ing
More Utilities...........................................................................................................62
7.2. Filesystem Usage............................................................................................................................62
7.2.1. The df command....................................................................................................................62
7.2.2. The du command...................................................................................................................62
7.2.3. Quotas....................................................................................................................................63
7.3. Monitor
ing
Users............................................................................................................................63
7.3.1. The who command................................................................................................................63
7.3.2. The ps command -again!......................................................................................................64
7.3.3. The w command....................................................................................................................64
7.3.4. The skill command................................................................................................................64
7.3.5. nice and renice.......................................................................................................................64
Chapter 8. Boots And Shutdowns....................................................................................................................65
8.1. An overview of boots and shutdowns.............................................................................................65
8.2. The boot process in closer look......................................................................................................65
8.2.1. A Word About Bootloaders...................................................................................................67
8.3. More about shutdowns....................................................................................................................67
8.4. Reboot
ing
........................................................................................................................................68
8.5. S
ing
le user mode.............................................................................................................................69
8.6. Emergency boot floppies................................................................................................................69
Chapter 9. init....................................................................................................................................................70
9.1. init comes first................................................................................................................................70
9.2. Configur
ing
init to start getty: the/etc/inittab file..........................................................................70
9.3. Run levels.......................................................................................................................................71
9.4. Special configuration in/etc/inittab................................................................................................73
9.5. Boot
ing
in s
ing
le user mode...........................................................................................................73
Chapter 10. Logg
ing
In And Out.....................................................................................................................75
10.1. Logins via terminals......................................................................................................................75
10.2. Logins via the network..................................................................................................................76
10.3. What login does............................................................................................................................77
10.4. X and xdm.....................................................................................................................................78
iii
The Linux System Administrator's Guide
Table of Contents
Chapter 10. Logg
ing
In And Out
10.5. Access control...............................................................................................................................78
10.6. Shell startup..................................................................................................................................78
Chapter 11. Manag
ing
user accounts..............................................................................................................79
11.1. What's an account?........................................................................................................................79
11.2. Creat
ing
a user..............................................................................................................................79
11.2.1./etc/passwd and other informative files...............................................................................79
11.2.2. Pick
ing
numeric user and group ids....................................................................................80
11.2.3. Initial environment: /etc/skel...............................................................................................80
11.2.4. Creat
ing
a user by hand.......................................................................................................80
11.3. Chang
ing
user properties..............................................................................................................81
11.4. Remov
ing
a user...........................................................................................................................81
11.5. Disabl
ing
a user temporarily.........................................................................................................82
Chapter 12. Backups.........................................................................................................................................83
12.1. On the importance of be
ing
backed up.........................................................................................83
12.2. Select
ing
the backup medium.......................................................................................................83
12.3. Select
ing
the backup tool..............................................................................................................84
12.4. Simple backups.............................................................................................................................85
12.4.1. Mak
ing
backups with tar.....................................................................................................85
12.4.2. Restor
ing
files with tar........................................................................................................86
12.5. Multilevel backups........................................................................................................................87
12.6. What to back up............................................................................................................................88
12.7. Compressed backups.....................................................................................................................89
Chapter 13. Task Automation --To Be Added.............................................................................................90
Chapter 14. Keep
ing
Time...............................................................................................................................91
14.1. The concept of localtime...............................................................................................................91
14.2. The hardware and software clocks................................................................................................92
14.3. Show
ing
and sett
ing
time..............................................................................................................92
14.4. When the clock is wrong...............................................................................................................93
14.5. NTP - Network Time Protocol.....................................................................................................93
14.6. Basic NTP configuration...............................................................................................................94
14.7. NTP Toolkit..................................................................................................................................95
14.8. Some known NTP servers.............................................................................................................97
14.9. NTP Links.....................................................................................................................................97
Chapter 15. System Logs --To Be Added......................................................................................................98
Chapter 16. System Updates --To Be Added................................................................................................99
Chapter 17. The Linux Kernel Source..........................................................................................................100
Chapter 18. Find
ing
Help...............................................................................................................................101
18.1. Newsgroups and Mail
ing
Lists...................................................................................................101
18.1.1. Find
ing
The Right Forum..................................................................................................101
iv
The Linux System Administrator's Guide
Table of Contents
Chapter 18. Find
ing
Help
18.1.2. Before You Post................................................................................................................101
18.1.3. Writ
ing
Your Post.............................................................................................................101
18.1.4. Formatt
ing
Your Post........................................................................................................102
18.1.5. Follow Up..........................................................................................................................102
18.1.6. More Information..............................................................................................................102
18.2. IRC..............................................................................................................................................102
18.2.1. Colours..............................................................................................................................103
18.2.2. Be Polite............................................................................................................................103
18.2.3. Type Properly, in English..................................................................................................103
18.2.4. Port scann
ing
.....................................................................................................................103
18.2.5. Keep it in the Channel.......................................................................................................103
18.2.6. Stay On Topic....................................................................................................................104
18.2.7. CTCPs...............................................................................................................................104
18.2.8. Hack
ing
, Crack
ing
, Phreak
ing
, Warez
ing
.........................................................................104
18.2.9. Round Up..........................................................................................................................104
18.2.10. Further Read
ing
...............................................................................................................104
Appendix A. GNU Free Documentation License.........................................................................................105
A.1. PREAMBLE................................................................................................................................105
A.2. APPLICABILITY AND DEFINITIONS....................................................................................105
A.3. VERBATIM COPY
ING
..............................................................................................................106
A.4. COPY
ING
IN QUANTITY.........................................................................................................106
A.5. MODIFICATIONS......................................................................................................................107
A.6. COMBIN
ING
DOCUMENTS.....................................................................................................108
A.7. COLLECTIONS OF DOCUMENTS..........................................................................................109
A.8. AGGREGATION WITH INDEPENDENT WORKS.................................................................109
A.9. TRANSLATION..........................................................................................................................109
A.10. TERMINATION........................................................................................................................109
A.11. FUTURE REVISIONS OF THIS LICENSE.............................................................................110
A.12. ADDENDUM: How to use this License for your documents...................................................110
Glossary (DRAFT, but not for long hopefully)............................................................................................111
Index-Draft..........................................................................................................................................115
A....................................................................................................................................................115
B....................................................................................................................................................115
C....................................................................................................................................................115
D....................................................................................................................................................116
E.....................................................................................................................................................117
F.....................................................................................................................................................117
G....................................................................................................................................................120
H....................................................................................................................................................120
I......................................................................................................................................................120
K....................................................................................................................................................120
L.....................................................................................................................................................121
M...................................................................................................................................................121
N....................................................................................................................................................121
O....................................................................................................................................................121
v
The Linux System Administrator's Guide
Table of Contents
Glossary (DRAFT, but not for long hopefully)
P.....................................................................................................................................................121
R....................................................................................................................................................122
S.....................................................................................................................................................122
T.....................................................................................................................................................122
V....................................................................................................................................................122
W...................................................................................................................................................122
nfs
mount
failed: Connection timed out
linux挂载
NFS
的几个注意事项。在使用嵌入式Linux时,需要注意的几个
问题
。 1. 服务端需要开启
nfs
server 2. 本机挂载,检查服务是否成功。 3. 客户端通过P
ing
测试,检测网络连通。 4. 客户端需要支持
nfs
client,在内核中进行配置 $ make menuconfig ARCH=arm 开启对
NFS
客户端的支持。cat /proc/
filesystems
可以查看是否对
NFS
有支持。 5. 参数设置 由于没有加-o nolock参数导致错误:
mount
ing
...
mount
:
mount
ing
192.168.xx.xxx:/home/
nfs
on /mnt/ failed: No such device
出现这个
问题
的原因是,内核不支持
nfs
文件系统,需要配置内核使其支持
nfs
文件系统 1、进入到内核源码 2、make menuconfig 使用图形化界面进行配置 File systems—> [*] Network File Systems —>
系统维护与使用区
19,612
社区成员
74,603
社区内容
发帖
与我相关
我的任务
系统维护与使用区
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
复制链接
扫一扫
分享
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章