aboutsummaryrefslogtreecommitdiff
path: root/share/man
diff options
context:
space:
mode:
Diffstat (limited to 'share/man')
-rw-r--r--share/man/Makefile20
-rw-r--r--share/man/man1/Makefile95
-rw-r--r--share/man/man1/builtin.1332
-rw-r--r--share/man/man1/intro.184
-rw-r--r--share/man/man3/ATOMIC_VAR_INIT.3301
-rw-r--r--share/man/man3/Makefile312
-rw-r--r--share/man/man3/assert.394
-rw-r--r--share/man/man3/bitstring.3190
-rw-r--r--share/man/man3/end.383
-rw-r--r--share/man/man3/fpgetround.3180
-rw-r--r--share/man/man3/intro.3168
-rw-r--r--share/man/man3/makedev.390
-rw-r--r--share/man/man3/offsetof.347
-rw-r--r--share/man/man3/pthread.3550
-rw-r--r--share/man/man3/pthread_affinity_np.3156
-rw-r--r--share/man/man3/pthread_atfork.3117
-rw-r--r--share/man/man3/pthread_attr.3238
-rw-r--r--share/man/man3/pthread_attr_affinity_np.3162
-rw-r--r--share/man/man3/pthread_attr_get_np.3116
-rw-r--r--share/man/man3/pthread_attr_setcreatesuspend_np.372
-rw-r--r--share/man/man3/pthread_barrier_destroy.3158
-rw-r--r--share/man/man3/pthread_barrierattr.3148
-rw-r--r--share/man/man3/pthread_cancel.381
-rw-r--r--share/man/man3/pthread_cleanup_pop.366
-rw-r--r--share/man/man3/pthread_cleanup_push.368
-rw-r--r--share/man/man3/pthread_cond_broadcast.372
-rw-r--r--share/man/man3/pthread_cond_destroy.379
-rw-r--r--share/man/man3/pthread_cond_init.383
-rw-r--r--share/man/man3/pthread_cond_signal.372
-rw-r--r--share/man/man3/pthread_cond_timedwait.3101
-rw-r--r--share/man/man3/pthread_cond_wait.389
-rw-r--r--share/man/man3/pthread_condattr.3174
-rw-r--r--share/man/man3/pthread_create.3129
-rw-r--r--share/man/man3/pthread_detach.391
-rw-r--r--share/man/man3/pthread_equal.369
-rw-r--r--share/man/man3/pthread_exit.3106
-rw-r--r--share/man/man3/pthread_getconcurrency.3115
-rw-r--r--share/man/man3/pthread_getspecific.385
-rw-r--r--share/man/man3/pthread_getthreadid_np.356
-rw-r--r--share/man/man3/pthread_join.3140
-rw-r--r--share/man/man3/pthread_key_create.3109
-rw-r--r--share/man/man3/pthread_key_delete.3100
-rw-r--r--share/man/man3/pthread_kill.377
-rw-r--r--share/man/man3/pthread_main_np.360
-rw-r--r--share/man/man3/pthread_multi_np.366
-rw-r--r--share/man/man3/pthread_mutex_destroy.374
-rw-r--r--share/man/man3/pthread_mutex_init.378
-rw-r--r--share/man/man3/pthread_mutex_lock.376
-rw-r--r--share/man/man3/pthread_mutex_timedlock.3103
-rw-r--r--share/man/man3/pthread_mutex_trylock.377
-rw-r--r--share/man/man3/pthread_mutex_unlock.376
-rw-r--r--share/man/man3/pthread_mutexattr.3187
-rw-r--r--share/man/man3/pthread_mutexattr_getkind_np.381
-rw-r--r--share/man/man3/pthread_once.3107
-rw-r--r--share/man/man3/pthread_resume_all_np.351
-rw-r--r--share/man/man3/pthread_resume_np.372
-rw-r--r--share/man/man3/pthread_rwlock_destroy.383
-rw-r--r--share/man/man3/pthread_rwlock_init.3102
-rw-r--r--share/man/man3/pthread_rwlock_rdlock.3127
-rw-r--r--share/man/man3/pthread_rwlock_timedrdlock.3118
-rw-r--r--share/man/man3/pthread_rwlock_timedwrlock.3108
-rw-r--r--share/man/man3/pthread_rwlock_unlock.382
-rw-r--r--share/man/man3/pthread_rwlock_wrlock.3106
-rw-r--r--share/man/man3/pthread_rwlockattr_destroy.372
-rw-r--r--share/man/man3/pthread_rwlockattr_getpshared.386
-rw-r--r--share/man/man3/pthread_rwlockattr_init.371
-rw-r--r--share/man/man3/pthread_rwlockattr_setpshared.394
-rw-r--r--share/man/man3/pthread_schedparam.3100
-rw-r--r--share/man/man3/pthread_self.363
-rw-r--r--share/man/man3/pthread_set_name_np.352
-rw-r--r--share/man/man3/pthread_setspecific.398
-rw-r--r--share/man/man3/pthread_sigmask.399
-rw-r--r--share/man/man3/pthread_spin_init.3138
-rw-r--r--share/man/man3/pthread_spin_lock.3138
-rw-r--r--share/man/man3/pthread_suspend_all_np.353
-rw-r--r--share/man/man3/pthread_suspend_np.370
-rw-r--r--share/man/man3/pthread_switch_add_np.387
-rw-r--r--share/man/man3/pthread_testcancel.3210
-rw-r--r--share/man/man3/pthread_yield.330
-rw-r--r--share/man/man3/queue.31044
-rw-r--r--share/man/man3/siginfo.3305
-rw-r--r--share/man/man3/stdarg.3232
-rw-r--r--share/man/man3/sysexits.3144
-rw-r--r--share/man/man3/tgmath.3162
-rw-r--r--share/man/man3/timeradd.3119
-rw-r--r--share/man/man3/tree.3504
-rw-r--r--share/man/man4/Makefile759
-rw-r--r--share/man/man4/aac.4302
-rw-r--r--share/man/man4/acpi.4635
-rw-r--r--share/man/man4/acpi_asus.4186
-rw-r--r--share/man/man4/acpi_dock.462
-rw-r--r--share/man/man4/acpi_fujitsu.4175
-rw-r--r--share/man/man4/acpi_hp.4287
-rw-r--r--share/man/man4/acpi_ibm.4461
-rw-r--r--share/man/man4/acpi_panasonic.4178
-rw-r--r--share/man/man4/acpi_sony.482
-rw-r--r--share/man/man4/acpi_thermal.4149
-rw-r--r--share/man/man4/acpi_toshiba.4128
-rw-r--r--share/man/man4/acpi_video.489
-rw-r--r--share/man/man4/acpi_wmi.496
-rw-r--r--share/man/man4/ada.4152
-rw-r--r--share/man/man4/adv.4240
-rw-r--r--share/man/man4/adw.4104
-rw-r--r--share/man/man4/ae.4152
-rw-r--r--share/man/man4/aesni.494
-rw-r--r--share/man/man4/age.4187
-rw-r--r--share/man/man4/agp.4177
-rw-r--r--share/man/man4/aha.4136
-rw-r--r--share/man/man4/ahb.492
-rw-r--r--share/man/man4/ahc.4446
-rw-r--r--share/man/man4/ahci.4172
-rw-r--r--share/man/man4/ahd.4180
-rw-r--r--share/man/man4/aibs.4207
-rw-r--r--share/man/man4/aio.468
-rw-r--r--share/man/man4/alc.4168
-rw-r--r--share/man/man4/ale.4162
-rw-r--r--share/man/man4/alpm.462
-rw-r--r--share/man/man4/altq.4193
-rw-r--r--share/man/man4/amdpm.472
-rw-r--r--share/man/man4/amdsbwd.474
-rw-r--r--share/man/man4/amdsmb.454
-rw-r--r--share/man/man4/amdtemp.4111
-rw-r--r--share/man/man4/amr.4241
-rw-r--r--share/man/man4/an.4144
-rw-r--r--share/man/man4/apic.477
-rw-r--r--share/man/man4/arcmsr.4158
-rw-r--r--share/man/man4/asmc.4163
-rw-r--r--share/man/man4/asr.4115
-rw-r--r--share/man/man4/ata.4268
-rw-r--r--share/man/man4/atapicam.4134
-rw-r--r--share/man/man4/ataraid.4148
-rw-r--r--share/man/man4/ath.4302
-rw-r--r--share/man/man4/ath_ahb.460
-rw-r--r--share/man/man4/ath_hal.4142
-rw-r--r--share/man/man4/ath_pci.457
-rw-r--r--share/man/man4/atkbd.4230
-rw-r--r--share/man/man4/atkbdc.4119
-rw-r--r--share/man/man4/atp.4180
-rw-r--r--share/man/man4/atrtc.457
-rw-r--r--share/man/man4/attimer.477
-rw-r--r--share/man/man4/audit.4139
-rw-r--r--share/man/man4/auditpipe.4256
-rw-r--r--share/man/man4/aue.4205
-rw-r--r--share/man/man4/axe.4256
-rw-r--r--share/man/man4/bce.4366
-rw-r--r--share/man/man4/bfe.4109
-rw-r--r--share/man/man4/bge.4264
-rw-r--r--share/man/man4/bktr.4266
-rw-r--r--share/man/man4/blackhole.484
-rw-r--r--share/man/man4/bpf.41106
-rw-r--r--share/man/man4/bridge.4448
-rw-r--r--share/man/man4/bt.4203
-rw-r--r--share/man/man4/bwi.4148
-rw-r--r--share/man/man4/bwn.4156
-rw-r--r--share/man/man4/capsicum.4120
-rw-r--r--share/man/man4/cardbus.459
-rw-r--r--share/man/man4/carp.4301
-rw-r--r--share/man/man4/cas.4159
-rw-r--r--share/man/man4/cc_chd.4128
-rw-r--r--share/man/man4/cc_cubic.4114
-rw-r--r--share/man/man4/cc_hd.4120
-rw-r--r--share/man/man4/cc_htcp.4136
-rw-r--r--share/man/man4/cc_newreno.482
-rw-r--r--share/man/man4/cc_vegas.4136
-rw-r--r--share/man/man4/ccd.4287
-rw-r--r--share/man/man4/cd.4538
-rw-r--r--share/man/man4/cdce.4155
-rw-r--r--share/man/man4/ch.4351
-rw-r--r--share/man/man4/ciss.4175
-rw-r--r--share/man/man4/cm.4173
-rw-r--r--share/man/man4/cmx.4120
-rw-r--r--share/man/man4/coda.482
-rw-r--r--share/man/man4/coretemp.474
-rw-r--r--share/man/man4/cpuctl.4154
-rw-r--r--share/man/man4/cpufreq.4307
-rw-r--r--share/man/man4/crypto.4126
-rw-r--r--share/man/man4/cue.4113
-rw-r--r--share/man/man4/cxgb.4134
-rw-r--r--share/man/man4/cxgbe.4230
-rw-r--r--share/man/man4/cy.4261
-rw-r--r--share/man/man4/da.4217
-rw-r--r--share/man/man4/dc.4450
-rw-r--r--share/man/man4/dcons.4125
-rw-r--r--share/man/man4/dcons_crom.461
-rw-r--r--share/man/man4/ddb.41474
-rw-r--r--share/man/man4/de.4149
-rw-r--r--share/man/man4/devctl.4128
-rw-r--r--share/man/man4/digi.4381
-rw-r--r--share/man/man4/disc.480
-rw-r--r--share/man/man4/divert.4192
-rw-r--r--share/man/man4/dpms.457
-rw-r--r--share/man/man4/dpt.4115
-rw-r--r--share/man/man4/dummynet.479
-rw-r--r--share/man/man4/ed.4448
-rw-r--r--share/man/man4/edsc.4111
-rw-r--r--share/man/man4/ef.4111
-rw-r--r--share/man/man4/ehci.4101
-rw-r--r--share/man/man4/em.4289
-rw-r--r--share/man/man4/en.478
-rw-r--r--share/man/man4/enc.4133
-rw-r--r--share/man/man4/epair.4119
-rw-r--r--share/man/man4/esp.4115
-rw-r--r--share/man/man4/et.4186
-rw-r--r--share/man/man4/eventtimers.4161
-rw-r--r--share/man/man4/exca.440
-rw-r--r--share/man/man4/faith.4133
-rw-r--r--share/man/man4/fatm.4115
-rw-r--r--share/man/man4/fd.4105
-rw-r--r--share/man/man4/fdc.4343
-rw-r--r--share/man/man4/fdt.4184
-rw-r--r--share/man/man4/fdtbus.487
-rw-r--r--share/man/man4/ffclock.4129
-rw-r--r--share/man/man4/firewire.4119
-rw-r--r--share/man/man4/fpa.458
-rw-r--r--share/man/man4/fwe.496
-rw-r--r--share/man/man4/fwip.495
-rw-r--r--share/man/man4/fwohci.4158
-rw-r--r--share/man/man4/fxp.4220
-rw-r--r--share/man/man4/gbde.4304
-rw-r--r--share/man/man4/gdb.4603
-rw-r--r--share/man/man4/gem.4148
-rw-r--r--share/man/man4/geom.4467
-rw-r--r--share/man/man4/geom_fox.4214
-rw-r--r--share/man/man4/geom_linux_lvm.488
-rw-r--r--share/man/man4/geom_map.4211
-rw-r--r--share/man/man4/geom_uzip.4105
-rw-r--r--share/man/man4/gif.4287
-rw-r--r--share/man/man4/gpib.4100
-rw-r--r--share/man/man4/gre.4340
-rw-r--r--share/man/man4/h_ertt.4143
-rw-r--r--share/man/man4/harp.466
-rw-r--r--share/man/man4/hatm.4282
-rw-r--r--share/man/man4/hfa.4139
-rw-r--r--share/man/man4/hifn.4134
-rw-r--r--share/man/man4/hme.4151
-rw-r--r--share/man/man4/hpet.4108
-rw-r--r--share/man/man4/hpt27xx.4101
-rw-r--r--share/man/man4/hptiop.4106
-rw-r--r--share/man/man4/hptmv.4101
-rw-r--r--share/man/man4/hptrr.4137
-rw-r--r--share/man/man4/hwpmc.4833
-rw-r--r--share/man/man4/ichsmb.457
-rw-r--r--share/man/man4/ichwd.490
-rw-r--r--share/man/man4/icmp.4254
-rw-r--r--share/man/man4/icmp6.4265
-rw-r--r--share/man/man4/ida.484
-rw-r--r--share/man/man4/idt.460
-rw-r--r--share/man/man4/ifmib.4190
-rw-r--r--share/man/man4/igb.4215
-rw-r--r--share/man/man4/igmp.4138
-rw-r--r--share/man/man4/iic.4188
-rw-r--r--share/man/man4/iicbb.458
-rw-r--r--share/man/man4/iicbus.4118
-rw-r--r--share/man/man4/iicsmb.456
-rw-r--r--share/man/man4/iir.477
-rw-r--r--share/man/man4/inet.4309
-rw-r--r--share/man/man4/inet6.4457
-rw-r--r--share/man/man4/intpm.463
-rw-r--r--share/man/man4/intro.4178
-rw-r--r--share/man/man4/io.4130
-rw-r--r--share/man/man4/ip.4854
-rw-r--r--share/man/man4/ip6.4701
-rw-r--r--share/man/man4/ipfirewall.497
-rw-r--r--share/man/man4/ipmi.4201
-rw-r--r--share/man/man4/ips.4204
-rw-r--r--share/man/man4/ipsec.4415
-rw-r--r--share/man/man4/ipw.4155
-rw-r--r--share/man/man4/ipwfw.475
-rw-r--r--share/man/man4/isci.4112
-rw-r--r--share/man/man4/iscsi_initiator.4109
-rw-r--r--share/man/man4/isp.4238
-rw-r--r--share/man/man4/ispfw.459
-rw-r--r--share/man/man4/iwi.4160
-rw-r--r--share/man/man4/iwifw.475
-rw-r--r--share/man/man4/iwn.4182
-rw-r--r--share/man/man4/iwnfw.474
-rw-r--r--share/man/man4/ixgb.4125
-rw-r--r--share/man/man4/ixgbe.4126
-rw-r--r--share/man/man4/jme.4197
-rw-r--r--share/man/man4/joy.4119
-rw-r--r--share/man/man4/kbdmux.456
-rw-r--r--share/man/man4/keyboard.4170
-rw-r--r--share/man/man4/kld.4175
-rw-r--r--share/man/man4/ksyms.4158
-rw-r--r--share/man/man4/ktr.4206
-rw-r--r--share/man/man4/kue.4142
-rw-r--r--share/man/man4/lagg.4203
-rw-r--r--share/man/man4/le.4476
-rw-r--r--share/man/man4/led.4193
-rw-r--r--share/man/man4/lge.4157
-rw-r--r--share/man/man4/lindev.473
-rw-r--r--share/man/man4/linux.4145
-rw-r--r--share/man/man4/lmc.4764
-rw-r--r--share/man/man4/lo.490
-rw-r--r--share/man/man4/lp.4245
-rw-r--r--share/man/man4/lpbb.479
-rw-r--r--share/man/man4/lpt.498
-rw-r--r--share/man/man4/mac.4254
-rw-r--r--share/man/man4/mac_biba.4236
-rw-r--r--share/man/man4/mac_bsdextended.4149
-rw-r--r--share/man/man4/mac_ifoff.4133
-rw-r--r--share/man/man4/mac_lomac.4221
-rw-r--r--share/man/man4/mac_mls.4251
-rw-r--r--share/man/man4/mac_none.4113
-rw-r--r--share/man/man4/mac_partition.4133
-rw-r--r--share/man/man4/mac_portacl.4217
-rw-r--r--share/man/man4/mac_seeotheruids.4131
-rw-r--r--share/man/man4/mac_stub.4116
-rw-r--r--share/man/man4/mac_test.4117
-rw-r--r--share/man/man4/malo.4127
-rw-r--r--share/man/man4/man4.arm/Makefile10
-rw-r--r--share/man/man4/man4.arm/mge.4158
-rw-r--r--share/man/man4/man4.arm/npe.4163
-rw-r--r--share/man/man4/man4.i386/CPU_ELAN.4159
-rw-r--r--share/man/man4/man4.i386/Makefile41
-rw-r--r--share/man/man4/man4.i386/aic.484
-rw-r--r--share/man/man4/man4.i386/apm.4158
-rw-r--r--share/man/man4/man4.i386/ce.4111
-rw-r--r--share/man/man4/man4.i386/cp.4113
-rw-r--r--share/man/man4/man4.i386/cs.4152
-rw-r--r--share/man/man4/man4.i386/ct.4162
-rw-r--r--share/man/man4/man4.i386/ctau.4119
-rw-r--r--share/man/man4/man4.i386/cx.4139
-rw-r--r--share/man/man4/man4.i386/ep.4212
-rw-r--r--share/man/man4/man4.i386/ex.4119
-rw-r--r--share/man/man4/man4.i386/fe.4318
-rw-r--r--share/man/man4/man4.i386/glxiic.4106
-rw-r--r--share/man/man4/man4.i386/glxsb.497
-rw-r--r--share/man/man4/man4.i386/ie.4143
-rw-r--r--share/man/man4/man4.i386/longrun.467
-rw-r--r--share/man/man4/man4.i386/mse.4385
-rw-r--r--share/man/man4/man4.i386/npx.4111
-rw-r--r--share/man/man4/man4.i386/pae.4127
-rw-r--r--share/man/man4/man4.i386/pbio.4187
-rw-r--r--share/man/man4/man4.i386/perfmon.4213
-rw-r--r--share/man/man4/man4.i386/pnp.490
-rw-r--r--share/man/man4/man4.i386/pnpbios.485
-rw-r--r--share/man/man4/man4.i386/sbni.4132
-rw-r--r--share/man/man4/man4.i386/smapi.4153
-rw-r--r--share/man/man4/man4.i386/snc.4142
-rw-r--r--share/man/man4/man4.i386/streams.485
-rw-r--r--share/man/man4/man4.i386/svr4.4225
-rw-r--r--share/man/man4/man4.i386/vpd.490
-rw-r--r--share/man/man4/man4.i386/vx.4140
-rw-r--r--share/man/man4/man4.i386/wl.4191
-rw-r--r--share/man/man4/man4.powerpc/Makefile18
-rw-r--r--share/man/man4/man4.powerpc/abtn.4115
-rw-r--r--share/man/man4/man4.powerpc/adb.470
-rw-r--r--share/man/man4/man4.powerpc/akbd.4105
-rw-r--r--share/man/man4/man4.powerpc/ams.487
-rw-r--r--share/man/man4/man4.powerpc/bm.487
-rw-r--r--share/man/man4/man4.powerpc/cuda.479
-rw-r--r--share/man/man4/man4.powerpc/pmu.4116
-rw-r--r--share/man/man4/man4.powerpc/powermac_nvram.465
-rw-r--r--share/man/man4/man4.powerpc/smu.4125
-rw-r--r--share/man/man4/man4.powerpc/snd_ai2s.488
-rw-r--r--share/man/man4/man4.powerpc/snd_davbus.481
-rw-r--r--share/man/man4/man4.powerpc/tsec.4154
-rw-r--r--share/man/man4/man4.sparc64/Makefile22
-rw-r--r--share/man/man4/man4.sparc64/auxio.480
-rw-r--r--share/man/man4/man4.sparc64/central.460
-rw-r--r--share/man/man4/man4.sparc64/clkbrd.488
-rw-r--r--share/man/man4/man4.sparc64/creator.488
-rw-r--r--share/man/man4/man4.sparc64/ebus.4122
-rw-r--r--share/man/man4/man4.sparc64/eeprom.4130
-rw-r--r--share/man/man4/man4.sparc64/fhc.482
-rw-r--r--share/man/man4/man4.sparc64/machfb.4180
-rw-r--r--share/man/man4/man4.sparc64/ofw_console.4126
-rw-r--r--share/man/man4/man4.sparc64/openfirm.4300
-rw-r--r--share/man/man4/man4.sparc64/openprom.4240
-rw-r--r--share/man/man4/man4.sparc64/rtc.488
-rw-r--r--share/man/man4/man4.sparc64/sbus.479
-rw-r--r--share/man/man4/man4.sparc64/snd_audiocs.488
-rw-r--r--share/man/man4/mcd.4169
-rw-r--r--share/man/man4/md.4114
-rw-r--r--share/man/man4/mem.4211
-rw-r--r--share/man/man4/meteor.4873
-rw-r--r--share/man/man4/mfi.4127
-rw-r--r--share/man/man4/miibus.4191
-rw-r--r--share/man/man4/mk48txx.4228
-rw-r--r--share/man/man4/mld.4106
-rw-r--r--share/man/man4/mlx.4256
-rw-r--r--share/man/man4/mly.4272
-rw-r--r--share/man/man4/mmc.460
-rw-r--r--share/man/man4/mmcsd.448
-rw-r--r--share/man/man4/mn.455
-rw-r--r--share/man/man4/mod_cc.4117
-rw-r--r--share/man/man4/mos.497
-rw-r--r--share/man/man4/mouse.4403
-rw-r--r--share/man/man4/mps.4216
-rw-r--r--share/man/man4/mpt.4186
-rw-r--r--share/man/man4/msk.4256
-rw-r--r--share/man/man4/mtio.4307
-rw-r--r--share/man/man4/multicast.41011
-rw-r--r--share/man/man4/mvs.4177
-rw-r--r--share/man/man4/mwl.4193
-rw-r--r--share/man/man4/mwlfw.452
-rw-r--r--share/man/man4/mxge.4186
-rw-r--r--share/man/man4/my.490
-rw-r--r--share/man/man4/natm.4101
-rw-r--r--share/man/man4/natmip.4248
-rw-r--r--share/man/man4/ncr.491
-rw-r--r--share/man/man4/ncv.4133
-rw-r--r--share/man/man4/ndis.4153
-rw-r--r--share/man/man4/net80211.41318
-rw-r--r--share/man/man4/netgraph.41480
-rw-r--r--share/man/man4/netintro.4442
-rw-r--r--share/man/man4/netmap.4304
-rw-r--r--share/man/man4/nfe.4203
-rw-r--r--share/man/man4/nfsmb.454
-rw-r--r--share/man/man4/ng_UI.493
-rw-r--r--share/man/man4/ng_async.4173
-rw-r--r--share/man/man4/ng_atm.4416
-rw-r--r--share/man/man4/ng_atmllc.496
-rw-r--r--share/man/man4/ng_bluetooth.4112
-rw-r--r--share/man/man4/ng_bpf.4191
-rw-r--r--share/man/man4/ng_bridge.4213
-rw-r--r--share/man/man4/ng_bt3c.4129
-rw-r--r--share/man/man4/ng_btsocket.4354
-rw-r--r--share/man/man4/ng_car.4214
-rw-r--r--share/man/man4/ng_ccatm.4324
-rw-r--r--share/man/man4/ng_cisco.4184
-rw-r--r--share/man/man4/ng_deflate.4158
-rw-r--r--share/man/man4/ng_device.496
-rw-r--r--share/man/man4/ng_echo.473
-rw-r--r--share/man/man4/ng_eiface.4122
-rw-r--r--share/man/man4/ng_etf.4155
-rw-r--r--share/man/man4/ng_ether.4241
-rw-r--r--share/man/man4/ng_ether_echo.477
-rw-r--r--share/man/man4/ng_fec.4109
-rw-r--r--share/man/man4/ng_frame_relay.499
-rw-r--r--share/man/man4/ng_gif.4126
-rw-r--r--share/man/man4/ng_gif_demux.4107
-rw-r--r--share/man/man4/ng_h4.4123
-rw-r--r--share/man/man4/ng_hci.4387
-rw-r--r--share/man/man4/ng_hole.491
-rw-r--r--share/man/man4/ng_hub.475
-rw-r--r--share/man/man4/ng_iface.4171
-rw-r--r--share/man/man4/ng_ip_input.4102
-rw-r--r--share/man/man4/ng_ipfw.4117
-rw-r--r--share/man/man4/ng_ksocket.4242
-rw-r--r--share/man/man4/ng_l2cap.4422
-rw-r--r--share/man/man4/ng_l2tp.4330
-rw-r--r--share/man/man4/ng_lmi.4138
-rw-r--r--share/man/man4/ng_mppc.4194
-rw-r--r--share/man/man4/ng_nat.4325
-rw-r--r--share/man/man4/ng_netflow.4348
-rw-r--r--share/man/man4/ng_one2many.4277
-rw-r--r--share/man/man4/ng_patch.4235
-rw-r--r--share/man/man4/ng_ppp.4460
-rw-r--r--share/man/man4/ng_pppoe.4507
-rw-r--r--share/man/man4/ng_pptpgre.4178
-rw-r--r--share/man/man4/ng_pred1.4145
-rw-r--r--share/man/man4/ng_rfc1490.4141
-rw-r--r--share/man/man4/ng_socket.4189
-rw-r--r--share/man/man4/ng_source.4349
-rw-r--r--share/man/man4/ng_split.488
-rw-r--r--share/man/man4/ng_sppp.4172
-rw-r--r--share/man/man4/ng_sscfu.4161
-rw-r--r--share/man/man4/ng_sscop.4403
-rw-r--r--share/man/man4/ng_tag.4338
-rw-r--r--share/man/man4/ng_tcpmss.4125
-rw-r--r--share/man/man4/ng_tee.4134
-rw-r--r--share/man/man4/ng_tty.4129
-rw-r--r--share/man/man4/ng_ubt.4123
-rw-r--r--share/man/man4/ng_uni.4420
-rw-r--r--share/man/man4/ng_vjc.4238
-rw-r--r--share/man/man4/ng_vlan.4145
-rw-r--r--share/man/man4/ngatmbase.4134
-rw-r--r--share/man/man4/nge.4227
-rw-r--r--share/man/man4/nmdm.485
-rw-r--r--share/man/man4/nsp.498
-rw-r--r--share/man/man4/null.460
-rw-r--r--share/man/man4/nve.4141
-rw-r--r--share/man/man4/nvram.493
-rw-r--r--share/man/man4/nvram2env.4118
-rw-r--r--share/man/man4/nxge.497
-rw-r--r--share/man/man4/oce.4135
-rw-r--r--share/man/man4/ohci.478
-rw-r--r--share/man/man4/orm.447
-rw-r--r--share/man/man4/padlock.497
-rw-r--r--share/man/man4/pass.4120
-rw-r--r--share/man/man4/patm.4192
-rw-r--r--share/man/man4/pccard.478
-rw-r--r--share/man/man4/pccbb.4183
-rw-r--r--share/man/man4/pcf.472
-rw-r--r--share/man/man4/pci.4343
-rw-r--r--share/man/man4/pcib.449
-rw-r--r--share/man/man4/pcic.4103
-rw-r--r--share/man/man4/pcii.497
-rw-r--r--share/man/man4/pcm.4796
-rw-r--r--share/man/man4/pcn.4191
-rw-r--r--share/man/man4/pim.4201
-rw-r--r--share/man/man4/polling.4221
-rw-r--r--share/man/man4/ppbus.4363
-rw-r--r--share/man/man4/ppc.4136
-rw-r--r--share/man/man4/ppi.4107
-rw-r--r--share/man/man4/psm.4865
-rw-r--r--share/man/man4/pst.476
-rw-r--r--share/man/man4/pt.491
-rw-r--r--share/man/man4/pts.4162
-rw-r--r--share/man/man4/pty.497
-rw-r--r--share/man/man4/puc.457
-rw-r--r--share/man/man4/qlxgb.493
-rw-r--r--share/man/man4/ral.4259
-rw-r--r--share/man/man4/random.4326
-rw-r--r--share/man/man4/rc.4125
-rw-r--r--share/man/man4/re.4285
-rw-r--r--share/man/man4/rgephy.496
-rw-r--r--share/man/man4/rl.4310
-rw-r--r--share/man/man4/rndtest.472
-rw-r--r--share/man/man4/route.4335
-rw-r--r--share/man/man4/rp.4195
-rw-r--r--share/man/man4/rue.4154
-rw-r--r--share/man/man4/rum.4187
-rw-r--r--share/man/man4/run.4229
-rw-r--r--share/man/man4/runfw.450
-rw-r--r--share/man/man4/sa.4247
-rw-r--r--share/man/man4/safe.4129
-rw-r--r--share/man/man4/sbp.497
-rw-r--r--share/man/man4/sbp_targ.498
-rw-r--r--share/man/man4/scc.475
-rw-r--r--share/man/man4/scd.474
-rw-r--r--share/man/man4/sched_4bsd.474
-rw-r--r--share/man/man4/sched_ule.473
-rw-r--r--share/man/man4/screen.4241
-rw-r--r--share/man/man4/scsi.4363
-rw-r--r--share/man/man4/sctp.4425
-rw-r--r--share/man/man4/sdhci.488
-rw-r--r--share/man/man4/sem.477
-rw-r--r--share/man/man4/send.4217
-rw-r--r--share/man/man4/ses.4134
-rw-r--r--share/man/man4/sf.4209
-rw-r--r--share/man/man4/sfxge.496
-rw-r--r--share/man/man4/sge.4121
-rw-r--r--share/man/man4/si.4181
-rw-r--r--share/man/man4/siba.490
-rw-r--r--share/man/man4/siftr.4758
-rw-r--r--share/man/man4/siis.4139
-rw-r--r--share/man/man4/simplebus.481
-rw-r--r--share/man/man4/sio.4414
-rw-r--r--share/man/man4/sis.4226
-rw-r--r--share/man/man4/sk.4241
-rw-r--r--share/man/man4/smb.4204
-rw-r--r--share/man/man4/smbus.480
-rw-r--r--share/man/man4/smp.4163
-rw-r--r--share/man/man4/sn.4109
-rw-r--r--share/man/man4/snd_ad1816.481
-rw-r--r--share/man/man4/snd_als4000.470
-rw-r--r--share/man/man4/snd_atiixp.4100
-rw-r--r--share/man/man4/snd_cmi.476
-rw-r--r--share/man/man4/snd_cs4281.470
-rw-r--r--share/man/man4/snd_csa.498
-rw-r--r--share/man/man4/snd_ds1.472
-rw-r--r--share/man/man4/snd_emu10k1.482
-rw-r--r--share/man/man4/snd_emu10kx.4296
-rw-r--r--share/man/man4/snd_envy24.482
-rw-r--r--share/man/man4/snd_envy24ht.4105
-rw-r--r--share/man/man4/snd_es137x.4117
-rw-r--r--share/man/man4/snd_ess.472
-rw-r--r--share/man/man4/snd_fm801.478
-rw-r--r--share/man/man4/snd_gusc.497
-rw-r--r--share/man/man4/snd_hda.4635
-rw-r--r--share/man/man4/snd_hdspe.476
-rw-r--r--share/man/man4/snd_ich.4111
-rw-r--r--share/man/man4/snd_maestro.478
-rw-r--r--share/man/man4/snd_maestro3.494
-rw-r--r--share/man/man4/snd_mss.4116
-rw-r--r--share/man/man4/snd_neomagic.474
-rw-r--r--share/man/man4/snd_sbc.4132
-rw-r--r--share/man/man4/snd_solo.466
-rw-r--r--share/man/man4/snd_spicds.489
-rw-r--r--share/man/man4/snd_t4dwave.477
-rw-r--r--share/man/man4/snd_uaudio.4102
-rw-r--r--share/man/man4/snd_via8233.4105
-rw-r--r--share/man/man4/snd_via82c686.471
-rw-r--r--share/man/man4/snd_vibes.471
-rw-r--r--share/man/man4/snp.499
-rw-r--r--share/man/man4/spic.461
-rw-r--r--share/man/man4/spkr.4249
-rw-r--r--share/man/man4/splash.4293
-rw-r--r--share/man/man4/sppp.4240
-rw-r--r--share/man/man4/ste.4204
-rw-r--r--share/man/man4/stf.4267
-rw-r--r--share/man/man4/stg.4110
-rw-r--r--share/man/man4/stge.4202
-rw-r--r--share/man/man4/sym.4382
-rw-r--r--share/man/man4/syncache.4215
-rw-r--r--share/man/man4/syncer.492
-rw-r--r--share/man/man4/syscons.4565
-rw-r--r--share/man/man4/sysmouse.4477
-rw-r--r--share/man/man4/tap.4317
-rw-r--r--share/man/man4/targ.4152
-rw-r--r--share/man/man4/tcp.4600
-rw-r--r--share/man/man4/tdfx.493
-rw-r--r--share/man/man4/termios.41586
-rw-r--r--share/man/man4/textdump.4172
-rw-r--r--share/man/man4/ti.4425
-rw-r--r--share/man/man4/timecounters.4106
-rw-r--r--share/man/man4/tl.4185
-rw-r--r--share/man/man4/tnt4882.455
-rw-r--r--share/man/man4/tpm.486
-rw-r--r--share/man/man4/trm.4107
-rw-r--r--share/man/man4/tty.4371
-rw-r--r--share/man/man4/tun.4313
-rw-r--r--share/man/man4/twa.4135
-rw-r--r--share/man/man4/twe.4278
-rw-r--r--share/man/man4/tws.4118
-rw-r--r--share/man/man4/tx.4120
-rw-r--r--share/man/man4/txp.4140
-rw-r--r--share/man/man4/u3g.4119
-rw-r--r--share/man/man4/uark.485
-rw-r--r--share/man/man4/uart.4181
-rw-r--r--share/man/man4/uath.4187
-rw-r--r--share/man/man4/ubsa.4109
-rw-r--r--share/man/man4/ubsec.4123
-rw-r--r--share/man/man4/ubser.469
-rw-r--r--share/man/man4/ubtbcmfw.4108
-rw-r--r--share/man/man4/uchcom.488
-rw-r--r--share/man/man4/ucom.4106
-rw-r--r--share/man/man4/ucycom.487
-rw-r--r--share/man/man4/udav.4101
-rw-r--r--share/man/man4/udbp.4124
-rw-r--r--share/man/man4/udp.4170
-rw-r--r--share/man/man4/uep.479
-rw-r--r--share/man/man4/ufm.485
-rw-r--r--share/man/man4/ufoma.4141
-rw-r--r--share/man/man4/uftdi.496
-rw-r--r--share/man/man4/ugen.4321
-rw-r--r--share/man/man4/uhci.468
-rw-r--r--share/man/man4/uhid.4147
-rw-r--r--share/man/man4/uhso.4142
-rw-r--r--share/man/man4/uipaq.498
-rw-r--r--share/man/man4/ukbd.4171
-rw-r--r--share/man/man4/ulpt.4110
-rw-r--r--share/man/man4/umass.4257
-rw-r--r--share/man/man4/umcs.4101
-rw-r--r--share/man/man4/umct.4101
-rw-r--r--share/man/man4/umodem.4113
-rw-r--r--share/man/man4/ums.4113
-rw-r--r--share/man/man4/unix.4280
-rw-r--r--share/man/man4/upgt.4222
-rw-r--r--share/man/man4/uplcom.4195
-rw-r--r--share/man/man4/ural.4165
-rw-r--r--share/man/man4/urio.4130
-rw-r--r--share/man/man4/urtw.4126
-rw-r--r--share/man/man4/usb.4181
-rw-r--r--share/man/man4/usb2_template.484
-rw-r--r--share/man/man4/usb_quirk.4195
-rw-r--r--share/man/man4/uslcom.498
-rw-r--r--share/man/man4/utopia.4196
-rw-r--r--share/man/man4/uvisor.4142
-rw-r--r--share/man/man4/uvscom.495
-rw-r--r--share/man/man4/vga.4185
-rw-r--r--share/man/man4/vge.4225
-rw-r--r--share/man/man4/viapm.472
-rw-r--r--share/man/man4/viawd.479
-rw-r--r--share/man/man4/vinum.41171
-rw-r--r--share/man/man4/virtio.492
-rw-r--r--share/man/man4/virtio_balloon.464
-rw-r--r--share/man/man4/virtio_blk.470
-rw-r--r--share/man/man4/vkbd.4153
-rw-r--r--share/man/man4/vlan.4209
-rw-r--r--share/man/man4/vpo.4105
-rw-r--r--share/man/man4/vr.4217
-rw-r--r--share/man/man4/vte.4152
-rw-r--r--share/man/man4/vtnet.499
-rw-r--r--share/man/man4/vxge.4110
-rw-r--r--share/man/man4/watchdog.4147
-rw-r--r--share/man/man4/wb.4196
-rw-r--r--share/man/man4/wbwd.4117
-rw-r--r--share/man/man4/wi.4377
-rw-r--r--share/man/man4/witness.4144
-rw-r--r--share/man/man4/wlan.4219
-rw-r--r--share/man/man4/wlan_acl.457
-rw-r--r--share/man/man4/wlan_amrr.459
-rw-r--r--share/man/man4/wlan_ccmp.466
-rw-r--r--share/man/man4/wlan_tkip.466
-rw-r--r--share/man/man4/wlan_wep.463
-rw-r--r--share/man/man4/wlan_xauth.461
-rw-r--r--share/man/man4/wpi.4144
-rw-r--r--share/man/man4/xe.4168
-rw-r--r--share/man/man4/xen.4185
-rw-r--r--share/man/man4/xhci.468
-rw-r--r--share/man/man4/xl.4270
-rw-r--r--share/man/man4/xnb.4141
-rw-r--r--share/man/man4/xpt.4108
-rw-r--r--share/man/man4/zero.457
-rw-r--r--share/man/man4/zyd.4186
-rw-r--r--share/man/man5/Makefile92
-rw-r--r--share/man/man5/a.out.5460
-rw-r--r--share/man/man5/acct.5131
-rw-r--r--share/man/man5/ar.5327
-rw-r--r--share/man/man5/bluetooth.device.conf.5186
-rw-r--r--share/man/man5/bluetooth.hosts.563
-rw-r--r--share/man/man5/bluetooth.protocols.562
-rw-r--r--share/man/man5/boot.config.5103
-rw-r--r--share/man/man5/core.5144
-rw-r--r--share/man/man5/devfs.5152
-rw-r--r--share/man/man5/devfs.conf.5140
-rw-r--r--share/man/man5/devfs.rules.5127
-rw-r--r--share/man/man5/device.hints.5170
-rw-r--r--share/man/man5/dir.5160
-rw-r--r--share/man/man5/disktab.5143
-rw-r--r--share/man/man5/elf.51313
-rw-r--r--share/man/man5/ethers.5102
-rw-r--r--share/man/man5/eui64.5110
-rw-r--r--share/man/man5/ext2fs.583
-rw-r--r--share/man/man5/fbtab.547
-rw-r--r--share/man/man5/fdescfs.5130
-rw-r--r--share/man/man5/forward.597
-rw-r--r--share/man/man5/freebsd-update.conf.5233
-rw-r--r--share/man/man5/fs.5450
-rw-r--r--share/man/man5/fstab.5347
-rw-r--r--share/man/man5/group.5164
-rw-r--r--share/man/man5/hesiod.conf.580
-rw-r--r--share/man/man5/hosts.5116
-rw-r--r--share/man/man5/hosts.equiv.5149
-rw-r--r--share/man/man5/hosts.lpd.562
-rw-r--r--share/man/man5/intro.555
-rw-r--r--share/man/man5/libmap.conf.5163
-rw-r--r--share/man/man5/link.5590
-rw-r--r--share/man/man5/linprocfs.598
-rw-r--r--share/man/man5/linsysfs.599
-rw-r--r--share/man/man5/mailer.conf.5161
-rw-r--r--share/man/man5/make.conf.5792
-rw-r--r--share/man/man5/moduli.5159
-rw-r--r--share/man/man5/motd.543
-rw-r--r--share/man/man5/mqueuefs.5124
-rw-r--r--share/man/man5/msdosfs.569
-rw-r--r--share/man/man5/networks.589
-rw-r--r--share/man/man5/nsmb.conf.5160
-rw-r--r--share/man/man5/nsswitch.conf.5386
-rw-r--r--share/man/man5/nullfs.575
-rw-r--r--share/man/man5/passwd.5451
-rw-r--r--share/man/man5/pbm.588
-rw-r--r--share/man/man5/periodic.conf.5826
-rw-r--r--share/man/man5/phones.582
-rw-r--r--share/man/man5/portindex.5101
-rw-r--r--share/man/man5/portsnap.conf.5143
-rw-r--r--share/man/man5/procfs.5277
-rw-r--r--share/man/man5/protocols.580
-rw-r--r--share/man/man5/quota.user.5129
-rw-r--r--share/man/man5/rc.conf.54630
-rw-r--r--share/man/man5/rctl.conf.574
-rw-r--r--share/man/man5/regdomain.548
-rw-r--r--share/man/man5/reiserfs.583
-rw-r--r--share/man/man5/remote.5214
-rw-r--r--share/man/man5/resolver.5222
-rw-r--r--share/man/man5/services.5107
-rw-r--r--share/man/man5/shells.566
-rw-r--r--share/man/man5/src.conf.51029
-rw-r--r--share/man/man5/stab.5221
-rw-r--r--share/man/man5/style.Makefile.5276
-rw-r--r--share/man/man5/sysctl.conf.584
-rw-r--r--share/man/man5/tmpfs.5149
-rw-r--r--share/man/man5/xfs.5108
-rw-r--r--share/man/man6/Makefile5
-rw-r--r--share/man/man6/intro.662
-rw-r--r--share/man/man7/Makefile37
-rw-r--r--share/man/man7/adding_user.7110
-rw-r--r--share/man/man7/ascii.7117
-rw-r--r--share/man/man7/bsd.snmpmod.mk.7117
-rw-r--r--share/man/man7/build.7608
-rw-r--r--share/man/man7/c99.7183
-rw-r--r--share/man/man7/clocks.7178
-rw-r--r--share/man/man7/development.7698
-rw-r--r--share/man/man7/environ.7271
-rw-r--r--share/man/man7/ffs.7226
-rw-r--r--share/man/man7/firewall.7442
-rw-r--r--share/man/man7/hier.7845
-rw-r--r--share/man/man7/hostname.794
-rw-r--r--share/man/man7/intro.747
-rw-r--r--share/man/man7/maclabel.798
-rw-r--r--share/man/man7/mailaddr.7162
-rw-r--r--share/man/man7/operator.768
-rw-r--r--share/man/man7/ports.7555
-rw-r--r--share/man/man7/release.7393
-rw-r--r--share/man/man7/sdoc.7241
-rw-r--r--share/man/man7/security.71012
-rw-r--r--share/man/man7/sprog.7180
-rw-r--r--share/man/man7/stdint.7136
-rw-r--r--share/man/man7/sticky.782
-rw-r--r--share/man/man7/tuning.71068
-rw-r--r--share/man/man8/Makefile27
-rw-r--r--share/man/man8/crash.8220
-rw-r--r--share/man/man8/diskless.8480
-rw-r--r--share/man/man8/intro.895
-rw-r--r--share/man/man8/nanobsd.8337
-rw-r--r--share/man/man8/picobsd.8663
-rw-r--r--share/man/man8/rc.8541
-rw-r--r--share/man/man8/rc.sendmail.8262
-rw-r--r--share/man/man8/rc.subr.8878
-rw-r--r--share/man/man8/rescue.8184
-rw-r--r--share/man/man8/yp.8588
-rw-r--r--share/man/man9/BUF_ISLOCKED.969
-rw-r--r--share/man/man9/BUF_LOCK.975
-rw-r--r--share/man/man9/BUF_LOCKFREE.963
-rw-r--r--share/man/man9/BUF_LOCKINIT.962
-rw-r--r--share/man/man9/BUF_RECURSED.965
-rw-r--r--share/man/man9/BUF_TIMELOCK.983
-rw-r--r--share/man/man9/BUF_UNLOCK.964
-rw-r--r--share/man/man9/BUS_ADD_CHILD.974
-rw-r--r--share/man/man9/BUS_BIND_INTR.998
-rw-r--r--share/man/man9/BUS_CONFIG_INTR.9106
-rw-r--r--share/man/man9/BUS_DESCRIBE_INTR.9104
-rw-r--r--share/man/man9/BUS_NEW_PASS.956
-rw-r--r--share/man/man9/BUS_PRINT_CHILD.964
-rw-r--r--share/man/man9/BUS_READ_IVAR.963
-rw-r--r--share/man/man9/BUS_SETUP_INTR.9216
-rw-r--r--share/man/man9/CTASSERT.970
-rw-r--r--share/man/man9/DB_COMMAND.9110
-rw-r--r--share/man/man9/DECLARE_GEOM_CLASS.9179
-rw-r--r--share/man/man9/DECLARE_MODULE.9112
-rw-r--r--share/man/man9/DELAY.947
-rw-r--r--share/man/man9/DEVICE_ATTACH.971
-rw-r--r--share/man/man9/DEVICE_DETACH.965
-rw-r--r--share/man/man9/DEVICE_IDENTIFY.994
-rw-r--r--share/man/man9/DEVICE_PROBE.9139
-rw-r--r--share/man/man9/DEVICE_SHUTDOWN.957
-rw-r--r--share/man/man9/DEV_MODULE.9105
-rw-r--r--share/man/man9/DRIVER_MODULE.9104
-rw-r--r--share/man/man9/EVENTHANDLER.9248
-rw-r--r--share/man/man9/KASSERT.987
-rw-r--r--share/man/man9/LOCK_PROFILING.9187
-rw-r--r--share/man/man9/MD5.978
-rw-r--r--share/man/man9/MODULE_DEPEND.980
-rw-r--r--share/man/man9/MODULE_VERSION.959
-rw-r--r--share/man/man9/Makefile1477
-rw-r--r--share/man/man9/SYSCALL_MODULE.984
-rw-r--r--share/man/man9/SYSINIT.9163
-rw-r--r--share/man/man9/VFS.959
-rw-r--r--share/man/man9/VFS_CHECKEXP.988
-rw-r--r--share/man/man9/VFS_FHTOVP.983
-rw-r--r--share/man/man9/VFS_LOCK_GIANT.993
-rw-r--r--share/man/man9/VFS_MOUNT.984
-rw-r--r--share/man/man9/VFS_QUOTACTL.953
-rw-r--r--share/man/man9/VFS_ROOT.967
-rw-r--r--share/man/man9/VFS_SET.9116
-rw-r--r--share/man/man9/VFS_STATFS.9116
-rw-r--r--share/man/man9/VFS_SYNC.981
-rw-r--r--share/man/man9/VFS_UNMOUNT.968
-rw-r--r--share/man/man9/VFS_VGET.983
-rw-r--r--share/man/man9/VOP_ACCESS.9103
-rw-r--r--share/man/man9/VOP_ACLCHECK.9102
-rw-r--r--share/man/man9/VOP_ADVLOCK.988
-rw-r--r--share/man/man9/VOP_ATTRIB.9102
-rw-r--r--share/man/man9/VOP_BWRITE.956
-rw-r--r--share/man/man9/VOP_CREATE.9100
-rw-r--r--share/man/man9/VOP_FSYNC.993
-rw-r--r--share/man/man9/VOP_GETACL.996
-rw-r--r--share/man/man9/VOP_GETEXTATTR.9133
-rw-r--r--share/man/man9/VOP_GETPAGES.9167
-rw-r--r--share/man/man9/VOP_GETVOBJECT.9113
-rw-r--r--share/man/man9/VOP_INACTIVE.981
-rw-r--r--share/man/man9/VOP_IOCTL.974
-rw-r--r--share/man/man9/VOP_LINK.983
-rw-r--r--share/man/man9/VOP_LISTEXTATTR.9136
-rw-r--r--share/man/man9/VOP_LOCK.9124
-rw-r--r--share/man/man9/VOP_LOOKUP.9195
-rw-r--r--share/man/man9/VOP_OPENCLOSE.9104
-rw-r--r--share/man/man9/VOP_PATHCONF.988
-rw-r--r--share/man/man9/VOP_PRINT.954
-rw-r--r--share/man/man9/VOP_RDWR.9104
-rw-r--r--share/man/man9/VOP_READDIR.9108
-rw-r--r--share/man/man9/VOP_READLINK.967
-rw-r--r--share/man/man9/VOP_REALLOCBLKS.959
-rw-r--r--share/man/man9/VOP_REMOVE.977
-rw-r--r--share/man/man9/VOP_RENAME.996
-rw-r--r--share/man/man9/VOP_REVOKE.970
-rw-r--r--share/man/man9/VOP_SETACL.9105
-rw-r--r--share/man/man9/VOP_SETEXTATTR.9119
-rw-r--r--share/man/man9/VOP_STRATEGY.964
-rw-r--r--share/man/man9/VOP_VPTOCNP.992
-rw-r--r--share/man/man9/VOP_VPTOFH.960
-rw-r--r--share/man/man9/accept_filter.9152
-rw-r--r--share/man/man9/accf_data.978
-rw-r--r--share/man/man9/accf_dns.979
-rw-r--r--share/man/man9/accf_http.998
-rw-r--r--share/man/man9/acl.9219
-rw-r--r--share/man/man9/alq.9441
-rw-r--r--share/man/man9/altq.9599
-rw-r--r--share/man/man9/atomic.9356
-rw-r--r--share/man/man9/bios.9182
-rw-r--r--share/man/man9/boot.9100
-rw-r--r--share/man/man9/bpf.9279
-rw-r--r--share/man/man9/buf.9150
-rw-r--r--share/man/man9/buf_ring.9144
-rw-r--r--share/man/man9/bus_activate_resource.993
-rw-r--r--share/man/man9/bus_adjust_resource.9101
-rw-r--r--share/man/man9/bus_alloc_resource.9183
-rw-r--r--share/man/man9/bus_child_present.987
-rw-r--r--share/man/man9/bus_dma.91001
-rw-r--r--share/man/man9/bus_generic_attach.958
-rw-r--r--share/man/man9/bus_generic_detach.959
-rw-r--r--share/man/man9/bus_generic_new_pass.957
-rw-r--r--share/man/man9/bus_generic_print_child.965
-rw-r--r--share/man/man9/bus_generic_read_ivar.957
-rw-r--r--share/man/man9/bus_generic_shutdown.959
-rw-r--r--share/man/man9/bus_release_resource.9106
-rw-r--r--share/man/man9/bus_set_pass.954
-rw-r--r--share/man/man9/bus_set_resource.996
-rw-r--r--share/man/man9/bus_space.91721
-rw-r--r--share/man/man9/byteorder.9169
-rw-r--r--share/man/man9/cd.9126
-rw-r--r--share/man/man9/condvar.9233
-rw-r--r--share/man/man9/config_intrhook.9105
-rw-r--r--share/man/man9/contigmalloc.9132
-rw-r--r--share/man/man9/copy.9173
-rw-r--r--share/man/man9/cr_cansee.992
-rw-r--r--share/man/man9/cr_seeothergids.982
-rw-r--r--share/man/man9/cr_seeotheruids.982
-rw-r--r--share/man/man9/critical_enter.974
-rw-r--r--share/man/man9/crypto.9665
-rw-r--r--share/man/man9/dev_clone.978
-rw-r--r--share/man/man9/devclass.969
-rw-r--r--share/man/man9/devclass_find.956
-rw-r--r--share/man/man9/devclass_get_count.947
-rw-r--r--share/man/man9/devclass_get_device.952
-rw-r--r--share/man/man9/devclass_get_devices.960
-rw-r--r--share/man/man9/devclass_get_drivers.960
-rw-r--r--share/man/man9/devclass_get_maxunit.966
-rw-r--r--share/man/man9/devclass_get_name.949
-rw-r--r--share/man/man9/devclass_get_softc.952
-rw-r--r--share/man/man9/devfs_set_cdevpriv.9121
-rw-r--r--share/man/man9/device.9104
-rw-r--r--share/man/man9/device_add_child.9125
-rw-r--r--share/man/man9/device_delete_child.956
-rw-r--r--share/man/man9/device_enable.963
-rw-r--r--share/man/man9/device_find_child.962
-rw-r--r--share/man/man9/device_get_children.962
-rw-r--r--share/man/man9/device_get_devclass.952
-rw-r--r--share/man/man9/device_get_driver.952
-rw-r--r--share/man/man9/device_get_ivars.964
-rw-r--r--share/man/man9/device_get_name.956
-rw-r--r--share/man/man9/device_get_parent.950
-rw-r--r--share/man/man9/device_get_softc.969
-rw-r--r--share/man/man9/device_get_state.999
-rw-r--r--share/man/man9/device_get_sysctl.958
-rw-r--r--share/man/man9/device_get_unit.948
-rw-r--r--share/man/man9/device_printf.958
-rw-r--r--share/man/man9/device_probe_and_attach.961
-rw-r--r--share/man/man9/device_quiet.966
-rw-r--r--share/man/man9/device_set_desc.963
-rw-r--r--share/man/man9/device_set_driver.953
-rw-r--r--share/man/man9/device_set_flags.956
-rw-r--r--share/man/man9/devstat.9455
-rw-r--r--share/man/man9/devtoname.948
-rw-r--r--share/man/man9/disk.9200
-rw-r--r--share/man/man9/domain.9226
-rw-r--r--share/man/man9/drbr.9147
-rw-r--r--share/man/man9/driver.9116
-rw-r--r--share/man/man9/eventtimers.9236
-rw-r--r--share/man/man9/extattr.996
-rw-r--r--share/man/man9/fail.9208
-rw-r--r--share/man/man9/fetch.9101
-rw-r--r--share/man/man9/firmware.9270
-rw-r--r--share/man/man9/g_access.9165
-rw-r--r--share/man/man9/g_attach.9141
-rw-r--r--share/man/man9/g_bio.9277
-rw-r--r--share/man/man9/g_consumer.9137
-rw-r--r--share/man/man9/g_data.9122
-rw-r--r--share/man/man9/g_event.9189
-rw-r--r--share/man/man9/g_geom.9206
-rw-r--r--share/man/man9/g_provider.9145
-rw-r--r--share/man/man9/g_provider_by_name.977
-rw-r--r--share/man/man9/g_wither_geom.986
-rw-r--r--share/man/man9/get_cyclecount.995
-rw-r--r--share/man/man9/getnewvnode.969
-rw-r--r--share/man/man9/groupmember.960
-rw-r--r--share/man/man9/hash.9161
-rw-r--r--share/man/man9/hashinit.9176
-rw-r--r--share/man/man9/hexdump.994
-rw-r--r--share/man/man9/hhook.9388
-rw-r--r--share/man/man9/ieee80211.9568
-rw-r--r--share/man/man9/ieee80211_amrr.9194
-rw-r--r--share/man/man9/ieee80211_beacon.9115
-rw-r--r--share/man/man9/ieee80211_bmiss.991
-rw-r--r--share/man/man9/ieee80211_crypto.9260
-rw-r--r--share/man/man9/ieee80211_ddb.971
-rw-r--r--share/man/man9/ieee80211_input.9116
-rw-r--r--share/man/man9/ieee80211_node.9251
-rw-r--r--share/man/man9/ieee80211_output.9194
-rw-r--r--share/man/man9/ieee80211_proto.9241
-rw-r--r--share/man/man9/ieee80211_radiotap.9302
-rw-r--r--share/man/man9/ieee80211_regdomain.9143
-rw-r--r--share/man/man9/ieee80211_scan.9350
-rw-r--r--share/man/man9/ieee80211_vap.9154
-rw-r--r--share/man/man9/ifnet.91542
-rw-r--r--share/man/man9/inittodr.9123
-rw-r--r--share/man/man9/insmntque.995
-rw-r--r--share/man/man9/intro.9109
-rw-r--r--share/man/man9/ithread.9351
-rw-r--r--share/man/man9/kernacc.983
-rw-r--r--share/man/man9/kernel_mount.9212
-rw-r--r--share/man/man9/khelp.9438
-rw-r--r--share/man/man9/kobj.9156
-rw-r--r--share/man/man9/kproc.9395
-rw-r--r--share/man/man9/kqueue.9467
-rw-r--r--share/man/man9/kthread.9349
-rw-r--r--share/man/man9/ktr.9162
-rw-r--r--share/man/man9/lock.9389
-rw-r--r--share/man/man9/locking.9363
-rw-r--r--share/man/man9/mac.9246
-rw-r--r--share/man/man9/make_dev.9401
-rw-r--r--share/man/man9/malloc.9286
-rw-r--r--share/man/man9/mbchain.9222
-rw-r--r--share/man/man9/mbpool.9264
-rw-r--r--share/man/man9/mbuf.91238
-rw-r--r--share/man/man9/mbuf_tags.9286
-rw-r--r--share/man/man9/mdchain.9211
-rw-r--r--share/man/man9/memcchr.959
-rw-r--r--share/man/man9/memguard.9220
-rw-r--r--share/man/man9/mi_switch.9158
-rw-r--r--share/man/man9/microseq.9493
-rw-r--r--share/man/man9/microtime.9121
-rw-r--r--share/man/man9/microuptime.9108
-rw-r--r--share/man/man9/mod_cc.9333
-rw-r--r--share/man/man9/module.9121
-rw-r--r--share/man/man9/mtx_pool.9184
-rw-r--r--share/man/man9/mutex.9523
-rw-r--r--share/man/man9/namei.9381
-rw-r--r--share/man/man9/netisr.9221
-rw-r--r--share/man/man9/osd.9390
-rw-r--r--share/man/man9/p_candebug.9138
-rw-r--r--share/man/man9/p_cansee.993
-rw-r--r--share/man/man9/panic.970
-rw-r--r--share/man/man9/pbuf.9132
-rw-r--r--share/man/man9/pci.9706
-rw-r--r--share/man/man9/pfil.9216
-rw-r--r--share/man/man9/pfind.988
-rw-r--r--share/man/man9/pgfind.965
-rw-r--r--share/man/man9/physio.9131
-rw-r--r--share/man/man9/pmap.9130
-rw-r--r--share/man/man9/pmap_activate.951
-rw-r--r--share/man/man9/pmap_change_wiring.968
-rw-r--r--share/man/man9/pmap_clear_modify.963
-rw-r--r--share/man/man9/pmap_copy.984
-rw-r--r--share/man/man9/pmap_enter.968
-rw-r--r--share/man/man9/pmap_extract.995
-rw-r--r--share/man/man9/pmap_growkernel.951
-rw-r--r--share/man/man9/pmap_init.965
-rw-r--r--share/man/man9/pmap_is_modified.971
-rw-r--r--share/man/man9/pmap_is_prefaultable.957
-rw-r--r--share/man/man9/pmap_map.980
-rw-r--r--share/man/man9/pmap_mincore.974
-rw-r--r--share/man/man9/pmap_object_init_pt.973
-rw-r--r--share/man/man9/pmap_page_exists_quick.966
-rw-r--r--share/man/man9/pmap_page_init.951
-rw-r--r--share/man/man9/pmap_page_protect.967
-rw-r--r--share/man/man9/pmap_pinit.967
-rw-r--r--share/man/man9/pmap_qenter.979
-rw-r--r--share/man/man9/pmap_release.958
-rw-r--r--share/man/man9/pmap_remove.984
-rw-r--r--share/man/man9/pmap_resident_count.974
-rw-r--r--share/man/man9/pmap_zero_page.972
-rw-r--r--share/man/man9/printf.9175
-rw-r--r--share/man/man9/prison_check.963
-rw-r--r--share/man/man9/priv.9122
-rw-r--r--share/man/man9/pseudofs.970
-rw-r--r--share/man/man9/psignal.9151
-rw-r--r--share/man/man9/random.9156
-rw-r--r--share/man/man9/random_harvest.9112
-rw-r--r--share/man/man9/redzone.9125
-rw-r--r--share/man/man9/refcount.996
-rw-r--r--share/man/man9/resettodr.962
-rw-r--r--share/man/man9/resource_int_value.979
-rw-r--r--share/man/man9/rijndael.9135
-rw-r--r--share/man/man9/rman.9472
-rw-r--r--share/man/man9/rmlock.9256
-rw-r--r--share/man/man9/rtalloc.9273
-rw-r--r--share/man/man9/rtentry.9252
-rw-r--r--share/man/man9/runqueue.9137
-rw-r--r--share/man/man9/rwlock.9313
-rw-r--r--share/man/man9/sbuf.9531
-rw-r--r--share/man/man9/scheduler.9276
-rw-r--r--share/man/man9/securelevel_gt.971
-rw-r--r--share/man/man9/selrecord.9126
-rw-r--r--share/man/man9/sema.9132
-rw-r--r--share/man/man9/sf_buf.9142
-rw-r--r--share/man/man9/sglist.9507
-rw-r--r--share/man/man9/shm_map.9186
-rw-r--r--share/man/man9/signal.9446
-rw-r--r--share/man/man9/sleep.9346
-rw-r--r--share/man/man9/sleepqueue.9403
-rw-r--r--share/man/man9/socket.9338
-rw-r--r--share/man/man9/spl.9228
-rw-r--r--share/man/man9/stack.9148
-rw-r--r--share/man/man9/store.998
-rw-r--r--share/man/man9/style.9856
-rw-r--r--share/man/man9/swi.9226
-rw-r--r--share/man/man9/sx.9328
-rw-r--r--share/man/man9/sysctl.9303
-rw-r--r--share/man/man9/sysctl_add_oid.9530
-rw-r--r--share/man/man9/sysctl_ctx_init.9247
-rw-r--r--share/man/man9/taskqueue.9382
-rw-r--r--share/man/man9/thread_exit.963
-rw-r--r--share/man/man9/time.9115
-rw-r--r--share/man/man9/timeout.9561
-rw-r--r--share/man/man9/tvtohz.958
-rw-r--r--share/man/man9/ucred.9236
-rw-r--r--share/man/man9/uidinfo.9109
-rw-r--r--share/man/man9/uio.9215
-rw-r--r--share/man/man9/unr.9110
-rw-r--r--share/man/man9/usbdi.9641
-rw-r--r--share/man/man9/utopia.9353
-rw-r--r--share/man/man9/vaccess.9128
-rw-r--r--share/man/man9/vaccess_acl_nfs4.9129
-rw-r--r--share/man/man9/vaccess_acl_posix1e.9128
-rw-r--r--share/man/man9/vcount.973
-rw-r--r--share/man/man9/vflush.981
-rw-r--r--share/man/man9/vfs_busy.989
-rw-r--r--share/man/man9/vfs_getnewfsid.977
-rw-r--r--share/man/man9/vfs_getopt.9245
-rw-r--r--share/man/man9/vfs_getvfs.977
-rw-r--r--share/man/man9/vfs_mount.9135
-rw-r--r--share/man/man9/vfs_mountedfrom.955
-rw-r--r--share/man/man9/vfs_rootmountalloc.966
-rw-r--r--share/man/man9/vfs_suser.972
-rw-r--r--share/man/man9/vfs_timestamp.963
-rw-r--r--share/man/man9/vfs_unbusy.958
-rw-r--r--share/man/man9/vfs_unmountall.947
-rw-r--r--share/man/man9/vfsconf.9151
-rw-r--r--share/man/man9/vget.971
-rw-r--r--share/man/man9/vgone.963
-rw-r--r--share/man/man9/vhold.983
-rw-r--r--share/man/man9/vinvalbuf.9119
-rw-r--r--share/man/man9/vm_fault_prefault.972
-rw-r--r--share/man/man9/vm_map.9350
-rw-r--r--share/man/man9/vm_map_check_protection.970
-rw-r--r--share/man/man9/vm_map_create.966
-rw-r--r--share/man/man9/vm_map_delete.968
-rw-r--r--share/man/man9/vm_map_entry_resize_free.9244
-rw-r--r--share/man/man9/vm_map_find.9127
-rw-r--r--share/man/man9/vm_map_findspace.978
-rw-r--r--share/man/man9/vm_map_inherit.985
-rw-r--r--share/man/man9/vm_map_init.959
-rw-r--r--share/man/man9/vm_map_insert.996
-rw-r--r--share/man/man9/vm_map_lock.9113
-rw-r--r--share/man/man9/vm_map_lookup.988
-rw-r--r--share/man/man9/vm_map_madvise.977
-rw-r--r--share/man/man9/vm_map_max.966
-rw-r--r--share/man/man9/vm_map_protect.993
-rw-r--r--share/man/man9/vm_map_remove.969
-rw-r--r--share/man/man9/vm_map_simplify_entry.961
-rw-r--r--share/man/man9/vm_map_stack.9132
-rw-r--r--share/man/man9/vm_map_submap.995
-rw-r--r--share/man/man9/vm_map_sync.981
-rw-r--r--share/man/man9/vm_map_wire.9114
-rw-r--r--share/man/man9/vm_page_aflag.9100
-rw-r--r--share/man/man9/vm_page_alloc.9139
-rw-r--r--share/man/man9/vm_page_bits.9167
-rw-r--r--share/man/man9/vm_page_cache.951
-rw-r--r--share/man/man9/vm_page_deactivate.950
-rw-r--r--share/man/man9/vm_page_dontneed.959
-rw-r--r--share/man/man9/vm_page_free.998
-rw-r--r--share/man/man9/vm_page_grab.970
-rw-r--r--share/man/man9/vm_page_hold.975
-rw-r--r--share/man/man9/vm_page_insert.996
-rw-r--r--share/man/man9/vm_page_io.965
-rw-r--r--share/man/man9/vm_page_lookup.963
-rw-r--r--share/man/man9/vm_page_rename.972
-rw-r--r--share/man/man9/vm_page_sleep_if_busy.968
-rw-r--r--share/man/man9/vm_page_wakeup.975
-rw-r--r--share/man/man9/vm_page_wire.967
-rw-r--r--share/man/man9/vm_set_page_size.962
-rw-r--r--share/man/man9/vn_fullpath.9125
-rw-r--r--share/man/man9/vn_isdisk.973
-rw-r--r--share/man/man9/vnode.9199
-rw-r--r--share/man/man9/vref.968
-rw-r--r--share/man/man9/vrefcnt.953
-rw-r--r--share/man/man9/vrele.9101
-rw-r--r--share/man/man9/vslock.991
-rw-r--r--share/man/man9/watchdog.981
-rw-r--r--share/man/man9/zero_copy.9168
-rw-r--r--share/man/man9/zone.9242
1176 files changed, 216079 insertions, 0 deletions
diff --git a/share/man/Makefile b/share/man/Makefile
new file mode 100644
index 000000000000..524235c2e9f0
--- /dev/null
+++ b/share/man/Makefile
@@ -0,0 +1,20 @@
+# @(#)Makefile 8.2 (Berkeley) 4/16/94
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+# XXX MISSING: man3f
+SUBDIR= man1 man3 man4 man5 man6 man7 man8 man9
+
+MAKEWHATIS?= makewhatis
+
+makedb:
+.if ${MK_MAN_UTILS} != "no"
+ ${MAKEWHATIS} ${DESTDIR}${BINDIR}/man
+.if ${MK_OPENSSL} != "no"
+ ${MAKEWHATIS} ${DESTDIR}${BINDIR}/openssl/man
+.endif
+.endif
+
+.include "${.CURDIR}/../Makefile.inc"
+.include <bsd.subdir.mk>
diff --git a/share/man/man1/Makefile b/share/man/man1/Makefile
new file mode 100644
index 000000000000..43bf9442d010
--- /dev/null
+++ b/share/man/man1/Makefile
@@ -0,0 +1,95 @@
+# @(#)Makefile 8.1 (Berkeley) 6/5/93
+# $FreeBSD$
+
+MAN= builtin.1 intro.1
+
+# Create MLINKS for Shell built in commands for which there are no userland
+# utilities of the same name:
+MLINKS= builtin.1 alias.1 \
+ builtin.1 alloc.1 \
+ builtin.1 bg.1 \
+ builtin.1 bind.1 \
+ builtin.1 bindkey.1 \
+ builtin.1 break.1 \
+ builtin.1 breaksw.1 \
+ builtin.1 builtins.1 \
+ builtin.1 case.1 \
+ builtin.1 cd.1 \
+ builtin.1 chdir.1 \
+ builtin.1 command.1 \
+ builtin.1 complete.1 \
+ builtin.1 continue.1 \
+ builtin.1 default.1 \
+ builtin.1 dirs.1 \
+ builtin.1 do.1 \
+ builtin.1 done.1 \
+ builtin.1 echotc.1 \
+ builtin.1 elif.1 \
+ builtin.1 else.1 \
+ builtin.1 end.1 \
+ builtin.1 endif.1 \
+ builtin.1 endsw.1 \
+ builtin.1 esac.1 \
+ builtin.1 eval.1 \
+ builtin.1 exec.1 \
+ builtin.1 exit.1 \
+ builtin.1 export.1 \
+ builtin.1 fc.1 \
+ builtin.1 fg.1 \
+ builtin.1 fi.1 \
+ builtin.1 filetest.1 \
+ builtin.1 for.1 \
+ builtin.1 foreach.1 \
+ builtin.1 getopts.1 \
+ builtin.1 glob.1 \
+ builtin.1 goto.1 \
+ builtin.1 hash.1 \
+ builtin.1 hashstat.1 \
+ builtin.1 history.1 \
+ builtin.1 hup.1 \
+ builtin.1 if.1 \
+ builtin.1 jobid.1 \
+ builtin.1 jobs.1 \
+ builtin.1 limit.1 \
+ builtin.1 log.1 \
+ builtin.1 logout.1 \
+ builtin.1 ls-F.1 \
+ builtin.1 notify.1 \
+ builtin.1 onintr.1 \
+ builtin.1 popd.1 \
+ builtin.1 pushd.1 \
+ builtin.1 read.1 \
+ builtin.1 readonly.1 \
+ builtin.1 rehash.1 \
+ builtin.1 repeat.1 \
+ builtin.1 sched.1 \
+ builtin.1 set.1 \
+ builtin.1 setenv.1 \
+ builtin.1 settc.1 \
+ builtin.1 setty.1 \
+ builtin.1 setvar.1 \
+ builtin.1 shift.1 \
+ builtin.1 source.1 \
+ builtin.1 stop.1 \
+ builtin.1 suspend.1 \
+ builtin.1 switch.1 \
+ builtin.1 telltc.1 \
+ builtin.1 then.1 \
+ builtin.1 times.1 \
+ builtin.1 trap.1 \
+ builtin.1 type.1 \
+ builtin.1 ulimit.1 \
+ builtin.1 umask.1 \
+ builtin.1 unalias.1 \
+ builtin.1 uncomplete.1 \
+ builtin.1 unhash.1 \
+ builtin.1 unlimit.1 \
+ builtin.1 unset.1 \
+ builtin.1 unsetenv.1 \
+ builtin.1 until.1 \
+ builtin.1 wait.1 \
+ builtin.1 where.1 \
+ builtin.1 while.1
+MLINKS+=intro.1 introduction.1
+
+.include <bsd.prog.mk>
diff --git a/share/man/man1/builtin.1 b/share/man/man1/builtin.1
new file mode 100644
index 000000000000..72b016bcd20d
--- /dev/null
+++ b/share/man/man1/builtin.1
@@ -0,0 +1,332 @@
+.\"
+.\" Copyright (c) 1999 Sheldon Hearn
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 21, 2010
+.Dt BUILTIN 1
+.Os
+.Sh NAME
+.Nm builtin ,
+.Nm \&! ,
+.Nm % ,
+.Nm \&. ,
+.Nm \&: ,
+.Nm @ ,
+.Nm \&[ ,
+.Nm { ,
+.Nm } ,
+.Nm alias ,
+.Nm alloc ,
+.Nm bg ,
+.Nm bind ,
+.Nm bindkey ,
+.Nm break ,
+.Nm breaksw ,
+.Nm builtins ,
+.Nm case ,
+.Nm cd ,
+.Nm chdir ,
+.Nm command ,
+.Nm complete ,
+.Nm continue ,
+.Nm default ,
+.Nm dirs ,
+.Nm do ,
+.Nm done ,
+.Nm echo ,
+.Nm echotc ,
+.Nm elif ,
+.Nm else ,
+.Nm end ,
+.Nm endif ,
+.Nm endsw ,
+.Nm esac ,
+.Nm eval ,
+.Nm exec ,
+.Nm exit ,
+.Nm export ,
+.Nm false ,
+.Nm fc ,
+.Nm fg ,
+.Nm filetest ,
+.Nm fi ,
+.Nm for ,
+.Nm foreach ,
+.Nm getopts ,
+.Nm glob ,
+.Nm goto ,
+.Nm hash ,
+.Nm hashstat ,
+.Nm history ,
+.Nm hup ,
+.Nm if ,
+.Nm jobid ,
+.Nm jobs ,
+.Nm kill ,
+.Nm limit ,
+.Nm local ,
+.Nm log ,
+.Nm login ,
+.Nm logout ,
+.Nm ls-F ,
+.Nm nice ,
+.Nm nohup ,
+.Nm notify ,
+.Nm onintr ,
+.Nm popd ,
+.Nm printenv ,
+.Nm printf ,
+.Nm pushd ,
+.Nm pwd ,
+.Nm read ,
+.Nm readonly ,
+.Nm rehash ,
+.Nm repeat ,
+.Nm return ,
+.Nm sched ,
+.Nm set ,
+.Nm setenv ,
+.Nm settc ,
+.Nm setty ,
+.Nm setvar ,
+.Nm shift ,
+.Nm source ,
+.Nm stop ,
+.Nm suspend ,
+.Nm switch ,
+.Nm telltc ,
+.Nm test ,
+.Nm then ,
+.Nm time ,
+.Nm times ,
+.Nm trap ,
+.Nm true ,
+.Nm type ,
+.Nm ulimit ,
+.Nm umask ,
+.Nm unalias ,
+.Nm uncomplete ,
+.Nm unhash ,
+.Nm unlimit ,
+.Nm unset ,
+.Nm unsetenv ,
+.Nm until ,
+.Nm wait ,
+.Nm where ,
+.Nm which ,
+.Nm while
+.Nd shell built-in commands
+.Sh SYNOPSIS
+See the built-in command description in the appropriate shell manual page.
+.Sh DESCRIPTION
+Shell builtin commands are commands that can be executed within the
+running shell's process.
+Note that, in the case of
+.Xr csh 1
+builtin commands, the command is executed in a subshell if it occurs as
+any component of a pipeline except the last.
+.Pp
+If a command specified to the shell contains a slash
+.Ql / ,
+the shell will not execute a builtin command, even if the last component
+of the specified command matches the name of a builtin command.
+Thus, while specifying
+.Dq Li echo
+causes a builtin command to be executed under shells that support the
+.Nm echo
+builtin command,
+specifying
+.Dq Li /bin/echo
+or
+.Dq Li ./echo
+does not.
+.Pp
+While some builtin commands may exist in more than one shell, their
+operation may be different under each shell which supports them.
+Below is a table which lists shell builtin commands, the standard shells
+that support them and whether they exist as standalone utilities.
+.Pp
+Only builtin commands for the
+.Xr csh 1
+and
+.Xr sh 1
+shells are listed here.
+Consult a shell's manual page for
+details on the operation its builtin commands.
+Beware that the
+.Xr sh 1
+manual page, at least, calls some of these commands
+.Dq built-in commands
+and some of them
+.Dq reserved words .
+Users of other shells may need to consult an
+.Xr info 1
+page or other sources of documentation.
+.Pp
+Commands marked
+.Dq Li No**
+under
+.Em External
+do exist externally,
+but are implemented as scripts using a builtin command of the same name.
+.Bl -column ".Ic uncomplete" ".Em External" ".Xr csh 1" ".Xr sh 1" -offset indent
+.It Em Command Ta Em External Ta Xr csh 1 Ta Xr sh 1
+.It Ic \&! Ta \&No Ta \&No Ta Yes
+.It Ic % Ta \&No Ta Yes Ta \&No
+.It Ic \&. Ta \&No Ta \&No Ta Yes
+.It Ic \&: Ta \&No Ta Yes Ta Yes
+.It Ic @ Ta \&No Ta Yes Ta \&No
+.It Ic \&[ Ta Yes Ta \&No Ta Yes
+.It Ic { Ta \&No Ta \&No Ta Yes
+.It Ic } Ta \&No Ta \&No Ta Yes
+.It Ic alias Ta No** Ta Yes Ta Yes
+.It Ic alloc Ta \&No Ta Yes Ta \&No
+.It Ic bg Ta No** Ta Yes Ta Yes
+.It Ic bind Ta \&No Ta \&No Ta Yes
+.It Ic bindkey Ta \&No Ta Yes Ta \&No
+.It Ic break Ta \&No Ta Yes Ta Yes
+.It Ic breaksw Ta \&No Ta Yes Ta \&No
+.It Ic builtin Ta \&No Ta \&No Ta Yes
+.It Ic builtins Ta \&No Ta Yes Ta \&No
+.It Ic case Ta \&No Ta Yes Ta Yes
+.It Ic cd Ta No** Ta Yes Ta Yes
+.It Ic chdir Ta \&No Ta Yes Ta Yes
+.It Ic command Ta No** Ta \&No Ta Yes
+.It Ic complete Ta \&No Ta Yes Ta \&No
+.It Ic continue Ta \&No Ta Yes Ta Yes
+.It Ic default Ta \&No Ta Yes Ta \&No
+.It Ic dirs Ta \&No Ta Yes Ta \&No
+.It Ic do Ta \&No Ta \&No Ta Yes
+.It Ic done Ta \&No Ta \&No Ta Yes
+.It Ic echo Ta Yes Ta Yes Ta Yes
+.It Ic echotc Ta \&No Ta Yes Ta \&No
+.It Ic elif Ta \&No Ta \&No Ta Yes
+.It Ic else Ta \&No Ta Yes Ta Yes
+.It Ic end Ta \&No Ta Yes Ta \&No
+.It Ic endif Ta \&No Ta Yes Ta \&No
+.It Ic endsw Ta \&No Ta Yes Ta \&No
+.It Ic esac Ta \&No Ta \&No Ta Yes
+.It Ic eval Ta \&No Ta Yes Ta Yes
+.It Ic exec Ta \&No Ta Yes Ta Yes
+.It Ic exit Ta \&No Ta Yes Ta Yes
+.It Ic export Ta \&No Ta \&No Ta Yes
+.It Ic false Ta Yes Ta \&No Ta Yes
+.It Ic fc Ta No** Ta \&No Ta Yes
+.It Ic fg Ta No** Ta Yes Ta Yes
+.It Ic filetest Ta \&No Ta Yes Ta \&No
+.It Ic fi Ta \&No Ta \&No Ta Yes
+.It Ic for Ta \&No Ta \&No Ta Yes
+.It Ic foreach Ta \&No Ta Yes Ta \&No
+.It Ic getopts Ta No** Ta \&No Ta Yes
+.It Ic glob Ta \&No Ta Yes Ta \&No
+.It Ic goto Ta \&No Ta Yes Ta \&No
+.It Ic hash Ta No** Ta \&No Ta Yes
+.It Ic hashstat Ta \&No Ta Yes Ta \&No
+.It Ic history Ta \&No Ta Yes Ta \&No
+.It Ic hup Ta \&No Ta Yes Ta \&No
+.It Ic if Ta \&No Ta Yes Ta Yes
+.It Ic jobid Ta \&No Ta \&No Ta Yes
+.It Ic jobs Ta No** Ta Yes Ta Yes
+.It Ic kill Ta Yes Ta Yes Ta Yes
+.It Ic limit Ta \&No Ta Yes Ta \&No
+.It Ic local Ta \&No Ta \&No Ta Yes
+.It Ic log Ta \&No Ta Yes Ta \&No
+.It Ic login Ta Yes Ta Yes Ta \&No
+.It Ic logout Ta \&No Ta Yes Ta \&No
+.It Ic ls-F Ta \&No Ta Yes Ta \&No
+.It Ic nice Ta Yes Ta Yes Ta \&No
+.It Ic nohup Ta Yes Ta Yes Ta \&No
+.It Ic notify Ta \&No Ta Yes Ta \&No
+.It Ic onintr Ta \&No Ta Yes Ta \&No
+.It Ic popd Ta \&No Ta Yes Ta \&No
+.It Ic printenv Ta Yes Ta Yes Ta \&No
+.It Ic printf Ta Yes Ta \&No Ta Yes
+.It Ic pushd Ta \&No Ta Yes Ta \&No
+.It Ic pwd Ta Yes Ta \&No Ta Yes
+.It Ic read Ta No** Ta \&No Ta Yes
+.It Ic readonly Ta \&No Ta \&No Ta Yes
+.It Ic rehash Ta \&No Ta Yes Ta \&No
+.It Ic repeat Ta \&No Ta Yes Ta \&No
+.It Ic return Ta \&No Ta \&No Ta Yes
+.It Ic sched Ta \&No Ta Yes Ta \&No
+.It Ic set Ta \&No Ta Yes Ta Yes
+.It Ic setenv Ta \&No Ta Yes Ta \&No
+.It Ic settc Ta \&No Ta Yes Ta \&No
+.It Ic setty Ta \&No Ta Yes Ta \&No
+.It Ic setvar Ta \&No Ta \&No Ta Yes
+.It Ic shift Ta \&No Ta Yes Ta Yes
+.It Ic source Ta \&No Ta Yes Ta \&No
+.It Ic stop Ta \&No Ta Yes Ta \&No
+.It Ic suspend Ta \&No Ta Yes Ta \&No
+.It Ic switch Ta \&No Ta Yes Ta \&No
+.It Ic telltc Ta \&No Ta Yes Ta \&No
+.It Ic test Ta Yes Ta \&No Ta Yes
+.It Ic then Ta \&No Ta \&No Ta Yes
+.It Ic time Ta Yes Ta Yes Ta \&No
+.It Ic times Ta \&No Ta \&No Ta Yes
+.It Ic trap Ta \&No Ta \&No Ta Yes
+.It Ic true Ta Yes Ta \&No Ta Yes
+.It Ic type Ta No** Ta \&No Ta Yes
+.It Ic ulimit Ta No** Ta \&No Ta Yes
+.It Ic umask Ta No** Ta Yes Ta Yes
+.It Ic unalias Ta No** Ta Yes Ta Yes
+.It Ic uncomplete Ta \&No Ta Yes Ta \&No
+.It Ic unhash Ta \&No Ta Yes Ta \&No
+.It Ic unlimit Ta \&No Ta Yes Ta \&No
+.It Ic unset Ta \&No Ta Yes Ta Yes
+.It Ic unsetenv Ta \&No Ta Yes Ta \&No
+.It Ic until Ta \&No Ta \&No Ta Yes
+.It Ic wait Ta No** Ta Yes Ta Yes
+.It Ic where Ta \&No Ta Yes Ta \&No
+.It Ic which Ta Yes Ta Yes Ta \&No
+.It Ic while Ta \&No Ta Yes Ta Yes
+.El
+.Sh SEE ALSO
+.Xr csh 1 ,
+.Xr echo 1 ,
+.Xr false 1 ,
+.Xr info 1 ,
+.Xr kill 1 ,
+.Xr login 1 ,
+.Xr nice 1 ,
+.Xr nohup 1 ,
+.Xr printenv 1 ,
+.Xr printf 1 ,
+.Xr pwd 1 ,
+.Xr sh 1 ,
+.Xr test 1 ,
+.Xr time 1 ,
+.Xr true 1 ,
+.Xr which 1
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.4 .
+.Sh AUTHORS
+This manual page was written by
+.An Sheldon Hearn Aq sheldonh@FreeBSD.org .
diff --git a/share/man/man1/intro.1 b/share/man/man1/intro.1
new file mode 100644
index 000000000000..c7bd089dfc0e
--- /dev/null
+++ b/share/man/man1/intro.1
@@ -0,0 +1,84 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)intro.1 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd October 21, 2001
+.Dt INTRO 1
+.Os
+.Sh NAME
+.Nm intro
+.Nd introduction to general commands (tools and utilities)
+.Sh DESCRIPTION
+Section one of the manual contains most of the commands
+which comprise the
+.Bx
+user environment.
+Some of the commands included in section one are
+text editors, command shell interpreters,
+searching and sorting tools,
+file manipulation commands,
+system status commands,
+remote file copy commands, mail commands,
+compilers and compiler tools,
+formatted output tools,
+and line printer commands.
+.Pp
+All commands set a status value upon exit which may be tested
+to see if the command completed normally.
+Traditionally, the value 0 signifies successful
+completion of the command, while a value >0 indicates an error.
+Some commands attempt to describe the nature of the failure by using
+exit codes as defined in
+.Xr sysexits 3 ,
+while others simply set the status to an arbitrary value >0 (typically 1).
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr man 1 ,
+.Xr intro 2 ,
+.Xr intro 3 ,
+.Xr sysexits 3 ,
+.Xr intro 4 ,
+.Xr intro 5 ,
+.Xr intro 6 ,
+.Xr intro 7 ,
+.Xr security 7 ,
+.Xr intro 8 ,
+.Xr intro 9
+.Pp
+Tutorials in the
+.%T "UNIX User's Manual Supplementary Documents" .
+.Sh HISTORY
+The
+.Nm
+manual page appeared in
+.At v6 .
diff --git a/share/man/man3/ATOMIC_VAR_INIT.3 b/share/man/man3/ATOMIC_VAR_INIT.3
new file mode 100644
index 000000000000..1f85d3b1e85b
--- /dev/null
+++ b/share/man/man3/ATOMIC_VAR_INIT.3
@@ -0,0 +1,301 @@
+.\" Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 27, 2011
+.Dt ATOMIC_VAR_INIT 3
+.Os
+.Sh NAME
+.Nm ATOMIC_VAR_INIT ,
+.Nm atomic_init ,
+.Nm atomic_load ,
+.Nm atomic_store ,
+.Nm atomic_exchange ,
+.Nm atomic_compare_exchange_strong ,
+.Nm atomic_compare_exchange_weak ,
+.Nm atomic_fetch_add ,
+.Nm atomic_fetch_and ,
+.Nm atomic_fetch_or ,
+.Nm atomic_fetch_sub ,
+.Nm atomic_fetch_xor ,
+.Nm atomic_is_lock_free
+.Nd type-generic atomic operations
+.Sh SYNOPSIS
+.In stdatomic.h
+.Pp
+_Atomic(T)
+.Fa v
+= ATOMIC_VAR_INIT(c);
+.Ft void
+.Fn atomic_init "_Atomic(T) *object" "T value"
+.Ft T
+.Fn atomic_load "_Atomic(T) *object"
+.Ft T
+.Fn atomic_load_explicit "_Atomic(T) *object" "memory_order order"
+.Ft void
+.Fn atomic_store "_Atomic(T) *object" "T desired"
+.Ft void
+.Fn atomic_store_explicit "_Atomic(T) *object" "T desired" "memory_order order"
+.Ft T
+.Fn atomic_exchange "_Atomic(T) *object" "T desired"
+.Ft T
+.Fn atomic_exchange_explicit "_Atomic(T) *object" "T desired" "memory_order order"
+.Ft _Bool
+.Fn atomic_compare_exchange_strong "_Atomic(T) *object" "T *expected" "T desired"
+.Ft _Bool
+.Fn atomic_compare_exchange_strong_explicit "_Atomic(T) *object" "T *expected" "T desired" "memory_order success" "memory_order failure"
+.Ft _Bool
+.Fn atomic_compare_exchange_weak "_Atomic(T) *object" "T *expected" "T desired"
+.Ft _Bool
+.Fn atomic_compare_exchange_weak_explicit "_Atomic(T) *object" "T *expected" "T desired" "memory_order success" "memory_order failure"
+.Ft T
+.Fn atomic_fetch_add "_Atomic(T) *object" "T operand"
+.Ft T
+.Fn atomic_fetch_add_explicit "_Atomic(T) *object" "T operand" "memory_order order"
+.Ft T
+.Fn atomic_fetch_and "_Atomic(T) *object" "T operand"
+.Ft T
+.Fn atomic_fetch_and_explicit "_Atomic(T) *object" "T operand" "memory_order order"
+.Ft T
+.Fn atomic_fetch_or "_Atomic(T) *object" "T operand"
+.Ft T
+.Fn atomic_fetch_or_explicit "_Atomic(T) *object" "T operand" "memory_order order"
+.Ft T
+.Fn atomic_fetch_sub "_Atomic(T) *object" "T operand"
+.Ft T
+.Fn atomic_fetch_sub_explicit "_Atomic(T) *object" "T operand" "memory_order order"
+.Ft T
+.Fn atomic_fetch_xor "_Atomic(T) *object" "T operand"
+.Ft T
+.Fn atomic_fetch_xor_explicit "_Atomic(T) *object" "T operand" "memory_order order"
+.Ft _Bool
+.Fn atomic_is_lock_free "const _Atomic(T) *object"
+.Sh DESCRIPTION
+The header
+.In stdatomic.h
+provides type-generic macros for atomic operations.
+Atomic operations can be used by multithreaded programs to provide
+shared variables between threads that in most cases may be modified
+without acquiring locks.
+.Pp
+Atomic variables are declared using the
+.Fn _Atomic
+type specifier.
+These variables are not type-compatible with their non-atomic
+counterparts.
+Depending on the compiler used, atomic variables may be opaque and can
+therefore only be influenced using the macros described.
+.Pp
+The
+.Fn atomic_init
+macro initializes the atomic variable
+.Fa object
+with a
+.Fa value .
+Atomic variables can be initialized while being declared using
+.Fn ATOMIC_VAR_INIT .
+.Pp
+The
+.Fn atomic_load
+macro returns the value of atomic variable
+.Fa object .
+The
+.Fn atomic_store
+macro sets the atomic variable
+.Fa object
+to its
+.Fa desired
+value.
+.Pp
+The
+.Fn atomic_exchange
+macro combines the behaviour of
+.Fn atomic_load
+and
+.Fn atomic_store .
+It sets the atomic variable
+.Fa object
+to its desired
+.Fa value
+and returs the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_compare_exchange_strong
+macro stores a
+.Fa desired
+value into atomic variable
+.Fa object ,
+only if the atomic variable is equal to its
+.Fa expected
+value.
+Upon success, the macro returns
+.Dv true .
+Upon failure, the
+.Fa desired
+value is overwritten with the value of the atomic variable and
+.Dv false
+is returned.
+The
+.Fn atomic_compare_exchange_weak
+macro is identical to
+.Fn atomic_compare_exchange_strong ,
+but is allowed to fail even if atomic variable
+.Fa object
+is equal to its
+.Fa expected
+value.
+.Pp
+The
+.Fn atomic_fetch_add
+macro adds the value
+.Fa operand
+to atomic variable
+.Fa object
+and returns the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_fetch_and
+macro applies the
+.Em and
+operator to atomic variable
+.Fa object
+and
+.Fa operand
+and stores the value into
+.Fa object ,
+while returning the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_fetch_or
+macro applies the
+.Em or
+operator to atomic variable
+.Fa object
+and
+.Fa operand
+and stores the value into
+.Fa object ,
+while returning the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_fetch_sub
+macro subtracts the value
+.Fa operand
+to atomic variable
+.Fa object
+and returns the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_fetch_xor
+macro applies the
+.Em xor
+operator to atomic variable
+.Fa object
+and
+.Fa operand
+and stores the value into
+.Fa object ,
+while returning the original contents of the atomic variable.
+.Pp
+The
+.Fn atomic_is_lock_free
+macro returns whether atomic variable
+.Fa object
+uses locks when using atomic operations.
+.Sh BARRIERS
+The atomic operations described previously are implemented in such a way
+that they disallow both the compiler and the executing processor to
+re-order any nearby memory operations across the atomic operation.
+In certain cases this behaviour may cause suboptimal performance.
+To mitigate this, every atomic operation has an
+.Fn _explicit
+version that allows the re-ordering to be configured.
+.Pp
+The
+.Fa order
+parameter of these
+.Fn _explicit
+macros can have one of the following values.
+.Bl -tag -width memory_order_relaxed
+.It Dv memory_order_relaxed
+No operation orders memory.
+.It Dv memory_order_consume
+Perform consume operation.
+.It Dv memory_order_acquire
+Acquire fence.
+.It Dv memory_order_release
+Release fence.
+.It Dv memory_order_acq_rel
+Acquire and release fence.
+.It Dv memory_order_seq_cst
+Sequentially consistent acquire and release fence.
+.El
+.Pp
+The previously described macros are identical to the
+.Fn _explicit
+macros, when
+.Fa order
+is
+.Dv memory_order_seq_cst .
+.Sh COMPILER SUPPORT
+These atomic operations are typically implemented by the compiler, as
+they must be implemented type-generically and must often use special
+hardware instructions.
+As this interface has not been adopted by most compilers yet, the
+.In stdatomic.h
+header implements these macros on top of existing compiler intrinsics to
+provide forward compatibility.
+.Pp
+This means that certain aspects of the interface, such as support for
+different barrier types may simply be ignored.
+When using GCC, all atomic operations are executed as if they are using
+.Dv memory_order_seq_cst .
+.Pp
+Instead of using the atomic operations provided by this interface,
+.St -isoC-2011
+allows the atomic variables to be modified directly using built-in
+language operators.
+This behaviour cannot be emulated for older compilers.
+To prevent unintended non-atomic access to these variables, this header
+file places the atomic variable in a structure when using an older
+compiler.
+.Pp
+When using GCC on architectures on which it lacks support for built-in
+atomic intrinsics, these macros may emit function calls to fallback
+routines.
+These fallback routines are only implemented for 32-bits and 64-bits
+datatypes, if supported by the CPU.
+.Sh SEE ALSO
+.Xr pthread 3 ,
+.Xr atomic 9
+.Sh STANDARDS
+These macros attempt to conform to
+.St -isoC-2011 .
+.Sh HISTORY
+These macros appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An Ed Schouten Aq ed@FreeBSD.org ,
+.An David Chisnall Aq theraven@FreeBSD.org
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile
new file mode 100644
index 000000000000..d1453ebc308f
--- /dev/null
+++ b/share/man/man3/Makefile
@@ -0,0 +1,312 @@
+# @(#)Makefile 8.2 (Berkeley) 12/13/93
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+MAN= assert.3 \
+ ATOMIC_VAR_INIT.3 \
+ bitstring.3 \
+ end.3 \
+ fpgetround.3 \
+ intro.3 \
+ makedev.3 \
+ offsetof.3 \
+ ${PTHREAD_MAN} \
+ queue.3 \
+ siginfo.3 \
+ stdarg.3 \
+ sysexits.3 \
+ tgmath.3 \
+ timeradd.3 \
+ tree.3
+
+MLINKS= ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong.3 \
+ ATOMIC_VAR_INIT.3 atomic_compare_exchange_strong_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak.3 \
+ ATOMIC_VAR_INIT.3 atomic_compare_exchange_weak_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_exchange.3 \
+ ATOMIC_VAR_INIT.3 atomic_exchange_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_add.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_add_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_and.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_and_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_or.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_or_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_sub.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_sub_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_xor.3 \
+ ATOMIC_VAR_INIT.3 atomic_fetch_xor_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_init.3 \
+ ATOMIC_VAR_INIT.3 atomic_is_lock_free.3 \
+ ATOMIC_VAR_INIT.3 atomic_load.3 \
+ ATOMIC_VAR_INIT.3 atomic_load_explicit.3 \
+ ATOMIC_VAR_INIT.3 atomic_store.3 \
+ ATOMIC_VAR_INIT.3 atomic_store_explicit.3
+MLINKS+= bitstring.3 bit_alloc.3 \
+ bitstring.3 bit_clear.3 \
+ bitstring.3 bit_decl.3 \
+ bitstring.3 bit_ffc.3 \
+ bitstring.3 bit_ffs.3 \
+ bitstring.3 bit_nclear.3 \
+ bitstring.3 bit_nset.3 \
+ bitstring.3 bit_set.3 \
+ bitstring.3 bitstr_size.3 \
+ bitstring.3 bit_test.3
+MLINKS+= end.3 edata.3 \
+ end.3 etext.3
+MLINKS+= fpgetround.3 fpgetmask.3 \
+ fpgetround.3 fpgetprec.3 \
+ fpgetround.3 fpgetsticky.3 \
+ fpgetround.3 fpresetsticky.3 \
+ fpgetround.3 fpsetmask.3 \
+ fpgetround.3 fpsetprec.3 \
+ fpgetround.3 fpsetround.3
+MLINKS+= makedev.3 major.3 \
+ makedev.3 minor.3
+MLINKS+= ${PTHREAD_MLINKS}
+MLINKS+= queue.3 LIST_EMPTY.3 \
+ queue.3 LIST_ENTRY.3 \
+ queue.3 LIST_FIRST.3 \
+ queue.3 LIST_FOREACH.3 \
+ queue.3 LIST_FOREACH_SAFE.3 \
+ queue.3 LIST_HEAD.3 \
+ queue.3 LIST_HEAD_INITIALIZER.3 \
+ queue.3 LIST_INIT.3 \
+ queue.3 LIST_INSERT_AFTER.3 \
+ queue.3 LIST_INSERT_BEFORE.3 \
+ queue.3 LIST_INSERT_HEAD.3 \
+ queue.3 LIST_NEXT.3 \
+ queue.3 LIST_REMOVE.3 \
+ queue.3 LIST_SWAP.3 \
+ queue.3 SLIST_EMPTY.3 \
+ queue.3 SLIST_ENTRY.3 \
+ queue.3 SLIST_FIRST.3 \
+ queue.3 SLIST_FOREACH.3 \
+ queue.3 SLIST_FOREACH_SAFE.3 \
+ queue.3 SLIST_HEAD.3 \
+ queue.3 SLIST_HEAD_INITIALIZER.3 \
+ queue.3 SLIST_INIT.3 \
+ queue.3 SLIST_INSERT_AFTER.3 \
+ queue.3 SLIST_INSERT_HEAD.3 \
+ queue.3 SLIST_NEXT.3 \
+ queue.3 SLIST_REMOVE.3 \
+ queue.3 SLIST_REMOVE_AFTER.3 \
+ queue.3 SLIST_REMOVE_HEAD.3 \
+ queue.3 SLIST_SWAP.3 \
+ queue.3 STAILQ_CONCAT.3 \
+ queue.3 STAILQ_EMPTY.3 \
+ queue.3 STAILQ_ENTRY.3 \
+ queue.3 STAILQ_FIRST.3 \
+ queue.3 STAILQ_FOREACH.3 \
+ queue.3 STAILQ_FOREACH_SAFE.3 \
+ queue.3 STAILQ_HEAD.3 \
+ queue.3 STAILQ_HEAD_INITIALIZER.3 \
+ queue.3 STAILQ_INIT.3 \
+ queue.3 STAILQ_INSERT_AFTER.3 \
+ queue.3 STAILQ_INSERT_HEAD.3 \
+ queue.3 STAILQ_INSERT_TAIL.3 \
+ queue.3 STAILQ_LAST.3 \
+ queue.3 STAILQ_NEXT.3 \
+ queue.3 STAILQ_REMOVE.3 \
+ queue.3 STAILQ_REMOVE_AFTER.3 \
+ queue.3 STAILQ_REMOVE_HEAD.3 \
+ queue.3 STAILQ_SWAP.3 \
+ queue.3 TAILQ_CONCAT.3 \
+ queue.3 TAILQ_EMPTY.3 \
+ queue.3 TAILQ_ENTRY.3 \
+ queue.3 TAILQ_FIRST.3 \
+ queue.3 TAILQ_FOREACH.3 \
+ queue.3 TAILQ_FOREACH_REVERSE.3 \
+ queue.3 TAILQ_FOREACH_REVERSE_SAFE.3 \
+ queue.3 TAILQ_FOREACH_SAFE.3 \
+ queue.3 TAILQ_HEAD.3 \
+ queue.3 TAILQ_HEAD_INITIALIZER.3 \
+ queue.3 TAILQ_INIT.3 \
+ queue.3 TAILQ_INSERT_AFTER.3 \
+ queue.3 TAILQ_INSERT_BEFORE.3 \
+ queue.3 TAILQ_INSERT_HEAD.3 \
+ queue.3 TAILQ_INSERT_TAIL.3 \
+ queue.3 TAILQ_LAST.3 \
+ queue.3 TAILQ_NEXT.3 \
+ queue.3 TAILQ_PREV.3 \
+ queue.3 TAILQ_REMOVE.3 \
+ queue.3 TAILQ_SWAP.3
+MLINKS+= stdarg.3 va_arg.3 \
+ stdarg.3 va_copy.3 \
+ stdarg.3 va_end.3 \
+ stdarg.3 varargs.3 \
+ stdarg.3 va_start.3
+MLINKS+= timeradd.3 timerclear.3 \
+ timeradd.3 timercmp.3 \
+ timeradd.3 timerisset.3 \
+ timeradd.3 timersub.3
+MLINKS+= tree.3 RB_EMPTY.3 \
+ tree.3 RB_ENTRY.3 \
+ tree.3 RB_FIND.3 \
+ tree.3 RB_FOREACH.3 \
+ tree.3 RB_FOREACH_REVERSE.3 \
+ tree.3 RB_GENERATE.3 \
+ tree.3 RB_GENERATE_STATIC.3 \
+ tree.3 RB_HEAD.3 \
+ tree.3 RB_INIT.3 \
+ tree.3 RB_INITIALIZER.3 \
+ tree.3 RB_INSERT.3 \
+ tree.3 RB_LEFT.3 \
+ tree.3 RB_MAX.3 \
+ tree.3 RB_MIN.3 \
+ tree.3 RB_NEXT.3 \
+ tree.3 RB_NFIND.3 \
+ tree.3 RB_PARENT.3 \
+ tree.3 RB_PREV.3 \
+ tree.3 RB_PROTOTYPE.3 \
+ tree.3 RB_PROTOTYPE_STATIC.3 \
+ tree.3 RB_REMOVE.3 \
+ tree.3 RB_RIGHT.3 \
+ tree.3 RB_ROOT.3 \
+ tree.3 SPLAY_EMPTY.3 \
+ tree.3 SPLAY_ENTRY.3 \
+ tree.3 SPLAY_FIND.3 \
+ tree.3 SPLAY_FOREACH.3 \
+ tree.3 SPLAY_GENERATE.3 \
+ tree.3 SPLAY_HEAD.3 \
+ tree.3 SPLAY_INIT.3 \
+ tree.3 SPLAY_INITIALIZER.3 \
+ tree.3 SPLAY_INSERT.3 \
+ tree.3 SPLAY_LEFT.3 \
+ tree.3 SPLAY_MAX.3 \
+ tree.3 SPLAY_MIN.3 \
+ tree.3 SPLAY_NEXT.3 \
+ tree.3 SPLAY_PROTOTYPE.3 \
+ tree.3 SPLAY_REMOVE.3 \
+ tree.3 SPLAY_RIGHT.3 \
+ tree.3 SPLAY_ROOT.3
+
+.if ${MK_LIBTHR} != "no"
+PTHREAD_MAN= pthread.3 \
+ pthread_affinity_np.3 \
+ pthread_atfork.3 \
+ pthread_attr.3 \
+ pthread_attr_affinity_np.3 \
+ pthread_attr_get_np.3 \
+ pthread_attr_setcreatesuspend_np.3 \
+ pthread_barrierattr.3 \
+ pthread_barrier_destroy.3 \
+ pthread_cancel.3 \
+ pthread_cleanup_pop.3 \
+ pthread_cleanup_push.3 \
+ pthread_condattr.3 \
+ pthread_cond_broadcast.3 \
+ pthread_cond_destroy.3 \
+ pthread_cond_init.3 \
+ pthread_cond_signal.3 \
+ pthread_cond_timedwait.3 \
+ pthread_cond_wait.3 \
+ pthread_create.3 \
+ pthread_detach.3 \
+ pthread_equal.3 \
+ pthread_exit.3 \
+ pthread_getconcurrency.3 \
+ pthread_getspecific.3 \
+ pthread_getthreadid_np.3 \
+ pthread_join.3 \
+ pthread_key_create.3 \
+ pthread_key_delete.3 \
+ pthread_kill.3 \
+ pthread_main_np.3 \
+ pthread_multi_np.3 \
+ pthread_mutexattr.3 \
+ pthread_mutexattr_getkind_np.3 \
+ pthread_mutex_destroy.3 \
+ pthread_mutex_init.3 \
+ pthread_mutex_lock.3 \
+ pthread_mutex_timedlock.3 \
+ pthread_mutex_trylock.3 \
+ pthread_mutex_unlock.3 \
+ pthread_once.3 \
+ pthread_resume_all_np.3 \
+ pthread_resume_np.3 \
+ pthread_rwlockattr_destroy.3 \
+ pthread_rwlockattr_getpshared.3 \
+ pthread_rwlockattr_init.3 \
+ pthread_rwlockattr_setpshared.3 \
+ pthread_rwlock_destroy.3 \
+ pthread_rwlock_init.3 \
+ pthread_rwlock_rdlock.3 \
+ pthread_rwlock_timedrdlock.3 \
+ pthread_rwlock_timedwrlock.3 \
+ pthread_rwlock_unlock.3 \
+ pthread_rwlock_wrlock.3 \
+ pthread_schedparam.3 \
+ pthread_self.3 \
+ pthread_set_name_np.3 \
+ pthread_setspecific.3 \
+ pthread_sigmask.3 \
+ pthread_spin_init.3 \
+ pthread_spin_lock.3 \
+ pthread_suspend_all_np.3 \
+ pthread_suspend_np.3 \
+ pthread_switch_add_np.3 \
+ pthread_testcancel.3 \
+ pthread_yield.3
+
+PTHREAD_MLINKS= pthread_affinity_np.3 pthread_getaffinity_np.3 \
+ pthread_affinity_np.3 pthread_setaffinity_np.3
+PTHREAD_MLINKS+=pthread_attr.3 pthread_attr_destroy.3 \
+ pthread_attr.3 pthread_attr_getdetachstate.3 \
+ pthread_attr.3 pthread_attr_getguardsize.3 \
+ pthread_attr.3 pthread_attr_getinheritsched.3 \
+ pthread_attr.3 pthread_attr_getschedparam.3 \
+ pthread_attr.3 pthread_attr_getschedpolicy.3 \
+ pthread_attr.3 pthread_attr_getscope.3 \
+ pthread_attr.3 pthread_attr_getstack.3 \
+ pthread_attr.3 pthread_attr_getstackaddr.3 \
+ pthread_attr.3 pthread_attr_getstacksize.3 \
+ pthread_attr.3 pthread_attr_init.3 \
+ pthread_attr.3 pthread_attr_setdetachstate.3 \
+ pthread_attr.3 pthread_attr_setguardsize.3 \
+ pthread_attr.3 pthread_attr_setinheritsched.3 \
+ pthread_attr.3 pthread_attr_setschedparam.3 \
+ pthread_attr.3 pthread_attr_setschedpolicy.3 \
+ pthread_attr.3 pthread_attr_setscope.3 \
+ pthread_attr.3 pthread_attr_setstack.3 \
+ pthread_attr.3 pthread_attr_setstackaddr.3 \
+ pthread_attr.3 pthread_attr_setstacksize.3
+PTHREAD_MLINKS+=pthread_attr_affinity_np.3 pthread_attr_getaffinity_np.3 \
+ pthread_attr_affinity_np.3 pthread_attr_setaffinity_np.3
+PTHREAD_MLINKS+=pthread_barrierattr.3 pthread_barrierattr_destroy.3 \
+ pthread_barrierattr.3 pthread_barrierattr_getpshared.3 \
+ pthread_barrierattr.3 pthread_barrierattr_init.3 \
+ pthread_barrierattr.3 pthread_barrierattr_setpshared.3
+PTHREAD_MLINKS+=pthread_barrier_destroy.3 pthread_barrier_init.3 \
+ pthread_barrier_destroy.3 pthread_barrier_wait.3
+PTHREAD_MLINKS+=pthread_condattr.3 pthread_condattr_destroy.3 \
+ pthread_condattr.3 pthread_condattr_init.3 \
+ pthread_condattr.3 pthread_condattr_getclock.3 \
+ pthread_condattr.3 pthread_condattr_setclock.3 \
+ pthread_condattr.3 pthread_condattr_getpshared.3 \
+ pthread_condattr.3 pthread_condattr_setpshared.3
+PTHREAD_MLINKS+=pthread_getconcurrency.3 pthread_setconcurrency.3
+PTHREAD_MLINKS+=pthread_multi_np.3 pthread_single_np.3
+PTHREAD_MLINKS+=pthread_mutexattr.3 pthread_mutexattr_destroy.3 \
+ pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3 \
+ pthread_mutexattr.3 pthread_mutexattr_getprotocol.3 \
+ pthread_mutexattr.3 pthread_mutexattr_gettype.3 \
+ pthread_mutexattr.3 pthread_mutexattr_init.3 \
+ pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3 \
+ pthread_mutexattr.3 pthread_mutexattr_setprotocol.3 \
+ pthread_mutexattr.3 pthread_mutexattr_settype.3
+PTHREAD_MLINKS+=pthread_mutexattr_getkind_np.3 pthread_mutexattr_setkind_np.3
+PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
+PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
+PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \
+ pthread_schedparam.3 pthread_setschedparam.3
+PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \
+ pthread_spin_lock.3 pthread_spin_trylock.3 \
+ pthread_spin_lock.3 pthread_spin_unlock.3
+PTHREAD_MLINKS+=pthread_switch_add_np.3 pthread_switch_delete_np.3
+PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \
+ pthread_testcancel.3 pthread_setcanceltype.3
+PTHREAD_MLINKS+=pthread_join.3 pthread_timedjoin_np.3
+.endif
+
+.include <bsd.prog.mk>
diff --git a/share/man/man3/assert.3 b/share/man/man3/assert.3
new file mode 100644
index 000000000000..88805357b929
--- /dev/null
+++ b/share/man/man3/assert.3
@@ -0,0 +1,94 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)assert.3 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd January 26, 1999
+.Dt ASSERT 3
+.Os
+.Sh NAME
+.Nm assert
+.Nd expression verification macro
+.Sh SYNOPSIS
+.In assert.h
+.Fn assert expression
+.Sh DESCRIPTION
+The
+.Fn assert
+macro tests the given
+.Ar expression
+and if it is false,
+the calling process is terminated.
+A
+diagnostic message is written to
+.Dv stderr
+and the function
+.Xr abort 3
+is called, effectively terminating the program.
+.Pp
+If
+.Ar expression
+is true,
+the
+.Fn assert
+macro does nothing.
+.Pp
+The
+.Fn assert
+macro
+may be removed at compile time by defining
+.Dv NDEBUG
+as a macro
+(e.g., by using the
+.Xr cc 1
+option
+.Fl D Ns Dv NDEBUG ) .
+.Sh EXAMPLES
+The assertion:
+.Pp
+.Dl "assert(1 == 0);"
+.Pp
+generates a diagnostic message similar to the following:
+.Pp
+.Dl "Assertion failed: (1 == 0), function main, file assertion.c, line 100."
+.Sh SEE ALSO
+.Xr abort 3
+.Sh STANDARDS
+The
+.Fn assert
+macro conforms to
+.St -isoC-99 .
+.Sh HISTORY
+An
+.Nm
+macro appeared in
+.At v6 .
diff --git a/share/man/man3/bitstring.3 b/share/man/man3/bitstring.3
new file mode 100644
index 000000000000..ed7b0f3dfd0c
--- /dev/null
+++ b/share/man/man3/bitstring.3
@@ -0,0 +1,190 @@
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Paul Vixie.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93
+.\" $FreeBSD$
+.\"
+.Dd July 19, 1993
+.Dt BITSTRING 3
+.Os
+.Sh NAME
+.Nm bit_alloc ,
+.Nm bit_clear ,
+.Nm bit_decl ,
+.Nm bit_ffs ,
+.Nm bit_nclear ,
+.Nm bit_nset ,
+.Nm bit_set ,
+.Nm bitstr_size ,
+.Nm bit_test
+.Nd bit-string manipulation macros
+.Sh SYNOPSIS
+.In bitstring.h
+.Ft bitstr_t *
+.Fn bit_alloc "int nbits"
+.Ft void
+.Fn bit_decl "bitstr_t *name" "int nbits"
+.Ft void
+.Fn bit_clear "bitstr_t *name" "int bit"
+.Ft void
+.Fn bit_ffc "bitstr_t *name" "int nbits" "int *value"
+.Ft void
+.Fn bit_ffs "bitstr_t *name" "int nbits" "int *value"
+.Ft void
+.Fn bit_nclear "bitstr_t *name" "int start" "int stop"
+.Ft void
+.Fn bit_nset "bitstr_t *name" "int start" "int stop"
+.Ft void
+.Fn bit_set "bitstr_t *name" "int bit"
+.Ft int
+.Fn bitstr_size "int nbits"
+.Ft int
+.Fn bit_test "bitstr_t *name" "int bit"
+.Sh DESCRIPTION
+These macros operate on strings of bits.
+.Pp
+The macro
+.Fn bit_alloc
+returns a pointer of type
+.Dq Fa "bitstr_t *"
+to sufficient space to store
+.Fa nbits
+bits, or
+.Dv NULL
+if no space is available.
+.Pp
+The macro
+.Fn bit_decl
+allocates sufficient space to store
+.Fa nbits
+bits on the stack.
+.Pp
+The macro
+.Fn bitstr_size
+returns the number of elements of type
+.Fa bitstr_t
+necessary to store
+.Fa nbits
+bits.
+This is useful for copying bit strings.
+.Pp
+The macros
+.Fn bit_clear
+and
+.Fn bit_set
+clear or set the zero-based numbered bit
+.Fa bit ,
+in the bit string
+.Ar name .
+.Pp
+The
+.Fn bit_nset
+and
+.Fn bit_nclear
+macros
+set or clear the zero-based numbered bits from
+.Fa start
+through
+.Fa stop
+in the bit string
+.Ar name .
+.Pp
+The
+.Fn bit_test
+macro
+evaluates to non-zero if the zero-based numbered bit
+.Fa bit
+of bit string
+.Fa name
+is set, and zero otherwise.
+.Pp
+The
+.Fn bit_ffs
+macro
+stores in the location referenced by
+.Fa value
+the zero-based number of the first bit set in the array of
+.Fa nbits
+bits referenced by
+.Fa name .
+If no bits are set, the location referenced by
+.Fa value
+is set to \-1.
+.Pp
+The macro
+.Fn bit_ffc
+stores in the location referenced by
+.Fa value
+the zero-based number of the first bit not set in the array of
+.Fa nbits
+bits referenced by
+.Fa name .
+If all bits are set, the location referenced by
+.Fa value
+is set to \-1.
+.Pp
+The arguments to these macros are evaluated only once and may safely
+have side effects.
+.Sh EXAMPLES
+.Bd -literal -offset indent
+#include <limits.h>
+#include <bitstring.h>
+
+\&...
+#define LPR_BUSY_BIT 0
+#define LPR_FORMAT_BIT 1
+#define LPR_DOWNLOAD_BIT 2
+\&...
+#define LPR_AVAILABLE_BIT 9
+#define LPR_MAX_BITS 10
+
+make_lpr_available()
+{
+ bitstr_t bit_decl(bitlist, LPR_MAX_BITS);
+ ...
+ bit_nclear(bitlist, 0, LPR_MAX_BITS - 1);
+ ...
+ if (!bit_test(bitlist, LPR_BUSY_BIT)) {
+ bit_clear(bitlist, LPR_FORMAT_BIT);
+ bit_clear(bitlist, LPR_DOWNLOAD_BIT);
+ bit_set(bitlist, LPR_AVAILABLE_BIT);
+ }
+}
+.Ed
+.Sh SEE ALSO
+.Xr malloc 3
+.Sh HISTORY
+The
+.Nm bitstring
+functions first appeared in
+.Bx 4.4 .
diff --git a/share/man/man3/end.3 b/share/man/man3/end.3
new file mode 100644
index 000000000000..42e73fe586a4
--- /dev/null
+++ b/share/man/man3/end.3
@@ -0,0 +1,83 @@
+.\" Copyright (c) 1986
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)end.3 6.4 (Berkeley) 1/24/94
+.\" $FreeBSD$
+.\"
+.Dd August 28, 2000
+.Dt END 3
+.Os
+.Sh NAME
+.Nm end ,
+.Nm etext ,
+.Nm edata
+.Nd end boundaries of image segments
+.Sh SYNOPSIS
+.Vt extern end ;
+.Vt extern etext ;
+.Vt extern edata ;
+.Sh DESCRIPTION
+The globals
+.Va end , etext
+and
+.Va edata
+are program segment end addresses.
+.Pp
+.Va etext
+is the first address after the end of the text segment.
+.Pp
+.Va edata
+is the first address after the end of the initialized data segment.
+.Pp
+.Va end
+is the first address after the end of the data segment
+.Pq Tn BSS
+when the program is loaded.
+Use the
+.Xr sbrk 2
+.\".Fn sbrk 0
+system call with zero as its argument to find the current end of the
+data segment.
+.Sh SEE ALSO
+.Xr sbrk 2 ,
+.Xr malloc 3 ,
+.Xr a.out 5
+.Sh HISTORY
+An
+.Nm
+manual page appeared in
+.At v6 .
+.Sh BUGS
+Traditionally, no variable existed that pointed to the start of the
+text segment because the text segment always started at address zero.
+Although it is no longer valid to make this assumption, no
+variable similar to the ones documented above exists to point to the
+start of the text segment.
diff --git a/share/man/man3/fpgetround.3 b/share/man/man3/fpgetround.3
new file mode 100644
index 000000000000..189e252aa2dd
--- /dev/null
+++ b/share/man/man3/fpgetround.3
@@ -0,0 +1,180 @@
+.\" Copyright (c) 1993 Andrew Moore, Talke Studio
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)fpgetround.3 1.0 (Berkeley) 9/23/93
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2010
+.Dt FPGETROUND 3
+.Os
+.Sh NAME
+.Nm fpgetround ,
+.Nm fpsetround ,
+.Nm fpsetprec ,
+.Nm fpgetprec ,
+.Nm fpgetmask ,
+.Nm fpsetmask ,
+.Nm fpgetsticky ,
+.Nm fpresetsticky
+.Nd IEEE floating point interface
+.Sh SYNOPSIS
+.In ieeefp.h
+.Bd -literal
+typedef enum {
+ FP_RN, /* round to nearest */
+ FP_RM, /* round down to minus infinity */
+ FP_RP, /* round up to plus infinity */
+ FP_RZ /* truncate */
+} fp_rnd_t;
+.Ed
+.Ft fp_rnd_t
+.Fn fpgetround void
+.Ft fp_rnd_t
+.Fn fpsetround "fp_rnd_t direction"
+.Bd -literal
+typedef enum {
+ FP_PS, /* 24 bit (single-precision) */
+ FP_PRS, /* reserved */
+ FP_PD, /* 53 bit (double-precision) */
+ FP_PE /* 64 bit (extended-precision) */
+} fp_prec_t;
+.Ed
+.Ft fp_prec_t
+.Fn fpgetprec void
+.Ft fp_prec_t
+.Fn fpsetprec "fp_prec_t precision"
+.Bd -literal
+#define fp_except_t int
+#define FP_X_INV 0x01 /* invalid operation */
+#define FP_X_DNML 0x02 /* denormal */
+#define FP_X_DZ 0x04 /* zero divide */
+#define FP_X_OFL 0x08 /* overflow */
+#define FP_X_UFL 0x10 /* underflow */
+#define FP_X_IMP 0x20 /* (im)precision */
+#define FP_X_STK 0x40 /* stack fault */
+.Ed
+.Ft fp_except_t
+.Fn fpgetmask void
+.Ft fp_except_t
+.Fn fpsetmask "fp_except_t mask"
+.Ft fp_except_t
+.Fn fpgetsticky void
+.Ft fp_except_t
+.Fn fpresetsticky "fp_except_t sticky"
+.Sh DESCRIPTION
+The routines described herein are deprecated.
+New code should use the functionality provided by
+.Xr fenv 3 .
+.Pp
+When a floating point exception is detected, the exception sticky flag is
+set and the exception mask is tested.
+If the mask is set, then a trap
+occurs.
+These routines allow both setting the floating point exception
+masks, and resetting the exception sticky flags after an exception is
+detected.
+In addition, they allow setting the floating point rounding mode
+and precision.
+.Pp
+The
+.Fn fpgetround
+function
+returns the current floating point rounding mode.
+.Pp
+The
+.Fn fpsetround
+function
+sets the floating point rounding mode and returns
+the previous mode.
+.Pp
+The
+.Fn fpgetprec
+function
+returns the current floating point precision.
+.Pp
+The
+.Fn fpsetprec
+function
+sets the floating point precision and returns
+the previous precision.
+.Pp
+The
+.Fn fpgetmask
+function
+returns the current floating point exception masks.
+.Pp
+The
+.Fn fpsetmask
+function
+sets the floating point exception masks and returns the
+previous masks.
+.Pp
+The
+.Fn fpgetsticky
+function
+returns the current floating point sticky flags.
+.Pp
+The
+.Fn fpresetsticky
+function
+clears the floating point sticky flags and returns
+the previous flags.
+.Pp
+Sample code which prevents a trap on divide-by-zero:
+.Bd -literal -offset indent
+fpsetmask(~FP_X_DZ);
+a = 1.0;
+b = 0;
+c = a / b;
+fpresetsticky(FP_X_DZ);
+fpsetmask(FP_X_DZ);
+.Ed
+.Sh IMPLEMENTATION NOTES
+The
+.Fn fpgetprec
+and
+.Fn fpsetprec
+functions provide functionality unavailable on many platforms.
+At present, they are implemented only on the i386 and amd64 platforms.
+Changing precision isn't a supported feature:
+it may be ineffective when code is compiled to take advantage of SSE,
+and many library functions and compiler optimizations depend upon the
+default precision for correct behavior.
+.Sh SEE ALSO
+.Xr fenv 3 ,
+.Xr isnan 3
+.Sh HISTORY
+These routines are based on SysV/386 routines of the same name.
+.Sh CAVEATS
+After a floating point exception and before a mask is set, the sticky
+flags must be reset.
+If another exception occurs before the sticky
+flags are reset, then a wrong exception type may be signaled.
diff --git a/share/man/man3/intro.3 b/share/man/man3/intro.3
new file mode 100644
index 000000000000..5645ad94f996
--- /dev/null
+++ b/share/man/man3/intro.3
@@ -0,0 +1,168 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)intro.3 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt INTRO 3
+.Os
+.Sh NAME
+.Nm intro
+.Nd introduction to the C libraries
+.Sh DESCRIPTION
+This section provides an overview of the C
+library functions, their error returns and other
+common definitions and concepts.
+Most of these functions are available from the C library,
+.Em libc .
+.\" (see
+.\" .Xr libc 3 ) .
+Other libraries, such as the math library,
+.Em libm ,
+must be indicated at compile time with the
+.Fl l
+option of the compiler.
+.\" .Pp
+.\" A subset of the
+.\" .Xr libc functions
+.\" are available from Fortran;
+.\" they are described separately in
+.\" .Xr intro 3f .
+.Pp
+The various libraries (followed by the loader flag):
+.Bl -tag -width "libc (-lc)"
+.It Xr libc Pq Fl l Ns Ar c
+Standard C library functions.
+.\" (See
+.\" .Xr libc 3 . )
+When using the C compiler
+.Xr cc 1 ,
+it is not necessary
+to supply the loader flag
+.Fl l Ns Ar c
+for these functions.
+There are several `libraries' or groups of functions included inside of
+.Xr libc :
+the standard
+.Tn I/O
+routines,
+database routines,
+bit operators,
+string operators,
+character tests and character operators,
+des encryption routines,
+storage allocation, time functions, signal handling and more.
+.It Xr libcurses Pq Fl l Ns Ar curses Fl l Ns Ar termcap
+Terminal independent screen management routines
+for two dimensional non-bitmap display terminals.
+(See
+.Xr ncurses 3 . )
+.It Xr libcompat Pq Fl l Ns Ar compat
+Functions which are obsolete but are available for compatibility with
+.Bx 4.3 .
+In particular,
+a number of system call interfaces provided in previous releases of
+.Bx
+have been included for source code compatibility.
+Use of these routines should, for the most part, be avoided.
+The manual page entry for each compatibility routine
+indicates the proper interface to use.
+.It Xr libkvm Pq Fl l Ns Ar kvm
+Functions used to access kernel memory are in this library.
+They can be used
+against both a running system and a crash dump.
+(See
+.Xr kvm 3 . )
+.It Xr libl Pq Fl l Ns Ar l
+The library for
+.Xr lex 1 .
+.\" .It Xr libln
+.It Xr libm Pq Fl l Ns Ar m
+The math library,
+.Em libm .
+The math library is loaded as needed by the Pascal compiler,
+.\" .Xr pc 1 ,
+but not by the C compiler which requires the
+.Fl l Ns Ar m
+flag.
+(See
+.Xr math 3 . )
+.It Xr libmp Pq Fl l Ns Ar mp
+.\" .It Xr libom
+.\" Old math library.
+.\" .It Xr libplot Pq Fl l Ns Ar plot
+.\" Device independent plotting functions.
+.\" (See
+.\" .Xr plot 3 . )
+.\" .It Xr libplotf77 Pq Fl l Ns Ar plotf77
+.\" The device independent plotting functions for fortran.
+.\" (See
+.\" .Xr plot 3 . )
+.\" .It Xr libresolv Pq Fl l Ns Ar resolv
+.\" Routines for network address resolution.
+.It Xr libtermcap Pq Fl l Ns Ar termcap
+The terminal independent operation library package.
+(See
+.Xr termcap 3 . )
+.\" .It libvt0.a
+.It Xr liby Pq Fl l Ns Ar y
+The library for
+.Xr yacc 1 .
+.El
+.Sh FILES
+.Bl -tag -width /usr/lib/libm_p.a -compact
+.It Pa /usr/lib/libc.a
+the C library
+.It Pa /usr/lib/libc_p.a
+the C library compiled for profiling
+.It Pa /usr/lib/libm.a
+the math library
+.It Pa /usr/lib/libm_p.a
+the math library compiled for profiling
+.El
+.Sh SEE ALSO
+.\" .Xr libc 3 ,
+.Xr cc 1 ,
+.Xr ld 1 ,
+.Xr nm 1 ,
+.Xr intro 2 ,
+.Xr math 3 ,
+.Xr stdio 3
+.\" .Sh LIST OF FUNCTIONS
+.\" .Bl -column "strncasecmpxxx" "system"
+.\" .Sy Name Description
+.\" .El
+.Sh HISTORY
+An
+.Nm
+manual appeared in
+.At v7 .
diff --git a/share/man/man3/makedev.3 b/share/man/man3/makedev.3
new file mode 100644
index 000000000000..b32d69ef624a
--- /dev/null
+++ b/share/man/man3/makedev.3
@@ -0,0 +1,90 @@
+.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 28, 2008
+.Dt MAKEDEV 3
+.Os
+.Sh NAME
+.Nm makedev ,
+.Nm major ,
+.Nm minor
+.Nd device number conversion
+.Sh SYNOPSIS
+.In sys/types.h
+.Ft dev_t
+.Fn makedev "int major" "int minor"
+.Ft int
+.Fn major "dev_t dev"
+.Ft int
+.Fn minor "dev_t dev"
+.Sh DESCRIPTION
+The
+.Fn makedev
+macro allows a unique device number to be generated based on its
+.Fa major
+and
+.Fa minor
+number.
+The
+.Fn major
+and
+.Fn minor
+macros can be used to obtain the original numbers from the device number
+.Fa dev .
+.Pp
+In previous implementations of
+.Fx
+all block and character devices were uniquely identified by a pair of
+major and minor numbers.
+The major number referred to a certain device class (e.g. disks, TTYs)
+while the minor number identified an instance within the device class.
+Later versions of
+.Fx
+automatically generate a unique device number for each character device
+visible in
+.Pa /dev/ .
+These numbers are not divided in device classes.
+.Pp
+On
+.Fx
+these macros are only used by utilities that need to exchange numbers
+with other operating systems that may use different encodings for
+.Vt dev_t ,
+but also applications that present these numbers to the user in a more
+conventional way.
+.Sh RETURN VALUES
+The
+.Fn major
+macro returns a device major number that has a value between 0 and 255.
+The
+.Fn minor
+macro returns a device minor number whose value can span the complete
+range of an
+.Vt int .
+.Sh SEE ALSO
+.Xr devfs 5 ,
+.Xr devname 3 ,
+.Xr mknod 2
diff --git a/share/man/man3/offsetof.3 b/share/man/man3/offsetof.3
new file mode 100644
index 000000000000..e63916b18483
--- /dev/null
+++ b/share/man/man3/offsetof.3
@@ -0,0 +1,47 @@
+.\" $OpenBSD: offsetof.3,v 1.2 2010/02/18 18:30:19 jmc Exp $
+.\"
+.\" Copyright (c) 2010 Thomas Pfaff <tpfaff@tp76.info>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 18 2010
+.Dt OFFSETOF 3
+.Os
+.Sh NAME
+.Nm offsetof
+.Nd offset of a structure member
+.Sh SYNOPSIS
+.Fd #include <stddef.h>
+.Ft size_t
+.Fn offsetof "type" "member"
+.Sh DESCRIPTION
+The
+.Fn offsetof
+macro expands to an integer constant expression of type
+.Ft size_t
+and yields the offset,
+in bytes, of the field
+.Ar member
+from the start of the structure
+.Ar type .
+.Pp
+A compiler error will result if
+.Ar member
+is not aligned to a byte boundary (i.e. it is a bit-field).
+.Sh STANDARDS
+The
+.Fn offsetof
+macro conforms to
+.St -ansiC .
diff --git a/share/man/man3/pthread.3 b/share/man/man3/pthread.3
new file mode 100644
index 000000000000..caa7f7412e3e
--- /dev/null
+++ b/share/man/man3/pthread.3
@@ -0,0 +1,550 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2010
+.Dt PTHREAD 3
+.Os
+.Sh NAME
+.Nm pthread
+.Nd POSIX thread functions
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Sh DESCRIPTION
+POSIX threads are a set of functions that support applications with
+requirements for multiple flows of control, called
+.Em threads ,
+within a process.
+Multithreading is used to improve the performance of a
+program.
+.Pp
+The POSIX thread functions are summarized in this section in the following
+groups:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+Thread Routines
+.It
+Attribute Object Routines
+.It
+Mutex Routines
+.It
+Condition Variable Routines
+.It
+Read/Write Lock Routines
+.It
+Per-Thread Context Routines
+.It
+Cleanup Routines
+.El
+.Ss Thread Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fo pthread_create
+.Fa "pthread_t *thread" "const pthread_attr_t *attr"
+.Fa "void *\*[lp]*start_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
+.Fc
+.Xc
+Creates a new thread of execution.
+.It Xo
+.Ft int
+.Fn pthread_cancel "pthread_t thread"
+.Xc
+Cancels execution of a thread.
+.It Xo
+.Ft int
+.Fn pthread_detach "pthread_t thread"
+.Xc
+Marks a thread for deletion.
+.It Xo
+.Ft int
+.Fn pthread_equal "pthread_t t1" "pthread_t t2"
+.Xc
+Compares two thread IDs.
+.It Xo
+.Ft void
+.Fn pthread_exit "void *value_ptr"
+.Xc
+Terminates the calling thread.
+.It Xo
+.Ft int
+.Fn pthread_join "pthread_t thread" "void **value_ptr"
+.Xc
+Causes the calling thread to wait for the termination of the specified thread.
+.It Xo
+.Ft int
+.Fn pthread_kill "pthread_t thread" "int sig"
+.Xc
+Delivers a signal to a specified thread.
+.It Xo
+.Ft int
+.Fn pthread_once "pthread_once_t *once_control" "void \*[lp]*init_routine\*[rp]\*[lp]void\*[rp]"
+.Xc
+Calls an initialization routine once.
+.It Xo
+.Ft pthread_t
+.Fn pthread_self void
+.Xc
+Returns the thread ID of the calling thread.
+.It Xo
+.Ft int
+.Fn pthread_setcancelstate "int state" "int *oldstate"
+.Xc
+Sets the current thread's cancelability state.
+.It Xo
+.Ft int
+.Fn pthread_setcanceltype "int type" "int *oldtype"
+.Xc
+Sets the current thread's cancelability type.
+.It Xo
+.Ft void
+.Fn pthread_testcancel void
+.Xc
+Creates a cancellation point in the calling thread.
+.It Xo
+.Ft void
+.Fn pthread_yield void
+.Xc
+Allows the scheduler to run another thread instead of the current one.
+.El
+.Ss Attribute Object Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fn pthread_attr_destroy "pthread_attr_t *attr"
+.Xc
+Destroy a thread attributes object.
+.It Xo
+.Ft int
+.Fo pthread_attr_getinheritsched
+.Fa "const pthread_attr_t *attr" "int *inheritsched"
+.Fc
+.Xc
+Get the inherit scheduling attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fo pthread_attr_getschedparam
+.Fa "const pthread_attr_t *attr" "struct sched_param *param"
+.Fc
+.Xc
+Get the scheduling parameter attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
+.Xc
+Get the scheduling policy attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
+.Xc
+Get the contention scope attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
+.Xc
+Get the stack size attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
+.Xc
+Get the stack address attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
+.Xc
+Get the detach state attribute from a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_init "pthread_attr_t *attr"
+.Xc
+Initialize a thread attributes object with default values.
+.It Xo
+.Ft int
+.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
+.Xc
+Set the inherit scheduling attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fo pthread_attr_setschedparam
+.Fa "pthread_attr_t *attr" "const struct sched_param *param"
+.Fc
+.Xc
+Set the scheduling parameter attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
+.Xc
+Set the scheduling policy attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
+.Xc
+Set the contention scope attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
+.Xc
+Set the stack size attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
+.Xc
+Set the stack address attribute in a thread attributes object.
+.It Xo
+.Ft int
+.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
+.Xc
+Set the detach state in a thread attributes object.
+.El
+.Ss Mutex Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr"
+.Xc
+Destroy a mutex attributes object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *ceiling"
+.Xc
+Obtain priority ceiling attribute of mutex attribute object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
+.Xc
+Obtain protocol attribute of mutex attribute object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
+.Xc
+Obtain the mutex type attribute in the specified mutex attributes object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_init "pthread_mutexattr_t *attr"
+.Xc
+Initialize a mutex attributes object with default values.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int ceiling"
+.Xc
+Set priority ceiling attribute of mutex attribute object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
+.Xc
+Set protocol attribute of mutex attribute object.
+.It Xo
+.Ft int
+.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
+.Xc
+Set the mutex type attribute that is used when a mutex is created.
+.It Xo
+.Ft int
+.Fn pthread_mutex_destroy "pthread_mutex_t *mutex"
+.Xc
+Destroy a mutex.
+.It Xo
+.Ft int
+.Fo pthread_mutex_init
+.Fa "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr"
+.Fc
+.Xc
+Initialize a mutex with specified attributes.
+.It Xo
+.Ft int
+.Fn pthread_mutex_lock "pthread_mutex_t *mutex"
+.Xc
+Lock a mutex and block until it becomes available.
+.It Xo
+.Ft int
+.Fo pthread_mutex_timedlock
+.Fa "pthread_mutex_t *mutex" "const struct timespec *abstime"
+.Fc
+.Xc
+Lock a mutex and block until it becomes available or until the timeout expires.
+.It Xo
+.Ft int
+.Fn pthread_mutex_trylock "pthread_mutex_t *mutex"
+.Xc
+Try to lock a mutex, but do not block if the mutex is locked by another thread,
+including the current thread.
+.It Xo
+.Ft int
+.Fn pthread_mutex_unlock "pthread_mutex_t *mutex"
+.Xc
+Unlock a mutex.
+.El
+.Ss Condition Variable Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
+.Xc
+Destroy a condition variable attributes object.
+.It Xo
+.Ft int
+.Fn pthread_condattr_init "pthread_condattr_t *attr"
+.Xc
+Initialize a condition variable attributes object with default values.
+.It Xo
+.Ft int
+.Fn pthread_cond_broadcast "pthread_cond_t *cond"
+.Xc
+Unblock all threads currently blocked on the specified condition variable.
+.It Xo
+.Ft int
+.Fn pthread_cond_destroy "pthread_cond_t *cond"
+.Xc
+Destroy a condition variable.
+.It Xo
+.Ft int
+.Fn pthread_cond_init "pthread_cond_t *cond" "const pthread_condattr_t *attr"
+.Xc
+Initialize a condition variable with specified attributes.
+.It Xo
+.Ft int
+.Fn pthread_cond_signal "pthread_cond_t *cond"
+.Xc
+Unblock at least one of the threads blocked on the specified condition variable.
+.It Xo
+.Ft int
+.Fo pthread_cond_timedwait
+.Fa "pthread_cond_t *cond" "pthread_mutex_t *mutex"
+.Fa "const struct timespec *abstime"
+.Fc
+.Xc
+Wait no longer than the specified time for a condition
+and lock the specified mutex.
+.It Xo
+.Ft int
+.Fn pthread_cond_wait "pthread_cond_t *" "pthread_mutex_t *mutex"
+.Xc
+Wait for a condition and lock the specified mutex.
+.El
+.Ss Read/Write Lock Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fn pthread_rwlock_destroy "pthread_rwlock_t *lock"
+.Xc
+Destroy a read/write lock object.
+.It Xo
+.Ft int
+.Fo pthread_rwlock_init
+.Fa "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr"
+.Fc
+.Xc
+Initialize a read/write lock object.
+.It Xo
+.Ft int
+.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
+.Xc
+Lock a read/write lock for reading, blocking until the lock can be
+acquired.
+.It Xo
+.Ft int
+.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
+.Xc
+Attempt to lock a read/write lock for reading, without blocking if the
+lock is unavailable.
+.It Xo
+.Ft int
+.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock"
+.Xc
+Attempt to lock a read/write lock for writing, without blocking if the
+lock is unavailable.
+.It Xo
+.Ft int
+.Fn pthread_rwlock_unlock "pthread_rwlock_t *lock"
+.Xc
+Unlock a read/write lock.
+.It Xo
+.Ft int
+.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock"
+.Xc
+Lock a read/write lock for writing, blocking until the lock can be
+acquired.
+.It Xo
+.Ft int
+.Fn pthread_rwlockattr_destroy "pthread_rwlockattr_t *attr"
+.Xc
+Destroy a read/write lock attribute object.
+.It Xo
+.Ft int
+.Fo pthread_rwlockattr_getpshared
+.Fa "const pthread_rwlockattr_t *attr" "int *pshared"
+.Fc
+.Xc
+Retrieve the process shared setting for the read/write lock attribute
+object.
+.It Xo
+.Ft int
+.Fn pthread_rwlockattr_init "pthread_rwlockattr_t *attr"
+.Xc
+Initialize a read/write lock attribute object.
+.It Xo
+.Ft int
+.Fn pthread_rwlockattr_setpshared "pthread_rwlockattr_t *attr" "int pshared"
+.Xc
+Set the process shared setting for the read/write lock attribute object.
+.El
+.Ss Per-Thread Context Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fn pthread_key_create "pthread_key_t *key" "void \*[lp]*routine\*[rp]\*[lp]void *\*[rp]"
+.Xc
+Create a thread-specific data key.
+.It Xo
+.Ft int
+.Fn pthread_key_delete "pthread_key_t key"
+.Xc
+Delete a thread-specific data key.
+.It Xo
+.Ft "void *"
+.Fn pthread_getspecific "pthread_key_t key"
+.Xc
+Get the thread-specific value for the specified key.
+.It Xo
+.Ft int
+.Fn pthread_setspecific "pthread_key_t key" "const void *value_ptr"
+.Xc
+Set the thread-specific value for the specified key.
+.El
+.Ss Cleanup Routines
+.Bl -tag -width indent
+.It Xo
+.Ft int
+.Fo pthread_atfork
+.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]"
+.Fc
+.Xc
+Register fork handlers
+.It Xo
+.Ft void
+.Fn pthread_cleanup_pop "int execute"
+.Xc
+Remove the routine at the top of the calling thread's cancellation cleanup
+stack and optionally invoke it.
+.It Xo
+.Ft void
+.Fn pthread_cleanup_push "void \*[lp]*routine\*[rp]\*[lp]void *\*[rp]" "void *routine_arg"
+.Xc
+Push the specified cancellation cleanup handler onto the calling thread's
+cancellation stack.
+.El
+.Sh IMPLEMENTATION NOTES
+The current
+.Fx
+POSIX thread implementation is built into the
+.Lb libthr
+library.
+It contains thread-safe versions of
+.Lb libc
+functions and the thread functions.
+Threaded applications are linked with this library.
+.Sh SEE ALSO
+.Xr libthr 3 ,
+.Xr pthread_affinity_np 3 ,
+.Xr pthread_atfork 3 ,
+.Xr pthread_attr 3 ,
+.Xr pthread_cancel 3 ,
+.Xr pthread_cleanup_pop 3 ,
+.Xr pthread_cleanup_push 3 ,
+.Xr pthread_condattr_destroy 3 ,
+.Xr pthread_condattr_init 3 ,
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_timedwait 3 ,
+.Xr pthread_cond_wait 3 ,
+.Xr pthread_create 3 ,
+.Xr pthread_detach 3 ,
+.Xr pthread_equal 3 ,
+.Xr pthread_exit 3 ,
+.Xr pthread_getspecific 3 ,
+.Xr pthread_join 3 ,
+.Xr pthread_key_delete 3 ,
+.Xr pthread_kill 3 ,
+.Xr pthread_mutexattr_destroy 3 ,
+.Xr pthread_mutexattr_getprioceiling 3 ,
+.Xr pthread_mutexattr_getprotocol 3 ,
+.Xr pthread_mutexattr_gettype 3 ,
+.Xr pthread_mutexattr_init 3 ,
+.Xr pthread_mutexattr_setprioceiling 3 ,
+.Xr pthread_mutexattr_setprotocol 3 ,
+.Xr pthread_mutexattr_settype 3 ,
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_trylock 3 ,
+.Xr pthread_mutex_unlock 3 ,
+.Xr pthread_once 3 ,
+.Xr pthread_rwlockattr_destroy 3 ,
+.Xr pthread_rwlockattr_getpshared 3 ,
+.Xr pthread_rwlockattr_init 3 ,
+.Xr pthread_rwlockattr_setpshared 3 ,
+.Xr pthread_rwlock_destroy 3 ,
+.Xr pthread_rwlock_init 3 ,
+.Xr pthread_rwlock_rdlock 3 ,
+.Xr pthread_rwlock_unlock 3 ,
+.Xr pthread_rwlock_wrlock 3 ,
+.Xr pthread_self 3 ,
+.Xr pthread_setcancelstate 3 ,
+.Xr pthread_setcanceltype 3 ,
+.Xr pthread_setspecific 3 ,
+.Xr pthread_testcancel 3
+.Sh STANDARDS
+The functions with the
+.Nm pthread_
+prefix and not
+.Nm _np
+suffix or
+.Nm pthread_rwlock
+prefix conform to
+.St -p1003.1-96 .
+.Pp
+The functions with the
+.Nm pthread_
+prefix and
+.Nm _np
+suffix are non-portable extensions to POSIX threads.
+.Pp
+The functions with the
+.Nm pthread_rwlock
+prefix are extensions created by The Open Group as part of the
+.St -susv2 .
diff --git a/share/man/man3/pthread_affinity_np.3 b/share/man/man3/pthread_affinity_np.3
new file mode 100644
index 000000000000..95128c8ebd5e
--- /dev/null
+++ b/share/man/man3/pthread_affinity_np.3
@@ -0,0 +1,156 @@
+.\"-
+.\" Copyright (c) 2010 Xin LI <delphij@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 23, 2010
+.Dt PTHREAD_AFFINITY_NP 3
+.Os
+.Sh NAME
+.Nm pthread_getaffinity_np ,
+.Nm pthread_setaffinity_np
+.Nd manage CPU affinity
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_getaffinity_np "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp"
+.Ft int
+.Fn pthread_setaffinity_np "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp"
+.Sh DESCRIPTION
+.Fn pthread_getaffinity_np
+and
+.Fn pthread_setaffinity_np
+allow the manipulation of sets of CPUs available to the specified thread.
+.Pp
+Masks of type
+.Ft cpuset_t
+are composed using the
+.Xr CPU_SET 3
+macros.
+The kernel tolerates large sets as long as all CPUs specified
+in the set exist.
+Sets smaller than the kernel uses generate an error on calls to
+.Fn pthread_getaffinity_np
+even if the result set would fit within the user supplied set.
+Calls to
+.Fn pthread_setaffinity_np
+tolerate small sets with no restrictions.
+.Pp
+The supplied mask should have a size of
+.Fa cpusetsize
+bytes.
+This size is usually provided by calling
+.Li sizeof(cpuset_t)
+which is ultimately determined by the value of
+.Dv CPU_SETSIZE
+as defined in
+.In sys/cpuset.h .
+.Pp
+.Fn pthread_getaffinity_np
+retrieves the
+mask from the thread specified by
+.Fa td ,
+and stores it in the space provided by
+.Fa cpusetp .
+.Pp
+.Fn pthread_setaffinity_np
+attempts to set the mask for the thread specified by
+.Fa td
+to the value in
+.Fa cpusetp .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_getaffinity_np
+and
+.Fn pthread_setaffinity_np
+functions will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_getaffinity_np
+and
+.Fn pthread_setaffinity_np
+functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EDEADLK
+The
+.Fn pthread_setaffinity_np
+call would leave a thread without a valid CPU to run on because the set
+does not overlap with the thread's anonymous mask.
+.It Bq Er EFAULT
+The
+.Fa cpusetp
+pointer passed was invalid.
+.It Bq Er ESRCH
+The thread specified by the
+.Fa td
+argument could not be found.
+.It Bq Er ERANGE
+The
+.Fa cpusetsize
+was either preposterously large or smaller than the kernel set size.
+.It Bq Er EPERM
+The calling thread did not have the credentials required to complete the
+operation.
+.El
+.Sh SEE ALSO
+.Xr cpuset 1 ,
+.Xr cpuset 2 ,
+.Xr cpuset_getid 2 ,
+.Xr cpuset_setid 2 ,
+.Xr CPU_SET 3 ,
+.Xr pthread 3 ,
+.Xr pthread_attr_getaffinity_np 3 ,
+.Xr pthread_attr_setaffinity_np 3
+.Sh STANDARDS
+The
+.Nm pthread_getaffinity_np
+and
+.Nm pthread_setaffinity_np
+functions are non-standard
+.Fx
+extensions and may be not available on other operating systems.
+.Sh HISTORY
+The
+.Nm pthread_getaffinity_np
+and
+.Nm pthread_setaffinity_np
+function first appeared in
+.Fx 7.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm pthread_getaffinity_np
+and
+.Nm pthread_setaffinity_np
+functions were written by
+.An David Xu
+.Aq davidxu@FreeBSD.org ,
+and this manpage was written by
+.An Xin LI
+.Aq delphij@FreeBSD.org .
diff --git a/share/man/man3/pthread_atfork.3 b/share/man/man3/pthread_atfork.3
new file mode 100644
index 000000000000..125bb430316e
--- /dev/null
+++ b/share/man/man3/pthread_atfork.3
@@ -0,0 +1,117 @@
+.\" Copyright (c) 2004 Alex Vasylenko <lxv@omut.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Portions of this text are reprinted and reproduced in electronic form
+.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
+.\" Portable Operating System Interface (POSIX), The Open Group Base
+.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
+.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
+.\" event of any discrepancy between this version and the original IEEE and
+.\" The Open Group Standard, the original IEEE and The Open Group Standard is
+.\" the referee document. The original Standard can be obtained online at
+.\" http://www.opengroup.org/unix/online.html.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 21, 2004
+.Dt PTHREAD_ATFORK 3
+.Os
+.Sh NAME
+.Nm pthread_atfork
+.Nd register fork handlers
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fo pthread_atfork
+.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pthread_atfork
+function declares fork handlers to be called before and after
+.Xr fork 2 ,
+in the context of the thread that called
+.Xr fork 2 .
+.Pp
+The handlers registered with
+.Fn pthread_atfork
+are called at the moments in time described below:
+.Bl -tag -width ".Fa prepare"
+.It Fa prepare
+Before
+.Xr fork 2
+processing commences in the parent process.
+If more than one
+.Fa prepare
+handler is registered they will be called in the opposite order
+they were registered.
+.It Fa parent
+After
+.Xr fork 2
+completes in the parent process.
+If more than one
+.Fa parent
+handler is registered they will be called in the same order
+they were registered.
+.It Fa child
+After
+.Xr fork 2
+processing completes in the child process.
+If more than one
+.Fa child
+handler is registered they will be called in the same order
+they were registered.
+.El
+.Pp
+If no handling is desired at one or more of these three points,
+a null pointer may be passed as the corresponding fork handler.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_atfork
+function will return zero.
+Otherwise an error number will be returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_atfork
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient table space exists to record the fork handler addresses.
+.El
+.Sh SEE ALSO
+.Xr fork 2 ,
+.Xr pthread 3
+.Sh STANDARDS
+The
+.Fn pthread_atfork
+function is expected to conform to
+.St -p1003.1 .
+.Sh AUTHORS
+This manpage was written by
+.An Alex Vasylenko
+.Aq lxv@omut.org .
diff --git a/share/man/man3/pthread_attr.3 b/share/man/man3/pthread_attr.3
new file mode 100644
index 000000000000..a99d32d626cc
--- /dev/null
+++ b/share/man/man3/pthread_attr.3
@@ -0,0 +1,238 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd January 8, 2010
+.Dt PTHREAD_ATTR 3
+.Os
+.Sh NAME
+.Nm pthread_attr_init ,
+.Nm pthread_attr_destroy ,
+.Nm pthread_attr_setstack ,
+.Nm pthread_attr_getstack ,
+.Nm pthread_attr_setstacksize ,
+.Nm pthread_attr_getstacksize ,
+.Nm pthread_attr_setguardsize ,
+.Nm pthread_attr_getguardsize ,
+.Nm pthread_attr_setstackaddr ,
+.Nm pthread_attr_getstackaddr ,
+.Nm pthread_attr_setdetachstate ,
+.Nm pthread_attr_getdetachstate ,
+.Nm pthread_attr_setinheritsched ,
+.Nm pthread_attr_getinheritsched ,
+.Nm pthread_attr_setschedparam ,
+.Nm pthread_attr_getschedparam ,
+.Nm pthread_attr_setschedpolicy ,
+.Nm pthread_attr_getschedpolicy ,
+.Nm pthread_attr_setscope ,
+.Nm pthread_attr_getscope
+.Nd thread attribute operations
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_attr_init "pthread_attr_t *attr"
+.Ft int
+.Fn pthread_attr_destroy "pthread_attr_t *attr"
+.Ft int
+.Fn pthread_attr_setstack "pthread_attr_t *attr" " void *stackaddr" "size_t stacksize"
+.Ft int
+.Fn pthread_attr_getstack "const pthread_attr_t * restrict attr" "void ** restrict stackaddr" "size_t * restrict stacksize"
+.Ft int
+.Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
+.Ft int
+.Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
+.Ft int
+.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
+.Ft int
+.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
+.Ft int
+.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
+.Ft int
+.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
+.Ft int
+.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
+.Ft int
+.Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
+.Ft int
+.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
+.Ft int
+.Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched"
+.Ft int
+.Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param"
+.Ft int
+.Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param"
+.Ft int
+.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
+.Ft int
+.Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
+.Ft int
+.Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
+.Ft int
+.Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
+.Sh DESCRIPTION
+Thread attributes are used to specify parameters to
+.Fn pthread_create .
+One attribute object can be used in multiple calls to
+.Fn pthread_create ,
+with or without modifications between calls.
+.Pp
+The
+.Fn pthread_attr_init
+function initializes
+.Fa attr
+with all the default thread attributes.
+.Pp
+The
+.Fn pthread_attr_destroy
+function destroys
+.Fa attr .
+.Pp
+The
+.Fn pthread_attr_set*
+functions set the attribute that corresponds to each function name.
+.Pp
+The
+.Fn pthread_attr_get*
+functions copy the value of the attribute that corresponds to each function name
+to the location pointed to by the second function parameter.
+.Sh RETURN VALUES
+If successful, these functions return 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_attr_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Out of memory.
+.El
+.Pp
+The
+.Fn pthread_attr_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_attr_setstacksize
+and
+.Fn pthread_attr_setstack
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa stacksize
+is less than
+.Dv PTHREAD_STACK_MIN .
+.El
+.Pp
+The
+.Fn pthread_attr_setdetachstate
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa detachstate .
+.El
+.Pp
+The
+.Fn pthread_attr_setinheritsched
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_attr_setschedparam
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.It Bq Er ENOTSUP
+Invalid value for
+.Fa param .
+.El
+.Pp
+The
+.Fn pthread_attr_setschedpolicy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.It Bq Er ENOTSUP
+Invalid or unsupported value for
+.Fa policy .
+.El
+.Pp
+The
+.Fn pthread_attr_setscope
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.It Bq Er ENOTSUP
+Invalid or unsupported value for
+.Fa contentionscope .
+.El
+.Sh SEE ALSO
+.Xr pthread_attr_get_np 3 ,
+.Xr pthread_attr_affinity_np 3 ,
+.Xr pthread_create 3
+.Sh STANDARDS
+.Fn pthread_attr_init ,
+.Fn pthread_attr_destroy ,
+.Fn pthread_attr_setstacksize ,
+.Fn pthread_attr_getstacksize ,
+.Fn pthread_attr_setstackaddr ,
+.Fn pthread_attr_getstackaddr ,
+.Fn pthread_attr_setdetachstate ,
+and
+.Fn pthread_attr_getdetachstate
+functions conform to
+.St -p1003.1-96
+.Pp
+The
+.Fn pthread_attr_setinheritsched ,
+.Fn pthread_attr_getinheritsched ,
+.Fn pthread_attr_setschedparam ,
+.Fn pthread_attr_getschedparam ,
+.Fn pthread_attr_setschedpolicy ,
+.Fn pthread_attr_getschedpolicy ,
+.Fn pthread_attr_setscope ,
+and
+.Fn pthread_attr_getscope
+functions conform to
+.St -susv2
diff --git a/share/man/man3/pthread_attr_affinity_np.3 b/share/man/man3/pthread_attr_affinity_np.3
new file mode 100644
index 000000000000..8813f1a07dc9
--- /dev/null
+++ b/share/man/man3/pthread_attr_affinity_np.3
@@ -0,0 +1,162 @@
+.\"-
+.\" Copyright (c) 2010 Xin LI <delphij@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2010
+.Dt PTHREAD_ATTR_AFFINITY_NP 3
+.Os
+.Sh NAME
+.Nm pthread_attr_getaffinity_np ,
+.Nm pthread_attr_setaffinity_np
+.Nd manage CPU affinity in thread attribute objects
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_attr_getaffinity_np "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp"
+.Ft int
+.Fn pthread_attr_setaffinity_np "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp"
+.Sh DESCRIPTION
+The
+.Fn pthread_attr_getaffinity_np
+and
+.Fn pthread_attr_setaffinity_np
+functions allow the manipulation of sets of CPUs available to the specified thread attribute object.
+.Pp
+Masks of type
+.Ft cpuset_t
+are composed using the
+.Xr CPU_SET 3
+macros.
+The kernel tolerates large sets as long as all CPUs specified
+in the set exist.
+Sets smaller than the kernel uses generate an error on calls to
+.Fn pthread_attr_getaffinity_np
+even if the result set would fit within the user supplied set.
+Calls to
+.Fn pthread_attr_setaffinity_np
+tolerate small sets with no restrictions.
+.Pp
+The supplied mask should have a size of
+.Fa cpusetsize
+bytes.
+This size is usually provided by calling
+.Li sizeof(cpuset_t)
+which is ultimately determined by the value of
+.Dv CPU_SETSIZE
+as defined in
+.In sys/cpuset.h .
+.Pp
+.Fn pthread_attr_getaffinity_np
+retrieves the
+mask from the thread attribute object specified by
+.Fa pattr ,
+and stores it in the space provided by
+.Fa cpusetp .
+.Pp
+.Fn pthread_attr_setaffinity_np
+sets the mask for the thread attribute object specified by
+.Fa pattr
+to the value in
+.Fa cpusetp .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_attr_getaffinity_np
+and
+.Fn pthread_attr_setaffinity_np
+functions will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_attr_getaffinity_np
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa pattr
+or the attribute specified by it is
+.Dv NULL .
+.It Bq Er ERANGE
+The
+.Fa cpusetsize
+is too small.
+.El
+.Pp
+The
+.Fn pthread_attr_setaffinity_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa pattr
+or the attribute specified by it is
+.Dv NULL .
+.It Bq Er EINVAL
+The
+.Fa cpusetp
+specified a CPU that was outside the set supported by the kernel.
+.It Bq Er ERANGE
+The
+.Fa cpusetsize
+is too small.
+.It Bq Er ENOMEM
+Insufficient memory exists to store the cpuset mask.
+.El
+.Sh SEE ALSO
+.Xr cpuset 1 ,
+.Xr cpuset 2 ,
+.Xr cpuset_getid 2 ,
+.Xr cpuset_setid 2 ,
+.Xr CPU_SET 3 ,
+.Xr pthread_get_affinity_np 3 ,
+.Xr pthread_set_affinity_np 3
+.Sh STANDARDS
+The
+.Nm pthread_attr_getaffinity_np
+and
+.Nm pthread_attr_setaffinity_np
+functions are non-standard
+.Fx
+extensions and may be not available on other operating systems.
+.Sh HISTORY
+The
+.Nm pthread_attr_getaffinity_np
+and
+.Nm pthread_attr_setaffinity_np
+functions first appeared in
+.Fx 7.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm pthread_attr_getaffinity_np
+and
+.Nm pthread_attr_setaffinity_np
+functions were written by
+.An David Xu Aq davidxu@FreeBSD.org ,
+and this manpage was written by
+.An Xin LI Aq delphij@FreeBSD.org .
diff --git a/share/man/man3/pthread_attr_get_np.3 b/share/man/man3/pthread_attr_get_np.3
new file mode 100644
index 000000000000..774be8f02875
--- /dev/null
+++ b/share/man/man3/pthread_attr_get_np.3
@@ -0,0 +1,116 @@
+.\" Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 31, 2003
+.Dt PTHREAD_ATTR_GET_NP 3
+.Os
+.Sh NAME
+.Nm pthread_attr_get_np
+.Nd get attributes of existent thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_attr_get_np "pthread_t pid" "pthread_attr_t *dst"
+.Sh DESCRIPTION
+The
+.Fn pthread_attr_get_np
+function is used to get existent thread's attributes.
+Most fields of
+.Vt pthread_attr_t
+structure are exact values of attributes provided at thread creation
+time (as parameter to
+.Xr pthread_create 3
+function), except for the stack address.
+.Pp
+Value returned as
+.Fa dst
+is supposed to be used in conjunction with
+.Fn pthread_attr_get*
+functions to retrieve individual values from
+.Vt pthread_attr_t
+structure.
+Parameter
+.Fa dst
+should point to allocated memory area big enough to fit this structure.
+.Pp
+It is HIGHLY RECOMMENDED to use
+.Xr pthread_attr_init 3
+function to allocate attribute storage.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn pthread_attr_get_np
+function will always return a pointer to the thread's real stack address,
+regardless of its value in the original attributes structure.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_attr_get_np
+function returns 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh EXAMPLES
+.Bd -literal
+size_t
+my_thread_stack_size(pthread_t pid)
+{
+ pthread_attr_t attr;
+ size_t size;
+
+ pthread_attr_init(&attr);
+ pthread_attr_get_np(pid, &attr);
+ pthread_attr_getstacksize(&attr, &size);
+ pthread_attr_destroy(&attr);
+ return(size);
+}
+.Ed
+.Sh ERRORS
+The
+.Fn pthread_attr_get_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for one of given parameters.
+.It Bq Er ESRC
+No thread could be found corresponding to that specified by the given
+thread ID.
+.El
+.Sh SEE ALSO
+.Xr pthread_attr_destroy 3 ,
+.Xr pthread_attr_getdetachstate 3 ,
+.Xr pthread_attr_getinheritsched 3 ,
+.Xr pthread_attr_getschedparam 3 ,
+.Xr pthread_attr_getschedpolicy 3 ,
+.Xr pthread_attr_getscope 3 ,
+.Xr pthread_attr_getstack 3 ,
+.Xr pthread_attr_getstackaddr 3 ,
+.Xr pthread_attr_getstacksize 3 ,
+.Xr pthread_attr_init 3
+.Sh AUTHORS
+The
+.Fn pthread_attr_get_np
+function and this manual page were written by
+.An Alexey Zelkin
+.Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_attr_setcreatesuspend_np.3 b/share/man/man3/pthread_attr_setcreatesuspend_np.3
new file mode 100644
index 000000000000..92c2fe0a7059
--- /dev/null
+++ b/share/man/man3/pthread_attr_setcreatesuspend_np.3
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_ATTR_SETCREATESUSPEND_NP 3
+.Os
+.Sh NAME
+.Nm pthread_attr_setcreatesuspend_np
+.Nd prepare attribute for creation of suspended thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_attr_setcreatesuspend_np
+instructs
+.Xr pthread_create 3
+that the thread created with the
+.Fa attr
+attribute
+should be created and left in a suspended state until explicitly resumed
+by the call to
+.Fn pthread_resume_np
+or
+.Fn pthread_resume_all_np .
+.Sh RETURN VALUES
+.Rv -std pthread_attr_setcreatesuspend_np
+.Sh ERRORS
+The
+.Fn pthread_attr_setcreatesuspend_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_attr_destroy 3 ,
+.Xr pthread_attr_init 3 ,
+.Xr pthread_create 3 ,
+.Xr pthread_resume_all_np 3 ,
+.Xr pthread_resume_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_barrier_destroy.3 b/share/man/man3/pthread_barrier_destroy.3
new file mode 100644
index 000000000000..34be9d0c793f
--- /dev/null
+++ b/share/man/man3/pthread_barrier_destroy.3
@@ -0,0 +1,158 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 19, 2004
+.Dt PTHREAD_BARRIER 3
+.Os
+.Sh NAME
+.Nm pthread_barrier_destroy , pthread_barrier_init , pthread_barrier_wait
+.Nd "destroy, initialize or wait on a barrier object"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_barrier_destroy "pthread_barrier_t *barrier"
+.Ft int
+.Fn pthread_barrier_init "pthread_barrier_t *barrier" "const pthread_barrierattr_t *attr" "unsigned count"
+.Ft int
+.Fn pthread_barrier_wait "pthread_barrier_t *barrier"
+.Sh DESCRIPTION
+The
+.Fn pthread_barrier_init
+function will initialize
+.Fa barrier
+with attributes specified in
+.Fa attr ,
+or if it is
+.Dv NULL ,
+with default attributes.
+The number of threads that must call
+.Fn pthread_barrier_wait
+before any of the waiting threads can be
+released is specified by
+.Fa count .
+The
+.Fn pthread_barrier_destroy
+function will destroy
+.Fa barrier
+and release any resources that may have been allocated on its behalf.
+.Pp
+The
+.Fn pthread_barrier_wait
+function will synchronize calling threads at
+.Fa barrier .
+The threads will be blocked from
+making further progress until
+a sufficient number of threads calls this function.
+The number of threads that must call it before
+any of them will be released is determined by the
+.Fa count
+argument to
+.Fn pthread_barrier_init .
+Once the threads have been released the barrier will be reset.
+.Sh IMPLEMENTATION NOTES
+In both
+.Lb libkse
+and
+.Lb libthr
+the
+.Dv PTHREAD_BARRIER_SERIAL_THREAD
+return value will
+always be returned by the last thread to reach the barrier.
+.Sh RETURN VALUES
+If successful,
+both
+.Fn pthread_barrier_destroy
+and
+.Fn pthread_barrier_init
+will return zero.
+Otherwise, an error number will be returned to indicate the error.
+If the call to
+.Fn pthread_barrier_wait
+is successful, all but one of the threads will return zero.
+That one thread will return
+.Dv PTHREAD_BARRIER_SERIAL_THREAD .
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+None of these functions will return
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_barrier_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+An attempt was made to destroy
+.Fa barrier
+while it was in use.
+.El
+.Pp
+The
+.Fn pthread_barrier_destroy
+and
+.Fn pthread_barrier_wait
+functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa barrier
+is invalid.
+.El
+.Pp
+The
+.Fn pthread_barrier_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system lacks resources,
+other than memory,
+to initialize
+.Fa barrier .
+.It Bq Er EINVAL
+The
+.Fa count
+argument is less than 1.
+.It Bq Er ENOMEM
+Insufficient memory to initialize
+.Fa barrier .
+.El
+.Sh SEE ALSO
+.Xr pthread_barrierattr 3
+.Sh HISTORY
+The
+.Fn pthread_barrier_destroy ,
+.Fn pthread_barrier_init
+and
+.Fn pthread_barrier_wait
+functions first appeared in
+.Lb libkse
+in
+.Fx 5.2 ,
+and in
+.Lb libthr
+in
+.Fx 5.3 .
diff --git a/share/man/man3/pthread_barrierattr.3 b/share/man/man3/pthread_barrierattr.3
new file mode 100644
index 000000000000..e314a0e6180e
--- /dev/null
+++ b/share/man/man3/pthread_barrierattr.3
@@ -0,0 +1,148 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 19, 2004
+.Dt PTHREAD_BARRIERATTR 3
+.Os
+.Sh NAME
+.Nm pthread_barrierattr_destroy , pthread_barrierattr_getpshared ,
+.Nm pthread_barrierattr_init , pthread_barrierattr_setpshared
+.Nd "manipulate a barrier attribute object"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr"
+.Ft int
+.Fn pthread_barrierattr_getpshared "const pthread_barrierattr_t *attr" "int *pshared"
+.Ft int
+.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr"
+.Ft int
+.Fn pthread_barrierattr_setpshared "pthread_barrierattr_t *attr" "int pshared"
+.Sh DESCRIPTION
+The
+.Fn pthread_barrierattr_init
+function will initialize
+.Fa attr
+with default attributes.
+The
+.Fn pthread_barrierattr_destroy
+function will destroy
+.Fa attr
+and release any resources that may have been allocated on its behalf.
+.Pp
+The
+.Fn pthread_barrierattr_getpshared
+function will put the value of the process-shared attribute from
+.Fa attr
+into the memory area pointed to by
+.Fa pshared .
+The
+.Fn pthread_barrierattr_setpshared
+function will set the process-shared attribute of
+.Fa attr
+to the value specified in
+.Fa pshared .
+The argument
+.Fa pshared
+may have one of the following values:
+.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE"
+.It Dv PTHREAD_PROCESS_PRIVATE
+The barrier object it is attached to may only be accessed by
+threads in the same process as the one that created the object.
+.It Dv PTHREAD_PROCESS_SHARED
+The barrier object it is attached to may be accessed by
+threads in processes other than the one that created the object.
+.El
+.Sh RETURN VALUES
+If successful, all these functions will return zero.
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+None of these functions will return
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_barrierattr_destroy ,
+.Fn pthread_barrierattr_getpshared
+and
+.Fn pthread_barrierattr_setpshared
+functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Pp
+The
+.Fn pthread_barrierattr_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory to initialize the barrier attribute object
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_barrierattr_setpshared
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified in
+.Fa pshared
+is not one of the allowed values.
+.El
+.Sh SEE ALSO
+.Xr pthread_barrier_destroy 3 ,
+.Xr pthread_barrier_init 3 ,
+.Xr pthread_barrier_wait 3
+.Sh HISTORY
+The
+.Fn pthread_barrierattr_*
+functions first appeared in
+.Lb libkse
+in
+.Fx 5.2 ,
+and in
+.Lb libthr
+in
+.Fx 5.3 .
+.Sh BUGS
+The implementation of
+barriers
+does not fully conform to
+.St -p1003.2
+because the process-shared attribute is ignored in
+.Lb libthr ,
+and in
+.Lb libkse ;
+if any value other than
+.Dv PTHREAD_PROCESSES_PRIVATE
+is specified in a call to
+.Fn pthread_barrierattr_setpshared ,
+it will return
+.Er EINVAL .
diff --git a/share/man/man3/pthread_cancel.3 b/share/man/man3/pthread_cancel.3
new file mode 100644
index 000000000000..7ac5f9de2b0b
--- /dev/null
+++ b/share/man/man3/pthread_cancel.3
@@ -0,0 +1,81 @@
+.\" $FreeBSD$
+.Dd January 17, 1999
+.Dt PTHREAD_CANCEL 3
+.Os
+.Sh NAME
+.Nm pthread_cancel
+.Nd cancel execution of a thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cancel "pthread_t thread"
+.Sh DESCRIPTION
+The
+.Fn pthread_cancel
+function requests that
+.Fa thread
+be canceled.
+The target thread's cancelability state and type determines
+when the cancellation takes effect.
+When the cancellation is acted on,
+the cancellation cleanup handlers for
+.Fa thread
+are called.
+When the last cancellation cleanup handler returns,
+the thread-specific data destructor functions will be called for
+.Fa thread .
+When the last destructor function returns,
+.Fa thread
+will be terminated.
+.Pp
+The cancellation processing in the target thread runs asynchronously with
+respect to the calling thread returning from
+.Fn pthread_cancel .
+.Pp
+A status of
+.Dv PTHREAD_CANCELED
+is made available to any threads joining with the target.
+The symbolic
+constant
+.Dv PTHREAD_CANCELED
+expands to a constant expression of type
+.Ft "(void *)" ,
+whose value matches no pointer to an object in memory nor the value
+.Dv NULL .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cancel
+functions will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cancel
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+No thread could be found corresponding to that specified by the given
+thread ID.
+.El
+.Sh SEE ALSO
+.Xr pthread_cleanup_pop 3 ,
+.Xr pthread_cleanup_push 3 ,
+.Xr pthread_exit 3 ,
+.Xr pthread_join 3 ,
+.Xr pthread_setcancelstate 3 ,
+.Xr pthread_setcanceltype 3 ,
+.Xr pthread_testcancel 3
+.Sh STANDARDS
+The
+.Fn pthread_cancel
+function conforms to
+.St -p1003.1-96 .
+.Sh AUTHORS
+This manual page was written by
+.An David Leonard Aq d@openbsd.org
+for the
+.Ox
+implementation of
+.Fn pthread_cancel .
diff --git a/share/man/man3/pthread_cleanup_pop.3 b/share/man/man3/pthread_cleanup_pop.3
new file mode 100644
index 000000000000..519e53f4ef47
--- /dev/null
+++ b/share/man/man3/pthread_cleanup_pop.3
@@ -0,0 +1,66 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 30, 1998
+.Dt PTHREAD_CLEANUP_POP 3
+.Os
+.Sh NAME
+.Nm pthread_cleanup_pop
+.Nd call the first cleanup routine
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft void
+.Fn pthread_cleanup_pop "int execute"
+.Sh DESCRIPTION
+The
+.Fn pthread_cleanup_pop
+function pops the top cleanup routine off of the current threads cleanup
+routine stack, and, if
+.Fa execute
+is non-zero, it will execute the function.
+If there is no cleanup routine
+then
+.Fn pthread_cleanup_pop
+does nothing.
+.Sh RETURN VALUES
+The
+.Fn pthread_cleanup_pop
+function does not return any value.
+.Sh ERRORS
+None
+.Sh SEE ALSO
+.Xr pthread_cleanup_push 3 ,
+.Xr pthread_exit 3
+.Sh STANDARDS
+The
+.Fn pthread_cleanup_pop
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cleanup_push.3 b/share/man/man3/pthread_cleanup_push.3
new file mode 100644
index 000000000000..279098774599
--- /dev/null
+++ b/share/man/man3/pthread_cleanup_push.3
@@ -0,0 +1,68 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 30, 1998
+.Dt PTHREAD_CLEANUP_PUSH 3
+.Os
+.Sh NAME
+.Nm pthread_cleanup_push
+.Nd add a cleanup function for thread exit
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft void
+.Fn pthread_cleanup_push "void \*[lp]*cleanup_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn pthread_cleanup_push
+function adds
+.Fa cleanup_routine
+to the top of the stack of cleanup handlers that
+get called when the current thread exits.
+.Pp
+When
+.Fa cleanup_routine
+is called, it is passed
+.Fa arg
+as its only argument.
+.Sh RETURN VALUES
+The
+.Fn pthread_cleanup_push
+function does not return any value.
+.Sh ERRORS
+None
+.Sh SEE ALSO
+.Xr pthread_cleanup_pop 3 ,
+.Xr pthread_exit 3
+.Sh STANDARDS
+The
+.Fn pthread_cleanup_push
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_broadcast.3 b/share/man/man3/pthread_cond_broadcast.3
new file mode 100644
index 000000000000..bbd274103ac3
--- /dev/null
+++ b/share/man/man3/pthread_cond_broadcast.3
@@ -0,0 +1,72 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 28, 1998
+.Dt PTHREAD_COND_BROADCAST 3
+.Os
+.Sh NAME
+.Nm pthread_cond_broadcast
+.Nd unblock all threads waiting for a condition variable
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_broadcast "pthread_cond_t *cond"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_broadcast
+function unblocks all threads waiting for the condition variable
+.Fa cond .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_broadcast
+function will return zero, otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_broadcast
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa cond
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_timedwait 3 ,
+.Xr pthread_cond_wait 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_broadcast
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_destroy.3 b/share/man/man3/pthread_cond_destroy.3
new file mode 100644
index 000000000000..4ea7a87d8a26
--- /dev/null
+++ b/share/man/man3/pthread_cond_destroy.3
@@ -0,0 +1,79 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 28, 1998
+.Dt PTHREAD_COND_DESTROY 3
+.Os
+.Sh NAME
+.Nm pthread_cond_destroy
+.Nd destroy a condition variable
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_destroy "pthread_cond_t *cond"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_destroy
+function frees the resources allocated by the condition variable
+.Fa cond .
+.Sh IMPLEMENTATION NOTES
+A condition variable can be destroyed immediately after all the threads that
+are blocked on it are awakened.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_destroy
+function will return zero, otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa cond
+is invalid.
+.It Bq Er EBUSY
+The variable
+.Fa cond
+is locked by another thread.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_timedwait 3 ,
+.Xr pthread_cond_wait 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_destroy
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_init.3 b/share/man/man3/pthread_cond_init.3
new file mode 100644
index 000000000000..38843a76fe70
--- /dev/null
+++ b/share/man/man3/pthread_cond_init.3
@@ -0,0 +1,83 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 4, 2006
+.Dt PTHREAD_COND_INIT 3
+.Os
+.Sh NAME
+.Nm pthread_cond_init
+.Nd create a condition variable
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_init "pthread_cond_t *cond" "const pthread_condattr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_init
+function creates a new condition variable, with attributes specified with
+.Fa attr .
+If
+.Fa attr
+is NULL the default attributes are used.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_init
+function will return zero and put the new condition variable id into
+.Fa cond ,
+otherwise an error number will be returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.It Bq Er ENOMEM
+The process cannot allocate enough memory to create another condition
+variable.
+.It Bq Er EAGAIN
+The system temporarily lacks the resources to create another condition
+variable.
+.El
+.Sh SEE ALSO
+.Xr pthread_condattr 3 ,
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_timedwait 3 ,
+.Xr pthread_cond_wait 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_init
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_signal.3 b/share/man/man3/pthread_cond_signal.3
new file mode 100644
index 000000000000..8ab801f91997
--- /dev/null
+++ b/share/man/man3/pthread_cond_signal.3
@@ -0,0 +1,72 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 28, 1998
+.Dt PTHREAD_COND_SIGNAL 3
+.Os
+.Sh NAME
+.Nm pthread_cond_signal
+.Nd unblock a thread waiting for a condition variable
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_signal "pthread_cond_t *cond"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_signal
+function unblocks one thread waiting for the condition variable
+.Fa cond .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_signal
+function will return zero, otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_signal
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa cond
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_timedwait 3 ,
+.Xr pthread_cond_wait 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_signal
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_timedwait.3 b/share/man/man3/pthread_cond_timedwait.3
new file mode 100644
index 000000000000..071f690be195
--- /dev/null
+++ b/share/man/man3/pthread_cond_timedwait.3
@@ -0,0 +1,101 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 9, 2010
+.Dt PTHREAD_COND_TIMEDWAIT 3
+.Os
+.Sh NAME
+.Nm pthread_cond_timedwait
+.Nd "wait on a condition variable for a specific amount of time"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_timedwait "pthread_cond_t *cond" "pthread_mutex_t *mutex" "const struct timespec *abstime"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_timedwait
+function atomically blocks the current thread waiting on the condition
+variable specified by
+.Fa cond ,
+and releases the mutex specified by
+.Fa mutex .
+The waiting thread unblocks only after another thread calls
+.Xr pthread_cond_signal 3 ,
+or
+.Xr pthread_cond_broadcast 3
+with the same condition variable, or if the system time reaches the
+time specified in
+.Fa abstime ,
+and the current thread reacquires the lock on
+.Fa mutex .
+.Pp
+The clock used to measure
+.Fa abstime
+can be specified during creation of the condition variable using
+.Xr pthread_condattr_setclock 3 .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_timedwait
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_timedwait
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa cond ,
+.Fa mutex
+or
+.Fa abstime
+is invalid.
+.It Bq Er ETIMEDOUT
+The system time has reached or exceeded the time specified in
+.Fa abstime .
+.It Bq Er EPERM
+The specified
+.Fa mutex
+was not locked by the calling thread.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_wait 3 ,
+.Xr pthread_condattr_setclock 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_timedwait
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_cond_wait.3 b/share/man/man3/pthread_cond_wait.3
new file mode 100644
index 000000000000..c057098696e8
--- /dev/null
+++ b/share/man/man3/pthread_cond_wait.3
@@ -0,0 +1,89 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 2006
+.Dt PTHREAD_COND_WAIT 3
+.Os
+.Sh NAME
+.Nm pthread_cond_wait
+.Nd wait on a condition variable
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_cond_wait "pthread_cond_t *cond" "pthread_mutex_t *mutex"
+.Sh DESCRIPTION
+The
+.Fn pthread_cond_wait
+function atomically blocks the current thread waiting on the condition
+variable specified by
+.Fa cond ,
+and releases the mutex specified by
+.Fa mutex .
+The waiting thread unblocks only after another thread calls
+.Xr pthread_cond_signal 3 ,
+or
+.Xr pthread_cond_broadcast 3
+with the same condition variable, and the current thread reacquires the lock
+on
+.Fa mutex .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_cond_wait
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_cond_wait
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa cond
+or the value specified by
+.Fa mutex
+is invalid.
+.It Bq Er EPERM
+The specified
+.Fa mutex
+was not locked by the calling thread.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_broadcast 3 ,
+.Xr pthread_cond_destroy 3 ,
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_signal 3 ,
+.Xr pthread_cond_timedwait 3
+.Sh STANDARDS
+The
+.Fn pthread_cond_wait
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_condattr.3 b/share/man/man3/pthread_condattr.3
new file mode 100644
index 000000000000..e232ef6a37ec
--- /dev/null
+++ b/share/man/man3/pthread_condattr.3
@@ -0,0 +1,174 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd May 9, 2010
+.Dt PTHREAD_CONDATTR 3
+.Os
+.Sh NAME
+.Nm pthread_condattr_init ,
+.Nm pthread_condattr_destroy ,
+.Nm pthread_condattr_getclock ,
+.Nm pthread_condattr_setclock ,
+.Nm pthread_condattr_getpshared ,
+.Nm pthread_condattr_setpshared ,
+.Nd condition attribute operations
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_condattr_init "pthread_condattr_t *attr"
+.Ft int
+.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
+.Ft int
+.Fn pthread_condattr_getclock "pthread_condattr_t * restrict attr" "clock_t * restrict clock_id"
+.Ft int
+.Fn pthread_condattr_setclock "pthread_condattr_t *attr" "clock_t clock_id"
+.Ft int
+.Fn pthread_condattr_getpshared "pthread_condattr_t * restrict attr" "int * restrict pshared"
+.Ft int
+.Fn pthread_condattr_setpshared "pthread_condattr_t *attr" "int pshared"
+.Sh DESCRIPTION
+Condition attribute objects are used to specify parameters to
+.Fn pthread_cond_init .
+.Pp
+The
+.Fn pthread_condattr_init
+function initializes a condition attribute object with the default attributes.
+.Pp
+The
+.Fn pthread_condattr_destroy
+function destroys a condition attribute object.
+.Pp
+The
+.Fn pthread_condattr_getclock
+function will put the value of the clock attribute from
+.Fa attr
+into the memory area pointed to by
+.Fa clock_id .
+The
+.Fn pthread_condattr_setclock
+function will set the clock attribute of
+.Fa attr
+to the value specified in
+.Fa clock_id .
+The clock attribute affects the interpretation of
+.Fa abstime
+in
+.Xr pthread_cond_timedwait 3
+and may be set to
+.Dv CLOCK_REALTIME
+(default)
+or
+.Dv CLOCK_MONOTONIC .
+.Pp
+The
+.Fn pthread_condattr_getpshared
+function will put the value of the process-shared attribute from
+.Fa attr
+into the memory area pointed to by
+.Fa pshared .
+The
+.Fn pthread_condattr_setpshared
+function will set the process-shared attribute of
+.Fa attr
+to the value specified in
+.Fa pshared .
+The argument
+.Fa pshared
+may have one of the following values:
+.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE"
+.It Dv PTHREAD_PROCESS_PRIVATE
+The condition variable it is attached to may only be accessed by
+threads in the same process as the one that created the object.
+.It Dv PTHREAD_PROCESS_SHARED
+The condition variable it is attached to may be accessed by
+threads in processes other than the one that created the object.
+.El
+.Sh RETURN VALUES
+If successful, these functions return 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_condattr_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Out of memory.
+.El
+.Pp
+The
+.Fn pthread_condattr_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_condattr_setclock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified in
+.Fa clock_id
+is not one of the allowed values.
+.El
+.Pp
+The
+.Fn pthread_condattr_setpshared
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified in
+.Fa pshared
+is not one of the allowed values.
+.El
+.Sh SEE ALSO
+.Xr pthread_cond_init 3 ,
+.Xr pthread_cond_timedwait 3
+.Sh STANDARDS
+The
+.Fn pthread_condattr_init
+and
+.Fn pthread_condattr_destroy
+functions conform to
+.St -p1003.1-96
+.Sh BUGS
+The implementation of
+condition variables
+does not fully conform to
+.St -p1003.2
+because the process-shared attribute is ignored;
+if any value other than
+.Dv PTHREAD_PROCESSES_PRIVATE
+is specified in a call to
+.Fn pthread_condattr_setpshared ,
+it will return
+.Er EINVAL .
diff --git a/share/man/man3/pthread_create.3 b/share/man/man3/pthread_create.3
new file mode 100644
index 000000000000..277d157cfbfc
--- /dev/null
+++ b/share/man/man3/pthread_create.3
@@ -0,0 +1,129 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 4, 2006
+.Dt PTHREAD_CREATE 3
+.Os
+.Sh NAME
+.Nm pthread_create
+.Nd create a new thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_create "pthread_t *thread" "const pthread_attr_t *attr" "void *(*start_routine)(void *)" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn pthread_create
+function is used to create a new thread, with attributes specified by
+.Fa attr ,
+within a process.
+If
+.Fa attr
+is
+.Dv NULL ,
+the default attributes are used.
+If the attributes specified by
+.Fa attr
+are modified later, the thread's attributes are not affected.
+Upon
+successful completion
+.Fn pthread_create
+will store the ID of the created thread in the location specified by
+.Fa thread .
+.Pp
+The thread is created executing
+.Fa start_routine
+with
+.Fa arg
+as its sole argument.
+If the
+.Fa start_routine
+returns, the effect is as if there was an implicit call to
+.Fn pthread_exit
+using the return value of
+.Fa start_routine
+as the exit status.
+Note that the thread in which
+.Fn main
+was originally invoked differs from this.
+When it returns from
+.Fn main ,
+the effect is as if there was an implicit call to
+.Fn exit
+using the return value of
+.Fn main
+as the exit status.
+.Pp
+The signal state of the new thread is initialized as:
+.Bl -bullet -offset indent
+.It
+The signal mask is inherited from the creating thread.
+.It
+The set of signals pending for the new thread is empty.
+.El
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_create
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_create
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system lacked the necessary resources to create another thread, or
+the system-imposed limit on the total number of threads in a process
+[PTHREAD_THREADS_MAX] would be exceeded.
+.It Bq Er EPERM
+The caller does not have appropriate permission to set the required scheduling
+parameters or scheduling policy.
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr fork 2 ,
+.Xr pthread_attr 3 ,
+.Xr pthread_cleanup_pop 3 ,
+.Xr pthread_cleanup_push 3 ,
+.Xr pthread_exit 3 ,
+.Xr pthread_join 3
+.Sh STANDARDS
+The
+.Fn pthread_create
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_detach.3 b/share/man/man3/pthread_detach.3
new file mode 100644
index 000000000000..dba4aec433c1
--- /dev/null
+++ b/share/man/man3/pthread_detach.3
@@ -0,0 +1,91 @@
+.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_DETACH 3
+.Os
+.Sh NAME
+.Nm pthread_detach
+.Nd detach a thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_detach "pthread_t thread"
+.Sh DESCRIPTION
+The
+.Fn pthread_detach
+function is used to indicate to the implementation that storage for the
+thread
+.Fa thread
+can be reclaimed when the thread terminates.
+If
+.Fa thread
+has not terminated,
+.Fn pthread_detach
+will not cause it to terminate.
+The effect of multiple
+.Fn pthread_detach
+calls on the same target thread is unspecified.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_detach
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+Note that the function does not change the value
+of errno as it did for some drafts of the standard.
+These early drafts
+also passed a pointer to pthread_t as the argument.
+Beware!
+.Sh ERRORS
+The
+.Fn pthread_detach
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The implementation has detected that the value specified by
+.Fa thread
+does not refer to a joinable thread.
+.It Bq Er ESRCH
+No thread could be found corresponding to that specified by the given
+thread ID,
+.Fa thread .
+.El
+.Sh SEE ALSO
+.Xr pthread_join 3
+.Sh STANDARDS
+The
+.Fn pthread_detach
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_equal.3 b/share/man/man3/pthread_equal.3
new file mode 100644
index 000000000000..1ed85319b961
--- /dev/null
+++ b/share/man/man3/pthread_equal.3
@@ -0,0 +1,69 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_EQUAL 3
+.Os
+.Sh NAME
+.Nm pthread_equal
+.Nd compare thread IDs
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_equal "pthread_t t1" "pthread_t t2"
+.Sh DESCRIPTION
+The
+.Fn pthread_equal
+function compares the thread IDs
+.Fa t1
+and
+.Fa t2 .
+.Sh RETURN VALUES
+The
+.Fn pthread_equal
+function will return non-zero if the thread IDs
+.Fa t1
+and
+.Fa t2
+correspond to the same thread, otherwise it will return zero.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr pthread_create 3 ,
+.Xr pthread_exit 3
+.Sh STANDARDS
+The
+.Fn pthread_equal
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_exit.3 b/share/man/man3/pthread_exit.3
new file mode 100644
index 000000000000..d949f190ef11
--- /dev/null
+++ b/share/man/man3/pthread_exit.3
@@ -0,0 +1,106 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_EXIT 3
+.Os
+.Sh NAME
+.Nm pthread_exit
+.Nd terminate the calling thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft void
+.Fn pthread_exit "void *value_ptr"
+.Sh DESCRIPTION
+The
+.Fn pthread_exit
+function terminates the calling thread and makes the value
+.Fa value_ptr
+available to any successful join with the terminating thread.
+Any
+cancellation cleanup handlers that have been pushed and are not yet popped
+are popped in the reverse order that they were pushed and then executed.
+After all cancellation handlers have been executed, if the thread has any
+thread-specific data, appropriate destructor functions are called in an
+unspecified order.
+Thread termination does not release any application
+visible process resources, including, but not limited to, mutexes and
+file descriptors, nor does it perform any process level cleanup
+actions, including, but not limited to, calling
+.Fn atexit
+routines that may exist.
+.Pp
+An implicit call to
+.Fn pthread_exit
+is made when a thread other than the thread in which
+.Fn main
+was first invoked returns from the start routine that was used to create
+it.
+The function's return value serves as the thread's exit status.
+.Pp
+The behavior of
+.Fn pthread_exit
+is undefined if called from a cancellation handler or destructor function
+that was invoked as the result of an implicit or explicit call to
+.Fn pthread_exit .
+.Pp
+After a thread has terminated, the result of access to local (auto)
+variables of the thread is undefined.
+Thus, references to local variables
+of the exiting thread should not be used for the
+.Fn pthread_exit
+.Fa value_ptr
+parameter value.
+.Pp
+The process will exit with an exit status of 0 after the last thread has
+been terminated.
+The behavior is as if the implementation called
+.Fn exit
+with a zero argument at thread termination time.
+.Sh RETURN VALUES
+The
+.Fn pthread_exit
+function cannot return to its caller.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr _exit 2 ,
+.Xr exit 3 ,
+.Xr pthread_create 3 ,
+.Xr pthread_join 3
+.Sh STANDARDS
+The
+.Fn pthread_exit
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_getconcurrency.3 b/share/man/man3/pthread_getconcurrency.3
new file mode 100644
index 000000000000..f442ea20b408
--- /dev/null
+++ b/share/man/man3/pthread_getconcurrency.3
@@ -0,0 +1,115 @@
+.\" Copyright (c) 2003 Sergey Osokin <osa@FreeBSD.org.ru>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd April 11, 2003
+.Dt PTHREAD_GETCONCURRENCY 3
+.Os
+.Sh NAME
+.Nm pthread_getconcurrency ,
+.Nm pthread_setconcurrency
+.Nd get or set level of concurrency
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_getconcurrency void
+.Ft int
+.Fn pthread_setconcurrency "int new_level"
+.Sh DESCRIPTION
+The
+.Fn pthread_getconcurrency
+function allows an application to inform the threads implementation
+of its desired concurrency level,
+.Fa new_level .
+The actual level of concurrency provided by the implementation
+as a result of this function call is unspecified.
+If
+.Fa new_level
+is zero, it causes the implementation to maintain the concurrency
+level at its discretion as if
+.Fn pthread_setconcurrency
+was never called.
+The
+.Fn pthread_getconcurrency
+function returns the value set by a previous call to the
+.Fn pthread_setconcurrency
+function.
+If the
+.Fn pthread_setconcurrency
+function was not previously called, this function returns zero to
+indicate that the implementation is maintaining the concurrency
+level.
+When an application calls
+.Fn pthread_setconcurrency ,
+it is informing the implementation of its desired concurrency
+level.
+The implementation uses this as a hint, not a requirement.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_setconcurrency
+function returns zero.
+Otherwise, an error number is returned
+to indicate the error.
+The
+.Fn pthread_getconcurrency
+function always returns the concurrency level set by a previous
+call to
+.Fn pthread_setconcurrency .
+If the
+.Fn pthread_setconcurrency
+function has never been called,
+.Fn pthread_getconcurrency
+returns zero.
+.Sh ERRORS
+The
+.Fn pthread_setconcurrency
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa new_level
+is negative.
+.It Bq Er EAGAIN
+The value specified by
+.Fa new_level
+would cause a system resource to be exceeded.
+.El
+.Sh APPLICATION USAGE
+Use of these functions changes the state of the underlying
+concurrency upon which the application depends.
+Library developers are advised to not use the
+.Fn pthread_getconcurrency
+and
+.Fn pthread_setconcurrency
+functions since their use may conflict with an application's
+use of these functions.
+.Sh STANDARDS
+The
+.Fn pthread_getconcurrency
+and
+.Fn pthread_setconcurrency
+functions conform to
+.St -susv2 .
diff --git a/share/man/man3/pthread_getspecific.3 b/share/man/man3/pthread_getspecific.3
new file mode 100644
index 000000000000..d59003f4e281
--- /dev/null
+++ b/share/man/man3/pthread_getspecific.3
@@ -0,0 +1,85 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_GETSPECIFIC 3
+.Os
+.Sh NAME
+.Nm pthread_getspecific
+.Nd get a thread-specific data value
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft void *
+.Fn pthread_getspecific "pthread_key_t key"
+.Sh DESCRIPTION
+The
+.Fn pthread_getspecific
+function returns the value currently bound to the specified
+.Fa key
+on behalf of the calling thread.
+.Pp
+The effect of calling
+.Fn pthread_getspecific
+with a
+.Fa key
+value not obtained from
+.Fn pthread_key_create
+or after
+.Fa key
+has been deleted with
+.Fn pthread_key_delete
+is undefined.
+.Pp
+The
+.Fn pthread_getspecific
+function may be called from a thread-specific data destructor function.
+.Sh RETURN VALUES
+The
+.Fn pthread_getspecific
+function will return the thread-specific data value associated with the given
+.Fa key .
+If no thread-specific data value is associated with
+.Fa key ,
+then the value NULL is returned.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr pthread_key_create 3 ,
+.Xr pthread_key_delete 3 ,
+.Xr pthread_setspecific 3
+.Sh STANDARDS
+The
+.Fn pthread_getspecific
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_getthreadid_np.3 b/share/man/man3/pthread_getthreadid_np.3
new file mode 100644
index 000000000000..bd28c6b5bf20
--- /dev/null
+++ b/share/man/man3/pthread_getthreadid_np.3
@@ -0,0 +1,56 @@
+.\" Copyright (c) 2011 Jung-uk Kim <jkim@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt PTHREAD_GETTHREADID_NP 3
+.Os
+.Sh NAME
+.Nm pthread_getthreadid_np
+.Nd get the calling thread's integral ID
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_getthreadid_np void
+.Sh DESCRIPTION
+The
+.Fn pthread_getthreadid_np
+function returns the unique integral ID of the calling thread.
+Its semantics is similar to the AIX's
+.Fn pthread_getthreadid_np
+function.
+.Sh RETURN VALUES
+The
+.Fn pthread_getthreadid_np
+function returns the thread integral ID of the calling thread.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr pthread_self 3
+.Sh AUTHORS
+This manual page was written by
+.An Jung-uk Kim Aq jkim@FreeBSD.org .
diff --git a/share/man/man3/pthread_join.3 b/share/man/man3/pthread_join.3
new file mode 100644
index 000000000000..fd2fa5acedd1
--- /dev/null
+++ b/share/man/man3/pthread_join.3
@@ -0,0 +1,140 @@
+.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 2010
+.Dt PTHREAD_JOIN 3
+.Os
+.Sh NAME
+.Nm pthread_join ,
+.Nm pthread_timedjoin_np
+.Nd wait for thread termination
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_join "pthread_t thread" "void **value_ptr"
+.Ft int
+.Fn pthread_timedjoin_np "pthread_t thread" "void **value_ptr" "const struct timespec *abstime"
+.Sh DESCRIPTION
+The
+.Fn pthread_join
+function suspends execution of the calling thread until the target
+.Fa thread
+terminates unless the target
+.Fa thread
+has already terminated.
+.Pp
+On return from a successful
+.Fn pthread_join
+call with a non-NULL
+.Fa value_ptr
+argument, the value passed to
+.Fn pthread_exit
+by the terminating thread is stored in the location referenced by
+.Fa value_ptr .
+When a
+.Fn pthread_join
+returns successfully, the target thread has been terminated.
+The results
+of multiple simultaneous calls to
+.Fn pthread_join
+specifying the same target thread are undefined.
+If the thread calling
+.Fn pthread_join
+is cancelled, then the target thread is not detached.
+.Pp
+The
+.Fn pthread_timedjoin_np
+function is equivalent to the
+.Fn pthread_join
+function except it will return
+.Er ETIMEDOUT
+if target thread does not exit before specified absolute time passes.
+.Pp
+A thread that has exited but remains unjoined counts against
+[_POSIX_THREAD_THREADS_MAX].
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_join
+and
+.Fn pthread_timedjoin_np
+functions will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_join
+and
+.Fn pthread_timedjoin_np
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The implementation has detected that the value specified by
+.Fa thread
+does not refer to a joinable thread.
+.It Bq Er ESRCH
+No thread could be found corresponding to that specified by the given
+thread ID,
+.Fa thread .
+.It Bq Er EDEADLK
+A deadlock was detected or the value of
+.Fa thread
+specifies the calling thread.
+.It Bq Er EOPNOTSUPP
+The implementation detected that another caller is already waiting on
+.Fa thread .
+.El
+.Pp
+Additionally, the
+.Fn pthread_timedjoin_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The specified absolute time passed while
+.Fn pthread_timedjoin_np
+waited for thread exit.
+.El
+.Sh SEE ALSO
+.Xr wait 2 ,
+.Xr pthread_create 3
+.Sh STANDARDS
+The
+.Fn pthread_join
+function conforms to
+.St -p1003.1-96 .
+The
+.Fn pthread_timedjoin_np
+is a
+.Fx
+extension which first appeared in
+.Fx 6.1 .
diff --git a/share/man/man3/pthread_key_create.3 b/share/man/man3/pthread_key_create.3
new file mode 100644
index 000000000000..a818e1a52364
--- /dev/null
+++ b/share/man/man3/pthread_key_create.3
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_KEY_CREATE 3
+.Os
+.Sh NAME
+.Nm pthread_key_create
+.Nd thread-specific data key creation
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_key_create "pthread_key_t *key" "void (*destructor)(void *)"
+.Sh DESCRIPTION
+The
+.Fn pthread_key_create
+function creates a thread-specific data key visible to all threads in the
+process.
+Key values provided by
+.Fn pthread_key_create
+are opaque objects used to locate thread-specific data.
+Although the same
+key value may be used by different threads, the values bound to the key
+by
+.Fn pthread_setspecific
+are maintained on a per-thread basis and persist for the life of the calling
+thread.
+.Pp
+Upon key creation, the value NULL is associated with the new key in all
+active threads.
+Upon thread creation, the value NULL is associated with all
+defined keys in the new thread.
+.Pp
+An optional destructor function may be associated with each key value.
+At
+thread exit, if a key value has a non-NULL destructor pointer, and the
+thread has a non-NULL value associated with the key, the function pointed
+to is called with the current associated value as its sole argument.
+The
+order of destructor calls is unspecified if more than one destructor exists
+for a thread when it exits.
+.Pp
+If, after all the destructors have been called for all non-NULL values
+with associated destructors, there are still some non-NULL values with
+associated destructors, then the process is repeated.
+If, after at least
+[PTHREAD_DESTRUCTOR_ITERATIONS] iterations of destructor calls for
+outstanding non-NULL values, there are still some non-NULL values with
+associated destructors, the implementation stops calling destructors.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_key_create
+function will store the newly created key value at the location specified by
+.Fa key
+and returns zero.
+Otherwise an error number will be returned to indicate
+the error.
+.Sh ERRORS
+The
+.Fn pthread_key_create
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system lacked the necessary resources to create another thread-specific
+data key, or the system-imposed limit on the total number of keys per process
+[PTHREAD_KEYS_MAX] would be exceeded.
+.It Bq Er ENOMEM
+Insufficient memory exists to create the key.
+.El
+.Sh SEE ALSO
+.Xr pthread_getspecific 3 ,
+.Xr pthread_key_delete 3 ,
+.Xr pthread_setspecific 3
+.Sh STANDARDS
+The
+.Fn pthread_key_create
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_key_delete.3 b/share/man/man3/pthread_key_delete.3
new file mode 100644
index 000000000000..c7861af50ce2
--- /dev/null
+++ b/share/man/man3/pthread_key_delete.3
@@ -0,0 +1,100 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_KEY_DELETE 3
+.Os
+.Sh NAME
+.Nm pthread_key_delete
+.Nd delete a thread-specific data key
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_key_delete "pthread_key_t key"
+.Sh DESCRIPTION
+The
+.Fn pthread_key_delete
+function deletes a thread-specific data key previously returned by
+.Fn pthread_key_create .
+The thread-specific data values associated with
+.Fa key
+need not be NULL at the time that
+.Fn pthread_key_delete
+is called.
+It is the responsibility of the application to free any
+application storage or perform any cleanup actions for data structures
+related to the deleted key or associated thread-specific data in any threads;
+this cleanup can be done either before or after
+.Fn pthread_key_delete
+is called.
+Any attempt to use
+.Fa key
+following the call to
+.Fn pthread_key_delete
+results in undefined behavior.
+.Pp
+The
+.Fn pthread_key_delete
+function is callable from within destructor functions.
+Destructor functions
+are not invoked by
+.Fn pthread_key_delete .
+Any destructor function that may have been associated with
+.Fa key
+will no longer be called upon thread exit.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_key_delete
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_key_delete
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa key
+value is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_getspecific 3 ,
+.Xr pthread_key_create 3 ,
+.Xr pthread_setspecific 3
+.Sh STANDARDS
+The
+.Fn pthread_key_delete
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_kill.3 b/share/man/man3/pthread_kill.3
new file mode 100644
index 000000000000..1ef879a2f765
--- /dev/null
+++ b/share/man/man3/pthread_kill.3
@@ -0,0 +1,77 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd April 27, 2000
+.Dt PTHREAD_KILL 3
+.Os
+.Sh NAME
+.Nm pthread_kill
+.Nd send a signal to a specified thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.In signal.h
+.Ft int
+.Fn pthread_kill "pthread_t thread" "int sig"
+.Sh DESCRIPTION
+The
+.Fn pthread_kill
+function sends a signal, specified by
+.Fa sig ,
+to a thread, specified by
+.Fa thread .
+If
+.Fa sig
+is 0, error checking is performed, but no signal is actually sent.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_kill
+returns 0.
+Otherwise, an error number is returned.
+.Sh ERRORS
+The
+.Fn pthread_kill
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+.Fa thread
+is an invalid thread ID.
+.It Bq Er EINVAL
+.Fa sig
+is an invalid or unsupported signal number.
+.El
+.Sh SEE ALSO
+.Xr kill 2 ,
+.Xr pthread_self 3 ,
+.Xr raise 3
+.Sh STANDARDS
+The
+.Fn pthread_kill
+function conforms to
+.St -p1003.1-96
diff --git a/share/man/man3/pthread_main_np.3 b/share/man/man3/pthread_main_np.3
new file mode 100644
index 000000000000..43d72920140a
--- /dev/null
+++ b/share/man/man3/pthread_main_np.3
@@ -0,0 +1,60 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_MAIN_NP 3
+.Os
+.Sh NAME
+.Nm pthread_main_np
+.Nd identify the initial thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_main_np void
+.Sh DESCRIPTION
+The
+.Fn pthread_main_np
+function
+is used in userland threads environment to identify the initial thread.
+Its semantics is similar to the Solaris's
+.Fn thr_main
+function.
+.Sh RETURN VALUES
+The
+.Fn pthread_main_np
+function returns
+1 if the calling thread is the initial thread,
+0 if the calling thread is not the initial thread,
+and \-1 if the thread's initialization has not yet completed.
+.Sh SEE ALSO
+.Xr pthread_create 3 ,
+.Xr pthread_equal 3 ,
+.Xr pthread_self 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_multi_np.3 b/share/man/man3/pthread_multi_np.3
new file mode 100644
index 000000000000..9a42a99585bc
--- /dev/null
+++ b/share/man/man3/pthread_multi_np.3
@@ -0,0 +1,66 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_MULTI_NP 3
+.Os
+.Sh NAME
+.Nm pthread_multi_np ,
+.Nm pthread_single_np
+.Nd "switch between multi- and single-threaded scheduling modes"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_multi_np void
+.Ft int
+.Fn pthread_single_np void
+.Sh DESCRIPTION
+The
+.Fn pthread_single_np
+function switches the process to a single-threaded mode, i.e.,
+suspends all threads except the current.
+The semantics of this function is similar to
+.Xr pthread_suspend_all_np 3 .
+.Pp
+The
+.Fn pthread_multi_np
+function switches the process to a multi-threaded mode.
+The semantics of this function is similar to
+.Xr pthread_resume_all_np 3 .
+.Sh RETURN VALUES
+The
+.Fn pthread_multi_np
+and
+.Nm pthread_single_np
+functions always return 0.
+.Sh SEE ALSO
+.Xr pthread_resume_all_np 3 ,
+.Xr pthread_suspend_all_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_mutex_destroy.3 b/share/man/man3/pthread_mutex_destroy.3
new file mode 100644
index 000000000000..d6c4bcd5e446
--- /dev/null
+++ b/share/man/man3/pthread_mutex_destroy.3
@@ -0,0 +1,74 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 29, 1998
+.Dt PTHREAD_MUTEX_DESTROY 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_destroy
+.Nd free resources allocated for a mutex
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutex_destroy "pthread_mutex_t *mutex"
+.Sh DESCRIPTION
+The
+.Fn pthread_mutex_destroy
+function frees the resources allocated for
+.Fa mutex .
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_destroy
+will return zero, otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa mutex
+is invalid.
+.It Bq Er EBUSY
+.Fa Mutex
+is locked by another thread.
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_trylock 3 ,
+.Xr pthread_mutex_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_destroy
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutex_init.3 b/share/man/man3/pthread_mutex_init.3
new file mode 100644
index 000000000000..10a026b9dcbe
--- /dev/null
+++ b/share/man/man3/pthread_mutex_init.3
@@ -0,0 +1,78 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 4, 2006
+.Dt PTHREAD_MUTEX_INIT 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_init
+.Nd create a mutex
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutex_init "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_mutex_init
+function creates a new mutex, with attributes specified with
+.Fa attr .
+If
+.Fa attr
+is NULL the default attributes are used.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_init
+will return zero and put the new mutex id into
+.Fa mutex ,
+otherwise an error number will be returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.It Bq Er ENOMEM
+The process cannot allocate enough memory to create another mutex.
+.El
+.Sh SEE ALSO
+.Xr pthread_mutexattr 3 ,
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_trylock 3 ,
+.Xr pthread_mutex_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_init
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutex_lock.3 b/share/man/man3/pthread_mutex_lock.3
new file mode 100644
index 000000000000..8479a69d3a02
--- /dev/null
+++ b/share/man/man3/pthread_mutex_lock.3
@@ -0,0 +1,76 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 31, 2006
+.Dt PTHREAD_MUTEX_LOCK 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_lock
+.Nd lock a mutex
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutex_lock "pthread_mutex_t *mutex"
+.Sh DESCRIPTION
+The
+.Fn pthread_mutex_lock
+function locks
+.Fa mutex .
+If the mutex is already locked, the calling thread will block until the
+mutex becomes available.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_lock
+will return zero, otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_lock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa mutex
+is invalid.
+.It Bq Er EDEADLK
+A deadlock would occur if the thread blocked waiting for
+.Fa mutex .
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_trylock 3 ,
+.Xr pthread_mutex_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_lock
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutex_timedlock.3 b/share/man/man3/pthread_mutex_timedlock.3
new file mode 100644
index 000000000000..abc7e2a28854
--- /dev/null
+++ b/share/man/man3/pthread_mutex_timedlock.3
@@ -0,0 +1,103 @@
+.\" Copyright (c) 2003 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 30, 2003
+.Dt PTHREAD_MUTEX_TIMEDLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_timedlock
+.Nd lock a mutex without blocking indefinitely
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.In time.h
+.Ft int
+.Fn pthread_mutex_timedlock "pthread_mutex_t *mutex" "const struct timespec *abs_timeout"
+.Sh DESCRIPTION
+The
+.Fn pthread_mutex_timedlock
+function will lock
+.Fa mutex .
+If it is already locked the calling thread will block until
+the mutex becomes available or
+the timeout,
+specified by abs_timeout,
+expires.
+The time of the timeout is an absolute time and
+is not relative to the current time.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_timedlock
+will return zero, otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_timedlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa mutex
+was created with the protocol attribute having the
+value PTHREAD_PRIO_PROTECT and
+the calling thread's priority is higher than the
+mutex's current priority ceiling.
+.It Bq Er EINVAL
+The process or thread would have blocked, and
+.Fa abs_timeout
+specified a nanosecond value less than zero or
+greater than or equal to 1 billion.
+.It Bq Er EINVAL
+The
+.Fa mutex
+parameter is invalid.
+.It Bq Er ETIMEDOUT
+The
+.Fa mutex
+could not be locked before the timeout expired.
+.It Bq Er EAGAIN
+The
+.Fa mutex
+could not be acquired because the
+maximum number of recursive locks for the
+.Fa mutex
+has been exceeded.
+.It Bq Er EDEADLK
+The current thread already owns the
+.Fa mutex .
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_trylock 3 ,
+.Xr pthread_mutex_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_timedlock
+function is expected to conform to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutex_trylock.3 b/share/man/man3/pthread_mutex_trylock.3
new file mode 100644
index 000000000000..049006f916f1
--- /dev/null
+++ b/share/man/man3/pthread_mutex_trylock.3
@@ -0,0 +1,77 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 30, 1998
+.Dt PTHREAD_MUTEX_TRYLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_trylock
+.Nd attempt to lock a mutex without blocking
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutex_trylock "pthread_mutex_t *mutex"
+.Sh DESCRIPTION
+The
+.Fn pthread_mutex_trylock
+function locks
+.Fa mutex .
+If the mutex is already locked,
+.Fn pthread_mutex_trylock
+will not block waiting for the mutex, but will return an error condition.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_trylock
+will return zero, otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_trylock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa mutex
+is invalid.
+.It Bq Er EBUSY
+.Fa Mutex
+is already locked.
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_trylock
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutex_unlock.3 b/share/man/man3/pthread_mutex_unlock.3
new file mode 100644
index 000000000000..77784e1b1962
--- /dev/null
+++ b/share/man/man3/pthread_mutex_unlock.3
@@ -0,0 +1,76 @@
+.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 30, 1998
+.Dt PTHREAD_MUTEX_UNLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_mutex_unlock
+.Nd unlock a mutex
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutex_unlock "pthread_mutex_t *mutex"
+.Sh DESCRIPTION
+If the current thread holds the lock on
+.Fa mutex ,
+then the
+.Fn pthread_mutex_unlock
+function unlocks
+.Fa mutex .
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_mutex_unlock
+will return zero, otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutex_unlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa mutex
+is invalid.
+.It Bq Er EPERM
+The current thread does not hold a lock on
+.Fa mutex .
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3 ,
+.Xr pthread_mutex_lock 3 ,
+.Xr pthread_mutex_trylock 3
+.Sh STANDARDS
+The
+.Fn pthread_mutex_unlock
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_mutexattr.3 b/share/man/man3/pthread_mutexattr.3
new file mode 100644
index 000000000000..f97602615be1
--- /dev/null
+++ b/share/man/man3/pthread_mutexattr.3
@@ -0,0 +1,187 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd May 1, 2000
+.Dt PTHREAD_MUTEXATTR 3
+.Os
+.Sh NAME
+.Nm pthread_mutexattr_init ,
+.Nm pthread_mutexattr_destroy ,
+.Nm pthread_mutexattr_setprioceiling ,
+.Nm pthread_mutexattr_getprioceiling ,
+.Nm pthread_mutexattr_setprotocol ,
+.Nm pthread_mutexattr_getprotocol ,
+.Nm pthread_mutexattr_settype ,
+.Nm pthread_mutexattr_gettype
+.Nd mutex attribute operations
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_mutexattr_init "pthread_mutexattr_t *attr"
+.Ft int
+.Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr"
+.Ft int
+.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int prioceiling"
+.Ft int
+.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *prioceiling"
+.Ft int
+.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
+.Ft int
+.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
+.Ft int
+.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
+.Ft int
+.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
+.Sh DESCRIPTION
+Mutex attributes are used to specify parameters to
+.Fn pthread_mutex_init .
+One attribute object can be used in multiple calls to
+.Fn pthread_mutex_init ,
+with or without modifications between calls.
+.Pp
+The
+.Fn pthread_mutexattr_init
+function initializes
+.Fa attr
+with all the default mutex attributes.
+.Pp
+The
+.Fn pthread_mutexattr_destroy
+function destroys
+.Fa attr .
+.Pp
+The
+.Fn pthread_mutexattr_set*
+functions set the attribute that corresponds to each function name.
+.Pp
+The
+.Fn pthread_mutexattr_get*
+functions copy the value of the attribute that corresponds to each function name
+to the location pointed to by the second function parameter.
+.Sh RETURN VALUES
+If successful, these functions return 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_mutexattr_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Out of memory.
+.El
+.Pp
+The
+.Fn pthread_mutexattr_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_setprioceiling
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr ,
+or invalid value for
+.Fa prioceiling .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_getprioceiling
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_setprotocol
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr ,
+or invalid value for
+.Fa protocol .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_getprotocol
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_settype
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr ,
+or invalid value for
+.Fa type .
+.El
+.Pp
+The
+.Fn pthread_mutexattr_gettype
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa attr .
+.El
+.Sh SEE ALSO
+.Xr pthread_mutex_init 3
+.Sh STANDARDS
+The
+.Fn pthread_mutexattr_init
+and
+.Fn pthread_mutexattr_destroy
+functions conform to
+.St -p1003.1-96
+.Pp
+The
+.Fn pthread_mutexattr_setprioceiling ,
+.Fn pthread_mutexattr_getprioceiling ,
+.Fn pthread_mutexattr_setprotocol ,
+.Fn pthread_mutexattr_getprotocol ,
+.Fn pthread_mutexattr_settype ,
+and
+.Fn pthread_mutexattr_gettype
+functions conform to
+.St -susv2
diff --git a/share/man/man3/pthread_mutexattr_getkind_np.3 b/share/man/man3/pthread_mutexattr_getkind_np.3
new file mode 100644
index 000000000000..548045b5aac7
--- /dev/null
+++ b/share/man/man3/pthread_mutexattr_getkind_np.3
@@ -0,0 +1,81 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_MUTEXATTR_GETKIND_NP 3
+.Os
+.Sh NAME
+.Nm pthread_mutexattr_getkind_np ,
+.Nm pthread_mutexattr_setkind_np
+.Nd mutex attribute operations (legacy)
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr"
+.Ft int
+.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr" "int kind"
+.Sh DESCRIPTION
+.Bf -symbolic
+These functions are deprecated and non-portable implementation of
+the mutex type manipulation.
+.Ef
+.Pp
+It is recommended to use the
+.Xr pthread_mutexattr_gettype 3
+and
+.Xr pthread_mutexattr_settype 3
+functions instead.
+.Sh RETURN VALUES
+The
+.Fn pthread_mutexattr_getkind_np
+function returns a positive value representing the
+.Dq kind
+of the mutex attribute
+.Fa attr
+if successful; otherwise the value \-1 is returned and the global variable
+.Va errno
+is set to indicate the error.
+.Pp
+.Rv -std pthread_mutexattr_setkind_np
+.Sh ERRORS
+The
+.Fn pthread_mutexattr_getkind_np
+and
+.Fn pthread_mutexattr_setkind_np
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_mutexattr_gettype 3 ,
+.Xr pthread_mutexattr_settype 3 ,
+.Xr pthread_mutex_destroy 3 ,
+.Xr pthread_mutex_init 3
diff --git a/share/man/man3/pthread_once.3 b/share/man/man3/pthread_once.3
new file mode 100644
index 000000000000..fe234187730c
--- /dev/null
+++ b/share/man/man3/pthread_once.3
@@ -0,0 +1,107 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_ONCE 3
+.Os
+.Sh NAME
+.Nm pthread_once
+.Nd dynamic package initialization
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Pp
+pthread_once_t
+.Fa once_control
+= PTHREAD_ONCE_INIT;
+.Ft int
+.Fn pthread_once "pthread_once_t *once_control" "void (*init_routine)(void)"
+.Sh DESCRIPTION
+The first call to
+.Fn pthread_once
+by any thread in a process, with a given
+.Fa once_control ,
+will call the
+.Fn init_routine
+with no arguments.
+Subsequent calls to
+.Fn pthread_once
+with the same
+.Fa once_control
+will not call the
+.Fn init_routine .
+On return from
+.Fn pthread_once ,
+it is guaranteed that
+.Fn init_routine
+has completed.
+The
+.Fa once_control
+parameter is used to determine whether the associated initialization
+routine has been called.
+.Pp
+The function
+.Fn pthread_once
+is not a cancellation point.
+However, if
+.Fn init_routine
+is a cancellation point and is cancelled, the effect on
+.Fa once_control
+is as if
+.Fn pthread_once
+was never called.
+.Pp
+The constant
+.Fa PTHREAD_ONCE_INIT
+is defined by header
+.In pthread.h .
+.Pp
+The behavior of
+.Fn pthread_once
+is undefined if
+.Fa once_control
+has automatic storage duration or is not initialized by
+.Fa PTHREAD_ONCE_INIT .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_once
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+None.
+.Sh STANDARDS
+The
+.Fn pthread_once
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_resume_all_np.3 b/share/man/man3/pthread_resume_all_np.3
new file mode 100644
index 000000000000..4c63c3bf4c37
--- /dev/null
+++ b/share/man/man3/pthread_resume_all_np.3
@@ -0,0 +1,51 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_RESUME_ALL_NP 3
+.Os
+.Sh NAME
+.Nm pthread_resume_all_np
+.Nd resume all suspended threads
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft void
+.Fn pthread_resume_all_np void
+.Sh DESCRIPTION
+The
+.Fn pthread_resume_all_np
+function causes all active threads to be scanned
+and resumes those which were previously suspended.
+.Sh SEE ALSO
+.Xr pthread_attr_setcreatesuspend_np 3 ,
+.Xr pthread_resume_np 3 ,
+.Xr pthread_suspend_all_np 3 ,
+.Xr pthread_suspend_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_resume_np.3 b/share/man/man3/pthread_resume_np.3
new file mode 100644
index 000000000000..08f7cb96f100
--- /dev/null
+++ b/share/man/man3/pthread_resume_np.3
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_RESUME_NP 3
+.Os
+.Sh NAME
+.Nm pthread_resume_np
+.Nd resume suspended thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_resume_np "pthread_t tid"
+.Sh DESCRIPTION
+The
+.Fn pthread_resume_np
+function, called on a suspended thread, causes it to resume.
+If a thread specified by the
+.Fa tid
+argument is not suspended, no actions will be performed.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_resume_np
+function returns 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_resume_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by the
+.Fa tid
+argument is invalid.
+.It Bq ESRC
+No thread could be found corresponding to the thread ID specified by the
+.Fa tid
+argument.
+.El
+.Sh SEE ALSO
+.Xr pthread_attr_setcreatesuspend_np 3 ,
+.Xr pthread_resume_all_np 3 ,
+.Xr pthread_suspend_all_np 3 ,
+.Xr pthread_suspend_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_rwlock_destroy.3 b/share/man/man3/pthread_rwlock_destroy.3
new file mode 100644
index 000000000000..0129222866b2
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_destroy.3
@@ -0,0 +1,83 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCK_DESTROY 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_destroy
+.Nd destroy a read/write lock
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_destroy "pthread_rwlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlock_destroy
+function is used to destroy a read/write lock previously created with
+.Fn pthread_rwlock_init .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_destroy
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlock_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The caller does not have the privilege to perform the operation.
+.El
+.Pp
+The
+.Fn pthread_rwlock_destroy
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The system has detected an attempt to destroy the object referenced by
+.Fa lock
+while it is locked.
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_init 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_destroy
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_destroy
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlock_init.3 b/share/man/man3/pthread_rwlock_init.3
new file mode 100644
index 000000000000..cf8cc7e10ed6
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_init.3
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCK_INIT 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_init
+.Nd initialize a read/write lock
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_init "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlock_init
+function is used to initialize a read/write lock, with attributes
+specified by
+.Fa attr .
+If
+.Fa attr
+is NULL, the default read/write lock attributes are used.
+.Pp
+The results of calling
+.Fn pthread_rwlock_init
+with an already initialized lock are undefined.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_init
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlock_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system lacked the necessary resources (other than memory) to
+initialize the lock.
+.It Bq Er ENOMEM
+Insufficient memory exists to initialize the lock.
+.It Bq Er EPERM
+The caller does not have sufficient privilege to perform the
+operation.
+.El
+.Pp
+The
+.Fn pthread_rwlock_init
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The system has detected an attempt to re-initialize the object
+referenced by
+.Fa lock ,
+a previously initialized but not yet destroyed read/write lock.
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlockattr_init 3 ,
+.Xr pthread_rwlockattr_setpshared 3 ,
+.Xr pthread_rwlock_destroy 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_init
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_init
+function first appeared in
+.Fx 3.0 .
+.Sh BUGS
+The PTHREAD_PROCESS_SHARED attribute is not supported.
diff --git a/share/man/man3/pthread_rwlock_rdlock.3 b/share/man/man3/pthread_rwlock_rdlock.3
new file mode 100644
index 000000000000..7a197f210ba0
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_rdlock.3
@@ -0,0 +1,127 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCK_RDLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_rdlock ,
+.Nm pthread_rwlock_tryrdlock
+.Nd acquire a read/write lock for reading
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
+.Ft int
+.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlock_rdlock
+function acquires a read lock on
+.Fa lock
+provided that
+.Fa lock
+is not presently held for writing and no writer threads are
+presently blocked on the lock.
+If the read lock cannot be
+immediately acquired, the calling thread blocks until it can
+acquire the lock.
+.Pp
+The
+.Fn pthread_rwlock_tryrdlock
+function performs the same action, but does not block if the lock
+cannot be immediately obtained (i.e., the lock is held for writing
+or there are waiting writers).
+.Pp
+A thread may hold multiple concurrent read locks.
+If so,
+.Fn pthread_rwlock_unlock
+must be called once for each lock obtained.
+.Pp
+The results of acquiring a read lock while the calling thread holds
+a write lock are undefined.
+.Sh IMPLEMENTATION NOTES
+To prevent writer starvation, writers are favored over readers.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_rdlock
+and
+.Fn pthread_rwlock_tryrdlock
+functions will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlock_tryrdlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The lock could not be acquired because a writer holds the lock or
+was blocked on it.
+.El
+.Pp
+The
+.Fn pthread_rwlock_rdlock
+and
+.Fn pthread_rwlock_tryrdlock
+functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The lock could not be acquired because the maximum number of read locks
+against
+.Fa lock
+has been exceeded.
+.It Bq Er EDEADLK
+The current thread already owns
+.Fa lock
+for writing.
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid.
+.It Bq Er ENOMEM
+Insufficient memory exists to initialize the lock (applies to
+statically initialized locks only).
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_init 3 ,
+.Xr pthread_rwlock_trywrlock 3 ,
+.Xr pthread_rwlock_unlock 3 ,
+.Xr pthread_rwlock_wrlock 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_rdlock
+and
+.Fn pthread_rwlock_tryrdlock
+functions are expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_rdlock
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlock_timedrdlock.3 b/share/man/man3/pthread_rwlock_timedrdlock.3
new file mode 100644
index 000000000000..78b74700ce75
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_timedrdlock.3
@@ -0,0 +1,118 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt PTHREAD_RWLOCK_TIMEDRDLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_timedrdlock
+.Nd "acquire a read-write lock for reading or give up after a specified period"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_timedrdlock "pthread_rwlock_t *rwlock" "const struct timespec *abs_timeout"
+.Sh DESCRIPTION
+This function acquires a read lock on the read-write lock
+.Fa rwlock .
+However, if the lock cannot be
+acquired without waiting for another thread to
+unlock the lock,
+this wait shall be terminated when
+.Fa abs_timeout
+expires.
+.Pp
+A thread may hold multiple concurrent read locks.
+The
+.Xr pthread_rwlock_unlock 3
+function must be called once for each lock acquired.
+.Pp
+If the thread should be interrupted by a signal,
+the
+.Fn pthread_rwlock_timedrdlock
+function will be automatically restarted after the thread returns from
+the signal handler.
+.Pp
+The calling thread may deadlock if
+at the time the call is made it holds a write lock on
+.Fa rwlock .
+The results are undefined if this function is called with
+an uninitialized read-write lock.
+.Sh IMPLEMENTATION NOTES
+To prevent writer starvation, writers are favored over readers.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_timedrdlock
+function will return zero.
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+This function shall not return an error code of
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_rwlock_timedrdlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The lock could not be acquired before the specified timeout expired.
+.El
+.Pp
+The
+.Fn pthread_rwlock_timedrdlock
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The read lock could not be
+acquired because the maximum number of read locks for
+.Fa rwlock
+would be exceeded.
+.It Bq Er EDEADLK
+The calling thread already holds a write lock on
+.Fa rwlock .
+.It Bq Er EINVAL
+The value specified by
+.Fa rwlock
+does not refer to an initialized read-write lock object,
+or the
+.Fa abs_timeout
+nanosecond value is less than zero or
+greater than or equal to 1 billion.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_init 3 ,
+.Xr pthread_rwlock_timedwrlock 3 ,
+.Xr pthread_rwlock_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_timedrdlock
+function is expected to conform to
+.St -p1003.1-96 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_timedrdlock
+function first appeared in
+.Fx 5.2 .
diff --git a/share/man/man3/pthread_rwlock_timedwrlock.3 b/share/man/man3/pthread_rwlock_timedwrlock.3
new file mode 100644
index 000000000000..0941dbb99fa5
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_timedwrlock.3
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt PTHREAD_RWLOCK_TIMEDWRLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_timedwrlock
+.Nd "acquire a read-write lock for writing or give up after a specified period"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_timedwrlock "pthread_rwlock_t *rwlock" "const struct timespec *abs_timeout"
+.Sh DESCRIPTION
+This function acquires a write lock on the read-write lock
+.Fa rwlock .
+However, if the lock cannot be
+acquired without waiting for another thread to
+unlock the lock,
+this wait shall be terminated when
+.Fa abs_timeout
+expires.
+.Pp
+If the thread should be interrupted by a signal,
+the
+.Fn pthread_rwlock_timedwrlock
+function will be automatically restarted after the thread returns from
+the signal handler.
+.Pp
+The calling thread may deadlock if
+at the time the call is made it holds
+.Fa rwlock .
+The results are undefined if this function is called with
+an uninitialized read-write lock.
+.Sh IMPLEMENTATION NOTES
+To prevent writer starvation, writers are favored over readers.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_timedwrlock
+function will return zero.
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+This function shall not return an error code of
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_rwlock_timedwrlock
+function shall fail if:
+.Bl -tag -width Er
+.It Bq Er ETIMEDOUT
+The lock could not be acquired before the specified timeout expired.
+.El
+.Pp
+The
+.Fn pthread_rwlock_timedwrlock
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EDEADLK
+The calling thread already holds
+.Fa rwlock .
+.It Bq Er EINVAL
+The value specified by
+.Fa rwlock
+does not refer to an initialized read-write lock object,
+or the
+.Fa abs_timeout
+nanosecond value is less than zero or
+greater than or equal to 1 billion.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_init 3 ,
+.Xr pthread_rwlock_timedrdlock 3 ,
+.Xr pthread_rwlock_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_timedwrlock
+function is expected to conform to
+.St -p1003.1-96 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_timedwrlock
+function first appeared in
+.Fx 5.2 .
diff --git a/share/man/man3/pthread_rwlock_unlock.3 b/share/man/man3/pthread_rwlock_unlock.3
new file mode 100644
index 000000000000..8ad891ea4545
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_unlock.3
@@ -0,0 +1,82 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCK_UNLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_unlock
+.Nd release a read/write lock
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_unlock "pthread_rwlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlock_unlock
+function is used to release the read/write lock previously obtained by
+.Fn pthread_rwlock_rdlock ,
+.Fn pthread_rwlock_wrlock ,
+.Fn pthread_rwlock_tryrdlock ,
+or
+.Fn pthread_rwlock_trywrlock .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_unlock
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Pp
+The results are undefined if
+.Fa lock
+is not held by the calling thread.
+.Sh ERRORS
+The
+.Fn pthread_rwlock_unlock
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid.
+.It Bq Er EPERM
+The current thread does not own the read/write lock.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_rdlock 3 ,
+.Xr pthread_rwlock_wrlock 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_unlock
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_unlock
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlock_wrlock.3 b/share/man/man3/pthread_rwlock_wrlock.3
new file mode 100644
index 000000000000..602b54fd029f
--- /dev/null
+++ b/share/man/man3/pthread_rwlock_wrlock.3
@@ -0,0 +1,106 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCK_WRLOCK 3
+.Os
+.Sh NAME
+.Nm pthread_rwlock_wrlock ,
+.Nm pthread_rwlock_trywrlock
+.Nd acquire a read/write lock for writing
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock"
+.Ft int
+.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlock_wrlock
+function blocks until a write lock can be acquired against
+.Fa lock .
+The
+.Fn pthread_rwlock_trywrlock
+function performs the same action, but does not block if the lock
+cannot be immediately obtained.
+.Pp
+The results are undefined if the calling thread already holds the
+lock at the time the call is made.
+.Sh IMPLEMENTATION NOTES
+To prevent writer starvation, writers are favored over readers.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlock_wrlock
+and
+.Fn pthread_rwlock_trywrlock
+functions will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlock_trywrlock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The calling thread is not able to acquire the lock without blocking.
+.El
+.Pp
+The
+.Fn pthread_rwlock_wrlock
+and
+.Fn pthread_rwlock_trywrlock
+functions may fail if:
+.Bl -tag -width Er
+.It Bq Er EDEADLK
+The calling thread already owns the read/write lock (for reading
+or writing).
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid.
+.It Bq Er ENOMEM
+Insufficient memory exists to initialize the lock (applies to
+statically initialized locks only).
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlock_init 3 ,
+.Xr pthread_rwlock_rdlock 3 ,
+.Xr pthread_rwlock_tryrdlock 3 ,
+.Xr pthread_rwlock_unlock 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlock_wrlock
+and
+.Fn pthread_rwlock_trywrlock
+functions are expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlock_wrlock
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlockattr_destroy.3 b/share/man/man3/pthread_rwlockattr_destroy.3
new file mode 100644
index 000000000000..bff808fdbbd9
--- /dev/null
+++ b/share/man/man3/pthread_rwlockattr_destroy.3
@@ -0,0 +1,72 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCKATTR_DESTROY 3
+.Os
+.Sh NAME
+.Nm pthread_rwlockattr_destroy
+.Nd destroy a read/write lock
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlockattr_destroy "pthread_rwlockattr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlockattr_destroy
+function is used to destroy a read/write lock attribute object
+previously created with
+.Fn pthread_rwlockattr_init .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlockattr_destroy
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlockattr_destroy
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlockattr_init 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlockattr_destroy
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlockattr_destroy
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlockattr_getpshared.3 b/share/man/man3/pthread_rwlockattr_getpshared.3
new file mode 100644
index 000000000000..3fe5de1ae0aa
--- /dev/null
+++ b/share/man/man3/pthread_rwlockattr_getpshared.3
@@ -0,0 +1,86 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 22, 1999
+.Dt PTHREAD_RWLOCKATTR_GETPSHARED 3
+.Os
+.Sh NAME
+.Nm pthread_rwlockattr_getpshared
+.Nd get the process shared attribute
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlockattr_getpshared "const pthread_rwlockattr_t *attr" "int *pshared"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlockattr_getpshared
+function is used to get the process shared setting of a read/write
+lock attribute object.
+The setting is returned via
+.Fa pshared ,
+and may be one of two values:
+.Bl -tag -width PTHREAD_PROCESS_PRIVATE
+.It Dv PTHREAD_PROCESS_SHARED
+Any thread of any process that has access to the memory where the
+read/write lock resides can manipulate the lock.
+.It Dv PTHREAD_PROCESS_PRIVATE
+Only threads created within the same process as the thread that
+initialized the read/write lock can manipulate the lock.
+This is
+the default value.
+.El
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlockattr_getpshared
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlockattr_getpshared
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlockattr_init 3 ,
+.Xr pthread_rwlockattr_setpshared 3 ,
+.Xr pthread_rwlock_init 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlockattr_getpshared
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlockattr_getpshared
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlockattr_init.3 b/share/man/man3/pthread_rwlockattr_init.3
new file mode 100644
index 000000000000..54d319ff84e2
--- /dev/null
+++ b/share/man/man3/pthread_rwlockattr_init.3
@@ -0,0 +1,71 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCKATTR_INIT 3
+.Os
+.Sh NAME
+.Nm pthread_rwlockattr_init
+.Nd initialize a read/write lock
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlockattr_init "pthread_rwlockattr_t *attr"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlockattr_init
+function is used to initialize a read/write lock attributes object.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlockattr_init
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlockattr_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory exists to initialize the attribute object.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlockattr_destroy 3 ,
+.Xr pthread_rwlockattr_getpshared 3 ,
+.Xr pthread_rwlockattr_setpshared 3 ,
+.Xr pthread_rwlock_init 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlockattr_init
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlockattr_init
+function first appeared in
+.Fx 3.0 .
diff --git a/share/man/man3/pthread_rwlockattr_setpshared.3 b/share/man/man3/pthread_rwlockattr_setpshared.3
new file mode 100644
index 000000000000..36bcc690f46e
--- /dev/null
+++ b/share/man/man3/pthread_rwlockattr_setpshared.3
@@ -0,0 +1,94 @@
+.\" Copyright (c) 1998 Alex Nash
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 1998
+.Dt PTHREAD_RWLOCKATTR_SETPSHARED 3
+.Os
+.Sh NAME
+.Nm pthread_rwlockattr_setpshared
+.Nd set the process shared attribute
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_rwlockattr_setpshared "pthread_rwlockattr_t *attr" "int pshared"
+.Sh DESCRIPTION
+The
+.Fn pthread_rwlockattr_setpshared
+function sets the process shared attribute of
+.Fa attr
+to the value referenced by
+.Fa pshared .
+The
+.Fa pshared
+argument may be one of two values:
+.Bl -tag -width PTHREAD_PROCESS_PRIVATE
+.It Dv PTHREAD_PROCESS_SHARED
+Any thread of any process that has access to the memory where the
+read/write lock resides can manipulate the lock.
+.It Dv PTHREAD_PROCESS_PRIVATE
+Only threads created within the same process as the thread that
+initialized the read/write lock can manipulate the lock.
+This is
+the default value.
+.El
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_rwlockattr_setpshared
+function will return zero.
+Otherwise an error number will be returned
+to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_rwlockattr_setpshared
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa attr
+or
+.Fa pshared
+is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_rwlockattr_getpshared 3 ,
+.Xr pthread_rwlockattr_init 3 ,
+.Xr pthread_rwlock_init 3
+.Sh STANDARDS
+The
+.Fn pthread_rwlockattr_setpshared
+function is expected to conform to
+.St -susv2 .
+.Sh HISTORY
+The
+.Fn pthread_rwlockattr_setpshared
+function first appeared in
+.Fx 3.0 .
+.Sh BUGS
+The
+.Dv PTHREAD_PROCESS_SHARED
+attribute is not supported.
diff --git a/share/man/man3/pthread_schedparam.3 b/share/man/man3/pthread_schedparam.3
new file mode 100644
index 000000000000..52d72cc1dd9b
--- /dev/null
+++ b/share/man/man3/pthread_schedparam.3
@@ -0,0 +1,100 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 16, 2006
+.Dt PTHREAD_SCHEDPARAM 3
+.Os
+.Sh NAME
+.Nm pthread_setschedparam ,
+.Nm pthread_getschedparam
+.Nd thread scheduling parameter manipulation
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
+.Ft int
+.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
+.Sh DESCRIPTION
+The
+.Fn pthread_setschedparam
+and
+.Fn pthread_getschedparam
+functions set and get the scheduling parameters of individual threads.
+The scheduling policy for a thread can either be
+.Dv SCHED_FIFO
+(first in, first out),
+.Dv SCHED_RR
+(round-robin), or
+.Dv SCHED_OTHER
+(timesharing).
+Valid thread priorities (accessed via
+.Va param->sched_priority )
+must be within the range returned by the
+.Xr sched_get_priority_min 2
+and
+.Xr sched_get_priority_max 2
+system calls.
+.Sh RETURN VALUES
+If successful, these functions return 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_setschedparam
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa policy .
+.It Bq Er ENOTSUP
+Invalid value for scheduling parameters.
+.It Bq Er ESRCH
+Non-existent thread
+.Fa thread .
+.El
+.Pp
+The
+.Fn pthread_getschedparam
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+Non-existent thread
+.Fa thread .
+.El
+.Sh SEE ALSO
+.Xr sched_get_priority_max 2 ,
+.Xr sched_get_priority_min 2
+.Sh STANDARDS
+The
+.Fn pthread_setschedparam
+and
+.Fn pthread_getschedparam
+functions conform to
+.St -susv2 .
diff --git a/share/man/man3/pthread_self.3 b/share/man/man3/pthread_self.3
new file mode 100644
index 000000000000..8b346836c631
--- /dev/null
+++ b/share/man/man3/pthread_self.3
@@ -0,0 +1,63 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_SELF 3
+.Os
+.Sh NAME
+.Nm pthread_self
+.Nd get the calling thread's ID
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft pthread_t
+.Fn pthread_self "void"
+.Sh DESCRIPTION
+The
+.Fn pthread_self
+function returns the thread ID of the calling thread.
+.Sh RETURN VALUES
+The
+.Fn pthread_self
+function returns the thread ID of the calling thread.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr pthread_create 3 ,
+.Xr pthread_equal 3 ,
+.Xr pthread_getthreadid_np 3
+.Sh STANDARDS
+The
+.Fn pthread_self
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_set_name_np.3 b/share/man/man3/pthread_set_name_np.3
new file mode 100644
index 000000000000..aad2fd6c63a8
--- /dev/null
+++ b/share/man/man3/pthread_set_name_np.3
@@ -0,0 +1,52 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_SET_NAME_NP 3
+.Os
+.Sh NAME
+.Nm pthread_set_name_np
+.Nd set the thread name
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft void
+.Fn pthread_set_name_np "pthread_t tid" "const char *name"
+.Sh DESCRIPTION
+The
+.Fn pthread_set_name_np
+function sets internal name for thread specified by
+.Fa tid
+argument to string value specified by
+.Fa name
+argument.
+.Sh ERRORS
+Because of the debugging nature of this function, all errors that may
+appear inside are silently ignored.
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_setspecific.3 b/share/man/man3/pthread_setspecific.3
new file mode 100644
index 000000000000..1ea3002d43a0
--- /dev/null
+++ b/share/man/man3/pthread_setspecific.3
@@ -0,0 +1,98 @@
+.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by John Birrell.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 1996
+.Dt PTHREAD_SETSPECIFIC 3
+.Os
+.Sh NAME
+.Nm pthread_setspecific
+.Nd set a thread-specific data value
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_setspecific "pthread_key_t key" "const void *value"
+.Sh DESCRIPTION
+The
+.Fn pthread_setspecific
+function associates a thread-specific value with a
+.Fa key
+obtained via a previous call to
+.Fn pthread_key_create .
+Different threads can bind different values to the same key.
+These values are
+typically pointers to blocks of dynamically allocated memory that have been
+reserved for use by the calling thread.
+.Pp
+The effect of calling
+.Fn pthread_setspecific
+with a key value not obtained from
+.Fn pthread_key_create
+or after
+.Fa key
+has been deleted with
+.Fn pthread_key_delete
+is undefined.
+.Pp
+The
+.Fn pthread_setspecific
+function may be called from a thread-specific data destructor function,
+however this may result in lost storage or infinite loops.
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_setspecific
+function will return zero.
+Otherwise an error number will be returned to
+indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_setspecific
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory exists to associate the value with the
+.Fa key .
+.It Bq Er EINVAL
+The
+.Fa key
+value is invalid.
+.El
+.Sh SEE ALSO
+.Xr pthread_getspecific 3 ,
+.Xr pthread_key_create 3 ,
+.Xr pthread_key_delete 3
+.Sh STANDARDS
+The
+.Fn pthread_setspecific
+function conforms to
+.St -p1003.1-96 .
diff --git a/share/man/man3/pthread_sigmask.3 b/share/man/man3/pthread_sigmask.3
new file mode 100644
index 000000000000..013ba7cb6844
--- /dev/null
+++ b/share/man/man3/pthread_sigmask.3
@@ -0,0 +1,99 @@
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd February 19, 2011
+.Dt PTHREAD_SIGMASK 3
+.Os
+.Sh NAME
+.Nm pthread_sigmask
+.Nd examine and/or change a thread's signal mask
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.In signal.h
+.Ft int
+.Fn pthread_sigmask "int how" "const sigset_t * restrict set" \
+ "sigset_t * restrict oset"
+.Sh DESCRIPTION
+The
+.Fn pthread_sigmask
+function examines and/or changes the calling thread's signal mask.
+.Pp
+If
+.Fa set
+is not
+.Dv NULL ,
+it specifies a set of signals to be modified, and
+.Fa how
+specifies what to set the signal mask to:
+.Bl -tag -width SIG_UNBLOCK
+.It Dv SIG_BLOCK
+Union of the current mask and
+.Fa set .
+.It Dv SIG_UNBLOCK
+Intersection of the current mask and the complement of
+.Fa set .
+.It Dv SIG_SETMASK
+.Fa set .
+.El
+.Pp
+If
+.Fa oset
+is not NULL, the previous signal mask is stored in the location pointed to by
+.Fa oset .
+.Pp
+.Dv SIGKILL
+and
+.Dv SIGSTOP
+cannot be blocked, and will be silently ignored if included in the signal mask.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_sigmask
+returns 0.
+Otherwise, an error is returned.
+.Sh ERRORS
+The
+.Fn pthread_sigmask
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa how
+is not one of the defined values.
+.El
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr sigpending 2 ,
+.Xr sigprocmask 2 ,
+.Xr sigsuspend 2 ,
+.Xr sigsetops 3
+.Sh STANDARDS
+The
+.Fn pthread_sigmask
+function conforms to
+.St -p1003.1-96
diff --git a/share/man/man3/pthread_spin_init.3 b/share/man/man3/pthread_spin_init.3
new file mode 100644
index 000000000000..1f76de1bf6a1
--- /dev/null
+++ b/share/man/man3/pthread_spin_init.3
@@ -0,0 +1,138 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2004
+.Dt PTHREAD_SPIN_INIT 3
+.Os
+.Sh NAME
+.Nm pthread_spin_init , pthread_spin_destroy
+.Nd "initialize or destroy a spin lock"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_spin_init "pthread_spinlock_t *lock" "int pshared"
+.Ft int
+.Fn pthread_spin_destroy "pthread_spinlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_spin_init
+function will initialize
+.Fa lock
+to an unlocked state and
+allocate any resources necessary to begin using it.
+If
+.Fa pshared
+is set to
+.Dv PTHREAD_PROCESS_SHARED ,
+any thread,
+whether belonging to the process in which the spinlock was created or not,
+that has access to the memory area where
+.Fa lock
+resides, can use
+.Fa lock .
+If it is set to
+.Dv PTHREAD_PROCESS_PRIVATE ,
+it can only be used by threads within the same process.
+.Pp
+The
+.Fn pthread_spin_destroy
+function will destroy
+.Fa lock
+and release any resources that may have been allocated on its behalf.
+.Sh RETURN VALUES
+If successful,
+both
+.Fn pthread_spin_init
+and
+.Fn pthread_spin_destroy
+will return zero.
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+Neither of these functions will return
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_spin_init
+and
+.Fn pthread_spin_destroy
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+An attempt to initialize or destroy
+.Fa lock
+while it is in use.
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid.
+.El
+.Pp
+The
+.Fn pthread_spin_init
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+Insufficient resources,
+other than memory,
+to initialize
+.Fa lock .
+.It Bq Er ENOMEM
+Insufficient memory to initialize
+.Fa lock .
+.El
+.Sh SEE ALSO
+.Xr pthread_spin_lock 3 ,
+.Xr pthread_spin_unlock 3
+.Sh HISTORY
+The
+.Fn pthread_spin_init
+and
+.Fn pthread_spin_destroy
+functions first appeared in
+.Lb libkse
+in
+.Fx 5.2 ,
+and in
+.Lb libthr
+in
+.Fx 5.3 .
+.Sh BUGS
+The implementation of
+.Fn pthread_spin_init
+does not fully conform to
+.St -p1003.2
+because the
+.Fa pshared
+argument is ignored in
+.Lb libthr ,
+and in
+.Lb libkse
+if any value other than
+.Dv PTHREAD_PROCESSES_PRIVATE
+is specified, it returns
+.Er EINVAL .
diff --git a/share/man/man3/pthread_spin_lock.3 b/share/man/man3/pthread_spin_lock.3
new file mode 100644
index 000000000000..24dea92d2397
--- /dev/null
+++ b/share/man/man3/pthread_spin_lock.3
@@ -0,0 +1,138 @@
+.\" Copyright (c) 2004 Michael Telahun Makonnen
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2004
+.Dt PTHREAD_SPIN_LOCK 3
+.Os
+.Sh NAME
+.Nm pthread_spin_lock , pthread_spin_trylock , pthread_spin_unlock
+.Nd "lock or unlock a spin lock"
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_spin_lock "pthread_spinlock_t *lock"
+.Ft int
+.Fn pthread_spin_trylock "pthread_spinlock_t *lock"
+.Ft int
+.Fn pthread_spin_unlock "pthread_spinlock_t *lock"
+.Sh DESCRIPTION
+The
+.Fn pthread_spin_lock
+function will acquire
+.Fa lock
+if it is not currently owned by another thread.
+If the lock cannot be acquired immediately, it will
+spin attempting to acquire the lock (it will not sleep) until
+it becomes available.
+.Pp
+The
+.Fn pthread_spin_trylock
+function is the same as
+.Fn pthread_spin_lock
+except that if it cannot acquire
+.Fa lock
+immediately it will return with an error.
+.Pp
+The
+.Fn pthread_spin_unlock
+function will release
+.Fa lock ,
+which must have been previously locked by a call to
+.Fn pthread_spin_lock
+or
+.Fn pthread_spin_trylock .
+.Sh RETURN VALUES
+If successful, all these functions will return zero.
+Otherwise, an error number will be returned to indicate the error.
+.Pp
+None of these functions will return
+.Er EINTR .
+.Sh ERRORS
+The
+.Fn pthread_spin_lock ,
+.Fn pthread_spin_trylock
+and
+.Fn pthread_spin_unlock
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value specified by
+.Fa lock
+is invalid or is not initialized.
+.El
+.Pp
+The
+.Fn pthread_spin_lock
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EDEADLK
+The calling thread already owns the lock.
+.El
+.Pp
+The
+.Fn pthread_spin_trylock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+Another thread currently holds
+.Fa lock .
+.El
+.Pp
+The
+.Fn pthread_spin_unlock
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The calling thread does not own
+.Fa lock .
+.El
+.Sh SEE ALSO
+.Xr pthread_spin_destroy 3 ,
+.Xr pthread_spin_init 3
+.Sh HISTORY
+The
+.Fn pthread_spin_lock ,
+.Fn pthread_spin_trylock
+and
+.Fn pthread_spin_unlock
+functions first appeared in
+.Lb libkse
+in
+.Fx 5.2 ,
+and in
+.Lb libthr
+in
+.Fx 5.3 .
+.Sh BUGS
+The implementation of
+.Fn pthread_spin_lock ,
+.Fn pthread_spin_trylock
+and
+.Fn pthread_spin_unlock
+is expected to conform to
+.St -p1003.2 .
diff --git a/share/man/man3/pthread_suspend_all_np.3 b/share/man/man3/pthread_suspend_all_np.3
new file mode 100644
index 000000000000..fdeab1970fc9
--- /dev/null
+++ b/share/man/man3/pthread_suspend_all_np.3
@@ -0,0 +1,53 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_SUSPEND_ALL_NP 3
+.Os
+.Sh NAME
+.Nm pthread_suspend_all_np
+.Nd suspend all active threads
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft void
+.Fn pthread_suspend_all_np void
+.Sh DESCRIPTION
+The
+.Fn pthread_suspend_all_np
+function causes all active threads to be suspended.
+The only exception is the current thread,
+the thread that called the
+.Fn pthread_suspend_all_np
+function.
+.Sh SEE ALSO
+.Xr pthread_resume_all_np 3 ,
+.Xr pthread_resume_np 3 ,
+.Xr pthread_suspend_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_suspend_np.3 b/share/man/man3/pthread_suspend_np.3
new file mode 100644
index 000000000000..43d2b7ddea97
--- /dev/null
+++ b/share/man/man3/pthread_suspend_np.3
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_SUSPEND_NP 3
+.Os
+.Sh NAME
+.Nm pthread_suspend_np
+.Nd suspend a thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_suspend_np "pthread_t tid"
+.Sh DESCRIPTION
+The
+.Fn pthread_suspend_np
+function, called on an active thread, causes it to suspend.
+.Sh RETURN VALUES
+If successful,
+.Fn pthread_suspend_np
+function returns 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_suspend_np
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EDEADLK
+An attempt was made to suspend the current thread.
+.It Bq Er EINVAL
+The value specified by the
+.Fa tid
+argument is invalid.
+.It Bq ESRC
+No thread could be found corresponding to the thread ID specified by the
+.Fa tid
+argument.
+.El
+.Sh SEE ALSO
+.Xr pthread_resume_all_np 3 ,
+.Xr pthread_resume_np 3 ,
+.Xr pthread_suspend_all_np 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_switch_add_np.3 b/share/man/man3/pthread_switch_add_np.3
new file mode 100644
index 000000000000..0c4207271843
--- /dev/null
+++ b/share/man/man3/pthread_switch_add_np.3
@@ -0,0 +1,87 @@
+.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2003
+.Dt PTHREAD_SWITCH_ADD_NP 3
+.Os
+.Sh NAME
+.Nm pthread_switch_add_np ,
+.Nm pthread_switch_delete_np
+.Nd thread context switches debugging primitives
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread_np.h
+.Ft int
+.Fn pthread_switch_add_np "pthread_switch_routine_t routine"
+.Ft int
+.Fn pthread_switch_delete_np "pthread_switch_routine_t routine"
+.Sh DESCRIPTION
+An application is allowed to monitor the thread context switches inside
+the threading library.
+An application can install a routine that gets called every time a thread
+(explicitly created by an application with the
+.Xr pthread_create 3
+function) gets the context switched.
+The routine is passed the thread IDs of the threads that are
+being switched in and out.
+Installation and removal of these hooks may be done using the
+.Fn pthread_switch_add_np
+and
+.Fn pthread_switch_delete_np
+functions respectively.
+.Sh RETURN VALUES
+If successful,
+these functions return 0.
+Otherwise, an error number is returned to indicate the error.
+.Sh ERRORS
+The
+.Fn pthread_switch_add_np
+may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Dv NULL
+pointer was passed in the
+.Fa routine
+argument.
+.El
+.Pp
+The
+.Fn pthread_switch_delete_np
+may fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa routine
+argument is different from the argument previously passed to the
+.Fn pthread_switch_add_np
+function.
+.El
+.Sh SEE ALSO
+.Xr pthread_create 3
+.Sh AUTHORS
+This manual page was written by
+.An Alexey Zelkin Aq phantom@FreeBSD.org .
diff --git a/share/man/man3/pthread_testcancel.3 b/share/man/man3/pthread_testcancel.3
new file mode 100644
index 000000000000..7a73cb9edcbe
--- /dev/null
+++ b/share/man/man3/pthread_testcancel.3
@@ -0,0 +1,210 @@
+.\" $FreeBSD$
+.Dd January 17, 1999
+.Dt PTHREAD_TESTCANCEL 3
+.Os
+.Sh NAME
+.Nm pthread_setcancelstate ,
+.Nm pthread_setcanceltype ,
+.Nm pthread_testcancel
+.Nd set cancelability state
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft int
+.Fn pthread_setcancelstate "int state" "int *oldstate"
+.Ft int
+.Fn pthread_setcanceltype "int type" "int *oldtype"
+.Ft void
+.Fn pthread_testcancel "void"
+.Sh DESCRIPTION
+The
+.Fn pthread_setcancelstate
+function atomically both sets the calling thread's cancelability state
+to the indicated
+.Fa state
+and, if
+.Fa oldstate
+is not
+.Dv NULL ,
+returns the previous cancelability state at the location referenced by
+.Fa oldstate .
+Legal values for
+.Fa state
+are
+.Dv PTHREAD_CANCEL_ENABLE
+and
+.Dv PTHREAD_CANCEL_DISABLE .
+.Pp
+The
+.Fn pthread_setcanceltype
+function atomically both sets the calling thread's cancelability type
+to the indicated
+.Fa type
+and, if
+.Fa oldtype
+is not
+.Dv NULL ,
+returns the previous cancelability type at the location referenced by
+.Fa oldtype .
+Legal values for
+.Fa type
+are
+.Dv PTHREAD_CANCEL_DEFERRED
+and
+.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
+.Pp
+The cancelability state and type of any newly created threads, including the
+thread in which
+.Fn main
+was first invoked, are
+.Dv PTHREAD_CANCEL_ENABLE
+and
+.Dv PTHREAD_CANCEL_DEFERRED
+respectively.
+.Pp
+The
+.Fn pthread_testcancel
+function creates a cancellation point in the calling thread.
+The
+.Fn pthread_testcancel
+function has no effect if cancelability is disabled.
+.Pp
+.Ss Cancelability States
+The cancelability state of a thread determines the action taken upon
+receipt of a cancellation request.
+The thread may control cancellation in
+a number of ways.
+.Pp
+Each thread maintains its own
+.Dq cancelability state
+which may be encoded in two bits:
+.Bl -hang
+.It Em Cancelability Enable
+When cancelability is
+.Dv PTHREAD_CANCEL_DISABLE ,
+cancellation requests against the target thread are held pending.
+.It Em Cancelability Type
+When cancelability is enabled and the cancelability type is
+.Dv PTHREAD_CANCEL_ASYNCHRONOUS ,
+new or pending cancellation requests may be acted upon at any time.
+When cancelability is enabled and the cancelability type is
+.Dv PTHREAD_CANCEL_DEFERRED ,
+cancellation requests are held pending until a cancellation point (see
+below) is reached.
+If cancelability is disabled, the setting of the
+cancelability type has no immediate effect as all cancellation requests
+are held pending; however, once cancelability is enabled again the new
+type will be in effect.
+.El
+.Ss Cancellation Points
+Cancellation points will occur when a thread is executing the following
+functions:
+.Fn close ,
+.Fn creat ,
+.Fn fcntl ,
+.Fn fsync ,
+.Fn msync ,
+.Fn nanosleep ,
+.Fn open ,
+.Fn pause ,
+.Fn pthread_cond_timedwait ,
+.Fn pthread_cond_wait ,
+.Fn pthread_join ,
+.Fn pthread_testcancel ,
+.Fn read ,
+.Fn sigwaitinfo ,
+.Fn sigsuspend ,
+.Fn sigwait ,
+.Fn sleep ,
+.Fn system ,
+.Fn tcdrain ,
+.Fn wait ,
+.Fn waitpid ,
+.Fn write .
+.Sh RETURN VALUES
+If successful, the
+.Fn pthread_setcancelstate
+and
+.Fn pthread_setcanceltype
+functions will return zero.
+Otherwise, an error number shall be returned to
+indicate the error.
+.Pp
+The
+.Fn pthread_setcancelstate
+and
+.Fn pthread_setcanceltype
+functions are used to control the points at which a thread may be
+asynchronously canceled.
+For cancellation control to be usable in modular
+fashion, some rules must be followed.
+.Pp
+For purposes of this discussion, consider an object to be a generalization
+of a procedure.
+It is a set of procedures and global variables written as
+a unit and called by clients not known by the object.
+Objects may depend
+on other objects.
+.Pp
+First, cancelability should only be disabled on entry to an object, never
+explicitly enabled.
+On exit from an object, the cancelability state should
+always be restored to its value on entry to the object.
+.Pp
+This follows from a modularity argument: if the client of an object (or the
+client of an object that uses that object) has disabled cancelability, it is
+because the client does not want to have to worry about how to clean up if the
+thread is canceled while executing some sequence of actions.
+If an object
+is called in such a state and it enables cancelability and a cancellation
+request is pending for that thread, then the thread will be canceled,
+contrary to the wish of the client that disabled.
+.Pp
+Second, the cancelability type may be explicitly set to either
+.Em deferred
+or
+.Em asynchronous
+upon entry to an object.
+But as with the cancelability state, on exit from
+an object that cancelability type should always be restored to its value on
+entry to the object.
+.Pp
+Finally, only functions that are cancel-safe may be called from a thread that
+is asynchronously cancelable.
+.Sh ERRORS
+The function
+.Fn pthread_setcancelstate
+may fail with:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The specified state is not
+.Dv PTHREAD_CANCEL_ENABLE
+or
+.Dv PTHREAD_CANCEL_DISABLE .
+.El
+.Pp
+The function
+.Fn pthread_setcanceltype
+may fail with:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The specified state is not
+.Dv PTHREAD_CANCEL_DEFERRED
+or
+.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
+.El
+.Sh SEE ALSO
+.Xr pthread_cancel 3
+.Sh STANDARDS
+The
+.Fn pthread_testcancel
+function conforms to
+.St -p1003.1-96 .
+.Sh AUTHORS
+This manual page was written by
+.An David Leonard Aq d@openbsd.org
+for the
+.Ox
+implementation of
+.Xr pthread_cancel 3 .
diff --git a/share/man/man3/pthread_yield.3 b/share/man/man3/pthread_yield.3
new file mode 100644
index 000000000000..e47c033acfb7
--- /dev/null
+++ b/share/man/man3/pthread_yield.3
@@ -0,0 +1,30 @@
+.\" $OpenBSD: pthread_yield.3,v 1.3 2004/01/25 14:48:32 jmc Exp $
+.\"
+.\" PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2006
+.Dt PTHREAD_YIELD 3
+.Os
+.Sh NAME
+.Nm pthread_yield
+.Nd yield control of the current thread
+.Sh LIBRARY
+.Lb libpthread
+.Sh SYNOPSIS
+.In pthread.h
+.Ft void
+.Fn pthread_yield void
+.Sh DESCRIPTION
+The
+.Fn pthread_yield
+forces the running thread to relinquish the processor until it again
+becomes the head of its thread list.
+.Sh SEE ALSO
+.Xr sched_yield 2
+.Sh STANDARDS
+The
+.Fn pthread_yield
+is a non-portable (but quite common) extension to
+.St -p1003.1-2001 .
diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3
new file mode 100644
index 000000000000..76f9464d99c4
--- /dev/null
+++ b/share/man/man3/queue.3
@@ -0,0 +1,1044 @@
+.\" Copyright (c) 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)queue.3 8.2 (Berkeley) 1/24/94
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2011
+.Dt QUEUE 3
+.Os
+.Sh NAME
+.Nm SLIST_EMPTY ,
+.Nm SLIST_ENTRY ,
+.Nm SLIST_FIRST ,
+.Nm SLIST_FOREACH ,
+.Nm SLIST_FOREACH_SAFE ,
+.Nm SLIST_HEAD ,
+.Nm SLIST_HEAD_INITIALIZER ,
+.Nm SLIST_INIT ,
+.Nm SLIST_INSERT_AFTER ,
+.Nm SLIST_INSERT_HEAD ,
+.Nm SLIST_NEXT ,
+.Nm SLIST_REMOVE_AFTER ,
+.Nm SLIST_REMOVE_HEAD ,
+.Nm SLIST_REMOVE ,
+.Nm SLIST_SWAP ,
+.Nm STAILQ_CONCAT ,
+.Nm STAILQ_EMPTY ,
+.Nm STAILQ_ENTRY ,
+.Nm STAILQ_FIRST ,
+.Nm STAILQ_FOREACH ,
+.Nm STAILQ_FOREACH_SAFE ,
+.Nm STAILQ_HEAD ,
+.Nm STAILQ_HEAD_INITIALIZER ,
+.Nm STAILQ_INIT ,
+.Nm STAILQ_INSERT_AFTER ,
+.Nm STAILQ_INSERT_HEAD ,
+.Nm STAILQ_INSERT_TAIL ,
+.Nm STAILQ_LAST ,
+.Nm STAILQ_NEXT ,
+.Nm STAILQ_REMOVE_AFTER ,
+.Nm STAILQ_REMOVE_HEAD ,
+.Nm STAILQ_REMOVE ,
+.Nm STAILQ_SWAP ,
+.Nm LIST_EMPTY ,
+.Nm LIST_ENTRY ,
+.Nm LIST_FIRST ,
+.Nm LIST_FOREACH ,
+.Nm LIST_FOREACH_SAFE ,
+.Nm LIST_HEAD ,
+.Nm LIST_HEAD_INITIALIZER ,
+.Nm LIST_INIT ,
+.Nm LIST_INSERT_AFTER ,
+.Nm LIST_INSERT_BEFORE ,
+.Nm LIST_INSERT_HEAD ,
+.Nm LIST_NEXT ,
+.Nm LIST_REMOVE ,
+.Nm LIST_SWAP ,
+.Nm TAILQ_CONCAT ,
+.Nm TAILQ_EMPTY ,
+.Nm TAILQ_ENTRY ,
+.Nm TAILQ_FIRST ,
+.Nm TAILQ_FOREACH ,
+.Nm TAILQ_FOREACH_SAFE ,
+.Nm TAILQ_FOREACH_REVERSE ,
+.Nm TAILQ_FOREACH_REVERSE_SAFE ,
+.Nm TAILQ_HEAD ,
+.Nm TAILQ_HEAD_INITIALIZER ,
+.Nm TAILQ_INIT ,
+.Nm TAILQ_INSERT_AFTER ,
+.Nm TAILQ_INSERT_BEFORE ,
+.Nm TAILQ_INSERT_HEAD ,
+.Nm TAILQ_INSERT_TAIL ,
+.Nm TAILQ_LAST ,
+.Nm TAILQ_NEXT ,
+.Nm TAILQ_PREV ,
+.Nm TAILQ_REMOVE ,
+.Nm TAILQ_SWAP
+.Nd implementations of singly-linked lists, singly-linked tail queues,
+lists and tail queues
+.Sh SYNOPSIS
+.In sys/queue.h
+.\"
+.Fn SLIST_EMPTY "SLIST_HEAD *head"
+.Fn SLIST_ENTRY "TYPE"
+.Fn SLIST_FIRST "SLIST_HEAD *head"
+.Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var"
+.Fn SLIST_HEAD "HEADNAME" "TYPE"
+.Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head"
+.Fn SLIST_INIT "SLIST_HEAD *head"
+.Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
+.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
+.\"
+.Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
+.Fn STAILQ_EMPTY "STAILQ_HEAD *head"
+.Fn STAILQ_ENTRY "TYPE"
+.Fn STAILQ_FIRST "STAILQ_HEAD *head"
+.Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn STAILQ_HEAD "HEADNAME" "TYPE"
+.Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head"
+.Fn STAILQ_INIT "STAILQ_HEAD *head"
+.Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
+.\"
+.Fn LIST_EMPTY "LIST_HEAD *head"
+.Fn LIST_ENTRY "TYPE"
+.Fn LIST_FIRST "LIST_HEAD *head"
+.Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME"
+.Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var"
+.Fn LIST_HEAD "HEADNAME" "TYPE"
+.Fn LIST_HEAD_INITIALIZER "LIST_HEAD head"
+.Fn LIST_INIT "LIST_HEAD *head"
+.Fn LIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
+.\"
+.Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
+.Fn TAILQ_EMPTY "TAILQ_HEAD *head"
+.Fn TAILQ_ENTRY "TYPE"
+.Fn TAILQ_FIRST "TAILQ_HEAD *head"
+.Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var"
+.Fn TAILQ_HEAD "HEADNAME" "TYPE"
+.Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head"
+.Fn TAILQ_INIT "TAILQ_HEAD *head"
+.Fn TAILQ_INSERT_AFTER "TAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_HEAD "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_INSERT_TAIL "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_LAST "TAILQ_HEAD *head" "HEADNAME"
+.Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
+.Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
+.\"
+.Sh DESCRIPTION
+These macros define and operate on four types of data structures:
+singly-linked lists, singly-linked tail queues, lists, and tail queues.
+All four structures support the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry at the head of the list.
+.It
+Insertion of a new entry after any element in the list.
+.It
+O(1) removal of an entry from the head of the list.
+.It
+Forward traversal through the list.
+.It
+Swapping the contents of two lists.
+.El
+.Pp
+Singly-linked lists are the simplest of the four data structures
+and support only the above functionality.
+Singly-linked lists are ideal for applications with large datasets
+and few or no removals,
+or for implementing a LIFO queue.
+Singly-linked lists add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+O(n) removal of any entry in the list.
+.El
+.Pp
+Singly-linked tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+O(n) removal of any entry in the list.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+Singly-linked tail queues are ideal for applications with large datasets and
+few or no removals,
+or for implementing a FIFO queue.
+.Pp
+All doubly linked types of data structures (lists and tail queues)
+additionally allow:
+.Bl -enum -compact -offset indent
+.It
+Insertion of a new entry before any element in the list.
+.It
+O(1) removal of any entry in the list.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+Each element requires two pointers rather than one.
+.It
+Code size and execution time of operations (except for removal) is about
+twice that of the singly-linked data-structures.
+.El
+.Pp
+Linked lists are the simplest of the doubly linked data structures and support
+only the above functionality over singly-linked lists.
+.Pp
+Tail queues add the following functionality:
+.Bl -enum -compact -offset indent
+.It
+Entries can be added at the end of a list.
+.It
+They may be traversed backwards, from tail to head.
+.It
+They may be concatenated.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+All list insertions and removals must specify the head of the list.
+.It
+Each head entry requires two pointers rather than one.
+.It
+Code size is about 15% greater and operations run about 20% slower
+than singly-linked lists.
+.El
+.Pp
+In the macro definitions,
+.Fa TYPE
+is the name of a user defined structure,
+that must contain a field of type
+.Li SLIST_ENTRY ,
+.Li STAILQ_ENTRY ,
+.Li LIST_ENTRY ,
+or
+.Li TAILQ_ENTRY ,
+named
+.Fa NAME .
+The argument
+.Fa HEADNAME
+is the name of a user defined structure that must be declared
+using the macros
+.Li SLIST_HEAD ,
+.Li STAILQ_HEAD ,
+.Li LIST_HEAD ,
+or
+.Li TAILQ_HEAD .
+See the examples below for further explanation of how these
+macros are used.
+.Sh SINGLY-LINKED LISTS
+A singly-linked list is headed by a structure defined by the
+.Nm SLIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are singly linked for minimum space and pointer manipulation
+overhead at the expense of O(n) removal for arbitrary elements.
+New elements can be added to the list after an existing element or
+at the head of the list.
+An
+.Fa SLIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+SLIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm SLIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm SLIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm SLIST_FIRST
+returns the first element in the list or NULL if the list is empty.
+.Pp
+The macro
+.Nm SLIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+.Pp
+The macro
+.Nm SLIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+However, unlike
+.Fn SLIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm SLIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm SLIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm SLIST_NEXT
+returns the next element in the list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the list. Unlike
+.Fa SLIST_REMOVE ,
+this macro does not traverse the entire list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_HEAD
+removes the element
+.Fa elm
+from the head of the list.
+For optimum efficiency,
+elements being removed from the head of the list should explicitly use
+this macro instead of the generic
+.Fa SLIST_REMOVE
+macro.
+.Pp
+The macro
+.Nm SLIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm SLIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED LIST EXAMPLE
+.Bd -literal
+SLIST_HEAD(slisthead, entry) head =
+ SLIST_HEAD_INITIALIZER(head);
+struct slisthead *headp; /* Singly-linked List head. */
+struct entry {
+ ...
+ SLIST_ENTRY(entry) entries; /* Singly-linked List. */
+ ...
+} *n1, *n2, *n3, *np;
+
+SLIST_INIT(&head); /* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the head. */
+SLIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert after. */
+SLIST_INSERT_AFTER(n1, n2, entries);
+
+SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */
+free(n2);
+
+n3 = SLIST_FIRST(&head);
+SLIST_REMOVE_HEAD(&head, entries); /* Deletion from the head. */
+free(n3);
+ /* Forward traversal. */
+SLIST_FOREACH(np, &head, entries)
+ np-> ...
+ /* Safe forward traversal. */
+SLIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+ np->do_stuff();
+ ...
+ SLIST_REMOVE(&head, np, entry, entries);
+ free(np);
+}
+
+while (!SLIST_EMPTY(&head)) { /* List Deletion. */
+ n1 = SLIST_FIRST(&head);
+ SLIST_REMOVE_HEAD(&head, entries);
+ free(n1);
+}
+.Ed
+.Sh SINGLY-LINKED TAIL QUEUES
+A singly-linked tail queue is headed by a structure defined by the
+.Nm STAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are singly linked for minimum space and pointer
+manipulation overhead at the expense of O(n) removal for arbitrary
+elements.
+New elements can be added to the tail queue after an existing element,
+at the head of the tail queue, or at the end of the tail queue.
+A
+.Fa STAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+STAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm STAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm STAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm STAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm STAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm STAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+.Pp
+The macro
+.Nm STAILQ_FOREACH_SAFE
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element
+in turn to
+.Fa var .
+However, unlike
+.Fn STAILQ_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm STAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm STAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm STAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm STAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm STAILQ_NEXT
+returns the next item on the tail queue, or NULL this item is the last.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the tail queue. Unlike
+.Fa STAILQ_REMOVE ,
+this macro does not traverse the entire tail queue.
+.Pp
+The macro
+.Nm STAILQ_REMOVE_HEAD
+removes the element at the head of the tail queue.
+For optimum efficiency,
+elements being removed from the head of the tail queue should
+use this macro explicitly rather than the generic
+.Fa STAILQ_REMOVE
+macro.
+.Pp
+The macro
+.Nm STAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm STAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
+.Bd -literal
+STAILQ_HEAD(stailhead, entry) head =
+ STAILQ_HEAD_INITIALIZER(head);
+struct stailhead *headp; /* Singly-linked tail queue head. */
+struct entry {
+ ...
+ STAILQ_ENTRY(entry) entries; /* Tail queue. */
+ ...
+} *n1, *n2, *n3, *np;
+
+STAILQ_INIT(&head); /* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the head. */
+STAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the tail. */
+STAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert after. */
+STAILQ_INSERT_AFTER(&head, n1, n2, entries);
+ /* Deletion. */
+STAILQ_REMOVE(&head, n2, entry, entries);
+free(n2);
+ /* Deletion from the head. */
+n3 = STAILQ_FIRST(&head);
+STAILQ_REMOVE_HEAD(&head, entries);
+free(n3);
+ /* Forward traversal. */
+STAILQ_FOREACH(np, &head, entries)
+ np-> ...
+ /* Safe forward traversal. */
+STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+ np->do_stuff();
+ ...
+ STAILQ_REMOVE(&head, np, entry, entries);
+ free(np);
+}
+ /* TailQ Deletion. */
+while (!STAILQ_EMPTY(&head)) {
+ n1 = STAILQ_FIRST(&head);
+ STAILQ_REMOVE_HEAD(&head, entries);
+ free(n1);
+}
+ /* Faster TailQ Deletion. */
+n1 = STAILQ_FIRST(&head);
+while (n1 != NULL) {
+ n2 = STAILQ_NEXT(n1, entries);
+ free(n1);
+ n1 = n2;
+}
+STAILQ_INIT(&head);
+.Ed
+.Sh LISTS
+A list is headed by a structure defined by the
+.Nm LIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the list.
+New elements can be added to the list after an existing element,
+before an existing element, or at the head of the list.
+A
+.Fa LIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+LIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm LIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm LIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm LIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm LIST_FIRST
+returns the first element in the list or NULL if the list
+is empty.
+.Pp
+The macro
+.Nm LIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macro
+.Nm LIST_FOREACH_SAFE
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+However, unlike
+.Fn LIST_FOREACH
+here it is permitted to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm LIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm LIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm LIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm LIST_NEXT
+returns the next element in the list, or NULL if this is the last.
+.Pp
+The macro
+.Nm LIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.Pp
+The macro
+.Nm LIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh LIST EXAMPLE
+.Bd -literal
+LIST_HEAD(listhead, entry) head =
+ LIST_HEAD_INITIALIZER(head);
+struct listhead *headp; /* List head. */
+struct entry {
+ ...
+ LIST_ENTRY(entry) entries; /* List. */
+ ...
+} *n1, *n2, *n3, *np, *np_temp;
+
+LIST_INIT(&head); /* Initialize the list. */
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the head. */
+LIST_INSERT_HEAD(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert after. */
+LIST_INSERT_AFTER(n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry)); /* Insert before. */
+LIST_INSERT_BEFORE(n2, n3, entries);
+
+LIST_REMOVE(n2, entries); /* Deletion. */
+free(n2);
+ /* Forward traversal. */
+LIST_FOREACH(np, &head, entries)
+ np-> ...
+
+ /* Safe forward traversal. */
+LIST_FOREACH_SAFE(np, &head, entries, np_temp) {
+ np->do_stuff();
+ ...
+ LIST_REMOVE(np, entries);
+ free(np);
+}
+
+while (!LIST_EMPTY(&head)) { /* List Deletion. */
+ n1 = LIST_FIRST(&head);
+ LIST_REMOVE(n1, entries);
+ free(n1);
+}
+
+n1 = LIST_FIRST(&head); /* Faster List Deletion. */
+while (n1 != NULL) {
+ n2 = LIST_NEXT(n1, entries);
+ free(n1);
+ n1 = n2;
+}
+LIST_INIT(&head);
+.Ed
+.Sh TAIL QUEUES
+A tail queue is headed by a structure defined by the
+.Nm TAILQ_HEAD
+macro.
+This structure contains a pair of pointers,
+one to the first element in the tail queue and the other to
+the last element in the tail queue.
+The elements are doubly linked so that an arbitrary element can be
+removed without traversing the tail queue.
+New elements can be added to the tail queue after an existing element,
+before an existing element, at the head of the tail queue,
+or at the end of the tail queue.
+A
+.Fa TAILQ_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+TAILQ_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Li HEADNAME
+is the name of the structure to be defined, and
+.Li TYPE
+is the type of the elements to be linked into the tail queue.
+A pointer to the head of the tail queue can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm TAILQ_HEAD_INITIALIZER
+evaluates to an initializer for the tail queue
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_CONCAT
+concatenates the tail queue headed by
+.Fa head2
+onto the end of the one headed by
+.Fa head1
+removing all entries from the former.
+.Pp
+The macro
+.Nm TAILQ_EMPTY
+evaluates to true if there are no items on the tail queue.
+.Pp
+The macro
+.Nm TAILQ_ENTRY
+declares a structure that connects the elements in
+the tail queue.
+.Pp
+The macro
+.Nm TAILQ_FIRST
+returns the first item on the tail queue or NULL if the tail queue
+is empty.
+.Pp
+The macro
+.Nm TAILQ_FOREACH
+traverses the tail queue referenced by
+.Fa head
+in the forward direction, assigning each element in turn to
+.Fa var .
+.Fa var
+is set to
+.Dv NULL
+if the loop completes normally, or if there were no elements.
+.Pp
+The macro
+.Nm TAILQ_FOREACH_REVERSE
+traverses the tail queue referenced by
+.Fa head
+in the reverse direction, assigning each element in turn to
+.Fa var .
+.Pp
+The macros
+.Nm TAILQ_FOREACH_SAFE
+and
+.Nm TAILQ_FOREACH_REVERSE_SAFE
+traverse the list referenced by
+.Fa head
+in the forward or reverse direction respectively,
+assigning each element in turn to
+.Fa var .
+However, unlike their unsafe counterparts,
+.Nm TAILQ_FOREACH
+and
+.Nm TAILQ_FOREACH_REVERSE
+permit to both remove
+.Fa var
+as well as free it from within the loop safely without interfering with the
+traversal.
+.Pp
+The macro
+.Nm TAILQ_INIT
+initializes the tail queue referenced by
+.Fa head .
+.Pp
+The macro
+.Nm TAILQ_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_TAIL
+inserts the new element
+.Fa elm
+at the end of the tail queue.
+.Pp
+The macro
+.Nm TAILQ_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_INSERT_BEFORE
+inserts the new element
+.Fa elm
+before the element
+.Fa listelm .
+.Pp
+The macro
+.Nm TAILQ_LAST
+returns the last item on the tail queue.
+If the tail queue is empty the return value is
+.Dv NULL .
+.Pp
+The macro
+.Nm TAILQ_NEXT
+returns the next item on the tail queue, or NULL if this item is the last.
+.Pp
+The macro
+.Nm TAILQ_PREV
+returns the previous item on the tail queue, or NULL if this item
+is the first.
+.Pp
+The macro
+.Nm TAILQ_REMOVE
+removes the element
+.Fa elm
+from the tail queue.
+.Pp
+The macro
+.Nm TAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
+.Sh TAIL QUEUE EXAMPLE
+.Bd -literal
+TAILQ_HEAD(tailhead, entry) head =
+ TAILQ_HEAD_INITIALIZER(head);
+struct tailhead *headp; /* Tail queue head. */
+struct entry {
+ ...
+ TAILQ_ENTRY(entry) entries; /* Tail queue. */
+ ...
+} *n1, *n2, *n3, *np;
+
+TAILQ_INIT(&head); /* Initialize the queue. */
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the head. */
+TAILQ_INSERT_HEAD(&head, n1, entries);
+
+n1 = malloc(sizeof(struct entry)); /* Insert at the tail. */
+TAILQ_INSERT_TAIL(&head, n1, entries);
+
+n2 = malloc(sizeof(struct entry)); /* Insert after. */
+TAILQ_INSERT_AFTER(&head, n1, n2, entries);
+
+n3 = malloc(sizeof(struct entry)); /* Insert before. */
+TAILQ_INSERT_BEFORE(n2, n3, entries);
+
+TAILQ_REMOVE(&head, n2, entries); /* Deletion. */
+free(n2);
+ /* Forward traversal. */
+TAILQ_FOREACH(np, &head, entries)
+ np-> ...
+ /* Safe forward traversal. */
+TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) {
+ np->do_stuff();
+ ...
+ TAILQ_REMOVE(&head, np, entries);
+ free(np);
+}
+ /* Reverse traversal. */
+TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
+ np-> ...
+ /* TailQ Deletion. */
+while (!TAILQ_EMPTY(&head)) {
+ n1 = TAILQ_FIRST(&head);
+ TAILQ_REMOVE(&head, n1, entries);
+ free(n1);
+}
+ /* Faster TailQ Deletion. */
+n1 = TAILQ_FIRST(&head);
+while (n1 != NULL) {
+ n2 = TAILQ_NEXT(n1, entries);
+ free(n1);
+ n1 = n2;
+}
+TAILQ_INIT(&head);
+.Ed
+.Sh SEE ALSO
+.Xr tree 3
+.Sh HISTORY
+The
+.Nm queue
+functions first appeared in
+.Bx 4.4 .
diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3
new file mode 100644
index 000000000000..9452b08647eb
--- /dev/null
+++ b/share/man/man3/siginfo.3
@@ -0,0 +1,305 @@
+.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 8, 2005
+.Dt SIGINFO 3
+.Os
+.Sh NAME
+.Nm siginfo
+.Nd "signal generation information"
+.Sh SYNOPSIS
+.In signal.h
+.Sh DESCRIPTION
+A process may request signal information when it is catching a signal.
+The information specifies why the system generated that signal.
+To request signal information in a signal handler, the user can set
+.Dv SA_SIGINFO
+in
+.Va sa_flags
+before
+.Xr sigaction 2
+is called,
+otherwise the user can use
+.Xr sigwaitinfo 2
+and
+.Xr sigtimedwait 2
+to get signal information.
+In either case, the system returns the information in a structure of type
+.Vt siginfo_t ,
+which includes the following information:
+.Bl -column ".Vt union signal" ".Va si_overrun"
+.It Sy "Type Member Description"
+.It Vt int Ta Va si_signo Ta
+signal number
+.It Vt int Ta Va si_errno Ta
+error number
+.It Vt int Ta Va si_code Ta
+signal code
+.It Vt union sigval Ta Va si_value Ta
+signal value
+.It Vt pid_t Ta Va si_pid Ta
+sending process ID
+.It Vt uid_t Ta Va si_uid Ta
+sending process's real user ID
+.It Vt void Ta Va *si_addr Ta
+address of faulting instruction
+.It Vt int Ta Va si_status Ta
+exit value or signal
+.It Vt long Ta Va si_band Ta
+band event for
+.Dv SIGPOLL
+.It Vt int Ta Va si_trapno Ta
+machine trap code
+.It Vt int Ta Va si_timerid Ta
+.Tn POSIX
+timer ID
+.It Vt int Ta Va si_overrun Ta
+.Tn POSIX
+timer overrun count
+.It Vt int Ta Va si_mqd Ta
+.Tn POSIX
+message queue ID
+.El
+.Pp
+The
+.Va si_signo
+member contains the signal number.
+.Pp
+The
+.Va si_errno
+member contains an error number defined in the file
+.In errno.h .
+.Pp
+The
+.Va si_code
+member contains a code which describes the cause of the signal.
+The macros specified in the
+.Sy Code
+column of the following table are defined
+for use as values of
+.Va si_code
+that are signal-specific or non-signal-specific reasons why the signal was
+generated:
+.Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED"
+.It Sy "Signal Code Reason"
+.It Dv SIGILL Ta Dv ILL_ILLOPC Ta
+illegal opcode
+.It Ta Dv ILL_ILLOPN Ta
+illegal operand
+.It Ta Dv ILL_ILLADR Ta
+illegal addressing mode
+.It Ta Dv ILL_ILLTRP Ta
+illegal trap
+.It Ta Dv ILL_PRVOPC Ta
+illegal privileged opcode
+.It Ta Dv ILL_PRVREG Ta
+illegal privileged register
+.It Ta Dv ILL_COPROC Ta
+coprocessor error
+.It Ta Dv ILL_BADSTK Ta
+internal stack error
+.It Dv SIGFPE Ta Dv FPE_INTDIV Ta
+integer divide by zero
+.It Ta Dv FPE_INTOVF Ta
+integer overflow
+.It Ta Dv FPE_FLTDIV Ta
+floating-point divide by zero
+.It Ta Dv FPE_FLTOVF Ta
+floating-point overflow
+.It Ta Dv FPE_FLTUND Ta
+floating-point underflow
+.It Ta Dv FPE_FLTRES Ta
+floating-point inexact result
+.It Ta Dv FPE_FLTINV Ta
+invalid floating-point operation
+.It Ta Dv FPE_FLTSUB Ta
+subscript out of range
+.It Dv SIGSEGV Ta Dv SEGV_MAPERR Ta
+address not mapped to object
+.It Ta Dv SEGV_ACCERR Ta
+invalid permissions for mapped object
+.It Dv SIGBUS Ta Dv BUS_ADRALN Ta
+invalid address alignment
+.It Ta Dv BUS_ADRERR Ta
+nonexistent physical address
+.It Ta Dv BUS_OBJERR Ta
+object-specific hardware error
+.It Dv SIGTRAP Ta Dv TRAP_BRKPT Ta
+process breakpoint
+.It Ta Dv TRAP_TRACE Ta
+process trace trap
+.It Dv SIGCHLD Ta Dv CLD_EXITED Ta
+child has exited
+.It Ta Dv CLD_KILLED Ta
+child has terminated abnormally and did not create a core file
+.It Ta Dv CLD_DUMPED Ta
+child has terminated abnormally and created a core file
+.It Ta Dv CLD_TRAPPED Ta
+traced child has trapped
+.It Ta Dv CLD_STOPPED Ta
+child has stopped
+.It Ta Dv CLD_CONTINUED Ta
+stopped child has continued
+.It Dv SIGPOLL Ta Dv POLL_IN Ta
+data input available
+.It Ta Dv POLL_OUT Ta
+output buffers available
+.It Ta Dv POLL_MSG Ta
+input message available
+.It Ta Dv POLL_ERR Ta
+I/O error
+.It Ta Dv POLL_PRI Ta
+high priority input available
+.It Ta Dv POLL_HUP Ta
+device disconnected
+.It Any Ta Dv SI_NOINFO Ta
+Only the
+.Va si_signo
+member is meaningful; the value of all other members is unspecified.
+.It Ta Dv SI_USER Ta
+signal sent by
+.Xr kill 2
+.It Ta Dv SI_QUEUE Ta
+signal sent by
+.Xr sigqueue 2
+.It Ta Dv SI_TIMER Ta
+signal generated by expiration of a timer set by
+.Xr timer_settime 2
+.It Ta Dv SI_ASYNCIO Ta
+signal generated by completion of an asynchronous I/O request
+.It Ta Dv SI_MESGQ Ta
+signal generated by arrival of a message on an empty message queue
+.El
+.Pp
+In addition, the following signal-specific information is available:
+.Bl -column ".Dv SIGPOLL" ".Dv CLD_CONTINUED"
+.It Sy "Signal Member Value"
+.It Dv SIGILL Ta Va si_addr Ta
+address of faulting instruction
+.It Ta Va si_trapno Ta
+machine dependent of trap code
+.It Dv SIGFPE Ta Va si_addr Ta
+address of faulting instruction
+.It Ta Va si_trapno Ta
+machine dependent of trap code
+.It Dv SIGSEGV Ta Va si_addr Ta
+address of faulting memory reference
+.It Ta Va si_trapno Ta
+machine dependent of trap code
+.It Dv SIGBUS Ta Va si_addr Ta
+address of faulting instruction
+.It Ta Va si_trapno Ta
+machine dependent of trap code
+.It Dv SIGCHLD Ta Va si_pid Ta
+child process ID
+.It Ta Va si_status Ta
+exit value or signal; if
+.Va si_code
+is equal to
+.Dv CLD_EXITED ,
+then it is equal to the exit value of the child process, otherwise,
+it is equal to a signal that caused the child process to change state.
+.It Ta Va si_uid Ta "real user ID of the process that sent the signal"
+.It Dv SIGPOLL Ta Va si_band Ta "band event for"
+.Dv POLL_IN , POLL_OUT ,
+or
+.Dv POLL_MSG
+.El
+.Pp
+Finally, the following code-specific information is available:
+.Bl -column ".Dv SI_QUEUE" ".Va si_overrun"
+.It Sy "Code Member Value"
+.It Dv SI_QUEUE Ta Va si_value Ta
+the value passed to
+.Xr sigqueue 2
+system call
+.It Ta Va si_pid Ta
+the process ID that sent the signal
+.It Ta Va si_uid Ta
+real user ID of the process that sent the signal
+.It Dv SI_TIMER Ta Va si_value Ta
+the value passed to
+.Xr timer_create 2
+system call
+.It Ta Va si_timerid Ta
+the timer ID returned by
+.Xr timer_create 2
+system call
+.It Ta Va si_overrun Ta
+timer overrun count corresponding to the signal
+.It Ta Va si_errno Ta
+If timer overrun will be
+.Brq Dv DELAYTIMER_MAX ,
+an error code defined in
+.In errno.h
+is set
+.It Dv SI_ASYNCIO Ta Va si_value Ta
+the value passed to aio system calls
+.It Dv SI_MESGQ Ta Va si_value Ta
+the value passed to
+.Xr mq_notify 2
+system call
+.It Ta Va si_mqd Ta
+the ID of the message queue which generated the signal
+.El
+.Sh NOTES
+Currently, the kernel never generates the
+.Dv SIGPOLL
+signal.
+.Dv SIGCHLD
+signal is queued when a process changed its status or exited.
+.Tn POSIX
+Realtime Extensions like aio, timer, and message queue also queue
+signals.
+For some hardware architectures, the exact value of
+.Va si_addr
+might not be available.
+.Sh SEE ALSO
+.Xr aio_read 2 ,
+.Xr kill 2 ,
+.Xr mq_notify 2 ,
+.Xr sigaction 2 ,
+.Xr sigqueue 2 ,
+.Xr sigwaitinfo 2 ,
+.Xr timer_create 2 ,
+.Xr timer_settime 2 ,
+.Xr waitpid 2
+.Sh STANDARDS
+The
+.Vt siginfo_t
+type conforms to
+.St -p1003.1-2004 .
+.Sh HISTORY
+Full support for
+.Tn POSIX
+signal information first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was written by
+.An "David Xu" Aq davidxu@FreeBSD.org .
diff --git a/share/man/man3/stdarg.3 b/share/man/man3/stdarg.3
new file mode 100644
index 000000000000..92a26f7c6d48
--- /dev/null
+++ b/share/man/man3/stdarg.3
@@ -0,0 +1,232 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the American National Standards Committee X3, on Information
+.\" Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)stdarg.3 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd October 25, 2002
+.Dt STDARG 3
+.Os
+.Sh NAME
+.Nm stdarg
+.Nd variable argument lists
+.Sh SYNOPSIS
+.In stdarg.h
+.Ft void
+.Fn va_start "va_list ap" last
+.Ft type
+.Fn va_arg "va_list ap" type
+.Ft void
+.Fn va_copy "va_list dest" "va_list src"
+.Ft void
+.Fn va_end "va_list ap"
+.Sh DESCRIPTION
+A function may be called with a varying number of arguments of varying
+types.
+The include file
+.In stdarg.h
+declares a type
+.Pq Em va_list
+and defines three macros for stepping
+through a list of arguments whose number and types are not known to
+the called function.
+.Pp
+The called function must declare an object of type
+.Em va_list
+which is used by the macros
+.Fn va_start ,
+.Fn va_arg ,
+.Fn va_copy ,
+and
+.Fn va_end .
+.Pp
+The
+.Fn va_start
+macro initializes
+.Fa ap
+for subsequent use by
+.Fn va_arg
+and
+.Fn va_end ,
+and must be called first.
+.Pp
+The parameter
+.Fa last
+is the name of the last parameter before the variable argument list,
+i.e., the last parameter of which the calling function knows the type.
+.Pp
+Because the address of this parameter is used in the
+.Fn va_start
+macro, it should not be declared as a register variable, or as a
+function or an array type.
+.Pp
+The
+.Fn va_start
+macro returns no value.
+.Pp
+The
+.Fn va_arg
+macro expands to an expression that has the type and value of the next
+argument in the call.
+The parameter
+.Fa ap
+is the
+.Em va_list Fa ap
+initialized by
+.Fn va_start .
+Each call to
+.Fn va_arg
+modifies
+.Fa ap
+so that the next call returns the next argument.
+The parameter
+.Fa type
+is a type name specified so that the type of a pointer to an
+object that has the specified type can be obtained simply by
+adding a *
+to
+.Fa type .
+.Pp
+If there is no next argument, or if
+.Fa type
+is not compatible with the type of the actual next argument
+(as promoted according to the default argument promotions),
+random errors will occur.
+.Pp
+The first use of the
+.Fn va_arg
+macro after that of the
+.Fn va_start
+macro returns the argument after
+.Fa last .
+Successive invocations return the values of the remaining
+arguments.
+.Pp
+The
+.Fn va_copy
+macro copies a variable argument list, previously initialized by
+.Fn va_start ,
+from
+.Fa src
+to
+.Fa dest .
+The state is preserved such that it is equivalent to calling
+.Fn va_start
+with the same second argument used with
+.Fa src ,
+and calling
+.Fn va_arg
+the same number of times as called with
+.Fa src .
+.Pp
+The
+.Fn va_copy
+macro returns no value.
+.Pp
+The
+.Fn va_end
+macro handles a normal return from the function whose variable argument
+list was initialized by
+.Fn va_start .
+.Pp
+The
+.Fn va_end
+macro returns no value.
+.Sh EXAMPLES
+The function
+.Em foo
+takes a string of format characters and prints out the argument
+associated with each format character based on the type.
+.Bd -literal -offset indent
+void foo(char *fmt, ...)
+{
+ va_list ap;
+ int d;
+ char c, *s;
+
+ va_start(ap, fmt);
+ while (*fmt)
+ switch(*fmt++) {
+ case 's': /* string */
+ s = va_arg(ap, char *);
+ printf("string %s\en", s);
+ break;
+ case 'd': /* int */
+ d = va_arg(ap, int);
+ printf("int %d\en", d);
+ break;
+ case 'c': /* char */
+ /* Note: char is promoted to int. */
+ c = va_arg(ap, int);
+ printf("char %c\en", c);
+ break;
+ }
+ va_end(ap);
+}
+.Ed
+.Sh COMPATIBILITY
+These macros are
+.Em not
+compatible with the historic macros they replace.
+A backward compatible version can be found in the include
+file
+.In varargs.h .
+.Sh STANDARDS
+The
+.Fn va_start ,
+.Fn va_arg ,
+.Fn va_copy ,
+and
+.Fn va_end
+macros conform to
+.St -isoC-99 .
+.Sh BUGS
+Unlike the
+.Em varargs
+macros, the
+.Nm
+macros do not permit programmers to
+code a function with no fixed arguments.
+This problem generates work mainly when converting
+.Em varargs
+code to
+.Nm
+code,
+but it also creates difficulties for variadic functions that
+wish to pass all of their arguments on to a function
+that takes a
+.Em va_list
+argument, such as
+.Xr vfprintf 3 .
diff --git a/share/man/man3/sysexits.3 b/share/man/man3/sysexits.3
new file mode 100644
index 000000000000..2ef3407b3255
--- /dev/null
+++ b/share/man/man3/sysexits.3
@@ -0,0 +1,144 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.\" "
+.Dd March 31, 1996
+.Dt SYSEXITS 3
+.Os
+.Sh NAME
+.Nm sysexits
+.Nd preferable exit codes for programs
+.Sh SYNOPSIS
+.In sysexits.h
+.Sh DESCRIPTION
+According to
+.Xr style 9 ,
+it is not a good practice to call
+.Xr exit 3
+with arbitrary values to indicate a failure condition when ending
+a program.
+Instead, the pre-defined exit codes from
+.Nm
+should be used, so the caller of the process can get a rough
+estimation about the failure class without looking up the source code.
+.Pp
+The successful exit is always indicated by a status of 0, or
+.Sy EX_OK .
+Error numbers begin at
+.Sy EX__BASE
+to reduce the possibility of clashing with other exit statuses that
+random programs may already return.
+The meaning of the codes is
+approximately as follows:
+.Bl -tag -width "EX_UNAVAILABLEXX(XX)"
+.It Sy EX_USAGE Pq 64
+The command was used incorrectly, e.g., with the wrong number of
+arguments, a bad flag, a bad syntax in a parameter, or whatever.
+.It Sy EX_DATAERR Pq 65
+The input data was incorrect in some way.
+This should only be used
+for user's data and not system files.
+.It Sy EX_NOINPUT Pq 66
+An input file (not a system file) did not exist or was not readable.
+This could also include errors like
+.Dq \&No message
+to a mailer (if it cared to catch it).
+.It Sy EX_NOUSER Pq 67
+The user specified did not exist.
+This might be used for mail
+addresses or remote logins.
+.It Sy EX_NOHOST Pq 68
+The host specified did not exist.
+This is used in mail addresses or
+network requests.
+.It Sy EX_UNAVAILABLE Pq 69
+A service is unavailable.
+This can occur if a support program or file
+does not exist.
+This can also be used as a catchall message when
+something you wanted to do does not work, but you do not know why.
+.It Sy EX_SOFTWARE Pq 70
+An internal software error has been detected.
+This should be limited
+to non-operating system related errors as possible.
+.It Sy EX_OSERR Pq 71
+An operating system error has been detected.
+This is intended to be
+used for such things as
+.Dq cannot fork ,
+.Dq cannot create pipe ,
+or the like.
+It includes things like getuid returning a user that
+does not exist in the passwd file.
+.It Sy EX_OSFILE Pq 72
+Some system file (e.g.,
+.Pa /etc/passwd ,
+.Pa /var/run/utx.active ,
+etc.) does not exist, cannot be opened, or has some sort of error
+(e.g., syntax error).
+.It Sy EX_CANTCREAT Pq 73
+A (user specified) output file cannot be created.
+.It Sy EX_IOERR Pq 74
+An error occurred while doing I/O on some file.
+.It Sy EX_TEMPFAIL Pq 75
+Temporary failure, indicating something that is not really an error.
+In sendmail, this means that a mailer (e.g.) could not create a
+connection, and the request should be reattempted later.
+.It Sy EX_PROTOCOL Pq 76
+The remote system returned something that was
+.Dq not possible
+during a protocol exchange.
+.It Sy EX_NOPERM Pq 77
+You did not have sufficient permission to perform the operation.
+This
+is not intended for file system problems, which should use
+.Sy EX_NOINPUT
+or
+.Sy EX_CANTCREAT ,
+but rather for higher level permissions.
+.It Sy EX_CONFIG Pq 78
+Something was found in an unconfigured or misconfigured state.
+.El
+.Pp
+The numerical values corresponding to the symbolical ones are given in
+parenthesis for easy reference.
+.Sh SEE ALSO
+.Xr err 3 ,
+.Xr exit 3 ,
+.Xr style 9
+.Sh HISTORY
+The
+.Nm
+file appeared somewhere after
+.Bx 4.3 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch
+after the comments in
+.In sysexits.h .
+.Sh BUGS
+The choice of an appropriate exit value is often ambiguous.
diff --git a/share/man/man3/tgmath.3 b/share/man/man3/tgmath.3
new file mode 100644
index 000000000000..0feb13ce81af
--- /dev/null
+++ b/share/man/man3/tgmath.3
@@ -0,0 +1,162 @@
+.\" Copyright (c) 2004 Stefan Farfeleder
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 4, 2012
+.Dt TGMATH 3
+.Os
+.Sh NAME
+.Nm tgmath
+.Nd "type-generic macros"
+.Sh SYNOPSIS
+.In tgmath.h
+.Sh DESCRIPTION
+The header
+.In tgmath.h
+provides type-generic macros
+for
+.In math.h
+and
+.In complex.h
+functions that have
+.Vt float
+(suffixed with
+.Sy f ) ,
+.Vt double
+and
+.Vt "long double"
+(suffixed with
+.Sy l )
+versions.
+The arguments that vary across the three functions and have type
+.Vt float , double
+and
+.Vt "long double" ,
+respectively, are called
+.Em "generic arguments" .
+.Pp
+The following rules describe which function is actually called if a
+type-generic macro is invoked.
+If any generic argument has type
+.Vt "long double"
+or
+.Vt "long double complex" ,
+the
+.Vt "long double"
+function is called.
+Else, if any generic argument has type
+.Vt double , "double complex"
+or an integer type, the
+.Vt double
+version is invoked.
+Otherwise, the macro expands to the
+.Vt float
+implementation.
+.Pp
+For the macros in the following table, both real and complex functions
+exist.
+The real functions are prototyped in
+.In math.h
+and the complex equivalents in
+.In complex.h .
+The complex function is called if any of the generic arguments is a
+complex value.
+Otherwise, the real equivalent is called.
+.Bl -column -offset indent ".Fn acosh" "Sy real function" ".Sy complex function"
+.It Sy Macro Ta Sy real function Ta Sy complex function
+.It Fn acos Ta Fn acos Ta Fn cacos
+.It Fn asin Ta Fn asin Ta Fn casin
+.It Fn atan Ta Fn atan Ta Fn catan
+.It Fn acosh Ta Fn acosh Ta Fn cacosh
+.It Fn asinh Ta Fn asinh Ta Fn casinh
+.It Fn atanh Ta Fn atanh Ta Fn catanh
+.It Fn cos Ta Fn cos Ta Fn ccos
+.It Fn sin Ta Fn sin Ta Fn csin
+.It Fn tan Ta Fn tan Ta Fn ctan
+.It Fn cosh Ta Fn cosh Ta Fn ccosh
+.It Fn sinh Ta Fn sinh Ta Fn csinh
+.It Fn tanh Ta Fn tanh Ta Fn ctanh
+.It Fn exp Ta Fn exp Ta Fn cexp
+.It Fn log Ta Fn log Ta Fn clog
+.It Fn pow Ta Fn pow Ta Fn cpow
+.It Fn sqrt Ta Fn sqrt Ta Fn csqrt
+.It Fn fabs Ta Fn fabs Ta Fn cabs
+.El
+.Pp
+No complex functions exist for the following macros, so passing a
+complex value to a generic argument invokes undefined behaviour:
+.Bl -column -offset indent ".Fn nexttoward" ".Fn nexttoward" ".Fn nexttoward" ".Fn nexttoward"
+.It Fn atan2 Ta Fn fma Ta Fn llround Ta Fn remainder
+.It Fn cbrt Ta Fn fmax Ta Fn log10 Ta Fn remquo
+.It Fn ceil Ta Fn fmin Ta Fn log1p Ta Fn rint
+.It Fn copysign Ta Fn fmod Ta Fn log2 Ta Fn round
+.It Fn erf Ta Fn frexp Ta Fn logb Ta Fn scalbn
+.It Fn erfc Ta Fn hypot Ta Fn lrint Ta Fn scalbln
+.It Fn exp2 Ta Fn ilogb Ta Fn lround Ta Fn tgamma
+.It Fn expm1 Ta Fn ldexp Ta Fn nextbyint Ta Fn trunc
+.It Fn fdim Ta Fn lgamma Ta Fn nextafter Ta \&
+.It Fn floor Ta Fn llrint Ta Fn nexttoward Ta \&
+.El
+.Pp
+The following macros always expand to a complex function:
+.Bl -column -offset indent ".Fn cimag" ".Fn cimag" ".Fn cimag" ".Fn cimag" ".Fn cimag"
+.It Fn carg Ta Fn cimag Ta Fn conj Ta Fn cproj Ta Fn creal
+.El
+.Pp
+This header includes
+.In complex.h
+and
+.In math.h .
+.Sh STANDARDS
+The header
+.In tgmath.h
+conforms to
+.St -isoC-99 .
+.Sh HISTORY
+The header
+.In tgmath.h
+first appeared in
+.Fx 5.3 .
+.Sh COMPILER SUPPORT
+Before
+.St -isoC-2011 ,
+the header
+.In tgmath.h
+could not be implemented with strictly conforming C code and needed
+special compiler support.
+As of
+.St -isoC-2011 ,
+this header file can be implemented using the
+.Fn _Generic
+language keyword.
+In addition to compilers that support this keyword, this header file
+works with GCC.
+.Sh BUGS
+Many of the functions mentioned here are not prototyped in
+.In math.h
+or
+.In complex.h
+as they are not yet implemented.
+This prevents the corresponding type-generic macro from working at all.
diff --git a/share/man/man3/timeradd.3 b/share/man/man3/timeradd.3
new file mode 100644
index 000000000000..7b6293f0dbfb
--- /dev/null
+++ b/share/man/man3/timeradd.3
@@ -0,0 +1,119 @@
+.\" Copyright (c) 1999 Kelly Yancey <kbyanc@posi.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 11, 1999
+.Dt TIMERADD 3
+.Os
+.Sh NAME
+.Nm timeradd ,
+.Nm timersub ,
+.Nm timerclear ,
+.Nm timerisset ,
+.Nm timercmp
+.Nd operations on timevals
+.Sh SYNOPSIS
+.In sys/time.h
+.Ft void
+.Fn timeradd "struct timeval *a" "struct timeval *b" "struct timeval *res"
+.Ft void
+.Fn timersub "struct timeval *a" "struct timeval *b" "struct timeval *res"
+.Ft void
+.Fn timerclear "struct timeval *tvp"
+.Ft int
+.Fn timerisset "struct timeval *tvp"
+.Ft int
+.Fn timercmp "struct timeval *a" "struct timeval *b" CMP
+.Sh DESCRIPTION
+These macros are provided for manipulating
+.Fa timeval
+structures for use with the
+.Xr gettimeofday 2
+and
+.Xr settimeofday 2
+calls.
+The structure is defined in
+.In sys/time.h
+as:
+.Bd -literal
+struct timeval {
+ long tv_sec; /* seconds since Jan. 1, 1970 */
+ long tv_usec; /* and microseconds */
+};
+.Ed
+.Pp
+.Fn timeradd
+adds the time information stored in
+.Fa a
+to
+.Fa b
+and stores the resulting
+.Vt timeval
+in
+.Fa res .
+The results are simplified such that the value of
+.Fa res->tv_usec
+is always less than 1,000,000 (1 second).
+.Pp
+.Fn timersub
+subtracts the time information stored in
+.Fa b
+from
+.Fa a
+and stores the resulting
+.Vt timeval
+in
+.Fa res .
+.Pp
+.Fn timerclear
+initializes
+.Fa tvp
+to midnight (0 hour) January 1st, 1970 (the Epoch).
+.Pp
+.Fn timerisset
+returns true if
+.Fa tvp
+is set to any time value other than the Epoch.
+.Pp
+.Fn timercmp
+compares
+.Fa a
+to
+.Fa b
+using the comparison operator given in
+.Fa CMP ,
+and returns the result of that comparison.
+.Sh SEE ALSO
+.Xr gettimeofday 2
+.Sh HISTORY
+The
+.Fn timeradd
+family of macros were imported from
+.Nx 1.1 ,
+and appeared in
+.Fx 2.2.6 .
diff --git a/share/man/man3/tree.3 b/share/man/man3/tree.3
new file mode 100644
index 000000000000..351e935418cb
--- /dev/null
+++ b/share/man/man3/tree.3
@@ -0,0 +1,504 @@
+.\" $OpenBSD: tree.3,v 1.7 2002/06/12 01:09:20 provos Exp $
+.\"
+.\" Copyright 2002 Niels Provos <provos@citi.umich.edu>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Niels Provos.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 27, 2007
+.Dt TREE 3
+.Os
+.Sh NAME
+.Nm SPLAY_PROTOTYPE ,
+.Nm SPLAY_GENERATE ,
+.Nm SPLAY_ENTRY ,
+.Nm SPLAY_HEAD ,
+.Nm SPLAY_INITIALIZER ,
+.Nm SPLAY_ROOT ,
+.Nm SPLAY_EMPTY ,
+.Nm SPLAY_NEXT ,
+.Nm SPLAY_MIN ,
+.Nm SPLAY_MAX ,
+.Nm SPLAY_FIND ,
+.Nm SPLAY_LEFT ,
+.Nm SPLAY_RIGHT ,
+.Nm SPLAY_FOREACH ,
+.Nm SPLAY_INIT ,
+.Nm SPLAY_INSERT ,
+.Nm SPLAY_REMOVE ,
+.Nm RB_PROTOTYPE ,
+.Nm RB_PROTOTYPE_STATIC ,
+.Nm RB_GENERATE ,
+.Nm RB_GENERATE_STATIC ,
+.Nm RB_ENTRY ,
+.Nm RB_HEAD ,
+.Nm RB_INITIALIZER ,
+.Nm RB_ROOT ,
+.Nm RB_EMPTY ,
+.Nm RB_NEXT ,
+.Nm RB_PREV ,
+.Nm RB_MIN ,
+.Nm RB_MAX ,
+.Nm RB_FIND ,
+.Nm RB_NFIND ,
+.Nm RB_LEFT ,
+.Nm RB_RIGHT ,
+.Nm RB_PARENT ,
+.Nm RB_FOREACH ,
+.Nm RB_FOREACH_REVERSE ,
+.Nm RB_INIT ,
+.Nm RB_INSERT ,
+.Nm RB_REMOVE
+.Nd "implementations of splay and red-black trees"
+.Sh SYNOPSIS
+.In sys/tree.h
+.Fn SPLAY_PROTOTYPE NAME TYPE FIELD CMP
+.Fn SPLAY_GENERATE NAME TYPE FIELD CMP
+.Fn SPLAY_ENTRY TYPE
+.Fn SPLAY_HEAD HEADNAME TYPE
+.Ft "struct TYPE *"
+.Fn SPLAY_INITIALIZER "SPLAY_HEAD *head"
+.Fn SPLAY_ROOT "SPLAY_HEAD *head"
+.Ft bool
+.Fn SPLAY_EMPTY "SPLAY_HEAD *head"
+.Ft "struct TYPE *"
+.Fn SPLAY_NEXT NAME "SPLAY_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn SPLAY_MIN NAME "SPLAY_HEAD *head"
+.Ft "struct TYPE *"
+.Fn SPLAY_MAX NAME "SPLAY_HEAD *head"
+.Ft "struct TYPE *"
+.Fn SPLAY_FIND NAME "SPLAY_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn SPLAY_LEFT "struct TYPE *elm" "SPLAY_ENTRY NAME"
+.Ft "struct TYPE *"
+.Fn SPLAY_RIGHT "struct TYPE *elm" "SPLAY_ENTRY NAME"
+.Fn SPLAY_FOREACH VARNAME NAME "SPLAY_HEAD *head"
+.Ft void
+.Fn SPLAY_INIT "SPLAY_HEAD *head"
+.Ft "struct TYPE *"
+.Fn SPLAY_INSERT NAME "SPLAY_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn SPLAY_REMOVE NAME "SPLAY_HEAD *head" "struct TYPE *elm"
+.Fn RB_PROTOTYPE NAME TYPE FIELD CMP
+.Fn RB_PROTOTYPE_STATIC NAME TYPE FIELD CMP
+.Fn RB_GENERATE NAME TYPE FIELD CMP
+.Fn RB_GENERATE_STATIC NAME TYPE FIELD CMP
+.Fn RB_ENTRY TYPE
+.Fn RB_HEAD HEADNAME TYPE
+.Fn RB_INITIALIZER "RB_HEAD *head"
+.Ft "struct TYPE *"
+.Fn RB_ROOT "RB_HEAD *head"
+.Ft "bool"
+.Fn RB_EMPTY "RB_HEAD *head"
+.Ft "struct TYPE *"
+.Fn RB_NEXT NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn RB_PREV NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn RB_MIN NAME "RB_HEAD *head"
+.Ft "struct TYPE *"
+.Fn RB_MAX NAME "RB_HEAD *head"
+.Ft "struct TYPE *"
+.Fn RB_FIND NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn RB_NFIND NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn RB_LEFT "struct TYPE *elm" "RB_ENTRY NAME"
+.Ft "struct TYPE *"
+.Fn RB_RIGHT "struct TYPE *elm" "RB_ENTRY NAME"
+.Ft "struct TYPE *"
+.Fn RB_PARENT "struct TYPE *elm" "RB_ENTRY NAME"
+.Fn RB_FOREACH VARNAME NAME "RB_HEAD *head"
+.Fn RB_FOREACH_REVERSE VARNAME NAME "RB_HEAD *head"
+.Ft void
+.Fn RB_INIT "RB_HEAD *head"
+.Ft "struct TYPE *"
+.Fn RB_INSERT NAME "RB_HEAD *head" "struct TYPE *elm"
+.Ft "struct TYPE *"
+.Fn RB_REMOVE NAME "RB_HEAD *head" "struct TYPE *elm"
+.Sh DESCRIPTION
+These macros define data structures for different types of trees:
+splay trees and red-black trees.
+.Pp
+In the macro definitions,
+.Fa TYPE
+is the name tag of a user defined structure that must contain a field of type
+.Vt SPLAY_ENTRY ,
+or
+.Vt RB_ENTRY ,
+named
+.Fa ENTRYNAME .
+The argument
+.Fa HEADNAME
+is the name tag of a user defined structure that must be declared
+using the macros
+.Fn SPLAY_HEAD ,
+or
+.Fn RB_HEAD .
+The argument
+.Fa NAME
+has to be a unique name prefix for every tree that is defined.
+.Pp
+The function prototypes are declared with
+.Fn SPLAY_PROTOTYPE ,
+.Fn RB_PROTOTYPE ,
+or
+.Fn RB_PROTOTYPE_STATIC .
+The function bodies are generated with
+.Fn SPLAY_GENERATE ,
+.Fn RB_GENERATE ,
+or
+.Fn RB_GENERATE_STATIC .
+See the examples below for further explanation of how these macros are used.
+.Sh SPLAY TREES
+A splay tree is a self-organizing data structure.
+Every operation on the tree causes a splay to happen.
+The splay moves the requested
+node to the root of the tree and partly rebalances it.
+.Pp
+This has the benefit that request locality causes faster lookups as
+the requested nodes move to the top of the tree.
+On the other hand, every lookup causes memory writes.
+.Pp
+The Balance Theorem bounds the total access time for
+.Ar m
+operations and
+.Ar n
+inserts on an initially empty tree as
+.Fn O "\*[lp]m + n\*[rp]lg n" .
+The
+amortized cost for a sequence of
+.Ar m
+accesses to a splay tree is
+.Fn O "lg n" .
+.Pp
+A splay tree is headed by a structure defined by the
+.Fn SPLAY_HEAD
+macro.
+A
+structure is declared as follows:
+.Bd -ragged -offset indent
+.Fn SPLAY_HEAD HEADNAME TYPE
+.Va head ;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and struct
+.Fa TYPE
+is the type of the elements to be inserted into the tree.
+.Pp
+The
+.Fn SPLAY_ENTRY
+macro declares a structure that allows elements to be connected in the tree.
+.Pp
+In order to use the functions that manipulate the tree structure,
+their prototypes need to be declared with the
+.Fn SPLAY_PROTOTYPE
+macro,
+where
+.Fa NAME
+is a unique identifier for this particular tree.
+The
+.Fa TYPE
+argument is the type of the structure that is being managed
+by the tree.
+The
+.Fa FIELD
+argument is the name of the element defined by
+.Fn SPLAY_ENTRY .
+.Pp
+The function bodies are generated with the
+.Fn SPLAY_GENERATE
+macro.
+It takes the same arguments as the
+.Fn SPLAY_PROTOTYPE
+macro, but should be used only once.
+.Pp
+Finally,
+the
+.Fa CMP
+argument is the name of a function used to compare tree nodes
+with each other.
+The function takes two arguments of type
+.Vt "struct TYPE *" .
+If the first argument is smaller than the second, the function returns a
+value smaller than zero.
+If they are equal, the function returns zero.
+Otherwise, it should return a value greater than zero.
+The compare
+function defines the order of the tree elements.
+.Pp
+The
+.Fn SPLAY_INIT
+macro initializes the tree referenced by
+.Fa head .
+.Pp
+The splay tree can also be initialized statically by using the
+.Fn SPLAY_INITIALIZER
+macro like this:
+.Bd -ragged -offset indent
+.Fn SPLAY_HEAD HEADNAME TYPE
+.Va head
+=
+.Fn SPLAY_INITIALIZER &head ;
+.Ed
+.Pp
+The
+.Fn SPLAY_INSERT
+macro inserts the new element
+.Fa elm
+into the tree.
+.Pp
+The
+.Fn SPLAY_REMOVE
+macro removes the element
+.Fa elm
+from the tree pointed by
+.Fa head .
+.Pp
+The
+.Fn SPLAY_FIND
+macro can be used to find a particular element in the tree.
+.Bd -literal -offset indent
+struct TYPE find, *res;
+find.key = 30;
+res = SPLAY_FIND(NAME, head, &find);
+.Ed
+.Pp
+The
+.Fn SPLAY_ROOT ,
+.Fn SPLAY_MIN ,
+.Fn SPLAY_MAX ,
+and
+.Fn SPLAY_NEXT
+macros can be used to traverse the tree:
+.Bd -literal -offset indent
+for (np = SPLAY_MIN(NAME, &head); np != NULL; np = SPLAY_NEXT(NAME, &head, np))
+.Ed
+.Pp
+Or, for simplicity, one can use the
+.Fn SPLAY_FOREACH
+macro:
+.Bd -ragged -offset indent
+.Fn SPLAY_FOREACH np NAME head
+.Ed
+.Pp
+The
+.Fn SPLAY_EMPTY
+macro should be used to check whether a splay tree is empty.
+.Sh RED-BLACK TREES
+A red-black tree is a binary search tree with the node color as an
+extra attribute.
+It fulfills a set of conditions:
+.Bl -enum -offset indent
+.It
+Every search path from the root to a leaf consists of the same number of
+black nodes.
+.It
+Each red node (except for the root) has a black parent.
+.It
+Each leaf node is black.
+.El
+.Pp
+Every operation on a red-black tree is bounded as
+.Fn O "lg n" .
+The maximum height of a red-black tree is
+.Fn 2lg "n + 1" .
+.Pp
+A red-black tree is headed by a structure defined by the
+.Fn RB_HEAD
+macro.
+A
+structure is declared as follows:
+.Bd -ragged -offset indent
+.Fn RB_HEAD HEADNAME TYPE
+.Va head ;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and struct
+.Fa TYPE
+is the type of the elements to be inserted into the tree.
+.Pp
+The
+.Fn RB_ENTRY
+macro declares a structure that allows elements to be connected in the tree.
+.Pp
+In order to use the functions that manipulate the tree structure,
+their prototypes need to be declared with the
+.Fn RB_PROTOTYPE
+or
+.Fn RB_PROTOTYPE_STATIC
+macro,
+where
+.Fa NAME
+is a unique identifier for this particular tree.
+The
+.Fa TYPE
+argument is the type of the structure that is being managed
+by the tree.
+The
+.Fa FIELD
+argument is the name of the element defined by
+.Fn RB_ENTRY .
+.Pp
+The function bodies are generated with the
+.Fn RB_GENERATE
+or
+.Fn RB_GENERATE_STATIC
+macro.
+These macros take the same arguments as the
+.Fn RB_PROTOTYPE
+and
+.Fn RB_PROTOTYPE_STATIC
+macros, but should be used only once.
+.Pp
+Finally,
+the
+.Fa CMP
+argument is the name of a function used to compare tree nodes
+with each other.
+The function takes two arguments of type
+.Vt "struct TYPE *" .
+If the first argument is smaller than the second, the function returns a
+value smaller than zero.
+If they are equal, the function returns zero.
+Otherwise, it should return a value greater than zero.
+The compare
+function defines the order of the tree elements.
+.Pp
+The
+.Fn RB_INIT
+macro initializes the tree referenced by
+.Fa head .
+.Pp
+The red-black tree can also be initialized statically by using the
+.Fn RB_INITIALIZER
+macro like this:
+.Bd -ragged -offset indent
+.Fn RB_HEAD HEADNAME TYPE
+.Va head
+=
+.Fn RB_INITIALIZER &head ;
+.Ed
+.Pp
+The
+.Fn RB_INSERT
+macro inserts the new element
+.Fa elm
+into the tree.
+.Pp
+The
+.Fn RB_REMOVE
+macro removes the element
+.Fa elm
+from the tree pointed by
+.Fa head .
+.Pp
+The
+.Fn RB_FIND
+and
+.Fn RB_NFIND
+macros can be used to find a particular element in the tree.
+.Bd -literal -offset indent
+struct TYPE find, *res;
+find.key = 30;
+res = RB_FIND(NAME, head, &find);
+.Ed
+.Pp
+The
+.Fn RB_ROOT ,
+.Fn RB_MIN ,
+.Fn RB_MAX ,
+.Fn RB_NEXT ,
+and
+.Fn RB_PREV
+macros can be used to traverse the tree:
+.Pp
+.Dl "for (np = RB_MIN(NAME, &head); np != NULL; np = RB_NEXT(NAME, &head, np))"
+.Pp
+Or, for simplicity, one can use the
+.Fn RB_FOREACH
+or
+.Fn RB_FOREACH_REVERSE
+macro:
+.Bd -ragged -offset indent
+.Fn RB_FOREACH np NAME head
+.Ed
+.Pp
+The
+.Fn RB_EMPTY
+macro should be used to check whether a red-black tree is empty.
+.Sh NOTES
+Trying to free a tree in the following way is a common error:
+.Bd -literal -offset indent
+SPLAY_FOREACH(var, NAME, head) {
+ SPLAY_REMOVE(NAME, head, var);
+ free(var);
+}
+free(head);
+.Ed
+.Pp
+Since
+.Va var
+is freed, the
+.Fn FOREACH
+macro refers to a pointer that may have been reallocated already.
+Proper code needs a second variable.
+.Bd -literal -offset indent
+for (var = SPLAY_MIN(NAME, head); var != NULL; var = nxt) {
+ nxt = SPLAY_NEXT(NAME, head, var);
+ SPLAY_REMOVE(NAME, head, var);
+ free(var);
+}
+.Ed
+.Pp
+Both
+.Fn RB_INSERT
+and
+.Fn SPLAY_INSERT
+return
+.Dv NULL
+if the element was inserted in the tree successfully, otherwise they
+return a pointer to the element with the colliding key.
+.Pp
+Accordingly,
+.Fn RB_REMOVE
+and
+.Fn SPLAY_REMOVE
+return the pointer to the removed element otherwise they return
+.Dv NULL
+to indicate an error.
+.Sh SEE ALSO
+.Xr queue 3
+.Sh AUTHORS
+The author of the tree macros is
+.An Niels Provos .
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
new file mode 100644
index 000000000000..dffe304045f2
--- /dev/null
+++ b/share/man/man4/Makefile
@@ -0,0 +1,759 @@
+# @(#)Makefile 8.1 (Berkeley) 6/18/93
+# $FreeBSD$
+
+MAN= aac.4 \
+ acpi.4 \
+ ${_acpi_asus.4} \
+ ${_acpi_dock.4} \
+ ${_acpi_fujitsu.4} \
+ ${_acpi_hp.4} \
+ ${_acpi_ibm.4} \
+ ${_acpi_panasonic.4} \
+ ${_acpi_sony.4} \
+ acpi_thermal.4 \
+ ${_acpi_toshiba.4} \
+ acpi_video.4 \
+ ${_acpi_wmi.4} \
+ ada.4 \
+ adv.4 \
+ adw.4 \
+ ae.4 \
+ ${_aesni.4} \
+ age.4 \
+ agp.4 \
+ aha.4 \
+ ahb.4 \
+ ahc.4 \
+ ahci.4 \
+ ahd.4 \
+ ${_aibs.4} \
+ aio.4 \
+ alc.4 \
+ ale.4 \
+ alpm.4 \
+ altq.4 \
+ amdpm.4 \
+ ${_amdsbwd.4} \
+ ${_amdsmb.4} \
+ ${_amdtemp.4} \
+ amr.4 \
+ an.4 \
+ ${_apic.4} \
+ arcmsr.4 \
+ ${_asmc.4} \
+ asr.4 \
+ ata.4 \
+ atapicam.4 \
+ ataraid.4 \
+ ath.4 \
+ ath_ahb.4 \
+ ath_hal.4 \
+ ath_pci.4 \
+ atkbd.4 \
+ atkbdc.4 \
+ ${_atp.4} \
+ ${_atrtc.4} \
+ ${_attimer.4} \
+ audit.4 \
+ auditpipe.4 \
+ aue.4 \
+ axe.4 \
+ bce.4 \
+ bfe.4 \
+ bge.4 \
+ bktr.4 \
+ blackhole.4 \
+ bpf.4 \
+ bridge.4 \
+ bt.4 \
+ bwi.4 \
+ bwn.4 \
+ capsicum.4 \
+ cardbus.4 \
+ carp.4 \
+ cas.4 \
+ cc_chd.4 \
+ cc_cubic.4 \
+ cc_hd.4 \
+ cc_htcp.4 \
+ cc_newreno.4 \
+ cc_vegas.4 \
+ ccd.4 \
+ cd.4 \
+ cdce.4 \
+ ch.4 \
+ ciss.4 \
+ cm.4 \
+ cmx.4 \
+ coda.4 \
+ ${_coretemp.4} \
+ ${_cpuctl.4} \
+ cpufreq.4 \
+ crypto.4 \
+ cue.4 \
+ cxgb.4 \
+ cxgbe.4 \
+ cy.4 \
+ da.4 \
+ dc.4 \
+ dcons.4 \
+ dcons_crom.4 \
+ ddb.4 \
+ de.4 \
+ devctl.4 \
+ digi.4 \
+ disc.4 \
+ divert.4 \
+ ${_dpms.4} \
+ dpt.4 \
+ dummynet.4 \
+ ed.4 \
+ edsc.4 \
+ ef.4 \
+ ehci.4 \
+ em.4 \
+ en.4 \
+ enc.4 \
+ epair.4 \
+ esp.4 \
+ et.4 \
+ eventtimers.4 \
+ exca.4 \
+ faith.4 \
+ fatm.4 \
+ fd.4 \
+ fdc.4 \
+ fdt.4 \
+ fdtbus.4 \
+ ffclock.4 \
+ firewire.4 \
+ fpa.4 \
+ fwe.4 \
+ fwip.4 \
+ fwohci.4 \
+ fxp.4 \
+ gbde.4 \
+ gdb.4 \
+ gem.4 \
+ geom.4 \
+ geom_fox.4 \
+ geom_linux_lvm.4 \
+ geom_map.4 \
+ geom_uzip.4 \
+ gif.4 \
+ gpib.4 \
+ gre.4 \
+ h_ertt.4 \
+ harp.4 \
+ hatm.4 \
+ hfa.4 \
+ hifn.4 \
+ hme.4 \
+ hpet.4 \
+ ${_hpt27xx.4} \
+ ${_hptiop.4} \
+ ${_hptmv.4} \
+ ${_hptrr.4} \
+ hwpmc.4 \
+ ichsmb.4 \
+ ${_ichwd.4} \
+ icmp.4 \
+ icmp6.4 \
+ ida.4 \
+ idt.4 \
+ ifmib.4 \
+ igb.4 \
+ igmp.4 \
+ iic.4 \
+ iicbb.4 \
+ iicbus.4 \
+ iicsmb.4 \
+ iir.4 \
+ inet.4 \
+ inet6.4 \
+ intpm.4 \
+ intro.4 \
+ ${_io.4} \
+ ip.4 \
+ ip6.4 \
+ ipfirewall.4 \
+ ${_ipmi.4} \
+ ips.4 \
+ ipsec.4 \
+ ipw.4 \
+ ipwfw.4 \
+ isci.4 \
+ iscsi_initiator.4 \
+ isp.4 \
+ ispfw.4 \
+ iwi.4 \
+ iwifw.4 \
+ iwn.4 \
+ iwnfw.4 \
+ ixgb.4 \
+ ixgbe.4 \
+ jme.4 \
+ joy.4 \
+ kbdmux.4 \
+ keyboard.4 \
+ kld.4 \
+ ksyms.4 \
+ ktr.4 \
+ kue.4 \
+ lagg.4 \
+ le.4 \
+ led.4 \
+ lge.4 \
+ ${_lindev.4} \
+ ${_linux.4} \
+ lmc.4 \
+ lo.4 \
+ lp.4 \
+ lpbb.4 \
+ lpt.4 \
+ mac.4 \
+ mac_biba.4 \
+ mac_bsdextended.4 \
+ mac_ifoff.4 \
+ mac_lomac.4 \
+ mac_mls.4 \
+ mac_none.4 \
+ mac_partition.4 \
+ mac_portacl.4 \
+ mac_seeotheruids.4 \
+ mac_stub.4 \
+ mac_test.4 \
+ malo.4 \
+ mcd.4 \
+ md.4 \
+ mem.4 \
+ meteor.4 \
+ mfi.4 \
+ miibus.4 \
+ mk48txx.4 \
+ mld.4 \
+ mlx.4 \
+ mly.4 \
+ mmc.4 \
+ mmcsd.4 \
+ mn.4 \
+ mod_cc.4 \
+ mos.4 \
+ mouse.4 \
+ mps.4 \
+ mpt.4 \
+ msk.4 \
+ mtio.4 \
+ multicast.4 \
+ mvs.4 \
+ mwl.4 \
+ mwlfw.4 \
+ mxge.4 \
+ my.4 \
+ natm.4 \
+ natmip.4 \
+ ncr.4 \
+ ncv.4 \
+ ${_ndis.4} \
+ net80211.4 \
+ netgraph.4 \
+ netintro.4 \
+ netmap.4 \
+ ${_nfe.4} \
+ ${_nfsmb.4} \
+ ng_async.4 \
+ ng_atm.4 \
+ ngatmbase.4 \
+ ng_atmllc.4 \
+ ng_bluetooth.4 \
+ ng_bpf.4 \
+ ng_bridge.4 \
+ ng_bt3c.4 \
+ ng_btsocket.4 \
+ ng_car.4 \
+ ng_ccatm.4 \
+ ng_cisco.4 \
+ ng_deflate.4 \
+ ng_device.4 \
+ nge.4 \
+ ng_echo.4 \
+ ng_eiface.4 \
+ ng_etf.4 \
+ ng_ether.4 \
+ ng_ether_echo.4 \
+ ng_fec.4 \
+ ng_frame_relay.4 \
+ ng_gif.4 \
+ ng_gif_demux.4 \
+ ng_h4.4 \
+ ng_hci.4 \
+ ng_hole.4 \
+ ng_hub.4 \
+ ng_iface.4 \
+ ng_ipfw.4 \
+ ng_ip_input.4 \
+ ng_ksocket.4 \
+ ng_l2cap.4 \
+ ng_l2tp.4 \
+ ng_lmi.4 \
+ ng_mppc.4 \
+ ng_nat.4 \
+ ng_netflow.4 \
+ ng_one2many.4 \
+ ng_patch.4 \
+ ng_ppp.4 \
+ ng_pppoe.4 \
+ ng_pptpgre.4 \
+ ng_pred1.4 \
+ ng_rfc1490.4 \
+ ng_socket.4 \
+ ng_source.4 \
+ ng_split.4 \
+ ng_sppp.4 \
+ ng_sscfu.4 \
+ ng_sscop.4 \
+ ng_tag.4 \
+ ng_tcpmss.4 \
+ ng_tee.4 \
+ ng_tty.4 \
+ ng_ubt.4 \
+ ng_UI.4 \
+ ng_uni.4 \
+ ng_vjc.4 \
+ ng_vlan.4 \
+ nmdm.4 \
+ nsp.4 \
+ null.4 \
+ ${_nve.4} \
+ ${_nvram.4} \
+ ${_nvram2env.4} \
+ ${_nxge.4} \
+ oce.4 \
+ ohci.4 \
+ orm.4 \
+ ${_padlock.4} \
+ pass.4 \
+ patm.4 \
+ pccard.4 \
+ pccbb.4 \
+ pcf.4 \
+ pci.4 \
+ pcib.4 \
+ pcic.4 \
+ pcii.4 \
+ pcm.4 \
+ pcn.4 \
+ pim.4 \
+ polling.4 \
+ ppbus.4 \
+ ppc.4 \
+ ppi.4 \
+ psm.4 \
+ pst.4 \
+ pt.4 \
+ pts.4 \
+ pty.4 \
+ puc.4 \
+ ${_qlxgb.4} \
+ ral.4 \
+ random.4 \
+ rc.4 \
+ re.4 \
+ rgephy.4 \
+ rl.4 \
+ rndtest.4 \
+ route.4 \
+ rp.4 \
+ rue.4 \
+ rum.4 \
+ run.4 \
+ runfw.4 \
+ sa.4 \
+ safe.4 \
+ sbp.4 \
+ sbp_targ.4 \
+ scc.4 \
+ scd.4 \
+ sched_4bsd.4 \
+ sched_ule.4 \
+ screen.4 \
+ scsi.4 \
+ sctp.4 \
+ sdhci.4 \
+ sem.4 \
+ send.4 \
+ ses.4 \
+ sf.4 \
+ ${_sfxge.4} \
+ sge.4 \
+ si.4 \
+ siba.4 \
+ siftr.4 \
+ siis.4 \
+ simplebus.4 \
+ sio.4 \
+ sis.4 \
+ sk.4 \
+ smb.4 \
+ smbus.4 \
+ smp.4 \
+ sn.4 \
+ snd_ad1816.4 \
+ snd_als4000.4 \
+ snd_atiixp.4 \
+ snd_cmi.4 \
+ snd_cs4281.4 \
+ snd_csa.4 \
+ snd_ds1.4 \
+ snd_emu10k1.4 \
+ snd_emu10kx.4 \
+ snd_envy24.4 \
+ snd_envy24ht.4 \
+ snd_es137x.4 \
+ snd_ess.4 \
+ snd_fm801.4 \
+ snd_gusc.4 \
+ snd_hda.4 \
+ snd_hdspe.4 \
+ snd_ich.4 \
+ snd_maestro3.4 \
+ snd_maestro.4 \
+ snd_mss.4 \
+ snd_neomagic.4 \
+ snd_sbc.4 \
+ snd_solo.4 \
+ snd_spicds.4 \
+ snd_t4dwave.4 \
+ snd_uaudio.4 \
+ snd_via8233.4 \
+ snd_via82c686.4 \
+ snd_vibes.4 \
+ snp.4 \
+ spic.4 \
+ ${_spkr.4} \
+ splash.4 \
+ sppp.4 \
+ ste.4 \
+ stf.4 \
+ stg.4 \
+ stge.4 \
+ sym.4 \
+ syncache.4 \
+ syncer.4 \
+ syscons.4 \
+ sysmouse.4 \
+ tap.4 \
+ targ.4 \
+ tcp.4 \
+ tdfx.4 \
+ termios.4 \
+ textdump.4 \
+ ti.4 \
+ timecounters.4 \
+ tl.4 \
+ tnt4882.4 \
+ ${_tpm.4} \
+ trm.4 \
+ tty.4 \
+ tun.4 \
+ twa.4 \
+ twe.4 \
+ tws.4 \
+ tx.4 \
+ txp.4 \
+ u3g.4 \
+ uark.4 \
+ uart.4 \
+ uath.4 \
+ ubsa.4 \
+ ubsec.4 \
+ ubser.4 \
+ ubtbcmfw.4 \
+ uchcom.4 \
+ ucom.4 \
+ ucycom.4 \
+ udav.4 \
+ udbp.4 \
+ udp.4 \
+ uep.4 \
+ ufm.4 \
+ ufoma.4 \
+ uftdi.4 \
+ ugen.4 \
+ uhci.4 \
+ uhid.4 \
+ uhso.4 \
+ uipaq.4 \
+ ukbd.4 \
+ ulpt.4 \
+ umass.4 \
+ umcs.4 \
+ umct.4 \
+ umodem.4 \
+ ums.4 \
+ unix.4 \
+ upgt.4 \
+ uplcom.4 \
+ ural.4 \
+ urio.4 \
+ ${_urtw.4} \
+ usb.4 \
+ usb_quirk.4 \
+ uslcom.4 \
+ utopia.4 \
+ uvisor.4 \
+ uvscom.4 \
+ vga.4 \
+ vge.4 \
+ viapm.4 \
+ ${_viawd.4} \
+ vinum.4 \
+ ${_virtio.4} \
+ ${_virtio_balloon.4} \
+ ${_virtio_blk.4} \
+ vkbd.4 \
+ vlan.4 \
+ vpo.4 \
+ vr.4 \
+ vte.4 \
+ ${_vtnet.4} \
+ ${_vxge.4} \
+ watchdog.4 \
+ wb.4 \
+ wi.4 \
+ witness.4 \
+ wlan.4 \
+ wlan_acl.4 \
+ wlan_amrr.4 \
+ wlan_ccmp.4 \
+ wlan_tkip.4 \
+ wlan_wep.4 \
+ wlan_xauth.4 \
+ ${_wpi.4} \
+ xe.4 \
+ ${_xen.4} \
+ xhci.4 \
+ xl.4 \
+ ${_xnb.4} \
+ xpt.4 \
+ zero.4 \
+ zyd.4
+
+MLINKS= ae.4 if_ae.4
+MLINKS+=age.4 if_age.4
+MLINKS+=agp.4 agpgart.4
+MLINKS+=ale.4 if_ale.4
+MLINKS+=altq.4 ALTQ.4
+MLINKS+=an.4 if_an.4
+MLINKS+=aue.4 if_aue.4
+MLINKS+=axe.4 if_axe.4
+MLINKS+=bce.4 if_bce.4
+MLINKS+=bfe.4 if_bfe.4
+MLINKS+=bge.4 if_bge.4
+MLINKS+=bktr.4 brooktree.4
+MLINKS+=bridge.4 if_bridge.4
+MLINKS+=bwi.4 if_bwi.4
+MLINKS+=cas.4 if_cas.4
+MLINKS+=crypto.4 cryptodev.4
+MLINKS+=cue.4 if_cue.4
+MLINKS+=dc.4 if_dc.4
+MLINKS+=de.4 if_de.4
+MLINKS+=disc.4 if_disc.4
+MLINKS+=ed.4 if_ed.4
+MLINKS+=edsc.4 if_edsc.4
+MLINKS+=ef.4 if_ef.4
+MLINKS+=em.4 if_em.4
+MLINKS+=en.4 if_en.4
+MLINKS+=enc.4 if_enc.4
+MLINKS+=epair.4 if_epair.4
+MLINKS+=et.4 if_et.4
+MLINKS+=faith.4 if_faith.4
+MLINKS+=fatm.4 if_fatm.4
+MLINKS+=fd.4 stderr.4 \
+ fd.4 stdin.4 \
+ fd.4 stdout.4
+MLINKS+=fdt.4 FDT.4
+MLINKS+=firewire.4 ieee1394.4
+MLINKS+=fpa.4 fea.4
+MLINKS+=fwe.4 if_fwe.4
+MLINKS+=fwip.4 if_fwip.4
+MLINKS+=fxp.4 if_fxp.4
+MLINKS+=gem.4 if_gem.4
+MLINKS+=geom.4 GEOM.4
+MLINKS+=gif.4 if_gif.4
+MLINKS+=gre.4 if_gre.4
+MLINKS+=hatm.4 if_hatm.4
+MLINKS+=hme.4 if_hme.4
+MLINKS+=hpet.4 acpi_hpet.4
+MLINKS+=${_hptrr.4} ${_rr232x.4}
+MLINKS+=${_attimer.4} ${_i8254.4}
+MLINKS+=idt.4 if_idt.4
+MLINKS+=igb.4 if_igb.4
+MLINKS+=ip.4 rawip.4
+MLINKS+=ipfirewall.4 ipaccounting.4 \
+ ipfirewall.4 ipacct.4 \
+ ipfirewall.4 ipfw.4
+MLINKS+=ipw.4 if_ipw.4
+MLINKS+=iwi.4 if_iwi.4
+MLINKS+=iwn.4 if_iwn.4
+MLINKS+=ixgb.4 if_ixgb.4
+MLINKS+=ixgbe.4 if_ixgbe.4
+MLINKS+=jme.4 if_jme.4
+MLINKS+=kue.4 if_kue.4
+MLINKS+=lagg.4 trunk.4
+MLINKS+=le.4 if_le.4
+MLINKS+=lge.4 if_lge.4
+MLINKS+=lo.4 loop.4
+MLINKS+=lp.4 plip.4
+MLINKS+=malo.4 if_malo.4
+MLINKS+=md.4 vn.4
+MLINKS+=mem.4 kmem.4
+MLINKS+=mn.4 if_mn.4
+MLINKS+=mxge.4 if_mxge.4
+MLINKS+=my.4 if_my.4
+MLINKS+=${_ndis.4} ${_if_ndis.4}
+MLINKS+=netintro.4 net.4 \
+ netintro.4 networking.4
+MLINKS+=${_nfe.4} ${_if_nfe.4}
+MLINKS+=nge.4 if_nge.4
+MLINKS+=${_nve.4} ${_if_nve.4}
+MLINKS+=${_nxge.4} ${_if_nxge.4}
+MLINKS+=patm.4 if_patm.4
+MLINKS+=pccbb.4 cbb.4
+MLINKS+=pcm.4 snd.4 \
+ pcm.4 sound.4
+MLINKS+=pcn.4 if_pcn.4
+MLINKS+=ral.4 if_ral.4
+MLINKS+=re.4 if_re.4
+MLINKS+=rl.4 if_rl.4
+MLINKS+=rue.4 if_rue.4
+MLINKS+=rum.4 if_rum.4
+MLINKS+=scsi.4 CAM.4 \
+ scsi.4 cam.4 \
+ scsi.4 scbus.4 \
+ scsi.4 SCSI.4
+MLINKS+=sf.4 if_sf.4
+MLINKS+=sis.4 if_sis.4
+MLINKS+=sk.4 if_sk.4
+MLINKS+=smp.4 SMP.4
+MLINKS+=sn.4 if_sn.4
+MLINKS+=snd_envy24.4 snd_ak452x.4
+MLINKS+=snd_sbc.4 snd_sb16.4 \
+ snd_sbc.4 snd_sb8.4
+MLINKS+=${_spkr.4} ${_speaker.4}
+MLINKS+=splash.4 screensaver.4
+MLINKS+=ste.4 if_ste.4
+MLINKS+=stf.4 if_stf.4
+MLINKS+=stge.4 if_stge.4
+MLINKS+=syncache.4 syncookies.4
+MLINKS+=syscons.4 sc.4
+MLINKS+=tap.4 if_tap.4
+MLINKS+=tdfx.4 tdfx_linux.4
+MLINKS+=ti.4 if_ti.4
+MLINKS+=tl.4 if_tl.4
+MLINKS+=tun.4 if_tun.4
+MLINKS+=tx.4 if_tx.4
+MLINKS+=txp.4 if_txp.4
+MLINKS+=u3g.4 u3gstub.4
+MLINKS+=uath.4 if_uath.4
+MLINKS+=udav.4 if_udav.4
+MLINKS+=upgt.4 if_upgt.4
+MLINKS+=ural.4 if_ural.4
+MLINKS+=${_urtw.4} ${_if_urtw.4}
+MLINKS+=vge.4 if_vge.4
+MLINKS+=vlan.4 if_vlan.4
+MLINKS+=vpo.4 imm.4
+MLINKS+=vr.4 if_vr.4
+MLINKS+=${_vtnet.4} ${_if_vtnet.4}
+MLINKS+=${_vxge.4} ${_if_vxge.4}
+MLINKS+=watchdog.4 SW_WATCHDOG.4
+MLINKS+=wb.4 if_wb.4
+MLINKS+=wi.4 if_wi.4
+MLINKS+=${_wpi.4} ${_if_wpi.4}
+MLINKS+=xe.4 if_xe.4
+MLINKS+=xl.4 if_xl.4
+MLINKS+=zyd.4 if_zyd.4
+
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+_acpi_asus.4= acpi_asus.4
+_acpi_dock.4= acpi_dock.4
+_acpi_fujitsu.4=acpi_fujitsu.4
+_acpi_hp.4= acpi_hp.4
+_acpi_ibm.4= acpi_ibm.4
+_acpi_panasonic.4=acpi_panasonic.4
+_acpi_sony.4= acpi_sony.4
+_acpi_toshiba.4=acpi_toshiba.4
+_acpi_wmi.4= acpi_wmi.4
+_aesni.4= aesni.4
+_apic.4= apic.4
+_atrtc.4= atrtc.4
+_attimer.4= attimer.4
+_aibs.4= aibs.4
+_amdsbwd.4= amdsbwd.4
+_amdsmb.4= amdsmb.4
+_amdtemp.4= amdtemp.4
+_asmc.4= asmc.4
+_atp.4= atp.4
+_coretemp.4= coretemp.4
+_cpuctl.4= cpuctl.4
+_dpms.4= dpms.4
+_hpt27xx.4= hpt27xx.4
+_hptiop.4= hptiop.4
+_hptmv.4= hptmv.4
+_hptrr.4= hptrr.4
+_i8254.4= i8254.4
+_ichwd.4= ichwd.4
+_if_ndis.4= if_ndis.4
+_if_nfe.4= if_nfe.4
+_if_nve.4= if_nve.4
+_if_nxge.4= if_nxge.4
+_if_urtw.4= if_urtw.4
+_if_vtnet.4= if_vtnet.4
+_if_vxge.4= if_vxge.4
+_if_wpi.4= if_wpi.4
+_ipmi.4= ipmi.4
+_io.4= io.4
+_lindev.4= lindev.4
+_linux.4= linux.4
+_ndis.4= ndis.4
+_nfe.4= nfe.4
+_nfsmb.4= nfsmb.4
+_nve.4= nve.4
+_nvram.4= nvram.4
+_nxge.4= nxge.4
+_virtio.4= virtio.4
+_virtio_balloon.4=virtio_balloon.4
+_virtio_blk.4= virtio_blk.4
+_vtnet.4= vtnet.4
+_vxge.4= vxge.4
+_padlock.4= padlock.4
+_rr232x.4= rr232x.4
+_speaker.4= speaker.4
+_spkr.4= spkr.4
+_tpm.4= tpm.4
+_urtw.4= urtw.4
+_viawd.4= viawd.4
+_wpi.4= wpi.4
+_xen.4= xen.4
+_xnb.4= xnb.4
+
+MLINKS+=lindev.4 full.4
+.endif
+
+.if ${MACHINE_CPUARCH} == "amd64"
+_qlxgb.4= qlxgb.4
+_sfxge.4= sfxge.4
+.endif
+
+.if ${MACHINE_CPUARCH} == "powerpc"
+_atp.4= atp.4
+.endif
+.if ${MACHINE_CPUARCH} == "mips"
+_nvram2env.4= nvram2env.4
+.endif
+
+.if exists(${.CURDIR}/man4.${MACHINE_CPUARCH})
+SUBDIR= man4.${MACHINE_CPUARCH}
+.endif
+
+.include <bsd.prog.mk>
diff --git a/share/man/man4/aac.4 b/share/man/man4/aac.4
new file mode 100644
index 000000000000..d0f370163b8c
--- /dev/null
+++ b/share/man/man4/aac.4
@@ -0,0 +1,302 @@
+.\" Copyright (c) 2000 Scott Long
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd July 10, 2009
+.Dt AAC 4
+.Os
+.Sh NAME
+.Nm aac
+.Nd Adaptec AdvancedRAID Controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device pci
+.Cd device aac
+.Cd device aacp
+.Pp
+To compile in debugging code:
+.Cd options AAC_DEBUG=N
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+aac_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Adaptec AAC family of SCSI Ultra2, Ultra160,
+and Ultra320, SATA and SAS RAID controllers.
+.Pp
+Access to RAID containers is available via the
+.Pa /dev/aacd?
+device nodes.
+The
+.Nm aacp
+device enables the SCSI pass-thru interface and allows devices connected
+to the card such as CD-ROMs to be available via the CAM
+.Xr scsi 4
+subsystem.
+Note that not all cards allow this interface to be enabled.
+.Pp
+The
+.Pa /dev/aac?
+device nodes provide access to the management interface of the controller.
+One node exists per installed card.
+The aliases
+.Pa /dev/afa?
+and
+.Pa /dev/hpn?
+exist for compatibility with the Dell and HP versions of management tools,
+respectively.
+If the kernel is compiled with the
+.Dv COMPAT_LINUX
+option, or the
+.Pa aac_linux.ko
+and
+.Pa linux.ko
+modules are loaded, the
+Linux-compatible
+.Xr ioctl 2
+interface for the management device will be enabled and will allow
+Linux-based management applications to control the card.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AAC-364
+.It
+Adaptec RAID 2045
+.It
+Adaptec RAID 2405
+.It
+Adaptec RAID 2445
+.It
+Adaptec RAID 2805
+.It
+Adaptec RAID 3085
+.It
+Adaptec RAID 31205
+.It
+Adaptec RAID 31605
+.It
+Adaptec RAID 5085
+.It
+Adaptec RAID 51205
+.It
+Adaptec RAID 51245
+.It
+Adaptec RAID 51605
+.It
+Adaptec RAID 51645
+.It
+Adaptec RAID 52445
+.It
+Adaptec RAID 5405
+.It
+Adaptec RAID 5445
+.It
+Adaptec RAID 5805
+.It
+Adaptec SAS RAID 3405
+.It
+Adaptec SAS RAID 3805
+.It
+Adaptec SAS RAID 4000SAS
+.It
+Adaptec SAS RAID 4005SAS
+.It
+Adaptec SAS RAID 4800SAS
+.It
+Adaptec SAS RAID 4805SAS
+.It
+Adaptec SATA RAID 2020SA ZCR
+.It
+Adaptec SATA RAID 2025SA ZCR
+.It
+Adaptec SATA RAID 2026ZCR
+.It
+Adaptec SATA RAID 2410SA
+.It
+Adaptec SATA RAID 2420SA
+.It
+Adaptec SATA RAID 2610SA
+.It
+Adaptec SATA RAID 2620SA
+.It
+Adaptec SATA RAID 2810SA
+.It
+Adaptec SATA RAID 2820SA
+.It
+Adaptec SATA RAID 21610SA
+.It
+Adaptec SCSI RAID 2020ZCR
+.It
+Adaptec SCSI RAID 2025ZCR
+.It
+Adaptec SCSI RAID 2120S
+.It
+Adaptec SCSI RAID 2130S
+.It
+Adaptec SCSI RAID 2130SLP
+.It
+Adaptec SCSI RAID 2230SLP
+.It
+Adaptec SCSI RAID 2200S
+.It
+Adaptec SCSI RAID 2240S
+.It
+Adaptec SCSI RAID 3230S
+.It
+Adaptec SCSI RAID 3240S
+.It
+Adaptec SCSI RAID 5400S
+.It
+Dell CERC SATA RAID 2
+.It
+Dell PERC 2/Si
+.It
+Dell PERC 2/QC
+.It
+Dell PERC 3/Si
+.It
+Dell PERC 3/Di
+.It
+Dell PERC 320/DC
+.It
+HP ML110 G2 (Adaptec SATA RAID 2610SA)
+.It
+HP NetRAID 4M
+.It
+IBM ServeRAID 8i
+.It
+IBM ServeRAID 8k
+.It
+IBM ServeRAID 8s
+.It
+ICP RAID ICP5045BL
+.It
+ICP RAID ICP5085BL
+.It
+ICP RAID ICP5085SL
+.It
+ICP RAID ICP5125BR
+.It
+ICP RAID ICP5125SL
+.It
+ICP RAID ICP5165BR
+.It
+ICP RAID ICP5165SL
+.It
+ICP RAID ICP5445SL
+.It
+ICP RAID ICP5805BL
+.It
+ICP RAID ICP5805SL
+.It
+ICP ICP5085BR SAS RAID
+.It
+ICP ICP9085LI SAS RAID
+.It
+ICP ICP9047MA SATA RAID
+.It
+ICP ICP9067MA SATA RAID
+.It
+ICP ICP9087MA SATA RAID
+.It
+ICP ICP9014RO SCSI RAID
+.It
+ICP ICP9024RO SCSI RAID
+.It
+Legend S220
+.It
+Legend S230
+.It
+Sun STK RAID REM
+.It
+Sun STK RAID EM
+.It
+SG-XPCIESAS-R-IN
+.It
+SG-XPCIESAS-R-EX
+.It
+AOC-USAS-S4i
+.It
+AOC-USAS-S8i
+.It
+AOC-USAS-S4iR
+.It
+AOC-USAS-S8iR
+.It
+AOC-USAS-S8i-LP
+.It
+AOC-USAS-S8iR-LP
+.El
+.Sh FILES
+.Bl -tag -width /boot/kernel/aac.ko -compact
+.It Pa /dev/aac?
+aac management interface
+.It Pa /dev/aacd?
+disk/container interface
+.El
+.Sh DIAGNOSTICS
+Compiling with
+.Dv AAC_DEBUG
+set to a number between 0 and 3
+will enable increasingly verbose debug messages.
+.Pp
+The adapter can send status and alert messages asynchronously
+to the driver.
+These messages are printed on the system console,
+and are also queued for retrieval by a management application.
+.Sh SEE ALSO
+.Xr kld 4 ,
+.Xr linux 4 ,
+.Xr scsi 4 ,
+.Xr kldload 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.3 .
+.Sh AUTHORS
+.An Mike Smith
+.Aq msmith@FreeBSD.org
+.An Scott Long
+.Aq scottl@FreeBSD.org
+.Sh BUGS
+This driver is not compatible with Dell controllers that have version 1.x
+firmware.
+The firmware version is the same as the kernel version printed in the BIOS
+POST and driver attach messages.
+.Pp
+The controller is not actually paused on suspend/resume.
diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4
new file mode 100644
index 000000000000..faedb066465f
--- /dev/null
+++ b/share/man/man4/acpi.4
@@ -0,0 +1,635 @@
+.\"
+.\" Copyright (c) 2001 Michael Smith
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 22, 2012
+.Dt ACPI 4
+.Os
+.Sh NAME
+.Nm acpi
+.Nd Advanced Configuration and Power Management support
+.Sh SYNOPSIS
+.Cd "device acpi"
+.Pp
+.Cd "options ACPI_DEBUG"
+.Cd "options DDB"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Intel/Microsoft/Compaq/Toshiba ACPI
+standard.
+This support includes platform hardware discovery (superseding the
+PnP and PCI BIOS), as well as power management (superseding APM) and
+other features.
+ACPI core support is provided by the ACPI CA reference implementation
+from Intel.
+.Pp
+Note that the
+.Nm
+driver is automatically loaded by the
+.Xr loader 8 ,
+and should only be
+compiled into the kernel on platforms where ACPI is mandatory.
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver is intended to provide power management without user intervention.
+If the default settings are not optimal, the following sysctls can be
+used to modify or monitor
+.Nm
+behavior.
+.Bl -tag -width indent
+.It Va debug.acpi.enable_debug_objects
+Enable dumping Debug objects without
+.Cd "options ACPI_DEBUG" .
+Default is 0, ignore Debug objects.
+.It Va hw.acpi.acline
+AC line state (1 means online, 0 means on battery power).
+.It Va hw.acpi.cpu.cx_usage
+Debugging information listing the percent of total usage for each sleep state.
+The values are reset when
+.Va hw.acpi.cpu.cx_lowest
+is modified.
+.It Va hw.acpi.cpu.cx_lowest
+Lowest Cx state to use for idling the CPU.
+A scheduling algorithm will select states between
+.Li C1
+and this setting
+as system load dictates.
+To enable ACPI CPU idling control,
+.Va machdep.cpu_idle_hlt
+must be set to 1.
+.It Va hw.acpi.cpu.cx_supported
+List of supported CPU idle states and their transition latency
+in microseconds.
+Each state has a type (e.g.,
+.Li C2 ) .
+.Li C1
+is equivalent to the ia32
+.Li HLT
+instruction,
+.Li C2
+provides a deeper
+sleep with the same semantics, and
+.Li C3
+provides the deepest sleep
+but additionally requires bus mastering to be disabled.
+States greater than
+.Li C3
+provide even more power savings with the same
+semantics as the
+.Li C3
+state.
+Deeper sleeps provide more power savings but increased transition
+latency when an interrupt occurs.
+.It Va hw.acpi.disable_on_reboot
+Disable ACPI during the reboot process.
+Most systems reboot fine with ACPI still enabled, but some require
+exiting to legacy mode first.
+Default is 0, leave ACPI enabled.
+.It Va hw.acpi.handle_reboot
+Use the ACPI Reset Register capability to reboot the system.
+Some newer systems require use of this register, while some only work
+with legacy rebooting support.
+.It Va hw.acpi.lid_switch_state
+Suspend state
+.Pq Li S1 Ns \[en] Ns Li S5
+to enter when the lid switch (i.e., a notebook screen) is closed.
+Default is
+.Dq Li NONE
+(do nothing).
+.It Va hw.acpi.power_button_state
+Suspend state
+.Pq Li S1 Ns \[en] Ns Li S5
+to enter when the power button is pressed.
+Default is
+.Li S5
+(power-off nicely).
+.It Va hw.acpi.reset_video
+Reset the video adapter from real mode during the resume path.
+Some systems need this help, others have display problems if it is enabled.
+Default is 0 (disabled).
+.It Va hw.acpi.s4bios
+Indicate whether the system supports
+.Li S4BIOS .
+This means that the BIOS can handle all the functions of suspending the
+system to disk.
+Otherwise, the OS is responsible for suspending to disk
+.Pq Li S4OS .
+Most current systems do not support
+.Li S4BIOS .
+.It Va hw.acpi.sleep_button_state
+Suspend state
+.Pq Li S1 Ns \[en] Ns Li S5
+to enter when the sleep button is pressed.
+This is usually a special function button on the keyboard.
+Default is
+.Li S3
+(suspend-to-RAM).
+.It Va hw.acpi.sleep_delay
+Wait this number of seconds between preparing the system to suspend and
+actually entering the suspend state.
+Default is 1 second.
+.It Va hw.acpi.supported_sleep_state
+Suspend states
+.Pq Li S1 Ns \[en] Ns Li S5
+supported by the BIOS.
+.Bl -tag -width indent
+.It Li S1
+Quick suspend to RAM.
+The CPU enters a lower power state, but most peripherals are left running.
+.It Li S2
+Lower power state than
+.Li S1 ,
+but with the same basic characteristics.
+Not supported by many systems.
+.It Li S3
+Suspend to RAM.
+Most devices are powered off, and the system stops running except for
+memory refresh.
+.It Li S4
+Suspend to disk.
+All devices are powered off, and the system stops running.
+When resuming, the system starts as if from a cold power on.
+Not yet supported by
+.Fx
+unless
+.Li S4BIOS
+is available.
+.It Li S5
+System shuts down cleanly and powers off.
+.El
+.It Va hw.acpi.verbose
+Enable verbose printing from the various ACPI subsystems.
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Pa /boot/loader.conf .
+Many of these tunables also have a matching
+.Xr sysctl 8
+entry for access after boot.
+.Bl -tag -width indent
+.It Va acpi_dsdt_load
+Enables loading of a custom ACPI DSDT.
+.It Va acpi_dsdt_name
+Name of the DSDT table to load, if loading is enabled.
+.It Va debug.acpi.disabled
+Selectively disables portions of ACPI for debugging purposes.
+.It Va debug.acpi.interpreter_slack
+Enable less strict ACPI implementations.
+Default is 1, ignore common BIOS mistakes.
+.It Va debug.acpi.max_threads
+Specify the number of task threads that are started on boot.
+Limiting this to 1 may help work around various BIOSes that cannot
+handle parallel requests.
+The default value is 3.
+.It Va debug.acpi.quirks
+Override any automatic quirks completely.
+.It Va debug.acpi.resume_beep
+Beep the PC speaker on resume.
+This can help diagnose suspend/resume problems.
+Default is 0 (disabled).
+.It Va debug.acpi.sleep_flags
+Execute optional ACPI methods for suspend/resume.
+If the bit 0 is set (1), it will try to execute _GTS (Going To Sleep) method
+when entering suspend state.
+If the bit 1 is set (2), it will try to execute _BFS (Back From Sleep) method
+when leaving suspend state.
+If both the bits are set (3), both the methods will be tried.
+Default is 0 (disabled).
+.It Va hint.acpi.0.disabled
+Set this to 1 to disable all of ACPI.
+If ACPI has been disabled on your system due to a blacklist entry for your
+BIOS, you can set this to 0 to re-enable ACPI for testing.
+.It Va hw.acpi.ec.poll_timeout
+Delay in milliseconds to wait for the EC to respond.
+Try increasing this number if you get the error
+.Qq Li AE_NO_HARDWARE_RESPONSE .
+.It Va hw.acpi.host_mem_start
+Override the assumed memory starting address for PCI host bridges.
+.It Va hw.acpi.install_interface , hw.acpi.remove_interface
+Install or remove OS interface(s) to control return value of
+.Ql _OSI
+query method. When an OS interface is specified in
+.Va hw.acpi.install_interface ,
+.Li _OSI
+query for the interface returns it is
+.Em supported .
+Conversely, when an OS interface is specified in
+.Va hw.acpi.remove_interface ,
+.Li _OSI
+query returns it is
+.Em not supported .
+Multiple interfaces can be specified in a comma-separated list and
+any leading white spaces will be ignored. For example,
+.Qq Li FreeBSD, Linux
+is a valid list of two interfaces
+.Qq Li FreeBSD
+and
+.Qq Li Linux .
+.It Va hw.acpi.reset_video
+Enables calling the VESA reset BIOS vector on the resume path.
+This can fix some graphics cards that have problems such as LCD white-out
+after resume.
+Default is 0 (disabled).
+.It Va hw.acpi.serialize_methods
+Allow override of whether methods execute in parallel or not.
+Enable this for serial behavior, which fixes
+.Qq Li AE_ALREADY_EXISTS
+errors for
+AML that really cannot handle parallel method execution.
+It is off by default since this breaks recursive methods and some IBMs use
+such code.
+.It Va hw.acpi.verbose
+Turn on verbose debugging information about what ACPI is doing.
+.It Va hw.pci.link.%s.%d.irq
+Override the interrupt to use for this link and index.
+This capability should be used carefully, and only if a device is not
+working with
+.Nm
+enabled.
+.Qq %s
+is the name of the link (e.g., LNKA).
+.Qq %d
+is the resource index when the link supports multiple IRQs.
+Most PCI links only have one IRQ resource, so the below form should be used.
+.It Va hw.pci.link.%s.irq
+Override the interrupt to use.
+This capability should be used carefully, and only if a device is not
+working with
+.Nm
+enabled.
+.Qq %s
+is the name of the link (e.g., LNKA).
+.El
+.Sh DISABLING ACPI
+Since ACPI support on different platforms varies greatly, there are many
+debugging and tuning options available.
+.Pp
+For machines known not to work with
+.Nm
+enabled, there is a BIOS blacklist.
+Currently, the blacklist only controls whether
+.Nm
+should be disabled or not.
+In the future, it will have more granularity to control features (the
+infrastructure for that is already there).
+.Pp
+To enable
+.Nm
+(for debugging purposes, etc.) on machines that are on the blacklist, set the
+kernel environment variable
+.Va hint.acpi.0.disabled
+to 0.
+Before trying this, consider updating your BIOS to a more recent version that
+may be compatible with ACPI.
+.Pp
+To disable the
+.Nm
+driver completely, set the kernel environment variable
+.Va hint.acpi.0.disabled
+to 1.
+.Pp
+Some i386 machines totally fail to operate with some or all of ACPI disabled.
+Other i386 machines fail with ACPI enabled.
+Disabling all or part of ACPI on non-i386 platforms (i.e., platforms where
+ACPI support is mandatory) may result in a non-functional system.
+.Pp
+The
+.Nm
+driver comprises a set of drivers, which may be selectively disabled
+in case of problems.
+To disable a sub-driver, list it in the kernel
+environment variable
+.Va debug.acpi.disabled .
+Multiple entries can be listed, separated by a space.
+.Pp
+ACPI sub-devices and features that can be disabled:
+.Bl -tag -width ".Li sysresource"
+.It Li all
+Disable all ACPI features and devices.
+.It Li acad
+.Pq Vt device
+Supports AC adapter.
+.It Li bus
+.Pq Vt feature
+Probes and attaches subdevices.
+Disabling will avoid scanning the ACPI namespace entirely.
+.It Li children
+.Pq Vt feature
+Attaches standard ACPI sub-drivers and devices enumerated in the
+ACPI namespace.
+Disabling this has a similar effect to disabling
+.Dq Li bus ,
+except that the
+ACPI namespace will still be scanned.
+.It Li button
+.Pq Vt device
+Supports ACPI button devices (typically power and sleep buttons).
+.It Li cmbat
+.Pq Vt device
+Control-method batteries device.
+.It Li cpu
+.Pq Vt device
+Supports CPU power-saving and speed-setting functions.
+.It Li ec
+.Pq Vt device
+Supports the ACPI Embedded Controller interface, used to communicate
+with embedded platform controllers.
+.It Li isa
+.Pq Vt device
+Supports an ISA bus bridge defined in the ACPI namespace,
+typically as a child of a PCI bus.
+.It Li lid
+.Pq Vt device
+Supports an ACPI laptop lid switch, which typically puts a
+system to sleep.
+.It Li quirks
+.Pq Vt feature
+Do not honor quirks.
+Quirks automatically disable ACPI functionality based on the XSDT table's
+OEM vendor name and revision date.
+.It Li pci
+.Pq Vt device
+Supports Host to PCI bridges.
+.It Li pci_link
+.Pq Vt feature
+Performs PCI interrupt routing.
+.It Li sysresource
+.Pq Vt device
+Pseudo-devices containing resources which ACPI claims.
+.It Li thermal
+.Pq Vt device
+Supports system cooling and heat management.
+.It Li timer
+.Pq Vt device
+Implements a timecounter using the ACPI fixed-frequency timer.
+.It Li video
+.Pq Vt device
+Supports
+.Xr acpi_video 4
+which may conflict with
+.Xr agp 4
+device.
+.El
+.Pp
+It is also possible to avoid portions of the ACPI namespace which
+may be causing problems, by listing the full path of the root of
+the region to be avoided in the kernel environment variable
+.Va debug.acpi.avoid .
+The object and all of its children will be ignored during the
+bus/children scan of the namespace.
+The ACPI CA code will still know about the avoided region.
+.Sh DEBUGGING OUTPUT
+To enable debugging output,
+.Nm
+must be compiled with
+.Cd "options ACPI_DEBUG" .
+Debugging output is separated between layers and levels, where a layer is
+a component of the ACPI subsystem, and a level is a particular kind
+of debugging output.
+.Pp
+Both layers and levels are specified as a whitespace-separated list of
+tokens, with layers listed in
+.Va debug.acpi.layer
+and levels in
+.Va debug.acpi.level .
+.Pp
+The first set of layers is for ACPI-CA components, and the second is for
+.Fx
+drivers.
+The ACPI-CA layer descriptions include the prefix for the files they
+refer to.
+The supported layers are:
+.Pp
+.Bl -tag -compact -width ".Li ACPI_CA_DISASSEMBLER"
+.It Li ACPI_UTILITIES
+Utility ("ut") functions
+.It Li ACPI_HARDWARE
+Hardware access ("hw")
+.It Li ACPI_EVENTS
+Event and GPE ("ev")
+.It Li ACPI_TABLES
+Table access ("tb")
+.It Li ACPI_NAMESPACE
+Namespace evaluation ("ns")
+.It Li ACPI_PARSER
+AML parser ("ps")
+.It Li ACPI_DISPATCHER
+Internal representation of interpreter state ("ds")
+.It Li ACPI_EXECUTER
+Execute AML methods ("ex")
+.It Li ACPI_RESOURCES
+Resource parsing ("rs")
+.It Li ACPI_CA_DEBUGGER
+Debugger implementation ("db", "dm")
+.It Li ACPI_OS_SERVICES
+Usermode support routines ("os")
+.It Li ACPI_CA_DISASSEMBLER
+Disassembler implementation (unused)
+.It Li ACPI_ALL_COMPONENTS
+All the above ACPI-CA components
+.It Li ACPI_AC_ADAPTER
+AC adapter driver
+.It Li ACPI_BATTERY
+Control-method battery driver
+.It Li ACPI_BUS
+ACPI, ISA, and PCI bus drivers
+.It Li ACPI_BUTTON
+Power and sleep button driver
+.It Li ACPI_EC
+Embedded controller driver
+.It Li ACPI_FAN
+Fan driver
+.It Li ACPI_OEM
+Platform-specific driver for hotkeys, LED, etc.
+.It Li ACPI_POWER
+Power resource driver
+.It Li ACPI_PROCESSOR
+CPU driver
+.It Li ACPI_THERMAL
+Thermal zone driver
+.It Li ACPI_TIMER
+Timer driver
+.It Li ACPI_ALL_DRIVERS
+All the above
+.Fx
+ACPI drivers
+.El
+.Pp
+The supported levels are:
+.Pp
+.Bl -tag -compact -width ".Li ACPI_LV_AML_DISASSEMBLE"
+.It Li ACPI_LV_INIT
+Initialization progress
+.It Li ACPI_LV_DEBUG_OBJECT
+Stores to objects
+.It Li ACPI_LV_INFO
+General information and progress
+.It Li ACPI_LV_REPAIR
+Repair a common problem with predefined methods
+.It Li ACPI_LV_ALL_EXCEPTIONS
+All the previous levels
+.It Li ACPI_LV_PARSE
+.It Li ACPI_LV_DISPATCH
+.It Li ACPI_LV_EXEC
+.It Li ACPI_LV_NAMES
+.It Li ACPI_LV_OPREGION
+.It Li ACPI_LV_BFIELD
+.It Li ACPI_LV_TABLES
+.It Li ACPI_LV_VALUES
+.It Li ACPI_LV_OBJECTS
+.It Li ACPI_LV_RESOURCES
+.It Li ACPI_LV_USER_REQUESTS
+.It Li ACPI_LV_PACKAGE
+.It Li ACPI_LV_VERBOSITY1
+All the previous levels
+.It Li ACPI_LV_ALLOCATIONS
+.It Li ACPI_LV_FUNCTIONS
+.It Li ACPI_LV_OPTIMIZATIONS
+.It Li ACPI_LV_VERBOSITY2
+All the previous levels
+.It Li ACPI_LV_ALL
+Synonym for
+.Qq Li ACPI_LV_VERBOSITY2
+.It Li ACPI_LV_MUTEX
+.It Li ACPI_LV_THREADS
+.It Li ACPI_LV_IO
+.It Li ACPI_LV_INTERRUPTS
+.It Li ACPI_LV_VERBOSITY3
+All the previous levels
+.It Li ACPI_LV_AML_DISASSEMBLE
+.It Li ACPI_LV_VERBOSE_INFO
+.It Li ACPI_LV_FULL_TABLES
+.It Li ACPI_LV_EVENTS
+.It Li ACPI_LV_VERBOSE
+All levels after
+.Qq Li ACPI_LV_VERBOSITY3
+.It Li ACPI_LV_INIT_NAMES
+.It Li ACPI_LV_LOAD
+.El
+.Pp
+Selection of the appropriate layer and level values is important
+to avoid massive amounts of debugging output.
+For example, the following configuration is a good way to gather initial
+information.
+It enables debug output for both ACPI-CA and the
+.Nm
+driver, printing basic information about errors, warnings, and progress.
+.Bd -literal -offset indent
+debug.acpi.layer="ACPI_ALL_COMPONENTS ACPI_ALL_DRIVERS"
+debug.acpi.level="ACPI_LV_ALL_EXCEPTIONS"
+.Ed
+.Pp
+Debugging output by the ACPI CA subsystem is prefixed with the
+module name in lowercase, followed by a source line number.
+Output from the
+.Fx Ns -local
+code follows the same format, but
+the module name is uppercased.
+.Sh OVERRIDING YOUR BIOS BYTECODE
+ACPI interprets bytecode named AML
+(ACPI Machine Language)
+provided by the BIOS vendor as a memory image at boot time.
+Sometimes, the AML code contains a bug that does not appear when parsed
+by the Microsoft implementation.
+.Fx
+provides a way to override it with your own AML code to work around
+or debug such problems.
+Note that all AML in your DSDT and any SSDT tables is overridden.
+.Pp
+In order to load your AML code, you must edit
+.Pa /boot/loader.conf
+and include the following lines.
+.Bd -literal -offset indent
+acpi_dsdt_load="YES"
+acpi_dsdt_name="/boot/acpi_dsdt.aml" # You may change this name.
+.Ed
+.Pp
+In order to prepare your AML code, you will need the
+.Xr acpidump 8
+and
+.Xr iasl 8
+utilities and some ACPI knowledge.
+.Sh COMPATIBILITY
+ACPI is only found and supported on i386/ia32, ia64, and amd64.
+.Sh SEE ALSO
+.Xr kenv 1 ,
+.Xr acpi_thermal 4 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr acpiconf 8 ,
+.Xr acpidump 8 ,
+.Xr config 8 ,
+.Xr iasl 8
+.Rs
+.%A "Compaq Computer Corporation"
+.%A "Intel Corporation"
+.%A "Microsoft Corporation"
+.%A "Phoenix Technologies Ltd."
+.%A "Toshiba Corporation"
+.%D August 25, 2003
+.%T "Advanced Configuration and Power Interface Specification"
+.%U http://acpi.info/spec.htm
+.Re
+.Sh AUTHORS
+.An -nosplit
+The ACPI CA subsystem is developed and maintained by
+Intel Architecture Labs.
+.Pp
+The following people made notable contributions to the ACPI subsystem
+in
+.Fx :
+.An Michael Smith ,
+.An Takanori Watanabe Aq takawata@jp.FreeBSD.org ,
+.An Mitsuru IWASAKI Aq iwasaki@jp.FreeBSD.org ,
+.An Munehiro Matsuda ,
+.An Nate Lawson ,
+the ACPI-jp mailing list at
+.Aq acpi-jp@jp.FreeBSD.org ,
+and many other contributors.
+.Pp
+This manual page was written by
+.An Michael Smith Aq msmith@FreeBSD.org .
+.Sh BUGS
+Many BIOS versions have serious bugs that may cause system instability,
+break suspend/resume, or prevent devices from operating properly due to
+IRQ routing problems.
+Upgrade your BIOS to the latest version available from the vendor before
+deciding it is a problem with
+.Nm .
+.Pp
+The
+.Nm
+CPU idle power management drive conflicts with the local APIC (LAPIC)
+timer.
+Disable the local APIC timer with
+.Va hint.apic.0.clock=0
+or do not use the
+.Li C3
+and deeper states if the local APIC timer is enabled.
diff --git a/share/man/man4/acpi_asus.4 b/share/man/man4/acpi_asus.4
new file mode 100644
index 000000000000..f3b99daf5227
--- /dev/null
+++ b/share/man/man4/acpi_asus.4
@@ -0,0 +1,186 @@
+.\"
+.\" Copyright (c) 2004 Philip Paeps <philip@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_ASUS 4
+.Os
+.Sh NAME
+.Nm acpi_asus
+.Nd Asus Laptop Extras
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_asus"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_asus_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the extra ACPI-controlled gadgets, such as hotkeys
+and leds, found on recent Asus (and Medion) laptops.
+It allows one to use the
+.Xr sysctl 8
+interface to manipulate the brightness of the LCD panel and the display output
+state.
+Hotkey events are passed to
+.Xr devd 8
+for easy handling in userspace with the default configuration in
+.Pa /etc/devd/asus.conf .
+.Pp
+Currently, the following Asus laptops are fully supported:
+.Pp
+.Bl -item -offset indent -compact
+.It
+xxN
+.It
+A1x
+.It
+A2x
+.It
+A3N
+.It
+A4D
+.It
+A6VM
+.It
+D1x
+.It
+J1x
+.It
+L2B
+.It
+L2D
+.It
+L2E
+.It
+L3C
+.It
+L3D
+.It
+L3H
+.It
+L4E
+.It
+L4R
+.It
+L5x
+.It
+L8x
+.It
+M1A
+.It
+M2E
+.It
+M6N
+.It
+M6R
+.It
+S1x
+.It
+S2x
+.It
+V6V
+.It
+W5A
+.It
+Eee PC
+.El
+.Pp
+Additionally,
+.Nm
+also supports the Asus-compatible
+.Em ATK0100
+interface found in
+.Em Samsung P30/P35
+laptops.
+.Sh SYSCTL VARIABLES
+The following sysctls are currently implemented:
+.Bl -tag -width indent
+.It Va hw.acpi.asus.lcd_brightness
+Makes the LCD backlight brighter or dimmer (higher values are brighter).
+.It Va hw.acpi.asus.lcd_backlight
+Turns the LCD backlight on or off.
+.It Va hw.acpi.asus.video_output
+Sets the active display to use according to a bitwise OR of the following:
+.Pp
+.Bl -tag -width indent -compact
+.It Li 0
+No display
+.It Li 1
+LCD
+.It Li 2
+CRT
+.It Li 4
+TV-Out
+.El
+.Pp
+Some models also support video switching via the generic
+.Xr acpi_video 4
+driver.
+Most models do not, however.
+.El
+.Pp
+Defaults for these variables can be set in
+.Xr sysctl.conf 5 ,
+which is parsed at boot-time.
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr acpi_video 4 ,
+.Xr sysctl.conf 5 ,
+.Xr sysctl 8
+.Rs
+.%T The acpi4asus Project
+.%U http://sourceforge.net/projects/acpi4asus/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An Philip Paeps Aq philip@FreeBSD.org .
+.Pp
+Inspiration came from the
+.Em acpi4asus project
+started by
+.An Julien Lerouge
+which maintains a driver implementing this
+functionality in the
+.Tn Linux
+kernel.
diff --git a/share/man/man4/acpi_dock.4 b/share/man/man4/acpi_dock.4
new file mode 100644
index 000000000000..1fda11d3c09a
--- /dev/null
+++ b/share/man/man4/acpi_dock.4
@@ -0,0 +1,62 @@
+.\" Copyright (c) 2006 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 20, 2006
+.Dt ACPI_DOCK 4
+.Os
+.Sh NAME
+.Nm acpi_dock
+.Nd "Laptop Docking Station device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_dock"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_dock_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for laptop docking stations.
+.Sh SEE ALSO
+.Xr acpi 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+device driver was written by
+.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org .
diff --git a/share/man/man4/acpi_fujitsu.4 b/share/man/man4/acpi_fujitsu.4
new file mode 100644
index 000000000000..ef72fee4ba00
--- /dev/null
+++ b/share/man/man4/acpi_fujitsu.4
@@ -0,0 +1,175 @@
+.\"
+.\" Copyright (c) 2005 Philip Paeps <philip@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_FUJITSU 4
+.Os
+.Sh NAME
+.Nm acpi_fujitsu
+.Nd Fujitsu Laptop Extras
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_fujitsu"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_fujitsu_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver enables the ACPI-controlled buttons on Fujitsu notebooks.
+The button events are sent to userspace via
+.Xr devd 8 ,
+and a
+.Xr sysctl 8
+interface is provided to simulate the hardware events.
+.Pp
+Using this driver, one can control the brightness of the display, the volume
+of the speakers, and the internal (eraserhead) mouse pointer.
+.Sh SYSCTL VARIABLES
+These sysctls are currently implemented:
+.Bl -tag -width indent
+.It Va hw.acpi.fujitsu.lcd_brightness
+Makes the LCD backlight brighter or dimmer.
+.It Va hw.acpi.fujitsu.pointer_enable
+Enables or disables the internal mouse pointer.
+.It Va hw.acpi.fujitsu.volume
+Controls the speaker volume.
+.It Va hw.acpi.fujitsu.mute
+Mutes the speakers.
+.El
+.Pp
+Defaults for these sysctls can be set in
+.Xr sysctl.conf 5 .
+.Sh EXAMPLES
+The following can be added to
+.Xr devd.conf 5
+in order to pass button events to a
+.Pa /usr/local/sbin/acpi_oem_exec.sh
+script:
+.Bd -literal -offset indent
+notify 10 {
+ match "system" "ACPI";
+ match "subsystem" "FUJITSU";
+ action "/usr/local/sbin/acpi_oem_exec.sh $notify fujitsu";
+};
+.Ed
+.Pp
+A possible
+.Pa /usr/local/sbin/acpi_oem_exec.sh
+script might look like:
+.Bd -literal -offset indent
+#!/bin/sh
+#
+if [ "$1" = "" -o "$2" = "" ]
+then
+ echo "usage: $0 notify oem_name"
+ exit 1
+fi
+NOTIFY=`echo $1`
+LOGGER="logger"
+CALC="bc"
+BC_PRECOMMANDS="scale=2"
+ECHO="echo"
+CUT="cut"
+MAX_LCD_BRIGHTNESS=7
+MAX_VOLUME=16
+OEM=$2
+DISPLAY_PIPE=/tmp/acpi_${OEM}_display
+
+case ${NOTIFY} in
+ 0x00)
+ LEVEL=`sysctl -n hw.acpi.${OEM}.mute`
+ if [ "$LEVEL" = "1" ]
+ then
+ MESSAGE="volume muted"
+ else
+ MESSAGE="volume unmuted"
+ fi
+ ;;
+ 0x01)
+ LEVEL=`sysctl -n hw.acpi.${OEM}.pointer_enable`
+ if [ "$LEVEL" = "1" ]
+ then
+ MESSAGE="pointer enabled"
+ else
+ MESSAGE="pointer disabled"
+ fi
+ ;;
+ 0x02)
+ LEVEL=`sysctl -n hw.acpi.${OEM}.lcd_brightness`
+ PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
+ ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\\
+ ${CALC} | ${CUT} -d . -f 1`
+ MESSAGE="brightness level ${PERCENT}%"
+ ;;
+ 0x03)
+ LEVEL=`sysctl -n hw.acpi.${OEM}.volume`
+ PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
+ ${LEVEL} / ${MAX_VOLUME} * 100" | \\
+ ${CALC} | ${CUT} -d . -f 1`
+ MESSAGE="volume level ${PERCENT}%"
+ ;;
+ *)
+ ;;
+ esac
+ ${LOGGER} ${MESSAGE}
+ if [ -p ${DISPLAY_PIPE} ]
+ then
+ ${ECHO} ${MESSAGE} >> ${DISPLAY_PIPE} &
+ fi
+exit 0
+.Ed
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr sysctl.conf 5 ,
+.Xr devd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Sean Bullington Aq shegget@gmail.com ,
+.An Anish Mistry Aq mistry.7@osu.edu ,
+and
+.An Marc Santcroos Aq marks@ripe.net .
+.Pp
+This manual page was written by
+.An Philip Paeps Aq philip@FreeBSD.org .
diff --git a/share/man/man4/acpi_hp.4 b/share/man/man4/acpi_hp.4
new file mode 100644
index 000000000000..dbb0ca01e049
--- /dev/null
+++ b/share/man/man4/acpi_hp.4
@@ -0,0 +1,287 @@
+.\" Copyright (c) 2009 Michael Gmelin
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_HP 4
+.Os
+.Sh NAME
+.Nm acpi_hp
+.Nd "ACPI extras driver for HP laptops"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_hp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_hp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for ACPI-controlled features found on HP laptops
+that use a WMI enabled BIOS (e.g. HP Compaq 8510p and 6510p).
+.Pp
+The main purpose of this driver is to provide an interface,
+accessible via
+.Xr sysctl 8 ,
+.Xr devd 8 and
+.Xr devfs 8 ,
+through which applications can determine and change the status of
+various laptop components and BIOS settings.
+.Pp
+.Ss Xr devd 8 Ss Events
+Devd events received by
+.Xr devd 8
+provide the following information:
+.Pp
+.Bl -tag -width "subsystem" -offset indent -compact
+.It system
+.Qq Li ACPI
+.It subsystem
+.Qq Li HP
+.It type
+The source of the event in the ACPI namespace.
+The value depends on the model.
+.It notify
+Event code (see below).
+.El
+.Pp
+Event codes:
+.Pp
+.Bl -tag -width "0xc0" -offset indent -compact
+.It Li 0xc0
+WLAN on air status changed to 0 (not on air)
+.It Li 0xc1
+WLAN on air status changed to 1 (on air)
+.It Li 0xd0
+Bluetooth on air status changed to 0 (not on air)
+.It Li 0xd1
+Bluetooth on air status changed to 1 (on air)
+.It Li 0xe0
+WWAN on air status changed to 0 (not on air)
+.It Li 0xe1
+WWAN on air status changed to 1 (on air)
+.El
+.Ss Xr devfs 8 Ss Device
+You can read /dev/hpcmi to see your current BIOS settings.
+The detail level can be adjusted by setting the sysctl
+.Va cmi_detail
+as described below.
+.Sh SYSCTL VARIABLES
+The following sysctls are currently implemented:
+.Ss WLAN:
+.Bl -tag -width indent
+.It Va dev.acpi_hp.0.wlan_enabled
+Toggle WLAN chip activity.
+.It Va dev.acpi_hp.0.wlan_radio
+(read-only)
+WLAN radio status (controlled by hardware switch)
+.It Va dev.acpi_hp.0.wlan_on_air
+(read-only)
+WLAN on air (chip enabled, hardware switch enabled + enabled in BIOS)
+.It Va dev.acpi_hp.0.wlan_enabled_if_radio_on
+If set to 1, the WLAN chip will be enabled if the radio is turned on
+.It Va dev.acpi_hp.0.wlan_disable_if_radio_off
+If set to 1, the WLAN chip will be disabled if the radio is turned off
+.El
+.Ss Bluetooth:
+.Bl -tag -width indent
+.It Va dev.acpi_hp.0.bt_enabled
+Toggle Bluetooth chip activity.
+.It Va dev.acpi_hp.0.bt_radio
+(read-only)
+Bluetooth radio status (controlled by hardware switch)
+.It Va dev.acpi_hp.0.bt_on_air
+(read-only)
+Bluetooth on air (chip enabled, hardware switch enabled + enabled in BIOS)
+.It Va dev.acpi_hp.0.bt_enabled_if_radio_on
+If set to 1, the Bluetooth chip will be enabled if the radio is turned on
+.It Va dev.acpi_hp.0.bt_disable_if_radio_off
+If set to 1, the Bluetooth chip will be disabled if the radio is turned off
+.El
+.Ss WWAN:
+.Bl -tag -width indent
+.It Va dev.acpi_hp.0.wwan_enabled
+Toggle WWAN chip activity.
+.It Va dev.acpi_hp.0.wwan_radio
+(read-only)
+WWAN radio status (controlled by hardware switch)
+.It Va dev.acpi_hp.0.wwan_on_air
+(read-only)
+WWAN on air (chip enabled, hardware switch enabled + enabled in BIOS)
+.It Va dev.acpi_hp.0.wwan_enabled_if_radio_on
+If set to 1, the WWAN chip will be enabled if the radio is turned on
+.It Va dev.acpi_hp.0.wwan_disable_if_radio_off
+If set to 1, the WWAN chip will be disabled if the radio is turned off
+.El
+.Ss Misc:
+.Bl -tag -width indent
+.It Va dev.acpi_hp.0.als_enabled
+Toggle ambient light sensor (ALS)
+.It Va dev.acpi_hp.0.display
+(read-only)
+Display status (bitmask)
+.It Va dev.acpi_hp.0.hdd_temperature
+(read-only)
+HDD temperature
+.It Va dev.acpi_hp.0.is_docked
+(read-only)
+Docking station status (1 if docked)
+.It Va dev.acpi_hp.0.cmi_detail
+Bitmask to control detail level in /dev/hpcmi output (values can be ORed).
+.Bl -tag -width "0x01" -offset indent -compact
+.It Li 0x01
+Show path component of BIOS setting
+.It Li 0x02
+Show a list of valid options for the BIOS setting
+.It Li 0x04
+Show additional flags of BIOS setting (ReadOnly etc.)
+.It Li 0x08
+Query highest BIOS entry instance.
+This is broken on many HP models and therefore disabled by default.
+.El
+.It Va dev.acpi_hp.0.verbose
+(read-only)
+Set verbosity level
+.El
+.Pp
+Defaults for these sysctls can be set in
+.Xr sysctl.conf 5 .
+.Sh HARDWARE
+The
+.Nm
+driver has been reported to support the following hardware:
+.Pp
+.Bl -bullet -compact
+.It
+HP Compaq 8510p
+.It
+HP Compaq nx7300
+.El
+.Pp
+It should work on most HP laptops that feature a WMI enabled BIOS.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/hpcmi"
+.It Pa /dev/hpcmi
+Interface to read BIOS settings
+.El
+.Sh EXAMPLES
+The following can be added to
+.Xr devd.conf 5
+in order disable the LAN interface when WLAN on air and reenable if it's
+not:
+.Bd -literal -offset indent
+notify 0 {
+ match "system" "ACPI";
+ match "subsystem" "HP";
+ match "notify" "0xc0";
+ action "ifconfig em0 up";
+};
+
+notify 0 {
+ match "system" "ACPI";
+ match "subsystem" "HP";
+ match "notify" "0xc1";
+ action "ifconfig em0 down";
+};
+.Ed
+.Pp
+Enable the ambient light sensor:
+.Bd -literal -offset indent
+sysctl dev.acpi_hp.0.als_enabled=1
+.Ed
+.Pp
+Enable Bluetooth:
+.Bd -literal -offset indent
+sysctl dev.acpi_hp.0.bt_enabled=1
+.Ed
+.Pp
+Get BIOS settings:
+.Bd -literal -offset indent
+cat /dev/hpcmi
+
+Serial Port Disable
+Infrared Port Enable
+Parallel Port Disable
+Flash Media Reader Disable
+USB Ports including Express Card slot Enable
+1394 Port Enable
+Cardbus Slot Disable
+Express Card Slot Disable
+(...)
+.Ed
+.Pp
+Set maximum detail level for /dev/hpcmi output:
+.Bd -literal -offset indent
+sysctl dev.acpi_hp.0.cmi_detail=7
+.Ed
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr acpi_wmi 4 ,
+.Xr sysctl.conf 5 ,
+.Xr devd 8 ,
+.Xr devfs 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Gmelin Aq freebsd@grem.de
+.Pp
+It has been inspired by hp-wmi driver, which implements a subset of these
+features (hotkeys) on Linux.
+.Bl -tag -width indent
+.It HP CMI whitepaper:
+http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf
+.It wmi-hp for Linux:
+http://www.kernel.org
+.It WMI and ACPI:
+http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx
+.El
+.Pp
+This manual page was written by
+.An Michael Gmelin Aq freebsd@grem.de
+.Sh BUGS
+This driver is experimental and has only been tested on i386 on an
+HP Compaq 8510p which featured all supported wireless devices (WWAN/BT/WLAN).
+Expect undefined results when operating on different hardware.
+.Pp
+Loading the driver is slow. Reading from /dev/hpcmi is even slower.
+.Pp
+Additional features like HP specific sensor readings or writing BIOS
+settings are not supported.
diff --git a/share/man/man4/acpi_ibm.4 b/share/man/man4/acpi_ibm.4
new file mode 100644
index 000000000000..376b64d109c1
--- /dev/null
+++ b/share/man/man4/acpi_ibm.4
@@ -0,0 +1,461 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" Copyright (c) 2005 Markus Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_IBM 4
+.Os
+.Sh NAME
+.Nm acpi_ibm
+.Nd "ACPI extras driver for IBM laptops"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_ibm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_ibm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for hotkeys and other components of IBM laptops.
+The main purpose of this driver is to provide an interface,
+accessible via
+.Xr sysctl 8
+and
+.Xr devd 8 ,
+through which applications can determine the status of
+various laptop components.
+.Pp
+While the
+.Xr sysctl 8
+interface is enabled automatically after loading the driver, the
+.Xr devd 8
+interface has to be enabled explicitly, as it may alter the default action of
+certain keys.
+This is done by setting the
+.Va events
+sysctl as described below.
+Specifying which keys should generate events is done by setting a bitmask,
+whereas each bit represents one key or key combination.
+This bitmask, accessible via the
+.Va eventmask
+sysctl, is set to
+.Va availmask
+by default, a value representing all possible keypress events on the specific
+ThinkPad model.
+.Ss Xr devd 8 Ss Events
+Hotkey events received by
+.Xr devd 8
+provide the following information:
+.Pp
+.Bl -tag -width "subsystem" -offset indent -compact
+.It system
+.Qq Li ACPI
+.It subsystem
+.Qq Li IBM
+.It type
+The source of the event in the ACPI namespace.
+The value depends on the model.
+.It notify
+Event code (see below).
+.El
+.Pp
+Depending on the ThinkPad model, event codes may vary.
+On a ThinkPad T41p these are as follows:
+.Pp
+.Bl -tag -width "subsystem" -offset indent -compact
+.It Li 0x01
+Fn + F1
+.It Li 0x02
+Fn + F2
+.It Li 0x03
+Fn + F3 (LCD backlight)
+.It Li 0x04
+Fn + F4 (Suspend to RAM)
+.It Li 0x05
+Fn + F5 (Bluetooth)
+.It Li 0x06
+Fn + F6
+.It Li 0x07
+Fn + F7 (Screen expand)
+.It Li 0x08
+Fn + F8
+.It Li 0x09
+Fn + F9
+.It Li 0x0a
+Fn + F10
+.It Li 0x0b
+Fn + F11
+.It Li 0x0c
+Fn + F12 (Suspend to disk)
+.It Li 0x0d
+Fn + Backspace
+.It Li 0x0e
+Fn + Insert
+.It Li 0x0f
+Fn + Delete
+.It Li 0x10
+Fn + Home (Brightness up)
+.It Li 0x11
+Fn + End (Brightness down)
+.It Li 0x12
+Fn + PageUp (ThinkLight)
+.It Li 0x13
+Fn + PageDown
+.It Li 0x14
+Fn + Space (Zoom)
+.It Li 0x15
+Volume Up
+.It Li 0x16
+Volume Down
+.It Li 0x17
+Mute
+.It Li 0x18
+Access IBM Button
+.El
+.Ss Xr led 4 Ss Interface
+The
+.Nm
+driver provides a
+.Xr led 4
+interface for the ThinkLight.
+The ThinkLight can be made to blink by writing
+.Tn ASCII
+strings to the
+.Pa /dev/led/thinklight
+device.
+.Sh SYSCTL VARIABLES
+The following sysctls are currently implemented:
+.Bl -tag -width indent
+.It Va dev.acpi_ibm.0.initialmask
+(read-only)
+Bitmask of ACPI events before the
+.Nm
+driver was loaded.
+.It Va dev.acpi_ibm.0.availmask
+(read-only)
+Bitmask of all supported ACPI events.
+.It Va dev.acpi_ibm.0.events
+Enable ACPI events and set the
+.Va eventmask
+to
+.Va availmask .
+Without the
+.Nm
+driver being loaded, only the Fn+F4 button generates an ACPI event.
+.It Va dev.acpi_ibm.0.eventmask
+Sets the ACPI events which are reported to
+.Xr devd 8 .
+Fn+F3, Fn+F4 and Fn+F12 always generate ACPI events, regardless which value
+.Va eventmask
+has.
+Depending on the ThinkPad model, the meaning of different bits in the
+.Va eventmask
+may vary.
+On a ThinkPad T41p this is a bitwise OR of the following:
+.Pp
+.Bl -tag -width indent-two -compact
+.It Li 1
+Fn + F1
+.It Li 2
+Fn + F2
+.It Li 4
+Fn + F3 (LCD backlight)
+.It Li 8
+Fn + F4 (Suspend to RAM)
+.It Li 16
+Fn + F5 (Bluetooth)
+.It Li 32
+Fn + F6
+.It Li 64
+Fn + F7 (Screen expand)
+.It Li 128
+Fn + F8
+.It Li 256
+Fn + F9
+.It Li 512
+Fn + F10
+.It Li 1024
+Fn + F11
+.It Li 2048
+Fn + F12 (Suspend to disk)
+.It Li 4096
+Fn + Backspace
+.It Li 8192
+Fn + Insert
+.It Li 16384
+Fn + Delete
+.It Li 32768
+Fn + Home (Brightness up)
+.It Li 65536
+Fn + End (Brightness down)
+.It Li 131072
+Fn + PageUp (ThinkLight)
+.It Li 262144
+Fn + PageDown
+.It Li 524288
+Fn + Space (Zoom)
+.It Li 1048576
+Volume Up
+.It Li 2097152
+Volume Down
+.It Li 4194304
+Mute
+.It Li 8388608
+Access IBM Button
+.El
+.It Va dev.acpi_ibm.0.hotkey
+(read-only)
+Status of several buttons.
+Every time a button is pressed, the respecting bit is toggled.
+It is a bitwise OR of the following:
+.Pp
+.Bl -tag -width indent-two -compact
+.It Li 1
+Home Button
+.It Li 2
+Search Button
+.It Li 4
+Mail Button
+.It Li 8
+Access IBM Button
+.It Li 16
+Zoom
+.It Li 32
+Wireless LAN Button
+.It Li 64
+Video Button
+.It Li 128
+Hibernate Button
+.It Li 256
+ThinkLight Button
+.It Li 512
+Screen Expand
+.It Li 1024
+Brightness Up/Down Button
+.It Li 2048
+Volume Up/Down/Mute Button
+.El
+.It Va dev.acpi_ibm.0.lcd_brightness
+Current brightness level of the display.
+.It Va dev.acpi_ibm.0.volume
+Speaker volume.
+.It Va dev.acpi_ibm.0.mute
+Indicates, whether the speakers are muted or not.
+.It Va dev.acpi_ibm.0.thinklight
+Indicates, whether the ThinkLight keyboard light is activated or not.
+.It Va dev.acpi_ibm.0.bluetooth
+Toggle Bluetooth chip activity.
+.It Va dev.acpi_ibm.0.wlan
+(read-only)
+Indicates whether the WLAN chip is active or not.
+.It Va dev.acpi_ibm.0.fan
+Indicates whether the fan is in automatic (1) or manual (0) mode.
+Default is automatic mode.
+This sysctl should be used with extreme precaution, since disabling automatic
+fan control might overheat the ThinkPad and lead to permanent damage if the
+.Va fan_level
+is not set accordingly.
+.It Va dev.acpi_ibm.0.fan_level
+Indicates at what speed the fan should run when being in manual mode.
+Values are ranging from 0 (off) to 7 (max).
+The resulting speed differs from model to model.
+On a T41p this is as follows:
+.Pp
+.Bl -tag -width indent-two -compact
+.It Li 0
+off
+.It Li 1, 2
+~3000 RPM
+.It Li 3, 4, 5
+~3600 RPM
+.It Li 6, 7
+~4300 RPM
+.El
+.It Va dev.acpi_ibm.0.fan_speed
+(read-only)
+Fan speed in rounds per minute.
+A few older ThinkPads report the fan speed in levels ranging from 0 (off)
+to 7 (max).
+.It Va dev.acpi_ibm.0.thermal
+(read-only)
+Shows the readings of up to eight different temperature sensors.
+Most ThinkPads include six or more temperature sensors but
+only expose the CPU temperature through
+.Xr acpi_thermal 4 .
+Some ThinkPads have the below sensor layout which might vary depending on the
+specific model:
+.Pp
+.Bl -enum -compact
+.It
+CPU
+.It
+Mini PCI Module
+.It
+HDD
+.It
+GPU
+.It
+Built-in battery
+.It
+UltraBay battery
+.It
+Built-in battery
+.It
+UltraBay battery
+.El
+.El
+.Pp
+Defaults for these sysctls can be set in
+.Xr sysctl.conf 5 .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/led/thinklight"
+.It Pa /dev/led/thinklight
+ThinkLight
+.Xr led 4
+device node
+.El
+.Sh EXAMPLES
+The following can be added to
+.Xr devd.conf 5
+in order to pass button events to a
+.Pa /usr/local/sbin/acpi_oem_exec.sh
+script:
+.Bd -literal -offset indent
+notify 10 {
+ match "system" "ACPI";
+ match "subsystem" "IBM";
+ action "/usr/local/sbin/acpi_oem_exec.sh $notify ibm";
+};
+.Ed
+.Pp
+A possible
+.Pa /usr/local/sbin/acpi_oem_exec.sh
+script might look like:
+.Bd -literal -offset indent
+#!/bin/sh
+#
+if [ "$1" = "" -o "$2" = "" ]
+then
+ echo "usage: $0 notify oem_name"
+ exit 1
+fi
+NOTIFY=`echo $1`
+LOGGER="logger"
+CALC="bc"
+BC_PRECOMMANDS="scale=2"
+ECHO="echo"
+CUT="cut"
+MAX_LCD_BRIGHTNESS=7
+MAX_VOLUME=14
+OEM=$2
+DISPLAY_PIPE=/tmp/acpi_${OEM}_display
+
+case ${NOTIFY} in
+ 0x05)
+ LEVEL=`sysctl -n dev.acpi_${OEM}.0.bluetooth`
+ if [ "$LEVEL" = "1" ]
+ then
+ sysctl dev.acpi_${OEM}.0.bluetooth=0
+ MESSAGE="bluetooth disabled"
+ else
+ sysctl dev.acpi_${OEM}.0.bluetooth=1
+ MESSAGE="bluetooth enabled"
+ fi
+ ;;
+ 0x10|0x11)
+ LEVEL=`sysctl -n dev.acpi_${OEM}.0.lcd_brightness`
+ PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
+ ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\\
+ ${CALC} | ${CUT} -d . -f 1`
+ MESSAGE="brightness level ${PERCENT}%"
+ ;;
+ 0x12)
+ LEVEL=`sysctl -n dev.acpi_${OEM}.0.thinklight`
+ if [ "$LEVEL" = "1" ]
+ then
+ MESSAGE="thinklight enabled"
+ else
+ MESSAGE="thinklight disabled"
+ fi
+ ;;
+ 0x15|0x16)
+ LEVEL=`sysctl -n dev.acpi_${OEM}.0.volume`
+ PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
+ ${LEVEL} / ${MAX_VOLUME} * 100" | \\
+ ${CALC} | ${CUT} -d . -f 1`
+ MESSAGE="volume level ${PERCENT}%"
+ ;;
+ 0x17)
+ LEVEL=`sysctl -n dev.acpi_${OEM}.0.mute`
+ if [ "$LEVEL" = "1" ]
+ then
+ MESSAGE="volume muted"
+ else
+ MESSAGE="volume unmuted"
+ fi
+ ;;
+ *)
+ ;;
+esac
+${LOGGER} ${MESSAGE}
+if [ -p ${DISPLAY_PIPE} ]
+then
+ ${ECHO} ${MESSAGE} >> ${DISPLAY_PIPE} &
+fi
+exit 0
+.Ed
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr led 4 ,
+.Xr sysctl.conf 5 ,
+.Xr devd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Takanori Watanabe Aq takawata@FreeBSD.org
+and later mostly rewritten by
+.An Markus Brueffer Aq markus@FreeBSD.org .
+This manual page was written by
+.An Christian Brueffer Aq brueffer@FreeBSD.org
+and
+.An Markus Brueffer Aq markus@FreeBSD.org .
diff --git a/share/man/man4/acpi_panasonic.4 b/share/man/man4/acpi_panasonic.4
new file mode 100644
index 000000000000..d02a16e3ffd5
--- /dev/null
+++ b/share/man/man4/acpi_panasonic.4
@@ -0,0 +1,178 @@
+.\"
+.\" Copyright (c) 2004 OGAWA Takaya <t-ogawa@triaez.kaisei.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt ACPI_PANASONIC 4
+.Os
+.Sh NAME
+.Nm acpi_panasonic
+.Nd "ACPI hotkey driver for Panasonic laptops"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_panasonic"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_panasonic_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver enables such hotkey facilities of various Panasonic laptops as
+changing LCD brightness, controlling mixer volumes, entering sleep or
+suspended state and so on.
+On the following models it is reported to work: Let's note (or
+Toughbook, outside Japan) CF-R1N, CF-R2A and CF-R3.
+It may also work on other models as well.
+.Pp
+The driver consists of three functionalities.
+The first is to detect hotkey events and take corresponding actions,
+which include changing LCD luminance and speaker mute state.
+The second role is to notify occurrences of the event by way of
+.Xr devctl 4
+and eventually to
+.Xr devd 8 .
+The third and last is to provide a way to adjust LCD brightness and
+sound mute state via
+.Xr sysctl 8 .
+.Ss Hotkeys
+There are 9 hotkeys available on the supported hardware:
+.Pp
+.Bl -tag -compact -offset indent
+.It Sy Fn+F1
+Make LCD backlight darker.
+.It Sy Fn+F2
+Make LCD backlight brighter.
+.It Sy Fn+F3
+Switch video output between LCD and CRT.
+Not supported by the
+.Nm
+driver.
+.It Sy Fn+F4
+Toggle muting the speaker.
+.It Sy Fn+F5
+Turn the mixer volume down.
+.It Sy Fn+F6
+Turn the mixer volume up.
+.It Sy Fn+F7
+Enter suspend-to-RAM state.
+.It Sy Fn+F9
+Show battery status.
+.It Sy Fn+F10
+Enter suspend-to-disk state.
+.El
+.Pp
+Actions are automatically taken within the driver for
+.Sy Fn+F1 , Fn+F2
+and
+.Sy Fn+F4 .
+For the other events such as
+mixer control and showing battery status,
+.Xr devd 8
+should take the role as described below.
+.Ss Xr devd 8 Ss Events
+When notified to
+.Xr devd 8 ,
+the hotkey event provides the following information:
+.Pp
+.Bl -tag -compact -offset indent
+.It system
+.Qq Li ACPI
+.It subsystem
+.Qq Li Panasonic
+.It type
+The source of the event in ACPI namespace.
+The value depends on the model but typically
+.Qq Li \e_SB_.HKEY .
+.It notify
+Event code (see below).
+.El
+.Pp
+Event codes to be generated are assigned as follows:
+.Bl -tag -offset indent
+.It 0x81-0x86, 0x89
+.Sy Fn+F<n>
+pressed.
+0x81 corresponds to
+.Sy Fn+F1 ,
+0x82 corresponds to
+.Sy Fn+F2 ,
+and so on.
+.It 0x01-0x07, 0x09, 0x1a
+.Sy Fn+F<n>
+released.
+0x01 corresponds to
+.Sy Fn+F1 ,
+0x02 corresponds to
+.Sy Fn+F2 ,
+and so on.
+.El
+.Sh SYSCTL VARIABLES
+The following MIBs are available:
+.Bl -tag -width indent
+.It Va hw.acpi.panasonic.lcd_brightness_max
+The maximum level of brightness.
+The value is read only and
+automatically set according to hardware model.
+.It Va hw.acpi.panasonic.lcd_brightness_min
+The minimum level of brightness.
+The value is read only and
+automatically set according to hardware model.
+.It Va hw.acpi.panasonic.lcd_brightness
+Current brightness level of the LCD (read-write).
+The value ranges from
+.Va hw.acpi.panasonic.lcd_brightness_min
+to
+.Va hw.acpi.panasonic.lcd_brightness_max .
+.It Va hw.acpi.panasonic.sound_mute
+A read-write boolean flag to control whether to mute the speaker.
+The value 1 means to mute and 0 not.
+.El
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr devd.conf 5 ,
+.Xr devd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An OGAWA Takaya Aq t\-ogawa@triaez.kaisei.org
+and
+.An TAKAHASHI Yoshihiro Aq nyan@FreeBSD.org .
diff --git a/share/man/man4/acpi_sony.4 b/share/man/man4/acpi_sony.4
new file mode 100644
index 000000000000..f0fb0e0835f1
--- /dev/null
+++ b/share/man/man4/acpi_sony.4
@@ -0,0 +1,82 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_SONY 4
+.Os
+.Sh NAME
+.Nm acpi_sony
+.Nd "ACPI notebook controller driver for Sony laptops"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_sony"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_sony_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the notebook controller in Sony laptops.
+Note that not all features will work on all laptop models.
+.Sh SYSCTLS
+The following sysctl nodes are currently implemented:
+.Bl -tag -width indent
+.It Va dev.acpi_sony.0.brightness
+Current brightness level of the display.
+.It Va dev.acpi_sony.0.brightness_default
+Default brightness level of the display (survives reboot).
+.It Va dev.acpi_sony.0.contrast
+Current contrast level of the display.
+.It Va dev.acpi_sony.0.bass_gain
+Enable or disable the Bass Gain feature.
+.It Va dev.acpi_sony.0.cdp
+Turns the CD power on or off.
+.It Va dev.acpi_sony.0.azp
+Turns the audio power on or off.
+.It Va dev.acpi_sony.0.lnp
+Turns the wired network interface power on or off.
+.El
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Takanori Watanabe Aq takawata@FreeBSD.org .
diff --git a/share/man/man4/acpi_thermal.4 b/share/man/man4/acpi_thermal.4
new file mode 100644
index 000000000000..d1cf8ee60ef2
--- /dev/null
+++ b/share/man/man4/acpi_thermal.4
@@ -0,0 +1,149 @@
+.\" Copyright (c) 2003 Takanori Watanabe.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 17, 2007
+.Dt ACPI_THERMAL 4
+.Os
+.Sh NAME
+.Nm acpi_thermal
+.Nd ACPI thermal management subsystem
+.Sh SYNOPSIS
+.Cd "device acpi"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides the thermal management features of the ACPI module.
+This driver has a
+.Xr sysctl 8
+interface and a
+.Xr devd 8
+notification interface.
+The sysctls export properties of each ACPI thermal zone object.
+.Pp
+There can be multiple thermal zones in a system.
+For example, each CPU and the enclosure could all be separate thermal
+zones, each with its own setpoints and cooling devices.
+Thermal zones are numbered sequentially in the order they appear in
+the AML.
+.Pp
+The
+.Nm
+driver also activates the active cooling system according to
+each thermal zone's setpoints.
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.It Va hw.acpi.thermal.min_runtime
+Number of seconds to continue active cooling once started.
+A new active cooling level will not be selected until this interval expires.
+.It Va hw.acpi.thermal.polling_rate
+Number of seconds between polling the current temperature.
+.It Va hw.acpi.thermal.user_override
+If set to 1, allow user override of various setpoints (below).
+The original values for these settings are obtained from the BIOS and
+system overheating and possible damage could occur if changed.
+Default is 0 (no override).
+.It Va hw.acpi.thermal.tz%d.active
+Current active cooling system state.
+If this is non-negative, the appropriate _AC%d object is running.
+Set this value to the desired active cooling level to force
+the corresponding fan object to the appropriate level.
+.It Va hw.acpi.thermal.tz%d.passive_cooling
+If set to 1, passive cooling is enabled.
+It does cooling without fans using
+.Xr cpufreq 4
+as the mechanism for controlling CPU speed.
+Default is enabled for tz0 where it is available.
+.It Va hw.acpi.thermal.tz%d.thermal_flags
+Current thermal zone status.
+These are bit-masked values.
+.It Va hw.acpi.thermal.tz%d.temperature
+Current temperature for this zone.
+.It Va hw.acpi.thermal.tz%d._PSV
+Temperature to start passive cooling by throttling down CPU, etc.
+This value can be overridden by the user.
+.It Va hw.acpi.thermal.tz%d._HOT
+Temperature to start critical suspend to disk (S4).
+This value can be overridden by the user.
+.It Va hw.acpi.thermal.tz%d._CRT
+Temperature to start critical shutdown (S5).
+This value can be overridden by the user.
+.It Va hw.acpi.thermal.tz%d._ACx
+Temperatures at which to switch to the corresponding active cooling
+level.
+The lower the _ACx value, the higher the cooling power.
+.El
+.Pp
+All temperatures are printed in Celsius.
+Values can be set in Celsius (by providing a trailing
+.Qq C )
+or Kelvin (by leaving off any trailing letter).
+When setting a value by
+.Xr sysctl 8 ,
+do not specify a trailing decimal (i.e., 90C instead of 90.0C).
+.Sh NOTIFIES
+Notifies are passed to userland via
+.Xr devd 8 .
+See
+.Pa /etc/devd.conf
+and
+.Xr devd.conf 5
+for examples.
+The
+.Nm
+driver sends events with the following attributes:
+.Pp
+.Bl -tag -width "subsystem" -compact
+.It system
+.Li ACPI
+.It subsystem
+.Li Thermal
+.It type
+The fully qualified thermal zone object path as in the ASL.
+.It notify
+An integer designating the event:
+.Pp
+.Bl -tag -width indent -compact
+.It Li 0x80
+Current temperature has changed.
+.It Li 0x81
+One or more trip points (_ACx, _PSV) have changed.
+.It Li 0x82
+One or more device lists (_ALx, _PSL, _TZD) have changed.
+.It Li 0xcc
+Non-standard notify that the system will shutdown if the temperature
+stays above _CRT or _HOT for one more poll cycle.
+.El
+.El
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr cpufreq 4 ,
+.Xr acpidump 8
+.Sh AUTHORS
+.An -nosplit
+.An Michael Smith
+.Pp
+This manual page was written by
+.An Takanori Watanabe .
diff --git a/share/man/man4/acpi_toshiba.4 b/share/man/man4/acpi_toshiba.4
new file mode 100644
index 000000000000..134ecc8d302d
--- /dev/null
+++ b/share/man/man4/acpi_toshiba.4
@@ -0,0 +1,128 @@
+.\"
+.\" Copyright (c) 2003 Philip Paeps <philip@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt ACPI_TOSHIBA 4
+.Os
+.Sh NAME
+.Nm acpi_toshiba
+.Nd Toshiba HCI interface
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_toshiba"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_toshiba_load="YES"
+.Ed
+.Sh DESCRIPTION
+HCI is Toshiba's
+.Em "Hardware Control Interface"
+which is somewhat uniform across their models.
+The
+.Nm
+driver allows the user to manipulate HCI-controlled hardware using a number of
+.Xr sysctl 8
+variables.
+.Sh SYSCTL VARIABLES
+The following sysctls are currently implemented:
+.Bl -tag -width indent
+.It Va hw.acpi.toshiba.force_fan
+Causes active cooling to be forcibly enabled
+.Pq Ql 1
+or disabled
+.Pq Ql 0
+regardless of the current temperature.
+.It Va hw.acpi.toshiba.video_output
+Sets the active display to use according to a bitwise OR of the following:
+.Pp
+.Bl -tag -width indent -compact
+.It Li 0
+No display
+.It Li 1
+LCD
+.It Li 2
+CRT
+.It Li 4
+TV-Out
+.El
+.Pp
+Only some systems (i.e., the Libretto L5) support video switching via
+this hardware-specific driver.
+Use the
+.Xr acpi_video 4
+driver for generic video output support.
+.It Va hw.acpi.toshiba.lcd_brightness
+Makes the LCD backlight brighter or dimmer (higher values are brighter).
+.It Va hw.acpi.toshiba.lcd_backlight
+Turns the LCD backlight on and off.
+.It Va hw.acpi.toshiba.cpu_speed
+Sets the CPU speed to the specified speed.
+This provides functionality similar to the
+.Va hw.acpi.cpu.throttle_state
+variable.
+Higher sysctl values mean lower CPU speeds.
+.El
+.Pp
+Defaults for these variables can be set in
+.Xr sysctl.conf 5 ,
+which is parsed at boot-time.
+.Sh LOADER TUNABLES
+The
+.Va hw.acpi.toshiba.enable_fn_keys
+tunable enables or disables the function keys on the keyboard.
+Function keys are enabled by default.
+.Pp
+This behaviour can be changed at the
+.Xr loader 8
+prompt or in
+.Xr loader.conf 5 .
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr acpi_video 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl.conf 5 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Hiroyuki Aizu Aq aizu@navi.org .
+This manual page was written by
+.An Philip Paeps Aq philip@FreeBSD.org .
diff --git a/share/man/man4/acpi_video.4 b/share/man/man4/acpi_video.4
new file mode 100644
index 000000000000..c28678479e71
--- /dev/null
+++ b/share/man/man4/acpi_video.4
@@ -0,0 +1,89 @@
+.\"
+.\" Copyright (c) 2004 Mark Santcroos <marks@ripe.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 8, 2004
+.Dt ACPI_VIDEO 4
+.Os
+.Sh NAME
+.Nm acpi_video
+.Nd ACPI Video Extensions driver
+.Sh SYNOPSIS
+.Cd "device acpi_video"
+.Sh DESCRIPTION
+This driver uses the ACPI Video Extensions to control display switching and
+backlight brightness.
+The availability of the
+.Xr sysctl 8
+variables depends on the functions offered by the host's ACPI implementation.
+.Sh SYSCTL VARIABLES
+The following sysctls are currently implemented,
+where
+.Aq Ar device
+is
+.Va crt , lcd ,
+or
+.Va tv :
+.Bl -tag -width indent
+.It Va hw.acpi.video. Ns Ao Ar device Ac Ns Va .active
+Current state of the output device.
+.It Va hw.acpi.video. Ns Ao Ar device Ac Ns Va .levels
+List of supported brightness levels.
+.It Va hw.acpi.video. Ns Ao Ar device Ac Ns Va .brightness
+Current brightness level of the device.
+.It Va hw.acpi.video. Ns Ao Ar device Ac Ns Va .fullpower
+Preset brightness level to be used in full power mode.
+.It Va hw.acpi.video. Ns Ao Ar device Ac Ns Va .economy
+Preset brightness level to be used in economy mode.
+.El
+.Pp
+Defaults for these variables can be set in
+.Xr sysctl.conf 5 ,
+which is parsed at boot-time.
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl.conf 5 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Taku YAMAMOTO Aq taku@cent.saitama-u.ac.jp .
+This manual page was written by
+.An Mark Santcroos Aq marks@ripe.net .
+.Sh BUGS
+Some systems only perform output switching via SMM even though they export
+the proper information via ACPI.
+On such systems, the proper hotkeys or OEM driver (for example,
+.Xr acpi_toshiba 4 )
+must be used instead.
diff --git a/share/man/man4/acpi_wmi.4 b/share/man/man4/acpi_wmi.4
new file mode 100644
index 000000000000..12ecdfaf62f0
--- /dev/null
+++ b/share/man/man4/acpi_wmi.4
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2009 Michael Gmelin
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2011
+.Dt ACPI_WMI 4
+.Os
+.Sh NAME
+.Nm acpi_wmi
+.Nd "ACPI to WMI mapping driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_wmi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_wmi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides an interface for vendor specific WMI implementations
+(e.g. HP and Acer laptops).
+It creates /dev/wmistat%d, which can be read to get
+information about GUIDs found in the system.
+.Sh FILES
+.Bl -tag -width /dev/wmistat%d -compact
+.It Pa /dev/wmistat%d
+WMI status device.
+.El
+.Sh EXAMPLES
+.Bd -literal
+# cat /dev/wmistat0
+GUID INST EXPE METH STR EVENT OID
+{5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NO AA
+{95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ -
+{2B814318-4BE8-4707-9D84-A190A859B5D0} 1 NO NO NO 0xA0 -
+{05901221-D566-11D1-B2F0-00A0C9062910} 1 NO NO NO NO AB
+{1F4C91EB-DC5C-460B-951D-C7CB9B4B8D5E} 1 NO WMBA NO NO BA
+{2D114B49-2DFB-4130-B8FE-4A3C09E75133} 57 NO NO NO NO BC
+{988D08E3-68F4-4C35-AF3E-6A1B8106F83C} 20 NO NO NO NO BD
+{14EA9746-CE1F-4098-A0E0-7045CB4DA745} 1 NO NO NO NO BE
+{322F2028-0F84-4901-988E-015176049E2D} 2 NO NO NO NO BF
+{8232DE3D-663D-4327-A8F4-E293ADB9BF05} 0 NO NO NO NO BG
+{8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BH
+{8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI
+.Ed
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Gmelin Aq freebsd@grem.de
+.Pp
+Work has been inspired by the Linux acpi-wmi driver written by Carlos Corbacho
+.Pp
+See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for
+the specification of ACPI-WMI.
+.Pp
+This manual page was written by
+.An Michael Gmelin Aq freebsd@grem.de
diff --git a/share/man/man4/ada.4 b/share/man/man4/ada.4
new file mode 100644
index 000000000000..698ce364c22a
--- /dev/null
+++ b/share/man/man4/ada.4
@@ -0,0 +1,152 @@
+.\" Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt ADA 4
+.Os
+.Sh NAME
+.Nm ada
+.Nd ATA Direct Access device driver
+.Sh SYNOPSIS
+.Cd device ada
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for direct access devices, implementing the
+.Tn ATA
+command protocol, that are attached to the system through a host adapter
+supported by the CAM subsystem.
+.Pp
+The host adapter must also be separately configured into the system before an
+.Tn ATA
+direct access device can be configured.
+.Sh COMMAND QUEUING
+Command queueing allows the device to process multiple transactions
+concurrently, often re-ordering them to reduce the number and length of
+seeks.
+.Tn ATA
+defines two types of queueing:
+.Tn TCQ (Tagged Command Queueing, PATA legacy)
+and
+.Tn NCQ (Native Command Queueing, SATA) .
+The
+.Nm
+device driver takes full advantage of NCQ, when supported.
+To ensure that transactions to distant parts of the media,
+which may be deferred indefinitely by servicing requests closer to the current
+head position, are completed in a timely fashion, an ordered
+transaction is sent every 7 seconds during continuous device operation.
+.Sh CACHE EFFECTS
+Many direct access devices are equipped with read and/or write caches.
+Parameters affecting the device's cache are reported in device IDENTIFY data
+and can be examined and modified via the
+.Xr camcontrol 8
+utility.
+.Pp
+The read cache is used to store data from device-initiated read ahead
+operations as well as frequently used data.
+The read cache is transparent
+to the user and can be enabled without any adverse effect.
+Most devices
+with a read cache come from the factory with it enabled.
+.Pp
+The write cache can greatly decrease the latency of write operations
+and allows the device to reorganize writes to increase efficiency and
+performance.
+This performance gain comes at a price.
+Should the device
+lose power while its cache contains uncommitted write operations, these
+writes will be lost.
+The effect of a loss of write transactions on
+a file system is non-deterministic and can cause corruption.
+Most
+devices age write transactions to limit the vulnerability to a few transactions
+recently reported as complete, but it is nonetheless recommended that
+systems with write cache enabled devices reside on an Uninterruptible
+Power Supply (UPS).
+The
+.Nm
+device driver ensures that the cache and media are synchronized upon
+final close of the device or an unexpected shutdown (panic) event.
+This ensures that it is safe to disconnect power once the operating system
+has reported that it has halted.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width 12
+.It Va kern.cam.ada.retry_count
+.Pp
+This variable determines how many times the
+.Nm
+driver will retry a READ or WRITE command.
+This does not affect the number of retries used during probe time or for
+the
+.Nm
+driver dump routine.
+This value currently defaults to 4.
+.It Va kern.cam.ada.default_timeout
+.Pp
+This variable determines how long the
+.Nm
+driver will wait before timing out an outstanding command.
+The units for this value are seconds, and the default is currently 30
+seconds.
+.It Va kern.cam.ada.spindown_shutdown
+.Pp
+This variable determines whether to spin-down disks when shutting down.
+Set to 1 to enable spin-down, 0 to disable.
+The default is currently enabled.
+.It Va kern.cam.ada.write_cache
+.It Va kern.cam.ada. Ns Ar X Ns Va .write_cache
+.Pp
+These variables determines whether device write cache should be enabled
+globally or per-device or disabled.
+Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is.
+Values modified in runtime take effect only after device reset.
+The global default is currently enabled.
+The per-device default is to leave it as-is (follow global setting).
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ada*" -compact
+.It Pa /dev/ada*
+ATA device nodes
+.El
+.Sh SEE ALSO
+.Xr ahci 4 ,
+.Xr cam 4 ,
+.Xr da 4 ,
+.Xr siis 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org
diff --git a/share/man/man4/adv.4 b/share/man/man4/adv.4
new file mode 100644
index 000000000000..366441d92572
--- /dev/null
+++ b/share/man/man4/adv.4
@@ -0,0 +1,240 @@
+.\"
+.\" Copyright (c) 1998, 2000
+.\" Justin T. Gibbs. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 8, 2004
+.Dt ADV 4
+.Os
+.Sh NAME
+.Nm adv
+.Nd Advansys ISA/VL/EISA/PCI 8bit SCSI Host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device adv"
+.Pp
+For one or more EISA cards:
+.Cd "device eisa"
+.Pp
+For one or more VL/ISA cards:
+.Cd "device isa"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.adv.0.at="isa"
+.Pp
+For one or more PCI cards:
+.Cd "device pci"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the 8bit
+.Tn SCSI
+bus connected to the Advanced Systems Products, Inc.
+.Tn ASC900 ,
+.Tn ASC1000 ,
+.Tn ASC1090 ,
+.Tn ASC1200 ,
+.Tn ASC3030 ,
+.Tn ASC3050 ,
+and
+.Tn ASC3150
+host adapter chips.
+The following tables list the AdvanSys products using these chips,
+their bus attachment type, maximum sync rate, and the maximum number of
+commands that can be handled by the adapter concurrently.
+.Bd -ragged -offset indent
+Connectivity Products:
+.Bl -column "ABP510/5150 " "ISA PnP " "Floppy " "MaxSync " "Commands " "Footnotes "
+.Em "Adapter" Ta Em "Bus" Ta Em "Floppy" Ta Em "MaxSync" Ta Em "Commands" Ta Em "Footnotes"
+.It "ABP510/5150" Ta "ISA" Ta "\&No" Ta "10MHz" Ta "240" Ta "1"
+.It "ABP5140" Ta "ISA PnP" Ta "\&No" Ta "10MHz" Ta "16" Ta "1, 3"
+.It "ABP5142" Ta "ISA PnP" Ta "Yes" Ta "10MHz" Ta "16" Ta "4"
+.It "ABP[3]902" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP3905" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP915" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP920" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP3922" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP3925" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP930" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta "5"
+.It "ABP930U" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "16" Ta ""
+.It "ABP930UA" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "16" Ta ""
+.It "ABP960" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "16" Ta ""
+.It "ABP960U" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "16" Ta ""
+.El
+.Pp
+Footnotes:
+.Bl -enum -compact
+.It
+This board has been shipped by HP with the 4020i CD-R drive.
+The board has no BIOS so it cannot control a boot device, but
+it can control any secondary SCSI device.
+.It
+This board has been sold by Iomega as a Jaz Jet PCI adapter.
+.It
+This board has been sold by SIIG as the i540 SpeedMaster.
+.It
+This board has been sold by SIIG as the i542 SpeedMaster.
+.It
+This board has been sold by SIIG as the Fast SCSI Pro PCI.
+.El
+.Ed
+.Bd -ragged -offset indent
+Single Channel Products:
+.Bl -column "ABPX3X940UA " "EISA " "Floppy " "MaxSync " "Commands"
+.Em "Adapter" Ta Em "Bus" Ta Em "Floppy" Ta Em "MaxSync" Ta Em "Commands"
+.It "ABP542" Ta "ISA" Ta "Yes" Ta "10MHz" Ta "240"
+.It "ABP742" Ta "EISA" Ta "Yes" Ta "10MHz" Ta "240"
+.It "ABP842" Ta "VL" Ta "Yes" Ta "10MHz" Ta "240"
+.It "ABP940" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "240"
+.It "ABP[3]940UA" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "240"
+.It "ABP940U" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "240"
+.It "ABP3960UA" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "240"
+.It "ABP970" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "240"
+.It "ABP970U" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "240"
+.El
+.Ed
+.Bd -ragged -offset indent
+Multi Channel Products (Commands are per-channel):
+.Bl -column "ABPX3X980UA " "EISA " "Floppy " "MaxSync " "Commands " "Channels"
+.Em "Adapter" Ta Em "Bus" Ta Em "Floppy" Ta Em "MaxSync" Ta Em "Commands" Ta Em "Channels"
+.It "ABP752" Ta "EISA" Ta "Yes" Ta "10MHz" Ta "240" Ta "2"
+.It "ABP852" Ta "VL" Ta "Yes" Ta "10MHz" Ta "240" Ta "2"
+.It "ABP950" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "240" Ta "2"
+.It "ABP980" Ta "PCI" Ta "\&No" Ta "10MHz" Ta "240" Ta "4"
+.It "ABP980U" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "240" Ta "4"
+.It "ABP[3]980UA" Ta "PCI" Ta "\&No" Ta "20MHz" Ta "16" Ta "4"
+.El
+.Ed
+.Pp
+.\" For ISA or Vesa Local Bus adapters, one kernel config entry is required
+.\" for every card to be attached by the system. Specific values for the port
+.\" address, irq, and drq may be specified. If wildcard values are used, the
+.\" driver will query the device for its current settings and use those. If
+.\" the port address is a wildcard, the driver consults an internal table of
+.\" possible port address locations and attaches to the first unattached card
+.\" it finds. The possible port addresses for these card are 0x110, 0x130,
+.\" 0x150, 0x190, 0x210, 0x230, 0x250, and 0x330.
+.\" .Pp
+Per target configuration performed in the
+.Tn AdvanceWare
+menu, which is accessible at boot,
+is honored by this driver.
+This includes synchronous/asynchronous transfers,
+maximum synchronous negotiation rate, disconnection, tagged queueing,
+and the host adapter's SCSI ID.
+The global setting for the maximum number of tagged transactions allowed
+per target is not honored as the CAM SCSI system will automatically determine
+the maximum number of tags a device can receive as well as guarantee fair
+resource allocation among devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SCSI controllers:
+.Pp
+.Bl -bullet -compact
+.It
+AdvanSys ABP510/5150
+.It
+AdvanSys ABP5140
+.It
+AdvanSys ABP5142
+.It
+AdvanSys ABP902/3902
+.It
+AdvanSys ABP3905
+.It
+AdvanSys ABP915
+.It
+AdvanSys ABP920
+.It
+AdvanSys ABP3922
+.It
+AdvanSys ABP3925
+.It
+AdvanSys ABP930, ABP930U, ABP930UA
+.It
+AdvanSys ABP960, ABP960U
+.It
+AdvanSys ABP542
+.It
+AdvanSys ABP742
+.It
+AdvanSys ABP842
+.It
+AdvanSys ABP940
+.It
+AdvanSys ABP940UA/3940UA
+.It
+AdvanSys ABP940U
+.It
+AdvanSys ABP3960UA
+.It
+AdvanSys ABP970, ABP970U
+.It
+AdvanSys ABP752
+.It
+AdvanSys ABP852
+.It
+AdvanSys ABP950
+.It
+AdvanSys ABP980, ABP980U
+.It
+AdvanSys ABP980UA/3980UA
+.It
+MELCO IFC-USP (PC-98)
+.It
+RATOC REX-PCI30 (PC-98)
+.It
+@Nifty FNECHARD IFC-USUP-TX (PC-98)
+.El
+.Sh SEE ALSO
+.Xr adw 4 ,
+.Xr aha 4 ,
+.Xr ahb 4 ,
+.Xr ahc 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was ported by
+.An Justin T. Gibbs
+from the Linux driver
+written by
+.An Bob Frey
+of Advanced System Products, Inc.
+Many thanks to AdvanSys for providing the original driver under a suitable
+license for use in
+.Fx .
diff --git a/share/man/man4/adw.4 b/share/man/man4/adw.4
new file mode 100644
index 000000000000..eae4a774c8d8
--- /dev/null
+++ b/share/man/man4/adw.4
@@ -0,0 +1,104 @@
+.\"
+.\" Copyright (c) 1998, 2000
+.\" Justin T. Gibbs. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2004
+.Dt ADW 4
+.Os
+.Sh NAME
+.Nm adw
+.Nd Advansys PCI 16bit SCSI Host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device adw"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the 16bit
+.Tn SCSI
+bus connected to the Advanced Systems Products, Inc.
+.Tn ASC3550 Ultra ,
+and
+.Tn ASC38C0800 Ultra2 ,
+SCSI Host Adapter chips.
+Both chips support, synchronous transfers
+(20MHz and 40MHz max respectively),
+16bit transfers, tagged queueing,
+and up to 253 concurrent SCSI transactions.
+.Pp
+Per target configuration performed in the
+.Tn AdvanceWare
+menu, which is accessible at boot,
+is honored by this driver.
+This includes synchronous/asynchronous transfers,
+maximum synchronous negotiation rate, wide transfers, disconnection,
+tagged queueing, and the host adapter's SCSI ID.
+The global setting for the maximum number of tagged transactions allowed
+per target is not honored as the CAM SCSI system will automatically determine
+the maximum number of tags a device can receive as well as guarantee fair
+resource allocation among devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports SCSI controllers including:
+.Pp
+.Bl -bullet -compact
+.It
+AdvanSys ABP940UW/ABP3940UW
+.It
+AdvanSys ABP950UW
+.It
+AdvanSys ABP970UW
+.It
+AdvanSys ABP3940U2W
+.It
+AdvanSys ABP3950U2W
+.El
+.Sh SEE ALSO
+.Xr adv 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was ported by
+.An Justin T. Gibbs
+from the Linux driver written by
+.An Bob Frey
+of Advanced System Products, Inc.
+Many thanks to AdvanSys for providing the original driver
+under a suitable license for use in
+.Fx .
diff --git a/share/man/man4/ae.4 b/share/man/man4/ae.4
new file mode 100644
index 000000000000..6bfe9d66bdf1
--- /dev/null
+++ b/share/man/man4/ae.4
@@ -0,0 +1,152 @@
+.\" Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 4, 2008
+.Dt AE 4
+.Os
+.Sh NAME
+.Nm ae
+.Nd "Attansic/Atheros L2 FastEthernet controller driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device ae"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ae_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for Attansic/Atheros L2 PCIe FastEthernet
+controllers.
+.Pp
+The controller supports hardware Ethernet checksum processing, hardware
+VLAN tag stripping/insertion and an interrupt moderation mechanism.
+Attansic L2 also features a 64-bit multicast hash filter.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override the autoselected mode by
+adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Select 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (FastEthernet) operation.
+.El
+.Pp
+The
+.Nm
+driver provides support for the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Attansic/Atheros L2 PCIe FastEthernet controllers, and
+is known to support the following hardware:
+.Pp
+.Bl -bullet -compact
+.It
+ASUS EeePC 701
+.It
+ASUS EeePC 900
+.El
+.Pp
+Other hardware may or may not work with this driver.
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.ae.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver collects a number of useful MAC counter during the work.
+The statistics is available via the
+.Va dev.ae.%d.stats
+.Xr sysctl 8
+tree, where %d corresponds to the controller number.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ae%d: watchdog timeout."
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "ae%d: reset timeout."
+The card reset operation has been timed out.
+.It "ae%d: Generating random ethernet address."
+No valid Ethernet address was found in the controller NVRAM and registers.
+Random locally administered address with ASUS OUI identifier will be used
+instead.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver and this manual page was written by
+.An Stanislav Sedov
+.Aq stas@FreeBSD.org .
+It first appeared in
+.Fx 7.1 .
+.Sh BUGS
+The Attansic L2 FastEthernet controller supports DMA but does not use a
+descriptor based transfer mechanism via scatter-gather DMA.
+Thus the data should be copied to/from the controller memory on each
+transmit/receive.
+Furthermore, a lot of data alignment restrictions apply.
+This may introduce a high CPU load on systems with heavy network activity.
+Luckily enough this should not be a problem on modern hardware as L2 does
+not support speeds faster than 100Mbps.
diff --git a/share/man/man4/aesni.4 b/share/man/man4/aesni.4
new file mode 100644
index 000000000000..0001ca274f8e
--- /dev/null
+++ b/share/man/man4/aesni.4
@@ -0,0 +1,94 @@
+.\" Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 6, 2010
+.Dt AESNI 4
+.Os
+.Sh NAME
+.Nm aesni
+.Nd "driver for the AES accelerator on Intel CPUs"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device aesni"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+aesni_load="YES"
+.Ed
+.Sh DESCRIPTION
+Starting with some models of Core i5/i7, Intel processors implement
+a new set of instructions called AESNI.
+The set of six instructions accelerates the calculation of the key
+schedule for key lengths of 128, 192, and 256 of the Advanced
+Encryption Standard (AES) symmetric cipher, and provides a hardware
+implementation of the regular and the last encryption and decryption
+rounds.
+.Pp
+The processor capability is reported as AESNI in the Features2 line at boot.
+The
+.Nm
+driver does not attach on systems that lack the required CPU capability.
+.Pp
+The
+.Nm
+driver registers itself to accelerate AES operations for
+.Xr crypto 4 .
+Besides speed, the advantage of using the
+.Nm
+driver is that the AESNI operation
+is data-independent, thus eliminating some attack vectors based on
+measuring cache use and timings typically present in table-driven
+implementations.
+.Sh SEE ALSO
+.Xr crypt 3 ,
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr ipsec 4 ,
+.Xr padlock 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Konstantin Belousov Aq kib@FreeBSD.org .
+The key schedule calculation code was adopted from the sample provided
+by Intel and used in the analogous
+.Ox
+driver.
diff --git a/share/man/man4/age.4 b/share/man/man4/age.4
new file mode 100644
index 000000000000..28e52c22451a
--- /dev/null
+++ b/share/man/man4/age.4
@@ -0,0 +1,187 @@
+.\" Copyright (c) 2008 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2008
+.Dt AGE 4
+.Os
+.Sh NAME
+.Nm age
+.Nd Attansic/Atheros L1 Gigabit Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device age"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_age_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for Attansic/Atheros L1 PCI Express
+Gigabit Ethernet controllers.
+.Pp
+All LOMs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for both transmit and
+receive, TCP segmentation offload (TSO), hardware VLAN tag
+stripping/insertion features and an interrupt moderation mechanism
+as well as a 64-bit multicast hash filter.
+.Pp
+The L1 also supports Jumbo Frames (up to 10240 bytes), which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for LOMs based on
+Attansic/Atheros L1 Gigabit Ethernet controller chips, including:
+.Pp
+.Bl -bullet -compact
+.It
+ASUS M2N8-VMX
+.It
+ASUS M2V
+.It
+ASUS M3A
+.It
+ASUS P2-M2A590G
+.It
+ASUS P5B-E
+.It
+ASUS P5B-MX/WIFI-AP
+.It
+ASUS P5B-VMSE
+.It
+ASUS P5K
+.It
+ASUS P5KC
+.It
+ASUS P5KPL-C
+.It
+ASUS P5KPL-VM
+.It
+ASUS P5K-SE
+.It
+ASUS P5K-V
+.It
+ASUS P5L-MX
+.It
+ASUS P5DL2-VM
+.It
+ASUS P5L-VM 1394
+.It
+ASUS G2S
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.age.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.age.msix_disable
+This tunable disables MSI-X support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.age.%d.int_mod
+Maximum amount of time to delay interrupt processing in units of
+2us.
+The accepted range is 0 to 65000, the default is 50 (100us).
+Value 0 completely disables the interrupt moderation.
+.It Va dev.age.%d.process_limit
+Maximum amount of Rx events to be processed in the event loop before
+rescheduling a taskqueue.
+The accepted range is 30 to 255, the default value is 128 events.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.It Va dev.age.%d.stats
+Display lots of useful MAC counters maintained in the driver.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
+It first appeared in
+.Fx 7.1 .
diff --git a/share/man/man4/agp.4 b/share/man/man4/agp.4
new file mode 100644
index 000000000000..8af97d6387e1
--- /dev/null
+++ b/share/man/man4/agp.4
@@ -0,0 +1,177 @@
+.\" Copyright (c) 2001 Yar Tikhiy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 28, 2007
+.Dt AGP 4
+.Os
+.Sh NAME
+.Nm agp
+.Nd "generic interface to the Accelerated Graphics Port (AGP)"
+.Sh SYNOPSIS
+.Cd "device agp"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides uniform, abstract methods for controlling
+the following devices:
+.Pp
+.Bl -tag -width "NVIDIA:" -compact
+.It Ali:
+M1541, M1621 and M1671 host to AGP bridges
+.It AMD:
+751, 761 and 762 host to AGP bridges
+.It ATI:
+RS100, RS200, RS250 and RS300 AGP bridges
+.It Intel:
+i820, i840, i845, i850, and i860 host to AGP bridges
+.It Intel:
+i810, i810-DC100, i810E, i815, 830M, 845G, 845M, 852GM, 852GME, 855GM, 855GME, 865G, 915G and 915GM SVGA controllers
+.It Intel:
+82443BX, 82443GX, 82443LX, 82815, 82820, 82830, 82840, 82845, 82845G, 82850, 82855, 82855GM, 82860, 82865, 82875P, E7205 and E7505 host to AGP bridges
+.It NVIDIA:
+nForce and nForce2 AGP controllers
+.It SiS:
+530, 540, 550, 620, 630, 645, 645DX, 648, 650, 651, 655, 661, 730, 735, 740, 741, 745, 746, 760 and 5591 host to AGP bridges
+.It VIA:
+3296, 82C597, 82C598, 82C691, 82C694X, 82C8363, 8235, 8237, 8361, 8367, 8371, 8377, 8501, 8601, 862x, 8633, 8653, 8703, 8753, 8754, 8763, 8783, KT880, PM800, PM880, PN800, PN880, PT880, XM266 and XN266 host to PCI bridges
+.El
+.Pp
+The most common application of
+.Nm
+is for running
+.Xr X 7
+on the Intel i81x controllers.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+operations can be performed on
+.Pa /dev/agpgart ,
+which are defined in
+.In sys/agpio.h :
+.Bl -tag -width indent
+.It Dv AGPIOC_INFO
+Returns state of the
+.Nm
+system.
+The result is a pointer to the following structure:
+.Bd -literal
+typedef struct _agp_info {
+ agp_version version; /* version of the driver */
+ uint32_t bridge_id; /* bridge vendor/device */
+ uint32_t agp_mode; /* mode info of bridge */
+ off_t aper_base; /* base of aperture */
+ size_t aper_size; /* size of aperture */
+ size_t pg_total; /* max pages (swap + system) */
+ size_t pg_system; /* max pages (system) */
+ size_t pg_used; /* current pages used */
+} agp_info;
+.Ed
+.It Dv AGPIOC_ACQUIRE
+Acquire control of the AGP chipset for use by this client.
+Returns
+.Er EBUSY
+if the AGP chipset is already acquired by another client.
+.It Dv AGPIOC_RELEASE
+Release control of the AGP chipset.
+This does not unbind or free any allocated memory, which is the
+responsibility of the client to handle if necessary.
+.It Dv AGPIOC_SETUP
+Enable the AGP hardware with the relevant mode.
+This
+.Xr ioctl 2
+takes the following structure:
+.Bd -literal
+typedef struct _agp_setup {
+ uint32_t agp_mode; /* mode info of bridge */
+} agp_setup;
+.Ed
+.Pp
+The mode bits are defined in
+.In sys/agpio.h .
+.It Dv AGPIOC_ALLOCATE
+Allocate physical memory suitable for mapping into the AGP aperture.
+This
+.Xr ioctl 2
+takes the following structure:
+.Bd -literal
+typedef struct _agp_allocate {
+ int key; /* tag of allocation */
+ size_t pg_count; /* number of pages */
+ uint32_t type; /* 0 == normal, other devspec */
+ uint32_t physical; /* device specific (some devices
+ * need a phys address of the
+ * actual page behind the gatt
+ * table) */
+} agp_allocate;
+.Ed
+.Pp
+Returns a handle to the allocated memory.
+.It Dv AGPIOC_DEALLOCATE
+Free the previously allocated memory associated with the handle passed.
+.It Dv AGPIOC_BIND
+Bind the allocated memory at given offset with the AGP aperture.
+Returns
+.Er EINVAL
+if the memory is already bound or the offset is not at AGP page boundary.
+This
+.Xr ioctl 2
+takes the following structure:
+.Bd -literal
+typedef struct _agp_bind {
+ int key; /* tag of allocation */
+ off_t pg_start; /* starting page to populate */
+} agp_bind;
+.Ed
+.Pp
+The tag of allocation is the handle returned by
+.Dv AGPIOC_ALLOCATE .
+.It Dv AGPIOC_UNBIND
+Unbind memory from the AGP aperture.
+Returns
+.Er EINVAL
+if the memory is not bound.
+This
+.Xr ioctl 2
+takes the following structure:
+.Bd -literal
+typedef struct _agp_unbind {
+ int key; /* tag of allocation */
+ uint32_t priority; /* priority for paging out */
+} agp_unbind;
+.Ed
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/agpgart" -compact
+.It Pa /dev/agpgart
+AGP device node.
+.El
+.Sh SEE ALSO
+.Xr X 7 Pq Pa ports/x11/xorg
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.1 .
diff --git a/share/man/man4/aha.4 b/share/man/man4/aha.4
new file mode 100644
index 000000000000..f0f8aca23634
--- /dev/null
+++ b/share/man/man4/aha.4
@@ -0,0 +1,136 @@
+.\"
+.\" Copyright (c) 1994 Wilko Bulte
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 4, 2004
+.Dt AHA 4
+.Os
+.Sh NAME
+.Nm aha
+.Nd Adaptec SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device aha"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+aha_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.aha.0.at="isa"
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn SCSI
+bus connected to the Adaptec AHA-154x and AHA-1640 SCSI host adapters.
+x is 0 for controllers without a floppy drive and 2 for controllers
+that have them.
+For optimum
+performance, Adaptec AHA-174x controllers should be configured in
+enhanced mode and attached via the
+.Xr ahb 4
+driver.
+.Pp
+One device hint entry for every card to be attached by the system is
+required.
+Specific values for the port address, IRQ, and DRQ may be specified.
+If wildcard values are used, the driver will query the device for its
+current settings and use those.
+If the port address
+is a wildcard, the driver consults an internal table of possible port address
+locations and attaches to the first unattached card it finds.
+The possible
+port addresses for this card are 0x330, 0x334, 0x230, 0x234, 0x130, and
+0x134.
+.Pp
+The AHA-1640 is an MCA bus card.
+Since the MCA bus is a self-identifying bus, no setting of hints is
+required.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SCSI host adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AHA-154xB
+.It
+Adaptec AHA-154xC
+.It
+Adaptec AHA-154xCF
+.It
+Adaptec AHA-154xCP
+.It
+Adaptec AHA-1640
+.It
+Adaptec AHA-174x in 154x emulation mode
+.It
+DTC 3290 SCSI controller in 1542 emulation mode
+.It
+Tekram SCSI controllers in 154x emulation mode
+.El
+.Sh SEE ALSO
+.Xr ahb 4 ,
+.Xr ahc 4 ,
+.Xr aic 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.\"
+.\" .Sh DIAGNOSTICS
+.\"
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was ported by
+.An M. Warner Losh
+from the
+.Nm bt
+driver written by
+.An Justin T. Gibbs .
+.Sh BUGS
+The AHA-154xA card does not support residuals on data transfers.
+As a result, this card is no longer supported.
+.Pp
+There have been some reports that the AHA-154xB does not work well
+under heavy load.
+.Pp
+The AHA-154xCP is a plug and play controller.
+However, its resources are set using the on-board BIOS and cannot be
+moved.
+Failures to attached for this card are often caused when the resources
+set in the BIOS conflict.
diff --git a/share/man/man4/ahb.4 b/share/man/man4/ahb.4
new file mode 100644
index 000000000000..fab6fecb258a
--- /dev/null
+++ b/share/man/man4/ahb.4
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright (c) 1994 Wilko Bulte
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 4, 2004
+.Dt AHB 4
+.Os
+.Sh NAME
+.Nm ahb
+.Nd Adaptec EISA SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ahb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ahb_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn SCSI
+bus connected to an Adaptec
+AHA-174X host adapters in
+.Dq Em enhanced
+mode.
+Tagged queueing and synchronous SCSI transfers are supported.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SCSI host adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AHA-1740
+.It
+Adaptec AHA-1742
+.It
+Adaptec AHA-1740A
+.It
+Adaptec AHA-1742A
+.El
+.Sh SEE ALSO
+.Xr aha 4 ,
+.Xr ahc 4 ,
+.Xr aic 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Justin T. Gibbs .
+.Sh CAVEATS
+The Adaptec 174X is very sensitive to SCSI bus termination and cable
+length.
+It may also have difficulties operating with some modern devices
+that, due to their speed, expose timing problems in the controller.
+There are no known mechanisms for working around device incompatibilities of
+this nature.
diff --git a/share/man/man4/ahc.4 b/share/man/man4/ahc.4
new file mode 100644
index 000000000000..3e47a8b21cf5
--- /dev/null
+++ b/share/man/man4/ahc.4
@@ -0,0 +1,446 @@
+.\"
+.\" Copyright (c) 1995, 1996, 1997, 1998, 2000
+.\" Justin T. Gibbs. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2008
+.Dt AHC 4
+.Os
+.Sh NAME
+.Nm ahc
+.Nd Adaptec VL/EISA/PCI SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ahc"
+.Pp
+For one or more VL/EISA cards:
+.Cd "device eisa"
+.Pp
+For one or more PCI cards:
+.Cd "device pci"
+.Pp
+To allow PCI adapters to use memory mapped I/O if enabled:
+.Cd options AHC_ALLOW_MEMIO
+.Pp
+To configure one or more controllers to assume the target role:
+.Cd options AHC_TMODE_ENABLE <bitmask of units>
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ahc_load="YES"
+ahc_eisa_load="YES"
+ahc_isa_load="YES"
+ahc_pci_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn SCSI
+bus(es) connected to the Adaptec AIC77xx and AIC78xx
+host adapter chips.
+.Pp
+Driver features include support for twin and wide busses,
+fast, ultra or ultra2 synchronous transfers depending on controller type,
+tagged queueing, SCB paging, and target mode.
+.Pp
+Memory mapped I/O can be enabled for PCI devices with the
+.Dq Dv AHC_ALLOW_MEMIO
+configuration option.
+Memory mapped I/O is more efficient than the alternative, programmed I/O.
+Most PCI BIOSes will map devices so that either technique for communicating
+with the card is available.
+In some cases,
+usually when the PCI device is sitting behind a PCI->PCI bridge,
+the BIOS may fail to properly initialize the chip for memory mapped I/O.
+The typical symptom of this problem is a system hang if memory mapped I/O
+is attempted.
+Most modern motherboards perform the initialization correctly and work fine
+with this option enabled.
+.Pp
+Individual controllers may be configured to operate in the target role
+through the
+.Dq Dv AHC_TMODE_ENABLE
+configuration option.
+The value assigned to this option should be a bitmap
+of all units where target mode is desired.
+For example, a value of 0x25, would enable target mode on units 0, 2, and 5.
+A value of 0x8a enables it for units 1, 3, and 7.
+.Pp
+Per target configuration performed in the
+.Tn SCSI-Select
+menu, accessible at boot
+in
+.No non- Ns Tn EISA
+models,
+or through an
+.Tn EISA
+configuration utility for
+.Tn EISA
+models,
+is honored by this driver.
+This includes synchronous/asynchronous transfers,
+maximum synchronous negotiation rate,
+wide transfers,
+disconnection,
+the host adapter's SCSI ID,
+and,
+in the case of
+.Tn EISA
+Twin Channel controllers,
+the primary channel selection.
+For systems that store non-volatile settings in a system specific manner
+rather than a serial eeprom directly connected to the aic7xxx controller,
+the
+.Tn BIOS
+must be enabled for the driver to access this information.
+This restriction applies to all
+.Tn EISA
+and many motherboard configurations.
+.Pp
+Note that I/O addresses are determined automatically by the probe routines,
+but care should be taken when using a 284x
+.Pq Tn VESA No local bus controller
+in an
+.Tn EISA
+system.
+The jumpers setting the I/O area for the 284x should match the
+.Tn EISA
+slot into which the card is inserted to prevent conflicts with other
+.Tn EISA
+cards.
+.Pp
+Performance and feature sets vary throughout the aic7xxx product line.
+The following table provides a comparison of the different chips supported
+by the
+.Nm
+driver.
+Note that wide and twin channel features, although always supported
+by a particular chip, may be disabled in a particular motherboard or card
+design.
+.Bd -ragged -offset indent
+.Bl -column "aic7895CX" "MIPSX" "EISA/VLX" "MaxSyncX" "MaxWidthX" "SCBsX" "2 3 4 5 6 7 8X"
+.It Em "Chip" Ta "MIPS" Ta "Bus" Ta "MaxSync" Ta "MaxWidth" Ta "SCBs" Ta "Features"
+.It "aic7770" Ta "10" Ta "EISA/VL" Ta "10MHz" Ta "16Bit" Ta "4" Ta "1"
+.It "aic7850" Ta "10" Ta "PCI/32" Ta "10MHz" Ta "8Bit" Ta "3" Ta ""
+.It "aic7860" Ta "10" Ta "PCI/32" Ta "20MHz" Ta "8Bit" Ta "3" Ta ""
+.It "aic7870" Ta "10" Ta "PCI/32" Ta "10MHz" Ta "16Bit" Ta "16" Ta ""
+.It "aic7880" Ta "10" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta ""
+.It "aic7890" Ta "20" Ta "PCI/32" Ta "40MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7891" Ta "20" Ta "PCI/64" Ta "40MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7892" Ta "20" Ta "PCI/64" Ta "80MHz" Ta "16Bit" Ta "16" Ta "3 4 5 6 7 8"
+.It "aic7895" Ta "15" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5"
+.It "aic7895C" Ta "15" Ta "PCI/32" Ta "20MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 8"
+.It "aic7896" Ta "20" Ta "PCI/32" Ta "40MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
+.It "aic7897" Ta "20" Ta "PCI/64" Ta "40MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
+.It "aic7899" Ta "20" Ta "PCI/64" Ta "80MHz" Ta "16Bit" Ta "16" Ta "2 3 4 5 6 7 8"
+.El
+.Pp
+.Bl -enum -compact
+.It
+Multiplexed Twin Channel Device - One controller servicing two busses.
+.It
+Multi-function Twin Channel Device - Two controllers on one chip.
+.It
+Command Channel Secondary DMA Engine - Allows scatter gather list and
+SCB prefetch.
+.It
+64 Byte SCB Support - SCSI CDB is embedded in the SCB to eliminate an extra DMA.
+.It
+Block Move Instruction Support - Doubles the speed of certain sequencer
+operations.
+.It
+.Sq Bayonet
+style Scatter Gather Engine - Improves S/G prefetch performance.
+.It
+Queuing Registers - Allows queueing of new transactions without pausing the
+sequencer.
+.It
+Multiple Target IDs - Allows the controller to respond to selection as a
+target on multiple SCSI IDs.
+.El
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver supports the following
+.Tn SCSI
+host adapter chips and
+.Tn SCSI
+controller cards:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec
+.Tn AIC7770
+host adapter chip
+.It
+Adaptec
+.Tn AIC7850
+host adapter chip
+.It
+Adaptec
+.Tn AIC7860
+host adapter chip
+.It
+Adaptec
+.Tn AIC7870
+host adapter chip
+.It
+Adaptec
+.Tn AIC7880
+host adapter chip
+.It
+Adaptec
+.Tn AIC7890
+host adapter chip
+.It
+Adaptec
+.Tn AIC7891
+host adapter chip
+.It
+Adaptec
+.Tn AIC7892
+host adapter chip
+.It
+Adaptec
+.Tn AIC7895
+host adapter chip
+.It
+Adaptec
+.Tn AIC7896
+host adapter chip
+.It
+Adaptec
+.Tn AIC7897
+host adapter chip
+.It
+Adaptec
+.Tn AIC7899
+host adapter chip
+.It
+Adaptec
+.Tn 274X(W)
+.It
+Adaptec
+.Tn 274X(T)
+.It
+Adaptec
+.Tn 284X
+.It
+Adaptec
+.Tn 2910
+.It
+Adaptec
+.Tn 2915
+.It
+Adaptec
+.Tn 2920C
+.It
+Adaptec
+.Tn 2930C
+.It
+Adaptec
+.Tn 2930U2
+.It
+Adaptec
+.Tn 2940
+.It
+Adaptec
+.Tn 2940J
+.It
+Adaptec
+.Tn 2940N
+.It
+Adaptec
+.Tn 2940U
+.It
+Adaptec
+.Tn 2940AU
+.It
+Adaptec
+.Tn 2940UW
+.It
+Adaptec
+.Tn 2940UW Dual
+.It
+Adaptec
+.Tn 2940UW Pro
+.It
+Adaptec
+.Tn 2940U2W
+.It
+Adaptec
+.Tn 2940U2B
+.It
+Adaptec
+.Tn 2950U2W
+.It
+Adaptec
+.Tn 2950U2B
+.It
+Adaptec
+.Tn 19160B
+.It
+Adaptec
+.Tn 29160B
+.It
+Adaptec
+.Tn 29160N
+.It
+Adaptec
+.Tn 3940
+.It
+Adaptec
+.Tn 3940U
+.It
+Adaptec
+.Tn 3940AU
+.It
+Adaptec
+.Tn 3940UW
+.It
+Adaptec
+.Tn 3940AUW
+.It
+Adaptec
+.Tn 3940U2W
+.It
+Adaptec
+.Tn 3950U2
+.It
+Adaptec
+.Tn 3960
+.It
+Adaptec
+.Tn 39160
+.It
+Adaptec
+.Tn 3985
+.It
+Adaptec
+.Tn 4944UW
+.It
+NEC PC-9821Xt13 (PC-98)
+.It
+NEC RvII26 (PC-98)
+.It
+NEC PC-9821X-B02L/B09 (PC-98)
+.It
+NEC SV-98/2-B03 (PC-98)
+.It
+Many motherboards with on-board
+.Tn SCSI
+support
+.El
+.Sh SCSI CONTROL BLOCKS (SCBs)
+Every transaction sent to a device on the SCSI bus is assigned a
+.Sq SCSI Control Block
+(SCB).
+The SCB contains all of the information required by the
+controller to process a transaction.
+The chip feature table lists
+the number of SCBs that can be stored in on-chip memory.
+All chips
+with model numbers greater than or equal to 7870 allow for the on chip
+SCB space to be augmented with external SRAM up to a maximum of 255 SCBs.
+Very few Adaptec controller configurations have external SRAM.
+.Pp
+If external SRAM is not available, SCBs are a limited resource.
+Using the SCBs in a straight forward manner would only allow the driver to
+handle as many concurrent transactions as there are physical SCBs.
+To fully utilize the SCSI bus and the devices on it,
+requires much more concurrency.
+The solution to this problem is
+.Em SCB Paging ,
+a concept similar to memory paging.
+SCB paging takes advantage of
+the fact that devices usually disconnect from the SCSI bus for long
+periods of time without talking to the controller.
+The SCBs for disconnected transactions are only of use to the controller
+when the transfer is resumed.
+When the host queues another transaction
+for the controller to execute, the controller firmware will use a
+free SCB if one is available.
+Otherwise, the state of the most recently
+disconnected (and therefore most likely to stay disconnected) SCB is
+saved, via dma, to host memory, and the local SCB reused to start
+the new transaction.
+This allows the controller to queue up to
+255 transactions regardless of the amount of SCB space.
+Since the
+local SCB space serves as a cache for disconnected transactions, the
+more SCB space available, the less host bus traffic consumed saving
+and restoring SCB data.
+.Sh SEE ALSO
+.Xr aha 4 ,
+.Xr ahb 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 2.0 .
+.Sh AUTHORS
+The
+.Nm
+driver, the
+.Tn AIC7xxx
+sequencer-code assembler,
+and the firmware running on the aic7xxx chips was written by
+.An Justin T. Gibbs .
+.Sh BUGS
+Some Quantum drives (at least the Empire 2100 and 1080s) will not run on an
+.Tn AIC7870
+Rev B in synchronous mode at 10MHz.
+Controllers with this problem have a
+42 MHz clock crystal on them and run slightly above 10MHz.
+This confuses the drive and hangs the bus.
+Setting a maximum synchronous negotiation rate of 8MHz in the
+.Tn SCSI-Select
+utility will allow normal operation.
+.Pp
+Although the Ultra2 and Ultra160 products have sufficient instruction
+ram space to support both the initiator and target roles concurrently,
+this configuration is disabled in favor of allowing the target role
+to respond on multiple target ids.
+A method for configuring dual role mode should be provided.
+.Pp
+Tagged Queuing is not supported in target mode.
+.Pp
+Reselection in target mode fails to function correctly on all high
+voltage differential boards as shipped by Adaptec.
+Information on
+how to modify HVD board to work correctly in target mode is available
+from Adaptec.
diff --git a/share/man/man4/ahci.4 b/share/man/man4/ahci.4
new file mode 100644
index 000000000000..622875c8e933
--- /dev/null
+++ b/share/man/man4/ahci.4
@@ -0,0 +1,172 @@
+.\" Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 6, 2011
+.Dt AHCI 4
+.Os
+.Sh NAME
+.Nm ahci
+.Nd Serial ATA Advanced Host Controller Interface driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device ahci"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ahci_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.ahci. Ns Ar X Ns Va .msi
+controls Message Signaled Interrupts (MSI) usage by the specified controller
+.Bl -tag -compact
+.It 0
+MSI disabled;
+.It 1
+single MSI vector used, if supported (default);
+.It 2
+multiple MSI vectors used, if supported;
+.El
+.It Va hint.ahci. Ns Ar X Ns Va .ccc
+controls Command Completion Coalescing (CCC) usage by the specified controller.
+Non-zero value enables CCC and defines maximum time (in ms), request can wait
+for interrupt, if there are some more requests present on controller queue.
+CCC reduces number of context switches on systems with many parallel requests,
+but it can decrease disk performance on some workloads due to additional
+command latency.
+.It Va hint.ahcich. Ns Ar X Ns Va .pm_level
+controls SATA interface Power Management for the specified channel,
+allowing some power to be saved at the cost of additional command
+latency.
+Possible values:
+.Bl -tag -compact
+.It 0
+interface Power Management is disabled (default);
+.It 1
+device is allowed to initiate PM state change, host is passive;
+.It 2
+host initiates PARTIAL PM state transition every time port becomes idle;
+.It 3
+host initiates SLUMBER PM state transition every time port becomes idle.
+.It 4
+driver initiates PARTIAL PM state transition 1ms after port becomes idle;
+.It 5
+driver initiates SLUMBER PM state transition 125ms after port becomes idle.
+.El
+Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used.
+Because of artificial entering latency, performance degradation in modes
+4 and 5 is much smaller then in modes 2 and 3.
+.Pp
+Note that interface Power Management complicates device presence detection.
+A manual bus reset/rescan may be needed after device hot-plug, unless hardware
+implements Cold Presence Detection.
+.It Va hint.ahcich. Ns Ar X Ns Va .sata_rev
+setting to nonzero value limits maximum SATA revision (speed).
+Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps.
+.It Va hw.ahci.force
+setting to nonzero value forces driver attach to some known AHCI-capable
+chips even if they are configured for legacy IDE emulation. Default is 1.
+.El
+.Sh DESCRIPTION
+This driver provides the
+.Xr CAM 4
+subsystem with native access to the
+.Tn SATA
+ports of AHCI-compatible controllers.
+Each SATA port found is represented to CAM as a separate bus with one
+target, or, if HBA supports Port Multipliers, 16 targets.
+Most of the bus-management details are handled by the SATA-specific
+transport of CAM.
+Connected ATA disks are handled by the ATA protocol disk peripheral driver
+.Xr ada 4 .
+ATAPI devices are handled by the SCSI protocol peripheral drivers
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+etc.
+.Pp
+Driver features include support for Serial ATA and ATAPI devices,
+Port Multipliers (including FIS-based switching, when supported),
+hardware command queues (up to 32 commands per port),
+Native Command Queuing, SATA interface Power Management, device hot-plug
+and Message Signaled Interrupts.
+.Pp
+Driver supports "LED" enclosure management messages, defined by the AHCI.
+When supported by hardware, it allows to control per-port activity, locate
+and fault LEDs via the
+.Xr led 4
+API for localization and status reporting purposes.
+Supporting AHCI controllers may transmit that information to the backplane
+controllers via SGPIO interface. Backplane controllers interpret received
+statuses in some way (IBPI standard) to report them using present indicators.
+.Pp
+AHCI hardware is also supported by ataahci driver from
+.Xr ata 4
+subsystem.
+If both drivers are loaded at the same time, this one will be
+given precedence as the more functional of the two.
+.Sh HARDWARE
+The
+.Nm
+driver supports AHCI compatible controllers having PCI class 1 (mass storage),
+subclass 6 (SATA) and programming interface 1 (AHCI).
+.Pp
+Also, in cooperation with atamarvell and atajmicron drivers of ata(4),
+it supports AHCI part of legacy-PATA + AHCI-SATA combined controllers,
+such as JMicron JMB36x and Marvell 88SE61xx.
+.Sh FILES
+.Bl -tag -width /dev/led/ahcich*.locate
+.It Pa /dev/led/ahcich*.act
+activity LED device nodes
+.It Pa /dev/led/ahcich*.fault
+fault LED device nodes
+.It Pa /dev/led/ahcich*.locate
+locate LED device nodes
+.El
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr ata 4 ,
+.Xr cam 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org .
diff --git a/share/man/man4/ahd.4 b/share/man/man4/ahd.4
new file mode 100644
index 000000000000..e00c42758ea7
--- /dev/null
+++ b/share/man/man4/ahd.4
@@ -0,0 +1,180 @@
+.\"
+.\" Copyright (c) 1995, 1996, 1997, 1998, 2000
+.\" Justin T. Gibbs. All rights reserved.
+.\" Copyright (c) 2002
+.\" Scott Long. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 4, 2004
+.Dt AHD 4
+.Os
+.Sh NAME
+.Nm ahd
+.Nd Adaptec PCI/PCI-X Ultra320 SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device ahd"
+.Pp
+To compile in debugging code:
+.Cd options AHD_DEBUG
+.Cd options AHD_DEBUG_OPTS=<bitmask of options>
+.Cd options AHD_REG_PRETTY_PRINT
+.Pp
+To configure one or more controllers to assume the target role:
+.Cd options AHD_TMODE_ENABLE=<bitmask of units>
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ahd_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn SCSI
+bus(es) connected to Adaptec
+.Tn AIC79xx
+host adapter chips.
+.Pp
+Driver features include support for narrow and wide busses,
+fast, ultra, ultra2, ultra160, and ultra320 synchronous transfers,
+packetized transfers, tagged queueing, 512 SCB's, and target mode.
+.Pp
+The
+.Dv AHD_DEBUG_OPTS
+option is used to control which diagnostic messages are printed to the
+console when
+.Dv AHD_DEBUG
+is enabled.
+Logically OR the following bits together:
+.Bl -column -offset indent Value Function
+.Em "Value Function"
+0x0001 Show miscellaneous information
+0x0002 Show sense data
+0x0004 Show Serial EEPROM contents
+0x0008 Show bus termination settings
+0x0010 Show host memory usage
+0x0020 Show SCSI protocol messages
+0x0040 Show mode pointer of the chip register window
+0x0080 Show selection timeouts
+0x0100 Show FIFO usage messages
+0x0200 Show Queue Full status
+0x0400 Show SCB queue status
+0x0800 Show inbound packet information
+0x1000 Show S/G list information
+0x2000 Enable extra diagnostic code in the firmware
+.El
+.Pp
+The
+.Dv AHD_REG_PRETTY_PRINT
+option compiles in support for human-readable bit definitions for each register
+that is printed by the debugging code.
+However, it also bloats the compiled
+size of the driver by approximately 215KB.
+.Pp
+Individual controllers may be configured to operate in the target role
+through the
+.Dv AHD_TMODE_ENABLE
+configuration option.
+The value assigned to this option should be a bitmap
+of all units where target mode is desired.
+For example, a value of 0x25 would enable target mode on units 0, 2, and 5.
+Note that target mode is only supported for ultra160 speeds and below.
+.Pp
+Per target configuration performed in the
+.Tn SCSI-Select
+menu, accessible at boot,
+is honored by this driver.
+This includes synchronous/asynchronous transfers,
+maximum synchronous negotiation rate,
+wide transfers,
+disconnection,
+and the host adapter's
+.Tn SCSI
+ID.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec
+.Tn AIC7901
+host adapter chip
+.It
+Adaptec
+.Tn AIC7901A
+host adapter chip
+.It
+Adaptec
+.Tn AIC7902
+host adapter chip
+.It
+Adaptec
+.Tn 29320
+host adapter
+.It
+Adaptec
+.Tn 39320
+host adapter
+.It
+Many motherboards with on-board
+.Tn SCSI
+support
+.El
+.Sh SEE ALSO
+.Xr ahc 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.7 .
+.Sh AUTHORS
+The
+.Nm
+driver, the
+.Tn AIC7xxx
+sequencer-code assembler,
+and the firmware running on the aic79xx chips was written by
+.An Justin T. Gibbs .
+This manual page is based on the
+.Xr ahc 4
+manual page.
+.Sh BUGS
+The current generation of 79xx chips do not support target mode in Ultra320
+mode.
+Target mode in general has not been well tested in this driver.
diff --git a/share/man/man4/aibs.4 b/share/man/man4/aibs.4
new file mode 100644
index 000000000000..b955f0f094d2
--- /dev/null
+++ b/share/man/man4/aibs.4
@@ -0,0 +1,207 @@
+.\" $FreeBSD$
+.\" $NetBSD: aibs.4,v 1.2 2010/02/09 05:37:25 cnst Exp $
+.\" $OpenBSD: aibs.4,v 1.4 2009/07/30 06:30:45 jmc Exp $
+.\"
+.\" Copyright (c) 2009/2010 Constantine A. Murenin <cnst++@FreeBSD.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd April 4, 2010
+.Dt AIBS 4
+.Os
+.Sh NAME
+.Nm aibs
+.Nd "ASUSTeK AI Booster ACPI ATK0110 voltage, temperature and fan sensor"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device aibs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+aibs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the voltage, temperature and fan sensors
+available through the
+.Tn ATK0110
+.Tn ASOC
+.Tn ACPI
+device
+on
+.Tn ASUSTeK
+motherboards.
+The number of sensors of each type,
+as well as the description of each sensor,
+varies according to the motherboard.
+.Pp
+The driver supports an arbitrary set of sensors,
+provides descriptions regarding what each sensor is used for,
+and reports the current values as well as
+the supposed range specifications of each sensor's input
+as defined by the motherboard manufacturer through
+.Tn ACPI .
+.Pp
+The range specifications are as follows:
+.Bl -bullet
+.It
+Voltage sensors have a lower and an upper range specification.
+.It
+Temperature sensors have two upper specifications.
+.It
+Fan sensors may either have only the lower specification,
+or, depending on the
+.Tn DSDT ,
+one lower and one upper specification.
+.El
+.Pp
+Sensor readings and the range specifications are made available through the
+.Xr sysctl 3
+interface,
+and can be monitored with
+.Xr sysctl 8 .
+For example, on an ASUS V3-P5G965 barebone:
+.Bd -literal -offset indent
+> sysctl dev.aibs.0.{volt,temp,fan}
+dev.aibs.0.volt.0: 1192 850 1600
+dev.aibs.0.volt.1: 3312 2970 3630
+dev.aibs.0.volt.2: 5017 4500 5500
+dev.aibs.0.volt.3: 12302 10200 13800
+dev.aibs.0.temp.0: 28.0C 80.0C 95.0C
+dev.aibs.0.temp.1: 55.0C 60.0C 95.0C
+dev.aibs.0.fan.0: 878 600 7200
+dev.aibs.0.fan.1: 0 700 7200
+.Pp
+> sysctl -d dev.aibs.0.{volt,temp,fan}
+dev.aibs.0.volt:
+dev.aibs.0.volt.0: Vcore Voltage
+dev.aibs.0.volt.1: +3.3 Voltage
+dev.aibs.0.volt.2: +5 Voltage
+dev.aibs.0.volt.3: +12 Voltage
+dev.aibs.0.temp:
+dev.aibs.0.temp.0: CPU Temperature
+dev.aibs.0.temp.1: MB Temperature
+dev.aibs.0.fan:
+dev.aibs.0.fan.0: CPU FAN Speed
+dev.aibs.0.fan.1: CHASSIS FAN Speed
+.Ed
+.Pp
+Generally, sensors provided by the
+.Nm
+driver may also be supported by certain other drivers or utilities
+that access the
+.Tn ISA /
+.Tn LPC
+or
+.Tn I2C /
+.Tn SMBus
+devices directly.
+The precise collection of
+.Nm
+sensors is comprised of the sensors
+specifically utilised in the motherboard
+design, which may be supported through
+a combination of one or more physical hardware monitoring chips.
+.Pp
+The
+.Nm
+driver, however, provides the following advantages
+when compared to the native hardware monitoring drivers or other utilities:
+.Bl -bullet
+.It
+Sensor values from
+.Nm
+are expected to be more reliable.
+For example, voltage sensors in many hardware monitoring chips
+can only sense voltage from 0 to 2 or 4 volts, and the excessive
+voltage is removed by the resistors, which may vary with the motherboard
+and with the voltage that is being sensed.
+In
+.Nm ,
+the required resistor factors are provided by
+the motherboard manufacturer through
+.Tn ACPI ;
+in the native drivers, the resistor factors
+are encoded into the driver based on the chip manufacturer's recommendations.
+In essence, sensor values from
+.Nm
+are very likely to be identical to the readings from the
+Hardware Monitor screen in the BIOS.
+.It
+Sensor descriptions from
+.Nm
+are more likely to match the markings on the motherboard.
+.It
+Sensor range specifications are supported by
+.Nm .
+The range specification is reported
+for each individual sensor as suggested by the motherboard manufacturer.
+For example, the threshold for the CPU temperature sensor is likely
+to be significantly higher than that for the chassis temperature sensor.
+.It
+Support for newer chips in
+.Nm .
+Newer chips may miss a native driver,
+but should be supported through
+.Nm
+regardless.
+.El
+.Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr acpi 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.7 ,
+.Dx 2.5 ,
+.Nx 6.0
+and
+.Fx 9.0 .
+.Pp
+An earlier version of the driver,
+.Nm acpi_aiboost ,
+first appeared in
+.Fx 7.0
+and
+.Nx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for
+.Ox ,
+.Dx ,
+.Nx
+and
+.Fx
+by
+.An Constantine A. Murenin Aq cnst@FreeBSD.org ,
+Raouf Boutaba Research Group,
+David R. Cheriton School of Computer Science,
+University of Waterloo.
+.Pp
+An earlier version of the driver, named
+.Nm acpi_aiboost ,
+was written for
+.Fx
+by
+.An Takanori Watanabe .
diff --git a/share/man/man4/aio.4 b/share/man/man4/aio.4
new file mode 100644
index 000000000000..8e773d96ee02
--- /dev/null
+++ b/share/man/man4/aio.4
@@ -0,0 +1,68 @@
+.\"-
+.\" Copyright (c) 2002 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 24, 2002
+.Dt AIO 4
+.Os
+.Sh NAME
+.Nm aio
+.Nd asynchronous I/O
+.Sh SYNOPSIS
+To link into the kernel:
+.Cd "options VFS_AIO"
+.Pp
+To load as a kernel loadable module:
+.Dl kldload aio
+.Sh DESCRIPTION
+The
+.Nm
+facility provides system calls for asynchronous I/O.
+It is available both as a kernel option for static inclusion and as a
+dynamic kernel module.
+.Sh SEE ALSO
+.Xr aio_cancel 2 ,
+.Xr aio_error 2 ,
+.Xr aio_read 2 ,
+.Xr aio_return 2 ,
+.Xr aio_suspend 2 ,
+.Xr aio_waitcomplete 2 ,
+.Xr aio_write 2 ,
+.Xr lio_listio 2 ,
+.Xr config 8 ,
+.Xr kldload 8 ,
+.Xr kldunload 8
+.Sh HISTORY
+The
+.Nm
+facility appeared as a kernel option in
+.Fx 3.0 .
+The
+.Nm
+kernel module appeared in
+.Fx 5.0 .
diff --git a/share/man/man4/alc.4 b/share/man/man4/alc.4
new file mode 100644
index 000000000000..9fe3c291e7be
--- /dev/null
+++ b/share/man/man4/alc.4
@@ -0,0 +1,168 @@
+.\" Copyright (c) 2009 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 9, 2010
+.Dt ALC 4
+.Os
+.Sh NAME
+.Nm alc
+.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device alc"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_alc_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for Atheros AR813x and AR815x PCI
+Express Gigabit/Fast Ethernet controllers.
+.Pp
+All LOMs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for transmit, TCP
+segmentation offload (TSO), hardware VLAN tag stripping/insertion
+features, Wake On Lan (WOL) and an interrupt moderation mechanism
+as well as a 64-bit multicast hash filter.
+.Pp
+The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144
+bytes, respectively), which can be configured via the interface
+MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+device driver provides support for the following Ethernet controllers:
+.Pp
+.Bl -bullet -compact
+.It
+Atheros AR8131 PCI Express Gigabit Ethernet controller
+.It
+Atheros AR8132 PCI Express Fast Ethernet controller
+.It
+Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller
+.It
+Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller
+.It
+Atheros AR8152 v1.1 PCI Express Fast Ethernet controller
+.It
+Atheros AR8152 v2.0 PCI Express Fast Ethernet controller
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.alc.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.alc.msix_disable
+This tunable disables MSI-X support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.alc.%d.int_rx_mod
+Maximum amount of time to delay receive interrupt processing in
+units of 1us.
+The accepted range is 0 to 130000, the default is 100(100us).
+Value 0 completely disables the interrupt moderation.
+.It Va dev.alc.%d.int_tx_mod
+Maximum amount of time to delay transmit interrupt processing in
+units of 1us.
+The accepted range is 0 to 130000, the default is 1000(1ms).
+Value 0 completely disables the interrupt moderation.
+.It Va dev.alc.%d.process_limit
+Maximum amount of Rx frames to be processed in the event loop before
+rescheduling a taskqueue.
+The accepted range is 32 to 255, the default value is 64 events.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
+It first appeared in
+.Fx 8.0 .
diff --git a/share/man/man4/ale.4 b/share/man/man4/ale.4
new file mode 100644
index 000000000000..d5102a157e85
--- /dev/null
+++ b/share/man/man4/ale.4
@@ -0,0 +1,162 @@
+.\" Copyright (c) 2008 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 12, 2008
+.Dt ALE 4
+.Os
+.Sh NAME
+.Nm ale
+.Nd Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device ale"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ale_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for Atheros AR8121 PCI Express
+Gigabit Ethernet controllers and Atheros AR8113/AR8114 PCI
+Express Fast Ethernet controllers.
+.Pp
+All LOMs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for both receive and transmit,
+TCP segmentation offload (TSO), hardware VLAN tag stripping/insertion
+features, Wake On Lan (WOL) and an interrupt coalescing/moderation
+mechanism as well as a 64-bit multicast hash filter.
+.Pp
+The AR8121 also supports Jumbo Frames (up to 8132 bytes), which can
+be configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+device driver provides support for the following Ethernet controllers:
+.Pp
+.Bl -bullet -compact
+.It
+Atheros AR8113 PCI Express Fast Ethernet controller
+.It
+Atheros AR8114 PCI Express Fast Ethernet controller
+.It
+Atheros AR8121 PCI Express Gigabit Ethernet controller
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.ale.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.ale.msix_disable
+This tunable disables MSI-X support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.ale.%d.int_rx_mod
+Maximum amount of time to delay receive interrupt processing in
+units of 1us.
+The accepted range is 0 to 130000, the default is 30(30us).
+Value 0 completely disables the interrupt moderation.
+.It Va dev.ale.%d.int_tx_mod
+Maximum amount of time to delay transmit interrupt processing in
+units of 1us.
+The accepted range is 0 to 130000, the default is 1000(1ms).
+Value 0 completely disables the interrupt moderation.
+.It Va dev.ale.%d.process_limit
+Maximum amount of Rx frames to be processed in the event loop before
+rescheduling a taskqueue.
+The accepted range is 32 to 255, the default value is 128 events.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
+It first appeared in
+.Fx 7.1 .
diff --git a/share/man/man4/alpm.4 b/share/man/man4/alpm.4
new file mode 100644
index 000000000000..43ee4596178e
--- /dev/null
+++ b/share/man/man4/alpm.4
@@ -0,0 +1,62 @@
+.\" Copyright (c) 1999 Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 1999
+.Dt ALPM 4
+.Os
+.Sh NAME
+.Nm alpm
+.Nd Acer Aladdin 15x3 Power Management controller driver
+.Sh SYNOPSIS
+.Cd device smbus
+.Cd device smb
+.Cd device alpm
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn Aladdin 15x3 Power Management Unit .
+Currently, only smbus controller
+function is implemented.
+.Pp
+The embedded SMBus controller of the Aladdin chipset may give you access
+to the monitoring facilities of your mainboard.
+See
+.Xr smb 4
+for writing user code to fetch voltages, temperature and so on from the
+monitoring chip of your mainboard.
+.Sh SEE ALSO
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu Aq nsouch@FreeBSD.org
+.Sh BUGS
+Only polling mode is supported.
diff --git a/share/man/man4/altq.4 b/share/man/man4/altq.4
new file mode 100644
index 000000000000..7b6fc4c0a9da
--- /dev/null
+++ b/share/man/man4/altq.4
@@ -0,0 +1,193 @@
+.\"
+.\" Copyright (c) 2004 Max Laier <mlaier@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 9, 2011
+.Dt ALTQ 4
+.Os
+.Sh NAME
+.Nm ALTQ
+.Nd "alternate queuing of network packets"
+.Sh SYNOPSIS
+.Cd options ALTQ
+.Pp
+.Cd options ALTQ_CBQ
+.Cd options ALTQ_RED
+.Cd options ALTQ_RIO
+.Cd options ALTQ_HFSC
+.Cd options ALTQ_CDNR
+.Cd options ALTQ_PRIQ
+.Sh DESCRIPTION
+The
+.Nm
+framework provides several disciplines for queuing outgoing network packets.
+This is done by modifications to the interface packet queues.
+See
+.Xr altq 9
+for details.
+.Pp
+The user interface for
+.Nm
+is implemented by the
+.Xr pfctl 8
+utility, so please refer to the
+.Xr pfctl 8
+and the
+.Xr pf.conf 5
+manpages for a complete description of the
+.Nm
+capabilities and how to use it.
+.Ss Kernel Options
+The following options in the kernel configuration file are related to
+.Nm
+operation:
+.Pp
+.Bl -tag -width ".Dv ALTQ_DEBUG" -compact
+.It Dv ALTQ
+Enable
+.Nm .
+.It Dv ALTQ_CBQ
+Build the
+.Dq "Class Based Queuing"
+discipline.
+.It Dv ALTQ_RED
+Build the
+.Dq "Random Early Detection"
+extension.
+.It Dv ALTQ_RIO
+Build
+.Dq "Random Early Drop"
+for input and output.
+.It Dv ALTQ_HFSC
+Build the
+.Dq "Hierarchical Packet Scheduler"
+discipline.
+.It Dv ALTQ_CDNR
+Build the traffic conditioner.
+This option is meaningless at the moment as the conditioner is not used by
+any of the available disciplines or consumers.
+.It Dv ALTQ_PRIQ
+Build the
+.Dq "Priority Queuing"
+discipline.
+.It Dv ALTQ_NOPCC
+Required if the TSC is unusable.
+.It Dv ALTQ_DEBUG
+Enable additional debugging facilities.
+.El
+.Pp
+Note that
+.Nm Ns -disciplines
+cannot be loaded as kernel modules.
+In order to use a certain discipline you have to build it into a custom
+kernel.
+The
+.Xr pf 4
+interface, that is required for the configuration process of
+.Nm
+can be loaded as a module.
+.Sh SUPPORTED DEVICES
+The driver modifications described in
+.Xr altq 9
+are required to use a certain network card with
+.Nm .
+They have been applied to the following hardware drivers:
+.Xr ae 4 ,
+.Xr age 4 ,
+.Xr alc 4 ,
+.Xr ale 4 ,
+.Xr an 4 ,
+.Xr ath 4 ,
+.Xr aue 4 ,
+.Xr axe 4 ,
+.Xr bce 4 ,
+.Xr bfe 4 ,
+.Xr bge 4 ,
+.Xr cas 4 ,
+.Xr cxgbe 4 ,
+.Xr dc 4 ,
+.Xr de 4 ,
+.Xr ed 4 ,
+.Xr em 4 ,
+.Xr ep 4 ,
+.Xr epair 4 ,
+.Xr et 4 ,
+.Xr fxp 4 ,
+.Xr gem 4 ,
+.Xr hme 4 ,
+.Xr igb 4 ,
+.Xr ipw 4 ,
+.Xr iwi 4 ,
+.Xr ixgbe 4 ,
+.Xr jme 4 ,
+.Xr le 4 ,
+.Xr msk 4 ,
+.Xr mxge 4 ,
+.Xr my 4 ,
+.Xr nfe 4 ,
+.Xr nge 4 ,
+.Xr npe 4 ,
+.Xr nve 4 ,
+.Xr qlxgb 4 ,
+.Xr ral 4 ,
+.Xr re 4 ,
+.Xr rl 4 ,
+.Xr rum 4 ,
+.Xr sf 4 ,
+.Xr sge 4 ,
+.Xr sis 4 ,
+.Xr sk 4 ,
+.Xr ste 4 ,
+.Xr stge 4 ,
+.Xr ti 4 ,
+.Xr txp 4 ,
+.Xr udav 4 ,
+.Xr ural 4 ,
+.Xr vge 4 ,
+.Xr vr 4 ,
+.Xr vte 4 ,
+.Xr wi 4 ,
+and
+.Xr xl 4 .
+.Pp
+The
+.Xr ndis 4
+framework also has support for
+.Nm
+and thus all encapsulated drivers.
+.Pp
+The
+.Xr tun 4
+and
+.Xr ng_iface 4
+pseudo drivers also do support
+.Nm .
+.Sh SEE ALSO
+.Xr pf 4 ,
+.Xr pf.conf 5 ,
+.Xr ipfw 8 ,
+.Xr pfctl 8 ,
+.Xr altq 9
diff --git a/share/man/man4/amdpm.4 b/share/man/man4/amdpm.4
new file mode 100644
index 000000000000..f791a28ba283
--- /dev/null
+++ b/share/man/man4/amdpm.4
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2001 Murray Stokely
+.\" Copyright (c) 1999 Takanori Watanabe
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 31, 2005
+.Dt AMDPM 4
+.Os
+.Sh NAME
+.Nm amdpm
+.Nd AMD 756/766/768/8111 Power Management controller driver
+.Sh SYNOPSIS
+.Cd device smbus
+.Cd device smb
+.Cd device amdpm
+.Sh DESCRIPTION
+This driver provides access to
+.Tn AMD 756/766/768/8111 Power management controllers .
+Currently, only the SMBus 1.0 controller function is implemented.
+The SMBus 2.0 functionality of the AMD 8111 controller is supported via the
+.Xr amdsmb 4
+driver.
+.Pp
+The embedded SMBus controller of the AMD 756 chipset may give you access
+to the monitoring facilities of your mainboard.
+See
+.Xr smb 4
+for writing user code to fetch voltages, temperature and so on from the
+monitoring chip of your mainboard.
+.Sh SEE ALSO
+.Xr amdsmb 4 ,
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.5 .
+.Sh AUTHORS
+.An -nosplit
+This driver was written by
+.An "Matthew C. Forman" .
+Based heavily on the
+.Nm alpm
+driver by
+.An Nicolas Souchu .
+This manual page was written by
+.An Murray Stokely Aq murray@FreeBSD.org .
+.Sh BUGS
+Only polling mode is supported.
diff --git a/share/man/man4/amdsbwd.4 b/share/man/man4/amdsbwd.4
new file mode 100644
index 000000000000..cfb2f79624d8
--- /dev/null
+++ b/share/man/man4/amdsbwd.4
@@ -0,0 +1,74 @@
+.\"-
+.\" Copyright (c) 2009 Andriy Gapon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 7, 2011
+.Dt AMDSBWD 4
+.Os
+.Sh NAME
+.Nm amdsbwd
+.Nd device driver for the AMD SB600/SB7xx/SB8xx watchdog timers
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device amdsbwd"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+amdsbwd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog timers present on
+AMD SB600, SB7xx and SB8xx southbridges.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.3
+and
+.Fx 8.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Andriy Gapon Aq avg@FreeBSD.org .
+This manual page was written by
+.An Andriy Gapon Aq avg@FreeBSD.org .
diff --git a/share/man/man4/amdsmb.4 b/share/man/man4/amdsmb.4
new file mode 100644
index 000000000000..c038584082f9
--- /dev/null
+++ b/share/man/man4/amdsmb.4
@@ -0,0 +1,54 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 31, 2005
+.Dt AMDSMB 4
+.Os
+.Sh NAME
+.Nm amdsmb
+.Nd "AMD-8111 SMBus 2.0 controller driver"
+.Sh SYNOPSIS
+.Cd "device smbus"
+.Cd "device smb"
+.Cd "device amdsmb"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the AMD-8111 SMBus 2.0 controller.
+.Sh SEE ALSO
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Ruslan Ermilov Aq ru@FreeBSD.org .
diff --git a/share/man/man4/amdtemp.4 b/share/man/man4/amdtemp.4
new file mode 100644
index 000000000000..52444f539a9b
--- /dev/null
+++ b/share/man/man4/amdtemp.4
@@ -0,0 +1,111 @@
+.\"-
+.\" Copyright (c) 2008 Rui Paulo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 23, 2012
+.Dt AMDTEMP 4
+.Os
+.Sh NAME
+.Nm amdtemp
+.Nd device driver for
+.Tn AMD
+processor on-die digital thermal sensor
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device amdtemp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+amdtemp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the on-die digital thermal sensor present
+in
+.Tn AMD
+Family 0Fh, 10h, 11h, 12h, 14h, and 15h processors.
+.Pp
+For Family 0Fh processors, the
+.Nm
+driver reports each core's temperature through sysctl nodes, named
+.Va dev.amdtemp.%d.core{0,1}.sensor{0,1} .
+The driver also creates
+.Va dev.cpu.%d.temperature
+in the corresponding CPU device's sysctl tree, displaying the maximum
+temperature of the two sensors located in each CPU core.
+.Pp
+For Family 10h, 11h, 12h, 14h, and 15h processors, the driver reports each
+package's temperature through a sysctl node, named
+.Va dev.amdtemp.%d.core0.sensor0 .
+The driver also creates
+.Va dev.cpu.%d.temperature
+in the corresponding CPU device's sysctl tree, displaying the temperature
+of the shared sensor located in each CPU package.
+.Sh SYSCTL VARIABLES
+The following variable is available as both
+.Xr sysctl 8
+variable and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.amdtemp.%d.sensor_offset
+.El
+Add the given offset to the temperature of the sensor.
+Default is 0.
+.Sh SEE ALSO
+.Xr loader 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+.An Rui Paulo Aq rpaulo@FreeBSD.org
+.An Norikatsu Shigemura Aq nork@FreeBSD.org
+.An Jung-uk Kim Aq jkim@FreeBSD.org
+.Sh CAVEATS
+For Family 10h and later processors,
+.Do
+(the reported temperature) is a non-physical temperature measured on
+an arbitrary scale and it does not represent an actual physical
+temperature like die or case temperature.
+Instead, it specifies the processor temperature relative to the point
+at which the system must supply the maximum cooling for the processor's
+specified maximum case temperature and maximum thermal power dissipation
+.Dc
+according to
+.Rs
+.%T BIOS and Kernel Developer's Guide (BKDG) for AMD Processors
+.%U http://developer.amd.com/documentation/guides/Pages/default.aspx
+.Re
diff --git a/share/man/man4/amr.4 b/share/man/man4/amr.4
new file mode 100644
index 000000000000..ad94ffe2c8dc
--- /dev/null
+++ b/share/man/man4/amr.4
@@ -0,0 +1,241 @@
+.\"
+.\" Copyright (c) 2000 Jeroen Ruigrok van der Werven
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2006
+.Dt AMR 4
+.Os
+.Sh NAME
+.Nm amr
+.Nd MegaRAID SCSI/ATA/SATA RAID driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device amr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+amr_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for LSI Logic MegaRAID SCSI, ATA and SATA
+RAID controllers and legacy American Megatrends MegaRAID
+SCSI RAID controllers, including models relabeled
+and sold by Dell and Hewlett-Packard.
+.Pp
+LSI MegaRAID SAS controllers are supported by
+.Xr mfi 4
+and will not work with this driver.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+MegaRAID SATA 150-4
+.It
+MegaRAID SATA 150-6
+.It
+MegaRAID SATA 300-4X
+.It
+MegaRAID SATA 300-8X
+.It
+MegaRAID SCSI 320-1E
+.It
+MegaRAID SCSI 320-2E
+.It
+MegaRAID SCSI 320-4E
+.It
+MegaRAID SCSI 320-0X
+.It
+MegaRAID SCSI 320-2X
+.It
+MegaRAID SCSI 320-4X
+.It
+MegaRAID SCSI 320-0
+.It
+MegaRAID SCSI 320-1
+.It
+MegaRAID SCSI 320-2
+.It
+MegaRAID SCSI 320-4
+.It
+MegaRAID Series 418
+.It
+MegaRAID i4 133 RAID
+.It
+MegaRAID Elite 1500 (Series 467)
+.It
+MegaRAID Elite 1600 (Series 493)
+.It
+MegaRAID Elite 1650 (Series 4xx)
+.It
+MegaRAID Enterprise 1200 (Series 428)
+.It
+MegaRAID Enterprise 1300 (Series 434)
+.It
+MegaRAID Enterprise 1400 (Series 438)
+.It
+MegaRAID Enterprise 1500 (Series 467)
+.It
+MegaRAID Enterprise 1600 (Series 471)
+.It
+MegaRAID Express 100 (Series 466WS)
+.It
+MegaRAID Express 200 (Series 466)
+.It
+MegaRAID Express 300 (Series 490)
+.It
+MegaRAID Express 500 (Series 475)
+.It
+Dell PERC
+.It
+Dell PERC 2/SC
+.It
+Dell PERC 2/DC
+.It
+Dell PERC 3/DCL
+.It
+Dell PERC 3/QC
+.It
+Dell PERC 4/DC
+.It
+Dell PERC 4/IM
+.It
+Dell PERC 4/SC
+.It
+Dell PERC 4/Di
+.It
+Dell PERC 4e/DC
+.It
+Dell PERC 4e/Di
+.It
+Dell PERC 4e/Si
+.It
+Dell PERC 4ei
+.It
+HP NetRAID-1/Si
+.It
+HP NetRAID-3/Si (D4943A)
+.It
+HP Embedded NetRAID
+.It
+Intel RAID Controller SRCS16
+.It
+Intel RAID Controller SRCU42X
+.El
+.Sh DIAGNOSTICS
+.Ss Driver initialisation/shutdown phase
+.Bl -diag
+.It amr%d: memory window not available
+.It amr%d: I/O window not available
+.Pp
+The PCI BIOS did not allocate resources necessary for the correct operation of
+the controller.
+The driver cannot attach to this controller.
+.It amr%d: busmaster bit not set, enabling
+.Pp
+The PCI BIOS did not enable busmaster DMA,
+which is required for the correct operation of the controller.
+The driver has enabled this bit and initialisation will proceed.
+.It amr%d: can't allocate register window
+.It amr%d: can't allocate interrupt
+.It amr%d: can't set up interrupt
+.It amr%d: can't allocate parent DMA tag
+.It amr%d: can't allocate buffer DMA tag
+.It amr%d: can't allocate scatter/gather DMA tag
+.It amr%d: can't allocate s/g table
+.It amr%d: can't allocate mailbox tag
+.It amr%d: can't allocate mailbox memory
+.Pp
+A resource allocation error occurred while initialising the driver;
+initialisation has failed and the driver will not attach to this controller.
+.It amr%d: can't obtain configuration data from controller
+.It amr%d: can't obtain product data from controller
+.Pp
+The driver was unable to obtain vital configuration data from the controller.
+Initialisation has failed and the driver will not attach to this controller.
+.It amr%d: can't establish configuration hook
+.It amr%d: can't scan controller for drives
+.Pp
+The scan for logical drives managed by the controller failed.
+No drives will be attached.
+.It amr%d: device_add_child failed
+.It amr%d: bus_generic_attach returned %d
+.Pp
+Creation of the logical drive instances failed;
+attachment of one or more logical drives may have been aborted.
+.It amr%d: flushing cache...
+.Pp
+The controller cache is being flushed prior to shutdown or detach.
+.El
+.Ss Operational diagnostics
+.Bl -diag
+.It amr%d: I/O beyond end of unit (%u,%d > %u)
+.Pp
+A partitioning error or disk corruption has caused an I/O request
+beyond the end of the logical drive.
+This may also occur if FlexRAID Virtual Sizing is enabled and
+an I/O operation is attempted on a portion of the virtual drive
+beyond the actual capacity available.
+.It amr%d: polled command timeout
+.Pp
+An initialisation command timed out.
+The initialisation process may fail as a result.
+.It amr%d: bad slot %d completed
+.Pp
+The controller reported completion of a command that the driver did not issue.
+This may result in data corruption,
+and suggests a hardware or firmware problem with the system or controller.
+.It amr%d: I/O error - %x
+.Pp
+An I/O error has occurred.
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr mfi 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Mike Smith Aq msmith@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Mike Smith Aq msmith@FreeBSD.org
+and
+.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org .
diff --git a/share/man/man4/an.4 b/share/man/man4/an.4
new file mode 100644
index 000000000000..608a4edf9a0c
--- /dev/null
+++ b/share/man/man4/an.4
@@ -0,0 +1,144 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt AN 4
+.Os
+.Sh NAME
+.Nm an
+.Nd "Aironet Communications 4500/4800 wireless network adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device an"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_an_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Aironet Communications 4500 and 4800
+wireless network adapters and variants, including the following:
+.Pp
+.Bl -bullet -compact -offset indent
+.It
+Aironet Communications 4500 and 4800 series
+.It
+Cisco Aironet 340 and 350 series
+.It
+Xircom Wireless Ethernet Adapter
+.El
+.Pp
+Support for these devices include the ISA, PCI and PCMCIA
+varieties.
+The Aironet 4500 series adapters operate at 1 and 2Mbps while
+the Aironet 4800 series and Cisco adapters can operate at 1, 2, 5.5 and 11Mbps.
+The ISA, PCI
+and PCMCIA devices are all based on the same core PCMCIA modules
+and all have the same programming interface, however unlike the
+Lucent WaveLAN/IEEE cards, the ISA and PCI cards appear to the
+host as normal ISA and PCI devices and do not require any PCCARD
+support.
+.Pp
+The PCMCIA Aironet cards require PC Card support, including the
+kernel
+.Xr pccard 4
+driver.
+ISA cards can either be configured to use ISA Plug and Play
+or to use a particular I/O address and IRQ
+by properly setting the DIP switches on the board.
+(The default
+switch setting is for Plug and Play.)
+The
+.Nm
+driver has Plug and Play support and will work in either configuration,
+however when using a hard-wired I/O address and IRQ, the driver
+configuration and the NIC's switch settings must agree.
+PCI cards
+require no switch settings of any kind and will be automatically
+probed and attached.
+.Pp
+All host/device interaction with the Aironet cards is via programmed I/O.
+The Aironet devices support 802.11 and 802.3 frames, power management,
+BSS (infrastructure) and IBSS (ad-hoc) operation modes.
+The
+.Nm
+driver encapsulates all IP and ARP traffic as 802.11 frames, however
+it can receive either 802.11 or 802.3 frames.
+Transmit speed is
+selectable between 1Mbps, 2Mbps, 5.5Mbps, 11Mbps or
+"auto" (the NIC automatically chooses the best speed).
+.Pp
+By default, the
+.Nm
+driver configures the Aironet card for infrastructure operation.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "an%d: init failed"
+The Aironet card failed to become ready after an initialization command was
+issued.
+.It "an%d: failed to allocate %d bytes on NIC"
+The driver was unable to allocate memory for transmit frames in the
+NIC's on-board RAM.
+.It "an%d: device timeout"
+The Aironet card failed to generate an interrupt to acknowledge a transmit
+command.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr wlan 4 ,
+.Xr ancontrol 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
diff --git a/share/man/man4/apic.4 b/share/man/man4/apic.4
new file mode 100644
index 000000000000..0856232f2afe
--- /dev/null
+++ b/share/man/man4/apic.4
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 20, 2011
+.Dt APIC 4
+.Os
+.Sh NAME
+.Nm apic
+.Nd Advanced Programmable Interrupt Controller (APIC) driver
+.Sh SYNOPSIS
+This driver is a mandatory part of amd64 kernel.
+To compile this driver into i386 or pc98 kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device apic"
+.Ed
+.Pp
+The following tunable is settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.apic. Ns Ar X Ns Va .clock
+controls event timers functionality support. Setting to 0, disables it.
+Default value is 1.
+.It Va hint.apic. Ns Ar X Ns Va .disabled
+Set this to 1 to disable APIC support, falling back to the legacy PIC.
+.El
+.Sh DESCRIPTION
+There are two components in the Intel APIC system, the local APIC (LAPIC)
+and the I/O APIC.
+There is one local APIC in each CPU in the system.
+There is typically one I/O APIC for each peripheral bus in the system.
+.Pp
+Local APICs manage all external interrupts for a specific processor.
+In addition, they are able to accept and generate inter-processor interrupts
+(IPIs).
+.Pp
+I/O APICs contain a redirection table, which is used to route the interrupts
+they receive from peripheral buses to one or more local APICs.
+.Pp
+Each local APIC includes one 32-bit programmable timer.
+This driver uses them to supply kernel with one event timer named "LAPIC".
+Event timer provided by the driver supports both one-shot an periodic modes.
+Because of local APIC nature it is per-CPU.
+The timer frequency is not reported by the platform and so automatically
+measured by the driver on the first use.
+Depending on CPU model this timer may stop in C3 and deeper CPU sleep states.
+Driver automatically adjusts event timer priority and reports it to prevent
+entering dangerous sleep states when it is used.
+.Sh SEE ALSO
+.Xr atrtc 4 ,
+.Xr attimer 4 ,
+.Xr eventtimers 4 ,
+.Xr hpet 4
diff --git a/share/man/man4/arcmsr.4 b/share/man/man4/arcmsr.4
new file mode 100644
index 000000000000..499c34efc13d
--- /dev/null
+++ b/share/man/man4/arcmsr.4
@@ -0,0 +1,158 @@
+.\" Copyright (c) 2005 Scott Long
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 25, 2010
+.Dt ARCMSR 4
+.Os
+.Sh NAME
+.Nm arcmsr
+.Nd Areca RAID Controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device da"
+.Cd "device arcmsr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+arcmsr_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Areca ARC-11xx, ARC-12xx, ARC-13xx,
+ARC-16xx and ARC-18xx series of SAS and SATA RAID controllers.
+These controllers feature RAID-0, 1, 3, 5, 6, and 10 and
+JBOD acceleration for up to 16 SATA drives.
+RAID level and stripe level
+migration, online capacity expansion, hot insertion/removal, automatic failover
+and rebuild, and SMART are also supported.
+Access to the arrays is provided
+via the SCSI CAM
+.Pa /dev/da?
+device nodes.
+A management interface is also present via the
+.Pa /dev/arcmsr?
+device node.
+Management tools for i386 and amd64 are available from Areca.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+ARC-1110
+.It
+ARC-1120
+.It
+ARC-1130
+.It
+ARC-1160
+.It
+ARC-1170
+.It
+ARC-1110ML
+.It
+ARC-1120ML
+.It
+ARC-1130ML
+.It
+ARC-1160ML
+.It
+ARC-1200
+.It
+ARC-1201
+.It
+ARC-1210
+.It
+ARC-1212
+.It
+ARC-1220
+.It
+ARC-1222
+.It
+ARC-1230
+.It
+ARC-1231
+.It
+ARC-1260
+.It
+ARC-1261
+.It
+ARC-1270
+.It
+ARC-1280
+.It
+ARC-1210ML
+.It
+ARC-1220ML
+.It
+ARC-1231ML
+.It
+ARC-1261ML
+.It
+ARC-1280ML
+.It
+ARC-1380
+.It
+ARC-1381
+.It
+ARC-1680
+.It
+ARC-1681
+.It
+ARC-1880
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/arcmsr?" -compact
+.It Pa /dev/da?
+Array block device
+.It Pa /dev/arcmsr?
+Management interface
+.El
+.Sh SEE ALSO
+.Xr da 4 ,
+.Xr scbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+The driver was written by
+.An Erich Chen Aq erich@areca.com.tw .
+.Sh BUGS
+The driver has been tested on i386 and amd64.
+It likely requires additional
+work to function on big-endian architectures.
diff --git a/share/man/man4/asmc.4 b/share/man/man4/asmc.4
new file mode 100644
index 000000000000..6ad37442e0cd
--- /dev/null
+++ b/share/man/man4/asmc.4
@@ -0,0 +1,163 @@
+.\"-
+.\" Copyright (c) 2007, 2008, 2009 Rui Paulo <rpaulo@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 27, 2009
+.Dt ASMC 4
+.Os
+.Sh NAME
+.Nm asmc
+.Nd device driver for the Apple System Management Console (SMC)
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device asmc"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+asmc_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver controls the Apple System Management Console (SMC for short)
+found on Intel Apple systems.
+.Pp
+The SMC is known to be found on the following systems:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+MacBook
+.It
+MacBook Pro
+.It
+Intel MacMini
+.It
+Mac Pro
+.It
+MacBook Air
+.It
+Intel iMac
+.El
+.Pp
+With this driver, you can configure your keyboard backlight
+brightness, check temperatures of several sensors, check the speed of
+the internal fans and check the status of the Sudden Motion Sensor.
+.Pp
+Variables related to the SMC control and inspection are exported via
+.Xr sysctl 3
+under the device tree
+.Va dev.asmc .
+.Sh KEYBOARD BACKLIGHT
+On
+.Tn MacBook Pro
+systems, you can control the keyboard brightness by writing a value to
+the
+.Va dev.asmc.%d.light.control
+sysctl MIB.
+.Pp
+The following sysctl MIBs contains the raw value returned by the left
+and right light sensors:
+.Va dev.asmc.%d.light.left
+or
+.Va dev.asmc.%d.light.right .
+.Sh TEMPERATURES
+The number of temperature sensors and their description varies among
+systems.
+You can inspect the temperature sensors on your system by traversing
+the
+.Va dev.asmc.temp
+sysctl MIB.
+.Pp
+All values are in degrees celsius.
+.Sh SYSTEM FANS
+The
+.Va dev.asmc.fan.%d
+sysctl tree contains the leaf nodes
+.Va speed ,
+.Va safespeed ,
+.Va minspeed ,
+.Va maxspeed
+and
+.Va targetspeed .
+Each of these leaf nodes represent the current fan speed, the safest
+minimum fan speed, the minimum speed and the maximum speed
+respectively.
+.Pp
+All values are in RPM.
+.Sh SUDDEN MOTION SENSOR
+The Sudden Motion Sensor (SMS for short) is a device that detects
+laptop movement and notifies the operating system via an interrupt.
+The sysctl MIBs present under
+.Va dev.asmc.sms
+all relate to the SMS.
+.Pp
+The most interesting usage of this device is to park the disk heads
+when the laptop is moved harshly.
+First, you need to install
+.Xr ataidle 8 Pq Pa ports/sysutils/ataidle
+and then configure
+.Xr devd 8
+the following way:
+.Bd -literal -offset indent
+notify 0 {
+ match "system" "ACPI";
+ match "subsystem" "asmc";
+ action "/usr/local/sbin/ataidle -s X Y";
+};
+.Ed
+.Pp
+Do not forget to change the
+.Ar X
+and
+.Ar Y
+values in the command above.
+.Pp
+Also, please note that parking the disk heads too many times can
+dramatically reduce your hard drive's life span.
+Do not rely solely on
+the SMS to protect your hard drive: good care and common sense can
+increase your hard drive's life.
+.Sh SEE ALSO
+.Xr ataidle 8 Pq Pa ports/sysutils/ataidle ,
+.Xr devd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+.An Rui Paulo Aq rpaulo@FreeBSD.org
+(Google Summer of Code project).
+.Sh BUGS
+Support for the latest models was never tested and is most likely not
+fully working.
diff --git a/share/man/man4/asr.4 b/share/man/man4/asr.4
new file mode 100644
index 000000000000..955eb0f3655a
--- /dev/null
+++ b/share/man/man4/asr.4
@@ -0,0 +1,115 @@
+.\" Copyright (c) 2003 David E. O'Brien
+.\" Copyright (c) 2000 Adaptec, Inc.
+.\" All rights reserved.
+.\"
+.\" Manpage cleanup by: Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2004
+.Dt ASR 4
+.Os
+.Sh NAME
+.Nm asr
+.Nd driver for Adaptec I2O based SCSI/ATA host bus adapters
+.Sh SYNOPSIS
+.Cd "device asr"
+.Sh DESCRIPTION
+The Adaptec
+.Nm
+driver provides access to disks
+and disk arrays controlled by I2O based host bus adapters and
+SmartRAID SCSI RAID adapters through the standard SCSI disk
+.Xr da 4
+interface.
+.Pp
+The supported adapters provide 64 bit PCI,
+Compact PCI, Zero Channel PCI,
+and up to four channels of Ultra2, Ultra 160, or Ultra320 SCSI,
+or two channels of 1GB Fibre.
+All support RAID-0, RAID-1, RAID-10, RAID-5 and RAID-50 arrays.
+All SCSI target types are supported.
+For the ATA based controllers, one IDE drive per channel is supported.
+Hot-swapping of IDE drives is not supported at this time.
+.Pp
+All host bus adapters must be configured
+before they can be used with any operating system.
+Please contact Adaptec directly to obtain the latest information
+on configuration utilities for the adapters.
+Currently there are both a Motif based GUI configuration utility
+and a CLI based configuration utility available from the Adaptec Web site.
+The cards and arrays can also be configured via the BIOS based configuration
+tool (SMOR).
+.Sh HARDWARE
+The adapters currently supported by the
+.Nm
+driver include the following:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec Zero-Channel SCSI RAID 2000S, 2005S, 2010S, 2015S
+.It
+Adaptec SCSI RAID 2100S, 2110S
+.It
+Adaptec ATA-100 RAID 2400A
+.It
+Adaptec SCSI RAID 3200S, 3210S
+.It
+Adaptec SCSI RAID 3400S, 3410S
+.It
+Adaptec SmartRAID PM1554
+.It
+Adaptec SmartRAID PM1564
+.It
+Adaptec SmartRAID PM2554
+.It
+Adaptec SmartRAID PM2564
+.It
+Adaptec SmartRAID PM2664
+.It
+Adaptec SmartRAID PM2754
+.It
+Adaptec SmartRAID PM2865
+.It
+Adaptec SmartRAID PM3754
+.It
+Adaptec SmartRAID PM3755U2B / SmartRAID V Millennium
+.It
+Adaptec SmartRAID PM3757
+.It
+DEC KZPCC-AC (LVD 1-ch, 4MB or 16MB cache),
+DEC KZPCC-CE (LVD 3-ch, 64MB cache),
+DEC KZPCC-XC (LVD 1-ch, 16MB cache),
+DEC KZPCC-XE (LVD 3-ch, 64MB cache) -- rebadged SmartRAID V Millennium
+.El
+.Sh FILES
+.Bl -tag -width "/dev/asr*" -compact
+.It Pa /dev/asr*
+Adaptec SCSI RAID control nodes
+.El
+.Sh NOTES
+The ATA based controllers present their devices as SCSI-like devices via CAM.
+For IDE drives attached to these cards, a subset of standard SCSI commands
+and mode pages are understood via translation performed in the card's firmware.
+.Sh SEE ALSO
+.Xr da 4
+.Sh HISTORY
+The
+.Nm
+(Adaptec SCSI RAID)
+driver first appeared as the dpti2o driver under BSDi
+.Bsx 3.2 ,
+then under
+.Fx 2.2.8
+and was ported over to the CAM layer represented in 4.0.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was kindly donated by Adaptec
+and is maintained by
+.An Mark Salyzyn Aq mark_salyzyn@adaptec.com .
+This manual page was written by
+.An Mark Salyzyn
+and fixed up by
+.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org .
diff --git a/share/man/man4/ata.4 b/share/man/man4/ata.4
new file mode 100644
index 000000000000..d2ac57aaabca
--- /dev/null
+++ b/share/man/man4/ata.4
@@ -0,0 +1,268 @@
+.\" Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 17, 2011
+.Dt ATA 4
+.Os
+.Sh NAME
+.Nm ata
+.Nd generic ATA/SATA controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ata"
+.Cd "options ATA_CAM"
+.Ed
+.Pp
+Alternatively, to load the driver as set of modules at boot time,
+place some of the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ata_load="YES"
+
+atacard_load="YES"
+ataisa_load="YES"
+atapci_load="YES"
+
+ataacard_load="YES"
+ataacerlabs_load="YES"
+ataadaptec_load="YES"
+ataahci_load="YES"
+ataamd_load="YES"
+ataati_load="YES"
+atacenatek_load="YES"
+atacypress_load="YES"
+atacyrix_load="YES"
+atahighpoint_load="YES"
+ataintel_load="YES"
+ataite_load="YES"
+atajmicron_load="YES"
+atamarvell_load="YES"
+atamicron_load="YES"
+atanational_load="YES"
+atanetcell_load="YES"
+atanvidia_load="YES"
+atapromise_load="YES"
+ataserverworks_load="YES"
+atasiliconimage_load="YES"
+atasis_load="YES"
+atavia_load="YES"
+.Ed
+.Pp
+The first line is for the common hardware independent code, and is a
+prerequisite for the other modules.
+The next three lines are generic bus-specific drivers.
+Of the rest, ataahci is the AHCI driver.
+The others are vendor-specific PCI drivers.
+The
+.Dv ATA_CAM
+option should always remain in the kernel configuration, to make
+the driver work as a
+.Xr CAM 4
+subsystem module.
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hw.ata.ata_dma_check_80pin
+set to 0 to disable the 80pin cable check (the default is 1, check the cable)
+.It Va hint.atapci.X.msi
+set to 1 to allow Message Signalled Interrupts (MSI) to be used by the
+specified PCI ATA controller, if supported.
+.It Va hint.ata.X.devX.mode
+limits the initial ATA mode for the specified device on specified the channel.
+.It Va hint.ata.X.mode
+limits the initial ATA mode for every device on the specified channel.
+.It Va hint.ata.X.pm_level
+controls SATA interface Power Management for the specified channel,
+allowing some power savings at the cost of additional command latency.
+Possible values:
+.Bl -tag -compact
+.It 0
+Interface Power Management is disabled.
+This is the default value.
+.It 1
+The device is allowed to initiate a PM state change; the host is passive.
+.It 2
+The host initiates a PARTIAL PM state transition every time a port becomes idle.
+.It 3
+host initiates SLUMBER PM state transition every time port becomes idle.
+.El
+Modes 2 and 3 are only supported for AHCI.
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver gives the
+.Xr CAM 4
+subsystem access to the ATA (IDE) and SATA ports
+of many generic controllers.
+Depending on the controller, each PATA (IDE)
+port or each one or two SATA ports are
+represented to CAM as a separate bus with one or two targets.
+Most of the bus-management details are handled by the ATA/SATA-specific
+transport of CAM.
+Connected ATA disks are handled by the ATA protocol disk peripheral driver
+.Xr ada 4 .
+ATAPI devices are handled by the SCSI protocol peripheral drivers
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+etc.
+.Pp
+This driver supports ATA, and for the most of controllers, ATAPI devices.
+Command queuing and SATA port multipliers are not supported.
+Device hot-plug and SATA interface power management is supported only on
+some controllers.
+.Pp
+The
+.Nm
+driver can change the transfer mode when the system is up and running.
+See the
+.Cm negotiate
+subcommand of
+.Xr camcontrol 8 .
+.Pp
+The
+.Nm
+driver sets the maximum transfer mode supported by the hardware as default.
+However, the
+.Nm
+driver sometimes warns:
+.Dq Sy "DMA limited to UDMA33, non-ATA66 cable or device".
+This means that
+the
+.Nm
+driver has detected that the required 80 conductor cable is not present
+or could not be detected properly,
+or that one of the devices on the channel only accepts up
+to UDMA2/ATA33.
+The
+.Va hw.ata.ata_dma_check_80pin
+tunable can be set to 0 to disable this check.
+.Sh HARDWARE
+The currently supported ATA/SATA controller chips are:
+.Pp
+.Bl -tag -width "Silicon Image:" -compact
+.It Acard:
+ATP850P, ATP860A, ATP860R, ATP865A, ATP865R.
+.It ALI:
+M5228, M5229, M5281, M5283, M5287, M5288, M5289.
+.It AMD:
+AMD756, AMD766, AMD768, AMD8111, CS5536.
+.It ATI:
+IXP200, IXP300, IXP400, IXP600, IXP700, IXP800.
+.It CMD:
+CMD646, CMD646U2, CMD648, CMD649.
+.It Cypress:
+Cypress 82C693.
+.It Cyrix:
+Cyrix 5530.
+.It HighPoint:
+HPT302, HPT366, HPT368, HPT370, HPT371, HPT372, HPT372N, HPT374.
+.It Intel:
+6300ESB, 31244, PIIX, PIIX3, PIIX4, ESB2, ICH, ICH0, ICH2, ICH3, ICH4, ICH5,
+ICH6, ICH7, ICH8, ICH9, ICH10, SCH, PCH.
+.It ITE:
+IT8211F, IT8212F, IT8213F.
+.It JMicron:
+JMB360, JMB361, JMB363, JMB365, JMB366, JMB368.
+.It Marvell
+88SX5040, 88SX5041, 88SX5080, 88SX5081, 88SX6041, 88SX6042, 88SX6081, 88SE6101,
+88SE6102, 88SE6111, 88SE6121, 88SE6141, 88SE6145, 88SX7042.
+.It National:
+SC1100.
+.It NetCell:
+NC3000, NC5000.
+.It nVidia:
+nForce, nForce2, nForce2 MCP, nForce3, nForce3 MCP, nForce3 Pro, nForce4,
+MCP51, MCP55, MCP61, MCP65, MCP67, MCP73, MCP77, MCP79, MCP89.
+.It Promise:
+PDC20246, PDC20262, PDC20263, PDC20265, PDC20267, PDC20268, PDC20269, PDC20270,
+PDC20271, PDC20275, PDC20276, PDC20277, PDC20318, PDC20319, PDC20371, PDC20375,
+PDC20376, PDC20377, PDC20378, PDC20379, PDC20571, PDC20575, PDC20579, PDC20580,
+PDC20617, PDC20618, PDC20619, PDC20620, PDC20621, PDC20622, PDC40518, PDC40519,
+PDC40718, PDC40719.
+.It ServerWorks:
+HT1000, ROSB4, CSB5, CSB6, K2, Frodo4, Frodo8.
+.It Silicon Image:
+SiI0680, SiI3112, SiI3114, SiI3124, SiI3132, SiI3512.
+.It SiS:
+SIS180, SIS181, SIS182, SIS5513, SIS530, SIS540, SIS550, SIS620, SIS630,
+SIS630S, SIS633, SIS635, SIS730, SIS733, SIS735, SIS745, SIS961, SIS962,
+SIS963, SIS964, SIS965.
+.It VIA:
+VT6410, VT6420, VT6421, VT82C586, VT82C586B, VT82C596, VT82C596B, VT82C686,
+VT82C686A, VT82C686B, VT8231, VT8233, VT8233A, VT8233C, VT8235, VT8237,
+VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900.
+.El
+.Pp
+Some of above chips are also supported by the more featured
+.Xr ahci 4 ,
+.Xr mvs 4 ,
+and
+.Xr siis 4
+drivers.
+If both drivers are loaded at the same time, those will have precedence.
+.Pp
+Unknown ATA chipsets are supported in PIO modes, and if the standard
+busmaster DMA registers are present and contain valid setup, DMA is
+also enabled, although the max mode is limited to UDMA33, as it is
+not known what the chipset can do and how to program it.
+.Sh NOTES
+Please remember that in order to use UDMA4/ATA66 and above modes you
+.Em must
+use 80 conductor cables.
+Please assure that ribbon cables are no longer than 45cm.
+In case of rounded ATA cables, the length depends on the
+quality of the cables.
+SATA cables can be up to 1m long according to the specification.
+External SATA cables can be 2m long and more, but not all controllers
+work well on long cables, especially at high speeds.
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr ahci 4 ,
+.Xr cam 4 ,
+.Xr camcontrol 8 ,
+.Xr cd 4 ,
+.Xr mvs 4 ,
+.Xr siis 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.0 .
+It was turned into a
+.Xr CAM 4
+interface module in
+.Fx 9.0 .
+.Sh AUTHORS
+.An Alexander Motin
+.Aq mav@FreeBSD.org ,
+.An S\(/oren Schmidt
+.Aq sos@FreeBSD.org
diff --git a/share/man/man4/atapicam.4 b/share/man/man4/atapicam.4
new file mode 100644
index 000000000000..5f083d017e71
--- /dev/null
+++ b/share/man/man4/atapicam.4
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2002, 2004
+.\" Thomas Quinot <thomas@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 22, 2009
+.Dt ATAPICAM 4
+.Os
+.Sh NAME
+.Nm atapicam
+.Nd CAM XPT (transport) module for ATAPI devices
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ata"
+.Cd "device atapicam"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+atapicam_load="YES"
+.Ed
+.Sh DESCRIPTION
+The ATAPI/CAM module allows ATAPI devices (CD-ROM, CD-RW, DVD drives,
+floppy drives such as Iomega Zip, tape drives) to be accessed through
+the SCSI subsystem,
+.Xr cam 4 .
+.Pp
+.Xr ata 4
+and
+.Xr scbus 4
+must be configured in the kernel as well.
+The SCSI target drivers
+.Xr ( cd 4 ,
+.Xr da 4 ,
+or
+.Xr st 4 )
+can then be used to access the devices.
+The generic passthrough device,
+.Xr pass 4 ,
+can also be used to send SCSI commands directly
+to the devices through the CAM API.
+.Pp
+A separate CAM bus is created for each ATA bus in the system.
+On each of these buses, target ID 0 is assigned to the master
+device, and ID 1 is assigned to the slave
+(provided they are ATAPI devices).
+.Sh IMPLEMENTATION NOTES
+Some SCSI commands are intercepted by the driver, and undergo special
+processing in order to work around limitations of ATAPI devices.
+Such limitations can be consequences of the ATAPI specification.
+For example, ATAPI devices do not implement the 6-byte versions
+of
+.Dv MODE_SELECT , MODE_SENSE , READ ,
+or
+.Dv WRITE .
+They can also be common bugs, such as hanging when queried for
+extended
+.Dv INQUIRY
+information.
+.Sh EXAMPLES
+.Bd -literal -offset indent
+device ata
+device atapicam
+device scbus
+device cd
+device pass
+.Ed
+.Pp
+Add the
+.Nm
+driver to the kernel.
+.Pp
+.Dl "camcontrol devlist"
+.Pp
+Print the list of all devices available through CAM.
+.Pp
+.Dl "mount -t cd9660 /dev/cd0 /mnt"
+.Pp
+Mount a CD-ROM from an ATAPI CD-ROM drive
+(the command above assumes that the ATAPI drive is the only CD-ROM unit).
+.Sh SEE ALSO
+.Xr ata 4 ,
+.Xr cam 4 ,
+.Xr scsi 4 ,
+.Xr atacontrol 8 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The ATAPI/CAM driver first appeared in
+.Fx 4.8
+and
+.Fx 5.0 .
+.Sh AUTHORS
+The ATAPI/CAM driver was written by
+.An Thomas Quinot Aq thomas@FreeBSD.org .
+.Sh BUGS
+.Nm
+and ATAPI-specific target drivers
+.Xr ( acd 4 ,
+.Xr ast 4 ,
+and
+.Xr afd 4 )
+can be configured in the same kernel.
+Simultaneous access to the same device through the SCSI generic drivers
+and the ATAPI-specific drivers may cause problems and is strongly discouraged.
diff --git a/share/man/man4/ataraid.4 b/share/man/man4/ataraid.4
new file mode 100644
index 000000000000..98d30688a078
--- /dev/null
+++ b/share/man/man4/ataraid.4
@@ -0,0 +1,148 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 17, 2006
+.Dt ATARAID 4
+.Os
+.Sh NAME
+.Nm ataraid
+.Nd "ATA software RAID support"
+.Sh SYNOPSIS
+.Cd "device ata"
+.Cd "device ataraid"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for so-called software RAID
+(sometimes referred to as fake RAID or pseudo RAID).
+.Pp
+When a controller that supports software RAID is instructed to
+create a RAID array, its BIOS writes data structures in a specific
+metadata format to the disks.
+These data structures are picked up by the
+.Nm
+driver, so that
+.Fx
+can work with the array.
+The
+.Nm
+driver has to understand the specific metadata format of a
+controller BIOS in order to support its RAID capabilities.
+.Pp
+Read-only support for a metadata format means that
+.Fx
+can use the given RAID array for normal read/write operations.
+Creation and rebuild of such arrays has to be done from the
+controller BIOS.
+.Pp
+Read and write support for a metadata format means that
+.Fx
+can use the given RAID array for normal read/write operations.
+Additionally, the
+.Xr atacontrol 8
+utility can be used to create, rebuild, update and fail such
+RAID arrays.
+.Pp
+The
+.Nm
+driver can read the following metadata formats:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec HostRAID
+.It
+Highpoint V2 RocketRAID
+.It
+Highpoint V3 RocketRAID
+.It
+Intel MatrixRAID
+.It
+Integrated Technology Express (ITE)
+.It
+JMicron
+.It
+LSI Logic V2 MegaRAID
+.It
+LSI Logic V3 MegaRAID
+.It
+NVIDIA MediaShield
+.It
+Promise FastTrak
+.It
+Silicon Image Medley
+.It
+Silicon Integrated Systems (SiS)
+.It
+VIA Tech V-RAID
+.It
+FreeBSD PseudoRAID
+.El
+.Pp
+The
+.Nm
+driver can write the following metadata formats:
+.Pp
+.Bl -bullet -compact
+.It
+Highpoint V2 RocketRAID
+.It
+Intel MatrixRAID
+.It
+JMicron
+.It
+Promise FastTrak
+.It
+Silicon Integrated Systems (SiS)
+.It
+VIA Tech V-RAID
+.It
+FreeBSD PseudoRAID
+.El
+.Pp
+It is also possible to use software RAID on controllers
+that do not have special software RAID capabilities.
+See
+.Xr atacontrol 8
+for details.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ar*" -compact
+.It Pa /dev/ar*
+ATA RAID device nodes
+.El
+.Sh SEE ALSO
+.Xr ata 4 ,
+.Xr atacontrol 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An S\(/oren Schmidt Aq sos@FreeBSD.org .
+This manual page was written by
+.An Christian Brueffer Aq brueffer@FreeBSD.org .
+.Sh CAVEATS
+RAID5 is not supported at this time.
+Code exists, but it neither uses nor maintains parity information.
diff --git a/share/man/man4/ath.4 b/share/man/man4/ath.4
new file mode 100644
index 000000000000..e145853ac50f
--- /dev/null
+++ b/share/man/man4/ath.4
@@ -0,0 +1,302 @@
+.\"-
+.\" Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd August 28, 2011
+.Dt ATH 4
+.Os
+.Sh NAME
+.Nm ath
+.Nd "Atheros IEEE 802.11 wireless network driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ath"
+.Cd "device ath_pci"
+.Cd "device ath_hal"
+.Cd "options AH_SUPPORT_AR5416"
+.Cd "device ath_rate_sample"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ath_load="YES"
+if_ath_pci_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for wireless network adapters based on
+the Atheros AR5210, AR5211, AR5212, and AR5416 programming APIs.
+These APIs are used by a wide variety of chips; most all chips with
+a PCI and/or CardBus interface are supported.
+.Pp
+Supported features include 802.11 and 802.3 frames, power management, BSS,
+IBSS, MBSS, TDMA, and host-based access point operation modes.
+All host/device interaction is via DMA.
+.Pp
+Please note that from FreeBSD-9.0, the
+.Nm
+driver does not include the PCI/PCIe bus glue.
+The same driver supports multiple underlying bus types, including PCI/PCIe,
+but also embedded (AHB) and USB in the future.
+.Pp
+To enable use for PCI/PCIe systems, see the
+.Xr ath_pci 4
+driver.
+For embedded systems which use the AHB to connect the wireless MAC, see the
+.Xr ath_ahb 4
+driver.
+.Pp
+The
+.Nm
+driver encapsulates all IP and ARP traffic as 802.11 frames, however
+it can receive either 802.11 or 802.3 frames.
+Transmit speed and operating mode is selectable
+and depends on the specific chipset.
+AR5210-based devices support 802.11a operation with transmit speeds
+of 6 Mbps, 9 Mbps, 12 Mbps, 18 Mbps, 24 Mbps, 36 Mbps, 48 Mbps, and 54 Mbps.
+AR5211-based devices support 802.11a and 802.11b operation with transmit
+speeds as above for 802.11a operation and
+1Mbps, 2Mbps, 5.5 Mbps and 11Mbps for 802.11b operation.
+AR5212-based devices support 802.11a, 802.11b, and 802.11g operation
+with transmit speeds appropriate to each.
+AR5416-class devices are capable of 802.11n operation
+but are supported only in legacy modes (802.11a, 11b, 11g).
+Most chips also support an Atheros Turbo Mode (TM) that operates in
+the 5GHz frequency range with 2x the transmit speeds.
+Some chips also support Turbo mode in the 2.4GHz range with 802.11g
+though this support is not presently available due to regulatory requirements.
+(Note that Turbo modes are, however,
+only interoperable with other Atheros-based devices.)
+AR5212-based devices also support half- (10MHz) and quarter-width (5MHz) channels.
+The actual transmit speed used is dependent on signal quality and the
+.Dq "rate control"
+algorithm employed by the driver.
+All chips support WEP encryption.
+AR5212 and AR5416 parts have hardware support for the
+AES-CCM, TKIP, and Michael cryptographic
+operations required for WPA.
+To enable encryption, use
+.Xr ifconfig 8
+as shown below.
+.Pp
+The driver supports
+.Cm station ,
+.Cm adhoc ,
+.Cm adhoc-demo ,
+.Cm hostap ,
+.Cm mesh ,
+.Cm wds ,
+and
+.Cm monitor
+mode operation.
+Multiple
+.Cm hostap
+virtual interfaces may be configured for simultaneous
+use on cards that use a 5212 part.
+When multiple interfaces are configured each may have a separate
+mac address that is formed by setting the U/L bits in the mac
+address assigned to the underlying device.
+Any number of
+.Cm wds
+virtual interfaces may be configured together with
+.Cm hostap
+interfaces.
+Multiple
+.Cm station
+interfaces may be operated together with
+.Cm hostap
+interfaces to construct a wireless repeater device.
+The driver also support
+.Cm tdma
+operation when compiled with
+.Cd "options IEEE80211_SUPPORT_TDMA"
+(which also enables the required 802.11 support).
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+Devices supported by the
+.Nm
+driver come in either Cardbus or mini-PCI packages.
+Wireless cards in Cardbus slots may be inserted and ejected on the fly.
+.Sh HARDWARE
+The
+.Nm
+driver supports all Atheros Cardbus and PCI cards,
+except those that are based on the AR5005VL chipset.
+.Sh EXAMPLES
+Join a specific BSS network with WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0
+ifconfig wlan0 inet 192.168.0.20 netmask 0xffffff00 ssid my_net \e
+ wepmode on wepkey 0x8736639624
+.Ed
+.Pp
+Join/create an 802.11b IBSS network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0 wlanmode adhoc
+ifconfig wlan0 inet 192.168.0.22 netmask 0xffffff00 ssid my_net \e
+ mode 11b
+.Ed
+.Pp
+Create an 802.11g host-based access point:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0 wlanmode hostap
+ifconfig wlan0 inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e
+ mode 11g
+.Ed
+.Pp
+Create an 802.11a mesh station:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0 wlanmode mesh
+ifconfig wlan0 meshid my_mesh mode 11a inet 192.168.0.10/24
+.Ed
+.Pp
+Create two virtual 802.11a host-based access points, one with
+with WEP enabled and one with no security, and bridge them to
+the fxp0 (wired) device:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0 wlanmode hostap \e
+ ssid paying-customers wepmode on wepkey 0x1234567890 \e
+ mode 11a up
+ifconfig wlan1 create wlandev ath0 wlanmode hostap bssid \e
+ ssid freeloaders up
+ifconfig bridge0 create addm wlan0 addm wlan1 addm fxp0 up
+.Ed
+.Pp
+Create a master node in a two slot TDMA BSS configured to use
+2.5 millisecond slots.
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev ath0 wlanmode tdma \e
+ ssid tdma-test tmdaslot 0 tdmaslotlen 2500 \e
+ channel 36 up
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ath%d: unable to attach hardware; HAL status %u"
+The Atheros Hardware Access Layer was unable to configure the hardware
+as requested.
+The status code is explained in the HAL include file
+.Pa sys/dev/ath/ath_hal/ah.h .
+.It "ath%d: failed to allocate descriptors: %d"
+The driver was unable to allocate contiguous memory for the transmit
+and receive descriptors.
+This usually indicates system memory is scarce and/or fragmented.
+.It "ath%d: unable to setup a data xmit queue!"
+The request to the HAL to set up the transmit queue for normal
+data frames failed.
+This should not happen.
+.It "ath%d: unable to setup a beacon xmit queue!"
+The request to the HAL to set up the transmit queue for 802.11 beacon frames
+frames failed.
+This should not happen.
+.It "ath%d: 802.11 address: %s"
+The MAC address programmed in the EEPROM is displayed.
+.It "ath%d: hardware error; resetting"
+An unrecoverable error in the hardware occurred.
+Errors of this sort include unrecoverable DMA errors.
+The driver will reset the hardware and continue.
+.It "ath%d: rx FIFO overrun; resetting"
+The receive FIFO in the hardware overflowed before the data could be
+transferred to the host.
+This typically occurs because the hardware ran short of receive
+descriptors and had no place to transfer received data.
+The driver will reset the hardware and continue.
+.It "ath%d: unable to reset hardware; hal status %u"
+The Atheros Hardware Access Layer was unable to reset the hardware
+as requested.
+The status code is explained in the HAL include file
+.Pa sys/dev/ath/ath_hal/ah.h .
+This should not happen.
+.It "ath%d: unable to start recv logic"
+The driver was unable to restart frame reception.
+This should not happen.
+.It "ath%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware and continue.
+This should not happen.
+.It "ath%d: bogus xmit rate 0x%x"
+An invalid transmit rate was specified for an outgoing frame.
+The frame is discarded.
+This should not happen.
+.It "ath%d: ath_chan_set: unable to reset channel %u (%u MHz)"
+The Atheros Hardware Access Layer was unable to reset the hardware
+when switching channels during scanning.
+This should not happen.
+.It "ath%d: failed to enable memory mapping"
+The driver was unable to enable memory-mapped I/O to the PCI device registers.
+This should not happen.
+.It "ath%d: failed to enable bus mastering"
+The driver was unable to enable the device as a PCI bus master for doing DMA.
+This should not happen.
+.It "ath%d: cannot map register space"
+The driver was unable to map the device registers into the host address space.
+This should not happen.
+.It "ath%d: could not map interrupt"
+The driver was unable to allocate an IRQ for the device interrupt.
+This should not happen.
+.It "ath%d: could not establish interrupt"
+The driver was unable to install the device interrupt handler.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr ath_hal 4 ,
+.Xr cardbus 4 ,
+.Xr intro 4 ,
+.Xr pcic 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr hostapd 8 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.2 .
+.Sh CAVEATS
+Revision A1 of the D-LINK DWL-G520 and DWL-G650 are based on an
+Intersil PrismGT chip and are not supported by this driver.
+.Sh BUGS
+There is no software retransmit; only hardware retransmit is used.
+.Pp
+The driver does not fully enable power-save operation of the chip
+in station mode; consequently power use is suboptimal (e.g. on a laptop).
+.Pp
+WPA is not supported for 5210 parts.
diff --git a/share/man/man4/ath_ahb.4 b/share/man/man4/ath_ahb.4
new file mode 100644
index 000000000000..6688dc27468e
--- /dev/null
+++ b/share/man/man4/ath_ahb.4
@@ -0,0 +1,60 @@
+.\"-
+.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd May 30, 2011
+.Dt ATH_AHB 4
+.Os
+.Sh NAME
+.Nm ath_ahb
+.Nd "Atheros AHB device glue"
+.Sh SYNOPSIS
+.Cd "device ath_ahb"
+.Sh DESCRIPTION
+This module provides the AHB bus glue needed for the devices supported
+by the
+.Xr ath 4
+and
+.Xr ath_hal 4
+drivers.
+.Pp
+This is only relevant for embedded System-on-Chip (SoC) devices such as
+the Atheros AR913x series, which include an Atheros wireless MAC on-die.
+.Sh SEE ALSO
+.Xr ath 4
+.Xr ath_hal 4
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 9.0 .
+.Sh BUGS
+See
+.Xr ath 4
+for known bugs.
diff --git a/share/man/man4/ath_hal.4 b/share/man/man4/ath_hal.4
new file mode 100644
index 000000000000..a17393fc4051
--- /dev/null
+++ b/share/man/man4/ath_hal.4
@@ -0,0 +1,142 @@
+.\"-
+.\" Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd August 28, 2011
+.Dt ATH_HAL 4
+.Os
+.Sh NAME
+.Nm ath_hal
+.Nd "Atheros Hardware Access Layer (HAL)"
+.Sh SYNOPSIS
+.Cd "device ath_hal"
+.Cd "options AH_SUPPORT_AR5416"
+or
+.Cd "device ath_ar5210"
+.Cd "device ath_ar5211"
+.Cd "device ath_ar5212"
+.Cd "device ath_rf2413"
+.Cd "device ath_rf2417"
+.Cd "device ath_rf2425"
+.Cd "device ath_rf5111"
+.Cd "device ath_rf5112"
+.Cd "device ath_rf5413"
+.Cd "device ath_ar5416"
+.\".Cd "device ath_ar5312"
+.\".Cd "device ath_rf2136"
+.\".Cd "device ath_rf2137"
+.Cd "device ath_ar9130"
+.Cd "device ath_ar9160"
+.Cd "device ath_ar9280"
+.Cd "device ath_ar9285"
+.Cd "device ath_ar9287"
+.Cd "options AH_SUPPORT_AR5416"
+.Sh DESCRIPTION
+The hal provides hardware support for wireless network adapters based on
+the Atheros AR5210, AR5211, AR5212, AR5213, AR2413, AR2417, AR2425,
+AR5413, AR5416, AR5418, AR5424, AR9160, AR9220, AR9280, AR9285 and AR9287
+chips (and companion RF/baseband parts).
+This code is part of the
+.Xr ath 4
+driver but configured separately to allow fine-grained control
+over the set of chips supported.
+Selecting
+.Nm
+enables support for all PCI and Cardbus devices.
+Note this includes AR5416, AR5418, AR9130, AR9160, AR9220, AR9280, AR9285
+and AR9287 devices and must be accompanied by the
+AH_SUPPORT_AR5416
+option to enable the extended hardware descriptor format used by
+AR5416 and later devices.
+.Pp
+Some devices come in Cardbus/MiniPCI/PCI format.
+Others (for example AR2413, AR2427, AR5418, AR9280, AR9285, AR9287) come in
+PCIe, Mini-PCIe or ExpressCard format.
+.Pp
+Historically this code has been released in a binary-only form
+and packaged as a separate module.
+With the release of source code for the hal this is no longer true
+and the code is tightly integrated with the driver.
+.Sh HARDWARE
+The following cards are among those supported by the
+.Nm
+module:
+.Pp
+.Bl -column -compact "Samsung SWL-5200N" "AR5212" "Cardbus" "a/b/g"
+.It Em "Card Chip Bus Standard"
+.It "Aztech WL830PC AR5212 CardBus b/g"
+.It "D-Link DWL-A650 AR5210 CardBus a"
+.It "D-Link DWL-AB650 AR5211 CardBus a/b"
+.It "D-Link DWL-A520 AR5210 PCI a"
+.It "D-Link DWL-AG520 AR5212 PCI a/b/g"
+.It "D-Link DWL-AG650 AR5212 CardBus a/b/g"
+.It "D-Link DWL-G520B AR5212 PCI b/g"
+.It "D-Link DWL-G650B AR5212 CardBus b/g"
+.It "Elecom LD-WL54AG AR5212 Cardbus a/b/g"
+.It "Elecom LD-WL54 AR5211 Cardbus a"
+.It "Fujitsu E5454 AR5212 Cardbus a/b/g"
+.It "Fujitsu FMV-JW481 AR5212 Cardbus a/b/g"
+.It "Fujitsu E5454 AR5212 Cardbus a/b/g"
+.It "HP NC4000 AR5212 PCI a/b/g"
+.It "I/O Data WN-AB AR5212 CardBus a/b"
+.It "I/O Data WN-AG AR5212 CardBus a/b/g"
+.It "I/O Data WN-A54 AR5212 CardBus a"
+.It "Linksys WMP55AG AR5212 PCI a/b/g"
+.It "Linksys WPC51AB AR5211 CardBus a/b"
+.It "Linksys WPC55AG AR5212 CardBus a/b/g"
+.It "NEC PA-WL/54AG AR5212 CardBus a/b/g"
+.It "Netgear WAG311 AR5212 PCI a/b/g"
+.It "Netgear WAB501 AR5211 CardBus a/b"
+.It "Netgear WAG511 AR5212 CardBus a/b/g"
+.It "Netgear WG311 (aka WG311v1) AR5212 PCI b/g"
+.It "Netgear WG311v2 AR5212 PCI b/g"
+.It "Netgear WG311T AR5212 PCI b/g"
+.It "Netgear WG511T AR5212 CardBus b/g"
+.It "Orinoco 8480 AR5212 CardBus a/b/g"
+.It "Orinoco 8470WD AR5212 CardBus a/b/g"
+.It "Proxim Skyline 4030 AR5210 CardBus a"
+.It "Proxim Skyline 4032 AR5210 PCI a"
+.It "Samsung SWL-5200N AR5212 CardBus a/b/g"
+.It "SMC SMC2735W AR5210 CardBus a"
+.It "Sony PCWA-C700 AR5212 Cardbus a/b"
+.It "Sony PCWA-C300S AR5212 Cardbus b/g"
+.It "Sony PCWA-C500 AR5210 Cardbus a"
+.It "3Com 3CRPAG175 AR5212 CardBus a/b/g"
+.El
+.Sh SEE ALSO
+.Xr ath 4
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 5.2 .
+.Sh BUGS
+See
+.Xr ath 4
+for known bugs.
diff --git a/share/man/man4/ath_pci.4 b/share/man/man4/ath_pci.4
new file mode 100644
index 000000000000..814e5353c340
--- /dev/null
+++ b/share/man/man4/ath_pci.4
@@ -0,0 +1,57 @@
+.\"-
+.\" Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd May 30, 2011
+.Dt ATH_PCI 4
+.Os
+.Sh NAME
+.Nm ath_pci
+.Nd "Atheros PCI device glue"
+.Sh SYNOPSIS
+.Cd "device ath_pci"
+.Sh DESCRIPTION
+This module provides the PCI/PCIe bus glue needed for the devices supported
+by the
+.Xr ath 4
+and
+.Xr ath_hal 4
+drivers.
+.Sh SEE ALSO
+.Xr ath 4
+.Xr ath_hal 4
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 9.0 .
+.Sh BUGS
+See
+.Xr ath 4
+for known bugs.
diff --git a/share/man/man4/atkbd.4 b/share/man/man4/atkbd.4
new file mode 100644
index 000000000000..17ccef5435a0
--- /dev/null
+++ b/share/man/man4/atkbd.4
@@ -0,0 +1,230 @@
+.\"
+.\" Copyright (c) 1999
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 29, 2008
+.Dt ATKBD 4
+.Os
+.Sh NAME
+.Nm atkbd
+.Nd the AT keyboard interface
+.Sh SYNOPSIS
+.Cd "options ATKBD_DFLT_KEYMAP"
+.Cd "makeoptions ATKBD_DFLT_KEYMAP=_keymap_name_"
+.Cd "options KBD_DISABLE_KEYMAP_LOAD"
+.Cd "device atkbd"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.atkbd.0.at="atkbdc"
+.Cd hint.atkbd.0.irq="1"
+.Sh DESCRIPTION
+The
+.Nm
+driver, together with the
+.Nm atkbdc
+driver, provides access to the AT 84 keyboard or the AT enhanced keyboard
+which is connected to the AT keyboard controller.
+.Pp
+This driver is required for the console driver
+.Xr syscons 4 .
+.Pp
+There can be only one
+.Nm
+device defined in the kernel configuration file.
+This device also requires the
+.Nm atkbdc
+keyboard controller to be present.
+The
+.Em irq
+number must always be 1; there is no provision of changing the number.
+.Ss Function Keys
+The AT keyboard has a number of function keys.
+They are numbered as follows and can be associated with strings
+by the
+.Xr kbdcontrol 1
+command.
+You can use a keyboard map file (see
+.Xr kbdmap 5 )
+to map them to arbitrary keys, particularly
+the functions in the range from 65 to 96
+which are not used by default.
+.Pp
+.Bl -tag -width "Function Key Number" -compact
+.It "Function Key number"
+Function Key
+.It "1, 2,...12"
+F1, F2,...\& F12
+.It "13, 14,...24"
+Shift+F1, Shift+F2,...\& Shift+F12
+.It "25, 26,...36"
+Ctl+F1, Ctl+F2,...\& Ctl+F12
+.It "37, 38,...48"
+Shift+Ctl+F1, Shift+Ctl+F2,...\& Shift+Ctl+F12
+.It 49
+Home and Numpad 7 (without NumLock)
+.It 50
+Up Arrow and Numpad 8 (without NumLock)
+.It 51
+Page Up and Numpad 9 (without NumLock)
+.It 52
+Numpad -
+.It 53
+Left Arrow and Numpad 4 (without NumLock)
+.It 54
+Numpad 5 (without NumLock)
+.It 55
+Right Arrow and Numpad 6 (without NumLock)
+.It 56
+Numpad +
+.It 57
+End and Numpad 1 (without NumLock)
+.It 58
+Down Arrow and Numpad 2 (without NumLock)
+.It 59
+Page Down and Numpad 3 (without NumLock)
+.It 60
+Ins and Numpad 0 (without NumLock)
+.It 61
+Del
+.It 62
+Left GUI Key
+.It 63
+Right GUI Key
+.It 64
+Menu
+.It "65, 66,...96"
+free (not used by default)
+.El
+.Pp
+See the man page for the
+.Xr kbdcontrol 1
+command for how to assign a string to the function key.
+.Sh DRIVER CONFIGURATION
+.Ss Kernel Configuration Options
+The following kernel configuration options control the
+.Nm
+driver.
+.Bl -tag -width ATKBD_DFLT
+.It Em ATKBD_DFLT_KEYMAP
+This option sets the default, built-in keymap of the
+.Nm
+driver to the named keymap.
+See
+.Sx EXAMPLES
+below.
+.It Em KBD_DISABLE_KEYMAP_LOAD
+The keymap can be modified by the
+.Xr kbdcontrol 1
+command.
+This option will disable this feature and prevent the user from
+changing key assignment.
+.El
+.Ss Driver Flags
+The
+.Nm
+driver accepts the following driver flags.
+They can be set either in
+.Pa /boot/device.hints ,
+or else from within the boot loader
+(see
+.Xr loader 8 ) .
+.Bl -tag -width FAIL
+.It bit 0 (FAIL_IF_NO_KBD)
+By default the
+.Nm
+driver will install even if a keyboard is not actually connected to the
+system.
+This option prevents the driver from being installed in this situation.
+.It bit 1 (NO_RESET)
+When this option is given, the
+.Nm
+driver will not reset the keyboard when initializing it.
+It may be useful for laptop computers whose function keys
+have special functions and these functions are forgotten when the
+keyboard is reset.
+.It bit 2 (ALT_SCANCODESET)
+Certain keyboards, such as those on some ThinkPad models, behave
+like the old XT keyboard and require this option.
+.It bit 3 (NO_PROBE_TEST)
+When this option is given, the
+.Nm
+driver will not test the keyboard port during the probe routine.
+Some machines hang during boot when this test is performed.
+.El
+.\".Sh FILES
+.Sh EXAMPLES
+The
+.Nm
+driver requires the keyboard controller
+.Nm atkbdc .
+Thus, the kernel configuration file should contain the following lines.
+.Pp
+.Dl "device atkbdc"
+.Dl "device atkbd"
+.Pp
+The following example shows how to set the default, built-in keymap
+to
+.Pa jp.106.kbd .
+.Pp
+.Dl "device atkbdc"
+.Dl "options ATKBD_DFLT_KEYMAP"
+.Dl "makeoptions ATKBD_DFLT_KEYMAP=jp.106"
+.Dl "device atkbd"
+.Pp
+In both cases, you also need to have following lines in
+.Pa /boot/device.hints .
+.Pp
+.Dl hint.atkbdc.0.at="isa"
+.Dl hint.atkbdc.0.port="0x060"
+.Dl hint.atkbd.0.at="atkbdc"
+.Dl hint.atkbd.0.irq="1"
+.\".Sh DIAGNOSTICS
+.\".Sh CAVEATS
+.\".Sh BUGS
+.Sh SEE ALSO
+.Xr kbdcontrol 1 ,
+.Xr atkbdc 4 ,
+.Xr psm 4 ,
+.Xr syscons 4 ,
+.Xr kbdmap 5 ,
+.Xr loader 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An S\(/oren Schmidt Aq sos@FreeBSD.org
+and
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+This manual page was written by
+.An Kazutaka Yokota .
diff --git a/share/man/man4/atkbdc.4 b/share/man/man4/atkbdc.4
new file mode 100644
index 000000000000..46d30c1ec24e
--- /dev/null
+++ b/share/man/man4/atkbdc.4
@@ -0,0 +1,119 @@
+.\"
+.\" Copyright (c) 1999
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 9, 1999
+.Dt ATKBDC 4
+.Os
+.Sh NAME
+.Nm atkbdc
+.Nd the AT keyboard controller interface
+.Sh SYNOPSIS
+.Cd "options KBD_RESETDELAY=N"
+.Cd "options KBD_MAXWAIT=N"
+.Cd "options KBDIO_DEBUG=N"
+.Cd "device atkbdc"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.atkbdc.0.at="isa"
+.Cd hint.atkbdc.0.port="0x060"
+.Sh DESCRIPTION
+The keyboard controller
+.Nm
+provides I/O services for the AT keyboard and PS/2 mouse style
+pointing devices.
+This controller is required for the keyboard driver
+.Nm atkbd
+and the PS/2 pointing device driver
+.Nm psm .
+.Pp
+There can be only one
+.Nm
+device configured in the system.
+.Sh DRIVER CONFIGURATION
+.Ss Kernel Configuration Options
+The following kernel configuration options can be used to control the
+.Nm
+driver.
+They may be set in the kernel configuration file
+(see
+.Xr config 8 ) .
+.Bl -tag -width MOUSE
+.It Em KBD_RESETDELAY=X , KBD_MAXWAIT=Y
+The keyboard driver
+.Nm atkbd
+and the pointing device driver
+.Nm psm
+may ask the
+.Nm
+driver to reset these devices during the boot process.
+It sometimes takes a long time before these devices respond to
+the reset command.
+These options control how long the
+.Nm
+driver should
+wait before eventually giving up -- the driver will wait
+.Fa X
+*
+.Fa Y
+msecs at most.
+If the drivers seem unable to detect
+devices, you may want to increase these values.
+The default values are
+200 msec for
+.Fa X
+and 5
+for
+.Fa Y .
+.It Em KBDIO_DEBUG=N
+Sets the debug level to
+.Fa N .
+The default value is zero, which suppresses all debugging output.
+.El
+.\".Ss Driver Flags
+.\".Sh FILES
+.\".Sh EXAMPLE
+.\".Sh DIAGNOSTICS
+.\".Sh CAVEATS
+.\".Sh BUGS
+.Sh SEE ALSO
+.Xr atkbd 4 ,
+.Xr psm 4 ,
+.Xr config 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.1 .
+It is based on the kbdio module in
+.Fx 2.2 .
+.Sh AUTHORS
+The kbdio module, the
+.Nm
+driver and this manual page were written by
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
diff --git a/share/man/man4/atp.4 b/share/man/man4/atp.4
new file mode 100644
index 000000000000..ed7b4d3ab928
--- /dev/null
+++ b/share/man/man4/atp.4
@@ -0,0 +1,180 @@
+.\" Copyright (c) 2009 Rohit Grover <rgrover1 at gmail dot com>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 12, 2009
+.Dt ATP 4
+.Os
+.Sh NAME
+.Nm atp
+.Nd Apple touchpad driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines into
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device atp"
+.Cd "device usb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+atp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Apple Internal Trackpad
+device found in many Apple laptops.
+.Pp
+The driver simulates a three\-button mouse using multi\-finger tap
+detection.
+.
+A single\-finger tap generates a left button click;
+two\-finger tap maps to the middle button; whereas a three\-finger tap
+gets treated as a right button click.
+.
+A double\-tap followed by a drag is treated as a selection gesture; a
+virtual left\-button click is assumed for the lifespan of the drag.
+.
+.Nm
+attempts to filter away activity at the horizontal edges of the
+trackpad\-\-this is to keep unintentional palm movement from being
+considered as user input.
+.
+.Pp
+.Nm
+supports dynamic reconfiguration using
+.Xr sysctl 8 ;
+through nodes under
+.Nm hw.usb.atp .
+Pointer sensitivity can be controlled using the sysctl tunable
+.Nm hw.usb.atp.scale_factor .
+.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following Product IDs:
+.Pp
+.Bl -bullet -compact
+.It
+Core Duo MacBook & MacBook Pro (IDs: 0x0217, 0x0218, 0x0219)
+.It
+Core2 Duo MacBook & MacBook Pro (IDs: 0x021a, 0x021b, 0x021c)
+.It
+Core2 Duo MacBook3,1 (IDs: 0x0229, 0x022a, 0x022b)
+.It
+12 inch PowerBook and iBook (IDs: 0x030a, 0x030b)
+.It
+15 inch PowerBook (IDs: 0x020e, 0x020f, 0x0215)
+.It
+17 inch PowerBook (ID: 0x020d)
+.El
+.Pp
+To discover the product\-id of a touchpad, search for 'Trackpad' in the
+output of
+.Xr lshal 1
+and look up the property
+.Nm usb_device.product_id .
+.Sh FILES
+.Nm
+creates a blocking pseudo\-device file,
+.Pa /dev/atp0 ,
+which presents the mouse as a
+.Ar sysmouse
+or
+.Ar mousesystems
+type device\-\-see
+.Xr moused 8
+for an explanation of these mouse
+types.
+.Xr moused 8
+can be configured to read touchpad data from
+.Pa /dev/atp0
+and pass it along to the
+.Xr sysmouse 4
+driver so that any process wanting to utilize mouse operation (such as
+an X server) may fetch it from
+.Pa /dev/sysmouse ;
+alternatively,
+.Pa /dev/atp0
+may be manipulated via
+.Xr read 2
+and
+.Xr ioctl 2
+calls to get mouse data directly.
+.Sh EXAMPLES
+To use a compatible Apple Trackpad as your console mouse:
+.Pp
+.Dl moused -p /dev/atp0 -t auto
+.Pp
+To launch
+.Xr moused 8
+automatically upon boot, add the following to
+.Pa /etc/rc.conf :
+.Pp
+.Dl moused_enable="YES"
+.Dl moused_type="auto"
+.Dl moused_port="/dev/atp0"
+.Pp
+If you want
+.Xr moused 8
+to also probe for external USB mice or other devices, then add the
+following to
+.Pa /etc/rc.conf :
+.Pp
+.Dl moused_nondefault_enable="YES"
+.Dl moused_ums0_enable="YES"
+.Dl moused_ums1_enable="YES"
+.Pp
+To be able to use the trackpad under X, change the "Pointer" section in
+.Nm xorg.conf
+to the following:
+.Pp
+.Dl Device "/dev/atp0"
+.Dl Protocol "Auto"
+.Pp
+Better still, if you want to be able to use the mouse in both virtual
+consoles as well as in X change it to:
+.Pp
+.Dl Device "/dev/sysmouse"
+.Dl Protocol "Auto"
+.Sh SEE ALSO
+.Xr sysmouse 4 ,
+.Xr usb 4 ,
+.Xr loader.conf 5 ,
+.Xr xorg.conf 5 Pq Pa ports/x11/xorg ,
+.Xr moused 8 ,
+.Xr sysctl 8 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Rohit Grover Aq rgrover1@gmail.com
diff --git a/share/man/man4/atrtc.4 b/share/man/man4/atrtc.4
new file mode 100644
index 000000000000..0b0dd8fb6905
--- /dev/null
+++ b/share/man/man4/atrtc.4
@@ -0,0 +1,57 @@
+.\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 17, 2010
+.Dt ATRTC 4
+.Os
+.Sh NAME
+.Nm atrtc
+.Nd AT Real-Time Clock (RTC) driver
+.Sh SYNOPSIS
+This driver is a mandatory part of i386/amd64 kernels.
+.Pp
+The following tunable is settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.atrtc. Ns Ar X Ns Va .clock
+controls event timers functionality support. Setting to 0, disables it.
+Default value is 1.
+.El
+.Sh DESCRIPTION
+This driver uses RTC hardware to supply kernel with time-of-day clock
+with 1 second resolution and one event timer.
+This hardware uses base frequency of 32768Hz for advancing time-of-day clock
+and generating periodic interrupts.
+Interrupts could be generated with fixed number of frequencies, from 2Hz to
+8192Hz, obtained by dividing base frequency by one of supported power-of-2
+divisors.
+.Pp
+Event timer provided by the driver is irrelevant to CPU power states.
+.Sh SEE ALSO
+.Xr apic 4 ,
+.Xr attimer 4 ,
+.Xr eventtimers 4 ,
+.Xr hpet 4
diff --git a/share/man/man4/attimer.4 b/share/man/man4/attimer.4
new file mode 100644
index 000000000000..751b9ea1a203
--- /dev/null
+++ b/share/man/man4/attimer.4
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 14, 2010
+.Dt ATTIMER 4
+.Os
+.Sh NAME
+.Nm attimer
+.Nd i8254 Programmable Interval Timer (AT Timer) driver
+.Sh SYNOPSIS
+This driver is a mandatory part of x86 kernels.
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.attimer. Ns Ar X Ns Va .clock
+controls event timers functionality support. Setting to 0, disables it.
+Default value is 1.
+.It Va hint.attimer. Ns Ar X Ns Va .timecounter
+controls time counter functionality support. Setting to 0, disables it.
+Default value is 1.
+.It Va hw.i8254.freq
+allows to override default counter frequency.
+The same value is also available in run-time via
+.Va machdep.i8254_freq
+sysctl.
+.El
+.Sh DESCRIPTION
+This driver uses i8254 Programmable Interval Timer (AT Timer) hardware
+to supply kernel with one time counter and one event timer, and generate
+sound tones for system speaker.
+This hardware includes three channels.
+Each channel includes 16bit counter, counting down with known,
+platform-dependent frequency.
+Counters can operate in several different modes, including periodic and
+one-shot.
+Output of each channel has platform-defined wiring: one channel is wired
+to the interrupt controller and may be used as event timer, one channel is
+wired to speaker and used to generate sound tones, and one timer is reserved
+for platform purposes.
+.Pp
+Driver uses single hardware channel to provide both time counter and event
+timer functionality.
+To make it possible, respective counter must be running in periodic more.
+As result, one-shot event timer mode supported only when time counter
+functionality is disabled.
+.Pp
+Event timer provided by the driver is irrelevant to CPU power states.
+.Sh SEE ALSO
+.Xr apic 4 ,
+.Xr atrtc 4 ,
+.Xr eventtimers 4 ,
+.Xr hpet 4 ,
+.Xr timecounters 4
diff --git a/share/man/man4/audit.4 b/share/man/man4/audit.4
new file mode 100644
index 000000000000..167248cec5da
--- /dev/null
+++ b/share/man/man4/audit.4
@@ -0,0 +1,139 @@
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 31, 2009
+.Dt AUDIT 4
+.Os
+.Sh NAME
+.Nm audit
+.Nd Security Event Audit
+.Sh SYNOPSIS
+.Cd "options AUDIT"
+.Sh DESCRIPTION
+Security Event Audit is a facility to provide fine-grained, configurable
+logging of security-relevant events, and is intended to meet the requirements
+of the Common Criteria (CC) Common Access Protection Profile (CAPP)
+evaluation.
+The
+.Fx
+.Nm
+facility implements the de facto industry standard BSM API, file
+formats, and command line interface, first found in the Solaris operating
+system.
+Information on the user space implementation can be found in
+.Xr libbsm 3 .
+.Pp
+Audit support is enabled at boot, if present in the kernel, using an
+.Xr rc.conf 5
+flag.
+The audit daemon,
+.Xr auditd 8 ,
+is responsible for configuring the kernel to perform
+.Nm ,
+pushing
+configuration data from the various audit configuration files into the
+kernel.
+.Ss Audit Special Device
+The kernel
+.Nm
+facility provides a special device,
+.Pa /dev/audit ,
+which is used by
+.Xr auditd 8
+to monitor for
+.Nm
+events, such as requests to cycle the log, low disk
+space conditions, and requests to terminate auditing.
+This device is not intended for use by applications.
+.Ss Audit Pipe Special Devices
+Audit pipe special devices, discussed in
+.Xr auditpipe 4 ,
+provide a configurable live tracking mechanism to allow applications to
+tee the audit trail, as well as to configure custom preselection parameters
+to track users and events in a fine-grained manner.
+.Sh SEE ALSO
+.Xr auditreduce 1 ,
+.Xr praudit 1 ,
+.Xr audit 2 ,
+.Xr auditctl 2 ,
+.Xr auditon 2 ,
+.Xr getaudit 2 ,
+.Xr getauid 2 ,
+.Xr poll 2 ,
+.Xr select 2 ,
+.Xr setaudit 2 ,
+.Xr setauid 2 ,
+.Xr libbsm 3 ,
+.Xr auditpipe 4 ,
+.Xr audit_class 5 ,
+.Xr audit_control 5 ,
+.Xr audit_event 5 ,
+.Xr audit.log 5 ,
+.Xr audit_user 5 ,
+.Xr audit_warn 5 ,
+.Xr rc.conf 5 ,
+.Xr audit 8 ,
+.Xr auditd 8
+.Sh HISTORY
+The
+.Tn OpenBSM
+implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
+.Pp
+Support for kernel
+.Nm
+first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+.An -nosplit
+This software was created by McAfee Research, the security research division
+of McAfee, Inc., under contract to Apple Computer Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
+.Pp
+The Basic Security Module (BSM) interface to audit records and audit event
+stream format were defined by Sun Microsystems.
+.Pp
+This manual page was written by
+.An Robert Watson Aq rwatson@FreeBSD.org .
+.Sh BUGS
+The
+.Fx
+kernel does not fully validate that audit records submitted by user
+applications are syntactically valid BSM; as submission of records is limited
+to privileged processes, this is not a critical bug.
+.Pp
+Instrumentation of auditable events in the kernel is not complete, as some
+system calls do not generate audit records, or generate audit records with
+incomplete argument information.
+.Pp
+Mandatory Access Control (MAC) labels, as provided by the
+.Xr mac 4
+facility, are not audited as part of records involving MAC decisions.
diff --git a/share/man/man4/auditpipe.4 b/share/man/man4/auditpipe.4
new file mode 100644
index 000000000000..19db8565b703
--- /dev/null
+++ b/share/man/man4/auditpipe.4
@@ -0,0 +1,256 @@
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 5, 2006
+.Dt AUDITPIPE 4
+.Os
+.Sh NAME
+.Nm auditpipe
+.Nd "pseudo-device for live audit event tracking"
+.Sh SYNOPSIS
+.Cd "options AUDIT"
+.Sh DESCRIPTION
+While audit trail files
+generated with
+.Xr audit 4
+and maintained by
+.Xr auditd 8
+provide a reliable long-term store for audit log information, current log
+files are owned by the audit daemon until terminated making them somewhat
+unwieldy for live monitoring applications such as host-based intrusion
+detection.
+For example, the log may be cycled and new records written to a new file
+without notice to applications that may be accessing the file.
+.Pp
+The audit facility provides an audit pipe facility for applications requiring
+direct access to live BSM audit data for the purposes of real-time
+monitoring.
+Audit pipes are available via a clonable special device,
+.Pa /dev/auditpipe ,
+subject to the permissions on the device node, and provide a
+.Qq tee
+of the audit event stream.
+As the device is clonable, more than one instance of the device may be opened
+at a time; each device instance will provide independent access to all
+records.
+.Pp
+The audit pipe device provides discrete BSM audit records; if the read buffer
+passed by the application is too small to hold the next record in the
+sequence, it will be dropped.
+Unlike audit data written to the audit trail, the reliability of record
+delivery is not guaranteed.
+In particular, when an audit pipe queue fills, records will be dropped.
+Audit pipe devices are blocking by default, but support non-blocking I/O,
+asynchronous I/O using
+.Dv SIGIO ,
+and polled operation via
+.Xr select 2
+and
+.Xr poll 2 .
+.Pp
+Applications may choose to track the global audit trail, or configure local
+preselection parameters independent of the global audit trail parameters.
+.Ss Audit Pipe Queue Ioctls
+The following ioctls retrieve and set various audit pipe record queue
+properties:
+.Bl -tag -width ".Dv AUDITPIPE_GET_MAXAUDITDATA"
+.It Dv AUDITPIPE_GET_QLEN
+Query the current number of records available for reading on the pipe.
+.It Dv AUDITPIPE_GET_QLIMIT
+Retrieve the current maximum number of records that may be queued for reading
+on the pipe.
+.It Dv AUDITPIPE_SET_QLIMIT
+Set the current maximum number of records that may be queued for reading on
+the pipe.
+The new limit must fall between the queue limit minimum and queue limit
+maximum queryable using the following two ioctls.
+.It Dv AUDITPIPE_GET_QLIMIT_MIN
+Query the lowest possible maximum number of records that may be queued for
+reading on the pipe.
+.It Dv AUDITPIPE_GET_QLIMIT_MAX
+Query the highest possible maximum number of records that may be queued for
+reading on the pipe.
+.It Dv AUDITPIPE_FLUSH
+Flush all outstanding records on the audit pipe; useful after setting initial
+preselection properties to delete records queued during the configuration
+process which may not match the interests of the user process.
+.It Dv AUDITPIPE_GET_MAXAUDITDATA
+Query the maximum size of an audit record, which is a useful minimum size for
+a user space buffer intended to hold audit records read from the audit pipe.
+.El
+.Ss Audit Pipe Preselection Mode Ioctls
+By default, the audit pipe facility configures pipes to present records
+matched by the system-wide audit trail, configured by
+.Xr auditd 8 .
+However, the preselection mechanism for audit pipes can be configured using
+alternative criteria, including pipe-local flags and naflags settings, as
+well as auid-specific selection masks.
+This allows applications to track events not captured in the global audit
+trail, as well as limit records presented to those of specific interest to
+the application.
+.Pp
+The following ioctls configure the preselection mode on an audit pipe:
+.Bl -tag -width ".Dv AUDITPIPE_GET_PRESELECT_MODE"
+.It Dv AUDITPIPE_GET_PRESELECT_MODE
+Return the current preselect mode on the audit pipe.
+The ioctl argument should be of type
+.Vt int .
+.It Dv AUDITPIPE_SET_PRESELECT_MODE
+Set the current preselection mode on the audit pipe.
+The ioctl argument should be of type
+.Vt int .
+.El
+.Pp
+Possible preselection mode values are:
+.Bl -tag -width ".Dv AUDITPIPE_PRESELECT_MODE_TRAIL"
+.It Dv AUDITPIPE_PRESELECT_MODE_TRAIL
+Use the global audit trail preselection parameters to select records for the
+audit pipe.
+.It Dv AUDITPIPE_PRESELECT_MODE_LOCAL
+Use local audit pipe preselection; this model is similar to the global audit
+trail configuration model, consisting of global flags and naflags parameters,
+as well as a set of per-auid masks.
+These parameters are configured using further ioctls.
+.El
+.Pp
+After changing the audit pipe preselection mode, records selected under
+earlier preselection configuration may still be in the audit pipe queue.
+The application may flush the current record queue after changing the
+configuration to remove possibly undesired records.
+.Ss Audit Pipe Local Preselection Mode Ioctls
+The following ioctls configure the preselection parameters used when an audit
+pipe is configured for the
+.Dv AUDITPIPE_PRESELECT_MODE_LOCAL
+preselection mode.
+.Bl -tag -width ".Dv AUDITPIPE_GET_PRESELECT_NAFLAGS"
+.It Dv AUDITPIPE_GET_PRESELECT_FLAGS
+Retrieve the current default preselection flags for attributable events on
+the pipe.
+These flags correspond to the
+.Va flags
+field in
+.Xr audit_control 5 .
+The ioctl argument should be of type
+.Vt u_int .
+.It Dv AUDITPIPE_SET_PRESELECT_FLAGS
+Set the current default preselection flags for attributable events on the
+pipe.
+These flags correspond to the
+.Va flags
+field in
+.Xr audit_control 5 .
+The ioctl argument should be of type
+.Vt u_int .
+.It Dv AUDITPIPE_GET_PRESELECT_NAFLAGS
+Retrieve the current default preselection flags for non-attributable events
+on the pipe.
+These flags correspond to the
+.Va naflags
+field in
+.Xr audit_control 5 .
+The ioctl argument should be of type
+.Vt u_int .
+.It Dv AUDITPIPE_SET_PRESELECT_NAFLAGS
+Set the current default preselection flags for non-attributable events on the
+pipe.
+These flags correspond to the
+.Va naflags
+field in
+.Xr audit_control 5 .
+The ioctl argument should be of type
+.Vt u_int .
+.It Dv AUDITPIPE_GET_PRESELECT_AUID
+Query the current preselection masks for a specific auid on the pipe.
+The ioctl argument should be of type
+.Vt "struct auditpipe_ioctl_preselect" .
+The auid to query is specified via the
+.Va ap_auid
+field of type
+.Vt au_id_t ;
+the mask will be returned via
+.Va ap_mask
+of type
+.Vt au_mask_t .
+.It Dv AUDITPIPE_SET_PRESELECT_AUID
+Set the current preselection masks for a specific auid on the pipe.
+Arguments are identical to
+.Dv AUDITPIPE_GET_PRESELECT_AUID ,
+except that the caller should properly initialize the
+.Va ap_mask
+field to hold the desired preselection mask.
+.It Dv AUDITPIPE_DELETE_PRESELECT_AUID
+Delete the current preselection mask for a specific auid on the pipe.
+Once called, events associated with the specified auid will use the default
+flags mask.
+The ioctl argument should be of type
+.Vt au_id_t .
+.It Dv AUDITPIPE_FLUSH_PRESELECT_AUID
+Delete all auid specific preselection specifications.
+.El
+.Sh EXAMPLES
+The
+.Xr praudit 1
+utility
+may be directly executed on
+.Pa /dev/auditpipe
+to review the default audit trail.
+.Sh SEE ALSO
+.Xr poll 2 ,
+.Xr select 2 ,
+.Xr audit 4 ,
+.Xr audit_control 5 ,
+.Xr audit 8 ,
+.Xr auditd 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
+.Pp
+Support for kernel audit first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+The audit pipe facility was designed and implemented by
+.An Robert Watson Aq rwatson@FreeBSD.org .
+.Pp
+The Basic Security Module (BSM) interface to audit records and audit event
+stream format were defined by Sun Microsystems.
+.Sh BUGS
+See the
+.Xr audit 4
+manual page for information on audit-related bugs and limitations.
+.Pp
+The configurable preselection mechanism mirrors the selection model present
+for the global audit trail.
+It might be desirable to provided a more flexible selection model.
+.Pp
+The per-pipe audit event queue is fifo, with drops occurring if either the
+user thread provides in sufficient for the record on the queue head, or on
+enqueue if there is insufficient room.
+It might be desirable to support partial reads of records, which would be
+more compatible with buffered I/O as implemented in system libraries, and to
+allow applications to select which records are dropped, possibly in the style
+of preselection.
diff --git a/share/man/man4/aue.4 b/share/man/man4/aue.4
new file mode 100644
index 000000000000..c708c8948fdd
--- /dev/null
+++ b/share/man/man4/aue.4
@@ -0,0 +1,205 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 7, 2006
+.Dt AUE 4
+.Os
+.Sh NAME
+.Nm aue
+.Nd ADMtek AN986 Pegasus USB Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device aue"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_aue_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the ADMtek
+AN986 Pegasus chipset.
+.Pp
+The LinkSys USB10T adapters that contain the AN986 Pegasus chipset
+will operate at 100Base-TX and full-duplex.
+.Pp
+The Pegasus contains a 10/100
+Ethernet MAC with MII interface and is designed to work with both
+Ethernet and HomePNA transceivers.
+Although designed to interface with
+100Mbps peripherals, the existing USB standard specifies a maximum
+transfer speed of 12Mbps.
+Users should therefore not expect to actually
+achieve 100Mbps speeds with these devices.
+.Pp
+The Pegasus supports a 64-bit multicast hash table, single perfect
+filter entry for the station address and promiscuous mode.
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to enable
+.Ar full-duplex
+operation.
+Not specifying
+.Ar full duplex
+implies
+.Ar half-duplex
+mode.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to enable
+.Ar full-duplex
+operation.
+Not specifying
+.Ar full duplex
+implies
+.Ar half-duplex
+mode.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation.
+The interface will operate in
+half duplex mode if this media option is not specified.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Abocom UFE1000, DSB650TX_NA
+.It
+Accton USB320-EC, SpeedStream
+.It
+ADMtek AN986, AN8511
+.It
+Billionton USB100, USB100LP, USB100EL, USBE100
+.It
+Corega Ether FEther USB-T, FEther USB-TX, FEther USB-TXS
+.It
+D-Link DSB-650, DSB-650TX, DSB-650TX-PNA
+.It
+Elecom LD-USBL/TX
+.It
+Elsa Microlink USB2Ethernet
+.It
+HP hn210e
+.It
+I-O Data USB ETTX
+.It
+Kingston KNU101TX
+.It
+LinkSys USB10T adapters that contain the AN986 Pegasus chipset,
+USB10TA, USB10TX, USB100TX, USB100H1
+.It
+MELCO LUA-TX, LUA2-TX
+.It
+Netgear FA101
+.It
+Planex UE-200TX
+.It
+Sandberg USB to Network Link (model number 133-06)
+.It
+Siemens Speedstream
+.It
+SmartBridges smartNIC
+.It
+SMC 2202USB
+.It
+SOHOware NUB100
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "aue%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "aue%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Rs
+.%T ADMtek AN986 data sheet
+.%U http://www.admtek.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
diff --git a/share/man/man4/axe.4 b/share/man/man4/axe.4
new file mode 100644
index 000000000000..6c68d46e0fcd
--- /dev/null
+++ b/share/man/man4/axe.4
@@ -0,0 +1,256 @@
+.\" Copyright (c) 1997, 1998, 1999, 2000-2003
+.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 25, 2011
+.Dt AXE 4
+.Os
+.Sh NAME
+.Nm axe
+.Nd "ASIX Electronics AX88x7x/760 USB Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device axe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_axe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the ASIX
+Electronics AX88172, AX88178, AX88772, AX88772A, AX88772B and AX88760
+USB 2.0 chipsets.
+.Pp
+The AX88172, AX88772, AX88772A, AX88772B and AX88760 contain a 10/100
+Ethernet MAC with MII interface and are designed to work with both
+Ethernet and HomePNA transceivers.
+The AX88178 has a 10/100/1000 Ethernet MAC with GMII/RGMII interface
+for interfacing with Gigabit Ethernet PHY.
+.Pp
+These devices will operate with
+both USB 1.x and USB 2.0 controllers, however performance with 1.x
+controllers will be limited since the USB 1.x standard specifies a
+maximum transfer speed of 12Mbps.
+Users with USB 1.x controllers should therefore not expect to actually
+achieve 100Mbps speeds with these devices.
+.Pp
+All chipsets support a 64-bit multicast hash table, single perfect
+filter entry for the station address, all-multicast mode and promiscuous mode.
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseT
+Set 1000Mbps (Gigabit Ethernet) operation (AX88178 only).
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports ASIX Electronics AX88172/AX88178/AX88772/AX88772A/AX88772B/AX88760
+based USB Ethernet adapters including:
+.Pp
+AX88172:
+.Bl -bullet -compact
+.It
+AboCom UF200
+.It
+Acer Communications EP1427X2
+.It
+ASIX AX88172
+.It
+ATen UC210T
+.It
+Billionton SnapPort
+.It
+Billionton USB2AR
+.It
+Buffalo (Melco Inc.) LUA-U2-KTX
+.It
+Corega USB2_TX
+.It
+D-Link DUBE100
+.It
+Goodway GWUSB2E
+.It
+JVC MP_PRX1
+.It
+LinkSys USB200M
+.It
+Netgear FA120
+.It
+Sitecom LN-029
+.It
+System TALKS Inc.\& SGC-X2UL
+.El
+.Pp
+AX88178:
+.Bl -bullet -compact
+.It
+ASIX AX88178
+.It
+Belkin F5D5055
+.It
+Logitec LAN-GTJ/U2A
+.It
+Buffalo (Melco Inc.) LUA3-U2-AGT
+.It
+Planex Communications GU1000T
+.It
+Sitecom Europe LN-028
+.El
+.Pp
+AX88772:
+.Bl -bullet -compact
+.It
+ASIX AX88772
+.It
+Buffalo (Melco Inc.) LUA3-U2-ATX
+.It
+D-Link DUBE100B1
+.It
+Planex UE-200TX-G
+.It
+Planex UE-200TX-G2
+.El
+.Pp
+AX88772A:
+.Bl -bullet -compact
+.It
+ASIX AX88772A
+.It
+Cisco-Linksys USB200Mv2
+.El
+.Pp
+AX88772B:
+.Bl -bullet -compact
+.It
+ASIX AX88772B
+.El
+.Pp
+AX88760:
+.Bl -bullet -compact
+.It
+ASIX AX88760
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "axe%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "axe%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr rgephy 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T "ASIX AX88x7x and AX88760 data sheets"
+.%U http://www.asix.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@windriver.com .
diff --git a/share/man/man4/bce.4 b/share/man/man4/bce.4
new file mode 100644
index 000000000000..090c47775a94
--- /dev/null
+++ b/share/man/man4/bce.4
@@ -0,0 +1,366 @@
+.\" Copyright (c) 2006 Broadcom Corporation
+.\" David Christensen <davidch@broadcom.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of Broadcom Corporation nor the name of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written consent.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 7, 2009
+.Dt BCE 4
+.Os
+.Sh NAME
+.Nm bce
+.Nd "Broadcom NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device bce"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bce_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Broadcom's NetXtreme II product family, including the
+BCM5706, BCM5708, BCM5709 and BCM5716 Ethernet controllers.
+.Pp
+The NetXtreme II product family is composed of various Converged NIC (or CNIC)
+Ethernet controllers which support a TCP Offload Engine (TOE), Remote DMA (RDMA),
+and iSCSI acceleration, in addition to standard L2 Ethernet traffic, all on the
+same controller.
+.Pp
+The following features are supported in the
+.Nm
+driver under
+.Fx :
+.Pp
+.Bl -item -offset indent -compact
+.It
+IP/TCP/UDP checksum offload
+.It
+Jumbo frames (up to 9022 bytes)
+.It
+VLAN tag stripping
+.It
+Interrupt coalescing
+.It
+10/100/1000Mbps operation in full-duplex mode
+.It
+10/100Mbps operation in half-duplex mode
+.El
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseSX
+Sets 1000Mbps operation.
+Only
+.Cm full-duplex
+mode is supported at this speed.
+.It Cm 1000baseT
+Set 1000baseT operation over twisted pair.
+Only
+.Cm full-duplex
+mode is supported.
+.It Cm 2500BaseSX
+Set 2500Mbps operation.
+Only
+.Cm full-duplex
+mode is supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for various NICs based on the Broadcom NetXtreme II
+family of Gigabit Ethernet controllers, including the
+following:
+.Pp
+.Bl -bullet -compact
+.It
+Broadcom NetXtreme II BCM5706 1000Base-SX
+.It
+Broadcom NetXtreme II BCM5706 1000Base-T
+.It
+Broadcom NetXtreme II BCM5708 1000Base-SX
+.It
+Broadcom NetXtreme II BCM5708 1000Base-T
+.It
+Broadcom NetXtreme II BCM5709 1000Base-SX
+.It
+Broadcom NetXtreme II BCM5709 1000Base-T
+.It
+Broadcom NetXtreme II BCM5716 1000Base-T
+.It
+Dell PowerEdge 1950 integrated BCM5708 NIC
+.It
+Dell PowerEdge 2950 integrated BCM5708 NIC
+.It
+Dell PowerEdge R710 integrated BCM5709 NIC
+.It
+HP NC370F Multifunction Gigabit Server Adapter
+.It
+HP NC370T Multifunction Gigabit Server Adapter
+.It
+HP NC370i Multifunction Gigabit Server Adapter
+.It
+HP NC371i Multifunction Gigabit Server Adapter
+.It
+HP NC373F PCIe Multifunc Giga Server Adapter
+.It
+HP NC373T PCIe Multifunction Gig Server Adapter
+.It
+HP NC373i Multifunction Gigabit Server Adapter
+.It
+HP NC373m Multifunction Gigabit Server Adapter
+.It
+HP NC374m PCIe Multifunction Adapter
+.It
+HP NC380T PCIe DP Multifunc Gig Server Adapter
+.It
+HP NC382T PCIe DP Multifunction Gigabit Server Adapter
+.It
+HP NC382i DP Multifunction Gigabit Server Adapter
+.It
+HP NC382m DP 1GbE Multifunction BL-c Adapter
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.bce.msi_enable
+Whether or not MSI support is enabled in the driver.
+The default value is 1.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "bce%d: PCI memory allocation failed!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: PCI map interrupt failed!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: Unsupported controller revision (%c%d)"
+The driver does not support the controller revision in use.
+.It "bce%d: Controller initialization failed!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: NVRAM test failed!"
+The driver could not access the controller NVRAM correctly.
+.It "bce%d: DMA resource allocation failed!"
+The driver could not allocate DMA memory to setup the controllers
+host memory data structures.
+.It "bce%d: Interface allocation failed!"
+The driver could not create a network interface for the controller.
+.It "bce%d: PHY probe failed!"
+The driver could not access the PHY used by the controller.
+.It "bce%d: Failed to setup IRQ!"
+The driver could not initialize the IRQ handler.
+.It "bce%d: Error: PHY read timeout!"
+The driver could not read a PHY register before the timeout period expired.
+.It "bce%d: PHY write timeout!"
+The driver could not write to the PHY register because a timeout occurred.
+.It "bce%d: Timeout error reading NVRAM at offset 0x%08X!"
+The driver could not write to NVRAM because a timeout occurred.
+.It "bce%d: Unknown Flash NVRAM found!"
+The driver does not recognize the NVRAM device being used and therefore
+cannot access it correctly.
+.It "bce%d: Invalid NVRAM magic value!"
+The driver cannot read NVRAM or the NVRAM is corrupt.
+.It "bce%d: Invalid Manufacturing Information NVRAM CRC!"
+The driver cannot read NVRAM or the NVRAM is corrupt.
+.It "bce%d: Invalid Feature Configuration Information NVRAM CRC!"
+The driver cannot read NVRAM or the NVRAM is corrupt.
+.It "bce%d: DMA mapping error!"
+The driver was unable to map memory into DMA addressable space required
+by the controller.
+.It "bce%d: Could not allocate parent DMA tag!"
+The driver could not allocate a PCI compatible DMA tag.
+.It "bce%d: Could not allocate status block DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+status block.
+.It "bce%d: Could not allocate status block DMA memory!"
+The driver could not allocate DMA addressable memory for the controller's
+status block.
+.It "bce%d: Could not map status block DMA memory!"
+The driver could not map the status block memory into the controller's DMA
+address space.
+.It "bce%d: Could not allocate statistics block DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+statistics block.
+.It "bce%d: Could not allocate statistics block DMA memory!"
+The driver could not allocate DMA addressable memory for the controller's
+statistics block.
+.It "bce%d: Could not map statistics block DMA memory!"
+The driver could not map the statistics block memory into the controller's DMA
+address space.
+.It "bce%d: Could not allocate TX descriptor chain DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+TX chain.
+.It "bce%d: Could not allocate TX descriptor chain DMA memory!"
+The driver could not allocate DMA addressable memory for the controller's
+TX chain.
+.It "bce%d: Could not map TX descriptor chain DMA memory!"
+The driver could not map the TX descriptor chain memory into the controller's DMA
+address space.
+.It "bce%d: Could not allocate TX mbuf DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+TX mbuf memory.
+.It "bce%d: Unable to create TX mbuf DMA map!"
+The driver could not map the TX mbuf memory into the controller's DMA
+address space.
+.It "bce%d: Could not allocate RX descriptor chain DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+RX chain.
+.It "bce%d: Could not allocate RX descriptor chain "
+The driver could not allocate DMA addressable memory for the controller's
+RX chain.
+.It "bce%d: Could not map RX descriptor chain DMA memory!"
+The driver could not map the RX descriptor chain memory into the controller's DMA
+address space.
+.It "bce%d: Could not allocate RX mbuf DMA tag!"
+The driver could not allocate a DMA tag for the controller's
+RX mbuf memory.
+.It "bce%d: Unable to create RX mbuf DMA map!"
+The driver could not map the RX mbuf memory into the controller's DMA
+address space.
+.It "bce%d: Firmware synchronization timeout!"
+The driver was not able to synchronize with the firmware running on the
+controller.
+The firmware may be stopped or hung.
+.It "bce%d: Invalid Ethernet address!"
+The driver was not able to read a valid Ethernet MAC address from NVRAM.
+.It "bce%d: Reset failed!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: Byte swap is incorrect!"
+The driver has encountered a fatal initialization error.
+Contact the author
+with details of the CPU architecture and system chipset in use.
+.It "bce%d: Firmware did not complete initialization!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: Bootcode not running!"
+The driver has encountered a fatal initialization error.
+.It "bce%d: Error mapping mbuf into RX chain!"
+The driver could not map a RX mbuf into DMA addressable memory.
+.It "bce%d: Error filling RX chain: rx_bd[0x%04X]!"
+The driver was unable to allocate enough mbufs to fill the RX chain
+during initialization.
+Try increasing the number of mbufs available in
+the system, increase system memory, or if using jumbo frames, make sure
+enough 9KB mbufs are available.
+.It "bce%d: Failed to allocate new mbuf, incoming frame dropped!"
+The driver was unable to allocate a new mbuf for the RX chain and reused
+the mbuf for the received frame, dropping the incoming frame in the process.
+Try increasing the number of mbufs available in the system or increase system
+memory.
+.It "bce%d: Controller reset failed!"
+A fatal initialization error has occurred.
+.It "bce%d: Controller initialization failed!"
+A fatal initialization error has occurred.
+.It "bce%d: Block initialization failed!"
+A fatal initialization error has occurred.
+.It "bce%d: Error mapping mbuf into TX chain!"
+The driver could not map a TX mbuf into DMA addressable memory.
+.It "bce%d: Error registering poll function!"
+The driver received an error while attempting to register the poll function.
+.It "bce%d: Changing VLAN_MTU not supported."
+Changing the VLAN MTU is not currently supported by the driver.
+.It "bce%d: Cannot change VLAN_HWTAGGING while management firmware (ASF/IPMI/UMP) is running!"
+Management firmware to support ASF/IPMI/UMP requires that VLAN
+tag stripping be enabled in the controller.
+.It "bce%d: Changing VLAN_HWTAGGING not supported!"
+Disabling VLAN tag stripping is not currently supported by the driver.
+.It "bce%d: Watchdog timeout occurred, resetting!"
+The device has stopped responding to the network, there is a problem
+with the cable connection, or a driver logic problem has occurred..
+.It "bce%d: Fatal attention detected: 0x%08X!"
+A controller hardware failure has occurred.
+If the problem continues replace the controller.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An David Christensen Aq davidch@broadcom.com .
diff --git a/share/man/man4/bfe.4 b/share/man/man4/bfe.4
new file mode 100644
index 000000000000..307813b7ab4f
--- /dev/null
+++ b/share/man/man4/bfe.4
@@ -0,0 +1,109 @@
+.\"
+.\" Copyright (c) 2003 Stuart Walsh
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt BFE 4
+.Os
+.Sh NAME
+.Nm bfe
+.Nd "Broadcom BCM4401 Ethernet Device Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device bfe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bfe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Broadcom BCM4401 based Fast Ethernet adapters.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Set full duplex operation.
+.El
+.Pp
+For further information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "bfe%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "bfe%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "bfe%d: failed to allocate DMA resources"
+There are not enough mbufs available for allocation.
+.It "bfe%d: watchdog timeout -- resetting"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Stuart Walsh
+and
+.An Duncan Barclay .
+This manual page was written by
+.An Stuart Walsh .
diff --git a/share/man/man4/bge.4 b/share/man/man4/bge.4
new file mode 100644
index 000000000000..dc31ff6695ab
--- /dev/null
+++ b/share/man/man4/bge.4
@@ -0,0 +1,264 @@
+.\" Copyright (c) 2001 Wind River Systems
+.\" Copyright (c) 1997, 1998, 1999, 2000, 2001
+.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 19, 2012
+.Dt BGE 4
+.Os
+.Sh NAME
+.Nm bge
+.Nd "Broadcom BCM57xx/BCM590x Gigabit/Fast Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device bge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs based on the Broadcom BCM570x,
+571x, 572x, 575x, 576x, 578x, 5776x and 5778x Gigabit Ethernet controller
+chips and the 590x and 5779x Fast Ethernet controller chips.
+.Pp
+All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5
+copper cable, except for the SysKonnect SK-9D41 which supports only
+1000Mbps over multimode fiber.
+The BCM570x builds upon the technology of the Alteon Tigon II.
+It has two R4000 CPU cores and is PCI v2.2 and PCI-X v1.0 compliant.
+It supports IP, TCP
+and UDP checksum offload for both receive and transmit,
+multiple RX and TX DMA rings for QoS applications, rules-based
+receive filtering, and VLAN tag stripping/insertion as well as
+a 256-bit multicast hash filter.
+Additional features may be
+provided via value-add firmware updates.
+The BCM570x supports TBI (ten bit interface) and GMII
+transceivers, which means it can be used with either copper or 1000baseX
+fiber applications.
+Note however the device only supports a single
+speed in TBI mode.
+.Pp
+Most BCM5700-based cards also use the Broadcom BCM5401 or BCM5411 10/100/1000
+copper gigabit transceivers,
+which support autonegotiation of 10, 100 and 1000Mbps modes in
+full or half duplex.
+.Pp
+The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719,
+BCM5720, BCM5780 and BCM57765 also support jumbo frames, which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+Using jumbo frames can greatly improve performance for certain tasks,
+such as file transfers and data streaming.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Ic mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Ic mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+Only
+.Cm full-duplex
+mode is supported.
+.It Cm 1000baseSX
+Set 1000Mbps (Gigabit Ethernet) operation.
+Both
+.Cm full-duplex
+and
+.Cm half-duplex
+modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for various NICs based on the Broadcom BCM570x
+family of Gigabit Ethernet controller chips, including the
+following:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c996-SX (1000baseSX)
+.It
+3Com 3c996-T (10/100/1000baseTX)
+.It
+Dell PowerEdge 1750 integrated BCM5704C NIC (10/100/1000baseTX)
+.It
+Dell PowerEdge 2550 integrated BCM5700 NIC (10/100/1000baseTX)
+.It
+Dell PowerEdge 2650 integrated BCM5703 NIC (10/100/1000baseTX)
+.It
+Dell PowerEdge R200 integrated BCM5750 NIC (10/100/1000baseTX)
+.It
+Dell PowerEdge R300 integrated BCM5722 NIC (10/100/1000baseTX)
+.It
+IBM x235 server integrated BCM5703x NIC (10/100/1000baseTX)
+.It
+HP Compaq dc7600 integrated BCM5752 NIC (10/100/1000baseTX)
+.It
+HP ProLiant NC7760 embedded Gigabit NIC (10/100/1000baseTX)
+.It
+HP ProLiant NC7770 PCI-X Gigabit NIC (10/100/1000baseTX)
+.It
+HP ProLiant NC7771 PCI-X Gigabit NIC (10/100/1000baseTX)
+.It
+HP ProLiant NC7781 embedded PCI-X Gigabit NIC (10/100/1000baseTX)
+.It
+Netgear GA302T (10/100/1000baseTX)
+.It
+SysKonnect SK-9D21 (10/100/1000baseTX)
+.It
+SysKonnect SK-9D41 (1000baseSX)
+.El
+.Sh LOADER TUNABLES
+The following tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel, or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.bge.allow_asf
+Allow the ASF feature for cooperating with IPMI.
+Can cause system lockup problems on a small number of systems.
+Enabled by default.
+.It Va dev.bge.%d.msi
+Non-zero value enables MSI support on the Ethernet hardware.
+The default value is 1.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va dev.bge.%d.forced_collapse
+Allow collapsing multiple transmit buffers into a single buffer
+to increase transmit performance with the cost of CPU cycles.
+The default value is 0 to disable transmit buffer collapsing.
+.It Va dev.bge.%d.forced_udpcsum
+Enable UDP transmit checksum offloading even if controller can generate
+UDP datagrams with checksum value 0.
+UDP datagrams with checksum value 0 can confuse receiver host as it means
+sender did not compute UDP checksum.
+The default value is 0 which disables UDP transmit checksum offloading.
+The interface need to be brought down and up again before a change takes
+effect.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "bge%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "bge%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "bge%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "bge%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "bge%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "bge%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "bge%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.5 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@windriver.com .
diff --git a/share/man/man4/bktr.4 b/share/man/man4/bktr.4
new file mode 100644
index 000000000000..59136bff593d
--- /dev/null
+++ b/share/man/man4/bktr.4
@@ -0,0 +1,266 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 18, 2006
+.Dt BKTR 4
+.Os
+.Sh NAME
+.Nm bktr
+.Nd Brooktree Bt848/849/878/879 and Pinnacle PCTV video capture driver
+.Sh SYNOPSIS
+.Cd device bktr
+.Pp
+.Cd device iicbus
+.Cd device iicbb
+.Cd device smbus
+.Sh DESCRIPTION
+The
+.Nm bktr
+driver provides support for PCI
+.Em video
+capture and
+.Em VBI
+capture on low cost, high performance boards.
+The driver is based on the Matrox Meteor driver and uses the same API.
+The
+.Nm
+driver should support most video cards based on the
+.Em "Brooktree Bt848/849/878/879 Video Capture Chip" .
+Also supported are most
+.Em "Pinnacle PCTV"
+video cards.
+Furthermore, the driver supports
+.Em FM Radio
+if the tuner supports it.
+.Pp
+The driver currently supports the following features:
+.Bd -unfilled -offset indent
+PCI to PCI dma transfer
+clipping
+yuv
+rgb16
+rgb24
+rgb32
+.Ed
+.Pp
+On the supported cards, tuners and other components are interconnected
+with an I2C bus.
+The Brooktree848 chips act as a master device on the bus to control them.
+Therefore,
+.Xr iicbus 4 ,
+.Xr iicbb 4
+and
+.Xr smbus 4
+controller declarations are mandatory to activate
+.Nm
+support.
+.Pp
+The following kernel parameters may be used to further configure the driver:
+.Pp
+.Em options "BROOKTREE_ALLOC_PAGES=xxx"
+specifies the number of contiguous pages to allocate when successfully
+probed.
+The default number of pages allocated by the kernel is 216.
+This means that there are (216*4096) bytes available for use.
+.Bd -unfilled
+.Cd options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL
+.Cd options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
+.Ed
+One of these options can be used to set the default video format for the driver.
+This fixed random hangs and lockups with the VideoLogic Captivator PCI card.
+.Pp
+The following sysctls may be used to further configure the driver:
+.Pp
+.Em sysctl hw.bt848.card=nnnn
+This can be used to override the card make which was detected at boot time.
+.Ql nnnn
+is set to an integer from 1 to 23 taken from the following table:
+.Pp
+.Bl -tag -compact -width 30n
+.It MIRO
+1
+.It HAUPPAUGE
+2
+.It STB
+3
+.It INTEL
+4
+.It IMS_TURBO
+5
+.It AVER_MEDIA
+6
+.It OSPREY
+7
+.It NEC_PK
+8
+.It IO_GV
+9
+.It FLYVIDEO
+10
+.It ZOLTRIX
+11
+.It KISS
+12
+.It VIDEO_HIGHWAY_XTREME
+13
+.It ASKEY_DYNALINK_MAGIC_TVIEW
+14
+.It LEADTEK
+15
+.It TERRATVPLUS
+16
+.It IO_BCTV3
+17
+.It AOPEN_VA1000
+18
+.It PINNACLE_PCTV_RAVE
+19
+.It PIXELVIEW_PLAYTV_PAK
+20
+.It TERRATVALUE
+21
+.It PIXELVIEW_PLAYTV_PRO_REV_4C
+22
+.It Bt848_MAX
+23
+.El
+.Pp
+.Em sysctl hw.bt848.tuner=nnnn
+This can be used to override the tuner make which was detected at boot time.
+.Ql nnnn
+is set to an integer from 0 to 16 taken from the following table:
+.Pp
+.Bl -tag -compact -width 22n
+.It NO_TUNER
+0
+.It TEMIC_NTSC
+1
+.It TEMIC_PAL
+2
+.It TEMIC_SECAM
+3
+.It PHILIPS_NTSC
+4
+.It PHILIPS_PAL
+5
+.It PHILIPS_SECAM
+6
+.It TEMIC_PALI
+7
+.It PHILIPS_PALI
+8
+.It PHILIPS_FR1236_NTSC
+9 /* These have FM Radio support */
+.It PHILIPS_FR1216_PAL
+10 /* These have FM Radio support */
+.It PHILIPS_FR1236_SECAM
+11 /* These have FM Radio support */
+.It ALPS_TSCH5
+12
+.It ALPS_TSBH1
+13
+.It MT2032
+14
+.It LG_TPI8PSB12P_PAL
+15
+.It Bt848_MAX
+16
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports video capture cards based on the
+Brooktree Bt848/849/878/879 chips, as well as
+Pinnacle PCTV cards, including:
+.Pp
+.Bl -bullet -compact
+.It
+AOpen VA1000
+.It
+AVerMedia AVerTV Studio
+.It
+AVerMedia TF/FM-98
+.It
+ATI TV Wonder VE
+.It
+Hauppauge WinCast/TV
+.It
+Hauppauge WinTV-Go-FM
+.It
+Hauppauge WinTV-pci
+.It
+Hauppauge WinTV-radio
+.It
+Intel Smart Video Recorder III
+.It
+KWORLD PCI TV Tuner
+.It
+Miro PC TV
+.It
+Pinnacle PCTV Pro
+.It
+Pinnacle PCTV Rave
+.It
+PixelView PlayTV PAK
+.It
+PixelView PlayTV Pro (rev 4C, 9D)
+.It
+SIGMA TV II
+.It
+STB TV PCI Television Tuner
+.It
+Super TV Tuner
+.It
+TerraTec TValue
+.It
+V-Stream XPERT TV-PVR 878
+.It
+Video Highway XTreme
+.It
+VideoLogic Captivator PCI
+.El
+.Sh FILES
+.Bl -tag -width /usr/share/examples/meteor -compact
+.It Pa /usr/share/examples/meteor
+Examples of what you can do with the (similarly designed) Meteor driver.
+.It Pa /usr/ports/multimedia/fxtv
+A TV and Camera display program utilizing the bktr driver - requires that
+.Em The X Window System
+and
+.Em The Ports Collection
+also be installed.
+.It Pa /usr/ports/misc/alevt
+A program to capture and display Teletext (VideoText) pages - requires that
+.Em The X Window System
+and
+.Em The Ports Collection
+also be installed.
+.It Pa /usr/ports/audio/xmradio
+An FM Radio Tuner for cards which have an FM Radio tuner fitted - requires that
+.Em The X Window System
+and
+.Em The Ports Collection
+also be installed.
+It also requires
+.Em Motif
+or the
+.Em lesstif
+port.
+.El
+.Sh SEE ALSO
+.Xr meteor 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+This driver is based on the work of
+.An Jim Lowe Aq james@miller.cs.uwm.edu ,
+.An Mark Tinguely Aq tinguely@plains.nodak.edu ,
+.An Amancio Hasty Aq hasty@star-gate.com ,
+.An Roger Hardiman Aq roger@FreeBSD.org
+and a bunch of other people.
+Support for Pinnacle PCTV Rave cards was added by
+.An Branko Lankester Aq branko@euro.net .
diff --git a/share/man/man4/blackhole.4 b/share/man/man4/blackhole.4
new file mode 100644
index 000000000000..668f92d0ca73
--- /dev/null
+++ b/share/man/man4/blackhole.4
@@ -0,0 +1,84 @@
+.\"
+.\" blackhole - drop refused TCP or UDP connects
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\"
+.\" $FreeBSD$
+.Dd January 1, 2007
+.Dt BLACKHOLE 4
+.Os
+.Sh NAME
+.Nm blackhole
+.Nd a
+.Xr sysctl 8
+MIB for manipulating behaviour in respect of refused TCP or UDP connection
+attempts
+.Sh SYNOPSIS
+.Cd sysctl net.inet.tcp.blackhole[=[0 | 1 | 2]]
+.Cd sysctl net.inet.udp.blackhole[=[0 | 1]]
+.Sh DESCRIPTION
+The
+.Nm
+.Xr sysctl 8
+MIB is used to control system behaviour when connection requests
+are received on TCP or UDP ports where there is no socket listening.
+.Pp
+Normal behaviour, when a TCP SYN segment is received on a port where
+there is no socket accepting connections, is for the system to return
+a RST segment, and drop the connection.
+The connecting system will
+see this as a
+.Dq Connection refused .
+By setting the TCP blackhole
+MIB to a numeric value of one, the incoming SYN segment
+is merely dropped, and no RST is sent, making the system appear
+as a blackhole.
+By setting the MIB value to two, any segment arriving
+on a closed port is dropped without returning a RST.
+This provides some degree of protection against stealth port scans.
+.Pp
+In the UDP instance, enabling blackhole behaviour turns off the sending
+of an ICMP port unreachable message in response to a UDP datagram which
+arrives on a port where there is no socket listening.
+It must be noted that this behaviour will prevent remote systems from running
+.Xr traceroute 8
+to a system.
+.Pp
+The blackhole behaviour is useful to slow down anyone who is port scanning
+a system, attempting to detect vulnerable services on a system.
+It could potentially also slow down someone who is attempting a denial
+of service attack.
+.Sh WARNING
+The TCP and UDP blackhole features should not be regarded as a replacement
+for firewall solutions.
+Better security would consist of the
+.Nm
+.Xr sysctl 8
+MIB used in conjunction with one of the available firewall packages.
+.Pp
+This mechanism is not a substitute for securing a system.
+It should be used together with other security mechanisms.
+.Sh SEE ALSO
+.Xr ip 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr ipf 8 ,
+.Xr ipfw 8 ,
+.Xr pfctl 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The TCP and UDP
+.Nm
+MIBs
+first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Geoffrey M. Rehmet
diff --git a/share/man/man4/bpf.4 b/share/man/man4/bpf.4
new file mode 100644
index 000000000000..a3179204467a
--- /dev/null
+++ b/share/man/man4/bpf.4
@@ -0,0 +1,1106 @@
+.\" Copyright (c) 2007 Seccuris Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed by Robert N. M. Watson under contract to
+.\" Seccuris Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Copyright (c) 1990 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that: (1) source code distributions
+.\" retain the above copyright notice and this paragraph in its entirety, (2)
+.\" distributions including binary code include the above copyright notice and
+.\" this paragraph in its entirety in the documentation or other materials
+.\" provided with the distribution, and (3) all advertising materials mentioning
+.\" features or use of this software display the following acknowledgement:
+.\" ``This product includes software developed by the University of California,
+.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+.\" the University nor the names of its contributors may be used to endorse
+.\" or promote products derived from this software without specific prior
+.\" written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" This document is derived in part from the enet man page (enet.4)
+.\" distributed with 4.3BSD Unix.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 15, 2010
+.Dt BPF 4
+.Os
+.Sh NAME
+.Nm bpf
+.Nd Berkeley Packet Filter
+.Sh SYNOPSIS
+.Cd device bpf
+.Sh DESCRIPTION
+The Berkeley Packet Filter
+provides a raw interface to data link layers in a protocol
+independent fashion.
+All packets on the network, even those destined for other hosts,
+are accessible through this mechanism.
+.Pp
+The packet filter appears as a character special device,
+.Pa /dev/bpf .
+After opening the device, the file descriptor must be bound to a
+specific network interface with the
+.Dv BIOCSETIF
+ioctl.
+A given interface can be shared by multiple listeners, and the filter
+underlying each descriptor will see an identical packet stream.
+.Pp
+A separate device file is required for each minor device.
+If a file is in use, the open will fail and
+.Va errno
+will be set to
+.Er EBUSY .
+.Pp
+Associated with each open instance of a
+.Nm
+file is a user-settable packet filter.
+Whenever a packet is received by an interface,
+all file descriptors listening on that interface apply their filter.
+Each descriptor that accepts the packet receives its own copy.
+.Pp
+The packet filter will support any link level protocol that has fixed length
+headers.
+Currently, only Ethernet,
+.Tn SLIP ,
+and
+.Tn PPP
+drivers have been modified to interact with
+.Nm .
+.Pp
+Since packet data is in network byte order, applications should use the
+.Xr byteorder 3
+macros to extract multi-byte values.
+.Pp
+A packet can be sent out on the network by writing to a
+.Nm
+file descriptor.
+The writes are unbuffered, meaning only one packet can be processed per write.
+Currently, only writes to Ethernets and
+.Tn SLIP
+links are supported.
+.Sh BUFFER MODES
+.Nm
+devices deliver packet data to the application via memory buffers provided by
+the application.
+The buffer mode is set using the
+.Dv BIOCSETBUFMODE
+ioctl, and read using the
+.Dv BIOCGETBUFMODE
+ioctl.
+.Ss Buffered read mode
+By default,
+.Nm
+devices operate in the
+.Dv BPF_BUFMODE_BUFFER
+mode, in which packet data is copied explicitly from kernel to user memory
+using the
+.Xr read 2
+system call.
+The user process will declare a fixed buffer size that will be used both for
+sizing internal buffers and for all
+.Xr read 2
+operations on the file.
+This size is queried using the
+.Dv BIOCGBLEN
+ioctl, and is set using the
+.Dv BIOCSBLEN
+ioctl.
+Note that an individual packet larger than the buffer size is necessarily
+truncated.
+.Ss Zero-copy buffer mode
+.Nm
+devices may also operate in the
+.Dv BPF_BUFMODE_ZEROCOPY
+mode, in which packet data is written directly into two user memory buffers
+by the kernel, avoiding both system call and copying overhead.
+Buffers are of fixed (and equal) size, page-aligned, and an even multiple of
+the page size.
+The maximum zero-copy buffer size is returned by the
+.Dv BIOCGETZMAX
+ioctl.
+Note that an individual packet larger than the buffer size is necessarily
+truncated.
+.Pp
+The user process registers two memory buffers using the
+.Dv BIOCSETZBUF
+ioctl, which accepts a
+.Vt struct bpf_zbuf
+pointer as an argument:
+.Bd -literal
+struct bpf_zbuf {
+ void *bz_bufa;
+ void *bz_bufb;
+ size_t bz_buflen;
+};
+.Ed
+.Pp
+.Vt bz_bufa
+is a pointer to the userspace address of the first buffer that will be
+filled, and
+.Vt bz_bufb
+is a pointer to the second buffer.
+.Nm
+will then cycle between the two buffers as they fill and are acknowledged.
+.Pp
+Each buffer begins with a fixed-length header to hold synchronization and
+data length information for the buffer:
+.Bd -literal
+struct bpf_zbuf_header {
+ volatile u_int bzh_kernel_gen; /* Kernel generation number. */
+ volatile u_int bzh_kernel_len; /* Length of data in the buffer. */
+ volatile u_int bzh_user_gen; /* User generation number. */
+ /* ...padding for future use... */
+};
+.Ed
+.Pp
+The header structure of each buffer, including all padding, should be zeroed
+before it is configured using
+.Dv BIOCSETZBUF .
+Remaining space in the buffer will be used by the kernel to store packet
+data, laid out in the same format as with buffered read mode.
+.Pp
+The kernel and the user process follow a simple acknowledgement protocol via
+the buffer header to synchronize access to the buffer: when the header
+generation numbers,
+.Vt bzh_kernel_gen
+and
+.Vt bzh_user_gen ,
+hold the same value, the kernel owns the buffer, and when they differ,
+userspace owns the buffer.
+.Pp
+While the kernel owns the buffer, the contents are unstable and may change
+asynchronously; while the user process owns the buffer, its contents are
+stable and will not be changed until the buffer has been acknowledged.
+.Pp
+Initializing the buffer headers to all 0's before registering the buffer has
+the effect of assigning initial ownership of both buffers to the kernel.
+The kernel signals that a buffer has been assigned to userspace by modifying
+.Vt bzh_kernel_gen ,
+and userspace acknowledges the buffer and returns it to the kernel by setting
+the value of
+.Vt bzh_user_gen
+to the value of
+.Vt bzh_kernel_gen .
+.Pp
+In order to avoid caching and memory re-ordering effects, the user process
+must use atomic operations and memory barriers when checking for and
+acknowledging buffers:
+.Bd -literal
+#include <machine/atomic.h>
+
+/*
+ * Return ownership of a buffer to the kernel for reuse.
+ */
+static void
+buffer_acknowledge(struct bpf_zbuf_header *bzh)
+{
+
+ atomic_store_rel_int(&bzh->bzh_user_gen, bzh->bzh_kernel_gen);
+}
+
+/*
+ * Check whether a buffer has been assigned to userspace by the kernel.
+ * Return true if userspace owns the buffer, and false otherwise.
+ */
+static int
+buffer_check(struct bpf_zbuf_header *bzh)
+{
+
+ return (bzh->bzh_user_gen !=
+ atomic_load_acq_int(&bzh->bzh_kernel_gen));
+}
+.Ed
+.Pp
+The user process may force the assignment of the next buffer, if any data
+is pending, to userspace using the
+.Dv BIOCROTZBUF
+ioctl.
+This allows the user process to retrieve data in a partially filled buffer
+before the buffer is full, such as following a timeout; the process must
+recheck for buffer ownership using the header generation numbers, as the
+buffer will not be assigned to userspace if no data was present.
+.Pp
+As in the buffered read mode,
+.Xr kqueue 2 ,
+.Xr poll 2 ,
+and
+.Xr select 2
+may be used to sleep awaiting the availability of a completed buffer.
+They will return a readable file descriptor when ownership of the next buffer
+is assigned to user space.
+.Pp
+In the current implementation, the kernel may assign zero, one, or both
+buffers to the user process; however, an earlier implementation maintained
+the invariant that at most one buffer could be assigned to the user process
+at a time.
+In order to both ensure progress and high performance, user processes should
+acknowledge a completely processed buffer as quickly as possible, returning
+it for reuse, and not block waiting on a second buffer while holding another
+buffer.
+.Sh IOCTLS
+The
+.Xr ioctl 2
+command codes below are defined in
+.In net/bpf.h .
+All commands require
+these includes:
+.Bd -literal
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+ #include <net/bpf.h>
+.Ed
+.Pp
+Additionally,
+.Dv BIOCGETIF
+and
+.Dv BIOCSETIF
+require
+.In sys/socket.h
+and
+.In net/if.h .
+.Pp
+In addition to
+.Dv FIONREAD
+and
+.Dv SIOCGIFADDR ,
+the following commands may be applied to any open
+.Nm
+file.
+The (third) argument to
+.Xr ioctl 2
+should be a pointer to the type indicated.
+.Bl -tag -width BIOCGETBUFMODE
+.It Dv BIOCGBLEN
+.Pq Li u_int
+Returns the required buffer length for reads on
+.Nm
+files.
+.It Dv BIOCSBLEN
+.Pq Li u_int
+Sets the buffer length for reads on
+.Nm
+files.
+The buffer must be set before the file is attached to an interface
+with
+.Dv BIOCSETIF .
+If the requested buffer size cannot be accommodated, the closest
+allowable size will be set and returned in the argument.
+A read call will result in
+.Er EIO
+if it is passed a buffer that is not this size.
+.It Dv BIOCGDLT
+.Pq Li u_int
+Returns the type of the data link layer underlying the attached interface.
+.Er EINVAL
+is returned if no interface has been specified.
+The device types, prefixed with
+.Dq Li DLT_ ,
+are defined in
+.In net/bpf.h .
+.It Dv BIOCPROMISC
+Forces the interface into promiscuous mode.
+All packets, not just those destined for the local host, are processed.
+Since more than one file can be listening on a given interface,
+a listener that opened its interface non-promiscuously may receive
+packets promiscuously.
+This problem can be remedied with an appropriate filter.
+.It Dv BIOCFLUSH
+Flushes the buffer of incoming packets,
+and resets the statistics that are returned by BIOCGSTATS.
+.It Dv BIOCGETIF
+.Pq Li "struct ifreq"
+Returns the name of the hardware interface that the file is listening on.
+The name is returned in the ifr_name field of
+the
+.Li ifreq
+structure.
+All other fields are undefined.
+.It Dv BIOCSETIF
+.Pq Li "struct ifreq"
+Sets the hardware interface associate with the file.
+This
+command must be performed before any packets can be read.
+The device is indicated by name using the
+.Li ifr_name
+field of the
+.Li ifreq
+structure.
+Additionally, performs the actions of
+.Dv BIOCFLUSH .
+.It Dv BIOCSRTIMEOUT
+.It Dv BIOCGRTIMEOUT
+.Pq Li "struct timeval"
+Set or get the read timeout parameter.
+The argument
+specifies the length of time to wait before timing
+out on a read request.
+This parameter is initialized to zero by
+.Xr open 2 ,
+indicating no timeout.
+.It Dv BIOCGSTATS
+.Pq Li "struct bpf_stat"
+Returns the following structure of packet statistics:
+.Bd -literal
+struct bpf_stat {
+ u_int bs_recv; /* number of packets received */
+ u_int bs_drop; /* number of packets dropped */
+};
+.Ed
+.Pp
+The fields are:
+.Bl -hang -offset indent
+.It Li bs_recv
+the number of packets received by the descriptor since opened or reset
+(including any buffered since the last read call);
+and
+.It Li bs_drop
+the number of packets which were accepted by the filter but dropped by the
+kernel because of buffer overflows
+(i.e., the application's reads are not keeping up with the packet traffic).
+.El
+.It Dv BIOCIMMEDIATE
+.Pq Li u_int
+Enable or disable
+.Dq immediate mode ,
+based on the truth value of the argument.
+When immediate mode is enabled, reads return immediately upon packet
+reception.
+Otherwise, a read will block until either the kernel buffer
+becomes full or a timeout occurs.
+This is useful for programs like
+.Xr rarpd 8
+which must respond to messages in real time.
+The default for a new file is off.
+.It Dv BIOCSETF
+.It Dv BIOCSETFNR
+.Pq Li "struct bpf_program"
+Sets the read filter program used by the kernel to discard uninteresting
+packets.
+An array of instructions and its length is passed in using
+the following structure:
+.Bd -literal
+struct bpf_program {
+ int bf_len;
+ struct bpf_insn *bf_insns;
+};
+.Ed
+.Pp
+The filter program is pointed to by the
+.Li bf_insns
+field while its length in units of
+.Sq Li struct bpf_insn
+is given by the
+.Li bf_len
+field.
+See section
+.Sx "FILTER MACHINE"
+for an explanation of the filter language.
+The only difference between
+.Dv BIOCSETF
+and
+.Dv BIOCSETFNR
+is
+.Dv BIOCSETF
+performs the actions of
+.Dv BIOCFLUSH
+while
+.Dv BIOCSETFNR
+does not.
+.It Dv BIOCSETWF
+.Pq Li "struct bpf_program"
+Sets the write filter program used by the kernel to control what type of
+packets can be written to the interface.
+See the
+.Dv BIOCSETF
+command for more
+information on the
+.Nm
+filter program.
+.It Dv BIOCVERSION
+.Pq Li "struct bpf_version"
+Returns the major and minor version numbers of the filter language currently
+recognized by the kernel.
+Before installing a filter, applications must check
+that the current version is compatible with the running kernel.
+Version numbers are compatible if the major numbers match and the application minor
+is less than or equal to the kernel minor.
+The kernel version number is returned in the following structure:
+.Bd -literal
+struct bpf_version {
+ u_short bv_major;
+ u_short bv_minor;
+};
+.Ed
+.Pp
+The current version numbers are given by
+.Dv BPF_MAJOR_VERSION
+and
+.Dv BPF_MINOR_VERSION
+from
+.In net/bpf.h .
+An incompatible filter
+may result in undefined behavior (most likely, an error returned by
+.Fn ioctl
+or haphazard packet matching).
+.It Dv BIOCSHDRCMPLT
+.It Dv BIOCGHDRCMPLT
+.Pq Li u_int
+Set or get the status of the
+.Dq header complete
+flag.
+Set to zero if the link level source address should be filled in automatically
+by the interface output routine.
+Set to one if the link level source
+address will be written, as provided, to the wire.
+This flag is initialized to zero by default.
+.It Dv BIOCSSEESENT
+.It Dv BIOCGSEESENT
+.Pq Li u_int
+These commands are obsolete but left for compatibility.
+Use
+.Dv BIOCSDIRECTION
+and
+.Dv BIOCGDIRECTION
+instead.
+Set or get the flag determining whether locally generated packets on the
+interface should be returned by BPF.
+Set to zero to see only incoming packets on the interface.
+Set to one to see packets originating locally and remotely on the interface.
+This flag is initialized to one by default.
+.It Dv BIOCSDIRECTION
+.It Dv BIOCGDIRECTION
+.Pq Li u_int
+Set or get the setting determining whether incoming, outgoing, or all packets
+on the interface should be returned by BPF.
+Set to
+.Dv BPF_D_IN
+to see only incoming packets on the interface.
+Set to
+.Dv BPF_D_INOUT
+to see packets originating locally and remotely on the interface.
+Set to
+.Dv BPF_D_OUT
+to see only outgoing packets on the interface.
+This setting is initialized to
+.Dv BPF_D_INOUT
+by default.
+.It Dv BIOCSTSTAMP
+.It Dv BIOCGTSTAMP
+.Pq Li u_int
+Set or get format and resolution of the time stamps returned by BPF.
+Set to
+.Dv BPF_T_MICROTIME ,
+.Dv BPF_T_MICROTIME_FAST ,
+.Dv BPF_T_MICROTIME_MONOTONIC ,
+or
+.Dv BPF_T_MICROTIME_MONOTONIC_FAST
+to get time stamps in 64-bit
+.Vt struct timeval
+format.
+Set to
+.Dv BPF_T_NANOTIME ,
+.Dv BPF_T_NANOTIME_FAST ,
+.Dv BPF_T_NANOTIME_MONOTONIC ,
+or
+.Dv BPF_T_NANOTIME_MONOTONIC_FAST
+to get time stamps in 64-bit
+.Vt struct timespec
+format.
+Set to
+.Dv BPF_T_BINTIME ,
+.Dv BPF_T_BINTIME_FAST ,
+.Dv BPF_T_NANOTIME_MONOTONIC ,
+or
+.Dv BPF_T_BINTIME_MONOTONIC_FAST
+to get time stamps in 64-bit
+.Vt struct bintime
+format.
+Set to
+.Dv BPF_T_NONE
+to ignore time stamp.
+All 64-bit time stamp formats are wrapped in
+.Vt struct bpf_ts .
+The
+.Dv BPF_T_MICROTIME_FAST ,
+.Dv BPF_T_NANOTIME_FAST ,
+.Dv BPF_T_BINTIME_FAST ,
+.Dv BPF_T_MICROTIME_MONOTONIC_FAST ,
+.Dv BPF_T_NANOTIME_MONOTONIC_FAST ,
+and
+.Dv BPF_T_BINTIME_MONOTONIC_FAST
+are analogs of corresponding formats without _FAST suffix but do not perform
+a full time counter query, so their accuracy is one timer tick.
+The
+.Dv BPF_T_MICROTIME_MONOTONIC ,
+.Dv BPF_T_NANOTIME_MONOTONIC ,
+.Dv BPF_T_BINTIME_MONOTONIC ,
+.Dv BPF_T_MICROTIME_MONOTONIC_FAST ,
+.Dv BPF_T_NANOTIME_MONOTONIC_FAST ,
+and
+.Dv BPF_T_BINTIME_MONOTONIC_FAST
+store the time elapsed since kernel boot.
+This setting is initialized to
+.Dv BPF_T_MICROTIME
+by default.
+.It Dv BIOCFEEDBACK
+.Pq Li u_int
+Set packet feedback mode.
+This allows injected packets to be fed back as input to the interface when
+output via the interface is successful.
+When
+.Dv BPF_D_INOUT
+direction is set, injected outgoing packet is not returned by BPF to avoid
+duplication. This flag is initialized to zero by default.
+.It Dv BIOCLOCK
+Set the locked flag on the
+.Nm
+descriptor.
+This prevents the execution of
+ioctl commands which could change the underlying operating parameters of
+the device.
+.It Dv BIOCGETBUFMODE
+.It Dv BIOCSETBUFMODE
+.Pq Li u_int
+Get or set the current
+.Nm
+buffering mode; possible values are
+.Dv BPF_BUFMODE_BUFFER ,
+buffered read mode, and
+.Dv BPF_BUFMODE_ZBUF ,
+zero-copy buffer mode.
+.It Dv BIOCSETZBUF
+.Pq Li struct bpf_zbuf
+Set the current zero-copy buffer locations; buffer locations may be
+set only once zero-copy buffer mode has been selected, and prior to attaching
+to an interface.
+Buffers must be of identical size, page-aligned, and an integer multiple of
+pages in size.
+The three fields
+.Vt bz_bufa ,
+.Vt bz_bufb ,
+and
+.Vt bz_buflen
+must be filled out.
+If buffers have already been set for this device, the ioctl will fail.
+.It Dv BIOCGETZMAX
+.Pq Li size_t
+Get the largest individual zero-copy buffer size allowed.
+As two buffers are used in zero-copy buffer mode, the limit (in practice) is
+twice the returned size.
+As zero-copy buffers consume kernel address space, conservative selection of
+buffer size is suggested, especially when there are multiple
+.Nm
+descriptors in use on 32-bit systems.
+.It Dv BIOCROTZBUF
+Force ownership of the next buffer to be assigned to userspace, if any data
+present in the buffer.
+If no data is present, the buffer will remain owned by the kernel.
+This allows consumers of zero-copy buffering to implement timeouts and
+retrieve partially filled buffers.
+In order to handle the case where no data is present in the buffer and
+therefore ownership is not assigned, the user process must check
+.Vt bzh_kernel_gen
+against
+.Vt bzh_user_gen .
+.El
+.Sh BPF HEADER
+One of the following structures is prepended to each packet returned by
+.Xr read 2
+or via a zero-copy buffer:
+.Bd -literal
+struct bpf_xhdr {
+ struct bpf_ts bh_tstamp; /* time stamp */
+ uint32_t bh_caplen; /* length of captured portion */
+ uint32_t bh_datalen; /* original length of packet */
+ u_short bh_hdrlen; /* length of bpf header (this struct
+ plus alignment padding */
+};
+
+struct bpf_hdr {
+ struct timeval bh_tstamp; /* time stamp */
+ uint32_t bh_caplen; /* length of captured portion */
+ uint32_t bh_datalen; /* original length of packet */
+ u_short bh_hdrlen; /* length of bpf header (this struct
+ plus alignment padding */
+};
+.Ed
+.Pp
+The fields, whose values are stored in host order, and are:
+.Pp
+.Bl -tag -compact -width bh_datalen
+.It Li bh_tstamp
+The time at which the packet was processed by the packet filter.
+.It Li bh_caplen
+The length of the captured portion of the packet.
+This is the minimum of
+the truncation amount specified by the filter and the length of the packet.
+.It Li bh_datalen
+The length of the packet off the wire.
+This value is independent of the truncation amount specified by the filter.
+.It Li bh_hdrlen
+The length of the
+.Nm
+header, which may not be equal to
+.\" XXX - not really a function call
+.Fn sizeof "struct bpf_xhdr"
+or
+.Fn sizeof "struct bpf_hdr" .
+.El
+.Pp
+The
+.Li bh_hdrlen
+field exists to account for
+padding between the header and the link level protocol.
+The purpose here is to guarantee proper alignment of the packet
+data structures, which is required on alignment sensitive
+architectures and improves performance on many other architectures.
+The packet filter ensures that the
+.Vt bpf_xhdr ,
+.Vt bpf_hdr
+and the network layer
+header will be word aligned.
+Currently,
+.Vt bpf_hdr
+is used when the time stamp is set to
+.Dv BPF_T_MICROTIME ,
+.Dv BPF_T_MICROTIME_FAST ,
+.Dv BPF_T_MICROTIME_MONOTONIC ,
+.Dv BPF_T_MICROTIME_MONOTONIC_FAST ,
+or
+.Dv BPF_T_NONE
+for backward compatibility reasons. Otherwise,
+.Vt bpf_xhdr
+is used. However,
+.Vt bpf_hdr
+may be deprecated in the near future.
+Suitable precautions
+must be taken when accessing the link layer protocol fields on alignment
+restricted machines.
+(This is not a problem on an Ethernet, since
+the type field is a short falling on an even offset,
+and the addresses are probably accessed in a bytewise fashion).
+.Pp
+Additionally, individual packets are padded so that each starts
+on a word boundary.
+This requires that an application
+has some knowledge of how to get from packet to packet.
+The macro
+.Dv BPF_WORDALIGN
+is defined in
+.In net/bpf.h
+to facilitate
+this process.
+It rounds up its argument to the nearest word aligned value (where a word is
+.Dv BPF_ALIGNMENT
+bytes wide).
+.Pp
+For example, if
+.Sq Li p
+points to the start of a packet, this expression
+will advance it to the next packet:
+.Dl p = (char *)p + BPF_WORDALIGN(p->bh_hdrlen + p->bh_caplen)
+.Pp
+For the alignment mechanisms to work properly, the
+buffer passed to
+.Xr read 2
+must itself be word aligned.
+The
+.Xr malloc 3
+function
+will always return an aligned buffer.
+.Sh FILTER MACHINE
+A filter program is an array of instructions, with all branches forwardly
+directed, terminated by a
+.Em return
+instruction.
+Each instruction performs some action on the pseudo-machine state,
+which consists of an accumulator, index register, scratch memory store,
+and implicit program counter.
+.Pp
+The following structure defines the instruction format:
+.Bd -literal
+struct bpf_insn {
+ u_short code;
+ u_char jt;
+ u_char jf;
+ u_long k;
+};
+.Ed
+.Pp
+The
+.Li k
+field is used in different ways by different instructions,
+and the
+.Li jt
+and
+.Li jf
+fields are used as offsets
+by the branch instructions.
+The opcodes are encoded in a semi-hierarchical fashion.
+There are eight classes of instructions:
+.Dv BPF_LD ,
+.Dv BPF_LDX ,
+.Dv BPF_ST ,
+.Dv BPF_STX ,
+.Dv BPF_ALU ,
+.Dv BPF_JMP ,
+.Dv BPF_RET ,
+and
+.Dv BPF_MISC .
+Various other mode and
+operator bits are or'd into the class to give the actual instructions.
+The classes and modes are defined in
+.In net/bpf.h .
+.Pp
+Below are the semantics for each defined
+.Nm
+instruction.
+We use the convention that A is the accumulator, X is the index register,
+P[] packet data, and M[] scratch memory store.
+P[i:n] gives the data at byte offset
+.Dq i
+in the packet,
+interpreted as a word (n=4),
+unsigned halfword (n=2), or unsigned byte (n=1).
+M[i] gives the i'th word in the scratch memory store, which is only
+addressed in word units.
+The memory store is indexed from 0 to
+.Dv BPF_MEMWORDS
+- 1.
+.Li k ,
+.Li jt ,
+and
+.Li jf
+are the corresponding fields in the
+instruction definition.
+.Dq len
+refers to the length of the packet.
+.Bl -tag -width BPF_STXx
+.It Dv BPF_LD
+These instructions copy a value into the accumulator.
+The type of the source operand is specified by an
+.Dq addressing mode
+and can be a constant
+.Pq Dv BPF_IMM ,
+packet data at a fixed offset
+.Pq Dv BPF_ABS ,
+packet data at a variable offset
+.Pq Dv BPF_IND ,
+the packet length
+.Pq Dv BPF_LEN ,
+or a word in the scratch memory store
+.Pq Dv BPF_MEM .
+For
+.Dv BPF_IND
+and
+.Dv BPF_ABS ,
+the data size must be specified as a word
+.Pq Dv BPF_W ,
+halfword
+.Pq Dv BPF_H ,
+or byte
+.Pq Dv BPF_B .
+The semantics of all the recognized
+.Dv BPF_LD
+instructions follow.
+.Bd -literal
+BPF_LD+BPF_W+BPF_ABS A <- P[k:4]
+BPF_LD+BPF_H+BPF_ABS A <- P[k:2]
+BPF_LD+BPF_B+BPF_ABS A <- P[k:1]
+BPF_LD+BPF_W+BPF_IND A <- P[X+k:4]
+BPF_LD+BPF_H+BPF_IND A <- P[X+k:2]
+BPF_LD+BPF_B+BPF_IND A <- P[X+k:1]
+BPF_LD+BPF_W+BPF_LEN A <- len
+BPF_LD+BPF_IMM A <- k
+BPF_LD+BPF_MEM A <- M[k]
+.Ed
+.It Dv BPF_LDX
+These instructions load a value into the index register.
+Note that
+the addressing modes are more restrictive than those of the accumulator loads,
+but they include
+.Dv BPF_MSH ,
+a hack for efficiently loading the IP header length.
+.Bd -literal
+BPF_LDX+BPF_W+BPF_IMM X <- k
+BPF_LDX+BPF_W+BPF_MEM X <- M[k]
+BPF_LDX+BPF_W+BPF_LEN X <- len
+BPF_LDX+BPF_B+BPF_MSH X <- 4*(P[k:1]&0xf)
+.Ed
+.It Dv BPF_ST
+This instruction stores the accumulator into the scratch memory.
+We do not need an addressing mode since there is only one possibility
+for the destination.
+.Bd -literal
+BPF_ST M[k] <- A
+.Ed
+.It Dv BPF_STX
+This instruction stores the index register in the scratch memory store.
+.Bd -literal
+BPF_STX M[k] <- X
+.Ed
+.It Dv BPF_ALU
+The alu instructions perform operations between the accumulator and
+index register or constant, and store the result back in the accumulator.
+For binary operations, a source mode is required
+.Dv ( BPF_K
+or
+.Dv BPF_X ) .
+.Bd -literal
+BPF_ALU+BPF_ADD+BPF_K A <- A + k
+BPF_ALU+BPF_SUB+BPF_K A <- A - k
+BPF_ALU+BPF_MUL+BPF_K A <- A * k
+BPF_ALU+BPF_DIV+BPF_K A <- A / k
+BPF_ALU+BPF_AND+BPF_K A <- A & k
+BPF_ALU+BPF_OR+BPF_K A <- A | k
+BPF_ALU+BPF_LSH+BPF_K A <- A << k
+BPF_ALU+BPF_RSH+BPF_K A <- A >> k
+BPF_ALU+BPF_ADD+BPF_X A <- A + X
+BPF_ALU+BPF_SUB+BPF_X A <- A - X
+BPF_ALU+BPF_MUL+BPF_X A <- A * X
+BPF_ALU+BPF_DIV+BPF_X A <- A / X
+BPF_ALU+BPF_AND+BPF_X A <- A & X
+BPF_ALU+BPF_OR+BPF_X A <- A | X
+BPF_ALU+BPF_LSH+BPF_X A <- A << X
+BPF_ALU+BPF_RSH+BPF_X A <- A >> X
+BPF_ALU+BPF_NEG A <- -A
+.Ed
+.It Dv BPF_JMP
+The jump instructions alter flow of control.
+Conditional jumps
+compare the accumulator against a constant
+.Pq Dv BPF_K
+or the index register
+.Pq Dv BPF_X .
+If the result is true (or non-zero),
+the true branch is taken, otherwise the false branch is taken.
+Jump offsets are encoded in 8 bits so the longest jump is 256 instructions.
+However, the jump always
+.Pq Dv BPF_JA
+opcode uses the 32 bit
+.Li k
+field as the offset, allowing arbitrarily distant destinations.
+All conditionals use unsigned comparison conventions.
+.Bd -literal
+BPF_JMP+BPF_JA pc += k
+BPF_JMP+BPF_JGT+BPF_K pc += (A > k) ? jt : jf
+BPF_JMP+BPF_JGE+BPF_K pc += (A >= k) ? jt : jf
+BPF_JMP+BPF_JEQ+BPF_K pc += (A == k) ? jt : jf
+BPF_JMP+BPF_JSET+BPF_K pc += (A & k) ? jt : jf
+BPF_JMP+BPF_JGT+BPF_X pc += (A > X) ? jt : jf
+BPF_JMP+BPF_JGE+BPF_X pc += (A >= X) ? jt : jf
+BPF_JMP+BPF_JEQ+BPF_X pc += (A == X) ? jt : jf
+BPF_JMP+BPF_JSET+BPF_X pc += (A & X) ? jt : jf
+.Ed
+.It Dv BPF_RET
+The return instructions terminate the filter program and specify the amount
+of packet to accept (i.e., they return the truncation amount).
+A return value of zero indicates that the packet should be ignored.
+The return value is either a constant
+.Pq Dv BPF_K
+or the accumulator
+.Pq Dv BPF_A .
+.Bd -literal
+BPF_RET+BPF_A accept A bytes
+BPF_RET+BPF_K accept k bytes
+.Ed
+.It Dv BPF_MISC
+The miscellaneous category was created for anything that does not
+fit into the above classes, and for any new instructions that might need to
+be added.
+Currently, these are the register transfer instructions
+that copy the index register to the accumulator or vice versa.
+.Bd -literal
+BPF_MISC+BPF_TAX X <- A
+BPF_MISC+BPF_TXA A <- X
+.Ed
+.El
+.Pp
+The
+.Nm
+interface provides the following macros to facilitate
+array initializers:
+.Fn BPF_STMT opcode operand
+and
+.Fn BPF_JUMP opcode operand true_offset false_offset .
+.Sh SYSCTL VARIABLES
+A set of
+.Xr sysctl 8
+variables controls the behaviour of the
+.Nm
+subsystem
+.Bl -tag -width indent
+.It Va net.bpf.optimize_writers: No 0
+Various programs use BPF to send (but not receive) raw packets
+(cdpd, lldpd, dhcpd, dhcp relays, etc. are good examples of such programs).
+They do not need incoming packets to be send to them. Turning this option on
+makes new BPF users to be attached to write-only interface list until program
+explicitly specifies read filter via
+.Cm pcap_set_filter() .
+This removes any performance degradation for high-speed interfaces.
+.It Va net.bpf.stats:
+Binary interface for retrieving general statistics.
+.It Va net.bpf.zerocopy_enable: No 0
+Permits zero-copy to be used with net BPF readers. Use with caution.
+.It Va net.bpf.maxinsns: No 512
+Maximum number of instructions that BPF program can contain. Use
+.Xr tcpdump 1
+-d option to determine approximate number of instruction for any filter.
+.It Va net.bpf.maxbufsize: No 524288
+Maximum buffer size to allocate for packets buffer.
+.It Va net.bpf.bufsize: No 4096
+Default buffer size to allocate for packets buffer.
+.El
+.Sh EXAMPLES
+The following filter is taken from the Reverse ARP Daemon.
+It accepts only Reverse ARP requests.
+.Bd -literal
+struct bpf_insn insns[] = {
+ BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_REVARP, 0, 3),
+ BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 20),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, REVARP_REQUEST, 0, 1),
+ BPF_STMT(BPF_RET+BPF_K, sizeof(struct ether_arp) +
+ sizeof(struct ether_header)),
+ BPF_STMT(BPF_RET+BPF_K, 0),
+};
+.Ed
+.Pp
+This filter accepts only IP packets between host 128.3.112.15 and
+128.3.112.35.
+.Bd -literal
+struct bpf_insn insns[] = {
+ BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 8),
+ BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 26),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 2),
+ BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 3, 4),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x80037023, 0, 3),
+ BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 30),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 0x8003700f, 0, 1),
+ BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
+ BPF_STMT(BPF_RET+BPF_K, 0),
+};
+.Ed
+.Pp
+Finally, this filter returns only TCP finger packets.
+We must parse the IP header to reach the TCP header.
+The
+.Dv BPF_JSET
+instruction
+checks that the IP fragment offset is 0 so we are sure
+that we have a TCP header.
+.Bd -literal
+struct bpf_insn insns[] = {
+ BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 10),
+ BPF_STMT(BPF_LD+BPF_B+BPF_ABS, 23),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, IPPROTO_TCP, 0, 8),
+ BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 20),
+ BPF_JUMP(BPF_JMP+BPF_JSET+BPF_K, 0x1fff, 6, 0),
+ BPF_STMT(BPF_LDX+BPF_B+BPF_MSH, 14),
+ BPF_STMT(BPF_LD+BPF_H+BPF_IND, 14),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 79, 2, 0),
+ BPF_STMT(BPF_LD+BPF_H+BPF_IND, 16),
+ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, 79, 0, 1),
+ BPF_STMT(BPF_RET+BPF_K, (u_int)-1),
+ BPF_STMT(BPF_RET+BPF_K, 0),
+};
+.Ed
+.Sh SEE ALSO
+.Xr tcpdump 1 ,
+.Xr ioctl 2 ,
+.Xr kqueue 2 ,
+.Xr poll 2 ,
+.Xr select 2 ,
+.Xr byteorder 3 ,
+.Xr ng_bpf 4 ,
+.Xr bpf 9
+.Rs
+.%A McCanne, S.
+.%A Jacobson V.
+.%T "An efficient, extensible, and portable network monitor"
+.Re
+.Sh HISTORY
+The Enet packet filter was created in 1980 by Mike Accetta and
+Rick Rashid at Carnegie-Mellon University.
+Jeffrey Mogul, at
+Stanford, ported the code to
+.Bx
+and continued its development from
+1983 on.
+Since then, it has evolved into the Ultrix Packet Filter at
+.Tn DEC ,
+a
+.Tn STREAMS
+.Tn NIT
+module under
+.Tn SunOS 4.1 ,
+and
+.Tn BPF .
+.Sh AUTHORS
+.An -nosplit
+.An Steven McCanne ,
+of Lawrence Berkeley Laboratory, implemented BPF in
+Summer 1990.
+Much of the design is due to
+.An Van Jacobson .
+.Pp
+Support for zero-copy buffers was added by
+.An Robert N. M. Watson
+under contract to Seccuris Inc.
+.Sh BUGS
+The read buffer must be of a fixed size (returned by the
+.Dv BIOCGBLEN
+ioctl).
+.Pp
+A file that does not request promiscuous mode may receive promiscuously
+received packets as a side effect of another file requesting this
+mode on the same hardware interface.
+This could be fixed in the kernel with additional processing overhead.
+However, we favor the model where
+all files must assume that the interface is promiscuous, and if
+so desired, must utilize a filter to reject foreign packets.
+.Pp
+Data link protocols with variable length headers are not currently supported.
+.Pp
+The
+.Dv SEESENT ,
+.Dv DIRECTION ,
+and
+.Dv FEEDBACK
+settings have been observed to work incorrectly on some interface
+types, including those with hardware loopback rather than software loopback,
+and point-to-point interfaces.
+They appear to function correctly on a
+broad range of Ethernet-style interfaces.
diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4
new file mode 100644
index 000000000000..09e1dadf39b8
--- /dev/null
+++ b/share/man/man4/bridge.4
@@ -0,0 +1,448 @@
+.\" $NetBSD: bridge.4,v 1.5 2004/01/31 20:14:11 jdc Exp $
+.\"
+.\" Copyright 2001 Wasabi Systems, Inc.
+.\" All rights reserved.
+.\"
+.\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project by
+.\" Wasabi Systems, Inc.
+.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
+.\" or promote products derived from this software without specific prior
+.\" written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 9, 2010
+.Dt IF_BRIDGE 4
+.Os
+.Sh NAME
+.Nm if_bridge
+.Nd network bridge device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device if_bridge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bridge_load="YES"
+bridgestp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver creates a logical link between two or more IEEE 802 networks
+that use the same (or
+.Dq "similar enough" )
+framing format.
+For example, it is possible to bridge Ethernet and 802.11 networks together,
+but it is not possible to bridge Ethernet and Token Ring together.
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Pp
+The
+.Nm
+interface randomly chooses a link (MAC) address in the range reserved for
+locally administered addresses when it is created.
+This address is guaranteed to be unique
+.Em only
+across all
+.Nm
+interfaces on the local machine.
+Thus you can theoretically have two bridges on the different machines with
+the same link addresses.
+The address can be changed by assigning the desired link address using
+.Xr ifconfig 8 .
+.Pp
+If
+.Xr sysctl 8
+node
+.Va net.link.bridge.inherit_mac
+has non-zero value, newly created bridge will inherit MAC address
+from its first member instead of choosing random link-level address.
+This will provide more predictable bridge MAC without any
+additional configuration, but currently this feature is known
+to break some L2 protocols, for example PPPoE that is provided
+by
+.Xr ng_pppoe 4
+and
+.Xr ppp 8 .
+Now this feature is considered as experimental and is turned off
+by-default.
+.Pp
+A bridge can be used to provide several services, such as a simple
+802.11-to-Ethernet bridge for wireless hosts, and traffic isolation.
+.Pp
+A bridge works like a switch, forwarding traffic from one interface
+to another.
+Multicast and broadcast packets are always forwarded to all
+interfaces that are part of the bridge.
+For unicast traffic, the bridge learns which MAC addresses are associated
+with which interfaces and will forward the traffic selectively.
+.Pp
+All the bridged member interfaces need to be up in order to pass network traffic.
+These can be enabled using
+.Xr ifconfig 8
+or
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Li ="up"
+in
+.Xr rc.conf 5 .
+.Pp
+The MTU of the first member interface to be added is used as the bridge MTU.
+All additional members are required to have exactly the same value.
+.Pp
+The TXCSUM capability is disabled for any interface added to the bridge, and it
+is restored when the interface is removed again.
+.Pp
+The bridge supports
+.Dq monitor mode ,
+where the packets are discarded after
+.Xr bpf 4
+processing, and are not processed or forwarded further.
+This can be used to multiplex the input of two or more interfaces into a single
+.Xr bpf 4
+stream.
+This is useful for reconstructing the traffic for network taps
+that transmit the RX/TX signals out through two separate interfaces.
+.Sh SPANNING TREE
+The
+.Nm
+driver implements the Rapid Spanning Tree Protocol (RSTP or 802.1w) with
+backwards compatibility with the legacy Spanning Tree Protocol (STP).
+Spanning Tree is used to detect and remove loops in a network topology.
+.Pp
+RSTP provides faster spanning tree convergence than legacy STP, the protocol
+will exchange information with neighbouring switches to quickly transition to
+forwarding without creating loops.
+.Pp
+The code will default to RSTP mode but will downgrade any port connected to a
+legacy STP network so is fully backward compatible.
+A bridge can be forced to operate in STP mode without rapid state transitions
+via the
+.Va proto
+command in
+.Xr ifconfig 8 .
+.Pp
+The bridge can log STP port changes to
+.Xr syslog 3
+by enabling the
+.Va net.link.bridge.log_stp
+variable using
+.Xr sysctl 8 .
+.Sh PACKET FILTERING
+Packet filtering can be used with any firewall package that hooks in via the
+.Xr pfil 9
+framework.
+When filtering is enabled, bridged packets will pass through the filter
+inbound on the originating interface, on the bridge interface and outbound on
+the appropriate interfaces.
+Either stage can be disabled.
+The filtering behaviour can be controlled using
+.Xr sysctl 8 :
+.Bl -tag -width ".Va net.link.bridge.pfil_onlyip"
+.It Va net.link.bridge.pfil_onlyip
+Controls the handling of non-IP packets which are not passed to
+.Xr pfil 9 .
+Set to
+.Li 1
+to only allow IP packets to pass (subject to firewall rules), set to
+.Li 0
+to unconditionally pass all non-IP Ethernet frames.
+.It Va net.link.bridge.pfil_member
+Set to
+.Li 1
+to enable filtering on the incoming and outgoing member interfaces, set
+to
+.Li 0
+to disable it.
+.It Va net.link.bridge.pfil_bridge
+Set to
+.Li 1
+to enable filtering on the bridge interface, set
+to
+.Li 0
+to disable it.
+.It Va net.link.bridge.pfil_local_phys
+Set to
+.Li 1
+to additionally filter on the physical interface for locally destined packets.
+Set to
+.Li 0
+to disable this feature.
+.It Va net.link.bridge.ipfw
+Set to
+.Li 1
+to enable layer2 filtering with
+.Xr ipfirewall 4 ,
+set to
+.Li 0
+to disable it.
+This needs to be enabled for
+.Xr dummynet 4
+support.
+When
+.Va ipfw
+is enabled,
+.Va pfil_bridge
+and
+.Va pfil_member
+will be disabled so that IPFW
+is not run twice; these can be re-enabled if desired.
+.It Va net.link.bridge.ipfw_arp
+Set to
+.Li 1
+to enable layer2 ARP filtering with
+.Xr ipfirewall 4 ,
+set to
+.Li 0
+to disable it.
+Requires
+.Va ipfw
+to be enabled.
+.El
+.Pp
+ARP and REVARP packets are forwarded without being filtered and others
+that are not IP nor IPv6 packets are not forwarded when
+.Va pfil_onlyip
+is enabled.
+IPFW can filter Ethernet types using
+.Cm mac-type
+so all packets are passed to
+the filter for processing.
+.Pp
+The packets originating from the bridging host will be seen by
+the filter on the interface that is looked up in the routing
+table.
+.Pp
+The packets destined to the bridging host will be seen by the filter
+on the interface with the MAC address equal to the packet's destination
+MAC.
+There are situations when some of the bridge members are sharing
+the same MAC address (for example the
+.Xr vlan 4
+interfaces: they are currently sharing the
+MAC address of the parent physical interface).
+It is not possible to distinguish between these interfaces using
+their MAC address, excluding the case when the packet's destination
+MAC address is equal to the MAC address of the interface on which
+the packet was entered to the system.
+In this case the filter will see the incoming packet on this
+interface.
+In all other cases the interface seen by the packet filter is chosen
+from the list of bridge members with the same MAC address and the
+result strongly depends on the member addition sequence and the
+actual implementation of
+.Nm .
+It is not recommended to rely on the order chosen by the current
+.Nm
+implementation: it can be changed in the future.
+.Pp
+The previous paragraph is best illustrated with the following
+pictures.
+Let
+.Bl -bullet
+.It
+the MAC address of the incoming packet's destination is
+.Nm nn:nn:nn:nn:nn:nn ,
+.It
+the interface on which packet entered the system is
+.Nm ifX ,
+.It
+.Nm ifX
+MAC address is
+.Nm xx:xx:xx:xx:xx:xx ,
+.It
+there are possibly other bridge members with the same MAC address
+.Nm xx:xx:xx:xx:xx:xx ,
+.It
+the bridge has more than one interface that are sharing the
+same MAC address
+.Nm yy:yy:yy:yy:yy:yy ;
+we will call them
+.Nm vlanY1 ,
+.Nm vlanY2 ,
+etc.
+.El
+.Pp
+Then if the MAC address
+.Nm nn:nn:nn:nn:nn:nn
+is equal to the
+.Nm xx:xx:xx:xx:xx:xx
+then the filter will see the packet on the interface
+.Nm ifX
+no matter if there are any other bridge members carrying the same
+MAC address.
+But if the MAC address
+.Nm nn:nn:nn:nn:nn:nn
+is equal to the
+.Nm yy:yy:yy:yy:yy:yy
+then the interface that will be seen by the filter is one of the
+.Nm vlanYn .
+It is not possible to predict the name of the actual interface
+without the knowledge of the system state and the
+.Nm
+implementation details.
+.Pp
+This problem arises for any bridge members that are sharing the same
+MAC address, not only to the
+.Xr vlan 4
+ones: they we taken just as the example of such situation.
+So if one wants the filter the locally destined packets based on
+their interface name, one should be aware of this implication.
+The described situation will appear at least on the filtering bridges
+that are doing IP-forwarding; in some of such cases it is better
+to assign the IP address only to the
+.Nm
+interface and not to the bridge members.
+Enabling
+.Va net.link.bridge.pfil_local_phys
+will let you do the additional filtering on the physical interface.
+.Sh EXAMPLES
+The following when placed in the file
+.Pa /etc/rc.conf
+will cause a bridge called
+.Dq Li bridge0
+to be created, and will add the interfaces
+.Dq Li wlan0
+and
+.Dq Li fxp0
+to the bridge, and then enable packet forwarding.
+Such a configuration could be used to implement a simple
+802.11-to-Ethernet bridge (assuming the 802.11 interface is
+in ad-hoc mode).
+.Bd -literal -offset indent
+cloned_interfaces="bridge0"
+ifconfig_bridge0="addm wlan0 addm fxp0 up"
+.Ed
+.Pp
+For the bridge to forward packets all member interfaces and the bridge need
+to be up.
+The above example would also require:
+.Bd -literal -offset indent
+create_args_wlan0="wlanmode hostap"
+ifconfig_wlan0="up ssid my_ap mode 11g"
+ifconfig_fxp0="up"
+.Ed
+.Pp
+Consider a system with two 4-port Ethernet boards.
+The following will cause a bridge consisting of all 8 ports with Rapid Spanning
+Tree enabled to be created:
+.Bd -literal -offset indent
+ifconfig bridge0 create
+ifconfig bridge0 \e
+ addm fxp0 stp fxp0 \e
+ addm fxp1 stp fxp1 \e
+ addm fxp2 stp fxp2 \e
+ addm fxp3 stp fxp3 \e
+ addm fxp4 stp fxp4 \e
+ addm fxp5 stp fxp5 \e
+ addm fxp6 stp fxp6 \e
+ addm fxp7 stp fxp7 \e
+ up
+.Ed
+.Pp
+The bridge can be used as a regular host interface at the same time as bridging
+between its member ports.
+In this example, the bridge connects em0 and em1, and will receive its IP
+address through DHCP:
+.Bd -literal -offset indent
+cloned_interfaces="bridge0"
+ifconfig_bridge0="addm em0 addm em1 DHCP"
+ifconfig_em0="up"
+ifconfig_em1="up"
+.Ed
+.Pp
+The bridge can tunnel Ethernet across an IP internet using the EtherIP
+protocol.
+This can be combined with
+.Xr ipsec 4
+to provide an encrypted connection.
+Create a
+.Xr gif 4
+interface and set the local and remote IP addresses for the
+tunnel, these are reversed on the remote bridge.
+.Bd -literal -offset indent
+ifconfig gif0 create
+ifconfig gif0 tunnel 1.2.3.4 5.6.7.8 up
+ifconfig bridge0 create
+ifconfig bridge0 addm fxp0 addm gif0 up
+.Ed
+.Pp
+Note that
+.Fx
+6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 have a bug in the EtherIP protocol.
+For more details and workaround, see
+.Xr gif 4 manual page.
+.Sh SEE ALSO
+.Xr gif 4 ,
+.Xr ipf 4 ,
+.Xr ipfw 4 ,
+.Xr pf 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm bridge
+driver was originally written by
+.An Jason L. Wright
+.Aq jason@thought.net
+as part of an undergraduate independent study at the University of
+North Carolina at Greensboro.
+.Pp
+This version of the
+.Nm
+driver has been heavily modified from the original version by
+.An Jason R. Thorpe
+.Aq thorpej@wasabisystems.com .
+.Pp
+Rapid Spanning Tree Protocol (RSTP) support was added by
+.An Andrew Thompson
+.Aq thompsa@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver currently supports only Ethernet and Ethernet-like (e.g., 802.11)
+network devices, with exactly the same interface MTU size as the bridge device.
diff --git a/share/man/man4/bt.4 b/share/man/man4/bt.4
new file mode 100644
index 000000000000..6a09befd423f
--- /dev/null
+++ b/share/man/man4/bt.4
@@ -0,0 +1,203 @@
+.\"
+.\" Copyright (c) 1994 Jordan Hubbard
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2006
+.Dt BT 4
+.Os
+.Sh NAME
+.Nm bt
+.Nd Buslogic/Mylex MultiMaster SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device isa"
+.Cd "device scbus"
+.Cd "device bt"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.bt.0.at="isa"
+.Cd hint.bt.0.port="0x330"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn SCSI
+bus connected to a Buslogic/Mylex MultiMaster or compatible controller:
+.Bd -ragged -offset indent
+MultiMaster "W" Series Host Adapters:
+.Bl -column "BT-956CD " "ISA " "Commands " "Description"
+.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description"
+BT-948 PCI 192 Ultra SCSI-3
+BT-958 PCI 192 Wide Ultra SCSI-3
+BT-958D PCI 192 Wide Differential Ultra SCSI-3
+.El
+.Pp
+MultiMaster "C" Series Host Adapters:
+.Bl -column "BT-956CD " "ISA " "Commands " "Description"
+.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description"
+BT-946C PCI 100 Fast SCSI-2
+BT-956C PCI 100 Wide Fast SCSI-2
+BT-956CD PCI 100 Wide Differential Fast SCSI-2
+BT-445C VLB 100 Fast SCSI-2
+BT-747C EISA 100 Fast SCSI-2
+BT-757C EISA 100 Wide Fast SCSI-2
+BT-757CD EISA 100 Wide Differential Fast SCSI-2
+BT-545C ISA 50 Fast SCSI-2
+BT-540CF ISA 50 Fast SCSI-2
+.El
+.Pp
+MultiMaster "S" Series Host Adapters:
+.Bl -column "BT-956CD " "ISA " "Commands " "Description"
+.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description"
+BT-445S VLB 30 Fast SCSI-2
+BT-747S EISA 30 Fast SCSI-2
+BT-747D EISA 30 Differential Fast SCSI-2
+BT-757S EISA 30 Wide Fast SCSI-2
+BT-757D EISA 30 Wide Differential Fast SCSI-2
+BT-545S ISA 30 Fast SCSI-2
+BT-542D ISA 30 Differential Fast SCSI-2
+BT-742A EISA 30 SCSI-2 (742A revision H)
+BT-542B ISA 30 SCSI-2 (542B revision H)
+.El
+.Pp
+MultiMaster "A" Series Host Adapters:
+.Bl -column "BT-956CD " "ISA " "Commands " "Description"
+.Em "Adapter" Ta Em "Bus" Ta Em "Commands" Ta Em "Description"
+BT-742A EISA 30 SCSI-2 (742A revisions A - G)
+BT-542B ISA 30 SCSI-2 (542B revisions A - G)
+.El
+.Ed
+.Pp
+Tagged queueing is supported on 'W' series adapters, 'C' series adapters
+with firmware of rev 4.42 and higher, and 'S' series adapters with firmware
+of rev 3.35 and higher.
+.Pp
+Boards with certain firmware revisions may lock up under heavy load to
+certain devices, especially if tagged queueing is used.
+Should you encounter
+a problem with your adapter, contact Mylex technical support and ensure you
+have the latest firmware for your controller.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following BusLogic MultiMaster
+.Dq W ,
+.Dq C ,
+.Dq S ,
+and
+.Dq A
+series and compatible SCSI host adapters:
+.Pp
+.Bl -bullet -compact
+.It
+BusLogic BT-445C
+.It
+BusLogic BT-445S
+.It
+BusLogic BT-540CF
+.It
+BusLogic BT-542B
+.It
+BusLogic BT-542B
+.It
+BusLogic BT-542D
+.It
+BusLogic BT-545C
+.It
+BusLogic BT-545S
+.It
+BusLogic/BusTek BT-640
+.It
+BusLogic BT-742A
+.It
+BusLogic BT-742A
+.It
+BusLogic BT-747C
+.It
+BusLogic BT-747D
+.It
+BusLogic BT-747S
+.It
+BusLogic BT-757C
+.It
+BusLogic BT-757CD
+.It
+BusLogic BT-757D
+.It
+BusLogic BT-757S
+.It
+BusLogic BT-946C
+.It
+BusLogic BT-948
+.It
+BusLogic BT-956C
+.It
+BusLogic BT-956CD
+.It
+BusLogic BT-958
+.It
+BusLogic BT-958D
+.It
+Storage Dimensions SDC3211B / SDC3211F
+.El
+.Pp
+AMI FastDisk Host Adapters that are true BusLogic MultiMaster clones
+are also supported by the
+.Nm
+driver.
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in the
+.Bx 386
+patch kit.
+.Sh AUTHORS
+.An -nosplit
+.An Julian Elischer
+wrote a driver for the Multimaster cards that appeared in the
+.Bx 386
+patch kit.
+The driver was rewritten by
+.An Justin T. Gibbs
+to take advantage of new board features and work with the CAM SCSI framework in
+.Fx 3.0 .
+.Pp
+Special thanks to
+.An Leonard N. Zubkoff
+for writing such a complete and well documented Mylex/BusLogic MultiMaster
+driver for Linux.
+Support in this driver for the wide range of MultiMaster
+controllers and firmware revisions, with their otherwise undocumented quirks,
+would not have been possible without his efforts.
diff --git a/share/man/man4/bwi.4 b/share/man/man4/bwi.4
new file mode 100644
index 000000000000..fe1ea65b4e68
--- /dev/null
+++ b/share/man/man4/bwi.4
@@ -0,0 +1,148 @@
+.\" Copyright (c) 2009 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 6, 2011
+.Dt BWI 4
+.Os
+.Sh NAME
+.Nm bwi
+.Nd Broadcom BCM43xx IEEE 802.11b/g wireless network driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device bwi"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bwi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Broadcom BCM43xx based
+PCI/CardBus network adapters.
+.Pp
+It supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires firmware to be loaded before it will work.
+The
+.Pa ports/net/bwi-firmware-kmod
+port needs to be installed before
+.Xr ifconfig 8
+will work.
+.Sh HARDWARE
+The
+.Nm
+driver supports Broadcom BCM43xx based wireless devices, including:
+.Bl -column "Apple Airport Extreme" "BCM4306" "Mini PCI" "a/b/g" -offset 6n
+.It Em "Card" Ta Em "Chip" Ta Em "Bus" Ta Em "Standard"
+.It "Apple Airport Extreme BCM4306 PCI b/g"
+.It "Apple Airport Extreme BCM4318 PCI b/g"
+.It "ASUS WL-138g BCM4318 PCI b/g"
+.It "Buffalo WLI-CB-G54S BCM4318 CardBus b/g"
+.It "Buffalo WLI-PCI-G54S BCM4306 PCI b/g"
+.It "Compaq R4035 onboard BCM4306 PCI b/g"
+.It "Dell Wireless 1390 BCM4311 Mini PCI b/g"
+.It "Dell Wireless 1470 BCM4318 Mini PCI b/g"
+.It "Dell Truemobile 1300 r2 BCM4306 Mini PCI b/g"
+.It "Dell Truemobile 1400 BCM4309 Mini PCI b/g"
+.It "HP nx6125 BCM4319 PCI b/g"
+.It "Linksys WPC54G Ver 3 BCM4318 CardBus b/g"
+.It "Linksys WPC54GS Ver 2 BCM4318 CardBus b/g"
+.It "TRENDnet TEW-401PCplus BCM4306 CardBus b/g"
+.It "US Robotics 5411 BCM4318 CardBus b/g"
+.El
+.Pp
+The
+.Nm
+driver uses the older v3 version of Broadcom's firmware.
+While this older firmware does support most BCM43xx parts, the
+.Xr bwn 4
+driver works better for the newer chips it supports.
+You must use the
+.Nm
+driver if you are using older Broadcom chipsets (BCM4301, BCM4303 and
+BCM4306 rev 2).
+The v4 version of the firmware that
+.Xr bwn 4
+uses does not support these chips.
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwi0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev bwi0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwi0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr cardbus 4 ,
+.Xr intro 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for DragonFly BSD by
+.An Sepherosa Ziehau
+and subsequently ported to
+.Fx .
+.Sh BUGS
+Some card based on the BCM4306 and BCM4309 chips do not work properly
+on channel 1, 2 and 3.
diff --git a/share/man/man4/bwn.4 b/share/man/man4/bwn.4
new file mode 100644
index 000000000000..4aa75fda4944
--- /dev/null
+++ b/share/man/man4/bwn.4
@@ -0,0 +1,156 @@
+.\" Copyright (c) 2009 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 15, 2011
+.Dt BWN 4
+.Os
+.Sh NAME
+.Nm bwn
+.Nd Broadcom BCM43xx IEEE 802.11b/g wireless network driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device siba_bwn"
+.Cd "device bwn"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bwn_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Broadcom BCM43xx based
+PCI/CardBus network adapters.
+.Pp
+It supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires firmware to be loaded before it will work.
+The
+.Pa ports/net/bwn-firmware-kmod
+port needs to be installed before
+.Xr ifconfig 8
+will work.
+Most cases you need to use bwn_v4_ucode module but if you are a
+LP (low power) PHY user please uses bwn_v4_lp_ucode module.
+.Sh HARDWARE
+The
+.Nm
+driver supports Broadcom BCM43xx based wireless devices, including:
+.Bl -column "Apple Airport Extreme" "BCM4306" "Mini PCI" "a/b/g"
+.It Em "Card" Ta Em "Chip" Ta Em "Bus" Ta Em "Standard"
+.It "Apple Airport Extreme BCM4318 PCI b/g"
+.It "ASUS WL-138g BCM4318 PCI b/g"
+.It "Buffalo WLI-CB-G54S BCM4318 CardBus b/g"
+.It "Dell Wireless 1390 BCM4311 Mini PCI b/g"
+.It "Dell Wireless 1470 BCM4318 Mini PCI b/g"
+.It "Dell Truemobile 1400 BCM4309 Mini PCI b/g"
+.It "HP Compaq 6715b BCM4312 PCI b/g"
+.It "HP nx6125 BCM4319 PCI b/g"
+.It "Linksys WPC54G Ver 3 BCM4318 CardBus b/g"
+.It "Linksys WPC54GS Ver 2 BCM4318 CardBus b/g"
+.It "US Robotics 5411 BCM4318 CardBus b/g"
+.El
+.Pp
+Users of older Broadcom chipsets (BCM4301, BCM4303 and BCM4306 rev 2)
+must use
+.Xr bwi 4
+because the v4 version of the firmware does not support these chips.
+The newer firmware is too big to fit into these old chips.
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwn0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev bwn0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev bwn0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.bwn.msi_disable
+This tunable disables MSI support on the hardware.
+The default value is 0.
+.It Va hw.bwn.usedma
+This tunable enables DMA operations on the hardware.
+If the value is 0, PIO mode would be used.
+The default value is 1.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr bwi 4 ,
+.Xr cardbus 4 ,
+.Xr intro 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Weongyo Jeong
+.Aq weongyo@FreeBSD.org .
+.\".Sh BUGS
+.\"Some card based on the BCM4306 and BCM4309 chips do not work properly
+.\"on channel 1, 2 and 3.
+.Sh CAVEATS
+Some LP PHY devices have DMA operation problems that in that case try to
+use PIO mode.
diff --git a/share/man/man4/capsicum.4 b/share/man/man4/capsicum.4
new file mode 100644
index 000000000000..980ab79152ee
--- /dev/null
+++ b/share/man/man4/capsicum.4
@@ -0,0 +1,120 @@
+.\"
+.\" Copyright (c) 2011 Robert N. M. Watson
+.\" Copyright (c) 2011 Jonathan Anderson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 20, 2011
+.Dt CAPSICUM 4
+.Os
+.Sh NAME
+.Nm Capsicum
+.Nd lightweight OS capability and sandbox framework
+.Sh SYNOPSIS
+.Cd "options CAPABILITY_MODE"
+.Cd "options CAPABILITIES"
+.Cd "options PROCDESC"
+.Sh DESCRIPTION
+.Nm
+is a lightweight OS capability and sandbox framework implementing a hybrid
+capability system model.
+.Nm
+can be used for application and library compartmentalisation, the
+decomposition of larger bodies of software into isolated (sandboxed)
+components in order to implement security policies and limit the impact of
+software vulnerabilities.
+.Pp
+.Nm
+provides two core kernel primitives:
+.Bl -tag -width indent
+.It capability mode
+A process mode, entered by invoking
+.Xr cap_enter 2 ,
+in which access to global OS namespaces (such as the file system and PID
+namespaces) is restricted; only explicitly delegated rights, referenced by
+memory mappings or file descriptors, may be used.
+Once set, the flag is inherited by future children proceses, and may not be
+cleared.
+.It capabilities
+File descriptors that wrap other file descriptors, masking operations that can
+be called on them; for example, a file descriptor returned by
+.Xr open 2
+may be refined using
+.Xr cap_new 2
+so that only
+.Xr read 2
+and
+.Xr write 2
+can be called, but not
+.Xr fchmod 2 .
+.El
+.Pp
+In some cases,
+.Nm
+requires use of alternatives to traditional POSIX APIs in order to name
+objects using capabilities rather than global namespaces:
+.Bl -tag -width indent
+.It process descriptors
+File descriptors representing processes, allowing parent processes to manage
+child processes without requiring access to the PID namespace.
+.It anonymous shared memory
+An extension to the POSIX shared memory API to support anonymous swap objects
+associated with file descriptors.
+.El
+.Sh SEE ALSO
+.Xr cap_enter 2 ,
+.Xr cap_getmode 2 ,
+.Xr cap_getrights 2 ,
+.Xr cap_new 2 ,
+.Xr fchmod 2 ,
+.Xr open 2 ,
+.Xr pdfork 2 ,
+.Xr pdgetpid 2 ,
+.Xr pdkill 2 ,
+.Xr pdwait4 2 ,
+.Xr read 2 ,
+.Xr shm_open 2 ,
+.Xr write 2
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 9.0 ,
+and was developed at the University of Cambridge.
+.Sh AUTHORS
+.Nm
+was developed by
+.An -nosplit
+.An "Robert Watson" Aq rwatson@FreeBSD.org
+and
+.An "Jonathan Anderson" Aq jonathan@FreeBSD.org
+at the University of Cambridge, and
+.An "Ben Laurie" Aq benl@FreeBSD.org
+and
+.An "Kris Kennaway" Aq kris@FreeBSD.org
+at Google, Inc.
+.Sh BUGS
+.Nm
+is considered experimental in
+.Fx .
diff --git a/share/man/man4/cardbus.4 b/share/man/man4/cardbus.4
new file mode 100644
index 000000000000..1c3600a91683
--- /dev/null
+++ b/share/man/man4/cardbus.4
@@ -0,0 +1,59 @@
+.\"
+.\" Copyright (c) 2002 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2002
+.Dt CARDBUS 4
+.Os
+.Sh NAME
+.Nm cardbus
+.Nd CardBus bus driver
+.Sh SYNOPSIS
+.Cd device cardbus
+.Sh DESCRIPTION
+The
+.Nm
+driver implements the CardBus bus.
+The
+.Nm
+driver supports all cardbus bridges in the system.
+.Sh TUNABLES
+The driver supports the following tunable parameters, which may be
+added to
+.Pa /boot/loader.conf
+or set via the
+.Xr sysctl 8
+command:
+.Bl -tag -width ".Cm hw.cardbus.cis_debug" -compact
+.It Cm hw.cardbus.debug
+Non-zero values cause more verbose information to be printed when a
+32-bit CardBus card is inserted or removed.
+.It Cm hw.cardbus.cis_debug
+Non-zero value causes the CIS parsing of the 32-bit CardBus card to be
+much more verbose and include a complete CIS dump.
+.El
+.Sh SEE ALSO
+.Xr pccard 4 ,
+.Xr pccbb 4
diff --git a/share/man/man4/carp.4 b/share/man/man4/carp.4
new file mode 100644
index 000000000000..05e4ece5f326
--- /dev/null
+++ b/share/man/man4/carp.4
@@ -0,0 +1,301 @@
+.\" $OpenBSD: carp.4,v 1.16 2004/12/07 23:41:35 jmc Exp $
+.\"
+.\" Copyright (c) 2003, Ryan McBride. All rights reserved.
+.\" Copyright (c) 2011, Gleb Smirnoff <glebius@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2012
+.Dt CARP 4
+.Os
+.Sh NAME
+.Nm carp
+.Nd Common Address Redundancy Protocol
+.Sh SYNOPSIS
+.Cd "device carp"
+.Sh DESCRIPTION
+The CARP allows multiple hosts on the same local network to share a set of
+IPv4 and/or IPv6 addresses.
+Its primary purpose is to ensure that these
+addresses are always available.
+.Pp
+To use
+.Nm ,
+the administrator needs to configure at minimum a common virtual host ID
+(vhid) and attach at least one IP address to this vhid on each machine which
+is to take part in the virtual group.
+Additional parameters can also be set on a per-vhid basis:
+.Cm advbase
+and
+.Cm advskew ,
+which are used to control how frequently the host sends advertisements when it
+is the master for a virtual host, and
+.Cm pass
+which is used to authenticate
+.Nm
+advertisements.
+The
+.Cm advbase
+parameter stands for
+.Dq "advertisement base" .
+It is measured in seconds and specifies the base of the advertisement interval.
+The
+.Cm advskew
+parameter stands for
+.Dq "advertisement skew" .
+It is measured in 1/256 of seconds.
+It is added to the base advertisement interval to make one host advertise
+a bit slower that the other does.
+Both
+.Cm advbase
+and
+.Cm advskew
+are put inside CARP advertisements.
+These configurations can be done using
+.Xr ifconfig 8 ,
+or through the
+.Dv SIOCSVH
+.Xr ioctl 2 .
+.Pp
+CARP virtual hosts can be configured on multicast capable interfaces: Ethernet,
+layer 2 VLAN, FDDI and Token Ring.
+An arbitrary number of virtual host IDs can be configured on an interface.
+An arbitrary number of IPv4 or IPv6 addresses can be attached to a particular
+vhid.
+It is important that all hosts participating in a vhid have the same list
+of prefixes configured on the vhid, since all prefixes are included in the
+cryptographic checksum supplied in each advertisement.
+Multiple vhids running on one interface participate in master/backup
+elections independently.
+.Pp
+Additionally, there are a number of global parameters which can be set using
+.Xr sysctl 8 :
+.Bl -tag -width ".Va net.inet.carp.preempt"
+.It Va net.inet.carp.allow
+Accept incoming
+.Nm
+packets.
+Enabled by default.
+.It Va net.inet.carp.preempt
+Allow virtual hosts to preempt each other.
+When enabled, a vhid in a backup state would preempt a master that
+is announcing itself with a lower advskew.
+Disabled by default.
+.It Va net.inet.carp.log
+Value of 0 disables any logging.
+Value of 1 enables logging state changes of
+.Nm
+vhids.
+Values above 1 enable logging of bad
+.Nm
+packets.
+Default value is 1.
+.It Va net.inet.carp.demotion
+This value shows current level of CARP demotion.
+The value is added to the actual advskew sent in announcements for
+all vhids.
+At normal system operation the demotion factor is zero.
+However, problematic conditions raise its level: when
+.Nm
+experiences problem with sending announcements, when an interface
+running a vhid goes down, or while the
+.Xr pfsync 4
+interface is not synchronized.
+The demotion value is writable, so that user may alter it
+depending on some external conditions, for example on status of some
+daemon utility.
+However, altering the value should be performed with care, do
+not conflict with subsystems that adjust demotion factor
+automatically:
+.Nm
+and
+.Xr pfsync 4 .
+.It Va net.inet.carp.ifdown_demotion_factor
+Value added to
+.Va net.inet.carp.demotion
+when interface running a vhid goes down.
+Default value is 240 (maximum advskew value).
+.It Va net.inet.carp.senderr_demotion_factor
+Value added to
+.Va net.inet.carp.demotion
+when
+.Nm
+experiences errors sending its announcements.
+Default value is 240 (maximum advskew value).
+.El
+.\".Sh ARP level load balancing
+.\"The
+.\".Nm
+.\"has limited abilities for load balancing the incoming connections
+.\"between hosts in Ethernet network.
+.\"For load balancing operation, one needs several CARP interfaces that
+.\"are configured to the same IP address, but to a different vhids.
+.\"Once an ARP request is received, the CARP protocol will use a hashing
+.\"function against the source IP address in the ARP request to determine
+.\"which vhid should this request belong to.
+.\"If the corresponding CARP interface is in master state, the ARP request
+.\"will be replied, otherwise it will be ignored.
+.\"See the
+.\".Sx EXAMPLES
+.\"section for a practical example of load balancing.
+.\".Pp
+.\"The ARP load balancing has some limitations.
+.\"First, ARP balancing only works on the local network segment.
+.\"It cannot balance traffic that crosses a router, because the
+.\"router itself will always be balanced to the same virtual host.
+.\"Second, ARP load balancing can lead to asymmetric routing
+.\"of incoming and outgoing traffic, and thus combining it with
+.\".Xr pfsync 4
+.\"is dangerous, because this creates a race condition between
+.\"balanced routers and a host they are serving.
+.\"Imagine an incoming packet creating state on the first router, being
+.\"forwarded to its destination, and destination replying faster
+.\"than the state information is packed and synced with the second router.
+.\"If the reply would be load balanced to second router, it will be
+.\"dropped due to no state.
+.Sh STATE CHANGE NOTIFICATIONS
+Sometimes it is useful to get notified about
+.Nm
+status change events.
+This can be accomplished by using
+.Xr devd 8
+hooks.
+Master/slave events are signalled under system
+.Dv CARP .
+Subsystem specifies vhid and name of interface, where event occurred.
+Type of the message displays new state of vhid.
+Please see
+.Xr devd.conf 5
+and
+.Sx EXAMPLES
+section for more information.
+.Sh EXAMPLES
+For firewalls and routers with multiple interfaces, it is desirable to
+failover all of the addresses running
+.Nm
+together, when one of the physical interfaces goes down.
+This is achieved by the preempt option.
+Enable it on both host A and B:
+.Pp
+.Dl sysctl net.inet.carp.preempt=1
+.Pp
+Assume that host A is the preferred master and we are running the
+192.168.1.0/24 prefix on em0 and 192.168.2.0/24 on em1.
+This is the setup for host A:
+.Bd -literal -offset indent
+ifconfig em0 vhid 1 pass mekmitasdigoat 192.168.1.1/24
+ifconfig em1 vhid 2 pass mekmitasdigoat 192.168.2.1/24
+.Ed
+.Pp
+The setup for host B is identical, but it has a higher
+.Cm advskew :
+.Bd -literal -offset indent
+ifconfig em0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.1/24
+ifconfig em1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.2.1/24
+.Ed
+.Pp
+When one of the physical interfaces of host A fails,
+.Cm advskew
+is demoted to a configured value on all its
+.Nm
+vhids.
+Due to the preempt option, host B would start announcing itself, and thus
+preempt host A on both interfaces instead of just the failed one.
+.\".Pp
+.\"In order to set up an ARP balanced virtual host, it is necessary to configure
+.\"one virtual host for each physical host which would respond to ARP requests
+.\"and thus handle the traffic.
+.\"In the following example, two virtual hosts are configured on two hosts to
+.\"provide balancing and failover for the IP address 192.168.1.10.
+.\".Pp
+.\"First the
+.\".Nm
+.\"interfaces on host A are configured.
+.\"The
+.\".Cm advskew
+.\"of 100 on the second virtual host means that its advertisements will be sent
+.\"out slightly less frequently.
+.\".Bd -literal -offset indent
+.\"ifconfig carp0 create
+.\"ifconfig carp0 vhid 1 pass mekmitasdigoat 192.168.1.10/24
+.\"ifconfig carp1 create
+.\"ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.1.10/24
+.\".Ed
+.\".Pp
+.\"The configuration for host B is identical, except the
+.\".Cm advskew
+.\"is on virtual host 1 rather than virtual host 2.
+.\".Bd -literal -offset indent
+.\"ifconfig carp0 create
+.\"ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.10/24
+.\"ifconfig carp1 create
+.\"ifconfig carp1 vhid 2 pass mekmitasdigoat 192.168.1.10/24
+.\".Ed
+.\".Pp
+.\"Finally, the ARP balancing feature must be enabled on both hosts:
+.\".Pp
+.\".Dl sysctl net.inet.carp.arpbalance=1
+.\".Pp
+.\"When the hosts receive an ARP request for 192.168.1.10, the source IP address
+.\"of the request is used to compute which virtual host should answer the request.
+.\"The host which is master of the selected virtual host will reply to the
+.\"request, the other(s) will ignore it.
+.\".Pp
+.\"This way, locally connected systems will receive different ARP replies and
+.\"subsequent IP traffic will be balanced among the hosts.
+.\"If one of the hosts fails, the other will take over the virtual MAC address,
+.\"and begin answering ARP requests on its behalf.
+.Pp
+Processing of
+.Nm
+status change events can be set up by using the following devd.conf rule:
+.Bd -literal -offset indent
+notify 0 {
+ match "system" "CARP";
+ match "subsystem" "[0-9]+@";
+ match "type" "(MASTER|BACKUP)";
+ action "/root/carpcontrol.sh $subsystem $type";
+};
+.Ed
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr pfsync 4 ,
+.Xr rc.conf 5 ,
+.Xr devd.conf 5 ,
+.Xr ifconfig 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Ox 3.5 .
+The
+.Nm
+device was imported into
+.Fx 5.4 .
+In
+.Fx 10
+the
+.Nm
+was significantly rewritten, and is no longer a pseudo-interface.
diff --git a/share/man/man4/cas.4 b/share/man/man4/cas.4
new file mode 100644
index 000000000000..0c0f5d7ab462
--- /dev/null
+++ b/share/man/man4/cas.4
@@ -0,0 +1,159 @@
+.\"
+.\" Copyright (c) 2009 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 24, 2012
+.Dt CAS 4
+.Os
+.Sh NAME
+.Nm cas
+.Nd Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn Gigabit Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device cas"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cas="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Sun Cassini/Cassini+ and National
+Semiconductor DP83065 Saturn Gigabit Ethernet controllers found
+on-board in Sun UltraSPARC machines and as add-on cards.
+.Pp
+All controllers supported by the
+.Nm
+driver have TCP/UDP checksum offload capability for both receive and
+transmit, support for the reception and transmission of extended frames
+for
+.Xr vlan 4
+and an interrupt coalescing/moderation mechanism as well as a 512-bit
+multicast hash filter.
+.Pp
+The
+.Nm
+driver also supports Jumbo Frames (up to 9022 bytes), which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Sh HARDWARE
+The chips supported by the
+.Nm
+driver are:
+.Pp
+.Bl -bullet -compact
+.It
+National Semiconductor DP83065 Saturn Gigabit Ethernet
+.It
+Sun Cassini Gigabit Ethernet
+.It
+Sun Cassini+ Gigabit Ethernet
+.El
+.Pp
+The
+following add-on cards are known to work with the
+.Nm
+driver at this time:
+.Pp
+.Bl -bullet -compact
+.It
+Sun GigaSwift Ethernet 1.0 MMF (Cassini Kuheen)
+(part no.\& 501-5524)
+.It
+Sun GigaSwift Ethernet 1.0 UTP (Cassini)
+(part no.\& 501-5902)
+.It
+Sun GigaSwift Ethernet UTP (GCS)
+(part no.\& 501-6719)
+.It
+Sun Quad GigaSwift Ethernet UTP (QGE)
+(part no.\& 501-6522)
+.It
+Sun Quad GigaSwift Ethernet PCI-X (QGE-X)
+(part no.\& 501-6738)
+.El
+.Sh NOTES
+On sparc64 the
+.Nm
+driver respects the
+.Va local-mac-address?
+system configuration variable which can be set in the Open Firmware boot
+monitor using the
+.Ic setenv
+command or by
+.Xr eeprom 8 .
+If set to
+.Dq Li false
+(the default), the
+.Nm
+driver will use the system's default MAC address for all of its devices.
+If set to
+.Dq Li true ,
+the unique MAC address of each interface is used if present rather than
+the system's default MAC address.
+.Pp
+Supported interfaces having their own MAC address include on-board
+versions on boards equipped with more than one Ethernet interface and
+all add-on cards.
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr vlan 4 ,
+.Xr eeprom 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0
+and
+.Fx 7.3 .
+It is named after the
+.Nm
+driver which first appeared in
+.Ox 4.1
+and supports the same set of controllers but is otherwise unrelated.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Marius Strobl
+.Aq marius@FreeBSD.org
+based on the
+.Xr gem 4
+driver.
diff --git a/share/man/man4/cc_chd.4 b/share/man/man4/cc_chd.4
new file mode 100644
index 000000000000..39cdef3b601d
--- /dev/null
+++ b/share/man/man4/cc_chd.4
@@ -0,0 +1,128 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_CHD 4
+.Os
+.Sh NAME
+.Nm cc_chd
+.Nd CHD Congestion Control Algorithm
+.Sh DESCRIPTION
+CHD enhances the HD algorithm implemented in
+.Xr cc_hd 4 .
+It provides tolerance to non-congestion related packet loss and improvements to
+coexistence with traditional loss-based TCP flows, especially when the
+bottleneck link is lightly multiplexed.
+.Pp
+Like HD, the algorithm aims to keep network queuing delays below a particular
+threshold (queue_threshold) and decides to reduce the congestion window (cwnd)
+probabilistically based on its estimate of the network queuing delay.
+.Pp
+It differs from HD in three key aspects:
+.Bl -bullet
+.It
+The probability of cwnd reduction due to congestion is calculated once per round
+trip time instead of each time an acknowledgement is received as done by
+.Xr cc_hd 4 .
+.It
+Packet losses that occur while the queuing delay is less than queue_threshold
+do not cause cwnd to be reduced.
+.It
+CHD uses a shadow window to help regain lost transmission opportunities when
+competing with loss-based TCP flows.
+.El
+.Sh MIB Variables
+The algorithm exposes the following tunable variables in the
+.Va net.inet.tcp.cc.chd
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va queue_threshold"
+.It Va queue_threshold
+Queueing congestion threshold (qth) in ticks.
+Default is 20.
+.It Va pmax
+Per RTT maximum backoff probability as a percentage.
+Default is 50.
+.It Va qmin
+Minimum queuing delay threshold (qmin) in ticks.
+Default is 5.
+.It Va loss_fair
+If 1, cwnd is adjusted using the shadow window when a congestion
+related loss is detected.
+Default is 1.
+.It Va use_max
+If 1, the maximum RTT seen within the measurement period is used as the basic
+delay measurement for the algorithm, otherwise a sampled RTT measurement
+is used.
+Default is 1.
+.El
+.Sh SEE ALSO
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A "D. A. Hayes"
+.%A "G. Armitage"
+.%T "Improved coexistence and loss tolerance for delay based TCP congestion control"
+.%J "in 35th Annual IEEE Conference on Local Computer Networks"
+.%D "October 2010"
+.%P "24-31"
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2010 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module and this manual page were written by
+.An David Hayes Aq david.hayes@ieee.org .
diff --git a/share/man/man4/cc_cubic.4 b/share/man/man4/cc_cubic.4
new file mode 100644
index 000000000000..771f2643b9bb
--- /dev/null
+++ b/share/man/man4/cc_cubic.4
@@ -0,0 +1,114 @@
+.\"
+.\" Copyright (c) 2009 Lawrence Stewart <lstewart@FreeBSD.org>
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this documentation were written at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_CUBIC 4
+.Os
+.Sh NAME
+.Nm cc_cubic
+.Nd CUBIC Congestion Control Algorithm
+.Sh DESCRIPTION
+The CUBIC congestion control algorithm was designed to provide increased
+throughput in fast and long-distance networks.
+It attempts to maintain fairness when competing with legacy NewReno TCP in lower
+speed scenarios where NewReno is able to operate adequately.
+.Pp
+The congestion window is increased as a function of the time elapsed since the
+last congestion event.
+During regular operation, the window increase function follows a cubic function,
+with the inflection point set to be the congestion window value reached at the
+last congestion event.
+CUBIC also calculates an estimate of the congestion window that NewReno would
+have achieved at a given time after a congestion event.
+When updating the congestion window, the algorithm will choose the larger of the
+calculated CUBIC and estimated NewReno windows.
+.Pp
+CUBIC also backs off less on congestion by changing the multiplicative decrease
+factor from 1/2 (used by standard NewReno TCP) to 4/5.
+.Pp
+The implementation was done in a clean-room fashion, and is based on the
+Internet Draft and paper referenced in the
+.Sx SEE ALSO
+section below.
+.Sh MIB Variables
+There are currently no tunable MIB variables.
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr mod_cc 9
+.Rs
+.%A "Sangtae Ha"
+.%A "Injong Rhee"
+.%A "Lisong Xu"
+.%T "CUBIC for Fast Long-Distance Networks"
+.%U "http://tools.ietf.org/id/draft-rhee-tcpm-cubic-02.txt"
+.Re
+.Rs
+.%A "Sangtae Ha"
+.%A "Injong Rhee"
+.%A "Lisong Xu"
+.%T "CUBIC: a new TCP-friendly high-speed TCP variant"
+.%J "SIGOPS Oper. Syst. Rev."
+.%V "42"
+.%N "5"
+.%D "July 2008"
+.%P "64-74"
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2009 by Lawrence Stewart whilst studying at
+Swinburne University of Technology's Centre for Advanced Internet Architectures,
+Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module and this manual page were written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org
+and
+.An David Hayes Aq david.hayes@ieee.org .
diff --git a/share/man/man4/cc_hd.4 b/share/man/man4/cc_hd.4
new file mode 100644
index 000000000000..d0acb34c05ec
--- /dev/null
+++ b/share/man/man4/cc_hd.4
@@ -0,0 +1,120 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_HD 4
+.Os
+.Sh NAME
+.Nm cc_hd
+.Nd HD Congestion Control Algorithm
+.Sh DESCRIPTION
+The HD congestion control algorithm is an implementation of the Hamilton
+Institute's delay-based congestion control which aims to keep network queuing
+delays below a particular threshold (queue_threshold).
+.Pp
+HD probabilistically reduces the congestion window (cwnd) based on its estimate
+of the network queuing delay.
+The probability of reducing cwnd is zero at hd_qmin or less, rising to a maximum
+at queue_threshold, and then back to zero at the maximum queuing delay.
+.Pp
+Loss-based congestion control algorithms such as NewReno probe for network
+capacity by filling queues until there is a packet loss.
+HD competes with loss-based congestion control algorithms by allowing its
+probability of reducing cwnd to drop from a maximum at queue_threshold to be
+zero at the maximum queuing delay.
+This has been shown to work well when the bottleneck link is highly multiplexed.
+.Sh MIB Variables
+The algorithm exposes the following tunable variables in the
+.Va net.inet.tcp.cc.hd
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va queue_threshold"
+.It Va queue_threshold
+Queueing congestion threshold (qth) in ticks.
+Default is 20.
+.It Va pmax
+Per packet maximum backoff probability as a percentage.
+Default is 5.
+.It Va qmin
+Minimum queuing delay threshold (qmin) in ticks.
+Default is 5.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A "L. Budzisz"
+.%A "R. Stanojevic"
+.%A "R. Shorten"
+.%A "F. Baker"
+.%T "A strategy for fair coexistence of loss and delay-based congestion control algorithms"
+.%J "IEEE Commun. Lett."
+.%D "Jul 2009"
+.%V "13"
+.%N "7"
+.%P "555-557"
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh FUTURE WORK
+The Hamilton Institute have recently made some improvements to the algorithm
+implemented by this module and have called it Coexistent-TCP (C-TCP).
+The improvements should be evaluated and potentially incorporated into this
+module.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2010 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module and this manual page were written by
+.An David Hayes Aq david.hayes@ieee.org .
diff --git a/share/man/man4/cc_htcp.4 b/share/man/man4/cc_htcp.4
new file mode 100644
index 000000000000..45d00186c878
--- /dev/null
+++ b/share/man/man4/cc_htcp.4
@@ -0,0 +1,136 @@
+.\"
+.\" Copyright (c) 2008 Lawrence Stewart <lstewart@FreeBSD.org>
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this documentation were written at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_HTCP 4
+.Os
+.Sh NAME
+.Nm cc_htcp
+.Nd H-TCP Congestion Control Algorithm
+.Sh DESCRIPTION
+The H-TCP congestion control algorithm was designed to provide increased
+throughput in fast and long-distance networks.
+It attempts to maintain fairness when competing with legacy NewReno TCP in lower
+speed scenarios where NewReno is able to operate adequately.
+.Pp
+The congestion window is increased as a function of the time elapsed since the
+last congestion event.
+The window increase algorithm operates like NewReno for the first second after a
+congestion event, and then switches to a high-speed mode based on a quadratic
+increase function.
+.Pp
+The implementation was done in a clean-room fashion, and is based on the
+Internet Draft and other documents referenced in the
+.Sx SEE ALSO
+section below.
+.Sh MIB Variables
+The algorithm exposes the following tunable variables in the
+.Va net.inet.tcp.cc.htcp
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va adaptive_backoff"
+.It Va adaptive_backoff
+Controls use of the adaptive backoff algorithm, which is designed to keep
+network queues non-empty during congestion recovery episodes.
+Default is 0 (disabled).
+.It Va rtt_scaling
+Controls use of the RTT scaling algorithm, which is designed to make congestion
+window increase during congestion avoidance mode invariant with respect to RTT.
+Default is 0 (disabled).
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr mod_cc 9
+.Rs
+.%A "D. Leith"
+.%A "R. Shorten"
+.%T "H-TCP: TCP Congestion Control for High Bandwidth-Delay Product Paths"
+.%U "http://tools.ietf.org/id/draft-leith-tcp-htcp-06.txt"
+.Re
+.Rs
+.%A "D. Leith"
+.%A "R. Shorten"
+.%A "T. Yee"
+.%T "H-TCP: A framework for congestion control in high-speed and long-distance networks"
+.%B "Proc. PFLDnet"
+.%D "2005"
+.Re
+.Rs
+.%A "G. Armitage"
+.%A "L. Stewart"
+.%A "M. Welzl"
+.%A "J. Healy"
+.%T "An independent H-TCP implementation under FreeBSD 7.0: description and observed behaviour"
+.%J "SIGCOMM Comput. Commun. Rev."
+.%V "38"
+.%N "3"
+.%D "July 2008"
+.%P "27-38"
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2007 by James Healy and Lawrence Stewart whilst
+working on the NewTCP research project at Swinburne University of Technology's
+Centre for Advanced Internet Architectures, Melbourne, Australia, which was made
+possible in part by a grant from the Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module was written by
+.An James Healy Aq jimmy@deefa.com
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org
+and
+.An David Hayes Aq david.hayes@ieee.org .
diff --git a/share/man/man4/cc_newreno.4 b/share/man/man4/cc_newreno.4
new file mode 100644
index 000000000000..fe4c3db306b4
--- /dev/null
+++ b/share/man/man4/cc_newreno.4
@@ -0,0 +1,82 @@
+.\"
+.\" Copyright (c) 2009 Lawrence Stewart <lstewart@FreeBSD.org>
+.\" Copyright (c) 2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this documentation were written at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_NEWRENO 4
+.Os
+.Sh NAME
+.Nm cc_newreno
+.Nd NewReno Congestion Control Algorithm
+.Sh DESCRIPTION
+The NewReno congestion control algorithm is the default for TCP.
+Details about the algorithm can be found in RFC5681.
+.Sh MIB Variables
+There are currently no tunable MIB variables.
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_vegas 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr mod_cc 9
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+congestion control algorithm first appeared in its modular form in
+.Fx 9.0 .
+.Pp
+The module was first released in 2007 by James Healy and Lawrence Stewart whilst
+working on the NewTCP research project at Swinburne University of Technology's
+Centre for Advanced Internet Architectures, Melbourne, Australia, which was made
+possible in part by a grant from the Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module was written by
+.An James Healy Aq jimmy@deefa.com ,
+.An Lawrence Stewart Aq lstewart@FreeBSD.org
+and
+.An David Hayes Aq david.hayes@ieee.org .
+.Pp
+This manual page was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man4/cc_vegas.4 b/share/man/man4/cc_vegas.4
new file mode 100644
index 000000000000..a7397d58d20d
--- /dev/null
+++ b/share/man/man4/cc_vegas.4
@@ -0,0 +1,136 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt CC_VEGAS 4
+.Os
+.Sh NAME
+.Nm cc_vegas
+.Nd Vegas Congestion Control Algorithm
+.Sh DESCRIPTION
+The Vegas congestion control algorithm uses what the authors term the actual and
+expected transmission rates to determine whether there is congestion along the
+network path i.e.
+.Bl -item -offset indent
+.It
+actual rate = (total data sent in a RTT) / RTT
+.It
+expected rate = cwnd / RTTmin
+.It
+diff = expected - actual
+.El
+.Pp
+where RTT is the measured instantaneous round trip time and RTTmin is the
+smallest round trip time observed during the connection.
+.Pp
+The algorithm aims to keep diff between two parameters alpha and beta, such
+that:
+.Bl -item -offset indent
+.It
+alpha < diff < beta
+.El
+.Pp
+If diff > beta, congestion is inferred and cwnd is decremented by one packet (or
+the maximum TCP segment size).
+If diff < alpha, then cwnd is incremented by one packet.
+Alpha and beta govern the amount of buffering along the path.
+.Pp
+The implementation was done in a clean-room fashion, and is based on the
+paper referenced in the
+.Sx SEE ALSO
+section below.
+.Sh IMPLEMENTATION NOTES
+The time from the transmission of a marked packet until the receipt of an
+acknowledgement for that packet is measured once per RTT.
+This implementation does not implement Brakmo's and Peterson's original
+duplicate ACK policy since clock ticks in today's machines are not as coarse as
+they were (i.e. 500ms) when Vegas was originally designed.
+Note that modern TCP recovery processes such as fast retransmit and SACK are
+enabled by default in the TCP stack.
+.Sh MIB Variables
+The algorithm exposes the following tunable variables in the
+.Va net.inet.tcp.cc.vegas
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va alpha"
+.It Va alpha
+Query or set the Vegas alpha parameter as a number of buffers on the path.
+When setting alpha, the value must satisfy: 0 < alpha < beta.
+Default is 1.
+.It Va beta
+Query or set the Vegas beta parameter as a number of buffers on the path.
+When setting beta, the value must satisfy: 0 < alpha < beta.
+Default is 3.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr h_ertt 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4 ,
+.Xr khelp 9 ,
+.Xr mod_cc 9
+.Rs
+.%A "L. S. Brakmo"
+.%A "L. L. Peterson"
+.%T "TCP Vegas: end to end congestion avoidance on a global internet"
+.%J "IEEE J. Sel. Areas Commun."
+.%D "October 1995"
+.%V "13"
+.%N "8"
+.%P "1465-1480"
+.Re
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+congestion control module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2010 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+congestion control module and this manual page were written by
+.An David Hayes Aq david.hayes@ieee.org .
diff --git a/share/man/man4/ccd.4 b/share/man/man4/ccd.4
new file mode 100644
index 000000000000..8da0e360490a
--- /dev/null
+++ b/share/man/man4/ccd.4
@@ -0,0 +1,287 @@
+.\" $NetBSD: ccd.4,v 1.5 1995/10/09 06:09:09 thorpej Exp $
+.\"
+.\" Copyright (c) 1994 Jason Downs.
+.\" Copyright (c) 1994, 1995 Jason R. Thorpe.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Jason Downs and Jason R. Thorpe.
+.\" 4. Neither the name of the author nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 9, 1995
+.Dt CCD 4
+.Os
+.Sh NAME
+.Nm ccd
+.Nd Concatenated Disk driver
+.Sh SYNOPSIS
+.Cd "device ccd"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides the capability of combining one or more disks/partitions
+into one virtual disk.
+.Pp
+This document assumes that you are familiar with how to generate kernels,
+how to properly configure disks and devices in a kernel
+configuration file, and how to partition disks.
+.Pp
+In order to compile in support for the
+.Nm ,
+you must add a line similar
+to the following to your kernel configuration file:
+.Pp
+.Dl "device ccd # concatenated disk devices"
+.Pp
+As of the
+.Fx 3.0
+release, you do not need to
+configure your kernel with
+.Nm
+but may instead use it as a kernel loadable
+module.
+Simply running
+.Xr ccdconfig 8
+will load the module into the kernel.
+.Pp
+A
+.Nm
+may be either serially concatenated or interleaved.
+To serially
+concatenate the partitions, specify the interleave factor of 0.
+Note that mirroring may not be used with an interleave factor of 0.
+.Pp
+There is a run-time utility that is used for configuring
+.Nm Ns s .
+See
+.Xr ccdconfig 8
+for more information.
+.Ss The Interleave Factor
+If a
+.Nm
+is interleaved correctly, a
+.Dq striping
+effect is achieved, which can increase sequential read/write
+performance.
+The interleave factor is expressed in units of
+.Dv DEV_BSIZE
+(usually 512 bytes).
+For large writes, the optimum interleave factor
+is typically the size of a track, while for large reads, it is about a
+quarter of a track.
+(Note that this changes greatly depending on the
+number and speed of disks.)
+For instance, with eight 7,200 RPM drives
+on two Fast-Wide SCSI buses, this translates to about 128 for writes
+and 32 for reads.
+A larger interleave tends to work better when the
+disk is taking a multitasking load by localizing the file I/O from
+any given process onto a single disk.
+You lose sequential performance when
+you do this, but sequential performance is not usually an issue with a
+multitasking load.
+.Pp
+An interleave factor must be specified when using a mirroring configuration,
+even when you have only two disks (i.e., the layout winds up being the same
+no matter what the interleave factor).
+The interleave factor will determine
+how I/O is broken up, however, and a value 128 or greater is recommended.
+.Pp
+.Nm
+has an option for a parity disk, but does not currently implement it.
+.Pp
+The best performance is achieved if all component disks have the same
+geometry and size.
+Optimum striping cannot occur with different
+disk types.
+.Pp
+For random-access oriented workloads, such as news servers, a larger
+interleave factor (e.g., 65,536) is more desirable.
+Note that there
+is not much
+.Nm
+can do to speed up applications that are seek-time limited.
+Larger
+interleave factors will at least reduce the chance of having to seek
+two disk-heads to read one directory or a file.
+.Ss Disk Mirroring
+You can configure the
+.Nm
+to
+.Dq mirror
+any even number of disks.
+See
+.Xr ccdconfig 8
+for how to specify the necessary flags.
+For example, if you have a
+.Nm
+configuration specifying four disks, the first two disks will be mirrored with
+the second two disks.
+A write will be run to both sides of
+the mirror.
+A read will be run to either side of the mirror depending
+on what the driver believes to be most optimal.
+If the read fails,
+the driver will automatically attempt to read the same sector from the
+other side of the mirror.
+Currently
+.Nm
+uses a dual seek zone model to optimize reads for a multi-tasking load
+rather than a sequential load.
+.Pp
+In an event of a disk
+failure, you can use
+.Xr dd 1
+to recover the failed disk.
+.Pp
+Note that a one-disk
+.Nm
+is not the same as the original partition.
+In particular, this means
+if you have a file system on a two-disk mirrored
+.Nm
+and one of the disks fail, you cannot mount and use the remaining
+partition as itself; you have to configure it as a one-disk
+.Nm .
+You cannot replace a disk in a mirrored
+.Nm
+partition without first backing up the partition, then replacing the disk,
+then restoring the partition.
+.Ss Linux Compatibility
+The
+.Tn Linux
+compatibility mode does not try to read the label that
+.Tn Linux Ns '
+.Xr md 4
+driver leaves on the raw devices.
+You will have to give the order
+of devices and the interleave factor on your own.
+When in
+.Tn Linux
+compatibility mode,
+.Nm
+will convert the interleave factor from
+.Tn Linux
+terminology.
+That means you give the same interleave factor that you
+gave as chunk size in
+.Tn Linux .
+.Pp
+If you have a
+.Tn Linux
+.Xr md 4
+device in
+.Dq legacy
+mode, do not use the
+.Dv CCDF_LINUX
+flag in
+.Xr ccdconfig 8 .
+Use the
+.Dv CCDF_NO_OFFSET
+flag instead.
+In that case you have to convert
+the interleave factor on your own, usually it is
+.Tn Linux Ns '
+chunk size multiplied by two.
+.Pp
+Using a
+.Tn Linux
+RAID this way is potentially dangerous and can destroy
+the data in there.
+Since
+.Fx
+does not read the label used by
+.Tn Linux ,
+changes in
+.Tn Linux
+might invalidate the compatibility layer.
+.Pp
+However, using this is reasonably safe if you test the compatibility
+before mounting a RAID read-write for the first time.
+Just using
+.Xr ccdconfig 8
+without mounting does not write anything to the
+.Tn Linux
+RAID.
+Then you do a
+.Nm fsck.ext2fs Pq Pa ports/sysutils/e2fsprogs
+on the
+.Nm
+device using the
+.Fl n
+flag.
+You can mount the file system read-only to check files in there.
+If all this works, it is unlikely that there is a problem with
+.Nm .
+Keep in mind that even when the
+.Tn Linux
+compatibility mode in
+.Nm
+is working correctly, bugs in
+.Fx Ap s
+.Nm ex2fs
+implementation would still destroy
+your data.
+.Sh WARNINGS
+If just one (or more) of the disks in a
+.Nm
+fails, the entire
+file system will be lost unless you are mirroring the disks.
+.Pp
+If one of the disks in a mirror is lost, you should still
+be able to back up your data.
+If a write error occurs, however, data
+read from that sector may be non-deterministic.
+It may return the data
+prior to the write or it may return the data that was written.
+When a
+write error occurs, you should recover and regenerate the data as soon
+as possible.
+.Pp
+Changing the interleave or other parameters for a
+.Nm
+disk usually destroys whatever data previously existed on that disk.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ccd*"
+.It Pa /dev/ccd*
+.Nm
+device special files
+.El
+.Sh SEE ALSO
+.Xr dd 1 ,
+.Xr ccdconfig 8 ,
+.Xr config 8 ,
+.Xr disklabel 8 ,
+.Xr fsck 8 ,
+.Xr mount 8 ,
+.Xr newfs 8 ,
+.Xr vinum 8
+.Sh HISTORY
+The concatenated disk driver was originally written at the University of
+Utah.
diff --git a/share/man/man4/cd.4 b/share/man/man4/cd.4
new file mode 100644
index 000000000000..5c67b0c6b103
--- /dev/null
+++ b/share/man/man4/cd.4
@@ -0,0 +1,538 @@
+.\" Copyright (c) 1996
+.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt CD 4
+.Os
+.Sh NAME
+.Nm cd
+.Nd SCSI CD-ROM driver
+.Sh SYNOPSIS
+.Cd device cd
+.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
+.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for a
+.Tn SCSI
+.Tn CD-ROM
+(Compact Disc-Read Only Memory) drive.
+In an attempt to look like a regular disk, the
+.Nm
+driver synthesizes a partition table, with one partition covering the entire
+.Tn CD-ROM .
+It is possible to modify this partition table using
+.Xr disklabel 8 ,
+but it will only last until the
+.Tn CD-ROM
+is unmounted.
+In general the interfaces are similar to those described by
+.Xr ada 4
+and
+.Xr da 4 .
+.Pp
+As the
+.Tn SCSI
+adapter is probed during boot, the
+.Tn SCSI
+bus is scanned for devices.
+Any devices found which answer as CDROM
+(type 5) or WORM (type 4) type devices will be `attached' to the
+.Nm
+driver.
+Prior to
+.Fx 2.1 ,
+the first device found will be attached as
+.Li cd0
+the next,
+.Li cd1 ,
+etc.
+Beginning in
+.Fx 2.1
+it is possible to specify what cd unit a device should
+come on line as; refer to
+.Xr scsi 4
+for details on kernel configuration.
+.Pp
+The system utility
+.Xr disklabel 8
+may be used to read the synthesized
+disk label
+structure, which will contain correct figures for the size of the
+.Tn CD-ROM
+should that information be required.
+.Sh KERNEL CONFIGURATION
+Any number of
+.Tn CD-ROM
+devices may be attached to the system regardless of system
+configuration as all resources are dynamically allocated.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls which apply to
+.Tn SCSI
+.Tn CD-ROM
+drives are defined
+in the header files
+.In sys/cdio.h
+and
+.In sys/disklabel.h .
+.Bl -tag -width CDIOCREADSUBCHANNEL
+.It Dv DIOCGDINFO
+.It Dv DIOCSDINFO
+.Pq Li "struct disklabel"
+Read or write the in-core copy of the disklabel for the
+drive.
+The disklabel is initialized with information
+read from the scsi inquiry commands, and should be the same as
+the information printed at boot.
+This structure is defined in the header file
+.In sys/disklabel.h .
+.It Dv CDIOCCAPABILITY
+.Pq Li "struct ioc_capability"
+Retrieve information from the drive on what features it supports.
+The information is returned in the following structure:
+.Bd -literal -offset indent
+struct ioc_capability {
+ u_long play_function;
+#define CDDOPLAYTRK 0x00000001
+ /* Can play tracks/index */
+#define CDDOPLAYMSF 0x00000002
+ /* Can play msf to msf */
+#define CDDOPLAYBLOCKS 0x00000004
+ /* Can play range of blocks */
+#define CDDOPAUSE 0x00000100
+ /* Output can be paused */
+#define CDDORESUME 0x00000200
+ /* Output can be resumed */
+#define CDDORESET 0x00000400
+ /* Drive can be completely reset */
+#define CDDOSTART 0x00000800
+ /* Audio can be started */
+#define CDDOSTOP 0x00001000
+ /* Audio can be stopped */
+#define CDDOPITCH 0x00002000
+ /* Audio pitch can be changed */
+
+ u_long routing_function;
+#define CDREADVOLUME 0x00000001
+ /* Volume settings can be read */
+#define CDSETVOLUME 0x00000002
+ /* Volume settings can be set */
+#define CDSETMONO 0x00000100
+ /* Output can be set to mono */
+#define CDSETSTEREO 0x00000200
+ /* Output can be set to stereo (def) */
+#define CDSETLEFT 0x00000400
+ /* Output can be set to left only */
+#define CDSETRIGHT 0x00000800
+ /* Output can be set to right only */
+#define CDSETMUTE 0x00001000
+ /* Output can be muted */
+#define CDSETPATCH 0x00008000
+ /* Direct routing control allowed */
+
+ u_long special_function;
+#define CDDOEJECT 0x00000001
+ /* The tray can be opened */
+#define CDDOCLOSE 0x00000002
+ /* The tray can be closed */
+#define CDDOLOCK 0x00000004
+ /* The tray can be locked */
+#define CDREADHEADER 0x00000100
+ /* Can read Table of Contents */
+#define CDREADENTRIES 0x00000200
+ /* Can read TOC Entries */
+#define CDREADSUBQ 0x00000200
+ /* Can read Subchannel info */
+#define CDREADRW 0x00000400
+ /* Can read subcodes R-W */
+#define CDHASDEBUG 0x00004000
+ /* The tray has dynamic debugging */
+};
+.Ed
+.It Dv CDIOCPLAYTRACKS
+.Pq Li "struct ioc_play_track"
+Start audio playback given a track address and length.
+The structure is defined as follows:
+.Bd -literal -offset indent
+struct ioc_play_track
+{
+ u_char start_track;
+ u_char start_index;
+ u_char end_track;
+ u_char end_index;
+};
+.Ed
+.It Dv CDIOCPLAYBLOCKS
+.Pq Li "struct ioc_play_blocks"
+Start audio playback given a block address and length.
+The structure is defined as follows:
+.Bd -literal -offset indent
+struct ioc_play_blocks
+{
+ int blk;
+ int len;
+};
+.Ed
+.It Dv CDIOCPLAYMSF
+.Pq Li "struct ioc_play_msf"
+Start audio playback given a `minutes-seconds-frames' address and
+length.
+The structure is defined as follows:
+.Bd -literal -offset indent
+struct ioc_play_msf
+{
+ u_char start_m;
+ u_char start_s;
+ u_char start_f;
+ u_char end_m;
+ u_char end_s;
+ u_char end_f;
+};
+.Ed
+.It Dv CDIOCREADSUBCHANNEL
+.Pq Li "struct ioc_read_subchannel"
+Read information from the subchannel at the location specified by this
+structure:
+.Bd -literal -offset indent
+struct ioc_read_subchannel {
+ u_char address_format;
+#define CD_LBA_FORMAT 1
+#define CD_MSF_FORMAT 2
+ u_char data_format;
+#define CD_SUBQ_DATA 0
+#define CD_CURRENT_POSITION 1
+#define CD_MEDIA_CATALOG 2
+#define CD_TRACK_INFO 3
+ u_char track;
+ int data_len;
+ struct cd_sub_channel_info *data;
+};
+.Ed
+.It Dv CDIOREADTOCHEADER
+.Pq Li "struct ioc_toc_header"
+Return summary information about the table of contents for the mounted
+.Tn CD-ROM .
+The information is returned into the following structure:
+.Bd -literal -offset indent
+struct ioc_toc_header {
+ u_short len;
+ u_char starting_track;
+ u_char ending_track;
+};
+.Ed
+.It Dv CDIOREADTOCENTRYS
+.Pq Li "struct ioc_read_toc_entry"
+Return information from the table of contents entries mentioned.
+.Pq Yes, this command name is misspelled.
+The argument structure is defined as follows:
+.Bd -literal -offset indent
+struct ioc_read_toc_entry {
+ u_char address_format;
+ u_char starting_track;
+ u_short data_len;
+ struct cd_toc_entry *data;
+};
+.Ed
+The requested data is written into an area of size
+.Li data_len
+and pointed to by
+.Li data .
+.It Dv CDIOCSETPATCH
+.Pq Li "struct ioc_patch"
+Attach various audio channels to various output channels.
+The argument structure is defined thusly:
+.Bd -literal -offset indent
+struct ioc_patch {
+ u_char patch[4];
+ /* one for each channel */
+};
+.Ed
+.It Dv CDIOCGETVOL
+.It Dv CDIOCSETVOL
+.Pq Li "struct ioc_vol"
+Get (set) information about the volume settings of the output channels.
+The argument structure is as follows:
+.Bd -literal -offset indent
+struct ioc_vol
+{
+ u_char vol[4];
+ /* one for each channel */
+};
+.Ed
+.It Dv CDIOCSETMONO
+Patch all output channels to all source channels.
+.It Dv CDIOCSETSTEREO
+Patch left source channel to the left output channel and the right
+source channel to the right output channel.
+.It Dv CDIOCSETMUTE
+Mute output without changing the volume settings.
+.It Dv CDIOCSETLEFT
+.It Dv CDIOCSETRIGHT
+Attach both output channels to the left (right) source channel.
+.It Dv CDIOCSETDEBUG
+.It Dv CDIOCCLRDEBUG
+Turn on (off) debugging for the appropriate device.
+.It Dv CDIOCPAUSE
+.It Dv CDIOCRESUME
+Pause (resume) audio play, without resetting the location of the read-head.
+.It Dv CDIOCRESET
+Reset the drive.
+.It Dv CDIOCSTART
+.It Dv CDIOCSTOP
+Tell the drive to spin-up (-down) the
+.Tn CD-ROM .
+.It Dv CDIOCALLOW
+.It Dv CDIOCPREVENT
+Tell the drive to allow (prevent) manual ejection of the
+.Tn CD-ROM
+disc.
+Not all drives support this feature.
+.It Dv CDIOCEJECT
+Eject the
+.Tn CD-ROM .
+.It Dv CDIOCCLOSE
+Tell the drive to close its door and load the media.
+Not all drives support this feature.
+.It Dv CDIOCPITCH
+.Pq Li "struct ioc_pitch"
+For drives that support it, this command instructs the drive to play
+the audio at a faster or slower rate than normal.
+Values of
+.Li speed
+between -32767 and -1 result in slower playback; a zero value
+indicates normal speed; and values from 1 to 32767 give faster
+playback.
+Drives with less than 16 bits of resolution will silently
+ignore less-significant bits.
+The structure is defined thusly:
+.Bd -literal -offset indent
+struct ioc_pitch
+{
+ short speed;
+};
+.Ed
+.El
+.Sh NOTES
+When a
+.Tn CD-ROM
+is changed in a drive controlled by the
+.Nm
+driver, then the act of changing the media will invalidate the
+disklabel and information held within the kernel.
+To stop corruption,
+all accesses to the device will be discarded until there are no more
+open file descriptors referencing the device.
+During this period, all
+new open attempts will be rejected.
+When no more open file descriptors
+reference the device, the first next open will load a new set of
+parameters (including disklabel) for the drive.
+.Pp
+The audio code in the
+.Nm
+driver only support
+.Tn SCSI-2
+standard audio commands.
+As many
+.Tn CD-ROM
+manufacturers have not followed the standard, there are many
+.Tn CD-ROM
+drives for which audio will not work.
+Some work is planned to support
+some of the more common `broken'
+.Tn CD-ROM
+drives; however, this is not yet under way.
+.Sh CHANGER OPERATION
+This driver has built-in support for LUN-based CD changers.
+A LUN-based CD
+changer is a drive that can hold two or more CDs, but only has one CD
+player mechanism.
+Each CD in the drive shows up as a separate logical unit
+on the
+.Tn SCSI
+bus.
+The
+.Nm
+driver automatically recognizes LUN-based changers, and routes commands for
+changers through an internal scheduler.
+The scheduler prevents changer
+"thrashing", which is caused by sending commands to different LUNs in the
+changer at the same time.
+.Pp
+The scheduler honors minimum and maximum time
+quanta that the driver will spend on a particular LUN.
+The minimum time
+is the guaranteed minimum amount of time that the driver will spend on a
+given LUN, even if there is no outstanding I/O for that LUN.
+The maximum
+time is the maximum amount of time the changer will spend on a LUN if there
+is outstanding I/O for another LUN.
+If there is no outstanding I/O for
+another LUN, the driver will allow indefinite access to a given LUN.
+.Pp
+The minimum and maximum time quanta are configurable via kernel options and
+also via sysctl and kernel tunable variables.
+The kernel options are:
+.Pp
+.Bl -item -compact
+.It
+.Cd "options ""CHANGER_MIN_BUSY_SECONDS=3"""
+.It
+.Cd "options ""CHANGER_MAX_BUSY_SECONDS=11"""
+.El
+.Pp
+The sysctl/kernel tunable variables are:
+.Pp
+.Bl -item -compact
+.It
+.Va kern.cam.cd.changer.min_busy_seconds
+.It
+.Va kern.cam.cd.changer.max_busy_seconds
+.El
+.Pp
+It is suggested that the user try experimenting with the minimum and
+maximum timeouts via the sysctl variables to arrive at the proper values
+for your changer.
+Once you have settled on the proper timeouts for your
+changer, you can then put them in your kernel config file.
+.Pp
+If your system does have a LUN-based changer, you may notice that the
+probe messages for the various LUNs of the changer will continue to appear
+while the boot process is going on.
+This is normal, and is caused by the
+changer scheduling code.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width 12
+.It kern.cam.cd.retry_count
+.Pp
+This variable determines how many times the
+.Nm
+driver will retry a READ or WRITE command.
+This does not affect the number of retries used during probe time or for
+the
+.Nm
+driver dump routine.
+This value currently defaults to 4.
+.It kern.cam.cd.%d.minimum_cmd_size
+.Pp
+The
+.Nm
+driver attempts to automatically determine whether the drive it is talking
+to supports 6 byte or 10 byte MODE SENSE/MODE SELECT operations.
+Many
+.Tn SCSI
+drives only support 6 byte commands, and
+.Tn ATAPI
+drives only support 10 byte commands.
+The
+.Nm
+driver first attempts to determine whether the protocol in use typically
+supports 6 byte commands by issuing a CAM Path Inquiry CCB.
+It will then default to 6 byte or 10 byte commands as appropriate.
+After that, the
+.Nm
+driver defaults to using 6 byte commands (assuming the protocol the drive
+speaks claims to support 6 byte commands), until one fails with a
+.Tn SCSI
+ILLEGAL REQUEST error.
+Then it tries the 10 byte version of the command to
+see if that works instead.
+Users can change the default via per-drive
+sysctl variables and loader tunables.
+Where
+.Dq %d
+is the unit number of the drive in question.
+Valid minimum command sizes
+are 6 and 10.
+Any value above 6 will be rounded to 10, and any value below
+6 will be rounded to 6.
+.It kern.cam.cd.changer.min_busy_seconds
+.It kern.cam.cd.changer.max_busy_seconds
+.Pp
+Tune how long individual LUNs are 'locked' for I/O operations to
+optimize changer operation.
+See CHANGER OPERATION section for information on how to use these items.
+.El
+.Sh FILES
+.Bl -tag -width /dev/cd[0-9][a-h] -compact
+.It Pa /dev/cd[0-9][a-h]
+raw mode
+.Tn CD-ROM
+devices
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr da 4 ,
+.Xr disklabel 8 ,
+.Xr cd 9
+.Sh HISTORY
+This
+.Nm
+driver is based upon the
+.Nm
+driver written by Julian Elischer, which appeared in
+.Bx 386 0.1 .
+The
+CAM version of the
+.Nm
+driver was written by Kenneth Merry and first appeared in
+.Fx 3.0 .
+.Sh BUGS
+The names of the structures used for the third argument to
+.Fn ioctl
+were poorly chosen, and a number of spelling errors have survived in
+the names of the
+.Fn ioctl
+commands.
+.Pp
+There is no mechanism currently to set different minimum and maximum
+timeouts for different CD changers; the timeout values set by the kernel
+options or the sysctl variables apply to all LUN-based CD changers in the
+system.
+It is possible to implement such support, but the sysctl
+implementation at least would be rather inelegant, because of the current
+inability of the sysctl code to handle the addition of nodes after compile
+time.
+Thus, it would take one dynamically sized sysctl variable and a
+userland utility to get/set the timeout values.
+Implementation of separate
+timeouts for different CD devices in the kernel config file would likely
+require modification of
+.Xr config 8
+to support the two timeouts when hardwiring
+.Nm
+devices.
diff --git a/share/man/man4/cdce.4 b/share/man/man4/cdce.4
new file mode 100644
index 000000000000..e055e1b96f62
--- /dev/null
+++ b/share/man/man4/cdce.4
@@ -0,0 +1,155 @@
+.\" Copyright (c) 2004 Daniel Hartmeier
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" - Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" - Redistributions in binary form must reproduce the above
+.\" copyright notice, this list of conditions and the following
+.\" disclaimer in the documentation and/or other materials provided
+.\" with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $
+.\" $FreeBSD$
+.\"
+.Dd September 17, 2005
+.Dt CDCE 4
+.Os
+.Sh NAME
+.Nm cdce
+.Nd "USB Communication Device Class Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device cdce"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cdce_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Host-to-Host (aka USB-to-USB) and
+USB-to-Ethernet bridges based on the USB Communication Device Class
+(CDC) and Ethernet subclass.
+.Pp
+The USB bridge appears as a regular network interface on both sides,
+transporting Ethernet frames.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+USB 1.x bridges support speeds of up to 12Mbps, and USB 2.0 speeds of
+up to 480Mbps.
+.Pp
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+The
+.Nm
+driver does not support different media types or options.
+.Sh HARDWARE
+The following devices are supported by the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+Prolific PL-2501 Host-to-Host Bridge Controller
+.It
+Sharp Zaurus PDA
+.It
+Terayon TJ-715 DOCSIS Cable Modem
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "cdce%d: no union descriptor"
+The driver could not fetch an interface descriptor from the USB
+device.
+For a manually added USB vendor/product, the CDCE_NO_UNION flag
+can be tried to work around the missing descriptor.
+.It "cdce%d: no data interface"
+.It "cdce%d: could not read endpoint descriptor"
+.It "cdce%d: unexpected endpoint"
+.It "cdce%d: could not find data bulk in/out"
+For a manually added USB vendor/product, these errors indicate
+that the bridge is not compatible with the driver.
+.It "cdce%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "cdce%d: no memory for rx list -- packet dropped!"
+Memory allocation through MGETHDR or MCLGET failed, the system
+is running low on mbufs.
+.It "cdce%d: abort/close rx/tx pipe failed"
+.It "cdce%d: rx/tx list init failed"
+.It "cdce%d: open rx/tx pipe failed"
+.It "cdce%d: usb error on rx/tx"
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.\" .Xr hostname.if 5 ,
+.Xr ifconfig 8
+.Rs
+.%T "Universal Serial Bus Class Definitions for Communication Devices"
+.%U http://www.usb.org/developers/devclass_docs/usbcdc11.pdf
+.Re
+.Rs
+.%T "Data sheet Prolific PL-2501 Host-to-Host Bridge/Network Controller"
+.%U http://tech.prolific.com.tw/visitor/fcabdl.asp?fid=20679530
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 3.6 ,
+.Nx 3.0
+and
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Craig Boston Aq craig@tobuj.gank.org
+based on the
+.Xr aue 4
+driver written by
+.An Bill Paul Aq wpaul@windriver.com
+and ported to
+.Ox
+by
+.An Daniel Hartmeier Aq dhartmei@openbsd.org .
+.Sh CAVEATS
+Many USB devices notoriously fail to report their class and interfaces
+correctly.
+Undetected products might work flawlessly when their vendor and product IDs
+are added to the driver manually.
diff --git a/share/man/man4/ch.4 b/share/man/man4/ch.4
new file mode 100644
index 000000000000..b45ecaa0d538
--- /dev/null
+++ b/share/man/man4/ch.4
@@ -0,0 +1,351 @@
+.\" $FreeBSD$
+.\" Copyright (c) 1996
+.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd May 14, 1998
+.Dt CH 4
+.Os
+.Sh NAME
+.Nm ch
+.Nd SCSI media-changer (juke box) driver
+.Sh SYNOPSIS
+.Cd device ch
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for a
+.Em SCSI
+media changer.
+It allows many slots of media to be multiplexed between
+a number of drives.
+The changer device may optionally be equipped
+with a bar code reader, which reads label information attached to
+the media.
+.Pp
+A SCSI adapter must also be separately configured into the system
+before a SCSI changer can be configured.
+.Pp
+As the SCSI adapter is probed during boot, the
+.Em SCSI
+bus is scanned for devices.
+Any devices found which answer as 'Changer'
+type devices will be 'attached' to the
+.Nm
+driver.
+In
+.Fx
+releases prior to 2.1, the first found will be attached as
+.Em ch0
+and the next,
+.Em ch1
+etc.
+Beginning in 2.1 it is possible to specify what ch unit a device should
+come on line as; refer to
+.Xr scsi 4
+for details on kernel configuration.
+.Sh KERNEL CONFIGURATION
+It is only necessary to explicitly configure one
+.Nm
+device; data structures are dynamically allocated as media changes are found
+on the
+.Tn SCSI
+bus.
+.Sh IOCTLS
+User mode programs communicate with the changer driver through a
+number of ioctls which are described below.
+Changer element addresses
+used in the communication between the kernel and the changer device are
+mapped to zero-based logical addresses.
+Element types are specified as follows:
+.Bl -tag -width CHET_MT
+.It Dv CHET_MT
+Medium transport element (picker).
+.It Dv CHET_ST
+Storage element (slot).
+.It Dv CHET_IE
+Import/export element (portal).
+.It Dv CHET_DT
+Data transfer element (drive).
+.El
+.Pp
+The following
+.Xr ioctl 2
+calls apply to the changer.
+They are defined
+in the header file
+.In sys/chio.h .
+.Bl -tag -width CHIOEXCHANGE
+.It Dv CHIOMOVE
+.Pq Vt "struct changer_move"
+Move a medium from one element to another
+.Pq Sy "MOVE MEDIUM"
+using the current picker.
+The source and destination elements are specified
+in a changer_move structure, which includes at least the following
+fields:
+.Bd -literal -offset indent
+u_int cm_fromtype; /* element type to move from */
+u_int cm_fromunit; /* logical unit of from element */
+u_int cm_totype; /* element type to move to */
+u_int cm_tounit; /* logical unit of to element */
+u_int cm_flags; /* misc. flags */
+.Ed
+If the
+.Dv CM_INVERT
+in the
+.Va cm_flags
+field is set, the medium
+changer is instructed to flip the medium while moving it.
+.It Dv CHIOEXCHANGE
+.Pq Vt "struct changer_exchange"
+Move the medium located in the source element to the first destination
+element, and move the medium that had been in the first destination
+element to the second destination element.
+In case of a simple
+exchange, the source and second destination elements should be the
+same.
+The current picker is used to perform the operation.
+The addresses of the affected elements is specified to the ioctl in a
+.Vt changer_exchange
+structure which includes at least the following
+fields:
+.Bd -literal -offset indent
+u_int ce_srctype; /* element type of source */
+u_int ce_srcunit; /* logical unit of source */
+u_int ce_fdsttype; /* element type of first destination */
+u_int ce_fdstunit; /* logical unit of first destination */
+u_int ce_sdsttype; /* element type of second destination */
+u_int ce_sdstunit; /* logical unit of second destination */
+u_int ce_flags; /* misc. flags */
+.Ed
+In
+.Va ce_flags ,
+.Dv CM_INVERT1
+and/or
+.Dv CM_INVERT2
+may be set
+to flip the first or second medium during the exchange operation,
+respectively.
+.Pp
+.Em This operation is untested .
+.It Dv CHIOPOSITION
+.Pq Vt "struct changer_position"
+Position the current picker in front of the specified element.
+The element is specified with a changer_position structure, which includes
+at least the following elements:
+.Bd -literal -offset indent
+u_int cp_type; /* element type */
+u_int cp_unit; /* logical unit of element */
+u_int cp_flags; /* misc. flags */
+.Ed
+The
+.Va cp_flags
+field may be set to
+.Dv CP_INVERT
+to invert the picker during the operation.
+.It Dv CHIOGPICKER
+.Pq Vt int
+Return the logical address of the current picker.
+.It Dv CHIOSPICKER
+.Pq Vt int
+Select the picker specified by the given logical address.
+.It Dv CHIOGPARAMS
+.Pq Vt "struct changer_params"
+Return the configuration parameters for the media changer.
+This ioctl
+fills the changer_params structure passed by the user with at least the
+following fields:
+.Bd -literal -offset indent
+u_int cp_npickers; /* number of pickers */
+u_int cp_nslots; /* number of slots */
+u_int cp_nportals; /* number of import/export portals */
+u_int cp_ndrives; /* number of drives */
+.Ed
+.Pp
+This call can be used by applications to query the dimensions of
+the jukebox before using the
+.Dv CHIGSTATUS
+ioctl to query the jukebox' status.
+.It Dv CHIOIELEM
+Perform the
+.Sy INITIALIZE ELEMENT STATUS
+call on the media changer device.
+This forces the media changer to update its internal status
+information with respect to loaded media.
+It also scans any barcode labels provided that it has a label reader.
+The
+.Nm
+driver's status is not affected by this call.
+.It Dv CHIOGSTATUS
+.Pq Vt "struct changer_element_status_request"
+Perform the
+.Sy READ ELEMENT STATUS
+call on the media changer device.
+This call reads the element status information of the media
+changer and converts it to an array of
+.Vt changer_element_status
+structures.
+.Pp
+With each call to
+.Dv CHIOGSTATUS ,
+the status of one or more elements of one type may be queried.
+.Pp
+The application passes a
+.Vt changer_element_status_request
+structure to the
+.Nm
+driver which contains the following fields:
+.Bd -literal -offset indent
+u_int cesr_element_type;
+u_int cesr_element_base;
+u_int cesr_element_count;
+u_int cesr_flags;
+struct changer_element_status *cesr_element_status;
+.Ed
+.Pp
+This structure is read by the driver to determine the type, logical
+base address and number of elements for which information is to be
+returned in the array of
+.Vt changer_element_status
+structures pointed to by the
+.Va cesr_element_status field .
+The application must allocate enough
+memory for
+.Va cesr_element_count
+status structures (see below).
+The
+.Va cesr_flags
+can optionally be set to
+.Dv CESR_VOLTAGS
+to indicate that volume tag (bar code) information is to be read from
+the jukebox and returned.
+.Pp
+The
+.Va cesr_element_base
+and
+.Va cesr_element_count
+fields must be valid with respect to the physical configuration of the changer.
+If they are not, the
+.Dv CHIOGSTATUS
+ioctl returns the
+.Er EINVAL
+error code.
+.Pp
+The information about the elements is returned in an array of
+.Vt changer_element_status
+structures.
+This structure include at least the following fields:
+.Bd -literal -offset indent
+u_int ces_addr; /* element address in media changer */
+u_char ces_flags; /* see CESTATUS definitions below */
+u_char ces_sensecode; /* additional sense code for element */
+u_char ces_sensequal; /* additional sense code qualifier */
+u_char ces_invert; /* invert bit */
+u_char ces_svalid; /* source address (ces_source) valid */
+u_short ces_source; /* source address of medium */
+changer_voltag_t ces_pvoltag; /* primary volume tag */
+changer_voltag_t ces_avoltag; /* alternate volume tag */
+u_char ces_idvalid; /* ces_scsi_id is valid */
+u_char ces_scsi_id; /* SCSI id of element (if ces_idvalid is nonzero) */
+u_char ces_lunvalid; /* ces_scsi_lun is valid */
+u_char ces_scsi_lun; /* SCSI lun of element (if ces_lunvalid is nonzero) */
+.Ed
+.Pp
+The
+.Va ces_addr
+field contains the address of the element in the
+coordinate system of the media changer.
+It is not used by the driver,
+and should be used for diagnostic purposes only.
+.Pp
+The following flags are defined for the
+.Va ces_flags
+field:
+.Bl -tag -width CESTATUS_IMPEXP
+.It Dv CESTATUS_FULL
+A medium is present.
+.It Dv CESTATUS_IMPEXP
+The medium has been deposited by the operator (and not by a picker).
+.It Dv CESTATUS_EXCEPT
+The element is in an exceptional state (e.g.\& invalid barcode label,
+barcode not yet scanned).
+.It Dv CESTATUS_ACCESS
+The element is accessible by the picker.
+.It Dv CESTATUS_EXENAB
+The element supports medium export.
+.It Dv CESTATUS_INENAB
+The element supports medium import.
+.El
+.Pp
+Note that not all flags are valid for all element types.
+.El
+.Sh NOTES
+This version of the
+.Nm
+driver has been tested with a DEC TZ875 (5 slot, one DLT drive)
+and a Breece Hill Q47 (60 slot, four DLT drives, barcode reader).
+.Pp
+Many of the features the
+.Nm
+driver supports are not thoroughly tested due to the fact that the
+devices available for testing do not support the necessary commands.
+This is true for alternate volume tags, media flipping, import/export
+element handling, multiple picker operation and other things.
+.Sh FILES
+.Bl -tag -width /dev/ch[0-9] -compact
+.It Pa /dev/ch[0-9]
+device entries
+.El
+.Sh DIAGNOSTICS
+If the media changer does not support features requested by the
+.Nm
+driver, it will produce both console error messages and failure return
+codes to the ioctls described here.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr chio 1 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Bx 386 0.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jason R. Thorpe Aq thorpej@and.com
+for And Communications,
+.Pa http://www.and.com/ .
+It was added to the system by
+.An Stefan Grefen Aq grefen@goofy.zdv.uni-mainz.de
+who apparently had such a device.
+It was ported to CAM by
+.An Kenneth Merry Aq ken@FreeBSD.org .
+It was updated to support volume tags by
+.An Hans Huebner Aq hans@artcom.de .
diff --git a/share/man/man4/ciss.4 b/share/man/man4/ciss.4
new file mode 100644
index 000000000000..277847b52bb1
--- /dev/null
+++ b/share/man/man4/ciss.4
@@ -0,0 +1,175 @@
+.\" $FreeBSD$
+.\" Written by Tom Rhodes
+.\" This file is in the public domain.
+.\"
+.Dd January 26, 2012
+.Dt CISS 4
+.Os
+.Sh NAME
+.Nm ciss
+.Nd Common Interface for SCSI-3 Support driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ciss"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ciss_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver claims to provide a common interface between generic SCSI
+transports and intelligent host adapters.
+.Pp
+The
+.Nm
+driver supports
+.Em CISS
+as defined in the document entitled
+.%T "CISS Command Interface for SCSI-3 Support Open Specification, Version 1.04, Valence Number 1" ,
+dated 2000/11/27, produced by Compaq Computer Corporation.
+.Pp
+We provide a shim layer between the
+.Nm
+interface and
+.Xr CAM 4 ,
+offloading most of the queueing and being-a-disk chores onto CAM.
+Entry to the driver is via the PCI bus attachment
+.Fn ciss_probe ,
+.Fn ciss_attach ,
+etc.\& and via the CAM interface
+.Fn ciss_cam_action ,
+and
+.Fn ciss_cam_poll .
+The Compaq
+.Nm
+adapters require faked responses to get reasonable
+behavior out of them.
+In addition, the
+.Nm
+command set is by no means adequate to support the functionality
+of a RAID controller,
+and thus the supported Compaq adapters utilize portions of the
+control protocol from earlier Compaq adapter families.
+.Pp
+Currently
+.Nm
+only supports the
+.Dq simple
+transport layer over PCI.
+This interface (ab)uses the I2O register set (specifically the post
+queues) to exchange commands with the adapter.
+Other interfaces are available, but we are not supposed to know about them,
+and it is dubious whether they would provide major performance improvements
+except under extreme load.
+.Pp
+Non-disk devices (such as internal DATs and devices
+attached to the external SCSI bus) are supported as normal CAM devices
+provided that they are exported by the controller firmware and are not
+marked as being masked.
+Masked devices can be exposed by setting the
+.Va hw.ciss.expose_hidden_physical
+tunable to non-zero at boot time.
+Direct Access devices (such as disk
+drives) are only exposed as
+.Xr pass 4
+devices.
+Hot-insertion and removal of devices is supported but a bus
+rescan might be necessary.
+.Pp
+The problem which adapter freezes with the message
+.Dq ADAPTER HEARTBEAT FAILED
+might be solved by updating the firmware and/or setting the
+.Va hw.ciss.nop_message_heartbeat
+tunable to non-zero at boot time.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Compaq Smart Array 5300
+.It
+Compaq Smart Array 532
+.It
+Compaq Smart Array 5i
+.It
+HP Smart Array 5312
+.It
+HP Smart Array 6i
+.It
+HP Smart Array 641
+.It
+HP Smart Array 642
+.It
+HP Smart Array 6400
+.It
+HP Smart Array 6400 EM
+.It
+HP Smart Array E200
+.It
+HP Smart Array E200i
+.It
+HP Smart Array P212
+.It
+HP Smart Array P220i
+.It
+HP Smart Array P222
+.It
+HP Smart Array P400
+.It
+HP Smart Array P400i
+.It
+HP Smart Array P410
+.It
+HP Smart Array P410i
+.It
+HP Smart Array P411
+.It
+HP Smart Array P420
+.It
+HP Smart Array P420i
+.It
+HP Smart Array P421
+.It
+HP Smart Array P600
+.It
+HP Smart Array P721m
+.It
+HP Smart Array P800
+.It
+HP Smart Array P812
+.It
+HP Modular Smart Array 20 (MSA20)
+.It
+HP Modular Smart Array 500 (MSA500)
+.El
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr pass 4 ,
+.Xr xpt 4 ,
+.Xr loader.conf 5 ,
+.Xr camcontrol 8
+.Rs
+.%T "CISS Command Interface for SCSI-3 Support Open Specification, Version 1.04, Valence Number 1"
+.%D 2000/11/27
+.%Q "Compaq Computer Corporation"
+.Re
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Mike Smith Aq msmith@FreeBSD.org .
+.Pp
+This manual page is based on his comments and was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/cm.4 b/share/man/man4/cm.4
new file mode 100644
index 000000000000..bbeee52f9532
--- /dev/null
+++ b/share/man/man4/cm.4
@@ -0,0 +1,173 @@
+.\"
+.\" Copyright (c) 2004 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt CM 4
+.Os
+.Sh NAME
+.Nm cm
+.Nd "SMC Arcnet Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "device isa"
+.Cd "device cm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn Arcnet
+.Tn ISA
+network adapters.
+.Pp
+This driver also has quirks preset in the
+.Xr device.hints 5
+file for card detection.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following
+card models:
+.Pp
+.Bl -bullet -compact
+.It
+SMC90c26
+.It
+SMC90c56
+.It
+SMC90c66 in '56 compatibility mode.
+.El
+.Sh IMPLEMENTATION NOTES
+When the
+.Va NOARP
+flag is set on the
+.Nm
+interface,
+it does not employ the address resolution protocol described in
+.Xr arp 4
+to dynamically map between Internet and Ethernet addresses on
+the local network.
+Instead it uses the least significant 8 bits of the
+.Tn IP
+address as the hardware address
+like described in
+.Tn RFC
+1051
+and
+.Tn RFC
+1201.
+.Pp
+With the
+.Dv IFF_LINK0
+flag cleared
+.Tn IP/ARP/RARP
+encoding is done according to
+.Tn RFC
+1201
+that is, with Packet Header Definition Standard header and packet type
+212 / 213.
+The
+.Tn MTU
+is normally 1500.
+The
+.Dv IFF_LINK0
+flag is cleared by default.
+.Pp
+With the
+.Dv IFF_LINK0
+flag set,
+.Tn IP
+and
+.Tn ARP
+encoding is done according to the deprecated
+.Tn RFC
+1051 encoding, that is with simple header, packet type 240 / 241,
+and the
+.Tn MTU
+is 507.
+.Pp
+When switching between the two modes, use
+.Dl ifconfig interfacename down up
+to switch the
+.Tn MTU .
+.Sh DIAGNOSTICS
+The following driver specific error messages
+may be reported:
+.Bl -diag
+.It "reset: card reset, link addr = 0x%02x (cm%d)"
+The card is being reset and a new link address assigned.
+.It "srint: restarted rx on buf cm%d"
+The rx buffer has been emptied and will be reset.
+.El
+.Sh SEE ALSO
+.Xr netintro 4 ,
+.Xr watchdog 4 ,
+.Xr device.hints 5 ,
+.Xr ifconfig 8 ,
+.Xr watchdog 8
+.Sh HISTORY
+The
+.Nm
+device was ported from
+.Nx
+by
+.An Max Khon Aq fjoe@FreeBSD.org
+and first appeared in
+.Fx 4.6 .
+This manual page first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+The
+.Sx IMPLEMENTATION NOTES
+section was submitted by
+.An Max Khon Aq fjoe@FreeBSD.org
+and originated from
+.Nx .
+.Sh BUGS
+The
+.Nm
+driver code could do with a bit of improvement,
+it would be nice if some one could come along and take care of this.
+.Pp
+The
+.Sx IMPLEMENTATION NOTES
+section is specific to all Arcnet
+devices (see
+.Pa sys/net/if_arcsubr.c )
+and should be moved to a more generic location.
diff --git a/share/man/man4/cmx.4 b/share/man/man4/cmx.4
new file mode 100644
index 000000000000..844e6c446e5a
--- /dev/null
+++ b/share/man/man4/cmx.4
@@ -0,0 +1,120 @@
+.\"
+.\" Copyright (c) 2006-2007 Daniel Roethlisberger <daniel@roe.ch>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 7, 2007
+.Dt CMX 4
+.Os
+.Sh NAME
+.Nm cmx
+.Nd Omnikey CardMan 4040 smartcard reader device driver
+.Sh SYNOPSIS
+.Cd device cmx
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the PCCARD based
+.Em Omnikey CardMan 4040
+smartcard reader.
+The driver provides a character device special file based
+.Em Chip/Smart Card Interface Devices (CCID)
+interface. The driver implements what the vendor calls the
+.Em Synchronous API
+onto the smartcard reader device.
+.Pp
+Reading and writing is synchronous, meaning that a call to
+.Xr write 2
+directly corresponds to a complete CCID command sent to the
+device, while the following
+.Xr read 2
+will return the complete answer from the reader. There is no
+support for partial reads or writes. There is no upper limit on
+CCID request or response sizes, but the complete CCID request
+must be sent to the driver in
+.Xr write 2
+and the complete CCID response must fit into the buffer
+supplied to
+.Xr read 2 .
+.Pp
+Non-blocking I/O,
+.Xr select 2
+and
+.Xr poll 2
+are supported and work as expected. An open file descriptor
+will always be ready for writing, but only ready for reading
+if the device indicates that it has data available.
+.Sh FILES
+.Bl -tag -width /usr/ports/security/openct -compact
+.It Pa /dev/cmx\fBn\fP
+Character device special file.
+.It Pa /usr/ports/security/openct
+OpenCT, a userspace smartcard daemon containing a
+.Em CCID
+driver which directly supports
+.Nm
+devices.
+.\".It Pa /usr/ports/devel/pcsc-lite
+.\"PC/SC-Lite, a userspace smartcard daemon.
+.\".It Pa /usr/ports/devel/libccid
+.\"libccid, a generic
+.\".Em CCID
+.\"driver for use by PC/SC-Lite to interface to
+.\".Nm
+.\"devices.
+.El
+.Sh COMPATIBILITY
+Userland smartcard code written for the vendor's Linux drivers
+should work with the
+.Nm
+driver without modification.
+.Sh SEE ALSO
+.Xr pccard 4
+.Sh HISTORY
+The
+.Nm cmx
+driver first appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Daniel Roethlisberger Aq daniel@roe.ch ,
+originally based on the Linux driver v1.1.0 by
+.An Omnikey GmbH Aq www.omnikey.com .
+Early testing and bug fixes by
+.An Marcin Cieslak Aq saper@system.pl .
+.Sh BUGS
+.An -nosplit
+The way the
+.Nm
+driver talks to the CardMan 4040 is a bit rough. Due to the
+complete lack of hardware documentation other than vendor drivers
+for other operating systems, the gory details of the device's
+I/O registers are not understood very well. There may be error
+conditions which can only be solved by physically reinserting the
+reader.
diff --git a/share/man/man4/coda.4 b/share/man/man4/coda.4
new file mode 100644
index 000000000000..e1799ef419a6
--- /dev/null
+++ b/share/man/man4/coda.4
@@ -0,0 +1,82 @@
+.\" Copyright (c) 2008 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2008
+.Dt CODA 4
+.Os
+.Sh NAME
+.Nm coda
+.Nd Coda Distributed File System
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options CODA"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+coda_load="YES"
+.Ed
+.Pp
+To load as a kernel loadable module after boot:
+.Pp
+.Dl "kldload coda"
+.Sh DESCRIPTION
+The
+.Nm
+kernel module allows the experimental, third-party Coda distributed file
+system client to be used with
+.Fx .
+The module allows the userspace Coda client daemon, Venus, to present the
+Coda distributed file system namespace via the local
+.Pa /coda
+file system mountpoint via the
+.Pa /dev/cfs0
+special device.
+.Pp
+To use Coda, the Coda client software package must also be installed; more
+information on Coda may be found in the Coda documentation distributed with
+that package.
+.Sh SEE ALSO
+.Xr loader.conf 5 ,
+.Xr kldload 8
+.Sh HISTORY
+Support for
+.Nm
+first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson Aq rwatson@FreeBSD.org .
+.Sh BUGS
+The
+Coda distributed file system is considered experimental, and production
+deployment should occur only after careful consideration of the risks of
+deploying experimental software.
diff --git a/share/man/man4/coretemp.4 b/share/man/man4/coretemp.4
new file mode 100644
index 000000000000..efae020a152c
--- /dev/null
+++ b/share/man/man4/coretemp.4
@@ -0,0 +1,74 @@
+.\"-
+.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 23, 2007
+.Dt CORETEMP 4
+.Os
+.Sh NAME
+.Nm coretemp
+.Nd device driver for Intel Core on-die digital thermal sensor
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device coretemp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+coretemp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the on-die digital thermal sensor present
+in Intel Core and newer CPUs.
+.Pp
+The
+.Nm
+driver reports each core's temperature through a sysctl node in the
+corresponding CPU device's sysctl tree, named
+.Va dev.cpu.%d.temperature .
+.Sh SEE ALSO
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Rui Paulo Aq rpaulo@FreeBSD.org
+as part of a Google Summer of Code project.
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
diff --git a/share/man/man4/cpuctl.4 b/share/man/man4/cpuctl.4
new file mode 100644
index 000000000000..9e3a2aaf783d
--- /dev/null
+++ b/share/man/man4/cpuctl.4
@@ -0,0 +1,154 @@
+.\" Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 30, 2009
+.Dt CPUCTL 4
+.Os
+.Sh NAME
+.Nm cpuctl
+.Nd cpuctl pseudo device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "device cpuctl"
+.Ed
+.Pp
+Alternatively, to load the driver as a module
+at boot time, place the following in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+cpuctl_load="YES"
+.Ed
+.Sh DESCRIPTION
+The special device
+.Pa /dev/cpuctl
+presents interface to the system CPU.
+It provides functionality to retrieve
+CPUID information, read/write machine specific registers (MSR) and perform
+CPU firmware updates.
+.Pp
+For each CPU present in the system, the special device
+.Pa /dev/cpuctl%d
+with the appropriate index will be created.
+For multicore CPUs such a
+special device will be created for each core.
+.Pp
+Currently, only i386 and amd64 processors are
+supported.
+.Sh IOCTL INTERFACE
+All of the supported operations are invoked using the
+.Xr ioctl 2
+system call.
+Currently, the following ioctls are defined:
+.Bl -tag -width CPUCTL_UPDATE
+.It Dv CPUCTL_RDMSR Fa cpuctl_msr_args_t *args
+.It Dv CPUCTL_WRMSR Fa cpuctl_msr_args_t *args
+Read/write CPU machine specific register.
+The
+.Vt cpuctl_msr_args_t
+structure is defined in
+.In sys/cpuctl.h
+as:
+.Bd -literal
+typedef struct {
+ int msr; /* MSR to read */
+ uint64_t data;
+} cpuctl_msr_args_t;
+.Ed
+.It Dv CPUCTL_MSRSBIT Fa cpuctl_msr_args_t *args
+.It Dv CPUCTL_MSRCBIT Fa cpuctl_msr_args_t *args
+Set/clear MSR bits according to the mask given in the
+.Va data
+field.
+.It Dv CPUCTL_CPUID Fa cpuctl_cpuid_args_t *args
+Retrieve CPUID information.
+Arguments are supplied in
+the following struct:
+.Bd -literal
+typedef struct {
+ int level; /* CPUID level */
+ uint32_t data[4];
+} cpuctl_cpuid_args_t;
+.Ed
+.Pp
+The
+.Va level
+field indicates the CPUID level to retrieve information for, while the
+.Va data
+field is used to store the received CPUID data.
+.It Dv CPUCTL_UPDATE cpuctl_update_args_t *args
+Update CPU firmware (microcode).
+The structure is defined in
+.In sys/cpuctl.h
+as:
+.Bd -literal
+typedef struct {
+ void *data;
+ size_t size;
+} cpuctl_update_args_t;
+.Ed
+.Pp
+The
+.Va data
+field should point to the firmware image of size
+.Va size .
+.El
+.Pp
+For additional information refer to
+.Pa cpuctl.h .
+.Sh RETURN VALUES
+.Bl -tag -width Er
+.It Bq Er ENXIO
+The operation requested is not supported by the device (e.g. unsupported
+architecture or the CPU is disabled)
+.It Bq Er EINVAL
+Incorrect request was supplied, or microcode image is not correct.
+.It Bq Er ENOMEM
+No physical memory was available to complete the request.
+.It Bq Er EFAULT
+The firmware image address points outside the process address space.
+.El
+.Sh FILES
+.Bl -tag -width /dev/cpuctl -compact
+.It Pa /dev/cpuctl
+.El
+.Sh SEE ALSO
+.Xr hwpmc 4 ,
+.Xr cpucontrol 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.2 .
+.Sh AUTHORS
+The
+.Nm
+module and this manual page were written by
+.An Stanislav Sedov Aq stas@FreeBSD.org .
+.Sh BUGS
+Yes, probably, report if any.
diff --git a/share/man/man4/cpufreq.4 b/share/man/man4/cpufreq.4
new file mode 100644
index 000000000000..d4a2a3fad076
--- /dev/null
+++ b/share/man/man4/cpufreq.4
@@ -0,0 +1,307 @@
+.\" Copyright (c) 2005 Nate Lawson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 3, 2006
+.Dt CPUFREQ 4
+.Os
+.Sh NAME
+.Nm cpufreq
+.Nd CPU frequency control framework
+.Sh SYNOPSIS
+.Cd "device cpufreq"
+.Pp
+.In sys/cpu.h
+.Ft int
+.Fn cpufreq_levels "device_t dev" "struct cf_level *levels" "int *count"
+.Ft int
+.Fn cpufreq_set "device_t dev" "const struct cf_level *level" "int priority"
+.Ft int
+.Fn cpufreq_get "device_t dev" "struct cf_level *level"
+.Ft int
+.Fo cpufreq_drv_settings
+.Fa "device_t dev"
+.Fa "struct cf_setting *sets"
+.Fa "int *count"
+.Fc
+.Ft int
+.Fn cpufreq_drv_type "device_t dev" "int *type"
+.Ft int
+.Fn cpufreq_drv_set "device_t dev" "const struct cf_setting *set"
+.Ft int
+.Fn cpufreq_drv_get "device_t dev" "struct cf_setting *set"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a unified kernel and user interface to CPU frequency
+control drivers.
+It combines multiple drivers offering different settings into a single
+interface of all possible levels.
+Users can access this interface directly via
+.Xr sysctl 8
+or by indicating to
+.Pa /etc/rc.d/power_profile
+that it should switch settings when the AC line state changes via
+.Xr rc.conf 5 .
+.Sh SYSCTL VARIABLES
+These settings may be overridden by kernel drivers requesting alternate
+settings.
+If this occurs, the original values will be restored once the condition
+has passed (e.g., the system has cooled sufficiently).
+If a sysctl cannot be set due to an override condition, it will return
+.Er EPERM .
+.Pp
+The frequency cannot be changed if TSC is in use as the timecounter.
+This is because the timecounter system needs to use a source that has a
+constant rate.
+The timecounter source can be changed with the
+.Pa kern.timecounter.hardware
+sysctl.
+Available modes are in
+.Pa kern.timecounter.choice
+sysctl entry.
+.Bl -tag -width indent
+.It Va dev.cpu.%d.freq
+Current active CPU frequency in MHz.
+.It Va dev.cpu.%d.freq_levels
+Currently available levels for the CPU (frequency/power usage).
+Values are in units of MHz and milliwatts.
+.It Va dev.DEVICE.%d.freq_settings
+Currently available settings for the driver (frequency/power usage).
+Values are in units of MHz and milliwatts.
+This is helpful for understanding which settings are offered by which
+driver for debugging purposes.
+.It Va debug.cpufreq.lowest
+Lowest CPU frequency in MHz to offer to users.
+This setting is also accessible via a tunable with the same name.
+This can be used to disable very low levels that may be unusable on
+some systems.
+.It Va debug.cpufreq.verbose
+Print verbose messages.
+This setting is also accessible via a tunable with the same name.
+.El
+.Sh SUPPORTED DRIVERS
+The following device drivers offer absolute frequency control via the
+.Nm
+interface.
+Usually, only one of these can be active at a time.
+.Pp
+.Bl -tag -compact -width ".Pa acpi_perf"
+.It Pa acpi_perf
+ACPI CPU performance states
+.It Pa est
+Intel Enhanced SpeedStep
+.It Pa ichss
+Intel SpeedStep for ICH
+.It Pa powernow
+AMD PowerNow!\& and Cool'n'Quiet for K7 and K8
+.It Pa smist
+Intel SMI-based SpeedStep for PIIX4
+.El
+.Pp
+The following device drivers offer relative frequency control and
+have an additive effect:
+.Pp
+.Bl -tag -compact -width ".Pa acpi_throttle"
+.It Pa acpi_throttle
+ACPI CPU throttling
+.It Pa p4tcc
+Pentium 4 Thermal Control Circuitry
+.El
+.Sh KERNEL INTERFACE
+Kernel components can query and set CPU frequencies through the
+.Nm
+kernel interface.
+This involves obtaining a
+.Nm
+device, calling
+.Fn cpufreq_levels
+to get the currently available frequency levels,
+checking the current level with
+.Fn cpufreq_get ,
+and setting a new one from the list with
+.Fn cpufreq_set .
+Each level may actually reference more than one
+.Nm
+driver but kernel components do not need to be aware of this.
+The
+.Va total_set
+element of
+.Vt "struct cf_level"
+provides a summary of the frequency and power for this level.
+Unknown or irrelevant values are set to
+.Dv CPUFREQ_VAL_UNKNOWN .
+.Pp
+The
+.Fn cpufreq_levels
+method takes a
+.Nm
+device and an empty array of
+.Fa levels .
+The
+.Fa count
+value should be set to the number of levels available and after the
+function completes, will be set to the actual number of levels returned.
+If there are more levels than
+.Fa count
+will allow, it should return
+.Er E2BIG .
+.Pp
+The
+.Fn cpufreq_get
+method takes a pointer to space to store a
+.Fa level .
+After successful completion, the output will be the current active level
+and is equal to one of the levels returned by
+.Fn cpufreq_levels .
+.Pp
+The
+.Fn cpufreq_set
+method takes a pointer a
+.Fa level
+and attempts to activate it.
+The
+.Fa priority
+(i.e.,
+.Dv CPUFREQ_PRIO_KERN )
+tells
+.Nm
+whether to override previous settings while activating this level.
+If
+.Fa priority
+is higher than the current active level, that level will be saved and
+overridden with the new level.
+If a level is already saved, the new level is set without overwriting
+the older saved level.
+If
+.Fn cpufreq_set
+is called with a
+.Dv NULL
+.Fa level ,
+the saved level will be restored.
+If there is no saved level,
+.Fn cpufreq_set
+will return
+.Er ENXIO .
+If
+.Fa priority
+is lower than the current active level's priority, this method returns
+.Er EPERM .
+.Sh DRIVER INTERFACE
+Kernel drivers offering hardware-specific CPU frequency control export
+their individual settings through the
+.Nm
+driver interface.
+This involves implementing these methods:
+.Fn cpufreq_drv_settings ,
+.Fn cpufreq_drv_type ,
+.Fn cpufreq_drv_set ,
+and
+.Fn cpufreq_drv_get .
+Additionally, the driver must attach a device as a child of a CPU
+device so that these methods can be called by the
+.Nm
+framework.
+.Pp
+The
+.Fn cpufreq_drv_settings
+method returns an array of currently available settings, each of type
+.Vt "struct cf_setting" .
+The driver should set unknown or irrelevant values to
+.Dv CPUFREQ_VAL_UNKNOWN .
+All the following elements for each setting should be returned:
+.Bd -literal
+struct cf_setting {
+ int freq; /* CPU clock in MHz or 100ths of a percent. */
+ int volts; /* Voltage in mV. */
+ int power; /* Power consumed in mW. */
+ int lat; /* Transition latency in us. */
+ device_t dev; /* Driver providing this setting. */
+};
+.Ed
+.Pp
+On entry to this method,
+.Fa count
+contains the number of settings that can be returned.
+On successful completion, the driver sets it to the actual number of
+settings returned.
+If the driver offers more settings than
+.Fa count
+will allow, it should return
+.Er E2BIG .
+.Pp
+The
+.Fn cpufreq_drv_type
+method indicates the type of settings it offers, either
+.Dv CPUFREQ_TYPE_ABSOLUTE
+or
+.Dv CPUFREQ_TYPE_RELATIVE .
+Additionally, the driver may set the
+.Dv CPUFREQ_FLAG_INFO_ONLY
+flag if the settings it provides are information for other drivers only
+and cannot be passed to
+.Fn cpufreq_drv_set
+to activate them.
+.Pp
+The
+.Fn cpufreq_drv_set
+method takes a driver setting and makes it active.
+If the setting is invalid or not currently available, it should return
+.Er EINVAL .
+.Pp
+The
+.Fn cpufreq_drv_get
+method returns the currently-active driver setting.
+The
+.Vt "struct cf_setting"
+returned must be valid for passing to
+.Fn cpufreq_drv_set ,
+including all elements being filled out correctly.
+If the driver cannot infer the current setting
+(even by estimating it with
+.Fn cpu_est_clockrate )
+then it should set all elements to
+.Dv CPUFREQ_VAL_UNKNOWN .
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr timecounters 4 ,
+.Xr powerd 8 ,
+.Xr sysctl 8
+.Sh AUTHORS
+.An Nate Lawson
+.An Bruno Ducrot
+contributed the
+.Pa powernow
+driver.
+.Sh BUGS
+The following drivers have not yet been converted to the
+.Nm
+interface:
+.Xr longrun 4 .
+.Pp
+Notification of CPU and bus frequency changes is not implemented yet.
+.Pp
+When multiple CPUs offer frequency control, they cannot be set to different
+levels and must all offer the same frequency settings.
diff --git a/share/man/man4/crypto.4 b/share/man/man4/crypto.4
new file mode 100644
index 000000000000..bb628254556b
--- /dev/null
+++ b/share/man/man4/crypto.4
@@ -0,0 +1,126 @@
+.\" $OpenBSD: crypto.4,v 1.4 2002/09/12 07:15:03 deraadt Exp $
+.\"
+.\" Copyright (c) 2001 Theo de Raadt
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 7, 2010
+.Dt CRYPTO 4
+.Os
+.Sh NAME
+.Nm crypto ,
+.Nm cryptodev
+.Nd hardware crypto access driver
+.Sh SYNOPSIS
+.Cd device crypto
+.Cd device cryptodev
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a device-independent framework to support
+cryptographic operations in the kernel.
+The
+.Nm cryptodev
+driver provides userland applications access to this support
+through the
+.Pa /dev/crypto
+device.
+This node primarily operates in an
+.Xr ioctl 2
+based model, permitting a variety of applications to query device capabilities,
+submit transactions, and get results.
+.Pp
+If
+.Ar count
+given in the specification, and is greater than 0, a maximum of one
+.Nm
+device is created.
+.Pp
+The following
+.Xr ioctl 2
+calls apply only to the
+.Nm
+devices:
+.Bl -tag -width ".Dv CIOCGSESSION"
+.It Dv CIOCGSESSION
+Setup a new crypto session for a new type of operation.
+.It Dv CIOCFSESSION
+Free a previously established session.
+.It Dv CIOCCRYPT
+Perform a crypto operation against a previously setup session.
+.El
+.Sh FEATURES
+Depending on hardware being present, the following symmetric and
+asymmetric cryptographic features are potentially available from
+.Pa /dev/crypto :
+.Pp
+.Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -offset indent -compact
+.It Dv CRYPTO_DES_CBC
+.It Dv CRYPTO_3DES_CBC
+.It Dv CRYPTO_BLF_CBC
+.It Dv CRYPTO_CAMELLIA_CBC
+.It Dv CRYPTO_CAST_CBC
+.It Dv CRYPTO_SKIPJACK_CBC
+.It Dv CRYPTO_MD5_HMAC
+.It Dv CRYPTO_SHA1_HMAC
+.It Dv CRYPTO_RIPEMD160_HMAC
+.It Dv CRYPTO_MD5_KPDK
+.It Dv CRYPTO_SHA1_KPDK
+.It Dv CRYPTO_AES_CBC
+.It Dv CRYPTO_ARC4
+.It Dv CRYPTO_MD5
+.It Dv CRYPTO_SHA1
+.It Dv CRK_MOD_EXP
+.It Dv CRK_MOD_EXP_CRT
+.It Dv CRK_DSA_SIGN
+.It Dv CRK_DSA_VERIFY
+.It Dv CRK_DH_COMPUTE_KEY
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/crypto" -compact
+.It Pa /dev/crypto
+crypto access device
+.El
+.Sh SEE ALSO
+.Xr aesni 4 ,
+.Xr glxsb 4 ,
+.Xr hifn 4 ,
+.Xr ipsec 4 ,
+.Xr padlock 4 ,
+.Xr safe 4 ,
+.Xr ubsec 4 ,
+.Xr geli 8 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 3.0 .
+The
+.Nm
+driver was imported to
+.Fx 5.0 .
diff --git a/share/man/man4/cue.4 b/share/man/man4/cue.4
new file mode 100644
index 000000000000..a27653cffa8a
--- /dev/null
+++ b/share/man/man4/cue.4
@@ -0,0 +1,113 @@
+.\" Copyright (c) 1997, 1998, 1999, 2000
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt CUE 4
+.Os
+.Sh NAME
+.Nm cue
+.Nd "CATC USB-EL1210A USB Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device cue"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cue_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the Computer
+Access Technology Corporation's USB-EL1210A chipset.
+.Pp
+The USB-EL1210A supports a 512-bit multicast hash filter, single perfect
+filter entry for the station address and promiscuous mode.
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+The CATC chipset supports only 10Mbps half-duplex mode, hence there
+are no
+.Xr ifmedia 4
+modes to select.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports CATC USB-EL1210A based USB Ethernet
+adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+Belkin F5U011/F5U111
+.It
+CATC Netmate
+.It
+CATC Netmate II
+.It
+SmartBridges SmartLink
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "cue%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "cue%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
diff --git a/share/man/man4/cxgb.4 b/share/man/man4/cxgb.4
new file mode 100644
index 000000000000..97f72b570d99
--- /dev/null
+++ b/share/man/man4/cxgb.4
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2007-2008, Chelsio Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Chelsio Inc nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 14, 2007
+.Dt CXGB 4
+.Os
+.Sh NAME
+.Nm cxgb
+.Nd "Chelsio T3 10 Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firmware"
+.Cd "device cxgb"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cxgb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Transmit/Receive checksum offload,
+Jumbo Frames, TCP segmentation offload (TSO), Large Receive Offload (LRO),
+VLAN hardware insertion / extraction, and VLAN checksum offload.
+For further hardware information, see
+.Pa http://www.chelsio.com/ .
+.Pp
+For questions related to hardware requirements,
+refer to the documentation supplied with your Chelsio T3 adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 9000.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10 Gigabit and 1 Gigabit Ethernet adapters based on the T3 and T3B chipset:
+.Pp
+.Bl -bullet -compact
+.It
+Chelsio 10GBase-CX4
+.It
+Chelsio 10GBase-LR
+.It
+Chelsio 10GBase-SR
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "cxgb%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "cxgb%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "cxgb%d: Could not find firmware image %s"
+The appropriate firmware kld module was not installed.
+This is a fatal initialization error.
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Chelsio support website at:
+.Pa http://www.chelsio.com/ .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq support@chelsio.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3
+and
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Kip Macy Aq kmacy@FreeBSD.org
+with substantial support from
+.An Scott Long Aq scottl@FreeBSD.org .
diff --git a/share/man/man4/cxgbe.4 b/share/man/man4/cxgbe.4
new file mode 100644
index 000000000000..88d42e3f3b32
--- /dev/null
+++ b/share/man/man4/cxgbe.4
@@ -0,0 +1,230 @@
+.\" Copyright (c) 2011, Chelsio Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Chelsio Inc nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt CXGBE 4
+.Os
+.Sh NAME
+.Nm cxgbe
+.Nd "Chelsio T4 10Gb and 1Gb Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device cxgbe"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cxgbe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Express Ethernet adapters based on
+the Chelsio Terminator 4 (T4) ASIC.
+The driver supports Jumbo Frames, Transmit/Receive checksum offload,
+TCP segmentation offload (TSO), Large Receive Offload (LRO), VLAN
+tag insertion/extraction, VLAN checksum offload, VLAN TSO, and
+Receive Side Steering (RSS).
+For further hardware information and questions related to hardware
+requirements, see
+.Pa http://www.chelsio.com/ .
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10Gb and 1Gb Ethernet adapters based on the T4 ASIC:
+.Pp
+.Bl -bullet -compact
+.It
+Chelsio T420-CR
+.It
+Chelsio T422-CR
+.It
+Chelsio T440-CR
+.It
+Chelsio T420-BCH
+.It
+Chelsio T440-BCH
+.It
+Chelsio T440-CH
+.It
+Chelsio T420-SO
+.It
+Chelsio T420-CX
+.It
+Chelsio T420-BT
+.It
+Chelsio T404-BT
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.cxgbe.ntxq10g
+The number of tx queues to use for a 10Gb port.
+The default is 16 or the number
+of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nrxq10g
+The number of rx queues to use for a 10Gb port.
+The default is 8 or the number
+of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.ntxq1g
+The number of tx queues to use for a 1Gb port.
+The default is 4 or the number
+of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nrxq1g
+The number of rx queues to use for a 1Gb port.
+The default is 2 or the number
+of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nofldtxq10g
+The number of TOE tx queues to use for a 10Gb port.
+The default is 8 or the
+number of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nofldrxq10g
+The number of TOE rx queues to use for a 10Gb port.
+The default is 2 or the
+number of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nofldtxq1g
+The number of TOE tx queues to use for a 1Gb port.
+The default is 2 or the
+number of CPU cores in the system, whichever is less.
+.It Va hw.cxgbe.nofldrxq1g
+The number of TOE rx queues to use for a 1Gb port.
+The default is 1.
+.It Va hw.cxgbe.holdoff_timer_idx_10G
+.It Va hw.cxgbe.holdoff_timer_idx_1G
+The timer index value to use to delay interrupts.
+The holdoff timer list has the values 1, 5, 10, 50, 100, and 200
+by default (all values are in microseconds) and the index selects a
+value from this list.
+The default value is 1 for both 10Gb and 1Gb ports, which means the
+timer value is 5us.
+Different cxgbe interfaces can be assigned different values at any time via the
+dev.cxgbe.X.holdoff_tmr_idx sysctl.
+.It Va hw.cxgbe.holdoff_pktc_idx_10G
+.It Va hw.cxgbe.holdoff_pktc_idx_1G
+The packet-count index value to use to delay interrupts.
+The packet-count list has the values 1, 8, 16, and 32 by default
+and the index selects a value from this list.
+The default value is 2 for both 10Gb and 1Gb ports, which means 16
+packets (or the holdoff timer going off) before an interrupt is
+generated.
+-1 disables packet counting.
+Different cxgbe interfaces can be assigned different values via the
+dev.cxgbe.X.holdoff_pktc_idx sysctl.
+This sysctl works only when the interface has never been marked up (as done by
+ifconfig up).
+.It Va hw.cxgbe.qsize_txq
+The size, in number of entries, of the descriptor ring used for a tx
+queue.
+A buf_ring of the same size is also allocated for additional
+software queuing.
+See
+.Xr ifnet 9 .
+The default value is 1024.
+Different cxgbe interfaces can be assigned different values via the
+dev.cxgbe.X.qsize_txq sysctl.
+This sysctl works only when the interface has never been marked up (as done by
+ifconfig up).
+.It Va hw.cxgbe.qsize_rxq
+The size, in number of entries, of the descriptor ring used for an
+rx queue.
+The default value is 1024.
+Different cxgbe interfaces can be assigned different values via the
+dev.cxgbe.X.qsize_rxq sysctl.
+This sysctl works only when the interface has never been marked up (as done by
+ifconfig up).
+.It Va hw.cxgbe.interrupt_types
+The interrupt types that the driver is allowed to use.
+Bit 0 represents INTx (line interrupts), bit 1 MSI, bit 2 MSI-X.
+The default is 7 (all allowed).
+The driver will select the best possible type out of the allowed types by
+itself.
+.It Va hw.cxgbe.config_file
+Select a pre-packaged device configuration file.
+A configuration file contains a recipe for partitioning and configuring the
+hardware resources on the card.
+This tunable is for specialized applications only and should not be used in
+normal operation.
+The configuration profile currently in use is available in the dev.t4nex.X.cf
+and dev.t4nex.X.cfcsum sysctls.
+.It Va hw.cxgbe.linkcaps_allowed
+.It Va hw.cxgbe.niccaps_allowed
+.It Va hw.cxgbe.toecaps_allowed
+.It Va hw.cxgbe.rdmacaps_allowed
+.It Va hw.cxgbe.iscsicaps_allowed
+.It Va hw.cxgbe.fcoecaps_allowed
+Disallowing capabilities provides a hint to the driver and firmware to not
+reserve hardware resources for that feature.
+Each of these is a bit field with a bit for each sub-capability within the
+capability.
+This tunable is for specialized applications only and should not be used in
+normal operation.
+The capabilities for which hardware resources have been reserved are listed in
+dev.t4nex.X.*caps sysctls.
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Chelsio support website at:
+.Pa http://www.chelsio.com/ .
+.Pp
+If an issue is identified with this driver with a supported adapter,
+email all the specific information related to the issue to
+.Aq support@chelsio.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr cxgb 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 9.0
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Navdeep Parhar Aq np@FreeBSD.org .
diff --git a/share/man/man4/cy.4 b/share/man/man4/cy.4
new file mode 100644
index 000000000000..3ad479fbce35
--- /dev/null
+++ b/share/man/man4/cy.4
@@ -0,0 +1,261 @@
+.\" Copyright (c) 1990, 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Systems Programming Group of the University of Utah Computer
+.\" Science Department.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
+.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
+.\" from: sio.4,v 1.16 1995/06/26 06:05:30 bde Exp $
+.\" $FreeBSD$
+.\"
+.Dd May 24, 2004
+.Dt CY 4
+.Os
+.Sh NAME
+.Nm cy
+.Nd Cyclades Cyclom-Y serial driver
+.Sh SYNOPSIS
+For one ISA card:
+.Bd -ragged -offset indent -compact
+.Cd "device cy"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.cy.0.at="isa"
+.Cd hint.cy.0.irq="10"
+.Cd hint.cy.0.maddr="0xd4000"
+.Cd hint.cy.0.msize="0x2000"
+.Ed
+.Pp
+For two ISA cards:
+.Bd -ragged -offset indent -compact
+.Cd "device cy"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.cy.0.at="isa"
+.Cd hint.cy.0.irq="10"
+.Cd hint.cy.0.maddr="0xd4000"
+.Cd hint.cy.0.msize="0x2000"
+.Cd hint.cy.1.at="isa"
+.Cd hint.cy.1.irq="11"
+.Cd hint.cy.1.maddr="0xd6000"
+.Cd hint.cy.1.msize="0x2000"
+.Ed
+.Pp
+For PCI cards:
+.Bd -ragged -offset indent -compact
+.Cd "device cy"
+.Cd "options CY_PCI_FASTINTR"
+.Pp
+No lines are required in
+.Pa /boot/device.hints
+for PCI cards.
+.Ed
+.Pp
+Minor numbering:
+.Bd -literal -offset indent -compact
+0b\fIMMMMMMMMMMMMMMMMxxxxxxxxOLIMMMMM\fR
+ call\fBO\fRut
+ \fBL\fRock
+ \fBI\fRnitial
+ \fBMMMMMMMMMMMMMMMM MMMMMM\fRinor
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Cirrus Logic CD1400-based
+.Tn EIA
+.Tn RS-232C
+.Pf ( Tn CCITT
+.Tn V.24 )
+communications interfaces (ports) on Cyclades Cyclom-Y boards.
+Each CD1400 provides 4 ports.
+Cyclom-Y boards with various numbers of CD1400's are available.
+This driver supports up to 8 CD1400's (32 ports) per board.
+.Pp
+Input and output for each line may set independently
+to the following speeds:
+50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
+19200, 38400, 57600, or 115200 bps.
+Other speeds of up to 150000 are supported by the termios interface
+but not by the sgttyb compatibility interface.
+The CD1400 is not fast enough to handle speeds above 115200 bps
+effectively.
+It can transmit on a single line at slightly more than 115200 bps,
+but when 4 lines are active in both directions its limit is about
+90000 bps on each line.
+.\" XXX the following should be true for all serial drivers and
+.\" should not be repeated in the man pages for all serial drivers.
+.\" It was copied from sio.4. The only change was s/sio/cy/g.
+.Pp
+Serial ports controlled by the
+.Nm
+driver can be used for both `callin' and `callout'.
+For each port there is a callin device and a callout device.
+The minor number of the callout device is 128 higher
+than that of the corresponding callin port.
+The callin device is general purpose.
+Processes opening it normally wait for carrier
+and for the callout device to become inactive.
+The callout device is used to steal the port from
+processes waiting for carrier on the callin device.
+Processes opening it do not wait for carrier
+and put any processes waiting for carrier on the callin device into
+a deeper sleep so that they do not conflict with the callout session.
+The callout device is abused for handling programs that are supposed
+to work on general ports and need to open the port without waiting
+but are too stupid to do so.
+.Pp
+The
+.Nm
+driver also supports an initial-state and a lock-state control
+device for each of the callin and the callout "data" devices.
+The minor number of the initial-state device is 32 higher
+than that of the corresponding data device.
+The minor number of the lock-state device is 64 higher
+than that of the corresponding data device.
+The termios settings of a data device are copied
+from those of the corresponding initial-state device
+on first opens and are not inherited from previous opens.
+Use
+.Xr stty 1
+in the normal way on the initial-state devices to program
+initial termios states suitable for your setup.
+.Pp
+The lock termios state acts as flags to disable changing
+the termios state.
+E.g., to lock a flag variable such as
+CRTSCTS, use
+.Em "stty crtscts"
+on the lock-state device.
+Speeds and special characters
+may be locked by setting the corresponding value in the lock-state
+device to any nonzero value.
+.Pp
+Correct programs talking to correctly wired external devices
+work with almost arbitrary initial states and almost no locking,
+but other setups may benefit from changing some of the default
+initial state and locking the state.
+In particular, the initial states for non (POSIX) standard flags
+should be set to suit the devices attached and may need to be
+locked to prevent buggy programs from changing them.
+E.g., CRTSCTS should be locked on for devices that support
+RTS/CTS handshaking at all times and off for devices that do not
+support it at all.
+CLOCAL should be locked on for devices
+that do not support carrier.
+HUPCL may be locked off if you do not
+want to hang up for some reason.
+In general, very bad things happen
+if something is locked to the wrong state, and things should not
+be locked for devices that support more than one setting.
+The
+CLOCAL flag on callin ports should be locked off for logins
+to avoid certain security holes, but this needs to be done by
+getty if the callin port is used for anything else.
+.Ss Kernel Configuration Options
+The
+.Em CY_PCI_FASTINTR
+option should be used to avoid suboptimal interrupt handling for
+PCI Cyclades boards.
+The PCI BIOS must be configured with the
+.Nm
+interrupt not shared with any other active device
+for this option to work.
+This option is not the default because it is currently harmful in
+certain cases where it does not work.
+.Sh FILES
+.\" XXX more cloning: s/d/c/g and add a ? for the card number.
+.Bl -tag -width /dev/ttyic?? -compact
+.It Pa /dev/ttyc??
+for callin ports
+.It Pa /dev/ttyic??
+.It Pa /dev/ttylc??
+corresponding callin initial-state and lock-state devices
+.Pp
+.\" XXX more cloning: s/a/c/g. No consistency :-(.
+.It Pa /dev/cuac??
+for callout ports
+.It Pa /dev/cuaic??
+.It Pa /dev/cualc??
+corresponding callout initial-state and lock-state devices
+.El
+.Pp
+.Bl -tag -width /etc/rc.serial -compact
+.It Pa /etc/rc.serial
+examples of setting the initial-state and lock-state devices
+.El
+.Pp
+The first question mark in these device names is short for the
+card number
+(a decimal number between 0 and 65535 inclusive).
+The second question mark is short for the port number
+(a letter in the range [0-9a-v]).
+.Sh DIAGNOSTICS
+.Bl -diag
+.\" XXX back to s/sio/cy/g.
+.It cy%d: silo overflow.
+Problem in the interrupt handler.
+.El
+.Bl -diag
+.It cy%d: interrupt-level buffer overflow.
+Problem in the bottom half of the driver.
+.El
+.Bl -diag
+.It cy%d: tty-level buffer overflow.
+Problem in the application.
+Input has arrived faster than the given module could process it
+and some has been lost.
+.El
+.\" .Bl -diag
+.\" .It sio%d: reduced fifo trigger level to %d.
+.\" Attempting to avoid further silo overflows.
+.\" .El
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr termios 4 ,
+.Xr tty 4 ,
+.Xr comcontrol 8 ,
+.Xr pstat 8
+.Sh HISTORY
+The
+.Nm
+driver is derived from the
+.Nm sio
+driver and the
+.Nx
+.Nm
+driver and is
+.Ud
+.Sh BUGS
+Serial consoles are not implemented.
diff --git a/share/man/man4/da.4 b/share/man/man4/da.4
new file mode 100644
index 000000000000..39e1dbabfb96
--- /dev/null
+++ b/share/man/man4/da.4
@@ -0,0 +1,217 @@
+.\" Copyright (c) 1996
+.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt DA 4
+.Os
+.Sh NAME
+.Nm da
+.Nd SCSI Direct Access device driver
+.Sh SYNOPSIS
+.Cd device da
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all
+.Tn SCSI
+devices of the direct access class that are attached to the system
+through a supported
+.Tn SCSI
+Host Adapter.
+The direct access class includes disk, magneto-optical,
+and solid-state devices.
+.Pp
+A
+.Tn SCSI
+Host
+adapter must also be separately configured into the system
+before a
+.Tn SCSI
+direct access device can be configured.
+.Sh CACHE EFFECTS
+Many direct access devices are equipped with read and/or write caches.
+Parameters affecting the device's cache are stored in mode page 8,
+the caching control page.
+Mode pages can be examined and modified via the
+.Xr camcontrol 8
+utility.
+.Pp
+The read cache is used to store data from device-initiated read ahead
+operations as well as frequently used data.
+The read cache is transparent
+to the user and can be enabled without any adverse effect.
+Most devices
+with a read cache come from the factory with it enabled.
+The read cache can be disabled by setting the
+.Tn RCD
+(Read Cache Disable) bit in the caching control mode page.
+.Pp
+The write cache can greatly decrease the latency of write operations
+and allows the device to reorganize writes to increase efficiency and
+performance.
+This performance gain comes at a price.
+Should the device
+lose power while its cache contains uncommitted write operations, these
+writes will be lost.
+The effect of a loss of write transactions on
+a file system is non-deterministic and can cause corruption.
+Most
+devices age write transactions to limit vulnerability to a few transactions
+recently reported as complete, but it is none-the-less recommended that
+systems with write cache enabled devices reside on an Uninterruptible
+Power Supply (UPS).
+The
+.Nm
+device driver ensures that the cache and media are synchronized upon
+final close of the device or an unexpected shutdown (panic) event.
+This ensures that it is safe to disconnect power once the operating system
+has reported that it has halted.
+The write cache can be enabled by setting the
+.Tn WCE
+(Write Cache Enable) bit in the caching control mode page.
+.Sh TAGGED QUEUING
+The
+.Nm
+device driver will take full advantage of the SCSI feature known as tagged
+queueing.
+Tagged queueing allows the device to process multiple transactions
+concurrently, often re-ordering them to reduce the number and length of
+seeks.
+To ensure that transactions to distant portions of the media,
+which may be deferred indefinitely by servicing requests nearer the current
+head position, are completed in a timely fashion, an ordered tagged
+transaction is sent every 15 seconds during continuous device operation.
+.Sh BAD BLOCK RECOVERY
+Direct Access devices have the capability of mapping out portions of
+defective media.
+Media recovery parameters are located in mode page 1,
+the Read-Write Error Recovery mode page.
+The most important media
+remapping features are 'Auto Write Reallocation' and 'Auto Read
+Reallocation' which can be enabled via the AWRE and ARRE bits,
+respectively, of the Read-Write Error Recovery page.
+Many devices do not ship from the factory with these feature enabled.
+Mode pages can be examined and modified
+via the
+.Xr camcontrol 8
+utility.
+.Sh KERNEL CONFIGURATION
+It is only necessary to explicitly configure one
+.Nm
+device; data structures are dynamically allocated as disks are found
+on the
+.Tn SCSI
+bus.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width 12
+.It kern.cam.da.retry_count
+.Pp
+This variable determines how many times the
+.Nm
+driver will retry a READ or WRITE command.
+This does not affect the number of retries used during probe time or for
+the
+.Nm
+driver dump routine.
+This value currently defaults to 4.
+.It kern.cam.da.default_timeout
+.Pp
+This variable determines how long the
+.Nm
+driver will wait before timing out an outstanding command.
+The units for this value are seconds, and the default is currently 60
+seconds.
+.It kern.cam.da.%d.minimum_cmd_size
+.Pp
+This variable determines what the minimum READ/WRITE CDB size is for a
+given
+.Nm
+unit.
+(The %d above denotes the unit number of the
+.Nm
+driver instance, e.g.\& 1, 2, 4, 8, etc.)
+Valid minimum command size values are 6, 10, 12 and 16 bytes.
+The default is 6 bytes.
+.Pp
+The
+.Nm
+driver issues a CAM Path Inquiry CCB at probe time to determine whether the
+protocol the device in question speaks (e.g.\& ATAPI) typically does not allow
+6 byte commands.
+If it does not, the
+.Nm
+driver will default to using at least 10 byte CDBs.
+If a 6 byte READ or WRITE fails with an ILLEGAL REQUEST error, the
+.Nm
+driver will then increase the default CDB size for the device to 10 bytes and
+retry the command.
+CDB size is always
+chosen as the smallest READ/WRITE CDB that will satisfy the specified minimum
+command size, and the LBA and length of the READ or WRITE in question.
+(e.g., a write to an LBA larger than 2^32 will require a 16 byte CDB.)
+.El
+.Sh NOTES
+If a device becomes invalidated (media is removed, device becomes unresponsive)
+the disklabel and information held within the kernel about the device will
+be invalidated.
+To avoid corruption of a newly inserted piece of media or
+a replacement device, all accesses to the device will be discarded until
+the last file descriptor referencing the old device is closed.
+During this period, all new open attempts will be rejected.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/da*" -compact
+.It Pa /dev/da*
+SCSI disk device nodes
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr cam 4 ,
+.Xr geom 4 ,
+.Xr bsdlabel 8 ,
+.Xr fdisk 8
+.Sh HISTORY
+The
+.Nm
+driver was written for the
+.Tn CAM
+.Tn SCSI
+subsystem by
+.An Justin T. Gibbs .
+Many ideas were gleaned from the
+.Nm sd
+device driver written and ported from
+.Tn Mach
+2.5
+by
+.An Julian Elischer .
diff --git a/share/man/man4/dc.4 b/share/man/man4/dc.4
new file mode 100644
index 000000000000..cc6250c2c2ea
--- /dev/null
+++ b/share/man/man4/dc.4
@@ -0,0 +1,450 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 24, 2011
+.Dt DC 4
+.Os
+.Sh NAME
+.Nm dc
+.Nd "DEC/Intel 21143 and clone 10/100 Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device dc"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_dc_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for several PCI Fast Ethernet adapters and
+embedded controllers based on the DEC/Intel 21143 chipset and clones.
+.Pp
+All of supported chipsets have the same general register layout, DMA
+descriptor format and method of operation.
+All of the clone chips
+are based on the 21143 design with various modifications.
+The
+21143 itself has support for 10baseT, BNC, AUI, MII and symbol
+media attachments, 10 and 100Mbps speeds in full or half duplex,
+built in NWAY autonegotiation and wake on LAN.
+The 21143 also
+offers several receive filter programming options including
+perfect filtering, inverse perfect filtering and hash table
+filtering.
+.Pp
+Some clone chips duplicate the 21143 fairly closely while others
+only maintain superficial similarities.
+Some support only MII
+media attachments.
+Others use different receiver filter programming
+mechanisms.
+At least one supports only chained DMA descriptors
+(most support both chained descriptors and contiguously allocated
+fixed size rings).
+Some chips (especially the PNIC) also have
+peculiar bugs.
+The
+.Nm
+driver does its best to provide generalized support for all
+of these chipsets in order to keep special case code to a minimum.
+.Pp
+These chips are used by many vendors which makes it
+difficult to provide a complete list of all supported cards.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.Pp
+Note: the built-in NWAY autonegotiation on the original PNIC 82c168
+chip is horribly broken and is not supported by the
+.Nm
+driver at this time (see the
+.Sx BUGS
+section for details).
+The original 82c168 appears
+on very early revisions of the LinkSys LNE100TX and Matrox FastNIC.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Cm mediaopt
+option can also be used to enable
+.Cm full-duplex
+operation.
+Not specifying
+.Cm full-duplex
+implies
+.Cm half-duplex
+mode.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Cm mediaopt
+option can also be used to enable
+.Cm full-duplex
+operation.
+Not specifying
+.Cm full-duplex
+implies
+.Cm half-duplex
+mode.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+The interface will operate in
+half duplex mode if this media option is not specified.
+.El
+.Pp
+Note that the 100baseTX media type may not be available on certain
+Intel 21143 adapters which support 10Mbps media attachments only.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+DEC/Intel 21143
+.It
+ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513
+Centaur II
+.It
+ALi/ULi M5261 and M5263
+.It
+ASIX Electronics AX88140A and AX88141
+.It
+Conexant LANfinity RS7112 (miniPCI)
+.It
+Davicom DM9009, DM9100, DM9102 and DM9102A
+.It
+Lite-On 82c168 and 82c169 PNIC
+.It
+Lite-On/Macronix 82c115 PNIC II
+.It
+Macronix 98713, 98713A, 98715, 98715A, 98715AEC-C, 98725, 98727 and 98732
+.It
+Xircom X3201 (cardbus only)
+.El
+.Pp
+The
+following NICs are known to work with the
+.Nm
+driver at this time:
+.Pp
+.Bl -bullet -compact
+.It
+3Com OfficeConnect 10/100B (ADMtek AN985 Centaur-P)
+.It
+Abocom FE2500
+.It
+Accton EN1217 (98715A)
+.It
+Accton EN2242 MiniPCI
+.It
+Adico AE310TX (98715A)
+.It
+Alfa Inc GFC2204 (ASIX AX88140A)
+.It
+Built in 10Mbps only Ethernet on Compaq Presario 7900 series
+desktops (21143, non-MII)
+.It
+Built in Sun DMFE 10/100 Mbps Ethernet on Sun Netra X1 and Sun Fire V100
+(DM9102A, MII)
+.It
+Built in Ethernet on LinkSys EtherFast 10/100 Instant GigaDrive (DM9102, MII)
+.It
+CNet Pro110B (ASIX AX88140A)
+.It
+CNet Pro120A (98715A or 98713A) and CNet Pro120B (98715)
+.It
+Compex RL100-TX (98713 or 98713A)
+.It
+D-Link DFE-570TX (21143, MII, quad port)
+.It
+Digital DE500-BA 10/100 (21143, non-MII)
+.It
+ELECOM Laneed LD-CBL/TXA (ADMtek AN985)
+.It
+Hawking CB102 CardBus
+.It
+IBM EtherJet Cardbus Adapter
+.It
+Intel PRO/100 Mobile Cardbus (versions that use the X3201 chipset)
+.It
+Jaton XpressNet (Davicom DM9102)
+.It
+Kingston KNE100TX (21143, MII)
+.It
+Kingston KNE110TX (PNIC 82c169)
+.It
+LinkSys LNE100TX (PNIC 82c168, 82c169)
+.It
+LinkSys LNE100TX v2.0 (PNIC II 82c115)
+.It
+LinkSys LNE100TX v4.0/4.1 (ADMtek AN985 Centaur-P)
+.It
+Matrox FastNIC 10/100 (PNIC 82c168, 82c169)
+.It
+Melco LGY-PCI-TXL
+.It
+Microsoft MN-120 10/100 CardBus (ADMTek Centaur-C)
+.It
+Microsoft MN-130 10/100 PCI (ADMTek Centaur-P)
+.It
+NDC SOHOware SFA110A (98713A)
+.It
+NDC SOHOware SFA110A Rev B4 (98715AEC-C)
+.It
+NetGear FA310-TX Rev.\& D1, D2 or D3 (PNIC 82c169)
+.It
+Netgear FA511
+.It
+PlaneX FNW-3602-T (ADMtek AN985)
+.It
+SMC EZ Card 10/100 1233A-TX (ADMtek AN985)
+.It
+SVEC PN102-TX (98713)
+.It
+Xircom Cardbus Realport
+.It
+Xircom Cardbus Ethernet 10/100
+.It
+Xircom Cardbus Ethernet II 10/100
+.El
+.Sh NOTES
+On sparc64 the
+.Nm
+driver respects the
+.Va local-mac-address?
+system configuration variable for the built in Sun DMFE 10/100 Mbps Ethernet
+interfaces on Sun Netra X1 and Sun Fire V100.
+This system configuration variable can be set in the Open Firmware boot
+monitor using the
+.Ic setenv
+command or by
+.Xr eeprom 8 .
+If set to
+.Dq Li false
+(the default), the
+.Nm
+driver will use the system's default MAC address for both of the built in
+devices.
+If set to
+.Dq Li true ,
+the unique MAC address of each interface is used rather than the system's
+default MAC address.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "dc%d: couldn't map ports/memory"
+A fatal initialization error has occurred.
+.It "dc%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "dc%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, but the device failed to acknowledge the transmission
+before a timeout expired.
+This can happen if the device is unable
+to deliver interrupts for some reason, of if there is a problem with
+the network connection (cable or network equipment) that results in a loss
+of link.
+.It "dc%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "dc%d: TX underrun -- increasing TX threshold"
+The device generated a transmit underrun error while attempting to
+DMA and transmit a packet.
+This happens if the host is not able to
+DMA the packet data into the NIC's FIFO fast enough.
+The driver
+will dynamically increase the transmit start threshold so that
+more data must be DMAed into the FIFO before the NIC will start
+transmitting it onto the wire.
+.It "dc%d: TX underrun -- using store and forward mode"
+The device continued to generate transmit underruns even after all
+possible transmit start threshold settings had been tried, so the
+driver programmed the chip for store and forward mode.
+In this mode,
+the NIC will not begin transmission until the entire packet has been
+transferred into its FIFO memory.
+.It "dc%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform a second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr eeprom 8 ,
+.Xr ifconfig 8
+.Rs
+.%T ADMtek AL981, AL983 and AL985 data sheets
+.%U http://www.admtek.com.tw
+.Re
+.Rs
+.%T ASIX Electronics AX88140A and AX88141 data sheets
+.%U http://www.asix.com.tw
+.Re
+.Rs
+.%T Davicom DM9102 data sheet
+.%U http://www.davicom.com.tw/userfile/24247/DM9102H-DS-F01-021508.pdf
+.Re
+.Rs
+.%T Intel 21143 Hardware Reference Manual
+.%U http://developer.intel.com
+.Re
+.Rs
+.%T Macronix 98713/A, 98715/A and 98725 data sheets
+.%U http://www.macronix.com
+.Re
+.Rs
+.%T Macronix 98713/A and 98715/A app notes
+.%U http://www.macronix.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
+.Sh BUGS
+The Macronix application notes claim that in order to put the
+chips in normal operation, the driver must write a certain magic
+number into the CSR16 register.
+The numbers are documented in
+the app notes, but the exact meaning of the bits is not.
+.Pp
+The 98713A seems to have a problem with 10Mbps full duplex mode.
+The transmitter works but the receiver tends to produce many
+unexplained errors leading to very poor overall performance.
+The
+98715A does not exhibit this problem.
+All other modes on the
+98713A seem to work correctly.
+.Pp
+The original 82c168 PNIC chip has built in NWAY support which is
+used on certain early LinkSys LNE100TX and Matrox FastNIC cards,
+however it is horribly broken and difficult to use reliably.
+Consequently, autonegotiation is not currently supported for this
+chipset: the driver defaults the NIC to 10baseT half duplex, and it is
+up to the operator to manually select a different mode if necessary.
+(Later cards use an external MII transceiver to implement NWAY
+autonegotiation and work correctly.)
+.Pp
+The
+.Nm
+driver programs 82c168 and 82c169 PNIC chips to use the store and
+forward setting for the transmit start threshold by default.
+This
+is to work around problems with some NIC/PCI bus combinations where
+the PNIC can transmit corrupt frames when operating at 100Mbps,
+probably due to PCI DMA burst transfer errors.
+.Pp
+The 82c168 and 82c169 PNIC chips also have a receiver bug that
+sometimes manifests during periods of heavy receive and transmit
+activity, where the chip will improperly DMA received frames to
+the host.
+The chips appear to upload several kilobytes of garbage
+data along with the received frame data, dirtying several RX buffers
+instead of just the expected one.
+The
+.Nm
+driver detects this condition and will salvage the frame; however,
+it incurs a serious performance penalty in the process.
+.Pp
+The PNIC chips also sometimes generate a transmit underrun error when
+the driver attempts to download the receiver filter setup frame, which
+can result in the receive filter being incorrectly programmed.
+The
+.Nm
+driver will watch for this condition and requeue the setup frame until
+it is transferred successfully.
+.Pp
+The ADMtek AL981 chip (and possibly the AN985 as well) has been observed
+to sometimes wedge on transmit: this appears to happen when the driver
+queues a sequence of frames which cause it to wrap from the end of the
+transmit descriptor ring back to the beginning.
+The
+.Nm
+driver attempts to avoid this condition by not queuing any frames past
+the end of the transmit ring during a single invocation of the
+.Fn dc_start
+routine.
+This workaround has a negligible impact on transmit performance.
diff --git a/share/man/man4/dcons.4 b/share/man/man4/dcons.4
new file mode 100644
index 000000000000..d3a49c2c92be
--- /dev/null
+++ b/share/man/man4/dcons.4
@@ -0,0 +1,125 @@
+.\" Copyright (c) 2003 Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2008
+.Dt DCONS 4
+.Os
+.Sh NAME
+.Nm dcons
+.Nd dumb console device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GDB"
+.Cd "device firewire"
+.Cd "device dcons"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GDB"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -ragged -offset indent
+dcons_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device is a simple console device which just reads from and writes to
+an allocated buffer for input and output respectively.
+It is of no use by itself and it is supposed that the buffer is accessed
+via a bus like
+.Xr firewire 4
+or
+.Xr kvm 3
+for interaction.
+.Pp
+The buffer consists of 4 channels.
+There are 2 ports, one for the console TTY and another is GDB port,
+then each port has an input channel and an output channel.
+.Sh FILES
+.Bl -tag -width indent -compact
+.It Pa /dev/dcons
+.It Pa /etc/ttys
+.El
+.Sh EXAMPLES
+If you want to run
+.Xr getty 8
+on
+.Nm ,
+insert the following line into
+.Xr ttys 5
+and send a
+.Dv HUP
+signal to
+.Xr init 8
+using
+.Xr kill 1 .
+.Bd -literal -offset indent
+dcons "/usr/libexec/getty std.9600" vt100 on secure
+.Ed
+.Pp
+Once the
+.Xr fwohci 4
+device is initialized to allow physical access,
+the buffer can be accessed from another host via a
+.Xr firewire 4
+bus using the
+.Xr dconschat 8
+application.
+See
+.Xr dconschat 8
+for more details.
+.Pp
+If you want to use
+.Xr dcons 4
+as a
+.Xr gdb 1
+port, add the following line into
+.Xr loader.conf 5
+.Bd -literal -offset indent
+dcons_gdb="1"
+.Ed
+.Sh SEE ALSO
+.Xr dcons_crom 4 ,
+.Xr ddb 4 ,
+.Xr firewire 4 ,
+.Xr fwohci 4 ,
+.Xr gdb 4 ,
+.Xr ttys 5 ,
+.Xr conscontrol 8 ,
+.Xr dconschat 8 ,
+.Xr fwcontrol 8
+.Sh AUTHORS
+.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org
+.Sh BUGS
+This driver is
+.Ud
diff --git a/share/man/man4/dcons_crom.4 b/share/man/man4/dcons_crom.4
new file mode 100644
index 000000000000..b9c5ca09deb1
--- /dev/null
+++ b/share/man/man4/dcons_crom.4
@@ -0,0 +1,61 @@
+.\" Copyright (c) 2003 Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 2003
+.Dt DCONS_CROM 4
+.Os
+.Sh NAME
+.Nm dcons_crom
+.Nd Configuration ROM stub for
+.Xr dcons 4
+.Sh SYNOPSIS
+.Cd device dcons_crom
+.Cd device dcons
+.Cd device firewire
+.Sh DESCRIPTION
+The
+.Nm
+exposes the buffer address of
+.Xr dcons 4
+through the Configuration ROM of
+.Xr firewire 4 .
+This address is supposed to be used by
+.Xr dconschat 8 .
+.Sh SEE ALSO
+.Xr dcons 4 ,
+.Xr firewire 4 ,
+.Xr fwohci 4 ,
+.Xr dconschat 8 ,
+.Xr fwcontrol 8
+.Sh AUTHORS
+.An Hidetoshi Shimokawa Aq simokawa@FreeBSD.org
+.Sh BUGS
+If you load
+.Pa dcons_crom.ko
+manually after the system is booted, you may
+have to initiate a bus reset using
+.Dq Nm fwcontrol Fl r
+to update the Configuration ROM.
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
new file mode 100644
index 000000000000..c174b51ba562
--- /dev/null
+++ b/share/man/man4/ddb.4
@@ -0,0 +1,1474 @@
+.\"
+.\" Mach Operating System
+.\" Copyright (c) 1991,1990 Carnegie Mellon University
+.\" Copyright (c) 2007 Robert N. M. Watson
+.\" All Rights Reserved.
+.\"
+.\" Permission to use, copy, modify and distribute this software and its
+.\" documentation is hereby granted, provided that both the copyright
+.\" notice and this permission notice appear in all copies of the
+.\" software, derivative works or modified versions, and any portions
+.\" thereof, and that both notices appear in supporting documentation.
+.\"
+.\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+.\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+.\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+.\"
+.\" Carnegie Mellon requests users of this software to return to
+.\"
+.\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+.\" School of Computer Science
+.\" Carnegie Mellon University
+.\" Pittsburgh PA 15213-3890
+.\"
+.\" any improvements or extensions that they make and grant Carnegie Mellon
+.\" the rights to redistribute these changes.
+.\"
+.\" changed a \# to #, since groff choked on it.
+.\"
+.\" HISTORY
+.\" ddb.4,v
+.\" Revision 1.1 1993/07/15 18:41:02 brezak
+.\" Man page for DDB
+.\"
+.\" Revision 2.6 92/04/08 08:52:57 rpd
+.\" Changes from OSF.
+.\" [92/01/17 14:19:22 jsb]
+.\" Changes for OSF debugger modifications.
+.\" [91/12/12 tak]
+.\"
+.\" Revision 2.5 91/06/25 13:50:22 rpd
+.\" Added some watchpoint explanation.
+.\" [91/06/25 rpd]
+.\"
+.\" Revision 2.4 91/06/17 15:47:31 jsb
+.\" Added documentation for continue/c, match, search, and watchpoints.
+.\" I've not actually explained what a watchpoint is; maybe Rich can
+.\" do that (hint, hint).
+.\" [91/06/17 10:58:08 jsb]
+.\"
+.\" Revision 2.3 91/05/14 17:04:23 mrt
+.\" Correcting copyright
+.\"
+.\" Revision 2.2 91/02/14 14:10:06 mrt
+.\" Changed to new Mach copyright
+.\" [91/02/12 18:10:12 mrt]
+.\"
+.\" Revision 2.2 90/08/30 14:23:15 dbg
+.\" Created.
+.\" [90/08/30 dbg]
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 16, 2011
+.Dt DDB 4
+.Os
+.Sh NAME
+.Nm ddb
+.Nd interactive kernel debugger
+.Sh SYNOPSIS
+In order to enable kernel debugging facilities include:
+.Bd -ragged -offset indent
+.Cd options KDB
+.Cd options DDB
+.Ed
+.Pp
+To prevent activation of the debugger on kernel
+.Xr panic 9 :
+.Bd -ragged -offset indent
+.Cd options KDB_UNATTENDED
+.Ed
+.Pp
+In order to print a stack trace of the current thread on the console
+for a panic:
+.Bd -ragged -offset indent
+.Cd options KDB_TRACE
+.Ed
+.Pp
+To print the numerical value of symbols in addition to the symbolic
+representation, define:
+.Bd -ragged -offset indent
+.Cd options DDB_NUMSYM
+.Ed
+.Pp
+To enable the
+.Xr gdb 1
+backend, so that remote debugging with
+.Xr kgdb 1
+is possible, include:
+.Bd -ragged -offset indent
+.Cd options GDB
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+kernel debugger is an interactive debugger with a syntax inspired by
+.Xr gdb 1 .
+If linked into the running kernel,
+it can be invoked locally with the
+.Ql debug
+.Xr keymap 5
+action.
+The debugger is also invoked on kernel
+.Xr panic 9
+if the
+.Va debug.debugger_on_panic
+.Xr sysctl 8
+MIB variable is set non-zero,
+which is the default
+unless the
+.Dv KDB_UNATTENDED
+option is specified.
+.Pp
+The current location is called
+.Va dot .
+The
+.Va dot
+is displayed with
+a hexadecimal format at a prompt.
+The commands
+.Ic examine
+and
+.Ic write
+update
+.Va dot
+to the address of the last line
+examined or the last location modified, and set
+.Va next
+to the address of
+the next location to be examined or changed.
+Other commands do not change
+.Va dot ,
+and set
+.Va next
+to be the same as
+.Va dot .
+.Pp
+The general command syntax is:
+.Ar command Ns Op Li / Ns Ar modifier
+.Ar address Ns Op Li , Ns Ar count
+.Pp
+A blank line repeats the previous command from the address
+.Va next
+with
+count 1 and no modifiers.
+Specifying
+.Ar address
+sets
+.Va dot
+to the address.
+Omitting
+.Ar address
+uses
+.Va dot .
+A missing
+.Ar count
+is taken
+to be 1 for printing commands or infinity for stack traces.
+.Pp
+The
+.Nm
+debugger has a pager feature (like the
+.Xr more 1
+command)
+for the output.
+If an output line exceeds the number set in the
+.Va lines
+variable, it displays
+.Dq Li --More--
+and waits for a response.
+The valid responses for it are:
+.Pp
+.Bl -tag -compact -width ".Li SPC"
+.It Li SPC
+one more page
+.It Li RET
+one more line
+.It Li q
+abort the current command, and return to the command input mode
+.El
+.Pp
+Finally,
+.Nm
+provides a small (currently 10 items) command history, and offers
+simple
+.Nm emacs Ns -style
+command line editing capabilities.
+In addition to
+the
+.Nm emacs
+control keys, the usual
+.Tn ANSI
+arrow keys may be used to
+browse through the history buffer, and move the cursor within the
+current line.
+.Sh COMMANDS
+.Bl -tag -width indent -compact
+.It Ic examine
+.It Ic x
+Display the addressed locations according to the formats in the modifier.
+Multiple modifier formats display multiple locations.
+If no format is specified, the last format specified for this command
+is used.
+.Pp
+The format characters are:
+.Bl -tag -compact -width indent
+.It Cm b
+look at by bytes (8 bits)
+.It Cm h
+look at by half words (16 bits)
+.It Cm l
+look at by long words (32 bits)
+.It Cm a
+print the location being displayed
+.It Cm A
+print the location with a line number if possible
+.It Cm x
+display in unsigned hex
+.It Cm z
+display in signed hex
+.It Cm o
+display in unsigned octal
+.It Cm d
+display in signed decimal
+.It Cm u
+display in unsigned decimal
+.It Cm r
+display in current radix, signed
+.It Cm c
+display low 8 bits as a character.
+Non-printing characters are displayed as an octal escape code (e.g.,
+.Ql \e000 ) .
+.It Cm s
+display the null-terminated string at the location.
+Non-printing characters are displayed as octal escapes.
+.It Cm m
+display in unsigned hex with character dump at the end of each line.
+The location is also displayed in hex at the beginning of each line.
+.It Cm i
+display as an instruction
+.It Cm I
+display as an instruction with possible alternate formats depending on the
+machine:
+.Bl -tag -width ".Tn powerpc" -compact
+.It Tn amd64
+No alternate format.
+.It Tn i386
+No alternate format.
+.It Tn ia64
+No alternate format.
+.It Tn powerpc
+No alternate format.
+.It Tn sparc64
+No alternate format.
+.El
+.It Cm S
+display a symbol name for the pointer stored at the address
+.El
+.Pp
+.It Ic xf
+Examine forward:
+execute an
+.Ic examine
+command with the last specified parameters to it
+except that the next address displayed by it is used as the start address.
+.Pp
+.It Ic xb
+Examine backward:
+execute an
+.Ic examine
+command with the last specified parameters to it
+except that the last start address subtracted by the size displayed by it
+is used as the start address.
+.Pp
+.It Ic print Ns Op Li / Ns Cm acdoruxz
+.It Ic p Ns Op Li / Ns Cm acdoruxz
+Print
+.Ar addr Ns s
+according to the modifier character (as described above for
+.Cm examine ) .
+Valid formats are:
+.Cm a , x , z , o , d , u , r ,
+and
+.Cm c .
+If no modifier is specified, the last one specified to it is used.
+The argument
+.Ar addr
+can be a string, in which case it is printed as it is.
+For example:
+.Bd -literal -offset indent
+print/x "eax = " $eax "\enecx = " $ecx "\en"
+.Ed
+.Pp
+will print like:
+.Bd -literal -offset indent
+eax = xxxxxx
+ecx = yyyyyy
+.Ed
+.Pp
+.It Xo
+.Ic write Ns Op Li / Ns Cm bhl
+.Ar addr expr1 Op Ar expr2 ...
+.Xc
+.It Xo
+.Ic w Ns Op Li / Ns Cm bhl
+.Ar addr expr1 Op Ar expr2 ...
+.Xc
+Write the expressions specified after
+.Ar addr
+on the command line at succeeding locations starting with
+.Ar addr .
+The write unit size can be specified in the modifier with a letter
+.Cm b
+(byte),
+.Cm h
+(half word) or
+.Cm l
+(long word) respectively.
+If omitted,
+long word is assumed.
+.Pp
+.Sy Warning :
+since there is no delimiter between expressions, strange
+things may happen.
+It is best to enclose each expression in parentheses.
+.Pp
+.It Ic set Li $ Ns Ar variable Oo Li = Oc Ar expr
+Set the named variable or register with the value of
+.Ar expr .
+Valid variable names are described below.
+.Pp
+.It Ic break Ns Op Li / Ns Cm u
+.It Ic b Ns Op Li / Ns Cm u
+Set a break point at
+.Ar addr .
+If
+.Ar count
+is supplied, continues
+.Ar count
+\- 1 times before stopping at the
+break point.
+If the break point is set, a break point number is
+printed with
+.Ql # .
+This number can be used in deleting the break point
+or adding conditions to it.
+.Pp
+If the
+.Cm u
+modifier is specified, this command sets a break point in user
+address space.
+Without the
+.Cm u
+option, the address is considered to be in the kernel
+space, and a wrong space address is rejected with an error message.
+This modifier can be used only if it is supported by machine dependent
+routines.
+.Pp
+.Sy Warning :
+If a user text is shadowed by a normal user space debugger,
+user space break points may not work correctly.
+Setting a break
+point at the low-level code paths may also cause strange behavior.
+.Pp
+.It Ic delete Ar addr
+.It Ic d Ar addr
+.It Ic delete Li # Ns Ar number
+.It Ic d Li # Ns Ar number
+Delete the break point.
+The target break point can be specified by a
+break point number with
+.Ql # ,
+or by using the same
+.Ar addr
+specified in the original
+.Ic break
+command.
+.Pp
+.It Ic watch Ar addr Ns Li , Ns Ar size
+Set a watchpoint for a region.
+Execution stops when an attempt to modify the region occurs.
+The
+.Ar size
+argument defaults to 4.
+If you specify a wrong space address, the request is rejected
+with an error message.
+.Pp
+.Sy Warning :
+Attempts to watch wired kernel memory
+may cause unrecoverable error in some systems such as i386.
+Watchpoints on user addresses work best.
+.Pp
+.It Ic hwatch Ar addr Ns Li , Ns Ar size
+Set a hardware watchpoint for a region if supported by the
+architecture.
+Execution stops when an attempt to modify the region occurs.
+The
+.Ar size
+argument defaults to 4.
+.Pp
+.Sy Warning :
+The hardware debug facilities do not have a concept of separate
+address spaces like the watch command does.
+Use
+.Ic hwatch
+for setting watchpoints on kernel address locations only, and avoid
+its use on user mode address spaces.
+.Pp
+.It Ic dhwatch Ar addr Ns Li , Ns Ar size
+Delete specified hardware watchpoint.
+.Pp
+.It Ic step Ns Op Li / Ns Cm p
+.It Ic s Ns Op Li / Ns Cm p
+Single step
+.Ar count
+times (the comma is a mandatory part of the syntax).
+If the
+.Cm p
+modifier is specified, print each instruction at each step.
+Otherwise, only print the last instruction.
+.Pp
+.Sy Warning :
+depending on machine type, it may not be possible to
+single-step through some low-level code paths or user space code.
+On machines with software-emulated single-stepping (e.g., pmax),
+stepping through code executed by interrupt handlers will probably
+do the wrong thing.
+.Pp
+.It Ic continue Ns Op Li / Ns Cm c
+.It Ic c Ns Op Li / Ns Cm c
+Continue execution until a breakpoint or watchpoint.
+If the
+.Cm c
+modifier is specified, count instructions while executing.
+Some machines (e.g., pmax) also count loads and stores.
+.Pp
+.Sy Warning :
+when counting, the debugger is really silently single-stepping.
+This means that single-stepping on low-level code may cause strange
+behavior.
+.Pp
+.It Ic until Ns Op Li / Ns Cm p
+Stop at the next call or return instruction.
+If the
+.Cm p
+modifier is specified, print the call nesting depth and the
+cumulative instruction count at each call or return.
+Otherwise,
+only print when the matching return is hit.
+.Pp
+.It Ic next Ns Op Li / Ns Cm p
+.It Ic match Ns Op Li / Ns Cm p
+Stop at the matching return instruction.
+If the
+.Cm p
+modifier is specified, print the call nesting depth and the
+cumulative instruction count at each call or return.
+Otherwise, only print when the matching return is hit.
+.Pp
+.It Xo
+.Ic trace Ns Op Li / Ns Cm u
+.Op Ar pid | tid
+.Op Li , Ns Ar count
+.Xc
+.It Xo
+.Ic t Ns Op Li / Ns Cm u
+.Op Ar pid | tid
+.Op Li , Ns Ar count
+.Xc
+.It Xo
+.Ic where Ns Op Li / Ns Cm u
+.Op Ar pid | tid
+.Op Li , Ns Ar count
+.Xc
+.It Xo
+.Ic bt Ns Op Li / Ns Cm u
+.Op Ar pid | tid
+.Op Li , Ns Ar count
+.Xc
+Stack trace.
+The
+.Cm u
+option traces user space; if omitted,
+.Ic trace
+only traces
+kernel space.
+The optional argument
+.Ar count
+is the number of frames to be traced.
+If
+.Ar count
+is omitted, all frames are printed.
+.Pp
+.Sy Warning :
+User space stack trace is valid
+only if the machine dependent code supports it.
+.Pp
+.It Xo
+.Ic search Ns Op Li / Ns Cm bhl
+.Ar addr
+.Ar value
+.Op Ar mask
+.Op Li , Ns Ar count
+.Xc
+Search memory for
+.Ar value .
+This command might fail in interesting
+ways if it does not find the searched-for value.
+This is because
+.Nm
+does not always recover from touching bad memory.
+The optional
+.Ar count
+argument limits the search.
+.\"
+.Pp
+.It Xo
+.Ic findstack
+.Ar addr
+.Xc
+Prints the thread address for a thread kernel-mode stack of which contains the
+specified address.
+If the thread is not found, search the thread stack cache and prints the
+cached stack address.
+Otherwise, prints nothing.
+.Pp
+.It Ic show Cm all procs Ns Op Li / Ns Cm m
+.It Ic ps Ns Op Li / Ns Cm m
+Display all process information.
+The process information may not be shown if it is not
+supported in the machine, or the bottom of the stack of the
+target process is not in the main memory at that time.
+The
+.Cm m
+modifier will alter the display to show VM map
+addresses for the process and not show other information.
+.\"
+.Pp
+.It Ic show Cm all ttys
+Show all TTY's within the system.
+Output is similar to
+.Xr pstat 8 ,
+but also includes the address of the TTY structure.
+.\"
+.Pp
+.It Ic show Cm allchains
+Show the same information like "show lockchain" does, but
+for every thread in the system.
+.\"
+.Pp
+.It Ic show Cm alllocks
+Show all locks that are currently held.
+This command is only available if
+.Xr witness 4
+is included in the kernel.
+.\"
+.Pp
+.It Ic show Cm allpcpu
+The same as "show pcpu", but for every CPU present in the system.
+.\"
+.Pp
+.It Ic show Cm allrman
+Show information related with resource management, including
+interrupt request lines, DMA request lines, I/O ports and I/O memory
+addresses.
+.\"
+.Pp
+.It Ic show Cm apic
+Dump data about APIC IDT vector mappings.
+.\"
+.Pp
+.It Ic show Cm breaks
+Show breakpoints set with the "break" command.
+.\"
+.Pp
+.It Ic show Cm buffer
+Show buffer structure of
+.Vt struct buf
+type.
+Such a structure is used within the
+.Fx
+kernel for the I/O subsystem
+implementation.
+For an exact interpretation of the output, please see the
+.Pa sys/buf.h
+header file.
+.\"
+.Pp
+.It Ic show Cm cbstat
+Show brief information about the TTY subsystem.
+.\"
+.Pp
+.It Ic show Cm cdev
+Without argument, show the list of all created cdev's, consisting of devfs
+node name and struct cdev address.
+When address of cdev is supplied, show some internal devfs state of the cdev.
+.\"
+.Pp
+.It Ic show Cm conifhk
+Lists hooks currently waiting for completion in
+run_interrupt_driven_config_hooks().
+.\"
+.Pp
+.It Ic show Cm cpusets
+Print numbered root and assigned CPU affinity sets.
+See
+.Xr cpuset 2
+for more details.
+.\"
+.Pp
+.It Ic show Cm cyrixreg
+Show registers specific to the Cyrix processor.
+.\"
+.Pp
+.It Ic show Cm domain Ar addr
+Print protocol domain structure
+.Vt struct domain
+at address
+.Ar addr .
+See the
+.Pa sys/domain.h
+header file for more details on the exact meaning of the structure fields.
+.\"
+.Pp
+.It Ic show Cm ffs Op Ar addr
+Show brief information about ffs mount at the address
+.Ar addr ,
+if argument is given.
+Otherwise, provides the summary about each ffs mount.
+.\"
+.Pp
+.It Ic show Cm file Ar addr
+Show information about the file structure
+.Vt struct file
+present at address
+.Ar addr .
+.\"
+.Pp
+.It Ic show Cm files
+Show information about every file structure in the system.
+.\"
+.Pp
+.It Ic show Cm freepages
+Show the number of physical pages in each of the free lists.
+.\"
+.Pp
+.It Ic show Cm geom Op Ar addr
+If the
+.Ar addr
+argument is not given, displays the entire GEOM topology.
+If
+.Ar addr
+is given, displays details about the given GEOM object (class, geom,
+provider or consumer).
+.\"
+.Pp
+.It Ic show Cm idt
+Show IDT layout.
+The first column specifies the IDT vector.
+The second one is the name of the interrupt/trap handler.
+Those functions are machine dependent.
+.\"
+.Pp
+.It Ic show Cm inodedeps Op Ar addr
+Show brief information about each inodedep structure.
+If
+.Ar addr
+is given, only inodedeps belonging to the fs located at the
+supplied address are shown.
+.\"
+.Pp
+.It Ic show Cm inpcb Ar addr
+Show information on IP Control Block
+.Vt struct in_pcb
+present at
+.Ar addr .
+.\"
+.Pp
+.It Ic show Cm intr
+Dump information about interrupt handlers.
+.\"
+.Pp
+.It Ic show Cm intrcnt
+Dump the interrupt statistics.
+.\"
+.Pp
+.It Ic show Cm irqs
+Show interrupt lines and their respective kernel threads.
+.\"
+.Pp
+.It Ic show Cm jails
+Show the list of
+.Xr jail 8
+instances.
+In addition to what
+.Xr jls 8
+shows, also list kernel internal details.
+.\"
+.Pp
+.It Ic show Cm lapic
+Show information from the local APIC registers for this CPU.
+.\"
+.Pp
+.It Ic show Cm lock Ar addr
+Show lock structure.
+The output format is as follows:
+.Bl -tag -width "flags"
+.It Ic class:
+Class of the lock.
+Possible types include
+.Xr mutex 9 ,
+.Xr rmlock 9 ,
+.Xr rwlock 9 ,
+.Xr sx 9 .
+.It Ic name:
+Name of the lock.
+.It Ic flags:
+Flags passed to the lock initialization function.
+For exact possibilities see manual pages of possible lock types.
+.It Ic state:
+Current state of a lock.
+As well as
+.Ic flags
+it's lock-specific.
+.It Ic owner:
+Lock owner.
+.El
+.\"
+.Pp
+.It Ic show Cm lockchain Ar addr
+Show all threads a particular thread at address
+.Ar addr
+is waiting on based on non-sleepable and non-spin locks.
+.\"
+.Pp
+.It Ic show Cm lockedbufs
+Show the same information as "show buf", but for every locked
+.Vt struct buf
+object.
+.\"
+.Pp
+.It Ic show Cm lockedvnods
+List all locked vnodes in the system.
+.\"
+.Pp
+.It Ic show Cm locks
+Prints all locks that are currently acquired.
+This command is only available if
+.Xr witness 4
+is included in the kernel.
+.\"
+.Pp
+.It Ic show Cm locktree
+.\"
+.Pp
+.It Ic show Cm malloc
+Prints
+.Xr malloc 9
+memory allocator statistics.
+The output format is as follows:
+.Pp
+.Bl -tag -compact -offset indent -width "Requests"
+.It Ic Type
+Specifies a type of memory.
+It is the same as a description string used while defining the
+given memory type with
+.Xr MALLOC_DECLARE 9 .
+.It Ic InUse
+Number of memory allocations of the given type, for which
+.Xr free 9
+has not been called yet.
+.It Ic MemUse
+Total memory consumed by the given allocation type.
+.It Ic Requests
+Number of memory allocation requests for the given
+memory type.
+.El
+.Pp
+The same information can be gathered in userspace with
+.Dq Nm vmstat Fl m .
+.\"
+.Pp
+.It Ic show Cm map Ns Oo Li / Ns Cm f Oc Ar addr
+Prints the VM map at
+.Ar addr .
+If the
+.Cm f
+modifier is specified the
+complete map is printed.
+.\"
+.Pp
+.It Ic show Cm msgbuf
+Print the system's message buffer.
+It is the same output as in the
+.Dq Nm dmesg
+case.
+It is useful if you got a kernel panic, attached a serial cable
+to the machine and want to get the boot messages from before the
+system hang.
+.\"
+.It Ic show Cm mount
+Displays short info about all currently mounted file systems.
+.Pp
+.It Ic show Cm mount Ar addr
+Displays details about the given mount point.
+.\"
+.Pp
+.It Ic show Cm object Ns Oo Li / Ns Cm f Oc Ar addr
+Prints the VM object at
+.Ar addr .
+If the
+.Cm f
+option is specified the
+complete object is printed.
+.\"
+.Pp
+.It Ic show Cm page
+Show statistics on VM pages.
+.\"
+.Pp
+.It Ic show Cm pageq
+Show statistics on VM page queues.
+.\"
+.Pp
+.It Ic show Cm pciregs
+Print PCI bus registers.
+The same information can be gathered in userspace by running
+.Dq Nm pciconf Fl lv .
+.\"
+.Pp
+.It Ic show Cm pcpu
+Print current processor state.
+The output format is as follows:
+.Pp
+.Bl -tag -compact -offset indent -width "spin locks held:"
+.It Ic cpuid
+Processor identifier.
+.It Ic curthread
+Thread pointer, process identifier and the name of the process.
+.It Ic curpcb
+Control block pointer.
+.It Ic fpcurthread
+FPU thread pointer.
+.It Ic idlethread
+Idle thread pointer.
+.It Ic APIC ID
+CPU identifier coming from APIC.
+.It Ic currentldt
+LDT pointer.
+.It Ic spin locks held
+Names of spin locks held.
+.El
+.\"
+.Pp
+.It Ic show Cm pgrpdump
+Dump process groups present within the system.
+.\"
+.Pp
+.It Ic show Cm proc Op Ar addr
+If no
+.Op Ar addr
+is specified, print information about the current process.
+Otherwise, show information about the process at address
+.Ar addr .
+.\"
+.Pp
+.It Ic show Cm procvm
+Show process virtual memory layout.
+.\"
+.Pp
+.It Ic show Cm protosw Ar addr
+Print protocol switch structure
+.Vt struct protosw
+at address
+.Ar addr .
+.\"
+.Pp
+.It Ic show Cm registers Ns Op Li / Ns Cm u
+Display the register set.
+If the
+.Cm u
+modifier is specified, it displays user registers instead of
+kernel registers or the currently saved one.
+.Pp
+.Sy Warning :
+The support of the
+.Cm u
+modifier depends on the machine.
+If not supported, incorrect information will be displayed.
+.\"
+.Pp
+.It Ic show Cm rman Ar addr
+Show resource manager object
+.Vt struct rman
+at address
+.Ar addr .
+Addresses of particular pointers can be gathered with "show allrman"
+command.
+.\"
+.Pp
+.It Ic show Cm rtc
+Show real time clock value.
+Useful for long debugging sessions.
+.\"
+.Pp
+.It Ic show Cm sleepchain
+Show all the threads a particular thread is waiting on based on
+sleepable locks.
+.\"
+.Pp
+.It Ic show Cm sleepq
+.It Ic show Cm sleepqueue
+Both commands provide the same functionality.
+They show sleepqueue
+.Vt struct sleepqueue
+structure.
+Sleepqueues are used within the
+.Fx
+kernel to implement sleepable
+synchronization primitives (thread holding a lock might sleep or
+be context switched), which at the time of writing are:
+.Xr condvar 9 ,
+.Xr sx 9
+and standard
+.Xr msleep 9
+interface.
+.\"
+.Pp
+.It Ic show Cm sockbuf Ar addr
+.It Ic show Cm socket Ar addr
+Those commands print
+.Vt struct sockbuf
+and
+.Vt struct socket
+objects placed at
+.Ar addr .
+Output consists of all values present in structures mentioned.
+For exact interpretation and more details, visit
+.Pa sys/socket.h
+header file.
+.\"
+.Pp
+.It Ic show Cm sysregs
+Show system registers (e.g.,
+.Li cr0-4
+on i386.)
+Not present on some platforms.
+.\"
+.Pp
+.It Ic show Cm tcpcb Ar addr
+Print TCP control block
+.Vt struct tcpcb
+lying at address
+.Ar addr .
+For exact interpretation of output, visit
+.Pa netinet/tcp.h
+header file.
+.\"
+.Pp
+.It Ic show Cm thread Op Ar addr
+If no
+.Ar addr
+is specified, show detailed information about current thread.
+Otherwise, information about thread at
+.Ar addr
+is printed.
+.\"
+.Pp
+.It Ic show Cm threads
+Show all threads within the system.
+Output format is as follows:
+.Pp
+.Bl -tag -compact -offset indent -width "Second column"
+.It Ic First column
+Thread identifier (TID)
+.It Ic Second column
+Thread structure address
+.It Ic Third column
+Backtrace.
+.El
+.\"
+.Pp
+.It Ic show Cm tty Ar addr
+Display the contents of a TTY structure in a readable form.
+.\"
+.Pp
+.It Ic show Cm turnstile Ar addr
+Show turnstile
+.Vt struct turnstile
+structure at address
+.Ar addr .
+Turnstiles are structures used within the
+.Fx
+kernel to implement
+synchronization primitives which, while holding a specific type of lock, cannot
+sleep or context switch to another thread.
+Currently, those are:
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr rmlock 9 .
+.\"
+.Pp
+.It Ic show Cm uma
+Show UMA allocator statistics.
+Output consists five columns:
+.Pp
+.Bl -tag -compact -offset indent -width "Requests"
+.It Cm "Zone"
+Name of the UMA zone.
+The same string that was passed to
+.Xr uma_zcreate 9
+as a first argument.
+.It Cm "Size"
+Size of a given memory object (slab).
+.It Cm "Used"
+Number of slabs being currently used.
+.It Cm "Free"
+Number of free slabs within the UMA zone.
+.It Cm "Requests"
+Number of allocations requests to the given zone.
+.El
+.Pp
+The very same information might be gathered in the userspace
+with the help of
+.Dq Nm vmstat Fl z
+.\"
+.Pp
+.It Ic show Cm unpcb Ar addr
+Shows UNIX domain socket private control block
+.Vt struct unpcb
+present at the address
+.Ar addr
+.\"
+.Pp
+.It Ic show Cm vmochk
+Prints, whether the internal VM objects are in a map somewhere
+and none have zero ref counts.
+.\"
+.Pp
+.It Ic show Cm vmopag
+This is supposed to show physical addresses consumed by a
+VM object.
+Currently, it is not possible to use this command when
+.Xr witness 4
+is compiled in the kernel.
+.\"
+.Pp
+.It Ic show Cm vnode Op Ar addr
+Prints vnode
+.Vt struct vnode
+structure lying at
+.Op Ar addr .
+For the exact interpretation of the output, look at the
+.Pa sys/vnode.h
+header file.
+.\"
+.Pp
+.It Ic show Cm vnodebufs Ar addr
+Shows clean/dirty buffer lists of the vnode located at
+.Ar addr .
+.\"
+.Pp
+.It Ic show Cm watches
+Displays all watchpoints.
+Shows watchpoints set with "watch" command.
+.\"
+.Pp
+.It Ic show Cm witness
+Shows information about lock acquisition coming from the
+.Xr witness 4
+subsystem.
+.\"
+.Pp
+.It Ic gdb
+Toggles between remote GDB and DDB mode.
+In remote GDB mode, another machine is required that runs
+.Xr gdb 1
+using the remote debug feature, with a connection to the serial
+console port on the target machine.
+Currently only available on the
+i386
+architecture.
+.Pp
+.It Ic halt
+Halt the system.
+.Pp
+.It Ic kill Ar sig pid
+Send signal
+.Ar sig
+to process
+.Ar pid .
+The signal is acted on upon returning from the debugger.
+This command can be used to kill a process causing resource contention
+in the case of a hung system.
+See
+.Xr signal 3
+for a list of signals.
+Note that the arguments are reversed relative to
+.Xr kill 2 .
+.Pp
+.It Ic reboot Op Ar seconds
+.It Ic reset Op Ar seconds
+Hard reset the system.
+If the optional argument
+.Ar seconds
+is given, the debugger will wait for this long, at most a week,
+before rebooting.
+.Pp
+.It Ic help
+Print a short summary of the available commands and command
+abbreviations.
+.Pp
+.It Ic capture on
+.It Ic capture off
+.It Ic capture reset
+.It Ic capture status
+.Nm
+supports a basic output capture facility, which can be used to retrieve the
+results of debugging commands from userpsace using
+.Xr sysctl 2 .
+.Ic capture on
+enables output capture;
+.Ic capture off
+disables capture.
+.Ic capture reset
+will clear the capture buffer and disable capture.
+.Ic capture status
+will report current buffer use, buffer size, and disposition of output
+capture.
+.Pp
+Userspace processes may inspect and manage
+.Nm
+capture state using
+.Xr sysctl 8 :
+.Pp
+.Dv debug.ddb.capture.bufsize
+may be used to query or set the current capture buffer size.
+.Pp
+.Dv debug.ddb.capture.maxbufsize
+may be used to query the compile-time limit on the capture buffer size.
+.Pp
+.Dv debug.ddb.capture.bytes
+may be used to query the number of bytes of output currently in the capture
+buffer.
+.Pp
+.Dv debug.ddb.capture.data
+returns the contents of the buffer as a string to an appropriately privileged
+process.
+.Pp
+This facility is particularly useful in concert with the scripting and
+.Xr textdump 4
+facilities, allowing scripted debugging output to be captured and
+committed to disk as part of a textdump for later analysis.
+The contents of the capture buffer may also be inspected in a kernel core dump
+using
+.Xr kgdb 1 .
+.Pp
+.It Ic run
+.It Ic script
+.It Ic scripts
+.It Ic unscript
+Run, define, list, and delete scripts.
+See the
+.Sx SCRIPTING
+section for more information on the scripting facility.
+.Pp
+.It Ic textdump set
+.It Ic textdump status
+.It Ic textdump unset
+The
+.Ic textdump set
+command may be used to force the next kernel core dump to be a textdump
+rather than a traditional memory dump or minidump.
+.Ic textdump status
+reports whether a textdump has been scheduled.
+.Ic textdump unset
+cancels a request to perform a textdump as the next kernel core dump.
+More information may be found in
+.Xr textdump 4 .
+.El
+.Sh VARIABLES
+The debugger accesses registers and variables as
+.Li $ Ns Ar name .
+Register names are as in the
+.Dq Ic show Cm registers
+command.
+Some variables are suffixed with numbers, and may have some modifier
+following a colon immediately after the variable name.
+For example, register variables can have a
+.Cm u
+modifier to indicate user register (e.g.,
+.Dq Li $eax:u ) .
+.Pp
+Built-in variables currently supported are:
+.Pp
+.Bl -tag -width ".Va tabstops" -compact
+.It Va radix
+Input and output radix.
+.It Va maxoff
+Addresses are printed as
+.Dq Ar symbol Ns Li + Ns Ar offset
+unless
+.Ar offset
+is greater than
+.Va maxoff .
+.It Va maxwidth
+The width of the displayed line.
+.It Va lines
+The number of lines.
+It is used by the built-in pager.
+.It Va tabstops
+Tab stop width.
+.It Va work Ns Ar xx
+Work variable;
+.Ar xx
+can take values from 0 to 31.
+.El
+.Sh EXPRESSIONS
+Most expression operators in C are supported except
+.Ql ~ ,
+.Ql ^ ,
+and unary
+.Ql & .
+Special rules in
+.Nm
+are:
+.Bl -tag -width ".No Identifiers"
+.It Identifiers
+The name of a symbol is translated to the value of the symbol, which
+is the address of the corresponding object.
+.Ql \&.
+and
+.Ql \&:
+can be used in the identifier.
+If supported by an object format dependent routine,
+.Sm off
+.Oo Ar filename : Oc Ar func : lineno ,
+.Sm on
+.Oo Ar filename : Oc Ns Ar variable ,
+and
+.Oo Ar filename : Oc Ns Ar lineno
+can be accepted as a symbol.
+.It Numbers
+Radix is determined by the first two letters:
+.Ql 0x :
+hex,
+.Ql 0o :
+octal,
+.Ql 0t :
+decimal; otherwise, follow current radix.
+.It Li \&.
+.Va dot
+.It Li +
+.Va next
+.It Li ..
+address of the start of the last line examined.
+Unlike
+.Va dot
+or
+.Va next ,
+this is only changed by
+.Ic examine
+or
+.Ic write
+command.
+.It Li '
+last address explicitly specified.
+.It Li $ Ns Ar variable
+Translated to the value of the specified variable.
+It may be followed by a
+.Ql \&:
+and modifiers as described above.
+.It Ar a Ns Li # Ns Ar b
+A binary operator which rounds up the left hand side to the next
+multiple of right hand side.
+.It Li * Ns Ar expr
+Indirection.
+It may be followed by a
+.Ql \&:
+and modifiers as described above.
+.El
+.Sh SCRIPTING
+.Nm
+supports a basic scripting facility to allow automating tasks or responses to
+specific events.
+Each script consists of a list of DDB commands to be executed sequentially,
+and is assigned a unique name.
+Certain script names have special meaning, and will be automatically run on
+various
+.Nm
+events if scripts by those names have been defined.
+.Pp
+The
+.Ic script
+command may be used to define a script by name.
+Scripts consist of a series of
+.Nm
+commands separated with the
+.Ic ;
+character.
+For example:
+.Bd -literal -offset indent
+script kdb.enter.panic=bt; show pcpu
+script lockinfo=show alllocks; show lockedvnods
+.Ed
+.Pp
+The
+.Ic scripts
+command lists currently defined scripts.
+.Pp
+The
+.Ic run
+command execute a script by name.
+For example:
+.Bd -literal -offset indent
+run lockinfo
+.Ed
+.Pp
+The
+.Ic unscript
+command may be used to delete a script by name.
+For example:
+.Bd -literal -offset indent
+unscript kdb.enter.panic
+.Ed
+.Pp
+These functions may also be performed from userspace using the
+.Xr ddb 8
+command.
+.Pp
+Certain scripts are run automatically, if defined, for specific
+.Nm
+events.
+The follow scripts are run when various events occur:
+.Bl -tag -width kdb.enter.powerfail
+.It Dv kdb.enter.acpi
+The kernel debugger was entered as a result of an
+.Xr acpi 4
+event.
+.It Dv kdb.enter.bootflags
+The kernel debugger was entered at boot as a result of the debugger boot
+flag being set.
+.It Dv kdb.enter.break
+The kernel debugger was entered as a result of a serial or console break.
+.It Dv kdb.enter.cam
+The kernel debugger was entered as a result of a
+.Xr CAM 4
+event.
+.It Dv kdb.enter.mac
+The kernel debugger was entered as a result of an assertion failure in the
+.Xr mac_test 4
+module of the
+TrustedBSD MAC Framework.
+.It Dv kdb.enter.ndis
+The kernel debugger was entered as a result of an
+.Xr ndis 4
+breakpoint event.
+.It Dv kdb.enter.netgraph
+The kernel debugger was entered as a result of a
+.Xr netgraph 4
+event.
+.It Dv kdb.enter.panic
+.Xr panic 9
+was called.
+.It Dv kdb.enter.powerfail
+The kernel debugger was entered as a result of a powerfail NMI on the sparc64
+platform.
+.It Dv kdb.enter.powerpc
+The kernel debugger was entered as a result of an unimplemented interrupt
+type on the powerpc platform.
+.It Dv kdb.enter.sysctl
+The kernel debugger was entered as a result of the
+.Dv debug.kdb.enter
+sysctl being set.
+.It Dv kdb.enter.trapsig
+The kernel debugger was entered as a result of a trapsig event on the sparc64
+platform.
+.It Dv kdb.enter.unionfs
+The kernel debugger was entered as a result of an assertion failure in the
+union file system.
+.It Dv kdb.enter.unknown
+The kernel debugger was entered, but no reason has been set.
+.It Dv kdb.enter.vfslock
+The kernel debugger was entered as a result of a VFS lock violation.
+.It Dv kdb.enter.watchdog
+The kernel debugger was entered as a result of a watchdog firing.
+.It Dv kdb.enter.witness
+The kernel debugger was entered as a result of a
+.Xr witness 4
+violation.
+.El
+.Pp
+In the event that none of these scripts is found,
+.Nm
+will attempt to execute a default script:
+.Bl -tag -width kdb.enter.powerfail
+.It Dv kdb.enter.default
+The kernel debugger was entered, but a script exactly matching the reason for
+entering was not defined.
+This can be used as a catch-all to handle cases not specifically of interest;
+for example,
+.Dv kdb.enter.witness
+might be defined to have special handling, and
+.Dv kdb.enter.default
+might be defined to simply panic and reboot.
+.El
+.Sh HINTS
+On machines with an ISA expansion bus, a simple NMI generation card can be
+constructed by connecting a push button between the A01 and B01 (CHCHK# and
+GND) card fingers.
+Momentarily shorting these two fingers together may cause the bridge chipset to
+generate an NMI, which causes the kernel to pass control to
+.Nm .
+Some bridge chipsets do not generate a NMI on CHCHK#, so your mileage may vary.
+The NMI allows one to break into the debugger on a wedged machine to
+diagnose problems.
+Other bus' bridge chipsets may be able to generate NMI using bus specific
+methods.
+.Sh FILES
+Header files mention in this manual page can be found below
+.Pa /usr/include
+directory.
+.Pp
+.Bl -dash -compact
+.It
+.Pa sys/buf.h
+.It
+.Pa sys/domain.h
+.It
+.Pa netinet/in_pcb.h
+.It
+.Pa sys/socket.h
+.It
+.Pa sys/vnode.h
+.El
+.Sh SEE ALSO
+.Xr gdb 1 ,
+.Xr kgdb 1 ,
+.Xr acpi 4 ,
+.Xr CAM 4 ,
+.Xr mac_test 4 ,
+.Xr ndis 4 ,
+.Xr netgraph 4 ,
+.Xr textdump 4 ,
+.Xr witness 4 ,
+.Xr ddb 8 ,
+.Xr sysctl 8 ,
+.Xr panic 9
+.Sh HISTORY
+The
+.Nm
+debugger was developed for Mach, and ported to
+.Bx 386 0.1 .
+This manual page translated from
+.Xr man 7
+macros by
+.An Garrett Wollman .
+.Pp
+.An Robert N. M. Watson
+added support for
+.Nm
+output capture,
+.Xr textdump 4
+and scripting in
+.Fx 7.1 .
diff --git a/share/man/man4/de.4 b/share/man/man4/de.4
new file mode 100644
index 000000000000..c9f25ad31b89
--- /dev/null
+++ b/share/man/man4/de.4
@@ -0,0 +1,149 @@
+.\"
+.\" Copyright (c) 1997 David E. O'Brien
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt DE 4
+.Os
+.Sh NAME
+.Nm de
+.Nd "DEC DC21x4x Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device de"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_de_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Ethernet adapters based on the Digital
+Equipment DC21x4x based self-contained Ethernet and Fast Ethernet
+chips.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options
+.It 10baseT/UTP
+Set 10Mbps operation on the 10baseT port
+.It 10base2/BNC
+Set 10Mbps operation on the BNC port
+.It 10base5/AUI
+Set 10Mbps operation on the AUI port
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation
+.It 100baseFX
+Set 100Mbps operation
+.It 100baseT4
+Set 100Mbps operation (4-pair cat-3 cable)
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxx
+.It full-duplex
+Set full duplex operation
+.El
+.Pp
+Note that the media types available depend on the particular card in use.
+Some cards are explicitly programmed to a particular media type by a
+setup utility and are not changeable.
+.Pp
+Use the
+.Xr ifconfig 8
+command and in particular the
+.Fl m
+flag to list the supported media types for your particular card.
+.Pp
+The old
+.Dq ifconfig linkN
+method of configuration is not supported.
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec ANA-6944/TX
+.It
+Cogent EM100FX and EM440TX
+.It
+Corega FastEther PCI-TX
+.It
+D-Link DFE-500TX
+.It
+DEC DE435, DEC DE450, and DEC DE500
+.It
+ELECOM LD-PCI2T, LD-PCITS
+.It
+I-O DATA LA2/T-PCI
+.It
+SMC Etherpower 8432, 9332 and 9334
+.It
+ZNYX ZX3xx
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "de%d: waking device from sleep/snooze mode"
+The 21041 and 21140A chips support suspending the operation of the card.
+.It "de%d: error: desired IRQ of %d does not match device's actual IRQ of %d"
+The device probe detected that the board is configured for a different
+interrupt than the one specified in the kernel configuration file.
+.It "de%d: not configured; limit of %d reached or exceeded"
+There is a limit of 32
+.Nm
+devices allowed in a single machine.
+.It "de%d: not configured; 21040 pass 2.0 required (%d.%d found)"
+.It "de%d: not configured; 21140 pass 1.1 required (%d.%d found)"
+Certain revisions of the chipset are not supported by this driver.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Matt Thomas .
+This manual page was written by
+.An David E. O'Brien .
diff --git a/share/man/man4/devctl.4 b/share/man/man4/devctl.4
new file mode 100644
index 000000000000..50afee70442e
--- /dev/null
+++ b/share/man/man4/devctl.4
@@ -0,0 +1,128 @@
+.\"
+.\" Copyright (c) 2002 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 11, 2003
+.Dt DEVCTL 4
+.Os
+.Sh NAME
+.Nm devctl
+.Nd "device event reporting and device control interface"
+.Sh DESCRIPTION
+The
+.Nm
+device is used to report device events from the kernel.
+Future versions will allow for some device control as well.
+.Sh IMPLEMENTATION NOTES
+This design allows only one reader for
+.Pa /dev/devctl .
+This is not desirable
+in the long run, but will get a lot of hair out of this implementation.
+Maybe we should make this device a clonable device.
+.Pp
+Also note: we specifically do not attach a device to the
+.Vt device_t
+tree
+to avoid potential chicken and egg problems.
+One could argue that all of this belongs to the root node.
+One could also further argue that the
+.Xr sysctl 3
+interface that we have now might more properly be an
+.Xr ioctl 2
+interface.
+.Pp
+.Dv SIGIO
+support is included in the driver.
+However, the author is not sure that the
+.Dv SIGIO
+support is done correctly.
+It was copied from a driver that had
+.Dv SIGIO
+support that likely has not been
+tested since
+.Fx 3.4
+or
+.Fx 2.2.8 !
+.Pp
+The read channel for this device is used to report changes to
+userland in realtime.
+We return one record at a time.
+If you try to read this device a character at a time, you will lose
+the rest of the data.
+Listening programs are expected to cope.
+.Pp
+The sysctl and boot parameter
+.Va hw.bus.devctl_disable
+is used to disable
+.Nm
+when no
+.Xr devd 8
+is running.
+.Sh PROTOCOL
+The
+.Nm
+device
+uses an
+.Tn ASCII
+protocol.
+The driver returns one record at a time to its readers.
+Each record is terminated with a newline.
+The first character of the record is the event type.
+.Pp
+.Bl -column -compact "Type" "Description"
+.Em "Type Description"
+! A notify event, such as a link state change.
++ Device node in tree attached.
+- Device node in tree detached.
+? Unknown device detected.
+.El
+.Ss Message Formats
+Except for the first character in the record, attach and detach
+messages have the same format.
+.Pp
+.D1 Ar T Ns Ar dev Li at Ar parent Li on Ar location
+.Pp
+.Bl -column -compact "location" "Description"
+.Em "Part Description"
+.It Ar T Ta "+ or -"
+.It Ar dev Ta "The device name that was attached/detached."
+.It Ar parent Ta "The device name of the parent bus that attached the device."
+.It Ar location Ta "Bus specific location information."
+.El
+.Pp
+The nomatch messages can be used to load devices driver.
+If you load a device driver, then one of two things can happen.
+If the device driver attaches to something, you will get a device
+attached message.
+If it does not, then nothing will happen.
+.Pp
+The attach and detach messages arrive after the event.
+This means one cannot use the attach message to load an alternate
+driver.
+The attach message driver has already claimed this device.
+One cannot use the detach messages to flush data to the device.
+The device is already gone.
+.Sh SEE ALSO
+.Xr devd 8
diff --git a/share/man/man4/digi.4 b/share/man/man4/digi.4
new file mode 100644
index 000000000000..f84ac78e0adb
--- /dev/null
+++ b/share/man/man4/digi.4
@@ -0,0 +1,381 @@
+.\" Copyright (c) 1990, 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Systems Programming Group of the University of Utah Computer
+.\" Science Department.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
+.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
+.\" from: sio.4,v 1.15 1994/12/06 20:14:30 bde Exp
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2003
+.Dt DIGI 4
+.Os
+.Sh NAME
+.Nm digi
+.Nd DigiBoard intelligent serial cards driver
+.Sh SYNOPSIS
+.Cd "device digi"
+.Pp
+This man page was originally written for the dgb driver, and should
+likely be gone over with a fine tooth comb to reflect differences
+with the digi driver.
+.Pp
+When not defined the number is computed:
+.Bd -ragged -offset 4n
+default
+.Dv NDGBPORTS
+= number_of_described_DigiBoard_cards * 16
+.Ed
+.Pp
+If it is less than the actual number of ports
+the system will be able to use only the
+first
+.Dv NDGBPORTS
+ports.
+If it is greater then all ports will be usable
+but some memory will be wasted.
+.Pp
+Meaning of
+.Cm flags :
+.Bl -tag -width indent -compact
+.It 0x0001
+use alternate pinout (exchange DCD and DSR lines)
+.It 0x0002
+do not use 8K window mode of PC/Xe
+.El
+.Pp
+Device numbering:
+.Bd -literal -compact
+0b\fICC\fPmmmmmmmm\fIOLIPPPPP\fP
+ \fBCC\fPard number
+ \fRmmmmmmmm\fPajor number
+ call\fBO\fPut
+ \fBL\fPock
+ \fBI\fPnitial
+ \fBPPPPP\fPort number
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for DigiBoard PC/Xe and PC/Xi series intelligent
+serial multiport cards with asynchronous interfaces based on the
+.Tn EIA
+.Tn RS-232C
+.Pf ( Tn CCITT
+.Tn V.24 )
+standard.
+.Pp
+Input and output for each line may set to one of following baud rates;
+50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
+19200, 38400, 57600, or for newer versions of cards 115200.
+.Pp
+The driver does not use any interrupts, it is
+.Dq polling-based .
+This means that
+it uses clock interrupts instead of interrupts generated by DigiBoard cards and
+checks the state of cards 25 times per second.
+This is practical because the
+DigiBoard cards have large input and output buffers (more than 1Kbyte per
+port) and hardware that allows efficiently finding the port that needs
+attention.
+The only problem seen with this policy is slower
+SLIP and PPP response.
+.Pp
+Each line in the kernel configuration file describes one card, not one port
+as in the
+.Xr sio 4
+driver.
+.Pp
+The
+.Cm flags
+keyword may be used on each
+.Dq Li "device dgb"
+line in the kernel configuration file
+to change the pinout of the interface or to use new PC/Xe cards
+which can work with an 8K memory window in compatibility mode
+(with a 64K memory window).
+Note
+that using 8K memory window does not mean shorter input/output buffers, it means
+only that all buffers will be mapped to the same memory address and switched as
+needed.
+.Pp
+The
+.Cm port
+value must be the same
+as the
+port
+set on the card by jumpers.
+For PC/Xi cards the same rule is applicable to the
+.Cm iomem
+value.
+It must be the same as the memory address set on the card
+by jumpers.
+.\"Some documentation gives the address as a ``paragraph'' or ``segment'';
+.\"you can get the value of address by adding the digit "0" at end of
+.\"paragraph value, e.g., 0xfc000 -> 0xfc0000.
+For PC/Xe cards there is no need to use jumpers for this purpose.
+In fact there are no jumpers to do it.
+Just
+write the address you want as the
+.Cm iomem
+value in kernel config file and the card will be programmed
+to use this address.
+.Pp
+The same range of memory addresses may be used
+for all the DigiBoards installed
+(but not for any other card or real memory).
+DigiBoards
+with a large amount of memory (256K or 512K and perhaps
+even 128K) must be mapped
+to memory addresses outside of the first megabyte.
+If the computer
+has more than 15 megabytes of memory then there is no free address space
+outside of the first megabyte where such DigiBoards can be mapped.
+In this case you
+may need to reduce the amount of memory in the computer.
+But many machines provide a better solution.
+They have the ability to
+.Dq "turn off"
+the memory in the 16th megabyte (addresses 0xF00000 - 0xFFFFFF)
+using the
+BIOS setup.
+Then the DigiBoard's address space can be set to this
+.Dq hole .
+.\" XXX the following should be true for all serial drivers and
+.\" should not be repeated in the man pages for all serial drivers.
+.\" It was copied from sio.4. The only changes were s/sio/dgb/g.
+.Pp
+Serial ports controlled by the
+.Nm
+driver can be used for both
+.Dq callin
+and
+.Dq callout .
+For each port there is a callin device and a callout device.
+The minor number of the callout device is 128 higher
+than that of the corresponding callin port.
+The callin device is general purpose.
+Processes opening it normally wait for carrier
+and for the callout device to become inactive.
+The callout device is used to steal the port from
+processes waiting for carrier on the callin device.
+Processes opening it do not wait for carrier
+and put any processes waiting for carrier on the callin device into
+a deeper sleep so that they do not conflict with the callout session.
+The callout device is abused for handling programs that are supposed
+to work on general ports and need to open the port without waiting
+but are too stupid to do so.
+.Pp
+The
+.Nm
+driver also supports an initial-state and a lock-state control
+device for each of the callin and the callout
+.Dq data
+devices.
+The minor number of the initial-state device is 32 higher
+than that of the corresponding data device.
+The minor number of the lock-state device is 64 higher
+than that of the corresponding data device.
+The termios settings of a data device are copied
+from those of the corresponding initial-state device
+on first opens and are not inherited from previous opens.
+Use
+.Xr stty 1
+in the normal way on the initial-state devices to program
+initial termios states suitable for your setup.
+.Pp
+The lock termios state acts as flags to disable changing
+the termios state.
+E.g., to lock a flag variable such as
+.Dv CRTSCTS ,
+use
+.Dq Li "stty crtscts"
+on the lock-state device.
+Speeds and special characters
+may be locked by setting the corresponding value in the lock-state
+device to any nonzero value.
+.Pp
+Correct programs talking to correctly wired external devices
+.\" XXX change next line in other man pages too, and rewrite this paragraph.
+work with almost arbitrary initial states and no locking,
+but other setups may benefit from changing some of the default
+initial state and locking the state.
+In particular, the initial states for non (POSIX) standard flags
+should be set to suit the devices attached and may need to be
+locked to prevent buggy programs from changing them.
+E.g.,
+.Dv CRTSCTS
+should be locked on for devices that support
+RTS/CTS handshaking at all times and off for devices that do not
+support it at all.
+.Dv CLOCAL
+should be locked on for devices
+that do not support carrier.
+.Dv HUPCL
+may be locked off if you do not
+want to hang up for some reason.
+In general, very bad things happen
+if something is locked to the wrong state, and things should not
+be locked for devices that support more than one setting.
+The
+.Dv CLOCAL
+flag on callin ports should be locked off for logins
+to avoid certain security holes, but this needs to be done by
+getty if the callin port is used for anything else.
+.Sh FILES
+.Bl -tag -width /dev/ttyiD?? -compact
+.It Pa /dev/ttyD??
+for callin ports
+.It Pa /dev/ttyiD??
+.It Pa /dev/ttylD??
+corresponding callin initial-state and lock-state devices
+.Pp
+.It Pa /dev/cuaD??
+for callout ports
+.It Pa /dev/cuaiD??
+.It Pa /dev/cualD??
+corresponding callout initial-state and lock-state devices
+.El
+.Pp
+.Bl -tag -width /etc/rc.serial -compact
+.It Pa /etc/rc.serial
+examples of setting the initial-state and lock-state devices
+.El
+.Pp
+The first question mark in these device names is short for the
+card number
+(a decimal number between 0 and 65535 inclusive).
+The second question mark is short for the port number
+(a letter in the range [0-9a-v]).
+.Sh DIAGNOSTICS
+You may enable extended diagnostics by defining DEBUG at the
+start of the source file
+.Pa dgb.c .
+.Bl -diag
+.It dgb\fIX\fP: warning: address \fIN\fP truncated to \fIM\fP
+The memory address for the PC/Xe's 8K window is misaligned (it should be
+on an 8K boundary) or outside of the first megabyte.
+.It dgb\fIX\fP: 1st reset failed
+Problems with accessing I/O port of the card, probably
+the wrong
+.Cm port
+value is specified in the kernel config file.
+.It dgb\fIX\fP: 2nd reset failed
+Problems with hardware.
+.It dgb\fIX\fP: \fIN\fP[st,nd,rd,th] memory test failed
+Problems with accessing the memory of the card, probably
+the wrong
+.Cm iomem
+value is specified in the kernel config file.
+.It dgb\fIX\fP: BIOS start failed
+Problems with starting the on-board BIOS.
+Probably the memory addresses of the
+DigiBoard overlap with some other device or with RAM.
+.It dgb\fIX\fP: BIOS download failed
+Problems with the on-board BIOS.
+Probably the memory addresses of the
+DigiBoard overlap with some other device or with RAM.
+.It dgb\fIX\fP: FEP code download failed
+Problems with downloading of the Front-End Processor's micro-OS.
+Probably the memory addresses of the
+DigiBoard overlap with some other device or with RAM.
+.It dgb\fIX\fP: FEP/OS start failed
+Problems with starting of the Front-End Processor's micro-OS.
+Probably the memory addresses of the
+DigiBoard overlap with some other device or with RAM.
+.It dgb\fIX\fP: too many ports
+This DigiBoard reports that it has more than 32 ports.
+Perhaps a hardware problem or
+the memory addresses of the
+DigiBoard overlap with some other device or with RAM.
+.It dgb\fIX\fP: only \fIN\fP ports are usable
+The
+.Dv NDGBPORTS
+parameter is too small and there is only enough space allocated
+for
+.Ar N
+ports on this card.
+.It dgb\fIX\fP: port \fIY\fP is broken
+The on-board diagnostic has reported that the specified port has hardware
+problems.
+.It dgb\fIX\fP: polling of disabled board stopped
+Internal problems in the polling logic of driver.
+.It dgb\fIX\fP: event queue's head or tail is wrong!
+Internal problems in the driver or hardware.
+.It dgb\fIX\fP: port \fIY\fP: got event on nonexisting port
+Some status changed on a port that is physically present but is
+unusable due to misconfiguration.
+.It dgb\fIX\fP: port \fIY\fP: event \fIN\fP mstat \fIM\fP lstat \fIK\fP
+The driver got a strange event from card.
+Probably this means that you have a
+newer card with an extended list of events or some other hardware problem.
+.It dgb\fIX\fP: port \fIY\fP: overrun
+Input buffer has filled up.
+Problems in polling logic of driver.
+.It dgb\fIX\fP: port \fIY\fP: FEP command on disabled port
+Internal problems in driver.
+.It dgb\fIX\fP: port \fIY\fP: timeout on FEP command
+Problems in hardware.
+.El
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr termios 4 ,
+.Xr tty 4 ,
+.Xr comcontrol 8
+.\" XXX add next line to many other drivers.
+.Sh HISTORY
+The
+.Nm
+driver is derived from the
+.Xr sio 4
+driver and the DigiBoard driver from
+.Tn Linux
+and is
+.Ud
+.Sh BUGS
+The implementation of sending
+.Dv BREAK
+is broken.
+.Dv BREAK
+of fixed length of 1/4 s
+is sent anyway.
+.Pp
+There was a bug in implementation of
+.Xr select 2 .
+It is fixed now but not widely tested yet.
+.Pp
+There is no ditty command.
+Most of its functions (alternate pinout,
+speed up to 115200 baud, etc.) are implemented in the driver itself.
+Some
+other functions are missing.
diff --git a/share/man/man4/disc.4 b/share/man/man4/disc.4
new file mode 100644
index 000000000000..300e712272fc
--- /dev/null
+++ b/share/man/man4/disc.4
@@ -0,0 +1,80 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2002
+.Dt DISC 4
+.Os
+.Sh NAME
+.Nm disc
+.Nd software discard network interface
+.Sh SYNOPSIS
+.Cd "device disc"
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software discard mechanism which may be
+used for performance analysis and/or software testing.
+As with other network interfaces, the discard interface must have
+network addresses assigned for each address family with which it is to be used.
+These addresses
+may be set or changed with the
+.Dv SIOCSIFADDR
+.Xr ioctl 2 .
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr intro 4
+.\" .Xr ns 4
+.Sh HISTORY
+The
+.Nm
+device appears to have been derived from the
+.Xr lo 4
+device around the time of
+.Bx 4.4 .
+This manpage was adapted from
+.Xr lo 4
+and first appeared in
+.Fx 5.0 .
diff --git a/share/man/man4/divert.4 b/share/man/man4/divert.4
new file mode 100644
index 000000000000..d0e67857b1c8
--- /dev/null
+++ b/share/man/man4/divert.4
@@ -0,0 +1,192 @@
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2004
+.Dt DIVERT 4
+.Os
+.Sh NAME
+.Nm divert
+.Nd kernel packet diversion mechanism
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket PF_INET SOCK_RAW IPPROTO_DIVERT
+.Pp
+To enable support for divert sockets, place the following lines in the
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options IPFIREWALL"
+.Cd "options IPDIVERT"
+.Ed
+.Pp
+Alternatively, to load
+.Ns Nm
+as a module at boot time, add the following lines into the
+.Xr loader.conf 5
+file:
+.Bd -literal -offset indent
+ipfw_load="YES"
+ipdivert_load="YES"
+.Ed
+.Sh DESCRIPTION
+Divert sockets are similar to raw IP sockets, except that they
+can be bound to a specific
+.Nm
+port via the
+.Xr bind 2
+system call.
+The IP address in the bind is ignored; only the port
+number is significant.
+A divert socket bound to a divert port will receive all packets diverted
+to that port by some (here unspecified) kernel mechanism(s).
+Packets may also be written to a divert port, in which case they
+re-enter kernel IP packet processing.
+.Pp
+Divert sockets are normally used in conjunction with
+.Fx Ns 's
+packet filtering implementation and the
+.Xr ipfw 8
+program.
+By reading from and writing to a divert socket, matching packets
+can be passed through an arbitrary ``filter'' as they travel through
+the host machine, special routing tricks can be done, etc.
+.Sh READING PACKETS
+Packets are diverted either as they are ``incoming'' or ``outgoing.''
+Incoming packets are diverted after reception on an IP interface,
+whereas outgoing packets are diverted before next hop forwarding.
+.Pp
+Diverted packets may be read unaltered via
+.Xr read 2 ,
+.Xr recv 2 ,
+or
+.Xr recvfrom 2 .
+In the latter case, the address returned will have its port set to
+some tag supplied by the packet diverter, (usually the ipfw rule number)
+and the IP address set to the (first) address of
+the interface on which the packet was received (if the packet
+was incoming) or
+.Dv INADDR_ANY
+(if the packet was outgoing).
+The interface name (if defined
+for the packet) will be placed in the 8 bytes following the address,
+if it fits.
+.Sh WRITING PACKETS
+Writing to a divert socket is similar to writing to a raw IP socket;
+the packet is injected ``as is'' into the normal kernel IP packet
+processing using
+.Xr sendto 2
+and minimal error checking is done.
+Packets are distinguished as either incoming or outgoing.
+If
+.Xr sendto 2
+is used with a destination IP address of
+.Dv INADDR_ANY ,
+then the packet is treated as if it were outgoing, i.e., destined
+for a non-local address.
+Otherwise, the packet is assumed to be
+incoming and full packet routing is done.
+.Pp
+In the latter case, the
+IP address specified must match the address of some local interface,
+or an interface name
+must be found after the IP address.
+If an interface name is found,
+that interface will be used and the value of the IP address will be
+ignored (other than the fact that it is not
+.Dv INADDR_ANY ) .
+This is to indicate on which interface the packet
+.Dq arrived .
+.Pp
+Normally, packets read as incoming should be written as incoming;
+similarly for outgoing packets.
+When reading and then writing back
+packets, passing the same socket address supplied by
+.Xr recvfrom 2
+unmodified to
+.Xr sendto 2
+simplifies things (see below).
+.Pp
+The port part of the socket address passed to the
+.Xr sendto 2
+contains a tag that should be meaningful to the diversion module.
+In the
+case of
+.Xr ipfw 8
+the tag is interpreted as the rule number
+.Em after which
+rule processing should restart.
+.Sh LOOP AVOIDANCE
+Packets written into a divert socket
+(using
+.Xr sendto 2 )
+re-enter the packet filter at the rule number
+following the tag given in the port part of the socket address, which
+is usually already set at the rule number that caused the diversion
+(not the next rule if there are several at the same number).
+If the 'tag'
+is altered to indicate an alternative re-entry point, care should be taken
+to avoid loops, where the same packet is diverted more than once at the
+same rule.
+.Sh DETAILS
+If a packet is diverted but no socket is bound to the
+port, or if
+.Dv IPDIVERT
+is not enabled or loaded in the kernel, the packet is dropped.
+.Pp
+Incoming packet fragments which get diverted are fully reassembled
+before delivery; the diversion of any one fragment causes the entire
+packet to get diverted.
+If different fragments divert to different ports,
+then which port ultimately gets chosen is unpredictable.
+.Pp
+Note that packets arriving on the divert socket by the
+.Xr ipfw 8
+.Cm tee
+action are delivered as-is and packet fragments do not get reassembled
+in this case.
+.Pp
+Packets are received and sent unchanged, except that
+packets read as outgoing have invalid IP header checksums, and
+packets written as outgoing have their IP header checksums overwritten
+with the correct value.
+Packets written as incoming and having incorrect checksums will be dropped.
+Otherwise, all header fields are unchanged (and therefore in network order).
+.Pp
+Binding to port numbers less than 1024 requires super-user access, as does
+creating a socket of type SOCK_RAW.
+.Sh ERRORS
+Writing to a divert socket can return these errors, along with
+the usual errors possible when writing raw packets:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The packet had an invalid header, or the IP options in the packet
+and the socket options set were incompatible.
+.It Bq Er EADDRNOTAVAIL
+The destination address contained an IP address not equal to
+.Dv INADDR_ANY
+that was not associated with any interface.
+.El
+.Sh SEE ALSO
+.Xr bind 2 ,
+.Xr recvfrom 2 ,
+.Xr sendto 2 ,
+.Xr socket 2 ,
+.Xr ipfw 4 ,
+.Xr ipfw 8
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org ,
+Whistle Communications Corp.
+.Sh BUGS
+This is an attempt to provide a clean way for user mode processes
+to implement various IP tricks like address translation, but it
+could be cleaner, and it is too dependent on
+.Xr ipfw 8 .
+.Pp
+It is questionable whether incoming fragments should be reassembled
+before being diverted.
+For example, if only some fragments of a
+packet destined for another machine do not get routed through the
+local machine, the packet is lost.
+This should probably be
+a settable socket option in any case.
diff --git a/share/man/man4/dpms.4 b/share/man/man4/dpms.4
new file mode 100644
index 000000000000..7f7af3ed5f33
--- /dev/null
+++ b/share/man/man4/dpms.4
@@ -0,0 +1,57 @@
+.\" Copyright (c) 2008 Yahoo!, Inc.
+.\" All rights reserved.
+.\" Written by: John Baldwin <jhb@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 23, 2008
+.Dt DPMS 4
+.Os
+.Sh NAME
+.Nm dpms
+.Nd VESA BIOS DPMS driver
+.Sh SYNOPSIS
+.Cd "device dpms"
+.Sh DESCRIPTION
+The
+.Nm
+driver uses the VESA BIOS to manage an external display during suspend and
+resume.
+When the machine suspends,
+the
+.Nm
+driver turns the external display off.
+When the machine resumes,
+it restores the display to its state when the driver was first loaded.
+.Sh SEE ALSO
+.Xr acpi_video 4
+.Sh BUGS
+The VESA BIOS DPMS calls do not provide any way to identify a particular
+display or adapter to manipulate.
+As a result,
+this driver may have unexpected results on systems with multiple displays
+and/or adapters.
diff --git a/share/man/man4/dpt.4 b/share/man/man4/dpt.4
new file mode 100644
index 000000000000..fecb7a54583b
--- /dev/null
+++ b/share/man/man4/dpt.4
@@ -0,0 +1,115 @@
+.\"
+.\" Copyright (c) 1998 Justin T. Gibbs
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2006
+.Dt DPT 4
+.Os
+.Sh NAME
+.Nm dpt
+.Nd DPT RAID Controller SCSI driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device dpt"
+.Pp
+For one or more EISA cards:
+.Cd "device eisa"
+.Pp
+For one or more ISA cards:
+.Cd "device isa"
+.Pp
+For one or more PCI cards:
+.Cd "device pci"
+.Pp
+To allow PCI adapters to use memory mapped I/O if enabled:
+.Cd options DPT_ALLOW_MEMIO
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dpt_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports DPT RAID SCSI controllers.
+.Pp
+SmartRAID (PM3???) are "Enterprise" class cards,
+and SmartCache (PM2???) cards are in the "Workstation" class.
+The Gen 4 Smart Cache IV products were a re-issue of the Gen 3 utilizing
+upgraded (and cheaper to produce) silicon.
+The PM3334 (Smart RAID III) was not revamped as there was no upgraded silicon
+(68040 processor) and it was using the best DPT made.
+Note there has been customer confusion over the faster enterprise class card
+supported by this driver being an older generation.
+The Gen5 cards are supported by the
+.Xr asr 4
+driver.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following RAID adapters:
+.Pp
+.Bl -bullet -compact
+.It
+DPT Smart Cache Plus
+.It
+Smart Cache II (PM2?2?, PM2022 [EISA], PM2024/PM2124 [PCI]) (Gen2)
+.It
+Smart RAID II (PM3?2?, PM3021, PM3222)
+.It
+Smart Cache III (PM2?3?)
+.It
+Smart RAID III (PM3?3?, PM3332 [EISA], PM3334UW [PCI]) (Gen3)
+.It
+Smart Cache IV (PM2?4?, PM2042 [EISA], PM2044/PM2144 [PCI]) (Gen4)
+.It
+Smart RAID IV
+.El
+.Sh SEE ALSO
+.Xr asr 4 ,
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.2.6 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Simon Shapiro
+and ported to the CAM SCSI system by
+.An Justin T. Gibbs .
diff --git a/share/man/man4/dummynet.4 b/share/man/man4/dummynet.4
new file mode 100644
index 000000000000..a5d0e6c8d05a
--- /dev/null
+++ b/share/man/man4/dummynet.4
@@ -0,0 +1,79 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 28, 2002
+.Dt DUMMYNET 4
+.Os
+.Sh NAME
+.Nm dummynet
+.Nd traffic shaper, bandwidth manager and delay emulator
+.Sh DESCRIPTION
+The
+.Nm
+system facility permits the control of traffic
+going through the various network interfaces, by applying bandwidth
+and queue size limitations, implementing different scheduling and queue
+management policies, and emulating delays and losses.
+.Pp
+The user interface for
+.Nm
+is implemented by the
+.Xr ipfw 8
+utility, so please refer to the
+.Xr ipfw 8
+manpage for a complete description of the
+.Nm
+capabilities and how to use it.
+.Ss Kernel Options
+The following options in the kernel configuration file are related to
+.Nm
+operation:
+.Pp
+.Bl -tag -width ".Dv IPFIREWALL_VERBOSE_LIMIT" -offset indent -compact
+.It Dv IPFIREWALL
+enable ipfirewall (required for
+.Nm )
+.It Dv IPFIREWALL_VERBOSE
+enable firewall output
+.It Dv IPFIREWALL_VERBOSE_LIMIT
+limit firewall output
+.It Dv DUMMYNET
+enable
+.Nm
+operation
+.It Dv HZ
+set the timer granularity
+.El
+.Pp
+Generally, the following options are required:
+.Bd -literal -offset indent
+options IPFIREWALL
+options DUMMYNET
+options HZ=1000 # strongly recommended
+.Ed
+.Pp
+Additionally, one may want to increase the number
+of mbuf clusters (used to store network packets) according to the
+sum of the bandwidth-delay products and queue sizes of all configured
+pipes.
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr if_bridge 4 ,
+.Xr ip 4 ,
+.Xr ipfw 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+facility
+was initially implemented as a testing tool for
+.Tn TCP
+congestion control by
+.An Luigi Rizzo Aq luigi@iet.unipi.it ,
+as described on ACM Computer Communication Review, Jan.97 issue.
+Later it has been modified to work at the
+.Tn IP
+and bridging levels, integrated with the
+.Xr ipfw 4
+packet filter, and extended to
+support multiple queueing and scheduling policies.
diff --git a/share/man/man4/ed.4 b/share/man/man4/ed.4
new file mode 100644
index 000000000000..bfa5972d3d95
--- /dev/null
+++ b/share/man/man4/ed.4
@@ -0,0 +1,448 @@
+.\"
+.\" Copyright (c) 1994, David Greenman
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by David Greenman.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt ED 4
+.Os
+.Sh NAME
+.Nm ed
+.Nd "NE-2000 and WD-80x3 Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device ed"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ed_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for 8 and 16bit Ethernet cards that are based on
+the National Semiconductor DS8390 and similar NICs manufactured by
+other companies.
+The
+.Nm
+driver also supports many PC Card chips which interface via MII to a PHY.
+Axiom's AX88790, AX88190 and AX88190A;
+DLink's DL10019 and DL10022; and
+Tamarack's TC5299J chips all support internal or external MII/PHY combinations.
+Realtek's PCI and ISA RTL80x9-based cards are also supported.
+For these chipsets, autonegotiation and status reporting are supported.
+.Pp
+In addition to the standard port and IRQ specifications, the
+.Nm
+driver also supports a number of
+.Cd flags
+which can force 8/16bit mode, enable/disable multi-buffering, and select the default
+interface type (AUI/BNC, and for cards with twisted pair, AUI/10BaseT).
+.Pp
+The
+.Cd flags
+are a bit field, and are summarized as follows:
+.Bl -tag -width indent
+.It Li 0x01
+Disable transceiver.
+On those cards which support it, this flag causes the transceiver to
+be disabled and the AUI connection to be used by default.
+.It Li 0x02
+Force 8bit mode.
+This flag forces the card to 8bit mode regardless of how the
+card identifies itself.
+This may be needed for some clones which incorrectly
+identify themselves as 16bit, even though they only have an 8bit interface.
+This flag takes precedence over force 16bit mode.
+.It Li 0x04
+Force 16bit mode.
+This flag forces the card to 16bit mode regardless of how the
+card identifies itself.
+This may be needed for some clones which incorrectly
+identify themselves as 8bit, even though they have a 16bit ISA interface.
+.It Li 0x08
+Disable transmitter multi-buffering.
+This flag disables the use of multiple
+transmit buffers and may be necessary in rare cases where packets are sent out
+faster than a machine on the other end can handle (as evidenced by severe packet
+lossage).
+Some
+.No ( non- Ns Fx
+:-)) machines have terrible Ethernet performance
+and simply cannot cope with 1100K+ data rates.
+Use of this flag also provides
+one more packet worth of receiver buffering, and on 8bit cards, this may help
+reduce receiver lossage.
+.El
+.Pp
+When using a 3c503 card, the AUI connection may be selected by specifying the
+.Cm link2
+option to
+.Xr ifconfig 8
+(BNC is the default).
+.Sh HARDWARE
+The
+.Nm
+driver supports the following Ethernet NICs:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c503 Etherlink II
+.Pq Cd "options ED_3C503"
+.It
+AR-P500 Ethernet
+.It
+Accton EN1644 (old model), EN1646 (old model), EN2203 (old model) (110pin)
+(flags 0xd00000)
+.It
+Accton EN2212/EN2216/UE2216
+.It
+Allied Telesis CentreCOM LA100-PCM_V2
+.It
+Allied Telesis LA-98 (flags 0x000000) (PC-98)
+.It
+Allied Telesis SIC-98, SIC-98NOTE (110pin), SIU-98 (flags 0x600000) (PC-98)
+.It
+Allied Telesis SIU-98-D (flags 0x610000) (PC-98)
+.It
+AmbiCom 10BaseT card (8002, 8002T, 8010 and 8610)
+.It
+Bay Networks NETGEAR FA410TXC Fast Ethernet
+.It
+Belkin F5D5020 PC Card Fast Ethernet
+.It
+Billionton LM5LT-10B Ethernet/Modem PC Card
+.It
+Billionton LNT-10TB, LNT-10TN Ethernet PC Card
+.It
+Bromax iPort 10/100 Ethernet PC Card
+.It
+Bromax iPort 10 Ethernet PC Card
+.It
+Buffalo LPC2-CLT, LPC3-CLT, LPC3-CLX, LPC4-TX, LPC-CTX PC Card
+.It
+Buffalo LPC-CF-CLT CF Card
+.It
+CNet BC40 adapter
+.It
+Compex Net-A adapter
+.It
+Compex RL2000
+.It
+Contec C-NET(98), RT-1007(98), C-NET(9N) (110pin) (flags 0xa00000) (PC-98)
+.It
+Contec C-NET(98)E-A, C-NET(98)L-A, C-NET(98)P (flags 0x300000) (PC-98)
+.It
+Corega Ether98-T (flags 0x000000) (PC-98)
+.It
+Corega Ether PCC-T/EtherII PCC-T/FEther PCC-TXF/PCC-TXD PCC-T/Fether II TXD
+.It
+Corega LAPCCTXD (TC5299J)
+.It
+CyQ've ELA-010
+.It
+DEC EtherWorks DE305
+.It
+Danpex EN-6200P2
+.It
+D-Link DE-298, DE-298P (flags 0x500000) (PC-98)
+.It
+D-Link DE-660, DE-660+
+.It
+D-Link IC-CARD/IC-CARD+ Ethernet
+.It
+ELECOM LD-98P (flags 0x500000) (PC-98)
+.It
+ELECOM LD-BDN, LD-NW801G (flags 0x200000) (PC-98)
+.It
+ELECOM Laneed LD-CDL/TX, LD-CDF, LD-CDS, LD-10/100CD, LD-CDWA (DP83902A)
+.It
+Hawking PN652TX PC Card (AX88790)
+.It
+HP PC Lan+ 27247B and 27252A
+.Pq Cd "options ED_HPP"
+.It
+IBM Creditcard Ethernet I/II
+.It
+ICM AD-ET2-T, DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET, NB-ET-T (110pin)
+(flags 0x500000) (PC-98)
+.It
+I-O DATA LA/T-98, LA/T-98SB, LA2/T-98, ET/T-98 (flags 0x900000) (PC-98)
+.It
+I-O DATA ET2/T-PCI
+.It
+I-O DATA PCLATE
+.It
+Kansai KLA-98C/T (flags 0x900000) (PC-98)
+.It
+Kingston KNE-PC2, CIO10T, KNE-PCM/x Ethernet
+.It
+KTI ET32P2 PCI
+.It
+Linksys EC2T/PCMPC100/PCM100, PCMLM56
+.It
+Linksys EtherFast 10/100 PC Card, Combo PCMCIA Ethernet Card (PCMPC100 V2)
+.It
+Logitec LAN-98T (flags 0xb00000) (PC-98)
+.It
+MACNICA Ethernet ME1 for JEIDA
+.It
+MACNICA ME98 (flags 0x900000) (PC-98)
+.It
+MACNICA NE2098 (flags 0x400000) (PC-98)
+.It
+MELCO EGY-98 (flags 0x300000) (PC-98)
+.It
+MELCO LGH-98, LGY-98, LGY-98-N (110pin), IND-SP, IND-SS (flags 0x400000) (PC-98)
+.It
+MELCO LGY-PCI-TR
+.It
+MELCO LPC-T/LPC2-T/LPC2-CLT/LPC2-TX/LPC3-TX/LPC3-CLX
+.It
+NDC Ethernet Instant-Link
+.It
+NEC PC-9801-77, PC-9801-78 (flags 0x910000) (PC-98)
+.It
+NEC PC-9801-107, PC-9801-108 (flags 0x800000) (PC-98)
+.It
+National Semiconductor InfoMover NE4100
+.It
+NetGear FA-410TX
+.It
+NetVin NV5000SC
+.It
+Network Everywhere Ethernet 10BaseT PC Card
+.It
+Networld 98X3 (flags 0xd00000) (PC-98)
+.It
+Networld EC-98X, EP-98X (flags 0xd10000) (PC-98)
+.It
+New Media LANSurfer 10+56 Ethernet/Modem
+.It
+New Media LANSurfer
+.It
+Novell NE1000/NE2000/NE2100
+.It
+PLANEX ENW-8300-T
+.It
+PLANEX EN-2298-C (flags 0x200000) (PC-98)
+.It
+PLANEX EN-2298P-T, EN-2298-T (flags 0x500000) (PC-98)
+.It
+PLANEX FNW-3600-T
+.It
+Psion 10/100 LANGLOBAL Combine iT
+.It
+RealTek 8019
+.It
+RealTek 8029
+.It
+Relia Combo-L/M-56k PC Card
+.It
+SMC Elite 16 WD8013
+.It
+SMC Elite Ultra
+.It
+SMC EtherEZ98 (flags 0x000000) (PC-98)
+.It
+SMC WD8003E/WD8003EBT/WD8003S/WD8003SBT/WD8003W/WD8013EBT/WD8013W and clones
+.It
+SMC EZCard PC Card, 8040-TX, 8041-TX (AX88x90), 8041-TX V.2 (TC5299J)
+.It
+Socket LP-E, ES-1000 Ethernet/Serial, LP-E CF, LP-FE CF
+.It
+Surecom EtherPerfect EP-427
+.It
+Surecom NE-34
+.It
+TDK 3000/3400/5670 Fast Ethernet/Modem
+.It
+TDK LAK-CD031, Grey Cell GCS2000 Ethernet Card
+.It
+TDK DFL5610WS Ethernet/Modem PC Card
+.It
+Telecom Device SuperSocket RE450T
+.It
+Toshiba LANCT00A PC Card
+.It
+VIA VT86C926
+.It
+Winbond W89C940
+.It
+Winbond W89C940F
+.El
+.Pp
+C-Bus, ISA, PCI and PC Card devices are supported.
+.Pp
+The
+.Nm
+driver does not support the following Ethernet NICs:
+.Pp
+.Bl -bullet -compact
+.It
+Mitsubishi LAN Adapter B8895
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ed%d: failed to clear shared memory at %x - check configuration."
+When the card was probed at system boot time, the
+.Nm
+driver found that it could not clear the card's shared memory.
+This is most commonly
+caused by a BIOS extension ROM being configured in the same address space as the
+Ethernet card's shared memory.
+Either find the offending card and change its BIOS
+ROM to be at an address that does not conflict, or change the
+settings in
+.Xr device.hints 5
+that the card's shared memory is mapped at a
+non-conflicting address.
+.It "ed%d: Invalid irq configuration (%d) must be 2-5 for 3c503."
+The IRQ number that was specified in the
+.Xr device.hints 5
+file is not valid for the 3Com 3c503 card.
+The 3c503 can only be assigned to IRQs 2 through 5.
+.It "ed%d: Cannot find start of RAM."
+.It "ed%d: Cannot find any RAM, start : %d, x = %d."
+The probe of a Gateway card was unsuccessful in configuring the card's packet memory.
+This likely indicates that the card was improperly recognized as a Gateway or that
+the card is defective.
+.It "ed: packets buffered, but transmitter idle."
+Indicates a logic problem in the driver.
+Should never happen.
+.It "ed%d: device timeout"
+Indicates that an expected transmitter interrupt did not occur.
+Usually caused by an
+interrupt conflict with another card on the ISA bus.
+This condition could also be caused if the kernel is configured for a
+different IRQ channel than the one the card is actually using.
+If that is the case, you will have to either reconfigure the card
+using a DOS utility or set the jumpers on the card appropriately.
+.It "ed%d: NIC memory corrupt - invalid packet length %d."
+Indicates that a packet was received with a packet length that was either larger than
+the maximum size or smaller than the minimum size allowed by the IEEE 802.3 standard.
+Usually
+caused by a conflict with another card on the ISA bus, but in some cases may also
+indicate faulty cabling.
+.It "ed%d: remote transmit DMA failed to complete."
+This indicates that a programmed I/O transfer to an NE1000 or NE2000 style card
+has failed to properly complete.
+Usually caused by the ISA bus speed being set
+too fast.
+.It "ed%d: Invalid irq configuration (%ld) must be %s for %s"
+Indicates the device has a different IRQ than supported or expected.
+.It "ed%d: Cannot locate my ports!"
+The device is using a different I/O port than the driver knows about.
+.It "ed%d: Cannot extract MAC address"
+Attempts to get the MAC address failed.
+.It "ed%d: Missing mii!"
+Probing for an MII bus has failed.
+This indicates a coding error in the PC Card attachment, because a PHY
+is required for the chips that generate this error message.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr device.hints 5 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 1.0 .
+.Sh AUTHORS
+The
+.Nm
+device driver and this manual page were written by
+.An David Greenman .
+.Sh CAVEATS
+Early revision DS8390 chips have problems.
+They lock up whenever the receive
+ring-buffer overflows.
+They occasionally switch the byte order
+of the length field in the packet ring header (several different causes
+of this related to an off-by-one byte alignment) - resulting in
+.Qq Li "NIC memory corrupt - invalid packet length"
+messages.
+The card is reset
+whenever these problems occur, but otherwise there is no problem with
+recovering from these conditions.
+.Pp
+The NIC memory access to 3Com and Novell cards is much slower than it is on
+WD/SMC cards; it is less than 1MB/second on 8bit boards and less than 2MB/second
+on the 16bit cards.
+This can lead to ring-buffer overruns resulting in
+dropped packets during heavy network traffic.
+.Pp
+The Mitsubishi B8895 PC Card uses a DP83902, but its ASIC part is
+undocumented.
+Neither the NE2000 nor the WD83x0 drivers work with this card.
+.Sh BUGS
+The
+.Nm
+driver is a bit too aggressive about resetting the card whenever any bad
+packets are received.
+As a result, it may throw out some good packets which
+have been received but not yet transferred from the card to main memory.
+.Pp
+The
+.Nm
+driver is slow by today's standards.
+.Pp
+PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ethernet
+port only at this time.
+.Pp
+Some devices supported by
+.Nm
+do not generate the link state change events used by
+.Xr devd 8
+to start
+.Xr dhclient 8 .
+If you have problems with
+.Xr dhclient 8
+not starting and the device is always attached to the network it may
+be possible to work around this by changing
+.Dq Li DHCP
+to
+.Dq Li SYNCDHCP
+in the
+.Va ifconfig_ed0
+entry in
+.Pa /etc/rc.conf .
diff --git a/share/man/man4/edsc.4 b/share/man/man4/edsc.4
new file mode 100644
index 000000000000..075e73617695
--- /dev/null
+++ b/share/man/man4/edsc.4
@@ -0,0 +1,111 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd March 25, 2007
+.Dt EDSC 4
+.Os
+.Sh NAME
+.Nm edsc
+.Nd Ethernet discard network interface
+.Sh SYNOPSIS
+.Cd "device edsc"
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software discard mechanism which may be
+used for performance analysis and software testing.
+It imitates an Ethernet device, which
+allows for its use in conjunction with such drivers as
+.Xr if_bridge 4
+and
+.Xr vlan 4 .
+.Pp
+As with other network interfaces, an
+.Nm
+interface must have network addresses assigned for each address family
+with which it is to be used.
+These addresses may be set or changed with the
+.Dv SIOCSIFADDR
+.Xr ioctl 2
+or
+.Xr ifconfig 8
+utility.
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr arp 4 ,
+.Xr if_bridge 4 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr vlan 4 ,
+.Xr rc.conf 5 ,
+.Xr arp 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device was derived from the
+.Xr disc 4
+device and first appeared in
+.Fx 6.3 .
+This manpage was adapted from
+.Xr disc 4 .
+.Sh CAVEATS
+Since outgoing packets are just discarded by
+.Nm ,
+ARP requests stay unreplied.
+Consequently, an IP packet cannot be sent via
+.Nm
+until a static
+.Xr arp 4
+entry is created for its next hop using
+.Xr arp 8 .
+.Pp
+Initially an
+.Nm
+interface has a zero link level address.
+It can be changed with
+.Xr ifconfig 8
+.Cm lladdr
+if needed.
diff --git a/share/man/man4/ef.4 b/share/man/man4/ef.4
new file mode 100644
index 000000000000..ce074879ba43
--- /dev/null
+++ b/share/man/man4/ef.4
@@ -0,0 +1,111 @@
+.\"
+.\" Copyright (c) 1999, Boris Popov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 20, 1999
+.Dt EF 4
+.Os
+.Sh NAME
+.Nm ef
+.Nd "pseudo-device driver providing support for multiple Ethernet frame types"
+.Sh SYNOPSIS
+.Cd "device ef"
+.Sh DESCRIPTION
+The
+.Nm
+pseudo-device driver clones each Ethernet type device with four
+additional interfaces.
+Each of them is capable to send or receive only
+one predefined frame type.
+.Pp
+Names for the new interfaces are created by adding a
+.Ar fN
+suffix to an existing device name.
+Where
+.Ar N
+is a device unit which can have one of the following values:
+.Bd -literal -offset indent
+0 interface with an Ethernet_II frame
+1 interface with a Novell Ethernet_802.3 frame
+2 interface with an Ethernet_802.2 frame
+3 interface with an Ethernet_802.2/SNAP frame support.
+.Ed
+.Pp
+For example, device
+.Ar ed0
+will be populated with four devices:
+.Ar ed0f0 ,
+.Ar ed0f1 ,
+.Ar ed0f2
+and
+.Ar ed0f3 .
+.Pp
+After that, each device can be configured as usual:
+.Dl # ifconfig ed0f1 ipx 0x105
+This will configure IPX protocol with network number
+.Ar 0x105
+and
+.Ar Ethernet_802.3
+frame type.
+.Pp
+Please note that it is impossible to configure the IPX protocol on the parent
+.Ar ed0
+device after the
+.Ar if_ef.ko
+driver has been loaded.
+.Pp
+If the parent interface is not configured for any other protocol
+(IP for example), subinterfaces will not function.
+To avoid that, the parent interface should be
+manually marked as
+.Dq up :
+.Dl # ifconfig ed0 up
+.Sh EXAMPLES
+The
+.Nm
+driver can be loaded via the
+.Xr loader.conf 5
+file:
+.Dl if_ef_load="YES"
+.Pp
+In this case, ordinary interface configuration commands can be used
+in the
+.Xr rc.conf 5
+file:
+.Dl network_interfaces="ed2 lo0 tun0 ed2f0 ed2f1"
+.Dl ifconfig_ed2f0_ipx="ipx 0x101"
+.Dl ifconfig_ed2f1_ipx="ipx 0x102"
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr ipx 3 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An Boris Popov Aq bp@FreeBSD.org .
+.Sh CAVEATS
+Avoid to configure the parent Ethernet device for the IPX protocol, after the
+.Nm
+driver is loaded.
diff --git a/share/man/man4/ehci.4 b/share/man/man4/ehci.4
new file mode 100644
index 000000000000..1d06bf9b0dc9
--- /dev/null
+++ b/share/man/man4/ehci.4
@@ -0,0 +1,101 @@
+.\" $NetBSD: ehci.4,v 1.8 2001/11/21 17:22:56 augustss Exp $
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 4, 2012
+.Dt EHCI 4
+.Os
+.Sh NAME
+.Nm ehci
+.Nd USB Enhanced Host Controller driver
+.Sh SYNOPSIS
+.Cd "device ehci"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn USB
+Enhanced Host Controller Interface,
+which is used by
+.Tn USB
+2.0 controllers.
+.Pp
+.Tn EHCI
+controllers are peculiar in that they can only handle the
+.Tn USB
+2.0 protocol.
+This means that they normally have one or more companion controllers
+(i.e.,
+.Xr ohci 4
+or
+.Xr uhci 4 )
+handling USB 1.x devices.
+Consequently each
+.Tn USB
+connector is electrically connected to two
+.Tn USB
+controllers.
+The handling of this is totally automatic,
+but can be noticed since
+.Tn USB
+1.x and
+.Tn USB
+2.0 devices plugged in to the same
+connector appear to connect to different USB busses.
+.Sh SEE ALSO
+.Xr xhci 4 ,
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.1 .
+.Sh LOADER TUNABLES
+When the kernel has been compiled with
+.Cd options USB_DEBUG ,
+some tunables become available that affect the behavior of
+.Nm .
+These tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.usb.ehci.lostintrbug
+This tunable enables the lost interrupt quirk.
+The default value is 0 (off).
+.It Va hw.usb.ehci.iaadbug
+This tunable enables the EHCI doorbell quirk.
+The default value is 0 (off).
+.It Va hw.usb.ehci.no_hs
+This tunable disables USB devices to attach like HIGH-speed ones and will force all attached devices to attach to the FULL- or LOW-speed companion controller.
+The default value is 0 (off).
+.El
diff --git a/share/man/man4/em.4 b/share/man/man4/em.4
new file mode 100644
index 000000000000..9098b75875cf
--- /dev/null
+++ b/share/man/man4/em.4
@@ -0,0 +1,289 @@
+.\" Copyright (c) 2001-2003, Intel Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Intel Corporation nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 11, 2011
+.Dt EM 4
+.Os
+.Sh NAME
+.Nm em
+.Nd "Intel(R) PRO/1000 Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device em"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_em_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Gigabit Ethernet adapters based on
+the Intel 82540, 82541ER, 82541PI, 82542, 82543, 82544, 82545, 82546,
+82546EB, 82546GB, 82547, 82571, 81572, 82573, and 82574 Ethernet
+controller chips.
+The driver supports Transmit/Receive checksum offload
+and Jumbo Frames on all but 82542-based adapters.
+Furthermore it supports TCP segmentation offload (TSO) on all adapters but
+those based on the 82543, 82544 and 82547 controller chips.
+The identification LEDs of the adapters supported by the
+.Nm
+driver can be controlled via the
+.Xr led 4
+API for localization purposes.
+For further hardware information, see the
+.Pa README
+included with the driver.
+.Pp
+For questions related to hardware requirements,
+refer to the documentation supplied with your Intel PRO/1000 adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 16114.
+.Pp
+This driver version supports VLANs.
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enables auto-negotiation for speed and duplex.
+.It Cm 10baseT/UTP
+Sets 10Mbps operation.
+Use the
+.Cm mediaopt
+option to select
+.Cm full-duplex
+mode.
+.It Cm 100baseTX
+Sets 100Mbps operation.
+Use the
+.Cm mediaopt
+option to select
+.Cm full-duplex
+mode.
+.It Cm 1000baseSX
+Sets 1000Mbps operation.
+Only
+.Cm full-duplex
+mode is supported at this speed.
+.It Cm 1000baseTX
+Sets 1000Mbps operation.
+Only
+.Cm full-duplex
+mode is supported at this speed.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Forces full-duplex operation
+.It Cm half-duplex
+Forces half-duplex operation.
+.El
+.Pp
+Only use
+.Cm mediaopt
+to set the driver to
+.Cm full-duplex .
+If
+.Cm mediaopt
+is not specified, the driver defaults to
+.Cm half-duplex .
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Gigabit Ethernet adapters based on the Intel
+82540, 82541ER, 82541PI, 82542, 82543, 82544, 82545, 82546, 82546EB,
+82546GB, 82547, 82571, 82572, 82573, and 82574 controller chips:
+.Pp
+.Bl -bullet -compact
+.It
+Intel PRO/1000 CT Network Connection (82547)
+.It
+Intel PRO/1000 F Server Adapter (82543)
+.It
+Intel PRO/1000 Gigabit Server Adapter (82542)
+.It
+Intel PRO/1000 GT Desktop Adapter (82541PI)
+.It
+Intel PRO/1000 MF Dual Port Server Adapter (82546)
+.It
+Intel PRO/1000 MF Server Adapter (82545)
+.It
+Intel PRO/1000 MF Server Adapter (LX) (82545)
+.It
+Intel PRO/1000 MT Desktop Adapter (82540)
+.It
+Intel PRO/1000 MT Desktop Adapter (82541)
+.It
+Intel PRO/1000 MT Dual Port Server Adapter (82546)
+.It
+Intel PRO/1000 MT Quad Port Server Adapter (82546EB)
+.It
+Intel PRO/1000 MT Server Adapter (82545)
+.It
+Intel PRO/1000 PF Dual Port Server Adapter (82571)
+.It
+Intel PRO/1000 PF Quad Port Server Adapter (82571)
+.It
+Intel PRO/1000 PF Server Adapter (82572)
+.It
+Intel PRO/1000 PT Desktop Adapter (82572)
+.It
+Intel PRO/1000 PT Dual Port Server Adapter (82571)
+.It
+Intel PRO/1000 PT Quad Port Server Adapter (82571)
+.It
+Intel PRO/1000 PT Server Adapter (82572)
+.It
+Intel PRO/1000 T Desktop Adapter (82544)
+.It
+Intel PRO/1000 T Server Adapter (82543)
+.It
+Intel PRO/1000 XF Server Adapter (82544)
+.It
+Intel PRO/1000 XT Server Adapter (82544)
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.em.rxd
+Number of receive descriptors allocated by the driver.
+The default value is 1024 for adapters newer than 82547,
+and 256 for older ones.
+The 82542 and 82543-based adapters can handle up to 256 descriptors,
+while others can have up to 4096.
+.It Va hw.em.txd
+Number of transmit descriptors allocated by the driver.
+The default value is 1024 for adapters newer than 82547,
+and 256 for older ones.
+The 82542 and 82543-based adapters can handle up to 256 descriptors,
+while others can have up to 4096.
+.It Va hw.em.rx_int_delay
+This value delays the generation of receive interrupts in units of
+1.024 microseconds.
+The default value is 0, since adapters may hang with this feature
+being enabled.
+.It Va hw.em.rx_abs_int_delay
+If
+.Va hw.em.rx_int_delay
+is non-zero, this tunable limits the maximum delay in which a receive
+interrupt is generated.
+.It Va hw.em.tx_int_delay
+This value delays the generation of transmit interrupts in units of
+1.024 microseconds.
+The default value is 64.
+.It Va hw.em.tx_abs_int_delay
+If
+.Va hw.em.tx_int_delay
+is non-zero, this tunable limits the maximum delay in which a transmit
+interrupt is generated.
+.El
+.Sh FILES
+.Bl -tag -width /dev/led/em*
+.It Pa /dev/led/em*
+identification LED device nodes
+.El
+.Sh EXAMPLES
+Make the identification LED of em0 blink:
+.Pp
+.Dl "echo f2 > /dev/led/em0"
+.Pp
+Turn the identification LED of em0 off again:
+.Pp
+.Dl "echo 0 > /dev/led/em0"
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "em%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "em%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "em%d: watchdog timeout -- resetting"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Intel support website at:
+.Pa http://support.intel.com .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq freebsdnic@mailbox.intel.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr igb 4 ,
+.Xr led 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Intel Corporation Aq freebsdnic@mailbox.intel.com .
+.Sh BUGS
+Hardware-assisted VLAN processing is disabled by default.
+You can enable it on an
+.Nm
+interface using
+.Xr ifconfig 8 .
diff --git a/share/man/man4/en.4 b/share/man/man4/en.4
new file mode 100644
index 000000000000..f9281fa968f7
--- /dev/null
+++ b/share/man/man4/en.4
@@ -0,0 +1,78 @@
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt EN 4
+.Os
+.Sh NAME
+.Nm en
+.Nd "device driver for Midway-based ATM interfaces"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device en"
+.Cd "device atm"
+.Cd "device utopia"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_en_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports Midway-based ATM interfaces including the
+Efficient Networks, Inc.\& ENI-155 and Adaptec ANA-59x0.
+Midway is an AAL5 SAR (Segmentation and Reassembly) chip.
+.Pp
+For configuring the card for IP see
+.Xr natmip 4 .
+.Pp
+The following sysctls are recognized by the driver additionally to those
+handled by
+.Xr utopia 4 :
+.Bl -tag -width indent
+.It Va hw.atm.enX.istats
+Contains an array of
+.Vt uint32_t
+with internal driver statistics.
+.It Va hw.atm.enX.debug
+This is a bit map of debugging options.
+This variable is only available when the driver is compiled with debugging
+support.
+.El
+.Pp
+The driver supports the media options
+.Cm sdh ,
+.Cm noscramb
+and
+.Cm unassigned
+(see
+.Xr utopia 4 ) .
+.Sh DIAGNOSTICS
+.Bd -literal
+en0 <Efficient Networks ENI-155p> rev 0 int a irq 5 on pci0:16
+en0: ATM midway v0, board IDs 6.0, Utopia (pipelined), 512KB on-board RAM
+en0: maximum DMA burst length = 64 bytes
+en0: 7 32KB receive buffers, 8 32KB transmit buffers allocated
+.Ed
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr natmip 4 ,
+.Xr utopia 4 ,
+.Xr ifconfig 8 ,
+.Xr route 8
+.Sh AUTHORS
+.An Chuck Cranor
+of Washington University implemented
+.Nm
+driver in 1996 for
+.Nx .
+.Sh CAVEATS
+The driver extensively uses DMA on PCI.
+The first
+generation PCI chipsets do not work or exhibit poor performance.
diff --git a/share/man/man4/enc.4 b/share/man/man4/enc.4
new file mode 100644
index 000000000000..edbc488c83f0
--- /dev/null
+++ b/share/man/man4/enc.4
@@ -0,0 +1,133 @@
+.\" $OpenBSD: enc.4,v 1.22 2006/05/26 08:51:29 jmc Exp $
+.\"
+.\" Copyright (c) 1999 Angelos D. Keromytis
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Angelos D. Keromytis.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 28, 2007
+.Dt ENC 4
+.Os
+.Sh NAME
+.Nm enc
+.Nd Encapsulating Interface
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device enc"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software loopback mechanism that allows hosts or
+firewalls to filter
+.Xr ipsec 4
+traffic using any firewall package that hooks in via the
+.Xr pfil 9
+framework.
+.Pp
+The
+.Nm
+interface allows an administrator to see incoming and outgoing packets
+before and after they will be or have been processed by
+.Xr ipsec 4
+via
+.Xr tcpdump 1 .
+.Pp
+The
+.Dq Li enc0
+interface inherits all IPsec traffic.
+Thus all IPsec traffic can be filtered based on
+.Dq Li enc0 ,
+and all IPsec traffic could be seen by invoking
+.Xr tcpdump 1
+on the
+.Dq Li enc0
+interface.
+.Pp
+What can be seen with
+.Xr tcpdump 1
+and what will be passed on to the firewalls via the
+.Xr pfil 9
+framework can be independently controlled using the following
+.Xr sysctl 8
+variables:
+.Bl -column net.enc.out.ipsec_filter_mask 0x00000000 0x00000000
+.It Sy "Name Defaults Suggested"
+.It "net.enc.out.ipsec_bpf_mask 0x00000003 0x00000001"
+.It "net.enc.out.ipsec_filter_mask 0x00000001 0x00000001"
+.It "net.enc.in.ipsec_bpf_mask 0x00000001 0x00000002"
+.It "net.enc.in.ipsec_filter_mask 0x00000001 0x00000002"
+.El
+.Pp
+For the incoming path a value of
+.Li 0x1
+means
+.Dq Li before stripping off the outer header
+and
+.Li 0x2
+means
+.Dq Li after stripping off the outer header .
+For the outgoing path
+.Li 0x1
+means
+.Dq Li with only the inner header
+and
+.Li 0x2
+means
+.Dq Li with outer and inner headers .
+.Bd -literal
+incoming path |------|
+---- IPsec processing ---- (before) ---- (after) ----> | |
+ | Host |
+<--- IPsec processing ---- (after) ----- (before) ---- | |
+outgoing path |------|
+.Ed
+.Pp
+Most people will want to run with the suggested defaults for
+.Cm ipsec_filter_mask
+and rely on the security policy database for the outer headers.
+.Sh EXAMPLES
+To see the packets the processed via
+.Xr ipsec 4 ,
+adjust the
+.Xr sysctl 8
+variables according to your need and run:
+.Pp
+.Dl "tcpdump -i enc0"
+.Sh SEE ALSO
+.Xr tcpdump 1 ,
+.Xr bpf 4 ,
+.Xr ipf 4 ,
+.Xr ipfw 4 ,
+.Xr ipsec 4 ,
+.Xr pf 4 ,
+.Xr tcpdump 8
diff --git a/share/man/man4/epair.4 b/share/man/man4/epair.4
new file mode 100644
index 000000000000..899bd5fce683
--- /dev/null
+++ b/share/man/man4/epair.4
@@ -0,0 +1,119 @@
+.\"-
+.\" Copyright (c) 2008 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by CK Software GmbH under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 26, 2009
+.Dt EPAIR 4
+.Os
+.Sh NAME
+.Nm epair
+.Nd A pair of virtual back-to-back connected Ethernet interfaces.
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device epair"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_epair_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+is a pair of Ethernet-like software interfaces,
+which are connected back-to-back with a virtual cross-over cable.
+.Pp
+Each
+.Nm
+interface pair is created at runtime using interface cloning.
+This is most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+While for cloning you only give either
+.Pa epair
+or
+.Pa epair<n>
+the
+.Nm
+pair will be named like
+.Pa epair<n>[ab] .
+This means the names of the first
+.Nm
+interfaces will be
+.Pa epair0a
+and
+.Pa epair0b .
+.Pp
+Like any other Ethernet interface, an
+.Nm
+needs to have a network address.
+Each
+.Nm
+will be assigned a locally administered address by default,
+that is only guaranteed to be unique within one network stack.
+To change the default addresses one may use the SIOCSIFADDR ioctl(2) or
+ifconfig(8) utility.
+.Pp
+The basic intend is to provide connectivity between two virtual
+network stack instances.
+When connected to a
+.Xr if_bridge 4
+one end of the interface pair can also be part of another (virtual) LAN.
+As with any other Ethernet interface one can configure
+.Xr vlan 4
+support on top of it.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr altq 4 ,
+.Xr bpf 4 ,
+.Xr if_bridge 4 ,
+.Xr vlan 4 ,
+.Xr loader.conf 5 ,
+.Xr rc.conf 5 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+interface first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+The
+.Nm
+interface was written by
+.An Bjoern A. Zeeb, CK Software GmbH,
+under sponsorship from the FreeBSD Foundation.
diff --git a/share/man/man4/esp.4 b/share/man/man4/esp.4
new file mode 100644
index 000000000000..6ebc85b31123
--- /dev/null
+++ b/share/man/man4/esp.4
@@ -0,0 +1,115 @@
+.\"
+.\" Copyright (c) 2011 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 1, 2011
+.Dt ESP 4
+.Os
+.Sh NAME
+.Nm esp
+.Nd Emulex ESP, NCR 53C9x and QLogic FAS families based SCSI controllers
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device esp"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_esp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn AMD
+Am53C974, the
+.Tn Emulex
+ESP100, ESP100A, ESP200 and ESP406, the
+.Tn NCR
+53C90, 53C94 and 53C96 as well as the
+.Tn QLogic
+FAS100A, FAS216, FAS366 and FAS408
+.Tn SCSI
+controller chips found in a wide variety of systems and peripheral boards.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+MELCO IFC-DP (PC-98)
+.It
+Sun ESP family
+.It
+Sun FAS family
+.It
+Tekram DC390
+.It
+Tekram DC390T
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr pci 4 ,
+.Xr sa 4 ,
+.Xr sbus 4 ,
+.Xr scsi 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 1.3 .
+The first
+.Fx
+version to include it was
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was ported to
+.Fx
+by
+.An Scott Long
+.Aq scottl@FreeBSD.org
+and later on considerably improved by
+.An Marius Strobl
+.Aq marius@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver should read the EEPROM settings of
+.Tn Tekram
+controllers.
diff --git a/share/man/man4/et.4 b/share/man/man4/et.4
new file mode 100644
index 000000000000..9b9947017423
--- /dev/null
+++ b/share/man/man4/et.4
@@ -0,0 +1,186 @@
+.\"
+.\" Copyright (c) 2007 The DragonFly Project. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\" 3. Neither the name of The DragonFly Project nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific, prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 9, 2011
+.Dt ET 4
+.Os
+.Sh NAME
+.Nm et
+.Nd "Agere ET1310 10/100/Gigabit Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device et"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_et_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports PCI Express Ethernet adapters based on the Agere ET1310 chip.
+.\".Pp
+.\"Support for Jumbo Frames is provided via the interface MTU setting.
+.\"Selecting an MTU larger than 1500 bytes with the
+.\".Xr ifconfig 8
+.\"utility configures the adapter to receive and transmit Jumbo Frames.
+.\"The maximum MTU setting for Jumbo Frames is 15572.
+.\"This value coincides with the maximum Jumbo Frames size of 15594.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Pp
+.Bl -tag -width 10baseT/UTP -compact
+.It autoselect
+Enable autoselection of the media types and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.Pp
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.Pp
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.Pp
+.It 1000baseT
+Set 1000Mbps (Gigabit Ethernet) operation.
+The
+.Ar mediaopt
+option can only be set to
+.Ar full-duplex
+mode.
+.El
+.Pp
+The
+.Nm
+driver supports the following
+.Ar media
+options:
+.Pp
+.Bl -tag -width full-duplex -compact
+.It full-duplex
+Force full-duplex operation.
+.Pp
+.It half-duplex
+Force half-duplex operation.
+.El
+.Pp
+Note that the 1000baseT media type is only available
+if it is supported by the adapter.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Agere ET1310 10/100/Gigabit
+Ethernet adapters.
+.Sh TUNABLES
+.Bl -tag -width ".Va hw.et.rx_intr_npkts"
+.It Va hw.et.rx_intr_npkts
+This value controls how many packets should be received
+before a receive interrupt is generated.
+The default value is 32.
+It is recommended to set this value above 38 to prevent the host from being
+livelocked under a high degree of stress.
+.It Va hw.et.rx_intr_delay
+This value delays the generation of receive interrupts
+in units of ~4 microseconds.
+It is used together with
+.Va hw.et.rx_intr_npkts
+to achieve RX interrupt moderation.
+The default value is 20.
+.It Va hw.et.tx_intr_nsegs
+This value controls how many segments (not packets) should be transmitted
+before a transmit interrupt is generated.
+The default value is 126.
+It is recommended to set this value below 280 to prevent
+the TX ring from underflowing.
+.It Va hw.et.timer
+This value controls how often a timer interrupt should be generated.
+It is used together with
+.Va hw.et.tx_intr_nsegs
+to achieve TX interrupt moderation.
+The default value is 1000000000 (nanoseconds).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Dx 1.11 .
+The first
+.Fx
+release to include it was
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Sepherosa Ziehau Aq sepherosa@gmail.com
+for
+.Dx .
+It was ported to
+.Fx
+by
+.An Xin LI Aq delphij@FreeBSD.org .
diff --git a/share/man/man4/eventtimers.4 b/share/man/man4/eventtimers.4
new file mode 100644
index 000000000000..4db44207e86b
--- /dev/null
+++ b/share/man/man4/eventtimers.4
@@ -0,0 +1,161 @@
+.\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 13, 2012
+.Dt EVENTTIMERS 4
+.Os
+.Sh NAME
+.Nm eventtimers
+.Nd kernel event timers subsystem
+.Sh SYNOPSIS
+Kernel uses several types of time-related devices, such as: real time clocks,
+time counters and event timers.
+Real time clocks responsible for tracking real world time, mostly when system
+is down.
+Time counters are responsible for generation of monotonically increasing
+timestamps for precise uptime tracking purposes, when system is running.
+Event timers are responsible for generating interrupts at specified time or
+periodically, to run different time-based events.
+This page is about the last.
+.Sh DESCRIPTION
+Kernel uses time-based events for many different purposes: scheduling,
+statistics, time keeping, profiling and many other things, based on
+.Xr callout 9
+mechanism.
+These purposes now grouped into three main callbacks:
+.Bl -tag -width ".Fn hardclock"
+.It Fn hardclock
+.Xr callout 9
+and timekeeping events entry.
+Called with frequency defined by
+.Va hz
+variable,
+usually 1000Hz.
+.It Fn statclock
+statistics and scheduler events entry.
+Called with frequency about 128Hz.
+.It Fn profclock
+profiler events entry.
+When enabled, called with frequency about 8KHz.
+.El
+.Pp
+Different platforms provide different kinds of timer hardware.
+The goal of the event timers subsystem is to provide unified way to control
+that hardware, and to use it, supplying kernel with all required time-based
+events.
+.Pp
+Each driver implementing event timers, registers them at the subsystem.
+It is possible to see the list of present event timers, like this, via
+.Va kern.eventtimer
+sysctl:
+.Bd -literal
+kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0)
+kern.eventtimer.et.LAPIC.flags: 15
+kern.eventtimer.et.LAPIC.frequency: 0
+kern.eventtimer.et.LAPIC.quality: 400
+kern.eventtimer.et.i8254.flags: 1
+kern.eventtimer.et.i8254.frequency: 1193182
+kern.eventtimer.et.i8254.quality: 100
+kern.eventtimer.et.RTC.flags: 17
+kern.eventtimer.et.RTC.frequency: 32768
+kern.eventtimer.et.RTC.quality: 0
+kern.eventtimer.et.HPET.flags: 7
+kern.eventtimer.et.HPET.frequency: 14318180
+kern.eventtimer.et.HPET.quality: 550
+.Ed
+.Pp
+where:
+.Bl -inset
+.It Va kern.eventtimer.et. Ns Ar X Ns Va .flags
+is a
+bitmask, defining event timer capabilities:
+.Bl -tag -offset indent -width indent -compact
+.It 1
+periodic mode supported,
+.It 2
+one-shot mode supported,
+.It 4
+timer is per-CPU,
+.It 8
+timer may stop when CPU goes to sleep state,
+.It 16
+timer supports only power-of-2 divisors.
+.El
+.It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency
+is a
+timer base frequency,
+.It Va kern.eventtimer.et. Ns Ar X Ns Va .quality
+is an
+integral value, defining how good is this timer, comparing to others.
+.El
+.Pp
+Timers management code of the kernel chooses one timer from that list.
+Current choice can be read and affected via
+.Va kern.eventtimer.timer
+tunable/sysctl.
+Several other tunables/sysctls are affecting how exactly this timer is used:
+.Bl -inset
+.It Va kern.eventtimer.periodic
+allows to choose periodic and one-shot operation mode.
+In periodic mode, periodic interrupts from timer hardware are taken as the
+only source of time for time events.
+One-shot mode instead uses currently selected time counter to precisely
+schedule all needed events and programs event timer to generate interrupt
+exactly in specified time.
+Default value depends of chosen timer capabilities, but one-shot mode is
+preferred, until other is forced by user or hardware.
+.It Va kern.eventtimer.singlemul
+in periodic mode specifies how much times higher timer frequency should be,
+to not strictly alias
+.Fn hardclock
+and
+.Fn statclock
+events.
+Default values are
+1, 2 or 4, depending on configured HZ value.
+.It Va kern.eventtimer.idletick
+makes each CPU to receive every timer interrupt independently of whether they
+busy or not.
+By default this options is disabled.
+If chosen timer is per-CPU
+and runs in periodic mode, this option has no effect - all interrupts are
+always generating.
+.It Va kern.eventtimer.activetick
+makes each CPU to receive all kinds of timer interrupts when they are busy.
+Disabling it allows to skip some
+.Fn hardclock
+calls in some cases.
+By default this options is enabled.
+If chosen timer is per-CPU, this option has no effect - all interrupts are
+always generating, as timer reprogramming is too expensive for that case.
+.El
+.Sh SEE ALSO
+.Xr apic 4 ,
+.Xr atrtc 4 ,
+.Xr attimer 4 ,
+.Xr hpet 4 ,
+.Xr timecounters 4 ,
+.Xr eventtimers 9
diff --git a/share/man/man4/exca.4 b/share/man/man4/exca.4
new file mode 100644
index 000000000000..90b13307fdd3
--- /dev/null
+++ b/share/man/man4/exca.4
@@ -0,0 +1,40 @@
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 23, 2003
+.Dt EXCA 4
+.Os
+.Sh NAME
+.Nm exca
+.Nd helper module for PC Card and CardBus systems
+.Sh DESCRIPTION
+The
+.Nm
+module is used to implement the Intel ExCA interface to
+PC Cards.
+.Sh SEE ALSO
+.Xr pccbb 4 ,
+.Xr pcic 4
diff --git a/share/man/man4/faith.4 b/share/man/man4/faith.4
new file mode 100644
index 000000000000..f0a2df6f6c3c
--- /dev/null
+++ b/share/man/man4/faith.4
@@ -0,0 +1,133 @@
+.\" $KAME: faith.4,v 1.9 2001/04/27 17:26:35 itojun Exp $
+.\"
+.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 2012
+.Dt FAITH 4
+.Os
+.Sh NAME
+.Nm faith
+.Nd IPv6-to-IPv4 TCP relay capturing interface
+.Sh SYNOPSIS
+.Cd "device faith"
+.Sh DESCRIPTION
+The
+.Nm
+interface captures IPv6 TCP traffic,
+for implementing userland IPv6-to-IPv4 TCP relay
+like
+.Xr faithd 8 .
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Pp
+Special action will be taken when IPv6 TCP traffic is seen on a router,
+and the default routing table suggests to route it to the
+.Nm
+interface.
+In this case, the packet will be accepted by the router,
+regardless of the list of IPv6 interface addresses assigned to the router.
+The packet will be captured by an IPv6 TCP socket, if it has the
+.Dv IN6P_FAITH
+flag turned on and matching address/port pairs.
+As a result,
+.Nm
+will let you capture IPv6 TCP traffic to some specific destination addresses.
+Userland programs, such as
+.Xr faithd 8
+can use this behavior to relay IPv6 TCP traffic to IPv4 TCP traffic.
+The program can accept some specific IPv6 TCP traffic, perform
+.Xr getsockname 2
+to get the IPv6 destination address specified by the client,
+and perform application-specific address mapping to relay IPv6 TCP to IPv4 TCP.
+.Pp
+The
+.Dv IN6P_FAITH
+flag on a IPv6 TCP socket can be set by using
+.Xr setsockopt 2 ,
+with level
+.Dv IPPROTO_IPV6
+and optname
+.Dv IPv6_FAITH .
+.Pp
+To handle error reports by ICMPv6, some ICMPv6 packets routed to an
+.Nm
+interface will be delivered to IPv6 TCP, as well.
+.Pp
+To understand how
+.Nm
+can be used, take a look at the source code of
+.Xr faithd 8 .
+.Pp
+As the
+.Nm
+interface implements potentially dangerous operations,
+great care must be taken when configuring it.
+To avoid possible misuse, the
+.Xr sysctl 8
+variable
+.Li net.inet6.ip6.keepfaith
+must be set to
+.Li 1
+prior to using the interface.
+When
+.Li net.inet6.ip6.keepfaith
+is
+.Li 0 ,
+no packets will be captured by the
+.Nm
+interface.
+.Pp
+The
+.Nm
+interface is intended to be used on routers, not on hosts.
+.\"
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr inet6 4 ,
+.Xr faithd 8
+.Rs
+.%A Jun-ichiro itojun Hagino
+.%A Kazu Yamamoto
+.%T "An IPv6-to-IPv4 transport relay translator"
+.%O RFC3142
+.Re
+.Sh HISTORY
+The FAITH IPv6-to-IPv4 TCP relay translator first appeared in the
+WIDE hydrangea IPv6 stack.
diff --git a/share/man/man4/fatm.4 b/share/man/man4/fatm.4
new file mode 100644
index 000000000000..51dc6fc0eb79
--- /dev/null
+++ b/share/man/man4/fatm.4
@@ -0,0 +1,115 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" fatm(4) man page
+.\"
+.Dd May 15, 2003
+.Dt FATM 4
+.Os
+.Sh NAME
+.Nm fatm
+.Nd "device driver for Fore PCA200E ATM interfaces"
+.Sh SYNOPSIS
+.Cd device fatm
+.Cd device utopia
+.Cd device atm
+.Pp
+.Cd options NATM
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports the FORE (now Marconi) PCA200E ATM interface cards.
+The driver interfaces with the
+.Xr natm 4
+framework,
+.Xr netgraph 4
+and HARP.
+It provides only PVC services.
+Signalling, ATMARP, ILMI and other
+higher layer protocols are implemented using
+.Xr netgraph 4
+or HARP.
+.Pp
+For configuring the card for IP see
+.Xr natmip 4 .
+The following sysctls are recognized by the driver additionally to those
+handled by
+.Xr utopia 4 :
+.Bl -tag -width indent
+.It Va hw.atm.fatm Ns Ar N Ns Va .stats
+Returns a device specific statistic list of
+.Vt uint32_t
+statistic counters.
+.It Va hw.atm.fatm Ns Ar N Ns Va .istats
+Returns a list of
+.Vt uint32_t
+with internal driver statistics.
+.It Va hw.atm.fatm Ns Ar N Ns Va .retry_tx
+If this is set packets are stuffed back into the interface's send queue when
+the cards transmit queue is found to be full.
+They are transmitted later.
+If this is not set the packets are dropped.
+It may be useful to set this
+if only UBR traffic is sent.
+.It Va hw.atm.fatm Ns Ar N Ns Va .debug
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+These are debugging flags.
+See
+.Pa src/sys/dev/fatm/if_fatmvar.h
+for the possible flags.
+.El
+.Pp
+The driver supports the media options
+.Cm sdh , noscramb
+and
+.Cm unassigned
+(see
+.Xr utopia 4 ) .
+.Sh DIAGNOSTICS
+.Bd -literal
+fatm0: <FORE PCA200E> mem 0xd5800000-0xd59fffff irq 9 at device 9.0 on pci0
+.Ed
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr natmip 4 ,
+.Xr utopia 4
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh BUGS
+These cards can CBR shape a single VCC only.
+It is currently possible to
+request more than one CBR connection.
+In this case all the timing will be
+wrong.
+See
+.Xr hatm 4
+for a better card.
diff --git a/share/man/man4/fd.4 b/share/man/man4/fd.4
new file mode 100644
index 000000000000..99a05317c4fb
--- /dev/null
+++ b/share/man/man4/fd.4
@@ -0,0 +1,105 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)fd.4 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd June 9, 1993
+.Dt FD 4
+.Os
+.Sh NAME
+.Nm fd ,
+.Nm stdin ,
+.Nm stdout ,
+.Nm stderr
+.Nd file descriptor files
+.Sh DESCRIPTION
+The files
+.Pa /dev/fd/0
+through
+.Pa /dev/fd/#
+refer to file descriptors which can be accessed through the file
+system.
+If the file descriptor is open and the mode the file is being opened
+with is a subset of the mode of the existing descriptor, the call:
+.Bd -literal -offset indent
+fd = open("/dev/fd/0", mode);
+.Ed
+.Pp
+and the call:
+.Bd -literal -offset indent
+fd = fcntl(0, F_DUPFD, 0);
+.Ed
+.Pp
+are equivalent.
+.Pp
+Opening the files
+.Pa /dev/stdin ,
+.Pa /dev/stdout
+and
+.Pa /dev/stderr
+is equivalent to the following calls:
+.Bd -literal -offset indent
+fd = fcntl(STDIN_FILENO, F_DUPFD, 0);
+fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+fd = fcntl(STDERR_FILENO, F_DUPFD, 0);
+.Ed
+.Pp
+Flags to the
+.Xr open 2
+call other than
+.Dv O_RDONLY ,
+.Dv O_WRONLY
+and
+.Dv O_RDWR
+are ignored.
+.Sh IMPLEMENTATION NOTES
+By default,
+.Pa /dev/fd
+is provided by
+.Xr devfs 5 ,
+which provides nodes for the first three file descriptors.
+Some sites may require nodes for additional file descriptors; these can be
+made available by mounting
+.Xr fdescfs 5
+on
+.Pa /dev/fd .
+.Sh FILES
+.Bl -tag -width /dev/stderr -compact
+.It Pa /dev/fd/#
+.It Pa /dev/stdin
+.It Pa /dev/stdout
+.It Pa /dev/stderr
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr devfs 5 ,
+.Xr fdescfs 5
diff --git a/share/man/man4/fdc.4 b/share/man/man4/fdc.4
new file mode 100644
index 000000000000..7fadf0a8cb19
--- /dev/null
+++ b/share/man/man4/fdc.4
@@ -0,0 +1,343 @@
+.\"
+.\" Copyright (c) 1994 Wilko Bulte
+.\" Copyright (c) 2001 Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 11, 2006
+.Dt FDC 4
+.Os
+.Sh NAME
+.Nm fdc
+.Nd "PC architecture floppy disk controller driver"
+.Sh SYNOPSIS
+.Cd device fdc
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.fdc.0.at="isa"
+.Cd hint.fdc.0.port="0x3F0"
+.Cd hint.fdc.0.irq="6"
+.Cd hint.fdc.0.drq="2"
+.Cd hint.fdc.0.flags="0x0"
+.Cd hint.fd.0.at="fdc0"
+.Cd hint.fd.0.drive="0"
+.Cd hint.fd.0.flags="0x0"
+.Cd hint.fd.1.at="fdc0"
+.Cd hint.fd.1.drive="1"
+.Cd hint.fd.1.flags="0x0"
+.Sh DESCRIPTION
+.Ss Device Usage
+This driver provides access to floppy disk drives.
+Floppy disks using
+either FM (single-density) or MFM (double or high-density) recording
+can be handled.
+.Pp
+Floppy disk controllers can connect up to four drives each.
+The
+.Nm
+driver can currently handle up to two drives per controller (or four
+drives on ACPI).
+Upon
+driver initialization, an attempt is made to find out the type of the
+floppy controller in use.
+The known controller types are either the
+original NE765 or i8272 chips, or alternatively
+.Em enhanced
+controllers that are compatible with the NE72065 or i82077 chips.
+These enhanced controllers (among other enhancements) implement a FIFO
+for floppy data transfers that will automatically be enabled once an
+enhanced chip has been detected.
+This FIFO activation can be disabled
+using the per-controller flags value of
+.Ar 0x1 .
+.Pp
+By default, this driver creates a single device node
+.Pa /dev/fd Ns Ar N
+for each attached drive with number
+.Ar N .
+For historical reasons, device nodes that use a trailing UFS-style
+partition letter (ranging from
+.Sq a
+through
+.Sq h )
+can also be accessed, which will be implemented as symbolic links to
+the main device node.
+.Pp
+Accessing the main device node will attempt to autodetect the density
+of the available medium for multi-density devices.
+Thus it is
+possible to use either a 720 KB medium or a 1440 KB medium in a
+high-density 3.5 inch standard floppy drive.
+Normally, this
+autodetection will only happen once at the first call to
+.Xr open 2
+for the device after inserting the medium.
+This assumes the drive
+offers proper changeline support so media changes can be detected by
+the driver.
+To indicate a drive that does not have the changeline support,
+this can be overridden using the per-drive device flags value of
+.Ar 0x10
+(causing each call to
+.Xr open 2
+to perform the autodetection).
+.Pp
+When trying to use a floppy device with special-density media, other
+device nodes can be created, of the form
+.Pa /dev/fd Ns Ar N . Ns Ar MMMM ,
+where
+.Ar N
+is the drive number, and
+.Ar MMMM
+is a number between one and four digits describing the device density.
+Up to 15 additional subdevices per drive can be created that way.
+The
+administrator is free to decide on a policy how to assign these
+numbers.
+The two common policies are to either implement subdevices
+numbered 1 through 15, or to use a number that describes the medium
+density in kilobytes.
+Initially, each of those devices will be
+configured to the maximal density that is possible for the drive type
+(like 1200 KB for 5.25 inch HD drives or 1440 KB for 3.5 inch HD
+drives).
+The desired density to be used on that subdevice needs to be
+configured using
+.Xr fdcontrol 8 .
+.Pp
+Drive types are configured using the lower four bits of the per-drive
+device flags.
+The following values can be specified:
+.Bl -tag -width 2n -offset indent
+.It Ar 1
+5.25 inch double-density device with 40 cylinders (360 KB native
+capacity)
+.It Ar 2
+5.25 inch high-density device with 80 cylinders (1200 KB native
+capacity)
+.It Ar 3
+3.5 inch double-density device with 80 cylinders (720 KB native
+capacity)
+.It Ar 4
+3.5 inch high-density device with 80 cylinders (1440 KB native
+capacity)
+.It Ar 5
+3.5 inch extra-density device with 80 cylinders (2880 KB native
+capacity, usage currently restricted to at most 1440 KB media)
+.It Ar 6
+Same as type 5, available for compatibility with some BIOSes
+.El
+.Pp
+On IA32 architectures, the drive type can be specified as 0 for the
+drives.
+In that case, the CMOS configuration memory will be
+consulted to obtain the value for that drive.
+The ACPI probe automatically determines these values via the _FDE and
+_FDI methods, but this can be overridden by specifying a drive type hint.
+.Pp
+Normally, each configured drive will be probed at initialization
+time, using a short seek sequence.
+This is intended to find out about
+drives that have been configured but are actually missing or
+otherwise not responding.
+(The ACPI probe method does not perform this seek.)
+In some environments (like laptops with
+detachable drives), it might be desirable to bypass this drive probe,
+and pretend a drive to be there so the driver autoconfiguration will
+work even if the drive is currently not present.
+For that purpose, a
+per-drive device flags value of
+.Ar 0x20
+needs to be specified.
+.Ss Programming Interface
+In addition to the normal read and write functionality, the
+.Nm
+driver offers a number of configurable options using
+.Xr ioctl 2 .
+In order to access any of this functionality, programmers need to
+include the header file
+.In sys/fdcio.h
+into their programs.
+The call to
+.Xr open 2
+can be performed in two possible ways.
+When opening the device
+without the
+.Dv O_NONBLOCK
+flag set, the device is opened in a normal way, which would cause the
+main device nodes to perform automatic media density selection, and which
+will yield a file descriptor that is fully available for any I/O operation
+or any of the following
+.Xr ioctl 2
+commands.
+.Pp
+When opening the device with
+.Dv O_NONBLOCK
+set, automatic media density selection will be bypassed, and the device
+remains in a half-opened state.
+No actual I/O operations are possible, but
+many of the
+.Xr ioctl 2
+commands described below can be performed.
+This mode is intended for
+access to the device without the requirement to have an accessible
+media present, like for status inquiries to the drive, or in order to
+format a medium.
+.Dv O_NONBLOCK
+needs to be cleared before I/O operations are possible on the descriptor,
+which requires a prior specification of the density using the
+.Dv FD_STYPE
+command (see below).
+Operations that are not allowed on the half-opened
+descriptor will cause an error value of
+.Er EAGAIN .
+.Pp
+The following
+.Xr ioctl 2
+commands are currently available:
+.Bl -tag -width ".Dv FD_READID"
+.It Dv FD_FORM
+Used to format a floppy disk medium.
+Third argument is a pointer to a
+.Vt "struct fd_formb"
+specifying which track to format, and which parameters to fill into
+the ID fields of the floppy disk medium.
+.It Dv FD_GTYPE
+Returns the current density definition record for the selected device.
+Third argument is a pointer to
+.Vt "struct fd_type" .
+.It Dv FD_STYPE
+Adjusts the density definition of the selected device.
+Third argument
+is a pointer to
+.Vt "struct fd_type" .
+For the fixed-density subdevices (1 through 15 per drive), this
+operation is restricted to a process with superuser privileges.
+For
+the auto-selecting subdevice 0, the operation is temporarily allowed
+to any process, but this setting will be lost again upon the next
+autoselection.
+This can be used when formatting a new medium (which
+will require to open the device using
+.Dv O_NONBLOCK ,
+and thus to later adjust the density using
+.Dv FD_STYPE ) .
+.It Dv FD_GOPTS
+Obtain the current drive options.
+Third argument is a pointer to
+.Vt int ,
+containing a bitwise union of the following possible flag values:
+.Bl -tag -width ".Dv FDOPT_NOERRLOG"
+.It Dv FDOPT_NORETRY
+Do not automatically retry operations upon failure.
+.It Dv FDOPT_NOERRLOG
+Do not cause
+.Dq "hard error"
+kernel logs for failed I/O operations.
+.It Dv FDOPT_NOERROR
+Do not indicate I/O errors when returning from
+.Xr read 2
+or
+.Xr write 2
+system calls.
+The caller is assumed to use
+.Dv FD_GSTAT
+calls in order to inquire about the success of each operation.
+This
+is intended to allow even erroneous data from bad blocks to be
+retrieved using normal I/O operations.
+.It Dv FDOPT_AUTOSEL
+Device performs automatic density selection.
+Unlike the above flags,
+this one is read-only.
+.El
+.It Dv FD_SOPTS
+Set device options, see above for their meaning.
+Third argument is a
+pointer to
+.Vt int .
+Drive options will always be cleared when closing the descriptor.
+.It Dv FD_DEBUG
+Set the driver debug level.
+Third argument is a pointer to
+.Vt int ,
+level 0 turns off all debugging.
+Only applicable if the driver has
+been configured with
+.Cd "options FDC_DEBUG" .
+.It Dv FD_CLRERR
+Clear the internal low-level error counter.
+Normally, controller-level
+I/O errors are only logged up to
+.Dv FDC_ERRMAX
+errors (currently defined to 100).
+This command resets the counter.
+Requires superuser privileges.
+.It Dv FD_READID
+Read one sector ID field from the floppy disk medium.
+Third argument is
+a pointer to
+.Vt "struct fdc_readid" ,
+where the read data will be returned.
+Can be used to analyze a floppy
+disk medium.
+.It Dv FD_GSTAT
+Return the recent floppy disk controller status, if available.
+Third
+argument is a pointer to
+.Vt "struct fdc_status" ,
+where the status registers (ST0, ST1, ST2, C, H, R, and N) are being
+returned.
+.Er EINVAL
+will be caused if no recent status is available.
+.It Dv FD_GDTYPE
+Returns the floppy disk drive type.
+Third argument is a pointer to
+.Vt "enum fd_drivetype" .
+This type is the same as being used in the per-drive configuration
+flags, or in the CMOS configuration data or ACPI namespace on IA32 systems.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/fd*" -compact
+.It Pa /dev/fd*
+floppy disk device nodes
+.El
+.Sh SEE ALSO
+.Xr fdformat 1 ,
+.Xr fdread 1 ,
+.Xr fdwrite 1 ,
+.Xr ioctl 2 ,
+.Xr open 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr fdcontrol 8
+.Sh AUTHORS
+.An -nosplit
+This man page was initially written by
+.An Wilko Bulte ,
+and later vastly rewritten by
+.An J\(:org Wunsch .
diff --git a/share/man/man4/fdt.4 b/share/man/man4/fdt.4
new file mode 100644
index 000000000000..cd3312bd0afc
--- /dev/null
+++ b/share/man/man4/fdt.4
@@ -0,0 +1,184 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Semihalf under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 12, 2010
+.Dt FDT 4
+.Os
+.Sh NAME
+.Nm fdt
+.Nd Flattened Device Tree support
+.Sh SYNOPSIS
+.Cd "options FDT"
+.Cd "makeoptions FDT_DTS_FILE=<board name>.dts"
+.Cd "options FDT_DTB_STATIC"
+.Sh DESCRIPTION
+.Em Flattened Device Tree
+is a mechanism for describing computer hardware resources, which cannot be
+probed or self enumerated, in a uniform and portable way. The primary
+consumers of this technology are
+.Em embedded systems,
+where a lot of designs are based on similar chips, but have different
+assignment of pins, memory layout, addresses bindings, interrupts routing and
+other resources.
+.Pp
+Configuration data, which cannot be self discovered in run-time, has to be
+supplied from external source. The concept of a flattened device tree is a
+platform and architecture independent approach for resolving such problems.
+The idea is inherited from Open Firmware IEEE 1275 device-tree notion, and has
+been successfully adopted by the embedded industry. The scheme works in the
+following way:
+.Bl -bullet
+.It
+Hardware platform resources are
+.Em manually
+described in a human readable text source format, where all non
+self-enumerating information is gathered.
+.It
+This source description is converted
+.Em (compiled)
+into a binary object i.e. a flattened device tree
+.Em blob
+which is passed to the kernel at boot time.
+.It
+The kernel (driver) learns about hardware resources details and dependencies
+from this [externally supplied] blob, which eliminates the need for embedding
+any information about the underlying platform hardware resources in the kernel.
+.It
+The flattened device tree mechanism in principle does not depend on any
+particular first-stage bootloader or firmware features. The only overall
+requirement for the environment is to provide a complete device tree
+description to the kernel.
+.El
+.Pp
+The
+.Nm
+layer allows any platform code in the kernel to retrieve information about
+hardware resources from a unified origin, which brings advantages to the
+embedded applications (eliminates hard-coded configuration approach, enforces
+code to be data driven and extensible) leading to easier porting and
+maintenance.
+.Sh DEFINITIONS
+.Bl -tag -width Ar
+.It Va Device tree source (DTS)
+The device tree source is a text file which describes hardware resources of a
+computer system in a human-readable form, with certain hierarchical structure
+(a tree). The default location for DTS files
+in the
+.Fx
+source repository is
+.Pa sys/boot/fdt/dts
+directory.
+.It Va Device tree blob (DTB)
+The textual device tree description (DTS file) is first converted (compiled)
+into a binary object (the device tree blob) i.e. the DTB, which is handed over
+to the final consumer (typically kernel) for parsing and processing of its
+contents.
+.It Va Device tree compiler (DTC)
+A utility program executed on the host, which transforms (compiles) a textual
+description of a device tree (DTS) into a binary object (DTB).
+.It Va Device tree bindings
+While the device tree textual description and the binary object are media to
+convey the hardware configuration information, an actual meaning and
+interpretation of the contents are defined by the device tree
+.Pa bindings .
+They are certain conventions describing definitions (encoding) of particular
+nodes in a device tree and their properties, allowed values, ranges and so on.
+Such reference conventions were provided by the legacy Open Firmware bindings,
+further supplemented by the ePAPR specification.
+.El
+.Sh "BUILDING THE WORLD"
+In order for the system to support
+.Nm
+it is required that
+.Fx
+world be built with the
+.Pa WITH_FDT
+build knob supplied either via
+.Xr src.conf 5
+or command line defined with -D.
+.Pp
+This creates the user space
+.Pa dtc
+compiler and enables
+.Nm
+support in
+.Xr loader 8 .
+.Sh "BUILDING KERNEL"
+There is a couple of options for managing
+.Nm
+support at the
+.Fx
+kernel level.
+.Bl -tag -width Ar
+.It Va options FDT
+The primary option for enabling
+.Nm
+support in the kernel. It covers all low-level and infrastructure parts of
+.Nm
+kernel support, which primarily are the
+.Xr fdtbus 4 and
+.Xr simplebus 4 drivers, as well as helper routines and libraries.
+.It Va makeoptions FDT_DTS_FILE=<board name>.dts
+Specifies a preferred (default) device tree source (DTS) file for a given
+kernel. The indicated DTS file will be converted (compiled) into a binary form
+along with building the kernel itself. The DTS file name is relative
+to the default location of DTS sources i.e.
+.Pa sys/boot/fdt/dts .
+This makeoption is not mandatory unless FDT_DTB_STATIC is also defined (see
+below).
+.It Va options FDT_DTB_STATIC
+Typically, the device tree blob (DTB) is a stand-alone file, physically
+separate from the kernel, but this option lets statically embed a
+DTB file into a kernel image. Note that when this is specified the
+FDT_DTS_FILE makeoption becomes mandatory (as there needs to be a DTS file
+specified in order to embed it into the kernel image).
+.El
+.Sh SEE ALSO
+.Xr fdtbus 4 ,
+.Xr openfirm 4 ,
+.Xr simplebus 4 ,
+.Sh STANDARDS
+IEEE Std 1275: IEEE Standard for Boot (Initialization Configuration) Firmware:
+Core Requirements and Practices
+.Pq Vt Open Firmware .
+.Pp
+Power.org Standard for Embedded Power Architecture Platform Requirements
+.Pq Vt ePAPR .
+.Sh HISTORY
+The
+.Nm
+support first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+The
+.Nm
+support was developed by Semihalf under sponsorship from the FreeBSD
+Foundation. This manual page was written by
+.An Rafal Jaworowski .
diff --git a/share/man/man4/fdtbus.4 b/share/man/man4/fdtbus.4
new file mode 100644
index 000000000000..0956c4777664
--- /dev/null
+++ b/share/man/man4/fdtbus.4
@@ -0,0 +1,87 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Semihalf under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 12, 2010
+.Dt FDTBUS 4
+.Os
+.Sh NAME
+.Nm fdtbus
+.Nd Flattened Device Tree bus driver
+.Sh SYNOPSIS
+.Cd "options FDT"
+.Sh DESCRIPTION
+The
+.Nm
+abstract bus driver is the primary connection and translation layer between
+.Xr fdt 4
+hardware resources description and
+.Fx
+native newbus device drivers framework. For an embedded system
+.Nm
+represents peripherals typically found on a highly integrated chip
+(system-on-chip).
+.Pp
+The
+.Nm
+driver provides generic, common infrastructure for all
+.Xr fdt 4 oriented device drivers, and its main responsibilities are the
+following:
+.Bl -bullet
+.It
+Creating newbus children that reflect
+.Xr fdt 4
+nodes in the flattened device tree.
+.It
+Managing SYS_RES_IRQ resources.
+.It
+Managing SYS_RES_MEMORY, SYS_RES_IOPORT resources.
+.El
+.Sh SEE ALSO
+.Xr fdt 4 ,
+.Xr openfirm 4 ,
+.Xr simplebus 4 ,
+.Sh STANDARDS
+IEEE Std 1275: IEEE Standard for Boot (Initialization Configuration) Firmware:
+Core Requirements and Practices
+.Pq Vt Open Firmware .
+.Pp
+Power.org Standard for Embedded Power Architecture Platform Requirements
+.Pq Vt ePAPR .
+.Sh HISTORY
+The
+.Nm
+support first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+The
+.Nm
+support was developed by Semihalf under sponsorship from the FreeBSD
+Foundation. This manual page was written by
+.An Rafal Jaworowski .
diff --git a/share/man/man4/ffclock.4 b/share/man/man4/ffclock.4
new file mode 100644
index 000000000000..9110c167ceb1
--- /dev/null
+++ b/share/man/man4/ffclock.4
@@ -0,0 +1,129 @@
+.\" Copyright (c) 2011 The University of Melbourne
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Julien Ridoux at the University of
+.\" Melbourne under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2011
+.Dt FFCLOCK 4
+.Os
+.Sh NAME
+.Nm FFCLOCK
+.Nd Feed-forward system clock
+.Sh SYNOPSIS
+.Cd options FFCLOCK
+.Sh DESCRIPTION
+The
+.Xr ntpd 8
+daemon has been the dominant solution for system clock synchronisation for many
+years, which has in turn influenced the design of the system clock.
+The ntpd daemon implements a feedback control algorithm which has been
+demonstrated to perform poorly in common use cases.
+.Pp
+Feed-forward clock synchronisation algorithms implemented by an appropriate
+daemon, in concert with the
+.Nm
+kernel support, have been shown to provide highly robust and accurate clock
+synchronisation.
+In addition to time keeping, the
+.Nm
+kernel mechanism provides new timestamping capabilities and the ability to
+use specialised clocks.
+Feed-forward synchronisation is also very well suited for virtualised
+environments, reducing the overhead of timekeeping in guests and ensuring
+continued smooth operation of the system clock during guest live migration.
+.Pp
+The
+.Nm
+kernel support provides feed-forward timestamping functions within the kernel
+and system calls to support feed-forward synchronisation daemons
+.Po see
+.Xr ffclock 2
+.Pc .
+.Ss Kernel Options
+The following kernel configuration options are related to
+.Nm :
+.Pp
+.Bl -tag -width ".Dv FFCLOCK" -compact
+.It Dv FFCLOCK
+Enable feed-forward clock support.
+.El
+.Ss Configuration
+When feed-forward clock support is compiled into the kernel, multiple system
+clocks become available to choose from.
+System clock configuration is possible via the
+.Va kern.sysclock
+.Xr sysctl 8
+tree which provides the following variables:
+.Bl -tag -width " " -offset indent
+.It Va kern.sysclock.active
+Name of the current active system clock which is serving time.
+Set to one of the names in
+.Va kern.sysclock.available
+in order to change the default active system clock.
+.It Va kern.sysclock.available
+Lists the names of available system clocks
+.Po
+read only
+.Pc .
+.El
+.Pp
+Feed-forward system clock configuration is possible via the
+.Va kern.sysclock.ffclock
+sysctl tree which provides the following variables:
+.Bl -tag -width " " -offset indent
+.It Va kern.sysclock.ffclock.version
+Feed-forward clock kernel version
+.Po
+read only
+.Pc .
+.It Va kern.sysclock.ffclock.ffcounter_bypass
+Use reliable hardware timecounter as the feed-forward counter.
+Will eventually be useful for virtualised environment like
+.Xr xen 4 ,
+but currently does nothing.
+.El
+.Sh SEE ALSO
+.Xr clock_gettime 2 ,
+.Xr ffclock 2 ,
+.Xr bpf 4 ,
+.Xr timecounters 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+Feed-forward clock support first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The feed-forward clock support was written by
+.An Julien Ridoux Aq jridoux@unimelb.edu.au
+in collaboration with
+.An Darryl Veitch Aq dveitch@unimelb.edu.au
+at the University of Melbourne under sponsorship from the FreeBSD Foundation.
+.Pp
+This manual page was written by
+.An Julien Ridoux Aq jridoux@unimelb.edu.au
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man4/firewire.4 b/share/man/man4/firewire.4
new file mode 100644
index 000000000000..9f909f28e67a
--- /dev/null
+++ b/share/man/man4/firewire.4
@@ -0,0 +1,119 @@
+.\" Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the acknowledgement as bellow:
+.\"
+.\" This product includes software developed by K. Kobayashi and H. Shimokawa
+.\"
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 1, 2006
+.Dt FIREWIRE 4
+.Os
+.Sh NAME
+.Nm firewire
+.Nd IEEE1394 High-performance Serial Bus
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firewire"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+firewire_load="YES"
+.Ed
+.Sh DESCRIPTION
+.Fx
+provides machine-independent bus support and raw drivers for
+.Nm
+interfaces.
+.Pp
+The
+.Nm
+driver consists of two layers: the controller and the
+bus layer.
+The controller attaches to a physical bus
+(like
+.Xr pci 4 ) .
+The
+.Nm
+bus attaches to the controller.
+Additional drivers can be attached to the bus.
+.Pp
+Up to 63 devices, including the host itself, can be attached to
+a
+.Nm
+bus.
+The root node is dynamically assigned with a PHY device function.
+Also, the other
+.Nm
+bus specific parameters,
+e.g., node ID, cycle master, isochronous resource manager and bus
+manager, are dynamically assigned, after bus reset is initiated.
+On the
+.Nm
+bus, every device is identified by an EUI 64 address.
+.Sh FILES
+.Bl -tag -compact
+.It Pa /dev/fw0.0
+.It Pa /dev/fwmem0.0
+.El
+.Sh SEE ALSO
+.Xr fwe 4 ,
+.Xr fwip 4 ,
+.Xr fwohci 4 ,
+.Xr pci 4 ,
+.Xr sbp 4 ,
+.Xr eui64 5 ,
+.Xr fwcontrol 8 ,
+.Xr kldload 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Katsushi Kobayashi
+and
+.An Hidetoshi Shimokawa
+for the
+.Fx
+project.
+.Sh BUGS
+See
+.Xr fwohci 4
+for security notes.
diff --git a/share/man/man4/fpa.4 b/share/man/man4/fpa.4
new file mode 100644
index 000000000000..097442998e8c
--- /dev/null
+++ b/share/man/man4/fpa.4
@@ -0,0 +1,58 @@
+.\"
+.\" Copyright (c) 1995, Matt Thomas
+.\" All rights reserved.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 13, 1995
+.Dt FPA 4
+.Os
+.Sh NAME
+.Nm fpa ,
+.Nm fea
+.Nd device drivers for DEC FDDI controllers
+.Sh SYNOPSIS
+.Cd "device fpa"
+.Cd "device fea"
+.Pp
+.Fx
+only:
+.Cd "device fddi"
+.Sh DESCRIPTION
+The
+.Nm
+and
+.Nm fea
+device drivers provide support for the DEC DEFPA PCI FDDI Controller and
+the DEC DEFEA EISA FDDI Controller, respectively.
+All variants of either
+controller are supported including the DAS and SAS configurations.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "fea%d: error: desired IRQ of %d does not match device's actual IRQ (%d)"
+The device probe detected that the DEFEA board is configured for a different
+interrupt than the one specified in the kernel configuration file.
+.It "fea%d: error: memory not enabled! ECU reconfiguration required"
+The device probe found that no device memory had been configured on the
+DEFEA.
+Although the DEFEA can be configured with no device memory, this driver
+requires a minimum of 1K device memory to be set up.
+The ECU (EISA Configuration
+Utility) will need to be run to change the settings.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+The
+.Nm
+and
+.Nm fea
+device drivers and this manual page were written by
+.An Matt Thomas .
+.Sh CAVEATS
+Normally, the device driver will not enable the reception of SMT frames.
+However if the IFF_LINK1 flag is set, the device driver will enable the
+reception of SMT frames and pass them up to the Berkeley Packet Filter for
+processing.
diff --git a/share/man/man4/fwe.4 b/share/man/man4/fwe.4
new file mode 100644
index 000000000000..76fc1ac4f667
--- /dev/null
+++ b/share/man/man4/fwe.4
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2002 Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.\"
+.Dd July 16, 2005
+.Dt FWE 4
+.Os
+.Sh NAME
+.Nm fwe
+.Nd "Ethernet emulation driver for FireWire"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firewire"
+.Cd "device fwe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_fwe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides non-standard Ethernet emulation over FireWire (IEEE 1394).
+.Pp
+.Xr firewire 4
+and
+.Xr fwohci 4
+must be configured in the kernel as well.
+.Pp
+This driver exploits asynchronous stream over IEEE 1394 to carry Ethernet
+frames.
+The stream channel can be specified by
+the
+.Va hw.firewire.fwe.stream_ch
+.Xr sysctl 8 .
+.Pp
+This driver supports
+.Xr polling 4
+as well if it is compiled with the
+.Dv DEVICE_POLLING
+option.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr firewire 4 ,
+.Xr fwip 4 ,
+.Xr fwohci 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr ifconfig 8 ,
+.Xr kldload 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+driver and this manual page were written by
+.An Hidetoshi Shimokawa .
+.Sh BUGS
+This driver emulates Ethernet in a very adhoc way and it does not reserve a
+stream channel using an isochronous manager.
+Note that this driver uses a protocol which is very different from RFC 2734
+(IPv4 over IEEE 1394).
diff --git a/share/man/man4/fwip.4 b/share/man/man4/fwip.4
new file mode 100644
index 000000000000..c2c9f05bb7eb
--- /dev/null
+++ b/share/man/man4/fwip.4
@@ -0,0 +1,95 @@
+.\" Copyright (c) 2004 Doug Rabson
+.\" Copyright (c) 2002 Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt FWIP 4
+.Os
+.Sh NAME
+.Nm fwip
+.Nd "IP over FireWire driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firewire"
+.Cd "device fwip"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+firewire_load="YES"
+if_fwip_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides standard IP over FireWire (IEEE 1394) based on the
+protocols described in RFC 2734 and RFC 3146.
+.Pp
+The
+.Xr firewire 4
+and
+.Xr fwohci 4
+drivers
+must be configured in the kernel as well.
+.Pp
+This driver supports
+.Xr polling 4
+as well if it is compiled with the
+.Dv DEVICE_POLLING
+option.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr firewire 4 ,
+.Xr fwe 4 ,
+.Xr fwohci 4 ,
+.Xr netintro 4 ,
+.Xr polling 4 ,
+.Xr ifconfig 8 ,
+.Xr kldload 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An Doug Rabson ,
+based on earlier work by
+.An Hidetoshi Shimokawa .
+.Sh BUGS
+This driver currently does not support the MCAP protocol for multicast
+IP over FireWire.
+Multicast packets are treated as broadcast packets which is sufficient
+for most trivial uses of multicast.
diff --git a/share/man/man4/fwohci.4 b/share/man/man4/fwohci.4
new file mode 100644
index 000000000000..aa9aff3055f2
--- /dev/null
+++ b/share/man/man4/fwohci.4
@@ -0,0 +1,158 @@
+.\" Copyright (c) 1998,1999,2000 Katsushi Kobayashi and Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the acknowledgement as bellow:
+.\"
+.\" This product includes software developed by K. Kobayashi and H. Shimokawa
+.\"
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.\"
+.Dd March 3, 2008
+.Dt FWOHCI 4
+.Os
+.Sh NAME
+.Nm fwohci
+.Nd OHCI FireWire chipset device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firewire"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+firewire_load="YES"
+.Ed
+.Pp
+To disable physical access (see
+.Sx BUGS
+section for detail), put the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.firewire.phydma_enable=0
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver provides support for PCI/CardBus FireWire interface cards.
+The driver supports the following IEEE 1394 OHCI chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AHA-894x/AIC-5800
+.It
+Apple Pangea
+.It
+Apple UniNorth
+.It
+Intel 82372FB
+.It
+IOGEAR GUF320
+.It
+Lucent / Agere FW322/323
+.It
+NEC uPD72861
+.It
+NEC uPD72870
+.It
+NEC uPD72871/2
+.It
+NEC uPD72873
+.It
+NEC uPD72874
+.It
+National Semiconductor CS4210
+.It
+Ricoh R5C551
+.It
+Ricoh R5C552
+.It
+Sony CX3022
+.It
+Sony i.LINK (CXD3222)
+.It
+Sun PCIO-2 (RIO 1394)
+.It
+Texas Instruments PCI4410A
+.It
+Texas Instruments PCI4450
+.It
+Texas Instruments PCI4451
+.It
+Texas Instruments TSB12LV22
+.It
+Texas Instruments TSB12LV23
+.It
+Texas Instruments TSB12LV26
+.It
+Texas Instruments TSB43AA22
+.It
+Texas Instruments TSB43AB21/A/AI/A-EP
+.It
+Texas Instruments TSB43AB22/A
+.It
+Texas Instruments TSB43AB23
+.It
+Texas Instruments TSB82AA2
+.It
+VIA Fire II (VT6306)
+.El
+.Sh SEE ALSO
+.Xr firewire 4 ,
+.Xr fwe 4 ,
+.Xr fwip 4 ,
+.Xr sbp 4 ,
+.Xr fwcontrol 8 ,
+.Xr kldload 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Katsushi Kobayashi
+and
+.An Hidetoshi Shimokawa .
+.Sh BUGS
+The driver allows physical access from any nodes on the bus by default.
+This means that any devices on the bus can read and modify any memory space
+which can be accessed by an IEEE 1394 OHCI chip.
+It is allowed mostly for
+.Xr sbp 4
+devices.
+This should be changed to allow it only for specific devices.
+Anyway, FireWire is a bus and not expected to be connected with
+un-trustable devices because a node can monitor all the traffic.
diff --git a/share/man/man4/fxp.4 b/share/man/man4/fxp.4
new file mode 100644
index 000000000000..521c326ed09c
--- /dev/null
+++ b/share/man/man4/fxp.4
@@ -0,0 +1,220 @@
+.\"
+.\" Copyright (c) 1997 David E. O'Brien
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 26, 2010
+.Dt FXP 4
+.Os
+.Sh NAME
+.Nm fxp
+.Nd "Intel EtherExpress PRO/100 Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device fxp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_fxp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Ethernet adapters based on the Intel
+i82557, i82558, i82559, i82550, and i82562 chips.
+The driver supports TCP/UDP/IP checksum offload for both transmit
+and receive on i82550 and i82551.
+On i82559 only TCP/UDP checksum offload for receive is supported.
+TCP segmentation offload (TSO) for IPv4 as well as VLAN hardware
+tag insertion/stripping is supported on i82550 and i82551.
+Wake On Lan (WOL) support is provided on all controllers
+except i82557, i82259ER and early i82558 revisions.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width "10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The autoselected mode can be overridden by adding the media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width "full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+Note that 100baseTX media type is not available on the Pro/10.
+For further information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+The
+.Nm
+driver supports reception and transmission of extended frames
+for
+.Xr vlan 4 .
+This capability of
+.Nm
+can be controlled by means of the
+.Cm vlanmtu
+parameter
+to
+.Xr ifconfig 8 .
+.Pp
+The
+.Nm
+driver also supports a special link option:
+.Bl -tag -width link0
+.It Cm link0
+Some chip revisions have loadable microcode which can be used to reduce the
+interrupt load on the host cpu.
+Not all boards have microcode support.
+Setting the
+.Cm link0
+flag with
+.Xr ifconfig 8
+will download the microcode to the chip if it is available.
+.El
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Intel EtherExpress PRO/10
+.It
+Intel InBusiness 10/100
+.It
+Intel PRO/100B / EtherExpressPRO/100 B PCI Adapter
+.It
+Intel PRO/100+ Management Adapter
+.It
+Intel PRO/100 VE Desktop Adapter
+.It
+Intel PRO/100 VM Network Connection
+.It
+Intel PRO/100 M Desktop Adapter
+.It
+Intel PRO/100 S Desktop, Server and Dual-Port Server Adapters
+.It
+Contec C-NET(PI)-100TX (PC-98)
+.It
+NEC PC-9821Ra20, Rv20, Xv13, Xv20 internal 100Base-TX (PC-98)
+.It
+NEC PC-9821X-B06 (PC-98)
+.It
+Many on-board network interfaces on Intel motherboards
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+The following variables are available as both
+.Xr loader 8
+tunables and
+.Xr sysctl 8
+variables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.fxp.%d.int_delay
+Maximum amount of time, in microseconds, that an interrupt may
+be delayed in an attempt to coalesce interrupts.
+This is only effective if the Intel microcode is loaded.
+The accepted range is 300 to 3000, the default is 1000.
+.It Va dev.fxp.%d.bundle_max
+Number of packets that will be bundled, before an interrupt is
+generated.
+This is only effective if the Intel microcode is loaded.
+The accepted range is 1 to 65535, the default is 6.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as
+.Xr sysctl 8
+variables.
+.Bl -tag -width "xxxxxx"
+.It Va dev.fxp.%d.rnr
+This is a read-only variable and shows the number of events of
+RNR (resource not ready).
+.It Va dev.fxp.%d.stats
+This is a read-only variable and displays useful MAC counters
+maintained in the driver.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "fxp%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "fxp%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "fxp%d: Failed to malloc memory"
+There are not enough mbuf's available for allocation.
+.It "fxp%d: device timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "fxp%d: Microcode loaded, int_delay: %d usec bundle_max: %d"
+The chip has successfully downloaded the microcode, and changed the
+parameterized values to the given settings.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An David Greenman .
+It has then been updated to use the busdma API and made endian-clean by
+.An Maxime Henrion .
+This manual page was written by
+.An David E. O'Brien .
diff --git a/share/man/man4/gbde.4 b/share/man/man4/gbde.4
new file mode 100644
index 000000000000..2b868e555482
--- /dev/null
+++ b/share/man/man4/gbde.4
@@ -0,0 +1,304 @@
+.\"
+.\" Copyright (c) 2002 Poul-Henning Kamp
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Poul-Henning Kamp
+.\" and NAI Labs, the Security Research Division of Network Associates, Inc.
+.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 19, 2002
+.Dt GBDE 4
+.Os
+.Sh NAME
+.Nm gbde
+.Nd Geom Based Disk Encryption
+.Sh SYNOPSIS
+.Cd "options GEOM_BDE"
+.Sh DESCRIPTION
+.Bf -symbolic
+NOTICE:
+Please be aware that this code has not yet received much review
+and analysis by qualified cryptographers and therefore should be considered
+a slightly suspect experimental facility.
+.Pp
+We cannot at this point guarantee that the on-disk format will not change
+in response to reviews or bug-fixes, so potential users are advised to
+be prepared that
+.Xr dump 8 Ns / Ns Xr restore 8
+based migrations may be called for in the future.
+.Ef
+.Pp
+The objective of this facility is to provide a high degree of
+denial of access to the contents of a
+.Dq cold
+storage device.
+.Pp
+Be aware that if the computer is compromised while up and running
+.Em and
+the storage device is actively attached and opened with a valid
+pass-phrase, this facility offers no protection or denial of access
+to the contents of the storage device.
+.Pp
+If, on the other hand, the device is
+.Dq cold ,
+it should present a formidable
+challenge for an attacker to gain access to the contents in the absence of
+a valid pass-phrase.
+.Pp
+Four cryptographic barriers must be passed to gain access to the data,
+and only a valid pass-phrase will yield this access.
+.Pp
+When the pass-phrase is entered, it is hashed with SHA2 into a 512 bit
+.Dq key-material .
+This is a way of producing cryptographic usable keys from a typically
+.No all- Ns Tn ASCII
+pass-phrase of an unpredictable user-selected length.
+.Ss First barrier: the location of the \&"lock-sector".
+During initialization, up to four independent but mutually aware
+.Dq lock
+sectors are written to the device in randomly chosen
+locations.
+These lock-sectors contain the 2048 random bit master-key and a number
+of parameters of the layout geometry (more on this later).
+Since the entire device will contain isotropic data, there is no
+short-cut to rapidly determine which sequence of bytes contain a lock-sector.
+.Pp
+To locate a lock-sector, a small piece of data called the
+.Dq metadata
+and the key-material must be available.
+The key-material decrypts the
+metadata, which contains the byte offset on the device where the
+corresponding lock-sector is located.
+If the metadata is lost or unavailable but the key-material is at
+hand, it would be feasible to do a brute force scan where each byte offset
+of the device is checked to see if it contains the lock-sector data.
+.Ss Second barrier: decryption of the master-key using key-material.
+The lock-sector contains an encrypted copy of an architecture neutral
+byte-sequence which encodes the fields of the lock-structure.
+The order in which these fields are encoded is determined from the key-material.
+The encoded byte stream is encrypted with 256bit AES in CBC mode.
+.Ss Third barrier: decryption of the sector key.
+For each sector, an MD5 hash over a
+.Dq salt
+from the lock-sector and the sector number is used to
+.Dq cherry-pick
+a subset of the master key,
+which hashed together with the sector offset through MD5 produces the
+.Dq kkey ,
+the key which encrypts the sector key.
+.Ss Fourth barrier: decryption of the sector data.
+The actual payload of the sector is encrypted with 128 bit AES in CBC mode
+using a single-use random bits key.
+.Ss Examining the reverse path
+Assuming an attacker knows an amount of plaintext and has managed to
+locate the corresponding encrypted sectors on the device, gaining access
+to the plaintext context of other sectors is a daunting task:
+.Pp
+First he will have to derive from the encrypted sector and the known plain
+text the sector key(s) used.
+At the time of writing, it has been speculated that it could maybe be
+possible to break open AES in only 2^80 operations; even so, that is still
+a very impossible task.
+.Pp
+Armed with one or more sector keys, our patient attacker will then go
+through essentially the same exercise, using the sector key and the
+encrypted sector key to find the key used to encrypt the sector key.
+.Pp
+Armed with one or more of these
+.Dq kkeys ,
+our attacker has to
+run them backwards through MD5.
+Even though he knows that the input to MD5 was 24 bytes and has the value
+of 8 of these bytes from the sector number, he is still faced with 2^128
+equally likely possibilities.
+.Pp
+Having successfully done that, our attacker has successfully discovered
+up to 16 bytes of the master-key, but is still unaware which 16 bytes,
+and in which other sectors any of these known bytes contribute to the kkey.
+.Pp
+To unravel the last bit, the attacker has to guess the 16 byte random-bits
+salt stored in the lock-sector to recover the indexes into the masterkey.
+.Pp
+Any attacker with access to the necessary machine power to even attempt
+this attack will be better off attempting to brute-force the pass-phrase.
+.Ss Positive denial facilities
+Considering the infeasibility of the above attack,
+gaining access to the pass-phrase will be of paramount importance for an
+attacker,
+and a number of scenarios can be imagined where undue pressure will be
+applied to an individual to divulge the pass-phrase.
+.Pp
+A
+.Dq Blackening
+feature provides a way for the user, given a moment of
+opportunity, to destroy the master-key in such a way that the pass-phrase
+will be acknowledged as good but access to the data will still be
+denied.
+.Ss A practical analogy
+For persons who think cryptography is only slightly more interesting than
+watching silicon sublimate the author humbly offers this analogy to the
+keying scheme for a protected device:
+.Pp
+Imagine an installation with a vault with walls of several hundred meters
+thick solid steel.
+This vault can only be feasibly accessed using the
+single key, which has a complexity comparable to a number with 600 digits.
+.Pp
+This key exists in four copies, each of which is stored in one of
+four small safes, each of which can be opened
+with unique key which has a complexity comparable to an 80 digit
+number.
+.Pp
+In addition to the masterkey, each of the four safes also contains
+the exact locations of all four key-safes which are located in
+randomly chosen places on the outside surface of the vault where they
+are practically impossible to detect when they are closed.
+.Pp
+Finally, each safe contains four switches which are wired to a bar
+of dynamite inside each of the four safes.
+.Pp
+In addition to this, a keyholder after opening his key-safe is
+also able to install a copy of the master-key and re-key any of
+key-safes (including his own).
+.Pp
+In normal use, the user will open the safe for which he has the key,
+take out the master-key and access the vault.
+When done, he will lock up the master-key in the safe again.
+.Pp
+If a keyholder-X for some reason distrusts keyholder-Y, she
+has the option of opening her own safe, flipping one of the switches
+and detonating the bar of dynamite in safe-Y.
+This will obliterate the master-key in that safe and thereby deny
+keyholder-Y access to the vault.
+.Pp
+Should the facility come under attack, any of the keyholders can detonate
+all four bars of dynamite and thereby make sure that access to the
+vault is denied to everybody, keyholders and attackers alike.
+Should the facility fall to the enemy, and a keyholder be forced to apply
+his personal key, he can do so in confidence that the contents of his safe
+will not yield access to the vault, and the enemy will hopefully realize
+that applying further pressure on the personnel will not give access to
+the vault.
+.Pp
+The final point to make here is that it is perfectly possible to
+make a detached copy of any one of these keys, including the master
+key, and deposit or hide it as one sees fit.
+.Ss Steganography support
+When the device is initialized, it is possible to restrict the encrypted
+data to a single contiguous area of the device.
+If configured with care, this area could masquerade as some sort of
+valid data or as random trash left behind by the systems operation.
+.Pp
+This can be used to offer a plausible deniability of existence, where
+it will be impossible to prove that this specific area of the device
+is in fact used to store encrypted data and not just random junk.
+.Pp
+The main obstacle in this is that the output from any encryption algorithm
+worth its salt is so totally random looking that it stands out like a sore
+thumb amongst practically any other sort of data which contains at least
+some kind of structure or identifying byte sequences.
+.Pp
+Certain file formats like ELF contain multiple distinct sections, and it
+would be possible to locate things just right in such a way that a device
+contains a partition with a file system with a large executable,
+.Pq Dq "a backup copy of my kernel"
+where a non-loaded ELF section is laid out
+consecutively on the device and thereby could be used to contain a
+.Nm
+encrypted device.
+.Pp
+Apart from the ability to instruct
+.Nm
+which those sectors are, no support is provided for creating such a setup.
+.Ss Deployment suggestions
+For personal use, it may be wise to make a backup copy of the masterkey
+or use one of the four keys as a backup.
+Fitting protection of this key is up to yourself, your local circumstances and
+your imagination.
+.Pp
+For company or institutional use, it is strongly advised to make a copy
+of the master-key and put it under whatever protection you have at your
+means.
+If you fail to do this, a disgruntled employee can deny you access to
+the data
+.Dq "by accident" .
+(The employee can still intentionally deny access by applying another
+encryption scheme to the data, but that problem has no technical solution.)
+.Ss Cryptographic strength
+This section lists the specific components which contribute to the cryptographic
+strength of
+.Nm .
+.Pp
+The payload is encrypted with AES in CBC mode using a 128 bit random
+single-use key
+.Pq Dq "the skey" .
+AES is well documented.
+.Pp
+No IV is used in the encryption of the sectors, the assumption being
+that since the key is random bits and single-use, an IV adds nothing to the
+security of AES.
+.Pp
+The random key is produced with
+.Xr arc4rand 9
+which is believed to do a respectable job at producing unpredictable bytes.
+.Pp
+The skey is stored on the device in a location which can be derived from
+the location of the encrypted payload data.
+The stored copy is encrypted with AES in CBC mode using a 128 bit key
+.Pq Dq "the kkey"
+derived
+from a subset of the master key chosen by the output of an MD5 hash
+over a 16 byte random bit static salt and the sector offset.
+Up to 6.25% of the masterkey (16 bytes out of 2048 bits) will be selected
+and hashed through MD5 with the sector offset to generate the kkey.
+.Pp
+Up to four copies of the master-key and associated geometry information
+is stored on the device in static randomly chosen sectors.
+The exact location inside the sector is randomly chosen.
+The order in which the fields are encoded depends on the key-material.
+The encoded byte-stream is encrypted with AES in CBC mode using 256 bit
+key-material.
+.Pp
+The key-material is derived from the user-entered pass-phrase using
+512 bit SHA2.
+.Pp
+No chain is stronger than its weakest link, which usually is poor pass-phrases.
+.Sh SEE ALSO
+.Xr gbde 8
+.Sh HISTORY
+This software was developed for the
+.Fx
+Project by
+.An Poul-Henning Kamp
+and NAI Labs, the Security Research Division of Network Associates, Inc.\&
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the
+DARPA CHATS research program.
+.Sh AUTHORS
+.An "Poul-Henning Kamp" Aq phk@FreeBSD.org
diff --git a/share/man/man4/gdb.4 b/share/man/man4/gdb.4
new file mode 100644
index 000000000000..b92958b209b2
--- /dev/null
+++ b/share/man/man4/gdb.4
@@ -0,0 +1,603 @@
+.\" Copyright (c) 2003 Greg Lehey
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2005
+.Dt GDB 4
+.Os
+.Sh NAME
+.Nm gdb
+.Nd external kernel debugger
+.Sh SYNOPSIS
+.Cd "makeoptions DEBUG=-g"
+.Cd "options DDB"
+.Sh DESCRIPTION
+The
+.Nm
+kernel debugger is a variation of
+.Xr gdb 1
+which understands some aspects of the
+.Fx
+kernel environment.
+It can be used in a number of ways:
+.Bl -bullet
+.It
+It can be used to examine the memory of the processor on which it runs.
+.It
+It can be used to analyse a processor dump after a panic.
+.It
+It can be used to debug another system interactively via a serial or firewire
+link.
+In this mode, the processor can be stopped and single stepped.
+.It
+With a firewire link, it can be used to examine the memory of a remote system
+without the participation of that system.
+In this mode, the processor cannot be stopped and single stepped, but it can be
+of use when the remote system has crashed and is no longer responding.
+.El
+.Pp
+When used for remote debugging,
+.Nm
+requires the presence of the
+.Xr ddb 4
+kernel debugger.
+Commands exist to switch between
+.Nm
+and
+.Xr ddb 4 .
+.Sh PREPARING FOR DEBUGGING
+When debugging kernels, it is practically essential to have built a kernel with
+debugging symbols
+.Pq Cd "makeoptions DEBUG=-g" .
+It is easiest to perform operations from the kernel build directory, by default
+.Pa /usr/obj/usr/src/sys/GENERIC .
+.Pp
+First, ensure you have a copy of the debug macros in the directory:
+.Pp
+.Dl "make gdbinit"
+.Pp
+This command performs some transformations on the macros installed in
+.Pa /usr/src/tools/debugscripts
+to adapt them to the local environment.
+.Ss "Inspecting the environment of the local machine"
+To look at and change the contents of the memory of the system you are running
+on,
+.Pp
+.Dl "gdb -k -wcore kernel.debug /dev/mem"
+.Pp
+In this mode, you need the
+.Fl k
+flag to indicate to
+.Xr gdb 1
+that the
+.Dq "dump file"
+.Pa /dev/mem
+is a kernel data file.
+You can look at live data, and if you include the
+.Fl wcore
+option, you can change it at your peril.
+The system does not stop (obviously), so a number of things will not work.
+You can set breakpoints, but you cannot
+.Dq continue
+execution, so they will not work.
+.Ss "Debugging a crash dump"
+By default, crash dumps are stored in the directory
+.Pa /var/crash .
+Investigate them from the kernel build directory with:
+.Pp
+.Dl "gdb -k kernel.debug /var/crash/vmcore.29"
+.Pp
+In this mode, the system is obviously stopped, so you can only look at it.
+.Ss "Debugging a live system with a remote link"
+In the following discussion, the term
+.Dq "local system"
+refers to the system running the debugger, and
+.Dq "remote system"
+refers to the live system being debugged.
+.Pp
+To debug a live system with a remote link, the kernel must be compiled with the
+option
+.Cd "options DDB" .
+The option
+.Cd "options BREAK_TO_DEBUGGER"
+enables the debugging machine stop the debugged machine once a connection has
+been established by pressing
+.Ql ^C .
+.Ss "Debugging a live system with a remote serial link"
+When using a serial port for the remote link on the i386 platform, the serial
+port must be identified by setting the flag bit
+.Li 0x80
+for the specified interface.
+Generally, this port will also be used as a serial console (flag bit
+.Li 0x10 ) ,
+so the entry in
+.Pa /boot/device.hints
+should be:
+.Pp
+.Dl hint.sio.0.flags="0x90"
+.Ss "Debugging a live system with a remote firewire link"
+As with serial debugging, to debug a live system with a firewire link, the
+kernel must be compiled with the option
+.Cd "options DDB" .
+.Pp
+A number of steps must be performed to set up a firewire link:
+.Bl -bullet
+.It
+Ensure that both systems have
+.Xr firewire 4
+support, and that the kernel of the remote system includes the
+.Xr dcons 4
+and
+.Xr dcons_crom 4
+drivers.
+If they are not compiled into the kernel, load the KLDs:
+.Pp
+.Dl "kldload firewire"
+.Pp
+On the remote system only:
+.Bd -literal -offset indent
+kldload dcons
+kldload dcons_crom
+.Ed
+.Pp
+You should see something like this in the
+.Xr dmesg 8
+output of the remote system:
+.Bd -literal -offset indent
+fwohci0: BUS reset
+fwohci0: node_id=0x8800ffc0, gen=2, non CYCLEMASTER mode
+firewire0: 2 nodes, maxhop <= 1, cable IRM = 1
+firewire0: bus manager 1
+firewire0: New S400 device ID:00c04f3226e88061
+dcons_crom0: <dcons configuration ROM> on firewire0
+dcons_crom0: bus_addr 0x22a000
+.Ed
+.Pp
+It is a good idea to load these modules at boot time with the following entry in
+.Pa /boot/loader.conf :
+.Pp
+.Dl dcons_crom_enable="YES"
+.Pp
+This ensures that all three modules are loaded.
+There is no harm in loading
+.Xr dcons 4
+and
+.Xr dcons_crom 4
+on the local system, but if you only want to load the
+.Xr firewire 4
+module, include the following in
+.Pa /boot/loader.conf :
+.Pp
+.Dl firewire_enable="YES"
+.It
+Next, use
+.Xr fwcontrol 8
+to find the firewire node corresponding to the remote machine.
+On the local machine you might see:
+.Bd -literal -offset indent
+# fwcontrol
+2 devices (info_len=2)
+node EUI64 status
+ 1 0x00c04f3226e88061 0
+ 0 0x000199000003622b 1
+.Ed
+.Pp
+The first node is always the local system, so in this case, node 0 is the remote
+system.
+If there are more than two systems, check from the other end to find which node
+corresponds to the remote system.
+On the remote machine, it looks like this:
+.Bd -literal -offset indent
+# fwcontrol
+2 devices (info_len=2)
+node EUI64 status
+ 0 0x000199000003622b 0
+ 1 0x00c04f3226e88061 1
+.Ed
+.It
+Next, establish a firewire connection with
+.Xr dconschat 8 :
+.Pp
+.Dl "dconschat -br -G 5556 -t 0x000199000003622b"
+.Pp
+.Li 0x000199000003622b
+is the EUI64 address of the remote node, as determined from the output of
+.Xr fwcontrol 8
+above.
+When started in this manner,
+.Xr dconschat 8
+establishes a local tunnel connection from port
+.Li localhost:5556
+to the remote debugger.
+You can also establish a console port connection with the
+.Fl C
+option to the same invocation
+.Xr dconschat 8 .
+See the
+.Xr dconschat 8
+manpage for further details.
+.Pp
+The
+.Xr dconschat 8
+utility
+does not return control to the user.
+It displays error messages and console output for the remote system, so it is a
+good idea to start it in its own window.
+.It
+Finally, establish connection:
+.Bd -literal -offset indent
+# gdb kernel.debug
+GNU gdb 5.2.1 (FreeBSD)
+.Em "(political statements omitted)"
+Ready to go. Enter 'tr' to connect to the remote target
+with /dev/cuad0, 'tr /dev/cuad1' to connect to a different port
+or 'trf portno' to connect to the remote target with the firewire
+interface. portno defaults to 5556.
+
+Type 'getsyms' after connection to load kld symbols.
+
+If you are debugging a local system, you can use 'kldsyms' instead
+to load the kld symbols. That is a less obnoxious interface.
+(gdb) trf
+0xc21bd378 in ?? ()
+.Ed
+.Pp
+The
+.Ic trf
+macro assumes a connection on port 5556.
+If you want to use a different port (by changing the invocation of
+.Xr dconschat 8
+above), use the
+.Ic tr
+macro instead.
+For example, if you want to use port 4711, run
+.Xr dconschat 8
+like this:
+.Pp
+.Dl "dconschat -br -G 4711 -t 0x000199000003622b"
+.Pp
+Then establish connection with:
+.Bd -literal -offset indent
+(gdb) tr localhost:4711
+0xc21bd378 in ?? ()
+.Ed
+.El
+.Ss "Non-cooperative debugging a live system with a remote firewire link"
+In addition to the conventional debugging via firewire described in the previous
+section, it is possible to debug a remote system without its cooperation, once
+an initial connection has been established.
+This corresponds to debugging a local machine using
+.Pa /dev/mem .
+It can be very useful if a system crashes and the debugger no longer responds.
+To use this method, set the
+.Xr sysctl 8
+variables
+.Va hw.firewire.fwmem.eui64_hi
+and
+.Va hw.firewire.fwmem.eui64_lo
+to the upper and lower halves of the EUI64 ID of the remote system,
+respectively.
+From the previous example, the remote machine shows:
+.Bd -literal -offset indent
+# fwcontrol
+2 devices (info_len=2)
+node EUI64 status
+ 0 0x000199000003622b 0
+ 1 0x00c04f3226e88061 1
+.Ed
+.Pp
+Enter:
+.Bd -literal -offset indent
+# sysctl -w hw.firewire.fwmem.eui64_hi=0x00019900
+hw.firewire.fwmem.eui64_hi: 0 -> 104704
+# sysctl -w hw.firewire.fwmem.eui64_lo=0x0003622b
+hw.firewire.fwmem.eui64_lo: 0 -> 221739
+.Ed
+.Pp
+Note that the variables must be explicitly stated in hexadecimal.
+After this, you can examine the remote machine's state with the following input:
+.Bd -literal -offset indent
+# gdb -k kernel.debug /dev/fwmem0.0
+GNU gdb 5.2.1 (FreeBSD)
+.Em "(messages omitted)"
+Reading symbols from /boot/kernel/dcons.ko...done.
+Loaded symbols for /boot/kernel/dcons.ko
+Reading symbols from /boot/kernel/dcons_crom.ko...done.
+Loaded symbols for /boot/kernel/dcons_crom.ko
+#0 sched_switch (td=0xc0922fe0) at /usr/src/sys/kern/sched_4bsd.c:621
+0xc21bd378 in ?? ()
+.Ed
+.Pp
+In this case, it is not necessary to load the symbols explicitly.
+The remote system continues to run.
+.Sh COMMANDS
+The user interface to
+.Nm
+is via
+.Xr gdb 1 ,
+so
+.Xr gdb 1
+commands also work.
+This section discusses only the extensions for kernel debugging that get
+installed in the kernel build directory.
+.Ss "Debugging environment"
+The following macros manipulate the debugging environment:
+.Bl -tag -width indent
+.It Ic ddb
+Switch back to
+.Xr ddb 4 .
+This command is only meaningful when performing remote debugging.
+.It Ic getsyms
+Display
+.Ic kldstat
+information for the target machine and invite user to paste it back in.
+This is required because
+.Nm
+does not allow data to be passed to shell scripts.
+It is necessary for remote debugging and crash dumps; for local memory debugging
+use
+.Ic kldsyms
+instead.
+.It Ic kldsyms
+Read in the symbol tables for the debugging machine.
+This does not work for
+remote debugging and crash dumps; use
+.Ic getsyms
+instead.
+.It Ic tr Ar interface
+Debug a remote system via the specified serial or firewire interface.
+.It Ic tr0
+Debug a remote system via serial interface
+.Pa /dev/cuad0 .
+.It Ic tr1
+Debug a remote system via serial interface
+.Pa /dev/cuad1 .
+.It Ic trf
+Debug a remote system via firewire interface at default port 5556.
+.El
+.Pp
+The commands
+.Ic tr0 , tr1
+and
+.Ic trf
+are convenience commands which invoke
+.Ic tr .
+.Ss "The current process environment"
+The following macros are convenience functions intended to make things easier
+than the standard
+.Xr gdb 1
+commands.
+.Bl -tag -width indent
+.It Ic f0
+Select stack frame 0 and show assembler-level details.
+.It Ic f1
+Select stack frame 1 and show assembler-level details.
+.It Ic f2
+Select stack frame 2 and show assembler-level details.
+.It Ic f3
+Select stack frame 3 and show assembler-level details.
+.It Ic f4
+Select stack frame 4 and show assembler-level details.
+.It Ic f5
+Select stack frame 5 and show assembler-level details.
+.It Ic xb
+Show 12 words in hex, starting at current
+.Va ebp
+value.
+.It Ic xi
+List the next 10 instructions from the current
+.Va eip
+value.
+.It Ic xp
+Show the register contents and the first four parameters of the current stack
+frame.
+.It Ic xp0
+Show the first parameter of current stack frame in various formats.
+.It Ic xp1
+Show the second parameter of current stack frame in various formats.
+.It Ic xp2
+Show the third parameter of current stack frame in various formats.
+.It Ic xp3
+Show the fourth parameter of current stack frame in various formats.
+.It Ic xp4
+Show the fifth parameter of current stack frame in various formats.
+.It Ic xs
+Show the last 12 words on stack in hexadecimal.
+.It Ic xxp
+Show the register contents and the first ten parameters.
+.It Ic z
+Single step 1 instruction (over calls) and show next instruction.
+.It Ic zs
+Single step 1 instruction (through calls) and show next instruction.
+.El
+.Ss "Examining other processes"
+The following macros access other processes.
+The
+.Nm
+debugger
+does not understand the concept of multiple processes, so they effectively
+bypass the entire
+.Nm
+environment.
+.Bl -tag -width indent
+.It Ic btp Ar pid
+Show a backtrace for the process
+.Ar pid .
+.It Ic btpa
+Show backtraces for all processes in the system.
+.It Ic btpp
+Show a backtrace for the process previously selected with
+.Ic defproc .
+.It Ic btr Ar ebp
+Show a backtrace from the
+.Ar ebp
+address specified.
+.It Ic defproc Ar pid
+Specify the PID of the process for some other commands in this section.
+.It Ic fr Ar frame
+Show frame
+.Ar frame
+of the stack of the process previously selected with
+.Ic defproc .
+.It Ic pcb Ar proc
+Show some PCB contents of the process
+.Ar proc .
+.El
+.Ss "Examining data structures"
+You can use standard
+.Xr gdb 1
+commands to look at most data structures.
+The macros in this section are
+convenience functions which typically display the data in a more readable
+format, or which omit less interesting parts of the structure.
+.Bl -tag -width indent
+.It Ic bp
+Show information about the buffer header pointed to by the variable
+.Va bp
+in the current frame.
+.It Ic bpd
+Show the contents
+.Pq Vt "char *"
+of
+.Va bp->data
+in the current frame.
+.It Ic bpl
+Show detailed information about the buffer header
+.Pq Vt "struct bp"
+pointed at by the local variable
+.Va bp .
+.It Ic bpp Ar bp
+Show summary information about the buffer header
+.Pq Vt "struct bp"
+pointed at by the parameter
+.Ar bp .
+.It Ic bx
+Print a number of fields from the buffer header pointed at in by the pointer
+.Ar bp
+in the current environment.
+.It Ic vdev
+Show some information of the
+.Vt vnode
+pointed to by the local variable
+.Va vp .
+.El
+.Ss "Miscellaneous macros"
+.Bl -tag -width indent
+.It Ic checkmem
+Check unallocated memory for modifications.
+This assumes that the kernel has been compiled with
+.Cd "options DIAGNOSTIC"
+This causes the contents of free memory to be set to
+.Li 0xdeadc0de .
+.It Ic dmesg
+Print the system message buffer.
+This corresponds to the
+.Xr dmesg 8
+utility.
+This macro used to be called
+.Ic msgbuf .
+It can take a very long time over a serial line,
+and it is even slower via firewire
+or local memory due to inefficiencies in
+.Nm .
+When debugging a crash dump or over firewire, it is not necessary to start
+.Nm
+to access the message buffer: instead, use an appropriate variation of
+.Bd -literal -offset indent
+dmesg -M /var/crash/vmcore.0 -N kernel.debug
+dmesg -M /dev/fwmem0.0 -N kernel.debug
+.Ed
+.It Ic kldstat
+Equivalent of the
+.Xr kldstat 8
+utility without options.
+.It Ic pname
+Print the command name of the current process.
+.It Ic ps
+Show process status.
+This corresponds in concept, but not in appearance, to the
+.Xr ps 1
+utility.
+When debugging a crash dump or over firewire, it is not necessary to start
+.Nm
+to display the
+.Xr ps 1
+output: instead, use an appropriate variation of
+.Bd -literal -offset indent
+ps -M /var/crash/vmcore.0 -N kernel.debug
+ps -M /dev/fwmem0.0 -N kernel.debug
+.Ed
+.It Ic y
+Kludge for writing macros.
+When writing macros, it is convenient to paste them
+back into the
+.Nm
+window.
+Unfortunately, if the macro is already defined,
+.Nm
+insists on asking
+.Pp
+.Dl "Redefine foo?"
+.Pp
+It will not give up until you answer
+.Ql y .
+This command is that answer.
+It does nothing else except to print a warning
+message to remind you to remove it again.
+.El
+.Sh SEE ALSO
+.Xr gdb 1 ,
+.Xr ps 1 ,
+.Xr ddb 4 ,
+.Xr firewire 4 ,
+.Xr dconschat 8 ,
+.Xr dmesg 8 ,
+.Xr fwcontrol 8 ,
+.Xr kldload 8
+.Sh AUTHORS
+This man page was written by
+.An "Greg Lehey" Aq grog@FreeBSD.org .
+.Sh BUGS
+The
+.Xr gdb 1
+debugger
+was never designed to debug kernels, and it is not a very good match.
+Many problems exist.
+.Pp
+The
+.Nm
+implementation is very inefficient, and many operations are slow.
+.Pp
+Serial debugging is even slower, and race conditions can make it difficult to
+run the link at more than 9600 bps.
+Firewire connections do not have this problem.
+.Pp
+The debugging macros
+.Dq "just growed" .
+In general, the person who wrote them did so while looking for a specific
+problem, so they may not be general enough, and they may behave badly when used
+in ways for which they were not intended, even if those ways make sense.
+.Pp
+Many of these commands only work on the ia32 architecture.
diff --git a/share/man/man4/gem.4 b/share/man/man4/gem.4
new file mode 100644
index 000000000000..e4ebeb0ca6d0
--- /dev/null
+++ b/share/man/man4/gem.4
@@ -0,0 +1,148 @@
+.\" $NetBSD: gem.4,v 1.2 2003/02/14 15:20:18 grant Exp $
+.\"
+.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 25, 2009
+.Dt GEM 4
+.Os
+.Sh NAME
+.Nm gem
+.Nd ERI/GEM/GMAC Ethernet device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device gem"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_gem_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the GMAC Ethernet hardware found mostly in
+the last Apple PowerBooks G3s and most G4-based Apple hardware, as
+well as Sun UltraSPARC machines.
+.Pp
+All controllers supported by the
+.Nm
+driver have TCP checksum offload capability for both receive and transmit,
+support for the reception and transmission of extended frames for
+.Xr vlan 4
+and a 512-bit multicast hash filter.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple GMAC
+.It
+Sun ERI 10/100 Mbps Ethernet
+.It
+Sun GEM Gigabit Ethernet
+.El
+.Pp
+The
+following add-on cards are known to work with the
+.Nm
+driver at this time:
+.Pp
+.Bl -bullet -compact
+.It
+Sun Gigabit Ethernet PCI 2.0/3.0 (GBE/P)
+(part no.\& 501-4373)
+.It
+Sun Gigabit Ethernet SBus 2.0/3.0 (GBE/S)
+(part no.\& 501-4375)
+.El
+.Sh NOTES
+On sparc64 the
+.Nm
+driver respects the
+.Va local-mac-address?
+system configuration variable which can be set in the Open Firmware boot
+monitor using the
+.Ic setenv
+command or by
+.Xr eeprom 8 .
+If set to
+.Dq Li false
+(the default), the
+.Nm
+driver will use the system's default MAC address for all of its devices.
+If set to
+.Dq Li true ,
+the unique MAC address of each interface is used if present rather than
+the system's default MAC address.
+.Pp
+Supported interfaces having their own MAC address include the on-board
+Sun ERI 10/100 Mbps on boards equipped with more than one Ethernet interface
+and the Sun Gigabit Ethernet 2.0/3.0 GBE add-on cards.
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr vlan 4 ,
+.Xr eeprom 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 1.6 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for
+.Nx
+by
+.An Eduardo Horvath
+.Aq eeh@NetBSD.org .
+It was ported to
+.Fx
+by
+.An Thomas Moestl
+.Aq tmm@FreeBSD.org
+and later on improved by
+.An Marius Strobl
+.Aq marius@FreeBSD.org .
+The man page was written by
+.An Thomas Klausner
+.Aq wiz@NetBSD.org .
diff --git a/share/man/man4/geom.4 b/share/man/man4/geom.4
new file mode 100644
index 000000000000..0a1b24e5ec31
--- /dev/null
+++ b/share/man/man4/geom.4
@@ -0,0 +1,467 @@
+.\"
+.\" Copyright (c) 2002 Poul-Henning Kamp
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Poul-Henning Kamp
+.\" and NAI Labs, the Security Research Division of Network Associates, Inc.
+.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The names of the authors may not be used to endorse or promote
+.\" products derived from this software without specific prior written
+.\" permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2006
+.Dt GEOM 4
+.Os
+.Sh NAME
+.Nm GEOM
+.Nd "modular disk I/O request transformation framework"
+.Sh DESCRIPTION
+The
+.Nm
+framework provides an infrastructure in which
+.Dq classes
+can perform transformations on disk I/O requests on their path from
+the upper kernel to the device drivers and back.
+.Pp
+Transformations in a
+.Nm
+context range from the simple geometric
+displacement performed in typical disk partitioning modules over RAID
+algorithms and device multipath resolution to full blown cryptographic
+protection of the stored data.
+.Pp
+Compared to traditional
+.Dq "volume management" ,
+.Nm
+differs from most
+and in some cases all previous implementations in the following ways:
+.Bl -bullet
+.It
+.Nm
+is extensible.
+It is trivially simple to write a new class
+of transformation and it will not be given stepchild treatment.
+If
+someone for some reason wanted to mount IBM MVS diskpacks, a class
+recognizing and configuring their VTOC information would be a trivial
+matter.
+.It
+.Nm
+is topologically agnostic.
+Most volume management implementations
+have very strict notions of how classes can fit together, very often
+one fixed hierarchy is provided, for instance, subdisk - plex -
+volume.
+.El
+.Pp
+Being extensible means that new transformations are treated no differently
+than existing transformations.
+.Pp
+Fixed hierarchies are bad because they make it impossible to express
+the intent efficiently.
+In the fixed hierarchy above, it is not possible to mirror two
+physical disks and then partition the mirror into subdisks, instead
+one is forced to make subdisks on the physical volumes and to mirror
+these two and two, resulting in a much more complex configuration.
+.Nm
+on the other hand does not care in which order things are done,
+the only restriction is that cycles in the graph will not be allowed.
+.Sh "TERMINOLOGY AND TOPOLOGY"
+.Nm
+is quite object oriented and consequently the terminology
+borrows a lot of context and semantics from the OO vocabulary:
+.Pp
+A
+.Dq class ,
+represented by the data structure
+.Vt g_class
+implements one
+particular kind of transformation.
+Typical examples are MBR disk
+partition, BSD disklabel, and RAID5 classes.
+.Pp
+An instance of a class is called a
+.Dq geom
+and represented by the data structure
+.Vt g_geom .
+In a typical i386
+.Fx
+system, there
+will be one geom of class MBR for each disk.
+.Pp
+A
+.Dq provider ,
+represented by the data structure
+.Vt g_provider ,
+is the front gate at which a geom offers service.
+A provider is
+.Do
+a disk-like thing which appears in
+.Pa /dev
+.Dc - a logical
+disk in other words.
+All providers have three main properties:
+.Dq name ,
+.Dq sectorsize
+and
+.Dq size .
+.Pp
+A
+.Dq consumer
+is the backdoor through which a geom connects to another
+geom provider and through which I/O requests are sent.
+.Pp
+The topological relationship between these entities are as follows:
+.Bl -bullet
+.It
+A class has zero or more geom instances.
+.It
+A geom has exactly one class it is derived from.
+.It
+A geom has zero or more consumers.
+.It
+A geom has zero or more providers.
+.It
+A consumer can be attached to zero or one providers.
+.It
+A provider can have zero or more consumers attached.
+.El
+.Pp
+All geoms have a rank-number assigned, which is used to detect and
+prevent loops in the acyclic directed graph.
+This rank number is
+assigned as follows:
+.Bl -enum
+.It
+A geom with no attached consumers has rank=1.
+.It
+A geom with attached consumers has a rank one higher than the
+highest rank of the geoms of the providers its consumers are
+attached to.
+.El
+.Sh "SPECIAL TOPOLOGICAL MANEUVERS"
+In addition to the straightforward attach, which attaches a consumer
+to a provider, and detach, which breaks the bond, a number of special
+topological maneuvers exists to facilitate configuration and to
+improve the overall flexibility.
+.Bl -inset
+.It Em TASTING
+is a process that happens whenever a new class or new provider
+is created, and it provides the class a chance to automatically configure an
+instance on providers which it recognizes as its own.
+A typical example is the MBR disk-partition class which will look for
+the MBR table in the first sector and, if found and validated, will
+instantiate a geom to multiplex according to the contents of the MBR.
+.Pp
+A new class will be offered to all existing providers in turn and a new
+provider will be offered to all classes in turn.
+.Pp
+Exactly what a class does to recognize if it should accept the offered
+provider is not defined by
+.Nm ,
+but the sensible set of options are:
+.Bl -bullet
+.It
+Examine specific data structures on the disk.
+.It
+Examine properties like
+.Dq sectorsize
+or
+.Dq mediasize
+for the provider.
+.It
+Examine the rank number of the provider's geom.
+.It
+Examine the method name of the provider's geom.
+.El
+.It Em ORPHANIZATION
+is the process by which a provider is removed while
+it potentially is still being used.
+.Pp
+When a geom orphans a provider, all future I/O requests will
+.Dq bounce
+on the provider with an error code set by the geom.
+Any
+consumers attached to the provider will receive notification about
+the orphanization when the event loop gets around to it, and they
+can take appropriate action at that time.
+.Pp
+A geom which came into being as a result of a normal taste operation
+should self-destruct unless it has a way to keep functioning whilst
+lacking the orphaned provider.
+Geoms like disk slicers should therefore self-destruct whereas
+RAID5 or mirror geoms will be able to continue as long as they do
+not lose quorum.
+.Pp
+When a provider is orphaned, this does not necessarily result in any
+immediate change in the topology: any attached consumers are still
+attached, any opened paths are still open, any outstanding I/O
+requests are still outstanding.
+.Pp
+The typical scenario is:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+A device driver detects a disk has departed and orphans the provider for it.
+.It
+The geoms on top of the disk receive the orphanization event and
+orphan all their providers in turn.
+Providers which are not attached to will typically self-destruct
+right away.
+This process continues in a quasi-recursive fashion until all
+relevant pieces of the tree have heard the bad news.
+.It
+Eventually the buck stops when it reaches geom_dev at the top
+of the stack.
+.It
+Geom_dev will call
+.Xr destroy_dev 9
+to stop any more requests from
+coming in.
+It will sleep until any and all outstanding I/O requests have
+been returned.
+It will explicitly close (i.e.: zero the access counts), a change
+which will propagate all the way down through the mesh.
+It will then detach and destroy its geom.
+.It
+The geom whose provider is now detached will destroy the provider,
+detach and destroy its consumer and destroy its geom.
+.It
+This process percolates all the way down through the mesh, until
+the cleanup is complete.
+.El
+.Pp
+While this approach seems byzantine, it does provide the maximum
+flexibility and robustness in handling disappearing devices.
+.Pp
+The one absolutely crucial detail to be aware of is that if the
+device driver does not return all I/O requests, the tree will
+not unravel.
+.It Em SPOILING
+is a special case of orphanization used to protect
+against stale metadata.
+It is probably easiest to understand spoiling by going through
+an example.
+.Pp
+Imagine a disk,
+.Pa da0 ,
+on top of which an MBR geom provides
+.Pa da0s1
+and
+.Pa da0s2 ,
+and on top of
+.Pa da0s1
+a BSD geom provides
+.Pa da0s1a
+through
+.Pa da0s1e ,
+and that both the MBR and BSD geoms have
+autoconfigured based on data structures on the disk media.
+Now imagine the case where
+.Pa da0
+is opened for writing and those
+data structures are modified or overwritten: now the geoms would
+be operating on stale metadata unless some notification system
+can inform them otherwise.
+.Pp
+To avoid this situation, when the open of
+.Pa da0
+for write happens,
+all attached consumers are told about this and geoms like
+MBR and BSD will self-destruct as a result.
+When
+.Pa da0
+is closed, it will be offered for tasting again
+and, if the data structures for MBR and BSD are still there, new
+geoms will instantiate themselves anew.
+.Pp
+Now for the fine print:
+.Pp
+If any of the paths through the MBR or BSD module were open, they
+would have opened downwards with an exclusive bit thus rendering it
+impossible to open
+.Pa da0
+for writing in that case.
+Conversely,
+the requested exclusive bit would render it impossible to open a
+path through the MBR geom while
+.Pa da0
+is open for writing.
+.Pp
+From this it also follows that changing the size of open geoms can
+only be done with their cooperation.
+.Pp
+Finally: the spoiling only happens when the write count goes from
+zero to non-zero and the retasting happens only when the write count goes
+from non-zero to zero.
+.It Em INSERT/DELETE
+are very special operations which allow a new geom
+to be instantiated between a consumer and a provider attached to
+each other and to remove it again.
+.Pp
+To understand the utility of this, imagine a provider
+being mounted as a file system.
+Between the DEVFS geom's consumer and its provider we insert
+a mirror module which configures itself with one mirror
+copy and consequently is transparent to the I/O requests
+on the path.
+We can now configure yet a mirror copy on the mirror geom,
+request a synchronization, and finally drop the first mirror
+copy.
+We have now, in essence, moved a mounted file system from one
+disk to another while it was being used.
+At this point the mirror geom can be deleted from the path
+again; it has served its purpose.
+.It Em CONFIGURE
+is the process where the administrator issues instructions
+for a particular class to instantiate itself.
+There are multiple
+ways to express intent in this case - a particular provider may be
+specified with a level of override forcing, for instance, a BSD
+disklabel module to attach to a provider which was not found palatable
+during the TASTE operation.
+.Pp
+Finally, I/O is the reason we even do this: it concerns itself with
+sending I/O requests through the graph.
+.It Em "I/O REQUESTS" ,
+represented by
+.Vt "struct bio" ,
+originate at a consumer,
+are scheduled on its attached provider and, when processed, are returned
+to the consumer.
+It is important to realize that the
+.Vt "struct bio"
+which enters through the provider of a particular geom does not
+.Do
+come out on the other side
+.Dc .
+Even simple transformations like MBR and BSD will clone the
+.Vt "struct bio" ,
+modify the clone, and schedule the clone on their
+own consumer.
+Note that cloning the
+.Vt "struct bio"
+does not involve cloning the
+actual data area specified in the I/O request.
+.Pp
+In total, four different I/O requests exist in
+.Nm :
+read, write, delete, and
+.Dq "get attribute".
+.Pp
+Read and write are self explanatory.
+.Pp
+Delete indicates that a certain range of data is no longer used
+and that it can be erased or freed as the underlying technology
+supports.
+Technologies like flash adaptation layers can arrange to erase
+the relevant blocks before they will become reassigned and
+cryptographic devices may want to fill random bits into the
+range to reduce the amount of data available for attack.
+.Pp
+It is important to recognize that a delete indication is not a
+request and consequently there is no guarantee that the data actually
+will be erased or made unavailable unless guaranteed by specific
+geoms in the graph.
+If
+.Dq "secure delete"
+semantics are required, a
+geom should be pushed which converts delete indications into (a
+sequence of) write requests.
+.Pp
+.Dq "Get attribute"
+supports inspection and manipulation
+of out-of-band attributes on a particular provider or path.
+Attributes are named by
+.Tn ASCII
+strings and they will be discussed in
+a separate section below.
+.El
+.Pp
+(Stay tuned while the author rests his brain and fingers: more to come.)
+.Sh DIAGNOSTICS
+Several flags are provided for tracing
+.Nm
+operations and unlocking
+protection mechanisms via the
+.Va kern.geom.debugflags
+sysctl.
+All of these flags are off by default, and great care should be taken in
+turning them on.
+.Bl -tag -width indent
+.It 0x01 Pq Dv G_T_TOPOLOGY
+Provide tracing of topology change events.
+.It 0x02 Pq Dv G_T_BIO
+Provide tracing of buffer I/O requests.
+.It 0x04 Pq Dv G_T_ACCESS
+Provide tracing of access check controls.
+.It 0x08 (unused)
+.It 0x10 (allow foot shooting)
+Allow writing to Rank 1 providers.
+This would, for example, allow the super-user to overwrite the MBR on the root
+disk or write random sectors elsewhere to a mounted disk.
+The implications are obvious.
+.It 0x40 Pq Dv G_F_DISKIOCTL
+This is unused at this time.
+.It 0x80 Pq Dv G_F_CTLDUMP
+Dump contents of gctl requests.
+.El
+.Sh SEE ALSO
+.Xr libgeom 3 ,
+.Xr disk 9 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9
+.Sh HISTORY
+This software was developed for the
+.Fx
+Project by
+.An Poul-Henning Kamp
+and NAI Labs, the Security Research Division of Network Associates, Inc.\&
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the
+DARPA CHATS research program.
+.Pp
+The first precursor for
+.Nm
+was a gruesome hack to Minix 1.2 and was
+never distributed.
+An earlier attempt to implement a less general scheme
+in
+.Fx
+never succeeded.
+.Sh AUTHORS
+.An "Poul-Henning Kamp" Aq phk@FreeBSD.org
diff --git a/share/man/man4/geom_fox.4 b/share/man/man4/geom_fox.4
new file mode 100644
index 000000000000..8010d24d4d06
--- /dev/null
+++ b/share/man/man4/geom_fox.4
@@ -0,0 +1,214 @@
+.\"
+.\" Copyright (c) 2006 Wilko Bulte
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 2, 2005
+.Dt GEOM_FOX 4
+.Os
+.Sh NAME
+.Nm geom_fox
+.Nd "GEOM based basic disk multipathing"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GEOM_FOX"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+geom_fox_load="YES"
+.Ed
+.Sh DESCRIPTION
+The intent of the
+.Nm
+framework is to provide basic multipathing support to access direct
+access devices.
+Basic in the above sentence should be read as:
+.Nm
+only provides path failover functionality, not load balancing over
+the available paths etc.
+Using suitable hardware like SCSI or FibreChannel disks it is
+possible to have multiple (typically 2) host bus adapters access
+the same physical disk drive.
+.Pp
+Without a multipathing driver the
+.Fx
+kernel would probe the disks multiple times, resulting in the creation of
+multiple
+.Pa /dev
+entries for the same underlying physical device.
+A unique label written in the GEOM label area allows
+.Nm
+to detect multiple paths.
+Using this information it creates a unique
+.Pa da#.fox
+device.
+.Pp
+The
+.Nm
+device is subsequently used by the
+.Fx
+kernel to access the disks.
+Multiple physical access paths ensure that even in case of a path failure the
+.Fx
+kernel can continue to access the data.
+.Pp
+The
+.Nm
+driver will disallow write operations to the underlying devices once the
+fox device has been opened for writing.
+.Sh EXAMPLES
+.Bl -bullet -compact
+.It
+.Nm
+needs a label on the disk as follows in order to work properly:
+.Bd -literal
+"0123456789abcdef0123456789abcdef"
+"GEOM::FOX <--unique--id-->"
+.Ed
+.Pp
+For the unique ID 16 bytes are available.
+The
+.Dq Li GEOM::FOX
+is the magic to mark a
+.Nm
+device.
+.Pp
+The actual labelling is accomplished by
+.Bd -literal
+echo "GEOM::FOX someid" | dd of=/dev/da2 conv=sync
+.Ed
+.Pp
+For FibreChannel devices it is suggested to use the Node World Wide
+Name (Node WWN) as this is guaranteed by the FibreChannel standard to
+be worldwide unique.
+The use of the Port WWN not recommended as each port of a given
+device has a different WWN, thereby confusing things.
+.Pp
+The Node WWN can be obtained from a verbose boot as in for example
+.Bd -literal
+isp1: Target 1 (Loop 0x1) Port ID 0xe8 (role Target) Arrived
+ Port WWN 0x21000004cfc8aca2
+ Node WWN 0x20000004cfc8aca2
+.Ed
+.Pp
+This Node WWN would then be used like so:
+.Bd -literal
+echo "GEOM::FOX 20000004cfc8aca2" | dd of=/dev/da2 conv=sync
+.Ed
+.Pp
+For non-FibreChannel devices you could for example use the serial
+number of the device.
+Regardless of what you use, make sure the label is unique.
+.Pp
+Once the labelling has been performed and assuming the
+.Nm
+module is loaded the kernel will inform you that it has found a new
+.Nm
+device with a message similar to
+.Bd -literal
+Creating new fox (da2)
+fox da2.fox lock 0xfffffc0000fdba20
+.Ed
+.Pp
+.It
+To check which physical devices match a given
+.Nm
+device:
+.Bd -literal -offset indent
+# geom fox list
+Geom name: da2.fox
+Providers:
+1. Name: da2.fox
+ Mediasize: 73407865344 (68G)
+ Sectorsize: 512
+ Mode: r0w0e0
+Consumers:
+1. Name: da2
+ Mediasize: 73407865856 (68G)
+ Sectorsize: 512
+ Mode: r0w0e0
+2. Name: da6
+ Mediasize: 73407865856 (68G)
+ Sectorsize: 512
+ Mode: r0w0e0
+.Ed
+.Pp
+.It
+To check the status of the
+.Nm
+components:
+.Bd -literal
+# geom fox status
+ Name Status Components
+da2.fox N/A da2
+ da6
+.Ed
+.El
+.Sh SEE ALSO
+.Xr GEOM 4 ,
+.Xr geom 8 ,
+.Xr gmultipath 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Poul-Henning Kamp" Aq phk@FreeBSD.org .
+This manual page was written by
+.An "Wilko Bulte" Aq wilko@FreeBSD.org .
+.Sh CAVEATS
+The
+.Nm
+driver depends on the underlying hardware drivers to do the right thing in case
+of a path failure.
+If for example a hardware driver continues to retry forever,
+.Nm
+is not able to re-initiate the I/O to an alternative physical path.
+.Pp
+You have to be very sure to provide a unique label for each of the
+.Nm
+devices.
+Safety belts are not provided.
+For FibreChannel devices it is suggested to use the Port WWN of the device.
+The World Wide Name is guaranteed to be worldwide unique per the
+FibreChannel standard.
+.Sh BUGS
+The
+.Nm
+framework has only seen light testing.
+There definitely might be dragons here.
+.Pp
+The name
+.Nm
+is completely obscure.
+Just remember that any sly fox has multiple exits from its hole.
+.Pp
+The examples provided are too FibreChannel-centric.
diff --git a/share/man/man4/geom_linux_lvm.4 b/share/man/man4/geom_linux_lvm.4
new file mode 100644
index 000000000000..30b875edd3e0
--- /dev/null
+++ b/share/man/man4/geom_linux_lvm.4
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright (c) 2008 Andrew Thompson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 20, 2008
+.Dt GEOM_LINUX_LVM 4
+.Os
+.Sh NAME
+.Nm geom_linux_lvm
+.Nd "GEOM based Linux LVM logical volume mapping"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GEOM_LINUX_LVM"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+geom_linux_lvm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+framework provides support for mapping Linux LVM volumes to GEOM providers.
+.Nm
+currently supports linear stripes with segments on one or more physical disks.
+The parser is able to read LVM2 Text Format metadata, the logical volumes will
+be assembled and made available under
+.Pa /dev/linux_lvm/ .
+The metadata is read-only, logical volumes cannot be allocated or resized.
+.Sh EXAMPLES
+To view which
+.Nm
+devices are available:
+.Bd -literal -offset indent
+# geom linux_lvm list
+Geom name: vg1
+Providers:
+1. Name: linux_lvm/vg1-home
+ Mediasize: 4294967296 (4.0G)
+ Sectorsize: 512
+ Mode: r0w0e0
+2. Name: linux_lvm/vg1-logs
+ Mediasize: 4294967296 (4.0G)
+ Sectorsize: 512
+ Mode: r0w0e0
+Consumers:
+1. Name: ad0s1
+ Mediasize: 80023716864 (75G)
+ Sectorsize: 512
+ Mode: r0w0e0
+.Ed
+.Sh SEE ALSO
+.Xr GEOM 4 ,
+.Xr geom 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Andrew Thompson" Aq thompsa@FreeBSD.org .
diff --git a/share/man/man4/geom_map.4 b/share/man/man4/geom_map.4
new file mode 100644
index 000000000000..6af91be5d82c
--- /dev/null
+++ b/share/man/man4/geom_map.4
@@ -0,0 +1,211 @@
+.\"
+.\" Copyright (c) 2011 Aleksandr Rybalko
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 17, 2011
+.Dt GEOM_MAP 4
+.Os
+.Sh NAME
+.Nm geom_map
+.Nd "GEOM module that maps defined items as separate partitions"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device geom_map"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+framework provides support for mapping defined parts of the media.
+Basically it is helpful for embedded devices where in the one continuous
+flash are loader, kernel and rootfs parts.
+.Nm
+allows making them available as separate parts and protects the loader from
+being overwritten.
+.Pp
+At boot time
+.Nm
+partitions are listed (only with bootverbose) as:
+.Bd -literal -offset indent
+MAP: 0x30000, data=0x30000 "/dev/map/bootloader"
+MAP: 30000x10000, data=0x10000 "/dev/map/factory"
+MAP: 40000x7a0000, data=0x7a0000 "/dev/map/upgrade"
+MAP: search key ".!/bin/sh" from 0x100000, step 0x10000
+MAP: 40000x110000, data=0x110000 "/dev/map/kernel"
+MAP: search key ".!/bin/sh" from 0x100000, step 0x10000
+MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
+MAP: 7e0000x20000, data=0x20000 "/dev/map/config"
+.Ed
+.Pp
+The current
+.Nm
+configuration can be accessed with the following
+.Xr sysctl 8
+nodes:
+.Va kern.geom.conftxt , kern.geom.confxml ,
+and
+.Va kern.geom.confdot
+or by using
+.Dq Li "geom map list" .
+.Bd -literal -offset indent
+# sysctl -n kern.geom.conftxt
+0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc
+0 DISK cfid0 8388608 4 hd 0 sc 0
+1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072
+1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280
+2 UNCOMPRESS map/rootfs.uncompress 18677760 512
+1 MAP map/kernel 1114112 4 i 3 o 262144 entry 0 dsize 1114112
+1 MAP map/upgrade 7995392 4 i 2 o 262144 entry 0 dsize 7995392
+1 MAP map/factory 65536 4 i 1 o 196608 entry 0 dsize 65536
+1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608
+.Ed
+.Pp
+Driver configuration can be done in
+.Xr device.hints 5 .
+List of used parameters:
+.Bl -tag -width indent
+.It Va at
+select media to attach
+.It Va name
+name of partition (will create device
+.Pa /dev/map/ Ns Ar that_name )
+.It Va start
+offset from the beginning of the parent media to start of the mapped partition.
+This field can also have a special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+where:
+.Bl -tag -width indent
+.It Ar searchstart
+offset from the beginning of the parent media where search will be started
+.It Ar searchstep
+value of the increment used while searching for the partition boundary markers
+.It Ar searchkey
+key which will be used to find partition boundary markers.
+The wildcard
+.Ql .\&
+can be used to match any character on that position
+.El
+.It Va end
+offset from the beginning of the parent media to the end of the mapped partition.
+This field can also have the special value
+.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey ,
+as described above.
+.It Va offset
+offset where the data of the mapped partition begins
+.El
+.Pp
+Each record contains the start address (in bytes) from the media begin, size
+(in bytes), offset where the data of mapped partition begins, and the name of
+new device.
+.Bd -literal -offset indent
+MAP: 150000x690000, data=0x690000 "/dev/map/rootfs"
+.Ed
+.Bd -literal
+00150000 - start address
+00690000 - size
+00000000 - data begin from zero offset
+00690000 - data size
+"map/rootfs" - new media will be accessible via /dev/map/rootfs dev.
+.Ed
+.Sh EXAMPLES
+If we need to implement layout shown above, we need to define the following
+hints:
+.Bd -literal -offset indent
+hint.map.0.at="cfid0"
+hint.map.0.start=0x00000000
+hint.map.0.end=0x00030000
+hint.map.0.name="bootloader"
+hint.map.0.readonly=1
+.Ed
+.Pp
+This defines
+.Pa /dev/map/bootloader
+at disk
+.Pa cfid0
+starting at
+.Li 0x00000000
+and ending at
+.Li 0x00030000 ,
+it is also marked as readonly.
+.Bd -literal -offset indent
+hint.map.1.at="cfid0"
+hint.map.1.start=0x00030000
+hint.map.1.end=0x00040000
+hint.map.1.name="factory"
+
+hint.map.2.at="cfid0"
+hint.map.2.start=0x00040000
+hint.map.2.end=0x007e0000
+hint.map.2.name="upgrade"
+
+hint.map.3.at="cfid0"
+hint.map.3.name="kernel"
+hint.map.3.start=0x00040000
+hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh"
+.Ed
+.Pp
+This defines
+.Pa /dev/map/kernel
+at disk
+.Pa cfid0
+starting at
+.Li 0x00040000 ,
+but the end position must be searched by finding the key
+.Dq Li ".!/bin/sh" ,
+from offset
+.Li 0x00100000
+to the end of media with step
+.Li 0x10000 .
+The real marker in this case is
+.Dq Li "#!/bin/sh" ,
+but
+.Ql #
+terminates the line when the hints file is parsed, so we need to use wildcard
+.Ql .\&
+instead of
+.Ql # .
+.Bd -literal -offset indent
+hint.map.4.at="cfid0"
+hint.map.4.name="rootfs"
+hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh"
+hint.map.4.end=0x007e0000
+
+hint.map.5.at="cfid0"
+hint.map.5.start=0x007e0000
+hint.map.5.end=0x00800000
+hint.map.5.name="config"
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr geom 8 ,
+.Xr sysctl 8
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Aleksandr Rybalko" Aq ray@ddteam.net .
diff --git a/share/man/man4/geom_uzip.4 b/share/man/man4/geom_uzip.4
new file mode 100644
index 000000000000..8d27673614bc
--- /dev/null
+++ b/share/man/man4/geom_uzip.4
@@ -0,0 +1,105 @@
+.\"
+.\" Copyright (c) 2006 Ceri Davies
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 9, 2006
+.Dt GEOM_UZIP 4
+.Os
+.Sh NAME
+.Nm geom_uzip
+.Nd "GEOM based compressed disk images"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options GEOM_UZIP"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+geom_uzip_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+framework provides support for compressed read only
+disk images.
+This allows significant storage savings at the expense of
+a little CPU time on each read.
+Data written in the GEOM label area allows
+.Nm
+to detect compressed images which have been created with
+.Xr mkuzip 8
+and presented to the kernel as a logical disk device via
+.Xr md 4 .
+.Nm
+creates a unique
+.Pa md#.uzip
+device for each image.
+.Pp
+The
+.Nm
+device is subsequently used by the
+.Fx
+kernel to access the disk images.
+The
+.Nm
+driver does not allow write operations to the underlying disk image.
+To check which
+.Xr md 4
+devices match a given
+.Nm
+device:
+.Bd -literal -offset indent
+# geom uzip list
+Geom name: md1.uzip
+Providers:
+1. Name: md1.uzip
+ Mediasize: 22003712 (21M)
+ Sectorsize: 512
+ Mode: r1w0e1
+Consumers:
+1. Name: md1
+ Mediasize: 9563648 (9.1M)
+ Sectorsize: 512
+ Mode: r1w0e1
+.Ed
+.Sh SEE ALSO
+.Xr GEOM 4 ,
+.Xr md 4 ,
+.Xr geom 8 ,
+.Xr mkuzip 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Max Khon" Aq fjoe@FreeBSD.org .
+This manual page was written by
+.An "Ceri Davies" Aq ceri@FreeBSD.org .
diff --git a/share/man/man4/gif.4 b/share/man/man4/gif.4
new file mode 100644
index 000000000000..453b4bdb1c51
--- /dev/null
+++ b/share/man/man4/gif.4
@@ -0,0 +1,287 @@
+.\" $KAME: gif.4,v 1.28 2001/05/18 13:15:56 itojun Exp $
+.\"
+.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 1, 2011
+.Dt GIF 4
+.Os
+.Sh NAME
+.Nm gif
+.Nd generic tunnel interface
+.Sh SYNOPSIS
+.Cd "device gif"
+.Sh DESCRIPTION
+The
+.Nm
+interface is a generic tunnelling device for IPv4 and IPv6.
+It can tunnel IPv[46] traffic over IPv[46].
+Therefore, there can be four possible configurations.
+The behavior of
+.Nm
+is mainly based on RFC2893 IPv6-over-IPv4 configured tunnel.
+On
+.Nx ,
+.Nm
+can also tunnel ISO traffic over IPv[46] using EON encapsulation.
+Note that
+.Nm
+does not perform GRE encapsulation; use
+.Xr gre 4
+for GRE encapsulation.
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Dq Nm ifconfig Cm create
+command or using the
+.Va ifconfig_ Ns Aq Ar interface
+variable in
+.Xr rc.conf 5 .
+.Pp
+To use
+.Nm ,
+the administrator needs to configure the protocol and addresses used for the outer
+header.
+This can be done by using
+.Xr ifconfig 8
+.Cm tunnel ,
+or
+.Dv SIOCSIFPHYADDR
+ioctl.
+The administrator also needs to configure the protocol and addresses for the
+inner header, with
+.Xr ifconfig 8 .
+Note that IPv6 link-local addresses
+(those that start with
+.Li fe80:: )
+will be automatically configured whenever possible.
+You may need to remove IPv6 link-local addresses manually using
+.Xr ifconfig 8 ,
+if you want to disable the use of IPv6 as the inner header
+(for example, if you need a pure IPv4-over-IPv6 tunnel).
+Finally, you must modify the routing table to route the packets through the
+.Nm
+interface.
+.Pp
+The
+.Nm
+device can be configured to be ECN friendly.
+This can be configured by
+.Dv IFF_LINK1 .
+.Ss ECN friendly behavior
+The
+.Nm
+device can be configured to be ECN friendly, as described in
+.Dv draft-ietf-ipsec-ecn-02.txt .
+This is turned off by default, and can be turned on by the
+.Dv IFF_LINK1
+interface flag.
+.Pp
+Without
+.Dv IFF_LINK1 ,
+.Nm
+will show normal behavior, as described in RFC2893.
+This can be summarized as follows:
+.Bl -tag -width "Ingress" -offset indent
+.It Ingress
+Set outer TOS bit to
+.Dv 0 .
+.It Egress
+Drop outer TOS bit.
+.El
+.Pp
+With
+.Dv IFF_LINK1 ,
+.Nm
+will copy ECN bits
+.Dv ( 0x02
+and
+.Dv 0x01
+on IPv4 TOS byte or IPv6 traffic class byte)
+on egress and ingress, as follows:
+.Bl -tag -width "Ingress" -offset indent
+.It Ingress
+Copy TOS bits except for ECN CE
+(masked with
+.Dv 0xfe )
+from
+inner to outer.
+Set ECN CE bit to
+.Dv 0 .
+.It Egress
+Use inner TOS bits with some change.
+If outer ECN CE bit is
+.Dv 1 ,
+enable ECN CE bit on the inner.
+.El
+.Pp
+Note that the ECN friendly behavior violates RFC2893.
+This should be used in mutual agreement with the peer.
+.Ss Security
+A malicious party may try to circumvent security filters by using
+tunnelled packets.
+For better protection,
+.Nm
+performs both martian and ingress filtering against the outer source address
+on egress.
+Note that martian/ingress filters are in no way complete.
+You may want to secure your node by using packet filters.
+Ingress filtering can break tunnel operation in an asymmetrically
+routed network.
+It can be turned off by
+.Dv IFF_LINK2
+bit.
+.Ss Route caching
+Processing each packet requires two route lookups: first on the
+packet itself, and second on the tunnel destination.
+This second route can be cached, increasing tunnel performance.
+However, in a dynamically routed network, the tunnel will stick
+to the cached route, ignoring routing table updates.
+Route caching can be enabled with the
+.Dv IFF_LINK0
+flag.
+.\"
+.Ss Miscellaneous
+By default,
+.Nm
+tunnels may not be nested.
+This behavior may be modified at runtime by setting the
+.Xr sysctl 8
+variable
+.Va net.link.gif.max_nesting
+to the desired level of nesting.
+Additionally,
+.Nm
+tunnels are restricted to one per pair of end points.
+Parallel tunnels may be enabled by setting the
+.Xr sysctl 8
+variable
+.Va net.link.gif.parallel_tunnels
+to 1.
+.Sh SEE ALSO
+.Xr gre 4 ,
+.Xr inet 4 ,
+.Xr inet6 4 ,
+.Xr ifconfig 8
+.Rs
+.%A R. Gilligan
+.%A E. Nordmark
+.%B RFC2893
+.%T Transition Mechanisms for IPv6 Hosts and Routers
+.%D August 2000
+.%U http://tools.ietf.org/html/rfc2893
+.Re
+.Rs
+.%A Sally Floyd
+.%A David L. Black
+.%A K. K. Ramakrishnan
+.%T "IPsec Interactions with ECN"
+.%D December 1999
+.%O draft-ietf-ipsec-ecn-02.txt
+.Re
+.\"
+.Sh HISTORY
+The
+.Nm
+device first appeared in the WIDE hydrangea IPv6 kit.
+.\"
+.Sh BUGS
+There are many tunnelling protocol specifications, all
+defined differently from each other.
+The
+.Nm
+device may not interoperate with peers which are based on different specifications,
+and are picky about outer header fields.
+For example, you cannot usually use
+.Nm
+to talk with IPsec devices that use IPsec tunnel mode.
+.Pp
+The current code does not check if the ingress address
+(outer source address)
+configured in the
+.Nm
+interface makes sense.
+Make sure to specify an address which belongs to your node.
+Otherwise, your node will not be able to receive packets from the peer,
+and it will generate packets with a spoofed source address.
+.Pp
+If the outer protocol is IPv4,
+.Nm
+does not try to perform path MTU discovery for the encapsulated packet
+(DF bit is set to 0).
+.Pp
+If the outer protocol is IPv6, path MTU discovery for encapsulated packets
+may affect communication over the interface.
+The first bigger-than-pmtu packet may be lost.
+To avoid the problem, you may want to set the interface MTU for
+.Nm
+to 1240 or smaller, when the outer header is IPv6 and the inner header is IPv4.
+.Pp
+The
+.Nm
+device does not translate ICMP messages for the outer header into the inner header.
+.Pp
+In the past,
+.Nm
+had a multi-destination behavior, configurable via
+.Dv IFF_LINK0
+flag.
+The behavior is obsolete and is no longer supported.
+.Pp
+On
+.Fx
+6.1, 6.2, 6.3, 7.0, 7.1, and 7.2
+the
+.Nm
+sends and receives incorrect EtherIP packets with reversed version
+field when
+.Xr if_bridge 4
+is used together. As a workaround on this interoperability issue, the
+following two
+.Xr ifconfig 8
+flags can be used:
+.Bl -tag -width "accept_rev_ethip_ver" -offset indent
+.It accept_rev_ethip_ver
+accepts both correct EtherIP packets and ones with reversed version
+field, if enabled. If disabled, the
+.Nm
+accepts the correct packets only. This flag is enabled by default.
+.It send_rev_ethip_ver
+sends EtherIP packets with reversed version field intentionally, if
+enabled. If disabled, the
+.Nm
+sends the correct packets only. This flag is disabled by default.
+.El
+.Pp
+If interoperability with the older
+.Fx
+machines is needed, both of these two flags must be enabled.
diff --git a/share/man/man4/gpib.4 b/share/man/man4/gpib.4
new file mode 100644
index 000000000000..6e0f341c9608
--- /dev/null
+++ b/share/man/man4/gpib.4
@@ -0,0 +1,100 @@
+.\" Copyright (c) 2010, Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 24, 2010
+.Dt GPIB 4
+.Os
+.Sh NAME
+.Nm gpib
+.Nd General-Purpose Instrument Bus (GPIB) driver
+.Sh SYNOPSIS
+Either of the
+.Xr pcii 4
+or
+.Xr tnt4882 4
+drivers use this driver as the backend.
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for driving an IEEE-488 bus, also called
+IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
+Bus), or GPIB (General Purpose Instrument Bus).
+The device can become either a listener, talker, controller, and
+in particular a master controller on the bus.
+.Ss Example
+The following example code queries the device provided as
+.Va argv[1]
+for its identification response.
+.Bd -literal
+/* compile with: cc -O -o ibtest ibtest.c -lgpib */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <err.h>
+#include <vis.h>
+
+#include <gpib/gpib.h>
+
+int
+main(int argc, char **argv)
+{
+ int dmm;
+ unsigned char buf[100];
+ char vbuf[sizeof buf * 4];
+
+ /* DVM */
+ dmm = ibdev(0, (argc > 1? atoi(argv[1]): 7), 0,
+ T10s, 1, 0);
+ if (dmm < 0)
+ errx(1, "ibdev = %d\\n", dmm);
+ ibwrt(dmm, "*IDN?\\r\\n", 7);
+ ibrd(dmm, buf, sizeof buf - 1);
+ strvisx(vbuf, buf, ibcnt, VIS_WHITE | VIS_CSTYLE);
+ printf("%s\\n", vbuf);
+ return (0);
+}
+.Ed
+.Sh FILES
+.Bl -tag -width /dev/gpibNNib
+.It Pa /dev/gpib Ns Em N Ns "ib"
+Main device node to access the driver.
+.It Pa /dev/gpib Ns Em N Ns "l"
+Listen-only entry to the driver.
+When opening, an instrument can send data to this device on the
+bus in an unaddressed mode, for example hard-copy printer data.
+.El
+.Sh SEE ALSO
+.Xr gpib 3 ,
+.Xr pcii 4 ,
+.Xr tnt4882 4
+.Sh HISTORY
+The
+.Nm
+driver was written by Poul-Henning Kamp, and first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .
diff --git a/share/man/man4/gre.4 b/share/man/man4/gre.4
new file mode 100644
index 000000000000..827c93ec7202
--- /dev/null
+++ b/share/man/man4/gre.4
@@ -0,0 +1,340 @@
+.\" $NetBSD: gre.4,v 1.28 2002/06/10 02:49:35 itojun Exp $
+.\"
+.\" Copyright 1998 (c) The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Heiko W.Rupp <hwr@pilhuhn.de>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 20, 2008
+.Dt GRE 4
+.Os
+.Sh NAME
+.Nm gre
+.Nd encapsulating network device
+.Sh SYNOPSIS
+To compile the
+.Ns Nm
+device into the kernel, place the following line in the kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "device gre"
+.Ed
+.Pp
+Alternatively, to load the
+.Ns Nm
+device as a module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_gre_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+network interface pseudo device encapsulates datagrams
+into IP.
+These encapsulated datagrams are routed to a destination host,
+where they are decapsulated and further routed to their final destination.
+The
+.Dq tunnel
+appears to the inner datagrams as one hop.
+.Pp
+.Nm
+interfaces are dynamically created and destroyed with the
+.Xr ifconfig 8
+.Cm create
+and
+.Cm destroy
+subcommands.
+.Pp
+This driver currently supports the following modes of operation:
+.Bl -tag -width indent
+.It "GRE encapsulation (IP protocol number 47)"
+Encapsulated datagrams are
+prepended an outer datagram and a GRE header.
+The GRE header specifies
+the type of the encapsulated datagram and thus allows for tunneling other
+protocols than IP like e.g.\& AppleTalk.
+GRE mode is also the default tunnel mode on Cisco routers.
+This is also the default mode of operation of the
+.Nm
+interfaces.
+As part of the GRE mode,
+.Nm
+also supports Cisco WCCP protocol, both version 1 and version 2.
+Since there is no reliable way to distinguish between WCCP versions, it
+should be configured manually using the
+.Cm link2
+flag.
+If the
+.Cm link2
+flag is not set (default), then WCCP version 1 is selected.
+.It "MOBILE encapsulation (IP protocol number 55)"
+Datagrams are
+encapsulated into IP, but with a shorter encapsulation.
+The original
+IP header is modified and the modifications are inserted between the
+so modified header and the original payload.
+Like
+.Xr gif 4 ,
+only for IP-in-IP encapsulation.
+.El
+.Pp
+The
+.Nm
+interfaces support a number of
+.Xr ioctl 2 Ns s ,
+such as:
+.Bl -tag -width ".Dv GRESADDRS"
+.It Dv GRESADDRS
+Set the IP address of the local tunnel end.
+This is the source address
+set by or displayed by
+.Xr ifconfig 8
+for the
+.Nm
+interface.
+.It Dv GRESADDRD
+Set the IP address of the remote tunnel end.
+This is the destination address
+set by or displayed by
+.Xr ifconfig 8
+for the
+.Nm
+interface.
+.It Dv GREGADDRS
+Query the IP address that is set for the local tunnel end.
+This is the
+address the encapsulation header carries as local address (i.e., the real
+address of the tunnel start point).
+.It Dv GREGADDRD
+Query the IP address that is set for the remote tunnel end.
+This is the
+address the encapsulated packets are sent to (i.e., the real address of
+the remote tunnel endpoint).
+.It Dv GRESPROTO
+Set the operation mode to the specified IP protocol value.
+The
+protocol is passed to the interface in
+.Po Vt "struct ifreq" Pc Ns Li -> Ns Va ifr_flags .
+The operation mode can also be given as
+.Pp
+.Bl -tag -width ".Cm -link0" -compact
+.It Cm link0
+.Dv IPPROTO_GRE
+.It Cm -link0
+.Dv IPPROTO_MOBILE
+.El
+.Pp
+to
+.Xr ifconfig 8 .
+.Pp
+The
+.Cm link1
+flag is not used to choose encapsulation, but to modify the
+internal route search for the remote tunnel endpoint, see the
+.Sx BUGS
+section below.
+.It Dv GREGPROTO
+Query operation mode.
+.It Dv GRESKEY
+Set the GRE key used for outgoing packets.
+A value of 0 disables the key option.
+.It Dv GREGKEY
+Get the GRE key currently used for outgoing packets.
+0 means no outgoing key.
+.El
+.Pp
+Note that the IP addresses of the tunnel endpoints may be the same as the
+ones defined with
+.Xr ifconfig 8
+for the interface (as if IP is encapsulated), but need not be, as e.g.\& when
+encapsulating AppleTalk.
+.Sh EXAMPLES
+Configuration example:
+.Bd -literal
+Host X-- Host A ----------------tunnel---------- Cisco D------Host E
+ \\ |
+ \\ /
+ +------Host B----------Host C----------+
+.Ed
+.Pp
+On host A
+.Pq Fx :
+.Bd -literal -offset indent
+route add default B
+ifconfig greN create
+ifconfig greN A D netmask 0xffffffff linkX up
+ifconfig greN tunnel A D
+route add E D
+.Ed
+.Pp
+On Host D (Cisco):
+.Bd -literal -offset indent
+Interface TunnelX
+ ip unnumbered D ! e.g. address from Ethernet interface
+ tunnel source D ! e.g. address from Ethernet interface
+ tunnel destination A
+ip route C <some interface and mask>
+ip route A mask C
+ip route X mask tunnelX
+.Ed
+.Pp
+OR
+.Pp
+On Host D
+.Pq Fx :
+.Bd -literal -offset indent
+route add default C
+ifconfig greN create
+ifconfig greN D A
+ifconfig greN tunnel D A
+.Ed
+.Pp
+If all goes well, you should see packets flowing ;-)
+.Pp
+If you want to reach Host A over the tunnel (from Host D (Cisco)), then
+you have to have an alias on Host A for e.g.\& the Ethernet interface like:
+.Pp
+.Dl "ifconfig <etherif> alias Y"
+.Pp
+and on the Cisco:
+.Pp
+.Dl "ip route Y mask tunnelX"
+.Pp
+A similar setup can be used to create a link between two private networks
+(for example in the 192.168 subnet) over the Internet:
+.Bd -literal
+192.168.1.* --- Router A -------tunnel-------- Router B --- 192.168.2.*
+ \\ /
+ \\ /
+ +------ the Internet ------+
+.Ed
+.Pp
+Assuming router A has the (external) IP address A and the internal address
+192.168.1.1, while router B has external address B and internal address
+192.168.2.1, the following commands will configure the tunnel:
+.Pp
+On router A:
+.Bd -literal -offset indent
+ifconfig greN create
+ifconfig greN 192.168.1.1 192.168.2.1 link1
+ifconfig greN tunnel A B
+route add -net 192.168.2 -netmask 255.255.255.0 192.168.2.1
+.Ed
+.Pp
+On router B:
+.Bd -literal -offset indent
+ifconfig greN create
+ifconfig greN 192.168.2.1 192.168.1.1 link1
+ifconfig greN tunnel B A
+route add -net 192.168.1 -netmask 255.255.255.0 192.168.1.1
+.Ed
+.Pp
+Note that this is a safe situation where the
+.Cm link1
+flag (as discussed in the
+.Sx BUGS
+section below) may (and probably should) be set.
+.Sh NOTES
+The MTU of
+.Nm
+interfaces is set to 1476 by default, to match the value used by Cisco routers.
+If grekey is set this is lowered to 1472.
+This may not be an optimal value, depending on the link between the two tunnel
+endpoints.
+It can be adjusted via
+.Xr ifconfig 8 .
+.Pp
+For correct operation, the
+.Nm
+device needs a route to the destination that is less specific than the
+one over the tunnel.
+(Basically, there needs to be a route to the decapsulating host that
+does not run over the tunnel, as this would be a loop.)
+If the addresses are ambiguous, doing the
+.Nm ifconfig Cm tunnel
+step before the
+.Xr ifconfig 8
+call to set the
+.Nm
+IP addresses will help to find a route outside the tunnel.
+.Pp
+In order to tell
+.Xr ifconfig 8
+to actually mark the interface as
+.Dq up ,
+the keyword
+.Cm up
+must be given last on its command line.
+.Pp
+The kernel must be set to forward datagrams by setting the
+.Va net.inet.ip.forwarding
+.Xr sysctl 8
+variable to non-zero.
+.Sh SEE ALSO
+.\" Xr atalk 4 ,
+.Xr gif 4 ,
+.Xr inet 4 ,
+.Xr ip 4 ,
+.Xr netintro 4 ,
+.\" Xr options 4 ,
+.Xr protocols 5 ,
+.Xr ifconfig 8 ,
+.Xr sysctl 8
+.Pp
+A description of GRE encapsulation can be found in RFC 1701 and RFC 1702.
+.Pp
+A description of MOBILE encapsulation can be found in RFC 2004.
+.Sh AUTHORS
+.An Heiko W.Rupp Aq hwr@pilhuhn.de
+.Sh BUGS
+The
+.Fn compute_route
+code in
+.Pa if_gre.c
+toggles the last bit of the
+IP-address to provoke the search for a less specific route than the
+one directly over the tunnel to prevent loops.
+This is possibly not the best solution.
+.Pp
+To avoid the address munging described above, turn on the
+.Cm link1
+flag on the
+.Xr ifconfig 8
+command line.
+This implies that the GRE packet destination and the ifconfig remote host
+are not the same IP addresses, and that the GRE destination does not route
+over the
+.Nm
+interface itself.
+.Pp
+The current implementation uses the key only for outgoing packets.
+Incoming packets with a different key or without a key will be treated as if they
+would belong to this interface.
+.Pp
+RFC1701 is not fully supported, however all unsupported features have been
+deprecated in RFC2784.
diff --git a/share/man/man4/h_ertt.4 b/share/man/man4/h_ertt.4
new file mode 100644
index 000000000000..3dbedab451ad
--- /dev/null
+++ b/share/man/man4/h_ertt.4
@@ -0,0 +1,143 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 18, 2012
+.Dt H_ERTT 4
+.Os
+.Sh NAME
+.Nm h_ertt
+.Nd Enhanced Round Trip Time Khelp module
+.Sh SYNOPSIS
+.In netinet/khelp/h_ertt.h
+.Sh DESCRIPTION
+The
+.Nm
+Khelp module works within the
+.Xr khelp 9
+framework to provide TCP with a per-connection, low noise estimate of the
+instantaneous RTT.
+The implementation attempts to be robust in the face of delayed
+acknowledgements, TCP Segmentation Offload (TSO), receivers who manipulate TCP
+timestamps and lack of the TCP timestamp option altogether.
+.Pp
+TCP receivers using delayed acknowledgements either acknowledge every second packet
+(reflecting the time stamp of the first) or use a timeout to trigger the
+acknowledgement if no second packet arrives.
+If the heuristic used by
+.Nm
+determines that the receiver is using delayed acknowledgements, it measures the
+RTT using the second packet (the one that triggers the acknowledgement).
+It does not measure the RTT if the acknowledgement is for the
+first packet, since it cannot be accurately determined.
+.Pp
+When TSO is in use,
+.Nm
+will momentarily disable TSO whilst marking a packet to use for a new
+measurement.
+The process has negligible impact on the connection.
+.Pp
+.Nm
+associates the following struct with each connection's TCP control block:
+.Bd -literal
+struct ertt {
+ TAILQ_HEAD(txseginfo_head, txseginfo) txsegi_q; /* Private. */
+ long bytes_tx_in_rtt; /* Private. */
+ long bytes_tx_in_marked_rtt;
+ unsigned long marked_snd_cwnd;
+ int rtt;
+ int maxrtt;
+ int minrtt;
+ int dlyack_rx; /* Private. */
+ int timestamp_errors; /* Private. */
+ int markedpkt_rtt; /* Private. */
+ uint32_t flags;
+};
+.Ed
+.Pp
+The fields marked as private should not be manipulated by any code outside of
+the
+.Nm
+implementation.
+The non-private fields provide the following data:
+.Bl -tag -width ".Va bytes_tx_in_marked_rtt" -offset indent
+.It Va bytes_tx_in_marked_rtt
+The number of bytes transmitted in the
+.Va markedpkt_rtt .
+.It Va marked_snd_cwnd
+The value of cwnd for the marked rtt measurement.
+.It Va rtt
+The most recent RTT measurement.
+.It Va maxrtt
+The longest RTT measurement that has been taken.
+.It Va minrtt
+The shortest RTT measurement that has been taken.
+.It Va flags
+The ERTT_NEW_MEASUREMENT flag will be set by the implementation when a new
+measurement is available.
+It is the responsibility of
+.Nm
+consumers to unset the flag if they wish to use it as a notification method for
+new measurements.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_vegas 4 ,
+.Xr mod_cc 4 ,
+.Xr hhook 9 ,
+.Xr khelp 9
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 9.0 .
+.Pp
+The module was first released in 2010 by David Hayes whilst working on the
+NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+Khelp module and this manual page were written by
+.An David Hayes Aq david.hayes@ieee.org .
+.Sh BUGS
+The module maintains enhanced RTT estimates for all new TCP connections created
+after the time at which the module was loaded.
+It might be beneficial to see if it is possible to have the module only affect
+connections which actually care about ERTT estimates.
diff --git a/share/man/man4/harp.4 b/share/man/man4/harp.4
new file mode 100644
index 000000000000..9495f62d5646
--- /dev/null
+++ b/share/man/man4/harp.4
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt HARP 4
+.Os
+.Sh NAME
+.Nm harp
+.Nd pseudo physical interface driver for HARP
+.Sh SYNOPSIS
+.Cd device atm
+.Cd options NATM
+.Cd options ATM_CORE
+.Cd device harp
+.Sh DESCRIPTION
+The
+.Nm
+driver, when loaded, attaches to all
+.Xr netgraph 4
+ATM interfaces in the system, and for
+each of these interfaces presents a physical interface to the HARP stack.
+The name of the
+.Nm
+physical interface is the same as the name of the
+Netgraph interface (they are in different namespaces).
+.Sh SEE ALSO
+.Xr fatm 4 ,
+.Xr hatm 4 ,
+.Xr ng_atm 4 ,
+.Xr patm 4 ,
+.Xr atm 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh CAVEATS
+When
+.Xr fatm 4
+is used, it must be started before
+.Nm
+is loaded, to get the correct configuration for the HARP physical interface.
diff --git a/share/man/man4/hatm.4 b/share/man/man4/hatm.4
new file mode 100644
index 000000000000..59de800438e7
--- /dev/null
+++ b/share/man/man4/hatm.4
@@ -0,0 +1,282 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" hatm(4) man page
+.\"
+.Dd May 15, 2003
+.Dt HATM 4
+.Os
+.Sh NAME
+.Nm hatm
+.Nd "device driver for Fore/Marconi HE155 and HE622 ATM interfaces"
+.Sh SYNOPSIS
+.Cd device hatm
+.Cd device utopia
+.Cd device atm
+.Pp
+.Cd options NATM
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports the FORE (now Marconi) HE155 and HE622 ATM interface
+cards.
+The driver interfaces with the
+.Xr natm 4
+framework,
+.Xr netgraph 4
+and the HARP ATM stack.
+It provides only PVC services.
+Signalling, ATMARP, ILMI and other
+higher layer protocols are implemented using
+.Xr netgraph 4
+or HARP.
+.Pp
+For configuring the card for IP see
+.Xr natmip 4 .
+.Pp
+The following sysctls are recognized by the driver additionally to those
+handled by
+.Xr utopia 4 :
+.Bl -tag -width indent
+.It Va hw.atm.hatm.natm_traffic
+This is the traffic type to be used for NATM pvc connections.
+The type of
+this variable is integer and it must have one of the values 0 (UBR) or 1 (CBR).
+.It Va hw.atm.hatm.natm_pcr
+This is the peak cell rate to be used for NATM CBR connections.
+.It Va hw.atm.hatm Ns Ar N Ns Va .stats
+Contains an array of
+.Vt uint32_t
+with device specific statistics.
+.It Va hw.atm.hatm Ns Ar N Ns Va .istats
+Contains an array of
+.Vt uint32_t
+with internal driver statistics.
+.It Va hw.atm.hatm Ns Ar N Ns Va .debug
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+These are the debugging flags.
+See
+.Pa src/sys/dev/hatm/if_hatmvar.h
+for the possible flags.
+.It Va hw.atm.hatm Ns Ar N Ns Va .tsr
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+This is an array containing all transmission status registers.
+For each of the
+4096 possible VCCs there are 15 32-bit registers.
+.It Va hw.atm.hatm Ns Ar N Ns Va .tpd
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+This is an array containing all on card current transmission packet descriptors.
+For each of the 4096 possible VCCs there are 16 32-bit registers.
+.It Va hw.atm.hatm Ns Ar N Ns Va .mbox
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+This is an array containing the mbox registers.
+.It Va hw.atm.hatm Ns Ar N Ns Va .cm
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+This is an array containing all connection memory registers.
+The first 32-bit integer of this array is the ABR base address.
+.It Va hw.atm.hatm Ns Ar N Ns Va .heregs
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+This is an array containing all card registers including SUNI and the FLASH ROM.
+.It Va hw.atm.hatm Ns Ar N Ns Va .lbmem
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+Returns the contents of the local memory.
+.El
+.Pp
+The driver supports the media options
+.Cm sdh , noscramb
+and
+.Cm unassigned
+(see
+.Xr utopia 4 ) .
+.Sh ENVIRONMENT
+When attaching to a device the driver checks the kernel environment
+(see
+.Xr kenv 1 )
+to see if the default queues sizes should be overwritten or not.
+The
+following variables are checked and interpreted as unsigned integer
+values (in either radix):
+.Bl -tag -width indent
+.It Va hw.hatm Ns Ar N Ns Va .rbps0_size
+Size of the small receive buffer pool 0.
+This pool is used for all
+except raw AAL connections.
+The pool size must be a power of two between
+4 and 8192 inclusive.
+When attaching the driver allocates this number
+of mbufs.
+.It Va hw.hatm Ns Ar N Ns Va .rbps0_thresh
+Interrupt threshold for small receive buffer pool 0.
+When the number of free
+buffers in the pool falls below this threshold it generates an interrupt
+so that the driver can refill the pool.
+.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh
+Size of the large receive buffer pool 0.
+This pool is used for all
+except raw AAL connections.
+The pool size must be a power of two between
+4 and 8192 inclusive.
+When attaching the driver allocates this number
+of mbufs with clusters.
+.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh
+Interrupt threshold for large receive buffer pool 0.
+When the number of free
+buffers in the pool falls below this threshold it generates an interrupt
+so that the driver can refill the pool.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq0_size
+Size of receive buffer return queue 0.
+This queue is used to return buffers
+filled with received frames to the driver.
+The size must be a power of 2
+between 1 and 16384 inclusive.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq0_thresh
+Interrupt threshold for receive buffer return queue 0.
+This threshold
+should only be triggered in exceptional cases.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq0_tout
+Interrupt timeout for receive buffer return queue 0.
+An interrupt is generated
+after this time if the queue is not empty.
+The number is in internal card
+ticks.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq0_pcnt
+Packet count threshold for receive buffer return queue 0.
+An interrupt
+is generated if this number of packets is in the queue.
+.It Va hw.hatm Ns Ar N Ns Va .rbps1_size
+Size of the small receive buffer pool 1.
+This pool is used for all
+raw AAL connections.
+The pool size must be a power of two between
+4 and 8192 inclusive.
+When attaching the driver allocates this number
+of mbufs.
+.It Va hw.hatm Ns Ar N Ns Va .rbps1_thresh
+Interrupt threshold for small receive buffer pool 1.
+When the number of free
+buffers in the pool falls below this threshold it generates an interrupt
+so that the driver can refill the pool.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq1_size
+Size of receive buffer return queue 1.
+This queue is used to return buffers
+filled with received cells to the driver.
+The size must be a power of 2
+between 1 and 16384 inclusive.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq1_thresh
+Interrupt threshold for receive buffer return queue 1.
+This threshold
+should only be triggered in exceptional cases.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq1_tout
+Interrupt timeout for receive buffer return queue 1.
+An interrupt is generated
+after this time if the queue is not empty.
+The number is in internal card
+ticks.
+.It Va hw.hatm Ns Ar N Ns Va .rbrq1_pcnt
+Packet count threshold for receive buffer return queue 0.
+An interrupt
+is generated if this number of cells is in the queue.
+.It Va hw.hatm Ns Ar N Ns Va .irq0_size
+Size of interrupt queue 0.
+This must be a number between 1 and 1023 inclusive.
+.It Va hw.hatm Ns Ar N Ns Va .irq0_thresh
+Interrupt retrigger threshold of interrupt queue 0.
+A new interrupt is trigger
+if the queue fill state reaches this threshold and the interrupt was no
+served.
+.It Va hw.hatm Ns Ar N Ns Va .tbrq0_size
+Transmit buffer return queue 0 size.
+This queue is used to feed back empty
+buffers of transmitted frames back to the driver.
+It must be a power of 2
+between 1 and 4096 inclusive.
+.It Va hw.hatm Ns Ar N Ns Va .tbrq0_thresh
+Transmit buffer return queue 0 threshold.
+An interrupt is generated if the
+queue fill state reaches this point.
+.It Va hw.hatm Ns Ar N Ns Va .tpdrq_size
+Transmit descriptor ready queue size.
+This queue is used by the driver
+to feed transmit descriptors into the card.
+The size must be a power of 2
+between 1 and 16384 inclusive.
+.It Va hw.hatm Ns Ar N Ns Va .tpdmax
+Maximum number of active TPDs per connection.
+This controls the maximum
+number of outstanding packet chunks per connection and thus the maximum
+delay packets can have because of queueing on the adapter.
+If set to 0,
+a connection can eat up all available TPDs.
+.It Va hw.hatm Ns Ar N Ns Va .mbuf_max_pages
+Maximum number of memory pages allocated to small external mbufs.
+This must not be zero and not larger than 65536.
+.El
+.Sh DIAGNOSTICS
+.Bd -literal
+hatm0: <FORE HE> mem 0xd2600000-0xd26fffff irq 9 at device 15.0 on pci2
+hatm0: ForeRunnerHE 622, Rev. D, S/N 2949834, MAC=00:20:48:2d:02:ca
+.Ed
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr natmip 4 ,
+.Xr utopia 4 ,
+.Xr ifconfig 8 ,
+.Xr route 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh CAVEATS
+When putting a HE155 into a 64-bit 66MHz PCI slot the machine may hang.
+This occurs very early in the POST so that even the display does not turn on.
+The HE155 runs only in 33MHz slots (either 32 or 64-bit).
+HE622 cards work just fine in 64-bit slots.
+.Pp
+The driver may not work with bounce buffer, because of
+.Xr bus_dmamap_sync 9
+missing the
+.Fa offset
+and
+.Fa len
+arguments the
+.Nx
+function has.
diff --git a/share/man/man4/hfa.4 b/share/man/man4/hfa.4
new file mode 100644
index 000000000000..1c254bfeb5a3
--- /dev/null
+++ b/share/man/man4/hfa.4
@@ -0,0 +1,139 @@
+.\"
+.\" Copyright (c) 2004 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 6, 2004
+.Dt HFA 4
+.Os
+.Sh NAME
+.Nm hfa
+.Nd FORE Systems 200-Series ATM adapter driver
+.Sh SYNOPSIS
+.Cd device hfa
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn FORE
+Systems
+.Tn ATM
+series 200 adapters.
+This driver will support up to eight devices in a system
+at any given time.
+The
+.Nm
+driver follows the
+.Tn AALI
+or
+.Tn FORE
+.Tn ATM
+Adaptation Layer Interface and as such
+will adhere to its specifications.
+The supported
+.Tn AALs
+include:
+.Bl -bullet
+.It
+FORE AAL 0:
+The cell service;
+.It
+FORE AAL 4:
+Version three and four of AAL;
+.It
+FORE AAL 5:
+Version five of AAL.
+.El
+.Pp
+The
+.Nm
+driver supports traffic shaping for cards with firmware
+revisions of 4.X.X, see
+.Xr fore_dnld 8 .
+The following sysctls are recognized by the driver and
+may be used to enable or disable traffic shaping:
+.Bl -tag -width indent
+.It Va hw.atm.hfa Ns Ar N Ns Va .shape Pq 0
+Disable shaping on card number
+.Ar N .
+.It Va hw.atm.hfa Ns Ar N Ns Va .shape Pq 1
+Set one VCI to be traffic shaped on device
+.Ar N .
+This will shape the first CBR VCI which is opened.
+.It Va hw.atm.hfa Ns Ar N Ns Va .shape Pq 2
+Attempt to shape all VCIs on device
+.Ar N .
+.El
+The firmware should be loaded before using this
+driver, this can be an easy task if the
+.Xr fore_dnld 8
+utility is used.
+If the
+.Pa /etc/rc.d/atm1
+file has been properly configured then the firmware
+update should be automatic.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+FORE Systems PCA-200E ATM
+.It
+FORE Systems 200S
+.It
+FORE Systems 200
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "fore_cmd_drain: %s%d: GET_PROM failed"
+The driver failed to drain the PROM buffer.
+.It "fore initialization failed: intf=%s%d"
+Initialization of the card has failed.
+.It "fore initialization timed out: intf=%s%d"
+Initialization of the card has timed out.
+.It "hfa: version mismatch: fore=%d.%d kernel=%d.%d"
+A version mismatch error has occurred.
+.El
+.Sh SEE ALSO
+.Xr fatm 4 ,
+.Xr harp 4 ,
+.Xr ng_atm 4 ,
+.Xr atm 8 ,
+.Xr fore_dnld 8
+.Sh HISTORY
+The
+.Nm
+driver was written by Network Computing Services, Inc.\&
+and added to
+.Fx 3.0
+by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+This manual page first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/hifn.4 b/share/man/man4/hifn.4
new file mode 100644
index 000000000000..a53bac3231f7
--- /dev/null
+++ b/share/man/man4/hifn.4
@@ -0,0 +1,134 @@
+.\" $OpenBSD: hifn.4,v 1.32 2002/09/26 07:55:40 miod Exp $
+.\"
+.\" Copyright (c) 2000 Theo de Raadt
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 19, 2009
+.Dt HIFN 4
+.Os
+.Sh NAME
+.Nm hifn
+.Nd Hifn 7751/7951/7811/7955/7956 crypto accelerator
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device cryptodev"
+.Cd "device hifn"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hifn_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports various cards containing the Hifn 7751, 7951,
+7811, 7955, and 7956 chipsets.
+.Pp
+The
+.Nm
+driver registers itself to accelerate DES, Triple-DES,
+AES (7955 and 7956 only), ARC4, MD5,
+MD5-HMAC, SHA1, and SHA1-HMAC operations for
+.Xr ipsec 4
+and
+.Xr crypto 4 .
+.Pp
+The Hifn
+.Tn 7951 ,
+.Tn 7811 ,
+.Tn 7955 ,
+and
+.Tn 7956
+will also supply data to the kernel
+.Xr random 4
+subsystem.
+.Sh HARDWARE
+The
+.Nm
+driver supports various cards containing the Hifn 7751, 7951,
+7811, 7955, and 7956
+chipsets, such as:
+.Bl -tag -width namenamenamena -offset indent
+.It Invertex AEON
+No longer being made.
+Came as 128KB SRAM model, or 2MB DRAM model.
+.It Hifn 7751
+Reference board with 512KB SRAM.
+.It PowerCrypt
+Comes with 512KB SRAM.
+.It XL-Crypt
+Only board based on 7811 (which is faster than 7751 and has
+a random number generator).
+.It NetSec 7751
+Supports the most IPsec sessions, with 1MB SRAM.
+.It Soekris Engineering vpn1201 and vpn1211
+See
+.Pa http://www.soekris.com/ .
+Contains a 7951 and supports symmetric and random number operations.
+.It Soekris Engineering vpn1401 and vpn1411
+See
+.Pa http://www.soekris.com/ .
+Contains a 7955 and supports symmetric and random number operations.
+.El
+.Sh SEE ALSO
+.Xr crypt 3 ,
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Ox 2.7 .
+The
+.Nm
+device driver was imported to
+.Fx 5.0 .
+.Sh CAVEATS
+The Hifn 9751 shares the same PCI ID.
+This chip is basically a 7751, but with the cryptographic functions missing.
+Instead, the 9751 is only capable of doing compression.
+Since we do not currently attempt to use any of these chips to do
+compression, the 9751-based cards are not useful.
+.Pp
+Support for the 7955 and 7956 is incomplete; the asymmetric crypto
+facilities are to be added and the performance is suboptimal.
+.Sh BUGS
+The 7751 chip starts out at initialization by only supporting compression.
+A proprietary algorithm, which has been reverse engineered, is required to
+unlock the cryptographic functionality of the chip.
+It is possible for vendors to make boards which have a lock ID not known
+to the driver, but all vendors currently just use the obvious ID which is
+13 bytes of 0.
diff --git a/share/man/man4/hme.4 b/share/man/man4/hme.4
new file mode 100644
index 000000000000..2bdc72a6af42
--- /dev/null
+++ b/share/man/man4/hme.4
@@ -0,0 +1,151 @@
+.\" $NetBSD: hme.4,v 1.4 2003/02/14 15:20:18 grant Exp $
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Klaus Klein.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 14, 2009
+.Dt HME 4
+.Os
+.Sh NAME
+.Nm hme
+.Nd "Sun Microelectronics STP2002-STQ Ethernet interfaces device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device hme"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_hme_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Sun Microelectronics STP2002-STQ
+.Dq Happy Meal Ethernet
+Fast Ethernet interfaces.
+.Pp
+All controllers supported by the
+.Nm
+driver have TCP checksum offload capability for both receive and transmit,
+support for the reception and transmission of extended frames for
+.Xr vlan 4
+and a 128-bit multicast hash filter.
+.Sh HARDWARE
+The
+.Nm
+driver supports the on-board Ethernet interfaces of many
+Sun
+.Tn UltraSPARC
+workstation and server models.
+.Pp
+Cards supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Sun PCI SunSwift Adapter
+.Pq Dq SUNW,hme
+.It
+Sun SBus SunSwift Adapter
+.Dq ( hme
+and
+.Dq SUNW,hme )
+.It
+Sun PCI Sun100BaseT Adapter 2.0
+.Pq Dq SUNW,hme
+.It
+Sun SBus Sun100BaseT 2.0
+.Pq Dq SUNW,hme
+.It
+Sun PCI Quad FastEthernet Controller
+.Pq Dq SUNW,qfe
+.It
+Sun SBus Quad FastEthernet Controller
+.Pq Dq SUNW,qfe
+.El
+.Sh NOTES
+On sparc64 the
+.Nm
+driver respects the
+.Va local-mac-address?
+system configuration variable which can be set in the Open Firmware boot
+monitor using the
+.Ic setenv
+command or by
+.Xr eeprom 8 .
+If set to
+.Dq Li false
+(the default), the
+.Nm
+driver will use the system's default MAC address for all of its devices.
+If set to
+.Dq Li true ,
+the unique MAC address of each interface is used if present rather than
+the system's default MAC address.
+.Pp
+Supported interfaces having their own MAC address include on-board versions
+on boards equipped with more than one Ethernet interface and all add-on cards
+except the single-port SBus versions.
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr intro 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr vlan 4 ,
+.Xr eeprom 8 ,
+.Xr ifconfig 8
+.Rs
+.%T "STP2002QFP Fast Ethernet, Parallel Port, SCSI (FEPS) User's Guide"
+.%D April 1996
+.%A Sun Microelectronics
+.%U http://mediacast.sun.com/users/Barton808/media/STP2002QFP-FEPs_UG.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 1.5 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Paul Kranenburg
+.Aq pk@NetBSD.org .
diff --git a/share/man/man4/hpet.4 b/share/man/man4/hpet.4
new file mode 100644
index 000000000000..cd1b7663cc0a
--- /dev/null
+++ b/share/man/man4/hpet.4
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 14, 2010
+.Dt HPET 4
+.Os
+.Sh NAME
+.Nm hpet
+.Nd High Precision Event Timer driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.hpet. Ns Ar X Ns Va .allowed_irqs
+is a 32bit mask. Each set bit allows driver to use respective IRQ,
+if BIOS also set respective capability bit in comparator's configuration
+register.
+Default value is 0xffff0000, except some known broken hardware.
+.It Va hint.hpet. Ns Ar X Ns Va .clock
+controls event timers functionality support. Setting to 0, disables it.
+Default value is 1.
+.It Va hint.hpet. Ns Ar X Ns Va .legacy_route
+controls "LegacyReplacement Route" mode. If enabled, HPET will steal IRQ0 of
+i8254 timer and IRQ8 of RTC. Before using it, make sure that respective
+drivers are not using interrupts, by setting also:
+.Bd -literal
+hint.attimer.0.clock=0
+hint.atrtc.0.clock=0
+.Ed
+Default value is 0.
+.It Va hint.hpet. Ns Ar X Ns Va .per_cpu
+controls how much per-CPU event timers should driver attempt to register.
+This functionality requires every comparator in a group to have own unshared
+IRQ, so it depends on hardware capabilities and interrupts configuration.
+Default value is 1.
+.El
+.Sh DESCRIPTION
+This driver uses High Precision Event Timer hardware (part of the chipset,
+usually enumerated via ACPI) to supply kernel with one time counter and
+several (usually from 3 to 8) event timers.
+This hardware includes single main counter with known increment frequency
+(10MHz or more), and several programmable comparators (optionally with
+automatic reload feature).
+When value of the main counter matches current value of any comparator,
+interrupt can be generated.
+Depending on hardware capabilities and configuration, interrupt can be
+delivered as regular I/O APIC interrupt (ISA or PCI) in range from 0 to 31,
+or as Front Side Bus interrupt, alike to PCI MSI interrupts, or in so called
+"LegacyReplacement Route" HPET can steal IRQ0 of i8254 and IRQ8 of the RTC.
+Interrupt can be either edge- or level-triggered. In last case they could be
+safely shared with PCI IRQs.
+Driver prefers to use FSB interrupts, if supported, to avoid sharing.
+If it is not possible, it uses single sharable IRQ from PCI range.
+Other modes (LegacyReplacement and ISA IRQs) require special care to setup,
+but could be configured manually via device hints.
+.Pp
+Event timers provided by the driver support both one-shot an periodic modes
+and irrelevant to CPU power states.
+.Pp
+Depending on hardware capabilities and configuration, driver can expose each
+comparator as separate event timer or group them into one or several per-CPU
+event timers. In last case interrupt of every of those comparators within
+group is bound to specific CPU core. This is possible only when each
+of these comparators has own unsharable IRQ.
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr apic 4 ,
+.Xr atrtc 4 ,
+.Xr attimer 4 ,
+.Xr eventtimers 4 ,
+.Xr timecounters 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.3 .
+Support for event timers was added in
+.Fx 9.0 .
diff --git a/share/man/man4/hpt27xx.4 b/share/man/man4/hpt27xx.4
new file mode 100644
index 000000000000..01f9ba563645
--- /dev/null
+++ b/share/man/man4/hpt27xx.4
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2011 iXsystems, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 28, 2011
+.Dt HPT27XX 4
+.Os
+.Sh NAME
+.Nm hpt27xx
+.Nd "HighPoint RocketRAID 27xx SAS 6Gb/s HBA card driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device hpt27xx"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hpt27xx_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for HighPoint's RocketRAID 27xx based RAID controller.
+.Pp
+These devices support SAS disk drives
+and provide RAID0 (striping), RAID1 (mirroring), and RAID5 functionality.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SAS
+controllers:
+.Pp
+.Bl -bullet -compact
+.It
+HighPoint's RocketRAID 271x series
+.It
+HighPoint's RocketRAID 272x series
+.It
+HighPoint's RocketRAID 274x series
+.It
+HighPoint's RocketRAID 276x series
+.It
+HighPoint's RocketRAID 278x series
+.El
+.Sh NOTES
+The
+.Nm
+driver only works on the i386 and amd64 platforms as it requires a binary
+blob object from the manufacturer which they only supply for these platforms.
+The
+.Nm
+driver does
+.Em not
+work on i386 with
+.Xr pae 4
+enabled.
+.Sh SEE ALSO
+.Xr kld 4 ,
+.Xr kldload 8 ,
+.Xr loader 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An HighPoint Technologies, Inc. .
+This manual page was written by
+.An Xin LI Aq delphij@FreeBSD.org
+for iXsystems, Inc.
diff --git a/share/man/man4/hptiop.4 b/share/man/man4/hptiop.4
new file mode 100644
index 000000000000..94a6dbd33512
--- /dev/null
+++ b/share/man/man4/hptiop.4
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2007 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 1, 2011
+.Dt HPTIOP 4
+.Os
+.Sh NAME
+.Nm hptiop
+.Nd "HighPoint RocketRAID 3xxx/4xxx device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device hptiop"
+.Cd "device scbus"
+.Cd "device da"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hptiop_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the HighPoint RocketRAID 3xxx/4xxx series
+of SAS and SATA RAID controllers.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SAS and SATA RAID controllers:
+.Pp
+.Bl -bullet -compact
+.It
+HighPoint RocketRAID 4320
+.It
+HighPoint RocketRAID 4321
+.It
+HighPoint RocketRAID 4322
+.It
+HighPoint RocketRAID 3220
+.It
+HighPoint RocketRAID 3320
+.It
+HighPoint RocketRAID 3410
+.It
+HighPoint RocketRAID 3520
+.It
+HighPoint RocketRAID 3510
+.It
+HighPoint RocketRAID 3511
+.It
+HighPoint RocketRAID 3521
+.It
+HighPoint RocketRAID 3522
+.It
+HighPoint RocketRAID 3540
+.It
+HighPoint RocketRAID 3120
+.It
+HighPoint RocketRAID 3122
+.It
+HighPoint RocketRAID 3020
+.El
+.Sh NOTES
+The
+.Nm
+driver has only been tested on the i386 and amd64 platforms.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr hptmv 4 ,
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by HighPoint Technologies, Inc.
diff --git a/share/man/man4/hptmv.4 b/share/man/man4/hptmv.4
new file mode 100644
index 000000000000..240a32fb5505
--- /dev/null
+++ b/share/man/man4/hptmv.4
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2004 David E. O'Brien
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 17, 2005
+.Dt HPTMV 4
+.Os
+.Sh NAME
+.Nm hptmv
+.Nd "HighPoint RocketRAID 182x device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device hptmv"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hptmv_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for HighPoint's RocketRAID 182x based RAID controller.
+.Pp
+These devices support ATA disk drives
+and provide RAID0 (striping), RAID1 (mirroring), and RAID5 functionality.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following ATA RAID
+controllers:
+.Pp
+.Bl -bullet -compact
+.It
+HighPoint's RocketRAID 182x series
+.El
+.Sh NOTES
+The
+.Nm
+driver only works on the i386 and amd64 platforms as it requires a binary
+blob object from the manufacturer which they only supply for these platforms.
+The
+.Nm
+driver does
+.Em not
+work on i386 with
+.Xr pae 4
+enabled.
+.Sh SEE ALSO
+.Xr kld 4 ,
+.Xr kldload 8 ,
+.Xr loader 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An HighPoint Technologies, Inc. ,
+and ported to
+.Fx
+by
+.An Scott Long .
+This manual page was written by
+.An David E. O'Brien .
+.Sh BUGS
+The
+.Nm
+driver does not support manipulating the RAID from the OS, RAIDs need
+to be set up from the on-board BIOS.
diff --git a/share/man/man4/hptrr.4 b/share/man/man4/hptrr.4
new file mode 100644
index 000000000000..847d86db7c02
--- /dev/null
+++ b/share/man/man4/hptrr.4
@@ -0,0 +1,137 @@
+.\"
+.\" Copyright (c) 2007 Me
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 8, 2009
+.Dt HPTRR 4
+.Os
+.Sh NAME
+.Nm hptrr
+.Nd "HighPoint RocketRAID device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device hptrr"
+.Cd "device scbus"
+.Cd "device da"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hptrr_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the loader:
+.Bl -ohang
+.It Va hw.hptrr.attach_generic
+set to 0 to deny driver attach to chips with generic Marvell (non-HighPoint)
+PCI identification. These chips are also supported by ata(4).
+Some vendors are using same chips, but without providing RAID BIOS.
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for HighPoint's RocketRAID based RAID controllers.
+.Pp
+These devices support SATA/ATA disk drives
+and provide RAID0 (striping), RAID1 (mirroring), and RAID5 functionality.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following RAID
+controllers:
+.Pp
+.Bl -bullet -compact
+.It
+RocketRAID 172x series
+.It
+RocketRAID 174x series
+.It
+RocketRAID 2210
+.It
+RocketRAID 222x series
+.It
+RocketRAID 2240
+.It
+RocketRAID 230x series
+.It
+RocketRAID 231x series
+.It
+RocketRAID 232x series
+.It
+RocketRAID 2340
+.It
+RocketRAID 2522
+.El
+.Sh NOTES
+The
+.Nm
+driver only works on the i386 and amd64 platforms as it requires a binary
+blob object from the manufacturer which they only supply for these platforms.
+The
+.Nm
+driver does
+.Em not
+work on i386 with
+.Xr pae 4
+enabled.
+.Pp
+This driver does not support the RR182x series controller.
+See the
+.Xr hptmv 4
+manual page for details on support.
+.Pp
+This driver supersedes the older rr232x driver.
+.Sh SEE ALSO
+.Xr ata 4 ,
+.Xr cam 4 ,
+.Xr hptmv 4 ,
+.Xr loader 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An HighPoint Technologies, Inc. ,
+and ported to
+.Fx
+by
+.An Scott Long .
+This manual page was written by
+.An David E. O'Brien .
+.Sh BUGS
+The
+.Nm
+driver does not support manipulating the RAID from the OS, RAIDs need
+to be set up from the on-board BIOS.
diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4
new file mode 100644
index 000000000000..f65e8c406900
--- /dev/null
+++ b/share/man/man4/hwpmc.4
@@ -0,0 +1,833 @@
+.\" Copyright (c) 2003-2008 Joseph Koshy
+.\" Copyright (c) 2007 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed by A. Joseph Koshy under
+.\" sponsorship from the FreeBSD Foundation and Google, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 22, 2008
+.Dt HWPMC 4
+.Os
+.Sh NAME
+.Nm hwpmc
+.Nd "Hardware Performance Monitoring Counter support"
+.Sh SYNOPSIS
+.Cd "options HWPMC_HOOKS"
+.Cd "device hwpmc"
+.Pp
+Additionally, for i386 systems:
+.Cd "device apic"
+.Sh DESCRIPTION
+The
+.Nm
+driver virtualizes the hardware performance monitoring facilities in
+modern CPUs and provides support for using these facilities from
+user level processes.
+.Pp
+The driver supports multi-processor systems.
+.Pp
+PMCs are allocated using the
+.Dv PMC_OP_PMCALLOCATE
+request.
+A successful
+.Dv PMC_OP_PMCALLOCATE
+request will return a handle to the requesting process.
+Subsequent operations on the allocated PMC use this handle to denote
+the specific PMC.
+A process that has successfully allocated a PMC is termed an
+.Dq "owner process" .
+.Pp
+PMCs may be allocated with process or system scope.
+.Bl -tag -width ".Em Process-scope"
+.It Em "Process-scope"
+The PMC is active only when a thread belonging
+to a process it is attached to is scheduled on a CPU.
+.It Em "System-scope"
+The PMC operates independently of processes and
+measures hardware events for the system as a whole.
+.El
+.Pp
+PMCs may be allocated for counting or for sampling:
+.Bl -tag -width ".Em Counting"
+.It Em Counting
+In counting modes, the PMCs count hardware events.
+These counts are retrievable using the
+.Dv PMC_OP_PMCREAD
+system call on all architectures.
+Some architectures offer faster methods of reading these counts.
+.It Em Sampling
+In sampling modes, the PMCs are configured to sample the CPU
+instruction pointer (and optionally to capture the call chain leading
+up to the sampled instruction pointer) after a configurable number of
+hardware events have been observed.
+Instruction pointer samples and call chain records are usually
+directed to a log file for subsequent analysis.
+.El
+.Pp
+Scope and operational mode are orthogonal; a PMC may thus be
+configured to operate in one of the following four modes:
+.Bl -tag -width indent
+.It Process-scope, counting
+These PMCs count hardware events whenever a thread in their attached process is
+scheduled on a CPU.
+These PMCs normally count from zero, but the initial count may be
+set using the
+.Dv PMC_OP_SETCOUNT
+operation.
+Applications can read the value of the PMC anytime using the
+.Dv PMC_OP_PMCRW
+operation.
+.It Process-scope, sampling
+These PMCs sample the target processes instruction pointer after they
+have seen the configured number of hardware events.
+The PMCs only count events when a thread belonging to their attached
+process is active.
+The desired frequency of sampling is set using the
+.Dv PMC_OP_SETCOUNT
+operation prior to starting the PMC.
+Log files are configured using the
+.Dv PMC_OP_CONFIGURELOG
+operation.
+.It System-scope, counting
+These PMCs count hardware events seen by them independent of the
+processes that are executing.
+The current count on these PMCs can be read using the
+.Dv PMC_OP_PMCRW
+request.
+These PMCs normally count from zero, but the initial count may be
+set using the
+.Dv PMC_OP_SETCOUNT
+operation.
+.It System-scope, sampling
+These PMCs will periodically sample the instruction pointer of the CPU
+they are allocated on, and will write the sample to a log for further
+processing.
+The desired frequency of sampling is set using the
+.Dv PMC_OP_SETCOUNT
+operation prior to starting the PMC.
+Log files are configured using the
+.Dv PMC_OP_CONFIGURELOG
+operation.
+.Pp
+System-wide statistical sampling can only be enabled by a process with
+super-user privileges.
+.El
+.Pp
+Processes are allowed to allocate as many PMCs as the hardware and
+current operating conditions permit.
+Processes may mix allocations of system-wide and process-private
+PMCs.
+Multiple processes may be using PMCs simultaneously.
+.Pp
+Allocated PMCs are started using the
+.Dv PMC_OP_PMCSTART
+operation, and stopped using the
+.Dv PMC_OP_PMCSTOP
+operation.
+Stopping and starting a PMC is permitted at any time the owner process
+has a valid handle to the PMC.
+.Pp
+Process-private PMCs need to be attached to a target process before
+they can be used.
+Attaching a process to a PMC is done using the
+.Dv PMC_OP_PMCATTACH
+operation.
+An already attached PMC may be detached from its target process
+using the converse
+.Dv PMC_OP_PMCDETACH
+operation.
+Issuing a
+.Dv PMC_OP_PMCSTART
+operation on an as yet unattached PMC will cause it to be attached
+to its owner process.
+The following rules determine whether a given process may attach
+a PMC to another target process:
+.Bl -bullet -compact
+.It
+A non-jailed process with super-user privileges is allowed to attach
+to any other process in the system.
+.It
+Other processes are only allowed to attach to targets that they would
+be able to attach to for debugging (as determined by
+.Xr p_candebug 9 ) .
+.El
+.Pp
+PMCs are released using
+.Dv PMC_OP_PMCRELEASE .
+After a successful
+.Dv PMC_OP_PMCRELEASE
+operation the handle to the PMC will become invalid.
+.Ss Modifier Flags
+The
+.Dv PMC_OP_PMCALLOCATE
+operation supports the following flags that modify the behavior
+of an allocated PMC:
+.Bl -tag -width indent
+.It Dv PMC_F_CALLCHAIN
+This modifier informs sampling PMCs to record a callchain when
+capturing a sample.
+The maximum depth to which call chains are recorded is specified
+by the
+.Va "kern.hwpmc.callchaindepth"
+kernel tunable.
+.It Dv PMC_F_DESCENDANTS
+This modifier is valid only for a PMC being allocated in process-private
+mode.
+It signifies that the PMC will track hardware events for its
+target process and the target's current and future descendants.
+.It Dv PMC_F_KGMON
+This modifier is valid only for a PMC being allocated in system-wide
+sampling mode.
+It signifies that the PMC's sampling interrupt is to be used to drive
+kernel profiling via
+.Xr kgmon 8 .
+This functionality is currently unimplemented.
+.It Dv PMC_F_LOG_PROCCSW
+This modifier is valid only for a PMC being allocated in process-private
+mode.
+When this modifier is present, at every context switch,
+.Nm
+will log a record containing the number of hardware events
+seen by the target process when it was scheduled on the CPU.
+.It Dv PMC_F_LOG_PROCEXIT
+This modifier is valid only for a PMC being allocated in process-private
+mode.
+With this modifier present,
+.Nm
+will maintain per-process counts for each target process attached to
+a PMC.
+At process exit time, a record containing the target process' PID and
+the accumulated per-process count for that process will be written to the
+configured log file.
+.El
+.Pp
+Modifiers
+.Dv PMC_F_LOG_PROCEXIT
+and
+.Dv PMC_F_LOG_PROCCSW
+may be used in combination with modifier
+.Dv PMC_F_DESCENDANTS
+to track the behavior of complex pipelines of processes.
+PMCs with modifiers
+.Dv PMC_F_LOG_PROCEXIT
+and
+.Dv PMC_F_LOG_PROCCSW
+cannot be started until their owner process has configured a log file.
+.Ss Signals
+The
+.Nm
+driver may deliver signals to processes that have allocated PMCs:
+.Bl -tag -width ".Dv SIGBUS"
+.It Dv SIGIO
+A
+.Dv PMC_OP_PMCRW
+operation was attempted on a process-private PMC that does not have
+attached target processes.
+.It Dv SIGBUS
+The
+.Nm
+driver is being unloaded from the kernel.
+.El
+.Ss PMC ROW DISPOSITIONS
+A PMC row is defined as the set of PMC resources at the same hardware
+address in the CPUs in a system.
+Since process scope PMCs need to move between CPUs following their
+target threads, allocation of a process scope PMC reserves all PMCs in
+a PMC row for use only with process scope PMCs.
+Accordingly a PMC row will be in one of the following dispositions:
+.Bl -tag -width ".Dv PMC_DISP_STANDALONE" -compact
+.It Dv PMC_DISP_FREE
+Hardware counters in this row are free and may be use to satisfy
+either of system scope or process scope allocation requests.
+.It Dv PMC_DISP_THREAD
+Hardware counters in this row are in use by process scope PMCs
+and are only available for process scope allocation requests.
+.It Dv PMC_DISP_STANDALONE
+Some hardware counters in this row have been administratively
+disabled or are in use by system scope PMCs.
+Non-disabled hardware counters in such a row may be used
+for satisfying system scope allocation requests.
+No process scope PMCs will use hardware counters in this row.
+.El
+.Sh PROGRAMMING API
+The recommended way for application programs to use the facilities of
+the
+.Nm
+driver is using the API provided by the
+.Xr pmc 3
+library.
+.Pp
+The
+.Nm
+driver operates using a system call number that is dynamically
+allotted to it when it is loaded into the kernel.
+.Pp
+The
+.Nm
+driver supports the following operations:
+.Bl -tag -width indent
+.It Dv PMC_OP_CONFIGURELOG
+Configure a log file for PMCs that require a log file.
+The
+.Nm
+driver will write log data to this file asynchronously.
+If it encounters an error, logging will be stopped and the error code
+encountered will be saved for subsequent retrieval by a
+.Dv PMC_OP_FLUSHLOG
+request.
+.It Dv PMC_OP_FLUSHLOG
+Transfer buffered log data inside
+.Nm
+to a configured output file.
+This operation returns to the caller after the write operation
+has returned.
+The returned error code reflects any pending error state inside
+.Nm .
+.It Dv PMC_OP_GETCPUINFO
+Retrieve information about the highest possible CPU number for the system,
+and the number of hardware performance monitoring counters available per CPU.
+.It Dv PMC_OP_GETDRIVERSTATS
+Retrieve module statistics (for analyzing the behavior of
+.Nm
+itself).
+.It Dv PMC_OP_GETMODULEVERSION
+Retrieve the version number of API.
+.It Dv PMC_OP_GETPMCINFO
+Retrieve information about the current state of the PMCs on a
+given CPU.
+.It Dv PMC_OP_PMCADMIN
+Set the administrative state (i.e., whether enabled or disabled) for
+the hardware PMCs managed by the
+.Nm
+driver.
+The invoking process needs to possess the
+.Dv PRIV_PMC_MANAGE
+privilege.
+.It Dv PMC_OP_PMCALLOCATE
+Allocate and configure a PMC.
+On successful allocation, a handle to the PMC (a 32 bit value)
+is returned.
+.It Dv PMC_OP_PMCATTACH
+Attach a process mode PMC to a target process.
+The PMC will be active whenever a thread in the target process is
+scheduled on a CPU.
+.Pp
+If the
+.Dv PMC_F_DESCENDANTS
+flag had been specified at PMC allocation time, then the PMC is
+attached to all current and future descendants of the target process.
+.It Dv PMC_OP_PMCDETACH
+Detach a PMC from its target process.
+.It Dv PMC_OP_PMCRELEASE
+Release a PMC.
+.It Dv PMC_OP_PMCRW
+Read and write a PMC.
+This operation is valid only for PMCs configured in counting modes.
+.It Dv PMC_OP_SETCOUNT
+Set the initial count (for counting mode PMCs) or the desired sampling
+rate (for sampling mode PMCs).
+.It Dv PMC_OP_PMCSTART
+Start a PMC.
+.It Dv PMC_OP_PMCSTOP
+Stop a PMC.
+.It Dv PMC_OP_WRITELOG
+Insert a timestamped user record into the log file.
+.El
+.Ss i386 Specific API
+Some i386 family CPUs support the RDPMC instruction which allows a
+user process to read a PMC value without needing to invoke a
+.Dv PMC_OP_PMCRW
+operation.
+On such CPUs, the machine address associated with an allocated PMC is
+retrievable using the
+.Dv PMC_OP_PMCX86GETMSR
+system call.
+.Bl -tag -width indent
+.It Dv PMC_OP_PMCX86GETMSR
+Retrieve the MSR (machine specific register) number associated with
+the given PMC handle.
+.Pp
+The PMC needs to be in process-private mode and allocated without the
+.Dv PMC_F_DESCENDANTS
+modifier flag, and should be attached only to its owner process at the
+time of the call.
+.El
+.Ss amd64 Specific API
+AMD64 CPUs support the RDPMC instruction which allows a
+user process to read a PMC value without needing to invoke a
+.Dv PMC_OP_PMCRW
+operation.
+The machine address associated with an allocated PMC is
+retrievable using the
+.Dv PMC_OP_PMCX86GETMSR
+system call.
+.Bl -tag -width indent
+.It Dv PMC_OP_PMCX86GETMSR
+Retrieve the MSR (machine specific register) number associated with
+the given PMC handle.
+.Pp
+The PMC needs to be in process-private mode and allocated without the
+.Dv PMC_F_DESCENDANTS
+modifier flag, and should be attached only to its owner process at the
+time of the call.
+.El
+.Sh SYSCTL VARIABLES AND LOADER TUNABLES
+The behavior of
+.Nm
+is influenced by the following
+.Xr sysctl 8
+and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va kern.hwpmc.callchaindepth Pq integer, read-only
+The maximum number of call chain records to capture per sample.
+The default is 8.
+.It Va kern.hwpmc.debugflags Pq string, read-write
+(Only available if the
+.Nm
+driver was compiled with
+.Fl DDEBUG . )
+Control the verbosity of debug messages from the
+.Nm
+driver.
+.It Va kern.hwpmc.hashsize Pq integer, read-only
+The number of rows in the hash tables used to keep track of owner and
+target processes.
+The default is 16.
+.It Va kern.hwpmc.logbuffersize Pq integer, read-only
+The size in kilobytes of each log buffer used by
+.Nm Ns 's
+logging function.
+The default buffer size is 4KB.
+.It Va kern.hwpmc.mtxpoolsize Pq integer, read-only
+The size of the spin mutex pool used by the PMC driver.
+The default is 32.
+.It Va kern.hwpmc.nbuffers Pq integer, read-only
+The number of log buffers used by
+.Nm
+for logging.
+The default is 16.
+.It Va kern.hwpmc.nsamples Pq integer, read-only
+The number of entries in the per-CPU ring buffer used during sampling.
+The default is 16.
+.It Va security.bsd.unprivileged_syspmcs Pq boolean, read-write
+If set to non-zero, allow unprivileged processes to allocate system-wide
+PMCs.
+The default value is 0.
+.It Va security.bsd.unprivileged_proc_debug Pq boolean, read-write
+If set to 0, the
+.Nm
+driver will only allow privileged processes to attach PMCs to other
+processes.
+.El
+.Pp
+These variables may be set in the kernel environment using
+.Xr kenv 1
+before
+.Nm
+is loaded.
+.Sh IMPLEMENTATION NOTES
+.Ss SMP Symmetry
+The kernel driver requires all physical CPUs in an SMP system to have
+identical performance monitoring counter hardware.
+.Ss Sparse CPU Numbering
+On platforms that sparsely number CPUs and which support hot-plugging
+of CPUs, requests that specify non-existent or disabled CPUs will fail
+with an error.
+Applications allocating system-scope PMCs need to be aware of
+the possibility of such transient failures.
+.Ss x86 TSC Handling
+Historically, on the x86 architecture,
+.Fx
+has permitted user processes running at a processor CPL of 3 to
+read the TSC using the RDTSC instruction.
+The
+.Nm
+driver preserves this behavior.
+.Ss Intel P4/HTT Handling
+On CPUs with HTT support, Intel P4 PMCs are capable of qualifying
+only a subset of hardware events on a per-logical CPU basis.
+Consequently, if HTT is enabled on a system with Intel Pentium P4
+PMCs, then the
+.Nm
+driver will reject allocation requests for process-private PMCs that
+request counting of hardware events that cannot be counted separately
+for each logical CPU.
+.Ss Intel Pentium-Pro Handling
+Writing a value to the PMC MSRs found in Intel Pentium-Pro style PMCs
+(found in
+.Tn "Intel Pentium Pro" ,
+.Tn "Pentium II" ,
+.Tn "Pentium III" ,
+.Tn "Pentium M"
+and
+.Tn "Celeron"
+processors) will replicate bit 31 of the
+value being written into the upper 8 bits of the MSR,
+bringing down the usable width of these PMCs to 31 bits.
+For process-virtual PMCs, the
+.Nm
+driver implements a workaround in software and makes the corrected 64
+bit count available via the
+.Dv PMC_OP_RW
+operation.
+Processes that intend to use RDPMC instructions directly or
+that intend to write values larger than 2^31 into these PMCs with
+.Dv PMC_OP_RW
+need to be aware of this hardware limitation.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "hwpmc: [class/npmc/capabilities]..."
+Announce the presence of
+.Va npmc
+PMCs of class
+.Va class ,
+with capabilities described by bit string
+.Va capabilities .
+.It "hwpmc: kernel version (0x%x) does not match module version (0x%x)."
+The module loading process failed because a version mismatch was detected
+between the currently executing kernel and the module being loaded.
+.It "hwpmc: this kernel has not been compiled with 'options HWPMC_HOOKS'."
+The module loading process failed because the currently executing kernel
+was not configured with the required configuration option
+.Dv HWPMC_HOOKS .
+.It "hwpmc: tunable hashsize=%d must be greater than zero."
+A negative value was supplied for tunable
+.Va kern.hwpmc.hashsize .
+.It "hwpmc: tunable logbuffersize=%d must be greater than zero."
+A negative value was supplied for tunable
+.Va kern.hwpmc.logbuffersize .
+.It "hwpmc: tunable nlogbuffers=%d must be greater than zero."
+A negative value was supplied for tunable
+.Va kern.hwpmc.nlogbuffers .
+.It "hwpmc: tunable nsamples=%d out of range."
+The value for tunable
+.Va kern.hwpmc.nsamples
+was negative or greater than 65535.
+.El
+.Sh COMPATIBILITY
+The
+.Nm
+driver is
+.Ud
+The API and ABI documented in this manual page may change in
+the future.
+The recommended method of accessing this driver is using the
+.Xr pmc 3
+API.
+.Sh ERRORS
+A command issued to the
+.Nm
+driver may fail with the following errors:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+Helper process creation failed for a
+.Dv PMC_OP_CONFIGURELOG
+request due to a temporary resource shortage in the kernel.
+.It Bq Er EBUSY
+A
+.Dv PMC_OP_CONFIGURELOG
+operation was requested while an existing log was active.
+.It Bq Er EBUSY
+A DISABLE operation was requested using the
+.Dv PMC_OP_PMCADMIN
+request for a set of hardware resources currently in use for
+process-private PMCs.
+.It Bq Er EBUSY
+A
+.Dv PMC_OP_PMCADMIN
+operation was requested on an active system mode PMC.
+.It Bq Er EBUSY
+A
+.Dv PMC_OP_PMCATTACH
+operation was requested for a target process that already had another
+PMC using the same hardware resources attached to it.
+.It Bq Er EBUSY
+A
+.Dv PMC_OP_PMCRW
+request writing a new value was issued on a PMC that was active.
+.It Bq Er EBUSY
+A
+.Dv PMC_OP_PMCSETCOUNT
+request was issued on a PMC that was active.
+.It Bq Er EDOOFUS
+A
+.Dv PMC_OP_PMCSTART
+operation was requested without a log file being configured for a
+PMC allocated with
+.Dv PMC_F_LOG_PROCCSW
+and
+.Dv PMC_F_LOG_PROCEXIT
+modifiers.
+.It Bq Er EDOOFUS
+A
+.Dv PMC_OP_PMCSTART
+operation was requested on a system-wide sampling PMC without a log
+file being configured.
+.It Bq Er EEXIST
+A
+.Dv PMC_OP_PMCATTACH
+request was reissued for a target process that already is the target
+of this PMC.
+.It Bq Er EFAULT
+A bad address was passed in to the driver.
+.It Bq Er EINVAL
+An invalid PMC handle was specified.
+.It Bq Er EINVAL
+An invalid CPU number was passed in for a
+.Dv PMC_OP_GETPMCINFO
+operation.
+.It Bq Er EINVAL
+A
+.Dv PMC_OP_CONFIGURELOG
+request to de-configure a log file was issued without a log file
+being configured.
+.It Bq Er EINVAL
+A
+.Dv PMC_OP_FLUSHLOG
+request was issued without a log file being configured.
+.It Bq Er EINVAL
+An invalid CPU number was passed in for a
+.Dv PMC_OP_PMCADMIN
+operation.
+.It Bq Er EINVAL
+An invalid operation request was passed in for a
+.Dv PMC_OP_PMCADMIN
+operation.
+.It Bq Er EINVAL
+An invalid PMC ID was passed in for a
+.Dv PMC_OP_PMCADMIN
+operation.
+.It Bq Er EINVAL
+A suitable PMC matching the parameters passed in to a
+.Dv PMC_OP_PMCALLOCATE
+request could not be allocated.
+.It Bq Er EINVAL
+An invalid PMC mode was requested during a
+.Dv PMC_OP_PMCALLOCATE
+request.
+.It Bq Er EINVAL
+An invalid CPU number was specified during a
+.Dv PMC_OP_PMCALLOCATE
+request.
+.It Bq Er EINVAL
+A CPU other than
+.Dv PMC_CPU_ANY
+was specified in a
+.Dv PMC_OP_PMCALLOCATE
+request for a process-private PMC.
+.It Bq Er EINVAL
+A CPU number of
+.Dv PMC_CPU_ANY
+was specified in a
+.Dv PMC_OP_PMCALLOCATE
+request for a system-wide PMC.
+.It Bq Er EINVAL
+The
+.Ar pm_flags
+argument to an
+.Dv PMC_OP_PMCALLOCATE
+request contained unknown flags.
+.It Bq Er EINVAL
+(On Intel Pentium 4 CPUs with HTT support)
+A
+.Dv PMC_OP_PMCALLOCATE
+request for a process-private PMC was issued for an event that does
+not support counting on a per-logical CPU basis.
+.It Bq Er EINVAL
+A PMC allocated for system-wide operation was specified with a
+.Dv PMC_OP_PMCATTACH
+or
+.Dv PMC_OP_PMCDETACH
+request.
+.It Bq Er EINVAL
+The
+.Ar pm_pid
+argument to a
+.Dv PMC_OP_PMCATTACH
+or
+.Dv PMC_OP_PMCDETACH
+request specified an illegal process ID.
+.It Bq Er EINVAL
+A
+.Dv PMC_OP_PMCDETACH
+request was issued for a PMC not attached to the target process.
+.It Bq Er EINVAL
+Argument
+.Ar pm_flags
+to a
+.Dv PMC_OP_PMCRW
+request contained illegal flags.
+.It Bq Er EINVAL
+A
+.Dv PMC_OP_PMCX86GETMSR
+operation was requested for a PMC not in process-virtual mode, or
+for a PMC that is not solely attached to its owner process, or for
+a PMC that was allocated with flag
+.Dv PMC_F_DESCENDANTS .
+.It Bq Er EINVAL
+A
+.Dv PMC_OP_WRITELOG
+request was issued for an owner process without a log file
+configured.
+.It Bq Er ENOMEM
+The system was not able to allocate kernel memory.
+.It Bq Er ENOSYS
+(On i386 and amd64 architectures)
+A
+.Dv PMC_OP_PMCX86GETMSR
+operation was requested for hardware that does not support reading
+PMCs directly with the RDPMC instruction.
+.It Bq Er ENXIO
+A
+.Dv PMC_OP_GETPMCINFO
+operation was requested for an absent or disabled CPU.
+.It Bq Er ENXIO
+A
+.Dv PMC_OP_PMCALLOCATE
+operation specified allocation of a system-wide PMC on an absent or
+disabled CPU.
+.It Bq Er ENXIO
+A
+.Dv PMC_OP_PMCSTART
+or
+.Dv PMC_OP_PMCSTOP
+request was issued for a system-wide PMC that was allocated on a CPU
+that is currently absent or disabled.
+.It Bq Er EOPNOTSUPP
+A
+.Dv PMC_OP_PMCALLOCATE
+request was issued for PMC capabilities not supported
+by the specified PMC class.
+.It Bq Er EOPNOTSUPP
+(i386 architectures)
+A sampling mode PMC was requested on a CPU lacking an APIC.
+.It Bq Er EPERM
+A
+.Dv PMC_OP_PMCADMIN
+request was issued by a process without super-user
+privilege or by a jailed super-user process.
+.It Bq Er EPERM
+A
+.Dv PMC_OP_PMCATTACH
+operation was issued for a target process that the current process
+does not have permission to attach to.
+.It Bq Er EPERM
+(i386 and amd64 architectures)
+A
+.Dv PMC_OP_PMCATTACH
+operation was issued on a PMC whose MSR has been retrieved using
+.Dv PMC_OP_PMCX86GETMSR .
+.It Bq Er ESRCH
+A process issued a PMC operation request without having allocated any
+PMCs.
+.It Bq Er ESRCH
+A process issued a PMC operation request after the PMC was detached
+from all of its target processes.
+.It Bq Er ESRCH
+A
+.Dv PMC_OP_PMCATTACH
+or
+.Dv PMC_OP_PMCDETACH
+request specified a non-existent process ID.
+.It Bq Er ESRCH
+The target process for a
+.Dv PMC_OP_PMCDETACH
+operation is not being monitored by
+.Nm .
+.El
+.Sh SEE ALSO
+.Xr kenv 1 ,
+.Xr pmc 3 ,
+.Xr pmclog 3 ,
+.Xr kgmon 8 ,
+.Xr kldload 8 ,
+.Xr pmccontrol 8 ,
+.Xr pmcstat 8 ,
+.Xr sysctl 8 ,
+.Xr kproc_create 9 ,
+.Xr p_candebug 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Joseph Koshy"
+.Aq jkoshy@FreeBSD.org .
+.Sh BUGS
+The driver samples the state of the kernel's logical processor support
+at the time of initialization (i.e., at module load time).
+On CPUs supporting logical processors, the driver could misbehave if
+logical processors are subsequently enabled or disabled while the
+driver is active.
+.Pp
+On the i386 architecture, the driver requires that the local APIC on the
+CPU be enabled for sampling mode to be supported.
+Many single-processor motherboards keep the APIC disabled in BIOS; on
+such systems
+.Nm
+will not support sampling PMCs.
+.Sh SECURITY CONSIDERATIONS
+PMCs may be used to monitor the actual behavior of the system on hardware.
+In situations where this constitutes an undesirable information leak,
+the following options are available:
+.Bl -enum
+.It
+Set the
+.Xr sysctl 8
+tunable
+.Va security.bsd.unprivileged_syspmcs
+to 0.
+This ensures that unprivileged processes cannot allocate system-wide
+PMCs and thus cannot observe the hardware behavior of the system
+as a whole.
+This tunable may also be set at boot time using
+.Xr loader 8 ,
+or with
+.Xr kenv 1
+prior to loading the
+.Nm
+driver into the kernel.
+.It
+Set the
+.Xr sysctl 8
+tunable
+.Va security.bsd.unprivileged_proc_debug
+to 0.
+This will ensure that an unprivileged process cannot attach a PMC
+to any process other than itself and thus cannot observe the hardware
+behavior of other processes with the same credentials.
+.El
+.Pp
+System administrators should note that on IA-32 platforms
+.Fx
+makes the content of the IA-32 TSC counter available to all processes
+via the RDTSC instruction.
diff --git a/share/man/man4/ichsmb.4 b/share/man/man4/ichsmb.4
new file mode 100644
index 000000000000..a415941b6001
--- /dev/null
+++ b/share/man/man4/ichsmb.4
@@ -0,0 +1,57 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 28, 2007
+.Dt ICHSMB 4
+.Os
+.Sh NAME
+.Nm ichsmb
+.Nd Intel ICH SMBus controller driver
+.Sh SYNOPSIS
+.Cd device pci
+.Cd device smbus
+.Cd device smb
+.Cd device ichsmb
+.Sh DESCRIPTION
+This driver provides access to the SMBus controller logical
+device contained in the Intel 82801AA (ICH), 82801AB (ICH0),
+82801BA (ICH2), 82801CA (ICH3), 82801DC (ICH4), 82801EB (ICH5),
+82801FB (ICH6) and 82801GB (ICH7) PCI chips.
+.Sh SEE ALSO
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh AUTHORS
+.An Archie L. Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ichwd.4 b/share/man/man4/ichwd.4
new file mode 100644
index 000000000000..25b6dbb52e75
--- /dev/null
+++ b/share/man/man4/ichwd.4
@@ -0,0 +1,90 @@
+.\"-
+.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2008
+.Dt ICHWD 4
+.Os
+.Sh NAME
+.Nm ichwd
+.Nd device driver for the Intel ICH watchdog interrupt timer
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ichwd"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ichwd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog interrupt timer present on
+all Intel ICH motherboard chipsets.
+.Pp
+The ICH WDT counts down in ticks of approximately 0.6 seconds; the
+exact value depends on hardware quality and environmental factors.
+Supported watchdog intervals range from 2 to 63 ticks.
+.Pp
+Note that on some ICH-based systems, the WDT may be present but
+disabled, either in hardware or by the BIOS.
+The
+.Nm
+driver attempts to detect this condition and will refuse to attach if
+it believes the WDT is disabled.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Rs
+.%T Using the Intel ICH Family Watchdog Timer (WDT)
+.%R Intel Application Note AP-725
+.%O Document Number 292273-001
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Wm. Daryl Hawkins Aq dhawkins@tamu.edu
+of Texas A&M University and
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
diff --git a/share/man/man4/icmp.4 b/share/man/man4/icmp.4
new file mode 100644
index 000000000000..a6fbbf292b88
--- /dev/null
+++ b/share/man/man4/icmp.4
@@ -0,0 +1,254 @@
+.\" Copyright (c) 1986, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)icmp.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd February 9, 2007
+.Dt ICMP 4
+.Os
+.Sh NAME
+.Nm icmp
+.Nd Internet Control Message Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket AF_INET SOCK_RAW proto
+.Sh DESCRIPTION
+.Tn ICMP
+is the error and control message protocol used
+by
+.Tn IP
+and the Internet protocol family.
+It may be accessed
+through a
+.Dq raw socket
+for network monitoring
+and diagnostic functions.
+The
+.Fa proto
+parameter to the socket call to create an
+.Tn ICMP
+socket
+is obtained from
+.Xr getprotobyname 3 .
+.Tn ICMP
+sockets are connectionless,
+and are normally used with the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+calls, though the
+.Xr connect 2
+call may also be used to fix the destination for future
+packets (in which case the
+.Xr read 2
+or
+.Xr recv 2
+and
+.Xr write 2
+or
+.Xr send 2
+system calls may be used).
+.Pp
+Outgoing packets automatically have an
+.Tn IP
+header prepended to
+them (based on the destination address).
+Incoming packets are received with the
+.Tn IP
+header and options intact.
+.Ss Types
+ICMP messages are classified according to the type and code fields
+present in the ICMP header.
+The abbreviations for the types and codes may be used in rules in
+.Xr pf.conf 5 .
+The following types are defined:
+.Bl -column x xxxxxxxxxxxx -offset indent
+.It Sy Num Ta Sy Abbrev. Ta Sy Description
+.It 0 Ta echorep Ta "Echo reply"
+.It 3 Ta unreach Ta "Destination unreachable"
+.It 4 Ta squench Ta "Packet loss, slow down"
+.It 5 Ta redir Ta "Shorter route exists"
+.It 6 Ta althost Ta "Alternate host address"
+.It 8 Ta echoreq Ta "Echo request"
+.It 9 Ta routeradv Ta "Router advertisement"
+.It 10 Ta routersol Ta "Router solicitation"
+.It 11 Ta timex Ta "Time exceeded"
+.It 12 Ta paramprob Ta "Invalid IP header"
+.It 13 Ta timereq Ta "Timestamp request"
+.It 14 Ta timerep Ta "Timestamp reply"
+.It 15 Ta inforeq Ta "Information request"
+.It 16 Ta inforep Ta "Information reply"
+.It 17 Ta maskreq Ta "Address mask request"
+.It 18 Ta maskrep Ta "Address mask reply"
+.It 30 Ta trace Ta Traceroute
+.It 31 Ta dataconv Ta "Data conversion problem"
+.It 32 Ta mobredir Ta "Mobile host redirection"
+.It 33 Ta ipv6-where Ta "IPv6 where-are-you"
+.It 34 Ta ipv6-here Ta "IPv6 i-am-here"
+.It 35 Ta mobregreq Ta "Mobile registration request"
+.It 36 Ta mobregrep Ta "Mobile registration reply"
+.It 39 Ta skip Ta SKIP
+.It 40 Ta photuris Ta Photuris
+.El
+.Pp
+The following codes are defined:
+.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
+.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta Sy Description
+.It 0 Ta net-unr Ta unreach Ta "Network unreachable"
+.It 1 Ta host-unr Ta unreach Ta "Host unreachable"
+.It 2 Ta proto-unr Ta unreach Ta "Protocol unreachable"
+.It 3 Ta port-unr Ta unreach Ta "Port unreachable"
+.It 4 Ta needfrag Ta unreach Ta "Fragmentation needed but DF bit set"
+.It 5 Ta srcfail Ta unreach Ta "Source routing failed"
+.It 6 Ta net-unk Ta unreach Ta "Network unknown"
+.It 7 Ta host-unk Ta unreach Ta "Host unknown"
+.It 8 Ta isolate Ta unreach Ta "Host isolated"
+.It 9 Ta net-prohib Ta unreach Ta "Network administratively prohibited"
+.It 10 Ta host-prohib Ta unreach Ta "Host administratively prohibited"
+.It 11 Ta net-tos Ta unreach Ta "Invalid TOS for network"
+.It 12 Ta host-tos Ta unreach Ta "Invalid TOS for host"
+.It 13 Ta filter-prohib Ta unreach Ta "Prohibited access"
+.It 14 Ta host-preced Ta unreach Ta "Precedence violation"
+.It 15 Ta cutoff-preced Ta unreach Ta "Precedence cutoff"
+.It 0 Ta redir-net Ta redir Ta "Shorter route for network"
+.It 1 Ta redir-host Ta redir Ta "Shorter route for host"
+.It 2 Ta redir-tos-net Ta redir Ta "Shorter route for TOS and network"
+.It 3 Ta redir-tos-host Ta redir Ta "Shorter route for TOS and host"
+.It 0 Ta normal-adv Ta routeradv Ta "Normal advertisement"
+.It 16 Ta common-adv Ta routeradv Ta "Selective advertisement"
+.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
+.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
+.It 0 Ta badhead Ta paramprob Ta "Invalid option pointer"
+.It 1 Ta optmiss Ta paramprob Ta "Missing option"
+.It 2 Ta badlen Ta paramprob Ta "Invalid length"
+.It 1 Ta unknown-ind Ta photuris Ta "Unknown security index"
+.It 2 Ta auth-fail Ta photuris Ta "Authentication failed"
+.It 3 Ta decrypt-fail Ta photuris Ta "Decryption failed"
+.El
+.Ss MIB Variables
+The
+.Tn ICMP
+protocol implements a number of variables in the
+.Va net.inet.icmp
+branch of the
+.Xr sysctl 3
+MIB.
+.Bl -tag -width ".Va icmplim_output"
+.It Va maskrepl
+.Pq Vt boolean
+Enable/disable replies to ICMP Address Mask Request packets.
+Defaults to false.
+.It Va maskfake
+.Pq Vt "unsigned integer"
+When
+.Va maskrepl
+is set and this value is non-zero,
+it will be used instead of the real address mask when
+the system replies to an ICMP Address Mask Request packet.
+Defaults to 0.
+.It Va icmplim
+.Pq Vt integer
+Bandwidth limit for ICMP replies in packets/second.
+Used when
+.Va icmplim_output
+is non-zero.
+Defaults to 200.
+.It Va icmplim_output
+.Pq Vt boolean
+Enable/disable bandwidth limiting of ICMP replies.
+Defaults to true.
+.It Va drop_redirect
+.Pq Vt boolean
+Enable/disable dropping of ICMP Redirect packets.
+Defaults to false.
+.It Va log_redirect
+.Pq Vt boolean
+Enable/disable logging of ICMP Redirect packets.
+Defaults to false.
+.It Va bmcastecho
+.Pq Vt boolean
+Enable/disable ICMP replies received via broadcast or multicast.
+Defaults to false.
+.It Va reply_src
+.Pq Vt str
+An interface name used for the ICMP reply source in response to packets
+which are not directly addressed to us.
+By default continue with normal source selection.
+.It Va reply_from_interface
+.Pq Vt boolean
+Use the IP address of the interface the packet came through in for
+responses to packets which are not directly addressed to us.
+If enabled, this rule is processed before all others.
+By default, continue with normal source selection.
+Enabling this option is particularly useful on routers because it
+makes external traceroutes show the actual path a packet has taken
+instead of the possibly different return path.
+.It Va quotelen
+.Pq Vt integer
+Number of bytes from original packet to quote in ICMP reply.
+This number is internally enforced to be at least 8 bytes (per RFC792)
+and at most the maximal space left in the ICMP reply mbuf.
+.El
+.Sh ERRORS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width Er
+.It Bq Er EISCONN
+when trying to establish a connection on a socket which
+already has one, or when trying to send a datagram with the destination
+address specified and the socket is already connected;
+.It Bq Er ENOTCONN
+when trying to send a datagram, but
+no destination address is specified, and the socket has not been
+connected;
+.It Bq Er ENOBUFS
+when the system runs out of memory for
+an internal data structure;
+.It Bq Er EADDRNOTAVAIL
+when an attempt is made to create a
+socket with a network address for which no network interface
+exists.
+.El
+.Sh SEE ALSO
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr pf.conf 5
+.Sh HISTORY
+The
+.Nm
+protocol appeared in
+.Bx 4.3 .
diff --git a/share/man/man4/icmp6.4 b/share/man/man4/icmp6.4
new file mode 100644
index 000000000000..1c6026f8fb2c
--- /dev/null
+++ b/share/man/man4/icmp6.4
@@ -0,0 +1,265 @@
+.\" $KAME: icmp6.4,v 1.6 2004/12/27 05:30:56 itojun Exp $
+.\" $OpenBSD: icmp6.4,v 1.19 2004/12/23 20:33:03 jaredy Exp $
+.\"
+.\" Copyright (c) 1986, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 20, 2004
+.Dt ICMP6 4
+.Os
+.Sh NAME
+.Nm icmp6
+.Nd Internet Control Message Protocol for IPv6
+.Sh SYNOPSIS
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/icmp6.h
+.Ft int
+.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
+.Sh DESCRIPTION
+ICMPv6 is the error and control message protocol used by IPv6 and the
+IPv6 protocol family (see
+.Xr ip6 4
+and
+.Xr inet6 4 ) .
+It may be accessed through a
+.Dq raw socket
+for network monitoring and diagnostic functions.
+.Pp
+The
+.Fa proto
+parameter to the
+.Xr socket 2
+call to create an ICMPv6 socket may be obtained from
+.Xr getprotobyname 3 .
+ICMPv6 sockets are connectionless, and are normally used with the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+calls, though the
+.Xr connect 2
+call may also be used to fix the destination for future packets
+(in which case
+.Xr read 2
+or
+.Xr recv 2
+and
+.Xr write 2
+or
+.Xr send 2
+system calls may be used).
+.Pp
+Outgoing packets automatically have an IPv6 header prepended to them
+(based on the destination address).
+Incoming packets on the socket are received with the IPv6 header and any
+extension headers removed.
+.Ss Types
+ICMPv6 messages are classified according to the type and code fields
+present in the ICMPv6 header.
+The abbreviations for the types and codes may be used in rules in
+.Xr pf.conf 5 .
+The following types are defined:
+.Bl -column x xxxxxxxxxxxx -offset indent
+.It Sy Num Ta Sy Abbrev. Ta Sy Description
+.It 1 Ta unreach Ta "Destination unreachable"
+.It 2 Ta toobig Ta "Packet too big"
+.It 3 Ta timex Ta "Time exceeded"
+.It 4 Ta paramprob Ta "Invalid IPv6 header"
+.It 128 Ta echoreq Ta "Echo service request"
+.It 129 Ta echorep Ta "Echo service reply"
+.It 130 Ta groupqry Ta "Group membership query"
+.It 130 Ta listqry Ta "Multicast listener query"
+.It 131 Ta grouprep Ta "Group membership report"
+.It 131 Ta listenrep Ta "Multicast listener report"
+.It 132 Ta groupterm Ta "Group membership termination"
+.It 132 Ta listendone Ta "Multicast listener done"
+.It 133 Ta routersol Ta "Router solicitation"
+.It 134 Ta routeradv Ta "Router advertisement"
+.It 135 Ta neighbrsol Ta "Neighbor solicitation"
+.It 136 Ta neighbradv Ta "Neighbor advertisement"
+.It 137 Ta redir Ta "Shorter route exists"
+.It 138 Ta routrrenum Ta "Route renumbering"
+.It 139 Ta fqdnreq Ta "FQDN query"
+.It 139 Ta niqry Ta "Node information query"
+.It 139 Ta wrureq Ta "Who-are-you request"
+.It 140 Ta fqdnrep Ta "FQDN reply"
+.It 140 Ta nirep Ta "Node information reply"
+.It 140 Ta wrurep Ta "Who-are-you reply"
+.It 200 Ta mtraceresp Ta "mtrace response"
+.It 201 Ta mtrace Ta "mtrace messages"
+.El
+.Pp
+The following codes are defined:
+.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
+.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta
+.Sy Description
+.It 0 Ta noroute-unr Ta unreach Ta "No route to destination"
+.It 1 Ta admin-unr Ta unreach Ta "Administratively prohibited"
+.It 2 Ta beyond-unr Ta unreach Ta "Beyond scope of source address"
+.It 2 Ta notnbr-unr Ta unreach Ta "Not a neighbor (obsolete)"
+.It 3 Ta addr-unr Ta unreach Ta "Address unreachable"
+.It 4 Ta port-unr Ta unreach Ta "Port unreachable"
+.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
+.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
+.It 0 Ta badhead Ta paramprob Ta "Erroneous header field"
+.It 1 Ta nxthdr Ta paramprob Ta "Unrecognized next header"
+.It 2 Ta "" Ta redir Ta "Unrecognized option"
+.It 0 Ta redironlink Ta redir Ta "Redirection to on-link node"
+.It 1 Ta redirrouter Ta redir Ta "Redirection to better router"
+.El
+.Ss Headers
+All ICMPv6 messages are prefixed with an ICMPv6 header.
+This header corresponds to the
+.Vt icmp6_hdr
+structure and has the following definition:
+.Bd -literal -offset indent
+struct icmp6_hdr {
+ uint8_t icmp6_type; /* type field */
+ uint8_t icmp6_code; /* code field */
+ uint16_t icmp6_cksum; /* checksum field */
+ union {
+ uint32_t icmp6_un_data32[1]; /* type-specific */
+ uint16_t icmp6_un_data16[2]; /* type-specific */
+ uint8_t icmp6_un_data8[4]; /* type-specific */
+ } icmp6_dataun;
+} __packed;
+
+#define icmp6_data32 icmp6_dataun.icmp6_un_data32
+#define icmp6_data16 icmp6_dataun.icmp6_un_data16
+#define icmp6_data8 icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr icmp6_data32[0] /* parameter prob */
+#define icmp6_mtu icmp6_data32[0] /* packet too big */
+#define icmp6_id icmp6_data16[0] /* echo request/reply */
+#define icmp6_seq icmp6_data16[1] /* echo request/reply */
+#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership*/
+.Ed
+.Pp
+.Va icmp6_type
+describes the type of the message.
+Suitable values are defined in
+.Aq Pa netinet/icmp6.h .
+.Va icmp6_code
+describes the sub-type of the message and depends on
+.Va icmp6_type .
+.Va icmp6_cksum
+contains the checksum for the message and is filled in by the
+kernel on outgoing messages.
+The other fields are used for type-specific purposes.
+.Ss Filters
+Because of the extra functionality of ICMPv6 in comparison to ICMPv4,
+a larger number of messages may be potentially received on an ICMPv6
+socket.
+Input filters may therefore be used to restrict input to a subset of the
+incoming ICMPv6 messages so only interesting messages are returned by the
+.Xr recv 2
+family of calls to an application.
+.Pp
+The
+.Vt icmp6_filter
+structure may be used to refine the input message set according to the
+ICMPv6 type.
+By default, all messages types are allowed on newly created raw ICMPv6
+sockets.
+The following macros may be used to refine the input set:
+.Bl -tag -width Ds
+.It Fn "void ICMP6_FILTER_SETPASSALL" "struct icmp6_filter *filterp"
+Allow all incoming messages.
+.Va filterp
+is modified to allow all message types.
+.It Fn "void ICMP6_FILTER_SETBLOCKALL" "struct icmp6_filter *filterp"
+Ignore all incoming messages.
+.Va filterp
+is modified to ignore all message types.
+.It Xo
+.Ft void
+.Fn ICMP6_FILTER_SETPASS "int type" "struct icmp6_filter *filterp"
+.Xc
+Allow ICMPv6 messages with the given
+.Fa type .
+.Va filterp
+is modified to allow such messages.
+.It Xo
+.Ft void
+.Fn ICMP6_FILTER_SETBLOCK" "int type" "struct icmp6_filter *filterp"
+.Xc
+Ignore ICMPv6 messages with the given
+.Fa type .
+.Va filterp
+is modified to ignore such messages.
+.It Xo
+.Ft int
+.Fn ICMP6_FILTER_WILLPASS" "int type" "const struct icmp6_filter *filterp"
+.Xc
+Determine if the given filter will allow an ICMPv6 message of the given
+type.
+.It Xo
+.Ft int
+.Fn ICMP6_FILTER_WILLBLOCK" "int type" "const struct icmp6_filter *filterp"
+.Xc
+Determine if the given filter will ignore an ICMPv6 message of the given
+type.
+.El
+.Pp
+The
+.Xr getsockopt 2
+and
+.Xr setsockopt 2
+calls may be used to obtain and install the filter on ICMPv6 sockets at
+option level
+.Dv IPPROTO_ICMPV6
+and name
+.Dv ICMPV6_FILTER
+with a pointer to the
+.Vt icmp6_filter
+structure as the option value.
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr setsockopt 2 ,
+.Xr socket 2 ,
+.Xr getprotobyname 3 ,
+.Xr inet6 4 ,
+.Xr ip6 4 ,
+.Xr netintro 4
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%T Advanced Sockets API for IPv6
+.%N RFC 2292
+.%D February 1998
+.Re
+.Rs
+.%A A. Conta
+.%A S. Deering
+.%T "Internet Control Message Protocol (ICMPv6) for the Internet" \
+ "Protocol Version 6 (IPv6) Specification"
+.%N RFC 2463
+.%D December 1998
+.Re
diff --git a/share/man/man4/ida.4 b/share/man/man4/ida.4
new file mode 100644
index 000000000000..01e0267cd24e
--- /dev/null
+++ b/share/man/man4/ida.4
@@ -0,0 +1,84 @@
+.\" $FreeBSD$
+.\" Written by Tom Rhodes
+.\" This file is public domain
+.\"
+.Dd August 8, 2004
+.Dt IDA 4
+.Os
+.Sh NAME
+.Nm ida
+.Nd Compaq Intelligent Drive Array Controllers
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ida"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ida_load="YES"
+.Ed
+.Sh DESCRIPTION
+The Compaq Intelligent Drive Array (IDA) technology is used to
+distribute data across an array of hard drives.
+It unites these hard drives into one or more high-performance logical drives.
+The drive array is managed by an array controller.
+.Pp
+These controllers have the ability to provide fault tolerance for the connected
+drives and optionally provide write cache for the logical drives.
+It is also possible for an application to access the SCSI bus subsystem
+directly by using the pass-through interface.
+.Sh HARDWARE
+The following controllers are supported by the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+Compaq SMART Array 221
+.It
+Compaq Integrated SMART Array Controller
+.It
+Compaq SMART Array 4200
+.It
+Compaq SMART Array 4250ES
+.It
+Compaq SMART 3200 Controller
+.It
+Compaq SMART 3100ES Controller
+.It
+Compaq SMART-2/DH Controller
+.It
+Compaq SMART-2/SL Controller
+.It
+Compaq SMART-2/P Controller
+.It
+Compaq SMART-2/E Controller
+.It
+Compaq SMART Controller
+.El
+.Sh IMPLEMENTATION NOTES
+Extreme caution should be exercised when using the pass-through interface.
+It is possible to interfere with normal system I/O and cause hangs if
+pass-through is used to an active device.
+Pass-through should only be used to a device that is otherwise quiescent.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr pass 4 ,
+.Xr xpt 4 ,
+.Xr camcontrol 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jonathan Lemon Aq jlemon@FreeBSD.org
+and
+.An Matthew N. Dodd Aq mdodd@FreeBSD.org .
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/idt.4 b/share/man/man4/idt.4
new file mode 100644
index 000000000000..adf1cf79c028
--- /dev/null
+++ b/share/man/man4/idt.4
@@ -0,0 +1,60 @@
+.\" $FreeBSD$
+.\"
+.Dd June 3, 2003
+.Dt IDT 4
+.Os
+.Sh NAME
+.Nm idt
+.Nd device driver for IDT NICStAR-based ATM interfaces
+.Sh SYNOPSIS
+.Cd "device idt"
+.Cd "device atm"
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports ATM network interfaces based on the
+IDT NICStAR 77211 controller, including the FORE Systems
+ForeRunner LE25 and LE155.
+For configuring the card for IP see
+.Xr natmip 4 .
+.Pp
+ATM CBR connections are supported, and bandwidth is allocated in
+slots of 64k each.
+Three VBR queues handle traffic for VBR and UBR.
+Two UBR queues prioritize UBR traffic.
+ILMI and signalling get the higher priority queue, as well as UBR traffic
+that specifies a peak cell rate.
+All other UBR traffic goes into the lower queue.
+.Pp
+The following sysctls are recognized by the driver:
+.Bl -tag -width indent
+.It Va hw.idt.log_bufstat
+Print statistics about buffer use to the system log periodically.
+.It Va hw.idt.log_vcs
+Print information about VC opens, closes, and other events to the system log.
+.It Va hw.idt.bufs_large
+Set or print the maximum size of the 2KB buffer queue.
+.It Va hw.idt.bufs_small
+Set or print the maximum size of the mbuf queue.
+.It Va hw.idt.cur_large
+Print the current size of the 2KB buffer queue.
+.It Va hw.idt.cur_small
+Print the current size of the mbuf queue.
+.It Va hw.idt.qptr_hold
+Optimize the TX queue buffer for lowest overhead.
+.El
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr natmip 4 ,
+.Xr ifconfig 8 ,
+.Xr route 8
+.Sh AUTHORS
+.An -nosplit
+.An Richard Hodges ,
+based on the original driver for
+.Fx 2.2
+by
+.An Mark Tinguely .
+.An Bruce M. Simpson
+wrote this manual page and backported the driver to
+.Fx 4.9 .
diff --git a/share/man/man4/ifmib.4 b/share/man/man4/ifmib.4
new file mode 100644
index 000000000000..3d12a96bea07
--- /dev/null
+++ b/share/man/man4/ifmib.4
@@ -0,0 +1,190 @@
+.\" Copyright 1996 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 28, 2009
+.Dt IFMIB 4
+.Os
+.Sh NAME
+.Nm ifmib
+.Nd Management Information Base for network interfaces
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In sys/sysctl.h
+.In sys/time.h
+.In net/if.h
+.In net/if_mib.h
+.Sh DESCRIPTION
+The
+.Nm
+facility is an application of the
+.Xr sysctl 3
+interface to provide management information about network interfaces
+to client applications such as
+.Xr netstat 1 ,
+.Xr slstat 8 ,
+and
+.Tn SNMP
+management agents.
+This information is structured as a table, where
+each row in the table represents a logical network interface (either a
+hardware device or a software pseudo-device like
+.Xr lo 4 ) .
+There are two columns in the table, each containing a single
+structure: one column contains generic information relevant to all
+interfaces, and the other contains information specific to the
+particular class of interface.
+(Generally the latter will implement
+the
+.Tn SNMP
+.Tn MIB
+defined for that particular interface class, if one exists and can be
+implemented in the kernel.)
+.Pp
+The
+.Nm
+facility is accessed via the
+.Dq Li net.link.generic
+branch of the
+.Xr sysctl 3
+MIB.
+The manifest constants for each level in the
+.Xr sysctl 3
+.Ar name
+are defined in
+.In net/if_mib.h .
+The index of the last row in the table is given by
+.Dq Li net.link.generic.system.ifcount
+(or, using the manifest constants,
+.Dv CTL_NET ,
+.Dv PF_LINK ,
+.Dv NETLINK_GENERIC ,
+.Dv IFMIB_SYSTEM ,
+.Dv IFMIB_IFCOUNT ) .
+A management application searching for a particular interface should
+start with row 1 and continue through the table row-by-row until the
+desired interface is found, or the interface count is reached.
+Note that the table may be sparse, i.e., a given row may not exist,
+indicated by an
+.Va errno
+of
+.Er ENOENT .
+Such an error should be ignored, and the next row should be checked.
+.Pp
+The generic interface information, common to all interfaces,
+can be accessed via the following procedure:
+.Bd -literal -offset indent
+int
+get_ifmib_general(int row, struct ifmibdata *ifmd)
+{
+ int name[6];
+ size_t len;
+
+ name[0] = CTL_NET;
+ name[1] = PF_LINK;
+ name[2] = NETLINK_GENERIC;
+ name[3] = IFMIB_IFDATA;
+ name[4] = row;
+ name[5] = IFDATA_GENERAL;
+
+ len = sizeof(*ifmd);
+
+ return sysctl(name, 6, ifmd, &len, (void *)0, 0);
+}
+.Ed
+.Pp
+The fields in
+.Li struct ifmibdata
+are as follows:
+.Bl -tag -width "ifmd_snd_drops"
+.It Li ifmd_name
+.Pq Li "char []"
+the name of the interface, including the unit number
+.It Li ifmd_pcount
+.Pq Li int
+the number of promiscuous listeners
+.It Li ifmd_flags
+.Pq Li int
+the interface's flags (defined in
+.In net/if.h )
+.It Li ifmd_snd_len
+.Pq Li int
+the current instantaneous length of the send queue
+.It Li ifmd_snd_drops
+.Pq Li int
+the number of packets dropped at this interface because the send queue
+was full
+.It Li ifmd_data
+.Pq Li struct if_data
+more information from a structure defined in
+.In net/if.h
+(see
+.Xr if_data 9 )
+.El
+.Pp
+Class-specific information can be retrieved by examining the
+.Dv IFDATA_LINKSPECIFIC
+column instead.
+Note that the form and length of the structure will
+depend on the class of interface.
+For
+.Dv IFT_ETHER ,
+.Dv IFT_ISO88023 ,
+and
+.Dv IFT_STARLAN
+interfaces, the structure is called
+.Dq Li struct ifmib_iso_8802_3
+(defined in
+.In net/if_mib.h ) ,
+and implements a superset of the
+.Tn "RFC 1650"
+MIB for Ethernet-like networks.
+.Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr intro 4 ,
+.Xr ifnet 9
+.\" .Xr ethermib 4 ,
+.Rs
+.%T "Definitions of Managed Objects for the Ethernet-like Interface Types Using SMIv2"
+.%A F. Kastenholz
+.%D August 1994
+.%O RFC 1650
+.Re
+.Sh HISTORY
+The
+.Nm
+interface first appeared in
+.Fx 2.2 .
+.Sh BUGS
+Many Ethernet-like interfaces do not yet support the Ethernet MIB;
+the interfaces known to support it include
+.Xr ed 4
+and
+.Xr de 4 .
+Regardless, all interfaces automatically support the generic MIB.
diff --git a/share/man/man4/igb.4 b/share/man/man4/igb.4
new file mode 100644
index 000000000000..169d057559fc
--- /dev/null
+++ b/share/man/man4/igb.4
@@ -0,0 +1,215 @@
+.\" Copyright (c) 2001-2003, Intel Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Intel Corporation nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 11, 2011
+.Dt IGB 4
+.Os
+.Sh NAME
+.Nm igb
+.Nd "Intel(R) PRO/1000 PCI Express Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device igb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_igb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Express Gigabit Ethernet adapters
+based on the Intel 82575 and 82576 Ethernet controller chips.
+The driver supports Transmit/Receive checksum offload and Jumbo
+Frames.
+Furthermore it supports TCP segmentation offload (TSO) on all
+adapters.
+The identification LEDs of the adapters supported by the
+.Nm
+driver can be controlled via the
+.Xr led 4
+API for localization purposes.
+.Pp
+For questions related to hardware requirements, refer to the
+documentation supplied with your Intel PRO/1000 adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 9216.
+.Pp
+This driver supports hardware assisted VLANs.
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enables auto-negotiation for speed and duplex.
+.It Cm 10baseT/UTP
+Sets 10Mbps operation.
+Use the
+.Cm mediaopt
+option to select
+.Cm full-duplex
+mode.
+.It Cm 100baseTX
+Sets 100Mbps operation.
+Use the
+.Cm mediaopt
+option to select
+.Cm full-duplex
+mode.
+.It Cm 1000baseSX
+Sets 1000Mbps operation.
+Only
+.Cm full-duplex
+mode is supported at this speed.
+.It Cm 1000baseTX
+Sets 1000Mbps operation.
+Only
+.Cm full-duplex
+mode is supported at this speed.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Forces full-duplex operation
+.It Cm half-duplex
+Forces half-duplex operation.
+.El
+.Pp
+Only use
+.Cm mediaopt
+to set the driver to
+.Cm full-duplex .
+If
+.Cm mediaopt
+is not specified, the driver defaults to
+.Cm half-duplex .
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Gigabit Ethernet adapters based on the Intel 82575 and
+82576 controller chips:
+.Pp
+.Bl -bullet -compact
+.It
+Intel Gigabit ET Dual Port Server Adapter (82576)
+.It
+Intel Gigabit VT Quad Port Server Adapter (82575)
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.igb.rxd
+Number of receive descriptors allocated by the driver.
+The default value is 1024.
+The minimum is 80, and the maximum is 4096.
+.It Va hw.igb.txd
+Number of transmit descriptors allocated by the driver.
+The default value is 1024.
+The minimum is 80, and the maximum is 4096.
+.It Va hw.igb.enable_aim
+If set to 1, enable Adaptive Interrupt Moderation.
+The default is to enable Adaptive Interrupt Moderation.
+.El
+.Sh FILES
+.Bl -tag -width /dev/led/igb*
+.It Pa /dev/led/igb*
+identification LED device nodes
+.El
+.Sh EXAMPLES
+Make the identification LED of igb0 blink:
+.Pp
+.Dl "echo f2 > /dev/led/igb0"
+.Pp
+Turn the identification LED of igb0 off again:
+.Pp
+.Dl "echo 0 > /dev/led/igb0"
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "igb%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "igb%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "igb%d: watchdog timeout -- resetting"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Intel support website at:
+.Pa http://support.intel.com .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq freebsdnic@mailbox.intel.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr em 4 ,
+.Xr led 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Intel Corporation Aq freebsdnic@mailbox.intel.com .
diff --git a/share/man/man4/igmp.4 b/share/man/man4/igmp.4
new file mode 100644
index 000000000000..696fa7da667e
--- /dev/null
+++ b/share/man/man4/igmp.4
@@ -0,0 +1,138 @@
+.\"
+.\" Copyright (c) 2009 Bruce Simpson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 9, 2009
+.Dt IGMP 4
+.Os
+.Sh NAME
+.Nm igmp
+.Nd Internet Group Management Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip.h
+.In netinet/igmp.h
+.Ft int
+.Fn socket AF_INET SOCK_RAW IPPROTO_IGMP
+.Sh DESCRIPTION
+.Tn IGMP
+is a control plane protocol used by IPv4 hosts and routers to
+propagate multicast group membership information.
+Normally this protocol is not used directly, except by the kernel
+itself, in response to multicast membership requests by user
+applications.
+Routing protocols may open a raw socket to directly interact with
+.Nm .
+.Pp
+As of
+.Fx 8.0 ,
+IGMP version 3 is implemented.
+This adds support for Source-Specific Multicast (SSM), whereby
+applications may communicate to upstream multicast routers that
+they are only interested in receiving multicast streams from
+particular sources.
+.\"
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.\"
+.It net.inet.igmp.stats
+This opaque read-only variable exposes the stack-wide IGMPv3
+protocol statistics to
+.Xr netstat 1 .
+.\"
+.It net.inet.igmp.ifinfo
+This opaque read-only variable exposes the per-link IGMPv3 status to
+.Xr ifmcstat 8 .
+.\"
+.It net.inet.igmp.gsrdelay
+This variable specifies the time threshold, in seconds, for processing
+Group-and-Source Specific Queries (GSR).
+As GSR query processing requires maintaining state on the host,
+it may cause memory to be allocated, and is therefore a potential
+attack point for Denial-of-Service (DoS).
+If more than one GSR query is received within this threshold,
+it will be dropped, to mitigate the potential for DoS.
+.\"
+.It net.inet.igmp.default_version
+This variable controls the default version of IGMP to be used on all links.
+This sysctl is normally set to 3 by default.
+.\"
+.It net.inet.igmp.legacysupp
+If this variable is non-zero, then IGMP v1 and v2 membership reports
+received on a link will be allowed to suppress the IGMP v3 state-change
+reports which would otherwise be issued by this host.
+This sysctl is normally enabled by default.
+.\"
+.It net.inet.igmp.v2enable
+If this variable is non-zero, then IGMP v2 membership queries will be
+processed by this host, and backwards compatibility will be enabled
+until the v2 'Old Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\"
+.It net.inet.igmp.v1enable
+If this variable is non-zero, then IGMP v1 membership queries will be
+processed by this host, and backwards compatibility will be enabled
+until the v1 'Old Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\"
+.It net.inet.igmp.sendlocal
+If this variable is non-zero, then IGMP state-changes for groups in
+the 224.0.0.0/24 link-scope prefix will be issued.
+This behaviour is recommended if deploying
+.Fx
+in a network environment with layer 2 devices which snoop IGMP traffic
+to mitigate multicast propagation throughout the network.
+This sysctl is normally enabled by default.
+.\"
+.It net.inet.igmp.sendra
+If this variable is non-zero, then IGMP v2 and v3 reports will contain
+the IP Router Alert option.
+This sysctl is normally enabled by default.
+.\"
+.It net.inet.igmp.recvifkludge
+If this variable is non-zero, then received IGMP reports which contain
+0.0.0.0 as their source will be rewritten to contain the subnet address.
+This is useful when there are hosts on-link which have not yet been
+configured with a primary IPv4 address.
+This sysctl is normally enabled by default.
+.\"
+.El
+.Sh SEE ALSO
+.Xr ifmcstat 8 ,
+.Xr inet 4 ,
+.Xr multicast 4 ,
+.Xr netstat 1 ,
+.Xr sourcefilter 3
+.Sh HISTORY
+The
+.Nm
+manual page re-appeared in
+.Fx 8.0 .
diff --git a/share/man/man4/iic.4 b/share/man/man4/iic.4
new file mode 100644
index 000000000000..9f410a3f5a9e
--- /dev/null
+++ b/share/man/man4/iic.4
@@ -0,0 +1,188 @@
+.\" Copyright (c) 2006, M. Warner Losh
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 6, 2006
+.Dt IIC 4
+.Os
+.Sh NAME
+.Nm iic
+.Nd I2C generic I/O device driver
+.Sh SYNOPSIS
+.Cd "device iic"
+.Pp
+.In dev/iicbus/iic.h
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides generic I/O to any
+.Xr iicbus 4
+instance.
+In order to control I2C devices, use
+.Pa /dev/iic?
+with the
+following ioctls:
+.Bl -tag -width ".Dv I2CRPTSTART"
+.It Dv I2CSTART
+.Pq Vt "struct iiccmd"
+Sends the start condition to the slave specified by the
+.Va slave
+element to the bus.
+All other elements are ignored.
+.It Dv I2CRPTSTART
+.Pq Vt "struct iiccmd"
+Sends the repeated start condition to the slave specified by the
+.Va slave
+element to the bus.
+All other elements are ignored.
+.It Dv I2CSTOP
+No argument is passed.
+Sends the stop condition to the bus.
+This terminates the current transaction.
+.It Dv I2CRSTCARD
+.Pq Vt "struct iiccmd"
+Resets the bus.
+The argument is completely ignored.
+.It Dv I2CWRITE
+.Pq Vt "struct iiccmd"
+Writes data to the
+.Xr iicbus 4 .
+The bus should already be started.
+The
+.Va slave
+element is ignored.
+The
+.Va count
+element is the number of bytes to write.
+The
+.Va last
+element is a boolean flag.
+It is non-zero when additional write commands will follow.
+The
+.Va buf
+element is a pointer to the data to write to the bus.
+.It Dv I2CREAD
+.Pq Vt "struct iiccmd"
+Reads data from the
+.Xr iicbus 4 .
+The bus should already be started.
+The
+.Va slave
+element is ignored.
+The
+.Va count
+element is the number of bytes to write.
+The
+.Va last
+element is a boolean flag.
+It is non-zero when additional write commands will follow.
+The
+.Va buf
+element is a pointer to where to store the data read from the bus.
+Short reads on the bus produce undefined results.
+.It Dv I2CRDWR
+.Pq Vt "struct iic_rdwr_data"
+Generic read/write interface.
+Allows for an arbitrary number of commands to be sent to
+an arbitrary number of devices on the bus.
+A read transfer is specified if
+.Dv IIC_M_RD
+is set in
+.Va flags .
+Otherwise the transfer is a write transfer.
+The
+.Va slave
+element specifies the 7-bit address for the transfer.
+The
+.Va len
+element is the length of the data.
+The
+.Va buf
+element is a buffer for that data.
+This ioctl is intended to be
+.Tn Linux
+compatible.
+.El
+.Pp
+The following data structures are defined in
+.In dev/iicbus/iic.h
+and referenced above:
+.Bd -literal -offset indent
+struct iiccmd {
+ u_char slave;
+ int count;
+ int last;
+ char *buf;
+};
+
+/* Designed to be compatible with linux's struct i2c_msg */
+struct iic_msg
+{
+ uint16_t slave;
+ uint16_t flags;
+#define IIC_M_RD 0x0001 /* read vs write */
+ uint16_t len; /* msg length */
+ uint8_t * buf;
+};
+
+struct iic_rdwr_data {
+ struct iic_msg *msgs;
+ uint32_t nmsgs;
+};
+.Ed
+.Pp
+It is also possible to use read/write routines, then I2C start/stop handshake is
+managed by the
+.Xr iicbus 4
+system.
+However, the address used for the read/write routines is the one
+passed to last
+.Dv I2CSTART
+.Xr ioctl 2
+to this device.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr iicbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An -nosplit
+This
+manual page was written by
+.An Nicolas Souchu
+and
+.An M. Warner Losh .
+.Sh BUGS
+Only the
+.Dv I2CRDWR
+.Xr ioctl 2
+is thread safe.
+All other interfaces suffer from some kind of race.
diff --git a/share/man/man4/iicbb.4 b/share/man/man4/iicbb.4
new file mode 100644
index 000000000000..e048c5d9bc75
--- /dev/null
+++ b/share/man/man4/iicbb.4
@@ -0,0 +1,58 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 25, 1998
+.Dt IICBB 4
+.Os
+.Sh NAME
+.Nm iicbb
+.Nd I2C generic bit-banging driver
+.Sh SYNOPSIS
+.Cd "device iicbb"
+.Pp
+.Cd "device lpbb"
+.Pp
+For one or more iicbus busses:
+.Cd "device iicbus"
+.Sh DESCRIPTION
+The
+.Em iicbb
+driver provides support to any bit-banging interface for the
+.Xr iicbus 4
+system.
+.Sh SEE ALSO
+.Xr iicbus 4 ,
+.Xr lpbb 4 ,
+.Xr ppbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/iicbus.4 b/share/man/man4/iicbus.4
new file mode 100644
index 000000000000..f9e5c58d467a
--- /dev/null
+++ b/share/man/man4/iicbus.4
@@ -0,0 +1,118 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 6, 1998
+.Dt IICBUS 4
+.Os
+.Sh NAME
+.Nm iicbus
+.Nd I2C bus system
+.Sh SYNOPSIS
+.Cd "device iicbus"
+.Cd "device iicbb"
+.Pp
+.Cd "device iic"
+.Cd "device ic"
+.Cd "device iicsmb"
+.Sh DESCRIPTION
+The
+.Em iicbus
+system provides a uniform, modular and architecture-independent
+system for the implementation of drivers to control various I2C devices
+and to utilize different I2C controllers.
+.Sh I2C
+I2C is an acronym for Inter Integrated Circuit bus.
+The I2C bus was developed
+in the early 1980's by Philips semiconductors.
+Its purpose was to provide an
+easy way to connect a CPU to peripheral chips in a TV-set.
+.Pp
+The BUS physically consists of 2 active wires and a ground connection.
+The active wires, SDA and SCL, are both bidirectional.
+Where SDA is the
+Serial DAta line and SCL is the Serial CLock line.
+.Pp
+Every component hooked up to the bus has its own unique address whether it
+is a CPU, LCD driver, memory, or complex function chip.
+Each of these chips
+can act as a receiver and/or transmitter depending on its functionality.
+Obviously an LCD driver is only a receiver, while a memory or I/O chip can
+both be transmitter and receiver.
+Furthermore there may be one or
+more BUS MASTERs.
+.Pp
+The BUS MASTER is the chip issuing the commands on the BUS.
+In the I2C protocol
+specification it is stated that the IC that initiates a data transfer on the
+bus is considered the BUS MASTER.
+At that time all the others are regarded to
+as the BUS SLAVEs.
+As mentioned before, the IC bus is a Multi-MASTER BUS.
+This means that more than one IC capable of initiating data transfer can be
+connected to it.
+.Sh DEVICES
+Some I2C device drivers are available:
+.Pp
+.Bl -column "Device drivers" -compact
+.It Em Devices Ta Em Description
+.It Sy iic Ta "general i/o operation"
+.It Sy ic Ta "network IP interface"
+.It Sy iicsmb Ta "I2C to SMB software bridge"
+.El
+.Sh INTERFACES
+The I2C protocol may be implemented by hardware or software.
+Software
+interfaces rely on very simple hardware, usually two lines
+twiddled by 2 registers.
+Hardware interfaces are more intelligent and receive
+8-bit characters they write to the bus according to the I2C protocol.
+.Pp
+I2C interfaces may act on the bus as slave devices, allowing spontaneous
+bidirectional communications, thanks to the multi-master capabilities of the
+I2C protocol.
+.Pp
+Some I2C interfaces are available:
+.Pp
+.Bl -column "Interface drivers" -compact
+.It Em Interface Ta Em Description
+.It Sy pcf Ta "Philips PCF8584 master/slave interface"
+.It Sy iicbb Ta "generic bit-banging master-only driver"
+.It Sy lpbb Ta "parallel port specific bit-banging interface"
+.It Sy bktr Ta "Brooktree848 video chipset, hardware and software master-only interface"
+.El
+.Sh SEE ALSO
+.Xr iicbb 4 ,
+.Xr lpbb 4 ,
+.Xr pcf 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/iicsmb.4 b/share/man/man4/iicsmb.4
new file mode 100644
index 000000000000..4fdf6d497b8c
--- /dev/null
+++ b/share/man/man4/iicsmb.4
@@ -0,0 +1,56 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 1998
+.Dt IICSMB 4
+.Os
+.Sh NAME
+.Nm iicsmb
+.Nd I2C to SMB bridge
+.Sh SYNOPSIS
+.Cd "device iicsmb"
+.Pp
+For one or more smbus busses:
+.Cd "device smbus"
+.Sh DESCRIPTION
+The
+.Em iicsmb
+driver supports SMB commands over
+.Xr iicbus 4
+for the
+.Xr smbus 4
+system.
+.Sh SEE ALSO
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/iir.4 b/share/man/man4/iir.4
new file mode 100644
index 000000000000..a7608b2ece7f
--- /dev/null
+++ b/share/man/man4/iir.4
@@ -0,0 +1,77 @@
+.\" $FreeBSD$
+.\" Written by Tom Rhodes
+.\" This file is in the public domain.
+.\"
+.Dd August 8, 2004
+.Dt IIR 4
+.Os
+.Sh NAME
+.Nm iir
+.Nd Intel Integrated RAID controller and ICP Vortex driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device iir"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+iir_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver claims to interface with the Intel integrated
+RAID controller cards, and all versions of the
+ICP Vortex controllers (including FC).
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Intel RAID Controller SRCMR
+.It
+Intel Server RAID Controller U3-l (SRCU31a)
+.It
+Intel Server RAID Controller U3-1L (SRCU31La)
+.It
+Intel Server RAID Controller U3-2 (SRCU32)
+.It
+All past and future releases of Intel and ICP RAID Controllers.
+.El
+.Pp
+.Bl -bullet -compact
+.It
+Intel RAID Controller SRCU21 (discontinued)
+.It
+Intel RAID Controller SRCU31 (older revision, not compatible)
+.It
+Intel RAID Controller SRCU31L (older revision, not compatible)
+.El
+.Pp
+The SRCU31 and SRCU31L can be updated via a firmware update available
+from Intel.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr pass 4 ,
+.Xr xpt 4 ,
+.Xr camcontrol 8
+.Sh AUTHORS
+The
+.Nm
+driver is supported and maintained by
+.An -nosplit
+.An Achim Leubner Aq Achim_Leubner@adaptec.com .
+.Pp
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+and is based on information supplied by the driver authors and the website of
+.An Mike Smith Aq msmith@FreeBSD.org .
diff --git a/share/man/man4/inet.4 b/share/man/man4/inet.4
new file mode 100644
index 000000000000..09cb0bccaae4
--- /dev/null
+++ b/share/man/man4/inet.4
@@ -0,0 +1,309 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)inet.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2012
+.Dt INET 4
+.Os
+.Sh NAME
+.Nm inet
+.Nd Internet protocol family
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.Sh DESCRIPTION
+The Internet protocol family is a collection of protocols
+layered atop the
+.Em Internet Protocol
+.Pq Tn IP
+transport layer, and utilizing the Internet address format.
+The Internet family provides protocol support for the
+.Dv SOCK_STREAM , SOCK_DGRAM ,
+and
+.Dv SOCK_RAW
+socket types; the
+.Dv SOCK_RAW
+interface provides access to the
+.Tn IP
+protocol.
+.Sh ADDRESSING
+Internet addresses are four byte quantities, stored in
+network standard format (on little endian machines, such as the
+.Tn alpha ,
+.Tn amd64 ,
+.Tn i386
+and
+.Tn ia64
+these are word and byte reversed).
+The include file
+.In netinet/in.h
+defines this address
+as a discriminated union.
+.Pp
+Sockets bound to the Internet protocol family utilize
+the following addressing structure,
+.Bd -literal -offset indent
+struct sockaddr_in {
+ uint8_t sin_len;
+ sa_family_t sin_family;
+ in_port_t sin_port;
+ struct in_addr sin_addr;
+ char sin_zero[8];
+};
+.Ed
+.Pp
+Sockets may be created with the local address
+.Dv INADDR_ANY
+to affect
+.Dq wildcard
+matching on incoming messages.
+The address in a
+.Xr connect 2
+or
+.Xr sendto 2
+call may be given as
+.Dv INADDR_ANY
+to mean
+.Dq this host .
+The distinguished address
+.Dv INADDR_BROADCAST
+is allowed as a shorthand for the broadcast address on the primary
+network if the first network configured supports broadcast.
+.Sh PROTOCOLS
+The Internet protocol family is comprised of
+the
+.Tn IP
+network protocol, Internet Control
+Message Protocol
+.Pq Tn ICMP ,
+Internet Group Management Protocol
+.Pq Tn IGMP ,
+Transmission Control
+Protocol
+.Pq Tn TCP ,
+and User Datagram Protocol
+.Pq Tn UDP .
+.Tn TCP
+is used to support the
+.Dv SOCK_STREAM
+abstraction while
+.Tn UDP
+is used to support the
+.Dv SOCK_DGRAM
+abstraction.
+A raw interface to
+.Tn IP
+is available
+by creating an Internet socket of type
+.Dv SOCK_RAW .
+The
+.Tn ICMP
+message protocol is accessible from a raw socket.
+.Pp
+The
+.Nm
+address on an interface consist of the address itself, the
+netmask, either broadcast address in case of a broadcast
+interface or peers address in case of point-to-point interface.
+The following
+.Xr ioctl 2
+commands are provided for a datagram socket in the Internet domain:
+.Pp
+.Bl -tag -width ".Dv SIOCGIFBRDADDR" -offset indent -compact
+.It Dv SIOCAIFADDR
+Add address to an interface.
+The command requires
+.Ft struct in_aliasreq
+as argument.
+.It Dv SIOCDIFADDR
+Delete address from an interface.
+The command requires
+.Ft struct ifreq
+as argument.
+.It Dv SIOCGIFADDR
+.It Dv SIOCGIFBRDADDR
+.It Dv SIOCGIFDSTADDR
+.It Dv SIOCGIFNETMASK
+Return address information from interface. The returned value
+is in
+.Ft struct ifreq .
+This way of address information retrieval is obsoleted, a
+preferred way is to use
+.Xr getifaddrs 3
+API.
+.El
+.Ss MIB Variables
+A number of variables are implemented in the net.inet branch of the
+.Xr sysctl 3
+MIB.
+In addition to the variables supported by the transport protocols
+(for which the respective manual pages may be consulted),
+the following general variables are defined:
+.Bl -tag -width IPCTL_FASTFORWARDING
+.It Dv IPCTL_FORWARDING
+.Pq ip.forwarding
+Boolean: enable/disable forwarding of IP packets.
+Defaults to off.
+.It Dv IPCTL_FASTFORWARDING
+.Pq ip.fastforwarding
+Boolean: enable/disable the use of
+.Tn fast IP forwarding
+code.
+Defaults to off.
+When
+.Tn fast IP forwarding
+is enabled, IP packets are forwarded directly to the appropriate network
+interface with direct processing to completion, which greatly improves
+the throughput.
+All packets for local IP addresses, non-unicast, or with IP options are
+handled by the normal IP input processing path.
+All features of the normal (slow) IP forwarding path are supported
+including firewall (through
+.Xr pfil 9
+hooks) checking, except
+.Xr ipsec 4
+tunnel brokering.
+The
+.Tn IP fastforwarding
+path does not generate ICMP redirect or source quench messages.
+.It Dv IPCTL_SENDREDIRECTS
+.Pq ip.redirect
+Boolean: enable/disable sending of ICMP redirects in response to
+.Tn IP
+packets for which a better, and for the sender directly reachable, route
+and next hop is known.
+Defaults to on.
+.It Dv IPCTL_DEFTTL
+.Pq ip.ttl
+Integer: default time-to-live
+.Pq Dq TTL
+to use for outgoing
+.Tn IP
+packets.
+.It Dv IPCTL_ACCEPTSOURCEROUTE
+.Pq ip.accept_sourceroute
+Boolean: enable/disable accepting of source-routed IP packets (default false).
+.It Dv IPCTL_SOURCEROUTE
+.Pq ip.sourceroute
+Boolean: enable/disable forwarding of source-routed IP packets (default false).
+.It Dv IPCTL_RTEXPIRE
+.Pq ip.rtexpire
+Integer: lifetime in seconds of protocol-cloned
+.Tn IP
+routes after the last reference drops (default one hour).
+This value varies dynamically as described above.
+.It Dv IPCTL_RTMINEXPIRE
+.Pq ip.rtminexpire
+Integer: minimum value of ip.rtexpire (default ten seconds).
+This value has no effect on user modifications, but restricts the dynamic
+adaptation described above.
+.It Dv IPCTL_RTMAXCACHE
+.Pq ip.rtmaxcache
+Integer: trigger level of cached, unreferenced, protocol-cloned routes
+which initiates dynamic adaptation (default 128).
+.It Va ip.process_options
+Integer: control IP options processing.
+By setting this variable to 0, all IP options in the incoming packets
+will be ignored, and the packets will be passed unmodified.
+By setting to 1, IP options in the incoming packets will be processed
+accordingly.
+By setting to 2, an
+.Tn ICMP
+.Dq "prohibited by filter"
+message will be sent back in response to incoming packets with IP options.
+Default is 1.
+This
+.Xr sysctl 8
+variable affects packets destined for a local host as well as packets
+forwarded to some other host.
+.It Va ip.random_id
+Boolean: control IP IDs generation behaviour.
+Setting this
+.Xr sysctl 8
+to non-zero causes the ID field in IP packets to be randomized instead of
+incremented by 1 with each packet generated.
+This closes a minor information leak which allows remote observers to
+determine the rate of packet generation on the machine by watching the
+counter.
+In the same time, on high-speed links, it can decrease the ID reuse
+cycle greatly.
+Default is 0 (sequential IP IDs).
+IPv6 flow IDs and fragment IDs are always random.
+.It Va ip.maxfragpackets
+Integer: maximum number of fragmented packets the host will accept and hold
+in the reassembling queue simultaneously.
+0 means that the host will not accept any fragmented packets.
+\-1 means that the host will accept as many fragmented packets as it receives.
+.It Va ip.maxfragsperpacket
+Integer: maximum number of fragments the host will accept and hold
+in the reassembling queue for a packet.
+0 means that the host will not accept any fragmented packets.
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr getifaddrs 3 ,
+.Xr sysctl 3 ,
+.Xr icmp 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr ipfirewall 4 ,
+.Xr route 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr pfil 9
+.Rs
+.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
+.%B PS1
+.%N 7
+.Re
+.Rs
+.%T "An Advanced 4.3 BSD Interprocess Communication Tutorial"
+.%B PS1
+.%N 8
+.Re
+.Sh HISTORY
+The
+.Nm
+protocol interface appeared in
+.Bx 4.2 .
+The
+.Dq protocol cloning
+code appeared in
+.Fx 2.1 .
+.Sh CAVEATS
+The Internet protocol support is subject to change as
+the Internet protocols develop.
+Users should not depend
+on details of the current implementation, but rather
+the services exported.
diff --git a/share/man/man4/inet6.4 b/share/man/man4/inet6.4
new file mode 100644
index 000000000000..93015e0551be
--- /dev/null
+++ b/share/man/man4/inet6.4
@@ -0,0 +1,457 @@
+.\" $KAME: inet6.4,v 1.21 2001/04/05 01:00:18 itojun Exp $
+.\"
+.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 2, 2009
+.Dt INET6 4
+.Os
+.Sh NAME
+.Nm inet6
+.Nd Internet protocol version 6 family
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.Sh DESCRIPTION
+The
+.Nm
+family is an updated version of
+.Xr inet 4
+family.
+While
+.Xr inet 4
+implements Internet Protocol version 4,
+.Nm
+implements Internet Protocol version 6.
+.Pp
+.Nm
+is a collection of protocols layered atop the
+.Em Internet Protocol version 6
+.Pq Tn IPv6
+transport layer, and utilizing the IPv6 address format.
+The
+.Nm
+family provides protocol support for the
+.Dv SOCK_STREAM , SOCK_DGRAM ,
+and
+.Dv SOCK_RAW
+socket types; the
+.Dv SOCK_RAW
+interface provides access to the
+.Tn IPv6
+protocol.
+.Sh ADDRESSING
+IPv6 addresses are 16 byte quantities, stored in network standard byteorder.
+The include file
+.In netinet/in.h
+defines this address
+as a discriminated union.
+.Pp
+Sockets bound to the
+.Nm
+family utilize the following addressing structure:
+.Bd -literal -offset indent
+struct sockaddr_in6 {
+ uint8_t sin6_len;
+ sa_family_t sin6_family;
+ in_port_t sin6_port;
+ uint32_t sin6_flowinfo;
+ struct in6_addr sin6_addr;
+ uint32_t sin6_scope_id;
+};
+.Ed
+.Pp
+Sockets may be created with the local address
+.Dq Dv ::
+(which is equal to IPv6 address
+.Dv 0:0:0:0:0:0:0:0 )
+to affect
+.Dq wildcard
+matching on incoming messages.
+.Pp
+The IPv6 specification defines scoped addresses,
+like link-local or site-local addresses.
+A scoped address is ambiguous to the kernel,
+if it is specified without a scope identifier.
+To manipulate scoped addresses properly from the userland,
+programs must use the advanced API defined in RFC2292.
+A compact description of the advanced API is available in
+.Xr ip6 4 .
+If a scoped address is specified without an explicit scope,
+the kernel may raise an error.
+Note that scoped addresses are not for daily use at this moment,
+both from a specification and an implementation point of view.
+.Pp
+The KAME implementation supports an extended numeric IPv6 address notation
+for link-local addresses,
+like
+.Dq Li fe80::1%de0
+to specify
+.Do
+.Li fe80::1
+on
+.Li de0
+interface
+.Dc .
+This notation is supported by
+.Xr getaddrinfo 3
+and
+.Xr getnameinfo 3 .
+Some of normal userland programs, such as
+.Xr telnet 1
+or
+.Xr ftp 1 ,
+are able to use this notation.
+With special programs
+like
+.Xr ping6 8 ,
+you can specify the outgoing interface by an extra command line option
+to disambiguate scoped addresses.
+.Pp
+Scoped addresses are handled specially in the kernel.
+In kernel structures like routing tables or interface structures,
+a scoped address will have its interface index embedded into the address.
+Therefore,
+the address in some kernel structures is not the same as that on the wire.
+The embedded index will become visible through a
+.Dv PF_ROUTE
+socket, kernel memory accesses via
+.Xr kvm 3
+and on some other occasions.
+HOWEVER, users should never use the embedded form.
+For details please consult
+.Pa IMPLEMENTATION
+supplied with KAME kit.
+.Sh PROTOCOLS
+The
+.Nm
+family is comprised of the
+.Tn IPv6
+network protocol, Internet Control
+Message Protocol version 6
+.Pq Tn ICMPv6 ,
+Transmission Control Protocol
+.Pq Tn TCP ,
+and User Datagram Protocol
+.Pq Tn UDP .
+.Tn TCP
+is used to support the
+.Dv SOCK_STREAM
+abstraction while
+.Tn UDP
+is used to support the
+.Dv SOCK_DGRAM
+abstraction.
+Note that
+.Tn TCP
+and
+.Tn UDP
+are common to
+.Xr inet 4
+and
+.Nm .
+A raw interface to
+.Tn IPv6
+is available
+by creating an Internet socket of type
+.Dv SOCK_RAW .
+The
+.Tn ICMPv6
+message protocol is accessible from a raw socket.
+.Ss MIB Variables
+A number of variables are implemented in the net.inet6 branch of the
+.Xr sysctl 3
+MIB.
+In addition to the variables supported by the transport protocols
+(for which the respective manual pages may be consulted),
+the following general variables are defined:
+.Bl -tag -width IPV6CTL_MAXFRAGPACKETS
+.It Dv IPV6CTL_FORWARDING
+.Pq ip6.forwarding
+Boolean: enable/disable forwarding of
+.Tn IPv6
+packets.
+Also, identify if the node is acting as a router.
+Defaults to off.
+.It Dv IPV6CTL_SENDREDIRECTS
+.Pq ip6.redirect
+Boolean: enable/disable sending of
+.Tn ICMPv6
+redirects in response to unforwardable
+.Tn IPv6
+packets.
+This option is ignored unless the node is routing
+.Tn IPv6
+packets,
+and should normally be enabled on all systems.
+Defaults to on.
+.It Dv IPV6CTL_DEFHLIM
+.Pq ip6.hlim
+Integer: default hop limit value to use for outgoing
+.Tn IPv6
+packets.
+This value applies to all the transport protocols on top of
+.Tn IPv6 .
+There are APIs to override the value.
+.It Dv IPV6CTL_MAXFRAGPACKETS
+.Pq ip6.maxfragpackets
+Integer: default maximum number of fragmented packets the node will accept.
+0 means that the node will not accept any fragmented packets.
+-1 means that the node will accept as many fragmented packets as it receives.
+The flag is provided basically for avoiding possible DoS attacks.
+.It Dv IPV6CTL_ACCEPT_RTADV
+.Pq ip6.accept_rtadv
+Boolean: the default value of a per-interface flag to
+enable/disable receiving of
+.Tn ICMPv6
+router advertisement packets,
+and autoconfiguration of address prefixes and default routers.
+The node must be a host
+(not a router)
+for the option to be meaningful.
+Defaults to off.
+.It Dv IPV6CTL_AUTO_LINKLOCAL
+.Pq ip6.auto_linklocal
+Boolean: the default value of a per-interface flag to
+enable/disable performing automatic link-local address configuration.
+Defaults to on.
+.It Dv IPV6CTL_KEEPFAITH
+.Pq ip6.keepfaith
+Boolean: enable/disable
+.Dq FAITH
+TCP relay IPv6-to-IPv4 translator code in the kernel.
+Refer
+.Xr faith 4
+and
+.Xr faithd 8
+for detail.
+Defaults to off.
+.It Dv IPV6CTL_LOG_INTERVAL
+.Pq ip6.log_interval
+Integer: default interval between
+.Tn IPv6
+packet forwarding engine log output
+(in seconds).
+.It Dv IPV6CTL_HDRNESTLIMIT
+.Pq ip6.hdrnestlimit
+Integer: default number of the maximum
+.Tn IPv6
+extension headers
+permitted on incoming
+.Tn IPv6
+packets.
+If set to 0, the node will accept as many extension headers as possible.
+.It Dv IPV6CTL_DAD_COUNT
+.Pq ip6.dad_count
+Integer: default number of
+.Tn IPv6
+DAD
+.Pq duplicated address detection
+probe packets.
+The packets will be generated when
+.Tn IPv6
+interface addresses are configured.
+.It Dv IPV6CTL_AUTO_FLOWLABEL
+.Pq ip6.auto_flowlabel
+Boolean: enable/disable automatic filling of
+.Tn IPv6
+flowlabel field, for outstanding connected transport protocol packets.
+The field might be used by intermediate routers to identify packet flows.
+Defaults to on.
+.It Dv IPV6CTL_DEFMCASTHLIM
+.Pq ip6.defmcasthlim
+Integer: default hop limit value for an
+.Tn IPv6
+multicast packet sourced by the node.
+This value applies to all the transport protocols on top of
+.Tn IPv6 .
+There are APIs to override the value as documented in
+.Xr ip6 4 .
+.It Dv IPV6CTL_GIF_HLIM
+.Pq ip6.gifhlim
+Integer: default maximum hop limit value for an
+.Tn IPv6
+packet generated by
+.Xr gif 4
+tunnel interface.
+.It Dv IPV6CTL_KAME_VERSION
+.Pq ip6.kame_version
+String: identifies the version of KAME
+.Tn IPv6
+stack implemented in the kernel.
+.It Dv IPV6CTL_USE_DEPRECATED
+.Pq ip6.use_deprecated
+Boolean: enable/disable use of deprecated address,
+specified in RFC2462 5.5.4.
+Defaults to on.
+.It Dv IPV6CTL_RR_PRUNE
+.Pq ip6.rr_prune
+Integer: default interval between
+.Tn IPv6
+router renumbering prefix babysitting, in seconds.
+.It Dv IPV6CTL_V6ONLY
+.Pq ip6.v6only
+Boolean: enable/disable the prohibited use of
+.Tn IPv4
+mapped address on
+.Dv AF_INET6
+sockets.
+Defaults to on.
+.It Dv IPV6CTL_RTEXPIRE
+.Pq ip6.rtexpire
+Integer: lifetime in seconds of protocol-cloned
+.Tn IP
+routes after the last reference drops (default one hour).
+.\"This value varies dynamically as described above.
+.It Dv IPV6CTL_RTMINEXPIRE
+.Pq ip6.rtminexpire
+Integer: minimum value of ip.rtexpire (default ten seconds).
+.\"This value has no effect on user modifications, but restricts the dynamic
+.\"adaptation described above.
+.It Dv IPV6CTL_RTMAXCACHE
+.Pq ip6.rtmaxcache
+Integer: trigger level of cached, unreferenced, protocol-cloned routes
+which initiates dynamic adaptation (default 128).
+.El
+.Ss Interaction between IPv4/v6 sockets
+By default,
+.Fx
+does not route IPv4 traffic to
+.Dv AF_INET6
+sockets.
+The default behavior intentionally violates RFC2553 for security reasons.
+Listen to two sockets if you want to accept both IPv4 and IPv6 traffic.
+IPv4 traffic may be routed with certain
+per-socket/per-node configuration, however, it is not recommended to do so.
+Consult
+.Xr ip6 4
+for details.
+.Pp
+The behavior of
+.Dv AF_INET6
+TCP/UDP socket is documented in RFC2553.
+Basically, it says this:
+.Bl -bullet -compact
+.It
+A specific bind on an
+.Dv AF_INET6
+socket
+.Xr ( bind 2
+with an address specified)
+should accept IPv6 traffic to that address only.
+.It
+If you perform a wildcard bind
+on an
+.Dv AF_INET6
+socket
+.Xr ( bind 2
+to IPv6 address
+.Li :: ) ,
+and there is no wildcard bind
+.Dv AF_INET
+socket on that TCP/UDP port, IPv6 traffic as well as IPv4 traffic
+should be routed to that
+.Dv AF_INET6
+socket.
+IPv4 traffic should be seen as if it came from an IPv6 address like
+.Li ::ffff:10.1.1.1 .
+This is called an IPv4 mapped address.
+.It
+If there are both a wildcard bind
+.Dv AF_INET
+socket and a wildcard bind
+.Dv AF_INET6
+socket on one TCP/UDP port, they should behave separately.
+IPv4 traffic should be routed to the
+.Dv AF_INET
+socket and IPv6 should be routed to the
+.Dv AF_INET6
+socket.
+.El
+.Pp
+However, RFC2553 does not define the ordering constraint between calls to
+.Xr bind 2 ,
+nor how IPv4 TCP/UDP port numbers and IPv6 TCP/UDP port numbers
+relate to each other
+(should they be integrated or separated).
+Implemented behavior is very different from kernel to kernel.
+Therefore, it is unwise to rely too much upon the behavior of
+.Dv AF_INET6
+wildcard bind sockets.
+It is recommended to listen to two sockets, one for
+.Dv AF_INET
+and another for
+.Dv AF_INET6 ,
+when you would like to accept both IPv4 and IPv6 traffic.
+.Pp
+It should also be noted that
+malicious parties can take advantage of the complexity presented above,
+and are able to bypass access control,
+if the target node routes IPv4 traffic to
+.Dv AF_INET6
+socket.
+Users are advised to take care handling connections
+from IPv4 mapped address to
+.Dv AF_INET6
+sockets.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr sysctl 3 ,
+.Xr icmp6 4 ,
+.Xr intro 4 ,
+.Xr ip6 4 ,
+.Xr tcp 4 ,
+.Xr udp 4
+.Sh STANDARDS
+.Rs
+.%A Tatsuya Jinmei
+.%A Atsushi Onoe
+.%T "An Extension of Format for IPv6 Scoped Addresses"
+.%R internet draft
+.%D June 2000
+.%N draft-ietf-ipngwg-scopedaddr-format-02.txt
+.%O work in progress material
+.Re
+.Sh HISTORY
+The
+.Nm
+protocol interfaces are defined in RFC2553 and RFC2292.
+The implementation described herein appeared in the WIDE/KAME project.
+.Sh BUGS
+The IPv6 support is subject to change as the Internet protocols develop.
+Users should not depend on details of the current implementation,
+but rather the services exported.
+.Pp
+Users are suggested to implement
+.Dq version independent
+code as much as possible, as you will need to support both
+.Xr inet 4
+and
+.Nm .
diff --git a/share/man/man4/intpm.4 b/share/man/man4/intpm.4
new file mode 100644
index 000000000000..5e015a8f371d
--- /dev/null
+++ b/share/man/man4/intpm.4
@@ -0,0 +1,63 @@
+.\" Copyright (c) 1999 Takanori Watanabe
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 1999
+.Dt INTPM 4
+.Os
+.Sh NAME
+.Nm intpm
+.Nd Intel PIIX4 Power Management controller driver
+.Sh SYNOPSIS
+.Cd device smbus
+.Cd device smb
+.Cd device intpm
+.Sh DESCRIPTION
+This driver provides access to
+.Tn Intel PIIX4 PCI Controller function 3 ,
+Power management controller.
+Currently, only smbus controller
+function is implemented.
+But it also have bus idle monitoring function.
+It
+will display mapped I/O address for bus monitoring function when attaching.
+.Sh SEE ALSO
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.4 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Takanori Watanabe Aq takawata@shidahara1.planet.sci.kobe-u.ac.jp .
+.Sh BUGS
+This device requires IRQ 9 exclusively.
+To use this, you should enable
+ACPI function in BIOS configuration, or PnP mechanism assigns conflicted
+IRQ for PnP ISA card.
+And do not use IRQ 9 for Non-PnP ISA cards.
diff --git a/share/man/man4/intro.4 b/share/man/man4/intro.4
new file mode 100644
index 000000000000..93a9ab59d25d
--- /dev/null
+++ b/share/man/man4/intro.4
@@ -0,0 +1,178 @@
+.\"
+.\" Copyright (c) 1996 David E. O'Brien, Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 20, 1996
+.Dt INTRO 4
+.Os
+.Sh NAME
+.Nm intro
+.Nd introduction to devices and device drivers
+.Sh DESCRIPTION
+This section contains information related to devices, device drivers
+and miscellaneous hardware.
+.Ss The device abstraction
+Device is a term used mostly for hardware-related stuff that belongs
+to the system, like disks, printers, or a graphics display with its
+keyboard.
+There are also so-called
+.Em pseudo-devices
+where a device driver emulates the behaviour of a device in software
+without any particular underlying hardware.
+A typical example for
+the latter class is
+.Pa /dev/mem ,
+a loophole where the physical memory can be accessed using the regular
+file access semantics.
+.Pp
+The device abstraction generally provides a common set of system calls
+layered on top of them, which are dispatched to the corresponding
+device driver by the upper layers of the kernel.
+The set of system
+calls available for devices is chosen from
+.Xr open 2 ,
+.Xr close 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr ioctl 2 ,
+.Xr select 2 ,
+and
+.Xr mmap 2 .
+Not all drivers implement all system calls, for example, calling
+.Xr mmap 2
+on terminal devices is likely to be not useful at all.
+.Ss Accessing Devices
+Most of the devices in a
+.Ux Ns
+-like operating system are accessed
+through so-called
+.Em device nodes ,
+sometimes also called
+.Em special files .
+They are usually located under the directory
+.Pa /dev
+in the file system hierarchy
+(see also
+.Xr hier 7 ) .
+.Pp
+Note that this could lead to an inconsistent state, where either there
+are device nodes that do not have a configured driver associated with
+them, or there may be drivers that have successfully probed for their
+devices, but cannot be accessed since the corresponding device node is
+still missing.
+In the first case, any attempt to reference the device
+through the device node will result in an error, returned by the upper
+layers of the kernel, usually
+.Er ENXIO .
+In the second case, the device node needs to be created before the
+driver and its device will be usable.
+.Pp
+Some devices come in two flavors:
+.Em block
+and
+.Em character
+devices, or to use better terms, buffered and unbuffered
+(raw)
+devices.
+The traditional names are reflected by the letters
+.Ql b
+and
+.Ql c
+as the file type identification in the output of
+.Ql ls -l .
+Buffered devices are being accessed through the buffer cache of the
+operating system, and they are solely intended to layer a file system
+on top of them.
+They are normally implemented for disks and disk-like
+devices only and, for historical reasons, for tape devices.
+.Pp
+Raw devices are available for all drivers, including those that also
+implement a buffered device.
+For the latter group of devices, the
+differentiation is conventionally done by prepending the letter
+.Ql r
+to the path name of the device node, for example
+.Pa /dev/rda0
+denotes the raw device for the first SCSI disk, while
+.Pa /dev/da0
+is the corresponding device node for the buffered device.
+.Pp
+Unbuffered devices should be used for all actions that are not related
+to file system operations, even if the device in question is a disk
+device.
+This includes making backups of entire disk partitions, or
+to
+.Em raw
+floppy disks
+(i.e., those used like tapes).
+.Pp
+Access restrictions to device nodes are usually subject to the regular
+file permissions of the device node entry, instead of being enforced
+directly by the drivers in the kernel.
+.Ss Drivers without device nodes
+Drivers for network devices do not use device nodes in order to be
+accessed.
+Their selection is based on other decisions inside the
+kernel, and instead of calling
+.Xr open 2 ,
+use of a network device is generally introduced by using the system
+call
+.Xr socket 2 .
+.Ss Configuring a driver into the kernel
+For each kernel, there is a configuration file that is used as a base
+to select the facilities and drivers for that kernel, and to tune
+several options.
+See
+.Xr config 8
+for a detailed description of the files involved.
+The individual manual pages in this section provide a sample line for the
+configuration file in their synopsis portion.
+See also the sample config file
+.Pa /sys/i386/conf/LINT
+(for the
+.Em i386
+architecture).
+.Sh SEE ALSO
+.Xr close 2 ,
+.Xr ioctl 2 ,
+.Xr mmap 2 ,
+.Xr open 2 ,
+.Xr read 2 ,
+.Xr select 2 ,
+.Xr socket 2 ,
+.Xr write 2 ,
+.Xr devfs 5 ,
+.Xr hier 7 ,
+.Xr config 8
+.Sh HISTORY
+This manual page first appeared in
+.Fx 2.1 .
+.Sh AUTHORS
+.An -nosplit
+This man page has been written by
+.An J\(:org Wunsch
+with initial input by
+.An David E. O'Brien .
diff --git a/share/man/man4/io.4 b/share/man/man4/io.4
new file mode 100644
index 000000000000..a3561dbabd9e
--- /dev/null
+++ b/share/man/man4/io.4
@@ -0,0 +1,130 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 01, 2010
+.Dt IO 4
+.Os
+.Sh NAME
+.Nm io
+.Nd I/O privilege file
+.Sh SYNOPSIS
+.Cd "device io"
+.Pp
+.In sys/types.h
+.In sys/ioctl.h
+.In dev/io/iodev.h
+.In machine/iodev.h
+.Bd -literal
+struct iodev_pio_req {
+ u_int access;
+ u_int port;
+ u_int width;
+ u_int val;
+};
+.Ed
+.Sh DESCRIPTION
+The special file
+.Pa /dev/io
+is a controlled security hole that allows a process to gain I/O
+privileges
+(which are normally reserved for kernel-internal code).
+This can be useful in order to write userland
+programs that handle some hardware directly.
+.Pp
+The usual operations on the device are to open it via the
+.Xr open 2
+interface and to send I/O requests to the file descriptor using the
+.Xr ioctl 2
+syscall.
+.Pp
+The
+.Xr ioctl 2
+requests available for
+.Pa /dev/io
+are mostly platform dependent, but there are also some in common between
+all of them.
+The
+.Dv IODEV_PIO
+is used by all the architectures in order to request that an I/O operation
+be performed.
+It takes a 'struct iodev_pio_req' argument that must be previously setup.
+.Pp
+The
+.Fa access
+member specifies the type of operation requested.
+It may be:
+.Bl -tag -width IODEV_PIO_WRITE
+.It Dv IODEV_PIO_READ
+The operation is an "in" type.
+A value will be read from the specified port
+(retrieved from the
+.Fa port
+member) and the result will be stored in the
+.Fa val
+member.
+.It Dv IODEV_PIO_WRITE
+The operation is a "out" type.
+The value will be fetched from the
+.Fa val
+member and will be written out to the specified port (defined as the
+.Fa port
+member).
+.El
+.Pp
+Finally, the
+.Fa width
+member specifies the size of the operand to be read/written, expressed
+in bytes.
+.Pp
+In addition to any file access permissions on
+.Pa /dev/io ,
+the kernel enforces that only the super-user may open this device.
+.Sh LEGACY
+The
+.Pa /dev/io
+interface used to be very i386 specific and worked differently.
+The initial implementation simply raised the
+.Em IOPL
+of the current thread when
+.Xr open 2
+was called on the device.
+This behaviour is retained in the current implementation as legacy
+support for both i386 and amd64 architectures.
+.Sh SEE ALSO
+.Xr close 2 ,
+.Xr i386_get_ioperm 2 ,
+.Xr i386_set_ioperm 2 ,
+.Xr ioctl 2 ,
+.Xr open 2 ,
+.Xr mem 4
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 1.0 .
diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4
new file mode 100644
index 000000000000..cf16d6543928
--- /dev/null
+++ b/share/man/man4/ip.4
@@ -0,0 +1,854 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
+.\" $FreeBSD$
+.\"
+.Dd November 14, 2011
+.Dt IP 4
+.Os
+.Sh NAME
+.Nm ip
+.Nd Internet Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket AF_INET SOCK_RAW proto
+.Sh DESCRIPTION
+.Tn IP
+is the transport layer protocol used
+by the Internet protocol family.
+Options may be set at the
+.Tn IP
+level
+when using higher-level protocols that are based on
+.Tn IP
+(such as
+.Tn TCP
+and
+.Tn UDP ) .
+It may also be accessed
+through a
+.Dq raw socket
+when developing new protocols, or
+special-purpose applications.
+.Pp
+There are several
+.Tn IP-level
+.Xr setsockopt 2
+and
+.Xr getsockopt 2
+options.
+.Dv IP_OPTIONS
+may be used to provide
+.Tn IP
+options to be transmitted in the
+.Tn IP
+header of each outgoing packet
+or to examine the header options on incoming packets.
+.Tn IP
+options may be used with any socket type in the Internet family.
+The format of
+.Tn IP
+options to be sent is that specified by the
+.Tn IP
+protocol specification (RFC-791), with one exception:
+the list of addresses for Source Route options must include the first-hop
+gateway at the beginning of the list of gateways.
+The first-hop gateway address will be extracted from the option list
+and the size adjusted accordingly before use.
+To disable previously specified options,
+use a zero-length buffer:
+.Bd -literal
+setsockopt(s, IPPROTO_IP, IP_OPTIONS, NULL, 0);
+.Ed
+.Pp
+.Dv IP_TOS
+and
+.Dv IP_TTL
+may be used to set the type-of-service and time-to-live
+fields in the
+.Tn IP
+header for
+.Dv SOCK_STREAM , SOCK_DGRAM ,
+and certain types of
+.Dv SOCK_RAW
+sockets.
+For example,
+.Bd -literal
+int tos = IPTOS_LOWDELAY; /* see <netinet/ip.h> */
+setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
+
+int ttl = 60; /* max = 255 */
+setsockopt(s, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
+.Ed
+.Pp
+.Dv IP_MINTTL
+may be used to set the minimum acceptable TTL a packet must have when
+received on a socket.
+All packets with a lower TTL are silently dropped.
+This option is only really useful when set to 255, preventing packets
+from outside the directly connected networks reaching local listeners
+on sockets.
+.Pp
+.Dv IP_DONTFRAG
+may be used to set the Don't Fragment flag on IP packets.
+Currently this option is respected only on
+.Xr udp 4
+and raw
+.Xr ip 4
+sockets, unless the
+.Dv IP_HDRINCL
+option has been set.
+On
+.Xr tcp 4
+sockets, the Don't Fragment flag is controlled by the Path
+MTU Discovery option.
+Sending a packet larger than the MTU size of the egress interface,
+determined by the destination address, returns an
+.Er EMSGSIZE
+error.
+.Pp
+If the
+.Dv IP_RECVDSTADDR
+option is enabled on a
+.Dv SOCK_DGRAM
+socket,
+the
+.Xr recvmsg 2
+call will return the destination
+.Tn IP
+address for a
+.Tn UDP
+datagram.
+The
+.Vt msg_control
+field in the
+.Vt msghdr
+structure points to a buffer
+that contains a
+.Vt cmsghdr
+structure followed by the
+.Tn IP
+address.
+The
+.Vt cmsghdr
+fields have the following values:
+.Bd -literal
+cmsg_len = sizeof(struct in_addr)
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_RECVDSTADDR
+.Ed
+.Pp
+The source address to be used for outgoing
+.Tn UDP
+datagrams on a socket that is not bound to a specific
+.Tn IP
+address can be specified as ancillary data with a type code of
+.Dv IP_SENDSRCADDR .
+The msg_control field in the msghdr structure should point to a buffer
+that contains a
+.Vt cmsghdr
+structure followed by the
+.Tn IP
+address.
+The cmsghdr fields should have the following values:
+.Bd -literal
+cmsg_len = sizeof(struct in_addr)
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_SENDSRCADDR
+.Ed
+.Pp
+For convenience,
+.Dv IP_SENDSRCADDR
+is defined to have the same value as
+.Dv IP_RECVDSTADDR ,
+so the
+.Dv IP_RECVDSTADDR
+control message from
+.Xr recvmsg 2
+can be used directly as a control message for
+.Xr sendmsg 2 .
+.\"
+.Pp
+If the
+.Dv IP_ONESBCAST
+option is enabled on a
+.Dv SOCK_DGRAM
+or a
+.Dv SOCK_RAW
+socket, the destination address of outgoing
+broadcast datagrams on that socket will be forced
+to the undirected broadcast address,
+.Dv INADDR_BROADCAST ,
+before transmission.
+This is in contrast to the default behavior of the
+system, which is to transmit undirected broadcasts
+via the first network interface with the
+.Dv IFF_BROADCAST flag set.
+.Pp
+This option allows applications to choose which
+interface is used to transmit an undirected broadcast
+datagram.
+For example, the following code would force an
+undirected broadcast to be transmitted via the interface
+configured with the broadcast address 192.168.2.255:
+.Bd -literal
+char msg[512];
+struct sockaddr_in sin;
+u_char onesbcast = 1; /* 0 = disable (default), 1 = enable */
+
+setsockopt(s, IPPROTO_IP, IP_ONESBCAST, &onesbcast, sizeof(onesbcast));
+sin.sin_addr.s_addr = inet_addr("192.168.2.255");
+sin.sin_port = htons(1234);
+sendto(s, msg, sizeof(msg), 0, &sin, sizeof(sin));
+.Ed
+.Pp
+It is the application's responsibility to set the
+.Dv IP_TTL option
+to an appropriate value in order to prevent broadcast storms.
+The application must have sufficient credentials to set the
+.Dv SO_BROADCAST
+socket level option, otherwise the
+.Dv IP_ONESBCAST option has no effect.
+.Pp
+If the
+.Dv IP_BINDANY
+option is enabled on a
+.Dv SOCK_STREAM ,
+.Dv SOCK_DGRAM
+or a
+.Dv SOCK_RAW
+socket, one can
+.Xr bind 2
+to any address, even one not bound to any available network interface in the
+system.
+This functionality (in conjunction with special firewall rules) can be used for
+implementing a transparent proxy.
+The
+.Dv PRIV_NETINET_BINDANY
+privilege is needed to set this option.
+.Pp
+If the
+.Dv IP_RECVTTL
+option is enabled on a
+.Dv SOCK_DGRAM
+socket, the
+.Xr recvmsg 2
+call will return the
+.Tn IP
+.Tn TTL
+(time to live) field for a
+.Tn UDP
+datagram.
+The msg_control field in the msghdr structure points to a buffer
+that contains a cmsghdr structure followed by the
+.Tn TTL .
+The cmsghdr fields have the following values:
+.Bd -literal
+cmsg_len = sizeof(u_char)
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_RECVTTL
+.Ed
+.\"
+.Pp
+If the
+.Dv IP_RECVIF
+option is enabled on a
+.Dv SOCK_DGRAM
+socket, the
+.Xr recvmsg 2
+call returns a
+.Vt "struct sockaddr_dl"
+corresponding to the interface on which the
+packet was received.
+The
+.Va msg_control
+field in the
+.Vt msghdr
+structure points to a buffer that contains a
+.Vt cmsghdr
+structure followed by the
+.Vt "struct sockaddr_dl" .
+The
+.Vt cmsghdr
+fields have the following values:
+.Bd -literal
+cmsg_len = sizeof(struct sockaddr_dl)
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_RECVIF
+.Ed
+.Pp
+.Dv IP_PORTRANGE
+may be used to set the port range used for selecting a local port number
+on a socket with an unspecified (zero) port number.
+It has the following
+possible values:
+.Bl -tag -width IP_PORTRANGE_DEFAULT
+.It Dv IP_PORTRANGE_DEFAULT
+use the default range of values, normally
+.Dv IPPORT_HIFIRSTAUTO
+through
+.Dv IPPORT_HILASTAUTO .
+This is adjustable through the sysctl setting:
+.Va net.inet.ip.portrange.first
+and
+.Va net.inet.ip.portrange.last .
+.It Dv IP_PORTRANGE_HIGH
+use a high range of values, normally
+.Dv IPPORT_HIFIRSTAUTO
+and
+.Dv IPPORT_HILASTAUTO .
+This is adjustable through the sysctl setting:
+.Va net.inet.ip.portrange.hifirst
+and
+.Va net.inet.ip.portrange.hilast .
+.It Dv IP_PORTRANGE_LOW
+use a low range of ports, which are normally restricted to
+privileged processes on
+.Ux
+systems.
+The range is normally from
+.Dv IPPORT_RESERVED
+\- 1 down to
+.Li IPPORT_RESERVEDSTART
+in descending order.
+This is adjustable through the sysctl setting:
+.Va net.inet.ip.portrange.lowfirst
+and
+.Va net.inet.ip.portrange.lowlast .
+.El
+.Pp
+The range of privileged ports which only may be opened by
+root-owned processes may be modified by the
+.Va net.inet.ip.portrange.reservedlow
+and
+.Va net.inet.ip.portrange.reservedhigh
+sysctl settings.
+The values default to the traditional range,
+0 through
+.Dv IPPORT_RESERVED
+\- 1
+(0 through 1023), respectively.
+Note that these settings do not affect and are not accounted for in the
+use or calculation of the other
+.Va net.inet.ip.portrange
+values above.
+Changing these values departs from
+.Ux
+tradition and has security
+consequences that the administrator should carefully evaluate before
+modifying these settings.
+.Pp
+Ports are allocated at random within the specified port range in order
+to increase the difficulty of random spoofing attacks.
+In scenarios such as benchmarking, this behavior may be undesirable.
+In these cases,
+.Va net.inet.ip.portrange.randomized
+can be used to toggle randomization off.
+If more than
+.Va net.inet.ip.portrange.randomcps
+ports have been allocated in the last second, then return to sequential
+port allocation.
+Return to random allocation only once the current port allocation rate
+drops below
+.Va net.inet.ip.portrange.randomcps
+for at least
+.Va net.inet.ip.portrange.randomtime
+seconds.
+The default values for
+.Va net.inet.ip.portrange.randomcps
+and
+.Va net.inet.ip.portrange.randomtime
+are 10 port allocations per second and 45 seconds correspondingly.
+.Ss "Multicast Options"
+.Tn IP
+multicasting is supported only on
+.Dv AF_INET
+sockets of type
+.Dv SOCK_DGRAM
+and
+.Dv SOCK_RAW ,
+and only on networks where the interface
+driver supports multicasting.
+.Pp
+The
+.Dv IP_MULTICAST_TTL
+option changes the time-to-live (TTL)
+for outgoing multicast datagrams
+in order to control the scope of the multicasts:
+.Bd -literal
+u_char ttl; /* range: 0 to 255, default = 1 */
+setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
+.Ed
+.Pp
+Datagrams with a TTL of 1 are not forwarded beyond the local network.
+Multicast datagrams with a TTL of 0 will not be transmitted on any network,
+but may be delivered locally if the sending host belongs to the destination
+group and if multicast loopback has not been disabled on the sending socket
+(see below).
+Multicast datagrams with TTL greater than 1 may be forwarded
+to other networks if a multicast router is attached to the local network.
+.Pp
+For hosts with multiple interfaces, where an interface has not
+been specified for a multicast group membership,
+each multicast transmission is sent from the primary network interface.
+The
+.Dv IP_MULTICAST_IF
+option overrides the default for
+subsequent transmissions from a given socket:
+.Bd -literal
+struct in_addr addr;
+setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &addr, sizeof(addr));
+.Ed
+.Pp
+where "addr" is the local
+.Tn IP
+address of the desired interface or
+.Dv INADDR_ANY
+to specify the default interface.
+.Pp
+To specify an interface by index, an instance of
+.Vt ip_mreqn
+may be passed instead.
+The
+.Vt imr_ifindex
+member should be set to the index of the desired interface,
+or 0 to specify the default interface.
+The kernel differentiates between these two structures by their size.
+.Pp
+The use of
+.Vt IP_MULTICAST_IF
+is
+.Em not recommended ,
+as multicast memberships are scoped to each
+individual interface.
+It is supported for legacy use only by applications,
+such as routing daemons, which expect to
+be able to transmit link-local IPv4 multicast datagrams (224.0.0.0/24)
+on multiple interfaces,
+without requesting an individual membership for each interface.
+.Pp
+.\"
+An interface's local IP address and multicast capability can
+be obtained via the
+.Dv SIOCGIFCONF
+and
+.Dv SIOCGIFFLAGS
+ioctls.
+Normal applications should not need to use this option.
+.Pp
+If a multicast datagram is sent to a group to which the sending host itself
+belongs (on the outgoing interface), a copy of the datagram is, by default,
+looped back by the IP layer for local delivery.
+The
+.Dv IP_MULTICAST_LOOP
+option gives the sender explicit control
+over whether or not subsequent datagrams are looped back:
+.Bd -literal
+u_char loop; /* 0 = disable, 1 = enable (default) */
+setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop));
+.Ed
+.Pp
+This option
+improves performance for applications that may have no more than one
+instance on a single host (such as a routing daemon), by eliminating
+the overhead of receiving their own transmissions.
+It should generally not
+be used by applications for which there may be more than one instance on a
+single host (such as a conferencing program) or for which the sender does
+not belong to the destination group (such as a time querying program).
+.Pp
+The sysctl setting
+.Va net.inet.ip.mcast.loop
+controls the default setting of the
+.Dv IP_MULTICAST_LOOP
+socket option for new sockets.
+.Pp
+A multicast datagram sent with an initial TTL greater than 1 may be delivered
+to the sending host on a different interface from that on which it was sent,
+if the host belongs to the destination group on that other interface.
+The loopback control option has no effect on such delivery.
+.Pp
+A host must become a member of a multicast group before it can receive
+datagrams sent to the group.
+To join a multicast group, use the
+.Dv IP_ADD_MEMBERSHIP
+option:
+.Bd -literal
+struct ip_mreq mreq;
+setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
+.Ed
+.Pp
+where
+.Fa mreq
+is the following structure:
+.Bd -literal
+struct ip_mreq {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_interface; /* local IP address of interface */
+}
+.Ed
+.Pp
+.Va imr_interface
+should be set to the
+.Tn IP
+address of a particular multicast-capable interface if
+the host is multihomed.
+It may be set to
+.Dv INADDR_ANY
+to choose the default interface, although this is not recommended;
+this is considered to be the first interface corresponding
+to the default route.
+Otherwise, the first multicast-capable interface
+configured in the system will be used.
+.Pp
+Prior to
+.Fx 7.0 ,
+if the
+.Va imr_interface
+member is within the network range
+.Li 0.0.0.0/8 ,
+it is treated as an interface index in the system interface MIB,
+as per the RIP Version 2 MIB Extension (RFC-1724).
+In versions of
+.Fx
+since 7.0, this behavior is no longer supported.
+Developers should
+instead use the RFC 3678 multicast source filter APIs; in particular,
+.Dv MCAST_JOIN_GROUP .
+.Pp
+Up to
+.Dv IP_MAX_MEMBERSHIPS
+memberships may be added on a single socket.
+Membership is associated with a single interface;
+programs running on multihomed hosts may need to
+join the same group on more than one interface.
+.Pp
+To drop a membership, use:
+.Bd -literal
+struct ip_mreq mreq;
+setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
+.Ed
+.Pp
+where
+.Fa mreq
+contains the same values as used to add the membership.
+Memberships are dropped when the socket is closed or the process exits.
+.\" TODO: Update this piece when IPv4 source-address selection is implemented.
+.Pp
+The IGMP protocol uses the primary IP address of the interface
+as its identifier for group membership.
+This is the first IP address configured on the interface.
+If this address is removed or changed, the results are
+undefined, as the IGMP membership state will then be inconsistent.
+If multiple IP aliases are configured on the same interface,
+they will be ignored.
+.Pp
+This shortcoming was addressed in IPv6; MLDv2 requires
+that the unique link-local address for an interface is
+used to identify an MLDv2 listener.
+.Ss "Source-Specific Multicast Options"
+Since
+.Fx 8.0 ,
+the use of Source-Specific Multicast (SSM) is supported.
+These extensions require an IGMPv3 multicast router in order to
+make best use of them.
+If a legacy multicast router is present on the link,
+.Fx
+will simply downgrade to the version of IGMP spoken by the router,
+and the benefits of source filtering on the upstream link
+will not be present, although the kernel will continue to
+squelch transmissions from blocked sources.
+.Pp
+Each group membership on a socket now has a filter mode:
+.Bl -tag -width MCAST_EXCLUDE
+.It Dv MCAST_EXCLUDE
+Datagrams sent to this group are accepted,
+unless the source is in a list of blocked source addresses.
+.It Dv MCAST_INCLUDE
+Datagrams sent to this group are accepted
+only if the source is in a list of accepted source addresses.
+.El
+.Pp
+Groups joined using the legacy
+.Dv IP_ADD_MEMBERSHIP
+option are placed in exclusive-mode,
+and are able to request that certain sources are blocked or allowed.
+This is known as the
+.Em delta-based API .
+.Pp
+To block a multicast source on an existing group membership:
+.Bd -literal
+struct ip_mreq_source mreqs;
+setsockopt(s, IPPROTO_IP, IP_BLOCK_SOURCE, &mreqs, sizeof(mreqs));
+.Ed
+.Pp
+where
+.Fa mreqs
+is the following structure:
+.Bd -literal
+struct ip_mreq_source {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_sourceaddr; /* IP address of source */
+ struct in_addr imr_interface; /* local IP address of interface */
+}
+.Ed
+.Va imr_sourceaddr
+should be set to the address of the source to be blocked.
+.Pp
+To unblock a multicast source on an existing group:
+.Bd -literal
+struct ip_mreq_source mreqs;
+setsockopt(s, IPPROTO_IP, IP_UNBLOCK_SOURCE, &mreqs, sizeof(mreqs));
+.Ed
+.Pp
+The
+.Dv IP_BLOCK_SOURCE
+and
+.Dv IP_UNBLOCK_SOURCE
+options are
+.Em not permitted
+for inclusive-mode group memberships.
+.Pp
+To join a multicast group in
+.Dv MCAST_INCLUDE
+mode with a single source,
+or add another source to an existing inclusive-mode membership:
+.Bd -literal
+struct ip_mreq_source mreqs;
+setsockopt(s, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs));
+.Ed
+.Pp
+To leave a single source from an existing group in inclusive mode:
+.Bd -literal
+struct ip_mreq_source mreqs;
+setsockopt(s, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs));
+.Ed
+If this is the last accepted source for the group, the membership
+will be dropped.
+.Pp
+The
+.Dv IP_ADD_SOURCE_MEMBERSHIP
+and
+.Dv IP_DROP_SOURCE_MEMBERSHIP
+options are
+.Em not accepted
+for exclusive-mode group memberships.
+However, both exclusive and inclusive mode memberships
+support the use of the
+.Em full-state API
+documented in RFC 3678.
+For management of source filter lists using this API,
+please refer to
+.Xr sourcefilter 3 .
+.Pp
+The sysctl settings
+.Va net.inet.ip.mcast.maxsocksrc
+and
+.Va net.inet.ip.mcast.maxgrpsrc
+are used to specify an upper limit on the number of per-socket and per-group
+source filter entries which the kernel may allocate.
+.\"-----------------------
+.Ss "Raw IP Sockets"
+Raw
+.Tn IP
+sockets are connectionless,
+and are normally used with the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+calls, though the
+.Xr connect 2
+call may also be used to fix the destination for future
+packets (in which case the
+.Xr read 2
+or
+.Xr recv 2
+and
+.Xr write 2
+or
+.Xr send 2
+system calls may be used).
+.Pp
+If
+.Fa proto
+is 0, the default protocol
+.Dv IPPROTO_RAW
+is used for outgoing
+packets, and only incoming packets destined for that protocol
+are received.
+If
+.Fa proto
+is non-zero, that protocol number will be used on outgoing packets
+and to filter incoming packets.
+.Pp
+Outgoing packets automatically have an
+.Tn IP
+header prepended to
+them (based on the destination address and the protocol
+number the socket is created with),
+unless the
+.Dv IP_HDRINCL
+option has been set.
+Incoming packets are received with
+.Tn IP
+header and options intact.
+.Pp
+.Dv IP_HDRINCL
+indicates the complete IP header is included with the data
+and may be used only with the
+.Dv SOCK_RAW
+type.
+.Bd -literal
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+int hincl = 1; /* 1 = on, 0 = off */
+setsockopt(s, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl));
+.Ed
+.Pp
+Unlike previous
+.Bx
+releases, the program must set all
+the fields of the IP header, including the following:
+.Bd -literal
+ip->ip_v = IPVERSION;
+ip->ip_hl = hlen >> 2;
+ip->ip_id = 0; /* 0 means kernel set appropriate value */
+ip->ip_off = offset;
+.Ed
+.Pp
+The
+.Va ip_len
+and
+.Va ip_off
+fields
+.Em must
+be provided in host byte order.
+All other fields must be provided in network byte order.
+See
+.Xr byteorder 3
+for more information on network byte order.
+If the
+.Va ip_id
+field is set to 0 then the kernel will choose an
+appropriate value.
+If the header source address is set to
+.Dv INADDR_ANY ,
+the kernel will choose an appropriate address.
+.Sh ERRORS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width Er
+.It Bq Er EISCONN
+when trying to establish a connection on a socket which
+already has one, or when trying to send a datagram with the destination
+address specified and the socket is already connected;
+.It Bq Er ENOTCONN
+when trying to send a datagram, but
+no destination address is specified, and the socket has not been
+connected;
+.It Bq Er ENOBUFS
+when the system runs out of memory for
+an internal data structure;
+.It Bq Er EADDRNOTAVAIL
+when an attempt is made to create a
+socket with a network address for which no network interface
+exists.
+.It Bq Er EACCES
+when an attempt is made to create
+a raw IP socket by a non-privileged process.
+.El
+.Pp
+The following errors specific to
+.Tn IP
+may occur when setting or getting
+.Tn IP
+options:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+An unknown socket option name was given.
+.It Bq Er EINVAL
+The IP option field was improperly formed;
+an option field was shorter than the minimum value
+or longer than the option buffer provided.
+.El
+.Pp
+The following errors may occur when attempting to send
+.Tn IP
+datagrams via a
+.Dq raw socket
+with the
+.Dv IP_HDRINCL
+option set:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The user-supplied
+.Va ip_len
+field was not equal to the length of the datagram written to the socket.
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr byteorder 3 ,
+.Xr icmp 4 ,
+.Xr igmp 4 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr multicast 4 ,
+.Xr sourcefilter 3
+.Rs
+.%A D. Thaler
+.%A B. Fenner
+.%A B. Quinn
+.%T "Socket Interface Extensions for Multicast Source Filters"
+.%N RFC 3678
+.%D Jan 2004
+.Re
+.Sh HISTORY
+The
+.Nm
+protocol appeared in
+.Bx 4.2 .
+The
+.Vt ip_mreqn
+structure appeared in
+.Tn Linux 2.4 .
+.Sh BUGS
+Before
+.Fx 10.0
+packets received on raw IP sockets had the
+.Va ip_hl
+subtracted from the
+.Va ip_len field.
diff --git a/share/man/man4/ip6.4 b/share/man/man4/ip6.4
new file mode 100644
index 000000000000..fdbb9563d1ed
--- /dev/null
+++ b/share/man/man4/ip6.4
@@ -0,0 +1,701 @@
+.\" $KAME: ip6.4,v 1.23 2005/01/11 05:56:25 itojun Exp $
+.\" $OpenBSD: ip6.4,v 1.21 2005/01/06 03:50:46 itojun Exp $
+.\"
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 13, 2011
+.Dt IP6 4
+.Os
+.Sh NAME
+.Nm ip6
+.Nd Internet Protocol version 6 (IPv6) network layer
+.Sh SYNOPSIS
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket AF_INET6 SOCK_RAW proto
+.Sh DESCRIPTION
+The IPv6 network layer is used by the IPv6 protocol family for
+transporting data.
+IPv6 packets contain an IPv6 header that is not provided as part of the
+payload contents when passed to an application.
+IPv6 header options affect the behavior of this protocol and may be used
+by high-level protocols (such as the
+.Xr tcp 4
+and
+.Xr udp 4
+protocols) as well as directly by
+.Dq raw sockets ,
+which process IPv6 messages at a lower-level and may be useful for
+developing new protocols and special-purpose applications.
+.Ss Header
+All IPv6 packets begin with an IPv6 header.
+When data received by the kernel are passed to the application, this
+header is not included in buffer, even when raw sockets are being used.
+Likewise, when data are sent to the kernel for transmit from the
+application, the buffer is not examined for an IPv6 header:
+the kernel always constructs the header.
+To directly access IPv6 headers from received packets and specify them
+as part of the buffer passed to the kernel, link-level access
+.Po
+.Xr bpf 4 ,
+for example
+.Pc
+must instead be utilized.
+.Pp
+The header has the following definition:
+.Bd -literal -offset indent
+struct ip6_hdr {
+ union {
+ struct ip6_hdrctl {
+ uint32_t ip6_un1_flow; /* 20 bits of flow ID */
+ uint16_t ip6_un1_plen; /* payload length */
+ uint8_t ip6_un1_nxt; /* next header */
+ uint8_t ip6_un1_hlim; /* hop limit */
+ } ip6_un1;
+ uint8_t ip6_un2_vfc; /* version and class */
+ } ip6_ctlun;
+ struct in6_addr ip6_src; /* source address */
+ struct in6_addr ip6_dst; /* destination address */
+} __packed;
+
+#define ip6_vfc ip6_ctlun.ip6_un2_vfc
+#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
+.Ed
+.Pp
+All fields are in network-byte order.
+Any options specified (see
+.Sx Options
+below) must also be specified in network-byte order.
+.Pp
+.Va ip6_flow
+specifies the flow ID.
+.Va ip6_plen
+specifies the payload length.
+.Va ip6_nxt
+specifies the type of the next header.
+.Va ip6_hlim
+specifies the hop limit.
+.Pp
+The top 4 bits of
+.Va ip6_vfc
+specify the class and the bottom 4 bits specify the version.
+.Pp
+.Va ip6_src
+and
+.Va ip6_dst
+specify the source and destination addresses.
+.Pp
+The IPv6 header may be followed by any number of extension headers that start
+with the following generic definition:
+.Bd -literal -offset indent
+struct ip6_ext {
+ uint8_t ip6e_nxt;
+ uint8_t ip6e_len;
+} __packed;
+.Ed
+.Ss Options
+IPv6 allows header options on packets to manipulate the behavior of the
+protocol.
+These options and other control requests are accessed with the
+.Xr getsockopt 2
+and
+.Xr setsockopt 2
+system calls at level
+.Dv IPPROTO_IPV6
+and by using ancillary data in
+.Xr recvmsg 2
+and
+.Xr sendmsg 2 .
+They can be used to access most of the fields in the IPv6 header and
+extension headers.
+.Pp
+The following socket options are supported:
+.Bl -tag -width Ds
+.\" .It Dv IPV6_OPTIONS
+.It Dv IPV6_UNICAST_HOPS Fa "int *"
+Get or set the default hop limit header field for outgoing unicast
+datagrams sent on this socket.
+.\" .It Dv IPV6_RECVOPTS Fa "int *"
+.\" Get or set the status of whether all header options will be
+.\" delivered along with the datagram when it is received.
+.\" .It Dv IPV6_RECVRETOPTS Fa "int *"
+.\" Get or set the status of whether header options will be delivered
+.\" for reply.
+.\" .It Dv IPV6_RECVDSTADDR Fa "int *"
+.\" Get or set the status of whether datagrams are received with
+.\" destination addresses.
+.\" .It Dv IPV6_RETOPTS
+.\" Get or set IPv6 options.
+.It Dv IPV6_MULTICAST_IF Fa "u_int *"
+Get or set the interface from which multicast packets will be sent.
+For hosts with multiple interfaces, each multicast transmission is sent
+from the primary network interface.
+The interface is specified as its index as provided by
+.Xr if_nametoindex 3 .
+A value of zero specifies the default interface.
+.It Dv IPV6_MULTICAST_HOPS Fa "int *"
+Get or set the default hop limit header field for outgoing multicast
+datagrams sent on this socket.
+This option controls the scope of multicast datagram transmissions.
+.Pp
+Datagrams with a hop limit of 1 are not forwarded beyond the local
+network.
+Multicast datagrams with a hop limit of zero will not be transmitted on
+any network but may be delivered locally if the sending host belongs to
+the destination group and if multicast loopback (see below) has not been
+disabled on the sending socket.
+Multicast datagrams with a hop limit greater than 1 may be forwarded to
+the other networks if a multicast router (such as
+.Xr mrouted 8 Pq Pa ports/net/mrouted )
+is attached to the local network.
+.It Dv IPV6_MULTICAST_LOOP Fa "u_int *"
+Get or set the status of whether multicast datagrams will be looped back
+for local delivery when a multicast datagram is sent to a group to which
+the sending host belongs.
+.Pp
+This option improves performance for applications that may have no more
+than one instance on a single host (such as a router daemon) by
+eliminating the overhead of receiving their own transmissions.
+It should generally not be used by applications for which there may be
+more than one instance on a single host (such as a conferencing program)
+or for which the sender does not belong to the destination group
+(such as a time-querying program).
+.Pp
+A multicast datagram sent with an initial hop limit greater than 1 may
+be delivered to the sending host on a different interface from that on
+which it was sent if the host belongs to the destination group on that
+other interface.
+The multicast loopback control option has no effect on such delivery.
+.It Dv IPV6_JOIN_GROUP Fa "struct ipv6_mreq *"
+Join a multicast group.
+A host must become a member of a multicast group before it can receive
+datagrams sent to the group.
+.Bd -literal
+struct ipv6_mreq {
+ struct in6_addr ipv6mr_multiaddr;
+ unsigned int ipv6mr_interface;
+};
+.Ed
+.Pp
+.Va ipv6mr_interface
+may be set to zeroes to choose the default multicast interface or to the
+index of a particular multicast-capable interface if the host is
+multihomed.
+Membership is associated with a single interface; programs running on
+multihomed hosts may need to join the same group on more than one
+interface.
+.Pp
+If the multicast address is unspecified (i.e., all zeroes), messages
+from all multicast addresses will be accepted by this group.
+Note that setting to this value requires superuser privileges.
+.It Dv IPV6_LEAVE_GROUP Fa "struct ipv6_mreq *"
+Drop membership from the associated multicast group.
+Memberships are automatically dropped when the socket is closed or when
+the process exits.
+.It Dv IPV6_PORTRANGE Fa "int *"
+Get or set the allocation policy of ephemeral ports for when the kernel
+automatically binds a local address to this socket.
+The following values are available:
+.Pp
+.Bl -tag -width IPV6_PORTRANGE_DEFAULT -compact
+.It Dv IPV6_PORTRANGE_DEFAULT
+Use the regular range of non-reserved ports (varies, see
+.Xr ip 4 ) .
+.It Dv IPV6_PORTRANGE_HIGH
+Use a high range (varies, see
+.Xr ip 4 ) .
+.It Dv IPV6_PORTRANGE_LOW
+Use a low, reserved range (600\-1023, see
+.Xr ip 4 ) .
+.El
+.It Dv IPV6_PKTINFO Fa "int *"
+Get or set whether additional information about subsequent packets will
+be provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The information is stored in the following structure in the ancillary
+data returned:
+.Bd -literal
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr; /* src/dst IPv6 address */
+ unsigned int ipi6_ifindex; /* send/recv if index */
+};
+.Ed
+.It Dv IPV6_HOPLIMIT Fa "int *"
+Get or set whether the hop limit header field from subsequent packets
+will be provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The value is stored as an
+.Vt int
+in the ancillary data returned.
+.\" .It Dv IPV6_NEXTHOP Fa "int *"
+.\" Get or set whether the address of the next hop for subsequent
+.\" packets will be provided as ancillary data along with the payload in
+.\" subsequent
+.\" .Xr recvmsg 2
+.\" calls.
+.\" The option is stored as a
+.\" .Vt sockaddr
+.\" structure in the ancillary data returned.
+.\" .Pp
+.\" This option requires superuser privileges.
+.It Dv IPV6_HOPOPTS Fa "int *"
+Get or set whether the hop-by-hop options from subsequent packets will be
+provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The option is stored in the following structure in the ancillary data
+returned:
+.Bd -literal
+struct ip6_hbh {
+ uint8_t ip6h_nxt; /* next header */
+ uint8_t ip6h_len; /* length in units of 8 octets */
+/* followed by options */
+} __packed;
+.Ed
+.Pp
+The
+.Fn inet6_option_space
+routine and family of routines may be used to manipulate this data.
+.Pp
+This option requires superuser privileges.
+.It Dv IPV6_DSTOPTS Fa "int *"
+Get or set whether the destination options from subsequent packets will
+be provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The option is stored in the following structure in the ancillary data
+returned:
+.Bd -literal
+struct ip6_dest {
+ uint8_t ip6d_nxt; /* next header */
+ uint8_t ip6d_len; /* length in units of 8 octets */
+/* followed by options */
+} __packed;
+.Ed
+.Pp
+The
+.Fn inet6_option_space
+routine and family of routines may be used to manipulate this data.
+.Pp
+This option requires superuser privileges.
+.It Dv IPV6_TCLASS Fa "int *"
+Get or set the value of the traffic class field used for outgoing datagrams
+on this socket.
+The value must be between \-1 and 255.
+A value of \-1 resets to the default value.
+.It Dv IPV6_RECVTCLASS Fa "int *"
+Get or set the status of whether the traffic class header field will be
+provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The header field is stored as a single value of type
+.Vt int .
+.It Dv IPV6_RTHDR Fa "int *"
+Get or set whether the routing header from subsequent packets will be
+provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls.
+The header is stored in the following structure in the ancillary data
+returned:
+.Bd -literal
+struct ip6_rthdr {
+ uint8_t ip6r_nxt; /* next header */
+ uint8_t ip6r_len; /* length in units of 8 octets */
+ uint8_t ip6r_type; /* routing type */
+ uint8_t ip6r_segleft; /* segments left */
+/* followed by routing-type-specific data */
+} __packed;
+.Ed
+.Pp
+The
+.Fn inet6_option_space
+routine and family of routines may be used to manipulate this data.
+.Pp
+This option requires superuser privileges.
+.It Dv IPV6_PKTOPTIONS Fa "struct cmsghdr *"
+Get or set all header options and extension headers at one time on the
+last packet sent or received on the socket.
+All options must fit within the size of an mbuf (see
+.Xr mbuf 9 ) .
+Options are specified as a series of
+.Vt cmsghdr
+structures followed by corresponding values.
+.Va cmsg_level
+is set to
+.Dv IPPROTO_IPV6 ,
+.Va cmsg_type
+to one of the other values in this list, and trailing data to the option
+value.
+When setting options, if the length
+.Va optlen
+to
+.Xr setsockopt 2
+is zero, all header options will be reset to their default values.
+Otherwise, the length should specify the size the series of control
+messages consumes.
+.Pp
+Instead of using
+.Xr sendmsg 2
+to specify option values, the ancillary data used in these calls that
+correspond to the desired header options may be directly specified as
+the control message in the series of control messages provided as the
+argument to
+.Xr setsockopt 2 .
+.It Dv IPV6_CHECKSUM Fa "int *"
+Get or set the byte offset into a packet where the 16-bit checksum is
+located.
+When set, this byte offset is where incoming packets will be expected
+to have checksums of their data stored and where outgoing packets will
+have checksums of their data computed and stored by the kernel.
+A value of \-1 specifies that no checksums will be checked on incoming
+packets and that no checksums will be computed or stored on outgoing
+packets.
+The offset of the checksum for ICMPv6 sockets cannot be relocated or
+turned off.
+.It Dv IPV6_V6ONLY Fa "int *"
+Get or set whether only IPv6 connections can be made to this socket.
+For wildcard sockets, this can restrict connections to IPv6 only.
+.\"With
+.\".Ox
+.\"IPv6 sockets are always IPv6-only, so the socket option is read-only
+.\"(not modifiable).
+.It Dv IPV6_FAITH Fa "int *"
+Get or set the status of whether
+.Xr faith 4
+connections can be made to this socket.
+.It Dv IPV6_USE_MIN_MTU Fa "int *"
+Get or set whether the minimal IPv6 maximum transmission unit (MTU) size
+will be used to avoid fragmentation from occurring for subsequent
+outgoing datagrams.
+.It Dv IPV6_AUTH_LEVEL Fa "int *"
+Get or set the
+.Xr ipsec 4
+authentication level.
+.It Dv IPV6_ESP_TRANS_LEVEL Fa "int *"
+Get or set the ESP transport level.
+.It Dv IPV6_ESP_NETWORK_LEVEL Fa "int *"
+Get or set the ESP encapsulation level.
+.It Dv IPV6_IPCOMP_LEVEL Fa "int *"
+Get or set the
+.Xr ipcomp 4
+level.
+.El
+.Pp
+The
+.Dv IPV6_PKTINFO ,
+.\" .Dv IPV6_NEXTHOP ,
+.Dv IPV6_HOPLIMIT ,
+.Dv IPV6_HOPOPTS ,
+.Dv IPV6_DSTOPTS ,
+and
+.Dv IPV6_RTHDR
+options will return ancillary data along with payload contents in subsequent
+.Xr recvmsg 2
+calls with
+.Va cmsg_level
+set to
+.Dv IPPROTO_IPV6
+and
+.Va cmsg_type
+set to respective option name value (e.g.,
+.Dv IPV6_HOPTLIMIT ) .
+These options may also be used directly as ancillary
+.Va cmsg_type
+values in
+.Xr sendmsg 2
+to set options on the packet being transmitted by the call.
+The
+.Va cmsg_level
+value must be
+.Dv IPPROTO_IPV6 .
+For these options, the ancillary data object value format is the same
+as the value returned as explained for each when received with
+.Xr recvmsg 2 .
+.Pp
+Note that using
+.Xr sendmsg 2
+to specify options on particular packets works only on UDP and raw sockets.
+To manipulate header options for packets on TCP sockets, only the socket
+options may be used.
+.Pp
+In some cases, there are multiple APIs defined for manipulating an IPv6
+header field.
+A good example is the outgoing interface for multicast datagrams, which
+can be set by the
+.Dv IPV6_MULTICAST_IF
+socket option, through the
+.Dv IPV6_PKTINFO
+option, and through the
+.Va sin6_scope_id
+field of the socket address passed to the
+.Xr sendto 2
+system call.
+.Pp
+Resolving these conflicts is implementation dependent.
+This implementation determines the value in the following way:
+options specified by using ancillary data (i.e.,
+.Xr sendmsg 2 )
+are considered first,
+options specified by using
+.Dv IPV6_PKTOPTIONS
+to set
+.Dq sticky
+options are considered second,
+options specified by using the individual, basic, and direct socket
+options (e.g.,
+.Dv IPV6_UNICAST_HOPS )
+are considered third,
+and options specified in the socket address supplied to
+.Xr sendto 2
+are the last choice.
+.Ss Multicasting
+IPv6 multicasting is supported only on
+.Dv AF_INET6
+sockets of type
+.Dv SOCK_DGRAM
+and
+.Dv SOCK_RAW ,
+and only on networks where the interface driver supports
+multicasting.
+Socket options (see above) that manipulate membership of
+multicast groups and other multicast options include
+.Dv IPV6_MULTICAST_IF ,
+.Dv IPV6_MULTICAST_HOPS ,
+.Dv IPV6_MULTICAST_LOOP ,
+.Dv IPV6_LEAVE_GROUP ,
+and
+.Dv IPV6_JOIN_GROUP .
+.Ss Raw Sockets
+Raw IPv6 sockets are connectionless and are normally used with the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+calls, although the
+.Xr connect 2
+call may be used to fix the destination address for future outgoing
+packets so that
+.Xr send 2
+may instead be used and the
+.Xr bind 2
+call may be used to fix the source address for future outgoing
+packets instead of having the kernel choose a source address.
+.Pp
+By using
+.Xr connect 2
+or
+.Xr bind 2 ,
+raw socket input is constrained to only packets with their
+source address matching the socket destination address if
+.Xr connect 2
+was used and to packets with their destination address
+matching the socket source address if
+.Xr bind 2
+was used.
+.Pp
+If the
+.Ar proto
+argument to
+.Xr socket 2
+is zero, the default protocol
+.Pq Dv IPPROTO_RAW
+is used for outgoing packets.
+For incoming packets, protocols recognized by kernel are
+.Sy not
+passed to the application socket (e.g.,
+.Xr tcp 4
+and
+.Xr udp 4 )
+except for some ICMPv6 messages.
+The ICMPv6 messages not passed to raw sockets include echo, timestamp,
+and address mask requests.
+If
+.Ar proto
+is non-zero, only packets with this protocol will be passed to the
+socket.
+.Pp
+IPv6 fragments are also not passed to application sockets until
+they have been reassembled.
+If reception of all packets is desired, link-level access (such as
+.Xr bpf 4 )
+must be used instead.
+.Pp
+Outgoing packets automatically have an IPv6 header prepended to them
+(based on the destination address and the protocol number the socket
+was created with).
+Incoming packets are received by an application without the IPv6 header
+or any extension headers.
+.Pp
+Outgoing packets will be fragmented automatically by the kernel if they
+are too large.
+Incoming packets will be reassembled before being sent to the raw socket,
+so packet fragments or fragment headers will never be seen on a raw socket.
+.Sh EXAMPLES
+The following determines the hop limit on the next packet received:
+.Bd -literal
+struct iovec iov[2];
+u_char buf[BUFSIZ];
+struct cmsghdr *cm;
+struct msghdr m;
+int found, optval;
+u_char data[2048];
+
+/* Create socket. */
+
+(void)memset(&m, 0, sizeof(m));
+(void)memset(&iov, 0, sizeof(iov));
+
+iov[0].iov_base = data; /* buffer for packet payload */
+iov[0].iov_len = sizeof(data); /* expected packet length */
+
+m.msg_name = &from; /* sockaddr_in6 of peer */
+m.msg_namelen = sizeof(from);
+m.msg_iov = iov;
+m.msg_iovlen = 1;
+m.msg_control = (caddr_t)buf; /* buffer for control messages */
+m.msg_controllen = sizeof(buf);
+
+/*
+ * Enable the hop limit value from received packets to be
+ * returned along with the payload.
+ */
+optval = 1;
+if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
+ sizeof(optval)) == -1)
+ err(1, "setsockopt");
+
+found = 0;
+while (!found) {
+ if (recvmsg(s, &m, 0) == -1)
+ err(1, "recvmsg");
+ for (cm = CMSG_FIRSTHDR(&m); cm != NULL;
+ cm = CMSG_NXTHDR(&m, cm)) {
+ if (cm->cmsg_level == IPPROTO_IPV6 &&
+ cm->cmsg_type == IPV6_HOPLIMIT &&
+ cm->cmsg_len == CMSG_LEN(sizeof(int))) {
+ found = 1;
+ (void)printf("hop limit: %d\en",
+ *(int *)CMSG_DATA(cm));
+ break;
+ }
+ }
+}
+.Ed
+.Sh DIAGNOSTICS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width EADDRNOTAVAILxx
+.It Bq Er EISCONN
+when trying to establish a connection on a socket which
+already has one or when trying to send a datagram with the destination
+address specified and the socket is already connected.
+.It Bq Er ENOTCONN
+when trying to send a datagram, but
+no destination address is specified, and the socket has not been
+connected.
+.It Bq Er ENOBUFS
+when the system runs out of memory for
+an internal data structure.
+.It Bq Er EADDRNOTAVAIL
+when an attempt is made to create a
+socket with a network address for which no network interface
+exists.
+.It Bq Er EACCES
+when an attempt is made to create
+a raw IPv6 socket by a non-privileged process.
+.El
+.Pp
+The following errors specific to IPv6 may occur when setting or getting
+header options:
+.Bl -tag -width EADDRNOTAVAILxx
+.It Bq Er EINVAL
+An unknown socket option name was given.
+.It Bq Er EINVAL
+An ancillary data object was improperly formed.
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr setsockopt 2 ,
+.Xr socket 2 ,
+.\" .Xr inet6_option_space 3 ,
+.\" .Xr inet6_rthdr_space 3 ,
+.Xr if_nametoindex 3 ,
+.Xr bpf 4 ,
+.Xr icmp6 4 ,
+.Xr ip 4 ,
+.Xr inet6 4 ,
+.Xr netintro 4 ,
+.Xr tcp 4 ,
+.Xr udp 4
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%T Advanced Sockets API for IPv6
+.%R RFC 2292
+.%D February 1998
+.Re
+.Rs
+.%A S. Deering
+.%A R. Hinden
+.%T Internet Protocol, Version 6 (IPv6) Specification
+.%R RFC 2460
+.%D December 1998
+.Re
+.Rs
+.%A R. Gilligan
+.%A S. Thomson
+.%A J. Bound
+.%A W. Stevens
+.%T Basic Socket Interface Extensions for IPv6
+.%R RFC 2553
+.%D March 1999
+.Re
+.Rs
+.%A W. Stevens
+.%A B. Fenner
+.%A A. Rudoff
+.%T UNIX Network Programming, third edition
+.Re
+.Sh STANDARDS
+Most of the socket options are defined in RFC 2292 or RFC 2553.
+The
+.Dv IPV6_V6ONLY
+socket option is defined in RFC 3493 Section 5.3.
+The
+.Dv IPV6_PORTRANGE
+socket option and the conflict resolution rule are not defined in the
+RFCs and should be considered implementation dependent.
diff --git a/share/man/man4/ipfirewall.4 b/share/man/man4/ipfirewall.4
new file mode 100644
index 000000000000..e1c9a8affce8
--- /dev/null
+++ b/share/man/man4/ipfirewall.4
@@ -0,0 +1,97 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2006
+.Dt IPFW 4
+.Os
+.Sh NAME
+.Nm ipfw
+.Nd IP packet filter and traffic accounting
+.Sh SYNOPSIS
+To compile
+.Ns Nm
+into the kernel, place the following option in the kernel configuration
+file:
+.Bd -ragged -offset indent
+.Cd "options IPFIREWALL"
+.Ed
+.Pp
+Other kernel options related to
+.Ns Nm
+which may also be useful are:
+.Bd -ragged -offset indent
+.Cd "options IPFIREWALL_DEFAULT_TO_ACCEPT"
+.Cd "options IPFIREWALL_FORWARD"
+.Cd "options IPFIREWALL_VERBOSE"
+.Cd "options IPFIREWALL_VERBOSE_LIMIT=100"
+.Ed
+.Pp
+To load
+.Ns Nm
+as a module at boot time, add the following line into the
+.Xr loader.conf 5
+file:
+.Bd -literal -offset indent
+ipfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+system facility allows filtering,
+redirecting, and other operations on
+.Tn IP
+packets travelling through
+network interfaces.
+.Pp
+The default behavior of
+.Nm
+is to block all incoming and outgoing traffic.
+This behavior can be modified, to allow all traffic through the
+.Nm
+firewall by default, by enabling the
+.Dv IPFIREWALL_DEFAULT_TO_ACCEPT
+kernel option.
+This option may be useful when configuring
+.Nm
+for the first time.
+If the default
+.Nm
+behavior is to allow everything, it is easier to cope with
+firewall-tuning mistakes which may accidentally block all traffic.
+.Pp
+To enable logging of packets passing through
+.Nm ,
+enable the
+.Dv IPFIREWALL_VERBOSE
+kernel option.
+The
+.Dv IPFIREWALL_VERBOSE_LIMIT
+option will prevent
+.Xr syslogd 8
+from flooding system logs or causing local Denial of Service.
+This option may be set to the number of packets which will be logged on
+a per-entry basis before the entry is rate-limited.
+.Pp
+Policy routing and transparent forwarding features of
+.Nm
+can be enabled by
+.Dv IPFIREWALL_FORWARD
+kernel option.
+.Pp
+The user interface for
+.Nm
+is implemented by the
+.Xr ipfw 8
+utility, so please refer to the
+.Xr ipfw 8
+manpage for a complete description of the
+.Nm
+capabilities and how to use it.
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr divert 4 ,
+.Xr ip 4 ,
+.Xr ipfw 8 ,
+.Xr sysctl 8 ,
+.Xr syslogd 8 ,
+.Xr pfil 9
diff --git a/share/man/man4/ipmi.4 b/share/man/man4/ipmi.4
new file mode 100644
index 000000000000..08dd0b0c88d4
--- /dev/null
+++ b/share/man/man4/ipmi.4
@@ -0,0 +1,201 @@
+.\"
+.\" Copyright (c) 2006 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2007
+.Dt IPMI 4
+.Os
+.Sh NAME
+.Nm ipmi
+.Nd "OpenIPMI compatible IPMI interface driver"
+.Sh SYNOPSIS
+.Cd "device ipmi"
+.Pp
+To manually specify I/O attachment in
+.Pa /boot/device.hints :
+.Cd hint.ipmi.0.at="isa"
+.Cd hint.ipmi.0.port="0xCA2"
+.Cd hint.ipmi.0.spacing="8"
+.Cd hint.ipmi.0.mode="KCS"
+.Pp
+To manually specify memory attachment in
+.Pa /boot/device.hints :
+.Cd hint.ipmi.0.at="isa"
+.Cd hint.ipmi.0.maddr="0xf0000000"
+.Cd hint.ipmi.0.spacing="8"
+.Cd hint.ipmi.0.mode="SMIC"
+.Pp
+Meaning of
+.Ar spacing :
+.Bl -tag -offset indent -compact -width 0x0
+.It 8
+8 bit alignment
+.It 16
+16 bit alignment
+.It 32
+32 bit alignment
+.El
+.Pp
+If the
+.Ar port
+and
+.Ar spacing
+are not specified the interface type default will be used. Only specify
+either the
+.Ar port
+for I/O access or
+.Ar maddr
+for memory access.
+.Sh DESCRIPTION
+The
+.Tn IPMI
+(Intelligent Platform Management Interface) is a standard for
+monitoring system hardware by permitting generic code to detect
+and monitor the sensors in a system.
+The
+.Tn IPMI
+standard offers watchdog support, an FRU database, and other
+support extensions.
+It is currently being adopted by the makers of many
+single board and embedded system manufacturers.
+.Pp
+The
+.Nm
+driver in
+.Fx
+is heavily adopted from the standard and
+.Tn Linux
+driver; however, not all features described in the
+standard are supported.
+.Sh IOCTLS
+Sending and receiving messages through the
+.Nm
+driver requires the use of
+.Xr ioctl 2 .
+The ioctls are used due to the complexity of
+data sent to and from the device.
+The
+.Xr ioctl 2
+command codes below are defined in
+.In sys/ipmi.h .
+The third argument to
+.Xr ioctl 2
+should be a pointer to the type indicated.
+.Pp
+Currently the following ioctls are supported:
+.Bl -tag -width indent
+.It Dv IPMICTL_RECEIVE_MSG Pq Vt "struct ipmi_recv"
+Receive a message.
+Possible error values:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+No messages are in the process queue.
+.It Bq Er EFAULT
+An address supplied was invalid.
+.It Bq Er EMSGSIZE
+The address could not fit in the message buffer and
+will remain in the buffer.
+.El
+.It Dv IPMICTL_RECEIVE_MSG_TRUNC Pq Vt "struct ipmi_recv"
+Like
+.Dv IPMICTL_RECEIVE_MSG
+but if the message cannot fit into the buffer, it
+will truncate the contents instead of leaving the data
+in the buffer.
+.It Dv IPMICTL_SEND_COMMAND Pq Vt "struct ipmi_req"
+Send a message to the interface.
+Possible error values:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+An address supplied was invalid
+.It Bq Er ENOMEM
+Buffers could not be allowed for the command, out of memory.
+.El
+.It Dv IPMICTL_SET_MY_ADDRESS_CMD Pq Vt "unsigned int"
+Set the slave address for source messages.
+.It Dv IPMICTL_GET_MY_ADDRESS_CMD Pq Vt "unsigned int"
+Get the slave address for source messages.
+.It Dv IPMICTL_SET_MY_LUN_CMD Pq Vt "unsigned int"
+Set the slave LUN for source messages.
+.It Dv IPMICTL_GET_MY_LUN_CMD Pq Vt "unsigned int"
+Get the slave LUN for source messages.
+.El
+.Ss Unimplemented Ioctls
+.Bl -tag -width indent
+.It Dv IPMICTL_REGISTER_FOR_CMD Pq Vt "struct ipmi_cmdspec"
+Register to receive a specific command
+Possible error values:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+An supplied address was invalid.
+.It Bq Er EBUSY
+The network function/command is already in use.
+.It Bq Er ENOMEM
+Could not allocate memory.
+.El
+.It Dv IPMICTL_UNREGISTER_FOR_CMD Pq Vt "struct ipmi_cmdspec"
+Unregister to receive a specific command
+Possible error values:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+An address supplied was invalid.
+.It Bq Er ENOENT
+The network function/command was not found.
+.El
+.El
+.Ss Stub Only Ioctl
+.Bl -tag -width indent
+.It Dv IPMICTL_SET_GETS_EVENTS_CMD Pq Vt int
+Set whether this interface receives events.
+Possible error values:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+An address supplied was invalid.
+.El
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr watchdog 4 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Doug Ambrisko Aq ambrisko@FreeBSD.org .
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.Sh BUGS
+Not all features of the MontaVista driver are supported.
+.Pp
+Currently, IPMB and BT modes are not implemented.
diff --git a/share/man/man4/ips.4 b/share/man/man4/ips.4
new file mode 100644
index 000000000000..0a38d5b44713
--- /dev/null
+++ b/share/man/man4/ips.4
@@ -0,0 +1,204 @@
+.\"
+.\" Copyright (c) 2003 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 7, 2009
+.Dt IPS 4
+.Os
+.Sh NAME
+.Nm ips
+.Nd IBM/Adaptec ServeRAID controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device ips"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ips_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver claims to support the
+.Tn IBM
+(now Adaptec) ServeRAID series
+.Tn SCSI
+controller cards.
+.Pp
+These cards come with a built in configuration utility stored in
+the firmware known as the
+.Tn ISPR .
+This utility is accessed with the
+.Aq Em Ctrl+I
+key combination during the initial card
+.Tn POST .
+.Pp
+It is highly recommended that this utility be used to configure the card
+before attempting to diagnose the below error messages.
+.Pp
+In some cases, the
+.Nm
+driver can have difficulties attaching during
+the system initialization period.
+To avoid these difficulties, set the
+.Va hw.ips.0.disable
+tunable to 1.
+It will prevent the driver from attaching.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+IBM ServeRAID 3H
+.It
+ServeRAID 4L/4M/4H
+.It
+ServeRAID Series 5
+.It
+ServeRAID 6i/6M
+.It
+ServeRAID 7t/7k/7M
+.El
+.Pp
+Newer ServeRAID controllers are supported by the
+.Xr aac 4
+or
+.Xr mfi 4
+driver.
+.Sh DIAGNOSTICS
+Several error codes may be shown when the card initializes the
+.Tn IBM
+.Tn ISPR
+utility and are independent of
+.Fx .
+.Bl -diag
+.It ips%d: failed to get adapter configuration data from device
+.It ips%d: failed to get drive configuration data from device
+.Pp
+Unable to obtain adapter or drive configuration.
+.It ips%d iobuf error
+.Pp
+A buffer input/output error has occurred.
+.Bq Er ENXIO
+.El
+.Ss General adapter errors:
+.Bl -diag
+.It Attaching bus failed
+.Pp
+This message is undocumented.
+.It WARNING: command timeout. Adapter is in toaster mode, resetting
+.Pp
+A command timeout has caused the adapter to be reset.
+.It AIEE! adapter reset failed, giving up and going home! Have a nice day
+.Pp
+An error occurred while attempting to reset the adapter.
+.It unable to get adapter configuration
+.It unable to get drive configuration
+.Pp
+There was an error when attempting to get configuration information.
+.It Adapter error during initialization.
+.It adapter initialization failed
+.Pp
+There was an error while attempting to initialize the adapter.
+.It adapter failed config check
+.It adapter clear failed
+.Pp
+There was an error while checking the adapter.
+.It device is disabled
+.Pp
+The adapter is disabled.
+.It resource allocation failed
+.It irq allocation failed
+.It irq setup failed
+.Pp
+The driver was unable to allocate resources for the device.
+.El
+.Ss Error messages due to DMA:
+.Bl -diag
+.It can't alloc command dma tag
+.It can't alloc SG dma tag
+.It can't alloc dma tag for statue queue
+.It dmamap failed
+.Pp
+Failure to map or allocate DMA resources.
+.El
+.Ss Cache, buffer, and command errors:
+.Bl -diag
+.It failed to initialize command buffers
+.It no mem for command slots!
+.Pp
+The
+.Nm
+driver will return
+.Bq Er ENOMEM
+in such cases.
+.It ERROR: unable to get a command! can't flush cache!
+.It ERROR: cache flush command failed!
+.It ERROR: unable to get a command! can't update nvram
+.It ERROR: nvram update command failed!
+.It ERROR: unable to get a command! can't sync cache!
+.It ERROR: cache sync command failed!
+.It ERROR: unable to get a command! can't sync cache!
+.It ERROR: etable command failed!
+.El
+.Sh COMPATIBILITY
+Unlike many of the other
+.Tn SCSI
+devices in
+.Fx ,
+the
+.Nm
+driver does not use the
+.Xr cam 4
+.Tn SCSI
+subsystem.
+.Sh SEE ALSO
+.Xr aac 4 ,
+.Xr mfi 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr sysctl 8
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An -nosplit
+.An David Jefferys
+and
+.An Scott Long Aq scottl@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/ipsec.4 b/share/man/man4/ipsec.4
new file mode 100644
index 000000000000..d5f8b8f0f6c3
--- /dev/null
+++ b/share/man/man4/ipsec.4
@@ -0,0 +1,415 @@
+.\" $KAME: ipsec.4,v 1.17 2001/06/27 15:25:10 itojun Exp $
+.\"
+.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 29, 2009
+.Dt IPSEC 4
+.Os
+.Sh NAME
+.Nm IPsec
+.Nd Internet Protocol Security protocol
+.Sh SYNOPSIS
+.Cd "options IPSEC"
+.Cd "device crypto"
+.Pp
+.In sys/types.h
+.In netinet/in.h
+.In netipsec/ipsec.h
+.In netipsec/ipsec6.h
+.Sh DESCRIPTION
+.Nm
+is a security protocol implemented within the Internet Protocol layer
+of the networking stack.
+.Nm
+is defined for both IPv4 and IPv6
+.Xr ( inet 4
+and
+.Xr inet6 4 ) .
+.Nm
+is a set of protocols,
+.Tn ESP
+(for Encapsulating Security Payload)
+.Tn AH
+(for Authentication Header),
+and
+.Tn IPComp
+(for IP Payload Compression Protocol)
+that provide security services for IP datagrams.
+AH both authenticates and guarantees the integrity of an IP packet
+by attaching a cryptographic checksum computed using one-way hash functions.
+ESP, in addition, prevents unauthorized parties from reading the payload of
+an IP packet by also encrypting it.
+IPComp tries to increase communication performance by compressing IP payload,
+thus reducing the amount of data sent.
+This will help nodes on slow links but with enough computing power.
+.Nm
+operates in one of two modes: transport mode or tunnel mode.
+Transport mode is used to protect peer-to-peer communication between end nodes.
+Tunnel mode encapsulates IP packets within other IP packets
+and is designed for security gateways such as VPN endpoints.
+.Pp
+System configuration requires the
+.Xr crypto 4
+subsystem.
+.Pp
+The packets can be passed to a virtual
+.Xr enc 4
+interface,
+to perform packet filtering before outbound encryption and after decapsulation
+inbound.
+.Pp
+To properly filter on the inner packets of an
+.Nm
+tunnel with firewalls, you can change the values of the following sysctls
+.Bl -column net.inet6.ipsec6.filtertunnel default enable
+.It Sy "Name Default Enable"
+.It "net.inet.ipsec.filtertunnel 0 1"
+.It "net.inet6.ipsec6.filtertunnel 0 1"
+.El
+.\"
+.Ss Kernel interface
+.Nm
+is controlled by a key management and policy engine,
+that reside in the operating system kernel.
+Key management
+is the process of associating keys with security associations, also
+know as SAs.
+Policy management dictates when new security
+associations created or destroyed.
+.Pp
+The key management engine can be accessed from userland by using
+.Dv PF_KEY
+sockets.
+The
+.Dv PF_KEY
+socket API is defined in RFC2367.
+.Pp
+The policy engine is controlled by an extension to the
+.Dv PF_KEY
+API,
+.Xr setsockopt 2
+operations, and
+.Xr sysctl 3
+interface.
+The kernel implements
+an extended version of the
+.Dv PF_KEY
+interface and allows the programmer to define IPsec policies
+which are similar to the per-packet filters.
+The
+.Xr setsockopt 2
+interface is used to define per-socket behavior, and
+.Xr sysctl 3
+interface is used to define host-wide default behavior.
+.Pp
+The kernel code does not implement a dynamic encryption key exchange protocol
+such as IKE
+(Internet Key Exchange).
+Key exchange protocols are beyond what is necessary in the kernel and
+should be implemented as daemon processes which call the
+.Nm APIs.
+.\"
+.Ss Policy management
+IPsec policies can be managed in one of two ways, either by
+configuring per-socket policies using the
+.Xr setsockopt 2
+system calls, or by configuring kernel level packet filter-based
+policies using the
+.Dv PF_KEY
+interface, via the
+.Xr setkey 8
+you can define IPsec policies against packets using rules similar to packet
+filtering rules.
+Refer to
+.Xr setkey 8
+on how to use it.
+.Pp
+When setting policies using the
+.Xr setkey 8
+command, the
+.Dq Li default
+option instructs the system to use its default policy, as
+explained below, for processing packets.
+The following sysctl variables are available for configuring the
+system's IPsec behavior.
+The variables can have one of two values.
+A
+.Li 1
+means
+.Dq Li use ,
+which means that if there is a security association then use it but if
+there is not then the packets are not processed by IPsec.
+The value
+.Li 2
+is synonymous with
+.Dq Li require ,
+which requires that a security association must exist for the packets
+to move, and not be dropped.
+These terms are defined in
+.Xr ipsec_set_policy 8 .
+.Bl -column net.inet6.ipsec6.esp_trans_deflev integerxxx
+.It Sy "Name Type Changeable"
+.It "net.inet.ipsec.esp_trans_deflev integer yes"
+.It "net.inet.ipsec.esp_net_deflev integer yes"
+.It "net.inet.ipsec.ah_trans_deflev integer yes"
+.It "net.inet.ipsec.ah_net_deflev integer yes"
+.It "net.inet6.ipsec6.esp_trans_deflev integer yes"
+.It "net.inet6.ipsec6.esp_net_deflev integer yes"
+.It "net.inet6.ipsec6.ah_trans_deflev integer yes"
+.It "net.inet6.ipsec6.ah_net_deflev integer yes"
+.El
+.Pp
+If the kernel does not find a matching, system wide, policy then the
+default value is applied.
+The system wide default policy is specified
+by the following
+.Xr sysctl 8
+variables.
+.Li 0
+means
+.Dq Li discard
+which asks the kernel to drop the packet.
+.Li 1
+means
+.Dq Li none .
+.Bl -column net.inet6.ipsec6.def_policy integerxxx
+.It Sy "Name Type Changeable"
+.It "net.inet.ipsec.def_policy integer yes"
+.It "net.inet6.ipsec6.def_policy integer yes"
+.El
+.\"
+.Ss Miscellaneous sysctl variables
+When the
+.Nm
+protocols are configured for use, all protocols are included in the system.
+To selectively enable/disable protocols, use
+.Xr sysctl 8 .
+.Bl -column net.inet.ipcomp.ipcomp_enable
+.It Sy "Name Default"
+.It "net.inet.esp.esp_enable On"
+.It "net.inet.ah.ah_enable On"
+.It "net.inet.ipcomp.ipcomp_enable On"
+.El
+.Pp
+In addition the following variables are accessible via
+.Xr sysctl 8 ,
+for tweaking the kernel's IPsec behavior:
+.Bl -column net.inet6.ipsec6.inbonud_call_ike integerxxx
+.It Sy "Name Type Changeable"
+.It "net.inet.ipsec.ah_cleartos integer yes"
+.It "net.inet.ipsec.ah_offsetmask integer yes"
+.It "net.inet.ipsec.dfbit integer yes"
+.It "net.inet.ipsec.ecn integer yes"
+.It "net.inet.ipsec.debug integer yes"
+.It "net.inet6.ipsec6.ecn integer yes"
+.It "net.inet6.ipsec6.debug integer yes"
+.El
+.Pp
+The variables are interpreted as follows:
+.Bl -tag -width 6n
+.It Li ipsec.ah_cleartos
+If set to non-zero, the kernel clears the type-of-service field in the IPv4 header
+during AH authentication data computation.
+This variable is used to get current systems to inter-operate with devices that
+implement RFC1826 AH.
+It should be set to non-zero
+(clear the type-of-service field)
+for RFC2402 conformance.
+.It Li ipsec.ah_offsetmask
+During AH authentication data computation, the kernel will include a
+16bit fragment offset field
+(including flag bits)
+in the IPv4 header, after computing logical AND with the variable.
+The variable is used for inter-operating with devices that
+implement RFC1826 AH.
+It should be set to zero
+(clear the fragment offset field during computation)
+for RFC2402 conformance.
+.It Li ipsec.dfbit
+This variable configures the kernel behavior on IPv4 IPsec tunnel encapsulation.
+If set to 0, the DF bit on the outer IPv4 header will be cleared while
+1 means that the outer DF bit is set regardless from the inner DF bit and
+2 indicates that the DF bit is copied from the inner header to the
+outer one.
+The variable is supplied to conform to RFC2401 chapter 6.1.
+.It Li ipsec.ecn
+If set to non-zero, IPv4 IPsec tunnel encapsulation/decapsulation behavior will
+be friendly to ECN
+(explicit congestion notification),
+as documented in
+.Li draft-ietf-ipsec-ecn-02.txt .
+.Xr gif 4
+talks more about the behavior.
+.It Li ipsec.debug
+If set to non-zero, debug messages will be generated via
+.Xr syslog 3 .
+.El
+.Pp
+Variables under the
+.Li net.inet6.ipsec6
+tree have similar meanings to those described above.
+.\"
+.Sh PROTOCOLS
+The
+.Nm
+protocol acts as a plug-in to the
+.Xr inet 4
+and
+.Xr inet6 4
+protocols and therefore supports most of the protocols defined upon
+those IP-layer protocols.
+The
+.Xr icmp 4
+and
+.Xr icmp6 4
+protocols may behave differently with
+.Nm
+because
+.Nm
+can prevent
+.Xr icmp 4
+or
+.Xr icmp6 4
+routines from looking into the IP payload.
+.\"
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr ipsec_set_policy 3 ,
+.Xr crypto 4 ,
+.Xr enc 4 ,
+.Xr icmp6 4 ,
+.Xr intro 4 ,
+.Xr ip6 4 ,
+.Xr setkey 8 ,
+.Xr sysctl 8
+.\".Xr racoon 8
+.Rs
+.%A "S. Kent"
+.%A "R. Atkinson"
+.%T "IP Authentication Header"
+.%O "RFC 2404"
+.Re
+.Rs
+.%A "S. Kent"
+.%A "R. Atkinson"
+.%T "IP Encapsulating Security Payload (ESP)"
+.%O "RFC 2406"
+.Re
+.Sh STANDARDS
+.Rs
+.%A Daniel L. McDonald
+.%A Craig Metz
+.%A Bao G. Phan
+.%T "PF_KEY Key Management API, Version 2"
+.%R RFC
+.%N 2367
+.Re
+.Pp
+.Rs
+.%A "D. L. McDonald"
+.%T "A Simple IP Security API Extension to BSD Sockets"
+.%R internet draft
+.%N "draft-mcdonald-simple-ipsec-api-03.txt"
+.%O work in progress material
+.Re
+.Sh HISTORY
+The original
+.Nm
+implementation appeared in the WIDE/KAME IPv6/IPsec stack.
+.Pp
+For
+.Fx 5.0
+a fully locked IPsec implementation called fast_ipsec was brought in.
+The protocols drew heavily on the
+.Ox
+implementation of the
+.Tn IPsec
+protocols.
+The policy management code was derived from the
+.Tn KAME
+implementation found
+in their
+.Tn IPsec
+protocols.
+The fast_ipsec implementation lacked
+.Xr ip6 4
+support but made use of the
+.Xr crypto 4
+subsystem.
+.Pp
+For
+.Fx 7.0
+.Xr ip6 4
+support was added to fast_ipsec.
+After this the old KAME IPsec implementation was dropped and fast_ipsec
+became what now is the only
+.Nm
+implementation in
+.Fx .
+.Sh BUGS
+There is no single standard for the policy engine API,
+so the policy engine API described herein is just for this implementation.
+.Pp
+AH and tunnel mode encapsulation may not work as you might expect.
+If you configure inbound
+.Dq require
+policy with an AH tunnel or any IPsec encapsulating policy with AH
+(like
+.Dq Li esp/tunnel/A-B/use ah/transport/A-B/require ) ,
+tunnelled packets will be rejected.
+This is because the policy check is enforced on the inner packet on reception,
+and AH authenticates encapsulating
+(outer)
+packet, not the encapsulated
+(inner)
+packet
+(so for the receiving kernel there is no sign of authenticity).
+The issue will be solved when we revamp our policy engine to keep all the
+packet decapsulation history.
+.Pp
+When a large database of security associations or policies is present
+in the kernel the
+.Dv SADB_DUMP
+and
+.Dv SADB_SPDDUMP
+operations on
+.Dv PF_KEY
+sockets may fail due to lack of space.
+Increasing the socket buffer
+size may alleviate this problem.
+.Pp
+The
+.Tn IPcomp
+protocol may occasionally error because of
+.Xr zlib 3
+problems.
+.Pp
+This documentation needs more review.
diff --git a/share/man/man4/ipw.4 b/share/man/man4/ipw.4
new file mode 100644
index 000000000000..21ec44ca376e
--- /dev/null
+++ b/share/man/man4/ipw.4
@@ -0,0 +1,155 @@
+.\" Copyright (c) 2004-2006
+.\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2008
+.Dt IPW 4
+.Os
+.Sh NAME
+.Nm ipw
+.Nd "Intel PRO/Wireless 2100 IEEE 802.11 driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ipw"
+.Cd "device ipwfw"
+.Cd "device pci"
+.Cd "device wlan"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ipw_load="YES"
+.Ed
+.Pp
+In both cases, place the following line in
+.Xr loader.conf 5
+to acknowledge the firmware license (see below):
+.Bd -literal -offset indent
+legal.intel_ipw.license_ack=1
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn Intel
+PRO/Wireless 2100 MiniPCI network adapter.
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires the firmware built with the
+.Nm ipwfw
+module to work.
+For the loaded firmware to be enabled for use the license at
+.Pa /usr/share/doc/legal/intel_ipw/LICENSE
+must be agreed by adding the following line to
+.Xr loader.conf 5 :
+.Pp
+.Dl "legal.intel_ipw.license_ack=1"
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/doc/legal/intel_ipw/LICENSE" -compact
+.It Pa /usr/share/doc/legal/intel_ipw/LICENSE
+.Nm
+firmware license
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ipw0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev ipw0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ipw0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ipw0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ipw%d: device timeout"
+The driver will reset the hardware.
+This should not happen.
+.It "ipw%d: firmware error"
+The onboard microcontroller crashes for some reason.
+The driver will reset the hardware.
+This should not happen.
+.It "ipw%d: timeout waiting for firmware initialization to complete"
+The onboard microcontroller failed to initialize in time.
+This should not happen.
+.It "ipw%d: could not load firmware image '%s'"
+The driver failed to load the firmware image using the
+.Xr firmware 9
+subsystem.
+Verify the
+.Xr ipwfw 4
+firmware module is installed and the license agreement
+.Xr loader 8
+tunable has been set.
+.It "ipw%d: could not load microcode"
+An attempt to upload the microcode image to the onboard microcontroller failed.
+This should not happen.
+.It "ipw%d: could not load firmware"
+An attempt to upload the firmware image to the onboard microcontroller failed.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr ipwfw 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien.bergamini@free.fr
diff --git a/share/man/man4/ipwfw.4 b/share/man/man4/ipwfw.4
new file mode 100644
index 000000000000..b901de8c0ee3
--- /dev/null
+++ b/share/man/man4/ipwfw.4
@@ -0,0 +1,75 @@
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2010
+.Dt IPWFW 4
+.Os
+.Sh NAME
+.Nm ipwfw
+.Nd "Firmware Module for Intel PRO/Wireless 2100 driver"
+.Sh SYNOPSIS
+To compile this module into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ipwfw"
+.Ed
+.Pp
+This will include three firmware images inside the kernel.
+If you want to pick only the firmware image for the mode you want to operate
+your network adapter in choose one of the following:
+.Bd -ragged -offset indent
+.Cd "device ipwbssfw"
+.Cd "device ipwibssfw"
+.Cd "device ipwmonitorfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ipw_bss_load="YES"
+ipw_ibss_load="YES"
+ipw_monitor_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module provides access to firmware sets for the
+Intel PRO/Wireless 2100 series of IEEE 802.11 adapters.
+It may be statically linked into the kernel, or loaded as a module.
+.Pp
+For the loaded firmware to be enabled for use the license at
+.Pa /usr/share/doc/legal/intel_ipw/LICENSE
+must be agreed to by adding the following line to
+.Xr loader.conf 5 :
+.Pp
+.Dl "legal.intel_ipw.license_ack=1"
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/doc/legal/intel_ipw/LICENSE" -compact
+.It Pa /usr/share/doc/legal/intel_ipw/LICENSE
+.Nm
+firmware license
+.El
+.Sh SEE ALSO
+.Xr ipw 4 ,
+.Xr firmware 9
diff --git a/share/man/man4/isci.4 b/share/man/man4/isci.4
new file mode 100644
index 000000000000..0179a763430e
--- /dev/null
+++ b/share/man/man4/isci.4
@@ -0,0 +1,112 @@
+.\"
+.\" Copyright (c) 2012 Intel Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" substantially similar to the "NO WARRANTY" disclaimer below
+.\" ("Disclaimer") and any redistribution must be conditioned upon
+.\" including a substantially similar Disclaimer requirement for further
+.\" binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" isci driver man page.
+.\"
+.\" Author: Jim Harris <jimharris@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 2012
+.Dt ISCI 4
+.Os
+.Sh NAME
+.Nm isci
+.Nd Intel C600 Serial Attached SCSI driver
+.Sh SYNOPSIS
+To compile this driver into your kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device isci"
+.Ed
+.Pp
+Or, to load the driver as a module at boot, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+isci_load="YES"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver provides support for Intel C600
+.Tn SAS
+controllers.
+.Sh CONFIGURATION
+To force legacy interrupts for all
+.Nm
+driver instances, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.isci.force_legacy_interrupts=1
+.Ed
+.Sh DEBUGGING
+To enable debugging prints from the
+.Nm
+driver, set the
+.Bd -literal -offset indent
+hw.isci.debug_level
+.Ed
+.Pp
+variable to a value between 1 and 4 in
+.Xr loader.conf 5 .
+.Pp
+The hardware layer in the
+.Nm
+driver has extensive logging capabilities
+which are disabled by default for performance reasons.
+These can be enabled by adding
+.Bd -literal -offset indent
+options ISCI_LOGGING
+.Ed
+.Pp
+to the kernel configuration file.
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr pci 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.3 and 9.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was developed by Intel and originally written by
+.An Jim Harris Aq jimharris@FreeBSD.org
+with contributions from Sohaib Ahsan and input from
+.An Scott Long Aq scottl@FreeBSD.org .
+.Pp
+This man page was written by
+.An Jim Harris Aq jimharris@FreeBSD.org .
diff --git a/share/man/man4/iscsi_initiator.4 b/share/man/man4/iscsi_initiator.4
new file mode 100644
index 000000000000..b937f6b55bab
--- /dev/null
+++ b/share/man/man4/iscsi_initiator.4
@@ -0,0 +1,109 @@
+.\" Copyright (c) 2007 Daniel Braniss <danny@cs.huji.ac.il>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 9, 2010
+.Dt ISCSI_INITIATOR 4
+.Os
+.Sh NAME
+.Nm iscsi_initiator
+.Nd kernel driver for the iSCSI protocol
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device iscsi_initiator"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+iscsi_initiator_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+implements the kernel side of the Internet SCSI (iSCSI) network
+protocol standard.
+The userland companion is
+.Xr iscontrol 8 ,
+and permits access to remote
+.Em virtual
+SCSI devices via
+.Xr cam 4 .
+.Sh SYSCTL VARIABLES
+.Bl -tag -width "net.iscsi.n.targedaddress"
+.It Va debug.iscsi_initiator
+set the debug-level, 0 means no debugging, 9 for maximum.
+.It Va net.iscsi.isid
+the initiator part of the Session Identifier.
+.El
+.Pp
+The following are informative only:
+.Bl -tag -width "net.iscsi.n.targedaddress"
+.It Va net.iscsi.driver_version
+the current version of the driver.
+.It Va net.iscsi.sessions
+the number of current active sessions.
+.It Va net.iscsi.n.targetname
+the target name of session
+.Em n .
+.It Va net.iscsi.n.targedaddress
+the IP address of the target of session
+.Em n .
+.It Va net.iscsi.n.stats
+statistics for session
+.Em n
+.It Va net.iscsi.n.pid
+the
+.Em "process id"
+of the userland side of session
+.Em n ,
+see
+.Xr iscontrol 8 .
+.El
+.Sh FILES
+The
+.Nm
+driver creates the following:
+.Pp
+.Bl -tag -width ".Pa /dev/iscsi%dxx" -compact
+.It Pa /dev/iscsi
+used to create new sessions.
+.It Pa /dev/iscsi%d
+for each new session.
+.El
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr camcontrol 8 ,
+.Xr iscontrol 8
+.Sh STANDARDS
+iSCSI RFC 3720
+.\" .Sh HISTORY
+.\" .Sh AUTHORS
+.Sh BUGS
+The lun discovery method is old-fashioned.
diff --git a/share/man/man4/isp.4 b/share/man/man4/isp.4
new file mode 100644
index 000000000000..914fec44c0e1
--- /dev/null
+++ b/share/man/man4/isp.4
@@ -0,0 +1,238 @@
+.\" $NetBSD: isp.4,v 1.5 1999/12/18 18:33:05 mjacob Exp $
+.\"
+.\" Copyright (c) 1998, 1999, 2001
+.\" Matthew Jacob, for NASA/Ames Research Center
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" Additional Copyright (c) 2006 by Marcus Alves Grando
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 28, 2007
+.Dt ISP 4
+.Os
+.Sh NAME
+.Nm isp
+.Nd Qlogic based SCSI and FibreChannel SCSI Host Adapters
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device isp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+isp_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver provides access to
+.Tn SCSI
+or
+.Tn FibreChannel
+devices.
+.Pp
+SCSI features include support for Ultra SCSI and wide mode transactions
+for
+.Tn SCSI ,
+Ultra2 LVD (for the ISP1080 and ISP1280), and Ultra3 LVD (for the
+ISP12160).
+.Pp
+Fibre Channel support uses FCP SCSI profile for
+.Tn FibreChannel .
+and utilizes Class 3 and Class 2 connections (Qlogic 2100 is Class
+3 only, minor patches to the Qlogic 2200 to force Class 2 mode).
+Support is available for Public and Private loops, and for
+point-to-point connections (Qlogic 2200 only).
+The newer 2-Gigabit cards (2300, 2312, 2322) and 4-Gigabit (2422, 2432)
+are also supported.
+Command tagging is
+supported for all (in fact,
+.Tn FibreChannel
+requires tagging).
+Fabric support is enabled by default for other than 2100 cards.
+Fabric
+support for 2100 cards has been so problematic and these cards are so
+old now that it is just not worth your time to try it.
+.Sh FIRMWARE
+Firmware is available if the
+.Xr ispfw 4
+module is loaded during bootstrap (q.v.).
+.Pp
+It is
+.Ar strongly
+recommended that you use the firmware available
+from
+.Xr ispfw 4
+as it is the most likely to have been tested with this driver.
+.Sh HARDWARE
+Cards supported by the
+.Nm
+driver include:
+.Bl -tag -width xxxxxx -offset indent
+.It ISP1000
+SBus Fast Wide, Ultra Fast Wide cards, Single Ended or Differential
+cards.
+.It ISP1020
+Qlogic 1020 Fast Wide and Differential Fast Wide PCI cards.
+.It ISP1040
+Qlogic 1040 Ultra Wide and Differential Ultra Wide PCI cards.
+Also known as the DEC KZPBA-CA (single ended) and KZPBA-CB (HVD differential).
+.It Qlogic 1240
+Qlogic 1240 Dual Bus Ultra Wide and Differential Ultra Wide PCI
+cards.
+.It Qlogic 1020
+Qlogic 1020 SCSI cards.
+.It Qlogic 1040
+Qlogic 1040 Ultra SCSI cards.
+.It Qlogic 1080
+Qlogic 1280 LVD Ultra2 Wide PCI cards.
+.It Qlogic 1280
+Qlogic 1280 Dual Bus LVD Ultra2 Wide PCI cards.
+.It Qlogic 12160
+Qlogic 12160 Dual Bus LVD Ultra3 Wide PCI cards.
+.It Qlogic 210X
+Qlogic 2100 and 2100A Copper and Optical Fibre Channel Arbitrated
+Loop (single, dual).
+.It Qlogic 220X
+Qlogic 2200 Copper and Optical Fibre Channel Arbitrated Loop PCI
+cards (single, dual, quad).
+.It Qlogic 2300
+Qlogic 2300 Optical Fibre Channel PCI cards.
+.It Qlogic 2312
+Qlogic 2312 Optical Fibre Channel PCI cards.
+.It Qlogic 234X
+Qlogic 234X Optical Fibre Channel PCI cards (2312 chipset, single and dual attach).
+.It Qlogic 2322
+Qlogic 2322 Optical Fibre Channel PCIe cards.
+.It Qlogic 200
+Dell Branded version of the QLogic 2312 Fibre Channel PCI cards.
+.It Qlogic 2422
+Qlogic 2422 Optical Fibre Channel PCI cards (4 Gigabit)
+.It Qlogic 2432
+Qlogic 2432 Optical Fibre Channel PCIe cards (4 Gigabit)
+.El
+.Sh CONFIGURATION OPTIONS
+Target mode support may be enabled with the
+.Pp
+.Cd options ISP_TARGET_MODE
+.Pp
+option.
+.Sh BOOT OPTIONS
+The following options are switchable by setting values in
+.Pa /boot/device.hints .
+.Pp
+They are:
+.Bl -tag -width indent
+.It Va hint.isp.0.disable
+A hint value to disable driver in kernel.
+.It Va hint.isp.0.fwload_disable
+A hint value to disable loading of firmware
+.Xr ispfw 4 .
+.It Va hint.isp.0.prefer_memmap
+A hint value to use PCI memory space instead of I/O space
+access for.
+.It Va hint.isp.0.prefer_iomap
+A hint value to use PCI I/O space instead of Memory space
+access for.
+.It Va hint.isp.0.ignore_nvram
+A hint value to ignore board NVRAM settings for.
+Otherwise use NVRAM settings.
+.It Va hint.isp.0.fullduplex
+A hint value to set full duplex mode.
+.It Va hint.isp.0.topology
+A hint value to select topology of connection.
+Supported values are:
+.Pp
+.Bl -tag -width ".Li lport-only" -compact
+.It Li lport
+Prefer loopback and fallback to point to point.
+.It Li nport
+Prefer point to point and fallback to loopback.
+.It Li lport-only
+Loopback only.
+.It Li nport-only
+Point to point only.
+.El
+.It Va hint.isp.0.portwwn
+This should be the full 64 bit World Wide Port Name you would like
+to use, overriding the value in NVRAM for the card.
+.It Va hint.isp.0.nodewwn
+This should be the full 64 bit World Wide Node Name you would like
+to use, overriding the value in NVRAM for the card.
+.It Va hint.isp.0.iid
+A hint to override or set the Initiator ID or Loop ID.
+For Fibre Channel
+cards in Local Loop topologies it is
+.Ar strongly
+recommended that you set this value to non-zero.
+.It Va hint.isp.0.role
+A hint to define default role for isp instance (target, initiator, both).
+.It Va hint.isp.0.debug
+A hint value for a driver debug level (see the file
+.Pa /usr/src/sys/dev/isp/ispvar.h
+for the values.
+.El
+.Sh SYSCTL OPTIONS
+.Bl -tag -width indent
+.It Va dev.isp.N.loop_down_limit
+This value says how long to wait in seconds after loop has gone down before
+giving up and expiring all of the devices that were visible.
+The default is 300 seconds (5 minutes).
+A separate (nonadjustable) timeout is used when
+booting to not stop booting on lack of FC connectivity.
+.It Va dev.isp.N.gone_device_time
+This value says how long to wait for devices to reappear if they (temporarily)
+disappear due to loop or fabric events.
+While this timeout is running, I/O
+to those devices will simply be held.
+.It Va dev.isp.N.wwnn
+This is the readonly World Wide Node Name value for this port.
+.It Va dev.isp.N.wwpn
+This is the readonly World Wide Port Name value for this port.
+.El
+.Sh SEE ALSO
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr ispfw 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr gmultipath 8
+.Sh AUTHORS
+The
+.Nm
+driver was written by Matthew Jacob originally for NetBSD at
+NASA/Ames Research Center.
+.Sh BUGS
+The driver currently ignores some NVRAM settings.
+.Pp
+Target mode support is not completely reliable yet.
+It works reasonably
+well for Fibre Channel, somewhat well for Qlogic 1040 cards, but
+does not yet work for the other cards (due to last minute unannounced
+changes in firmware interfaces).
diff --git a/share/man/man4/ispfw.4 b/share/man/man4/ispfw.4
new file mode 100644
index 000000000000..5755501f3bf3
--- /dev/null
+++ b/share/man/man4/ispfw.4
@@ -0,0 +1,59 @@
+.\" Copyright (c) 2000
+.\" Matthew Jacob
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 20, 2000
+.Dt ISPFW 4
+.Os
+.Sh NAME
+.Nm ispfw
+.Nd "Firmware Module for Qlogic based SCSI and FibreChannel SCSI Host Adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ispfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ispfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+This trivial driver provides access to firmware sets for the Qlogic
+based SCSI and FibreChannel SCSI Host Adapters.
+It may either be
+statically linked into the kernel, or loaded as a module.
+In either
+case, the
+.Xr isp 4
+driver will notice that firmware is available to be downloaded onto
+Qlogic cards (to replace the usually out of date firmware on the cards).
+This will kick the f/w into getting unstuck.
+.Sh SEE ALSO
+.Xr isp 4
+.Sh AUTHORS
+This driver was written by Matthew Jacob.
diff --git a/share/man/man4/iwi.4 b/share/man/man4/iwi.4
new file mode 100644
index 000000000000..97ff634f4c73
--- /dev/null
+++ b/share/man/man4/iwi.4
@@ -0,0 +1,160 @@
+.\" Copyright (c) 2004-2006
+.\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2008
+.Dt IWI 4
+.Os
+.Sh NAME
+.Nm iwi
+.Nd "Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+include the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device iwi"
+.Cd "device iwifw"
+.Cd "device pci"
+.Cd "device wlan"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_iwi_load="YES"
+.Ed
+.Pp
+In both cases, place the following line in
+.Xr loader.conf 5
+to acknowledge the firmware license (see below):
+.Bd -literal -offset indent
+legal.intel_iwi.license_ack=1
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for
+.Tn Intel
+PRO/Wireless 2200BG/2915ABG MiniPCI and 2225BG PCI network adapters.
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires the firmware built with the
+.Nm iwifw
+module to work.
+For the loaded firmware to be enabled for use the license at
+.Pa /usr/share/doc/legal/intel_iwi/LICENSE
+must be agreed by adding the following line to
+.Xr loader.conf 5 :
+.Pp
+.Dl "legal.intel_iwi.license_ack=1"
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/doc/legal/intel_iwi/LICENSE" -compact
+.It Pa /usr/share/doc/legal/intel_iwi/LICENSE
+.Nm
+firmware license
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwi0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev iwi0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwi0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwi0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "iwi%d: device timeout"
+The driver will reset the hardware.
+This should not happen.
+.It "iwi%d: firmware error"
+The onboard microcontroller crashed for some reason.
+The driver will reset the hardware.
+This should not happen.
+.It "iwi%d: timeout waiting for firmware initialization to complete"
+The onboard microcontroller failed to initialize in time.
+This should not happen.
+.It "iwi%d: could not load firmware image '%s'"
+The driver failed to load the firmware image using the
+.Xr firmware 9
+subsystem.
+Verify the
+.Xr iwifw 4
+firmware module is installed and the license agreement
+.Xr loader 8
+tunable has been set.
+.It "iwi%d: could not load boot firmware"
+An attempt to upload the boot firmware image to the onboard microcontroller
+failed.
+This should not happen.
+.It "iwi%d: could not load microcode"
+An attempt to upload the microcode image to the onboard microcontroller failed.
+This should not happen.
+.It "iwi%d: could not load main firmware"
+An attempt to upload the main firmware image to the onboard microcontroller
+failed.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr iwifw 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien.bergamini@free.fr
diff --git a/share/man/man4/iwifw.4 b/share/man/man4/iwifw.4
new file mode 100644
index 000000000000..7effd3db7170
--- /dev/null
+++ b/share/man/man4/iwifw.4
@@ -0,0 +1,75 @@
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2010
+.Dt IWIFW 4
+.Os
+.Sh NAME
+.Nm iwifw
+.Nd "Firmware Module for Intel PRO/Wireless 2200BG/2225BG/2915ABG driver"
+.Sh SYNOPSIS
+To compile this module into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device iwifw"
+.Ed
+.Pp
+This will include three firmware images inside the kernel.
+If you want to pick only the firmware image for the mode you want to operate
+your network adapter in choose one of the following:
+.Bd -ragged -offset indent
+.Cd "device iwibssfw"
+.Cd "device iwiibssfw"
+.Cd "device iwimonitorfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+iwi_bss_load="YES"
+iwi_ibss_load="YES"
+iwi_monitor_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module provides access to firmware sets for the
+Intel PRO/Wireless 2200BG/2225BG/2915ABG series of IEEE 802.11 adapters.
+It may be statically linked into the kernel, or loaded as a module.
+.Pp
+For the loaded firmware to be enabled for use the license at
+.Pa /usr/share/doc/legal/intel_iwi/LICENSE
+must be agreed to by adding the following line to
+.Xr loader.conf 5 :
+.Pp
+.Dl "legal.intel_iwi.license_ack=1"
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/doc/legal/intel_iwi/LICENSE" -compact
+.It Pa /usr/share/doc/legal/intel_iwi/LICENSE
+.Nm
+firmware license
+.El
+.Sh SEE ALSO
+.Xr iwi 4 ,
+.Xr firmware 9
diff --git a/share/man/man4/iwn.4 b/share/man/man4/iwn.4
new file mode 100644
index 000000000000..2c47f6ff81b3
--- /dev/null
+++ b/share/man/man4/iwn.4
@@ -0,0 +1,182 @@
+.\" Copyright (c) 2004-2006
+.\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 27, 2012
+.Dt IWN 4
+.Os
+.Sh NAME
+.Nm iwn
+.Nd Intel IEEE 802.11n wireless network driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+include the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device iwn"
+.Cd "device pci"
+.Cd "device wlan"
+.Cd "device firmware"
+.Ed
+.Pp
+You also need to select a firmware for your device.
+Choose one from:
+.Bd -ragged -offset indent
+.Cd "device iwn4965fw"
+.Cd "device iwn1000fw"
+.Cd "device iwn5000fw"
+.Cd "device iwn5150fw"
+.Cd "device iwn6000fw"
+.Cd "device iwn6000g2afw"
+.Cd "device iwn6000g2bfw"
+.Cd "device iwn6050fw"
+.Ed
+.Pp
+Or you can use
+.Bd -ragged -offset indent
+.Cd "device iwnfw"
+.Ed
+.Pp
+to include them all.
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_iwn_load="YES"
+iwn4965fw_load="YES"
+iwn1000fw_load="YES"
+iwn5000fw_load="YES"
+iwn5150fw_load="YES"
+iwn6000fw_load="YES"
+iwn6000g2afw_load="YES"
+iwn6000g2bfw_load="YES"
+iwn6050fw_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It Intel Centrino Advanced-N 6200
+.It Intel Centrino Advanced-N 6205
+.It Intel Centrino Advanced-N 6230
+.It Intel Centrino Advanced-N + WiMAX 6250
+.It Intel Centrino Ultimate-N 6300
+.It Intel Centrino Wireless-N 130
+.It Intel Centrino Wireless-N 1000
+.It Intel Centrino Wireless-N 1030
+.It Intel Centrino Wireless-N + WiMAX 6150
+.It Intel Ultimate N WiFi Link 5300
+.It Intel Wireless WiFi Link 4965
+.It Intel WiFi Link 5100
+.It Intel WiMAX/WiFi Link 5150
+.It Intel WiMAX/WiFi Link 5350
+.El
+.Pp
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires the firmware built with the
+.Nm iwnfw
+module to work.
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwn0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev iwn0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwn0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev iwn0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "iwn%d: device timeout"
+The driver will reset the hardware.
+This should not happen.
+.It "iwn%d: firmware error"
+The onboard microcontroller crashed for some reason.
+The driver will reset the hardware.
+This should not happen.
+.It "iwn%d: timeout waiting for firmware initialization to complete"
+The onboard microcontroller failed to initialize in time.
+This should not happen.
+.It "iwn%d: could not load firmware image '%s'"
+The driver failed to load the firmware image using the
+.Xr firmware 9
+subsystem.
+Verify the
+.Xr iwnfw 4
+firmware module is present.
+.It "iwn%d: could not load boot firmware"
+An attempt to upload the boot firmware image to the onboard microcontroller
+failed.
+This should not happen.
+.It "iwn%d: could not load microcode"
+An attempt to upload the microcode image to the onboard microcontroller failed.
+This should not happen.
+.It "iwn%d: could not load main firmware"
+An attempt to upload the main firmware image to the onboard microcontroller
+failed.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr iwnfw 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien.bergamini@free.fr
diff --git a/share/man/man4/iwnfw.4 b/share/man/man4/iwnfw.4
new file mode 100644
index 000000000000..681d7284dea2
--- /dev/null
+++ b/share/man/man4/iwnfw.4
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 20, 2011
+.Dt IWNFW 4
+.Os
+.Sh NAME
+.Nm iwnfw
+.Nd "Firmware Module for Intel Wireless driver"
+.Sh SYNOPSIS
+To compile this module into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device iwnfw"
+.Ed
+.Pp
+This will include three firmware images inside the kernel.
+If you want to pick only the firmware image for your network adapter choose one
+of the following:
+.Bd -ragged -offset indent
+.Cd "device iwn4965fw"
+.Cd "device iwn1000fw"
+.Cd "device iwn5000fw"
+.Cd "device iwn5150fw"
+.Cd "device iwn6000fw"
+.Cd "device iwn6000g2afw"
+.Cd "device iwn6000g2bfw"
+.Cd "device iwn6050fw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+iwn4965fw_load="YES"
+iwn1000fw_load="YES"
+iwn5000fw_load="YES"
+iwn5150fw_load="YES"
+iwn6000fw_load="YES"
+iwn6000g2afw_load="YES"
+iwn6000g2bfw_load="YES"
+iwn6050fw_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module provides access to firmware sets for the
+Intel Wireless WiFi Link 4965, 1000, 5000 and 6000 series of
+IEEE 802.11n adapters.
+It may be
+statically linked into the kernel, or loaded as a module.
+.Sh SEE ALSO
+.Xr iwn 4 ,
+.Xr firmware 9
diff --git a/share/man/man4/ixgb.4 b/share/man/man4/ixgb.4
new file mode 100644
index 000000000000..adb51d4e1e3d
--- /dev/null
+++ b/share/man/man4/ixgb.4
@@ -0,0 +1,125 @@
+.\" Copyright (c) 2001-2004, Intel Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Intel Corporation nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 18, 2006
+.Dt IXGB 4
+.Os
+.Sh NAME
+.Nm ixgb
+.Nd "Intel(R) PRO/10GbE Ethernet driver for the FreeBSD operating system"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ixgb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ixgb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Gigabit Ethernet adapters based on
+the Intel 82597EX Ethernet controller chips.
+The driver supports Transmit/Receive checksum offload
+and Jumbo Frames.
+.Pp
+For questions related to hardware requirements,
+refer to the documentation supplied with your Intel PRO/10GbE adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 16114.
+.Pp
+This driver version supports VLANs.
+For information on enabling VLANs, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+Intel PRO/10GbE LR Server Adapter
+.It
+Intel PRO/10GbE SR Server Adapter
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ixgb%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "ixgb%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "ixgb%d: watchdog timeout -- resetting"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Intel support website at:
+.Pa http://support.intel.com .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq freebsdnic@mailbox.intel.com .
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr em 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.11
+and
+.Fx 5.3 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Intel Corporation Aq freebsdnic@mailbox.intel.com .
diff --git a/share/man/man4/ixgbe.4 b/share/man/man4/ixgbe.4
new file mode 100644
index 000000000000..1fa970c7c9f9
--- /dev/null
+++ b/share/man/man4/ixgbe.4
@@ -0,0 +1,126 @@
+.\" Copyright (c) 2001-2008, Intel Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Intel Corporation nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 19, 2010
+.Dt IXGBE 4
+.Os
+.Sh NAME
+.Nm ixgbe
+.Nd "Intel(R) 10Gb Ethernet driver for the FreeBSD operating system"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ixgbe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ixgbe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI 10Gb Ethernet adapters based on
+the Intel 82598EB Intel(R) Network Connections.
+The driver supports Jumbo Frames, MSIX, TSO, and RSS.
+.Pp
+For questions related to hardware requirements,
+refer to the documentation supplied with your Intel 10GbE adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 16114.
+.Pp
+This driver version supports VLANs.
+For information on enabling VLANs, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+Intel(R) 10 Gigabit XF SR/AF Dual Port Server Adapter
+.It
+Intel(R) 10 Gigabit XF SR/LR Server Adapter
+.It
+Intel(R) 82598EB 10 Gigabit AF Network Connection
+.It
+Intel(R) 82598EB 10 Gigabit AT CX4 Network Connection
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ixgbe%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "ixgbe%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "ixgbe%d: watchdog timeout -- resetting"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Intel support website at:
+.Pa http://support.intel.com .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq freebsdnic@mailbox.intel.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Intel Corporation Aq freebsdnic@mailbox.intel.com .
diff --git a/share/man/man4/jme.4 b/share/man/man4/jme.4
new file mode 100644
index 000000000000..e17a797b63ec
--- /dev/null
+++ b/share/man/man4/jme.4
@@ -0,0 +1,197 @@
+.\" Copyright (c) 2008 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 4, 2012
+.Dt JME 4
+.Os
+.Sh NAME
+.Nm jme
+.Nd JMicron Gigabit/Fast Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device jme"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_jme_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for JMicron JMC25x PCI Express
+Gigabit Ethernet controllers and JMicron JMC26x PCI Express Fast
+Ethernet controllers.
+.Pp
+All LOMs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for both transmit and receive,
+TCP segmentation offload (TSO), hardware VLAN tag stripping/insertion
+features, Wake On Lan (WOL) and an interrupt coalescing/moderation
+mechanism as well as a 64-bit multicast hash filter.
+.Pp
+The JMC25x also supports Jumbo Frames (up to 9216 bytes), which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+device driver provides support for the following Ethernet controllers:
+.Pp
+.Bl -bullet -compact
+.It
+JMicron JMC250 PCI Express Gigabit Ethernet controller
+.It
+JMicron JMC251 PCI Express Gigabit Ethernet with Card Read Host controller
+.It
+JMicron JMC260 PCI Express Fast Ethernet controller
+.It
+JMicron JMC261 PCI Express Gigabit Ethernet with Card Read Host controller
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.jme.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.jme.msix_disable
+This tunable disables MSI-X support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.jme.%d.tx_coal_to
+This variable sets the maximum amount of time to delay
+before sending a Tx completion interrupt, in microseconds.
+The accepted range is 1 to 65535; the default is 100 (100us).
+.It Va dev.jme.%d.tx_coal_pkt
+This variable sets the maximum number of outgoing packets which may be
+coalesced together into a single Tx completion interrupt.
+The accepted range is 1 to 255; the default is 8.
+.It Va dev.jme.%d.rx_coal_to
+This variable sets the maximum amount of time to wait for
+additional packets to arrive (for possible packet coalescing)
+before firing an Rx completion interrupt, in microseconds.
+The accepted range is 1 to 65535; the default is 100 (100us).
+.It Va dev.jme.%d.rx_coal_pkt
+This variable sets the maximum number of incoming packets which may be
+coalesced into a single Rx completion interrupt.
+The accepted range is 1 to 255; the default is 2.
+.It Va dev.jme.%d.process_limit
+This variable sets the maximum number of events that will be processed
+in a single batch before the handler is requeued into a taskqueue.
+The accepted range is 10 to 255; the default value is 128 events.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
+It first appeared in
+.Fx 7.1 .
+.Sh CAVEATS
+The
+.Nm
+driver tries to avoid unnecessary station address reprogramming for
+controllers that use eFuse to store station address.
+The number of times that eFuse can be safely reprogrammed is 16 at
+most.
+In addition, there is no way to restore the factory default station
+address once the station address has been reprogrammed via eFuse.
+It is highly recommended not to reprogram the station address and
+it is the responsibility of the administrator to store the original station
+address in a safe place when station address is changed.
+.Pp
+There are two known 1000baseT link establishment issues with JMC25x.
+If the full mask revision number of JMC25x controller is less than
+or equal to 4 and the link partner enabled the IEEE 802.3az Energy Efficient
+Ethernet feature, the controller will not be able to establish a
+1000baseT link.
+Also, if the length of the cable is longer than 120 meters, the controller
+can not establish a 1000baseT link.
+The known workaround for these issues is to force manual link
+configuration with 100baseTX instead of relying on auto-negotiation.
+The full mask revision number of controller can be checked with the
+verbose kernel boot option.
+Use the lower nibble of the chip revision number to get the
+full mask revision of the controller.
diff --git a/share/man/man4/joy.4 b/share/man/man4/joy.4
new file mode 100644
index 000000000000..4de2f5a6ee41
--- /dev/null
+++ b/share/man/man4/joy.4
@@ -0,0 +1,119 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 1995
+.Dt JOY 4
+.Os
+.Sh NAME
+.Nm joy
+.Nd joystick device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device joy"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+joy_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.joy.0.at="isa"
+.Cd hint.joy.0.port="0x201"
+.Cd hint.joy.1.at="isa"
+.Cd hint.joy.1.port="0x201"
+.Pp
+.In sys/joystick.h
+.Sh DESCRIPTION
+The joystick device driver allows applications to read the status of
+the PC joystick.
+.Pp
+This device may be opened by only one process at a time.
+.Pp
+The joystick status is read from a structure via a read()
+call.
+The structure is defined in the header file as follows:
+.Bd -literal -offset indent
+ struct joystick {
+ int x; /* x position */
+ int y; /* y position */
+ int b1; /* button 1 status */
+ int b2; /* button 2 status */
+ };
+.Ed
+.Pp
+Positions are typically in the range 0-2000.
+.Ss One line perl example:
+.Bd -literal -compact
+perl -e 'open(JOY,"/dev/joy0")||die;while(1)
+{sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
+.Ed
+.Ss ioctl calls
+Several ioctl() calls are also available.
+They take an argument of
+type int *
+.Bl -tag -width JOY_SET_X_OFFSET
+.It Dv JOY_SETTIMEOUT Fa int *limit
+Set the time limit (in microseconds) for reading the joystick
+status.
+Setting a value
+too small may prevent to get correct values for the positions (which
+are then set to -2147483648), however this can be useful if one is
+only interested by the buttons status.
+.It Dv JOY_GETTIMEOUT Fa int *limit
+Get the time limit (in microseconds) used for reading the joystick
+status.
+.It Dv JOY_SET_X_OFFSET Fa int *offset
+Set the value to be added to the X position when reading the joystick
+status.
+.It Dv JOY_SET_Y_OFFSET Fa int *offset
+Set the value to be added to the Y position when reading the joystick
+status.
+.It Dv JOY_GET_X_OFFSET Fa int *offset
+Get the value which is added to the X position when reading the joystick
+status.
+.It Dv JOY_GET_Y_OFFSET Fa int *offset
+Get the value which is added to the Y position when reading the joystick
+status.
+.El
+.Sh TECHNICAL SPECIFICATIONS
+The pinout of the DB-15 connector is as follow:
+.Bd -literal
+ 1 XY1 (+5v)
+ 2 Switch 1
+ 3 X1 (potentiometer #1)
+ 4 Switch 1 (GND)
+ 5 Switch 2 (GND)
+ 6 Y1 (potentiometer #2)
+ 7 Switch 2
+ 8 N.C.
+ 9 XY2 (+5v)
+ 10 Switch 4
+ 11 X2 (potentiometer #3)
+ 12 Switch 3&4 (GND)
+ 13 Y2 (potentiometer #4)
+ 14 Switch 3
+ 15 N.C.
+.Ed
+.Pp
+Pots are normally 0-150k variable resistors (0-100k sometimes), and
+according to the IBM technical reference, the time is given by
+Time = 24.2e-6s + 0.011e-6s * R/Ohms
+.Sh FILES
+.Bl -tag -width /dev/joy?
+.It Pa /dev/joy?
+joystick device files
+.El
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 2.0.5 .
+.Sh AUTHORS
+.An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr
diff --git a/share/man/man4/kbdmux.4 b/share/man/man4/kbdmux.4
new file mode 100644
index 000000000000..72b588906a14
--- /dev/null
+++ b/share/man/man4/kbdmux.4
@@ -0,0 +1,56 @@
+.\" $Id: kbdmux.4,v 1.1 2005/07/14 20:32:10 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd July 12, 2005
+.Dt KBDMUX 4
+.Os
+.Sh NAME
+.Nm kbdmux
+.Nd "keyboard multiplexer"
+.Sh SYNOPSIS
+.Cd "device kbdmux"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.kbdmux.0.disabled="1"
+.Sh DESCRIPTION
+The
+.Nm
+keyboard driver provides support for basic keyboard multiplexing.
+It is built around the idea of a
+.Dq "super keyboard" .
+The
+.Nm
+driver
+acts as a master keyboard consuming input from all slave keyboards attached to
+it.
+.Pp
+Slave keyboards can be attached to or detached from the
+.Nm
+keyboard driver with the
+.Xr kbdcontrol 1
+utility.
+.Sh SEE ALSO
+.Xr kbdcontrol 1 ,
+.Xr atkbd 4 ,
+.Xr syscons 4 ,
+.Xr ukbd 4
+.Sh HISTORY
+The
+.Nm
+module was implemented in
+.Fx 6.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh CAVEATS
+The
+.Nm
+keyboard driver switches all slave keyboards into
+.Dv K_RAW
+mode.
+Thus all slave keyboards attached to the
+.Nm
+keyboard share the same state.
+The
+.Nm
+keyboard is logically equivalent to one keyboard with lots of duplicated keys.
diff --git a/share/man/man4/keyboard.4 b/share/man/man4/keyboard.4
new file mode 100644
index 000000000000..8cff2924e8fb
--- /dev/null
+++ b/share/man/man4/keyboard.4
@@ -0,0 +1,170 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 1995
+.Dt KEYBOARD 4
+.Os
+.Sh NAME
+.Nm keyboard
+.Nd pc keyboard interface
+.Sh DESCRIPTION
+The PC keyboard is used as the console character input device.
+The keyboard
+is owned by the current virtual console.
+To switch between the virtual consoles use the sequence
+.Ar ALT+Fn ,
+which means hold down ALT and press one of the function keys.
+The
+virtual console with the same number as the function key is then
+selected as the current virtual console and given exclusive use of
+the keyboard and display.
+.Pp
+The console allows entering values that are not physically
+present on the keyboard via a special keysequence.
+To use this facility press and hold down ALT,
+then enter a decimal number from 0-255 via the numerical keypad, then
+release ALT.
+The entered value is then used as the ASCII value for one
+character.
+This way it is possible to enter any ASCII value, not present
+on the keyboard.
+The console driver also includes a history function.
+It is activated by
+pressing the scroll-lock key.
+This holds the display, and enables the cursor
+arrows for scrolling up and down through the last scrolled out lines.
+.Pp
+The keyboard is configurable to suit the individual user and the different
+national layout.
+.Pp
+The keys on the keyboard can have any of the following functions:
+.Pp
+.Bl -tag -width "Modifier Key" -compact
+.It "Normal key"
+Enter the ASCII value associated with the key.
+.It "Function key"
+Enter a string of ASCII values.
+.It "Switch Key"
+Switch virtual console.
+.It "Modifier Key"
+Change the meaning of another key.
+.El
+.Pp
+The keyboard is seen as a number of keys numbered from 1 to n.
+This
+number is often referred to as the "scancode" for a given key.
+The number
+of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is
+pressed, and the number with bit 7 as 1 when released.
+This makes it
+possible to make the mapping of the keys fully configurable.
+.Pp
+The meaning of every key is programmable via the PIO_KEYMAP ioctl call, that
+takes a structure keymap_t as argument.
+The layout of this structure is as
+follows:
+.Bd -literal -offset indent
+ struct keymap {
+ u_short n_keys;
+ struct key_t {
+ u_char map[NUM_STATES];
+ u_char spcl;
+ u_char flgs;
+ } key[NUM_KEYS];
+ };
+.Ed
+.Pp
+The field n_keys tells the system how many keydefinitions (scancodes)
+follows.
+Each scancode is then specified in the key_t substructure.
+.Pp
+Each scancode can be translated to any of 8 different values, depending
+on the shift, control, and alt state.
+These eight possibilities are
+represented by the map array, as shown below:
+.Bd -literal
+ alt
+ scan cntrl alt alt cntrl
+ code base shift cntrl shift alt shift cntrl shift
+ map[n] 0 1 2 3 4 5 6 7
+ ---- ------------------------------------------------------
+ 0x1E 'a' 'A' 0x01 0x01 'a' 'A' 0x01 0x01
+.Ed
+.Pp
+This is the default mapping for the key labelled 'A' which normally has
+scancode 0x1E.
+The eight states are as shown, giving the 'A' key its
+normal behavior.
+The spcl field is used to give the key "special" treatment, and is
+interpreted as follows.
+Each bit corresponds to one of the states above.
+If the bit is 0 the
+key emits the number defined in the corresponding map[] entry.
+If the bit is 1 the key is "special".
+This means it does not emit
+anything; instead it changes the "state".
+That means it is a shift,
+control, alt, lock, switch-screen, function-key or no-op key.
+The bitmap is backwards i.e.,
+7 for base, 6 for shift etc.
+.Pp
+The flgs field defines if the key should react on caps-lock (1),
+num-lock (2), both (3) or ignore both (0).
+.Pp
+The
+.Xr kbdcontrol 1
+utility is used to load such a description into/outof
+the kernel at runtime.
+This makes it possible to change the key
+assignments at runtime, or more important to get (GIO_KEYMAP ioctl)
+the exact key meanings from the kernel (e.g.\& used by the X server).
+.Pp
+The function keys can be programmed using the SETFKEY ioctl call.
+.Pp
+This ioctl takes an argument of the type fkeyarg_t:
+.Bd -literal -offset indent
+ struct fkeyarg {
+ u_short keynum;
+ char keydef[MAXFK];
+ char flen;
+ };
+.Ed
+.Pp
+The field keynum defines which function key that is programmed.
+The array keydef should contain the new string to be used (MAXFK long),
+and the length should be entered in flen.
+.Pp
+The GETFKEY ioctl call works in a similar manner, except it returns
+the current setting of keynum.
+.Pp
+The function keys are numbered like this:
+.Bd -literal -offset indent
+ F1-F12 key 1 - 12
+ Shift F1-F12 key 13 - 24
+ Ctrl F1-F12 key 25 - 36
+ Ctrl+shift F1-F12 key 37 - 48
+
+ Home key 49
+ Up arrow key 50
+ Page Up key 51
+ (keypad) - key 52
+ Left arrow key 53
+ (keypad) 5 key 54
+ Right arrow key 55
+ (keypad) + key 56
+ End key 57
+ Down arrow key 58
+ Page down key 59
+ Insert key 60
+ Delete key 61
+
+ Left window key 62
+ Right window key 63
+ Menu key 64
+.Ed
+.Pp
+The
+.Xr kbdcontrol 1
+utility also allows changing these values at runtime.
+.Sh AUTHORS
+.An S\(/oren Schmidt Aq sos@FreeBSD.org
diff --git a/share/man/man4/kld.4 b/share/man/man4/kld.4
new file mode 100644
index 000000000000..c36f6ab2493a
--- /dev/null
+++ b/share/man/man4/kld.4
@@ -0,0 +1,175 @@
+.\" Copyright (c) 1993 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 8, 1998
+.Dt KLD 4
+.Os
+.Sh NAME
+.Nm kld
+.Nd dynamic kernel linker facility
+.Sh DESCRIPTION
+The LKM (Loadable Kernel Modules) facility has been deprecated in
+.Fx 3.0
+and above in favor of the
+.Nm
+interface.
+This interface, like its
+predecessor, allows the system administrator to dynamically add and remove
+functionality from a running system.
+This ability also helps software
+developers to develop new parts of the kernel without constantly rebooting
+to test their changes.
+.Pp
+Various types of modules can be loaded into the system.
+There are several defined module types, listed below, which can
+be added to the system in a predefined way.
+In addition, there
+is a generic type, for which the module itself handles loading and
+unloading.
+.Pp
+The
+.Fx
+system makes extensive use of loadable kernel modules, and provides loadable
+versions of most file systems, the
+.Tn NFS
+client and server, all the screen-savers, and the
+.Tn iBCS2
+and
+.Tn Linux
+emulators.
+.Nm
+modules are placed by default in the
+.Pa /boot/kernel
+directory along with their matching kernel.
+.Pp
+The
+.Nm
+interface is used through the
+.Xr kldload 8 ,
+.Xr kldunload 8
+and
+.Xr kldstat 8
+programs.
+.Pp
+The
+.Xr kldload 8
+program can load either
+.Xr a.out 5
+or ELF formatted loadable modules.
+The
+.Xr kldunload 8
+program unloads any given loaded module, if no other module is dependent
+upon the given module.
+The
+.Xr kldstat 8
+program is used to check the status of the modules currently loaded into the
+system.
+.Pp
+Kernel modules may only be loaded or unloaded if the system security level
+.Va kern.securelevel
+is less than one.
+.Sh "MODULE TYPES"
+.Bl -ohang
+.It Em "Device Driver modules"
+New block and character device
+drivers may be loaded into the system with
+.Nm .
+Device nodes for the loaded drivers are automatically created when a
+module is loaded and destroyed when it is unloaded by
+.Xr devfs 5 .
+You can specify userland programs that will run when new devices
+become available as a result of loading modules, or existing devices
+go away when modules are unloaded, by configuring
+.Xr devd 8 .
+.El
+.Sh FILES
+.Bl -tag -width /usr/include/sys/module.h -compact
+.It Pa /boot/kernel
+directory containing module binaries built for the kernel also
+residing in the directory.
+.It Pa /usr/include/sys/module.h
+file containing definitions required to compile a
+.Nm
+module
+.It Pa /usr/share/examples/kld
+example source code implementing a sample kld module
+.El
+.Sh SEE ALSO
+.Xr kldfind 2 ,
+.Xr kldfirstmod 2 ,
+.Xr kldload 2 ,
+.Xr kldnext 2 ,
+.Xr kldstat 2 ,
+.Xr kldunload 2 ,
+.Xr devfs 5 ,
+.Xr devd 8 ,
+.Xr kldload 8 ,
+.Xr kldstat 8 ,
+.Xr kldunload 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+facility appeared in
+.Fx 3.0
+and was designed as a replacement for the
+.Nm lkm
+facility, which was similar in functionality to the loadable kernel modules
+facility provided by
+.Tn SunOS
+4.1.3.
+.Sh AUTHORS
+The
+.Nm
+facility was originally implemented by
+.An Doug Rabson Aq dfr@FreeBSD.org .
+.Sh BUGS
+If a module B, is dependent on another module A, but is not compiled with
+module A as a dependency, then
+.Xr kldload 8
+fails to load module B, even if module A is already present in the system.
+.Pp
+If multiple modules are dependent on module A, and are compiled with module
+A as a dependency, then
+.Xr kldload 8
+loads an instance of module A when any of the modules are loaded.
+.Pp
+If a custom entry point is used for a module, and the module is compiled as
+an
+.Sq ELF
+binary, then
+.Xr kldload 8
+fails to execute the entry point.
+.Pp
+.Xr kldload 8
+returns the cryptic message
+.Sq Li "ENOEXEC (Exec format error)"
+for any error encountered while loading a module.
+.Pp
+When system internal interfaces change, old modules often cannot
+detect this, and such modules when loaded will often cause crashes or
+mysterious failures.
diff --git a/share/man/man4/ksyms.4 b/share/man/man4/ksyms.4
new file mode 100644
index 000000000000..b8e4f2684ad4
--- /dev/null
+++ b/share/man/man4/ksyms.4
@@ -0,0 +1,158 @@
+.\" Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org>
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 5, 2009
+.Dt KSYMS 4
+.Os
+.Sh NAME
+.Nm ksyms
+.Nd kernel symbol table interface
+.Sh SYNOPSIS
+.Cd "device ksyms"
+.Sh DESCRIPTION
+The
+.Pa /dev/ksyms
+character device provides a read-only interface to a snapshot of the kernel
+symbol table. The in-kernel symbol manager is designed to be able to handle
+many types of symbols tables, however, only
+.Xr elf 5
+symbol tables are supported by this device. The ELF format image contains two
+sections: a symbol table and a corresponding string table.
+.Bl -tag -width indent -offset indent
+.It Dv Symbol Table
+The SYMTAB section contains the symbol table entries present in the current
+running kernel, including the symbol table entries of any loaded modules. The
+symbols are ordered by the kernel module load time starting with kernel file
+symbols first, followed by the first loaded module's symbols and so on.
+.It Dv String Table
+The STRTAB section contains the symbol name strings from the kernel and any
+loaded modules that the symbol table entries reference.
+.El
+.Pp
+Elf formatted symbol table data read from the
+.Pa /dev/ksyms
+file represents the state of the kernel at the time when the device is opened.
+Since
+.Pa /dev/ksyms
+has no text or data, most of the fields are initialized to NULL.
+The
+.Nm
+driver does not block the loading or unloading of modules into the kernel
+while the
+.Pa /dev/ksyms
+file is open but may contain stale data.
+.Sh IOCTLS
+The
+.Xr ioctl 2
+command codes below are defined in
+.Aq Pa sys/ksyms.h .
+.Pp
+The (third) argument to the
+.Xr ioctl 2
+should be a pointer to the type indicated.
+.Bl -tag -width indent -offset indent
+.It Dv KIOCGSIZE (size_t)
+Returns the total size of the current symbol table.
+This can be used when allocating a buffer to make a copy of
+the kernel symbol table.
+.It Dv KIOCGADDR (void *)
+Returns the address of the kernel symbol table mapped in
+the process memory.
+.El
+.Sh FILES
+.Bl -tag -width /dev/ksymsX
+.It Pa /dev/ksyms
+.El
+.Sh ERRORS
+An
+.Xr open 2
+of
+.Pa /dev/ksyms
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The device is already open. A process must close
+.Pa /dev/ksyms
+before it can be opened again.
+.It Bq Er ENOMEM
+There is a resource shortage in the kernel.
+.It Bq Er ENXIO
+The driver was unsuccessful in creating a snapshot of the kernel symbol
+table. This may occur if the kernel was in the process of loading or
+unloading a module.
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr nlist 3 ,
+.Xr elf 5 ,
+.Xr kldload 8
+.Sh HISTORY
+A
+.Nm
+device exists in many different operating systems.
+This implementation is similar in function to the Solaris and NetBSD
+.Nm
+driver.
+.Pp
+The
+.Nm
+driver first appeared in
+.Fx 8.0
+to support
+.Xr lockstat 1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Stacey Son
+.Aq sson@FreeBSD.org .
+.Sh BUGS
+Because files can be dynamically linked into the kernel at any time the symbol
+information can vary. When you open the
+.Pa /dev/ksyms
+file, you have access to an ELF image which represents a snapshot of the state of the kernel symbol information at that instant in time. Keeping the device open does not block the loading or unloading of kernel modules. To get a new snapshot you must close and re-open the device.
+.Pp
+A process is only allowed to open the
+.Pa /dev/ksyms
+file once at a time. The process must close the
+.Pa /dev/ksyms
+before it is allowed to open it again.
+.Pp
+The
+.Nm
+driver uses the calling process' memory address space to store the snapshot.
+.Xr ioctl 2
+can be used to get the memory address where the symbol table is stored to
+save kernel memory.
+.Xr mmap 2
+may also be used but it will map it to another address.
diff --git a/share/man/man4/ktr.4 b/share/man/man4/ktr.4
new file mode 100644
index 000000000000..b4039f0580bd
--- /dev/null
+++ b/share/man/man4/ktr.4
@@ -0,0 +1,206 @@
+.\" Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 25, 2005
+.Dt KTR 4
+.Os
+.Sh NAME
+.Nm ktr
+.Nd kernel tracing facility
+.Sh SYNOPSIS
+.Cd options KTR
+.Cd options ALQ
+.Cd options KTR_ALQ
+.Cd options KTR_COMPILE=(KTR_LOCK|KTR_INTR|KTR_PROC)
+.Cd options KTR_CPUMASK=0x3
+.Cd options KTR_ENTRIES=8192
+.Cd options KTR_MASK=(KTR_INTR|KTR_PROC)
+.Cd options KTR_VERBOSE
+.Sh DESCRIPTION
+The
+.Nm
+facility allows kernel events to be logged while the kernel executes so that
+they can be examined later when debugging.
+The only mandatory option to enable
+.Nm
+is
+.Dq Li options KTR .
+.Pp
+The
+.Dv KTR_ENTRIES
+option sets the size of the buffer of events.
+It must be a power of two.
+The size of the buffer in the currently running kernel can be found via the
+read-only sysctl
+.Va debug.ktr.entries .
+By default the buffer contains 1024 entries.
+.Ss Event Masking
+Event levels can be enabled or disabled to trim excessive and overly verbose
+logging.
+First, a mask of events is specified at compile time via the
+.Dv KTR_COMPILE
+option to limit which events are actually compiled into the kernel.
+The default value for this option is for all events to be enabled.
+.Pp
+Secondly, the actual events logged while the kernel runs can be further
+masked via the run time event mask.
+The
+.Dv KTR_MASK
+option sets the default value of the run time event mask.
+The runtime event mask can also be set by the
+.Xr loader 8
+via the
+.Va debug.ktr.mask
+environment variable.
+It can also be examined and set after booting via the
+.Va debug.ktr.mask
+sysctl.
+By default the run time mask is set to log only
+.Dv KTR_GEN
+events.
+The definitions of the event mask bits can be found in
+.In sys/ktr.h .
+.Pp
+Furthermore, there is a CPU event mask whose default value can be changed via
+the
+.Dv KTR_CPUMASK
+option.
+A CPU must have the bit corresponding to its logical id set in this bitmask
+for events that occur on it to be logged.
+This mask can be set by the
+.Xr loader 8
+via the
+.Va debug.ktr.cpumask
+environment variable.
+It can also be examined and set after booting via the
+.Va debug.ktr.cpumask
+sysctl.
+By default events on all CPUs are enabled.
+.Ss Verbose Mode
+By default, events are only logged to the internal buffer for examination
+later, but if the verbose flag is set then they are dumped to the kernel
+console as well.
+This flag can also be set from the loader via the
+.Va debug.ktr.verbose
+environment variable, or it can be examined and set after booting via the
+.Va debug.ktr.verbose
+sysctl.
+If the flag is set to zero, which is the default, then verbose output is
+disabled.
+If the flag is set to one, then the contents of the log message and the CPU
+number are printed to the kernel console.
+If the flag is greater than one, then the filename and line number of the
+event are output to the console in addition to the log message and the CPU
+number.
+The
+.Dv KTR_VERBOSE
+option sets the flag to one.
+.Ss Examining the Events
+The KTR buffer can be examined from within
+.Xr ddb 4
+via the
+.Ic show ktr Op Cm /vV
+command.
+This command displays the contents of the trace buffer one page at a time.
+At the
+.Dq Li --more--
+prompt, the Enter key displays one more entry and prompts again.
+The spacebar displays another page of entries.
+Any other key quits.
+By default the timestamp, filename, and line number are not displayed with
+each log entry.
+If the
+.Cm /v
+modifier is specified, then they are displayed in addition to the normal
+output.
+If the
+.Cm /V
+modifier is specified, then just the timestamp is displayed in
+addition to the normal output.
+Note that the events are displayed in reverse chronological order.
+That is, the most recent events are displayed first.
+.Ss Logging ktr to Disk
+The
+.Dv KTR_ALQ
+option can be used to log
+.Nm
+entries to disk for post analysis using the
+.Xr ktrdump 8
+utility.
+This option depends on the
+.Dv ALQ
+option.
+Due to the potentially high volume of trace messages the trace mask should be
+selected carefully.
+This feature is configured through a group of sysctls.
+.Bl -tag -width ".Va debug.ktr.alq_enable"
+.It Va debug.ktr.alq_file
+displays or sets the file that
+.Nm
+will log to.
+By default its value is
+.Pa /tmp/ktr.out .
+If the file name is changed while
+.Nm
+is enabled it will not take effect until
+the next invocation.
+.It Va debug.ktr.alq_enable
+enables logging of
+.Nm
+entries to disk if it is set to one.
+Setting this to 0 will terminate logging to disk and revert to
+logging to the normal ktr ring buffer.
+Data is not sent to the ring buffer while logging to disk.
+.It Va debug.ktr.alq_max
+is the maximum number of entries that will be recorded to disk, or 0 for
+infinite.
+This is helpful for limiting the number of particularly high frequency entries
+that are recorded.
+.It Va debug.ktr.alq_depth
+determines the number of entries in the write buffer.
+This is the buffer that holds entries before they are written to disk and
+defaults to the value of the
+.Dv KTR_ENTRIES
+option.
+.It Va debug.ktr.alq_failed
+records the number of times we failed to write an entry due to overflowing the
+write buffer.
+This may happen if the frequency of the logged
+.Nm
+messages outpaces the depth
+of the queue.
+.It Va debug.ktr.alq_cnt
+records the number of entries that have currently been written to disk.
+.El
+.Sh SEE ALSO
+.Xr ktrdump 8 ,
+.Xr alq 9 ,
+.Xr ktr 9
+.Sh HISTORY
+The KTR kernel tracing facility first appeared in
+.Bsx 3.0
+and was imported into
+.Fx 5.0 .
diff --git a/share/man/man4/kue.4 b/share/man/man4/kue.4
new file mode 100644
index 000000000000..c9a8ad710904
--- /dev/null
+++ b/share/man/man4/kue.4
@@ -0,0 +1,142 @@
+.\" Copyright (c) 1997, 1998, 1999, 2000
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 7, 2006
+.Dt KUE 4
+.Os
+.Sh NAME
+.Nm kue
+.Nd "Kawasaki LSI KL5KUSB101B USB Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device kue"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_kue_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the Kawasaki
+LSI KL5KLUSB101B chipset.
+.Pp
+The KL5KLUSB101B supports a 128-entry multicast filter, single perfect
+filter entry for the station address and promiscuous mode.
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+The Kawasaki chipset supports only 10Mbps half-duplex mode, hence there
+are no
+.Xr ifmedia 4
+modes to select.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Kawasaki LSI KL5KLUSB101B based USB Ethernet
+adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c19250
+.It
+3Com 3c460 HomeConnect Ethernet USB Adapter
+.It
+ADS Technologies USB-10BT
+.It
+AOX USB101
+.It
+ATen UC10T
+.It
+Abocom URE 450
+.It
+Corega USB-T
+.It
+D-Link DSB-650C
+.It
+Entrega NET-USB-E45, NET-HUB-3U1E
+.It
+I/O Data USB ETT
+.It
+Kawasaki DU-H3E
+.It
+LinkSys USB10T
+.It
+Netgear EA101
+.It
+Peracom USB Ethernet Adapter
+.It
+Psion Gold Port USB Ethernet adapter
+.It
+SMC 2102USB, 2104USB
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "kue%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "kue%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
+.Sh BUGS
+The
+.Nm
+driver does not accumulate Ethernet collisions statistics because the
+Kawasaki firmware does not appear to maintain any internal statistics.
diff --git a/share/man/man4/lagg.4 b/share/man/man4/lagg.4
new file mode 100644
index 000000000000..0ba8e1a95cef
--- /dev/null
+++ b/share/man/man4/lagg.4
@@ -0,0 +1,203 @@
+.\" $OpenBSD: trunk.4,v 1.18 2006/06/09 13:53:34 jmc Exp $
+.\"
+.\" Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 23, 2012
+.Dt LAGG 4
+.Os
+.Sh NAME
+.Nm lagg
+.Nd link aggregation and link failover interface
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device lagg"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_lagg_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+interface allows aggregation of multiple network interfaces as one virtual
+.Nm
+interface for the purpose of providing fault-tolerance and high-speed links.
+.Pp
+A
+.Nm
+interface can be created using the
+.Ic ifconfig lagg Ns Ar N Ic create
+command.
+It can use different link aggregation protocols specified
+using the
+.Ic laggproto Ar proto
+option.
+Child interfaces can be added using the
+.Ic laggport Ar child-iface
+option and removed using the
+.Ic -laggport Ar child-iface
+option.
+.Pp
+The driver currently supports the aggregation protocols
+.Ic failover
+(the default),
+.Ic fec ,
+.Ic lacp ,
+.Ic loadbalance ,
+.Ic roundrobin ,
+and
+.Ic none .
+The protocols determine which ports are used for outgoing traffic
+and whether a specific port accepts incoming traffic.
+The interface link state is used to validate if the port is active or
+not.
+.Bl -tag -width loadbalance
+.It Ic failover
+Sends traffic only through the active port.
+If the master port becomes unavailable,
+the next active port is used.
+The first interface added is the master port;
+any interfaces added after that are used as failover devices.
+.Pp
+By default, received traffic is only accepted when they are received
+through the active port.
+This constraint can be relaxed by setting the
+.Va net.link.lagg.failover_rx_all
+.Xr sysctl 8
+variable to a nonzero value,
+which is useful for certain bridged network setups.
+.It Ic fec
+Supports Cisco EtherChannel.
+This is an alias for
+.Ic loadbalance
+mode.
+.It Ic lacp
+Supports the IEEE 802.3ad Link Aggregation Control Protocol (LACP) and the
+Marker Protocol.
+LACP will negotiate a set of aggregable links with the peer in to one or more
+Link Aggregated Groups.
+Each LAG is composed of ports of the same speed, set to full-duplex operation.
+The traffic will be balanced across the ports in the LAG with the greatest
+total speed, in most cases there will only be one LAG which contains all ports.
+In the event of changes in physical connectivity, Link Aggregation will quickly
+converge to a new configuration.
+.It Ic loadbalance
+Balances outgoing traffic across the active ports based on hashed
+protocol header information and accepts incoming traffic from
+any active port.
+This is a static setup and does not negotiate aggregation with the peer or
+exchange frames to monitor the link.
+The hash includes the Ethernet source and destination address, and, if
+available, the VLAN tag, and the IP source and destination address.
+.It Ic roundrobin
+Distributes outgoing traffic using a round-robin scheduler
+through all active ports and accepts incoming traffic from
+any active port.
+.It Ic none
+This protocol is intended to do nothing: it disables any traffic without
+disabling the
+.Nm
+interface itself.
+.El
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Pp
+The MTU of the first interface to be added is used as the lagg MTU.
+All additional interfaces are required to have exactly the same value.
+.Pp
+The
+.Ic loadbalance
+and
+.Ic lacp
+modes will use the RSS hash from the network card if available to avoid
+computing one, this may give poor traffic distribution if the hash is invalid
+or uses less of the protocol header information.
+Local hash computation can be forced per interface by setting the
+.Va net.link.lagg.X.use_flowid
+.Xr sysctl 8
+variable to zero where X is the interface number.
+The default for new interfaces is set via the
+.Va net.link.lagg.default_use_flowid
+.Xr sysctl 8 .
+.Sh EXAMPLES
+Create a 802.3ad link aggregation using LACP with two
+.Xr bge 4
+Gigabit Ethernet interfaces:
+.Bd -literal -offset indent
+# ifconfig bge0 up
+# ifconfig bge1 up
+# ifconfig lagg0 laggproto lacp laggport bge0 laggport bge1 \e
+ 192.168.1.1 netmask 255.255.255.0
+.Ed
+.Pp
+The following example uses an active failover interface to set up roaming
+between wired and wireless networks using two network devices.
+Whenever the wired master interface is unplugged, the wireless failover
+device will be used:
+.Bd -literal -offset indent
+# ifconfig em0 up
+# ifconfig ath0 ether 00:11:22:33:44:55
+# ifconfig create wlan0 wlandev ath0 ssid my_net up
+# ifconfig lagg0 laggproto failover laggport em0 laggport wlan0 \e
+ 192.168.1.1 netmask 255.255.255.0
+.Ed
+.Pp
+(Note the mac address of the wireless device is forced to match the wired
+device as a workaround.)
+.Sh SEE ALSO
+.Xr ng_fec 4 ,
+.Xr ng_one2many 4 ,
+.Xr sysctl 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written under the name
+.Nm trunk
+by
+.An Reyk Floeter Aq reyk@openbsd.org .
+The LACP implementation was written by
+.An YAMAMOTO Takashi
+for
+.Nx .
+.Sh BUGS
+There is no way to configure LACP administrative variables, including system
+and port priorities.
+The current implementation always performs active-mode LACP and uses 0x8000 as
+system and port priorities.
diff --git a/share/man/man4/le.4 b/share/man/man4/le.4
new file mode 100644
index 000000000000..0a1823d30311
--- /dev/null
+++ b/share/man/man4/le.4
@@ -0,0 +1,476 @@
+.\" $NetBSD: le.4,v 1.22 2004/10/04 19:12:52 rumble Exp $
+.\"
+.\"-
+.\" Copyright (c) 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This software was developed by the Computer Systems Engineering group
+.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+.\" contributed to Berkeley.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: Header: le.4,v 1.2 92/10/13 05:31:33 leres Exp
+.\" from: @(#)le.4 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd January 20, 2007
+.Dt LE 4
+.Os
+.Sh NAME
+.Nm le
+.Nd "AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device le"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_le_load="YES"
+.Ed
+.Pp
+For C-Bus non-PnP adapters, the port address and the IRQ number have to be
+specified in
+.Pa /boot/device.hints :
+.Cd hint.le.0.at="isa"
+.Cd hint.le.0.port="0x03d0"
+.Cd hint.le.0.irq="6"
+.Pp
+For ISA non-PnP adapters, the port address as well as the IRQ and the DRQ
+numbers have to be specified in
+.Pa /boot/device.hints :
+.Cd hint.le.0.at="isa"
+.Cd hint.le.0.port="0x280"
+.Cd hint.le.0.irq="10"
+.Cd hint.le.0.drq="0"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Ethernet adapters based on the
+.Tn AMD Am7990
+and
+.Tn Am79C90
+.Pq CMOS, pin-compatible
+Local Area Network Controller for Ethernet
+.Pq Tn LANCE
+chips.
+.Pp
+The
+.Nm
+driver also supports Ethernet adapters based on the
+.Tn AMD Am79C900
+Integrated Local Area Communications Controller
+.Pq Tn ILACC
+as well as the
+.Tn Am79C9xx PCnet
+family of chips, which are single-chip implementations of a
+.Tn LANCE
+chip and a DMA engine.
+This includes a superset of the
+.Tn PCI
+bus Ethernet chips supported by the
+.Xr pcn 4
+driver.
+The
+.Nm
+driver treats all of these
+.Tn PCI
+bus Ethernet chips as an
+.Tn AMD Am79C970 PCnet-PCI
+and does not support the additional features like the MII bus and burst mode of
+.Tn AMD Am79C971 PCnet-FAST
+and greater chips.
+Thus the
+.Xr pcn 4
+driver should be preferred for the latter.
+.Pp
+Generally, the
+.Nm
+driver aims at supporting as many different chips on as many different
+platforms as possible,
+partially at the cost of the best performance with some of these.
+.Pp
+The
+.Nm
+driver supports reception and transmission of extended frames for
+.Xr vlan 4 .
+Selective reception of multicast Ethernet frames is provided by a 64-bit mask;
+multicast destination addresses are hashed to a bit entry using the Ethernet
+CRC function.
+.Sh HARDWARE
+.Ss C-Bus and ISA
+The
+.Nm
+driver supports
+.Tn C-Bus
+and
+.Tn ISA
+bus Ethernet adapters which are based on the following chips:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn AMD Am7990 and Am79C90 LANCE
+.It
+.Tn AMD Am79C960 PCnet-ISA
+.It
+.Tn AMD Am79C961 PCnet-ISA+
+.It
+.Tn AMD Am79C961A PCnet-ISA II
+.El
+.Pp
+This includes support for the following Ethernet adapters:
+.Pp
+C-Bus non-PnP:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn Contec C-NET(98)S
+.El
+.Pp
+ISA non-PnP:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn BICC Isolan
+.\" .It
+.\" .Tn Digital DEPCA
+.It
+.Tn Novell NE2100
+.El
+.Pp
+ISA PnP:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn AMD AM1500T/AM2100
+.It
+.Tn AMD PCnet-32
+.It
+.Tn AMD PCnet-ISA
+.It
+.Tn Allied Telesyn AT-1500
+.It
+.Tn Boca LANCard Combo
+.It
+.Tn Cabletron E2100 Series DNI
+.It
+.Tn Cabletron E2200 Single Chip
+.It
+.Tn Melco Inc. LGY-IV
+.It
+.Tn Novell NE2100
+.It
+.Tn Racal InterLan EtherBlaster
+.El
+.Pp
+The
+.Nm
+driver does not support the selection of media types and options via
+.Xr ifconfig 8
+with
+.Tn C-Bus
+and
+.Tn ISA
+bus Ethernet adapters.
+.\" .Ss EISA
+.\" The
+.\" .Tn EISA
+.\" bus Ethernet cards supported by the
+.\" .Nm
+.\" driver are:
+.\" .Pp
+.\" .Bl -bullet -compact
+.\" .It
+.\" .Tn DEC DE422
+.\" .El
+.\" .Ss MCA
+.\" The
+.\" .Tn MCA
+.\" bus Ethernet cards supported by the
+.\" .Nm
+.\" driver are:
+.\" .Pp
+.\" .Bl -bullet -compact
+.\" .It
+.\" .Tn SKNET Personal MC2
+.\" .It
+.\" .Tn SKNET MC2+
+.\" .El
+.Ss PCI
+The
+.Tn PCI
+bus Ethernet chips supported by the
+.Nm
+driver are:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn AMD Am53C974/Am79C970/Am79C974 PCnet-PCI
+.It
+.Tn AMD Am79C970A PCnet-PCI II
+.It
+.Tn AMD Am79C971 PCnet-FAST
+.It
+.Tn AMD Am79C972 PCnet-FAST+
+.It
+.Tn AMD Am79C973/Am79C975 PCnet-FAST III
+.It
+.Tn AMD Am79C976 PCnet-PRO
+.It
+.Tn AMD Am79C978 PCnet-Home
+.El
+.Pp
+This includes support for the following Ethernet adapters:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn AcerLAN NIC P20
+.It
+.Tn Allied Telesyn AT-2450 and AT-2700 series
+.It
+.Tn VMware emulated AMD Am79C970A PCnet-PCI II interface
+.El
+.Pp
+The
+.Nm
+driver supports the selection of the following media types via
+.Xr ifconfig 8
+with
+.Tn PCI
+bus Ethernet adapters:
+.Bl -tag -width ".Cm 10base5/AUI"
+.It Cm autoselect
+Enable autoselection of the media type.
+.It Cm 10baseT/UTP
+Select UTP media.
+.It Cm 10base5/AUI
+Select AUI/BNC media.
+.El
+.Pp
+The following media option is supported with these media types:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Select full duplex operation.
+.El
+.Pp
+Note that unlike the
+.Xr pcn 4
+driver, the
+.Nm
+driver does not support selecting 100Mbps (Fast Ethernet) media types.
+.Ss sparc64
+The
+.Nm
+driver supports the on-board
+.Tn LANCE
+interfaces found in
+.Tn Sun Ultra 1
+machines.
+The
+.Nm
+driver allows the selection of the following media types via
+.Xr ifconfig 8
+with these on-board interfaces:
+.Bl -tag -width ".Cm 10base5/AUI"
+.It Cm autoselect
+Enable autoselection of the media type.
+.It Cm 10baseT/UTP
+Select UTP media.
+.It Cm 10base5/AUI
+Select AUI media.
+.El
+.Pp
+When using autoselection, a default media type is selected for use by
+examining all ports for carrier.
+The first media type with which a carrier is detected will be selected.
+Additionally, if carrier is dropped on a port, the driver will switch
+between the possible ports until one with carrier is found.
+.Pp
+The
+.Nm
+driver also supports the following
+.Tn Sun SBus
+Ethernet add-on adapters:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn SCSI HBA and Buffered Ethernet
+.Pq SBE/S, P/N 501-1869
+.It
+.Tn Fast SCSI and Buffered Ethernet
+.Pq FSBE/S, P/N 501-2015 and 501-2981
+.El
+.Pp
+The
+.Nm
+driver does not support the selection of media types and options via
+.Xr ifconfig 8
+with
+.Tn SBus
+Ethernet add-on adapters.
+.Pp
+For further information on configuring media types and options, see
+.Xr ifconfig 8 .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "le%d: overflow"
+More packets came in from the Ethernet than there was space in the
+.Tn LANCE
+receive buffers.
+Packets were missed.
+.It "le%d: receive buffer error"
+The
+.Tn LANCE
+ran out of buffer space, packet dropped.
+.It "le%d: lost carrier"
+The Ethernet carrier disappeared during an attempt to transmit.
+The
+.Tn LANCE
+will finish transmitting the current packet,
+but will not automatically retry transmission if there is a collision.
+.It "le%d: excessive collisions, tdr %d"
+The Ethernet was extremely busy or jammed,
+outbound packets were dropped after 16 attempts to retransmit.
+.Pp
+TDR
+is the abbreviation of
+.Qq Time Domain Reflectometry .
+The optionally reported TDR value is an internal counter of the interval
+between the start of a transmission and the occurrence of a collision.
+This value can be used to determine the distance from the Ethernet tap to
+the point on the Ethernet cable that is shorted or open (unterminated).
+.It "le%d: dropping chained buffer"
+A packet did not fit into a single receive buffer and was dropped.
+Since the
+.Nm
+driver allocates buffers large enough to receive maximum sized Ethernet
+packets, this means some other station on the LAN transmitted a packet
+larger than allowed by the Ethernet standard.
+.It "le%d: transmit buffer error"
+The
+.Tn LANCE
+ran out of buffer space before finishing the transmission of a packet.
+If this error occurs, the driver software has a bug.
+.It "le%d: underflow"
+The
+.Tn LANCE
+ran out of buffer space before finishing the transmission of a packet.
+If this error occurs, the driver software has a bug.
+.It "le%d: controller failed to initialize"
+Driver failed to start the
+.Tn LANCE .
+This is potentially a hardware failure.
+.It "le%d: memory error"
+RAM failed to respond within the timeout when the
+.Tn LANCE
+wanted to read or write it.
+This is potentially a hardware failure.
+.It "le%d: receiver disabled"
+The receiver of the
+.Tn LANCE
+was turned off due to an error.
+.It "le%d: transmitter disabled"
+The transmitter of the
+.Tn LANCE
+was turned off due to an error.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr pcn 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was ported from
+.Nx
+and first appeared in
+.Fx 6.1 .
+The
+.Nx
+version in turn was derived from the
+.Nm
+driver which first appeared in
+.Bx 4.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was ported by
+.An "Marius Strobl" Aq marius@FreeBSD.org .
+.\" .Sh BUGS
+.\" The Am7990 Revision C chips have a bug which causes garbage to be inserted
+.\" in front of the received packet occasionally.
+.\" The work-around is to ignore packets with an invalid destination address
+.\" (garbage will usually not match), by double-checking the destination
+.\" address of every packet in the driver.
+.\" This work-around can be enabled with the
+.\" .Dv LANCE_REVC_BUG
+.\" kernel option.
+.\" .Pp
+.\" When
+.\" .Dv LANCE_REVC_BUG
+.\" is enabled, the
+.\" .Nm
+.\" driver executes one or two calls to an inline Ethernet address comparison
+.\" function for every received packet.
+.\" On the
+.\" .Tn MC68000
+.\" it is exactly eight instructions of 16 bits each.
+.\" There is one comparison for each unicast packet, and two comparisons for
+.\" each broadcast packet.
+.\" .Pp
+.\" In summary, the cost of the LANCE_REVC_BUG option is:
+.\" .Bl -enum -compact
+.\" .It
+.\" loss of multicast support, and
+.\" .It
+.\" eight extra
+.\" .Tn CPU
+.\" instructions per received packet, sometimes sixteen, depending on both the
+.\" processor, and the type of packet.
+.\" .El
+.\" .Pp
+.\" All sun3 systems are presumed to have this bad revision of the Am7990,
+.\" until proven otherwise.
+.\" Alas, the only way to prove what revision of the chip is in a particular
+.\" system is inspection of the date code on the chip package,
+.\" to compare against a list of what chip revisions were fabricated between
+.\" which dates.
+.\" .Pp
+.\" Alas, the Am7990 chip is so old that
+.\" .Tn AMD
+.\" has
+.\" .Qq de-archived
+.\" the production information about it; pending a search elsewhere, we do not
+.\" know how to identify the revision C chip from the date codes.
diff --git a/share/man/man4/led.4 b/share/man/man4/led.4
new file mode 100644
index 000000000000..b31a083c034b
--- /dev/null
+++ b/share/man/man4/led.4
@@ -0,0 +1,193 @@
+.\" Copyright (c) 2003 Sergey A. Osokin <osa@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 24, 2007
+.Dt LED 4
+.Os
+.Sh NAME
+.Nm led
+.Nd API for manipulating LED's, lamps and other annunciators
+.Sh SYNOPSIS
+.In dev/led/led.h
+.Pp
+.Fd "typedef void led_t(void *priv, int onoff);"
+.Ft struct cdev *
+.Fn led_create_state "led_t *func" "void *priv" "char const *name" "int state"
+.Ft struct cdev *
+.Fn led_create "led_t *func" "void *priv" "char const *name"
+.Ft void
+.Fn led_destroy "struct cdev *"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides generic support for handling LEDs, lamps and other
+annunciators.
+.Pp
+The hardware driver must supply a function to turn the annunciator on and off
+and the device
+.Fa name
+of the annunciator relative to
+.Pa /dev/led/ .
+The
+.Fa priv
+argument is passed back to this on/off function and can be used however
+the hardware driver sees fit.
+.Pp
+The lamp can be controlled by opening and writing
+.Tn ASCII
+strings to the
+.Pa /dev/led/bla
+device.
+.Pp
+In the following, we will use this special notation to indicate the resulting
+output of the annunciator:
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Ic *
+The annunciator is on for 1/10th second.
+.It Ic _
+The annunciator is off for 1/10th second.
+.El
+.Pp
+State can be set directly, and since the change happens immediately,
+it is possible to flash the annunciator with very short periods and
+synchronize it with program events.
+It should be noted that there is a non-trivial overhead, so this may
+not be usable for benchmarking or measuring short intervals.
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Ic 0
+Turn the annunciator off immediately.
+.It Ic 1
+Turn the annunciator on immediately.
+.El
+.Pp
+Flashing can be set with a given period.
+The pattern continues endlessly.
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Ic f
+_*
+.It Ic f1
+_*
+.It Ic f2
+__**
+.It Ic f3
+___***
+.It ...
+.It Ic f9
+_________*********
+.El
+.Pp
+Three high-level commands are available:
+.Bl -tag -width indent -offset indent
+.It Ic d%d
+Numbers.
+Each digit is blinked out at 1/10th second, zero as ten pulses.
+Between digits a one second pause and after the last
+digit a two second pause after which the sequence is repeated.
+.It Ic s%s
+String.
+This gives full control over the annunciator.
+Letters
+.Ql A
+.No ...
+.Ql J
+turn the annunciator on for from 1/10th to one full
+second.
+Letters
+.Ql a
+.No ...
+.Ql j
+turn the annunciator off for 1/10th
+to one full second.
+Letters
+.Ql u
+and
+.Ql U
+turn the annunciator off and on respectively when the next
+UTC second starts.
+Unless terminated with a
+.Ql \&. ,
+the sequence is immediately repeated.
+.It Ic m%s
+Morse.
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Ql \&.
+becomes
+.Ql _*
+.It Ql -
+becomes
+.Sq Li _***
+.It Ql "\ "
+becomes
+.Sq Li __
+.It Ql \en
+becomes
+.Sq Li ____
+.El
+.El
+.Pp
+The sequence is repeated after a one second pause.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/led/*"
+.It Pa /dev/led/*
+.El
+.Sh EXAMPLES
+A
+.Sq Li d12
+flashes the lamp
+.Pp
+.Dl *__________*_*______________________________
+.Pp
+A
+.Sq Li sAaAbBa
+flashes
+.Pp
+.Dl *_*__**_
+.Bd -literal
+/usr/games/morse -l "Soekris rocks" > /dev/led/error
+.Ed
+.Sh SEE ALSO
+.Xr morse 6
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.2 .
+.Sh AUTHORS
+.An -nosplit
+This software was written by
+.An Poul-Henning Kamp
+.Aq phk@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Sergey A. Osokin
+.Aq osa@FreeBSD.org
+and
+.An Poul-Henning Kamp
+.Aq phk@FreeBSD.org .
diff --git a/share/man/man4/lge.4 b/share/man/man4/lge.4
new file mode 100644
index 000000000000..89510f2c2146
--- /dev/null
+++ b/share/man/man4/lge.4
@@ -0,0 +1,157 @@
+.\" Copyright (c) 2001 Wind River Systems
+.\" Copyright (c) 1997, 1998, 1999, 2000, 2001
+.\" Bill Paul <william.paul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt LGE 4
+.Os
+.Sh NAME
+.Nm lge
+.Nd "Level 1 LXT1001 NetCellerator PCI Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device lge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_lge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs based on the Level 1 LXT1001
+NetCellerator Gigabit Ethernet controller chip.
+.Pp
+The LXT1001 supports fiber PHYs and also a GMII port for use with
+10/100/1000 copper PHYs, however there are currently no NICs on the
+market that use this feature.
+.Pp
+The LXT1001 supports TCP/IP checksum offload for receive and
+VLAN-based filtering as well as a 64-bit multicast hash filter.
+It also supports jumbo frames, which can be configured
+via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+Using jumbo frames can greatly improve performance for certain tasks,
+such as file transfers and data streaming.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 1000baseSX"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 1000baseSX
+Set 1000baseSX operation over fiber optic cable.
+Both
+.Cm full-duplex
+and
+.Cm half-duplex
+modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+SMC TigerCard 1000 (SMC9462SX)
+.It
+D-Link DGE-500SX
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "lge%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "lge%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "lge%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "lge%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "lge%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "lge%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "lge%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Rs
+.%T Level 1 LXT1001 Programming Manual
+.%U http://www.FreeBSD.org/~wpaul/Level1/LXT1001SRM.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq william.paul@windriver.com .
diff --git a/share/man/man4/lindev.4 b/share/man/man4/lindev.4
new file mode 100644
index 000000000000..ffc5e8310f97
--- /dev/null
+++ b/share/man/man4/lindev.4
@@ -0,0 +1,73 @@
+.\"-
+.\" Copyright (c) 2009 "Bjoern A. Zeeb" <bz@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 26, 2009
+.Dt LINDEV 4
+.Os
+.Sh NAME
+.Nm lindev
+.Nd Linux-specific pseudo devices support
+.Sh SYNOPSIS
+To compile this collection of linux-specific pseudo devices into the kernel,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device lindev"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time,
+place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+lindev_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+module provides a collection of linux-specific pseudo devices.
+.Sh DEVICES
+.Bl -tag -width /dev/full
+.It Pa /dev/full
+The
+.Xr full
+device always returns
+.Er ENOSPC
+on write attempts.
+For reads it emulates
+.Xr zero 4 .
+.El
+.Sh FILES
+.Bl -tag -width /dev/full
+.It Pa /dev/full
+.El
+.Sh SEE ALSO
+.Xr null 4 ,
+.Xr zero 4
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 8.1 .
diff --git a/share/man/man4/linux.4 b/share/man/man4/linux.4
new file mode 100644
index 000000000000..4fd95d10894d
--- /dev/null
+++ b/share/man/man4/linux.4
@@ -0,0 +1,145 @@
+.\" Copyright (c) 2000 Sheldon Hearn
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt LINUX 4
+.Os
+.Sh NAME
+.Nm linux
+.Nd Linux ABI support
+.Sh SYNOPSIS
+To compile support for this ABI into an i386 kernel
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options COMPAT_LINUX"
+.Ed
+.Pp
+for an amd64 kernel use:
+.Bd -ragged -offset indent
+.Cd "options COMPAT_LINUX32"
+.Ed
+.Pp
+Alternatively, to load the ABI as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+linux_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+module provides limited
+Linux ABI (application binary interface) compatibility
+for userland applications.
+The module provides the following significant facilities:
+.Bl -bullet
+.It
+An image activator
+for correctly branded
+.Xr elf 5
+executable images
+.It
+Special signal handling for activated images
+.It
+Linux to native system call translation
+.El
+.Pp
+It is important to note that the Linux ABI support
+it not provided through an emulator.
+Rather, a true (albeit limited) ABI implementation is provided.
+.Pp
+The following
+.Xr sysctl 8
+tunable variables are available:
+.Bl -tag -width compat.linux.oss_version
+.It compat.linux.osname
+Linux kernel operating system name.
+.It compat.linux.osrelease
+Linux kernel operating system release.
+Changing this to something else is discouraged on non-development systems,
+because it may change the way Linux programs work.
+Recent versions of GNU libc are known to use different syscalls depending
+on the value of this sysctl.
+.It compat.linux.oss_version
+Linux Open Sound System version.
+.El
+.Pp
+The
+.Nm
+module can be linked into the kernel statically with the
+.Dv COMPAT_LINUX
+kernel configuration option
+or loaded as required.
+The following command will load the module
+if it is neither linked into the kernel
+nor already loaded as a module:
+.Bd -literal -offset indent
+if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
+ kldload linux > /dev/null 2>&1
+fi
+.Ed
+.Pp
+Note that dynamically linked Linux executables
+will require a suitable environment in
+.Pa /compat/linux .
+Specifically, the Linux run-time linker's hints files
+should be correctly initialized.
+For this reason, it is common to execute the following commands
+to prepare the system to correctly run Linux executables:
+.Bd -literal -offset indent
+if [ -x /compat/linux/sbin/ldconfig ]; then
+ /compat/linux/sbin/ldconfig -r /compat/linux
+fi
+.Ed
+.Pp
+For information on loading the
+.Nm
+kernel loadable module automatically on system startup,
+see
+.Xr rc.conf 5 .
+This information applies
+regardless of whether the
+.Nm
+module is statically linked into the kernel
+or loaded as a module.
+.Sh FILES
+.Bl -tag -width /compat/linux/proc -compact
+.It Pa /compat/linux
+minimal Linux run-time environment
+.It Pa /compat/linux/proc
+limited Linux process file system
+.It Pa /compat/linux/sys
+limited Linux system file system
+.El
+.Sh SEE ALSO
+.Xr brandelf 1 ,
+.Xr elf 5 ,
+.Xr linprocfs 5 ,
+.Xr linsysfs 5
+.Sh HISTORY
+Linux ABI support first appeared in
+.Fx 2.1 .
diff --git a/share/man/man4/lmc.4 b/share/man/man4/lmc.4
new file mode 100644
index 000000000000..ee29aeeef9fb
--- /dev/null
+++ b/share/man/man4/lmc.4
@@ -0,0 +1,764 @@
+.\"
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 2002-2005 David Boggs. (boggs@boggs.palo-alto.ca.us)
+.\" All rights reserved.
+.\"
+.\" BSD License:
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" GNU General Public License:
+.\"
+.\" This program is free software; you can redistribute it and/or modify it
+.\" under the terms of the GNU General Public License as published by the Free
+.\" Software Foundation; either version 2 of the License, or (at your option)
+.\" any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but WITHOUT
+.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+.\" more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along with
+.\" this program; if not, write to the Free Software Foundation, Inc., 59
+.\" Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+.\"
+.Dd February 8, 2012
+.Dt LMC 4
+.Os
+.\"
+.Sh NAME
+.\"
+.Nm lmc
+.Nd device driver for
+.Tn LMC
+(now
+.Tn SBE )
+wide-area network interface cards
+.\"
+.Sh SYNOPSIS
+.\"
+To wire this driver into your kernel,
+add the following line to your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device lmc"
+.Ed
+.Pp
+Alternatively, to load this module at boot time, add
+.Bd -literal -offset indent
+if_lmc_load="YES"
+.Ed
+.Pp
+to
+.Pa /boot/loader.conf ;
+see
+.Xr loader.conf 5 .
+.Pp
+To wire a line protocol into your kernel, add:
+.Bd -ragged -offset indent
+.Cd "options NETGRAPH"
+.Cd "device sppp"
+.Ed
+.Pp
+It is not necessary to wire line protocols into your kernel,
+they can be loaded later with
+.Xr kldload 8 .
+The driver can send and receive raw IP packets even if neither
+SPPP nor Netgraph are configured into the kernel.
+Netgraph and SPPP can both be enabled; Netgraph will be used if the
+.Va rawdata
+hook is connected.
+.\"
+.Sh DESCRIPTION
+.\"
+This is an open-source
+.Ux
+device driver for PCI-bus WAN interface cards.
+It sends and receives packets in HDLC frames over synchronous circuits.
+A generic PC plus
+.Ux
+plus some
+.Tn LMC / SBE
+cards makes an
+.Em open
+router.
+This driver works with
+.Fx ,
+.Nx ,
+.Ox ,
+.Bsx
+and
+.Tn Linux
+OSs.
+It has been tested on i386 (SMP 32-bit little-endian) and Sparc (64-bit big-endian)
+architectures.
+.Pp
+The
+.Nm
+driver works with the following cards:
+.Bl -bullet
+.It
+SBE wanADAPT-HSSI (LMC5200)
+.Pp
+High Speed Serial Interface,
+EIA612/613, 50-pin connector,
+0 to 52 Mb/s, DTE only.
+.It
+SBE wanADAPT-T3 (LMC5245)
+.Pp
+T3: two 75-ohm BNC connectors,
+C-Parity or M13 Framing,
+44.736 Mb/s, up to 950 ft.
+.It
+SBE wanADAPT-SSI (LMC1000)
+.Pp
+Synchronous Serial Interface,
+V.35, X.21, EIA449, EIA530(A), EIA232,
+0 to 10 Mb/s, DTE or DCE.
+.It
+SBE wanADAPT-T1E1 (LMC1200)
+.Pp
+T1 or E1: RJ45 conn, 100 or 120 ohms,
+T1-ESF-B8ZS, T1-SF-AMI, E1-(many)-HDB3,
+1.544 Mb/s or 2.048 Mb/s, up to 6 Kft.
+.El
+.Pp
+Cards contain a high-performance
+.Sy "PCI"
+interface, an
+.Sy "HDLC"
+function and
+either integrated
+.Sy "modems"
+(T1, T3) or
+.Sy "modem"
+interfaces (HSSI and SSI).
+.Bl -tag -width "Modem"
+.It Sy "PCI"
+The PCI interface is a DEC 21140A "Tulip" Fast Ethernet chip.
+This chip has an efficient PCI implementation with scatter/gather DMA,
+and can run at 100 Mb/s full duplex (twice as fast as needed here).
+.It Sy "HDLC"
+The HDLC functions (ISO-3309: flags, bit-stuffing, CRC) are implemented
+in a Field Programmable Gate Array (FPGA) which talks to the Ethernet
+chip through a Media Independent Interface (MII).
+The hardware in the FPGA translates between Ethernet packets and
+HDLC frames on-the-fly; think it as a WAN PHY chip for Ethernet.
+.It Sy "Modem"
+The modem chips are the main differences between cards.
+HSSI cards use ECL10K chips to implement the EIA-612/613 interface.
+T3 cards use a TranSwitch TXC-03401 framer chip.
+SSI cards use Linear Technology LTC1343 modem interface chips.
+T1 cards use a BrookTree/Conexant/Mindspeed Bt8370 framer
+and line interface chip.
+.El
+.Pp
+Line protocols exist above device drivers and below internet protocols.
+They typically encapsulate packets in HDLC frames and deal with
+higher-level issues like protocol multiplexing and security.
+This driver is compatible with several line protocol packages:
+.Bl -tag -width "Generic HDLC"
+.It Sy "Netgraph"
+.Xr netgraph 4
+implements many basic packet-handling functions as kernel loadable modules.
+They can be interconnected in a graph to implement many protocols.
+Configuration is done from userland without rebuilding the kernel.
+Packets are sent and received through this interface if the driver's
+.Em rawdata
+hook is connected, otherwise the ifnet interface (SPPP and RawIP) is used.
+ASCII configuration control messages are
+.Em not
+currently supported.
+.It Sy "SPPP"
+.Xr sppp 4
+implements Synchronous-PPP, Frame-Relay and Cisco-HDLC in the kernel.
+.It Sy "RawIP"
+This null line protocol, built into the driver, sends and receives
+raw IPv4 and IPv6 packets in HDLC frames (aka IP-in-HDLC) with
+no extra bytes of overhead and no state at the end points.
+.El
+.\"
+.Sh EXAMPLES
+.\"
+.Ss "ifconfig and lmcconfig"
+.\"
+The program
+.Xr lmcconfig 8
+manipulates interface parameters beyond the scope of
+.Xr ifconfig 8 .
+In normal operation only a few arguments are needed:
+.Pp
+.Bl -tag -width ".Fl X" -offset indent -compact
+.It Fl X
+selects the external
+SPPP
+line protocol package.
+.It Fl x
+selects the built-in RawIP line protocol package.
+.It Fl Z
+selects PPP line protocol.
+.It Fl z
+selects Cisco-HDLC line protocol.
+.It Fl F
+selects Frame-Relay line protocol.
+.El
+.Bl -tag -width indent
+.It Li "lmcconfig lmc0"
+displays interface configuration and status.
+.It Li "lmcconfig lmc0 -D"
+enables debugging output from the device driver only.
+.It Li "ifconfig lmc0 debug"
+enables debugging output from the device driver and from
+the line protocol module above it.
+Debugging messages that appear on the console are also
+written to file
+.Pa "/var/log/messages" .
+.Em Caution :
+when things go very wrong, a torrent of debugging messages
+can swamp the console and bring a machine to its knees.
+.El
+.\"
+.Ss Operation
+.\"
+Activate a PPP link using SPPP and Netgraph with:
+.Bd -literal -offset indent
+ngctl mkpeer lmc0: sppp rawdata downstream
+ifconfig sppp0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+Activate a PPP link using only SPPP with:
+.Bd -literal -offset indent
+lmcconfig lmc0 -XYZ
+ifconfig lmc0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+Activate a Cisco-HDLC link using SPPP and Netgraph with:
+.Bd -literal -offset indent
+ngctl mkpeer lmc0: sppp rawdata downstream
+ifconfig sppp0 10.0.0.1 10.0.0.2 link2
+.Ed
+.Pp
+Activate a Cisco-HDLC link using only SPPP with:
+.Bd -literal -offset indent
+lmcconfig lmc0 -XYz
+ifconfig lmc0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+Activate a Cisco-HDLC link using only Netgraph with:
+.Bd -literal -offset indent
+ngctl mkpeer lmc0: cisco rawdata downstream
+ngctl mkpeer lmc0:rawdata iface inet inet
+ifconfig ng0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+Activate a Frame-Relay DTE link using SPPP with:
+.Bd -literal -offset indent
+lmcconfig lmc0 -XYF
+ifconfig lmc0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+(SPPP implements the ANSI T1.617 annex D LMI.)
+.Pp
+Activate a Frame-Relay DTE link using Netgraph with:
+.Bd -literal -offset indent
+ngctl mkpeer lmc0: frame_relay rawdata downstream
+ngctl mkpeer lmc0:rawdata lmi dlci0 auto0
+ngctl connect lmc0:rawdata dlci0 dlci1023 auto1023
+ngctl mkpeer lmc0:rawdata rfc1490 dlci500 downstream
+ngctl mkpeer lmc0:rawdata.dlci500 iface inet inet
+ifconfig ng0 10.0.0.1 10.0.0.2
+.Ed
+This is
+.Em ONE
+possible Frame Relay configuration; there are many.
+.Pp
+Activate a RAWIP link using only the driver with:
+.Bd -literal -offset indent
+lmcconfig lmc0 -x
+ifconfig lmc0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+Activate a RAWIP link using Netgraph with:
+.Bd -literal -offset indent
+ngctl mkpeer lmc0: iface rawdata inet
+ifconfig ng0 10.0.0.1 10.0.0.2
+.Ed
+.Pp
+If the driver is unloaded and then loaded, reconnect hooks by:
+.Pp
+.Dl "ngctl connect lmc0: ng0: rawdata inet"
+.\"
+.Sh TESTING
+.\"
+.Ss Testing with Loopbacks
+.\"
+Testing with loopbacks requires only one card.
+Packets can be looped back at many points: in the PCI chip,
+in the modem chips, through a loopback plug, in the
+local external equipment, or at the far end of a circuit.
+.Pp
+Activate the card with
+.Xr ifconfig 8 :
+.Pp
+.Dl "ifconfig lmc0 10.0.0.1 10.0.0.1"
+.Pp
+All cards can be looped through the PCI chip.
+Cards with internal modems can be looped through
+the modem framer and the modem line interface.
+Cards for external modems can be looped through
+the driver/receiver chips.
+See
+.Xr lmcconfig 8
+for details.
+.Pp
+Loopback plugs test everything on the card.
+.Bl -tag -width ".Sy T1/E1"
+.It Sy HSSI
+Loopback plugs can be ordered from SBE (and others).
+Transmit clock is normally supplied by the external modem.
+When an HSSI card is operated with a loopback plug, the PCI bus
+clock must be used as the transmit clock, typically 33 MHz.
+When testing an HSSI card with a loopback plug,
+configure it with
+.Xr lmcconfig 8 :
+.Pp
+.Dl "lmcconfig lmc0 -a 2"
+.Pp
+.Dq Fl a Li 2
+selects the PCI bus clock as the transmit clock.
+.It Sy T3
+Connect the two BNC jacks with a short coax cable.
+.It Sy SSI
+Loopback plugs can be ordered from SBE (only).
+Transmit clock is normally supplied by the external modem.
+When an SSI card is operated with a loopback plug,
+the on-board clock synthesizer must be used.
+When testing an SSI card with a loopback plug,
+configure it with
+.Xr lmcconfig 8 :
+.Pp
+.Dl "lmcconfig lmc0 -E -f 10000000"
+.Pp
+.Fl E
+puts the card in DCE mode to source a transmit clock.
+.Dq Fl f Li 10000000
+sets the internal clock source to 10 Mb/s.
+.It Sy T1/E1
+A loopback plug is a modular plug with two wires
+connecting pin 1 to pin 4 and pin 2 to pin 5.
+.El
+.Pp
+One can also test by connecting to a local modem (HSSI and SSI)
+or NI (T1 and T3) configured to loop back.
+Cards can generate signals to loopback remote equipment
+so that complete circuits can be tested; see
+.Xr lmcconfig 8
+for details.
+.\"
+.Ss Testing with a Modem
+.\"
+Testing with a modem requires two cards of different types.
+.Bl -tag -width ".Sy T3/HSSI"
+.It Sy T3/HSSI
+If you have a T3 modem with an HSSI interface
+(made by Digital Link, Larscom, Kentrox etc.\&)
+then use an HSSI card in one machine and a T3 card in the other machine.
+The T3 coax cables must use the null modem configuration (see below).
+.It Sy T1/V.35
+If you have a T1 (or E1) modem with a V.35, X.21 or EIA530 interface,
+then use an SSI card in one machine and a T1 card in the other machine.
+Use a T1 null modem cable (see below).
+.El
+.\"
+.Ss Testing with a Null Modem Cable
+.\"
+Testing with a null modem cable requires two cards of the same type.
+.Bl -tag -width ".Sy T1/E1"
+.It Sy HSSI
+Three-meter HSSI null-modem cables can be ordered from SBE.
+In a pinch, a 50-pin SCSI-II cable up to a few meters will
+work as a straight HSSI cable (not a null modem cable).
+Longer cables should be purpose-built HSSI cables because
+the cable impedance is different.
+Transmit clock is normally supplied by the external modem.
+When an HSSI card is connected by a null modem cable, the PCI bus
+clock can be used as the transmit clock, typically 33 MHz.
+When testing an HSSI card with a null modem cable, configure it
+with
+.Xr lmcconfig 8 :
+.Pp
+.Dl "lmcconfig lmc0 -a 2"
+.Pp
+.Dq Fl a Li 2
+selects the PCI bus clock as the transmit clock.
+.It Sy T3
+T3 null modem cables are just 75-ohm coax cables with BNC connectors.
+TX OUT on one card should be connected to RX IN on the other card.
+In a pinch, 50-ohm thin Ethernet cables
+.Em usually
+work up to a few meters, but they will
+.Em not
+work for longer runs \[em] 75-ohm coax is
+.Em required .
+.It Sy SSI
+Three-meter SSI null modem cables can be ordered from SBE.
+An SSI null modem cable reports a cable type of V.36/EIA449.
+Transmit clock is normally supplied by the external modem.
+When an SSI card is connected by a null modem cable,
+an on-board clock synthesizer is used.
+When testing an SSI card with a null modem cable, configure it
+with
+.Xr lmcconfig 8 :
+.Pp
+.Dl "lmcconfig lmc0 -E -f 10000000"
+.Pp
+.Fl E
+puts the card in DCE mode to source a transmit clock.
+.Dq Fl f Li 10000000
+sets the internal clock source to 10 Mb/s.
+.It Sy T1/E1
+A T1 null modem cable has two twisted pairs that connect
+pins 1 and 2 on one plug to pins 4 and 5 on the other plug.
+Looking into the cable entry hole of a plug,
+with the locking tab oriented down,
+pin 1 is on the left.
+A twisted pair Ethernet cable makes an excellent straight T1 cable.
+Alas, Ethernet cross-over cables do not work as T1 null modem cables.
+.El
+.\"
+.Sh OPERATION NOTES
+.\"
+.Ss Packet Lengths
+Maximum transmit and receive packet length is unlimited.
+Minimum transmit and receive packet length is one byte.
+.Pp
+Cleaning up after one packet and setting up for the next
+packet involves making several DMA references.
+This can take longer than the duration of a short packet,
+causing the adapter to fall behind.
+For typical PCI bus traffic levels and memory system latencies,
+back-to-back packets longer than about 20 bytes will always
+work (53 byte cells work), but a burst of several hundred
+back-to-back packets shorter than 20 bytes will cause packets
+to be dropped.
+This usually is not a problem since an IPv4 packet header is
+at least 20 bytes long.
+.Pp
+This device driver imposes no constraints on packet size.
+Most operating systems set the default Maximum Transmission
+Unit (MTU) to 1500 bytes; the legal range is usually (72..65535).
+This can be changed with
+.Pp
+.Dl "ifconfig lmc0 mtu 2000"
+.Pp
+SPPP enforces an MTU of (128..far-end-MRU) for PPP
+and 1500 bytes for Cisco-HDLC.
+RAWIP sets the default MTU to 4032 bytes,
+but it can be changed to anything.
+.\"
+.Ss BPF - Berkeley Packet Filter
+.\"
+This driver has hooks for
+.Xr bpf 4 ,
+the Berkeley Packet Filter.
+The line protocol header length reported to BPF is four bytes
+for SPPP and P2P line protocols and zero bytes for RawIP.
+.Pp
+To include BPF support into your kernel,
+add the following line to
+.Pa conf/YOURKERNEL :
+.Pp
+.Dl "device bpf"
+.Pp
+To test the BPF kernel interface,
+bring up a link between two machines, then run
+.Xr ping 8
+and
+.Xr tcpdump 1 :
+.Pp
+.Dl "ping 10.0.0.1"
+.Pp
+and in a different window:
+.Pp
+.Dl "tcpdump -i lmc0"
+.Pp
+The output from
+.Xr tcpdump 1
+should look like this:
+.Bd -literal -offset indent
+03:54:35.979965 10.0.0.2 > 10.0.0.1: icmp: echo request
+03:54:35.981423 10.0.0.1 > 10.0.0.2: icmp: echo reply
+.Ed
+.Pp
+Line protocol control packets will appear among the
+.Xr ping 8
+packets occasionally.
+.\"
+.Ss Device Polling
+.\"
+A T3 receiver can generate over 100K interrupts per second,
+this can cause a system to
+.Dq live-lock :
+spend all of its
+time servicing interrupts.
+.Fx
+has a polling mechanism to prevent live-lock.
+.Pp
+.Fx Ns 's
+mechanism permanently disables interrupts from the card
+and instead the card's interrupt service routine is called each
+time the kernel is entered (syscall, timer interrupt, etc.\&) and
+from the kernel idle loop; this adds some latency.
+The driver is permitted to process a limited number of packets.
+The percentage of the CPU that can be consumed this way is settable.
+.Pp
+See the
+.Xr polling 4
+manpage for details on how to enable the polling mode.
+.\"
+.Ss SNMP: Simple Network Management Protocol
+.\"
+This driver is aware of what is required to be a Network Interface
+Object managed by an Agent of the Simple Network Management Protocol.
+The driver exports SNMP-formatted configuration and status
+information sufficient for an SNMP Agent to create MIBs for:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.%T "RFC-2233: Interfaces group" ,
+.It
+.%T "RFC-2496: DS3 interfaces" ,
+.It
+.%T "RFC-2495: DS1/E1 interfaces" ,
+.It
+.%T "RFC-1659: RS232-like interfaces" .
+.El
+.Pp
+An SNMP Agent is a user program, not a kernel function.
+Agents can retrieve configuration and status information
+by using
+Netgraph control messages or
+.Xr ioctl 2
+system calls.
+User programs should poll
+.Va sc->cfg.ticks
+which increments once per second after the SNMP state has been updated.
+.\"
+.Ss HSSI and SSI LEDs
+.\"
+The card should be operational if all three green LEDs are on
+(the upper-left one should be blinking) and the red LED is off.
+All four LEDs turn on at power-on and module unload.
+.Pp
+.Bl -column -compact -offset indent "YELLOW" "upper-right" "Software"
+.It "RED" Ta "upper-right" Ta "No Transmit clock"
+.It "GREEN" Ta "upper-left" Ta "Device driver is alive if blinking"
+.It "GREEN" Ta "lower-right" Ta "Modem signals are good"
+.It "GREEN" Ta "lower-left" Ta "Cable is plugged in (SSI only)"
+.El
+.\"
+.Ss T1E1 and T3 LEDs
+.\"
+The card should be operational if the upper-left green LED is blinking
+and all other LEDs are off.
+For the T3 card, if other LEDs are on or
+blinking, try swapping the coax cables!
+All four LEDs turn on at power-on and module unload.
+.Pp
+.Bl -column -compact -offset indent "YELLOW" "upper-right" "Received"
+.It "RED" Ta "upper-right" Ta "Received signal is wrong"
+.It "GREEN" Ta "upper-left" Ta "Device driver is alive if blinking"
+.It "BLUE" Ta "lower-right" Ta "Alarm Information Signal (AIS)"
+.It "YELLOW" Ta "lower-left" Ta "Remote Alarm Indication (RAI)"
+.El \" YELLOW
+.Pp
+.Bl -column -compact "The yellow" "LED"
+.It "The green" Ta "LED blinks if the device driver is alive."
+.It "The red" Ta "LED blinks if an outward loopback is active."
+.It "The blue" Ta "LED blinks if sending AIS, on solid if receiving AIS."
+.It "The yellow" Ta "LED blinks if sending RAI, on solid if receiving RAI."
+.El \" LED
+.\"
+.Ss E1 Framing
+.\"
+Phone companies usually insist that customers put a
+.Em Frame Alignment Signal
+(FAS) in time slot 0.
+A Cyclic Redundancy Checksum (CRC) can also ride in time slot 0.
+.Em Channel Associated Signalling
+(CAS) uses Time Slot 16.
+In telco-speak
+.Em signalling
+is on/off hook, ringing, busy, etc.
+Signalling is not needed here and consumes 64 Kb/s.
+Only use E1-CAS formats if the other end insists on it!
+Use E1-FAS+CRC framing format on a public circuit.
+Depending on the equipment installed in a private circuit,
+it may be possible to use all 32 time slots for data (E1-NONE).
+.\"
+.Ss T3 Framing
+.\"
+M13 is a technique for multiplexing 28 T1s into a T3.
+Muxes use the C-bits for speed-matching the tributaries.
+Muxing is not needed here and usurps the FEBE and FEAC bits.
+Only use T3-M13 format if the other end insists on it!
+Use T3-CParity framing format if possible.
+Loop Timing, Fractional T3, and HDLC packets in
+the Facility Data Link are
+.Em not
+supported.
+.\"
+.Ss T1 & T3 Frame Overhead Functions
+.\"
+.Bl -item -compact
+.It
+Performance Report Messages (PRMs) are enabled in T1-ESF.
+.It
+Bit Oriented Protocol (BOP) messages are enabled in T1-ESF.
+.It
+In-band loopback control (framed or not) is enabled in T1-SF.
+.It
+Far End Alarm and Control (FEAC) msgs are enabled in T3-CPar.
+.It
+Far End Block Error (FEBE) reports are enabled in T3-CPar.
+.It
+Remote Alarm Indication (RAI) is enabled in T3-Any.
+.It
+Loopbacks initiated remotely time out after 300 seconds.
+.El
+.\"
+.Ss T1/E1 'Fractional' 64 kb/s Time Slots
+.\"
+T1 uses time slots 24..1; E1 uses time slots 31..0.
+E1 uses TS0 for FAS overhead and TS16 for CAS overhead.
+E1-NONE has
+.Em no
+overhead, so all 32 TSs are available for data.
+Enable/disable time slots by setting 32 1s/0s in a config param.
+Enabling an E1 overhead time slot,
+or enabling TS0 or TS25-TS31 for T1,
+is ignored by the driver, which knows better.
+The default TS param, 0xFFFFFFFF, enables the maximum number
+of time slots for whatever frame format is selected.
+56 Kb/s time slots are
+.Em not
+supported.
+.\"
+.Ss T1 Raw Mode
+.\"
+Special gate array microcode exists for the T1/E1 card.
+Each T1 frame of 24 bytes is treated as a packet.
+A raw T1 byte stream can be delivered to main memory
+and transmitted from main memory.
+The T1 card adds or deletes framing bits but does not
+touch the data.
+ATM cells can be transmitted and received this way, with
+the software doing all the work.
+But that is not hard; after all it is only 1.5 Mb/s second!
+.\"
+.Ss T3 Circuit Emulation Mode
+.\"
+Special gate array microcode exists for the T3 card.
+Each T3 frame of 595 bytes is treated as a packet.
+A raw T3 signal can be
+.Em packetized ,
+transported through a
+packet network (using some protocol) and then
+.Em reconstituted
+as a T3 signal at the far end.
+The output transmitter's
+bit rate can be controlled from software so that it can be
+.Em frequency locked
+to the distant input signal.
+.\"
+.Ss HSSI and SSI Transmit Clocks
+.\"
+Synchronous interfaces use two transmit clocks to eliminate
+.Em skew
+caused by speed-of-light delays in the modem cable.
+DCEs (modems) drive ST, Send Timing, the first transmit clock.
+DTEs (hosts) receive ST and use it to clock transmit data, TD,
+onto the modem cable.
+DTEs also drive a copy of ST back towards the DCE and call it TT,
+Transmit Timing, the second transmit clock.
+DCEs receive TT and TD and use TT to clock TD into a flip flop.
+TT experiences the same delay as (and has no
+.Em skew
+relative to) TD.
+Thus, cable length does not affect data/clock timing.
+.\"
+.Sh SEE ALSO
+.\"
+.Xr tcpdump 1 ,
+.Xr ioctl 2 ,
+.Xr bpf 4 ,
+.Xr kld 4 ,
+.Xr netgraph 4 ,
+.Xr polling 4 ,
+.Xr sppp 4 ,
+.Xr loader.conf 5 ,
+.Xr ifconfig 8 ,
+.Xr lmcconfig 8 ,
+.Xr mpd 8 Pq Pa ports/net/mpd ,
+.Xr ngctl 8 ,
+.Xr ping 8 ,
+.Xr ifnet 9
+.\"
+.Sh HISTORY
+.\"
+.An Ron Crane
+had the idea to use a Fast Ethernet chip as a PCI interface
+and add an Ethernet-to-HDLC gate array to make a WAN card.
+.An David Boggs
+designed the Ethernet-to-HDLC gate array and PC cards.
+We did this at our company, LAN Media Corporation
+.Tn (LMC) .
+.Tn SBE
+Corp.\& acquired
+.Tn LMC
+and continues to make the cards.
+.Pp
+Since the cards use Tulip Ethernet chips, we started with
+.An Matt Thomas Ns '
+ubiquitous
+.Xr de 4
+driver.
+.An Michael Graff
+stripped out the Ethernet stuff and added HSSI stuff.
+.An Basil Gunn
+ported it to
+.Tn Solaris
+(lost) and
+.Tn Rob Braun
+ported it to
+.Tn Linux .
+.An Andrew Stanley-Jones
+added support
+for three more cards and wrote the first version of
+.Xr lmcconfig 8 .
+.An David Boggs
+rewrote everything and now feels responsible for it.
+.\"
+.Sh AUTHORS
+.\"
+.An "David Boggs" Aq boggs@boggs.palo-alto.ca.us
diff --git a/share/man/man4/lo.4 b/share/man/man4/lo.4
new file mode 100644
index 000000000000..1a55b0ce97d5
--- /dev/null
+++ b/share/man/man4/lo.4
@@ -0,0 +1,90 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California.
+.\" Copyright (c) 2009 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)lo.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd January 25, 2012
+.Dt LO 4
+.Os
+.Sh NAME
+.Nm lo
+.Nd software loopback network interface
+.Sh SYNOPSIS
+.Cd "device loop"
+.Sh DESCRIPTION
+The
+.Nm loop
+interface is a software loopback mechanism which may be
+used for performance analysis, software testing, and/or local
+communication.
+As with other network interfaces, the loopback interface must have
+network addresses assigned for each address family with which it is to be used.
+These addresses
+may be set with the appropriate
+.Xr ioctl 2
+commands for corresponding address families.
+The loopback interface should be the last interface configured,
+as protocols may use the order of configuration as an indication of priority.
+The loopback should
+.Em never
+be configured first unless no hardware
+interfaces exist.
+.Pp
+If the transmit checksum offload capability flag is enabled on a loopback
+interface, checksums will not be generated by IP, UDP, or TCP for packets
+sent on the interface.
+.Pp
+If the receive checksum offload capability flag is enabled on a loopback
+interface, checksums will not be validated by IP, UDP, or TCP for packets
+received on the interface.
+.Pp
+By default, both receive and transmit checksum flags will be enabled, in
+order to avoid the overhead of checksumming for local communication where
+data corruption is unlikely.
+If transmit checksum generation is disabled, then validation should also be
+disabled in order to avoid packets being dropped due to invalid checksums.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It lo%d: can't handle af%d.
+The interface was handed
+a message with addresses formatted in an unsuitable address
+family; the packet was dropped.
+.El
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr intro 4
+.\" .Xr ns 4
+.Sh HISTORY
+The
+.Nm
+device appeared in
+.Bx 4.2 .
+The current checksum generation and validation avoidance policy appeared in
+.Fx 8.0 .
diff --git a/share/man/man4/lp.4 b/share/man/man4/lp.4
new file mode 100644
index 000000000000..f5b628e6ff0d
--- /dev/null
+++ b/share/man/man4/lp.4
@@ -0,0 +1,245 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 A.R.Gordon, andrew.gordon@net-tel.co.uk
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Id: man4.i386/lp.4,v 1.9 1999/02/14 12:06:16 nsouch Exp
+.\" $FreeBSD$
+.\"
+.Dd March 4, 1996
+.Dt LP 4
+.Os
+.Sh NAME
+.Nm lp
+.Nd printer port Internet Protocol driver
+.Sh SYNOPSIS
+.Nm ifconfig
+.Ar plip0
+.Ar myaddress hisaddress
+.Op Fl link0
+.Pp
+.Cd "device ppbus"
+.Cd "device plip"
+.Cd "device ppc"
+.Sh DESCRIPTION
+The
+.Nm
+driver allows a PC parallel printer port to be used as a
+point-to-point network interface between two similarly configured systems.
+Data is transferred 4 bits at a time, using the printer status lines for
+input: hence there is no requirement for special bidirectional hardware
+and any standard AT-compatible printer port with working interrupts may be used.
+.Pp
+During the boot process, for each
+.Nm plip
+device which is probed and has an interrupt assigned, a corresponding
+.Nm network
+device is created.
+.Pp
+Configuring an
+.Nm
+device with
+.Xr ifconfig 8
+causes the corresponding
+.Nm parallel port bus
+to be reserved for PLIP until the network interface is configured 'down'.
+.Pp
+The communication protocol is selected by the
+.Cm link0
+flag:
+.Bl -tag -width Fl
+.It Fl link0
+(default) Use
+.Fx
+mode (LPIP).
+This is the simpler of the two modes
+and therefore slightly more efficient.
+.It Cm link0
+Use Crynwr/Linux compatible mode (CLPIP).
+This mode has a simulated Ethernet
+packet header, and is easier to interface to other types of equipment.
+.El
+.Pp
+The interface MTU defaults to 1500, but may be set to any value.
+Both ends
+of the link must be configured with the same MTU.
+.Ss Cable Connections
+The cable connecting the two parallel ports should be wired as follows:
+.Bd -literal
+ Pin Pin Description
+ 2 15 Data0 -> ERROR*
+ 3 13 Data1 -> SLCT
+ 4 12 Data2 -> PE
+ 5 10 Data3 -> ACK*
+ 6 11 Data4 -> BUSY
+ 15 2 ERROR* -> Data0
+ 13 3 SLCT -> Data1
+ 12 4 PE -> Data2
+ 10 5 ACK* -> Data3
+ 11 6 BUSY -> Data4
+ 18-25 18-25 Ground
+.Ed
+.Pp
+Cables with this wiring are widely available as 'Laplink' cables, and
+are often coloured yellow.
+.Pp
+The connections are symmetric, and provide 5 lines in each direction (four
+data plus one handshake).
+The two modes use the same wiring, but make a
+different choice of which line to use as handshake.
+.Ss FreeBSD LPIP mode
+The signal lines are used as follows:
+.Bl -tag -width dataxxxx(Pinxx)
+.It Em Data0 (Pin 2)
+Data out, bit 0.
+.It Em Data1 (Pin 3)
+Data out, bit 1.
+.It Em Data2 (Pin 4)
+Data out, bit 2.
+.It Em Data3 (Pin 5)
+Handshake out.
+.It Em Data4 (Pin 6)
+Data out, bit 3.
+.It Em ERROR* (pin 15)
+Data in, bit 0.
+.It Em SLCT (pin 13)
+Data in, bit 1.
+.It Em PE (pin 12)
+Data in, bit 2.
+.It Em BUSY (pin 11)
+Data in, bit 3.
+.It Em ACK* (pin 10)
+Handshake in.
+.El
+.Pp
+When idle, all data lines are at zero.
+Each byte is signalled in four steps:
+sender writes the 4 most significant bits and raises the handshake line;
+receiver reads the 4 bits and raises its handshake to acknowledge;
+sender places the 4 least significant bits on the data lines and lowers
+the handshake; receiver reads the data and lowers its handshake.
+.Pp
+The packet format has a two-byte header, comprising the fixed values 0x08,
+0x00, immediately followed by the IP header and data.
+.Pp
+The start of a packet is indicated by simply signalling the first byte
+of the header.
+The end of the packet is indicated by inverting
+the data lines (i.e., writing the ones-complement of the previous nibble
+to be transmitted) without changing the state of the handshake.
+.Pp
+Note that the end-of-packet marker assumes that the handshake signal and
+the data-out bits can be written in a single instruction - otherwise
+certain byte values in the packet data would falsely be interpreted
+as end-of-packet.
+This is not a problem for the PC printer port,
+but requires care when implementing this protocol on other equipment.
+.Ss Crynwr/Linux CLPIP mode
+The signal lines are used as follows:
+.Bl -tag -width dataxxxx(Pinxx)
+.It Em Data0 (Pin 2)
+Data out, bit 0.
+.It Em Data1 (Pin 3)
+Data out, bit 1.
+.It Em Data2 (Pin 4)
+Data out, bit 2.
+.It Em Data3 (Pin 5)
+Data out, bit 3.
+.It Em Data4 (Pin 6)
+Handshake out.
+.It Em ERROR* (pin 15)
+Data in, bit 0.
+.It Em SLCT (pin 13)
+Data in, bit 1.
+.It Em PE (pin 12)
+Data in, bit 2.
+.It Em ACK* (pin 10)
+Data in, bit 3.
+.It Em BUSY (pin 11)
+Handshake in.
+.El
+.Pp
+When idle, all data lines are at zero.
+Each byte is signalled in four steps:
+sender writes the 4 least significant bits and raises the handshake line;
+receiver reads the 4 bits and raises its handshake to acknowledge;
+sender places the 4 most significant bits on the data lines and lowers
+the handshake; receiver reads the data and lowers its handshake.
+[Note that this is the opposite nibble order to LPIP mode].
+.Pp
+Packet format is:
+.Bd -literal
+Length (least significant byte)
+Length (most significant byte)
+12 bytes of supposed MAC addresses (ignored by FreeBSD).
+Fixed byte 0x08
+Fixed byte 0x00
+<IP datagram>
+Checksum byte.
+.Ed
+.Pp
+The length includes the 14 header bytes, but not the length bytes themselves
+nor the checksum byte.
+.Pp
+The checksum is a simple arithmetic sum of all the bytes (again, including
+the header but not checksum or length bytes).
+.Fx
+calculates
+outgoing checksums, but does not validate incoming ones.
+.Pp
+The start of packet has to be signalled specially, since the line chosen
+for handshake-in cannot be used to generate an interrupt.
+The sender writes the value 0x08 to the data lines, and waits for the receiver
+to respond by writing 0x01 to its data lines.
+The sender then starts
+signalling the first byte of the packet (the length byte).
+.Pp
+End of packet is deduced from the packet length and is not signalled
+specially (although the data lines are restored to the zero, idle
+state to avoid spuriously indicating the start of the next packet).
+.Sh SEE ALSO
+.Xr ppbus 4 ,
+.Xr ppc 4 ,
+.Xr ifconfig 8
+.Sh BUGS
+Busy-waiting loops are used while handshaking bytes, (and worse still when
+waiting for the receiving system to respond to an interrupt for the start
+of a packet).
+Hence a fast system talking to a slow one will consume
+excessive amounts of CPU.
+This is unavoidable in the case of CLPIP mode
+due to the choice of handshake lines; it could theoretically be improved
+in the case of LPIP mode.
+.Pp
+Polling timeouts are controlled by counting loop iterations rather than
+timers, and so are dependent on CPU speed.
+This is somewhat stabilised
+by the need to perform (slow) ISA bus cycles to actually read the port.
diff --git a/share/man/man4/lpbb.4 b/share/man/man4/lpbb.4
new file mode 100644
index 000000000000..89b2a07a2e77
--- /dev/null
+++ b/share/man/man4/lpbb.4
@@ -0,0 +1,79 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 25, 1998
+.Dt LPBB 4
+.Os
+.Sh NAME
+.Nm lpbb
+.Nd parallel port I2C bit-banging interface
+.Sh SYNOPSIS
+.Cd "device iicbus"
+.Cd "device iicbb"
+.Pp
+.Cd "device lpbb"
+.Cd "device iic"
+.Sh DESCRIPTION
+The
+.Em lpbb
+driver supports the Philips official I2C parallel bit-banging interface.
+.Bd -literal
+
+ LS05 pin 14 (Vcc) o -------
+ | | |
+ +--+--+---------------------+--+--+------------+------+-o 1 |
+ | | | | | | ===.1uF | +5V |
+ -------- [R][R][R] 3x10K 3x10K [R][R][R] LS05 | | |
+ | | | | | | | | pin 7 o-+------+-o 2 |
+ | 12 o-+--+ | | 3|\\ 4 | | | (Gnd) | GND |
+ | 17 o-+-----|--|----| >o-------------+--|--|--------------+ | |
+ | | | | |/ 8 /|9 | | 10 /|11 +----+-o 3 |
+ | 15 o-+-----+--|--------------o< |------+--|------o< |----+ | SCL |
+ | | | 1|\\ 2 \\| | \\| | |
+ | 9 o-+--------|----| >o-------------------+--------------+----+-o 4 |
+ | | | |/ 6 /|5 | | SDA |
+ | 11 o-+--------+----------------------------------o< |----+ -------
+ | 10 o-+-+ \\| 4-pin
+ | 13 o-+-+--oGND Connector
+ | 25 o-+-+ ------------------ Part List --------------------------
+ -------- | 1 - .1 uF capacitor | 6 - 10K 5% resistors |
+ 25-pin male D | 1 - 4-pin connector | 1 - 25-pin male D connector |
+ connector to PC | 1 - 74LS05 open collector hex inverter |
+ printer port -------------------------------------------------------
+.Ed
+.Sh SEE ALSO
+.Xr iicbb 4 ,
+.Xr iicbus 4 ,
+.Xr ppbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/lpt.4 b/share/man/man4/lpt.4
new file mode 100644
index 000000000000..8b3dd578fa3c
--- /dev/null
+++ b/share/man/man4/lpt.4
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright (c) 1993 Christopher G. Demetriou
+.\" Copyright (c) 1994 Geoffrey M. Rehmet
+.\" Copyright (c) 1999 Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 14, 1999
+.Dt LPT 4
+.Os
+.Sh NAME
+.Nm lpt
+.Nd generic printer device driver
+.Sh SYNOPSIS
+.Cd "device ppc"
+.Cd "device ppbus"
+.Cd "device lpt"
+.Sh DESCRIPTION
+The current
+.Em lpt
+driver is the port of the original lpt driver to the
+.Xr ppbus 4
+system.
+.Pp
+One purpose of this port was to allow parallel port sharing with other
+parallel devices.
+Secondly, inb()/outb() calls have been replaced by ppbus
+function calls.
+lpt is now arch-independent thanks to the ppbus interface.
+See
+.Xr ppbus 4
+for more info about the ppbus system.
+.Pp
+The parallel port bus is allocated by lpt when the printer device is opened
+and released only when the transfer is completed: either when the device
+is closed or when the entire buffer is sent in interrupt driven mode.
+.Pp
+The driver can be configured to be either interrupt-driven, or
+to poll the printer.
+Ports that are configured to be
+interrupt-driven can be switched to polled mode by using the
+.Xr lptcontrol 8
+command.
+.Pp
+Depending on your hardware, extended capabilities may be configured with the
+.Xr lptcontrol 8
+command.
+With an ECP/ISA port, you can take advantage
+of FIFO and DMA.
+.Pp
+In order to retrieve printer info from /dev/lpt0, just apply the
+.Nm cat
+command to the device.
+If the printer supports IEEE1284 nibble mode and has
+data to send to the host, you will get it.
+.Sh FILES
+.Bl -tag -width Pa -compact
+.It Pa /dev/lpt0
+first parallel port driver
+.El
+.Sh SEE ALSO
+.Xr ppbus 4 ,
+.Xr ppc 4 ,
+.Xr lptcontrol 8
+.Sh HISTORY
+This driver replaces the functionality of the lpa
+driver, which is now defunct.
+.Sh BUGS
+There are lots of them, especially in cheap parallel port implementations.
+.Pp
+It is only possible to open a lpt port when a printer is connected and
+on-line, making it impossible to run
+.Xr lptcontrol 8
+when there is no printer connected.
+.Pp
+This driver could still stand a rewrite.
diff --git a/share/man/man4/mac.4 b/share/man/man4/mac.4
new file mode 100644
index 000000000000..b1ff1d951d8e
--- /dev/null
+++ b/share/man/man4/mac.4
@@ -0,0 +1,254 @@
+.\" Copyright (c) 2003 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Labs, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 30, 2007
+.Dt MAC 4
+.Os
+.Sh NAME
+.Nm mac
+.Nd Mandatory Access Control
+.Sh SYNOPSIS
+.Cd "options MAC"
+.Sh DESCRIPTION
+.Ss Introduction
+The Mandatory Access Control, or MAC, framework allows administrators to
+finely control system security by providing for a loadable security policy
+architecture.
+It is important to note that due to its nature, MAC security policies may
+only restrict access relative to one another and the base system policy;
+they cannot override traditional
+.Ux
+security provisions such as file permissions and superuser checks.
+.Pp
+Currently, the following MAC policy modules are shipped with
+.Fx :
+.Bl -column ".Xr mac_seeotheruids 4" "low-watermark mac policy" ".Em Labeling" "boot only"
+.It Sy Name Ta Sy Description Ta Sy Labeling Ta Sy "Load time"
+.It Xr mac_biba 4 Ta "Biba integrity policy" Ta yes Ta boot only
+.It Xr mac_bsdextended 4 Ta "File system firewall" Ta no Ta any time
+.It Xr mac_ifoff 4 Ta "Interface silencing" Ta no Ta any time
+.It Xr mac_lomac 4 Ta "Low-Watermark MAC policy" Ta yes Ta boot only
+.It Xr mac_mls 4 Ta "Confidentiality policy" Ta yes Ta boot only
+.It Xr mac_none 4 Ta "Sample no-op policy" Ta no Ta any time
+.It Xr mac_partition 4 Ta "Process partition policy" Ta yes Ta any time
+.It Xr mac_portacl 4 Ta "Port bind(2) access control" Ta no Ta any time
+.It Xr mac_seeotheruids 4 Ta "See-other-UIDs policy" Ta no Ta any time
+.It Xr mac_test 4 Ta "MAC testing policy" Ta no Ta any time
+.El
+.Ss MAC Labels
+Each system subject (processes, sockets, etc.) and each system object
+(file system objects, sockets, etc.) can carry with it a MAC label.
+MAC labels contain data in an arbitrary format
+taken into consideration in making access control decisions
+for a given operation.
+Most MAC labels on system subjects and objects
+can be modified directly or indirectly by the system
+administrator.
+The format for a given policy's label may vary depending on the type
+of object or subject being labeled.
+More information on the format for MAC labels can be found in the
+.Xr maclabel 7
+man page.
+.Ss MAC Support for UFS2 File Systems
+By default, file system enforcement of labeled MAC policies relies on
+a single file system label
+(see
+.Sx "MAC Labels" )
+in order to make access control decisions for all the files in a particular
+file system.
+With some policies, this configuration may not allow administrators to take
+full advantage of features.
+In order to enable support for labeling files on an individual basis
+for a particular file system,
+the
+.Dq multilabel
+flag must be enabled on the file system.
+To set the
+.Dq multilabel
+flag, drop to single-user mode and unmount the file system,
+then execute the following command:
+.Pp
+.Dl "tunefs -l enable" Ar filesystem
+.Pp
+where
+.Ar filesystem
+is either the mount point
+(in
+.Xr fstab 5 )
+or the special file
+(in
+.Pa /dev )
+corresponding to the file system on which to enable multilabel support.
+.Ss Policy Enforcement
+Policy enforcement is divided into the following areas of the system:
+.Bl -ohang
+.It Sy "File System"
+File system mounts, modifying directories, modifying files, etc.
+.It Sy KLD
+Loading, unloading, and retrieving statistics on loaded kernel modules
+.It Sy Network
+Network interfaces,
+.Xr bpf 4 ,
+packet delivery and transmission,
+interface configuration
+.Xr ( ioctl 2 ,
+.Xr ifconfig 8 )
+.It Sy Pipes
+Creation of and operation on
+.Xr pipe 2
+objects
+.It Sy Processes
+Debugging
+(e.g.\&
+.Xr ktrace 2 ) ,
+process visibility
+.Pq Xr ps 1 ,
+process execution
+.Pq Xr execve 2 ,
+signalling
+.Pq Xr kill 2
+.It Sy Sockets
+Creation of and operation on
+.Xr socket 2
+objects
+.It Sy System
+Kernel environment
+.Pq Xr kenv 1 ,
+system accounting
+.Pq Xr acct 2 ,
+.Xr reboot 2 ,
+.Xr settimeofday 2 ,
+.Xr swapon 2 ,
+.Xr sysctl 3 ,
+.Xr nfsd 8 Ns
+-related operations
+.It Sy VM
+.Xr mmap 2 Ns
+-ed files
+.El
+.Ss Setting MAC Labels
+From the command line, each type of system object has its own means for setting
+and modifying its MAC policy label.
+.Bl -column "user (by login class)" "Xr setfmac 8 , Xr setfsmac 8" -offset indent
+.It Sy "Subject/Object" Ta Sy "Utility"
+.It "File system object" Ta Xr setfmac 8 , Xr setfsmac 8
+.It "Network interface" Ta Xr ifconfig 8
+.It "TTY (by login class)" Ta Xr login.conf 5
+.It "User (by login class)" Ta Xr login.conf 5
+.El
+.Pp
+Additionally, the
+.Xr su 1
+and
+.Xr setpmac 8
+utilities can be used to run a command with a different process label than
+the shell's current label.
+.Ss Programming With MAC
+MAC security enforcement itself is transparent to application
+programs, with the exception that some programs may need to be aware of
+additional
+.Xr errno 2
+returns from various system calls.
+.Pp
+The interface for retrieving, handling, and setting policy labels
+is documented in the
+.Xr mac 3
+man page.
+.\" *** XXX ***
+.\" Support for this feature is poor and should not be encouraged.
+.\"
+.\" .It Va security.mac.mmap_revocation
+.\" Revoke
+.\" .Xr mmap 2
+.\" access to files on subject relabel.
+.\" .It Va security.mac.mmap_revocation_via_cow
+.\" Revoke
+.\" .Xr mmap 2
+.\" access to files via copy-on-write semantics;
+.\" mapped regions will still appear writable, but will no longer
+.\" effect a change on the underlying vnode.
+.\" (Default: 0).
+.Sh SEE ALSO
+.Xr mac 3 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr login.conf 5 ,
+.Xr maclabel 7 ,
+.Xr getfmac 8 ,
+.Xr getpmac 8 ,
+.Xr setfmac 8 ,
+.Xr setpmac 8 ,
+.Xr mac 9
+.Rs
+.%B "The FreeBSD Handbook"
+.%T "Mandatory Access Control"
+.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/mac.html
+.Re
+.Sh HISTORY
+The
+.Nm
+implementation first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_biba.4 b/share/man/man4/mac_biba.4
new file mode 100644
index 000000000000..7b7cf6eb0e8f
--- /dev/null
+++ b/share/man/man4/mac_biba.4
@@ -0,0 +1,236 @@
+.\" Copyright (c) 2002-2004 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 18, 2002
+.Dt MAC_BIBA 4
+.Os
+.Sh NAME
+.Nm mac_biba
+.Nd "Biba data integrity policy"
+.Sh SYNOPSIS
+To compile Biba into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_BIBA"
+.Ed
+.Pp
+Alternately, to load the Biba module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_biba_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements the Biba integrity model,
+which protects the integrity of system objects and subjects by means of
+a strict information flow policy.
+In Biba, all system subjects and objects are assigned integrity labels, made
+up of hierarchal grades, and non-hierarchal components.
+Together, these label elements permit all labels to be placed in a partial
+order, with information flow protections based on a dominance operator
+describing the order.
+The hierarchal grade field is expressed as a value between 0 and 65535,
+with higher values reflecting higher integrity.
+The non-hierarchal compartment field is expressed as a set of up to 256
+components, numbered from 0 to 255.
+A complete label consists of both hierarchal and non-hierarchal elements.
+.Pp
+Three special label values exist:
+.Bl -column -offset indent ".Li biba/equal" "lower than all other labels"
+.It Sy Label Ta Sy Comparison
+.It Li biba/low Ta "lower than all other labels"
+.It Li biba/equal Ta "equal to all other labels"
+.It Li biba/high Ta "higher than all other labels"
+.El
+.Pp
+The
+.Dq Li biba/high
+label is assigned to system objects which affect the integrity of the system
+as a whole.
+The
+.Dq Li biba/equal
+label
+may be used to indicate that a particular subject or object is exempt from
+the Biba protections.
+These special label values are not specified as containing any compartments,
+although in a label comparison,
+.Dq Li biba/high
+appears to contain all compartments,
+.Dq Li biba/equal
+the same compartments as the other label to which it is being compared,
+and
+.Dq Li biba/low
+none.
+.Pp
+In general, Biba access control takes the following model:
+.Bl -bullet
+.It
+A subject at the same integrity level as an object may both read from
+and write to the object as though Biba protections were not in place.
+.It
+A subject at a higher integrity level than an object may write to the object,
+but not read the object.
+.It
+A subject at a lower integrity level than an object may read the object,
+but not write to the object.
+.It
+If the subject and object labels may not be compared in the partial order,
+all access is restricted.
+.El
+.Pp
+These rules prevent subjects of lower integrity from influencing the
+behavior of higher integrity subjects by preventing the flow of information,
+and hence control, from allowing low integrity subjects to modify either
+a high integrity object or high integrity subjects acting on those objects.
+Biba integrity policies may be appropriate in a number of environments,
+both from the perspective of preventing corruption of the operating system,
+and corruption of user data if marked as higher integrity than the attacker.
+In traditional trusted operating systems, the Biba integrity model is used
+to protect the Trusted Code Base (TCB).
+.Pp
+The Biba integrity model is similar to
+.Xr mac_lomac 4 ,
+with the exception that LOMAC permits access by a higher integrity subject
+to a lower integrity object, but downgrades the integrity level of the subject
+to prevent integrity rules from being violated.
+Biba is a fixed label policy in that all subject and object label changes are
+explicit, whereas LOMAC is a floating label policy.
+.Pp
+The Biba integrity model is also similar to
+.Xr mac_mls 4 ,
+with the exception that the dominance operator and access rules are reversed,
+preventing the downward flow of information rather than the upward flow of
+information.
+Multi-Level Security (MLS) protects the confidentiality, rather than the
+integrity, of subjects and objects.
+.Ss Label Format
+Almost all system objects are tagged with an effective, active label element,
+reflecting the integrity of the object, or integrity of the data contained
+in the object.
+In general, objects labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li biba / Ar grade : compartments
+.Sm on
+.Pp
+For example:
+.Bd -literal -offset indent
+biba/10:2+3+6
+biba/low
+.Ed
+.Pp
+Subject labels consist of three label elements: an effective (active) label,
+as well as a range of available labels.
+This range is represented using two ordered Biba label elements, and when set
+on a process, permits the process to change its active label to any label of
+greater or equal integrity to the low end of the range, and lesser or equal
+integrity to the high end of the range.
+In general, subject labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li biba / Ar effectivegrade : effectivecompartments ( lograde : locompartments -
+.D1 Ar higrade : hicompartments )
+.Sm on
+.Pp
+For example:
+.Bd -literal -offset indent
+biba/10:2+3+6(5:2+3-20:2+3+4+5+6)
+biba/high(low-high)
+.Ed
+.Pp
+Valid ranged labels must meet the following requirement regarding their
+elements:
+.Pp
+.D1 Ar rangehigh No \[>=] Ar effective No \[>=] Ar rangelow
+.Pp
+One class of objects with ranges currently exists, the network interface.
+In the case of the network interface, the effective label element references the
+default label for packets received over the interface, and the range
+represents the range of acceptable labels of packets to be transmitted over
+the interface.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+MIBs are available for fine-tuning the enforcement of this MAC policy.
+.Bl -tag -width ".Va security.mac.biba.ptys_equal"
+.It Va security.mac.biba.enabled
+Enables enforcement of the Biba integrity policy.
+(Default: 1).
+.It Va security.mac.biba.ptys_equal
+Label
+.Xr pty 4 Ns s
+as
+.Dq Li biba/equal
+upon creation.
+(Default: 0).
+.It Va security.mac.biba.revocation_enabled
+Revoke access to objects if the label is changed to dominate the subject.
+(Default: 0).
+.El
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr maclabel 7 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
diff --git a/share/man/man4/mac_bsdextended.4 b/share/man/man4/mac_bsdextended.4
new file mode 100644
index 000000000000..23b89c04d04b
--- /dev/null
+++ b/share/man/man4/mac_bsdextended.4
@@ -0,0 +1,149 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 21, 2005
+.Dt MAC_BSDEXTENDED 4
+.Os
+.Sh NAME
+.Nm mac_bsdextended
+.Nd "file system firewall policy"
+.Sh SYNOPSIS
+To compile the file system firewall policy into your kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_BSDEXTENDED"
+.Ed
+.Pp
+Alternately, to load the file system firewall policy module at boot time,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_bsdextended_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+security policy module provides an interface for the system administrator
+to impose mandatory rules regarding users and some system objects.
+Rules are uploaded to the module
+(typically using
+.Xr ugidfw 8 ,
+or some other tool utilizing
+.Xr libugidfw 3 )
+where they are stored internally
+and used to determine whether to allow or deny specific accesses
+(see
+.Xr ugidfw 8 ) .
+.Sh IMPLEMENTATION NOTES
+While the traditional
+.Xr mac 9
+entry points are implemented,
+policy labels are not used;
+instead, access control decisions are made by iterating through the internal
+list of rules until a rule
+which denies the particular access
+is found,
+or the end of the list is reached.
+The
+.Nm
+policy works similar to
+.Xr ipfw 8
+or by using a
+.Em first match semantic .
+This means that not all rules are applied,
+only the first matched rule; thus if
+Rule A allows access and Rule B blocks
+access, Rule B will never be applied.
+.Pp
+.Ss Sysctls
+The following sysctls may be used to tweak the behavior of
+.Nm :
+.Bl -tag -width indent
+.It Va security.mac.bsdextended.enabled
+Set to zero or one to toggle the policy off or on.
+.It Va security.mac.bsdextended.rule_count
+List the number of defined rules, the maximum rule count is
+current set at 256.
+.It Va security.mac.bsdextended.rule_slots
+List the number of rule slots currently being used.
+.It Va security.mac.bsdextended.firstmatch_enabled
+Toggle between the old all rules match functionality
+and the new first rule matches functionality.
+This is enabled by default.
+.It Va security.mac.bsdextended.logging
+Log all access violations via the
+.Dv AUTHPRIV
+.Xr syslog 3
+facility.
+.It Va security.mac.bsdextended.rules
+Currently does nothing interesting.
+.El
+.Sh SEE ALSO
+.Xr libugidfw 3 ,
+.Xr syslog 3 ,
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr ipfw 8 ,
+.Xr ugidfw 8 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Pp
+The "match first case" and logging capabilities were later added by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by NAI Labs, the Security Research Division of Network Associates
+Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
diff --git a/share/man/man4/mac_ifoff.4 b/share/man/man4/mac_ifoff.4
new file mode 100644
index 000000000000..87c73b250888
--- /dev/null
+++ b/share/man/man4/mac_ifoff.4
@@ -0,0 +1,133 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 10, 2002
+.Dt MAC_IFOFF 4
+.Os
+.Sh NAME
+.Nm mac_ifoff
+.Nd "interface silencing policy"
+.Sh SYNOPSIS
+To compile the interface silencing policy into your kernel,
+place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_IFOFF"
+.Ed
+.Pp
+Alternately, to load the interface silencing policy module at boot time,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_ifoff_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+interface silencing module allows administrators to enable and disable
+incoming and outgoing data flow on system network interfaces
+via the
+.Xr sysctl 8
+interface.
+.Pp
+To disable network traffic over the loopback
+.Pq Xr lo 4
+interface, set the
+.Xr sysctl 8
+OID
+.Va security.mac.ifoff.lo_enabled
+to 0 (default 1).
+.Pp
+To enable network traffic over other interfaces,
+set the
+.Xr sysctl 8
+OID
+.Va security.mac.ifoff.other_enabled
+to 1 (default 0).
+.Pp
+To allow BPF traffic to be received,
+even while other traffic is disabled,
+set the
+.Xr sysctl 8
+OID
+.Va security.mac.ifoff.bpfrecv_enabled
+to 1 (default 0).
+.Ss Label Format
+No labels are defined.
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_lomac.4 b/share/man/man4/mac_lomac.4
new file mode 100644
index 000000000000..0cf99c97f299
--- /dev/null
+++ b/share/man/man4/mac_lomac.4
@@ -0,0 +1,221 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt MAC_LOMAC 4
+.Os
+.Sh NAME
+.Nm mac_lomac
+.Nd "Low-watermark Mandatory Access Control data integrity policy"
+.Sh SYNOPSIS
+To compile LOMAC into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_LOMAC"
+.Ed
+.Pp
+Alternately, to load the LOMAC module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_lomac_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements the LOMAC integrity model,
+which protects the integrity of system objects and subjects by means of
+an information flow policy coupled with the subject demotion
+via floating labels.
+In LOMAC, all system subjects and objects are assigned integrity labels, made
+up of one or more hierarchical grades, depending on the their types.
+Together, these label elements permit all labels to be placed in a partial
+order, with information flow protections and demotion decisions
+based on a dominance operator
+describing the order.
+The hierarchal grade field or fields are expressed
+as a value between 0 and 65535,
+with higher values reflecting higher integrity.
+.Pp
+Three special label component values exist:
+.Bl -column -offset indent ".Sy Label" "dominated by all other labels"
+.It Sy Label Ta Sy Comparison
+.It Li low Ta "dominated by all other labels"
+.It Li equal Ta "equal to all other labels"
+.It Li high Ta "dominates all other labels"
+.El
+.Pp
+The
+.Dq Li high
+label is assigned to system objects which affect the integrity of the system
+as a whole.
+The
+.Dq Li equal
+label
+may be used to indicate that a particular subject or object is exempt from
+the LOMAC protections.
+For example, a label of
+.Dq Li lomac/equal(equal-equal)
+might be used on a subject which is to be used to administratively relabel
+anything on the system.
+.Pp
+Almost all system objects are tagged with a single, active label element,
+reflecting the integrity of the object, or integrity of the data contained
+in the object.
+File system objects may contain an additional auxiliary label which
+determines the inherited integrity level for new files created in a
+directory or the alternate label assumed by the subject upon execution of
+an executable.
+In general, objects labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li lomac / Ar grade Bq Ar auxgrade
+.Sm on
+.Pp
+For example:
+.Bd -literal -offset indent
+lomac/10[2]
+lomac/low
+.Ed
+.Pp
+Subject labels consist of three label elements: a single (active) label,
+as well as a range of available labels.
+This range is represented using two ordered LOMAC label elements, and when set
+on a process, permits the process to change its active label to any label of
+greater or equal integrity to the low end of the range, and lesser or equal
+integrity to the high end of the range.
+In general, subject labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li lomac / Ar singlegrade ( lograde No - Ar higrade )
+.Sm on
+.Pp
+Modification of objects is restricted to access via the following comparison:
+.Pp
+.D1 Ar subject Ns :: Ns Ar higrade No \[>=] Ar target-object Ns :: Ns Ar grade
+.Pp
+Modification of subjects is the same, as the target subject's single grade
+is the only element taken into comparison.
+.Pp
+Demotion of a subject occurs when the following comparison is true:
+.Pp
+.D1 Ar subject Ns :: Ns Ar singlegrade No > Ar object Ns :: Ns Ar grade
+.Pp
+When demotion occurs, the subject's
+.Ar singlegrade
+and
+.Ar higrade
+are reduced to the
+object's grade, as well as the
+.Ar lograde
+if necessary.
+When the demotion occurs, in addition to the permission of the subject being
+reduced, shared
+.Xr mmap 2
+objects which it has opened in its memory space may be revoked according to
+the following
+.Xr sysctl 3
+variables:
+.Pp
+.Bl -bullet -compact
+.It
+.Va security.mac.lomac.revocation_enabled
+.It
+.Va security.mac.enforce_vm
+.It
+.Va security.mac.mmap_revocation
+.It
+.Va security.mac.mmap_revocation_via_cow
+.El
+.Pp
+Upon execution of a file, if the executable has an auxiliary label, and that
+label is within the current range of
+.Ar lograde Ns - Ns Ar higrade ,
+it will be assumed by the subject immediately.
+After this, demotion is performed just as with any other read operation, with
+the executable as the target.
+Through the use of auxiliary labels, programs may be initially executed
+at a lower effective integrity level,
+while retaining the ability to raise it again.
+.Pp
+These rules prevent subjects of lower integrity from influencing the
+behavior of higher integrity subjects by preventing the flow of information,
+and hence control, from allowing low integrity subjects to modify either
+a high integrity object or high integrity subjects acting on those objects.
+LOMAC integrity policies may be appropriate in a number of environments,
+both from the perspective of preventing corruption of the operating system,
+and corruption of user data if marked as higher integrity than the attacker.
+.Pp
+The LOMAC security model is quite similar to that of
+.Xr mac_biba 4
+and
+.Xr mac_mls 4
+in various ways.
+More background information on this can be found in their respective
+man pages.
+.Sh SEE ALSO
+.Xr mmap 2 ,
+.Xr sysctl 3 ,
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
diff --git a/share/man/man4/mac_mls.4 b/share/man/man4/mac_mls.4
new file mode 100644
index 000000000000..b314fb5ca3a9
--- /dev/null
+++ b/share/man/man4/mac_mls.4
@@ -0,0 +1,251 @@
+.\" Copyright (c) 2002-2004 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2002
+.Dt MAC_MLS 4
+.Os
+.Sh NAME
+.Nm mac_mls
+.Nd "Multi-Level Security confidentiality policy"
+.Sh SYNOPSIS
+To compile MLS into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_MLS"
+.Ed
+.Pp
+Alternately, to load the MLS module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_mls_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements the Multi-Level Security, or MLS model,
+which controls access between subjects and objects based on their
+confidentiality by means of a strict information flow policy.
+Each subject and object in the system has an MLS label associated with it;
+each subject's MLS label contains information on its clearance level,
+and each object's MLS label contains information on its classification.
+.Pp
+In MLS, all system subjects and objects are assigned confidentiality labels,
+made up of a sensitivity level and zero or more compartments.
+Together, these label elements permit all labels to be placed in a partial
+order, with confidentiality protections based on a dominance operator
+describing the order.
+The sensitivity level is expressed as a value between 0 and
+65535, with higher values reflecting higher sensitivity levels.
+The compartment field is expressed as a set of up to 256 components,
+numbered from 1 to 256.
+A complete label consists of both sensitivity and compartment
+elements.
+.Pp
+With normal labels, dominance is defined as a label having a higher
+or equal active sensitivity level, and having at least
+all of the same compartments as the label to which it is being compared.
+With respect to label comparisons,
+.Dq Li lower
+is defined as being dominated by the label to which it is being compared,
+and
+.Dq Li higher
+is defined as dominating the label to which it is being compared,
+and
+.Dq Li equal
+is defined as both labels being able to satisfy the dominance requirements
+over one another.
+.Pp
+Three special label values exist:
+.Bl -column -offset indent ".Li mls/equal" "dominated by all other labels"
+.It Sy Label Ta Sy Comparison
+.It Li mls/low Ta "dominated by all other labels"
+.It Li mls/equal Ta "equal to all other labels"
+.It Li mls/high Ta "dominates all other labels"
+.El
+.Pp
+The
+.Dq Li mls/equal
+label may be applied to subjects and objects for which no enforcement of the
+MLS security policy is desired.
+.Pp
+The MLS model enforces the following basic restrictions:
+.Bl -bullet
+.It
+Subjects may not observe the processes of another subject if its
+clearance level is lower than the clearance level of the object it is
+attempting to observe.
+.It
+Subjects may not read, write, or otherwise observe objects without proper
+clearance (e.g.\& subjects may not observe objects whose classification label
+dominates its own clearance label)
+.It
+Subjects may not write to objects with a lower classification level than
+its own clearance level.
+.It
+A subject may read and write to an object if its clearance level is equal
+to the object's classification level as though MLS protections were not in
+place.
+.El
+.Pp
+These rules prevent subjects of lower clearance from gaining access
+information classified beyond its clearance level in order to protect the
+confidentiality of classified information, subjects of higher clearance
+from writing to objects of lower classification in order to prevent the
+accidental or malicious leaking of information, and subjects of lower
+clearance from observing subjects of higher clearance altogether.
+In traditional trusted operating systems, the MLS confidentiality model is
+used in concert with the Biba integrity model
+.Xr ( mac_biba 4 )
+in order to protect the Trusted Code Base (TCB).
+.Ss Label Format
+Almost all system objects are tagged with an effective, active label element,
+reflecting the classification of the object, or classification of the data
+contained in the object.
+In general, object labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li mls / Ar grade : compartments
+.Sm on
+.Pp
+For example:
+.Bd -literal -offset indent
+mls/10:2+3+6
+mls/low
+.Ed
+.Pp
+Subject labels consist of three label elements: an effective (active) label,
+as well as a range of available labels.
+This range is represented using two ordered MLS label elements, and when set
+on a process, permits the process to change its active label to any label of
+greater or equal integrity to the low end of the range, and lesser or equal
+integrity to the high end of the range.
+In general, subject labels are represented in the following form:
+.Pp
+.Sm off
+.D1 Li mls / Ar effectivegrade : effectivecompartments ( lograde : locompartments No -
+.D1 Ar higrade : hicompartments )
+.Sm on
+.Pp
+For example:
+.Bd -literal -offset indent
+mls/10:2+3+6(5:2+3-20:2+3+4+5+6)
+mls/high(low-high)
+.Ed
+.Pp
+Valid ranged labels must meet the following requirement regarding their
+elements:
+.Pp
+.D1 Ar rangehigh No \[>=] Ar effective No \[>=] Ar rangelow
+.Pp
+One class of objects with ranges currently exists, the network interface.
+In the case of the network interface, the effective label element references
+the default label for packets received over the interface, and the range
+represents the range of acceptable labels of packets to be transmitted over
+the interface.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+MIBs are available for fine-tuning the enforcement of this MAC policy.
+.Bl -tag -width ".Va security.mac.mls.ptys_equal"
+.It Va security.mac.mls.enabled
+Enables the enforcement of the MLS confidentiality policy.
+(Default: 1).
+.It Va security.mac.mls.ptys_equal
+Label
+.Xr pty 4 Ns s
+as
+.Dq Li mls/equal
+upon creation.
+(Default: 0).
+.It Va security.mac.mls.revocation_enabled
+Revoke access to objects if the label is changed to a more sensitive
+level than the subject.
+(Default: 0).
+.El
+.Sh IMPLEMENTATION NOTES
+Currently, the
+.Nm
+policy relies on superuser status
+.Pq Xr suser 9
+in order to change network interface MLS labels.
+This will eventually go away, but it is currently a liability and may
+allow the superuser to bypass MLS protections.
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr maclabel 7 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Laboratories,
+the Security Research Division of Network Associates
+Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_none.4 b/share/man/man4/mac_none.4
new file mode 100644
index 000000000000..8f4602935ac9
--- /dev/null
+++ b/share/man/man4/mac_none.4
@@ -0,0 +1,113 @@
+.\" Copyright (c) 2002, 2003 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2002
+.Dt MAC_NONE 4
+.Os
+.Sh NAME
+.Nm mac_none
+.Nd "null MAC policy module"
+.Sh SYNOPSIS
+To compile the null policy
+into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_NONE"
+.Ed
+.Pp
+Alternately, to load the sample module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_none_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements a sample MAC policy that has no effect on
+access control in the system.
+Unlike
+.Xr mac_stub 4 ,
+none of the MAC entry points are defined.
+.Ss Label Format
+No labels are defined for
+.Nm .
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_stub 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_partition.4 b/share/man/man4/mac_partition.4
new file mode 100644
index 000000000000..296635edaf06
--- /dev/null
+++ b/share/man/man4/mac_partition.4
@@ -0,0 +1,133 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 9, 2002
+.Dt MAC_PARTITION 4
+.Os
+.Sh NAME
+.Nm mac_partition
+.Nd "process partition policy"
+.Sh SYNOPSIS
+To compile the process partition policy into your kernel,
+place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_PARTITION"
+.Ed
+.Pp
+Alternately, to load the process partition module at boot time,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_partition_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements a process partition policy,
+which allows administrators to place running processes into
+.Dq partitions ,
+based on their numeric process partition
+(specified in the process's MAC label).
+Processes with a specified partition can only see processes that are in the
+same partition.
+If no partition is specified for a process, it can see all other processes
+in the system
+(subject to other MAC policy restrictions not defined in this man page).
+No provisions for placing processes into multiple partitions are available.
+.Ss Label Format
+Partition labels take on the following format:
+.Pp
+.Sm off
+.Dl Li partition / Ar value
+.Sm on
+.Pp
+Where
+.Ar value
+can be any integer value or
+.Dq Li none .
+For example:
+.Bd -literal -offset indent
+partition/1
+partition/20
+partition/none
+.Ed
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr maclabel 7 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_portacl.4 b/share/man/man4/mac_portacl.4
new file mode 100644
index 000000000000..2ecee26ca2fa
--- /dev/null
+++ b/share/man/man4/mac_portacl.4
@@ -0,0 +1,217 @@
+.\" Copyright (c) 2003 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Labs, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 9, 2004
+.Dt MAC_PORTACL 4
+.Os
+.Sh NAME
+.Nm mac_portacl
+.Nd "network port access control policy"
+.Sh SYNOPSIS
+To compile the port access control policy into your kernel,
+place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_PORTACL"
+.Ed
+.Pp
+Alternately, to load the port access control policy module at boot time,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Pp
+.Dl "mac_portacl_load=""YES"""
+.Sh DESCRIPTION
+The
+.Nm
+policy allows administrators to administratively limit binding to
+local
+.Tn UDP
+and
+.Tn TCP
+ports via the
+.Xr sysctl 8
+interface.
+.Pp
+In order to enable the
+.Nm
+policy, MAC policy must be enforced on sockets
+(see
+.Xr mac 4 ) ,
+and the port(s) protected by
+.Nm
+must not be included in the range specified by
+the
+.Va net.inet.ip.portrange.reservedlow
+and
+.Va net.inet.ip.portrange.reservedhigh
+.Xr sysctl 8
+MIBs.
+.Pp
+The
+.Nm
+policy only affects ports explicitly bound by a user process (either
+for a listen/outgoing
+.Tn TCP
+socket, or a send/receive
+.Tn UDP
+socket).
+This policy will not limit ports bound implicitly for outgoing
+connections where the process has not explicitly selected a port:
+these are automatically selected by the IP stack.
+.Pp
+When
+.Nm
+is enabled, it will control binding access to ports up to the port
+number set in the
+.Va security.mac.portacl.port_high
+.Xr sysctl 8
+variable.
+By default, all attempts to bind to
+.Nm
+controlled ports will fail if not explicitly allowed by the port
+access control list, though binding by the superuser will be allowed,
+if the
+.Xr sysctl 8
+variable
+.Va security.mac.portacl.suser_exempt
+is set to a non-zero value.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+MIBs are available for fine-tuning the enforcement of this MAC policy.
+All
+.Xr sysctl 8
+variables, except
+.Va security.mac.portacl.rules ,
+can also be set as
+.Xr loader 8
+tunables in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va security.mac.portacl.enabled
+Enforce the
+.Nm
+policy.
+(Default: 1).
+.It Va security.mac.portacl.port_high
+The highest port number
+.Nm
+will enforce rules for.
+(Default: 1023).
+.It Va security.mac.portacl.rules
+The port access control list is specified in the following format:
+.Pp
+.Sm off
+.D1 Ar idtype : id : protocol : port Op , Ar idtype : id : protocol : port , ...
+.Sm on
+.Bl -tag -width ".Ar protocol"
+.It Ar idtype
+Describes the type of subject match to be performed.
+Either
+.Li uid
+for user ID matching, or
+.Li gid
+for group ID matching.
+.It Ar id
+The user or group ID (depending on
+.Ar idtype )
+allowed to bind to the specified port.
+.Bf -emphasis
+NOTE: User and group names are not valid; only the actual ID numbers
+may be used.
+.Ef
+.It Ar protocol
+Describes which protocol this entry applies to.
+Either
+.Li tcp
+or
+.Li udp
+are supported.
+.It Ar port
+Describes which port this entry applies to.
+.Bf -emphasis
+NOTE: MAC security policies may not override other security system policies
+by allowing accesses that they may deny, such as
+.Va net.inet.ip.portrange.reservedlow /
+.Va net.inet.ip.portrange.reservedhigh .
+.Ef
+If the specified port falls within the range specified, the
+.Nm
+entry will not function
+(i.e., even the specified user/group may not be able to bind to the specified
+port).
+.El
+.It Va security.mac.portacl.suser_exempt
+Allow superuser (i.e., root) to bind to all
+.Nm
+protected ports, even if the port access control list does not
+explicitly allow this.
+(Default: 1).
+.It Va security.mac.portacl.autoport_exempt
+Allow applications to use automatic binding to port 0.
+Applications use port 0 as a request for automatic port allocation when
+binding an IP address to a socket.
+This tunable will exempt port 0 allocation from rule checking.
+(Default: 1).
+.El
+.Sh SEE ALSO
+.Xr mac 3 ,
+.Xr ip 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+MAC first appeared in
+.Fx 5.0
+and
+.Nm
+first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by NAI Labs, the Security Research Division of Network Associates
+Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
diff --git a/share/man/man4/mac_seeotheruids.4 b/share/man/man4/mac_seeotheruids.4
new file mode 100644
index 000000000000..c870ca00d3ed
--- /dev/null
+++ b/share/man/man4/mac_seeotheruids.4
@@ -0,0 +1,131 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 6, 2005
+.Dt MAC_SEEOTHERUIDS 4
+.Os
+.Sh NAME
+.Nm mac_seeotheruids
+.Nd "simple policy controlling whether users see other users"
+.Sh SYNOPSIS
+To compile the
+policy into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_SEEOTHERUIDS"
+.Ed
+.Pp
+Alternately, to load the module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_seeotheruids_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module, when enabled, denies users to see processes or sockets owned
+by other users.
+.Pp
+To enable
+.Nm ,
+set the sysctl OID
+.Va security.mac.seeotheruids.enabled
+to 1.
+To permit superuser awareness of other credentials by virtue of privilege,
+set the sysctl OID
+.Va security.mac.seeotheruids.suser_privileged
+to 1.
+.Pp
+To allow users to see processes and sockets owned by the same primary group,
+set the sysctl OID
+.Va security.mac.seeotheruids.primarygroup_enabled
+to 1.
+.Pp
+To allow processes with a specific group ID to be exempt from the policy,
+set the sysctl OID
+.Va security.mac.seeotheruids.specificgid_enabled
+to 1, and
+.Va security.mac.seeotheruids.specificgid
+to the group ID to be exempted.
+.Ss Label Format
+No labels are defined for
+.Nm .
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_stub.4 b/share/man/man4/mac_stub.4
new file mode 100644
index 000000000000..79326df3649f
--- /dev/null
+++ b/share/man/man4/mac_stub.4
@@ -0,0 +1,116 @@
+.\" Copyright (c) 2002, 2003 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2002
+.Dt MAC_STUB 4
+.Os
+.Sh NAME
+.Nm mac_stub
+.Nd "MAC policy stub module"
+.Sh SYNOPSIS
+To compile the sample policy
+into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_STUB"
+.Ed
+.Pp
+Alternately, to load the sample module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_stub_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements a sample MAC policy that has no effect on
+access control in the system.
+Unlike
+.Xr mac_none 4 ,
+each MAC entry point is defined as a
+.Dq no-op ,
+so the policy module will be entered for each event, but no change
+in system behavior should result.
+.Ss Label Format
+No labels are defined for
+.Nm .
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.1
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/mac_test.4 b/share/man/man4/mac_test.4
new file mode 100644
index 000000000000..e86d4bd0f140
--- /dev/null
+++ b/share/man/man4/mac_test.4
@@ -0,0 +1,117 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
+.\" DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2002
+.Dt MAC_TEST 4
+.Os
+.Sh NAME
+.Nm mac_test
+.Nd MAC framework testing policy
+.Sh SYNOPSIS
+To compile the testing policy
+into your kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Cd "options MAC_TEST"
+.Ed
+.Pp
+Alternately, to load the testing module at boot time, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options MAC"
+.Ed
+.Pp
+and in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mac_test_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+policy module implements a testing facility for the MAC framework.
+Among other things,
+.Nm
+will try to catch corrupt labels the system is attempting to destroy and
+drop to the debugger.
+Additionally, a set of statistics regarding the number of times various
+MAC framework entry points have been called is stored in the
+.Va security.mac.test
+.Xr sysctl 8
+tree.
+.Ss Label Format
+No labels are defined for
+.Nm .
+.Sh SEE ALSO
+.Xr mac 4 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_portacl 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac 9
+.Sh HISTORY
+The
+.Nm
+policy module first appeared in
+.Fx 5.0
+and was developed by the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by Network Associates Labs,
+the Security Research Division of Network Associates
+Inc.
+under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Sh BUGS
+See
+.Xr mac 9
+concerning appropriateness for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man4/malo.4 b/share/man/man4/malo.4
new file mode 100644
index 000000000000..22cc47142fbd
--- /dev/null
+++ b/share/man/man4/malo.4
@@ -0,0 +1,127 @@
+.\"-
+.\" Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org>
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\" 3. Neither the names of the above-listed copyright holders nor the names
+.\" of any contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd October 21, 2009
+.Dt MALO 4
+.Os
+.Sh NAME
+.Nm malo
+.Nd "Marvell Libertas IEEE 802.11b/g wireless network driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device malo"
+.Cd "device pci"
+.Cd "device wlan"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_malo_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Marvell Libertas 88W8335 based PCI
+and Cardbus network adapters.
+.Nm
+supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires the
+.Nm malofw
+firmware kernel module be installed before it will work.
+The firmware files are not publicly available.
+A port of the firmware can be found at:
+.Bd -literal -offset indent
+http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz
+.Ed
+.Pp
+The firmware kernel module can be installed by extracting
+the archive and running
+.Ql make install clean
+in the
+.Pa malo-firmware-1.4
+directory.
+.Sh HARDWARE
+The following cards are among those supported by the
+.Nm
+driver:
+.Bl -column "Netgear WG311v3" "88W8335" "PCI" "b/g"
+.Em "Card" Ta Em "Chip" Ta Em "Bus" Ta Em "Standard"
+.It "Netgear WG311v3" Ta "88W8335" Ta "PCI" Ta "b/g"
+.It "Tenda TWL542P" Ta "88W8335" Ta "PCI" Ta "b/g"
+.It "U-Khan UW-2054i" Ta "88W8335" Ta "PCI" Ta "b/g"
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev malo0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev malo0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev malo0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.1 .
diff --git a/share/man/man4/man4.arm/Makefile b/share/man/man4/man4.arm/Makefile
new file mode 100644
index 000000000000..8d3e2e1c362c
--- /dev/null
+++ b/share/man/man4/man4.arm/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+MAN= mge.4 npe.4
+
+MLINKS= mge.4 if_mge.4
+MLINKS+=npe.4 if_npe.4
+
+MANSUBDIR=/arm
+
+.include <bsd.prog.mk>
diff --git a/share/man/man4/man4.arm/mge.4 b/share/man/man4/man4.arm/mge.4
new file mode 100644
index 000000000000..a0f05bd965a8
--- /dev/null
+++ b/share/man/man4/man4.arm/mge.4
@@ -0,0 +1,158 @@
+.\"
+.\" Copyright (c) 2008 Semihalf, Rafal Jaworowski
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 27, 2008
+.Dt MGE 4
+.Os
+.Sh NAME
+.Nm mge
+.Nd "Marvell Gigabit Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mge"
+.Cd "device miibus"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for gigabit Ethernet controller integrated in Marvell
+system-on-chip devices.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options
+.It 10baseT/UTP
+Set 10Mbps operation
+.It 100baseTX
+Set 100Mbps operation
+.It 1000baseT
+Set 1000baseT operation
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Set full duplex operation
+.El
+.Pp
+The
+.Nm
+driver supports polled operation when the system is configured with
+DEVICE_POLLING kernel option, see
+.Xr polling 4
+for more details.
+.Pp
+The
+.Nm
+driver supports reception and transmission of extended frames
+for
+.Xr vlan 4 .
+This capability of
+.Nm
+can be controlled by means of the
+.Cm vlanmtu
+parameter
+to
+.Xr ifconfig 8 .
+.Pp
+The
+.Nm
+driver supports interrupts coalescing (IC) so that raising a transmit/receive
+frame interrupt is delayed, if possible, until a threshold-defined period of
+time has elapsed. The following sysctls regulate this behaviour (separately
+for each path):
+.Bl -tag -width indent
+.It Va dev.mge.X.int_coal.rx_time
+.It Va dev.mge.X.int_coal.tx_time
+.Pp
+Value of 0 disables IC on the given path, value greater than zero corresponds
+to a real time period and is expressed in units equivalent to 64 ticks of the
+MGE clock. Maximum allowed value depends on MGE hardware revision. User
+provided values larger than supported will be trimmed to the maximum
+supported. More details are available in the reference manual of the device.
+.El
+.Sh HARDWARE
+Gigabit Ethernet controllers built into the following Marvell systems-on-chip
+are known to work with the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+Orion 88F5182
+.It
+Orion 88F5281
+.It
+Kirkwood 88F6281 (MGE V2)
+.It
+Discovery MV78100 (MGE V2)
+.El
+.Pp
+There are also Marvell system controllers for PowerPC processors, which
+include a variation of this gigabit Ethernet module integrated on chip, and
+they should also work with the
+.Nm
+driver, but this wasn't tested:
+.Pp
+.Bl -bullet -compact
+.It
+MV64430
+.It
+MV64460, MV64461, MV64462
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The base version of
+.Nm
+device driver was written by
+.An Grzegorz Bernacki.
+It has been extended with advanced features (polling, interrupt coalescing,
+multicast, h/w checksum calculation etc.) by
+.An Piotr Ziecik .
+This manual page was written by
+.An Rafal Jaworowski .
diff --git a/share/man/man4/man4.arm/npe.4 b/share/man/man4/man4.arm/npe.4
new file mode 100644
index 000000000000..035dea1a94b4
--- /dev/null
+++ b/share/man/man4/man4.arm/npe.4
@@ -0,0 +1,163 @@
+.\"
+.\" Copyright (c) 2006 Sam Leffler, Errno Consulting
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 4, 2006
+.Dt NPE 4 arm
+.Os
+.Sh NAME
+.Nm npe
+.Nd "Intel XScale Network Processing Engine (NPE) Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device npe"
+.Cd "device npe_fw"
+.Cd "device firmware"
+.Cd "device qmgr"
+.Cd "device miibus"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Ethernet adapters based on the Intel
+XScale Network Processing Engine (NPE).
+The NPE must be loaded with firmware that is typically distributed
+with boards that have this part.
+Otherwise the firmware may be obtained at no cost from the Intel web site.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Set full duplex operation.
+.El
+.Pp
+The
+.Nm
+driver supports polled operation when the system is
+configured with device polling support,
+.Xr polling 4 .
+Note that for multi-port configurations polling and interrupt-style
+operation should not be combined as one of the hardware queues
+is shared by all ports.
+.Pp
+For further information on configuring this device, see
+.Xr ifconfig 8 .
+.\".Pp
+.\"The
+.\".Nm
+.\"driver supports reception and transmission of extended frames
+.\"for
+.\".Xr vlan 4 .
+.\"This capability of
+.\".Nm
+.\"can be controlled by means of the
+.\".Cm vlanmtu
+.\"parameter
+.\"to
+.\".Xr ifconfig 8 .
+.Sh HARDWARE
+The adapters supported by the
+.Nm
+driver exist only on boards that have an XScale processor.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "npe%d: unit %d not supported"
+The unit is larger than the maximum number built into the driver.
+This should not happen as
+.Nm
+devices are not really probed for; they are statically enumerated.
+.It "npe%d: Cannot find my PHY."
+The associated PHY did not appear while probing the MII bus.
+The relationship between PHYs and NPEs is statically defined
+in the driver and may require alterations to the driver for new boards.
+.It "npe%d: unable to allocate memory for %s ... buffers"
+There is not enough memory available for allocation.
+The driver pre-allocated memory during attach so this should not happen.
+.It "npe%d: remember to fix rx q setup"
+See
+.Sx BUGS
+below.
+.It "npe%d: free mbuf at entry %u"
+An mbuf was unexpectedly found on the device queue; the index of
+the queue entry is printed.
+.It "npe%d: too many fragments %u"
+A frame was dropped on transmit because it was too fragmented and
+the logic to de-fragment failed.
+This should not happen.
+.It "npe%d: device timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Pp
+Other diagnostics exist and are not listed here;
+they should be self-explanatory.
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr polling 4 ,
+.Xr qmgr 4 ,
+.\".Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh CAVEATS
+This driver has been tested only with dual-port boards using the IXP425
+such as the Gateworks Avila 2348.
+Some changes to the driver may be required for other configurations.
+.Sh BUGS
+The hardware queues are not properly flushed when the interface
+is marked down.
+.Pp
+The assignment of receive traffic classes to hardware queues
+is presently incomplete.
+Only the first 4 classes are assigned while there are 8 total.
+The driver will print
+.Dq Li "remember to fix rx q setup"
+on startup as a reminder.
+For the moment it is not a problem as all traffic arrives classified
+with class 0.
diff --git a/share/man/man4/man4.i386/CPU_ELAN.4 b/share/man/man4/man4.i386/CPU_ELAN.4
new file mode 100644
index 000000000000..4a0611f23f2d
--- /dev/null
+++ b/share/man/man4/man4.i386/CPU_ELAN.4
@@ -0,0 +1,159 @@
+.\" Copyright (c) 2003 Poul-Henning Kamp <phk@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 23, 2003
+.Dt CPU_ELAN 4 i386
+.Os
+.Sh NAME
+.Nm CPU_ELAN
+.Nd AMD Elan 520 CPU support
+.Sh SYNOPSIS
+.Cd "options CPU_ELAN"
+.Cd "options CPU_ELAN_PPS"
+.Cd "options CPU_ELAN_XTAL"
+.Bl -item -compact
+.It
+.Va machdep.elan_gpio_config
+.It
+.Va machdep.elan_freq
+.El
+.Cd "options CPU_SOEKRIS"
+.Sh DESCRIPTION
+The
+.Cd "options CPU_ELAN"
+enables support for the AMD Elan 520 CPU.
+.Pp
+A device
+.Pa /dev/elan-mmcr
+exports the MMCR register bank to userland
+using
+.Xr mmap 2 .
+.Pp
+The
+.Tn i8254
+timer will be adjusted to the slightly unorthodox
+frequency 1189161 Hz (32768 * 45 * 25 / 31) employed by the Elan.
+.Pp
+A timecounter named
+.Dq Li ELAN
+is implemented using the general purpose timer 2,
+but it will not be usable unless HZ is configured at 150 or higher.
+This timecounter is much better than the
+.Dq Li i8254
+timecounter and should be
+used at all times.
+.Pp
+The
+.Va machdep.elan_gpio_config
+.Xr sysctl 8
+variable
+enables configuration of the GPIO pins of the CPU.
+The string must be exactly 32 characters long.
+A
+.Ql -
+means the GPIO is unavailable.
+A
+.Ql l
+(lower-case ell) configures a
+.Xr led 4
+device (active low).
+A
+.Ql L
+configures a
+.Xr led 4
+device (active high).
+A
+.Ql \&.
+means no configuration for this GPIO.
+These
+.Xr led 4
+devices will be named
+.Pa /dev/led/gpio%d .
+For meaning of
+.Ql P ,
+.Ql e
+and
+.Ql E ,
+see under
+.Cd "options CPU_ELAN_PPS" .
+.Pp
+The
+.Cd "options CPU_ELAN_XTAL"
+and the
+.Va machdep.elan_freq
+.Xr sysctl 8
+variable
+can be used to set the CPU clock crystal frequency in Hz.
+The default is 33333333 Hz.
+.Pp
+The
+.Cd "options CPU_ELAN_PPS"
+enables precision timestamping using the RFC2783 PPS-API via the
+.Pa /dev/elan-mmcr
+device.
+The resolution will be approximately 125 nsec
+and the precision \(+- 125 nsec.
+(For 125 nsec read
+.Dq "4 / CPU clock crystal frequency" . )
+.Pp
+The input signal must be connected to the TMR1IN pin and
+a GPIO pin.
+The GPIO pin must be configured with a
+.Ql P
+in
+.Va machdep.elan_gpio_config .
+.Pp
+In addition, one GPIO pin can be configured with either
+.Ql e
+(active low)
+or
+.Ql E
+(active high) to become a
+.Dq echo
+output of the input signal.
+Please notice that this signal is not suitable for calibration.
+.Pp
+If the
+.Cd "options CPU_SOEKRIS"
+is given, the support will additionally be tailored to the
+Soekris Engineering 45xx series of embedded computers.
+The
+.Dq error
+led will be configured (as
+.Pa /dev/led/error )
+and the GPIO pins which are not
+available will be disabled.
+.Sh SEE ALSO
+.Xr led 4 ,
+.Xr timecounters 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+code first appeared in
+.Fx 4.7 .
+.Sh AUTHORS
+.An "Poul-Henning Kamp" Aq phk@FreeBSD.org
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
new file mode 100644
index 000000000000..974eec02df73
--- /dev/null
+++ b/share/man/man4/man4.i386/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+MAN= aic.4 \
+ apm.4 \
+ ce.4 \
+ cp.4 \
+ CPU_ELAN.4 \
+ cs.4 \
+ ct.4 \
+ ctau.4 \
+ cx.4 \
+ ep.4 \
+ ex.4 \
+ fe.4 \
+ glxiic.4 \
+ glxsb.4 \
+ ie.4 \
+ longrun.4 \
+ mse.4 \
+ npx.4 \
+ pae.4 \
+ pbio.4 \
+ perfmon.4 \
+ pnp.4 \
+ pnpbios.4 \
+ sbni.4 \
+ smapi.4 \
+ snc.4 \
+ streams.4 \
+ svr4.4 \
+ vpd.4 \
+ vx.4 \
+ wl.4
+
+MLINKS= CPU_ELAN.4 CPU_SOEKRIS.4
+MLINKS+=pae.4 PAE.4
+MLINKS+=sbni.4 if_sbni.4
+
+MANSUBDIR=/i386
+
+.include <bsd.prog.mk>
diff --git a/share/man/man4/man4.i386/aic.4 b/share/man/man4/man4.i386/aic.4
new file mode 100644
index 000000000000..991a0c50be99
--- /dev/null
+++ b/share/man/man4/man4.i386/aic.4
@@ -0,0 +1,84 @@
+.\"
+.\" Copyright (c) 1994 James A. Jegers
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 8, 2003
+.Dt AIC 4 i386
+.Os
+.Sh NAME
+.Nm aic
+.Nd Adaptec AIC-6260 and AIC-6360 SCSI driver
+.Sh SYNOPSIS
+.Cd "device aic"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.aic.0.at="isa"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Adaptec AIC-6260 and AIC-6360 SCSI
+controller chips.
+Many systems that use these controller chips do not have a boot ROM
+and therefore cannot be booted from.
+.Sh HARDWARE
+The adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AHA-1505 (ISA)
+.It
+Adaptec AHA-1510A, AHA-1510B (ISA)
+.It
+Adaptec AHA-1520A, AHA-1520B (ISA)
+.It
+Adaptec AHA-1522A, AHA-1522B (ISA)
+.It
+Adaptec AHA-1535 (ISA)
+.It
+Creative Labs SoundBlaster SCSI host adapter (ISA)
+.It
+Adaptec AHA-1460, AHA-1460B, AHA-1460C, AHA-1460D (PC Card)
+.It
+Adaptec AHA-1030B, AHA-1030P (PC98)
+.It
+NEC PC-9801-100 (PC98)
+.El
+.Sh SEE ALSO
+.Xr aha 4 ,
+.Xr ahb 4 ,
+.Xr ahc 4 ,
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr sa 4
+.Sh BUGS
+The driver does not work well with multiple devices on the SCSI bus.
+The driver works well with devices like CDROMs and Tape drives.
+The driver works not so well with disk drives.
+The PC Card version appears to work better than the ISA version, but
+that may be due to differing levels of testing of the devices.
diff --git a/share/man/man4/man4.i386/apm.4 b/share/man/man4/man4.i386/apm.4
new file mode 100644
index 000000000000..6d7b524799c0
--- /dev/null
+++ b/share/man/man4/man4.i386/apm.4
@@ -0,0 +1,158 @@
+.\" LP (Laptop Package)
+.\"
+.\" Copyright (c) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
+.\"
+.\" This software may be used, modified, copied, and distributed, in
+.\" both source and binary form provided that the above copyright and
+.\" these terms are retained. Under no circumstances is the author
+.\" responsible for the proper functioning of this software, nor does
+.\" the author assume any responsibility for damages incurred with its
+.\" use.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 1, 1994
+.Dt APM 4 i386
+.Os
+.Sh NAME
+.Nm apm
+.Nd APM BIOS interface
+.Sh SYNOPSIS
+.Cd device apm
+.Sh DESCRIPTION
+.Nm
+is an interface to the Intel / Microsoft APM (Advanced Power Management) BIOS
+on laptop PCs.
+.Pp
+.Nm
+provides the following power management functions.
+.Bl -enum -offset indent
+.It
+When the system wakes up from suspended mode,
+.Nm
+adjusts the system clock to RTC.
+.It
+When the system wakes up from suspended mode,
+.Nm
+passes a message to
+.Xr syslogd 8
+comprising of system wakeup time and elapsed time during suspended mode.
+.It
+.Nm
+slows CPU clock when there are no system activities (runnable processes,
+interrupts, etc.).
+This function is available only on systems whose APM
+supports CPU idling.
+.It
+.Nm
+exports an application interface as a character device.
+Applications
+can control APM, or retrieve APM status information via this interface.
+.Nm
+exports the following interfaces.
+These symbols are defined in
+.In machine/apm_bios.h .
+.Bl -tag -width 4n -offset indent
+.It Sy APMIO_SUSPEND
+Suspend system.
+.It Sy APMIO_GET
+Get power management information.
+.It Sy APMIO_ENABLE
+.It Sy APMIO_DISABLE
+Enable / Disable power management.
+.It Sy APMIO_HALTCPU
+.It Sy APMIO_NOTHALTCPU
+Control execution of HLT in the kernel context switch routine.
+.It Sy APMIO_GETPWSTATUS
+Get per battery information.
+.Pp
+Some APM implementations execute the HLT
+(Halt CPU until an interrupt occurs)
+instruction in the
+.Dq Em Idle CPU
+call, while others do not.
+Thus enabling this may result in
+redundant HLT executions because
+.Dq Em Idle CPU
+is called from the kernel context switch routine that inherently executes
+HLT.
+This may reduce peak system performance.
+.Pp
+Also the system hangs up if HLT instruction is disabled in the kernel
+context switch routine, and if the APM implementation of the machine
+does not execute HLT in
+.Dq Em Idle CPU .
+On some implementations that do not support CPU clock slowdown, APM
+might not execute HLT.
+.Nm
+disables
+.Sy APMIO_NOTHALTCPU
+operation on such machines.
+.Pp
+The current version of
+.Nm
+does not call
+.Dq Em Idle CPU
+from the kernel context switch routine if clock slowdown is not supported,
+and it executes HLT instruction by default.
+Therefore, there is
+no need to use these two operations in most cases.
+.El
+.Pp
+These interfaces are used by
+.Xr apm 8 .
+.It
+.Nm
+polls APM events and handles the following events.
+.Bl -column "xxxxxxxxxxxxxxxxx" "xxxxxxxxxxxxx" "xxxxxxxx"
+.It Sy "Name" Ta Sy "Action" Ta Sy "Description"
+.It Dv "PMEV_STANDBYREQ" Ta No "suspend system" Ta "standby request"
+.It Dv "PMEV_SUSPENDREQ" Ta No "suspend system" Ta "suspend request"
+.It Dv "PMEV_USERSUSPENDREQ" Ta No "suspend system" Ta "user suspend request"
+.It Dv "PMEV_CRITSUSPEND" Ta No "suspend system" Ta "critical suspend request"
+.It Dv "PMEV_NORMRESUME" Ta No "resume system" Ta "normal resume"
+.It Dv "PMEV_CRITRESUME" Ta No "resume system" Ta "critical resume"
+.It Dv "PMEV_STANDBYRESUME" Ta No "resume system" Ta "standby resume"
+.It Dv "PMEV_BATTERYLOW" Ta No "notify message" Ta "battery low"
+.It Dv "PMEV_UPDATETIME" Ta No "adjust clock" Ta "update time"
+.El
+.El
+.Sh SEE ALSO
+.Xr apm 8 ,
+.Xr zzz 8
+.Sh AUTHORS
+Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org>
+.Sh BUGS
+WARNING!
+Many, if not most, of the implementations of APM-bios in laptops
+today are buggy.
+You may be putting your LCD-display and batteries at
+a risk by using this interface.
+(The reason this is not a problem for
+MS-Windows is that they use the real-mode interface.)
+If you see any
+weird behavior from your system with this code in use, unplug the
+power and batteries ASAP, if not immediately, and disable this code.
+.Pp
+We are very interested in getting this code working, so please send your
+observations of any anomalous behavior to us.
+.Pp
+When
+.Nm
+is active, calling the BIOS setup routine by using hot-keys,
+may cause serious trouble when resuming the system.
+BIOS setup programs should be called during bootstrap, or from DOS.
+.Pp
+Some APM implementations cannot handle events such as pushing the
+power button or closing the cover.
+On such implementations, the system
+.Ar must
+be suspended
+.Ar only
+by using
+.Xr apm 8
+or
+.Xr zzz 8 .
+.Pp
+Disk spin-down, LCD backlight control, and power on demand have not
+been supported on the current version.
diff --git a/share/man/man4/man4.i386/ce.4 b/share/man/man4/man4.i386/ce.4
new file mode 100644
index 000000000000..fec2dabcb8d7
--- /dev/null
+++ b/share/man/man4/man4.i386/ce.4
@@ -0,0 +1,111 @@
+.\" Copyright (c) 2006 Roman Kurakin <rik@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 30, 2006
+.Dt CE 4 i386
+.Os
+.Sh NAME
+.Nm ce
+.Nd "driver for synchronous Cronyx Tau-PCI/32 WAN adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ce"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ce_load="YES"
+.Ed
+.Pp
+Additional options:
+.Cd "device sppp"
+.Cd "options NETGRAPH"
+.Cd "options NETGRAPH_CRONYX"
+.Sh DESCRIPTION
+The
+.Nm
+driver needs either
+.Xr sppp 4
+or
+.Xr netgraph 4 .
+Which one to use is determined by the
+.Dv NETGRAPH_CRONYX
+option.
+If this option is present in your kernel configuration file, the
+.Nm
+driver will be compiled with
+.Xr netgraph 4
+support.
+Otherwise, it will be compiled with
+.Xr sppp 4
+support.
+.Pp
+Refer to
+.Xr sconfig 8
+for information about the
+.Nm
+adapter configuration.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following models of Tau-PCI/32 WAN adapters:
+.Pp
+.Bl -tag -width 20n -compact
+.It Cronyx Tau-PCI/32
+two fractional/unframed E1 interfaces,
+with 32 HDLC channels shared between them with total adapter throughput
+2048 kbps.
+.It Cronyx Tau-PCI/32-Lite
+single fractional/unframed E1 interface,
+with 32 HDLC channels.
+.El
+.Sh SEE ALSO
+.Xr cp 4 ,
+.Xr ctau 4 ,
+.Xr cx 4 ,
+.Xr sppp 4 ,
+.Xr ifconfig 8 ,
+.Xr sconfig 8 ,
+.Xr spppcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver was added in
+.Fx 6.2 ,
+.Fx 5.5
+and
+.Fx 4.11 .
+The
+.Nm
+driver for previous versions of
+.Fx
+is available from
+.Pa http://www.cronyx.ru/ .
diff --git a/share/man/man4/man4.i386/cp.4 b/share/man/man4/man4.i386/cp.4
new file mode 100644
index 000000000000..049bb0829749
--- /dev/null
+++ b/share/man/man4/man4.i386/cp.4
@@ -0,0 +1,113 @@
+.\" Copyright (c) 2003-2004 Roman Kurakin <rik@cronyx.ru>
+.\" Copyright (c) 2003-2004 Cronyx Engineering
+.\" All rights reserved.
+.\"
+.\" This software is distributed with NO WARRANTIES, not even the implied
+.\" warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" Authors grant any other persons or organisations a permission to use,
+.\" modify and redistribute this software in source and binary forms,
+.\" as long as this message is kept with the software, all derivative
+.\" works or modified versions.
+.\"
+.\" Cronyx Id: cp.4,v 1.1.2.5 2004/06/21 17:47:40 rik Exp $
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt CP 4 i386
+.Os
+.Sh NAME
+.Nm cp
+.Nd "driver for synchronous Cronyx Tau-PCI WAN adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device cp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cp_load="YES"
+.Ed
+.Pp
+Additional options:
+.Cd "device sppp"
+.Cd "options NETGRAPH"
+.Cd "options NETGRAPH_CRONYX"
+.Sh DESCRIPTION
+The
+.Nm
+driver needs either
+.Xr sppp 4
+or
+.Xr netgraph 4 .
+Which one to use is determined by the
+.Dv NETGRAPH_CRONYX
+option.
+If this option is present in your kernel configuration file, the
+.Nm
+driver will be compiled with
+.Xr netgraph 4
+support.
+Otherwise, it will be compiled with
+.Xr sppp 4
+support.
+.Pp
+Refer to
+.Xr sconfig 8
+for information about the
+.Nm
+adapter configuration.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following models of Tau-PCI WAN adapters:
+.Pp
+.Bl -tag -width 20n -compact
+.It Cronyx Tau-PCI
+V.35 and RS-232 interfaces
+.It Cronyx Tau-PCI/R
+RS-530(RS-449) and X.21 interfaces
+.It Cronyx Tau-PCI-L
+one V.35 and RS-232 interface, low profile
+.It Cronyx Tau-PCI-L/R
+one RS-530(RS-449) and X.21 interface, low profile
+.It Cronyx Tau-PCI-E1
+fractional E1 interfaces
+.It Cronyx Tau-PCI-G703
+unframed E1 interfaces
+.It Cronyx Tau-PCI-2E1
+fractional E1 and unframed E1 interfaces
+.It Cronyx Tau-PCI-4E1
+fractional E1 and unframed E1 interfaces
+.It Cronyx Tau-PCI-E3
+E3 interface
+.It Cronyx Tau-PCI-T3
+T3 interface
+.It Cronyx Tau-PCI-STS1
+STS-1 interface
+.El
+.Sh SEE ALSO
+.Xr ctau 4 ,
+.Xr cx 4 ,
+.Xr sppp 4 ,
+.Xr ifconfig 8 ,
+.Xr sconfig 8 ,
+.Xr spppcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver was added in
+.Fx 5.3
+and
+.Fx 4.11 .
+The
+.Nm
+driver for previous versions of
+.Fx
+is available from
+.Pa http://www.cronyx.ru/ .
diff --git a/share/man/man4/man4.i386/cs.4 b/share/man/man4/man4.i386/cs.4
new file mode 100644
index 000000000000..b7e038934f6a
--- /dev/null
+++ b/share/man/man4/man4.i386/cs.4
@@ -0,0 +1,152 @@
+.\"
+.\" Copyright (c) 1998 Michael Smith
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt CS 4 i386
+.Os
+.Sh NAME
+.Nm cs
+.Nd "Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device cs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cs_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.cs.0.at="isa"
+.Cd hint.cs.0.port="0x300"
+.Cd hint.cs.0.irq="10"
+.Cd hint.cs.0.maddr="0xd000"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for ISA Ethernet adapters based on the
+.Tn Crystal Semiconductor CS8900
+and
+.Tn CS8920
+NICs.
+These devices are used on the
+.Tn IBM EtherJet ISA
+adapters and in many embedded applications where the high integration, small
+size and low cost of the CS89x0 family compensate for their drawbacks.
+.Pp
+The
+.Nm
+driver will obtain configuration parameters either from
+.Pa /boot/device.hints
+or from the card.
+At least the I/O port number must be specified.
+Other parameters specified in
+.Pa /boot/device.hints
+will be used if present;
+the card may be soft-configured so these may be any valid
+value.
+Adapters based on the CS8920 normally offer PnP configuration and the driver
+will detect the
+.Tn IBM EtherJet
+and the
+.Tn CSC6040
+adapters automatically.
+.Pp
+Note that the CS8900 is limited to 4 IRQ values; these are normally implemented
+as 5, 10, 11 and 12.
+The CS8920 has no such limitation.
+.Pp
+Memory-mapped and DMA operation are not supported at this time.
+.Pp
+In addition to the ISA devices, the PC Card devices based on the CS889x0
+family are also supported.
+The IBM EtherJet PCMCIA Card is the only known device based on this
+chip.
+The PC Card support does not need the above specific ISA hints to work.
+The PC Card support may not work for 10base2 (thinnet) connections and may
+bogusly claim to support 10base5 (there are no known cards that have an
+AUI necessary for 10base5 support on their dongles).
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "cs%d: full/half duplex negotiation timeout"
+The attempt to negotiate duplex settings with the hub timed out.
+This may
+indicate a cabling problem or a faulty or incompatible hub.
+.It "cs%d: failed to enable <media>"
+The CS89x0 failed to select the nominated media, either because it is not
+present or not operating correctly.
+.It "cs%d: No EEPROM, assuming defaults"
+The CS89x0 does not have an EEPROM, or the EEPROM is hopelessly damaged.
+Operation
+will only be successful if the configuration entry lists suitable values for
+the adapter.
+.It "cs%d: Invalid irq"
+The IRQ specified in the configuration entry is not valid for the adapter.
+.It "cs%d: Could not allocate memory for NIC"
+There is a critical memory shortage.
+The adapter will not function.
+.It "cs%d: Adapter has no media"
+The adapter is not configured for a specific media type.
+The media type will have
+to be manually set.
+.It "This is a %s, but LDN %d is disabled"
+The PnP probe code found a recognised adapter, but the adapter is disabled.
+.It "failed to read pnp parms"
+A PnP adapter was found, but configuration parameters for it could not be read.
+.It "failed to pnp card parameters"
+The parameters obtained via PnP were not accepted by the driver.
+The adapter
+may not function.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Maxim Bolotin
+and
+.An Oleg Sharoiko .
+This manpage was written by
+.An Michael Smith .
+.Sh CAVEATS
+The CS89x0 family of adapters have a very small RAM buffer (4K).
+This may
+cause problems with extremely high network loads or bursty network traffic.
+In particular, NFS operations should be limited to 1k read/write transactions
+in order to avoid overruns.
diff --git a/share/man/man4/man4.i386/ct.4 b/share/man/man4/man4.i386/ct.4
new file mode 100644
index 000000000000..ac8d6c2ae1e8
--- /dev/null
+++ b/share/man/man4/man4.i386/ct.4
@@ -0,0 +1,162 @@
+.\" Copyright (c) 2003 Noriaki MITSUNAGA. All rights reserved.
+.\" Copyright (c) 2003 Hideyuki KURASHINA. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 18, 2003
+.Dt CT 4 i386
+.Os
+.Sh NAME
+.Nm ct
+.Nd "WD33C93[ABC] based CBUS SCSI host adapter driver"
+.Sh SYNOPSIS
+.Cd "device ct"
+.Cd "device scbus"
+.Pp
+In
+.Pa /boot/device.hints:
+.Pp
+For most PC-9801-55, -92 and compatibles:
+.Cd hint.ct.0.at="isa"
+.Pp
+For ELECOM bus-master
+.Tn SCSI
+adapters:
+.Cd hint.ct.0.at="isa"
+.Cd hint.ct.0.flags="0x30000"
+.Pp
+For I-O DATA SC98 adapters:
+.Cd hint.ct.0.at="isa"
+.Cd hint.ct.0.flags="0x10000"
+.Pp
+For LOGITEC adapters:
+.Cd hint.ct.0.at="isa"
+.Cd hint.ct.0.flags="0x50000"
+.Pp
+For TEXA adapters:
+.Cd hint.ct.0.at="isa"
+.Cd hint.ct.0.flags="0x20000"
+.Pp
+For adapters with SMIT transfer mode to enable SMIT transfer:
+.Cd hint.ct.0.at="isa"
+.Cd hint.ct.0.flags="0x40000"
+.Cd hint.ct.0.maddr="0xdc000"
+.Pp
+Flags meaning:
+.Bl -tag -offset indent -compact -width 0x000000
+.It 0x00000
+DMA transfer mode for an NEC PC-9801-55, -92 (or
+compatibles), ICM IF-2660, Midori-Denshi MDC-554NA, or
+Logitec LHA-N151
+.It 0x10000
+DMA transfer mode for an I-O DATA SC-98II
+.It 0x20000
+bus-master transfer mode for a TEXA HA-55BS2, its
+successors, or Midori-Denshi MDC-926R
+.It 0x30000
+bus-master transfer mode for an ELECOM bus-master SCSI
+adapter
+.It 0x40000
+SMIT transfer mode (for supported adapters only)
+.It 0x50000
+bus-master transfer mode for a Logitec LHA-20x series,
+ICM IF-2766, IF-2766ET, IF-2767 or IF-2769
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the
+.Tn SCSI
+bus connected to a WD33C93[ABC] based host adapter.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+ELECOM bus-master
+.Tn SCSI
+adapters
+.It
+I-O DATA SC-98II
+.It
+ICM IF-2660, IF-2766, IF-2766ET, IF-2767 and IF-2769
+.It
+Logitec LHA-N151 and LHA-20x series
+.It
+Midori-Denshi MDC-554NA and MDC-926R
+.It
+NEC PC-9801-55, 92 and compatibles
+.It
+SMIT transfer type
+.Tn SCSI
+host adapters
+.It
+TEXA HA-55BS2 and its later models
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr ctau 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh NOTES
+Historically, the driver for the Cronyx Tau WAN adapters was
+.Dq ct .
+This device name was changed to
+.Dq ctau
+to avoid conflicts
+with this pc98
+.Nm
+driver.
+The network device name for
+.Xr ctau 4
+is
+.Dq Li ct .
+Please see
+.Xr ctau 4
+for the details for that device.
+.Sh HISTORY
+The
+.Nm
+device driver has been developed for
+.Nx Ns /pc98
+and ported for
+.Fx .
+It first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Naofumi HONDA .
+.Pp
+This manual page was written by
+.An -nosplit
+.An Noriaki MITSUNAGA Aq non@FreeBSD.org
+and
+.An Hideyuki KURASHINA Aq rushani@FreeBSD.org .
diff --git a/share/man/man4/man4.i386/ctau.4 b/share/man/man4/man4.i386/ctau.4
new file mode 100644
index 000000000000..e18dc347ad32
--- /dev/null
+++ b/share/man/man4/man4.i386/ctau.4
@@ -0,0 +1,119 @@
+.\" Copyright (c) 2004 Roman Kurakin <rik@cronyx.ru>
+.\" Copyright (c) 2004 Cronyx Engineering
+.\" All rights reserved.
+.\"
+.\" This software is distributed with NO WARRANTIES, not even the implied
+.\" warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" Authors grant any other persons or organisations a permission to use,
+.\" modify and redistribute this software in source and binary forms,
+.\" as long as this message is kept with the software, all derivative
+.\" works or modified versions.
+.\"
+.\" Cronyx Id: ct.4,v 1.1.2.6 2004/06/21 17:56:40 rik Exp $
+.\" $FreeBSD$
+.\"
+.Dd September 6, 2004
+.Dt CTAU 4 i386
+.Os
+.Sh NAME
+.Nm ctau
+.Nd driver for synchronous Cronyx Tau WAN adapters
+.Sh SYNOPSIS
+.Cd "device ctau"
+.Pp
+Additional options:
+.Cd "device sppp"
+.Cd "options NETGRAPH"
+.Cd "options NETGRAPH_CRONYX"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.ctau.0.at="isa"
+.Cd hint.ctau.0.port="0x240"
+.Cd hint.ctau.0.irq="15"
+.Cd hint.ctau.0.drq="7"
+.Sh DESCRIPTION
+The
+.Nm
+driver needs either
+.Xr sppp 4
+or
+.Xr netgraph 4 .
+Which one to use is determined by the
+.Dv NETGRAPH_CRONYX
+option.
+If this option is present in your kernel configuration file, the
+.Nm
+driver will be compiled with
+.Xr netgraph 4
+support.
+Otherwise, it will be compiled with
+.Xr sppp 4
+support.
+.Pp
+The base I/O port address specified in
+.Pa /boot/device.hints
+must match the port address set by the jumpers on the board.
+The DMA I/O channel and interrupt request numbers are configured
+by software at adapter initialization.
+Legal values are:
+.Pp
+.Bl -tag -compact -width Port:
+.It Port :
+0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0,
+0x300, 0x320, 0x340, 0x360, 0x380, 0x3a0, 0x3c0, 0x3e0
+.It IRQ :
+3, 5, 7, 10, 11, 12, 15
+.It DMA :
+5, 6, 7
+.El
+.Pp
+The
+.Nm
+driver supports autodetection.
+As for all non-PNP hardware, using
+autodetection could lead to some potential problems with other devices during
+the hardware detection process.
+It is always better to specify hardware resources manually.
+.Pp
+Refer to
+.Xr sconfig 8
+for information about the
+.Nm
+adapter configuration.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+Cronyx Tau (RS-232/V.35)
+.It
+Cronyx Tau/R (RS-530/RS-449)
+.It
+Cronyx Tau/E1 (fractional E1)
+.It
+Cronyx Tau/G703 (unframed E1)
+.El
+.Sh SEE ALSO
+.Xr cp 4 ,
+.Xr cx 4 ,
+.Xr sppp 4 ,
+.Xr ifconfig 8 ,
+.Xr sconfig 8 ,
+.Xr spppcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver was added in
+.Fx 5.3
+and
+.Fx 4.10 .
+The
+.Nm
+driver for previous versions of
+.Fx
+is available from
+.Pa http://www.cronyx.ru/ .
diff --git a/share/man/man4/man4.i386/cx.4 b/share/man/man4/man4.i386/cx.4
new file mode 100644
index 000000000000..00df603b5941
--- /dev/null
+++ b/share/man/man4/man4.i386/cx.4
@@ -0,0 +1,139 @@
+.\" Copyright (c) 2003-2004 Roman Kurakin <rik@cronyx.ru>
+.\" Copyright (c) 2003-2004 Cronyx Engineering
+.\" All rights reserved.
+.\"
+.\" This software is distributed with NO WARRANTIES, not even the implied
+.\" warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" Authors grant any other persons or organisations a permission to use,
+.\" modify and redistribute this software in source and binary forms,
+.\" as long as this message is kept with the software, all derivative
+.\" works or modified versions.
+.\"
+.\" Cronyx Id: cx.4,v 1.1.2.6 2004/06/21 17:56:40 rik Exp $
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt CX 4 i386
+.Os
+.Sh NAME
+.Nm cx
+.Nd "driver for synchronous/asynchronous Cronyx Sigma WAN adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device cx"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cx_load="YES"
+.Ed
+.Pp
+Additional options:
+.Cd "device sppp"
+.Cd "options NETGRAPH"
+.Cd "options NETGRAPH_CRONYX"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.cx.0.at="isa"
+.Cd hint.cx.0.port="0x240"
+.Cd hint.cx.0.irq="15"
+.Cd hint.cx.0.drq="7"
+.Sh DESCRIPTION
+The
+.Nm
+driver needs either
+.Xr sppp 4
+or
+.Xr netgraph 4 .
+Which one to use is determined by the
+.Dv NETGRAPH_CRONYX
+option.
+If this option is present in your kernel configuration file, the
+.Nm
+driver will be compiled with
+.Xr netgraph 4
+support.
+Otherwise, it will be compiled with
+.Xr sppp 4
+support.
+.Pp
+The base I/O port address specified in
+.Pa /boot/device.hints
+must match the port address set by the jumpers on the board.
+The DMA I/O channel and interrupt request numbers are configured
+by software at adapter initialization.
+Legal values are:
+.Pp
+.Bl -tag -compact -width Port:
+.It Port :
+0x240, 0x260, 0x280, 0x300, 0x320, 0x380
+.It IRQ :
+3, 5, 7, 10, 11, 12, 15
+.It DMA :
+5, 6, 7
+.El
+.Pp
+The
+.Nm
+driver supports autodetection.
+As for all non-PNP hardware, using
+autodetection could lead to some potential problems with other devices during
+the hardware detection process.
+It is always better to specify hardware resources manually.
+.Pp
+Refer to
+.Xr sconfig 8
+for information about the
+.Nm
+adapter configuration.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+Cronyx Sigma-22, Sigma-24
+.It
+Cronyx Sigma-100
+.It
+Cronyx Sigma-400, Sigma-401, Sigma-404, Sigma-410, Sigma-440
+.It
+Cronyx Sigma-500
+.It
+Cronyx Sigma-703
+.It
+Cronyx Sigma-800, Sigma-801, Sigma-810, Sigma-840
+.El
+.Sh SEE ALSO
+.Xr cp 4 ,
+.Xr ctau 4 ,
+.Xr sppp 4 ,
+.Xr ifconfig 8 ,
+.Xr sconfig 8 ,
+.Xr spppcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver was updated in
+.Fx 5.2
+and
+.Fx 4.10 .
+In most of the previous versions of
+.Fx
+the
+.Nm
+driver is out of date.
+The
+.Nm
+driver for previous versions of
+.Fx
+is available from
+.Pa http://www.cronyx.ru/ .
diff --git a/share/man/man4/man4.i386/ep.4 b/share/man/man4/man4.i386/ep.4
new file mode 100644
index 000000000000..6524ef781192
--- /dev/null
+++ b/share/man/man4/man4.i386/ep.4
@@ -0,0 +1,212 @@
+.\"
+.\" Copyright (c) 1994 Herb Peyerl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Herb Peyerl
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 1, 2011
+.Dt EP 4 i386
+.Os
+.Sh NAME
+.Nm ep
+.Nd "Ethernet driver for 3Com Etherlink III (3c5x9) interfaces"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ep"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ep_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports network adapters based on the 3Com 3C5x9 Etherlink III
+Parallel Tasking chipset.
+.Pp
+Various models of these cards come with a different assortment of
+connectors:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It AUI/DIX
+Standard 15 pin connector, also known as 10base5 (thick-net)
+.It 10Base2
+BNC, also known as thin-net
+.It 10BaseT
+UTP, also known as twisted pair
+.El
+.Pp
+The default port to use is the port that has been selected with the
+setup utility.
+To override this, use the following media options with
+.Xr ifconfig 8
+or in your
+.Pa /etc/rc.conf
+file.
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It 10base5/AUI
+Use the AUI port.
+.It 10base2/BNC
+Use the BNC port.
+.It 10baseT/UTP
+Use the UTP port.
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports Ethernet adapters based on the
+3Com 3C5x9 Etherlink III Parallel Tasking chipset, including:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3C1 CF
+.It
+3Com 3C509-TP, 3C509-BNC, 3C509-Combo, 3C509-TPO, 3C509-TPC ISA
+.It
+3Com 3C509B-TP, 3C509B-BNC, 3C509B-Combo, 3C509B-TPO, 3C509B-TPC ISA
+.It
+3Com 3C529, 3C529-TP MCA
+.It
+3Com 3C562/3C563 PCMCIA
+.It
+3Com 3C569B-J-TPO, 3C569B-J-COMBO CBUS
+.It
+3Com 3C574, 3C574TX, 3C574-TX, 3CCFE574BT, 3CXFE574BT, 3C3FE574BT PCMCIA
+.It
+3Com 3C579-TP, 3C579-BNC EISA
+.It
+3Com 3C589, 3C589B, 3C589C, 3C589D, 3CXE589DT PCMCIA
+.It
+3Com 3CCFEM556B, 3CCFEM556BI PCMCIA
+.It
+3Com 3CXE589EC, 3CCE589EC, 3CXE589ET, 3CCE589ET PCMCIA
+.It
+3Com Megahertz 3CCEM556, 3CXEM556, 3CCEM556B, 3CXEM556B, 3C3FEM556C PCMCIA
+.It
+3Com OfficeConnect 3CXSH572BT, 3CCSH572BT PCMCIA
+.It
+Farallon EtherWave and EtherMac PC Card (P/n 595/895 with BLUE arrow)
+.El
+.Sh NOTES
+The 3c509 card has no jumpers to set the address.
+3Com supplies software to set the address of the card in software.
+To find the card on the ISA bus, the kernel performs a complex
+scan operation at IO address 0x110.
+Beware!
+Avoid placing other cards at that address!
+.Pp
+Furthermore, the 3c509 should only be configured in EISA mode
+when installed in a computer that has actual EISA slots
+(and an EISA-aware BIOS).
+The normal driver auto-detection support is sufficient for non-EISA systems.
+.Pp
+Cards in PnP mode may conflict with other resources in the system.
+Ensure your BIOS is configured correctly to exclude resources used by
+the 3c509, especially IRQs, to avoid unpredictable behavior.
+.Pp
+Many different companies sold the 3Com PC Cards under their own private
+label.
+These cards also work.
+.Pp
+The Farallon EtherWave and EtherMac card came in two varieties.
+The
+.Nm
+driver supports the 595 and 895 cards.
+These cards have the blue arrow on the front along with a 3Com logo.
+The Farallon 595a cards, which have a red arrow on the front,
+are also called EtherWave and EtherMac.
+They are supported by the
+.Xr sn 4
+driver.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ep0: reset (status: %x)"
+The driver has encountered a FIFO underrun or overrun.
+The driver will reset the card and the packet will be lost.
+This is not fatal.
+.It "ep0: eeprom failed to come ready"
+The eeprom failed to come ready.
+This probably means the card is wedged.
+.It "ep0: 3c509 in test mode. Erase pencil mark!"
+This means that someone has scribbled with pencil
+in the test area on the card.
+Erase the pencil mark and reboot.
+(This is not a joke).
+.It "ep0: No I/O space?!"
+The driver was unable to allocate the I/O space that it thinks
+should be there.
+Look for conflicts with other devices.
+.It "ep0: No irq?!"
+The driver could not allocate the interrupt it wanted.
+Look for conflicts, although sharing interrupts for PC Card is normal.
+.It "ep0: No connectors!"
+The driver queried the hardware for what ethernet attachment were
+present, but the hardware reported none that the driver recognized.
+.It "ep0: Unable to get Ethernet address!"
+The driver was unable to read the ethernet address from the EEPROM.
+This is likely the result of the card being wedged.
+.It "ep0: if_alloc() failed"
+The driver was unable to allocate a ifnet structure.
+This may happen in extremely low memory conditions.
+.It "ep0: strange connector type in EEPROM: assuming AUI"
+The driver does not know what to do with the information the EEPROM
+has about connectors, so it is assuming the worst.
+.It "ep0: unknown ID 0xXXXXXXXX"
+The driver has found an ID that it believes it supports, but does not
+have a specific identification string to present to the user.
+.It "ep0: <%s> at port 0x%03x in EISA mode"
+The 3C509 ISA card is in EISA mode.
+This message appears to be purely informational.
+.It "ep0: <%s> at x0%03x in PnP mode"
+This card appears to be in Plug and Play mode.
+It should be probed as part of the plug and play phase of the ISA
+probes.
+.It "ep0: Invalid EEPROM checksum!"
+The EEPROM has a bad checksum, so the driver is ignoring the card.
+.It "ep0: bus_setup_intr() failed!"
+The driver was unable to setup the interrupt handler.
+This should never happen.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr ed 4 ,
+.Xr el 4 ,
+.Xr ie 4 ,
+.Xr intro 4 ,
+.Xr ng_ether 4 ,
+.Xr sn 4 ,
+.Xr vx 4 ,
+.Xr ifconfig 8
+.Sh STANDARDS
+are great.
+There is so many to choose from.
diff --git a/share/man/man4/man4.i386/ex.4 b/share/man/man4/man4.i386/ex.4
new file mode 100644
index 000000000000..3ffb3fcf661b
--- /dev/null
+++ b/share/man/man4/man4.i386/ex.4
@@ -0,0 +1,119 @@
+.\"
+.\" Copyright (c) 1997 David E. O'Brien
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt EX 4 i386
+.Os
+.Sh NAME
+.Nm ex
+.Nd "Ethernet device driver for the Intel EtherExpress Pro/10 and Pro/10+"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ex"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ex_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Ethernet adapters based on the Intel
+i82595 chip.
+.Pp
+On the ISA bus, the card will be searched for in the
+I/O address range 0x200 - 0x3a0.
+The IRQ will be read from the EEPROM on the card.
+For correct operation Plug-N-Play support should be disabled.
+.Pp
+On the PC Card bus, the card will be automatically recognized and
+configured.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following Ethernet adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Intel EtherExpress Pro/10 ISA
+.It
+Intel EtherExpress Pro/10+ ISA
+.It
+Olicom OC2220 Ethernet PC Card
+.It
+Olicom OC2232 Ethernet/Modem PC Card
+.It
+Silicom Ethernet LAN PC Card
+.It
+Silicom EtherSerial LAN PC Card
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ex%d: Intel EtherExpress Pro/10, address %6D, connector %s"
+The device probe found an installed card, and was able to correctly install
+the device driver.
+.It "ex%d: WARNING: board's EEPROM is configured for IRQ %d, using %d"
+The device probe detected that the board is configured for a different
+interrupt than the one specified in the kernel configuration file.
+.It "ex%d: invalid IRQ."
+The device probe detected an invalid IRQ setting.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Javier Mart\('in Rueda .
+The PC Card attachment was written by
+.An Mitsuru ISAWAKI
+and
+.An Warner Losh .
+This manual page was written by
+.An David E. O'Brien .
+.Sh BUGS
+Currently the driver does not support multicast.
+.Pp
+The Silicom EtherSerial card's serial port does not currently work.
+The Olicom OC2232 PC Card should work with the
+.Nm
+driver, but is currently completely broken.
diff --git a/share/man/man4/man4.i386/fe.4 b/share/man/man4/man4.i386/fe.4
new file mode 100644
index 000000000000..22bbf2a6a648
--- /dev/null
+++ b/share/man/man4/man4.i386/fe.4
@@ -0,0 +1,318 @@
+.\" All Rights Reserved, Copyright (C) Fujitsu Limited 1995
+.\"
+.\" This document may be used, modified, copied, distributed, and sold, in
+.\" both source and printed form provided that the above copyright, these
+.\" terms and the following disclaimer are retained. The name of the author
+.\" and/or the contributor may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS DOCUMENT IS PROVIDED BY THE AUTHOR AND THE CONTRIBUTOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS DOCUMENT, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Contributed by M. Sekiguchi <seki@sysrap.cs.fujitsu.co.jp>.
+.\" for fe driver.
+.\"
+.\" $FreeBSD$
+.Dd July 16, 2005
+.Dt FE 4 i386
+.Os
+.Sh NAME
+.Nm fe
+.Nd "Fujitsu MB86960A/MB86965A based Ethernet adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device fe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_fe_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.fe.0.at="isa"
+.Cd hint.fe.0.port="0x300"
+.Cd hint.fe.0.flags="0x0"
+.Sh DESCRIPTION
+The
+.Nm
+is a network device driver
+for Ethernet adapters based on Fujitsu MB86960A, MB86965A,
+or other compatible chips.
+.Pp
+The driver provides automatic I/O port address configuration and
+automatic IRQ configuration,
+when used with suitable adapter hardware.
+.Pp
+The driver works with program I/O data transfer technique.
+It gives a fair performance.
+Shared memory is never used, even if the adapter has one.
+.Pp
+It currently works with Fujitsu FMV-180 series for ISA,
+Allied-Telesis AT1700 series and RE2000 series for ISA,
+and Fujitsu MBH10302 PC card.
+.Ss Parameters
+In the
+.Pa /boot/device.hints
+file, two parameters,
+.Ar port
+and
+.Ar irq ,
+must be specified to reflect adapter hardware settings.
+Another parameter
+.Ar flags
+can be specified to provide additional configuration as an option.
+.Pp
+The
+.Ar port
+parameter specifies a base I/O port address of the adapter.
+It must match with the hardware setting of the adapter.
+The
+.Ar port
+may be left unspecified by removing
+.Dl hint.fe.0.port="..."
+from the file.
+In that case, the driver tries to detect the hardware setting
+of the I/O address automatically.
+This feature may not work with some adapter hardware.
+.Pp
+The
+.Ar irq
+parameter specifies an IRQ number used by the adapter.
+It must match the hardware setting of the adapter.
+.Ar Irq
+may be left unspecified by removing
+.Dl hint.fe.0.irq="..."
+from the file.
+in that case, the driver tries to detect
+the hardware setting of the IRQ automatically.
+This feature may not work on some adapters.
+.Pp
+The
+.Ar flags
+is a numeric value which consists of a combination of various device settings.
+The following flags are defined in the current version.
+To specify two or more settings for a device,
+use a numeric sum of each flag value.
+Flag bits not specified below are reserved and must be set to 0.
+Actually, each bit is either just ignored by the driver,
+or tested and used to control undocumented features of the driver.
+Consult the source program for undocumented features.
+.Bl -tag -width 8n
+.It Li 0x007F
+These flag bits are used
+to initialize DLCR6 register of MB86960A/MB86965A chip,
+when the
+.Li 0x0080
+bit of the
+.Ar flags
+is set.
+See below for more about DLCR6 override feature.
+The
+.Li 0x007F
+flag bits must be 0 unless the
+.Li 0x0080
+bit is set,
+to maintain the compatibility with future versions of the driver.
+.It Li 0x0080
+This flag overrides the default setting to the DLCR6 register
+of MB86960A/MB86965A chip by a user supplied value,
+which is taken from the lower 7 bits of the flag value.
+This is a troubleshooting flag and should not be used
+without understanding of the adapter hardware.
+Consult the Fujitsu manual for more information
+on DLCR6 settings.
+.El
+.Sh HARDWARE
+Controllers and cards supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Allied Telesis RE1000, RE1000Plus, ME1500 (110-pin)
+.It
+CONTEC C-NET(98)P2, C-NET (9N)E (110-pin), C-NET(9N)C (ExtCard)
+.It
+CONTEC C-NET(PC)C PC Card Ethernet
+.It
+Eagle Tech NE200T
+.It
+Eiger Labs EPX-10BT
+.It
+Fujitsu FMV-J182, FMV-J182A
+.It
+Fujitsu MB86960A, MB86965A
+.It
+Fujitsu MBH10303, MBH10302 PC Card Ethernet
+.It
+Fujitsu Towa LA501 Ethernet
+.It
+HITACHI HT-4840-11 PC Card Ethernet
+.It
+NextCom J Link NC5310
+.It
+RATOC REX-5588, REX-9822, REX-4886, and REX-R280
+.It
+RATOC REX-9880/9881/9882/9883
+.It
+TDK LAC-98012, LAC-98013, LAC-98025, LAC-9N011 (110-pin)
+.It
+TDK LAK-CD011, LAK-CD021, LAK-CD021A, LAK-CD021BX
+.It
+Ungermann-Bass Access/PC N98C+(PC85152, PC85142), Access/NOTE
+N98(PC86132) (110-pin)
+.El
+.Sh FEATURES SPECIFIC TO HARDWARE MODELS
+The
+.Nm
+driver has some features and limitations
+which depend on adapter hardware models.
+The following is a summary of these dependencies.
+.Ss Fujitsu FMV-180 series adapters
+Both automatic IRQ detection and automatic I/O port address detection
+is available with these adapters.
+.Pp
+Automatic I/O port address detection feature of
+.Nm
+works mostly fine for FMV-180 series.
+It works even if there are two or more FMV-180s in a system.
+However, some combination of other adapters may confuse the driver.
+It is recommended to explicitly specify
+.Ar port
+when you experience some difficulties with hardware probe.
+.Pp
+Automatic IRQ detection feature of
+.Nm
+works reliably for FMV-180 series.
+It is recommended to explicitly specify
+.Ar irq
+always for FMV-180.
+The hardware setting of IRQ is read
+from the configuration EEPROM on the adapter,
+even when the kernel config file specifies an IRQ value.
+The driver will generate a warning message,
+if the IRQ setting specified in
+.Pa /boot/device.hints
+does not match one stored in EEPROM.
+Then, it will use the value specified in the file.
+(This behavior has been changed from the previous releases.)
+.Ss Allied-Telesis AT1700 series and RE2000 series adapters
+Automatic I/O port address detection
+is available with Allied-Telesis AT1700 series and RE2000 series,
+while it is less reliable than FMV-180 series.
+Using the feature with Allied-Telesis adapters
+is not recommended.
+.Pp
+Automatic IRQ detection is also available with some limitation.
+The
+.Nm
+driver
+tries to get IRQ setting from the configuration EEPROM on the board,
+if
+.Ar irq
+is not specified in
+.Pa /boot/device.hints .
+Unfortunately,
+AT1700 series and RE2000 series seems to have two types of models;
+One type allows IRQ selection from 3/4/5/9,
+while the other from 10/11/12/15.
+Identification of the models are not well known.
+Hence, automatic IRQ detection with Allied-Telesis adapters
+may not be reliable.
+Specify an exact IRQ number if any troubles are encountered.
+.Pp
+Differences between AT1700 series and RE2000 series
+or minor models in those series are not recognized.
+.Ss Fujitsu MBH10302 PC card
+The
+.Nm
+driver supports Fujitsu MBH10302 and compatible PC cards.
+It requires the PC card (PCMCIA) support package.
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr ed 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 2.0.5 .
+.Sh AUTHORS, COPYRIGHT AND DISCLAIMER
+The
+.Nm
+driver was originally written and contributed by
+.An M. Sekiguchi Aq seki@sysrap.cs.fujitsu.co.jp ,
+following the
+.Nm ed
+driver written by
+.An David Greenman .
+PC card support in
+.Nm
+is written by
+.An Hidetoshi Kimura Aq h-kimura@tokyo.se.fujitsu.co.jp .
+This manual page was written by
+.An M. Sekiguchi .
+.Pp
+.Em "All Rights Reserved, Copyright (C) Fujitsu Limited 1995"
+.Pp
+This document and the associated software may be used, modified,
+copied, distributed, and sold, in both source and binary form provided
+that the above copyright, these terms and the following disclaimer are
+retained.
+The name of the author and/or the contributor may not be
+used to endorse or promote products derived from this document and the
+associated software without specific prior written permission.
+.Pp
+THIS DOCUMENT AND THE ASSOCIATED SOFTWARE IS PROVIDED BY THE AUTHOR
+AND THE CONTRIBUTOR
+.Dq AS IS
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR OR THE
+CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+DOCUMENT AND THE ASSOCIATED SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+.Sh BUGS
+Following are major known bugs:
+.Pp
+Statistics on the number of collisions maintained by the
+.Nm
+driver is not accurate;
+the
+.Fl i
+option of
+.Xr netstat 1
+shows slightly less value than true number of collisions.
+.Pp
+More mbuf clusters are used than expected.
+The packet receive routine has an intended violation
+against the mbuf cluster allocation policy.
+The unnecessarily allocated clusters are freed within short lifetime,
+and it will not affect long term kernel memory usage.
+.Pp
+Although XNS and IPX support is included in the driver,
+it has never been tested and it is expected to have a lot of bugs.
diff --git a/share/man/man4/man4.i386/glxiic.4 b/share/man/man4/man4.i386/glxiic.4
new file mode 100644
index 000000000000..30d3ffe98de8
--- /dev/null
+++ b/share/man/man4/man4.i386/glxiic.4
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2011 Henrik Brix Andersen <brix@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2011
+.Dt GLXIIC 4 i386
+.Os
+.Sh NAME
+.Nm glxiic
+.Nd Geode LX CS5536 I2C controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device isa"
+.Cd "device glxiic"
+.Cd "device iicbus"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+glxiic_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the System Management Bus controller of the Geode LX
+series CS5536 Companion Device. The Geode LX is a member of the AMD
+Geode family of integrated x86 system chips.
+.Pp
+Although AMD refers to this device as a System Management Bus (SMBus)
+controller, it is really an I2C controller (it lacks SMBus ALERT# and
+Alert Response support).
+.Pp
+The
+.Nm
+driver supports both I2C master and slave mode.
+.Sh SYSCTL VARIABLE
+The
+.Nm
+driver supports the following variable as both
+.Xr sysctl 8
+and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.glxiic.0.timeout
+This variable controls the I2C bus timeout in milliseconds. The
+default timeout is 35 milliseconds. A value of zero disables the
+timeout.
+.El
+.Sh CAVEAT
+The
+.Nm
+driver uses the interrupt line number configured by the board firmware
+by default. If no interrupt line number has been configured by the
+board firmware (or to override the interrupt line number configured by
+board firmware), place the following line in
+.Xr device.hints 5 :
+.Bd -ragged -offset indent
+hint.glxiic.0.irq="10"
+.Ed
+.Pp
+The interrupt line number must be between 1 and 15.
+.Sh SEE ALSO
+.Xr iicbus 4 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr loader 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver and manual page first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver and manual page were written by
+.An Henrik Brix Andersen Aq brix@FreeBSD.org .
diff --git a/share/man/man4/man4.i386/glxsb.4 b/share/man/man4/man4.i386/glxsb.4
new file mode 100644
index 000000000000..fb2669f10478
--- /dev/null
+++ b/share/man/man4/man4.i386/glxsb.4
@@ -0,0 +1,97 @@
+.\" $OpenBSD: glxsb.4,v 1.5 2007/05/31 19:19:54 jmc Exp $
+.\"
+.\"Copyright (c) 2006 Tom Cosgrove <tom@openbsd.org>
+.\"
+.\"Permission to use, copy, modify, and distribute this software for any
+.\"purpose with or without fee is hereby granted, provided that the above
+.\"copyright notice and this permission notice appear in all copies.
+.\"
+.\"THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\"WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\"MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\"ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\"OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 8, 2008
+.Dt GLXSB 4 i386
+.Os
+.Sh NAME
+.Nm glxsb
+.Nd Geode LX Security Block crypto accelerator
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device glxsb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+glxsb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the security block of the Geode LX series processors.
+The Geode LX is a member of the AMD Geode family
+of integrated x86 system chips.
+.Pp
+Driven by periodic checks for available data from the generator,
+.Nm
+supplies entropy to the
+.Xr random 4
+driver for common usage.
+.Pp
+.Nm
+also supports acceleration of AES-128-CBC operations for
+.Xr crypto 4 .
+It also registers itself to accelerate other HMAC algorithms, although
+there is no hardware acceleration for those algorithms.
+This is only needed so
+.Nm
+can work with
+.Xr ipsec 4 .
+.Sh CAVEAT
+The
+.Xr crypto 9
+framework will fail to open the crypto session on the device if the AES
+key's length is != 128 bits.
+This prevents the use of the
+.Nm
+device driver with AES keys of length != 128 bits.
+.Sh SEE ALSO
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr pci 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 4.1 .
+The
+.Nm
+device driver was imported into
+.Fx 7.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written for
+.Ox
+by
+.An Tom Cosgrove .
+It was ported to
+.Fx
+by
+.An Patrick Lamaiziere Aq patfbsd@davenulle.org .
diff --git a/share/man/man4/man4.i386/ie.4 b/share/man/man4/man4.i386/ie.4
new file mode 100644
index 000000000000..2ef9d05669ff
--- /dev/null
+++ b/share/man/man4/man4.i386/ie.4
@@ -0,0 +1,143 @@
+.\"
+.\" Copyright (c) 1994, Wilko Bulte
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt IE 4 i386
+.Os
+.Sh NAME
+.Nm ie
+.Nd "Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ie"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ie_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.ie.0.at="isa"
+.Cd hint.ie.0.port="0x300"
+.Cd hint.ie.0.irq="5"
+.Cd hint.ie.0.maddr="0xd0000"
+.Sh HARDWARE
+The
+.Nm
+driver provides supports the following 8 and 16bit ISA Ethernet cards
+that are based on the Intel i82586 chip:
+.Pp
+.Bl -bullet -compact
+.It
+3COM 3C507
+.It
+AT&T EN100
+.It
+AT&T Starlan 10
+.It
+AT&T Starlan Fiber
+.It
+Intel EtherExpress 16
+.It
+RACAL Interlan NI5210
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ie%d: unknown board type code %d"
+An i82586 chip was found, but the driver was unable to determine the actual
+board type during the probe.
+.It "ie%d: kernel configured maddr %x doesn't match board configured maddr %x"
+The device probe detected a different maddr than the one specified in the
+kernel configuration file.
+.It "ie%d: can't find shared memory"
+The device probe could not access the shared memory to determine its size.
+.It "ie%d: kernel configured msize %d doesn't match board configured msize %d"
+The device probe found a different size for the shared memory than the one
+specified in the kernel configuration file.
+.It "ie%d: kernel configured irq %d doesn't match board configured irq %d"
+The device probe detected that the board is configured for a different
+interrupt than the one specified in the kernel configuration file.
+.It "ie%d: reset"
+The Intel i82586 had to be reset by the driver.
+.It "ie%d: transceiver problem"
+The driver has detected a problem with the Ethernet transceiver.
+This is
+usually due to a loose or broken transceiver cable when using an external
+transceiver.
+When you experience this problem with an on-card transceiver
+your card may be incorrectly jumpered for to use an external transceiver.
+Worst case your on-board transceiver may be broken.
+.It "ie%d: TDR detected an open %d clocks away"
+The driver detected an open circuit in the Ethernet cable.
+Check your
+coax cable and terminator resistors.
+.It "ie%d: TDR detected a short %d clocks away"
+The driver detected a short circuit in the Ethernet cable.
+Check your
+coax cable and terminator resistors.
+.It "ie%d: TDR returned unknown status %x"
+The driver got an unknown status from the card during the Ethernet cable
+test.
+.It "ie%d: multicast address setup command failed"
+The card could not be put into multicast mode.
+.It "ie%d: configure command failed"
+The card refused to respond correctly during configuration.
+.It "ie%d: individual address setup command failed"
+The programming of the Ethernet (MAC) address failed.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Garrett A. Wollman ,
+based on code by
+.An William F. Jolitz
+and Lawrence Berkeley Laboratories.
+.Tn 3C507
+support was written by
+.An Charles M. Hannum .
+This manual page was written by
+.An Wilko C. Bulte .
+.Sh CAVEATS
+The Racal Interlan NI5210 comes in variants with 8 and 16 kbytes of
+shared memory.
+It is strongly advisable to use the 16 kbyte variant.
+You can upgrade your 8 kbyte card to 16 kbyte by adding an additional
+RAM chip.
diff --git a/share/man/man4/man4.i386/longrun.4 b/share/man/man4/man4.i386/longrun.4
new file mode 100644
index 000000000000..b9bfc66c5e21
--- /dev/null
+++ b/share/man/man4/man4.i386/longrun.4
@@ -0,0 +1,67 @@
+.\" Copyright (c) 2001 Tamotsu HATTORI <athlete@kta.att.ne.jp>
+.\" Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd June 30, 2001
+.Dt LONGRUN 4 i386
+.Os
+.Sh NAME
+.Nm longrun
+.Nd Transmeta(TM) Crusoe(TM) LongRun(TM) support
+.Sh SYNOPSIS
+LongRun support is a collection of power saving modes for the
+Transmeta Crusoe chips, similar in scope to Intel's SpeedStep.
+The following
+.Xr sysctl 8
+MIBs control the different CPU modes:
+.Bl -column ".Va hw.crusoe.percentage" ".Vt integer" "Changeable"
+.It Sy "Name Type Changeable Description"
+.It Va hw.crusoe.longrun Ta Vt integer Ta yes Ta "LongRun mode:"
+.It Ta Ta Ta "0: minimum frequency mode"
+.It Ta Ta Ta "1: power-saving mode"
+.It Ta Ta Ta "2: performance mode"
+.It Ta Ta Ta "3: maximum frequency mode"
+.It Va hw.crusoe.frequency Ta Vt integer Ta no Ta "Current frequency (MHz)."
+.It Va hw.crusoe.voltage Ta Vt integer Ta no Ta "Current voltage (mV)."
+.It Va hw.crusoe.percentage Ta Vt integer Ta no Ta "Processing performance (%)."
+.El
+.Sh EXAMPLES
+Print the current status:
+.Pp
+.Dl "% sysctl hw.crusoe"
+.Pp
+To set LongRun mode to performance oriented variable frequency mode
+(less power savings):
+.Pp
+.Dl "# sysctl hw.crusoe.longrun=2"
+.Sh HISTORY
+The Transmeta(TM) Crusoe(TM) LongRun(TM) support first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+.An -nosplit
+LongRun support and this manual page were written by
+.An Tamotsu HATTORI Aq athlete@kta.att.ne.jp
+and
+.An Mitsuru IWASAKI Aq iwasaki@FreeBSD.org .
diff --git a/share/man/man4/man4.i386/mse.4 b/share/man/man4/man4.i386/mse.4
new file mode 100644
index 000000000000..bea73e17af98
--- /dev/null
+++ b/share/man/man4/man4.i386/mse.4
@@ -0,0 +1,385 @@
+.\" Copyright 1992 by the University of Guelph
+.\"
+.\" Permission to use, copy and modify this
+.\" software and its documentation for any purpose and without
+.\" fee is hereby granted, provided that the above copyright
+.\" notice appear in all copies and that both that copyright
+.\" notice and this permission notice appear in supporting
+.\" documentation.
+.\" University of Guelph makes no representations about the suitability of
+.\" this software for any purpose. It is provided "as is"
+.\" without express or implied warranty.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 1997
+.Dt MSE 4 i386
+.Os
+.Sh NAME
+.Nm mse
+.Nd bus and InPort mice driver
+.Sh SYNOPSIS
+.\" .Cd "options MSE_XXX=N"
+.Cd "device mse"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.mse.0.at="isa"
+.Cd hint.mse.0.port="0x23c"
+.Cd hint.mse.0.irq="5"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the bus mouse and the InPort mouse, which
+are often collectively called ``bus'' mice, as these mice are sold with
+an interface card which needs to be installed in an expansion bus slot.
+The interface circuit may come on an integrated I/O card or as an option
+on video cards.
+.Pp
+The bus and InPort mice have two or three buttons,
+and a D-sub 9-pin male connector or a round DIN 9-pin
+male connector.
+.Pp
+The primary port address of the bus and InPort mouse interface cards
+is usually 0x23c.
+Some cards may also be set to use the secondary port
+address at 0x238.
+The interface cards require a single IRQ, which may be
+2, 3, 4 or 5.
+Some cards may offer additional IRQs.
+The port number and the IRQ number are configured by jumpers on the cards
+or by software provided with the card.
+.Pp
+Frequency, or report rate, at which the device sends movement
+and button state reports to the host system, may also be configurable on
+some interface cards.
+It may be 15, 30, 60 or 120Hz.
+.Pp
+The difference between the two types of the mice is not in mouse devices
+(in fact they are exactly the same).
+But in the circuit on the interface
+cards.
+This means that the device from a bus mouse package can be
+connected to the interface card from an InPort mouse package, or vice
+versa, provided that their connectors match.
+.Ss Operation Levels
+The
+.Nm
+driver has two levels of operation.
+The current operation level can be set via an ioctl call.
+.Pp
+At the level zero the basic support is provided; the device driver will report
+horizontal and vertical movement of the attached device
+and state of up to three buttons in the format described below.
+It is a subset of the MouseSystems protocol.
+.Pp
+.Bl -tag -width Byte_1 -compact
+.It Byte 1
+.Bl -tag -width bit_7 -compact
+.It bit 7
+Always one.
+.It bit 6..3
+Always zero.
+.It bit 2
+Left button status; cleared if pressed, otherwise set.
+.It bit 1
+Middle button status; cleared if pressed, otherwise set.
+Always one,
+if the device does not have the middle button.
+.It bit 0
+Right button status; cleared if pressed, otherwise set.
+.El
+.It Byte 2
+Horizontal movement count in two's compliment; -128 through 127.
+.It Byte 3
+Vertical movement count in two's compliment; -128 through 127.
+.It Byte 4
+Always zero.
+.It Byte 5
+Always zero.
+.El
+.Pp
+This is the default level of operation and the driver is initially
+at this level when opened by the user program.
+.Pp
+At the operation level one (extended level), a data packet is encoded
+in the standard format
+.Dv MOUSE_PROTO_SYSMOUSE
+as defined in
+.Xr mouse 4 .
+.Ss Acceleration
+The
+.Nm
+driver can somewhat `accelerate' the movement of the pointing device.
+The faster you move the device, the further the pointer
+travels on the screen.
+The driver has an internal variable which governs the effect of
+the acceleration.
+Its value can be modified via the driver flag
+or via an ioctl call.
+.Ss Device Number
+The minor device number of the
+.Nm
+is made up of:
+.Bd -literal -offset indent
+minor = (`unit' << 1) | `non-blocking'
+.Ed
+.Pp
+where `unit' is the device number (usually 0) and the `non-blocking' bit
+is set to indicate ``do not block waiting for mouse input,
+return immediately''.
+The `non-blocking' bit should be set for \fIXFree86\fP,
+therefore the minor device number usually used for \fIXFree86\fP is 1.
+See
+.Sx FILES
+for device node names.
+.Sh DRIVER CONFIGURATION
+.\" .Ss Kernel Configuration Options
+.Ss Driver Flags
+The
+.Nm
+driver accepts the following driver flag.
+Set it in the
+kernel configuration file
+(see
+.Xr config 8 )
+or in the User Configuration Menu at
+the boot time
+(see
+.Xr boot 8 ) .
+.Bl -tag -width MOUSE
+.It bit 4..7 ACCELERATION
+This flag controls the amount of acceleration effect.
+The smaller the value of this flag is, more sensitive the movement becomes.
+The minimum value allowed, thus the value for the most sensitive setting,
+is one.
+Setting this flag to zero will completely disables the
+acceleration effect.
+.El
+.Sh IOCTLS
+There are a few
+.Xr ioctl 2
+commands for mouse drivers.
+These commands and related structures and constants are defined in
+.In sys/mouse.h .
+General description of the commands is given in
+.Xr mouse 4 .
+This section explains the features specific to the
+.Nm
+driver.
+.Pp
+.Bl -tag -width MOUSE -compact
+.It Dv MOUSE_GETLEVEL Ar int *level
+.It Dv MOUSE_SETLEVEL Ar int *level
+These commands manipulate the operation level of the
+.Nm
+driver.
+.Pp
+.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
+Returns the hardware information of the attached device in the following
+structure.
+Only the
+.Dv iftype
+field is guaranteed to be filled with the correct value by the current
+version of the
+.Nm
+driver.
+.Bd -literal
+typedef struct mousehw {
+ int buttons; /* number of buttons */
+ int iftype; /* I/F type */
+ int type; /* mouse/track ball/pad... */
+ int model; /* I/F dependent model ID */
+ int hwid; /* I/F dependent hardware ID */
+} mousehw_t;
+.Ed
+.Pp
+The
+.Dv buttons
+field holds the number of buttons on the device.
+.Pp
+The
+.Dv iftype
+is either
+.Dv MOUSE_IF_BUS
+or
+.Dv MOUSE_IF_INPORT .
+.Pp
+The
+.Dv type
+may be
+.Dv MOUSE_MOUSE ,
+.Dv MOUSE_TRACKBALL ,
+.Dv MOUSE_STICK ,
+.Dv MOUSE_PAD ,
+or
+.Dv MOUSE_UNKNOWN .
+.Pp
+The
+.Dv model
+is always
+.Dv MOUSE_MODEL_GENERIC
+at the operation level 0.
+It may be
+.Dv MOUSE_MODEL_GENERIC
+or one of
+.Dv MOUSE_MODEL_XXX
+constants at higher operation levels.
+.Pp
+The
+.Dv hwid
+is always 0.
+.Pp
+.It Dv MOUSE_GETMODE Ar mousemode_t *mode
+The command gets the current operation parameters of the mouse
+driver.
+.Bd -literal
+typedef struct mousemode {
+ int protocol; /* MOUSE_PROTO_XXX */
+ int rate; /* report rate (per sec), -1 if unknown */
+ int resolution; /* MOUSE_RES_XXX, -1 if unknown */
+ int accelfactor; /* acceleration factor */
+ int level; /* driver operation level */
+ int packetsize; /* the length of the data packet */
+ unsigned char syncmask[2]; /* sync. bits */
+} mousemode_t;
+.Ed
+.Pp
+The
+.Dv protocol
+is either
+.Dv MOUSE_PROTO_BUS
+or
+.Dv MOUSE_PROTO_INPORT
+at the operation level zero.
+.Dv MOUSE_PROTO_SYSMOUSE
+at the operation level one.
+.Pp
+The
+.Dv rate
+is the status report rate (reports/sec) at which the device will send
+movement report to the host computer.
+As there is no standard to detect the current setting,
+this field is always set to -1.
+.Pp
+The
+.Dv resolution
+is always set to -1.
+.Pp
+The
+.Dv accelfactor
+field holds a value to control acceleration feature
+(see
+.Sx Acceleration ) .
+It is zero or greater.
+If it is zero, acceleration is disabled.
+.Pp
+The
+.Dv packetsize
+field specifies the length of the data packet.
+It depends on the
+operation level.
+.Pp
+.Bl -tag -width level_0__ -compact
+.It Em level 0
+5 bytes
+.It Em level 1
+8 bytes
+.El
+.Pp
+The array
+.Dv syncmask
+holds a bit mask and pattern to detect the first byte of the
+data packet.
+.Dv syncmask[0]
+is the bit mask to be ANDed with a byte.
+If the result is equal to
+.Dv syncmask[1] ,
+the byte is likely to be the first byte of the data packet.
+Note that this detection method is not 100% reliable,
+thus, should be taken only as an advisory measure.
+.Pp
+Only
+.Dv level
+and
+.Dv accelfactor
+are modifiable by the
+.Dv MOUSE_SETMODE
+command.
+Changing the other field does not cause error, but has no effect.
+.Pp
+.It Dv MOUSE_SETMODE Ar mousemode_t *mode
+The command changes the current operation parameters of the mouse driver
+as specified in
+.Ar mode .
+Only
+.Dv level
+and
+.Dv accelfactor
+may be modifiable.
+Setting values in the other field does not generate
+error and has no effect.
+.\" .Pp
+.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
+.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
+.\" These commands are not supported by the
+.\" .Nm
+.\" driver.
+.Pp
+.It Dv MOUSE_READDATA Ar mousedata_t *data
+.It Dv MOUSE_READSTATE Ar mousedata_t *state
+These commands are not supported by the
+.Nm
+driver.
+.Pp
+.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
+The command returns the current state of buttons and
+movement counts as described in
+.Xr mouse 4 .
+.El
+.Sh FILES
+.Bl -tag -width /dev/nmse0 -compact
+.It Pa /dev/mse0
+`non-blocking' device node in the system without
+.Em devfs ,
+`blocking' under
+.Em devfs .
+.It Pa /dev/nmse0
+`non-blocking' device node under
+.Em devfs .
+.El
+.Sh EXAMPLES
+.Dl "device mse"
+.Pp
+In
+.Pa /boot/device.hints :
+.Dl hint.mse.0.at="isa"
+.Dl hint.mse.0.port="0x23c"
+.Dl hint.mse.0.irq="5"
+.Pp
+Add the
+.Nm
+driver at the primary port address with the IRQ 5.
+.Pp
+.Dl "device mse"
+.Pp
+.Dl hint.mse.1.at="isa"
+.Dl hint.mse.1.port="0x238"
+.Dl hint.mse.1.irq="4"
+.Dl hint.mse.1.flags="0x30"
+.Pp
+Define the
+.Nm
+driver at the secondary port address with the IRQ 4 and the acceleration
+factor of 3.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr mouse 4 ,
+.Xr psm 4 ,
+.Xr sysmouse 4 ,
+.Xr moused 8
+.\".Sh HISTORY
+.Sh CAVEATS
+Some bus mouse interface cards generate interrupts at the fixed report rate
+when enabled, whether or not the mouse state is changing.
+The others generate interrupts only when the state is changing.
diff --git a/share/man/man4/man4.i386/npx.4 b/share/man/man4/man4.i386/npx.4
new file mode 100644
index 000000000000..7eea3723a47e
--- /dev/null
+++ b/share/man/man4/man4.i386/npx.4
@@ -0,0 +1,111 @@
+.\"
+.\" Copyright (c) 1993 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christopher G. Demetriou.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $Id: npx.4,v 1.1 1993/08/06 10:58:03 cgd Exp $
+.\" $FreeBSD$
+.\"
+.Dd August 28, 1993
+.Dt NPX 4 i386
+.Os
+.Sh NAME
+.Nm npx
+.Nd Numeric Processing Extension coprocessor
+.Sh SYNOPSIS
+.Cd "device npx"
+.Cd hint.npx.0.at="nexus"
+.Cd hint.npx.0.port="0x0F0"
+.Cd hint.npx.0.flags="0x0"
+.Cd hint.npx.0.irq="13"
+.Sh DESCRIPTION
+The
+.Nm
+driver enables the use of the system's Numeric Processing Extension
+coprocessor.
+Numeric processing extensions are present in
+systems with
+.Tn 486DX
+CPUs and in systems with
+.Tn 387
+or
+.Tn 487SX
+coprocessors.
+The
+.Nm
+driver is required for proper system functioning.
+If there is no NPX in the system, the system will not boot.
+.Pp
+The flags for
+.Pa npx0
+are:
+.Pp
+.Bl -tag -width indent -compact
+.It 0x01
+do not use the NPX registers to optimize bcopy.
+.It 0x02
+do not use the NPX registers to optimize bzero.
+.It 0x04
+do not use the NPX registers to optimize copyin or copyout.
+.El
+.Pp
+The NPX registers are normally used
+to optimize copying and zeroing
+when all of the following conditions are satisfied:
+.Pp
+.Bl -enum -compact
+.It
+.Cd "cpu I586_CPU"
+is an option
+.It
+the CPU is an i586 (perhaps not a Pentium)
+.It
+the probe for
+.Pa npx0
+succeeds
+.It
+INT 16 exception handling works.
+.El
+.Pp
+Then copying and zeroing
+using the NPX registers
+is normally 30-100% faster.
+.Pp
+The flags can be used
+to control cases
+where it does not work or is slower.
+Setting them at boot time
+using userconfig works correctly
+(the optimizations are not used
+until later in the bootstrap
+when
+.Pa npx0
+is attached).
+.Sh BUGS
+There are lots of them, especially on old cheap motherboards.
+In particular, some motherboards do not have the interrupt lines from
+the NPX to the CPU wired properly.
diff --git a/share/man/man4/man4.i386/pae.4 b/share/man/man4/man4.i386/pae.4
new file mode 100644
index 000000000000..718e2b2e20c2
--- /dev/null
+++ b/share/man/man4/man4.i386/pae.4
@@ -0,0 +1,127 @@
+.\"
+.\" Copyright (c) 2003 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Jake Burkholder,
+.\" Safeport Network Services, and Network Associates Laboratories, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA
+.\" CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 8, 2003
+.Dt PAE 4 i386
+.Os
+.Sh NAME
+.Nm PAE
+.Nd Physical Address Extensions
+.Sh SYNOPSIS
+.Cd "options PAE"
+.Sh DESCRIPTION
+The
+.Dv PAE
+option provides support for the physical address extensions capability
+of the
+.Tn Intel
+.Tn Pentium Pro
+and above CPUs,
+and allows for up to 64 gigabytes of memory to be used in systems capable
+of supporting it.
+With the
+.Dv PAE
+option, memory above 4 gigabytes is simply added to the general page pool.
+The system makes no distinction between memory above or below 4 gigabytes,
+and no specific facility is provided for a process or the kernel to access
+more memory than they would otherwise be able to access, through a sliding
+window or otherwise.
+.Sh SEE ALSO
+.Xr smp 4 ,
+.Xr tuning 7 ,
+.Xr config 8 ,
+.Xr bus_dma 9
+.Sh HISTORY
+The
+.Dv PAE
+option first appeared in
+.Fx 4.9
+and
+.Fx 5.1 .
+.Sh AUTHORS
+.An Jake Burkholder Aq jake@FreeBSD.org
+.Sh BUGS
+Since KLD modules are not compiled with the same options headers that
+the kernel is compiled with,
+they must not be loaded into a kernel compiled with the
+.Dv PAE
+option.
+.Pp
+Many devices or their device drivers are not capable of direct memory access
+to physical addresses above 4 gigabytes.
+In order to make use of direct memory access IO in a system with more than
+4 gigabytes of memory when the
+.Dv PAE
+option is used,
+these drivers must use a facility for remapping or substituting physical
+memory which is not accessible to the device.
+One such facility is provided by the
+.Nm busdma
+interface.
+Device drivers which do not account for such devices will not work reliably
+in a system with more than 4 gigabytes of memory when the
+.Dv PAE
+option is used,
+and may cause data corruption.
+The
+.Pa PAE
+kernel configuration file includes the
+.Dv PAE
+option, and explicitly excludes all device drivers which are known to not work
+or have not been tested in a system with the
+.Dv PAE
+option and more than 4 gigabytes of memory.
+.Pp
+Many parameters which determine how memory is used in the kernel are based on
+the amount of physical memory.
+The formulas used to determine the values of these parameters for specific
+memory configurations may not take into account the fact there may be more
+than 4 gigabytes of memory, and may not scale well to these memory
+configurations.
+In particular,
+it may be necessary to increase the amount of virtual address space available
+to the kernel,
+or to reduce the amount of a specific resource that is heavily used,
+in order to avoid running out of virtual address space.
+The
+.Dv KVA_PAGES
+option may be used to increase the kernel virtual address space,
+and the
+.Va kern.maxvnodes
+.Xr sysctl 8
+may be used to decrease the number of vnodes allowed,
+an example of a resource that the kernel is likely to overallocate in
+large memory configurations.
+For optimal performance and stability it may be necessary to consult the
+.Xr tuning 7
+manual page, and make adjustments to the parameters documented there.
diff --git a/share/man/man4/man4.i386/pbio.4 b/share/man/man4/man4.i386/pbio.4
new file mode 100644
index 000000000000..f4fbf3b4652e
--- /dev/null
+++ b/share/man/man4/man4.i386/pbio.4
@@ -0,0 +1,187 @@
+.\" Copyright (c) 2000-2002
+.\" Diomidis D. Spinellis, Athens, Greece
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Diomidis D. Spinellis ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Diomidis D. Spinellis BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2005
+.Dt PBIO 4 i386
+.Os
+.Sh NAME
+.Nm pbio
+.Nd 8255 parallel peripheral interface basic
+.Tn I/O
+driver
+.Sh SYNOPSIS
+.Cd "device pbio"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.pbio.0.at="isa"
+.Cd hint.pbio.0.port="0x360"
+.Pp
+.In dev/pbio/pbioio.h
+.Sh DESCRIPTION
+The
+.Nm
+driver supports direct access to the Intel 8255A programmable
+peripheral interface (PPI) chip running in mode 0 (simple
+.Tn I/O ) .
+Such an interface provides 24 digital
+.Tn I/O
+lines.
+The driver is designed for performing
+.Tn I/O
+under program control using
+peripherals such as the
+.Tn Advantech
+.Tn PCL-724
+card, which emulates the Intel 8255A PPI in mode 0.
+Other 8255A-based peripherals such as the
+.Tn BMC
+Messsysteme
+.Tn PIO24II
+card have also been reported to work.
+.Pp
+The PPI provides two 8-bit ports (port A and port B) and
+two 4-bit ports (port C upper, port C lower).
+Each port can be individually programmed for input and
+(latched) output,
+and appears at a different offset of the device's base
+.Tn I/O
+address.
+.Pp
+A separate register allows the configuration of ports for input
+or output.
+The device is so simple, that reliably probing for it when
+input data arrives at its terminals is impossible;
+therefore the kernel configuration has to specify the
+device's base address.
+The device driver provides four character devices that
+correspond to the peripheral's
+.Tn I/O
+ports.
+Opening a device for read or write automatically configures
+the corresponding hardware port for input or output.
+At boot time all ports are set configured for input to avoid damaging
+external circuitry.
+.Pp
+A set of
+.Xr ioctl 2
+requests allow polled input and paced output to be
+efficiently performed at the driver level without expensive
+user/kernel context switching.
+The driver can perform
+.Tn I/O
+in three different ways:
+.Bl -tag -width ".No Differential"
+.It Basic
+The read or write operation returns immediately after reading
+or writing the data to the port at bus speed.
+.It Paced
+Data is transferred from or to the port at intervals specified
+by a separate
+.Xr ioctl 2
+call.
+.It Differential
+(Input only.)
+Only port values that differ from the previous port value are returned.
+.El
+.Pp
+The pacing interval is specified in
+.Em Hz
+unit increments.
+Setting a pace of
+.Ar n
+seconds
+will result in no more than one value being read or written every
+.Ar n
+seconds.
+Single byte read/write operations will take at least
+.Ar n
+seconds to complete.
+.Pp
+The following
+.Xr ioctl 2
+calls are supported:
+.Bl -tag -width ".Dv PBIO_SETIPACE"
+.It Dv PBIO_SETDIFF
+accepts a pointer to an integer as the third argument,
+and sets the driver for differential input if the integer is non-zero.
+The input pace speed determines the periodic interval the driver will use to
+examine the port for a changed value.
+.It Dv PBIO_GETDIFF
+accepts a pointer to an integer as the third argument,
+and sets the integer to the last set value for differential input.
+.It Dv PBIO_SETIPACE
+accepts a pointer to an integer as the third argument,
+and sets the driver's input pacing speed to the value of that integer.
+.It Dv PBIO_GETIPACE
+accepts a pointer to an integer as the third argument,
+and sets the integer to the last set value for the input pace.
+.It Dv PBIO_SETOPACE
+accepts a pointer to an integer as the third argument,
+and sets the driver's output pacing speed to the value of that integer.
+.It Dv PBIO_GETOPACE
+accepts a pointer to an integer as the third argument,
+and sets the integer to the last set value for the output pace.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/pbio0ch" -compact
+.It Pa /dev/pbio0a
+Port A (8 bit
+.Tn I/O ) .
+.It Pa /dev/pbio0b
+Port B (8 bit
+.Tn I/O ) .
+.It Pa /dev/pbio0ch
+Port C upper (4 bit
+.Tn I/O ) .
+.It Pa /dev/pbio0cl
+Port C lower (4 bit
+.Tn I/O ) .
+.El
+.Sh SEE ALSO
+.Rs
+.%A "Diomidis Spinellis"
+.%T "The information furnace: Consolidated home control"
+.%D "2003"
+.%J "Personal and Ubiquitous Computing"
+.%N 1
+.%V 7
+.%P "53-69"
+.Re
+.Sh HISTORY
+The
+.Nm
+device was first used under
+.Fx 4.1 .
+.Sh AUTHORS
+.An "Diomidis D. Spinellis" Aq dds@aueb.gr
+.Sh BUGS
+One of the
+.Tn PCL-724
+card's inputs can optionally be wired to generate an interrupt.
+This feature is not supported.
diff --git a/share/man/man4/man4.i386/perfmon.4 b/share/man/man4/man4.i386/perfmon.4
new file mode 100644
index 000000000000..b9a00f53fd82
--- /dev/null
+++ b/share/man/man4/man4.i386/perfmon.4
@@ -0,0 +1,213 @@
+.\"
+.\" Copyright 1996 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd March 26, 1996
+.Dt PERFMON 4 i386
+.Os
+.Sh NAME
+.Nm perfmon
+.Nd CPU performance-monitoring interface
+.Sh SYNOPSIS
+.Cd cpu I586_CPU
+.Cd cpu I686_CPU
+.Cd options PERFMON
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the internal performance-monitoring
+capabilities of the
+.Tn Intel
+.Tn Pentium
+and
+.Tn "Pentium Pro"
+CPUs.
+These processors implement two internal counters which can be
+configured to measure a variety of events for either count or duration
+(in CPU cycles), as well as a cycle counter which counts clock cycles.
+The
+.Nm
+driver provides a device-style interface to these capabilities.
+.Pp
+All access to the performance-monitoring counters is performed through
+the special device file
+.Dq Pa /dev/perfmon .
+This device supports a number of
+.Xr ioctl 2
+requests, defined in
+.In machine/perfmon.h
+along with the definitions of the various counters for both
+.Tn Pentium
+and
+.Tn "Pentium Pro"
+processors.
+.Pp
+.Sy NOTA BENE :
+The set of available events differs from processor to processor.
+It
+is the responsibility of the programmer to ensure that the event
+numbers used are the correct ones for the CPU type being measured.
+.Pp
+The following
+.Xr ioctl 2
+requests are defined:
+.Bl -tag -width PMIOTSTAMP
+.It Dv PMIOSETUP
+.Pq Li "struct pmc"
+Set up a counter with parameters and flags defined in the structure.
+The following fields are defined in
+.Li struct pmc :
+.Bl -tag -width "u_char pmc_eventx"
+.It Li "int pmc_num"
+the number of the counter in question; must be less than
+.Dv NPMC
+(currently 2).
+.It Li "u_char pmc_event"
+the particular event number to be monitored, as defined in
+.In machine/perfmon.h .
+.It Li "u_char pmc_unit"
+the unit mask value, specific to the event type (see the
+.Tn Intel
+documentation).
+.It Li "u_char pmc_flags"
+flags modifying the operation of the counter (see below).
+.It Li "u_char pmc_mask"
+the counter mask value; essentially, this is a threshold used to
+restrict the count to events lasting more (or less) than the specified
+number of clocks.
+.El
+.Pp
+The following
+.Li pmc_flags
+values are defined:
+.Bl -tag -compact -width PMCF_USRxx
+.It Dv PMCF_USR
+count events in user mode
+.It Dv PMCF_OS
+count events in kernel mode
+.It Dv PMCF_E
+count number of events rather than their duration
+.It Dv PMCF_INV
+invert the sense of the counter mask comparison
+.El
+.It Dv PMIOGET
+.Pq Li "struct pmc"
+returns the current configuration of the specified counter.
+.It Dv PMIOSTART
+.It Dv PMIOSTOP
+.Pq Li int
+starts (stops) the specified counter.
+Due to hardware deficiencies,
+counters must be started and stopped in numerical order.
+(That is to
+say, counter 0 can never be stopped without first stopping counter 1.)
+The driver will
+.Em not
+enforce this restriction (since it may not be present in future CPUs).
+.It Dv PMIORESET
+.Pq Li int
+reset the specified counter to zero.
+The counter should be stopped
+with
+.Dv PMIOSTOP
+before it is reset.
+All counters are automatically reset by
+.Dv PMIOSETUP .
+.It Dv PMIOREAD
+.Pq Li "struct pmc_data"
+get the current value of the counter.
+The
+.Li pmc_data
+structure defines two fields:
+.Pp
+.Bl -tag -compact -width "quad_t pmcd_value"
+.It Li "int pmcd_num"
+the number of the counter to read
+.It Li "quad_t pmcd_value"
+the resulting value as a 64-bit signed integer
+.El
+.Pp
+In the future, it may be possible to use the
+.Li RDPMC
+instruction on
+.Tn "Pentium Pro"
+processors to read the counters directly.
+.It Dv PMIOTSTAMP
+.Pq Li "struct pmc_tstamp"
+read the time stamp counter.
+The
+.Li pmc_tstamp
+structure defines two fields:
+.Pp
+.Bl -tag -compact -width "quad_t pmct_value"
+.It Li "int pmct_rate"
+the approximate rate of the counter, in MHz
+.It Li "quad_t pmct_value"
+the current value of the counter as a 64-bit integer
+.El
+.Pp
+It is important to note that the counter rate, as provided in the
+.Li pmct_rate
+field, is often incorrect because of calibration difficulties and
+non-integral clock rates.
+This field should be considered more of a
+hint or sanity-check than an actual representation of the rate of
+clock ticks.
+.El
+.Sh FILES
+.Bl -tag -compact -width "/usr/include/machine/perfmon.h"
+.It Pa /dev/perfmon
+character device interface to counters
+.It Pa /usr/include/machine/perfmon.h
+include file with definitions of structures and event types
+.It Pa /usr/share/examples/perfmon
+sample source code demonstrating use of all the
+.Fn ioctl
+commands
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr hwpmc 4
+.Rs
+.%A Intel Corporation
+.%B Pentium Pro Family Developer's Manual
+.%D January 1996
+.%V vol. 3
+.%O Operating System Writer's Manual
+.Re
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Garrett A. Wollman ,
+MIT Laboratory for Computer Science.
diff --git a/share/man/man4/man4.i386/pnp.4 b/share/man/man4/man4.i386/pnp.4
new file mode 100644
index 000000000000..7c17b0e04dc0
--- /dev/null
+++ b/share/man/man4/man4.i386/pnp.4
@@ -0,0 +1,90 @@
+.\" Copyright (c) 1997 Luigi Rizzo
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgements:
+.\" This product includes software developed by Luigi Rizzo.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 20, 2001
+.Dt PNP 4 i386
+.Os
+.Sh NAME
+.Nm pnp
+.Nd support for
+.Dq "Plug and Play"
+(PnP) ISA devices
+.Sh DESCRIPTION
+The
+.Nm
+driver enumerates ISA devices which support
+.Dq "Plug and Play ISA Specification"
+in the system.
+It assigns ISA bus resources (interrupt line, DMA channel, I/O ports,
+and memory region) to each device and activates it.
+.Pp
+If it cannot assign necessary resources to a PnP ISA device without
+causing conflict with other devices in the system,
+the device will not be activated and will be unavailable
+to programs.
+.Sh SEE ALSO
+.Xr pnpbios 4
+.Sh STANDARDS
+.Rs
+.%A Intel
+.%A Microsoft
+.%T "Plug and Play ISA Specification, Version 1.0a"
+.%D "May 5, 1994"
+.Re
+.Pp
+.Rs
+.%T "Clarifications to the Plug and Play ISA Specification, Version 1.0a"
+.%D "December 10, 1994"
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.2.5 .
+It has been substantially updated in subsequent versions.
+.Sh AUTHORS
+.An -nosplit
+PnP support was originally written
+for
+.Fx 2.2.5
+by
+.An Luigi Rizzo ,
+based on initial work done by
+.An Sujal Patel .
+.Sh CAVEATS
+It is not possible to disable individual PnP ISA devices.
+The
+.Nm
+driver will find all devices conforming the PnP ISA specification
+and try to activate them all.
+.Pp
+There is no way to explicitly assign particular resource to
+the PnP ISA device.
+The resource assignment is fully automatic and there is
+no provision for manual override.
diff --git a/share/man/man4/man4.i386/pnpbios.4 b/share/man/man4/man4.i386/pnpbios.4
new file mode 100644
index 000000000000..b386be21f629
--- /dev/null
+++ b/share/man/man4/man4.i386/pnpbios.4
@@ -0,0 +1,85 @@
+.\"
+.\" Copyright (c) 2001
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd September 20, 2001
+.Dt PNPBIOS 4 i386
+.Os
+.Sh NAME
+.Nm pnpbios
+.Nd support for embedded devices on the motherboard
+.Sh DESCRIPTION
+The
+.Nm
+driver enumerates embedded ISA devices on the motherboard whose BIOS
+supports
+.Dq "Plug and Play BIOS Specification" .
+It assigns ISA bus resources (interrupt line, DMA channel, I/O ports,
+and memory region) to each device and activates it.
+.Pp
+If it cannot assign necessary resources to a device without
+causing conflict with other devices in the system,
+the device will not be activated and will be unavailable
+to programs.
+.Sh SEE ALSO
+.Xr pnp 4
+.Sh STANDARDS
+.Rs
+.%A Compaq
+.%A Phenix
+.%A Intel
+.%T "Plug and Play BIOS Specification Version 1.0A"
+.%D May 5, 1994
+.Re
+.Pp
+.Rs
+.%A Compaq
+.%A Phenix
+.%A Intel
+.%T "Plug and Play BIOS CLARIFICATION Paper for Plug and Play BIOS Specification Version 1.0A"
+.%D October 6, 1994
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Mike Smith .
+.Sh CAVEATS
+There is no explicit way to disable individual embedded devices.
+The
+.Nm
+driver will find all devices reported by the
+.Dq "Plug and Play (PnP)"
+BIOS and try to activate them all.
+.Pp
+There is no way to explicitly assign particular resource to a device.
+The resource assignment is fully automatic and there is
+no provision for manual override.
diff --git a/share/man/man4/man4.i386/sbni.4 b/share/man/man4/man4.i386/sbni.4
new file mode 100644
index 000000000000..31cf610b0095
--- /dev/null
+++ b/share/man/man4/man4.i386/sbni.4
@@ -0,0 +1,132 @@
+.\" Written by Denis I. Timofeev, 2002.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2002
+.Dt SBNI 4 i386
+.Os
+.Sh NAME
+.Nm sbni
+.Nd Granch SBNI12 leased line modem driver
+.Sh SYNOPSIS
+.Cd "device sbni"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for leased line modems of following models:
+.Pp
+.Bl -bullet -compact
+.It
+SBNI12-02, SBNI12D-02
+.It
+SBNI12-04, SBNI12D-04
+.It
+SBNI12-05, SBNI12D-05, ISA and PCI
+.It
+SBNI12-10, SBNI12D-10, ISA and PCI
+.El
+.Pp
+and a kit for data link over a voice band:
+.Bl -bullet
+.It
+SBNI12-11, SBNI12D-11, ISA and PCI.
+.El
+.Pp
+In addition to the standard port and IRQ specifications, the
+.Nm
+driver also supports a number of
+.Va flags
+which can set baud rate, receive level, and low three bytes of Ethernet
+MAC-address (high three are always
+.Li 00:ff:01 ) ,
+because Granch modems are
+presented to the system as Ethernet-like network cards.
+.Pp
+The high byte of the
+.Va flags
+is a bit field, it is used to specify SBNI adapter receive level/baud rate:
+.Bl -tag -width "Bits 0-3:" -offset indent
+.It "Bits 0-3:"
+receive level (0x00..0x0f)
+.It "Bits 4-5:"
+baud rate number:
+.Pp
+.Bl -inset -compact
+.It "00 -"
+0 baud rate (2Mb in fast mode/500kb in slow)
+.It "01 -"
+1 baud rate (1Mb/250kb)
+.It "10 -"
+2 baud rate (500kb/125kb)
+.It "11 -"
+3 baud rate (250kb/62.5kb)
+.El
+.It "Bit 6:"
+use fixed receive level
+.Pp
+if bit 6 is set then receive level will be set according
+to bits 0-3 value, otherwise receive level will be
+autodetected
+.It "Bit 7:"
+use fixed baud rate
+.Pp
+if bit 7 is set then baud rate will be set according to
+bits 4-5 value, otherwise baud rate is set to 2Mb
+.El
+.Sh FILES
+The sources for the driver reside in:
+.Pp
+.Bl -tag -compact
+.It Pa /sys/dev/sbni/if_sbni.c
+.It Pa /sys/dev/sbni/if_sbnireg.h
+.It Pa /sys/dev/sbni/if_sbnivar.h
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.6 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver for
+.Fx
+4.x was written by
+.An Denis I. Timofeev ,
+partially based on
+.An David Greenman Ns 's
+.Xr ed 4
+driver.
+Earlier versions (available on
+.Pa ftp.granch.com )
+were written by
+.An Alexey V. Zverev .
+.Pp
+SBNI12 hardware was designed by
+.An Alexey V. Chirkov .
diff --git a/share/man/man4/man4.i386/smapi.4 b/share/man/man4/man4.i386/smapi.4
new file mode 100644
index 000000000000..8af17fa0a826
--- /dev/null
+++ b/share/man/man4/man4.i386/smapi.4
@@ -0,0 +1,153 @@
+.\"
+.\" Copyright (c) 2003 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 1, 2003
+.Dt SMAPI 4 i386
+.Os
+.Sh NAME
+.Nm smapi
+.Nd "System Management Application Program Interface driver"
+.Sh DESCRIPTION
+Many
+.Tn IBM Thinkpad
+laptops utilize a special software interface known as
+.Tn SMAPI
+(System Management Application Program Interface).
+This interface controls various aspects of the system including:
+.Bl -bullet
+.It
+System Interface
+(the
+.Tn BIOS
+can store system information such as the system identifier),
+.It
+System Configuration (where devices such as the display can be configured),
+.It
+Power Management (software can interact with the
+.Tn SMAPI BIOS
+for Power Management control).
+.El
+.Pp
+Client software must locate a
+.Dq "header image"
+stored in the
+.Li F000
+segment in the
+.Tn Thinkpad ROM
+(read-only memory), which resides at the 16-byte boundary.
+This is considered the
+.Dq "Entry Point"
+for the service.
+.Pp
+The
+.Dq "header image"
+stores information like:
+.Bl -bullet
+.It
+signature,
+.It
+.Tn SMAPI
+version (major and minor),
+.It
+header image length,
+.It
+checksum information (which verifies the image),
+.It
+an Information Word (used to identify the
+.Tn BIOS
+service level),
+.It
+Real Mode Entry Point (where clients using the
+Real/V86 mode for the far-call value),
+.It
+and finally a 16-bit/32-bit Protected Mode Entry
+Point: base code address which specifies the
+.Tn BIOS
+physical address.
+The client must prepare a 64 kilobyte selector for this
+.Tn BIOS ) .
+.El
+.Pp
+To invoke the
+.Tn SMAPI BIOS ,
+a far-call must be used on the entry point specified in the header file.
+All other information should be stored in the client data area.
+The client is required to prepare both an input and output parameter in a
+data area of its own.
+This area can be
+.Dq informed
+by pushing those pointers into its stack before the far-calls.
+.Pp
+The
+.Tn SMAPI BIOS
+uses the stack and data areas with the selector during a
+.Tn BIOS
+invocation, thus the caller must define the same privilege area as the
+.Tn BIOS .
+.Pp
+The parameter structure will be made up by using the input and output
+fields prepared by the caller.
+The input field will specify the function request to the
+.Tn BIOS .
+The
+.Tn BIOS
+will then drop a return value into the output field.
+These fields are made up of three parts.
+The first holds parameters, function numbers, and return codes.
+The next will contain an offset in hexadecimal.
+Finally a length field which is comprised of Byte, Word, or Double Word.
+.Sh SEE ALSO
+.Rs
+.%B "IBM Thinkpad 560/560E Technical Reference"
+.%O "06J0536 S76H-7587-01"
+.Re
+.Rs
+.%B "IBM Thinkpad 560Z Technical Reference"
+.%O "xxxxxxx xxxx-xxxx-xx"
+.Re
+.Rs
+.%B "IBM Thinkpad 600 Technical Reference"
+.%O "xxxxxxx xxxx-xxxx-xx"
+.Re
+.Rs
+.%B "IBM Thinkpad 760XD/760XL/765D/765L Technical Reference"
+.%O "06J0537 S30H-2433-02"
+.Re
+.Rs
+.%B "IBM Thinkpad 770 Technical Reference"
+.%O "05L1739 S05L-1739-00"
+.Re
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Matthew N. Dodd Aq mdodd@FreeBSD.org .
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+and
+.An Matthew N. Dodd Aq mdodd@FreeBSD.org .
diff --git a/share/man/man4/man4.i386/snc.4 b/share/man/man4/man4.i386/snc.4
new file mode 100644
index 000000000000..66b45247822b
--- /dev/null
+++ b/share/man/man4/man4.i386/snc.4
@@ -0,0 +1,142 @@
+.\"
+.\" Copyright (c) 2004 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 4, 2004
+.Dt SNC 4 i386
+.Os
+.Sh NAME
+.Nm snc
+.Nd National Semiconductor DP8393X SONIC Ethernet adapter driver
+.Sh SYNOPSIS
+.Cd device isa
+.Cd device snc
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn National
+.Tn Semiconductor
+.Tn SONIC
+Ethernet adapters.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+National Semiconductor DP83934AVQB
+.It
+NEC PC-9801-83
+.It
+NEC PC-9801-84
+.It
+NEC PC-9801-103
+.It
+NEC PC-9801-104
+.It
+NEC PC-9801N-15
+.It
+NEC PC-9801N-25
+.It
+NEC PC-9801N-J02 PCMCIA
+.It
+NEC PC-9801N-J02R PCMCIA
+.El
+.Pp
+The
+.Nm
+driver also includes support for the
+.Tn National
+.Tn Semiconductor
+.Tn NS46C46
+as
+64 * 16 bits Microwave Serial
+.Tn EEPROM .
+.Sh IMPLEMENTATION NOTES
+Accessing
+.Tn SONIC
+card data structures and registers as 32 bit values
+makes code endianness independent.
+The
+.Tn SONIC
+is however always in big-endian mode so it is necessary to
+ensure that data structures shared
+between the
+.Tn CPU
+and the
+.Tn SONIC
+card are always in big-endian order.
+The
+.Nm
+driver supports the
+.Tn PC-98
+C-Bus,
+and
+.Tn PnP
+buses.
+Support is also provided for the legacy C-Bus.
+.Sh DIAGNOSTICS
+The following driver specific error messages
+may be reported:
+.Bl -diag
+.It "snc%d: snc_nec16_register_irq: unsupported irq (%d)"
+The card returned an
+.Tn IRQ
+which is not supported by the driver.
+.It "snc%d: invalid packet length %d bytes"
+An attempt to transfer a data packet failed due to an
+invalid packet length.
+.El
+.Sh SEE ALSO
+.Xr netintro 4 ,
+.Xr bus_alloc_resource_any 9
+.Sh HISTORY
+The
+.Nm
+driver was ported from
+.Nx
+by
+.An -nosplit
+.An Motomichi Matsuzaki Aq mzaki@e-mail.ne.jp
+and
+.An Hiroshi Yamashita Aq bluemoon@msj.biglobe.ne.jp .
+It first appeared in
+.Fx 4.2 .
+This manual page first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.Sh BUGS
+Currently the
+.Nm
+driver only works on the
+.Tn PC-98
+architecture.
+It should probably work on the i386 architecture
+as well.
diff --git a/share/man/man4/man4.i386/streams.4 b/share/man/man4/man4.i386/streams.4
new file mode 100644
index 000000000000..acb18087a16d
--- /dev/null
+++ b/share/man/man4/man4.i386/streams.4
@@ -0,0 +1,85 @@
+.\" Copyright (c) 2000 Mark Newton
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 17, 2008
+.Dt STREAMS 4 i386
+.Os
+.Sh NAME
+.Nm streams
+.Nd System V STREAMS networking ABI support
+.Sh SYNOPSIS
+To compile support for this ABI into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device streams"
+.Ed
+.Pp
+Alternatively, to load the ABI as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+streams_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+module provides limited
+System V Release 4 STREAMS interprocess communication ABI
+(application binary interface) compatibility
+for userland applications.
+.Pp
+Internally,
+.Nm
+provides STREAMS handles by using socket creation kernel routines, and
+adding state-tracking information to the socket to permit manipulation
+by STREAMS emulation code in
+.Xr svr4 4 .
+Hence, opening a stream device produces a result similar to what would be
+obtained by calling
+.Xr socket 2 .
+.Pp
+Applications should never use this interface directly: STREAMS
+emulation is only provided as a service to support ABI requirements in
+the SVR4 environment which
+.Xr svr4 4
+needs to present to client binaries.
+.Sh SEE ALSO
+.Xr svr4 4
+.Sh HISTORY
+System V Release 4 ABI support first appeared in
+.Fx 4.0 .
+The ABI was ported from an equivalent facility present in
+.Nx 1.3
+written by Christos Zoulas.
+.Sh BUGS
+This whole interface is a crude hack to produce STREAMS semantics
+through emulation over sockets.
+.Pp
+Programmers who hope to be able to use this interface to provide
+SVR4 STREAMS services to
+.Bx
+applications will be sorely disappointed.
diff --git a/share/man/man4/man4.i386/svr4.4 b/share/man/man4/man4.i386/svr4.4
new file mode 100644
index 000000000000..f470c433907e
--- /dev/null
+++ b/share/man/man4/man4.i386/svr4.4
@@ -0,0 +1,225 @@
+.\" Copyright (c) 2000 Mark Newton
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 17, 2008
+.Dt SVR4 4 i386
+.Os
+.Sh NAME
+.Nm svr4
+.Nd System V Release 4 ABI support
+.Sh SYNOPSIS
+To compile support for this ABI into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options COMPAT_SVR4"
+.Ed
+.Pp
+Alternatively, to load the ABI as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+svr4_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+module provides limited
+System V Release 4 ABI (application binary interface) compatibility
+for userland applications.
+The module provides the following significant facilities:
+.Bl -bullet
+.It
+An image activator
+for correctly branded
+.Xr elf 5
+executable images
+.It
+Special signal handling for activated images
+.It
+SVR4 to native system call translation
+.It
+STREAMS network API emulation (via the
+.Xr streams 4
+loadable module, or by means of
+.Dl device streams
+in a kernel configuration file)
+.It
+Mappings between
+.Fx
+and SVR4
+.Xr ioctl 2
+calls, or, where no such mappings exist, reverse-engineered implementations
+of the SVR4 calls.
+.El
+.Pp
+It is important to note that the SVR4 ABI support
+it not provided through an emulator.
+Rather, a true (albeit limited) "clean room" reverse-engineered ABI
+implementation is provided.
+.Sh LIMITATIONS
+Because the provided ABI has been developed in ignorance of actual SVR4
+source code, there are bound to be unforeseen interactions between SVR4
+client applications and the emulated ABI which cause applications to
+malfunction.
+.Pp
+Additionally, some SVR4 operating systems do not adhere to the SVR4
+ELF standard.
+In particular, Solaris does not set the ELF interpreter field in the
+ELF header to a value which would allow the kernel to correctly
+identify a client executable as an SVR4 application.
+Thus, in certain instances it is necessary to use the
+.Xr brandelf 1
+utility to explicitly brand the executable, or to set the
+kern.fallback_elf_brand
+.Xr sysctl 8
+variable to define a "default" ABI for unbranded executables.
+Value ELFOSABI_SOLARIS represents Solaris; ELFOSABI_SYSV represents other
+SysVR4 operating systems.
+See
+.In sys/elf_common.h
+for ELFOSABI branding definitions, and
+.Xr brandelf 1
+for information on branding executables.
+.Pp
+The
+.Nm
+module can be linked into the kernel statically with the
+.Dv COMPAT_SVR4
+kernel configuration option
+or loaded as required.
+The following command will load the module
+if it is neither linked into the kernel
+nor already loaded as a module:
+.Bd -literal -offset indent
+if ! kldstat -v | grep -E 'svr4elf' > /dev/null; then
+ kldload svr4 > /dev/null 2>&1
+fi
+.Ed
+.Pp
+The kernel
+will check for the presence of the
+.Xr streams 4
+module, and load it if necessary.
+.Pp
+Note that dynamically linked SVR4 executables
+will require a suitable environment in
+.Pa /compat/svr4 .
+.Pp
+For information on loading the
+.Nm
+kernel loadable module automatically on system startup,
+see
+.Xr rc.conf 5 .
+This information applies
+regardless of whether the
+.Nm
+module is statically linked into the kernel
+or loaded as a module.
+.Pp
+STREAMS emulation is limited but (largely) functional.
+Assuming the
+.Xr streams 4
+module is loaded, a STREAMS handle can be obtained by opening one of the
+relevant files in
+.Pa /dev
+or
+.Pa /compat/svr4/dev .
+Internally, the
+.Xr streams 4
+driver produces a socket descriptor and
+.Dq tags
+it with additional STREAMS
+state information before returning it to the client application.
+The
+.Nm
+environment uses the additional state information to recognize and
+manipulate emulated STREAMS handles when STREAMS-specific
+.Xr ioctl 2
+calls are executed.
+.Pp
+The subset of STREAMS functionality which is provided is small, probably
+little more than what is required to enable programs on the Solaris CD
+sets to run.
+.Sh FILES
+.Bl -tag -width /sys/compat/svr4/syscalls.master -compact
+.It Pa /compat/svr4
+minimal SVR4 run-time environment
+.It Pa /sys/compat/svr4/syscalls.master
+mappings between SVR4 syscalls and
+.Nm
+module entrypoints.
+.El
+.Sh SEE ALSO
+.Xr brandelf 1 ,
+.Xr streams 4 ,
+.Xr elf 5
+.Sh HISTORY
+System V Release 4 ABI support first appeared in
+.Fx 4.0 .
+The ABI was ported from an equivalent facility present in
+.Nx 1.3
+written by Christos Zoulas.
+.Sh BUGS
+Emulation of signal handlers is buggy.
+.Pp
+Emulated connectionless STREAMS fail to receive data from the network in
+some circumstances (but succeed in others -- probably due to particular
+ways of initializing them which the
+.Xr streams 4
+module is mishandling, and interaction between STREAMS and
+.Xr poll 2 ) .
+Connection-oriented STREAMS appear to be functional.
+.Pp
+Ironically, this SVR4 emulator does not (yet) support SVR4 semaphores or
+shared memory.
+.Pp
+.Xr ports 7
+to automatically create the
+.Pa /compat/svr4
+environment do not exist.
+.Xr tar 1
+archives containing pre-populated trees can be obtained from
+.Pa http://people.FreeBSD.org/~newton/freebsd-svr4/ .
+.Pp
+Extensive testing has only really been carried out with Solaris 2.x binaries,
+with anecdotal reports of limited success coming from testers with
+early-revision SCO media.
+In theory, the basic SVR4 ABI should be constant
+across the set of vendors who produce SVR4 operating systems, but in
+practice that is probably not the case.
+If necessary, future work can
+either implement additional
+.Xr kld 4
+modules which produce functionality which contains OS-dependent
+departures from the behaviour which has been implemented in this
+ABI implementation.
+Alternatively,
+.Xr sysctl 8
+variables could set the
+.Dq personality
+the environment should present to
+client applications.
diff --git a/share/man/man4/man4.i386/vpd.4 b/share/man/man4/man4.i386/vpd.4
new file mode 100644
index 000000000000..7ed2063a6fa9
--- /dev/null
+++ b/share/man/man4/man4.i386/vpd.4
@@ -0,0 +1,90 @@
+.\" Copyright (c) 2003 Matthew N. Dodd <winter@jurai.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 31, 2004
+.Dt VPD 4 i386
+.Os
+.Sh NAME
+.Nm vpd
+.Nd "Vital Product Data kernel interface"
+.Sh SYNOPSIS
+.Cd "device vpd"
+.Sh DESCRIPTION
+.Tn IBM ThinkPad
+notebooks (and most
+.Tn IBM
+desktop PCs) have a 48-byte
+Vital Product Data (VPD) structure located in the BIOS Shadow RAM.
+.Pp
+The VPD provides machine type and model information, the build ID
+(this is roughly the BIOS version) and serial number information.
+.Pp
+The
+.Nm
+driver scans the BIOS area and claims the memory used by the VPD
+structure.
+It provides the
+.Xr sysctl 3
+branch
+.Va hw.vpd
+to allow this information to be accessed by the userland.
+The following variables are provided, one per VPD attachment (there should
+only be one):
+.Pp
+.Bl -tag -width ".Dv MACHINE_MODEL" -compact
+.It Dv MACHINE_TYPE
+.Pq Va machine.type
+Machine type.
+.It Dv MACHINE_MODEL
+.Pq Va machine.model
+Machine model.
+.It Dv BUILD_ID
+.Pq Va build.id
+BIOS Build ID.
+.It Dv SERIAL_BOX
+.Pq Va serial.box
+Box Serial Number.
+.It Dv SERIAL_PLANAR
+.Pq Va serial.planar
+Motherboard Serial Number.
+.El
+.Sh SEE ALSO
+.Rs
+.%T "TP General - Using the BIOS Build ID to identify IBM ThinkPad systems"
+.%N "Reference #: MIGR-45120"
+.%D "November 22, 2002"
+.%U "http://www.ibm.com/support/docview.wss?uid=psg1MIGR-45120"
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+The
+.Nm
+driver and this manual page were written by
+.An Matthew N. Dodd Aq mdodd@FreeBSD.org .
diff --git a/share/man/man4/man4.i386/vx.4 b/share/man/man4/man4.i386/vx.4
new file mode 100644
index 000000000000..ab0472b6868a
--- /dev/null
+++ b/share/man/man4/man4.i386/vx.4
@@ -0,0 +1,140 @@
+.\"
+.\" Copyright (c) 1996, Fred Gray
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by David Greenman.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt VX 4 i386
+.Os
+.Sh NAME
+.Nm vx
+.Nd "3Com EtherLink III / Fast EtherLink III (3c59x) Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device vx"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vx_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the 3Com
+.Dq Vortex
+chipset.
+.Pp
+The medium selection
+can be influenced by the following link flags to the
+.Xr ifconfig 8
+command:
+.Pp
+.Bl -tag -width LINK0X -compact
+.It Em link0
+Use the AUI port.
+.It Em link1
+Use the BNC port.
+.It Em link2
+Use the UTP port.
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c590 EtherLink III PCI
+.It
+3Com 3c592 EtherLink III EISA
+.It
+3Com 3c595 Fast EtherLink III PCI in 10 Mbps mode
+.It
+3Com 3c597 Fast EtherLink III EISA in 10 Mbps mode
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "vx%d: not configured; kernel is built for only %d devices."
+There are not enough devices in the kernel configuration file for the number
+of adapters present in the system.
+Add devices to the configuration file,
+rebuild the kernel, and reboot.
+.El
+.Pp
+All other diagnostics indicate either a hardware problem or a bug in the
+driver.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.1 .
+It was derived from the
+.Nm ep
+driver, from which it inherits most of its limitations.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver and this manual page were written by
+.An Fred Gray Aq fgray@rice.edu ,
+based on the work of
+.An Herb Peyerl
+and with the assistance of numerous others.
+.Sh CAVEATS
+Some early-revision 3c590 cards are defective and suffer from many receive
+overruns, which cause lost packets.
+The author has attempted to implement
+a test for it based on the information supplied by 3Com, but the test resulted
+mostly in spurious warnings.
+.Pp
+The performance of this driver is somewhat limited by the fact that it uses
+only polled-mode I/O and does not make use of the bus-mastering capability
+of the cards.
+.Sh BUGS
+The
+.Nm
+driver is known not to reset the adapter correctly following a warm boot
+on some systems.
+.Pp
+The
+.Nm
+driver has not been exhaustively tested with all the models of cards that it
+claims to support.
diff --git a/share/man/man4/man4.i386/wl.4 b/share/man/man4/man4.i386/wl.4
new file mode 100644
index 000000000000..a1eacdabcd56
--- /dev/null
+++ b/share/man/man4/man4.i386/wl.4
@@ -0,0 +1,191 @@
+.\"
+.\" Copyright (c) 1997, Jim Binkley
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Jim Binkley
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd September 29, 2006
+.Dt WL 4 i386
+.Os
+.Sh NAME
+.Nm wl
+.Nd T1 speed ISA/radio lan card
+.Sh SYNOPSIS
+.Cd "device wl0 at isa? port 0x300 irq 5"
+.Sh DESCRIPTION
+The
+.Nm
+driver controls a radio lan card system made originally by
+NCR, then ATT, now Lucent.
+The system is spread-spectrum radio
+at around 915 MHz (or 2.4 GHz).
+With the supplied omni-directional antennae,
+about 400 feet (indoors, more outdoors) can be covered in circumference.
+This card can talk to the companion (wlp0) pccard.
+Speeds vary
+from 1 megabit to theoretically 2 megabits (roughly T1 in speed).
+.Pp
+The card has three fundamental hardware
+units, a so-called PSA or programmable storage area, a radio modem,
+and a Ethernet lan controller.
+The latter component is the
+ancient (and not very honorable) Intel 82586 Ethernet chip.
+Fundamentally it appears to the operating system as an Ethernet system,
+and speaks IEEE MAC addresses.
+The radio modem simply translates
+Ethernet packets to/from radio packets, that are either at 2.4 GHz
+or 915 MHz depending on the radio modem.
+It supports a collision
+avoidance scheme.
+The lan controller
+supports promiscuous mode, broadcast, and multicasting
+(although there is a glitch
+in the latter).
+"It thinks it is Ethernet".
+.Pp
+How it is used
+depends on the kind of antennae deployed with it.
+Point to point
+applications are possible as are Ethernet-like lan use.
+The vendor
+ships an omni-directional antennae that works in the
+vicinity of 400 feet (indoors).
+Point to point antennae can be purchased that will go miles.
+.Sh SETUP
+The card can either be initialized with the vendor supplied DOS setup software.
+Typically minimally an IRQ, port, and Network ID must be supplied.
+Michael Smith's
+.Xr wlconfig 8
+utility can now be used to do this work from
+the UNIX side.
+The card is "not" plug and play.
+The network id controls whether one set of cards can hear another.
+If different, cards will read physical packets, but they will be discarded
+by the radio modem.
+.Sh CONTROL
+In addition to the config utility, there are several sysctl
+switches that can be used to modify runtime parameters.
+The
+.Xr sysctl 8
+variables are as follows:
+.Bl -diag
+.It "machdep.wl_xmit_delay <useconds>"
+This variable will cause the driver to insert a delay on transmit.
+250 is the default.
+The delay should probably be a bit longer
+on faster cpus and less on slower cpus.
+It exists because the 82586
+was not designed to work with Pentium-speed cpu systems and if overdriven
+will have copious xmit side errors.
+.It machdep.wl_ignore_nwid <0 | 1>
+This switch defaults to 0; i.e., the nwid is not ignored.
+It can
+be set to 1 to cause the nwid to not be used.
+This may be useful
+when the device is in promiscuous mode as one can watch for all
+packets and ignore nwid differences.
+.It machdep.wl_xmit_watch <milliseconds>
+This switch is not currently useful.
+.It machdep.wl_gather_snr <milliseconds>
+This switch is not currently useful.
+.Pp
+There is also a signal strength cache in the driver.
+It may be interrogated
+with
+.Xr wlconfig 8 .
+Incoming packets
+are checked for certain hardware radio-modem values including signal
+strength, silence, and quality, which range fro 0..63, 0..63, and 0..15
+respectively.
+Thus one can read out signal strenth values to see
+how close/far peer nodes are.
+The signal strength cache is indexed by
+sender MAC address.
+There are two sysctls that change how it filters packets.
+Both are on
+by default.
+.It machdep.wl_wlcache_mcastonly <0 | 1>
+By default this switch is on.
+It forces the cache to filter out
+unicast packets.
+Only broadcast or multicast packets are accepted.
+.It machdep.wl_wlcache_iponly <0 | 1>
+By default this switch is on.
+It forces the driver to discard non-IP
+packets and also stores the IP src address.
+ARP packets are ignored,
+as are any other network protocol barring IPv4 packets.
+.El
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr wlconfig 8
+.Pp
+.Pa http://www.wavelan.com
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Anders Klemets
+(thousands of years ago?) and
+appears to be based on an even older Intel 82586 driver.
+The 82586
+controller was one of the first (if not the first?) integrated lan
+controller on the block.
+That does not mean it was the best either.
+Anders ported and or created a driver for the ISA wavelan and PCCARD
+wavelan system too (wlp).
+.An Robert T. Morris, Jr.
+ported the Mach drivers to BSDI.
+.An Jim Binkley
+ported them to
+.Fx 2.1 .
+.An Michael Smith
+ported the wl driver only to 2.2.2.
+Jim and Michael have been
+maintaining them.
+The current state of the driver is NOT ANYONE'S
+FAULT.
+Thanks to
+.An Bernie Doehner
+and
+.An Robert Buaas
+for contributions.
+.Sh AUTHORS
+Too numerous to mention.
+See above.
+.Sh CAVEATS
+The 82586 has numerous defects.
+It may experience transmit-side
+errors when modern faster cpus send packets at it faster than it can handle.
+The driver (and probably the chip) does not support an all multicast mode.
+As a result, it can be used with applications like
+.Xr mrouted 8 Pq Pa ports/net/mrouted ,
+but it must go into promiscuous mode for that to work.
+The driver
+is slow to change modes from "normal" to promiscuous mode, presumably
+due to delays in the configuration code.
diff --git a/share/man/man4/man4.powerpc/Makefile b/share/man/man4/man4.powerpc/Makefile
new file mode 100644
index 000000000000..09d8b70eb1f2
--- /dev/null
+++ b/share/man/man4/man4.powerpc/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+MAN= adb.4 \
+ akbd.4 \
+ abtn.4 \
+ ams.4 \
+ bm.4 \
+ cuda.4 \
+ pmu.4 \
+ powermac_nvram.4 \
+ smu.4 \
+ snd_ai2s.4 \
+ snd_davbus.4 \
+ tsec.4
+
+MANSUBDIR=/powerpc
+
+.include <bsd.prog.mk>
diff --git a/share/man/man4/man4.powerpc/abtn.4 b/share/man/man4/man4.powerpc/abtn.4
new file mode 100644
index 000000000000..670f5a270b5f
--- /dev/null
+++ b/share/man/man4/man4.powerpc/abtn.4
@@ -0,0 +1,115 @@
+.\"-
+.\" Copyright (c) 2011 Justin Hibbits
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 16, 2011
+.Dt ABTN 4
+.Os
+.Sh NAME
+.Nm abtn
+.Nd ADB Keyboard Special Keys Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the extended Fn keys on Apple notebooks with an ADB
+interface.
+.Sh HARDWARE
+The
+.Nm
+driver supports extended keyboard keys (special F-keys) on the following devices:
+.Pp
+.Bl -bullet -compact
+.It
+Apple iBook Keyboard
+.It
+Apple PowerBook Keyboard
+.El
+.Sh EVENTS
+The
+.Nm
+driver sends events to
+.Xr devd 8
+for the following events under the
+.Cd PMU
+system, and
+.Cd keys
+subsystem:
+.Pp
+.Bl -bullet -compact
+.It
+.Cd brightness
+- Generates
+.Cd up
+and
+.Cd down
+notify types matching the pressed key.
+.It
+.Cd mute
+.It
+.Cd volume
+- Generates
+.Cd up
+and
+.Cd down
+notify types matching the pressed key.
+.It
+.Cd eject
+.El
+.Pp
+Examples are included in /etc/devd/apple.conf.
+.Sh SEE ALSO
+.Xr adb 4 ,
+.Xr akbd 4 ,
+.Xr cuda 4 ,
+.Xr pmu 4 ,
+.Xr devd 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 5.0
+and was ported to
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Tsubai Masanari
+for
+.Nx
+and ported to
+.Fx
+by
+.An Justin Hibbits .
diff --git a/share/man/man4/man4.powerpc/adb.4 b/share/man/man4/man4.powerpc/adb.4
new file mode 100644
index 000000000000..eb34ecaf0c4e
--- /dev/null
+++ b/share/man/man4/man4.powerpc/adb.4
@@ -0,0 +1,70 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2009
+.Dt ADB 4
+.Os
+.Sh NAME
+.Nm adb
+.Nd Apple Desktop Bus
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Apple Desktop Bus, which is a simple
+multi-drop bus used in general for input peripherals in older Apple
+Macintosh hardware.
+.Pp
+The Apple Desktop Bus provides attachment for up to 16 devices,
+including multiple devices of a single type, but not does support
+hot-plugging.
+.Sh SEE ALSO
+Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse:
+.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html
+.Pp
+.Xr akbd 4 ,
+.Xr ams 4 ,
+.Xr cuda 4 ,
+.Xr pmu 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/akbd.4 b/share/man/man4/man4.powerpc/akbd.4
new file mode 100644
index 000000000000..e56676a76a2e
--- /dev/null
+++ b/share/man/man4/man4.powerpc/akbd.4
@@ -0,0 +1,105 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2009
+.Dt AKBD 4
+.Os
+.Sh NAME
+.Nm akbd
+.Nd ADB Keyboard Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all keyboards attached to the Apple Desktop
+Bus (ADB).
+.Sh HARDWARE
+Devices supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple Extended Keyboard
+.It
+Apple Keyboard II
+.It
+Apple iBook Keyboard
+.It
+Apple PowerBook Keyboard
+.El
+.Sh EVENTS
+The
+.Nm
+driver sends events to
+.Xr devd 8
+for the following events under the
+.Cd PMU
+system:
+.Pp
+.Bl -bullet -compact
+.It
+Power button -
+.Cd "Button"
+subsystem,
+.Cd "pressed"
+type.
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver supports the following sysctl variable for configuring the Fn keys:
+.Bl -tag -width indent
+.It Va dev.akbd.%d.fn_keys_function_as_primary
+Set the Fn keys to be their F-key type as default. A value of 0 causes the
+F-keys keys to work as special keys by default (
+.Xr abtn 4 )
+and a value of 1 sets them to behave as F-keys by default.
+.El
+.Sh SEE ALSO
+.Xr abtn 4 ,
+.Xr adb 4 ,
+.Xr cuda 4 ,
+.Xr pmu 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/ams.4 b/share/man/man4/man4.powerpc/ams.4
new file mode 100644
index 000000000000..15560cf3d9ed
--- /dev/null
+++ b/share/man/man4/man4.powerpc/ams.4
@@ -0,0 +1,87 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2009
+.Dt AMS 4
+.Os
+.Sh NAME
+.Nm ams
+.Nd ADB Mouse Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for mice and trackpads attached to the Apple Desktop
+Bus (ADB) implementing both the base and extended ADB mouse protocols.
+.Sh HARDWARE
+Devices supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple Mouse
+.It
+ADB Extended Mouse
+.It
+MacAlly 2-Button Mouse
+.It
+Apple iBook Trackpad
+.It
+Apple PowerBook Trackpad
+.El
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.It Va dev.ams.%d.tapping
+On ADB trackpads, setting this sysctl to 1 causes taps on the trackpad to
+be interpreted as button clicks.
+.El
+.Sh SEE ALSO
+Apple Tech Note HW01: ADB - The Untold Story: Space Aliens Ate My Mouse:
+.Pa http://developer.apple.com/legacy/mac/library/technotes/hw/hw_01.html
+.Pp
+.Xr adb 4 ,
+.Xr cuda 4 ,
+.Xr pmu 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/bm.4 b/share/man/man4/man4.powerpc/bm.4
new file mode 100644
index 000000000000..9d6a02970149
--- /dev/null
+++ b/share/man/man4/man4.powerpc/bm.4
@@ -0,0 +1,87 @@
+.\"-
+.\" Copyright (c) 2008 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 3, 2008
+.Dt BM 4
+.Os
+.Sh NAME
+.Nm bm
+.Nd BMAC Ethernet device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device bm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_bm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the BMac ethernet hardware found mostly in
+G3-based Apple hardware.
+It is a close relative of the Sun HME controller found in contemporary
+Sun workstations.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple BMAC Onboard Ethernet
+.It
+Apple BMAC+ Onboard Ethernet
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr hme 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org
+based on work by
+.An Peter Grehan
+.Aq grehan@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/cuda.4 b/share/man/man4/man4.powerpc/cuda.4
new file mode 100644
index 000000000000..f1faaf2d2919
--- /dev/null
+++ b/share/man/man4/man4.powerpc/cuda.4
@@ -0,0 +1,79 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 2009
+.Dt CUDA 4
+.Os
+.Sh NAME
+.Nm cuda
+.Nd Apple CUDA I/O Controller Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Cd "device cuda"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the CUDA VIA (Versatile Interface Attachment)
+chip found in pre-Core99 Apple hardware, such as the Power Macintosh G3.
+.Pp
+The Apple CUDA controller is a multi-purpose ASIC that provides power
+control and an
+.Xr adb 4
+interface.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple CUDA I/O Controller
+.El
+.Sh SEE ALSO
+.Xr adb 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 4.0 ,
+and then in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Lorenz
+.Aq macallan@NetBSD.org
+and ported to FreeBSD by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/pmu.4 b/share/man/man4/man4.powerpc/pmu.4
new file mode 100644
index 000000000000..ab998772a6f9
--- /dev/null
+++ b/share/man/man4/man4.powerpc/pmu.4
@@ -0,0 +1,116 @@
+.\"-
+.\" Copyright (c) 2008 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 6, 2008
+.Dt PMU 4
+.Os
+.Sh NAME
+.Nm pmu
+.Nd Apple PMU99 Power Management Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device adb"
+.Cd "device pmu"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Power Management Unit (PMU) found in Apple
+Core99 hardware.
+This includes late G3 laptops, all G4 machines, early G5
+desktops and all G5 XServes.
+.Pp
+The Apple PMU controller is a multi-purpose ASIC that provides power
+management and thermal control, as well as an ADB bus for the internal
+keyboard and mouse on laptops.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple KeyLargo PMU
+.It
+Apple K2-KeyLargo PMU
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver provides power management services in addition to an
+.Xr adb 4
+interface.
+The following sysctls can be used to control the
+power management behavior and to examine current system power and
+thermal conditions.
+.Bl -tag -width indent
+.It Va dev.pmu.%d.server_mode
+Restart after power failure behavior (1 causes system to reboot after power
+cut, 0 causes system to remain off).
+.It Va dev.pmu.%d.batteries.%d.present
+Indicates whether the relevant battery is inserted.
+.It Va dev.pmu.%d.batteries.%d.charging
+Indicates whether the battery is currently charging.
+.It Va dev.pmu.%d.batteries.%d.charge
+The current battery charge, in milliamp hours.
+.It Va dev.pmu.%d.batteries.%d.maxcharge
+The battery's self-reported maximum charge, in milliamp hours.
+.It Va dev.pmu.%d.batteries.%d.rate
+The current into the battery, in milliamps.
+While the battery is discharging,
+this will be negative.
+.It Va dev.pmu.%d.batteries.%d.voltage
+Battery voltage, in millivolts.
+.It Va dev.pmu.%d.batteries.%d.time
+Estimated time until full battery charge (or discharge), in minutes.
+.It Va dev.pmu.%d.batteries.%d.life
+Current fraction of the battery's maximum charge, in percent.
+.El
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr adb 4 ,
+.Xr led 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 4.0 ,
+and then in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Lorenz
+.Aq macallan@NetBSD.org
+and ported to FreeBSD by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/powermac_nvram.4 b/share/man/man4/man4.powerpc/powermac_nvram.4
new file mode 100644
index 000000000000..9aae9204adbf
--- /dev/null
+++ b/share/man/man4/man4.powerpc/powermac_nvram.4
@@ -0,0 +1,65 @@
+.\"-
+.\" Copyright (c) 2006 Maxim Sobolev <sobomax@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 5, 2010
+.Dt POWERMAC_NVRAM 4 powerpc
+.Os
+.Sh NAME
+.Nm powermac_nvram
+.Nd "non-volatile RAM"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device powermac_nvram"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+powermac_nvram_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the Open Firmware configuration NVRAM
+available on the Apple PowerPC-based machines.
+.Sh SEE ALSO
+.Xr eeprom 8 ,
+.Xr nvram 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Maxim Sobolev Aq sobomax@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/smu.4 b/share/man/man4/man4.powerpc/smu.4
new file mode 100644
index 000000000000..2550a0df6736
--- /dev/null
+++ b/share/man/man4/man4.powerpc/smu.4
@@ -0,0 +1,125 @@
+.\"-
+.\" Copyright (c) 2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 22, 2010
+.Dt SMU 4
+.Os
+.Sh NAME
+.Nm smu
+.Nd Apple System Management Unit Driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device smu"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the System Management Unit (SMU) found in many
+Apple G5 systems.
+This includes most Power Macintosh G5 and all iMac G5 systems.
+.Pp
+The Apple SMU controller provides software power management and thermal
+control functionality, and is responsible for managing system cooling
+devices.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple System Management Unit
+.El
+.Sh THERMAL MANAGEMENT
+The
+.Nm
+driver provides basic automatic thermal management. Without a userspace
+daemon providing more advanced control, the driver will attempt to maintain
+system temperatures in a conservative range through coarse-grained control of
+system cooling devices (see below). Automatic kernel-level thermal control
+will take over if more than 3 seconds elapses between userspace cooling
+setting adjustments.
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver provides power management services and thermal readout through a
+sysctl interface.
+The following sysctls can be used to control the
+power management behavior and to examine current system power and
+thermal conditions.
+.Bl -tag -width indent
+.It Va dev.smu.%d.server_mode
+Restart after power failure behavior (1 causes system to reboot after power
+cut, 0 causes system to remain off).
+.It Va dev.smu.%d.target_temp
+Target system temperature, in degrees Celsius. The
+.Nm
+driver will attempt to adjust fans to maintain the temperature of the
+warmest component in the system at or below this level.
+.It Va dev.smu.%d.critical_temp
+System critical temperature, in degrees Celsius. If any component in
+the system exceeds this temperature, the machine will be shut down within
+500 ms.
+.It Va dev.smu.%d.fans.%s.minrpm
+Minimum allowed speed for this fan.
+.It Va dev.smu.%d.fans.%s.maxrpm
+Maximum allowed speed for this fan.
+.It Va dev.smu.%d.fans.%s.rpm
+Current speed for this fan. The fan speed can be adjusted by changing this
+sysctl. If more than 3 seconds elapses between fan speed adjustments, the
+kernel will resume automatic control of the fan.
+.It Va dev.smu.%d.sensors.%s
+Current reading from this sensor. Four sensor types are supported. Temperature
+sensors are in units of degrees Celsius, current sensors in milliamps, voltage
+sensors in millivolts, and power sensors in milliwatts.
+.El
+.Sh LED INTERFACE
+The
+.Nm
+driver provides an
+.Xr led 4
+annunciator interface at
+.Pa /dev/led/sleepled .
+.Sh SEE ALSO
+.Xr acpi 4 ,
+.Xr pmu 4 ,
+.Xr led 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn
+.Aq nwhitehorn@FreeBSD.org .
diff --git a/share/man/man4/man4.powerpc/snd_ai2s.4 b/share/man/man4/man4.powerpc/snd_ai2s.4
new file mode 100644
index 000000000000..472a518b79e4
--- /dev/null
+++ b/share/man/man4/man4.powerpc/snd_ai2s.4
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 20, 2009
+.Dt SND_AI2S 4
+.Os
+.Sh NAME
+.Nm snd_ai2s
+.Nd "Apple I2S audio device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_ai2s"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_ai2s_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Apple I2S audio controllers found
+predominantly in G4 and G5 machines, along with the snapper and tumbler
+codecs. Some machines (e.g. the Mac Mini) do not have configurable
+codecs and so lack hardware volume control.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple Tumbler Audio
+.It
+Apple Snapper Audio
+.El
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr snd_davbus 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 2.0
+and then in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Tsubai Masanari
+.Aq tsubai@netbsd.org ,
+and ported to FreeBSD by
+.An Marco Trillo
+.Aq marcotrillo@gmail.com .
+.Sh BUGS
+Recording and operation with non-44.1 Khz audio are not currently supported.
diff --git a/share/man/man4/man4.powerpc/snd_davbus.4 b/share/man/man4/man4.powerpc/snd_davbus.4
new file mode 100644
index 000000000000..e220de27c35f
--- /dev/null
+++ b/share/man/man4/man4.powerpc/snd_davbus.4
@@ -0,0 +1,81 @@
+.\"-
+.\" Copyright (c) 2009 Nathan Whitehorn <nwhitehorn@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 20, 2009
+.Dt SND_DAVBUS 4
+.Os
+.Sh NAME
+.Nm snd_davbus
+.Nd "Apple Davbus audio device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_davbus"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_davbus_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Apple Davbus audio controllers found in
+many G3-era Apple machines.
+.Sh HARDWARE
+Chips supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Apple Burgundy Audio
+.It
+Apple Screamer Audio
+.El
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr snd_ai2s 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Marco Trillo
+.Aq marcotrillo@gmail.com .
+.Sh BUGS
+Recording is not currently supported.
diff --git a/share/man/man4/man4.powerpc/tsec.4 b/share/man/man4/man4.powerpc/tsec.4
new file mode 100644
index 000000000000..84db70e30677
--- /dev/null
+++ b/share/man/man4/man4.powerpc/tsec.4
@@ -0,0 +1,154 @@
+.\"
+.\" Copyright (c) 2009 Semihalf, Rafal Jaworowski
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 22, 2009
+.Dt TSEC 4
+.Os
+.Sh NAME
+.Nm tsec
+.Nd "Freescale Three-Speed Ethernet Controller device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device tsec"
+.Cd "device miibus"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the gigabit Ethernet controller integrated in
+some of the Freescale system-on-chip devices.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options
+.It 10baseT/UTP
+Set 10Mbps operation
+.It 100baseTX
+Set 100Mbps operation
+.It 1000baseT
+Set 1000baseT operation
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Set full duplex operation
+.El
+.Pp
+The
+.Nm
+driver supports polled operation when the system is configured with
+DEVICE_POLLING kernel option, see
+.Xr polling 4
+for more details.
+.Pp
+The
+.Nm
+driver supports reception and transmission of extended frames
+for
+.Xr vlan 4 .
+This capability of
+.Nm
+can be controlled by means of the
+.Cm vlanmtu
+parameter
+to
+.Xr ifconfig 8 .
+.Pp
+The
+.Nm
+driver supports interrupts coalescing (IC) so that raising a transmit/receive
+frame interrupt is delayed, if possible, until a threshold-defined period of
+time has elapsed, or a threshold-defined frame counter has been reached
+(whichever occurs first). The following sysctls regulate this behaviour:
+.Bl -tag -width indent
+.It Va dev.tsec.X.int_coal.rx_time
+.It Va dev.tsec.X.int_coal.rx_count
+.It Va dev.tsec.X.int_coal.tx_time
+.It Va dev.tsec.X.int_coal.tx_count
+.Pp
+Value of 0 for either time or count disables IC on the given path. Time value
+1-65535 corresponds to a real time period and is expressed in units equivalent
+to 64 ticks of the TSEC clock. Count 1-255 represents the number of frames
+(note that value of 1 is equivalent to IC disabled). User provided values
+larger than supported will be trimmed to the maximum supported. More details
+are available in the reference manual of the device.
+.El
+.Sh HARDWARE
+Gigabit Ethernet controllers built into the following Freescale
+system-on-chip devices are known to work with the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+MPC8349
+.It
+MPC8533, MPC8541, MPC8555
+.El
+.Pp
+The enhanced version of the controller (eTSEC), integrated in the following
+devices, is also supported by this driver:
+.Pp
+.Bl -bullet -compact
+.It
+MPC8548, MPC8572
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The base version of
+.Nm
+device driver was written by
+.An Piotr Kruszynski.
+It has been extended with polling and interrupt coalescing support by
+.An Rafal Jaworowski.
+It has been further enhanced with multicast, h/w checksum calculation and vlan
+support by
+.An Piotr Ziecik .
+This manual page was written by
+.An Rafal Jaworowski .
diff --git a/share/man/man4/man4.sparc64/Makefile b/share/man/man4/man4.sparc64/Makefile
new file mode 100644
index 000000000000..06d99c00a293
--- /dev/null
+++ b/share/man/man4/man4.sparc64/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+MAN= auxio.4 \
+ central.4 \
+ clkbrd.4 \
+ creator.4 \
+ ebus.4 \
+ eeprom.4 \
+ fhc.4 \
+ machfb.4 \
+ ofw_console.4 \
+ openfirm.4 \
+ openprom.4 \
+ rtc.4 \
+ sbus.4 \
+ snd_audiocs.4
+
+MLINKS= openfirm.4 openfirmware.4
+
+MANSUBDIR=/sparc64
+
+.include <bsd.prog.mk>
diff --git a/share/man/man4/man4.sparc64/auxio.4 b/share/man/man4/man4.sparc64/auxio.4
new file mode 100644
index 000000000000..fb3cdbdf2028
--- /dev/null
+++ b/share/man/man4/man4.sparc64/auxio.4
@@ -0,0 +1,80 @@
+.\"-
+.\" Copyright (c) 2004 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt AUXIO 4 sparc64
+.Os
+.Sh NAME
+.Nm auxio
+.Nd "Sun Auxiliary I/O"
+.Sh SYNOPSIS
+.Cd "device auxio"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the auxiliary I/O device found on the
+.Tn EBus
+and
+.Tn SBus
+busses of
+.Tn Sun UltraSPARC
+workstation and small server class systems.
+This device contains miscellaneous system controls,
+including the front panel LED.
+This LED can be made to blink by writing
+.Tn ASCII
+strings to the
+.Pa /dev/led/auxioled
+device.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/led/auxioled"
+.It Pa /dev/led/auxioled
+Auxiliary I/O device node
+.El
+.Sh SEE ALSO
+.Xr ebus 4 ,
+.Xr led 4 ,
+.Xr sbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 1.5 .
+The first
+.Fx
+version to include it was
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Matthew R. Green
+and ported to
+.Fx
+by
+.An Pyun YongHyeon Aq yongari@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/central.4 b/share/man/man4/man4.sparc64/central.4
new file mode 100644
index 000000000000..3fa09bdca0fc
--- /dev/null
+++ b/share/man/man4/man4.sparc64/central.4
@@ -0,0 +1,60 @@
+.\"-
+.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: central.4,v 1.3 2004/09/24 07:03:47 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt CENTRAL 4 sparc64
+.Os
+.Sh NAME
+.Nm central
+.Nd "Central host controller and bus"
+.Sh SYNOPSIS
+.Cd "device central"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn Central
+host controller and bus found in
+.Tn Sun Enterprise xx00
+systems.
+It provides an attachment point for the main
+.Xr fhc 4
+.Tn FireHose
+controller used to control board level functions on the host.
+.Sh SEE ALSO
+.Xr fhc 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Jake Burkholder" Aq jake@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/clkbrd.4 b/share/man/man4/man4.sparc64/clkbrd.4
new file mode 100644
index 000000000000..ad74ee288ef9
--- /dev/null
+++ b/share/man/man4/man4.sparc64/clkbrd.4
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: clkbrd.4,v 1.2 2005/02/21 11:29:36 jmc Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt CLKBRD 4 sparc64
+.Os
+.Sh NAME
+.Nm clkbrd
+.Nd "clock board"
+.Sh SYNOPSIS
+.Cd "device clkbrd"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the clock board found in
+.Tn Sun Enterprise xx00
+systems.
+The clock board has three status LEDs labeled
+.Dq Li Power ,
+.Dq Li Failure
+and
+.Dq Li Cycling .
+These LEDs are also mirrored on the main front panel.
+The
+.Dq Li Cycling
+LED can be made to blink by writing
+.Tn ASCII
+strings to the
+.Pa /dev/led/clockboard
+device.
+.Pp
+On attach the
+.Nm
+driver also prints out the number of board slots the chassis provides.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/led/clockboard"
+.It Pa /dev/led/clockboard
+clock board LED device node
+.El
+.Sh SEE ALSO
+.Xr fhc 4 ,
+.Xr led 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 3.7 .
+The first
+.Fx
+version to include it was
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Jason L. Wright"
+and ported to
+.Fx
+by
+.An "Marius Strobl" Aq marius@FreeBSD.org .
+.Sh CAVEATS
+Hardware management functionality is not implemented.
diff --git a/share/man/man4/man4.sparc64/creator.4 b/share/man/man4/man4.sparc64/creator.4
new file mode 100644
index 000000000000..5d7205be72ee
--- /dev/null
+++ b/share/man/man4/man4.sparc64/creator.4
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2002 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: creator.4,v 1.20 2005/03/05 01:48:59 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt CREATOR 4 sparc64
+.Os
+.Sh NAME
+.Nm creator
+.Nd "accelerated color frame buffer"
+.Sh SYNOPSIS
+.Cd "device creator"
+.Sh DESCRIPTION
+The
+.Tn Sun Creator ,
+.Tn Sun Creator3D
+and
+.Tn Sun Elite3D
+cards are color frame buffers with graphics acceleration available for
+.Tn UltraSPARC
+workstations with
+.Tn UPA
+slots.
+The
+.Nm
+driver interfaces those frame buffers with the
+.Xr syscons 4
+console driver.
+It also provides separate character devices
+.Pa /dev/fb*
+allowing to
+.Xr mmap 2
+these frame buffers
+(used by X11).
+.Sh FILES
+.Bl -tag -width ".Pa /dev/fb*"
+.It Pa /dev/fb*
+.Nm
+device nodes
+.El
+.Sh SEE ALSO
+.Xr machfb 4 ,
+.Xr syscons 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 3.2 .
+The first
+.Fx
+version to include it was
+.Fx 5.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Jake Burkholder" Aq jake@FreeBSD.org
+roughly based on the
+.Ox
+driver written by
+.An "Jason L. Wright" .
+.Sh CAVEATS
+Font loading and mode switching are not implemented.
diff --git a/share/man/man4/man4.sparc64/ebus.4 b/share/man/man4/man4.sparc64/ebus.4
new file mode 100644
index 000000000000..2dd9807a200d
--- /dev/null
+++ b/share/man/man4/man4.sparc64/ebus.4
@@ -0,0 +1,122 @@
+.\"-
+.\" Copyright (c) 1999 Matthew R. Green
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: ebus.4,v 1.6 2004/09/23 18:28:51 jason Exp
+.\" from: NetBSD: ebus.4,v 1.3 2002/03/13 21:42:20 wiz Exp
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2006
+.Dt EBUS 4 sparc64
+.Os
+.Sh NAME
+.Nm ebus
+.Nd "EBus controller and bus"
+.Sh SYNOPSIS
+.Cd "device ebus"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the EBus controller and bus found in most
+.Tn PCI
+based
+.Tn UltraSPARC
+systems.
+The
+.Tn EBus
+bus is designed to provide the ability to put
+.Tn ISA
+and traditional
+.Tn Intel
+style peripherals in a
+.Tn SPARC
+based system with a minimal amount of glue logic.
+In
+.Tn UltraSPARC
+systems it is implemented with either a PCIO or a PCIO-2 chip from
+.Tn Sun Microelectronics .
+The PCIO chip also implements a
+.Xr hme 4
+compatible
+.Tn PCI
+network device.
+The PCIO-2 chip also implements a
+.Xr fwohci 4
+compatible
+.Tn IEEE
+.Tn 1394
+.Tn OHCI
+interface, a
+.Xr gem 4
+compatible
+.Tn PCI
+network device and an
+.Xr ohci 4
+compatible
+.Tn OHCI
+.Tn USB
+controller.
+The
+.Tn EBus
+has four DMA channels,
+similar to the DMA seen in the
+.Xr esp 4
+.Tn SCSI
+DMA.
+.Sh SEE ALSO
+.Xr atkbdc 4 ,
+.Xr auxio 4 ,
+.Xr eeprom 4 ,
+.Xr rtc 4 ,
+.Xr scc 4 ,
+.Xr snd_audiocs 4 ,
+.Xr uart 4
+.Rs
+.%Q "Sun Microelectronics"
+.%T "Peripheral Component Interconnect Input Output Controller"
+.%V "Part No.: 802-7837-01"
+.%D "March 1997"
+.%U "http://www.sun.com/oem/products/manuals/802-7837.pdf"
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 1.5 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Matthew R. Green"
+and ported to
+.Fx
+by
+.An "Thomas Moestl" Aq tmm@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/eeprom.4 b/share/man/man4/man4.sparc64/eeprom.4
new file mode 100644
index 000000000000..58af4e892ecf
--- /dev/null
+++ b/share/man/man4/man4.sparc64/eeprom.4
@@ -0,0 +1,130 @@
+.\"-
+.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net)
+.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: clock.4,v 1.3 2004/09/24 07:04:15 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd February 15, 2006
+.Dt EEPROM 4 sparc64
+.Os
+.Sh NAME
+.Nm eeprom
+.Nd "non-volatile RAM / real time clock"
+.Sh SYNOPSIS
+.Cd "device genclock"
+.Cd "device mk48txx"
+.Cd "device eeprom"
+.Sh DESCRIPTION
+The
+.Nm
+driver is a front-end for the machine-independent
+.Tn Mostek
+MK48Txx driver.
+The
+.Tn Mostek
+MK48Txx driver provides access to the real time clock and the watchdog part
+of the supported chips to
+.Fx
+by interfacing them with the generic clock code and
+.Xr watchdog 4
+respectively.
+.Pp
+.Tn Mostek
+MK48Txx chips providing real time clock functionality are found on the
+.Tn EBus ,
+.Tn FireHose
+and
+.Tn SBus
+busses of
+.Tn UltraSPARC
+systems.
+On systems where the hostid is stored in the NVRAM part of the
+.Tn Mostek
+MK48Txx chip the
+.Nm
+driver prints out the hostid on attach.
+.Pp
+On
+.Tn Sun Enterprise
+250 and 450 systems additionally the watchdog functionality of the
+.Tn Mostek
+MK48Txx chips is available.
+The
+.Nm
+driver automatically registers the watchdog part with
+.Xr watchdog 4
+on these systems.
+Thus it can be used with
+.Xr watchdog 8
+and
+.Xr watchdogd 8 .
+The timeout interval supported by the
+.Tn Mostek
+MK48Txx watchdog is 1/16 second to 128 seconds.
+In the
+.Tn Sun Enterprise
+machines a system reset is triggered when the
+.Tn Mostek
+MK48Txx watchdog times out regardless of what the
+.Tn Open Firmware
+environment variable
+.Va watchdog-reboot?
+is set to.
+.Sh DIAGNOSTICS
+The following driver specific error message may be reported:
+.Bl -diag
+.It "mk48txx_attach: battery low"
+The device signals that its battery is low and should be replaced.
+The
+.Nm
+driver refused to attach the device in this case as the time in the real time
+clock is probably invalid.
+This gives the generic clock code the chance to use another device as the
+system real time clock that otherwise would not have been chosen.
+.El
+.Sh SEE ALSO
+.Xr ebus 4 ,
+.Xr fhc 4 ,
+.Xr rtc 4 ,
+.Xr sbus 4 ,
+.Xr watchdog 4 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Thomas Moestl" Aq tmm@FreeBSD.org
+based on the
+.Nx
+sparc64 clock code written by
+.An "Paul Kranenburg" .
diff --git a/share/man/man4/man4.sparc64/fhc.4 b/share/man/man4/man4.sparc64/fhc.4
new file mode 100644
index 000000000000..378737060f38
--- /dev/null
+++ b/share/man/man4/man4.sparc64/fhc.4
@@ -0,0 +1,82 @@
+.\"-
+.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: fhc.4,v 1.5 2004/09/28 21:42:59 jmc Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt FHC 4 sparc64
+.Os
+.Sh NAME
+.Nm fhc
+.Nd "FireHose controller and bus"
+.Sh SYNOPSIS
+.Cd "device fhc"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn FireHose
+controllers and busses found in
+.Tn Sun Enterprise xx00
+systems.
+These controllers are also used for board level functions on these systems.
+Each board has three status LEDs labeled
+.Dq Li Power ,
+.Dq Li Failure
+and
+.Dq Li Cycling .
+The
+.Dq Li Cycling
+LEDs can be made to blink by writing
+.Tn ASCII
+strings to the
+.Pa /dev/led/board Ns Ar N
+devices where
+.Ar N
+represents the physical slot number of the board.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/led/board Ns Ar N"
+.It Pa /dev/led/board Ns Ar N
+board
+.Ar N
+LED device node
+.El
+.Sh SEE ALSO
+.Xr central 4 ,
+.Xr clkbrd 4 ,
+.Xr eeprom 4 ,
+.Xr led 4 ,
+.Xr uart 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Jake Burkholder" Aq jake@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/machfb.4 b/share/man/man4/man4.sparc64/machfb.4
new file mode 100644
index 000000000000..c42eb9b08b98
--- /dev/null
+++ b/share/man/man4/man4.sparc64/machfb.4
@@ -0,0 +1,180 @@
+.\"-
+.\" Copyright (c) 2002 Jason L. Wright (jason@thought.net)
+.\" Copyright (c) 2005, 2006 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: creator.4,v 1.20 2005/03/05 01:48:59 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd September 2, 2006
+.Dt MACHFB 4 sparc64
+.Os
+.Sh NAME
+.Nm machfb
+.Nd "accelerated color frame buffer"
+.Sh SYNOPSIS
+.Cd "device machfb"
+.Sh DESCRIPTION
+The
+.Tn ATI Mach64
+family of chips are color frame buffers with graphics acceleration.
+The
+.Nm
+driver interfaces those frame buffers with the
+.Xr syscons 4
+console driver.
+.Pp
+.Tn ATI Mach64
+chips are very common as low-end graphics chips in
+.Tn PCI
+based
+.Tn UltraSPARC
+systems.
+They are found on-board in
+.Tn Sun Blade 100 ,
+.Tn Sun Blade 150 ,
+.Tn Sun Ultra 5
+and
+.Tn Sun Ultra 10
+as well as on
+.Tn Sun
+OEM mainboards like the
+.Tn Sun AXe .
+They are also used on add-on cards like the
+.Tn Sun PGX
+and
+.Tn Sun PGX64 .
+.Pp
+The
+.Nm
+driver requires the chip which it is supposed to drive to be also
+supported by the
+.Tn Open Firmware ,
+either by a built-in FCode driver package of the on-board firmware
+or by additional FCode on the add-on card.
+As a matter of course
+.Tn UltraSPARC
+systems with an on-board
+.Tn ATI Mach64 chip
+also have a built-in FCode driver package for this chip.
+There are also mainboards like the
+.Tn Sun AX1105
+and
+.Tn Sun AXi
+boards however,
+which have built-in FCode for certain
+.Tn ATI Mach64
+chips although they are not equipped with an on-board one.
+Mainboards with built-in FCode for certain
+.Tn ATI Mach64
+chips can be used with any add-on card which is based on one of those
+chips,
+including cards which are equipped with x86 firmware and intended for
+use in PCs.
+Otherwise an add-on card which comes with its own FCode like the
+.Tn Sun PGX
+or
+.Tn Sun PGX64
+has to be used.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following chips:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn ATI 3D Rage II+
+.It
+.Tn ATI 3D Rage IIC
+.It
+.Tn ATI 3D Rage I/II
+.It
+.Tn ATI 3D Rage LT
+.It
+.Tn ATI 3D Rage LT Pro
+.It
+.Tn ATI 3D Rage Pro
+.It
+.Tn ATI 3D Rage Pro Turbo
+.It
+.Tn ATI Mach64 CT
+.It
+.Tn ATI Mach64 VT
+.It
+.Tn ATI Mach64 VT4
+.It
+.Tn ATI Mach64 VTB
+.It
+.Tn ATI Rage L Mobility
+.It
+.Tn ATI Rage Mobility
+.It
+.Tn ATI Rage Mobility M1
+.It
+.Tn ATI Rage Mobility M3
+.It
+.Tn ATI Rage XC
+.It
+.Tn ATI Rage XL
+.El
+.Pp
+The
+following add-on cards are known to work with the
+.Nm
+driver at this time:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn ATI 3D Charger PCI
+.It
+.Tn Sun PGX 8-Bit Color Frame Buffer
+(part no.\& 370-2256)
+.It
+.Tn Sun PGX64 8/24-Bit Color Frame Buffer
+(part no.\& 370-4362)
+.El
+.Sh SEE ALSO
+.Xr creator 4 ,
+.Xr syscons 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 2.0 .
+The first
+.Fx
+version to include it was
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Marius Strobl" Aq marius@FreeBSD.org
+based on the
+.Nx
+driver written by
+.An "Bang Jun-Young" .
+.Sh CAVEATS
+Font loading and mode switching are not implemented.
diff --git a/share/man/man4/man4.sparc64/ofw_console.4 b/share/man/man4/man4.sparc64/ofw_console.4
new file mode 100644
index 000000000000..9a4513b10506
--- /dev/null
+++ b/share/man/man4/man4.sparc64/ofw_console.4
@@ -0,0 +1,126 @@
+.\"-
+.\" Copyright (c) 2001 Miodrag Vallat.
+.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistribution of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: pcons.4,v 1.4 2003/06/02 16:16:26 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt OFW_CONSOLE 4 sparc64
+.Os
+.Sh NAME
+.Nm ofw_console
+.Nd "Open Firmware console"
+.Sh SYNOPSIS
+.Cd "device ofw_console"
+.Cd "options OFWCONS_POLL_HZ=N"
+.Pp
+.Cd "options KDB"
+.Cd "options DDB"
+.Cd "options ALT_BREAK_TO_DEBUGGER"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a simple text console,
+using the Open Firmware services for input and output.
+It will use the Open Firmware console devices set via the
+.Va input-device
+and
+.Va output-device
+variables.
+.Pp
+This driver is deprecated and only provided as a fallback console mechanism
+if the real console hardware can not be driven by
+.Fx .
+.Pp
+In case the
+.Nm
+console appears to work too slowly, its responsiveness probably can be improved
+by including
+.Cd "options OFWCONS_POLL_HZ=N" .
+When omitted,
+.Dv OFWCONS_POLL_HZ
+defaults to 4.
+For example, on
+.Tn Sun Ultra 2
+a value of 20 or higher works best.
+Too high values, on the other hand, can cause
+.Nm
+to unnecessarily consume CPU.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/keyboard" -compact
+.It Pa /dev/console
+.It Pa /dev/keyboard
+terminal input device in case the console input device is the keyboard
+.It Pa /dev/screen
+terminal output device in case the console output device is the screen
+.It Pa /dev/tty[a-z]
+terminal device in case both the console input and output device is tty[a-z]
+.El
+.Sh SEE ALSO
+.Xr creator 4 ,
+.Xr machfb 4 ,
+.Xr syscons 4 ,
+.Xr uart 4 ,
+.Xr eeprom 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Benno Rice" Aq benno@FreeBSD.org .
+.Sh CAVEATS
+Since the Open Firmware will handle BREAK
+(or Stop-A)
+sequences before
+.Nm ,
+the preferred way to enter
+.Xr ddb 4
+when using
+.Nm
+is to include
+.Cd "options ALT_BREAK_TO_DEBUGGER"
+in a ddb-enabled kernel, and enter the alternate BREAK sequence
+(RETURN TILDE CTRL-b).
+.Sh BUGS
+The
+.Nm
+driver
+is not a real
+.Xr tty 4
+driver and is not MPSAFE.
+The
+.Nm
+driver also does not attach to the hardware resources it actually talks to.
+Therefore it cannot be included in the kernel together with real console
+hardware drivers
+like
+.Xr creator 4 ,
+.Xr machfb 4
+and
+.Xr uart 4 .
diff --git a/share/man/man4/man4.sparc64/openfirm.4 b/share/man/man4/man4.sparc64/openfirm.4
new file mode 100644
index 000000000000..4b6bde78943f
--- /dev/null
+++ b/share/man/man4/man4.sparc64/openfirm.4
@@ -0,0 +1,300 @@
+.\"-
+.\" Copyright (c) 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This software was developed by the Computer Systems Engineering group
+.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+.\" contributed to Berkeley.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)openprom.4 8.1 (Berkeley) 6/5/93
+.\" from: OpenBSD: openprom.4,v 1.9 2004/03/22 22:07:21 miod Exp
+.\"
+.\"-
+.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2006
+.Dt OPENFIRM 4 sparc64
+.Os
+.Sh NAME
+.Nm openfirm
+.Nd "Open Firmware interface"
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/ioctl.h
+.In dev/ofw/openfirmio.h
+.Sh DESCRIPTION
+The
+.Pa /dev/openfirm
+device is an interface to the
+.Tn Open Firmware
+device tree.
+This interface is similar to the
+.Tn SunOS /
+.Tn Solaris
+compatible
+.Xr openprom 4
+interface and highly stylized.
+It uses
+.Xr ioctl 2
+calls for all operations.
+These calls refer to the nodes in the
+.Tn Open Firmware
+device tree.
+The nodes are represented by package handles,
+which are simply integer values describing data areas.
+Occasionally a package handle of 0 may be used or returned instead,
+as described below.
+.Pp
+The calls that only take and/or return the package handle of a node
+use a pointer to a
+.Vt phandle_t
+for this purpose.
+The others use a pointer to a
+.Vt "struct ofiocdesc"
+descriptor,
+which has the following definition:
+.Bd -literal
+struct ofiocdesc {
+ phandle_t of_nodeid;
+ int of_namelen;
+ const char *of_name;
+ int of_buflen;
+ char *of_buf;
+};
+.Ed
+.Pp
+The
+.Va of_nodeid
+member is the package handle of the node that is passed in or returned.
+Strings are passed in via the
+.Va of_name
+member of
+.Va of_namelen
+length.
+The maximum accepted length of
+.Va of_name
+is
+.Dv OFIOCMAXNAME .
+The
+.Va of_buf
+member is used to return strings except for the
+.Dv OFIOCSET
+call where it is also used to pass in a string.
+In the latter case the maximum accepted length of
+.Va of_buf
+is
+.Dv OFIOCMAXVALUE .
+Generally,
+.Va of_buf
+works in a value-result fashion.
+At entry to the
+.Xr ioctl 2
+call,
+.Va of_buflen
+is expected to reflect the buffer size.
+On return,
+.Va of_buflen
+is updated to reflect the buffer contents.
+.Pp
+The following
+.Xr ioctl 2
+calls are supported:
+.Bl -tag -width ".Dv OFIOCGETOPTNODE"
+.It Dv OFIOCGETOPTNODE
+Uses a
+.Vt phandle_t .
+Takes nothing and returns the package handle of the
+.Pa /options
+node.
+.It Dv OFIOCGETNEXT
+Uses a
+.Vt phandle_t .
+Takes the package handle of a node and returns the package handle of the next
+node in the
+.Tn Open Firmware
+device tree.
+The node following the last node has a package handle of 0.
+The node following the node with the package handle of 0 is the first node.
+.It Dv OFIOCGETCHILD
+Uses a
+.Vt phandle_t .
+Takes the package handle of a node and returns the package handle of the first
+child of that node.
+This child may have siblings.
+These can be determined by using
+.Dv OFIOCGETNEXT .
+If the node does not have a child,
+a package handle of 0 is returned.
+.It Dv OFIOCGET
+Uses a
+.Vt "struct ofiocdesc" .
+Takes the package handle of a node and the name of a property.
+Returns the property value and its length.
+If no such property is associated with that node,
+the length of the value is set to \-1.
+If the named property exists but has no value,
+the length of the value is set to 0.
+.It Dv OFIOCGETPROPLEN
+Uses a
+.Vt "struct ofiocdesc" .
+Takes the package handle of a node and the name of a property.
+Returns the length of the property value.
+This call is the same as
+.Dv OFIOCGET
+except that only the length of the property value is returned.
+It can be used to determine whether a node has a particular property or whether
+a property has a value without the need to provide memory for storing the value.
+.It Dv OFIOCSET
+Uses a
+.Vt "struct ofiocdesc" .
+Takes the package handle of a node,
+the name of a property and a property value.
+Returns the property value and the length that actually have been written.
+The
+.Tn Open Firmware
+may choose to truncate the value if it is too long or write a valid value
+instead if the given value is invalid for the particular property.
+Therefore the returned value should be checked.
+The
+.Tn Open Firmware
+may also completely refuse to write the given value to the property.
+In this case
+.Er EINVAL
+is returned.
+.It Dv OFIOCNEXTPROP
+Uses a
+.Vt "struct ofiocdesc" .
+Takes the package handle of a node and the name of a property.
+Returns the name and the length of the next property of the node.
+If the property referenced by the given name is the last property of the node,
+.Er ENOENT
+is returned.
+.It Dv OFIOCFINDDEVICE
+Uses a
+.Vt "struct ofiocdesc" .
+Takes the name or alias name of a device node.
+Returns package handle of the node.
+If no matching node is found,
+.Er ENOENT
+is returned.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/openfirm"
+.It Pa /dev/openfirm
+Open Firmware interface node
+.El
+.Sh DIAGNOSTICS
+The following may result in rejection of an operation:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The requested operation requires permissions not specified at the call to
+.Fn open .
+.It Bq Er EINVAL
+The given package handle is not 0 and does not correspond to any valid node,
+or the given package handle is 0 where 0 is not allowed.
+.It Bq Er ENAMETOOLONG
+The given name or value exceeds the maximum allowed length of
+.Dv OFIOCMAXNAME
+and
+.Dv OFIOCMAXVALUE
+bytes respectively.
+.It Bq Er ENOMEM
+The kernel could not allocate memory to copy in data from user-space or to
+retrieve data from the
+.Tn Open Firmware .
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr openprom 4 ,
+.Xr eeprom 8 ,
+.Xr ofwdump 8
+.Rs
+.%Q "IEEE Standards Organization"
+.%B "IEEE Std 1275-1994:"
+.%B "IEEE Standard for Boot Firmware (Initialization Configuration) Firmware:"
+.%B Core Requirements and Practices"
+.%O ISBN 1-55937-426-8
+.Re
+.Sh HISTORY
+The
+.Nm
+interface first appeared in
+.Nx 1.6 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+interface was ported to
+.Fx
+by
+.An "Thomas Moestl" Aq tmm@FreeBSD.org .
+.Sh CAVEATS
+Due to limitations within
+.Tn Open Firmware
+itself,
+these functions run at elevated priority and may adversely affect system
+performance.
+.Pp
+For at least the
+.Pa /options
+node the property value passed in to the
+.Dv OFIOCSET
+call has to be null-terminated and the value length passed in has to include
+the terminating
+.Ql \e0 .
+However, as with the
+.Dv OFIOCGET
+call,
+the returned value length does not include the terminating
+.Ql \e0 .
diff --git a/share/man/man4/man4.sparc64/openprom.4 b/share/man/man4/man4.sparc64/openprom.4
new file mode 100644
index 000000000000..38a2291f098f
--- /dev/null
+++ b/share/man/man4/man4.sparc64/openprom.4
@@ -0,0 +1,240 @@
+.\"-
+.\" Copyright (c) 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This software was developed by the Computer Systems Engineering group
+.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+.\" contributed to Berkeley.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)openprom.4 8.1 (Berkeley) 6/5/93
+.\" from: OpenBSD: openprom.4,v 1.9 2004/03/22 22:07:21 miod Exp
+.\"
+.\"-
+.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt OPENPROM 4 sparc64
+.Os
+.Sh NAME
+.Nm openprom
+.Nd "OPENPROM interface"
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/ioctl.h
+.In dev/ofw/openpromio.h
+.Sh DESCRIPTION
+The
+.Pa /dev/openfirm
+device is a
+.Tn SunOS /
+.Tn Solaris
+compatible interface to the
+.Tn Open Firmware
+device tree.
+This interface is similar to the
+.Xr openprom 4
+interface.
+It uses
+.Xr ioctl 2
+calls for all operations.
+These calls refer to the nodes in the
+.Tn Open Firmware
+device tree.
+However,
+.Fx
+only implements a subset of the
+.Xr ioctl 2
+calls
+.Tn SunOS /
+.Tn Solaris
+does.
+The nodes are represented by integer values,
+which are simply describing data areas.
+Occasionally the number 0 may be used or returned instead,
+as described below.
+.Pp
+All calls use a pointer to a
+.Vt "struct openpromio"
+descriptor,
+which has the following definition:
+.Bd -literal
+struct openpromio {
+ uint32_t oprom_size;
+ char oprom_array[];
+};
+.Ed
+.Pp
+The
+.Va oprom_size
+member refers to the size of
+.Va oprom_array .
+The
+.Va oprom_array
+member actually works like a union.
+Depending on the
+.Xr ioctl 2
+call and whether the
+.Vt "struct openpromio"
+is used to pass in or return data,
+.Va oprom_array
+either contains an integer referring to a node or a string referring to a
+property name or property value.
+The maximum size of
+.Va oprom_array
+is
+.Dv OPROMMAXPARAM .
+.Pp
+The following
+.Xr ioctl 2
+calls are currently implemented:
+.Bl -tag -width ".Dv OPROMGETPROP"
+.It Dv OPROMNEXT
+Takes the number of a node and returns the number of the next node in the
+.Tn Open Firmware
+device tree.
+The node following the last node is number 0.
+The node following number 0 is the first node.
+.It Dv OPROMCHILD
+Takes the number of a node and returns the number of the first child of that
+node.
+This child may have siblings.
+These can be determined by using
+.Dv OPROMNEXT .
+If the node does not have a child,
+0 is returned.
+.It Dv OPROMGETPROP
+Takes the name of a property.
+Returns the property value.
+The
+.Dv OPROMGETPROP
+call refers to the node previously returned by either the
+.Dv OPROMNEXT
+or the
+.Dv OPROMCHILD
+call,
+depending on which one was invoked last.
+If the property referenced by the given name is not associated with that node,
+.Er EINVAL
+is returned.
+If the named property exists but has no value,
+an empty string is returned.
+.It Dv OPROMNXTPROP
+Takes the name of a property.
+Returns the name of the next property of the node.
+As with the
+.Dv OPROMGETPROP
+call,
+the
+.Dv OPROMNXTPROP
+call refers to the node previously returned by either the
+.Dv OPROMNEXT
+or the
+.Dv OPROMCHILD
+call.
+If the property referenced by the given name is the last property of the node,
+an empty string is returned.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/openprom"
+.It Pa /dev/openprom
+OPENPROM interface node
+.El
+.Sh DIAGNOSTICS
+The following may result in rejection of an operation:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+The
+.Pa /dev/openprom
+node is already opened.
+.It Bq Er EINVAL
+The given node number is not 0 and does not correspond to any valid node,
+or the given node number is 0 where 0 is not allowed,
+or the given size value is invalid,
+or the given property name exceeds the maximum allowed length of
+.Dv OPROMMAXPARAM
+bytes.
+.It Bq Er ENOMEM
+The kernel could not allocate memory to copy in data from user-space or to
+retrieve data from the
+.Tn Open Firmware .
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr openfirm 4 ,
+.Xr eeprom 8 ,
+.Xr ofwdump 8
+.Sh HISTORY
+The first
+.Fx
+version to include the
+.Nm
+interface was
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+interface was written by
+.An "Jake Burkholder" Aq jake@FreeBSD.org .
+.Sh CAVEATS
+Due to limitations within
+.Tn Open Firmware
+itself,
+these functions run at elevated priority and may adversely affect system
+performance.
+.Pp
+The
+.Nm
+interface exists entirely for compatibility with software like X11,
+and only the features that are actually needed for that are implemented.
+The interface sucks too much to actually use,
+new code should use the
+.Xr openfirm 4
+interface instead.
diff --git a/share/man/man4/man4.sparc64/rtc.4 b/share/man/man4/man4.sparc64/rtc.4
new file mode 100644
index 000000000000..9117bf325b7c
--- /dev/null
+++ b/share/man/man4/man4.sparc64/rtc.4
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2004 Jason L. Wright (jason@thought.net)
+.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: clock.4,v 1.3 2004/09/24 07:04:15 miod Exp
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2005
+.Dt RTC 4 sparc64
+.Os
+.Sh NAME
+.Nm rtc
+.Nd "non-volatile RAM / real time clock"
+.Sh SYNOPSIS
+.Cd "device genclock"
+.Cd "device mc146818"
+.Cd "device rtc"
+.Sh DESCRIPTION
+The
+.Nm
+driver is a front-end for the machine-independent
+.Tn Motorola
+MC146818 and compatible clocks driver.
+The
+.Tn Motorola
+MC146818 and compatible clocks driver provides access to the real time clock
+part of the chips it supports to
+.Fx
+by interfacing with the generic clock code.
+.Pp
+.Tn Dallas /
+.Tn Maxim Semiconductor
+DS1287 chips
+(those are compatible to the
+.Tn Motorola
+MC146818 clocks)
+are found on the ISA bus of
+.Tn UltraSPARC II
+systems and the EBus bus of
+.Tn UltraSPARC III
+systems.
+.Sh DIAGNOSTICS
+The following driver specific error message may be reported:
+.Bl -diag
+.It "mc146818_attach_attach: battery low"
+The device signals that its battery is low and should be replaced.
+The
+.Nm
+driver refused to attach the device in this case as the time in the real time
+clock is probably invalid.
+This gives the generic clock code the chance to use another device as the
+system real time clock that otherwise would not have been chosen.
+.El
+.Sh SEE ALSO
+.Xr ebus 4 ,
+.Xr eeprom 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An "Marius Strobl" Aq marius@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/sbus.4 b/share/man/man4/man4.sparc64/sbus.4
new file mode 100644
index 000000000000..7955727994b4
--- /dev/null
+++ b/share/man/man4/man4.sparc64/sbus.4
@@ -0,0 +1,79 @@
+.\"-
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" from: OpenBSD: sbus.4,v 1.27 2005/03/05 01:44:48 miod Exp
+.\" from: NetBSD: sbus.4,v 1.5 2002/01/21 17:54:10 wiz Exp
+.\" $FreeBSD$
+.\"
+.Dd September 1, 2006
+.Dt SBUS 4 sparc64
+.Os
+.Sh NAME
+.Nm sbus
+.Nd SBus controller and bus
+.Sh SYNOPSIS
+.Cd "device sbus"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the SBus controllers and busses found in older
+.Tn UltraSPARC
+workstations and small to medium server class systems.
+The SBus is an I/O interconnect bus supporting both on-board peripherals and
+extension boards.
+The SBus specifications define the bus protocol as well as the electrical and
+mechanical properties of the extension slots.
+.Sh SEE ALSO
+.Xr auxio 4 ,
+.Xr eeprom 4 ,
+.Xr esp 4 ,
+.Xr hme 4 ,
+.Xr isp 4 ,
+.Xr le 4 ,
+.Xr scc 4 ,
+.Xr snd_audiocs 4 ,
+.Xr uart 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 1.3 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An "Paul Kranenburg"
+and ported to
+.Fx
+by
+.An "Thomas Moestl" Aq tmm@FreeBSD.org .
diff --git a/share/man/man4/man4.sparc64/snd_audiocs.4 b/share/man/man4/man4.sparc64/snd_audiocs.4
new file mode 100644
index 000000000000..5fcc44ab56c3
--- /dev/null
+++ b/share/man/man4/man4.sparc64/snd_audiocs.4
@@ -0,0 +1,88 @@
+.\"-
+.\" Copyright (c) 2004 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_AUDIOCS 4 sparc64
+.Os
+.Sh NAME
+.Nm snd_audiocs
+.Nd "Crystal Semiconductor CS4231 audio device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_audiocs"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_audiocs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the CS4231 audio device.
+Speaker output is enabled by default.
+SBus based
+.Tn UltraSPARC
+workstations have no internal CD-ROM audio input capability.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+CS4231 on SBus based UltraSPARC
+.It
+CS4231 on PCI/EBus based UltraSPARC
+.El
+.Sh SEE ALSO
+.Xr ebus 4 ,
+.Xr sbus 4 ,
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was ported by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org
+from the
+.Ox
+driver written by
+.An Jason L. Wright .
diff --git a/share/man/man4/mcd.4 b/share/man/man4/mcd.4
new file mode 100644
index 000000000000..8efa7db6f841
--- /dev/null
+++ b/share/man/man4/mcd.4
@@ -0,0 +1,169 @@
+.\"
+.\" Copyright (c) 1994 Keith E. Walker
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 8, 1994
+.Dt MCD 4
+.Os
+.Sh NAME
+.Nm mcd
+.Nd Mitsumi CD-ROM driver
+.Sh SYNOPSIS
+.Cd "device mcd"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.mcd.0.at="isa"
+.Cd hint.mcd.0.port="0x300"
+.Cd hint.mcd.0.irq="10"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a data and audio interface to the Mitsumi-brand CD-ROM
+player.
+The CD-ROM player must be interfaced to the ISA bus through
+one of the Mitsumi proprietary controller boards.
+The controller
+boards supported are the LU002S, LU005S, the FX001 and the quite
+common FX001D.
+.Pp
+The
+.Nm
+driver responds to disk-specific
+.Fn ioctl
+commands, namely the
+.Dv DIOCGDINFO ,
+.Dv DIOCGPART ,
+.Dv DIOCWDINFO ,
+and
+.Dv DIOCSDINFO ,
+commands.
+Other disk-specific
+.Fn ioctl
+commands will return an error.
+.Pp
+The
+.Nm
+driver also responds to special CD-ROM
+.Fn ioctl
+commands.
+These commands
+control the CD-ROM player's audio features.
+The commands are:
+.Pp
+.Bl -tag -width CDIOCREADSUBCHANNEL -compact -offset indent
+.It CDIOCREADSUBCHANNEL
+get sub-channel information on current status of disc playing
+.It CDIOCREADTOCHEADER
+get table of contents header
+.It CDIOCREADTOCENTRYS
+gets all of the table of contents
+.It CDIOCPLAYTRACKS
+begins audio playing at location specified
+.It CDIOCPLAYBLOCKS
+fails with error
+.Er EINVAL
+.It CDIOCPLAYMSF
+begins audio playing at location specified
+.It CDIOCRESUME
+resumes playing a previously paused disc
+.It CDIOCPAUSE
+pauses a playing disc
+.It CDIOCSTART
+begins playing a disc
+.It CDIOCSTOP
+stops a previously playing disc
+.It CDIOCEJECT
+opens the disc tray (there is no support for a corresponding un-eject
+command).
+.It CDIOCRESET
+stops any play and resets the Mitsumi controller board
+.It CDIOCSETDEBUG
+cause the kernel to print debug messages to the console about the
+.Nm
+driver
+.It CDIOCCLRDEBUG
+cause the kernel to quit printing debug messages about the
+.Nm
+driver
+.El
+.Pp
+The
+.Fn ioctl
+commands defined above are the only ones that the
+.Nm
+driver supports.
+There are other CD-ROM related
+.Fn ioctl
+commands (such as
+.Dv CDIOCSETVOL
+and
+.Dv CDIOCSETSTERIO )
+which are available
+and may be supported by future versions of the driver.
+.Sh FILES
+.Bl -tag -width /dev/(r)mcd0a -compact
+.It Pa /dev/(r)mcd0a
+accesses
+.Bx
+partition on the disc.
+Normally, there is only
+one file system on a CD-ROM disc.
+.It Pa /dev/(r)mcd0c
+accesses raw device.
+.El
+.Sh NOTES
+The character-mode devices for the
+.Nm
+driver should only be used for accessing the audio features of the
+CD-ROM player as the performance on data is abysmal.
+.Pp
+The current version of the driver uses neither the DMA or IRQ
+features of the interface board, although it has an interrupt handler
+for any IRQ requests that are generated.
+Until the DMA features are
+supported, the only interrupts that the board generates are those that
+are not supported by the driver anyway.
+.Sh SEE ALSO
+.In sys/cdio.h
+.Sh HISTORY
+An
+.Nm
+driver appeared in
+.Fx 1.0 .
+.Sh AUTHORS
+.An -nosplit
+The driver was written by
+.An Holger Veit
+(data part) and
+.An Brian Moore
+(audio part).
+Changes were provided by
+.An Gary Clark II ,
+.An Andrew A. Chernov ,
+and
+.An Jordan K. Hubbard .
diff --git a/share/man/man4/md.4 b/share/man/man4/md.4
new file mode 100644
index 000000000000..49b0069d8e7a
--- /dev/null
+++ b/share/man/man4/md.4
@@ -0,0 +1,114 @@
+.\" ----------------------------------------------------------------------------
+.\" "THE BEER-WARE LICENSE" (Revision 42):
+.\" <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
+.\" can do whatever you want with this stuff. If we meet some day, and you think
+.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+.\" ----------------------------------------------------------------------------
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 30, 2007
+.Dt MD 4
+.Os
+.Sh NAME
+.Nm md
+.Nd memory disk
+.Sh SYNOPSIS
+.Cd device md
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for four kinds of memory backed virtual disks:
+.Bl -tag -width preload
+.It Cm malloc
+Backing store is allocated using
+.Xr malloc 9 .
+Only one malloc-bucket is used, which means that all
+.Nm
+devices with
+.Cm malloc
+backing must share the malloc-per-bucket-quota.
+The exact size of this quota varies, in particular with the amount
+of RAM in the
+system.
+The exact value can be determined with
+.Xr vmstat 8 .
+.It Cm preload
+A file loaded by
+.Xr loader 8
+with type
+.Sq md_image
+is used for backing store.
+For backwards compatibility the type
+.Sq mfs_root
+is also recognized.
+If the kernel is created with option
+.Dv MD_ROOT
+the first preloaded image found will become the root file system.
+.It Cm vnode
+A regular file is used as backing store.
+This allows for mounting ISO images without the tedious
+detour over actual physical media.
+.It Cm swap
+Backing store is allocated from buffer memory.
+Pages get pushed out to the swap when the system is under memory
+pressure, otherwise they stay in the operating memory.
+Using
+.Cm swap
+backing is generally preferable over
+.Cm malloc
+backing.
+.El
+.Pp
+For more information, please see
+.Xr mdconfig 8 .
+.Sh EXAMPLES
+To create a kernel with a ramdisk or MD file system, your kernel config
+needs the following options:
+.Bd -literal -offset indent
+options MD_ROOT # MD is a potential root device
+options MD_ROOT_SIZE=8192 # 8MB ram disk
+makeoptions MFS_IMAGE=/h/foo/ARM-MD
+options ROOTDEVNAME=\\"ufs:md0\\"
+.Ed
+.Pp
+The image in
+.Pa /h/foo/ARM-MD
+will be loaded as the initial image each boot.
+To create the image to use, please follow the steps to create a file-backed
+disk found in the
+.Xr mdconfig 8
+man page.
+Other tools will also create these images, such as NanoBSD.
+.Sh SEE ALSO
+.Xr disklabel 8 ,
+.Xr fdisk 8 ,
+.Xr loader 8 ,
+.Xr mdconfig 8 ,
+.Xr mdmfs 8 ,
+.Xr newfs 8 ,
+.Xr vmstat 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.0
+as a cleaner replacement
+for the MFS functionality previously used in
+.Tn PicoBSD
+and in the
+.Fx
+installation process.
+.Pp
+The
+.Nm
+driver did a hostile takeover of the
+.Xr vn 4
+driver in
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Poul-Henning Kamp
+.Aq phk@FreeBSD.org .
diff --git a/share/man/man4/mem.4 b/share/man/man4/mem.4
new file mode 100644
index 000000000000..38c5110ae537
--- /dev/null
+++ b/share/man/man4/mem.4
@@ -0,0 +1,211 @@
+.\" Copyright (c) 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)mem.4 5.3 (Berkeley) 5/2/91
+.\" $FreeBSD$
+.\"
+.Dd October 3, 2004
+.Dt MEM 4
+.Os
+.Sh NAME
+.Nm mem ,
+.Nm kmem
+.Nd memory files
+.Sh SYNOPSIS
+.Cd "device mem"
+.Sh DESCRIPTION
+The special file
+.Pa /dev/mem
+is an interface to the physical memory of the computer.
+Byte offsets in this file are interpreted as physical memory addresses.
+Reading and writing this file is equivalent to reading and writing
+memory itself.
+Only offsets within the bounds of
+.Pa /dev/mem
+are allowed.
+.Pp
+Kernel virtual memory is accessed through the interface
+.Pa /dev/kmem
+in the same manner as
+.Pa /dev/mem .
+Only kernel virtual addresses that are currently mapped to memory are allowed.
+.Pp
+On
+.Tn ISA
+the
+.Tn I/O
+memory space begins at physical address 0x000a0000
+and runs to 0x00100000.
+The
+per-process data
+size
+for the current process
+is
+.Dv UPAGES
+long, and ends at virtual
+address 0xf0000000.
+.Sh IOCTL INTERFACE
+Several architectures allow attributes to be associated with ranges of physical
+memory.
+These attributes can be manipulated via
+.Fn ioctl
+calls performed on
+.Pa /dev/mem .
+Declarations and data types are to be found in
+.In sys/memrange.h .
+.Pp
+The specific attributes, and number of programmable ranges may vary between
+architectures.
+The full set of supported attributes is:
+.Bl -tag -width indent
+.It Dv MDF_UNCACHEABLE
+The region is not cached.
+.It Dv MDF_WRITECOMBINE
+Writes to the region may be combined or performed out of order.
+.It Dv MDF_WRITETHROUGH
+Writes to the region are committed synchronously.
+.It Dv MDF_WRITEBACK
+Writes to the region are committed asynchronously.
+.It Dv MDF_WRITEPROTECT
+The region cannot be written to.
+.El
+.Pp
+Memory ranges are described by
+.Vt struct mem_range_desc :
+.Bd -literal -offset indent
+uint64_t mr_base; /\(** physical base address \(**/
+uint64_t mr_len; /\(** physical length of region \(**/
+int mr_flags; /\(** attributes of region \(**/
+char mr_owner[8];
+.Ed
+.Pp
+In addition to the region attributes listed above, the following flags
+may also be set in the
+.Fa mr_flags
+field:
+.Bl -tag -width indent
+.It MDF_FIXBASE
+The region's base address cannot be changed.
+.It MDF_FIXLEN
+The region's length cannot be changed.
+.It MDF_FIRMWARE
+The region is believed to have been established by the system firmware.
+.It MDF_ACTIVE
+The region is currently active.
+.It MDF_BOGUS
+We believe the region to be invalid or otherwise erroneous.
+.It MDF_FIXACTIVE
+The region cannot be disabled.
+.It MDF_BUSY
+The region is currently owned by another process and may not be
+altered.
+.El
+.Pp
+Operations are performed using
+.Fa struct mem_range_op :
+.Bd -literal -offset indent
+struct mem_range_desc *mo_desc;
+int mo_arg[2];
+.Ed
+.Pp
+The
+.Dv MEMRANGE_GET
+ioctl is used to retrieve current memory range attributes.
+If
+.Va mo_arg[0]
+is set to 0, it will be updated with the total number of memory range
+descriptors.
+If greater than 0, the array at
+.Va mo_desc
+will be filled with a corresponding number of descriptor structures,
+or the maximum, whichever is less.
+.Pp
+The
+.Dv MEMRANGE_SET
+ioctl is used to add, alter and remove memory range attributes.
+A range
+with the
+.Dv MDF_FIXACTIVE
+flag may not be removed; a range with the
+.Dv MDF_BUSY
+flag may not be removed or updated.
+.Pp
+.Va mo_arg[0]
+should be set to
+.Dv MEMRANGE_SET_UPDATE
+to update an existing or establish a new range, or to
+.Dv MEMRANGE_SET_REMOVE
+to remove a range.
+.Sh RETURN VALUES
+.Bl -tag -width Er
+.It Bq Er EOPNOTSUPP
+Memory range operations are not supported on this architecture.
+.It Bq Er ENXIO
+No memory range descriptors are available (e.g.\& firmware has not enabled
+any).
+.It Bq Er EINVAL
+The memory range supplied as an argument is invalid or overlaps another
+range in a fashion not supported by this architecture.
+.It Bq Er EBUSY
+An attempt to remove or update a range failed because the range is busy.
+.It Bq Er ENOSPC
+An attempt to create a new range failed due to a shortage of hardware
+resources (e.g.\& descriptor slots).
+.It Bq Er ENOENT
+An attempt to remove a range failed because no range matches the descriptor
+base/length supplied.
+.It Bq Er EPERM
+An attempt to remove a range failed because the range is permanently
+enabled.
+.El
+.Sh FILES
+.Bl -tag -width /dev/kmem -compact
+.It Pa /dev/mem
+.It Pa /dev/kmem
+.El
+.Sh SEE ALSO
+.Xr kvm 3 ,
+.Xr memcontrol 8
+.Sh HISTORY
+The
+.Nm mem
+and
+.Nm kmem
+files appeared in
+.At v6 .
+The ioctl interface for memory range attributes was added in
+.Fx 3.2 .
+.Sh BUGS
+Busy range attributes are not yet managed correctly.
+.Pp
+This device is required for all users of
+.Xr kvm 3
+to operate.
diff --git a/share/man/man4/meteor.4 b/share/man/man4/meteor.4
new file mode 100644
index 000000000000..77765defcde3
--- /dev/null
+++ b/share/man/man4/meteor.4
@@ -0,0 +1,873 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 15, 1995
+.Dt METEOR 4
+.Os
+.Sh NAME
+.Nm meteor
+.Nd "video capture driver interface"
+.Sh DESCRIPTION
+The
+.Nm
+driver defined a video capture interface.
+The
+.Nm
+driver is no longer in the tree, but other devices support this interface
+so the interface portion is documented here.
+.Ss Meteor Capture Modes
+The
+.Nm
+capture driver has three modes of capture operation.
+.Bl -enum
+.It
+Conventional
+.Xr read 2
+interface.
+.Pp
+This mode is the easiest and slowest to use.
+This mode is great for
+capturing a single field at little programming cost.
+.Pp
+In this mode, the user opens the device, sets the capture mode
+and size (see:
+.Dv METEORSETGEO
+.Xr ioctl 2
+call), and uses the
+.Xr read 2
+system
+call to load the data into a buffer.
+.Pp
+.Pa meteor_read.c ;
+read 400x300 RGB24 into a viewable PPM file
+.Bd -literal
+#include <sys/fcntl.h>
+#include <machine/ioctl_meteor.h>
+
+extern int errno;
+#define ROWS 300
+#define COLS 400
+#define SIZE (ROWS * COLS * 4)
+main()
+{
+ struct meteor_geomet geo;
+ char buf[SIZE],b[4],header[16],*p;
+ int i,o,c;
+
+ if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
+ printf("open failed: %d\\n", errno);
+ exit(1);
+ }
+ /* set up the capture type and size */
+ geo.rows = ROWS;
+ geo.columns = COLS;
+ geo.frames = 1;
+ geo.oformat = METEOR_GEO_RGB24 ;
+
+ if (ioctl(i, METEORSETGEO, &geo) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_FMT_NTSC;
+
+ if (ioctl(i, METEORSFMT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_INPUT_DEV0;
+
+ if (ioctl(i, METEORSINPUT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ if ((c=read(i, &buf[0], SIZE)) < SIZE) {
+ printf("read failed %d %d %d\\n", c, i, errno);
+ close(i);
+ exit(1);
+ }
+ close(i);
+
+ if ((o = open("rgb24.ppm", O_WRONLY | O_CREAT, 0644)) < 0) {
+ printf("ppm open failed: %d\\n", errno);
+ exit(1);
+ }
+
+ /* make PPM header and save to file */
+ strcpy(&header[0], "P6 400 300 255 ");
+ header[2] = header[6] = header[10] = header[14] = '\\n';
+ write (o, &header[0], 15);
+ /* save the RGB data to PPM file */
+ for (p = &buf[0]; p < &buf[SIZE]; ) {
+ b[2] = *p++; /* blue */
+ b[1] = *p++; /* green */
+ b[0] = *p++; /* red */
+ *p++; /* NULL byte */
+ write(o,&b[0], 3); /* not very efficient */
+ }
+ close(o);
+ exit(0);
+}
+.Ed
+.It
+Memory mapped single capture or unsynchronized continuous capture.
+.Pp
+The single capture mode is designed for conferencing tools such as
+.Nm nv .
+These tools need to control the starting of the image capture and also
+need several frames a second.
+The continuous capture mode is designed
+for applications that want free-running data.
+.Pp
+In this mode, the user opens the device, sets the capture mode
+and size (see:
+.Dv METEORSETGEO
+.Xr ioctl 2
+call),
+.Xr mmap 2 Ns s
+the frame buffer
+memory into the user process space, and issues either the
+single-capture or the continuous capture call (see:
+.Dv METEORCAPTUR
+.Xr ioctl 2
+call) to load the data into the memory mapped buffer.
+.Pp
+As explained in the
+.Dv METEORCAPTUR
+.Xr ioctl 2
+call, the single frame capture
+.Xr ioctl 2
+will block until the capture is complete, the continuous capture
+will return immediately.
+.Pp
+.Pa meteor_mmap_single_continuous.c
+.Bd -literal
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/fcntl.h>
+#include <machine/ioctl_meteor.h>
+
+extern int errno;
+#define ROWS 480
+#define COLS 640
+#define SIZE (ROWS * COLS * 2)
+main()
+{
+ struct meteor_geomet geo;
+ char buf[SIZE];
+ char *mmbuf;
+ int i,c;
+
+ if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
+ printf("open failed\\n");
+ exit(1);
+ }
+
+ geo.rows = ROWS;
+ geo.columns = COLS;
+ geo.frames = 1;
+ geo.oformat = METEOR_GEO_RGB16 ;
+
+ if (ioctl(i, METEORSETGEO, &geo) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_FMT_NTSC;
+
+ if (ioctl(i, METEORSFMT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_INPUT_DEV0;
+
+ if (ioctl(i, METEORSINPUT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ mmbuf=(char *)mmap((caddr_t)0, SIZE, PROT_READ,
+ MAP_SHARED, i, (off_t)0);
+
+#ifdef SINGLE_MODE
+ /* single frame capture */
+ c = METEOR_CAP_SINGLE ;
+ ioctl(i, METEORCAPTUR, &c); /* wait for the frame */
+
+ /* directly access the frame buffer array data in mmbuf */
+#else
+ /* continuous frame capture */
+ c = METEOR_CAP_CONTINOUS ;
+ ioctl(i, METEORCAPTUR, &c); /* returns immediately */
+
+ /* directly access the frame buffer array data in mmbuf */
+
+ c = METEOR_CAP_STOP_CONT ;
+ ioctl(i, METEORCAPTUR, &c); /* close will also stop capture */
+#endif
+
+ close(i);
+ exit(0);
+}
+.Ed
+.It
+Memory mapped, multi-frame ring buffer synchronize capture.
+.Pp
+This continuous capture mode is synchronized with the application that
+processes up to 32 frames.
+This gives the advantages of both single and
+continuous capture modes.
+.Pp
+The kernel notifies the application of a new data by raising an
+application defined signal.
+The driver also shares a structure with
+the application that allows them to communicate which frame has been
+written by the kernel and which frame has been read by the application.
+.Pp
+The shared structure starts on the first page after your data.
+The
+structure address can be found by calculation:
+.Pp
+.Dl "(number_rows * number_columns * pixel_depth + 4095) & 0xfffff000"
+or
+.Dl "((number_rows * number_columns * pixel_depth + 4095)/4096) * 4096"
+.Pp
+The shared structure is of type
+.Va struct meteor_mem .
+The two most
+important fields are called
+.Va active
+and
+.Va num_active_buf .
+.Va active
+is a bitmap of frames written by the kernel.
+.Va num_active_bufs
+is
+a count of frames marked in the
+.Va active
+field.
+When a frame is read
+in by the driver, the
+.Va num_active_bufs
+count is tested, if this
+count is below the threshold of number of active frames (value
+in
+.Va meteor_mem Ns 's
+.Va hiwat
+variable), the bit representing frame
+number in the buffer is stored in the
+.Va active
+variable, the
+.Va num_active_bufs
+is incremented, the kernel then raises the specified
+signal to activate the user application.
+The user application's
+responsibility when getting the signal is to check the active bitmap
+to determine the lowest active frame, use the data as the application
+desires, clear the bitmap entry for that frame, and decrement the
+.Va num_active_bufs .
+If the threshold of number of active frames
+.Pq Va hiwat
+has been exceeded, no new frames or signal from the kernel will occur
+until the
+.Va num_active_bufs
+is less than or equal to
+.Va lowat .
+.Pp
+The driver loads the frames in a round-robin fashion.
+It is expected
+that the user removes them in the same order.
+The driver does not
+check to see if the frame is already active.
+.Pp
+The
+.Va frame_size
+and number of frames in the buffer are also provided
+to the
+.Va meteor_mem
+structure, but changing these fields in the
+application will not change the operation of the driver.
+.Pp
+In programming for this mode, the user opens the device, sets the
+geometry,
+.Xr mmap 2 Ns s
+the data/common control structure, then starts the
+continuous capture mode.
+A special signal catcher is required to
+process the frames as they are read by the kernel.
+.Pp
+When specifying the geometry (see:
+.Dv METEORSETGEO
+.Xr ioctl 2
+call),
+it
+is important that the number of frames is set greater than 1.
+.Pp
+.Pa skeleton_capture_n.c
+.Bd -literal
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/fcntl.h>
+#include <sys/signal.h>
+#include <machine/ioctl_meteor.h>
+
+int video; /* made global if you wish to stop capture in signal handler */
+caddr_t data_frames;
+struct meteor_mem *common_mem;
+extern int errno;
+
+#define FRAME_MAX
+
+void
+usr2_catcher()
+{
+#ifdef SIGNAL_STOP
+ struct meteor_capframe capframe; /* for ioctl */
+#endif
+ char *frame;
+
+ /* find frame */
+ frame = (char *) (data_frames + sig_cnt * common_mem->frame_size) ;
+
+ /* add frame processing here */
+ /* deactivate frame */
+ common_mem->active &= ~(1 << (sig_cnt % 16));
+ common_mem->num_active_bufs--;
+
+ /* process next frame on next interrupt */
+ sig_cnt = ((sig_cnt+1) % FRAME_MAX);
+
+#ifdef SIGNAL_STOP
+ if (some_condition_requiring_stopping) {
+ capframe.command=METEOR_CAP_STOP_FRAMES;
+
+ if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
+ printf("METEORCAPFRM failed %d\\n", errno);
+ exit(1);
+ }
+ }
+#endif
+}
+
+main()
+{
+ struct meteor_geomet geo;
+ int height, width, depth, frames, size;
+ struct meteor_capframe capframe;
+
+ if ((i = open("/dev/meteor0", O_RDONLY)) < 0) {
+ printf("open failed\\n");
+ exit(1);
+ }
+ printf("test %d %d\\n", errno, i);
+
+ height = geo.rows = 120;
+ width= geo.columns = 320;
+ frames = geo.frames = FRAME_MAX;
+ depth = 2; /* 2 bytes per pixel for RGB*/
+
+
+ geo.oformat = METEOR_GEO_RGB16;
+
+ if (ioctl(i, METEORSETGEO, &geo) < 0) {
+ printf("METEORSETGEO failed %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_FMT_NTSC;
+
+ if (ioctl(i, METEORSFMT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ c = METEOR_INPUT_DEV0;
+
+ if (ioctl(i, METEORSINPUT, &c) < 0) {
+ printf("ioctl failed: %d\\n", errno);
+ exit(1);
+ }
+
+ size = ((width*height*depth*frames+4095)/4096)*4096;
+ /* add one page after data for meteor_mem */
+ data_frames = mmap((caddr_t)0, size + 4096, PROT_READ | PROT_WRITE,
+ MAP_SHARED, i, (off_t)0);
+
+ if (data_frames == (caddr_t) MAP_FAILED) return (0);
+
+ /* common_mem is located at page following data */
+ common_mem = (struct meteor_mem *) (y + size);
+
+ signal(SIGUSR2, usr2_catcher); /* catch new frame message */
+
+ capframe.command=METEOR_CAP_N_FRAMES;
+ capframe.signal=SIGUSR2;
+ capframe.lowat=12; /* must be < hiwat */
+ capframe.hiwat=14; /* must be < FRAME_MAX */
+
+ /* start the sync capture */
+ if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
+ printf("METEORCAPFRM failed %d\\n", errno);
+ exit(1);
+ }
+
+ /* this is the background working area, or you can sleep */
+
+
+ /* to stop capture */
+ capframe.command=METEOR_CAP_STOP_FRAMES;
+
+ if (ioctl(i, METEORCAPFRM, &capframe) < 0) {
+ printf("METEORCAPFRM failed %d\\n", errno);
+ exit(1);
+ }
+}
+.Ed
+.El
+.Ss Meteor IOCTL Call and Parameters
+The
+.Nm
+capture driver has
+.Xr ioctl 2
+requests for capturing, reading card
+status, for setting and reading the geometry, and for setting and reading the
+attributes.
+.Pp
+.Bf -symbolic
+IT IS VERY IMPORTANT TO CHECK FOR ERRORS ON THESE RETURNING IOCTLs.
+.Ef
+Errors indicate that something is very wrong with the
+.Xr ioctl 2
+and the
+application should not attempt to proceed further with capturing.
+The
+.Nm
+capture driver still makes attempts to stop the next capture step if
+an error occurred in a previous step but was ignored by the application
+programmer.
+.Bl -enum
+.It
+.Xr ioctl 2
+requests
+.Dv METEORSETGEO
+and
+.Dv METEORGETGEO
+.Pp
+.Dv METEORSETGEO
+and
+.Dv METEORGETGEO
+are used to set and read the input
+size, input device, and output format for frame capture.
+.Pp
+These
+.Xr ioctl 2
+routines use the
+.Va meteor_geomet
+structure that has the
+following entries:
+.Bl -tag -width columns
+.It Va rows
+number of rows (lines high) in output image
+.It Va columns
+number of pixels in a row (width) in output image
+.It Va frames
+number of frames in buffer.
+Should be 1, unless using
+the multi-framed synchronous capture mode
+.Pq Dv METEORCAPFRM
+which REQUIRES frames to be larger than 1.
+.Pp
+Note: if
+.Va rows , columns
+or
+.Va frames
+is not changed, then
+the existing values are used.
+The system defaults
+is 640x480x1.
+.It Va oformat
+you may choose one of the following output format:
+.Bl -tag -width METEOR_GEO_YUV_PACKED
+.It Dv METEOR_GEO_RGB16
+(RGB 16 bits xrrrrrgg gggbbbbb default)
+.It Dv METEOR_GEO_RGB24
+(RGB 24 bits packed in 32 bits:
+00000000 rrrrrrrr gggggggg bbbbbbbb)
+.It Dv METEOR_GEO_YUV_PACKED
+(4-2-2 YUV 16 bits packed byte format:
+u0 y0 v0 y1 u1 y2 v1 y3 ...)
+.It Dv METEOR_GEO_YUV_PLANER
+(4-2-2 YUV 16 bits planer format:
+rows * columns bytes of y
+rows * column / 4 bytes of even u
+rows * column / 4 bytes of even v
+rows * column / 4 bytes of odd u
+rows * column / 4 bytes of odd v)
+.El
+.El
+.Pp
+The
+.Dv METEORSETGEO
+.Xr ioctl 2
+will fail if more than one entry from a category
+is selected.
+It is highly recommended that a
+.Dv METEORSETGEO
+is done
+before capturing data because you cannot guarantee the initial mode
+the card.
+.Pp
+The
+.Dv METEORSETGEO
+will also attempt to reallocate a new contiguous
+kernel buffer if the new geometry exceeds the old geometry.
+On the
+other hand, if the new geometry will fit in the existing buffer,
+the existing buffer is used.
+.Pp
+If
+.Dv METEORSETGEO
+fails the
+.Xr ioctl 2
+will return a value of -1 and the
+external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid
+.Va meteor_geomet
+structure pointer,
+.Va rows , columns , frames
+were invalid.
+.It Bq Er ENOMEM
+could not allocate the contiguous block.
+.El
+.It
+.Xr ioctl 2
+requests
+.Dv METEORSFMT
+and
+.Dv METEORGFMT
+.Pp
+.Dv METEORSFMT
+and
+.Dv METEORGFMT
+are used to set and read the camera input
+standard format.
+.Pp
+Possible formats are:
+.Pp
+.Bl -tag -width METEOR_FMT_AUTOMODE -compact
+.It Dv METEOR_FMT_NTSC
+NTSC (default mode)
+.It Dv METEOR_FMT_PAL
+PAL
+.It Dv METEOR_FMT_SECAM
+SECAM
+.It Dv METEOR_FMT_AUTOMODE
+Autodetect.
+.El
+.It
+.Xr ioctl 2
+requests
+.Dv METEORSINPUT
+and
+.Dv METEORGINPUT
+.Pp
+.Dv METEORSINPUT
+and
+.Dv METEORGINPUT
+are used to set and read the camera
+input device.
+Using the DB9 connector on the
+.Tn Meteor
+card, 4 input
+devices can be connected and an input camera can be selected with this
+.Xr ioctl 2 .
+.Pp
+Possible formats are:
+.Pp
+.Bl -tag -width METEOR_INPUT_DEV_SVIDEO -compact
+.It Dv METEOR_INPUT_DEV0
+(default if none specified)
+.It Dv METEOR_INPUT_DEV_RCA
+(same as METEOR_INPUT_DEV0)
+.It Dv METEOR_INPUT_DEV1
+.It Dv METEOR_INPUT_DEV2
+.It Dv METEOR_INPUT_DEV_SVIDEO
+(same as METEOR_INPUT_DEV2)
+.El
+.It
+.Xr ioctl 2
+request
+.Dv METEORSTATUS
+.Pp
+.Dv METEORSTATUS
+is used to read the status of the
+.Tn Meteor
+capture card
+and returns the following information:
+.Bl -column "METEOR_STATUS_ID_MASK" "\&"
+.It Dv METEOR_STATUS_ID_MASK " 4 bit ID of the SAA7196 scaler chip."
+.Pp
+.It Dv METEOR_STATUS_DIR " 0 = scaler uses internal source."
+.It " 1 = scaler uses external data of expansion bus."
+.Pp
+.It Dv METEOR_STATUS_OEF " 0 = even field detected."
+.It " 1 = odd field detected."
+.Pp
+.It Dv METEOR_STATUS_SVP " VRAM Port state:"
+.It " 0 = inputs HFL and INCADDR inactive."
+.It " 1 = inputs HFL and INCADDR active."
+.Pp
+.It Dv METEOR_STATUS_STTC " 0 = TV horizontal time constant (slow)."
+.It " 1 = VCR horizontal time constant (fast)."
+.Pp
+.It Dv METEOR_STATUS_HCLK " 0 = Horizontal Phase Lock Loop locked."
+.It " 1 = Horizontal Phase Lock Loop unlocked."
+.Pp
+.It Dv METEOR_STATUS_FIDT " 0 = 50 Hz Field detected."
+.It " 1 = 60 Hz Field detected."
+.Pp
+.It Dv METEOR_STATUS_ALTD " 0 = no line alternating color burst detected."
+.It " 1 = line alternating color burst detected (PAL/SECAM)."
+.Pp
+.It Dv METEOR_STATUS_CODE " 0 = no color information detected."
+.It " 1 = color information detected."
+.El
+.It
+.Xr ioctl 2
+request
+.Dv METEORCAPTUR
+.Pp
+.Dv METEORCAPTUR
+is used to single frame capture or unsynchronized
+continuous capture.
+.Pp
+The single frame capture
+.Xr ioctl 2
+request will return only after a
+frame has been captured and transferred to the frame buffer.
+.Pp
+The unsynchronized continuous capture will return immediately and
+data is directly deposited into the buffer when it is available.
+Since this is unsynchronized, it is possible the data is being
+written by the kernel while being read by the application.
+.Pp
+These
+.Xr ioctl 2
+routines use the following settings:
+.Pp
+.Bl -tag -width METEOR_CAP_CONTINOUS -compact
+.It Dv METEOR_CAP_SINGLE
+capture one frame
+.It Dv METEOR_CAP_CONTINOUS
+unsynchronized continuous capture
+.It Dv METEOR_CAP_STOP_CONT
+stop the unsynchronized continuous
+capture
+.El
+.Pp
+If
+.Dv METEORCAPTUR
+fails the
+.Xr ioctl 2
+will return a value of -1 and the
+external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid capture command value
+.It Bq Er ENXIO
+there is not internal buffer to hold the frame.
+This indicates the previous set geometry
+.Xr ioctl 2
+failed.
+.It Bq Er EIO
+card is already capturing.
+.El
+.It
+.Xr ioctl 2
+request
+.Dv METEORCAPFRM
+.Pp
+.Dv METEORCAPFRM
+is used for synchronous capture of multiple frames.
+.Pp
+This
+.Xr ioctl 2
+routine uses the
+.Va meteor_capture
+structure that has the
+following entries:
+.Bl -tag -width command
+.It Va command
+possible values for
+.Va command
+are:
+.Bl -tag -width METEOR_CAP_STOP_FRAMES
+.It Dv METEOR_CAP_STOP_FRAMES
+stop the capture; does not use the
+other variable in structure.
+.It Dv METEOR_CAP_N_FRAMES
+start the capture using the other
+variables in the structure as inputs
+.El
+.It Va signal
+signal to send to application when a new
+frame has been captured.
+This signal will
+only be raised if the captured frame is saved.
+.It Va lowat
+see below
+.It Va hiwat
+see below
+.El
+.Pp
+When a new frame is completed, the driver checks the current unread
+frame count stored in shared variable (the shared variable is stored
+in the
+.Va meteor_mem
+structure)
+.Va num_active_buf ;
+if the count is larger
+than
+.Va hiwat ,
+the driver will not store any new frames and will not
+send capture signal to the user application until the
+.Va num_active_buf
+is lower than
+.Va lowat .
+.Pp
+If
+.Dv METEORCAPFRM
+fails the
+.Xr ioctl 2
+will return a value of -1 and the
+external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid meteor_geomet structure pointer or bad command.
+.It Bq Er ENXIO
+there is not internal buffer to hold the frame.
+This indicates the previous set geometry
+.Xr ioctl 2
+failed.
+.It Bq Er EIO
+card is already capturing.
+.El
+.It
+.Xr ioctl 2
+requests
+.Dv METEORSCHCV
+and
+.Dv METEORGCHCV
+.Pp
+.Dv METEORSCHCV
+and
+.Dv METEORGCHCV
+are used to set and get the chrominance
+gain control and effects the UV output amplitude.
+.Pp
+If
+.Dv METEORSCHCV
+or
+.Dv METEORGCHCV
+fails the
+.Xr ioctl 2
+will return a value
+of -1 and the external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid unsigned char pointer.
+.El
+.It
+.Xr ioctl 2
+requests
+.Dv METEORGHUE
+and
+.Dv METEORSHUE
+.Pp
+.Dv METEORGHUE
+and
+.Dv METEORSHUE
+are used to get and set the hue.
+The
+signed character has legal values are from +127 which represent
++178.6 degrees to -128 which represents -180 degrees.
+.Pp
+If
+.Dv METEORGHUE
+or
+.Dv METEORSHUE
+fails the
+.Xr ioctl 2
+will return a value of
+-1 and the external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid signed char pointer.
+.El
+.It
+.Xr ioctl 2
+requests
+.Dv METEORSCOUNT
+and
+.Dv METEORGCOUNT
+.Pp
+.Dv METEORGCOUNT
+is used to get the count of frame errors, DMA errors and
+count of the number of frames captured that have occurred since
+the device was opened.
+.Dv METEORSCOUNT
+can be used to reinitialize the
+counters.
+.Pp
+This
+.Xr ioctl 2
+routines use the
+.Va meteor_counts
+structure that has the
+following entries:
+.Bl -tag -width frame_count
+.It Va fifo_errors
+number of FIFO errors since device was opened.
+.It Va dma_errors
+number of DMA errors since device was opened.
+.It Va frame_count
+number of frames captured since device was opened.
+.El
+.Pp
+If
+.Dv METEORSCOUNT
+or
+.Dv METEORGCOUNT
+fails the
+.Xr ioctl 2
+will return a value
+of -1 and the external variable
+.Va errno
+will be set to:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+invalid meteor_counts structure pointer.
+.El
+.El
+.Sh AUTHORS
+.An Jim Lowe Aq james@miller.cs.uwm.edu ,
+.An Mark Tinguely Aq tinguely@plains.nodak.edu
+.Sh BUGS
+The
+.Nm
+driver no longer works at all.
diff --git a/share/man/man4/mfi.4 b/share/man/man4/mfi.4
new file mode 100644
index 000000000000..9313335570f0
--- /dev/null
+++ b/share/man/man4/mfi.4
@@ -0,0 +1,127 @@
+.\" Copyright (c) 2006 Scott Long
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 12, 2010
+.Dt MFI 4
+.Os
+.Sh NAME
+.Nm mfi
+.Nd "LSI MegaRAID SAS driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device mfi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mfi_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver is for LSI's next generation PCI Express SAS RAID controllers.
+Access to RAID arrays (logical disks) from this driver is provided via
+.Pa /dev/mfid?
+device nodes.
+A simple management interface is also provided on a per-controller basis via
+the
+.Pa /dev/mfi?
+device node.
+.Pp
+The
+.Nm
+name is derived from the phrase "MegaRAID Firmware Interface", which is
+substantially different than the old "MegaRAID" interface and thus requires
+a new driver.
+Older SCSI and SATA MegaRAID cards are supported by
+.Xr amr 4
+and will not work with this driver.
+.Pp
+Two sysctls are provided to tune the
+.Nm
+driver's behavior when a request is made to remove a mounted volume.
+By default the driver will disallow any requests to remove a mounted volume.
+If the sysctl
+.Va dev.mfi.%d.delete_busy_volumes
+is set to 1,
+then the driver will allow mounted volumes to be removed.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following hardware:
+.Pp
+.Bl -bullet -compact
+.It
+LSI MegaRAID SAS 1078
+.It
+LSI MegaRAID SAS 8408E
+.It
+LSI MegaRAID SAS 8480E
+.It
+LSI MegaRAID SAS 9260
+.It
+Dell PERC5
+.It
+Dell PERC6
+.It
+IBM ServeRAID M5015 SAS/SATA
+.It
+IBM ServeRAID-MR10i
+.It
+Intel RAID Controller SROMBSAS18E
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/mfid?" -compact
+.It Pa /dev/mfid?
+array/logical disk interface
+.It Pa /dev/mfi?
+management interface
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "mfid%d: Unable to delete busy device"
+An attempt was made to remove a mounted volume.
+.El
+.Sh SEE ALSO
+.Xr amr 4 ,
+.Xr pci 4 ,
+.Xr mfiutil 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.1 .
+.Sh AUTHORS
+The
+.Nm
+driver and this manual page were written by
+.An Scott Long Aq scottl@FreeBSD.org .
+.Sh BUGS
+The driver does not support big-endian architectures at this time.
diff --git a/share/man/man4/miibus.4 b/share/man/man4/miibus.4
new file mode 100644
index 000000000000..2bcf9c5bfc89
--- /dev/null
+++ b/share/man/man4/miibus.4
@@ -0,0 +1,191 @@
+.\" Written by Tom Rhodes for the FreeBSD Project.
+.\" Please see the /usr/src/COPYRIGHT file for copyright information.
+.\"
+.\" This document takes information from the IEEE 802.3 Standard
+.\" along with various comments from Peter Wemm, Robert Watson, and Bill Paul.
+.\" Originally this file looked much like the NetBSD mii(4) manual page, but
+.\" I doubt you would ever notice due to large differences.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 15, 2011
+.Dt MIIBUS 4
+.Os
+.Sh NAME
+.Nm miibus
+.Nd IEEE 802.3 Media Independent Interface network bus
+.Sh SYNOPSIS
+For most network interface cards (NIC):
+.Cd "device miibus"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides an interconnection between the Media Access Control (MAC)
+sublayer, the Physical Layer entities (PHY), Station Management (STA)
+entities, and the PHY Layer as defined by the IEEE 802.3 Standard.
+.Pp
+The
+.Nm
+layer allows network device drivers to share common support
+code for various external PHY devices.
+Most 10/100 network interface cards either use an MII transceiver
+or have built-in transceivers that can be programmed using an MII
+interface.
+The
+.Nm
+driver currently handles all of the media detection,
+selection, and reporting using the ifmedia interface.
+A generic driver has been included for all PHYs that are not
+handled by a specific driver, this is possible because all
+10/100 PHYs implement the same general register set along with
+their vendor specific register set.
+.Pp
+The following network device drivers use the
+.Nm
+interface:
+.Pp
+.Bl -tag -compact -width ".Xr fxp 4"
+.It Xr ae 4
+Attansic/Atheros L2 Fast Ethernet
+.It Xr age 4
+Attansic/Atheros L1 Gigabit Ethernet
+.It Xr alc 4
+Atheros AR8131/AR8132 PCIe Ethernet
+.It Xr ale 4
+Atheros AR8121/AR8113/AR8114 PCIe Ethernet
+.It Xr aue 4
+ADMtek USB Ethernet
+.It Xr axe 4
+ASIX Electronics AX88172 USB Ethernet
+.It Xr bce 4
+Broadcom NetXtreme II Gigabit Ethernet
+.It Xr bfe 4
+Broadcom BCM4401 Ethernet
+.It Xr bge 4
+Broadcom BCM570xx Gigabit Ethernet
+.It Xr cas 4
+Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn
+.It Xr dc 4
+DEC/Intel 21143 and various workalikes
+.It Xr ed 4
+NE[12]000, SMC Ultra, 3c503, DS8390 cards
+.It Xr et 4
+Agere ET1310 Gigabit Ethernet
+.It Xr fxp 4
+Intel EtherExpress PRO/100B
+.It Xr gem 4
+Sun ERI, Sun GEM and Apple GMAC Ethernet
+.It Xr hme 4
+Sun HME Ethernet
+.It Xr jme 4
+JMicron JMC250 Gigabit/JMC260 Fast Ethernet
+.It Xr lge 4
+Level 1 LXT1001 NetCellerator Gigabit Ethernet
+.It Xr msk 4
+Marvell/SysKonnect Yukon II Gigabit Ethernet
+.It Xr nfe 4
+NVIDIA nForce MCP Networking Adapter
+.It Xr nge 4
+National Semiconductor DP83820/DP83821 Gigabit Ethernet
+.It Xr nve 4
+NVIDIA nForce MCP Networking Adapter
+.It Xr pcn 4
+AMD Am79C97x PCI 10/100
+.It Xr re 4
+RealTek 8139C+/8169/8169S/8110S
+.It Xr rl 4
+RealTek 8129/8139
+.It Xr rue 4
+RealTek RTL8150 USB To Fast Ethernet
+.It Xr sf 4
+Adaptec AIC-6915
+.It Xr sge 4
+Silicon Integrated Systems SiS190/191 Ethernet
+.It Xr sis 4
+Silicon Integrated Systems SiS 900/SiS 7016
+.It Xr sk 4
+SysKonnect SK-984x and SK-982x Gigabit Ethernet
+.It Xr ste 4
+Sundance ST201 (D-Link DFE-550TX)
+.It Xr stge 4
+Sundance/Tamarack TC9021 Gigabit Ethernet
+.It Xr tl 4
+Texas Instruments ThunderLAN
+.It Xr tx 4
+SMC EtherPower II (83c170)
+.It Xr udav 4
+Davicom DM9601 USB Ethernet
+.It Xr vge 4
+VIA VT612x PCI Gigabit Ethernet
+.It Xr vr 4
+VIA Rhine, Rhine II
+.It Xr vte 4
+DM&P Vortex86 RDC R6040 Fast Ethernet
+.It Xr wb 4
+Winbond W89C840F
+.It Xr xl 4
+3Com 3c90x
+.El
+.Sh COMPATIBILITY
+The implementation of
+.Nm
+was originally intended to have similar API interfaces
+to
+.Bsx 3.0
+and
+.Nx ,
+but as a result are not well behaved newbus device drivers.
+.Sh SEE ALSO
+.Xr ae 4 ,
+.Xr age 4 ,
+.Xr alc 4 ,
+.Xr ale 4 ,
+.Xr arp 4 ,
+.Xr aue 4 ,
+.Xr axe 4 ,
+.Xr bce 4 ,
+.Xr bfe 4 ,
+.Xr bge 4 ,
+.Xr cas 4 ,
+.Xr dc 4 ,
+.Xr ed 4 ,
+.Xr et 4 ,
+.Xr fxp 4 ,
+.Xr gem 4 ,
+.Xr hme 4 ,
+.Xr jme 4 ,
+.Xr lge 4 ,
+.Xr msk 4 ,
+.Xr netintro 4 ,
+.Xr nfe 4 ,
+.Xr nge 4 ,
+.Xr nve 4 ,
+.Xr pcn 4 ,
+.Xr re 4 ,
+.Xr rgephy 4 ,
+.Xr rl 4 ,
+.Xr rue 4 ,
+.Xr sf 4 ,
+.Xr sge 4 ,
+.Xr sis 4 ,
+.Xr sk 4 ,
+.Xr ste 4 ,
+.Xr stge 4 ,
+.Xr tl 4 ,
+.Xr tx 4 ,
+.Xr udav 4 ,
+.Xr vge 4 ,
+.Xr vr 4 ,
+.Xr vte 4 ,
+.Xr wb 4 ,
+.Xr xl 4
+.Sh STANDARDS
+More information on MII can be found in the IEEE 802.3 Standard.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/mk48txx.4 b/share/man/man4/mk48txx.4
new file mode 100644
index 000000000000..66f9519f0282
--- /dev/null
+++ b/share/man/man4/mk48txx.4
@@ -0,0 +1,228 @@
+.\" $NetBSD: mk48txx.4,v 1.16 2009/04/10 17:14:07 joerg Exp $
+.\"
+.\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 25, 2009
+.Dt MK48TXX 4
+.Os
+.Sh NAME
+.Nm mk48txx
+.Nd
+.Tn Mostek
+time-of-day clock driver
+.Sh SYNOPSIS
+.In sys/eventhandler.h
+.In sys/lock.h
+.In sys/mutex.h
+.In dev/mk48txx/mk48txxvar.h
+.Pp
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mk48txx"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver is a back-end for several models of
+.Tn Mostek
+time-of-day clock chips.
+It provides access methods to retrieve and set date and time for use with the
+.Dq Li clock
+KOBJ interface.
+.Pp
+To tie an instance of this device to the system, use the
+.Fn mk48txx_attach
+function and the mk48txx_softc structure defined as follows:
+.Pp
+.Ft "int"
+.Fn mk48txx_attach "device_t dev"
+.Bd -literal
+typedef uint8_t (*mk48txx_nvrd_t)(device_t dev, int off);
+typedef void (*mk48txx_nvwr_t)(device_t dev, int off, uint8_t v);
+.Ed
+.Bd -literal
+struct mk48txx_softc {
+ struct resource sc_res;
+ struct mtx sc_mtx;
+ eventhandler_tag sc_wet;
+ const char *sc_model;
+ bus_size_t sc_nvramsz;
+ bus_size_t sc_clkoffset;
+ u_int sc_year0;
+ u_int sc_flag;
+ mk48txx_nvrd_t sc_nvrd;
+ mk48txx_nvwr_t sc_nvwr;
+};
+.Ed
+.Bl -tag -width indent
+.It Fa sc_res
+The bus resource used for accessing the chip's non-volatile memory
+.Pq including the clock registers ,
+which must be supplied by the front-end when using the default access methods
+.Pq see below .
+Otherwise this member is optional.
+.It Fa sc_mtx
+The hardware mutex used when accessing the chip's non-volatile memory
+.Pq including the clock registers ,
+which must be initialized with
+.Dv MTX_DEF
+by the front-end.
+.It Fa sc_wet
+The event handler tag for the watchdog functionality,
+which is registered by the
+.Fn mk48txx_attach
+function if supported by the chip and specified as part of the
+machine-dependent features
+.Pq see below .
+.It Fa sc_model
+The chip model which this instance should serve.
+This member must be set to one of
+.Dq mk48t02 ,
+.Dq mk48t08 ,
+.Dq mk48t18 ,
+or
+.Dq mk48t59
+by the front-end.
+.It Fa sc_nvramsz
+The size of the non-volatile RAM in the
+.Tn Mostek
+chip,
+which is set by the
+.Fn mk48txx_attach
+function.
+.It Fa sc_clkoffset
+The offset into the control registers of the
+.Tn Mostek
+chip,
+which is set by the the
+.Fn mk48txx_attach
+function.
+.It Fa sc_year0
+The year offset to be used with the
+.Sq year
+counter of the clock,
+which must be set by the front-end.
+This value is generally dependent on the system configuration in which
+the clock device is mounted.
+For instance, on
+.Tn Sun Microsystems
+machines the convention is to have clock's two-digit year represent
+the year since 1968.
+.It Fa sc_flag
+This flag is used to specify machine-dependent features.
+The following flags are supported:
+.Bl -tag -width ".Dv MK48TXX_WDOG_ENABLE_WDS"
+.It Dv MK48TXX_NO_CENT_ADJUST
+If the resulting date retrieved with the
+.Dq Li clock_gettime() method
+would be earlier than January 1, 1970,
+the driver will assume that the chip's year counter actually represents a
+year in the 21st century.
+This behavior can be overridden by setting this flag,
+which causes the
+.Nm
+driver to respect the clock's century bit instead.
+.It Dv MK48TXX_WDOG_REGISTER
+When this flag is set,
+the
+.Nm
+driver will register as a watchdog via the interface defined in
+.Xr watchdog 9
+if supported by the specific chip model.
+.It Dv MK48TXX_WDOG_ENABLE_WDS
+When this flag is set,
+the
+.Nm
+driver will set the watchdog steering
+.Pq WDS
+bit when enabling the watchdog functionality of the chip.
+enabled
+.Pq see the chip documentation for further information regarding the WDS bit .
+.El
+.It Fa sc_nvread
+.It Fa sc_nvwrite
+These members specify the access methods for reading respectively writing
+clock device registers.
+The default,
+when
+.Dv NULL
+is passed as an access method,
+is to access the chip memory
+.Pq and clock registers
+as if they were direct-mapped using the specified bus resource.
+.Pp
+Otherwise, the driver will call the respective function supplied by the
+front-end to perform the access,
+passing it the offset
+.Va off
+of the chip memory
+.Pq or clock register
+location to be read from or written to, respectively.
+.El
+.Sh HARDWARE
+The following models are supported:
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Tn Mostek MK48T02
+.It Tn Mostek MK48T08
+.It Tn Mostek MK48T18
+.It Tn Mostek MK48T59
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm mk48txx
+driver appeared in
+.Nx 1.5 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for
+.Nx
+by
+.An Paul Kranenburg
+.Aq pk@NetBSD.org .
+It was ported to
+.Fx
+by
+.An Thomas Moestl
+.Aq tmm@FreeBSD.org
+and later on improved by
+.An Marius Strobl
+.Aq marius@FreeBSD.org .
diff --git a/share/man/man4/mld.4 b/share/man/man4/mld.4
new file mode 100644
index 000000000000..b6f3cee6d250
--- /dev/null
+++ b/share/man/man4/mld.4
@@ -0,0 +1,106 @@
+.\"
+.\" Copyright (c) 2009 Bruce Simpson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 27, 2009
+.Dt MLD 4
+.Os
+.Sh NAME
+.Nm mld
+.Nd Multicast Listener Discovery Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip6.h
+.In netinet/icmp6.h
+.In netinet6/mld6.h
+.Ft int
+.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
+.Sh DESCRIPTION
+.Tn MLD
+is a control plane protocol used by IPv6 hosts and routers to
+propagate multicast group membership information.
+Normally this protocol is not used directly, except by the kernel
+itself, in response to multicast membership requests by user
+applications.
+Multicast routing protocol daemons may open a raw socket to directly
+interact with
+.Nm
+and receive membership reports.
+.Pp
+As of
+.Fx 8.0 ,
+MLD version 2 is implemented.
+This adds support for Source-Specific Multicast (SSM), whereby
+applications may communicate to upstream multicast routers that
+they are only interested in receiving multicast streams from
+particular sources.
+The retransmission of state-change reports adds some robustness
+to the protocol.
+.\"
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.\"
+.It net.inet6.mld.stats
+This opaque read-only variable exposes the stack-wide MLDv2
+protocol statistics to
+.Xr netstat 1 .
+.\"
+.It net.inet6.mld.ifinfo
+This opaque read-only variable exposes the per-link MLDv2 status to
+.Xr ifmcstat 8 .
+.\"
+.It net.inet6.mld.gsrdelay
+This variable specifies the time threshold, in seconds, for processing
+Group-and-Source Specific Queries (GSR).
+As GSR query processing requires maintaining state on the host,
+it may cause memory to be allocated, and is therefore a potential
+attack point for Denial-of-Service (DoS).
+If more than one GSR query is received within this threshold,
+it will be dropped, to mitigate the potential for DoS.
+.\"
+.It net.inet6.mld.v1enable
+If this variable is non-zero, then MLDv1 membership queries (and host
+reports) will be processed by this host, and backwards compatibility
+will be enabled until the v1 'Older Version Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\"
+.El
+.Sh SEE ALSO
+.Xr ifmcstat 8 ,
+.Xr inet 4 ,
+.Xr multicast 4 ,
+.Xr netstat 1 ,
+.Xr sourcefilter 3
+.Sh HISTORY
+The
+.Nm
+manual page appeared in
+.Fx 8.0 .
diff --git a/share/man/man4/mlx.4 b/share/man/man4/mlx.4
new file mode 100644
index 000000000000..696d04812e51
--- /dev/null
+++ b/share/man/man4/mlx.4
@@ -0,0 +1,256 @@
+.\"
+.\" Copyright (c) 2003 David O'Brien
+.\" Copyright (c) 2000 Jeroen Ruigrok van der Werven
+.\" Copyright (c) 2000 Michael Smith
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 2004
+.Dt MLX 4
+.Os
+.Sh NAME
+.Nm mlx
+.Nd Mylex DAC-family RAID driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device mlx"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mlx_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Mylex DAC-family PCI to SCSI RAID controllers,
+including versions relabeled by Digital/Compaq.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Mylex DAC960P
+.It
+Mylex DAC960PD / DEC KZPSC (Fast Wide)
+.It
+Mylex DAC960PDU
+.It
+Mylex DAC960PL
+.It
+Mylex DAC960PJ
+.It
+Mylex DAC960PG
+.It
+Mylex DAC960PU / DEC PZPAC (Ultra Wide)
+.It
+Mylex AcceleRAID 150 (DAC960PRL)
+.It
+Mylex AcceleRAID 250 (DAC960PTL1)
+.It
+Mylex eXtremeRAID 1100 (DAC1164P)
+.It
+RAIDarray 230 controllers, aka the Ultra-SCSI DEC KZPAC-AA (1-ch, 4MB
+cache), KZPAC-CA (3-ch, 4MB), KZPAC-CB (3-ch, 8MB cache)
+.El
+.Pp
+All major firmware revisions (2.x, 3.x, 4.x and 5.x) are supported, however
+it is always advisable to upgrade to the most recent firmware
+available for the controller.
+.Pp
+Compatible Mylex controllers not listed should work, but have not been
+verified.
+.Sh DIAGNOSTICS
+.Ss Controller initialisation phase
+.Bl -diag
+.It mlx%d: controller initialisation in progress...
+.It mlx%d: initialisation complete
+.Pp
+The controller firmware is performing/has completed initialisation.
+.It mlx%d: physical drive %d:%d not responding
+.Pp
+The drive at channel:target is not responding; it may have failed or
+been removed.
+.It mlx%d: spinning up drives...
+.Pp
+Drive startup is in progress; this may take several minutes.
+.It mlx%d: configuration checksum error
+.Pp
+The array configuration has become corrupted.
+.It mlx%d: mirror race recovery in progress
+.It mlx%d: mirror race on a critical system drive
+.It mlx%d: mirror race recovery failed
+.Pp
+These error codes are undocumented.
+.It mlx%d: physical drive %d:%d COD mismatch
+.Pp
+Configuration data on the drive at channel:target does not match the
+rest of the array.
+.It mlx%d: system drive installation aborted
+.Pp
+Errors occurred preventing one or more system drives from being configured.
+.It mlx%d: new controller configuration found
+.Pp
+The controller has detected a configuration on disk which supersedes the
+configuration in its nonvolatile memory.
+It will reset and come up with the new configuration.
+.It mlx%d: FATAL MEMORY PARITY ERROR
+.Pp
+Firmware detected a fatal memory error; the driver will not attempt to
+attach to this controller.
+.It mlx%d: unknown firmware initialisation error %x:%x:%x
+.Pp
+An unknown error occurred during initialisation; it will be ignored.
+.El
+.Ss Driver initialisation/shutdown phase:
+.Bl -diag
+.It mlx%d: can't allocate scatter/gather DMA tag
+.It mlx%d: can't allocate buffer DMA tag
+.It mlx%d: can't allocate s/g table
+.It mlx%d: can't make initial s/g list mapping
+.It mlx%d: can't make permanent s/g list mapping
+.It mlx%d: can't allocate interrupt
+.It mlx%d: can't set up interrupt
+.Pp
+A resource allocation error occurred while initialising the driver;
+initialisation has failed and the driver will not attach to this
+controller.
+.It mlx%d: error fetching drive status
+.Pp
+The current status of all system drives could not be fetched; attachment
+of system drives will be aborted.
+.It mlx%d: device_add_child failed
+.It mlx%d: bus_generic_attach returned %d
+.Pp
+Creation of the system drive instances failed; attachment of one or more
+system drives may have been aborted.
+.It mlxd%d: detaching...
+.Pp
+The indicated system drive is being detached.
+.It mlxd%d: still open, can't detach
+.Pp
+The indicated system drive is still open or mounted;
+the controller cannot be detached.
+.It mlx%d: flushing cache...
+.Pp
+The controller cache is being flushed prior to detach or shutdown.
+.El
+.Ss Operational diagnostics:
+.Bl -diag
+.It mlx%d: ENQUIRY failed - %s
+.It mlx%d: ENQUIRY2 failed
+.It mlx%d: ENQUIRY_OLD failed
+.It mlx%d: FLUSH failed - %s
+.It mlx%d: CHECK ASYNC failed - %s
+.It mlx%d: REBUILD ASYNC failed - %s
+.It mlx%d: command failed - %s
+.Pp
+The controller rejected a command for the reason given.
+.It mlx%d: I/O beyond end of unit (%u,%d > %u)
+.It mlx%d: I/O error - %s
+.Pp
+An I/O error was reported by the controller.
+.It mlx%d: periodic enquiry failed - %s
+.Pp
+An attempt to poll the controller for status failed for the reason given.
+.It mlx%d: mlx_periodic_enquiry: unknown command %x
+.Pp
+The periodic status poll has issued a command which has become corrupted.
+.It mlxd%d: drive offline
+.It mlxd%d: drive online
+.It mlxd%d: drive critical
+.Pp
+The system disk indicated has changed state.
+.It mlx%d: physical drive %d:%d reset
+.It mlx%d: physical drive %d:%d killed %s
+.It "mlx%d: physical drive %d:%d error log: sense = %d asc = %x asq = %x"
+.It "mlx%d: info %4D csi %4D"
+.Pp
+The drive at channel:target has been reset, killed for the given reason,
+or experienced a SCSI error.
+.It mlx%d: unknown log message type %x
+.It mlx%d: error reading message log - %s
+.Pp
+An error occurred while trying to read the controller's message log.
+.It mlxd%d: consistency check started
+.It mlx%d: consistency check completed
+.Pp
+A user-initiated consistency check has started/completed.
+.It mlx%d: drive rebuild started for %d:%d
+.It mlx%d: drive rebuild completed
+.Pp
+A user-initiated physical drive rebuild has started/completed.
+.It mlx%d: background check/rebuild operation started
+.It mlx%d: background check/rebuild operation completed
+.Pp
+An automatic system drive consistency check
+or physical drive rebuild has started/completed.
+.It mlx%d: channel %d pausing for %d seconds
+.It mlx%d: channel %d resuming
+.It mlx%d: pause command failed - %s
+.It mlx%d: pause failed for channel %d
+.It mlx%d: resume command failed - %s
+.It mlx%d: resume failed for channel %d
+.Pp
+Controller/channel pause operation notification.
+(Channel pause is not currently supported on any controller.)
+.It mlx%d: controller wedged (not taking commands)
+.Pp
+The controller is not responding to attempts to submit new commands.
+.It mlx%d: duplicate done event for slot %d
+.It mlx%d: done event for nonbusy slot %d
+.Pp
+Corruption has occurred in either the controller's onboard list of commands
+or in the driver.
+.El
+.Sh SEE ALSO
+.Xr mlxcontrol 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Smith
+.Aq msmith@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Jeroen Ruigrok van der Werven
+.Aq asmodai@FreeBSD.org
+and
+.An Michael Smith
+.Aq msmith@FreeBSD.org .
+.Sh BUGS
+The driver does not yet support EISA adapters.
+The DEC KZPSC has insufficient flash ROM to hold any reasonably recent firmware.
+This has caused problems for this driver.
+.Pp
+The driver does not yet support the version 6.x firmware as found in the
+AcceleRAID 352 and eXtremeRAID 2000 and 3000 products.
diff --git a/share/man/man4/mly.4 b/share/man/man4/mly.4
new file mode 100644
index 000000000000..3affcacbd3cd
--- /dev/null
+++ b/share/man/man4/mly.4
@@ -0,0 +1,272 @@
+.\"
+.\" Copyright (c) 2000 Michael Smith
+.\" Copyright (c) 2000 BSDi
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 2004
+.Dt MLY 4
+.Os
+.Sh NAME
+.Nm mly
+.Nd Mylex AcceleRAID/eXtremeRAID family driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device da"
+.Cd "device mly"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mly_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Mylex AcceleRAID and eXtremeRAID-family
+PCI to SCSI RAID controllers with version 6.00 and later
+firmware.
+.Pp
+Logical devices (array drives) attached to the controller are presented
+to the SCSI subsystem as though they were direct-access devices on a
+virtual SCSI bus.
+Physical devices which are not claimed by a logical
+device are presented on SCSI channels which match the physical channels
+on the controller.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Mylex AcceleRAID 160
+.It
+Mylex AcceleRAID 170
+.It
+Mylex AcceleRAID 352
+.It
+Mylex eXtremeRAID 2000
+.It
+Mylex eXtremeRAID 3000
+.El
+.Pp
+Compatible Mylex controllers not listed should work, but have not been
+verified.
+.Sh DIAGNOSTICS
+.Ss Controller initialisation phase
+.Bl -diag
+.It "mly%d: controller initialisation started"
+.It "mly%d: initialisation complete"
+.Pp
+The controller firmware has started initialisation.
+Normally this process is performed by the controller BIOS,
+but the driver may need
+to do this in cases where the BIOS has failed, or is not compatible
+(e.g.\& on non-x86 systems).
+.It "mly%d: drive spinup in progress"
+.Pp
+Drive startup is in progress; this may take several minutes.
+.It "mly%d: mirror race recovery failed, one or more drives offline"
+.It "mly%d: mirror race recovery in progress"
+.It "mly%d: mirror race recovery on a critical drive"
+.Pp
+These error codes are undocumented.
+.It "mly%d: FATAL MEMORY PARITY ERROR"
+.Pp
+Firmware detected a fatal memory error; the driver will not attempt to
+attach to this controller.
+.It "mly%d: unknown initialisation code %x"
+.Pp
+An unknown error occurred during initialisation; it will be ignored.
+.El
+.Ss Driver initialisation/shutdown phase
+.Bl -diag
+.It "mly%d: can't enable busmaster feature"
+.It "mly%d: memory window not available"
+.It "mly%d: can't allocate register window"
+.It "mly%d: can't allocate interrupt"
+.It "mly%d: can't set up interrupt"
+.Pp
+The system's PCI BIOS has not correctly configured the controller's
+PCI interface; initialisation has failed and the driver will not
+attach to this controller.
+.It "mly%d: can't allocate parent DMA tag"
+.It "mly%d: can't allocate buffer DMA tag"
+.It "mly%d: can't allocate command packet DMA tag"
+.It "mly%d: can't allocate scatter/gather DMA tag"
+.It "mly%d: can't allocate s/g table"
+.It "mly%d: can't allocate memory mailbox DMA tag"
+.It "mly%d: can't allocate memory mailbox"
+.Pp
+A resource allocation error occurred while initialising the driver;
+initialisation has failed and the driver will not attach to this
+controller.
+.It "mly%d: BTL rescan result corrupted"
+.Pp
+The results of a scan for an attached device were corrupted.
+One or more devices may not be correctly reported.
+.It "mly%d: flushing cache..."
+.Pp
+The controller cache is being flushed prior to detach or shutdown.
+.El
+.Ss Operational diagnostics
+.Bl -diag
+.It "mly%d: physical device %d:%d online"
+.It "mly%d: physical device %d:%d standby"
+.It "mly%d: physical device %d:%d automatic rebuild started"
+.It "mly%d: physical device %d:%d manual rebuild started"
+.It "mly%d: physical device %d:%d rebuild completed"
+.It "mly%d: physical device %d:%d rebuild cancelled"
+.It "mly%d: physical device %d:%d rebuild failed for unknown reasons"
+.It "mly%d: physical device %d:%d rebuild failed due to new physical device"
+.It "mly%d: physical device %d:%d rebuild failed due to logical drive failure"
+.It "mly%d: physical device %d:%d found"
+.It "mly%d: physical device %d:%d gone"
+.It "mly%d: physical device %d:%d unconfigured"
+.It "mly%d: physical device %d:%d expand capacity started"
+.It "mly%d: physical device %d:%d expand capacity completed"
+.It "mly%d: physical device %d:%d expand capacity failed"
+.It "mly%d: physical device %d:%d parity error"
+.It "mly%d: physical device %d:%d soft error"
+.It "mly%d: physical device %d:%d miscellaneous error"
+.It "mly%d: physical device %d:%d reset"
+.It "mly%d: physical device %d:%d active spare found"
+.It "mly%d: physical device %d:%d warm spare found"
+.It "mly%d: physical device %d:%d initialization started"
+.It "mly%d: physical device %d:%d initialization completed"
+.It "mly%d: physical device %d:%d initialization failed"
+.It "mly%d: physical device %d:%d initialization cancelled"
+.It "mly%d: physical device %d:%d write recovery failed"
+.It "mly%d: physical device %d:%d scsi bus reset failed"
+.It "mly%d: physical device %d:%d double check condition"
+.It "mly%d: physical device %d:%d device cannot be accessed"
+.It "mly%d: physical device %d:%d gross error on scsi processor"
+.It "mly%d: physical device %d:%d bad tag from device"
+.It "mly%d: physical device %d:%d command timeout"
+.It "mly%d: physical device %d:%d system reset"
+.It "mly%d: physical device %d:%d busy status or parity error"
+.It "mly%d: physical device %d:%d host set device to failed state"
+.It "mly%d: physical device %d:%d selection timeout"
+.It "mly%d: physical device %d:%d scsi bus phase error"
+.It "mly%d: physical device %d:%d device returned unknown status"
+.It "mly%d: physical device %d:%d device not ready"
+.It "mly%d: physical device %d:%d device not found at startup"
+.It "mly%d: physical device %d:%d COD write operation failed"
+.It "mly%d: physical device %d:%d BDT write operation failed"
+.It "mly%d: physical device %d:%d missing at startup"
+.It "mly%d: physical device %d:%d start rebuild failed due to physical drive too small"
+.It "mly%d: physical device %d:%d sense data received"
+.It "mly%d: sense key %d asc %02x ascq %02x"
+.It "mly%d: info %4D csi %4D"
+.It "mly%d: physical device %d:%d offline"
+.It "mly%d: sense key %d asc %02x ascq %02x"
+.It "mly%d: info %4D csi %4D"
+.Pp
+The reported event refers to the physical device at the given channel:target
+address.
+.It "mly%d: logical device %d (%s) consistency check started"
+.It "mly%d: logical device %d (%s) consistency check completed"
+.It "mly%d: logical device %d (%s) consistency check cancelled"
+.It "mly%d: logical device %d (%s) consistency check completed with errors"
+.It "mly%d: logical device %d (%s) consistency check failed due to logical drive failure"
+.It "mly%d: logical device %d (%s) consistency check failed due to physical device failure"
+.It "mly%d: logical device %d (%s) automatic rebuild started"
+.It "mly%d: logical device %d (%s) manual rebuild started"
+.It "mly%d: logical device %d (%s) rebuild completed"
+.It "mly%d: logical device %d (%s) rebuild cancelled"
+.It "mly%d: logical device %d (%s) rebuild failed for unknown reasons"
+.It "mly%d: logical device %d (%s) rebuild failed due to new physical device"
+.It "mly%d: logical device %d (%s) rebuild failed due to logical drive failure"
+.It "mly%d: logical device %d (%s) offline"
+.It "mly%d: logical device %d (%s) critical"
+.It "mly%d: logical device %d (%s) online"
+.It "mly%d: logical device %d (%s) initialization started"
+.It "mly%d: logical device %d (%s) initialization completed"
+.It "mly%d: logical device %d (%s) initialization cancelled"
+.It "mly%d: logical device %d (%s) initialization failed"
+.It "mly%d: logical device %d (%s) found"
+.It "mly%d: logical device %d (%s) gone"
+.It "mly%d: logical device %d (%s) expand capacity started"
+.It "mly%d: logical device %d (%s) expand capacity completed"
+.It "mly%d: logical device %d (%s) expand capacity failed"
+.It "mly%d: logical device %d (%s) bad block found"
+.It "mly%d: logical device %d (%s) size changed"
+.It "mly%d: logical device %d (%s) type changed"
+.It "mly%d: logical device %d (%s) bad data block found"
+.It "mly%d: logical device %d (%s) read of data block in bdt"
+.It "mly%d: logical device %d (%s) write back data for disk block lost"
+.Pp
+The event report will include the name of the SCSI device which has
+attached to the device if possible.
+.It "mly%d: enclosure %d fan %d failed"
+.It "mly%d: enclosure %d fan %d ok"
+.It "mly%d: enclosure %d fan %d not present"
+.It "mly%d: enclosure %d power supply %d failed"
+.It "mly%d: enclosure %d power supply %d ok"
+.It "mly%d: enclosure %d power supply %d not present"
+.It "mly%d: enclosure %d temperature sensor %d failed"
+.It "mly%d: enclosure %d temperature sensor %d critical"
+.It "mly%d: enclosure %d temperature sensor %d ok"
+.It "mly%d: enclosure %d temperature sensor %d not present"
+.It "mly%d: enclosure %d unit %d access critical"
+.It "mly%d: enclosure %d unit %d access ok"
+.It "mly%d: enclosure %d unit %d access offline"
+.Pp
+These events refer to external enclosures by number.
+The driver does not attempt to name the enclosures.
+.It "mly%d: controller cache write back error"
+.It "mly%d: controller battery backup unit found"
+.It "mly%d: controller battery backup unit charge level low"
+.It "mly%d: controller battery backup unit charge level ok"
+.It "mly%d: controller installation aborted"
+.It "mly%d: controller mirror race recovery in progress"
+.It "mly%d: controller mirror race on critical drive"
+.It "mly%d: controller memory soft ecc error"
+.It "mly%d: controller memory hard ecc error"
+.It "mly%d: controller battery backup unit failed"
+.Pp
+These events report controller status changes.
+.El
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Smith
+.Aq msmith@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Michael Smith
+.Aq msmith@FreeBSD.org .
+.Sh BUGS
+The driver does not yet provide an external management interface.
+.Pp
+Enclosures are not named or otherwise identified in event messages.
diff --git a/share/man/man4/mmc.4 b/share/man/man4/mmc.4
new file mode 100644
index 000000000000..95fe976833e7
--- /dev/null
+++ b/share/man/man4/mmc.4
@@ -0,0 +1,60 @@
+.\"
+.\" Copyright (c) 2007 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 8, 2008
+.Dt MMC 4
+.Os
+.Sh NAME
+.Nm mmc
+.Nd MultiMediaCard and SD Card bus driver
+.Sh SYNOPSIS
+.Cd device mmc
+.Sh DESCRIPTION
+The
+.Nm
+driver implements the MMC and SD Card bus.
+The
+.Nm
+driver supports all MMC and SD bridges in the system.
+All SD or MMC cards in the system attach to an instance of
+.Nm .
+The
+.Nm
+bus typically has only one slot, and only memory cards.
+MultiMediaCards exist only in memory.
+SD Cards exist as memory, I/O, or combination cards.
+.Sh SEE ALSO
+.Xr mmcsd 4 ,
+.Xr at91_mci 4 ,
+.Xr sdhci 4
+.Rs
+.%T "SD Specifications, Part 1, Physical Layer, Simplified Specification"
+.Re
+.Rs
+.%T "The MultiMediaCard System Specification"
+.Re
+.Sh BUGS
+SDIO cards currently do not work.
diff --git a/share/man/man4/mmcsd.4 b/share/man/man4/mmcsd.4
new file mode 100644
index 000000000000..646e032e63a9
--- /dev/null
+++ b/share/man/man4/mmcsd.4
@@ -0,0 +1,48 @@
+.\"
+.\" Copyright (c) 2007 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 22, 2008
+.Dt MMCSD 4
+.Os
+.Sh NAME
+.Nm mmcsd
+.Nd MMC and SD memory card driver.
+.Sh SYNOPSIS
+.Cd device mmcsd
+.Sh DESCRIPTION
+The
+.Nm
+driver implements direct access block device for MMC and SD memory cards.
+.Sh SEE ALSO
+.Xr mmc 4 ,
+.Xr at91_mci 4 ,
+.Xr sdhci 4
+.Rs
+.%T "SD Specifications, Part 1, Physical Layer, Simplified Specification"
+.Re
+.Rs
+.%T "The MultiMediaCard System Specification"
+.Re
diff --git a/share/man/man4/mn.4 b/share/man/man4/mn.4
new file mode 100644
index 000000000000..0b88f2fb9267
--- /dev/null
+++ b/share/man/man4/mn.4
@@ -0,0 +1,55 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND ITS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 10, 2005
+.Dt MN 4
+.Os
+.Sh NAME
+.Nm mn
+.Nd "Siemens Easy321-R1 E1/T1 device driver"
+.Sh SYNOPSIS
+.Cd "device mn"
+.Cd "options NETGRAPH"
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the Siemens Easy321-R1 E1/T1 reference
+design card.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
diff --git a/share/man/man4/mod_cc.4 b/share/man/man4/mod_cc.4
new file mode 100644
index 000000000000..204537faa36f
--- /dev/null
+++ b/share/man/man4/mod_cc.4
@@ -0,0 +1,117 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt MOD_CC 4
+.Os
+.Sh NAME
+.Nm mod_cc
+.Nd Modular congestion control
+.Sh DESCRIPTION
+The modular congestion control framework allows the TCP implementation to
+dynamically change the congestion control algorithm used by new and existing
+connections.
+Algorithms are identified by a unique
+.Xr ascii 7
+name.
+Algorithm modules can be compiled into the kernel or loaded as kernel modules
+using the
+.Xr kld 4
+facility.
+.Pp
+The default algorithm is NewReno, and all connections use the default unless
+explicitly overridden using the TCP_CONGESTION socket option (see
+.Xr tcp 4
+for details).
+The default can be changed using a
+.Xr sysctl 3
+MIB variable detailed in the
+.Sx MIB Variables
+section below.
+.Sh MIB Variables
+The framework exposes the following variables in the
+.Va net.inet.tcp.cc
+branch of the
+.Xr sysctl 3
+MIB:
+.Bl -tag -width ".Va available"
+.It Va available
+Read-only list of currently available congestion control algorithms by name.
+.It Va algorithm
+Returns the current default congestion control algorithm when read, and changes
+the default when set.
+When attempting to change the default algorithm, this variable should be set to
+one of the names listed by the
+.Va net.inet.tcp.cc.available
+MIB variable.
+.El
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr tcp 4 ,
+.Xr mod_cc 9
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+modular congestion control framework first appeared in
+.Fx 9.0 .
+.Pp
+The framework was first released in 2007 by James Healy and Lawrence Stewart
+whilst working on the NewTCP research project at Swinburne University of
+Technology's Centre for Advanced Internet Architectures, Melbourne, Australia,
+which was made possible in part by a grant from the Cisco University Research
+Program Fund at Community Foundation Silicon Valley.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org ,
+.An James Healy Aq jimmy@deefa.com
+and
+.An David Hayes Aq david.hayes@ieee.org .
+.Pp
+This manual page was written by
+.An David Hayes Aq david.hayes@ieee.org
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man4/mos.4 b/share/man/man4/mos.4
new file mode 100644
index 000000000000..2656deae109d
--- /dev/null
+++ b/share/man/man4/mos.4
@@ -0,0 +1,97 @@
+.\"
+.\" Copyright (c) 2011 Rick van der Zwet <info@rickvanderzwet.nl>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 14, 2011
+.Dt MOS 4
+.Os
+.Sh NAME
+.Nm mos
+.Nd Moschip MCS7730/MCS7830/MCS7832 USB Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device ehci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device mos"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_mos_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the
+Moschip MCS7730/MCS7830/MCS7832 chipset.
+.Pp
+The adapters that contain the Moschip MCS7730/MCS7830/MCS7832 chipset
+will operate at 100Base-TX and full-duplex.
+.Pp
+The Moschip contains a 10/100
+Ethernet MAC with MII interface and is designed to work with both
+Ethernet and HomePNA transceivers.
+Although designed to interface with
+100Mbps peripherals, this only works with USB 2.0. The existing USB 1.0
+standard specifies a maximum transfer speed of 12Mbps.
+USB 1.0 Users should therefore not expect to actually achieve 100Mbps speeds
+with these devices.
+.Pp
+The Moschip supports a 64-bit multicast hash table, single perfect
+filter entry for the station address and promiscuous mode.
+Packets are
+received and transmitted over separate USB bulk transfer endpoints.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Sitecom LN030
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Rs
+.%T ADMtek AN986 data sheet
+.%O http://www.moschip.com/data/products/MCS7830/Data%20Sheet_7830.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Rick van der Zwet info@rickvanderzwet.nl .
diff --git a/share/man/man4/mouse.4 b/share/man/man4/mouse.4
new file mode 100644
index 000000000000..f50fc0120072
--- /dev/null
+++ b/share/man/man4/mouse.4
@@ -0,0 +1,403 @@
+.\"
+.\" Copyright (c) 1997
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 3, 1997
+.Dt MOUSE 4
+.Os
+.Sh NAME
+.Nm mouse
+.Nd mouse and pointing device drivers
+.Sh SYNOPSIS
+.In sys/mouse.h
+.Sh DESCRIPTION
+The mouse drivers
+.Xr mse 4 ,
+.Xr psm 4 ,
+.Xr ums 4
+and
+.Xr sysmouse 4
+provide user programs with movement and button state information of the mouse.
+Currently there are specific device drivers for bus, InPort, PS/2, and USB mice.
+The serial mouse is not directly supported by a dedicated driver, but
+it is accessible via the serial device driver or via
+.Xr moused 8
+and
+.Xr sysmouse 4 .
+.Pp
+The user program simply opens a mouse device with a
+.Xr open 2
+call and reads
+mouse data from the device via
+.Xr read 2 .
+Movement and button states are usually encoded in fixed-length data packets.
+Some mouse devices may send data in variable length of packets.
+Actual protocol (data format) used by each driver differs widely.
+.Pp
+The mouse drivers may have ``non-blocking'' attribute which will make
+the driver return immediately if mouse data is not available.
+.Pp
+Mouse device drivers often offer several levels of operation.
+The current operation level can be examined and changed via
+.Xr ioctl 2
+commands.
+The level zero is the lowest level at which the driver offers the basic
+service to user programs.
+Most drivers provide horizontal and vertical movement of the mouse
+and state of up to three buttons at this level.
+At the level one, if supported by the driver, mouse data is encoded
+in the standard format
+.Dv MOUSE_PROTO_SYSMOUSE
+as follows:
+.Pp
+.Bl -tag -width Byte_1 -compact
+.It Byte 1
+.Bl -tag -width bit_7 -compact
+.It bit 7
+Always one.
+.It bit 6..3
+Always zero.
+.It bit 2
+Left button status; cleared if pressed, otherwise set.
+.It bit 1
+Middle button status; cleared if pressed, otherwise set.
+Always one,
+if the device does not have the middle button.
+.It bit 0
+Right button status; cleared if pressed, otherwise set.
+.El
+.It Byte 2
+The first half of horizontal movement count in two's complement;
+-128 through 127.
+.It Byte 3
+The first half of vertical movement count in two's complement;
+-128 through 127.
+.It Byte 4
+The second half of the horizontal movement count in two's complement;
+-128 through 127.
+To obtain the full horizontal movement count, add
+the byte 2 and 4.
+.It Byte 5
+The second half of the vertical movement count in two's complement;
+-128 through 127.
+To obtain the full vertical movement count, add
+the byte 3 and 5.
+.It Byte 6
+The bit 7 is always zero.
+The lower 7 bits encode the first half of
+Z axis movement count in two's complement; -64 through 63.
+.It Byte 7
+The bit 7 is always zero.
+The lower 7 bits encode the second half of
+the Z axis movement count in two's complement; -64 through 63.
+To obtain the full Z axis movement count, add the byte 6 and 7.
+.It Byte 8
+The bit 7 is always zero.
+The bits 0 through 6 reflect the state
+of the buttons 4 through 10.
+If a button is pressed, the corresponding bit is cleared.
+Otherwise
+the bit is set.
+.El
+.Pp
+The first 5 bytes of this format is compatible with the MouseSystems
+format.
+The additional 3 bytes have their MSBs always set to zero.
+Thus, if the user program can interpret the MouseSystems data format and
+tries to find the first byte of the format by detecting the bit pattern
+10000xxxb,
+it will discard the additional bytes, thus, be able to decode x, y
+and states of 3 buttons correctly.
+.Pp
+Device drivers may offer operation levels higher than one.
+Refer to manual pages of individual drivers for details.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+commands are defined for the mouse drivers.
+The degree of support
+varies from one driver to another.
+This section gives general
+description of the commands.
+Refer to manual pages of individual drivers for specific details.
+.Pp
+.Bl -tag -width MOUSE -compact
+.It Dv MOUSE_GETLEVEL Ar int *level
+.It Dv MOUSE_SETLEVEL Ar int *level
+These commands manipulate the operation level of the mouse driver.
+.Pp
+.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
+Returns the hardware information of the attached device in the following
+Except for the
+.Dv iftype
+field, the device driver may not always fill the structure with correct
+values.
+Consult manual pages of individual drivers for details of support.
+.Bd -literal
+typedef struct mousehw {
+ int buttons; /* number of buttons */
+ int iftype; /* I/F type */
+ int type; /* mouse/track ball/pad... */
+ int model; /* I/F dependent model ID */
+ int hwid; /* I/F dependent hardware ID */
+} mousehw_t;
+.Ed
+.Pp
+The
+.Dv buttons
+field holds the number of buttons detected by the driver.
+The driver
+may put an arbitrary value, such as two, in this field, if it cannot
+determine the exact number.
+.Pp
+The
+.Dv iftype
+is the type of interface:
+.Dv MOUSE_IF_SERIAL ,
+.Dv MOUSE_IF_BUS ,
+.Dv MOUSE_IF_INPORT ,
+.Dv MOUSE_IF_PS2 ,
+.Dv MOUSE_IF_USB ,
+.Dv MOUSE_IF_SYSMOUSE
+or
+.Dv MOUSE_IF_UNKNOWN .
+.Pp
+The
+.Dv type
+tells the device type:
+.Dv MOUSE_MOUSE ,
+.Dv MOUSE_TRACKBALL ,
+.Dv MOUSE_STICK ,
+.Dv MOUSE_PAD ,
+or
+.Dv MOUSE_UNKNOWN .
+.Pp
+The
+.Dv model
+may be
+.Dv MOUSE_MODEL_GENERIC
+or one of
+.Dv MOUSE_MODEL_XXX
+constants.
+.Pp
+The
+.Dv hwid
+is the ID value returned by the pointing device.
+It
+depend on the interface type; refer to the manual page of
+specific mouse drivers for possible values.
+.Pp
+.It Dv MOUSE_GETMODE Ar mousemode_t *mode
+The command reports the current operation parameters of the mouse driver.
+.Bd -literal
+typedef struct mousemode {
+ int protocol; /* MOUSE_PROTO_XXX */
+ int rate; /* report rate (per sec) */
+ int resolution; /* MOUSE_RES_XXX, -1 if unknown */
+ int accelfactor; /* acceleration factor */
+ int level; /* driver operation level */
+ int packetsize; /* the length of the data packet */
+ unsigned char syncmask[2]; /* sync. bits */
+} mousemode_t;
+.Ed
+.Pp
+The
+.Dv protocol
+field tells the format in which the device status is returned
+when the mouse data is read by the user program.
+It is one of
+.Dv MOUSE_PROTO_XXX
+constants.
+.Pp
+The
+.Dv rate
+field is the status report rate (reports/sec) at which the device will send
+movement reports to the host computer.
+-1 if unknown or not applicable.
+.Pp
+The
+.Dv resolution
+field holds a value specifying resolution of the pointing device.
+It is a positive value or one of
+.Dv MOUSE_RES_XXX
+constants.
+.Pp
+The
+.Dv accelfactor
+field holds a value to control acceleration feature.
+It must be zero or greater.
+If it is zero, acceleration is disabled.
+.Pp
+The
+.Dv packetsize
+field tells the length of the fixed-size data packet or the length
+of the fixed part of the variable-length packet.
+The size depends on the interface type, the device type and model, the
+protocol and the operation level of the driver.
+.Pp
+The array
+.Dv syncmask
+holds a bit mask and pattern to detect the first byte of the
+data packet.
+.Dv syncmask[0]
+is the bit mask to be ANDed with a byte.
+If the result is equal to
+.Dv syncmask[1] ,
+the byte is likely to be the first byte of the data packet.
+Note that this method of detecting the first byte is not 100% reliable,
+thus, should be taken only as an advisory measure.
+.Pp
+.It Dv MOUSE_SETMODE Ar mousemode_t *mode
+The command changes the current operation parameters of the mouse driver
+as specified in
+.Ar mode .
+Only
+.Dv rate ,
+.Dv resolution ,
+.Dv level
+and
+.Dv accelfactor
+may be modifiable.
+Setting values in the other field does not generate
+error and has no effect.
+.Pp
+If you do not want to change the current setting of a field, put -1
+there.
+You may also put zero in
+.Dv resolution
+and
+.Dv rate ,
+and the default value for the fields will be selected.
+.\" .Pp
+.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
+.\" Get internal variables of the mouse driver.
+.\" The variables which can be manipulated through these commands
+.\" are specific to each driver.
+.\" This command may not be supported by all drivers.
+.\" .Bd -literal
+.\" typedef struct mousevar {
+.\" int var[16]; /* internal variables */
+.\" } mousevar_t;
+.\" .Ed
+.\" .Pp
+.\" If the commands are supported, the first element of the array is
+.\" filled with a signature value.
+.\" Apart from the signature data, there is currently no standard concerning
+.\" the other elements of the buffer.
+.\" .Pp
+.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
+.\" Get internal variables of the mouse driver.
+.\" The first element of the array must be a signature value.
+.\" This command may not be supported by all drivers.
+.Pp
+.It Dv MOUSE_READDATA Ar mousedata_t *data
+The command reads the raw data from the device.
+.Bd -literal
+typedef struct mousedata {
+ int len; /* # of data in the buffer */
+ int buf[16]; /* data buffer */
+} mousedata_t;
+.Ed
+.Pp
+The calling process must fill the
+.Dv len
+field with the number of bytes to be read into the buffer.
+This command may not be supported by all drivers.
+.Pp
+.It Dv MOUSE_READSTATE Ar mousedata_t *state
+The command reads the raw state data from the device.
+It uses the same structure as above.
+This command may not be supported by all drivers.
+.Pp
+.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
+The command returns the current state of buttons and
+movement counts in the following structure.
+.Bd -literal
+typedef struct mousestatus {
+ int flags; /* state change flags */
+ int button; /* button status */
+ int obutton; /* previous button status */
+ int dx; /* x movement */
+ int dy; /* y movement */
+ int dz; /* z movement */
+} mousestatus_t;
+.Ed
+.Pp
+The
+.Dv button
+and
+.Dv obutton
+fields hold the current and the previous state of the mouse buttons.
+When a button is pressed, the corresponding bit is set.
+The mouse drivers may support up to 31 buttons with the bit 0 through 31.
+Few button bits are defined as
+.Dv MOUSE_BUTTON1DOWN
+through
+.Dv MOUSE_BUTTON8DOWN .
+The first three buttons correspond to left, middle and right buttons.
+.Pp
+If the state of the button has changed since the last
+.Dv MOUSE_GETSTATUS
+call, the corresponding bit in the
+.Dv flags
+field will be set.
+If the mouse has moved since the last call, the
+.Dv MOUSE_POSCHANGED
+bit in the
+.Dv flags
+field will also be set.
+.Pp
+The other fields hold movement counts since the last
+.Dv MOUSE_GETSTATUS
+call.
+The internal counters will be reset after every call to this
+command.
+.El
+.Sh FILES
+.Bl -tag -width /dev/sysmouseXX -compact
+.It Pa /dev/cuad%d
+serial ports
+.It Pa /dev/mse%d
+bus and InPort mouse device
+.It Pa /dev/psm%d
+PS/2 mouse device
+.It Pa /dev/sysmouse
+virtual mouse device
+.It Pa /dev/ums%d
+USB mouse device
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr mse 4 ,
+.Xr psm 4 ,
+.Xr sysmouse 4 ,
+.Xr ums 4 ,
+.Xr moused 8
+.\".Sh HISTORY
+.Sh AUTHORS
+This manual page was written by
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
diff --git a/share/man/man4/mps.4 b/share/man/man4/mps.4
new file mode 100644
index 000000000000..dbf35cd459f0
--- /dev/null
+++ b/share/man/man4/mps.4
@@ -0,0 +1,216 @@
+.\"
+.\" Copyright (c) 2010 Spectra Logic Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" substantially similar to the "NO WARRANTY" disclaimer below
+.\" ("Disclaimer") and any redistribution must be conditioned upon
+.\" including a substantially similar Disclaimer requirement for further
+.\" binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" mps driver man page.
+.\"
+.\" Author: Ken Merry <ken@FreeBSD.org>
+.\"
+.\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $
+.\" $FreeBSD$
+.\"
+.Dd February 7, 2012
+.Dt MPS 4
+.Os
+.Sh NAME
+.Nm mps
+.Nd LSI Fusion-MPT 2 Serial Attached SCSI driver
+.Sh SYNOPSIS
+To compile this driver into your kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device mps"
+.Ed
+.Pp
+Or, to load the driver as a module at boot, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mps_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for LSI Logic Fusion-MPT 2
+.Tn SAS
+controllers and WarpDrive solid state storage cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following controllers:
+.Pp
+.Bl -bullet -compact
+.It
+LSI Logic SAS2004 (4 Port
+.Tn SAS )
+.It
+LSI Logic SAS2008 (8 Port
+.Tn SAS )
+.It
+LSI Logic SAS2108 (8 Port
+.Tn SAS )
+.It
+LSI Logic SAS2116 (16 Port
+.Tn SAS )
+.It
+LSI Logic SAS2208 (8 Port
+.Tn SAS )
+.El
+.Sh CONFIGURATION
+To disable MSI interrupts for all
+.Nm
+driver instances, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mps.disable_msi=1
+.Ed
+.Pp
+To disable MSI interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msi=1
+.Ed
+.Pp
+where X is the adapter number.
+.Pp
+To disable MSI-X interrupts for all
+.Nm
+driver instances, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mps.disable_msix=1
+.Ed
+.Pp
+To disable MSI-X interrupts for a specific
+.Nm
+driver instance, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.disable_msix=1
+.Ed
+.Pp
+To set the maximum number of DMA chains allocated for all adapters,
+set the following variable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.mps.max_chains=NNNN
+.Ed
+.Pp
+To set the maximum number of DMA chains allocated for a specific adapter,
+set the following variable in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+dev.mps.X.max_chains=NNNN
+.Ed
+.Pp
+This variable may also be viewed via
+.Xr sysctl 8
+to see the maximum set for a given adapter.
+.Pp
+The current number of free chain frames may be seen via the
+dev.mps.X.chain_free
+.Xr sysctl 8
+variable.
+.Pp
+The lowest number of free chain frames may be seen via the
+dev.mps.X.chain_free_lowwater
+.Xr sysctl 8
+variable.
+.Pp
+The current number of active I/O commands is shown in the
+dev.mps.X.io_cmds_active
+.Xr sysctl 8
+variable.
+.Pp
+The maximum number of active I/O command seen since boot is shown in the
+dev.mps.X.io_cmds_highwater
+.Xr sysctl 8
+variable.
+.Sh DEBUGGING
+To enable debugging prints from the
+.Nm
+driver, set the
+.Bd -literal -offset indent
+hw.mps.X.debug_level
+.Ed
+.Pp
+variable, where X is the adapter number, either in
+.Xr loader.conf 5
+or via
+.Xr sysctl 8 .
+The following bits have the described effects:
+.Bl -tag -offset indent
+.It 0x01
+Enable informational prints.
+.It 0x02
+Enable tracing prints.
+.It 0x04
+Enable prints for driver faults.
+.It 0x08
+Enable prints for controller events.
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr mpt 4 ,
+.Xr pci 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr targ 4 ,
+.Xr loader.conf 5 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was originally written by
+.An Scott Long Aq scottl@FreeBSD.org .
+It has been improved and tested by LSI Logic Corporation.
+This man page was written by
+.An Ken Merry Aq ken@FreeBSD.org .
+.Sh BUGS
+This driver has a couple of known shortcomings:
+.Bl -bullet -compact
+.It
+Not endian safe.
+It only works on little endian machines (e.g. amd64 and i386).
+.It
+No userland utility available (e.g.
+.Xr mptutil 8)
+.It
+The driver probes devices sequentially.
+If your system has a large number of devices, the probe will take a while.
+.El
diff --git a/share/man/man4/mpt.4 b/share/man/man4/mpt.4
new file mode 100644
index 000000000000..4983759fb507
--- /dev/null
+++ b/share/man/man4/mpt.4
@@ -0,0 +1,186 @@
+.\" $NetBSD: mpt.4,v 1.1 2003/04/16 22:32:15 thorpej Exp $
+.\"
+.\" Copyright (c) 2003 Wasabi Systems, Inc.
+.\" All rights reserved.
+.\"
+.\" Written by Jason R. Thorpe for Wasabi Systems, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project by
+.\" Wasabi Systems, Inc.
+.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse
+.\" or promote products derived from this software without specific prior
+.\" written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2011
+.Dt MPT 4
+.Os
+.Sh NAME
+.Nm mpt
+.Nd LSI Fusion-MPT SCSI/Fibre Channel driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device mpt"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mpt_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support
+for the LSI Logic Fusion-MPT family of
+.Tn SCSI ,
+.Tn Fibre Channel
+and
+.Tn SAS
+controllers.
+.Sh HARDWARE
+The following controllers are supported by the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+LSI Logic 53c1030,
+LSI Logic LSI2x320-X
+(Single and Dual Ultra320
+.Tn SCSI )
+.It
+LSI Logic AS1064,
+LSI Logic AS1068
+.Pq Tn SAS/SATA
+.It
+LSI Logic FC909
+(1Gb/s
+.Tn Fibre Channel )
+.It
+LSI Logic FC909A
+(Dual 1Gb/s
+.Tn Fibre Channel )
+.It
+LSI Logic FC919,
+LSI Logic 7102XP-LC
+(Single 2Gb/s
+.Tn Fibre Channel )
+.It
+LSI Logic FC929,
+LSI Logic FC929X,
+LSI Logic 7202XP-LC
+(Dual 2Gb/s
+.Tn Fibre Channel )
+.It
+LSI Logic FC949X
+(Dual 4Gb/s
+.Tn Fibre Channel )
+.It
+LSI Logic FC949E,
+LSI Logic FC949ES
+(Dual 4Gb/s
+.Tn Fibre Channel PCI-Express)
+.El
+.Pp
+The
+.Tn Ultra 320 SCSI
+controller chips supported by the
+.Nm
+driver can be found onboard on many systems including:
+.Pp
+.Bl -bullet -compact
+.It
+Dell PowerEdge 1750 thru 2850
+.It
+IBM eServer xSeries 335
+.El
+.Pp
+These systems also contain Integrated Raid Mirroring and Integrated
+Raid Mirroring Enhanced which this driver also supports.
+.Pp
+The
+.Tn SAS
+controller chips are also present on many new AMD/Opteron based systems,
+like the Sun 4100.
+Note that this controller can drive both SAS and SATA
+drives or a mix of them at the same time. The Integrated Raid Mirroring
+available for these controllers is poorly supported at best.
+.Pp
+The
+.Tn Fibre Channel
+controller chipset are supported by a broad variety of speeds and systems.
+The
+.Tn Apple
+Fibre Channel HBA is in fact the
+.Tn FC949ES
+card.
+.Pp
+This driver also supports target mode for Fibre Channel cards.
+This support may be enabled by setting the desired role of the core via
+the LSI Logic firmware utility that establishes what roles the card
+can take on - no separate compilation is required.
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr mps 4 ,
+.Xr pci 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr targ 4 ,
+.Xr mptutil 8 ,
+.Xr gmultipath 8
+.Rs
+.%T "LSI Logic Website"
+.%U http://www.lsi.com/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.6 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was originally written for
+.Fx
+by
+.An Greg Ansley
+and marginally improved upon
+by
+.An Matt Jacob Aq mjacob@FreeBSD.org .
+.Pp
+.An Justin Gibbs Aq gibbs@FreeBSD.org
+and
+.An Scott Long Aq scottl@FreeBSD.org
+have made more substantial improvements.
diff --git a/share/man/man4/msk.4 b/share/man/man4/msk.4
new file mode 100644
index 000000000000..200c6f7f3e52
--- /dev/null
+++ b/share/man/man4/msk.4
@@ -0,0 +1,256 @@
+.\" Copyright (c) 2006 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2011
+.Dt MSK 4
+.Os
+.Sh NAME
+.Nm msk
+.Nd Marvell/SysKonnect Yukon II Gigabit Ethernet adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device msk"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_msk_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for various NICs based on the
+Marvell/SysKonnect Yukon II Gigabit Ethernet controller chip.
+.Pp
+All NICs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for transmit, TCP
+segmentation offload (TSO), hardware VLAN tag stripping/insertion
+features and an interrupt moderation mechanism as well as a 64-bit
+multicast hash filter.
+The Yukon II supports TBI (ten bit interface) and GMII
+transceivers, which means it can be used with either copper or
+1000baseX fiber applications.
+.Pp
+The Yukon II also supports Jumbo Frames (up to 9022 bytes), which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseSX
+Set 1000Mbps (Gigabit Ethernet) operation.
+Both
+.Cm full-duplex
+and
+.Cm half-duplex
+modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for various NICs based on the Marvell/SysKonnect
+Yukon II based Gigabit Ethernet controller chips, including:
+.Pp
+.Bl -bullet -compact
+.It
+D-Link 550SX Gigabit Ethernet
+.It
+D-Link 560SX Gigabit Ethernet
+.It
+D-Link 560T Gigabit Ethernet
+.It
+Marvell Yukon 88E8021CU Gigabit Ethernet
+.It
+Marvell Yukon 88E8021 SX/LX Gigabit Ethernet
+.It
+Marvell Yukon 88E8022CU Gigabit Ethernet
+.It
+Marvell Yukon 88E8022 SX/LX Gigabit Ethernet
+.It
+Marvell Yukon 88E8061CU Gigabit Ethernet
+.It
+Marvell Yukon 88E8061 SX/LX Gigabit Ethernet
+.It
+Marvell Yukon 88E8062CU Gigabit Ethernet
+.It
+Marvell Yukon 88E8062 SX/LX Gigabit Ethernet
+.It
+Marvell Yukon 88E8035 Fast Ethernet
+.It
+Marvell Yukon 88E8036 Fast Ethernet
+.It
+Marvell Yukon 88E8038 Fast Ethernet
+.It
+Marvell Yukon 88E8039 Fast Ethernet
+.It
+Marvell Yukon 88E8040 Fast Ethernet
+.It
+Marvell Yukon 88E8040T Fast Ethernet
+.It
+Marvell Yukon 88E8042 Fast Ethernet
+.It
+Marvell Yukon 88E8048 Fast Ethernet
+.It
+Marvell Yukon 88E8050 Gigabit Ethernet
+.It
+Marvell Yukon 88E8052 Gigabit Ethernet
+.It
+Marvell Yukon 88E8053 Gigabit Ethernet
+.It
+Marvell Yukon 88E8055 Gigabit Ethernet
+.It
+Marvell Yukon 88E8056 Gigabit Ethernet
+.It
+Marvell Yukon 88E8057 Gigabit Ethernet
+.It
+Marvell Yukon 88E8058 Gigabit Ethernet
+.It
+Marvell Yukon 88E8059 Gigabit Ethernet
+.It
+Marvell Yukon 88E8070 Gigabit Ethernet
+.It
+Marvell Yukon 88E8071 Gigabit Ethernet
+.It
+Marvell Yukon 88E8072 Gigabit Ethernet
+.It
+Marvell Yukon 88E8075 Gigabit Ethernet
+.It
+SysKonnect SK-9Sxx Gigabit Ethernet
+.It
+SysKonnect SK-9Exx Gigabit Ethernet
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.msk.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va dev.mskc.%d.int_holdoff
+Maximum number of time to delay interrupts.
+The valid range is 0 to 34359738 for 125MHz clock in units of 1us,
+the default is 100 (100us).
+The interface need to be brought down and up again before a change
+takes effect.
+.It Va dev.mskc.%d.process_limit
+Maximum amount of Rx events to be processed in the event loop before
+rescheduling a taskqueue.
+The accepted range is 30 to 256, the default value is 128 events.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org
+and it is based on
+.Xr sk 4
+and Marvell's
+.Fx
+driver.
+It first appeared in
+.Fx 7.0
+and
+.Fx 6.3 .
diff --git a/share/man/man4/mtio.4 b/share/man/man4/mtio.4
new file mode 100644
index 000000000000..e8056e6f65a4
--- /dev/null
+++ b/share/man/man4/mtio.4
@@ -0,0 +1,307 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)mtio.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd November 11, 2011
+.Dt MTIO 4
+.Os
+.Sh NAME
+.Nm mtio
+.Nd FreeBSD magtape interface
+.Sh DESCRIPTION
+The special files
+named
+.Pa /dev/[n]sa*
+refer to SCSI tape drives,
+which may be attached to the system.
+.Pa /dev/[n]sa*.ctl
+are control devices that can be used to issue ioctls to the SCSI
+tape driver to set parameters that are required to last beyond the
+unmounting of a tape.
+.Pp
+The rewind devices automatically rewind
+when the last requested read, write or seek has finished, or the end of the tape
+has been reached.
+The letter
+.Ql n
+is usually prepended to
+the name of the no-rewind devices.
+.Pp
+Tapes can be written with either fixed length records or variable length
+records.
+See
+.Xr sa 4
+for more information.
+Two end-of-file markers mark the end of a tape, and
+one end-of-file marker marks the end of a tape file.
+If the tape is not to be rewound it is positioned with the
+head in between the two tape marks, where the next write
+will over write the second end-of-file marker.
+.Pp
+All of the magtape devices may be manipulated with the
+.Xr mt 1
+command.
+.Pp
+A number of
+.Xr ioctl 2
+operations are available
+on raw magnetic tape.
+The following definitions are from
+.In sys/mtio.h :
+.Bd -literal
+#ifndef _SYS_MTIO_H_
+#define _SYS_MTIO_H_
+
+#ifndef _KERNEL
+#include <sys/types.h>
+#endif
+#include <sys/ioccom.h>
+
+/*
+ * Structures and definitions for mag tape io control commands
+ */
+
+/* structure for MTIOCTOP - mag tape op command */
+struct mtop {
+ short mt_op; /* operations defined below */
+ int32_t mt_count; /* how many of them */
+};
+
+/* operations */
+#define MTWEOF 0 /* write an end-of-file record */
+#define MTFSF 1 /* forward space file */
+#define MTBSF 2 /* backward space file */
+#define MTFSR 3 /* forward space record */
+#define MTBSR 4 /* backward space record */
+#define MTREW 5 /* rewind */
+#define MTOFFL 6 /* rewind and put the drive offline */
+#define MTNOP 7 /* no operation, sets status only */
+#define MTCACHE 8 /* enable controller cache */
+#define MTNOCACHE 9 /* disable controller cache */
+
+#if defined(__FreeBSD__)
+/* Set block size for device. If device is a variable size dev */
+/* a non zero parameter will change the device to a fixed block size */
+/* device with block size set to that of the parameter passed in. */
+/* Resetting the block size to 0 will restore the device to a variable */
+/* block size device. */
+
+#define MTSETBSIZ 10
+
+/* Set density values for device. Sets the value for the opened mode only. */
+
+#define MTSETDNSTY 11
+
+#define MTERASE 12 /* erase to EOM */
+#define MTEOD 13 /* Space to EOM */
+#define MTCOMP 14 /* select compression mode 0=off, 1=def */
+#define MTRETENS 15 /* re-tension tape */
+#define MTWSS 16 /* write setmark(s) */
+#define MTFSS 17 /* forward space setmark */
+#define MTBSS 18 /* backward space setmark */
+
+#define MT_COMP_ENABLE 0xffffffff
+#define MT_COMP_DISABLED 0xfffffffe
+#define MT_COMP_UNSUPP 0xfffffffd
+
+/*
+ * Values in mt_dsreg that say what the device is doing
+ */
+#define MTIO_DSREG_NIL 0 /* Unknown */
+#define MTIO_DSREG_REST 1 /* Doing Nothing */
+#define MTIO_DSREG_RBSY 2 /* Communicating with tape (but no motion) */
+#define MTIO_DSREG_WR 20 /* Writing */
+#define MTIO_DSREG_FMK 21 /* Writing Filemarks */
+#define MTIO_DSREG_ZER 22 /* Erasing */
+#define MTIO_DSREG_RD 30 /* Reading */
+#define MTIO_DSREG_FWD 40 /* Spacing Forward */
+#define MTIO_DSREG_REV 41 /* Spacing Reverse */
+#define MTIO_DSREG_POS 42 /* Hardware Positioning (direction unknown) */
+#define MTIO_DSREG_REW 43 /* Rewinding */
+#define MTIO_DSREG_TEN 44 /* Retensioning */
+#define MTIO_DSREG_UNL 45 /* Unloading */
+#define MTIO_DSREG_LD 46 /* Loading */
+
+#endif /* __FreeBSD__ */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget {
+ short mt_type; /* type of magtape device */
+/* the following two registers are grossly device dependent */
+ short mt_dsreg; /* ``drive status'' register */
+ short mt_erreg; /* ``error'' register */
+/* end device-dependent registers */
+ /*
+ * Note that the residual count, while maintained, may be
+ * be nonsense because the size of the residual may (greatly)
+ * exceed 32 K-bytes. Use the MTIOCERRSTAT ioctl to get a
+ * more accurate count.
+ */
+ short mt_resid; /* residual count */
+#if defined (__FreeBSD__)
+ int32_t mt_blksiz; /* presently operating blocksize */
+ int32_t mt_density; /* presently operating density */
+ uint32_t mt_comp; /* presently operating compression */
+ int32_t mt_blksiz0; /* blocksize for mode 0 */
+ int32_t mt_blksiz1; /* blocksize for mode 1 */
+ int32_t mt_blksiz2; /* blocksize for mode 2 */
+ int32_t mt_blksiz3; /* blocksize for mode 3 */
+ int32_t mt_density0; /* density for mode 0 */
+ int32_t mt_density1; /* density for mode 1 */
+ int32_t mt_density2; /* density for mode 2 */
+ int32_t mt_density3; /* density for mode 3 */
+/* the following are not yet implemented */
+ uint32_t mt_comp0; /* compression type for mode 0 */
+ uint32_t mt_comp1; /* compression type for mode 1 */
+ uint32_t mt_comp2; /* compression type for mode 2 */
+ uint32_t mt_comp3; /* compression type for mode 3 */
+/* end not yet implemented */
+#endif
+ int32_t mt_fileno; /* relative file number of current position */
+ int32_t mt_blkno; /* relative block number of current position */
+};
+
+/* structure for MTIOCERRSTAT - tape get error status command */
+/* really only supported for SCSI tapes right now */
+struct scsi_tape_errors {
+ /*
+ * These are latched from the last command that had a SCSI
+ * Check Condition noted for these operations. The act
+ * of issuing an MTIOCERRSTAT unlatches and clears them.
+ */
+ uint8_t io_sense[32]; /* Last Sense Data For Data I/O */
+ int32_t io_resid; /* residual count from last Data I/O */
+ uint8_t io_cdb[16]; /* Command that Caused the Last Data Sense */
+ uint8_t ctl_sense[32]; /* Last Sense Data For Control I/O */
+ int32_t ctl_resid; /* residual count from last Control I/O */
+ uint8_t ctl_cdb[16]; /* Command that Caused the Last Control Sense */
+ /*
+ * These are the read and write cumulative error counters.
+ * (how to reset cumulative error counters is not yet defined).
+ * (not implemented as yet but space is being reserved for them)
+ */
+ struct {
+ uint32_t retries; /* total # retries performed */
+ uint32_t corrected; /* total # corrections performed */
+ uint32_t processed; /* total # corrections successful */
+ uint32_t failures; /* total # corrections/retries failed */
+ uint64_t nbytes; /* total # bytes processed */
+ } wterr, rderr;
+};
+
+union mterrstat {
+ struct scsi_tape_errors scsi_errstat;
+ char _reserved_padding[256];
+};
+
+/*
+ * Constants for mt_type byte. These are the same
+ * for controllers compatible with the types listed.
+ */
+#define MT_ISTS 0x01 /* TS-11 */
+#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
+#define MT_ISTM 0x03 /* TM11/TE10 Unibus */
+#define MT_ISMT 0x04 /* TM78/TU78 Massbus */
+#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
+#define MT_ISCPC 0x06 /* SUN */
+#define MT_ISAR 0x07 /* SUN */
+#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
+#define MT_ISCY 0x09 /* CCI Cipher */
+#define MT_ISCT 0x0a /* HP 1/4 tape */
+#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */
+#define MT_ISEXABYTE 0x0c /* Exabyte */
+#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */
+#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */
+#define MT_ISVIPER1 0x0e /* Archive Viper-150 */
+#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */
+#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */
+#define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */
+#define MT_ISTK50 0x12 /* DEC SCSI TK50 */
+#define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */
+
+/* mag tape io control commands */
+#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
+#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
+/* these two do not appear to be used anywhere */
+#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
+#define MTIOCEEOT _IO('m', 4) /* enable EOT error */
+/*
+ * When more SCSI-3 SSC (streaming device) devices are out there
+ * that support the full 32 byte type 2 structure, we'll have to
+ * rethink these ioctls to support all the entities they haul into
+ * the picture (64 bit blocks, logical file record numbers, etc..).
+ */
+#define MTIOCRDSPOS _IOR('m', 5, uint32_t) /* get logical blk addr */
+#define MTIOCRDHPOS _IOR('m', 6, uint32_t) /* get hardware blk addr */
+#define MTIOCSLOCATE _IOW('m', 5, uint32_t) /* seek to logical blk addr */
+#define MTIOCHLOCATE _IOW('m', 6, uint32_t) /* seek to hardware blk addr */
+#define MTIOCERRSTAT _IOR('m', 7, union mterrstat) /* get tape errors */
+/*
+ * Set EOT model- argument is number of filemarks to end a tape with.
+ * Note that not all possible values will be accepted.
+ */
+#define MTIOCSETEOTMODEL _IOW('m', 8, uint32_t)
+/* Get current EOT model */
+#define MTIOCGETEOTMODEL _IOR('m', 8, uint32_t)
+
+#ifndef _KERNEL
+#define DEFTAPE "/dev/nsa0"
+#endif
+
+#endif /* !_SYS_MTIO_H_ */
+.Ed
+.Sh FILES
+.Bl -tag -width /dev/[n]sa* -compact
+.It Pa /dev/[n]sa*
+.El
+.Sh SEE ALSO
+.Xr mt 1 ,
+.Xr tar 1 ,
+.Xr ast 4 ,
+.Xr sa 4
+.Sh HISTORY
+The
+.Nm
+manual appeared in
+.Bx 4.2 .
+An i386 version first appeared in
+.Fx 2.2 .
+.Sh BUGS
+The status should be returned in a device independent format.
+.Pp
+The special file naming should be redone in a more consistent and
+understandable manner.
diff --git a/share/man/man4/multicast.4 b/share/man/man4/multicast.4
new file mode 100644
index 000000000000..2f0954ee9a3e
--- /dev/null
+++ b/share/man/man4/multicast.4
@@ -0,0 +1,1011 @@
+.\" Copyright (c) 2001-2003 International Computer Science Institute
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" The names and trademarks of copyright holders may not be used in
+.\" advertising or publicity pertaining to the software without specific
+.\" prior permission. Title to copyright in this software and any associated
+.\" documentation will at all times remain with the copyright holders.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 27, 2009
+.Dt MULTICAST 4
+.Os
+.\"
+.Sh NAME
+.Nm multicast
+.Nd Multicast Routing
+.\"
+.Sh SYNOPSIS
+.Cd "options MROUTING"
+.Pp
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/ip_mroute.h
+.In netinet6/ip6_mroute.h
+.Ft int
+.Fn getsockopt "int s" IPPROTO_IP MRT_INIT "void *optval" "socklen_t *optlen"
+.Ft int
+.Fn setsockopt "int s" IPPROTO_IP MRT_INIT "const void *optval" "socklen_t optlen"
+.Ft int
+.Fn getsockopt "int s" IPPROTO_IPV6 MRT6_INIT "void *optval" "socklen_t *optlen"
+.Ft int
+.Fn setsockopt "int s" IPPROTO_IPV6 MRT6_INIT "const void *optval" "socklen_t optlen"
+.Sh DESCRIPTION
+.Tn "Multicast routing"
+is used to efficiently propagate data
+packets to a set of multicast listeners in multipoint networks.
+If unicast is used to replicate the data to all listeners,
+then some of the network links may carry multiple copies of the same
+data packets.
+With multicast routing, the overhead is reduced to one copy
+(at most) per network link.
+.Pp
+All multicast-capable routers must run a common multicast routing
+protocol.
+It is recommended that either
+Protocol Independent Multicast - Sparse Mode (PIM-SM),
+or Protocol Independent Multicast - Dense Mode (PIM-DM)
+are used, as these are now the generally accepted protocols
+in the Internet community.
+The
+.Sx HISTORY
+section discusses previous multicast routing protocols.
+.Pp
+To start multicast routing,
+the user must enable multicast forwarding in the kernel
+(see
+.Sx SYNOPSIS
+about the kernel configuration options),
+and must run a multicast routing capable user-level process.
+From developer's point of view,
+the programming guide described in the
+.Sx "Programming Guide"
+section should be used to control the multicast forwarding in the kernel.
+.\"
+.Ss Programming Guide
+This section provides information about the basic multicast routing API.
+The so-called
+.Dq advanced multicast API
+is described in the
+.Sx "Advanced Multicast API Programming Guide"
+section.
+.Pp
+First, a multicast routing socket must be open.
+That socket would be used
+to control the multicast forwarding in the kernel.
+Note that most operations below require certain privilege
+(i.e., root privilege):
+.Bd -literal
+/* IPv4 */
+int mrouter_s4;
+mrouter_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP);
+.Ed
+.Bd -literal
+int mrouter_s6;
+mrouter_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+.Ed
+.Pp
+Note that if the router needs to open an IGMP or ICMPv6 socket
+(in case of IPv4 and IPv6 respectively)
+for sending or receiving of IGMP or MLD multicast group membership messages,
+then the same
+.Va mrouter_s4
+or
+.Va mrouter_s6
+sockets should be used
+for sending and receiving respectively IGMP or MLD messages.
+In case of
+.Bx Ns
+-derived kernel, it may be possible to open separate sockets
+for IGMP or MLD messages only.
+However, some other kernels (e.g.,
+.Tn Linux )
+require that the multicast
+routing socket must be used for sending and receiving of IGMP or MLD
+messages.
+Therefore, for portability reason the multicast
+routing socket should be reused for IGMP and MLD messages as well.
+.Pp
+After the multicast routing socket is open, it can be used to enable
+or disable multicast forwarding in the kernel:
+.Bd -literal
+/* IPv4 */
+int v = 1; /* 1 to enable, or 0 to disable */
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_INIT, (void *)&v, sizeof(v));
+.Ed
+.Bd -literal
+/* IPv6 */
+int v = 1; /* 1 to enable, or 0 to disable */
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_INIT, (void *)&v, sizeof(v));
+\&...
+/* If necessary, filter all ICMPv6 messages */
+struct icmp6_filter filter;
+ICMP6_FILTER_SETBLOCKALL(&filter);
+setsockopt(mrouter_s6, IPPROTO_ICMPV6, ICMP6_FILTER, (void *)&filter,
+ sizeof(filter));
+.Ed
+.Pp
+After multicast forwarding is enabled, the multicast routing socket
+can be used to enable PIM processing in the kernel if we are running PIM-SM or
+PIM-DM
+(see
+.Xr pim 4 ) .
+.Pp
+For each network interface (e.g., physical or a virtual tunnel)
+that would be used for multicast forwarding, a corresponding
+multicast interface must be added to the kernel:
+.Bd -literal
+/* IPv4 */
+struct vifctl vc;
+memset(&vc, 0, sizeof(vc));
+/* Assign all vifctl fields as appropriate */
+vc.vifc_vifi = vif_index;
+vc.vifc_flags = vif_flags;
+vc.vifc_threshold = min_ttl_threshold;
+vc.vifc_rate_limit = 0;
+memcpy(&vc.vifc_lcl_addr, &vif_local_address, sizeof(vc.vifc_lcl_addr));
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)&vc,
+ sizeof(vc));
+.Ed
+.Pp
+The
+.Va vif_index
+must be unique per vif.
+The
+.Va vif_flags
+contains the
+.Dv VIFF_*
+flags as defined in
+.In netinet/ip_mroute.h .
+The
+.Dv VIFF_TUNNEL
+flag is no longer supported by
+.Fx .
+Users who wish to forward multicast datagrams over a tunnel should consider
+configuring a
+.Xr gif 4
+or
+.Xr gre 4
+tunnel and using it as a physical interface.
+.Pp
+The
+.Va min_ttl_threshold
+contains the minimum TTL a multicast data packet must have to be
+forwarded on that vif.
+Typically, it would have value of 1.
+.Pp
+The
+.Va max_rate_limit
+argument is no longer supported in
+.Fx
+and should be set to 0.
+Users who wish to rate-limit multicast datagrams should consider the use of
+.Xr dummynet 4
+or
+.Xr altq 4 .
+.Pp
+The
+.Va vif_local_address
+contains the local IP address of the corresponding local interface.
+The
+.Va vif_remote_address
+contains the remote IP address in case of DVMRP multicast tunnels.
+.Bd -literal
+/* IPv6 */
+struct mif6ctl mc;
+memset(&mc, 0, sizeof(mc));
+/* Assign all mif6ctl fields as appropriate */
+mc.mif6c_mifi = mif_index;
+mc.mif6c_flags = mif_flags;
+mc.mif6c_pifi = pif_index;
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)&mc,
+ sizeof(mc));
+.Ed
+.Pp
+The
+.Va mif_index
+must be unique per vif.
+The
+.Va mif_flags
+contains the
+.Dv MIFF_*
+flags as defined in
+.In netinet6/ip6_mroute.h .
+The
+.Va pif_index
+is the physical interface index of the corresponding local interface.
+.Pp
+A multicast interface is deleted by:
+.Bd -literal
+/* IPv4 */
+vifi_t vifi = vif_index;
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_DEL_VIF, (void *)&vifi,
+ sizeof(vifi));
+.Ed
+.Bd -literal
+/* IPv6 */
+mifi_t mifi = mif_index;
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_DEL_MIF, (void *)&mifi,
+ sizeof(mifi));
+.Ed
+.Pp
+After the multicast forwarding is enabled, and the multicast virtual
+interfaces are
+added, the kernel may deliver upcall messages (also called signals
+later in this text) on the multicast routing socket that was open
+earlier with
+.Dv MRT_INIT
+or
+.Dv MRT6_INIT .
+The IPv4 upcalls have
+.Vt "struct igmpmsg"
+header (see
+.In netinet/ip_mroute.h )
+with field
+.Va im_mbz
+set to zero.
+Note that this header follows the structure of
+.Vt "struct ip"
+with the protocol field
+.Va ip_p
+set to zero.
+The IPv6 upcalls have
+.Vt "struct mrt6msg"
+header (see
+.In netinet6/ip6_mroute.h )
+with field
+.Va im6_mbz
+set to zero.
+Note that this header follows the structure of
+.Vt "struct ip6_hdr"
+with the next header field
+.Va ip6_nxt
+set to zero.
+.Pp
+The upcall header contains field
+.Va im_msgtype
+and
+.Va im6_msgtype
+with the type of the upcall
+.Dv IGMPMSG_*
+and
+.Dv MRT6MSG_*
+for IPv4 and IPv6 respectively.
+The values of the rest of the upcall header fields
+and the body of the upcall message depend on the particular upcall type.
+.Pp
+If the upcall message type is
+.Dv IGMPMSG_NOCACHE
+or
+.Dv MRT6MSG_NOCACHE ,
+this is an indication that a multicast packet has reached the multicast
+router, but the router has no forwarding state for that packet.
+Typically, the upcall would be a signal for the multicast routing
+user-level process to install the appropriate Multicast Forwarding
+Cache (MFC) entry in the kernel.
+.Pp
+An MFC entry is added by:
+.Bd -literal
+/* IPv4 */
+struct mfcctl mc;
+memset(&mc, 0, sizeof(mc));
+memcpy(&mc.mfcc_origin, &source_addr, sizeof(mc.mfcc_origin));
+memcpy(&mc.mfcc_mcastgrp, &group_addr, sizeof(mc.mfcc_mcastgrp));
+mc.mfcc_parent = iif_index;
+for (i = 0; i < maxvifs; i++)
+ mc.mfcc_ttls[i] = oifs_ttl[i];
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_MFC,
+ (void *)&mc, sizeof(mc));
+.Ed
+.Bd -literal
+/* IPv6 */
+struct mf6cctl mc;
+memset(&mc, 0, sizeof(mc));
+memcpy(&mc.mf6cc_origin, &source_addr, sizeof(mc.mf6cc_origin));
+memcpy(&mc.mf6cc_mcastgrp, &group_addr, sizeof(mf6cc_mcastgrp));
+mc.mf6cc_parent = iif_index;
+for (i = 0; i < maxvifs; i++)
+ if (oifs_ttl[i] > 0)
+ IF_SET(i, &mc.mf6cc_ifset);
+setsockopt(mrouter_s4, IPPROTO_IPV6, MRT6_ADD_MFC,
+ (void *)&mc, sizeof(mc));
+.Ed
+.Pp
+The
+.Va source_addr
+and
+.Va group_addr
+are the source and group address of the multicast packet (as set
+in the upcall message).
+The
+.Va iif_index
+is the virtual interface index of the multicast interface the multicast
+packets for this specific source and group address should be received on.
+The
+.Va oifs_ttl[]
+array contains the minimum TTL (per interface) a multicast packet
+should have to be forwarded on an outgoing interface.
+If the TTL value is zero, the corresponding interface is not included
+in the set of outgoing interfaces.
+Note that in case of IPv6 only the set of outgoing interfaces can
+be specified.
+.Pp
+An MFC entry is deleted by:
+.Bd -literal
+/* IPv4 */
+struct mfcctl mc;
+memset(&mc, 0, sizeof(mc));
+memcpy(&mc.mfcc_origin, &source_addr, sizeof(mc.mfcc_origin));
+memcpy(&mc.mfcc_mcastgrp, &group_addr, sizeof(mc.mfcc_mcastgrp));
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_DEL_MFC,
+ (void *)&mc, sizeof(mc));
+.Ed
+.Bd -literal
+/* IPv6 */
+struct mf6cctl mc;
+memset(&mc, 0, sizeof(mc));
+memcpy(&mc.mf6cc_origin, &source_addr, sizeof(mc.mf6cc_origin));
+memcpy(&mc.mf6cc_mcastgrp, &group_addr, sizeof(mf6cc_mcastgrp));
+setsockopt(mrouter_s4, IPPROTO_IPV6, MRT6_DEL_MFC,
+ (void *)&mc, sizeof(mc));
+.Ed
+.Pp
+The following method can be used to get various statistics per
+installed MFC entry in the kernel (e.g., the number of forwarded
+packets per source and group address):
+.Bd -literal
+/* IPv4 */
+struct sioc_sg_req sgreq;
+memset(&sgreq, 0, sizeof(sgreq));
+memcpy(&sgreq.src, &source_addr, sizeof(sgreq.src));
+memcpy(&sgreq.grp, &group_addr, sizeof(sgreq.grp));
+ioctl(mrouter_s4, SIOCGETSGCNT, &sgreq);
+.Ed
+.Bd -literal
+/* IPv6 */
+struct sioc_sg_req6 sgreq;
+memset(&sgreq, 0, sizeof(sgreq));
+memcpy(&sgreq.src, &source_addr, sizeof(sgreq.src));
+memcpy(&sgreq.grp, &group_addr, sizeof(sgreq.grp));
+ioctl(mrouter_s6, SIOCGETSGCNT_IN6, &sgreq);
+.Ed
+.Pp
+The following method can be used to get various statistics per
+multicast virtual interface in the kernel (e.g., the number of forwarded
+packets per interface):
+.Bd -literal
+/* IPv4 */
+struct sioc_vif_req vreq;
+memset(&vreq, 0, sizeof(vreq));
+vreq.vifi = vif_index;
+ioctl(mrouter_s4, SIOCGETVIFCNT, &vreq);
+.Ed
+.Bd -literal
+/* IPv6 */
+struct sioc_mif_req6 mreq;
+memset(&mreq, 0, sizeof(mreq));
+mreq.mifi = vif_index;
+ioctl(mrouter_s6, SIOCGETMIFCNT_IN6, &mreq);
+.Ed
+.Ss Advanced Multicast API Programming Guide
+If we want to add new features in the kernel, it becomes difficult
+to preserve backward compatibility (binary and API),
+and at the same time to allow user-level processes to take advantage of
+the new features (if the kernel supports them).
+.Pp
+One of the mechanisms that allows us to preserve the backward
+compatibility is a sort of negotiation
+between the user-level process and the kernel:
+.Bl -enum
+.It
+The user-level process tries to enable in the kernel the set of new
+features (and the corresponding API) it would like to use.
+.It
+The kernel returns the (sub)set of features it knows about
+and is willing to be enabled.
+.It
+The user-level process uses only that set of features
+the kernel has agreed on.
+.El
+.\"
+.Pp
+To support backward compatibility, if the user-level process does not
+ask for any new features, the kernel defaults to the basic
+multicast API (see the
+.Sx "Programming Guide"
+section).
+.\" XXX: edit as appropriate after the advanced multicast API is
+.\" supported under IPv6
+Currently, the advanced multicast API exists only for IPv4;
+in the future there will be IPv6 support as well.
+.Pp
+Below is a summary of the expandable API solution.
+Note that all new options and structures are defined
+in
+.In netinet/ip_mroute.h
+and
+.In netinet6/ip6_mroute.h ,
+unless stated otherwise.
+.Pp
+The user-level process uses new
+.Fn getsockopt Ns / Ns Fn setsockopt
+options to
+perform the API features negotiation with the kernel.
+This negotiation must be performed right after the multicast routing
+socket is open.
+The set of desired/allowed features is stored in a bitset
+(currently, in
+.Vt uint32_t ;
+i.e., maximum of 32 new features).
+The new
+.Fn getsockopt Ns / Ns Fn setsockopt
+options are
+.Dv MRT_API_SUPPORT
+and
+.Dv MRT_API_CONFIG .
+Example:
+.Bd -literal
+uint32_t v;
+getsockopt(sock, IPPROTO_IP, MRT_API_SUPPORT, (void *)&v, sizeof(v));
+.Ed
+.Pp
+would set in
+.Va v
+the pre-defined bits that the kernel API supports.
+The eight least significant bits in
+.Vt uint32_t
+are same as the
+eight possible flags
+.Dv MRT_MFC_FLAGS_*
+that can be used in
+.Va mfcc_flags
+as part of the new definition of
+.Vt "struct mfcctl"
+(see below about those flags), which leaves 24 flags for other new features.
+The value returned by
+.Fn getsockopt MRT_API_SUPPORT
+is read-only; in other words,
+.Fn setsockopt MRT_API_SUPPORT
+would fail.
+.Pp
+To modify the API, and to set some specific feature in the kernel, then:
+.Bd -literal
+uint32_t v = MRT_MFC_FLAGS_DISABLE_WRONGVIF;
+if (setsockopt(sock, IPPROTO_IP, MRT_API_CONFIG, (void *)&v, sizeof(v))
+ != 0) {
+ return (ERROR);
+}
+if (v & MRT_MFC_FLAGS_DISABLE_WRONGVIF)
+ return (OK); /* Success */
+else
+ return (ERROR);
+.Ed
+.Pp
+In other words, when
+.Fn setsockopt MRT_API_CONFIG
+is called, the
+argument to it specifies the desired set of features to
+be enabled in the API and the kernel.
+The return value in
+.Va v
+is the actual (sub)set of features that were enabled in the kernel.
+To obtain later the same set of features that were enabled, then:
+.Bd -literal
+getsockopt(sock, IPPROTO_IP, MRT_API_CONFIG, (void *)&v, sizeof(v));
+.Ed
+.Pp
+The set of enabled features is global.
+In other words,
+.Fn setsockopt MRT_API_CONFIG
+should be called right after
+.Fn setsockopt MRT_INIT .
+.Pp
+Currently, the following set of new features is defined:
+.Bd -literal
+#define MRT_MFC_FLAGS_DISABLE_WRONGVIF (1 << 0) /* disable WRONGVIF signals */
+#define MRT_MFC_FLAGS_BORDER_VIF (1 << 1) /* border vif */
+#define MRT_MFC_RP (1 << 8) /* enable RP address */
+#define MRT_MFC_BW_UPCALL (1 << 9) /* enable bw upcalls */
+.Ed
+.\" .Pp
+.\" In the future there might be:
+.\" .Bd -literal
+.\" #define MRT_MFC_GROUP_SPECIFIC (1 << 10) /* allow (*,G) MFC entries */
+.\" .Ed
+.\" .Pp
+.\" to allow (*,G) MFC entries (i.e., group-specific entries) in the kernel.
+.\" For now this is left-out until it is clear whether
+.\" (*,G) MFC support is the preferred solution instead of something more generic
+.\" solution for example.
+.\"
+.\" 2. The newly defined struct mfcctl2.
+.\"
+.Pp
+The advanced multicast API uses a newly defined
+.Vt "struct mfcctl2"
+instead of the traditional
+.Vt "struct mfcctl" .
+The original
+.Vt "struct mfcctl"
+is kept as is.
+The new
+.Vt "struct mfcctl2"
+is:
+.Bd -literal
+/*
+ * The new argument structure for MRT_ADD_MFC and MRT_DEL_MFC overlays
+ * and extends the old struct mfcctl.
+ */
+struct mfcctl2 {
+ /* the mfcctl fields */
+ struct in_addr mfcc_origin; /* ip origin of mcasts */
+ struct in_addr mfcc_mcastgrp; /* multicast group associated*/
+ vifi_t mfcc_parent; /* incoming vif */
+ u_char mfcc_ttls[MAXVIFS];/* forwarding ttls on vifs */
+
+ /* extension fields */
+ uint8_t mfcc_flags[MAXVIFS];/* the MRT_MFC_FLAGS_* flags*/
+ struct in_addr mfcc_rp; /* the RP address */
+};
+.Ed
+.Pp
+The new fields are
+.Va mfcc_flags[MAXVIFS]
+and
+.Va mfcc_rp .
+Note that for compatibility reasons they are added at the end.
+.Pp
+The
+.Va mfcc_flags[MAXVIFS]
+field is used to set various flags per
+interface per (S,G) entry.
+Currently, the defined flags are:
+.Bd -literal
+#define MRT_MFC_FLAGS_DISABLE_WRONGVIF (1 << 0) /* disable WRONGVIF signals */
+#define MRT_MFC_FLAGS_BORDER_VIF (1 << 1) /* border vif */
+.Ed
+.Pp
+The
+.Dv MRT_MFC_FLAGS_DISABLE_WRONGVIF
+flag is used to explicitly disable the
+.Dv IGMPMSG_WRONGVIF
+kernel signal at the (S,G) granularity if a multicast data packet
+arrives on the wrong interface.
+Usually, this signal is used to
+complete the shortest-path switch in case of PIM-SM multicast routing,
+or to trigger a PIM assert message.
+However, it should not be delivered for interfaces that are not in
+the outgoing interface set, and that are not expecting to
+become an incoming interface.
+Hence, if the
+.Dv MRT_MFC_FLAGS_DISABLE_WRONGVIF
+flag is set for some of the
+interfaces, then a data packet that arrives on that interface for
+that MFC entry will NOT trigger a WRONGVIF signal.
+If that flag is not set, then a signal is triggered (the default action).
+.Pp
+The
+.Dv MRT_MFC_FLAGS_BORDER_VIF
+flag is used to specify whether the Border-bit in PIM
+Register messages should be set (in case when the Register encapsulation
+is performed inside the kernel).
+If it is set for the special PIM Register kernel virtual interface
+(see
+.Xr pim 4 ) ,
+the Border-bit in the Register messages sent to the RP will be set.
+.Pp
+The remaining six bits are reserved for future usage.
+.Pp
+The
+.Va mfcc_rp
+field is used to specify the RP address (in case of PIM-SM multicast routing)
+for a multicast
+group G if we want to perform kernel-level PIM Register encapsulation.
+The
+.Va mfcc_rp
+field is used only if the
+.Dv MRT_MFC_RP
+advanced API flag/capability has been successfully set by
+.Fn setsockopt MRT_API_CONFIG .
+.Pp
+.\"
+.\" 3. Kernel-level PIM Register encapsulation
+.\"
+If the
+.Dv MRT_MFC_RP
+flag was successfully set by
+.Fn setsockopt MRT_API_CONFIG ,
+then the kernel will attempt to perform
+the PIM Register encapsulation itself instead of sending the
+multicast data packets to user level (inside
+.Dv IGMPMSG_WHOLEPKT
+upcalls) for user-level encapsulation.
+The RP address would be taken from the
+.Va mfcc_rp
+field
+inside the new
+.Vt "struct mfcctl2" .
+However, even if the
+.Dv MRT_MFC_RP
+flag was successfully set, if the
+.Va mfcc_rp
+field was set to
+.Dv INADDR_ANY ,
+then the
+kernel will still deliver an
+.Dv IGMPMSG_WHOLEPKT
+upcall with the
+multicast data packet to the user-level process.
+.Pp
+In addition, if the multicast data packet is too large to fit within
+a single IP packet after the PIM Register encapsulation (e.g., if
+its size was on the order of 65500 bytes), the data packet will be
+fragmented, and then each of the fragments will be encapsulated
+separately.
+Note that typically a multicast data packet can be that
+large only if it was originated locally from the same hosts that
+performs the encapsulation; otherwise the transmission of the
+multicast data packet over Ethernet for example would have
+fragmented it into much smaller pieces.
+.\"
+.\" Note that if this code is ported to IPv6, we may need the kernel to
+.\" perform MTU discovery to the RP, and keep those discoveries inside
+.\" the kernel so the encapsulating router may send back ICMP
+.\" Fragmentation Required if the size of the multicast data packet is
+.\" too large (see "Encapsulating data packets in the Register Tunnel"
+.\" in Section 4.4.1 in the PIM-SM spec
+.\" draft-ietf-pim-sm-v2-new-05.{txt,ps}).
+.\" For IPv4 we may be able to get away without it, but for IPv6 we need
+.\" that.
+.\"
+.\" 4. Mechanism for "multicast bandwidth monitoring and upcalls".
+.\"
+.Pp
+Typically, a multicast routing user-level process would need to know the
+forwarding bandwidth for some data flow.
+For example, the multicast routing process may want to timeout idle MFC
+entries, or in case of PIM-SM it can initiate (S,G) shortest-path switch if
+the bandwidth rate is above a threshold for example.
+.Pp
+The original solution for measuring the bandwidth of a dataflow was
+that a user-level process would periodically
+query the kernel about the number of forwarded packets/bytes per
+(S,G), and then based on those numbers it would estimate whether a source
+has been idle, or whether the source's transmission bandwidth is above a
+threshold.
+That solution is far from being scalable, hence the need for a new
+mechanism for bandwidth monitoring.
+.Pp
+Below is a description of the bandwidth monitoring mechanism.
+.Bl -bullet
+.It
+If the bandwidth of a data flow satisfies some pre-defined filter,
+the kernel delivers an upcall on the multicast routing socket
+to the multicast routing process that has installed that filter.
+.It
+The bandwidth-upcall filters are installed per (S,G).
+There can be
+more than one filter per (S,G).
+.It
+Instead of supporting all possible comparison operations
+(i.e., < <= == != > >= ), there is support only for the
+<= and >= operations,
+because this makes the kernel-level implementation simpler,
+and because practically we need only those two.
+Further, the missing operations can be simulated by secondary
+user-level filtering of those <= and >= filters.
+For example, to simulate !=, then we need to install filter
+.Dq bw <= 0xffffffff ,
+and after an
+upcall is received, we need to check whether
+.Dq measured_bw != expected_bw .
+.It
+The bandwidth-upcall mechanism is enabled by
+.Fn setsockopt MRT_API_CONFIG
+for the
+.Dv MRT_MFC_BW_UPCALL
+flag.
+.It
+The bandwidth-upcall filters are added/deleted by the new
+.Fn setsockopt MRT_ADD_BW_UPCALL
+and
+.Fn setsockopt MRT_DEL_BW_UPCALL
+respectively (with the appropriate
+.Vt "struct bw_upcall"
+argument of course).
+.El
+.Pp
+From application point of view, a developer needs to know about
+the following:
+.Bd -literal
+/*
+ * Structure for installing or delivering an upcall if the
+ * measured bandwidth is above or below a threshold.
+ *
+ * User programs (e.g. daemons) may have a need to know when the
+ * bandwidth used by some data flow is above or below some threshold.
+ * This interface allows the userland to specify the threshold (in
+ * bytes and/or packets) and the measurement interval. Flows are
+ * all packet with the same source and destination IP address.
+ * At the moment the code is only used for multicast destinations
+ * but there is nothing that prevents its use for unicast.
+ *
+ * The measurement interval cannot be shorter than some Tmin (currently, 3s).
+ * The threshold is set in packets and/or bytes per_interval.
+ *
+ * Measurement works as follows:
+ *
+ * For >= measurements:
+ * The first packet marks the start of a measurement interval.
+ * During an interval we count packets and bytes, and when we
+ * pass the threshold we deliver an upcall and we are done.
+ * The first packet after the end of the interval resets the
+ * count and restarts the measurement.
+ *
+ * For <= measurement:
+ * We start a timer to fire at the end of the interval, and
+ * then for each incoming packet we count packets and bytes.
+ * When the timer fires, we compare the value with the threshold,
+ * schedule an upcall if we are below, and restart the measurement
+ * (reschedule timer and zero counters).
+ */
+
+struct bw_data {
+ struct timeval b_time;
+ uint64_t b_packets;
+ uint64_t b_bytes;
+};
+
+struct bw_upcall {
+ struct in_addr bu_src; /* source address */
+ struct in_addr bu_dst; /* destination address */
+ uint32_t bu_flags; /* misc flags (see below) */
+#define BW_UPCALL_UNIT_PACKETS (1 << 0) /* threshold (in packets) */
+#define BW_UPCALL_UNIT_BYTES (1 << 1) /* threshold (in bytes) */
+#define BW_UPCALL_GEQ (1 << 2) /* upcall if bw >= threshold */
+#define BW_UPCALL_LEQ (1 << 3) /* upcall if bw <= threshold */
+#define BW_UPCALL_DELETE_ALL (1 << 4) /* delete all upcalls for s,d*/
+ struct bw_data bu_threshold; /* the bw threshold */
+ struct bw_data bu_measured; /* the measured bw */
+};
+
+/* max. number of upcalls to deliver together */
+#define BW_UPCALLS_MAX 128
+/* min. threshold time interval for bandwidth measurement */
+#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC 3
+#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC 0
+.Ed
+.Pp
+The
+.Vt bw_upcall
+structure is used as an argument to
+.Fn setsockopt MRT_ADD_BW_UPCALL
+and
+.Fn setsockopt MRT_DEL_BW_UPCALL .
+Each
+.Fn setsockopt MRT_ADD_BW_UPCALL
+installs a filter in the kernel
+for the source and destination address in the
+.Vt bw_upcall
+argument,
+and that filter will trigger an upcall according to the following
+pseudo-algorithm:
+.Bd -literal
+ if (bw_upcall_oper IS ">=") {
+ if (((bw_upcall_unit & PACKETS == PACKETS) &&
+ (measured_packets >= threshold_packets)) ||
+ ((bw_upcall_unit & BYTES == BYTES) &&
+ (measured_bytes >= threshold_bytes)))
+ SEND_UPCALL("measured bandwidth is >= threshold");
+ }
+ if (bw_upcall_oper IS "<=" && measured_interval >= threshold_interval) {
+ if (((bw_upcall_unit & PACKETS == PACKETS) &&
+ (measured_packets <= threshold_packets)) ||
+ ((bw_upcall_unit & BYTES == BYTES) &&
+ (measured_bytes <= threshold_bytes)))
+ SEND_UPCALL("measured bandwidth is <= threshold");
+ }
+.Ed
+.Pp
+In the same
+.Vt bw_upcall
+the unit can be specified in both BYTES and PACKETS.
+However, the GEQ and LEQ flags are mutually exclusive.
+.Pp
+Basically, an upcall is delivered if the measured bandwidth is >= or
+<= the threshold bandwidth (within the specified measurement
+interval).
+For practical reasons, the smallest value for the measurement
+interval is 3 seconds.
+If smaller values are allowed, then the bandwidth
+estimation may be less accurate, or the potentially very high frequency
+of the generated upcalls may introduce too much overhead.
+For the >= operation, the answer may be known before the end of
+.Va threshold_interval ,
+therefore the upcall may be delivered earlier.
+For the <= operation however, we must wait
+until the threshold interval has expired to know the answer.
+.Pp
+Example of usage:
+.Bd -literal
+struct bw_upcall bw_upcall;
+/* Assign all bw_upcall fields as appropriate */
+memset(&bw_upcall, 0, sizeof(bw_upcall));
+memcpy(&bw_upcall.bu_src, &source, sizeof(bw_upcall.bu_src));
+memcpy(&bw_upcall.bu_dst, &group, sizeof(bw_upcall.bu_dst));
+bw_upcall.bu_threshold.b_data = threshold_interval;
+bw_upcall.bu_threshold.b_packets = threshold_packets;
+bw_upcall.bu_threshold.b_bytes = threshold_bytes;
+if (is_threshold_in_packets)
+ bw_upcall.bu_flags |= BW_UPCALL_UNIT_PACKETS;
+if (is_threshold_in_bytes)
+ bw_upcall.bu_flags |= BW_UPCALL_UNIT_BYTES;
+do {
+ if (is_geq_upcall) {
+ bw_upcall.bu_flags |= BW_UPCALL_GEQ;
+ break;
+ }
+ if (is_leq_upcall) {
+ bw_upcall.bu_flags |= BW_UPCALL_LEQ;
+ break;
+ }
+ return (ERROR);
+} while (0);
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_BW_UPCALL,
+ (void *)&bw_upcall, sizeof(bw_upcall));
+.Ed
+.Pp
+To delete a single filter, then use
+.Dv MRT_DEL_BW_UPCALL ,
+and the fields of bw_upcall must be set
+exactly same as when
+.Dv MRT_ADD_BW_UPCALL
+was called.
+.Pp
+To delete all bandwidth filters for a given (S,G), then
+only the
+.Va bu_src
+and
+.Va bu_dst
+fields in
+.Vt "struct bw_upcall"
+need to be set, and then just set only the
+.Dv BW_UPCALL_DELETE_ALL
+flag inside field
+.Va bw_upcall.bu_flags .
+.Pp
+The bandwidth upcalls are received by aggregating them in the new upcall
+message:
+.Bd -literal
+#define IGMPMSG_BW_UPCALL 4 /* BW monitoring upcall */
+.Ed
+.Pp
+This message is an array of
+.Vt "struct bw_upcall"
+elements (up to
+.Dv BW_UPCALLS_MAX
+= 128).
+The upcalls are
+delivered when there are 128 pending upcalls, or when 1 second has
+expired since the previous upcall (whichever comes first).
+In an
+.Vt "struct upcall"
+element, the
+.Va bu_measured
+field is filled-in to
+indicate the particular measured values.
+However, because of the way
+the particular intervals are measured, the user should be careful how
+.Va bu_measured.b_time
+is used.
+For example, if the
+filter is installed to trigger an upcall if the number of packets
+is >= 1, then
+.Va bu_measured
+may have a value of zero in the upcalls after the
+first one, because the measured interval for >= filters is
+.Dq clocked
+by the forwarded packets.
+Hence, this upcall mechanism should not be used for measuring
+the exact value of the bandwidth of the forwarded data.
+To measure the exact bandwidth, the user would need to
+get the forwarded packets statistics with the
+.Fn ioctl SIOCGETSGCNT
+mechanism
+(see the
+.Sx Programming Guide
+section) .
+.Pp
+Note that the upcalls for a filter are delivered until the specific
+filter is deleted, but no more frequently than once per
+.Va bu_threshold.b_time .
+For example, if the filter is specified to
+deliver a signal if bw >= 1 packet, the first packet will trigger a
+signal, but the next upcall will be triggered no earlier than
+.Va bu_threshold.b_time
+after the previous upcall.
+.\"
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr dummynet 4 ,
+.Xr getsockopt 2 ,
+.Xr gif 4 ,
+.Xr gre 4 ,
+.Xr recvfrom 2 ,
+.Xr recvmsg 2 ,
+.Xr setsockopt 2 ,
+.Xr socket 2 ,
+.Xr sourcefilter 3 ,
+.Xr icmp6 4 ,
+.Xr igmp 4 ,
+.Xr inet 4 ,
+.Xr inet6 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr ip6 4 ,
+.Xr mld 4 ,
+.Xr pim 4
+.\"
+.Sh HISTORY
+The Distance Vector Multicast Routing Protocol (DVMRP)
+was the first developed multicast routing protocol.
+Later, other protocols such as Multicast Extensions to OSPF (MOSPF)
+and Core Based Trees (CBT), were developed as well.
+Routers at autonomous system boundaries may now exchange multicast
+routes with peers via the Border Gateway Protocol (BGP).
+Many other routing protocols are able to redistribute multicast routes
+for use with
+.Dv PIM-SM
+and
+.Dv PIM-DM .
+.Sh AUTHORS
+.An -nosplit
+The original multicast code was written by
+.An David Waitzman
+(BBN Labs),
+and later modified by the following individuals:
+.An Steve Deering
+(Stanford),
+.An Mark J. Steiglitz
+(Stanford),
+.An Van Jacobson
+(LBL),
+.An Ajit Thyagarajan
+(PARC),
+.An Bill Fenner
+(PARC).
+The IPv6 multicast support was implemented by the KAME project
+.Pq Pa http://www.kame.net ,
+and was based on the IPv4 multicast code.
+The advanced multicast API and the multicast bandwidth
+monitoring were implemented by
+.An Pavlin Radoslavov
+(ICSI)
+in collaboration with
+.An Chris Brown
+(NextHop).
+The IGMPv3 and MLDv2 multicast support was implemented by
+.An Bruce Simpson .
+.Pp
+This manual page was written by
+.An Pavlin Radoslavov
+(ICSI).
diff --git a/share/man/man4/mvs.4 b/share/man/man4/mvs.4
new file mode 100644
index 000000000000..a7bbe80c6014
--- /dev/null
+++ b/share/man/man4/mvs.4
@@ -0,0 +1,177 @@
+.\" Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 27, 2010
+.Dt MVS 4
+.Os
+.Sh NAME
+.Nm mvs
+.Nd Marvell Serial ATA Host Controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device mvs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mvs_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.mvs. Ns Ar X Ns Va .msi
+controls Message Signaled Interrupts (MSI) usage by the specified controller.
+.It Va hint.mvs. Ns Ar X Ns Va .ccc
+controls Command Completion Coalescing (CCC) usage by the specified controller.
+Non-zero value enables CCC and defines maximum time (in us), request can wait
+for interrupt.
+CCC reduces number of context switches on systems with many parallel requests,
+but it can decrease disk performance on some workloads due to additional
+command latency.
+.It Va hint.mvs. Ns Ar X Ns Va .cccc
+defines number of completed commands for CCC, which trigger interrupt without
+waiting for specified coalescing timeout.
+.It Va hint.mvs. Ns Ar X Ns Va .pm_level
+controls SATA interface Power Management for the specified channel,
+allowing some power to be saved at the cost of additional command
+latency.
+Possible values:
+.Bl -tag -compact
+.It 0
+interface Power Management is disabled (default);
+.It 1
+device is allowed to initiate PM state change, host is passive;
+.It 4
+driver initiates PARTIAL PM state transition 1ms after port becomes idle;
+.It 5
+driver initiates SLUMBER PM state transition 125ms after port becomes idle.
+.El
+.Pp
+Note that interface Power Management is not compatible with
+device presence detection.
+A manual bus reset is needed on device hot-plug.
+.It Va hint.mvs. Ns Ar X Ns Va .sata_rev
+setting to nonzero value limits maximum SATA revision (speed).
+Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps.
+.El
+.Sh DESCRIPTION
+This driver provides the
+.Xr CAM 4
+subsystem with native access to the
+.Tn SATA
+ports of several generations (Gen-I/II/IIe) of Marvell SATA controllers.
+Each SATA port found is represented to CAM as a separate bus with one
+target, or, if HBA supports Port Multipliers (Gen-II/IIe), 16 targets.
+Most of the bus-management details are handled by the SATA-specific
+transport of CAM.
+Connected ATA disks are handled by the ATA protocol disk peripheral driver
+.Xr ada 4 .
+ATAPI devices are handled by the SCSI protocol peripheral drivers
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+etc.
+.Pp
+Driver features include support for Serial ATA and ATAPI devices,
+Port Multipliers (including FIS-based switching, when supported),
+hardware command queues (up to 31 command per port),
+Native Command Queuing, SATA interface Power Management, device hot-plug
+and Message Signaled Interrupts.
+.Pp
+The same hardware is also supported by the atamarvell and ataadaptec
+drivers from the
+.Xr ata 4
+subsystem.
+If both drivers are loaded at the same time, this one will be
+given precedence as the more functional of the two.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following controllers:
+.Pp
+Gen-I (SATA 1.5Gbps):
+.Bl -bullet -compact -offset "xxxxxx"
+.It
+88SX5040
+.It
+88SX5041
+.It
+88SX5080
+.It
+88SX5081
+.El
+.Pp
+Gen-II (SATA 3Gbps, NCQ, PMP):
+.Bl -bullet -compact -offset "xxxxxx"
+.It
+88SX6040
+.It
+88SX6041 (including Adaptec 1420SA)
+.It
+88SX6080
+.It
+88SX6081
+.El
+.Pp
+Gen-IIe (SATA 3Gbps, NCQ, PMP with FBS):
+.Bl -bullet -compact -offset "xxxxxx"
+.It
+88SX6042
+.It
+88SX7042 (including Adaptec 1430SA)
+.It
+88F5182 SoC
+.It
+88F6281 SoC
+.It
+MV78100 SoC
+.El
+.Pp
+Note, that this hardware supports command queueing and FIS-based switching
+only for ATA DMA commands.
+ATAPI and non-DMA ATA commands executed one by one for each port.
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr ata 4 ,
+.Xr cam 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.1 .
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org
diff --git a/share/man/man4/mwl.4 b/share/man/man4/mwl.4
new file mode 100644
index 000000000000..62dc29e6eb58
--- /dev/null
+++ b/share/man/man4/mwl.4
@@ -0,0 +1,193 @@
+.\"-
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd July 8, 2009
+.Dt MWL 4
+.Os
+.Sh NAME
+.Nm mwl
+.Nd "Marvell 88W8363 IEEE 802.11n wireless network driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mwl"
+.Cd "device mwlfw"
+.Cd "device wlan"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_mwl_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for IEEE 802.11n wireless network adapters based on
+Marvell 88W8363 parts.
+PCI and/or CardBus interfaces are supported.
+.Pp
+This driver requires the firmware built with the
+.Nm mwlfw
+module to work.
+Normally this module is loaded on demand by the driver but it may
+also be compiled into the kernel.
+.Pp
+Supported features include 802.11n, power management, BSS, MBSS,
+and host-based access point operation modes.
+All host/device interaction is via DMA.
+.Pp
+The
+.Nm
+driver encapsulates IP and ARP traffic as 802.11 frames, however
+it can receive either 802.11 or 802.3 frames.
+Devices support 802.11n, 802.11a, 802.11g, and 802.11b operation with
+transmit speeds appropriate to each.
+The actual transmit speed used is dependent on signal quality and the
+.Dq "rate control"
+algorithm implemented in the firmware.
+All chips have hardware support for WEP,
+AES-CCM, TKIP, and Michael cryptographic operations.
+.Pp
+The driver supports
+.Cm station ,
+.Cm hostap ,
+.Cm mesh ,
+and
+.Cm wds
+mode operation.
+Multiple
+.Cm hostap
+virtual interfaces may be configured for simultaneous use.
+When multiple interfaces are configured each may have a separate
+mac address that is formed by setting the U/L bits in the mac
+address assigned to the underlying device.
+Any number of
+.Cm wds
+virtual interfaces may be configured together with
+.Cm hostap
+interfaces.
+Multiple
+.Cm station
+interfaces may be operated together with
+.Cm hostap
+interfaces to construct a wireless repeater device.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+Devices supported by the
+.Nm
+driver come in either Cardbus or mini-PCI packages.
+Wireless cards in Cardbus slots may be inserted and ejected on the fly.
+.Sh EXAMPLES
+Join an existing BSS network (ie: connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev mwl0 inet 192.168.0.20 \e
+ netmask 0xffffff00"
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev mwl0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net"
+.Ed
+.Pp
+Join a specific BSS network with WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev mwl0
+ifconfig wlan0 inet 192.168.0.20 netmask 0xffffff00 ssid my_net \e
+ wepmode on wepkey 0x8736639624
+.Ed
+.Pp
+Create an 802.11g host-based access point:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev mwl0 wlanmode hostap
+ifconfig wlan0 inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e
+ mode 11g
+.Ed
+.Pp
+Create an 802.11a mesh station:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev mwl0 wlanmode mesh
+ifconfig wlan0 meshid my_mesh mode 11a inet 192.168.0.10/24
+.Ed
+.Pp
+Create two virtual 802.11a host-based access points, one with
+with WEP enabled and one with no security, and bridge them to
+the fxp0 (wired) device:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev mwl0 wlanmode hostap \e
+ ssid paying-customers wepmode on wepkey 0x1234567890 \e
+ mode 11a up
+ifconfig wlan1 create wlandev mwl0 wlanmode hostap bssid \e
+ ssid freeloaders up
+ifconfig bridge0 create addm wlan0 addm wlan1 addm fxp0 up
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "mwl%d: unable to setup builtin firmware"
+There was a problem downloading and/or setting up the firmware.
+The device is not usable.
+.It "mwl%d: failed to setup descriptors: %d"
+There was a problem setting up the DMA data structures.
+This typically is caused by not being able to allocate contiguous memory.
+.It "mwl%d: transmit timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+This should not happen.
+.It "mwl%d: device not present"
+A cardbus device was ejected while active; the request to the firmware
+was not completed.
+.El
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr intro 4 ,
+.Xr mwlfw 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr hostapd 8 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh BUGS
+The driver does not support power-save operation in station mode;
+consequently power use is suboptimal (e.g. on a laptop).
diff --git a/share/man/man4/mwlfw.4 b/share/man/man4/mwlfw.4
new file mode 100644
index 000000000000..5e557bfc3073
--- /dev/null
+++ b/share/man/man4/mwlfw.4
@@ -0,0 +1,52 @@
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 9, 2009
+.Dt MWLFW 4
+.Os
+.Sh NAME
+.Nm mwlfw
+.Nd "Firmware Module for Marvell 88W8363 Wireless driver"
+.Sh SYNOPSIS
+To compile this module into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mwlfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mwlfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module provides access to firmware sets for the
+Marvell 88W8363 IEEE 802.11n wireless adapters.
+It may be
+statically linked into the kernel, or loaded as a module.
+.Sh SEE ALSO
+.Xr mwl 4 ,
+.Xr firmware 9
diff --git a/share/man/man4/mxge.4 b/share/man/man4/mxge.4
new file mode 100644
index 000000000000..5a353fbf423a
--- /dev/null
+++ b/share/man/man4/mxge.4
@@ -0,0 +1,186 @@
+.\" Copyright (c) 2006, Myricom Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Myricom Inc nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" * Other names and brands may be claimed as the property of others.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2008
+.Dt MXGE 4
+.Os
+.Sh NAME
+.Nm mxge
+.Nd "Myricom Myri10GE 10 Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device firmware"
+.Cd "device mxge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_mxge_load="YES"
+mxge_ethp_z8e_load="YES"
+mxge_eth_z8e_load="YES"
+mxge_rss_ethp_z8e_load="YES"
+mxge_rss_eth_z8e_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Express 10 Gigabit Ethernet adapters based on
+the Myricom LANai Z8E chip.
+The driver supports Transmit/Receive checksum offload,
+Jumbo Frames, TCP segmentation offload (TSO) as well
+as Large Receive Offload (LRO).
+For further hardware information, see
+.Pa http://www.myri.com/ .
+.Pp
+For questions related to hardware requirements,
+refer to the documentation supplied with your Myri10GE adapter.
+All hardware requirements listed apply to use with
+.Fx .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+The maximum MTU size for Jumbo Frames is 9000.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10 Gigabit Ethernet adapters based on the
+Myricom LANai Z8E chips:
+.Pp
+.Bl -bullet -compact
+.It
+Myricom 10GBase-CX4 (10G-PCIE-8A-C, 10G-PCIE-8AL-C)
+.It
+Myricom 10GBase-R (10G-PCIE-8A-R, 10G-PCIE-8AL-R)
+.It
+Myricom 10G XAUI over ribbon fiber (10G-PCIE-8A-Q, 10G-PCIE-8AL-Q)
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.mxge.flow_control_enabled
+Whether or not hardware flow control is enabled on the adapter.
+The default value is 1.
+.It Va hw.mxge.intr_coal_delay
+This value delays the generation of all interrupts in units of
+1 microsecond.
+The default value is 30.
+.It Va hw.mxge.skip_pio_read
+This value determines whether or not the driver may omit doing a
+PIO read in the interrupt handler which ensures that the interrupt
+line has been deasserted when using xPIC interrupts.
+A non-zero value
+may result in lower CPU overhead, however it may also result in
+spurious interrupts.
+The default value is 0.
+This tunable has no effect when the device is
+using MSI or MSI-X interrupts.
+.It Va hw.mxge.max_slices
+This value determines the maximum number of slices the driver
+will attempt to use.
+The default value is 1.
+A slice is comprised
+of a set of receive queues and an associated interrupt thread.
+When using multiple slices, the NIC hashes traffic to different slices
+based on the value of
+.Va hw.mxge.rss_hashtype .
+Using multiple slices requires that your motherboard and Myri10GE NIC
+both be capable of MSI-X.
+Older Myri10GE NICs can be field upgraded to add
+MSI-X using the "10G NIC Tool Kit" for FreeBSD which is available from
+.Pa http://www.myri.com/scs/download-10g-tools.html .
+.Pp
+.It Va hw.mxge.rss_hashtype
+This value determines how incoming traffic is steered to different
+slices.
+This tunable is ignored when using just a single slice.
+The legal values for this tunable are:
+.Bl -tag -width "XXXX"
+.It 1
+Hash on the source and destination IPv4 addresses.
+.It 2
+Hash on source and destination IPv4 addresses and if the packet
+is TCP, then also hash on the TCP source and destination ports.
+.It 4
+Hash on the TCP or UDP source ports.
+This is the default value.
+.El
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "mxge%d: Unable to allocate bus resource: memory"
+A fatal initialization error has occurred.
+.It "mxge%d: Unable to allocate bus resource: interrupt"
+A fatal initialization error has occurred.
+.It "mxge%d: Could not find firmware image %s"
+The appropriate firmware kld module was not installed.
+This is a non-fatal initialization error, but will
+result in running in a reduced performance mode.
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Myricom support website at:
+.Pa http://www.myri.com/scs/ .
+.Pp
+If an issue is identified with the released source code on the supported kernel
+with a supported adapter, email the specific information related to the
+issue to
+.Aq help@myri.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Andrew Gallatin Aq gallatin@FreeBSD.org .
diff --git a/share/man/man4/my.4 b/share/man/man4/my.4
new file mode 100644
index 000000000000..28b67ddbd85f
--- /dev/null
+++ b/share/man/man4/my.4
@@ -0,0 +1,90 @@
+.\" Copyright (c) 2003 Hiten M. Pandya
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND ITS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 11, 2007
+.Dt MY 4
+.Os
+.Sh NAME
+.Nm my
+.Nd "Myson Technology Ethernet PCI driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device my"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_my_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs based on the Myson chipset.
+The Myson chipset is a variant of the DEC Tulip NIC chipset.
+.Pp
+The driver will work with almost any MII-compliant PHY, thus failure to
+positively identify the chip is not a fatal error.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for various NICs based on the Myson chipset.
+Supported models include:
+.Pp
+.Bl -bullet -compact
+.It
+Myson MTD800 PCI Fast Ethernet chip
+.It
+Myson MTD803 PCI Fast Ethernet chip
+.It
+Myson MTD89X PCI Gigabit Ethernet chip
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr de 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.6 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by Myson Technology Inc.
+.Pp
+This manual page was written by
+.An Hiten M. Pandya Aq hmp@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver does not support Power Management Events (PME).
diff --git a/share/man/man4/natm.4 b/share/man/man4/natm.4
new file mode 100644
index 000000000000..a553f6ebd9e5
--- /dev/null
+++ b/share/man/man4/natm.4
@@ -0,0 +1,101 @@
+.\" $FreeBSD$
+.\"
+.Dd December 29, 1997
+.Dt NATM 4
+.Os
+.Sh NAME
+.Nm natm
+.Nd Native Mode ATM protocol layer
+.Sh DESCRIPTION
+The
+.Bx
+ATM software comes with a
+.Em native mode ATM protocol layer
+which provides socket level access to AAL0 and AAL5 virtual circuits.
+To enable this protocol layer, add
+.Dl options NATM
+to your kernel configuration file and re-make the kernel (do not forget
+to do
+.Dq make clean ) .
+.Sh NATM API
+The NATM layer uses a
+.Vt struct sockaddr_natm
+to specify a virtual circuit:
+.Bd -literal -offset indent
+struct sockaddr_natm {
+ uint8_t snatm_len; /* length */
+ uint8_t snatm_family; /* AF_NATM */
+ char snatm_if[IFNAMSIZ]; /* interface name */
+ uint16_t snatm_vci; /* vci */
+ uint8_t snatm_vpi; /* vpi */
+};
+.Ed
+.Pp
+To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201
+one would use the following:
+.Bd -literal -offset indent
+ struct sockaddr_natm snatm;
+ int s, r;
+ s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5);
+ /* note: PROTO_NATMAAL0 is AAL0 */
+ if (s < 0) { perror("socket"); exit(1); }
+ bzero(&snatm, sizeof(snatm));
+ snatm.snatm_len = sizeof(snatm);
+ snatm.snatm_family = AF_NATM;
+ sprintf(snatm.snatm_if, "en0");
+ snatm.snatm_vci = 201;
+ snatm.snatm_vpi = 0;
+ r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm));
+ if (r < 0) { perror("connect"); exit(1); }
+ /* s now connected to ATM! */
+.Ed
+.Pp
+The
+.Fn socket
+call simply creates an unconnected NATM socket.
+The
+.Fn connect
+call associates an unconnected NATM socket with a
+virtual circuit and tells the driver to enable that virtual circuit
+for receiving data.
+After the
+.Fn connect
+call one can
+.Fn read
+or
+.Fn write
+to the socket to perform ATM I/O.
+.Sh Internal NATM operation
+Internally, the NATM protocol layer keeps a list of all active virtual
+circuits on the system in
+.Dv natm_pcbs .
+This includes circuits currently being used for IP to prevent NATM and
+IP from clashing over virtual circuit usage.
+.Pp
+When a virtual circuit is enabled for receiving data, the NATM
+protocol layer passes the address of the protocol control block down
+to the driver as a receive
+.Dq handle .
+When inbound data arrives, the driver passes the data back with the
+appropriate receive handle.
+The NATM layer uses this to avoid the
+overhead of a protocol control block lookup.
+This allows us to take
+advantage of the fact that ATM has already demultiplexed the data for
+us.
+.Sh SEE ALSO
+.Xr en 4 ,
+.Xr fatm 4 ,
+.Xr hatm 4 ,
+.Xr natmip 4 ,
+.Xr patm 4
+.Sh AUTHORS
+.An Chuck Cranor
+of Washington University implemented the NATM protocol layer
+along with the EN ATM driver in 1996 for
+.Nx .
+.Sh CAVEATS
+The NATM protocol support is subject to change as
+the ATM protocols develop.
+Users should not depend on details of the current implementation, but rather
+the services exported.
diff --git a/share/man/man4/natmip.4 b/share/man/man4/natmip.4
new file mode 100644
index 000000000000..154e97da6681
--- /dev/null
+++ b/share/man/man4/natmip.4
@@ -0,0 +1,248 @@
+.\"
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 11, 2003
+.Dt NATMIP 4
+.Os
+.Sh NAME
+.Nm natmip
+.Nd IP over ATM PVCs
+.Sh SYNOPSIS
+.Cd "device atm"
+.Cd "options NATM"
+.Sh DESCRIPTION
+The NATM protocol stack includes support for IP over ATM.
+Without any
+additional signalling stacks or other modules it is possible to build
+a CLIP (classical IP over ATM) network based on PVCs.
+.Pp
+An ATM network card
+.Li ( en0
+in this example) is configured for IP by something
+like:
+.Pp
+.Dl "ifconfig en0 128.252.200.1 netmask 0xffffff00 up"
+.Pp
+IP routing is done with special interface routes (routes with directly
+reachable destinations) with a link layer gateway address.
+The link layer address specifies the ATM interface through which the
+destination can be reached, the virtual channel that connects to the
+destination and the ATM characteristics of this channel.
+The address part of the link layer address (see
+.Xr link_addr 3 )
+consists of a fixed part (the first 5 bytes) and a part that
+depends on the kind of the PVC (UBR, CBR, VBR, ABR).
+Multi-byte values
+are big-endian encoded: the bytes with the lower numbers contain the
+higher order bits.
+.Bl -tag -width "bytes 12...12" -offset indent
+.It byte 0
+Is a flag byte.
+Currently only flag 0x20 is used.
+When set, all IP frames are LLC/SNAP encapsulated before putting them into
+an AAL5 frame.
+Setting this flag is recommended and allows interoperability with other
+CLIP implementations.
+Note that BPF works only with LLC/SNAP encapsulation.
+.It byte 1
+This is the VPI of the channel.
+.It bytes 2...3
+VCI of the channel.
+Must not be zero.
+.It byte 4
+Traffic type.
+One of 0 (UBR), 1 (CBR), 2 (ABR), 3 (VBR).
+.El
+.Pp
+The variable part for UBR connections may be either empty or three bytes:
+.Bl -tag -width "bytes 12...12" -offset indent
+.It bytes 5...7
+Specifies the peak cell rate for UBR.
+.El
+.Pp
+The variable part for CBR connections must be three bytes:
+.Bl -tag -width "bytes 12...12" -offset indent
+.It bytes 5...7
+Specifies the peak cell rate for CBR.
+.El
+.Pp
+The variable part for VBR connections must be 9 bytes long and specifies three
+values:
+.Bl -tag -width "bytes 12...12" -offset indent
+.It bytes 5...7
+Specifies the peak cell rate for VBR.
+.It bytes 8...10
+This is the sustainable cell rate.
+.It bytes 11...13
+The maximum burst size.
+.El
+.Pp
+The variable part for ABR connections must be 19 bytes long and specifies the
+following values:
+.Bl -tag -width "bytes 12...12" -offset indent
+.It bytes 5...7
+Specifies the peak cell rate for ABR.
+.It bytes 8...10
+The minimum cell rate.
+.It bytes 11...13
+The initial cell rate.
+.It bytes 14...16
+The transient buffer exposure.
+.It byte 17
+The NRM value.
+.It byte 18
+The TRM value.
+.It bytes 19...20
+The ADTF value.
+.It byte 21
+The rate increase factor (RIF).
+.It byte 22
+The rate decrease factor (RDF).
+.It byte 23
+The cutoff decrease factor (CDF).
+.El
+.Pp
+To add a PVC the
+.Xr route 8
+utility can be used:
+.Bd -ragged -offset indent
+.Nm route Cm add
+.Fl iface Aq Ar "remote\ IP\ address"
+.Fl link Ao Ar iface Ac : Ns Aq Ar lladdr
+.Ed
+.Pp
+The
+.Ar iface
+is the ATM interface through which
+.Ar "remote\ IP\ address"
+can be reached and
+.Ar lladdr
+is the link layer address as a string of dot-separated, hexadecimal bytes.
+.Pp
+NATM also supports the old, original format.
+This consists of 4 byte
+link layer addresses (and the channels are implicit UBR):
+.Bl -tag -width "bytes 12...12" -offset indent
+.It byte 0
+Flags:
+.Bl -tag -width "0x02" -offset indent -compact
+.It 0x01
+use AAL5.
+.It 0x02
+if using AAL5, use an LLC/SNAP header.
+.El
+.Pp
+Thus, parameter 3 means AAL5 and LLC/SNAP encapsulation (this is the required
+setting for interworking with other CLIP clients).
+Note that BPF works only with LLC/SNAP encapsulation.
+.It byte 1
+VPI for the channel
+.It bytes 2...3
+VCI for the channel
+.El
+.Sh EXAMPLES
+Suppose you have 3 hosts 128.252.200.1, 128.252.200.2 and
+128.252.200.3 connected by ATM through PVCs:
+.Pp
+.Bl -item -offset indent -compact
+.It
+between 128.252.200.1 and 128.252.200.2: 0xc9 UBR
+.It
+between 128.252.200.1 and 128.252.200.3: 0xca VBR
+.It
+between 128.252.200.2 and 128.252.200.3: 0xcb CBR
+.El
+.Pp
+The parameters for the VBR channel are: PCR 50000, SCR 10000, MBS 10.
+The peak cell rate for the CBR channel is 100000.
+.Pp
+To enable the links use the following commands:
+.Pp
+on host 128.252.200.1:
+.Bd -literal -offset indent -compact
+ifconfig en0 128.252.200.1 netmask 0xffffff00 up
+route add -iface 128.252.200.2 -link en0:3.0.0.c9.0
+route add -iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
+.Ed
+.Pp
+on host 128.252.200.2:
+.Bd -literal -offset indent -compact
+ifconfig en0 128.252.200.2 netmask 0xffffff00 up
+route add -iface 128.252.200.1 -link en0:3.0.0.c9.0
+route add -iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0
+.Ed
+.Pp
+on host 128.252.200.3:
+.Bd -literal -offset indent -compact
+ifconfig en0 128.252.200.3 netmask 0xffffff00 up
+route add -iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
+route add -iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0
+.Ed
+.Pp
+This can also be done in
+.Xr rc.conf 5 :
+.Pp
+on host 128.252.200.1:
+.Bd -literal -offset indent -compact
+network_interfaces="lo0 en0"
+ifconfig_en0="inet 128.252.200.1 netmask 255.255.255.0"
+static_routes="host2 host3"
+route_host2="-iface 128.252.200.2 -link en0:3.0.0.c9.0"
+route_host3="-iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
+.Ed
+.Pp
+on host 128.252.200.2:
+.Bd -literal -offset indent -compact
+network_interfaces="lo0 en0"
+ifconfig_en0="inet 128.252.200.2 netmask 255.255.255.0"
+static_routes="host1 host3"
+route_host1="-iface 128.252.200.1 -link en0:3.0.0.c9.0"
+route_host3="-iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0"
+.Ed
+.Pp
+on host 128.252.200.3:
+.Bd -literal -offset indent -compact
+network_interfaces="lo0 en0"
+ifconfig_en0="inet 128.252.200.3 netmask 255.255.255.0"
+static_routes="host1 host2"
+route_host1="-iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
+route_host2="-iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0"
+.Ed
+.Sh SEE ALSO
+.Xr en 4 ,
+.Xr fatm 4 ,
+.Xr hatm 4 ,
+.Xr natm 4 ,
+.Xr patm 4
+.Sh AUTHORS
+.An Chuck Cranor
+of Washington University implemented the NATM protocol layer
+along with the EN ATM driver in 1996 for
+.Nx .
diff --git a/share/man/man4/ncr.4 b/share/man/man4/ncr.4
new file mode 100644
index 000000000000..0521b4d9e1fc
--- /dev/null
+++ b/share/man/man4/ncr.4
@@ -0,0 +1,91 @@
+.\"
+.\" Copyright (c) 1994 James A. Jegers
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 19, 2004
+.Dt NCR 4
+.Os
+.Sh NAME
+.Nm ncr
+.Nd NCR 53C8xx SCSI driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device ncr"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following NCR/Symbios SCSI controller
+chips:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn 53C810
+.It
+.Tn 53C810A
+.It
+.Tn 53C815
+.It
+.Tn 53C820
+.It
+.Tn 53C825A
+.It
+.Tn 53C860
+.It
+.Tn 53C875
+.It
+.Tn 53C875J
+.It
+.Tn 53C885
+.It
+.Tn 53C895
+.It
+.Tn 53C895A
+.It
+.Tn 53C896
+.It
+.Tn 53C1510D
+.El
+.Pp
+The following add-on boards are known to be supported:
+.Pp
+.Bl -bullet -compact
+.It
+I-O DATA SC-98/PCI (PC-98)
+.It
+I-O DATA SC-PCI (PC-98)
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr sym 4
diff --git a/share/man/man4/ncv.4 b/share/man/man4/ncv.4
new file mode 100644
index 000000000000..8ab719921b80
--- /dev/null
+++ b/share/man/man4/ncv.4
@@ -0,0 +1,133 @@
+.\" Copyright (C) 2003 The FreeBSD Project. All rights reserved.
+.\" Copyright (c) 2003 Noriaki Mitsunaga. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 2004
+.Dt NCV 4
+.Os
+.Sh NAME
+.Nm ncv
+.Nd "NCR 53C500 based SCSI host adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device ncv"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ncv_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the
+.Tn SCSI
+bus
+connected to an NCR 53C500 based
+PC-Card
+.Tn SCSI
+host adapter or an Adaptec AHA-2920 on the
+.Tn PCI
+bus.
+.Sh HARDWARE
+The following devices are currently supported by the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+I-O DATA PCSC-DV
+.It
+KME KXLC002 (TAXAN ICD-400PN, etc.), KXLC004, and UJDCD450
+.It
+Macnica Miracle SCSI-II mPS110
+.It
+Media Intelligent MSC-110, MSC-200
+.It
+NEC PC-9801N-J03R
+.It
+New Media Corporation BASICS SCSI
+.It
+Qlogic Fast SCSI
+.It
+RATOC REX-9530, REX-5572 (SCSI only)
+.El
+.Sh DIAGNOSTICS
+The following error messages are sometimes returned:
+.Bl -diag
+.It "SCSI BUS RESET failed"
+Usually returned when a failure occurs during
+the bus reset.
+.It "CMD_NOP failed"
+No operation or the operation has failed.
+.It "CMD_NOP|CMD_DMA"
+A failure occurred during the
+.Tn DMA
+read/write operations.
+.El
+.Pp
+The
+.Nm
+driver should return
+.Bq Er ENODEV
+when any of the previously noted failures occur.
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr pccard 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+device driver has been developed for
+.Nx Ns / Ns Tn pc98
+and ported to
+.Fx .
+The
+.Nm
+driver first appeared in
+.Fx 2.2
+with
+.Tn PAO
+and merged in
+.Fx 4.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Naofumi Honda .
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+and
+.An Noriaki Mitsunaga Aq non@FreeBSD.org .
diff --git a/share/man/man4/ndis.4 b/share/man/man4/ndis.4
new file mode 100644
index 000000000000..874a843f9770
--- /dev/null
+++ b/share/man/man4/ndis.4
@@ -0,0 +1,153 @@
+.\" Copyright (c) 2003
+.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 14, 2010
+.Dt NDIS 4
+.Os
+.Sh NAME
+.Nm ndis
+.Nd NDIS miniport driver wrapper
+.Sh SYNOPSIS
+.Cd "options NDISAPI"
+.Cd "device ndis"
+.Cd "device wlan"
+.Sh DESCRIPTION
+The
+.Nm
+driver is a wrapper designed to allow binary
+.Tn Windows\[rg]
+NDIS miniport
+network drivers to be used with
+.Fx .
+The
+.Nm
+driver is provided in source code form and must be combined with
+the
+.Tn Windows\[rg]
+driver supplied with your network adapter.
+The
+.Nm
+driver uses the
+.Nm ndisapi
+kernel subsystem to relocate and link the
+.Tn Windows\[rg]
+binary so
+that it can be used in conjunction with native code.
+The
+.Nm ndisapi
+subsystem provides an interface between the NDIS API and the
+.Fx
+networking infrastructure.
+The
+.Tn Windows\[rg]
+driver is essentially
+fooled into thinking it is running on
+.Tn Windows\[rg] .
+Note that this
+means the
+.Nm
+driver is only useful on x86 machines.
+.Pp
+To build a functional driver, the user must have a copy of the
+driver distribution media for his or her card.
+From this distribution,
+the user must extract two files: the
+.Pa .SYS
+file containing the driver
+binary code, and its companion
+.Pa .INF
+file, which contains the
+definitions for driver-specific registry keys and other installation
+data such as device identifiers.
+These two files can be converted
+into a kernel module file using the
+.Xr ndisgen 8
+utility.
+This file contains a binary image of the driver plus
+registry key data.
+When the
+.Nm
+driver loads, it will create
+.Xr sysctl 3
+nodes for each registry key extracted from the
+.Pa .INF
+file.
+.Pp
+The
+.Nm
+driver is designed to support mainly Ethernet and wireless
+network devices with PCI, PCMCIA and USB bus attachments.
+(Cardbus
+devices are also supported as a subset of PCI.)
+It can
+support many different media types and speeds.
+One limitation
+however, is that there is no consistent way to learn if an
+Ethernet device is operating in full or half duplex mode.
+The NDIS API allows for a generic means for determining link
+state and speed, but not the duplex setting.
+There may be
+driver-specific registry keys to control the media setting
+which can be configured via the
+.Xr sysctl 8
+command.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ndis%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8 ,
+.Xr ndis_events 8 ,
+.Xr ndiscvt 8 ,
+.Xr ndisgen 8 ,
+.Xr wpa_supplicant 8
+.Rs
+.%T "NDIS 5.1 specification"
+.%U http://www.microsoft.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@windriver.com .
diff --git a/share/man/man4/net80211.4 b/share/man/man4/net80211.4
new file mode 100644
index 000000000000..20d71fe39f03
--- /dev/null
+++ b/share/man/man4/net80211.4
@@ -0,0 +1,1318 @@
+.\"-
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\""
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+.\" redistribution must be conditioned upon including a substantially
+.\" similar Disclaimer requirement for further binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2009
+.Dt NET80211 4
+.Os
+.Sh NAME
+.Nm net80211
+.Nd standard interface to IEEE 802.11 devices
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/if.h
+.In net/ethernet.h
+.In net80211/ieee80211_ioctl.h
+.Sh DESCRIPTION
+This section describes the standard programming
+interface to configure and retrieve status information
+for IEEE 802.11 devices that depend on the
+.Xr wlan 4
+module for operation.
+The interface is via one
+of the following
+.Xr ioctl 2
+calls on a socket:
+.Bl -tag -width ".Dv SIOCG80211"
+.It Dv SIOCG80211
+Get configuration or status information.
+.It Dv SIOCS80211
+Set configuration information.
+.El
+.Pp
+These requests are made via a modified
+.Vt ifreq
+structure.
+This structure is defined as follows:
+.Bd -literal
+struct ieee80211req {
+ char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */
+ uint16_t i_type; /* req type */
+ int16_t i_val; /* Index or simple value */
+ int16_t i_len; /* Index or simple value */
+ void *i_data; /* Extra data */
+};
+.Ed
+.Pp
+Requests that are not supported by the underlying device return
+-1 and set the global variable errno to
+.Er EOPNOTSUPP .
+.Dv SIOCG80211
+requests that return data to an application place small values in
+.Va i_val
+or in a user-specified buffer pointed to by
+.Va i_data .
+When an indirect buffer is used
+.Va i_len
+specifies how large the indirect buffer is and on return it is set by the
+system to the actual amount of data returned.
+.Dv SIOCS80211
+requests use a similar scheme with data passed to the system taken either
+from
+.Va i_val
+or an indirect buffer pointed to by
+.Va i_data .
+.Pp
+For
+.Dv SIOCG80211
+the following values of
+.Va i_type
+are valid:
+.Bl -tag -width indent
+.It Dv IEEE80211_IOC_AMPDU
+Return whether or not AMPDU is enabled in
+.Va i_val .
+AMPDU is an aggregation scheme that is part of the 802.11n specification
+and is used only when operating on an HT channel.
+The value returned is one of:
+0 (AMPDU disabled),
+1 (AMPDU enabled for transmit),
+2 (AMPDU enabled for receive),
+and
+3 (AMPDU enabled for transmit and receive).
+The 802.11n specification says a compliant station must receive AMPDU but
+may not support transmitting AMPDU frames.
+Disabling AMPDU receive is mainly useful for testing and working around bugs.
+.It Dv IEEE80211_IOC_AMPDU_DENSITY
+Return the minimum density for bursting AMPDU frames in
+.Va i_val .
+The value returned is one of:
+0 (no time restriction),
+1 (1/4 usec),
+2 (1/2 usec),
+3 (1 usec),
+4 (2 usec),
+5 (4 usec),
+6 (8 usec),
+and
+7 (16 usec).
+.It Dv IEEE80211_IOC_AMPDU_LIMIT
+Return the limit on the size of AMPDU frames in
+.Va i_val .
+The value returned is one of:
+0 (8 kilobytes),
+1 (16 kilobytes),
+2 (32 kilobytes),
+and
+3 (64 kilobytes).
+.It Dv IEEE80211_IOC_AMSDU
+Return whether or not AMSDU is enabled in
+.Va i_val .
+AMSDU is an aggregation scheme that is part of the 802.11n specification
+and is used only when operating on an HT channel.
+The value returned is one of:
+0 (AMSDU disabled),
+1 (AMSDU enabled for transmit),
+2 (AMSDU enabled for receive),
+and
+3 (AMSDU enabled for transmit and receive).
+The 802.11n specification says a compliant station must receive AMSDU but
+may not support transmitting AMSDU frames.
+Disabling AMSDU receive is mainly useful for testing and working around bugs.
+.It Dv IEEE80211_IOC_AMSDU_LIMIT
+Return the limit on the size of AMSDU frames in
+.Va i_val .
+The value returned is one of:
+3839 (bytes)
+and
+7935 (bytes).
+Note these values are specified by 802.11n; arbitrary values are not allowed.
+.It Dv IEEE80211_IOC_APBRIDGE
+Return whether AP bridging is enabled in
+.Va i_val .
+Normally packets sent between stations associated
+to the same access point are delivered without going through system layers
+that do packet filtering; when AP bridging is disabled packets are
+passed up the system to be forwarded using some other mechanism.
+This value will be non-zero when AP bridging is enabled and otherwise zero.
+.It Dv IEEE80211_IOC_APPIE
+Return an application information element via
+.Va i_data .
+Application IE's are maintained for many 802.11 frames; the
+request must identify the frame to return an IE for in
+.Va i_val .
+For example, to retrieve the IE sent in each Beacon frame
+.Va i_val
+would be set to
+.Va IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT .
+If no information element is installed then
+.Er EINVAL
+is returned.
+If the data buffer for returning data is too small to hold the information
+element the value is truncated; this permits querying the presence of
+data by requesting zero bytes of data be returned.
+.It Dv IEEE80211_IOC_AUTHMODE
+Return the current authentication mode in
+.Va i_val .
+Valid values are
+.Dv IEEE80211_AUTH_NONE
+(no authentication),
+.Dv IEEE80211_AUTH_OPEN
+(open authentication),
+.Dv IEEE80211_AUTH_SHARED
+(shared key authentication),
+.Dv IEEE80211_AUTH_8021X
+(802.1x only authentication),
+and
+.Dv IEEE80211_AUTH_WPA
+(WPA/802.11i/802.1x authentication).
+.It Dv IEEE80211_IOC_BEACON_INTERVAL
+Return the time between Beacon frames (in TU) in
+.Va i_val .
+.It Dv IEEE80211_IOC_BGSCAN
+Return whether background scanning is enabled in
+.Va i_val .
+When this value is non-zero and operating in station mode
+the station will periodically leave
+the current channel and scan for neighboring stations.
+See also
+.Dv IEEE80211_IOC_BGSCAN_IDLE
+and
+.Dv IEEE80211_IOC_BGSCAN_INTERVAL .
+.It Dv IEEE80211_IOC_BGSCAN_IDLE
+Return in
+.Va i_val
+the minimum time (msecs) a station must be idle
+(i.e. not transmitting or receiving frames)
+before it will do a background scan.
+See also
+.Dv IEEE80211_IOC_BGSCAN_INTERVAL .
+.It Dv IEEE80211_IOC_BGSCAN_INTERVAL
+Return in
+.Va i_val
+the minimum time (seconds) between background scan operations.
+See also
+.Dv IEEE80211_IOC_BGSCAN_IDLE .
+.It Dv IEEE80211_IOC_BMISSTHRESHOLD
+Return in
+.Va i_val
+the number of consecutive missed Beacon frames before the system will
+attempt to roam to a different/better access point.
+.It Dv IEEE80211_IOC_BSSID
+Return the MAC address for the current BSS identifier via
+.Va i_data .
+When the interface is running, the bssid is either the value
+configured locally (e.g. for an IBSS network started by the local station)
+or the value adopted when joining an existing network.
+For WDS interfaces this value is the address of the remote station.
+When the interface is not running, the bssid returned is the desired
+bssid, if any, that has been configured.
+.It Dv IEEE80211_IOC_BURST
+Return whether or not packet bursting is enabled in
+.Va i_val .
+If this value is non-zero then the system will try to send packets closely
+spaced to improve throughput.
+.It Dv IEEE80211_IOC_CHANINFO
+Return the set of available channels via
+.Va i_data .
+Note this data should be used by user applications to map between
+channel specifications (frequency and attributes) and IEEE channel numbers
+as user applications may not have the necessary information to do
+this directly (e.g. for 900MHz radios, operation in the Public Safety Band).
+.It Dv IEEE80211_IOC_CHANLIST
+Return the current list of usable channels via
+.Va i_data .
+The channel list is returned as a bit vector with bit N set to 1 if
+IEEE channel number N is available for use.
+.It Dv IEEE80211_IOC_CHANNEL
+Return the IEEE channel number of the current channel in
+.Va i_val .
+Note this request is deprecated; use
+.Dv IEEE80211_IOC_CURCHAN
+instead.
+.It Dv IEEE80211_IOC_COUNTERMEASURES
+Return whether TKIP Countermeasures are enabled in
+.Va i_val .
+This value will be non-zero when Countermeasures are enabled and
+otherwise zero.
+.It Dv IEEE80211_IOC_CURCHAN
+Return information for the current channel via
+.Va i_data .
+This information includes the IEEE channel number, the frequency, and
+attributes that describe the operating constraints (e.g. Passive Scan,
+DFS, usage restrictions).
+.It Dv IEEE80211_IOC_DEVCAPS
+Return device capabilities in the data buffer pointed at by
+.Va i_data .
+The buffer must be large enough to return the number of available
+channels but otherwise may be made small to limit how much information
+is returned.
+.It Dv IEEE80211_IOC_DFS
+Return whether or not Dynamic Frequency Selection (DFS) is enabled in
+.Va i_val .
+DFS embodies several facilities including detection of overlapping
+radar signals, dynamic transmit power control, and channel selection
+according to a least-congested criteria.
+DFS support is mandatory for some 5GHz frequencies in certain
+locales (e.g. ETSI).
+By default DFS is enabled according to the regulatory definitions
+and the current country code, regdomain, and channel.
+.It Dv IEEE80211_IOC_DOTD
+Return whether or not 802.11d support is enabled in
+.Va i_val .
+When 802.11d is enabled in station mode, Beacon frames that advertise
+a country code different than the currently configured country code will
+cause an event to be dispatched to user applications.
+This event can be used by the station to adopt that country code and
+operate according to the associated regulatory constraints.
+When operating as an access point with 802.11d enabled the Beacon and
+ProbeResponse frames transmitted will advertise the current regulatory
+domain settings.
+.It Dv IEEE80211_IOC_DOTH
+Return whether 802.11h support is enabled in
+.Va i_val .
+When 802.11h is enabled Beacon and ProbeResponse frames will have
+the SpectrumMgt bit set in the capabilities field and
+country and power constraint information elements will be present.
+802.11h support also includes handling Channel Switch Announcements (CSA)
+which are a mechanism to coordinate channel changes by an access point.
+By default 802.11h is enabled if the device is capable.
+.It Dv IEEE80211_IOC_DROPUNENCRYPTED
+Return, in
+.Va i_val ,
+whether unencrypted packets transmit/received should be discarded.
+This value will be zero if unencrypted packets will be accepted and
+non-zero if they are to be discarded.
+.It Dv IEEE80211_IOC_DTIM_PERIOD
+Return the period (in beacon intervals) between DTIM events in
+.Va i_val .
+.It Dv IEEE80211_IOC_DWDS
+Return, in
+.Va i_val ,
+whether or not Dynamic WDS support is enabled.
+Dynamic WDS is a facility by which packets may be tunneled over normal
+Infrastructure BSS associations using 4-address (WDS) frames.
+.It Dv IEEE80211_IOC_FF
+Return, in
+.Va i_val ,
+whether Atheros fast-frames support is enabled.
+Fast-frames is a non-standard protocol extension that aggregates multiple
+frames to improve throughput.
+Note that enabling fast-frames support does not guarantee use;
+the client and access point must negotiate its use.
+.It Dv IEEE80211_IOC_FRAGTHRESHOLD
+Return, in
+.Va i_val ,
+the threshold (in bytes) for enabling fragmentation frames.
+Packets larger than this value will automatically be split into multiple
+fragmented frames that are sent one after the other.
+.It Dv IEEE80211_IOC_GREENFIELD
+Return, in
+.Va i_val ,
+whether or not Greenfield preamble use is enabled.
+This setting is meaningful only when operating with 802.11n on an HT channel.
+.It Dv IEEE80211_IOC_HIDESSID
+Return, in
+.Va i_val ,
+whether SSID hiding/cloaking is enabled.
+SSID hiding is only meaningful when operating as an access point.
+When this is enabled Beacon frames do not include the SSID and
+ProbeRequest frames are not answered unless they include the AP's SSID.
+This value will be non-zero when SSID hiding is enabled and otherwise zero.
+.It Dv IEEE80211_IOC_HTCOMPAT
+Return, in
+.Va i_val ,
+whether or not 802.11n compatibility support is enabled.
+The 802.11n protocol specification went through several incompatible iterations.
+Some vendors implemented 11n support to older specifications that
+will not interoperate with a purely 11n-compliant station.
+In particular the information elements included in management frames
+for old devices are different.
+When compatibility support is enabled both standard and compatible data
+will be provided and/or accepted.
+.It Dv IEEE80211_IOC_HTCONF
+Return the setting for automatic promotion of HT channels in
+.Va i_val .
+Promotion happens when the system must select a channel and may choose
+between legacy, HT20, and HT40 operation (e.g. when scanning).
+Valid values are:
+0 (do not promote, use legacy),
+1 (promote to HT20),
+and
+2 (promote to HT40),
+.It Dv IEEE80211_IOC_HTPROTMODE
+Return, in
+.Va i_val ,
+the technique used to protect HT frames in a mixed 802.11n network.
+Valid values are:
+.Dv IEEE80211_PROTMODE_OFF
+(no protection enabled)
+and
+.Dv IEEE80211_PROTMODE_RTSCTS
+(send RTS and wait for CTS).
+.It Dv IEEE80211_IOC_HWMP_MAXHOPS
+Return the maximum acceptable hop count in an HWMP path in
+.Va i_val .
+.It Dv IEEE80211_IOC_HWMP_ROOTMODE
+Return the setting for Mesh root mode operation in
+.Va i_val .
+Valid values are:
+.Dv IEEE80211_HWMP_ROOTMODE_DISABLED
+(root mode is disabled),
+.Dv IEEE80211_HWMP_ROOTMODE_NORMAL
+(send broadcast Path Request frames),
+.Dv IEEE80211_HWMP_ROOTMODE_PROACTIVE
+(send broadcast Path Request frames and force replies)
+and
+.Dv IEEE80211_HWMP_ROOTMODE_RANN
+(send broadcast Root Announcement (RANN) frames).
+.It Dv IEEE80211_IOC_INACTIVITY
+Return whether or not the system handles inactivity processing in
+.Va i_val .
+When inactivity processing is enabled the system will track stations
+that have not transmitted frames and periodically probe them to
+check if they are still present.
+Stations that are inactive and do not respond to probes are dropped.
+.It Dv IEEE80211_IOC_MACCMD
+Return information about the state of the MAC address
+access control list (ACL) system.
+There are two requests supported:
+.Dv IEEE80211_MACCMD_POLICY
+(to retrieve the current policy in
+.Va i_val ),
+and
+.Dv IEEE80211_MACCMD_LIST
+to retrieve the list installed/active ACL's via
+.Va i_data .
+The
+.Xr wlan_acl 4
+module must be installed and enabled or
+.Er EINVAL
+will be returned.
+.It Dv IEEE80211_IOC_MESH_AP
+Return whether or not Mesh AP support is enabled in
+.Va i_val .
+.It Dv IEEE80211_IOC_MESH_ID
+Return the Mesh ID in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_FWRD
+Return whether or not packet forwarding support is enabled in
+.Va i_val .
+.It Dv IEEE80211_IOC_MESH_PP_METRIC
+Return the link metric protocol in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_PP_PATH
+Return the path selection protocol in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_RTCMD
+Return information about the state of the Mesh routing tables.
+One request is supported:
+.Dv IEEE80211_MESH_RTCMD_LIST
+to retrieve the contents of the routing table in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_TTL
+Return, in
+.Va i_val ,
+the Mesh Time To Live (TTL) setting installed in packets
+transmitted by this mesh node.
+.It Dv IEEE80211_IOC_NUMSSIDS
+Return the number of SSIDs supported in
+.Va i_val .
+.It Dv IEEE80211_IOC_NUMWEPKEYS
+Return the number of WEP keys supported in
+.Va i_val
+.It Dv IEEE80211_IOC_POWERSAVE
+Return the current powersaving mode in
+.Va i_val .
+Valid values are
+.Dv IEEE80211_POWERSAVE_OFF
+(power save operation is disabled)
+and
+.Dv IEEE80211_POWERSAVE_ON
+(power save operation is enabled).
+.It Dv IEEE80211_IOC_POWERSAVESLEEP
+Return the powersave sleep time in TU in
+.Va i_val .
+This value is also termed the listen interval and represents the maximum time
+a station will sleep before waking to retrieve packets buffered by
+an access point.
+.It Dv IEEE80211_IOC_PRIVACY
+Return the current MLME setting for PRIVACY in
+.Va i_val .
+When PRIVACY is enabled all data packets must be encrypted.
+This value will be zero if PRIVACY is disabled and
+non-zero when PRIVACY is enabled.
+.It Dv IEEE80211_IOC_PROTMODE
+Return the current 802.11g protection mode in
+.Va i_val .
+Protection is the mechanism used to safeguard 802.11b stations operating
+on an 802.11g network.
+Valid values are
+.Dv IEEE80211_PROTMODE_OFF
+(no protection enabled),
+.Dv IEEE80211_PROTMODE_CTS
+(send CTS to yourself),
+and
+.Dv IEEE80211_PROTMODE_RTSCTS
+(send RTS and wait for CTS).
+.It Dv IEEE80211_IOC_PUREG
+Return whether ``pure 11g'' mode is enabled in
+.Va i_val .
+This setting is meaningful only for access point operation;
+when non-zero, 802.11b stations will not be allowed to associate.
+.It Dv IEEE80211_IOC_PUREN
+Return whether ``pure 11n'' mode is enabled in
+.Va i_val .
+This setting is meaningful only for access point operation;
+when non-zero, legacy (non-11n capable) stations will not be
+allowed to associate.
+.It Dv IEEE80211_IOC_REGDOMAIN
+Return the regulatory state in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_RIFS
+Return whether or not Reduced InterFrame Spacing (RIFS) is enabled in
+.Va i_val .
+This setting is meaningful only when operating with 802.11n on an HT channel.
+.It Dv IEEE80211_IOC_ROAM
+Return station roaming parameters in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_ROAMING
+Return the current roaming mode in
+.Va i_val .
+Roaming mode specifies which entity controls operation of the MLME
+state machine when operating as a station in an Infrastructure BSS.
+Valid values are:
+.Dv IEEE80211_ROAMING_DEVICE
+(driver/firmware is in control),
+.Dv IEEE80211_ROAMING_AUTO
+(host 802.11 layer is in control),
+and
+.Dv IEEE80211_ROAMING_MANUAL
+(application is in control).
+.It Dv IEEE80211_IOC_RTSTHRESHOLD
+Return the threshold (in bytes) for enabling transmission of RTS frames in
+.Va i_val .
+Packets larger than this value will automatically have an RTS frame
+sent preceding it to reduce the likelihood of packet loss.
+.It Dv IEEE80211_IOC_SCAN_RESULTS
+Return the current contents of the scan cache in the data area pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_SCANVALID
+Return in
+.Va i_val
+how long (in seconds) results from a scan operation will be considered valid.
+When scan results are no longer valid and they are needed (e.g. to roam) the
+system will initiate a scan operation to replenish the scan cache.
+.It Dv IEEE80211_IOC_SHORTGI
+Return whether or not Short Guard Interval (SGI) is enabled in
+.Va i_val .
+Note SGI is only used when operating with 802.11n on an HT channel.
+.It Dv IEEE80211_IOC_SMPS
+Return the Spatial Multiplexing Power Save (SMPS) setting in
+.Va i_val .
+This setting is meaningful only when operating with 802.11n on an HT channel.
+Valid values are:
+.Dv IEEE80211_HTCAP_SMPS_DYNAMIC
+(Dynamic SMPS is enabled),
+.Dv IEEE80211_HTCAP_SMPS_ENA
+(Static SMPS is enabled),
+and
+.Dv IEEE80211_HTCAP_SMPS_OFF
+(SMPS is disabled).
+.It Dv IEEE80211_IOC_SSID
+Return the requested SSID in the buffer pointed to by
+.Va i_data .
+If
+.Va i_val
+is \(>= 0 then the request refers to the configured value for that slot.
+Generally, 0 is the only valid value, but some interfaces support more
+SSIDs.
+.It Dv IEEE80211_IOC_STA_INFO
+Return information about the current state of the specified station(s) via
+.Va i_data .
+The MAC address of a single station may be passed in or, if the broadcast
+address is supplied, information about all stations will be returned.
+If a single station is requested and the MAC address is unknown then
+.Er ENOENT
+will be returned.
+.It Dv IEEE80211_IOC_STA_STATS
+Return collected statistics for the specified station via
+.Va i_data .
+The MAC address of the desired station is passed in; if it is unknown
+.Er ENOENT
+will be returned.
+.It Dv IEEE80211_IOC_STA_VLAN
+Return any VLAN tag assigned to a station via
+.Va i_data .
+.It Dv IEEE80211_IOC_TDMA_SLOT
+Return the slot number for the station in
+.Va i_val .
+Slot number zero is the master station in a TDMA network.
+.It Dv IEEE80211_IOC_TDMA_SLOTCNT
+Return the count of slots in the TDMA network in
+.Va i_val .
+.It Dv IEEE80211_IOC_TDMA_SLOTLEN
+Return the length (in usecs) of the TDMA slot assigned to each
+station in the network in
+.Va i_val .
+.It Dv IEEE80211_IOC_TDMA_BINTERVAL
+Return the number of superframes between Beacon frames in
+.Va i_val .
+A TDMA network with N slots and slot length T has a superframe of NxT.
+.It Dv IEEE80211_IOC_TSN
+Return whether or not Transitional Security Network (TSN) is enabled in
+.Va i_val .
+.It Dv IEEE80211_IOC_TURBOP
+Return whether Atheros Dynamic Turbo mode is enabled in
+.Va i_val .
+Dynamic Turbo mode is a non-standard protocol extension available only
+on Atheros devices where channel width is dynamically
+changed between 20MHz and 40MHz.
+Note that enabling Dynamic Turbo mode support does not guarantee use;
+both client and access point must use Atheros devices and support must
+be enabled on both sides.
+.It Dv IEEE80211_IOC_TXPARAMS
+Return transmit parameters in the buffer pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_TXPOWER
+Return the transmit power limit in .5 dBm units in
+.Va i_val .
+This value represents the effective maximum and is calculated according to
+the maximum power allowed by local regulations, any user-specified
+power limit, and the maximum power the device is capable of.
+.It Dv IEEE80211_IOC_TXPOWMAX
+Return the user-specified maximum transmit power in .5 dBm units in
+.Va i_val .
+The maximum setting is applied after any regulatory cap.
+.It Dv IEEE80211_IOC_WEP
+Return the current WEP status in
+.Va i_val .
+Valid values are:
+.Dv IEEE80211_WEP_ON
+(enabled for all packets sent and received),
+.Dv IEEE80211_WEP_OFF
+(disabled),
+and
+.Dv IEEE80211_WEP_MIXED
+(enabled for transmit and receive but also willing to receive
+unencrypted frames).
+This request is deprecated; use
+.Dv IEEE80211_IOC_PRIVACY
+and
+.Dv IEEE80211_IOC_UNENCRYPTED
+instead.
+.It Dv IEEE80211_IOC_WEPKEY
+Return the requested WEP key via
+.Va i_data .
+The key number is specified in
+.Va i_val
+and may be 0-3.
+If the device does not support returning the WEP key or the user is not
+root then the key may be returned as all zeros.
+This request is deprecated in favor of
+.Dv IEEE80211_IOC_WPAKEY .
+.It Dv IEEE80211_IOC_WEPTXKEY
+Return the number of the WEP key used for transmission in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME
+Return whether 802.11e/WME/WMM support is enabled in
+.Va i_val .
+This value will be non-zero when support is enabled and otherwise zero.
+.It Dv IEEE80211_IOC_WME_CWMIN
+Return the WME CWmin setting (log2) for the specified Access Class (AC) in
+.Va i_val .
+The AC is passed in through
+.Va i_len
+together with an optional IEEE80211_WMEPARAM_BSS flag to indicate if the
+parameter for the BSS or the channel is desired.
+If WME is not supported then
+.Er EINVAL
+will be returned.
+.It Dv IEEE80211_IOC_WME_CWMAX
+Return the WME CWmax setting (log2) for the specified Access Class (AC) in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_WME_CWMIN
+above for more details.
+.It Dv IEEE80211_IOC_WME_AIFS
+Return the WME AIFS setting for the specified Access Class (AC) in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_WME_CWMIN
+above for more details.
+.It Dv IEEE80211_IOC_WME_TXOPLIMIT
+Return the WME TxOpLimit (msec) for the specified Access Class (AC) in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_WME_CWMIN
+above for more details.
+.It Dv IEEE80211_IOC_WME_ACM
+Return the WME Admission Control Mechanism (ACM) setting
+for the specified Access Class (AC) in
+.Va i_val .
+This value is meaningful only for the BSS (not channel).
+See
+.Dv IEEE80211_IOC_WME_CWMIN
+above for more details.
+.It Dv IEEE80211_IOC_WME_ACKPOLICY
+Return the WME ACK Policy setting
+for the specified Access Class (AC) in
+.Va i_val .
+When this value is zero frames will be transmitted without waiting for
+an Acknowledgement.
+This value is meaningful only for the channel (not BSS).
+See
+.Dv IEEE80211_IOC_WME_CWMIN
+above for more details.
+.It Dv IEEE80211_IOC_WPA
+Return the WPA configuration in
+.Va i_val .
+Valid values are
+0 (WPA is not enabled),
+1 (WPA1 is enabled),
+2 (WPA2/802.11i is enabled),
+and
+3 (WPA1 and WPA2/802.11i are both enabled).
+.It Dv IEEE80211_IOC_WPAIE
+Return any WPA information element for an associated station via
+.Va i_data .
+The request passed in through
+.Va i_data
+identifies the MAC address of the desired station.
+If an RSN (802.11i) element is present it is returned; otherwise any WPA
+element is returned.
+Note this request is deprecated; use
+.Dv IEEE80211_IOC_WPAIE2
+instead.
+.It Dv IEEE80211_IOC_WPAIE2
+Return any WPA information elements for an associated station via
+.Va i_data .
+The request passed in through
+.Va i_data
+identifies the MAC address of the desired station.
+One or both of RSN (802.11i) and WPA elements may be returned.
+.It Dv IEEE80211_IOC_WPAKEY
+Return the requested cryptographic key in the buffer pointed to by
+.Va i_data .
+The key number is specified in
+.Va i_val
+and may be 0-3.
+A key number of zero is used to retrieve a station's unicast cipher key
+when operating with WPA enabled.
+If the user is not root then the key data returned is all zeros.
+.It Dv IEEE80211_IOC_WPS
+Return whether or not Wi-FI Protected Setup (WPS) is enabled in
+.Va i_val .
+.El
+.Pp
+For
+.Dv SIOCS80211
+the following values of
+.Va i_type
+are valid.
+Note that changing a value on an interface that is running may
+cause the interface to be
+.Sq reset .
+Resets may be handled without altering the state if the parameter
+does not affect the MLME state (e.g. RTS threshold), but in some
+cases the interface may need to scan for a new network or clear
+state (including any associated stations); in that case the interface
+is said to be
+.Sq restarted
+(it is equivalent to marking the interface down and back up).
+The information below identifies whether changing a value affects the
+state of a running interface.
+.Bl -tag -width indent
+.It Dv IEEE80211_IOC_ADDMAC
+Add an entry to the MAC address Access Control List (ACL) database using
+the value pointed to by
+.Va i_data .
+The
+.Xr wlan_acl 4
+module must be installed and enabled or
+.Er EINVAL
+will be returned.
+.It Dv IEEE80211_IOC_AMPDU
+Set whether or not AMPDU is enabled for transmit and/or receive
+using the value in
+.Va i_val .
+This request causes a running interface operating on an HT channel
+to be reset.
+See
+.Dv IEEE80211_IOC_AMPDU
+above for details.
+.It Dv IEEE80211_IOC_AMPDU_DENSITY
+Set the minimum density for bursting AMPDU frames to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_AMPDU_DENSITY
+above for details.
+.It Dv IEEE80211_IOC_AMPDU_LIMIT
+Set the limit on the size of AMPDU frames to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_AMPDU_LIMIT
+above for details.
+.It Dv IEEE80211_IOC_AMSDU
+Set whether or not AMSDU is enabled for transmit and/or receive
+using the value in
+.Va i_val .
+This request causes a running interface operating on an HT channel
+to be reset.
+See
+.Dv IEEE80211_IOC_AMSDU
+above for details.
+.It Dv IEEE80211_IOC_AMSDU_LIMIT
+Set the limit on the size of AMSDU frames to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_AMSDU_LIMIT
+above for details.
+.It Dv IEEE80211_IOC_APBRIDGE
+Set whether AP bridging is enabled using the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_APBRIDGE
+above for details.
+.It Dv IEEE80211_IOC_APPIE
+Set an application information element using the data pointed to by
+.Va i_data .
+This request causes a running interface to be restarted if the WPA
+information element is changed.
+See
+.Dv IEEE80211_IOC_APPIE
+above for details.
+.It Dv IEEE80211_IOC_AUTHMODE
+Set the current authentication mode using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_AUTHMODE
+above for details.
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_BEACON_INTERVAL
+Set the time between Beacon frames (in TU) to the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_BGSCAN
+Set whether background scanning is enabled using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_BGSCAN_IDLE
+Set the minimum time (in msecs) a station must be idle
+before it will do a background scan to the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_BGSCAN_INTERVAL
+Set the minimum time (seconds) between background scan operations to the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_BMISSTHRESHOLD
+Set the number of consecutive missed Beacon frames before the system will
+attempt to roam to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_BSSID
+Set the 802.11 MAC address for the desired BSS identifier according to
+.Va i_data .
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_BURST
+Set whether or not packet bursting is enabled using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_CHANNEL
+Set the desired/current channel to the value given by
+.Va i_val .
+This request causes a running interface to
+immediately change to the specified channel if possible;
+otherwise the interface will be restarted.
+Note this request is deprecated; use
+.Dv IEEE80211_IOC_CURCHAN
+instead.
+.It Dv IEEE80211_IOC_CHANLIST
+Set the list of available channels using the channel list pointed to by
+.Va i_data .
+The channel list is a bit vector with bit N set to 1 if
+IEEE channel number N is available for use.
+The specified channel list is checked against the set of supported
+channels and any channels not supported are silently ignored.
+If the intersection of the channel list and the supported channels is empty
+.Er EINVAL
+is returned.
+Note the current channel may be marked invalid after installing a
+new channel list.
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_COUNTERMEASURES
+Set whether TKIP Countermeasures are enabled using the value in
+.Va i_val .
+This request can only be used when the authentication mode is set
+WPA; otherwise
+.Er EOPNOTSUPP
+will be returned.
+.It Dv IEEE80211_IOC_CURCHAN
+Set the current channel using the information referenced by
+.Va i_data .
+This request causes a running interface to
+immediately change to the specified channel if possible;
+otherwise the interface will be restarted.
+.It Dv IEEE80211_IOC_DELKEY
+Delete the key specified by the information referenced by
+.Va i_data .
+.It Dv IEEE80211_IOC_DELMAC
+Remove an entry in the MAC address Access Control List (ACL) database using
+the value pointed to by
+.Va i_data .
+The
+.Xr wlan_acl 4
+module must be installed and enabled or
+.Er EINVAL
+will be returned.
+.It Dv IEEE80211_IOC_DFS
+Set whether or not Dynamic Frequency Selection (DFS) is enabled
+using the value in
+.Va i_val .
+This request will fail with
+.Er EINVAL
+if 802.11h support is not enabled.
+See
+.Dv IEEE80211_IOC_DFS
+above for details.
+.It Dv IEEE80211_IOC_DOTD
+Set whether or not 802.11d support is enabled using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_DOTD
+above for details.
+.It Dv IEEE80211_IOC_DOTH
+Return whether 802.11h support is enabled using the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_DOTH
+above for details.
+.It Dv IEEE80211_IOC_DROPUNENCRYPTED
+Set whether unencrypted packets transmit/received should be discarded
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_DTIM_PERIOD
+Set the period (in beacon intervals) between DTIM events to the value in
+This request causes a running interface to be restarted.
+.Va i_val .
+.It Dv IEEE80211_IOC_DWDS
+Set whether or not Dynamic WDS support is enabled using the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_DWDS
+above for details.
+.It Dv IEEE80211_IOC_FF
+Set whether Atheros fast-frames support is enabled using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_FF
+above for details.
+.It Dv IEEE80211_IOC_FRAGTHRESHOLD
+Set the threshold (in bytes) for enabling fragmentation frames using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_FRAGTHRESHOLD
+above for details.
+.It Dv IEEE80211_IOC_GREENFIELD
+Set whether or not Greenfield preamble use is enabled using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_GREENFIELD
+above for details.
+.It Dv IEEE80211_IOC_HIDESSID
+Set whether SSID hiding/cloaking is enabled using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_HIDESSID
+above for details.
+.It Dv IEEE80211_IOC_HTCOMPAT
+Set whether or not 802.11n compatibility support is enabled using the value in
+.Va i_val .
+This request causes a running interface to be reset if operating on HT channel.
+See
+.Dv IEEE80211_IOC_HTCOMPAT
+above for details.
+.It Dv IEEE80211_IOC_HTCONF
+Set automatic promotion of HT channels using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_HTCONF
+above for details.
+.It Dv IEEE80211_IOC_HTPROTMODE
+Set the technique used to protect HT frames in a mixed 802.11n network
+using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_HTPROTMODE
+above for details.
+.It Dv IEEE80211_IOC_HWMP_MAXHOPS
+Set the maximum acceptable hop count in an HWMP path according to
+.Va i_val .
+Values must be in the range [0-255].
+.It Dv IEEE80211_IOC_HWMP_ROOTMODE
+Set the Mesh root mode operation according to
+.Va i_val .
+Valid values are
+.Dv IEEE80211_HWMP_ROOTMODE_DISABLED
+(root mode is disabled),
+.Dv IEEE80211_HWMP_ROOTMODE_NORMAL
+(send broadcast Path Request frames),
+.Dv IEEE80211_HWMP_ROOTMODE_PROACTIVE
+(send broadcast Path Request frames and force replies)
+and
+.Dv IEEE80211_HWMP_ROOTMODE_RANN
+(send broadcast Root Announcement (RANN) frames).
+.It Dv IEEE80211_IOC_INACTIVITY
+Set whether or not the system handles inactivity processing using the value in
+.Va i_val .
+When inactivity processing is enabled the system will track stations
+that have not transmitted frames and periodically probe them to
+check if they are still present.
+Stations that are inactive and do not respond to probes are dropped.
+.It Dv IEEE80211_IOC_MACCMD
+Change the state of the MAC address Access Control List (ACL) system.
+There are several requests supported:
+.Dv IEEE80211_MACCMD_POLICY_OPEN
+(set the current policy to disable ACL use),
+.Dv IEEE80211_MACCMD_POLICY_ALLOW
+(set the current policy to allow only addresses listed in the database),
+.Dv IEEE80211_MACCMD_POLICY_DENY
+(set the current policy to deny addresses listed in the database),
+.Dv IEEE80211_MACCMD_POLICY_RADUS
+(set the current policy to enable use of a RADIUS backend),
+.Dv IEEE80211_MACCMD_FLUSH
+(flush all addresses from the database),
+and
+.Dv IEEE80211_MACCMD_DETACH
+(detach the ACL subsystem, disabling it).
+The
+.Xr wlan_acl 4
+module must be installed or
+.Er EINVAL
+will be returned.
+.It Dv IEEE80211_IOC_MESH_AP
+Set whether or not Mesh AP support is enabled using
+.Va i_val .
+.It Dv IEEE80211_IOC_MESH_FWRD
+Set whether or not packet forwarding support is enabled using
+.Va i_val .
+.It Dv IEEE80211_IOC_MESH_ID
+Set the Mesh ID using the value pointed to by
+.Va i_data .
+A Mesh ID can be up to
+.Dv IEEE80211_MESHID_LEN
+bytes long.
+.It Dv IEEE80211_IOC_MESH_PP_METRIC
+Set the link metric protocol using the value pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_PP_PATH
+Set the path selection protocol using the value pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_MESH_RTCMD
+Manipulate the state of the Mesh routing tables.
+Several requests are supported:
+.Dv IEEE80211_MESH_RTCMD_FLUSH
+(flush the contents of the routing table),
+.Dv IEEE80211_MESH_RTCMD_ADD
+(add an entry for the MAC address specified in
+.Va i_data
+and start the Peer discovery process),
+and
+.Dv IEEE80211_MESH_RTCMD_DELETE
+(delete the entry corresponding to the MAC address specified in
+.Va i_data ).
+.It Dv IEEE80211_IOC_MESH_TTL
+Set the Mesh Time To Live (TTL) setting installed in packets
+transmitted by this mesh node using
+.Va i_val .
+.It Dv IEEE80211_IOC_MLME
+Explicitly control the MLME state machine for a station using the
+MLME request pointed to by
+.Va i_data .
+There are several MLME operations supported:
+.Dv IEEE80211_MLME_ASSOC
+(request association to an access point),
+.Dv IEEE80211_MLME_DIASSOC
+(diassociate the specified station),
+.Dv IEEE80211_MLME_DEAUTH
+(deauthenticate the specified station),
+.Dv IEEE80211_MLME_AUHORIZE
+(mark the specified station authorized to pass data frames),
+.Dv IEEE80211_MLME_UNAUTHORIZE
+(revoke the specified station's ability to pass data frames),
+and
+.Dv IEEE80211_MLME_AUTH
+(request authentication to an access point).
+Note when this facility is used for stations operating in infrastructure mode
+the roaming mode should be set to manual.
+.It Dv IEEE80211_IOC_POWERSAVE
+Set the current powersaving mode to the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_POWERSAVE
+above for valid values.
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_POWERSAVESLEEP
+Set the powersave sleep time in TU to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_PRIVACY
+Set the current MLME setting for PRIVACY using the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_PRIVACY
+above for details.
+.It Dv IEEE80211_IOC_PROTMODE
+Set the current 802.11g protection mode to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_PROTMODE
+above for details.
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_PUREG
+Set whether ``pure 11g'' mode is enabled using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_PUREG
+above for details.
+.It Dv IEEE80211_IOC_PUREN
+Set whether ``pure 11n'' mode is enabled using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+See
+.Dv IEEE80211_IOC_PUREN
+above for details.
+.It Dv IEEE80211_IOC_REGDOMAIN
+Set the regulatory state using the data referenced by
+.Va i_data .
+This request can only be issued when all interfaces cloned from the
+underlying physical device are marked down; otherwise
+.Er EBUSY
+is returned.
+Note the new regulatory data may invalidate any desired channel.
+.It Dv IEEE80211_IOC_RIFS
+Set whether or not Reduced InterFrame Spacing (RIFS) is enabled
+using the value in
+.Va i_val .
+This setting is meaningful only when operating with 802.11n on an HT channel.
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_ROAM
+Set station roaming parameters using the data pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_ROAMING
+Set the current roaming mode to the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_ROAMING
+above for details.
+.It Dv IEEE80211_IOC_RTSTHRESHOLD
+Set the threshold (in bytes) for enabling transmission of RTS frames
+to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_RTSTHRESHOLD
+above for details.
+.It Dv IEEE80211_IOC_SCANVALID
+Set the age (in seconds) that results from a scan operation will be
+considered valid.
+When scan results are no longer valid and they are needed (e.g. to roam) the
+system will initiate a scan operation to replenish the scan cache.
+.It Dv IEEE80211_IOC_SCAN_REQ
+Request a scan operation using the parameters pointed to by
+.Va i_val .
+The underlying device must be running or
+.Er ENXIO
+will be returned.
+Values for
+.Va sr_duration ,
+.Va sr_mindwell ,
+and
+.Va sr_maxdwell
+shorter than 1 clock tick are rounded up to a tick.
+If more SSID's are supplied than the system is capable of handling
+the extra ones are silently ignored.
+If a scan operation is already in progress the request will be
+(silently) ignored.
+.It Dv IEEE80211_IOC_SCAN_CANCEL
+Cancel any pending/active scan operation.
+.It Dv IEEE80211_IOC_SHORTGI
+Set whether or not Short Guard Interval (SGI) is enabled using the value in
+.Va i_val .
+Note SGI is only used when operating on an HT (802.11n) channel.
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_SMPS
+Set the Spatial Multiplexing Power Save (SMPS) setting to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_SMPS
+above for details.
+.It Dv IEEE80211_IOC_SSID
+Set the desired SSID using the value pointed to by
+.Va i_data .
+The string may be at most IEEE80211_NWID_LEN bytes.
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_STA_STATS
+Clear accumulated statistics for the specified station.
+.It Dv IEEE80211_IOC_STA_VLAN
+Set the VLAN tag for the specified station using the information pointed to by
+.Va i_data .
+.It Dv IEEE80211_IOC_TDMA_BINTERVAL
+Set the interval between Beacon frames to the value in
+.Va i_val .
+Values must be positive.
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_TDMA_SLOT
+Set the current TDMA slot to the value in
+.Va i_val .
+Values must be in the range [0-slotcnt].
+Slot 0 identifies the master in the TDMA network; if it running it will
+immediately start sending Beacon frames.
+.It Dv IEEE80211_IOC_TDMA_SLOTCNT
+Set the number of slots in the TDMA network to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_TDMA_SLOTLEN
+Set the length of the TDMA slot assigned to each station in the network
+to the value in
+.Va i_val .
+Slot lengths must be in the range 200 usecs to 1024 milliseconds
+(though values outside the range 1-200ms are unlikely to work well).
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_TSN
+Set whether or not Transitional Security Network (TSN) is enabled
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_TURBOP
+Set whether Atheros Dynamic Turbo mode is enabled using the value in
+.Va i_val .
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_TXPARAMS
+Set transmit parameters using the data pointed to be
+.Va i_data .
+This request causes a running interface to be restarted.
+.It Dv IEEE80211_IOC_TXPOWER
+Set the maximum transmit power limit in .5 dBm units to the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_WEP
+Set the current WEP mode to the value in
+.Va i_val .
+See
+.Dv IEEE80211_IOC_WEP
+above for valid values.
+This request causes a running interface to be restarted.
+Note this request is deprecated; use
+.Dv IEEE80211_IOC_PRIVACY
+and
+.Dv IEEE80211_IOC_DROPUNENCRYPTED
+instead.
+.It Dv IEEE80211_IOC_WEPKEY
+Set the WEP key indicated by
+.Va i_val
+using the data pointed to by
+.Va i_data .
+Note this request is deprecated; use
+.Dv IEEE80211_IOC_WPAKEY
+instead.
+.It Dv IEEE80211_IOC_WEPTXKEY
+Set the default transmit key used for transmission to the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME
+Set whether or not WME/WMM support is enabled using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+.It Dv IEEE80211_IOC_WME_ACKPOLICY
+Set the WME ACK Policy for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME_ACM
+Set the WME Admission Control Mechanism for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME_AIFS
+Set the WME AIFS parameter for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME_CWMAX
+Set the WME CWmax parameter for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME_CWMIN
+Set the WME CWmin parameter for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WME_TXOPLIMIT
+Set the WME TxOpLimit parameter for the Access Class (AC) specified in
+.Va i_len
+using the value in
+.Va i_val .
+.It Dv IEEE80211_IOC_WPA
+Set the WPA configuration using the value in
+.Va i_val .
+This request causes a running interface to be reset.
+See
+.Dv IEEE80211_IOC_WPA
+above for details.
+.It Dv IEEE80211_IOC_WPAKEY
+Set the requested cryptographic key using data in the buffer pointed to by
+.Va i_data .
+See
+.Dv IEEE80211_IOC_WPAKEY
+for details.
+.It Dv IEEE80211_IOC_WPS
+Set whether or not Wi-FI Protected Setup (WPS) is enabled using the value in
+.Va i_val .
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr wlan 4 ,
+.Xr wlan_acl 4 ,
+.Xr wlan_xauth 4 ,
+.Xr ifconfig 8 ,
+.Xr hostapd 8 ,
+.Xr wpa_supplicant 8 .
diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4
new file mode 100644
index 000000000000..ebd0aa5fdac4
--- /dev/null
+++ b/share/man/man4/netgraph.4
@@ -0,0 +1,1480 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Authors: Julian Elischer <julian@FreeBSD.org>
+.\" Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $Whistle: netgraph.4,v 1.7 1999/01/28 23:54:52 julian Exp $
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2008
+.Dt NETGRAPH 4
+.Os
+.Sh NAME
+.Nm netgraph
+.Nd "graph based kernel networking subsystem"
+.Sh DESCRIPTION
+The
+.Nm
+system provides a uniform and modular system for the implementation
+of kernel objects which perform various networking functions.
+The objects, known as
+.Em nodes ,
+can be arranged into arbitrarily complicated graphs.
+Nodes have
+.Em hooks
+which are used to connect two nodes together, forming the edges in the graph.
+Nodes communicate along the edges to process data, implement protocols, etc.
+.Pp
+The aim of
+.Nm
+is to supplement rather than replace the existing kernel networking
+infrastructure.
+It provides:
+.Pp
+.Bl -bullet -compact
+.It
+A flexible way of combining protocol and link level drivers.
+.It
+A modular way to implement new protocols.
+.It
+A common framework for kernel entities to inter-communicate.
+.It
+A reasonably fast, kernel-based implementation.
+.El
+.Ss Nodes and Types
+The most fundamental concept in
+.Nm
+is that of a
+.Em node .
+All nodes implement a number of predefined methods which allow them
+to interact with other nodes in a well defined manner.
+.Pp
+Each node has a
+.Em type ,
+which is a static property of the node determined at node creation time.
+A node's type is described by a unique
+.Tn ASCII
+type name.
+The type implies what the node does and how it may be connected
+to other nodes.
+.Pp
+In object-oriented language, types are classes, and nodes are instances
+of their respective class.
+All node types are subclasses of the generic node
+type, and hence inherit certain common functionality and capabilities
+(e.g., the ability to have an
+.Tn ASCII
+name).
+.Pp
+Nodes may be assigned a globally unique
+.Tn ASCII
+name which can be
+used to refer to the node.
+The name must not contain the characters
+.Ql .\&
+or
+.Ql \&: ,
+and is limited to
+.Dv NG_NODESIZ
+characters (including the terminating
+.Dv NUL
+character).
+.Pp
+Each node instance has a unique
+.Em ID number
+which is expressed as a 32-bit hexadecimal value.
+This value may be used to refer to a node when there is no
+.Tn ASCII
+name assigned to it.
+.Ss Hooks
+Nodes are connected to other nodes by connecting a pair of
+.Em hooks ,
+one from each node.
+Data flows bidirectionally between nodes along
+connected pairs of hooks.
+A node may have as many hooks as it
+needs, and may assign whatever meaning it wants to a hook.
+.Pp
+Hooks have these properties:
+.Bl -bullet
+.It
+A hook has an
+.Tn ASCII
+name which is unique among all hooks
+on that node (other hooks on other nodes may have the same name).
+The name must not contain the characters
+.Ql .\&
+or
+.Ql \&: ,
+and is
+limited to
+.Dv NG_HOOKSIZ
+characters (including the terminating
+.Dv NUL
+character).
+.It
+A hook is always connected to another hook.
+That is, hooks are
+created at the time they are connected, and breaking an edge by
+removing either hook destroys both hooks.
+.It
+A hook can be set into a state where incoming packets are always queued
+by the input queueing system, rather than being delivered directly.
+This can be used when the data is sent from an interrupt handler,
+and processing must be quick so as not to block other interrupts.
+.It
+A hook may supply overriding receive data and receive message functions,
+which should be used for data and messages received through that hook
+in preference to the general node-wide methods.
+.El
+.Pp
+A node may decide to assign special meaning to some hooks.
+For example, connecting to the hook named
+.Va debug
+might trigger
+the node to start sending debugging information to that hook.
+.Ss Data Flow
+Two types of information flow between nodes: data messages and
+control messages.
+Data messages are passed in
+.Vt mbuf chains
+along the edges
+in the graph, one edge at a time.
+The first
+.Vt mbuf
+in a chain must have the
+.Dv M_PKTHDR
+flag set.
+Each node decides how to handle data received through one of its hooks.
+.Pp
+Along with data, nodes can also receive control messages.
+There are generic and type-specific control messages.
+Control messages have a common
+header format, followed by type-specific data, and are binary structures
+for efficiency.
+However, node types may also support conversion of the
+type-specific data between binary and
+.Tn ASCII
+formats,
+for debugging and human interface purposes (see the
+.Dv NGM_ASCII2BINARY
+and
+.Dv NGM_BINARY2ASCII
+generic control messages below).
+Nodes are not required to support these conversions.
+.Pp
+There are three ways to address a control message.
+If there is a sequence of edges connecting the two nodes, the message
+may be
+.Dq source routed
+by specifying the corresponding sequence
+of
+.Tn ASCII
+hook names as the destination address for the message (relative
+addressing).
+If the destination is adjacent to the source, then the source
+node may simply specify (as a pointer in the code) the hook across which the
+message should be sent.
+Otherwise, the recipient node's global
+.Tn ASCII
+name
+(or equivalent ID-based name) is used as the destination address
+for the message (absolute addressing).
+The two types of
+.Tn ASCII
+addressing
+may be combined, by specifying an absolute start node and a sequence
+of hooks.
+Only the
+.Tn ASCII
+addressing modes are available to control programs outside the kernel;
+use of direct pointers is limited to kernel modules.
+.Pp
+Messages often represent commands that are followed by a reply message
+in the reverse direction.
+To facilitate this, the recipient of a
+control message is supplied with a
+.Dq return address
+that is suitable for addressing a reply.
+.Pp
+Each control message contains a 32-bit value, called a
+.Dq typecookie ,
+indicating the type of the message, i.e.\& how to interpret it.
+Typically each type defines a unique typecookie for the messages
+that it understands.
+However, a node may choose to recognize and
+implement more than one type of messages.
+.Pp
+If a message is delivered to an address that implies that it arrived
+at that node through a particular hook (as opposed to having been directly
+addressed using its ID or global name) then that hook is identified to the
+receiving node.
+This allows a message to be re-routed or passed on, should
+a node decide that this is required, in much the same way that data packets
+are passed around between nodes.
+A set of standard
+messages for flow control and link management purposes are
+defined by the base system that are usually
+passed around in this manner.
+Flow control message would usually travel
+in the opposite direction to the data to which they pertain.
+.Ss Netgraph is (Usually) Functional
+In order to minimize latency, most
+.Nm
+operations are functional.
+That is, data and control messages are delivered by making function
+calls rather than by using queues and mailboxes.
+For example, if node
+A wishes to send a data
+.Vt mbuf
+to neighboring node B, it calls the
+generic
+.Nm
+data delivery function.
+This function in turn locates
+node B and calls B's
+.Dq receive data
+method.
+There are exceptions to this.
+.Pp
+Each node has an input queue, and some operations can be considered to
+be
+.Em writers
+in that they alter the state of the node.
+Obviously, in an SMP
+world it would be bad if the state of a node were changed while another
+data packet were transiting the node.
+For this purpose, the input queue implements a
+.Em reader/writer
+semantic so that when there is a writer in the node, all other requests
+are queued, and while there are readers, a writer, and any following
+packets are queued.
+In the case where there is no reason to queue the
+data, the input method is called directly, as mentioned above.
+.Pp
+A node may declare that all requests should be considered as writers,
+or that requests coming in over a particular hook should be considered to
+be a writer, or even that packets leaving or entering across a particular
+hook should always be queued, rather than delivered directly (often useful
+for interrupt routines who want to get back to the hardware quickly).
+By default, all control message packets are considered to be writers
+unless specifically declared to be a reader in their definition.
+(See
+.Dv NGM_READONLY
+in
+.In ng_message.h . )
+.Pp
+While this mode of operation
+results in good performance, it has a few implications for node
+developers:
+.Bl -bullet
+.It
+Whenever a node delivers a data or control message, the node
+may need to allow for the possibility of receiving a returning
+message before the original delivery function call returns.
+.It
+.Nm Netgraph
+provides internal synchronization between nodes.
+Data always enters a
+.Dq graph
+at an
+.Em edge node .
+An
+.Em edge node
+is a node that interfaces between
+.Nm
+and some other part of the system.
+Examples of
+.Dq edge nodes
+include device drivers, the
+.Vt socket , ether , tty ,
+and
+.Vt ksocket
+node type.
+In these
+.Em edge nodes ,
+the calling thread directly executes code in the node, and from that code
+calls upon the
+.Nm
+framework to deliver data across some edge
+in the graph.
+From an execution point of view, the calling thread will execute the
+.Nm
+framework methods, and if it can acquire a lock to do so,
+the input methods of the next node.
+This continues until either the data is discarded or queued for some
+device or system entity, or the thread is unable to acquire a lock on
+the next node.
+In that case, the data is queued for the node, and execution rewinds
+back to the original calling entity.
+The queued data will be picked up and processed by either the current
+holder of the lock when they have completed their operations, or by
+a special
+.Nm
+thread that is activated when there are such items
+queued.
+.It
+It is possible for an infinite loop to occur if the graph contains cycles.
+.El
+.Pp
+So far, these issues have not proven problematical in practice.
+.Ss Interaction with Other Parts of the Kernel
+A node may have a hidden interaction with other components of the
+kernel outside of the
+.Nm
+subsystem, such as device hardware,
+kernel protocol stacks, etc.
+In fact, one of the benefits of
+.Nm
+is the ability to join disparate kernel networking entities together in a
+consistent communication framework.
+.Pp
+An example is the
+.Vt socket
+node type which is both a
+.Nm
+node and a
+.Xr socket 2
+in the protocol family
+.Dv PF_NETGRAPH .
+Socket nodes allow user processes to participate in
+.Nm .
+Other nodes communicate with socket nodes using the usual methods, and the
+node hides the fact that it is also passing information to and from a
+cooperating user process.
+.Pp
+Another example is a device driver that presents
+a node interface to the hardware.
+.Ss Node Methods
+Nodes are notified of the following actions via function calls
+to the following node methods,
+and may accept or reject that action (by returning the appropriate
+error code):
+.Bl -tag -width 2n
+.It Creation of a new node
+The constructor for the type is called.
+If creation of a new node is allowed, constructor method may allocate any
+special resources it needs.
+For nodes that correspond to hardware, this is typically done during the
+device attach routine.
+Often a global
+.Tn ASCII
+name corresponding to the
+device name is assigned here as well.
+.It Creation of a new hook
+The hook is created and tentatively
+linked to the node, and the node is told about the name that will be
+used to describe this hook.
+The node sets up any special data structures
+it needs, or may reject the connection, based on the name of the hook.
+.It Successful connection of two hooks
+After both ends have accepted their
+hooks, and the links have been made, the nodes get a chance to
+find out who their peer is across the link, and can then decide to reject
+the connection.
+Tear-down is automatic.
+This is also the time at which
+a node may decide whether to set a particular hook (or its peer) into
+the
+.Em queueing
+mode.
+.It Destruction of a hook
+The node is notified of a broken connection.
+The node may consider some hooks
+to be critical to operation and others to be expendable: the disconnection
+of one hook may be an acceptable event while for another it
+may effect a total shutdown for the node.
+.It Preshutdown of a node
+This method is called before real shutdown, which is discussed below.
+While in this method, the node is fully operational and can send a
+.Dq goodbye
+message to its peers, or it can exclude itself from the chain and reconnect
+its peers together, like the
+.Xr ng_tee 4
+node type does.
+.It Shutdown of a node
+This method allows a node to clean up
+and to ensure that any actions that need to be performed
+at this time are taken.
+The method is called by the generic (i.e., superclass)
+node destructor which will get rid of the generic components of the node.
+Some nodes (usually associated with a piece of hardware) may be
+.Em persistent
+in that a shutdown breaks all edges and resets the node,
+but does not remove it.
+In this case, the shutdown method should not
+free its resources, but rather, clean up and then call the
+.Fn NG_NODE_REVIVE
+macro to signal the generic code that the shutdown is aborted.
+In the case where the shutdown is started by the node itself due to hardware
+removal or unloading (via
+.Fn ng_rmnode_self ) ,
+it should set the
+.Dv NGF_REALLY_DIE
+flag to signal to its own shutdown method that it is not to persist.
+.El
+.Ss Sending and Receiving Data
+Two other methods are also supported by all nodes:
+.Bl -tag -width 2n
+.It Receive data message
+A
+.Nm
+.Em queueable request item ,
+usually referred to as an
+.Em item ,
+is received by this function.
+The item contains a pointer to an
+.Vt mbuf .
+.Pp
+The node is notified on which hook the item has arrived,
+and can use this information in its processing decision.
+The receiving node must always
+.Fn NG_FREE_M
+the
+.Vt mbuf chain
+on completion or error, or pass it on to another node
+(or kernel module) which will then be responsible for freeing it.
+Similarly, the
+.Em item
+must be freed if it is not to be passed on to another node, by using the
+.Fn NG_FREE_ITEM
+macro.
+If the item still holds references to
+.Vt mbufs
+at the time of
+freeing then they will also be appropriately freed.
+Therefore, if there is any chance that the
+.Vt mbuf
+will be
+changed or freed separately from the item, it is very important
+that it be retrieved using the
+.Fn NGI_GET_M
+macro that also removes the reference within the item.
+(Or multiple frees of the same object will occur.)
+.Pp
+If it is only required to examine the contents of the
+.Vt mbufs ,
+then it is possible to use the
+.Fn NGI_M
+macro to both read and rewrite
+.Vt mbuf
+pointer inside the item.
+.Pp
+If developer needs to pass any meta information along with the
+.Vt mbuf chain ,
+he should use
+.Xr mbuf_tags 9
+framework.
+.Bf -symbolic
+Note that old
+.Nm
+specific meta-data format is obsoleted now.
+.Ef
+.Pp
+The receiving node may decide to defer the data by queueing it in the
+.Nm
+NETISR system (see below).
+It achieves this by setting the
+.Dv HK_QUEUE
+flag in the flags word of the hook on which that data will arrive.
+The infrastructure will respect that bit and queue the data for delivery at
+a later time, rather than deliver it directly.
+A node may decide to set
+the bit on the
+.Em peer
+node, so that its own output packets are queued.
+.Pp
+The node may elect to nominate a different receive data function
+for data received on a particular hook, to simplify coding.
+It uses the
+.Fn NG_HOOK_SET_RCVDATA hook fn
+macro to do this.
+The function receives the same arguments in every way
+other than it will receive all (and only) packets from that hook.
+.It Receive control message
+This method is called when a control message is addressed to the node.
+As with the received data, an
+.Em item
+is received, with a pointer to the control message.
+The message can be examined using the
+.Fn NGI_MSG
+macro, or completely extracted from the item using the
+.Fn NGI_GET_MSG
+which also removes the reference within the item.
+If the item still holds a reference to the message when it is freed
+(using the
+.Fn NG_FREE_ITEM
+macro), then the message will also be freed appropriately.
+If the
+reference has been removed, the node must free the message itself using the
+.Fn NG_FREE_MSG
+macro.
+A return address is always supplied, giving the address of the node
+that originated the message so a reply message can be sent anytime later.
+The return address is retrieved from the
+.Em item
+using the
+.Fn NGI_RETADDR
+macro and is of type
+.Vt ng_ID_t .
+All control messages and replies are
+allocated with the
+.Xr malloc 9
+type
+.Dv M_NETGRAPH_MSG ,
+however it is more convenient to use the
+.Fn NG_MKMESSAGE
+and
+.Fn NG_MKRESPONSE
+macros to allocate and fill out a message.
+Messages must be freed using the
+.Fn NG_FREE_MSG
+macro.
+.Pp
+If the message was delivered via a specific hook, that hook will
+also be made known, which allows the use of such things as flow-control
+messages, and status change messages, where the node may want to forward
+the message out another hook to that on which it arrived.
+.Pp
+The node may elect to nominate a different receive message function
+for messages received on a particular hook, to simplify coding.
+It uses the
+.Fn NG_HOOK_SET_RCVMSG hook fn
+macro to do this.
+The function receives the same arguments in every way
+other than it will receive all (and only) messages from that hook.
+.El
+.Pp
+Much use has been made of reference counts, so that nodes being
+freed of all references are automatically freed, and this behaviour
+has been tested and debugged to present a consistent and trustworthy
+framework for the
+.Dq type module
+writer to use.
+.Ss Addressing
+The
+.Nm
+framework provides an unambiguous and simple to use method of specifically
+addressing any single node in the graph.
+The naming of a node is
+independent of its type, in that another node, or external component
+need not know anything about the node's type in order to address it so as
+to send it a generic message type.
+Node and hook names should be
+chosen so as to make addresses meaningful.
+.Pp
+Addresses are either absolute or relative.
+An absolute address begins
+with a node name or ID, followed by a colon, followed by a sequence of hook
+names separated by periods.
+This addresses the node reached by starting
+at the named node and following the specified sequence of hooks.
+A relative address includes only the sequence of hook names, implicitly
+starting hook traversal at the local node.
+.Pp
+There are a couple of special possibilities for the node name.
+The name
+.Ql .\&
+(referred to as
+.Ql .: )
+always refers to the local node.
+Also, nodes that have no global name may be addressed by their ID numbers,
+by enclosing the hexadecimal representation of the ID number within
+the square brackets.
+Here are some examples of valid
+.Nm
+addresses:
+.Bd -literal -offset indent
+\&.:
+[3f]:
+foo:
+\&.:hook1
+foo:hook1.hook2
+[d80]:hook1
+.Ed
+.Pp
+The following set of nodes might be created for a site with
+a single physical frame relay line having two active logical DLCI channels,
+with RFC 1490 frames on DLCI 16 and PPP frames over DLCI 20:
+.Bd -literal
+[type SYNC ] [type FRAME] [type RFC1490]
+[ "Frame1" ](uplink)<-->(data)[<un-named>](dlci16)<-->(mux)[<un-named> ]
+[ A ] [ B ](dlci20)<---+ [ C ]
+ |
+ | [ type PPP ]
+ +>(mux)[<un-named>]
+ [ D ]
+.Ed
+.Pp
+One could always send a control message to node C from anywhere
+by using the name
+.Dq Li Frame1:uplink.dlci16 .
+In this case, node C would also be notified that the message
+reached it via its hook
+.Va mux .
+Similarly,
+.Dq Li Frame1:uplink.dlci20
+could reliably be used to reach node D, and node A could refer
+to node B as
+.Dq Li .:uplink ,
+or simply
+.Dq Li uplink .
+Conversely, B can refer to A as
+.Dq Li data .
+The address
+.Dq Li mux.data
+could be used by both nodes C and D to address a message to node A.
+.Pp
+Note that this is only for
+.Em control messages .
+In each of these cases, where a relative addressing mode is
+used, the recipient is notified of the hook on which the
+message arrived, as well as
+the originating node.
+This allows the option of hop-by-hop distribution of messages and
+state information.
+Data messages are
+.Em only
+routed one hop at a time, by specifying the departing
+hook, with each node making
+the next routing decision.
+So when B receives a frame on hook
+.Va data ,
+it decodes the frame relay header to determine the DLCI,
+and then forwards the unwrapped frame to either C or D.
+.Pp
+In a similar way, flow control messages may be routed in the reverse
+direction to outgoing data.
+For example a
+.Dq "buffer nearly full"
+message from
+.Dq Li Frame1:
+would be passed to node B
+which might decide to send similar messages to both nodes
+C and D.
+The nodes would use
+.Em "direct hook pointer"
+addressing to route the messages.
+The message may have travelled from
+.Dq Li Frame1:
+to B
+as a synchronous reply, saving time and cycles.
+.Ss Netgraph Structures
+Structures are defined in
+.In netgraph/netgraph.h
+(for kernel structures only of interest to nodes)
+and
+.In netgraph/ng_message.h
+(for message definitions also of interest to user programs).
+.Pp
+The two basic object types that are of interest to node authors are
+.Em nodes
+and
+.Em hooks .
+These two objects have the following
+properties that are also of interest to the node writers.
+.Bl -tag -width 2n
+.It Vt "struct ng_node"
+Node authors should always use the following
+.Ic typedef
+to declare
+their pointers, and should never actually declare the structure.
+.Pp
+.Fd "typedef struct ng_node *node_p;"
+.Pp
+The following properties are associated with a node, and can be
+accessed in the following manner:
+.Bl -tag -width 2n
+.It Validity
+A driver or interrupt routine may want to check whether
+the node is still valid.
+It is assumed that the caller holds a reference
+on the node so it will not have been freed, however it may have been
+disabled or otherwise shut down.
+Using the
+.Fn NG_NODE_IS_VALID node
+macro will return this state.
+Eventually it should be almost impossible
+for code to run in an invalid node but at this time that work has not been
+completed.
+.It Node ID Pq Vt ng_ID_t
+This property can be retrieved using the macro
+.Fn NG_NODE_ID node .
+.It Node name
+Optional globally unique name,
+.Dv NUL
+terminated string.
+If there
+is a value in here, it is the name of the node.
+.Bd -literal -offset indent
+if (NG_NODE_NAME(node)[0] != '\e0') ...
+
+if (strcmp(NG_NODE_NAME(node), "fred") == 0) ...
+.Ed
+.It A node dependent opaque cookie
+Anything of the pointer type can be placed here.
+The macros
+.Fn NG_NODE_SET_PRIVATE node value
+and
+.Fn NG_NODE_PRIVATE node
+set and retrieve this property, respectively.
+.It Number of hooks
+The
+.Fn NG_NODE_NUMHOOKS node
+macro is used
+to retrieve this value.
+.It Hooks
+The node may have a number of hooks.
+A traversal method is provided to allow all the hooks to be
+tested for some condition.
+.Fn NG_NODE_FOREACH_HOOK node fn arg rethook
+where
+.Fa fn
+is a function that will be called for each hook
+with the form
+.Fn fn hook arg
+and returning 0 to terminate the search.
+If the search is terminated, then
+.Fa rethook
+will be set to the hook at which the search was terminated.
+.El
+.It Vt "struct ng_hook"
+Node authors should always use the following
+.Ic typedef
+to declare
+their hook pointers.
+.Pp
+.Fd "typedef struct ng_hook *hook_p;"
+.Pp
+The following properties are associated with a hook, and can be
+accessed in the following manner:
+.Bl -tag -width 2n
+.It A hook dependent opaque cookie
+Anything of the pointer type can be placed here.
+The macros
+.Fn NG_HOOK_SET_PRIVATE hook value
+and
+.Fn NG_HOOK_PRIVATE hook
+set and retrieve this property, respectively.
+.It \&An associate node
+The macro
+.Fn NG_HOOK_NODE hook
+finds the associated node.
+.It A peer hook Pq Vt hook_p
+The other hook in this connected pair.
+The
+.Fn NG_HOOK_PEER hook
+macro finds the peer.
+.It References
+The
+.Fn NG_HOOK_REF hook
+and
+.Fn NG_HOOK_UNREF hook
+macros
+increment and decrement the hook reference count accordingly.
+After decrement you should always assume the hook has been freed
+unless you have another reference still valid.
+.It Override receive functions
+The
+.Fn NG_HOOK_SET_RCVDATA hook fn
+and
+.Fn NG_HOOK_SET_RCVMSG hook fn
+macros can be used to set override methods that will be used in preference
+to the generic receive data and receive message functions.
+To unset these, use the macros to set them to
+.Dv NULL .
+They will only be used for data and
+messages received on the hook on which they are set.
+.El
+.Pp
+The maintenance of the names, reference counts, and linked list
+of hooks for each node is handled automatically by the
+.Nm
+subsystem.
+Typically a node's private info contains a back-pointer to the node or hook
+structure, which counts as a new reference that must be included
+in the reference count for the node.
+When the node constructor is called,
+there is already a reference for this calculated in, so that
+when the node is destroyed, it should remember to do a
+.Fn NG_NODE_UNREF
+on the node.
+.Pp
+From a hook you can obtain the corresponding node, and from
+a node, it is possible to traverse all the active hooks.
+.Pp
+A current example of how to define a node can always be seen in
+.Pa src/sys/netgraph/ng_sample.c
+and should be used as a starting point for new node writers.
+.El
+.Ss Netgraph Message Structure
+Control messages have the following structure:
+.Bd -literal
+#define NG_CMDSTRSIZ 32 /* Max command string (including nul) */
+
+struct ng_mesg {
+ struct ng_msghdr {
+ u_char version; /* Must equal NG_VERSION */
+ u_char spare; /* Pad to 2 bytes */
+ u_short arglen; /* Length of cmd/resp data */
+ u_long flags; /* Message status flags */
+ u_long token; /* Reply should have the same token */
+ u_long typecookie; /* Node type understanding this message */
+ u_long cmd; /* Command identifier */
+ u_char cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */
+ } header;
+ char data[0]; /* Start of cmd/resp data */
+};
+
+#define NG_ABI_VERSION 5 /* Netgraph kernel ABI version */
+#define NG_VERSION 4 /* Netgraph message version */
+#define NGF_ORIG 0x0000 /* Command */
+#define NGF_RESP 0x0001 /* Response */
+.Ed
+.Pp
+Control messages have the fixed header shown above, followed by a
+variable length data section which depends on the type cookie
+and the command.
+Each field is explained below:
+.Bl -tag -width indent
+.It Va version
+Indicates the version of the
+.Nm
+message protocol itself.
+The current version is
+.Dv NG_VERSION .
+.It Va arglen
+This is the length of any extra arguments, which begin at
+.Va data .
+.It Va flags
+Indicates whether this is a command or a response control message.
+.It Va token
+The
+.Va token
+is a means by which a sender can match a reply message to the
+corresponding command message; the reply always has the same token.
+.It Va typecookie
+The corresponding node type's unique 32-bit value.
+If a node does not recognize the type cookie it must reject the message
+by returning
+.Er EINVAL .
+.Pp
+Each type should have an include file that defines the commands,
+argument format, and cookie for its own messages.
+The typecookie
+ensures that the same header file was included by both sender and
+receiver; when an incompatible change in the header file is made,
+the typecookie
+.Em must
+be changed.
+The de-facto method for generating unique type cookies is to take the
+seconds from the Epoch at the time the header file is written
+(i.e., the output of
+.Dq Nm date Fl u Li +%s ) .
+.Pp
+There is a predefined typecookie
+.Dv NGM_GENERIC_COOKIE
+for the
+.Vt generic
+node type, and
+a corresponding set of generic messages which all nodes understand.
+The handling of these messages is automatic.
+.It Va cmd
+The identifier for the message command.
+This is type specific,
+and is defined in the same header file as the typecookie.
+.It Va cmdstr
+Room for a short human readable version of
+.Va command
+(for debugging purposes only).
+.El
+.Pp
+Some modules may choose to implement messages from more than one
+of the header files and thus recognize more than one type cookie.
+.Ss Control Message ASCII Form
+Control messages are in binary format for efficiency.
+However, for
+debugging and human interface purposes, and if the node type supports
+it, control messages may be converted to and from an equivalent
+.Tn ASCII
+form.
+The
+.Tn ASCII
+form is similar to the binary form, with two exceptions:
+.Bl -enum
+.It
+The
+.Va cmdstr
+header field must contain the
+.Tn ASCII
+name of the command, corresponding to the
+.Va cmd
+header field.
+.It
+The arguments field contains a
+.Dv NUL Ns
+-terminated
+.Tn ASCII
+string version of the message arguments.
+.El
+.Pp
+In general, the arguments field of a control message can be any
+arbitrary C data type.
+.Nm Netgraph
+includes parsing routines to support
+some pre-defined datatypes in
+.Tn ASCII
+with this simple syntax:
+.Bl -bullet
+.It
+Integer types are represented by base 8, 10, or 16 numbers.
+.It
+Strings are enclosed in double quotes and respect the normal
+C language backslash escapes.
+.It
+IP addresses have the obvious form.
+.It
+Arrays are enclosed in square brackets, with the elements listed
+consecutively starting at index zero.
+An element may have an optional index and equals sign
+.Pq Ql =
+preceding it.
+Whenever an element
+does not have an explicit index, the index is implicitly the previous
+element's index plus one.
+.It
+Structures are enclosed in curly braces, and each field is specified
+in the form
+.Ar fieldname Ns = Ns Ar value .
+.It
+Any array element or structure field whose value is equal to its
+.Dq default value
+may be omitted.
+For integer types, the default value
+is usually zero; for string types, the empty string.
+.It
+Array elements and structure fields may be specified in any order.
+.El
+.Pp
+Each node type may define its own arbitrary types by providing
+the necessary routines to parse and unparse.
+.Tn ASCII
+forms defined
+for a specific node type are documented in the corresponding man page.
+.Ss Generic Control Messages
+There are a number of standard predefined messages that will work
+for any node, as they are supported directly by the framework itself.
+These are defined in
+.In netgraph/ng_message.h
+along with the basic layout of messages and other similar information.
+.Bl -tag -width indent
+.It Dv NGM_CONNECT
+Connect to another node, using the supplied hook names on either end.
+.It Dv NGM_MKPEER
+Construct a node of the given type and then connect to it using the
+supplied hook names.
+.It Dv NGM_SHUTDOWN
+The target node should disconnect from all its neighbours and shut down.
+Persistent nodes such as those representing physical hardware
+might not disappear from the node namespace, but only reset themselves.
+The node must disconnect all of its hooks.
+This may result in neighbors shutting themselves down, and possibly a
+cascading shutdown of the entire connected graph.
+.It Dv NGM_NAME
+Assign a name to a node.
+Nodes can exist without having a name, and this
+is the default for nodes created using the
+.Dv NGM_MKPEER
+method.
+Such nodes can only be addressed relatively or by their ID number.
+.It Dv NGM_RMHOOK
+Ask the node to break a hook connection to one of its neighbours.
+Both nodes will have their
+.Dq disconnect
+method invoked.
+Either node may elect to totally shut down as a result.
+.It Dv NGM_NODEINFO
+Asks the target node to describe itself.
+The four returned fields
+are the node name (if named), the node type, the node ID and the
+number of hooks attached.
+The ID is an internal number unique to that node.
+.It Dv NGM_LISTHOOKS
+This returns the information given by
+.Dv NGM_NODEINFO ,
+but in addition
+includes an array of fields describing each link, and the description for
+the node at the far end of that link.
+.It Dv NGM_LISTNAMES
+This returns an array of node descriptions (as for
+.Dv NGM_NODEINFO )
+where each entry of the array describes a named node.
+All named nodes will be described.
+.It Dv NGM_LISTNODES
+This is the same as
+.Dv NGM_LISTNAMES
+except that all nodes are listed regardless of whether they have a name or not.
+.It Dv NGM_LISTTYPES
+This returns a list of all currently installed
+.Nm
+types.
+.It Dv NGM_TEXT_STATUS
+The node may return a text formatted status message.
+The status information is determined entirely by the node type.
+It is the only
+.Dq generic
+message
+that requires any support within the node itself and as such the node may
+elect to not support this message.
+The text response must be less than
+.Dv NG_TEXTRESPONSE
+bytes in length (presently 1024).
+This can be used to return general
+status information in human readable form.
+.It Dv NGM_BINARY2ASCII
+This message converts a binary control message to its
+.Tn ASCII
+form.
+The entire control message to be converted is contained within the
+arguments field of the
+.Dv NGM_BINARY2ASCII
+message itself.
+If successful, the reply will contain the same control
+message in
+.Tn ASCII
+form.
+A node will typically only know how to translate messages that it
+itself understands, so the target node of the
+.Dv NGM_BINARY2ASCII
+is often the same node that would actually receive that message.
+.It Dv NGM_ASCII2BINARY
+The opposite of
+.Dv NGM_BINARY2ASCII .
+The entire control message to be converted, in
+.Tn ASCII
+form, is contained
+in the arguments section of the
+.Dv NGM_ASCII2BINARY
+and need only have the
+.Va flags , cmdstr ,
+and
+.Va arglen
+header fields filled in, plus the
+.Dv NUL Ns
+-terminated string version of
+the arguments in the arguments field.
+If successful, the reply
+contains the binary version of the control message.
+.El
+.Ss Flow Control Messages
+In addition to the control messages that affect nodes with respect to the
+graph, there are also a number of
+.Em flow control
+messages defined.
+At present these are
+.Em not
+handled automatically by the system, so
+nodes need to handle them if they are going to be used in a graph utilising
+flow control, and will be in the likely path of these messages.
+The default action of a node that does not understand these messages should
+be to pass them onto the next node.
+Hopefully some helper functions will assist in this eventually.
+These messages are also defined in
+.In netgraph/ng_message.h
+and have a separate cookie
+.Dv NG_FLOW_COOKIE
+to help identify them.
+They will not be covered in depth here.
+.Sh INITIALIZATION
+The base
+.Nm
+code may either be statically compiled
+into the kernel or else loaded dynamically as a KLD via
+.Xr kldload 8 .
+In the former case, include
+.Pp
+.D1 Cd "options NETGRAPH"
+.Pp
+in your kernel configuration file.
+You may also include selected
+node types in the kernel compilation, for example:
+.Pp
+.D1 Cd "options NETGRAPH"
+.D1 Cd "options NETGRAPH_SOCKET"
+.D1 Cd "options NETGRAPH_ECHO"
+.Pp
+Once the
+.Nm
+subsystem is loaded, individual node types may be loaded at any time
+as KLD modules via
+.Xr kldload 8 .
+Moreover,
+.Nm
+knows how to automatically do this; when a request to create a new
+node of unknown type
+.Ar type
+is made,
+.Nm
+will attempt to load the KLD module
+.Pa ng_ Ns Ao Ar type Ac Ns Pa .ko .
+.Pp
+Types can also be installed at boot time, as certain device drivers
+may want to export each instance of the device as a
+.Nm
+node.
+.Pp
+In general, new types can be installed at any time from within the
+kernel by calling
+.Fn ng_newtype ,
+supplying a pointer to the type's
+.Vt "struct ng_type"
+structure.
+.Pp
+The
+.Fn NETGRAPH_INIT
+macro automates this process by using a linker set.
+.Sh EXISTING NODE TYPES
+Several node types currently exist.
+Each is fully documented in its own man page:
+.Bl -tag -width indent
+.It SOCKET
+The socket type implements two new sockets in the new protocol domain
+.Dv PF_NETGRAPH .
+The new sockets protocols are
+.Dv NG_DATA
+and
+.Dv NG_CONTROL ,
+both of type
+.Dv SOCK_DGRAM .
+Typically one of each is associated with a socket node.
+When both sockets have closed, the node will shut down.
+The
+.Dv NG_DATA
+socket is used for sending and receiving data, while the
+.Dv NG_CONTROL
+socket is used for sending and receiving control messages.
+Data and control messages are passed using the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+system calls, using a
+.Vt "struct sockaddr_ng"
+socket address.
+.It HOLE
+Responds only to generic messages and is a
+.Dq black hole
+for data.
+Useful for testing.
+Always accepts new hooks.
+.It ECHO
+Responds only to generic messages and always echoes data back through the
+hook from which it arrived.
+Returns any non-generic messages as their own response.
+Useful for testing.
+Always accepts new hooks.
+.It TEE
+This node is useful for
+.Dq snooping .
+It has 4 hooks:
+.Va left , right , left2right ,
+and
+.Va right2left .
+Data entering from the
+.Va right
+is passed to the
+.Va left
+and duplicated on
+.Va right2left ,
+and data entering from the
+.Va left
+is passed to the
+.Va right
+and duplicated on
+.Va left2right .
+Data entering from
+.Va left2right
+is sent to the
+.Va right
+and data from
+.Va right2left
+to
+.Va left .
+.It RFC1490 MUX
+Encapsulates/de-encapsulates frames encoded according to RFC 1490.
+Has a hook for the encapsulated packets
+.Pq Va downstream
+and one hook
+for each protocol (i.e., IP, PPP, etc.).
+.It FRAME RELAY MUX
+Encapsulates/de-encapsulates Frame Relay frames.
+Has a hook for the encapsulated packets
+.Pq Va downstream
+and one hook
+for each DLCI.
+.It FRAME RELAY LMI
+Automatically handles frame relay
+.Dq LMI
+(link management interface) operations and packets.
+Automatically probes and detects which of several LMI standards
+is in use at the exchange.
+.It TTY
+This node is also a line discipline.
+It simply converts between
+.Vt mbuf
+frames and sequential serial data, allowing a TTY to appear as a
+.Nm
+node.
+It has a programmable
+.Dq hotkey
+character.
+.It ASYNC
+This node encapsulates and de-encapsulates asynchronous frames
+according to RFC 1662.
+This is used in conjunction with the TTY node
+type for supporting PPP links over asynchronous serial lines.
+.It ETHERNET
+This node is attached to every Ethernet interface in the system.
+It allows capturing raw Ethernet frames from the network, as well as
+sending frames out of the interface.
+.It INTERFACE
+This node is also a system networking interface.
+It has hooks representing
+each protocol family (IP, AppleTalk, IPX, etc.) and appears in the output of
+.Xr ifconfig 8 .
+The interfaces are named
+.Dq Li ng0 ,
+.Dq Li ng1 ,
+etc.
+.It ONE2MANY
+This node implements a simple round-robin multiplexer.
+It can be used
+for example to make several LAN ports act together to get a higher speed
+link between two machines.
+.It Various PPP related nodes
+There is a full multilink PPP implementation that runs in
+.Nm .
+The
+.Pa net/mpd
+port can use these modules to make a very low latency high
+capacity PPP system.
+It also supports
+.Tn PPTP
+VPNs using the PPTP node.
+.It PPPOE
+A server and client side implementation of PPPoE.
+Used in conjunction with
+either
+.Xr ppp 8
+or the
+.Pa net/mpd
+port.
+.It BRIDGE
+This node, together with the Ethernet nodes, allows a very flexible
+bridging system to be implemented.
+.It KSOCKET
+This intriguing node looks like a socket to the system but diverts
+all data to and from the
+.Nm
+system for further processing.
+This allows
+such things as UDP tunnels to be almost trivially implemented from the
+command line.
+.El
+.Pp
+Refer to the section at the end of this man page for more nodes types.
+.Sh NOTES
+Whether a named node exists can be checked by trying to send a control message
+to it (e.g.,
+.Dv NGM_NODEINFO ) .
+If it does not exist,
+.Er ENOENT
+will be returned.
+.Pp
+All data messages are
+.Vt mbuf chains
+with the
+.Dv M_PKTHDR
+flag set.
+.Pp
+Nodes are responsible for freeing what they allocate.
+There are three exceptions:
+.Bl -enum
+.It
+.Vt Mbufs
+sent across a data link are never to be freed by the sender.
+In the
+case of error, they should be considered freed.
+.It
+Messages sent using one of
+.Fn NG_SEND_MSG_*
+family macros are freed by the recipient.
+As in the case above, the addresses
+associated with the message are freed by whatever allocated them so the
+recipient should copy them if it wants to keep that information.
+.It
+Both control messages and data are delivered and queued with a
+.Nm
+.Em item .
+The item must be freed using
+.Fn NG_FREE_ITEM item
+or passed on to another node.
+.El
+.Sh FILES
+.Bl -tag -width indent
+.It In netgraph/netgraph.h
+Definitions for use solely within the kernel by
+.Nm
+nodes.
+.It In netgraph/ng_message.h
+Definitions needed by any file that needs to deal with
+.Nm
+messages.
+.It In netgraph/ng_socket.h
+Definitions needed to use
+.Nm
+.Vt socket
+type nodes.
+.It In netgraph/ng_ Ns Ao Ar type Ac Ns Pa .h
+Definitions needed to use
+.Nm
+.Ar type
+nodes, including the type cookie definition.
+.It Pa /boot/kernel/netgraph.ko
+The
+.Nm
+subsystem loadable KLD module.
+.It Pa /boot/kernel/ng_ Ns Ao Ar type Ac Ns Pa .ko
+Loadable KLD module for node type
+.Ar type .
+.It Pa src/sys/netgraph/ng_sample.c
+Skeleton
+.Nm
+node.
+Use this as a starting point for new node types.
+.El
+.Sh USER MODE SUPPORT
+There is a library for supporting user-mode programs that wish
+to interact with the
+.Nm
+system.
+See
+.Xr netgraph 3
+for details.
+.Pp
+Two user-mode support programs,
+.Xr ngctl 8
+and
+.Xr nghook 8 ,
+are available to assist manual configuration and debugging.
+.Pp
+There are a few useful techniques for debugging new node types.
+First, implementing new node types in user-mode first
+makes debugging easier.
+The
+.Vt tee
+node type is also useful for debugging, especially in conjunction with
+.Xr ngctl 8
+and
+.Xr nghook 8 .
+.Pp
+Also look in
+.Pa /usr/share/examples/netgraph
+for solutions to several
+common networking problems, solved using
+.Nm .
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 3 ,
+.Xr ng_async 4 ,
+.Xr ng_atm 4 ,
+.Xr ng_atmllc 4 ,
+.Xr ng_bluetooth 4 ,
+.Xr ng_bpf 4 ,
+.Xr ng_bridge 4 ,
+.Xr ng_bt3c 4 ,
+.Xr ng_btsocket 4 ,
+.Xr ng_cisco 4 ,
+.Xr ng_device 4 ,
+.Xr ng_echo 4 ,
+.Xr ng_eiface 4 ,
+.Xr ng_etf 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_fec 4 ,
+.Xr ng_frame_relay 4 ,
+.Xr ng_gif 4 ,
+.Xr ng_gif_demux 4 ,
+.Xr ng_h4 4 ,
+.Xr ng_hci 4 ,
+.Xr ng_hole 4 ,
+.Xr ng_hub 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_ip_input 4 ,
+.Xr ng_ksocket 4 ,
+.Xr ng_l2cap 4 ,
+.Xr ng_l2tp 4 ,
+.Xr ng_lmi 4 ,
+.Xr ng_mppc 4 ,
+.Xr ng_netflow 4 ,
+.Xr ng_one2many 4 ,
+.Xr ng_ppp 4 ,
+.Xr ng_pppoe 4 ,
+.Xr ng_pptpgre 4 ,
+.Xr ng_rfc1490 4 ,
+.Xr ng_socket 4 ,
+.Xr ng_split 4 ,
+.Xr ng_sppp 4 ,
+.Xr ng_sscfu 4 ,
+.Xr ng_sscop 4 ,
+.Xr ng_tee 4 ,
+.Xr ng_tty 4 ,
+.Xr ng_ubt 4 ,
+.Xr ng_UI 4 ,
+.Xr ng_uni 4 ,
+.Xr ng_vjc 4 ,
+.Xr ng_vlan 4 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh HISTORY
+The
+.Nm
+system was designed and first implemented at Whistle Communications, Inc.\&
+in a version of
+.Fx 2.2
+customized for the Whistle InterJet.
+It first made its debut in the main tree in
+.Fx 3.4 .
+.Sh AUTHORS
+.An -nosplit
+.An Julian Elischer Aq julian@FreeBSD.org ,
+with contributions by
+.An Archie Cobbs Aq archie@FreeBSD.org .
diff --git a/share/man/man4/netintro.4 b/share/man/man4/netintro.4
new file mode 100644
index 000000000000..9f05e48fa57e
--- /dev/null
+++ b/share/man/man4/netintro.4
@@ -0,0 +1,442 @@
+.\" Copyright (c) 1983, 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)netintro.4 8.2 (Berkeley) 11/30/93
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2012
+.Dt NETINTRO 4
+.Os
+.Sh NAME
+.Nm networking
+.Nd introduction to networking facilities
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/time.h
+.In sys/socket.h
+.In net/if.h
+.In net/route.h
+.Sh DESCRIPTION
+This section is a general introduction to the networking facilities
+available in the system.
+Documentation in this part of section
+4 is broken up into three areas:
+.Em protocol families
+(domains),
+.Em protocols ,
+and
+.Em network interfaces .
+.Pp
+All network protocols are associated with a specific
+.Em protocol family .
+A protocol family provides basic services to the protocol
+implementation to allow it to function within a specific
+network environment.
+These services may include
+packet fragmentation and reassembly, routing, addressing, and
+basic transport.
+A protocol family may support multiple
+methods of addressing, though the current protocol implementations
+do not.
+A protocol family is normally comprised of a number of protocols, one per
+.Xr socket 2
+type.
+It is not required that a protocol family support all socket types.
+A protocol family may contain multiple
+protocols supporting the same socket abstraction.
+.Pp
+A protocol supports one of the socket abstractions detailed in
+.Xr socket 2 .
+A specific protocol may be accessed either by creating a
+socket of the appropriate type and protocol family, or
+by requesting the protocol explicitly when creating a socket.
+Protocols normally accept only one type of address format,
+usually determined by the addressing structure inherent in
+the design of the protocol family/network architecture.
+Certain semantics of the basic socket abstractions are
+protocol specific.
+All protocols are expected to support
+the basic model for their particular socket type, but may,
+in addition, provide non-standard facilities or extensions
+to a mechanism.
+For example, a protocol supporting the
+.Dv SOCK_STREAM
+abstraction may allow more than one byte of out-of-band
+data to be transmitted per out-of-band message.
+.Pp
+A network interface is similar to a device interface.
+Network interfaces comprise the lowest layer of the
+networking subsystem, interacting with the actual transport
+hardware.
+An interface may support one or more protocol families and/or address formats.
+The SYNOPSIS section of each network interface
+entry gives a sample specification
+of the related drivers for use in providing
+a system description to the
+.Xr config 8
+program.
+The DIAGNOSTICS section lists messages which may appear on the console
+and/or in the system error log,
+.Pa /var/log/messages
+(see
+.Xr syslogd 8 ) ,
+due to errors in device operation.
+.Sh PROTOCOLS
+The system currently supports the
+Internet
+protocols, the Xerox Network Systems(tm) protocols,
+and some of the
+.Tn ISO OSI
+protocols.
+Raw socket interfaces are provided to the
+.Tn IP
+protocol
+layer of the
+Internet, and to the
+.Tn IDP
+protocol of Xerox
+.Tn NS .
+Consult the appropriate manual pages in this section for more
+information regarding the support for each protocol family.
+.Sh ADDRESSING
+Associated with each protocol family is an address
+format.
+All network addresses adhere to a general structure,
+called a sockaddr, described below.
+However, each protocol
+imposes finer and more specific structure, generally renaming
+the variant, which is discussed in the protocol family manual
+page alluded to above.
+.Bd -literal -offset indent
+struct sockaddr {
+ u_char sa_len;
+ u_char sa_family;
+ char sa_data[14];
+};
+.Ed
+.Pp
+The field
+.Va sa_len
+contains the total length of the structure,
+which may exceed 16 bytes.
+The following address values for
+.Va sa_family
+are known to the system
+(and additional formats are defined for possible future implementation):
+.Bd -literal
+#define AF_UNIX 1 /* local to host (pipes, portals) */
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#define AF_NS 6 /* Xerox NS protocols */
+#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
+#define AF_HYLINK 15 /* NSC Hyperchannel */
+#define AF_ISO 18 /* ISO protocols */
+.Ed
+.Sh ROUTING
+.Fx
+provides some packet routing facilities.
+The kernel maintains a routing information database, which
+is used in selecting the appropriate network interface when
+transmitting packets.
+.Pp
+A user process (or possibly multiple co-operating processes)
+maintains this database by sending messages over a special kind
+of socket.
+This supplants fixed size
+.Xr ioctl 2
+used in earlier releases.
+.Pp
+This facility is described in
+.Xr route 4 .
+.Sh INTERFACES
+Each network interface in a system corresponds to a
+path through which messages may be sent and received.
+A network interface usually has a hardware device associated with it, though
+certain interfaces such as the loopback interface,
+.Xr lo 4 ,
+do not.
+.Pp
+The following
+.Xr ioctl 2
+calls may be used to manipulate network interfaces.
+The
+.Fn ioctl
+is made on a socket (typically of type
+.Dv SOCK_DGRAM )
+in the desired domain.
+Most of the requests supported in earlier releases
+take an
+.Vt ifreq
+structure as its parameter.
+This structure has the form
+.Bd -literal
+struct ifreq {
+#define IFNAMSIZ 16
+ char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ union {
+ struct sockaddr ifru_addr;
+ struct sockaddr ifru_dstaddr;
+ struct sockaddr ifru_broadaddr;
+ struct ifreq_buffer ifru_buffer;
+ short ifru_flags[2];
+ short ifru_index;
+ int ifru_metric;
+ int ifru_mtu;
+ int ifru_phys;
+ int ifru_media;
+ caddr_t ifru_data;
+ int ifru_cap[2];
+ } ifr_ifru;
+#define ifr_addr ifr_ifru.ifru_addr /* address */
+#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
+#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
+#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */
+#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
+#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
+#define ifr_metric ifr_ifru.ifru_metric /* metric */
+#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
+#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
+#define ifr_media ifr_ifru.ifru_media /* physical media */
+#define ifr_data ifr_ifru.ifru_data /* for use by interface */
+#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
+#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
+#define ifr_index ifr_ifru.ifru_index /* interface index */
+};
+.Ed
+.Pp
+.Fn Ioctl
+requests to obtain addresses and requests both to set and
+retrieve other data are still fully supported
+and use the
+.Vt ifreq
+structure:
+.Bl -tag -width SIOCGIFBRDADDR
+.It Dv SIOCGIFADDR
+Get interface address for protocol family.
+.It Dv SIOCGIFDSTADDR
+Get point to point address for protocol family and interface.
+.It Dv SIOCGIFBRDADDR
+Get broadcast address for protocol family and interface.
+.It Dv SIOCSIFCAP
+Attempt to set the enabled capabilities field for the interface
+to the value of the
+.Va ifr_reqcap
+field of the
+.Vt ifreq
+structure.
+Note that, depending on the particular interface features,
+some capabilities may appear hard-coded to enabled, or toggling
+a capability may affect the status of other ones.
+The supported capabilities field is read-only, and the
+.Va ifr_curcap
+field is unused by this call.
+.It Dv SIOCGIFCAP
+Get the interface capabilities fields.
+The values for supported and enabled capabilities will be returned in the
+.Va ifr_reqcap
+and
+.Va ifr_curcap
+fields of the
+.Vt ifreq
+structure, respectively.
+.It Dv SIOCGIFDESCR
+Get the interface description, returned in the
+.Va buffer
+field of
+.Va ifru_buffer
+struct.
+The user supplied buffer length should be defined in the
+.Va length
+field of
+.Va ifru_buffer
+struct passed in as parameter, and the length would include
+the terminating nul character.
+If there is not enough space to hold the interface length,
+no copy would be done and the
+.Va buffer
+field of
+.Va ifru_buffer
+would be set to NULL.
+The kernel will store the buffer length in the
+.Va length
+field upon return, regardless whether the buffer itself is
+sufficient to hold the data.
+.It Dv SIOCSIFDESCR
+Set the interface description to the value of the
+.Va buffer
+field of
+.Va ifru_buffer
+struct, with
+.Va length
+field specifying its length (counting the terminating nul).
+.It Dv SIOCSIFFLAGS
+Set interface flags field.
+If the interface is marked down,
+any processes currently routing packets through the interface
+are notified;
+some interfaces may be reset so that incoming packets are no longer received.
+When marked up again, the interface is reinitialized.
+.It Dv SIOCGIFFLAGS
+Get interface flags.
+.It Dv SIOCSIFMETRIC
+Set interface routing metric.
+The metric is used only by user-level routers.
+.It Dv SIOCGIFMETRIC
+Get interface metric.
+.It Dv SIOCIFCREATE
+Attempt to create the specified interface.
+If the interface name is given without a unit number the system
+will attempt to create a new interface with an arbitrary unit number.
+On successful return the
+.Va ifr_name
+field will contain the new interface name.
+.It Dv SIOCIFDESTROY
+Attempt to destroy the specified interface.
+.El
+.Pp
+There are two requests that make use of a new structure:
+.Bl -tag -width SIOCGIFBRDADDR
+.It Dv SIOCAIFADDR
+An interface may have more than one address associated with it
+in some protocols.
+This request provides a means to
+add additional addresses (or modify characteristics of the
+primary address if the default address for the address family
+is specified).
+Rather than making separate calls to
+set destination or broadcast addresses, or network masks
+(now an integral feature of multiple protocols)
+a separate structure is used to specify all three facets simultaneously
+(see below).
+One would use a slightly tailored version of this struct specific
+to each family (replacing each sockaddr by one
+of the family-specific type).
+Where the sockaddr itself is larger than the
+default size, one needs to modify the
+.Fn ioctl
+identifier itself to include the total size, as described in
+.Fn ioctl .
+.It Dv SIOCDIFADDR
+This requests deletes the specified address from the list
+associated with an interface.
+It also uses the
+.Vt ifaliasreq
+structure to allow for the possibility of protocols allowing
+multiple masks or destination addresses, and also adopts the
+convention that specification of the default address means
+to delete the first address for the interface belonging to
+the address family in which the original socket was opened.
+.It Dv SIOCGIFCONF
+Get interface configuration list.
+This request takes an
+.Vt ifconf
+structure (see below) as a value-result parameter.
+The
+.Va ifc_len
+field should be initially set to the size of the buffer
+pointed to by
+.Va ifc_buf .
+On return it will contain the length, in bytes, of the
+configuration list.
+.It Dv SIOCIFGCLONERS
+Get list of clonable interfaces.
+This request takes an
+.Vt if_clonereq
+structure (see below) as a value-result parameter.
+The
+.Va ifcr_count
+field should be set to the number of
+.Dv IFNAMSIZ
+sized strings that can be fit in the buffer pointed to by
+.Va ifcr_buffer .
+On return,
+.Va ifcr_total
+will be set to the number of clonable interfaces and the buffer pointed
+to by
+.Va ifcr_buffer
+will be filled with the names of clonable interfaces aligned on
+.Dv IFNAMSIZ
+boundaries.
+.El
+.Bd -literal
+/*
+* Structure used in SIOCAIFADDR request.
+*/
+struct ifaliasreq {
+ char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct sockaddr ifra_addr;
+ struct sockaddr ifra_broadaddr;
+ struct sockaddr ifra_mask;
+};
+.Ed
+.Bd -literal
+/*
+* Structure used in SIOCGIFCONF request.
+* Used to retrieve interface configuration
+* for machine (useful for programs which
+* must know all networks accessible).
+*/
+struct ifconf {
+ int ifc_len; /* size of associated buffer */
+ union {
+ caddr_t ifcu_buf;
+ struct ifreq *ifcu_req;
+ } ifc_ifcu;
+#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
+#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
+};
+.Ed
+.Bd -literal
+/* Structure used in SIOCIFGCLONERS request. */
+struct if_clonereq {
+ int ifcr_total; /* total cloners (out) */
+ int ifcr_count; /* room for this many in user buffer */
+ char *ifcr_buffer; /* buffer for cloner names */
+};
+.Ed
+.Bd -literal
+/* Structure used in SIOCGIFDESCR and SIOCSIFDESCR requests */
+struct ifreq_buffer {
+ size_t length; /* length of the buffer */
+ void *buffer; /* pointer to userland space buffer */
+};
+.Ed
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr intro 4 ,
+.Xr config 8 ,
+.Xr routed 8 ,
+.Xr ifnet 9
+.Sh HISTORY
+The
+.Nm netintro
+manual appeared in
+.Bx 4.3 tahoe .
diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4
new file mode 100644
index 000000000000..8edcb028b92b
--- /dev/null
+++ b/share/man/man4/netmap.4
@@ -0,0 +1,304 @@
+.\" Copyright (c) 2011 Matteo Landi, Luigi Rizzo, Universita` di Pisa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" This document is derived in part from the enet man page (enet.4)
+.\" distributed with 4.3BSD Unix.
+.\"
+.\" $FreeBSD$
+.\" $Id: netmap.4 9662 2011-11-16 13:18:06Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $
+.\"
+.Dd February 27, 2012
+.Dt NETMAP 4
+.Os
+.Sh NAME
+.Nm netmap
+.Nd a framework for fast packet I/O
+.Sh SYNOPSIS
+.Cd device netmap
+.Sh DESCRIPTION
+.Nm
+is a framework for fast and safe access to network devices
+(reaching 14.88 Mpps at less than 1 GHz).
+.Nm
+uses memory mapped buffers and metadata
+(buffer indexes and lengths) to communicate with the kernel,
+which is in charge of validating information through
+.Pa ioctl()
+and
+.Pa select()/poll().
+.Nm
+can exploit the parallelism in multiqueue devices and
+multicore systems.
+.Pp
+.Nm
+requires explicit support in device drivers.
+For a list of supported devices, see the end of this manual page.
+.Sh OPERATION
+.Nm
+clients must first open the
+.Pa open("/dev/netmap") ,
+and then issue an
+.Pa ioctl(...,NIOCREGIF,...)
+to bind the file descriptor to a network device.
+.Pp
+When a device is put in
+.Nm
+mode, its data path is disconnected from the host stack.
+The processes owning the file descriptor
+can exchange packets with the device, or with the host stack,
+through an mmapped memory region that contains pre-allocated
+buffers and metadata.
+.Pp
+Non blocking I/O is done with special
+.Pa ioctl()'s ,
+whereas the file descriptor can be passed to
+.Pa select()/poll()
+to be notified about incoming packet or available transmit buffers.
+.Ss Data structures
+All data structures for all devices in
+.Nm
+mode are in a memory
+region shared by the kernel and all processes
+who open
+.Pa /dev/netmap
+(NOTE: visibility may be restricted in future implementations).
+All references between the shared data structure
+are relative (offsets or indexes). Some macros help converting
+them into actual pointers.
+.Pp
+The data structures in shared memory are the following:
+.Bl -tag -width XXX
+.It Dv struct netmap_if (one per interface)
+indicates the number of rings supported by an interface, their
+sizes, and the offsets of the
+.Pa netmap_rings
+associated to the interface.
+The offset of a
+.Pa struct netmap_if
+in the shared memory region is indicated by the
+.Pa nr_offset
+field in the structure returned by the
+.Pa NIOCREGIF
+(see below).
+.Bd -literal
+struct netmap_if {
+ char ni_name[IFNAMSIZ]; /* name of the interface. */
+ const u_int ni_num_queues; /* number of hw ring pairs */
+ const ssize_t ring_ofs[]; /* offset of tx and rx rings */
+};
+.Ed
+.It Dv struct netmap_ring (one per ring)
+contains the index of the current read or write slot (cur),
+the number of slots available for reception or transmission (avail),
+and an array of
+.Pa slots
+describing the buffers.
+There is one ring pair for each of the N hardware ring pairs
+supported by the card (numbered 0..N-1), plus
+one ring pair (numbered N) for packets from/to the host stack.
+.Bd -literal
+struct netmap_ring {
+ const ssize_t buf_ofs;
+ const uint32_t num_slots; /* number of slots in the ring. */
+ uint32_t avail; /* number of usable slots */
+ uint32_t cur; /* 'current' index for the user side */
+ uint32_t reserved; /* not refilled before current */
+
+ const uint16_t nr_buf_size;
+ uint16_t flags;
+ struct netmap_slot slot[0]; /* array of slots. */
+}
+.Ed
+.It Dv struct netmap_slot (one per packet)
+contains the metadata for a packet: a buffer index (buf_idx),
+a buffer length (len), and some flags.
+.Bd -literal
+struct netmap_slot {
+ uint32_t buf_idx; /* buffer index */
+ uint16_t len; /* packet length */
+ uint16_t flags; /* buf changed, etc. */
+#define NS_BUF_CHANGED 0x0001 /* must resync, buffer changed */
+#define NS_REPORT 0x0002 /* tell hw to report results
+ * e.g. by generating an interrupt
+ */
+};
+.Ed
+.It Dv packet buffers
+are fixed size (approximately 2k) buffers allocated by the kernel
+that contain packet data. Buffers addresses are computed through
+macros.
+.El
+.Pp
+Some macros support the access to objects in the shared memory
+region. In particular:
+.Bd -literal
+struct netmap_if *nifp;
+struct netmap_ring *txring = NETMAP_TXRING(nifp, i);
+struct netmap_ring *rxring = NETMAP_RXRING(nifp, i);
+int i = txring->slot[txring->cur].buf_idx;
+char *buf = NETMAP_BUF(txring, i);
+.Ed
+.Ss IOCTLS
+.Nm
+supports some ioctl() to synchronize the state of the rings
+between the kernel and the user processes, plus some
+to query and configure the interface.
+The former do not require any argument, whereas the latter
+use a
+.Pa struct netmap_req
+defined as follows:
+.Bd -literal
+struct nmreq {
+ char nr_name[IFNAMSIZ];
+ uint32_t nr_version; /* API version */
+#define NETMAP_API 2 /* current version */
+ uint32_t nr_offset; /* nifp offset in the shared region */
+ uint32_t nr_memsize; /* size of the shared region */
+ uint32_t nr_tx_slots; /* slots in tx rings */
+ uint32_t nr_rx_slots; /* slots in rx rings */
+ uint16_t nr_tx_rings; /* number of tx rings */
+ uint16_t nr_rx_rings; /* number of tx rings */
+ uint16_t nr_ringid; /* ring(s) we care about */
+#define NETMAP_HW_RING 0x4000 /* low bits indicate one hw ring */
+#define NETMAP_SW_RING 0x2000 /* we process the sw ring */
+#define NETMAP_NO_TX_POLL 0x1000 /* no gratuitous txsync on poll */
+#define NETMAP_RING_MASK 0xfff /* the actual ring number */
+};
+
+.Ed
+A device descriptor obtained through
+.Pa /dev/netmap
+also supports the ioctl supported by network devices.
+.Pp
+The netmap-specific
+.Xr ioctl 2
+command codes below are defined in
+.In net/netmap.h
+and are:
+.Bl -tag -width XXXX
+.It Dv NIOCGINFO
+returns information about the interface named in nr_name.
+On return, nr_memsize indicates the size of the shared netmap
+memory region (this is device-independent),
+nr_tx_slots and nr_rx_slots indicates how many buffers are in a
+transmit and receive ring,
+nr_tx_rings and nr_rx_rings indicates the number of transmit
+and receive rings supported by the hardware.
+.Pp
+If the device does not support netmap, the ioctl returns EINVAL.
+.It Dv NIOCREGIF
+puts the interface named in nr_name into netmap mode, disconnecting
+it from the host stack, and/or defines which rings are controlled
+through this file descriptor.
+On return, it gives the same info as NIOCGINFO, and nr_ringid
+indicates the identity of the rings controlled through the file
+descriptor.
+.Pp
+Possible values for nr_ringid are
+.Bl -tag -width XXXXX
+.It 0
+default, all hardware rings
+.It NETMAP_SW_RING
+the ``host rings'' connecting to the host stack
+.It NETMAP_HW_RING + i
+the i-th hardware ring
+.El
+By default, a
+.Nm poll
+or
+.Nm select
+call pushes out any pending packets on the transmit ring, even if
+no write events are specified.
+The feature can be disabled by or-ing
+.Nm NETMAP_NO_TX_SYNC
+to nr_ringid.
+But normally you should keep this feature unless you are using
+separate file descriptors for the send and receive rings, because
+otherwise packets are pushed out only if NETMAP_TXSYNC is called,
+or the send queue is full.
+.Pp
+.Pa NIOCREGIF
+can be used multiple times to change the association of a
+file descriptor to a ring pair, always within the same device.
+.It Dv NIOCUNREGIF
+brings an interface back to normal mode.
+.It Dv NIOCTXSYNC
+tells the hardware of new packets to transmit, and updates the
+number of slots available for transmission.
+.It Dv NIOCRXSYNC
+tells the hardware of consumed packets, and asks for newly available
+packets.
+.El
+.Ss SYSTEM CALLS
+.Nm
+uses
+.Nm select
+and
+.Nm poll
+to wake up processes when significant events occur.
+.Sh EXAMPLES
+The following code implements a traffic generator
+.Pp
+.Bd -literal -compact
+#include <net/netmap.h>
+#include <net/netmap_user.h>
+struct netmap_if *nifp;
+struct netmap_ring *ring;
+struct netmap_request nmr;
+
+fd = open("/dev/netmap", O_RDWR);
+bzero(&nmr, sizeof(nmr));
+strcpy(nmr.nm_name, "ix0");
+nmr.nm_version = NETMAP_API;
+ioctl(fd, NIOCREG, &nmr);
+p = mmap(0, nmr.memsize, fd);
+nifp = NETMAP_IF(p, nmr.offset);
+ring = NETMAP_TXRING(nifp, 0);
+fds.fd = fd;
+fds.events = POLLOUT;
+for (;;) {
+ poll(list, 1, -1);
+ while (ring->avail-- > 0) {
+ i = ring->cur;
+ buf = NETMAP_BUF(ring, ring->slot[i].buf_index);
+ ... prepare packet in buf ...
+ ring->slot[i].len = ... packet length ...
+ ring->cur = NETMAP_RING_NEXT(ring, i);
+ }
+}
+.Ed
+.Sh SUPPORTED INTERFACES
+.Nm
+supports the following interfaces:
+.Xr em 4 ,
+.Xr ixgbe 4 ,
+.Xr re 4 ,
+.Sh AUTHORS
+The
+.Nm
+framework has been designed and implemented by
+.An Luigi Rizzo
+and
+.An Matteo Landi
+in 2011 at the Universita` di Pisa.
diff --git a/share/man/man4/nfe.4 b/share/man/man4/nfe.4
new file mode 100644
index 000000000000..45dd380bb022
--- /dev/null
+++ b/share/man/man4/nfe.4
@@ -0,0 +1,203 @@
+.\" $OpenBSD: nfe.4,v 1.7 2006/02/28 08:13:47 jsg Exp $
+.\"
+.\" Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 15, 2011
+.Dt NFE 4
+.Os
+.Sh NAME
+.Nm nfe
+.Nd "NVIDIA nForce MCP Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device nfe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_nfe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports PCI Ethernet adapters based on the NVIDIA
+nForce Media and Communications Processors (MCP), such as
+the nForce, nForce 2, nForce 3, CK804, MCP04, MCP51, MCP55,
+MCP61, MCP65, MCP67, MCP73, MCP77 and MCP79 Ethernet
+controller chips.
+.Pp
+Supported features include (hardware support provided):
+.Pp
+.Bl -bullet -compact
+.It
+Receive/Transmit IP/TCP/UDP checksum offload
+.It
+Hardware VLAN tag insertion/stripping
+.It
+TCP segmentation offload (TSO)
+.It
+MSI/MSI-X
+.It
+Jumbo Frames
+.El
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width "10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseT
+Set 1000Mbps (Gigabit Ethernet) operation (recent models only).
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm half-duplex
+Force half duplex operation.
+.It Cm full-duplex
+Force full duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following NVIDIA MCP onboard adapters:
+.Pp
+.Bl -bullet -compact
+.It
+NVIDIA nForce MCP Networking Adapter
+.It
+NVIDIA nForce MCP04 Networking Adapter
+.It
+NVIDIA nForce 430 MCP12 Networking Adapter
+.It
+NVIDIA nForce 430 MCP13 Networking Adapter
+.It
+NVIDIA nForce MCP51 Networking Adapter
+.It
+NVIDIA nForce MCP55 Networking Adapter
+.It
+NVIDIA nForce MCP61 Networking Adapter
+.It
+NVIDIA nForce MCP65 Networking Adapter
+.It
+NVIDIA nForce MCP67 Networking Adapter
+.It
+NVIDIA nForce MCP73 Networking Adapter
+.It
+NVIDIA nForce MCP77 Networking Adapter
+.It
+NVIDIA nForce MCP79 Networking Adapter
+.It
+NVIDIA nForce2 MCP2 Networking Adapter
+.It
+NVIDIA nForce2 400 MCP4 Networking Adapter
+.It
+NVIDIA nForce2 400 MCP5 Networking Adapter
+.It
+NVIDIA nForce3 MCP3 Networking Adapter
+.It
+NVIDIA nForce3 250 MCP6 Networking Adapter
+.It
+NVIDIA nForce3 MCP7 Networking Adapter
+.It
+NVIDIA nForce4 CK804 MCP8 Networking Adapter
+.It
+NVIDIA nForce4 CK804 MCP9 Networking Adapter
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width indent
+.It Va hw.nfe.msi_disable
+Whether or not MSI support is enabled in the driver.
+The default value is 0.
+.It Va hw.nfe.msix_disable
+Whether or not MSI-X support is enabled in the driver.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variables can be used to modify or monitor
+.Nm
+behavior.
+.Bl -tag -width indent
+.It Va dev.nfe.%d.process_limit
+Maximum number of Rx events to be processed in the event loop
+before rescheduling a taskqueue.
+The accepted range is 50 to 255, the default value is 192.
+The interface does not need to be brought down and up again
+before a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr intro 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr polling 4 ,
+.Xr rgephy 4 ,
+.Xr sysctl 8 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 3.9 ,
+and then in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jonathan Gray
+.Aq jsg@openbsd.org
+and
+.An Damien Bergamini
+.Aq damien@openbsd.org .
+The
+.Nm
+driver was ported to
+.Fx
+by
+.An Shigeaki Tagashira
+.Aq shigeaki@se.hiroshima-u.ac.jp .
diff --git a/share/man/man4/nfsmb.4 b/share/man/man4/nfsmb.4
new file mode 100644
index 000000000000..d6f39cec7fc5
--- /dev/null
+++ b/share/man/man4/nfsmb.4
@@ -0,0 +1,54 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 31, 2005
+.Dt NFSMB 4
+.Os
+.Sh NAME
+.Nm nfsmb
+.Nd "NVIDIA nForce2/3/4 SMBus 2.0 controller driver"
+.Sh SYNOPSIS
+.Cd "device smbus"
+.Cd "device smb"
+.Cd "device nfsmb"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to NVIDIA nForce2/3/4 SMBus 2.0 controllers.
+.Sh SEE ALSO
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Ruslan Ermilov Aq ru@FreeBSD.org .
diff --git a/share/man/man4/ng_UI.4 b/share/man/man4/ng_UI.4
new file mode 100644
index 000000000000..2054d19ee1ad
--- /dev/null
+++ b/share/man/man4/ng_UI.4
@@ -0,0 +1,93 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_UI.8,v 1.4 1999/01/25 02:37:56 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_UI 4
+.Os
+.Sh NAME
+.Nm ng_UI
+.Nd UI netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_UI.h
+.Sh DESCRIPTION
+The
+.Nm UI
+node type has two hooks,
+.Dv upstream
+and
+.Dv downstream .
+Packets received on
+.Dv downstream
+must have 0x03 (indicating unnumbered information) as their first byte;
+if not the packet is dropped.
+This byte is then stripped and the
+remainder of the packet sent out on
+.Dv upstream .
+.Pp
+Conversely, packets received on
+.Dv upstream
+will have a 0x03 byte prepended to them before being forwarded out on the
+.Dv downstream
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobar
+.It Dv downstream
+Downstream connection.
+Packets on this side of the node have a 0x03 as
+their first byte.
+.It Dv upstream
+Upstream connection.
+Packets on this side of the node have the
+initial 0x03 byte stripped off.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_async.4 b/share/man/man4/ng_async.4
new file mode 100644
index 000000000000..2349cb3c6fac
--- /dev/null
+++ b/share/man/man4/ng_async.4
@@ -0,0 +1,173 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_async.8,v 1.6 1999/01/25 23:46:25 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ASYNC 4
+.Os
+.Sh NAME
+.Nm ng_async
+.Nd asynchronous framing netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_async.h
+.Sh DESCRIPTION
+The
+.Nm async
+node type performs conversion between synchronous frames and
+asynchronous frames, as defined for the PPP protocol in RFC 1662.
+Asynchronous framing uses flag bytes and octet-stuffing
+to simulate a frame oriented connection over an octet-oriented
+asynchronous serial line.
+.Pp
+The node transmits and receives asynchronous data on the
+.Dv async
+hook.
+Mbuf boundaries of incoming data are ignored.
+Once a complete packet has been received, it is decoded and
+stripped of all framing bytes, and transmitted out the
+.Dv sync
+hook as a single frame.
+.Pp
+Synchronous frames are transmitted and received on the
+.Dv sync
+hook.
+Packets received on this hook are encoded as asynchronous frames
+and sent out on
+.Dv async .
+Received packets should start with the address and control fields,
+or the PPP protocol field if address and control field compression
+is employed, and contain no checksum field.
+If the first four bytes are
+.Dv "0xff 0x03 0xc0 0x21"
+(an LCP protocol frame) then complete control character escaping
+is enabled for that frame (in PPP, LCP packets are always sent with
+no address and control field compression and all control characters
+escaped).
+.Pp
+This node supports
+.Dq flag sharing
+for packets transmitted on
+.Dv async .
+This is an optimization where the trailing flag byte
+of one frame is shared with the opening flag byte of the next.
+Flag sharing between frames is disabled after one second of transmit
+idle time.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobar
+.It Dv async
+Asynchronous connection.
+Typically this hook would be connected to a
+.Xr ng_tty 4
+node, which handles transmission of serial data over a tty device.
+.It Dv sync
+Synchronous connection.
+This hook sends and receives synchronous frames.
+For PPP, these frames should contain address, control, and protocol fields,
+but no checksum field.
+Typically this hook would be connected to an individual link hook of a
+.Xr ng_ppp 4
+type node.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_ASYNC_CMD_GET_STATS
+This command returns a
+.Dv "struct ng_async_stat"
+containing node statistics for packet, octet, and error counts.
+.It Dv NGM_ASYNC_CMD_CLR_STATS
+Clears the node statistics.
+.It Dv NGM_ASYNC_CMD_SET_CONFIG
+Sets the node configuration, which is described by a
+.Dv "struct ng_async_cfg" :
+.Bd -literal -offset 4n
+struct ng_async_cfg {
+ u_char enabled; /* Turn encoding on/off */
+ uint16_t amru; /* Max receive async frame len */
+ uint16_t smru; /* Max receive sync frame len */
+ uint32_t accm; /* ACCM encoding */
+};
+.Ed
+.Pp
+The
+.Dv enabled
+field enables or disables all encoding/decoding functions (default disabled).
+When disabled, the node operates in simple
+.Dq pass through
+mode.
+The
+.Dv amru
+and
+.Dv smru
+fields are the asynchronous and synchronous MRU (maximum receive unit) values,
+respectively.
+These both default to 1600; note that the async MRU
+applies to the incoming frame length after asynchronous decoding.
+The
+.Dv accm
+field is the asynchronous character control map, which controls the escaping
+of characters 0x00 thorough 0x1f (default 0xffffffff).
+.It Dv NGM_ASYNC_CMD_GET_CONFIG
+This command returns the current configuration structure.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 4 ,
+.Xr ng_tty 4 ,
+.Xr ngctl 8
+.Rs
+.%A W. Simpson
+.%T "PPP in HDLC-link Framing"
+.%O RFC 1662
+.Re
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ng_atm.4 b/share/man/man4/ng_atm.4
new file mode 100644
index 000000000000..aad0224f3eb2
--- /dev/null
+++ b/share/man/man4/ng_atm.4
@@ -0,0 +1,416 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" ng_atm(4) man page
+.\"
+.Dd June 24, 2003
+.Dt NG_ATM 4
+.Os
+.Sh NAME
+.Nm ng_atm
+.Nd netgraph ATM node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In net/if_atm.h
+.In netgraph.h
+.In netgraph/atm/ng_atm.h
+.Sh DESCRIPTION
+The
+.Nm atm
+netgraph node type allows
+.Xr natm 4
+ATM drivers to be connected to the
+.Xr netgraph 4
+networking subsystem.
+When the
+.Nm
+module is loaded a node is automatically created for each
+.Xr natm 4
+ATM interface.
+The nodes are named with the same name as the
+interface.
+Nodes are also created if a driver for an ATM
+card is loaded after
+.Nm
+was loaded.
+.Pp
+The
+.Nm atm
+nodes are persistent.
+They are removed when the interface is removed.
+.Dv NGM_SHUTDOWN
+messages are ignored by the node.
+.Sh HOOKS
+Four special hooks with fixed names and an unlimited number of hooks with user
+defined names are supported.
+Three of the fixed hooks are attached to
+strategic points in the information flow in the
+.Xr natm 4
+system and support only reading.
+The fourth fixed hook behaves like the other
+user hooks, but a number of management messages are sent along the hook.
+The other hooks can be attached to VCIs dynamically by means of
+control messages to the
+.Nm atm
+node and can be written and read.
+.Pp
+The four fixed hooks are:
+.Bl -tag -width ".Va orphans"
+.It Va input
+This is a connection to the raw input stream from the network.
+If this hook is connected, all incoming packets are delivered out to
+this hook.
+Note that this redirects ALL input.
+Neither
+.Xr natm 4
+nor the user hooks will see any input if
+.Va input
+is connected.
+An
+.Vt atm_pseudohdr
+(see
+.Xr natm 4 )
+is prepended to the actual data.
+.It Va output
+This is a connection to the raw output stream to the network device.
+If this hook is connected, all outgoing packets are handed over to
+the netgraph system and delivered to the hook instead of being delivered
+to the ATM driver.
+An
+.Vt atm_pseudohdr
+(see
+.Xr natm 4 )
+is prepended to the actual data.
+.It Va orphans
+This hook receives all packets that are unrecognized, i.e., do not belong to
+either a
+.Xr natm 4
+socket, a
+.Nm
+VCI or
+.Xr natm 4
+IP.
+Because ATM is connection oriented and packets are received on a given VCI only
+when someone initiates this VCI, packets should never be orphaned.
+There is
+however one exception: if you use
+.Xr natm 4
+IP with LLC/SNAP encapsulation packets with do not have the IP protocol
+indicated in the packet header are delivered out of this hook.
+An
+.Vt atm_pseudohdr
+(see
+.Xr natm 4 )
+is prepended to the actual data send out to the hook.
+.It Va manage
+This hook behaves exactly like a normal user hook (see below) except that
+the node at the other hand will receive management messages.
+.El
+.Pp
+Hooks for dynamically initiated VCIs can have whatever name is allowed by
+.Xr netgraph 4
+as long as the name does not collide with one of the three predefined names.
+.Pp
+To initiate packet sending and receiving on a dynamic hook, one has to issue
+a
+.Dv NGM_ATM_CPCS_INIT
+control message.
+To terminate sending and receiving one must send a
+.Dv NGM_ATM_CPCS_TERM
+message (see
+.Sx CONTROL MESSAGES ) .
+The data sent and received on these hooks has no additional
+headers.
+.Sh CONTROL MESSAGES
+This node type supports the generic messages plus the following:
+.Bl -tag -width 4n
+.It Dv NGM_ATM_GET_IFNAME
+Return the name of the interface as a
+.Dv NUL Ns
+-terminated string.
+This is normally the same name as that of the node.
+.It Dv NGM_ATM_GET_CONFIG
+Returns a structure defining the configuration of the interface:
+.Bd -literal
+struct ng_atm_config {
+ uint32_t pcr; /* peak cell rate */
+ uint32_t maxvpi; /* maximum vpi */
+ uint32_t maxvci; /* maximum vci */
+ uint32_t max_vpcs; /* maximum number of VPCs */
+ uint32_t max_vccs; /* maximum number of VCCs */
+};
+.Ed
+.It Dv NGM_ATM_GET_VCCS
+Returns the table of open VCCs from the driver.
+This table consists of
+a header and a variable sized array of entries, one for each open VCC:
+.Bd -literal
+struct atmio_vcctable {
+ uint32_t count; /* number of vccs */
+ struct atmio_vcc vccs[0]; /* array of VCCs */
+};
+struct atmio_vcc {
+ uint16_t flags; /* flags */
+ uint16_t vpi; /* VPI */
+ uint16_t vci; /* VCI */
+ uint16_t rmtu; /* Receive maximum CPCS size */
+ uint16_t tmtu; /* Transmit maximum CPCS size */
+ uint8_t aal; /* aal type */
+ uint8_t traffic; /* traffic type */
+ struct atmio_tparam tparam; /* traffic parameters */
+};
+struct atmio_tparam {
+ uint32_t pcr; /* 24bit: Peak Cell Rate */
+ uint32_t scr; /* 24bit: VBR Sustainable Cell Rate */
+ uint32_t mbs; /* 24bit: VBR Maximum burst size */
+ uint32_t mcr; /* 24bit: MCR */
+ uint32_t icr; /* 24bit: ABR ICR */
+ uint32_t tbe; /* 24bit: ABR TBE (1...2^24-1) */
+ uint8_t nrm; /* 3bit: ABR Nrm */
+ uint8_t trm; /* 3bit: ABR Trm */
+ uint16_t adtf; /* 10bit: ABR ADTF */
+ uint8_t rif; /* 4bit: ABR RIF */
+ uint8_t rdf; /* 4bit: ABR RDF */
+ uint8_t cdf; /* 3bit: ABR CDF */
+};
+.Ed
+.Pp
+Note that this is the driver's table, so all VCCs opened via
+.Xr natm 4
+sockets and IP are also shown.
+They can, however, be distinguished by
+their flags.
+The
+.Va flags
+field contains the following flags:
+.Pp
+.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
+.It Dv ATM_PH_AAL5
+use AAL5 instead of AAL0
+.It Dv ATM_PH_LLCSNAP
+if AAL5 use LLC SNAP encapsulation
+.It Dv ATM_FLAG_NG
+this is a netgraph VCC
+.It Dv ATM_FLAG_HARP
+this is a HARP VCC
+.It Dv ATM_FLAG_NORX
+transmit only VCC
+.It Dv ATM_FLAG_NOTX
+receive only VCC
+.It Dv ATMIO_FLAG_PVC
+treat channel as a PVC
+.El
+.Pp
+If the
+.Dv ATM_FLAG_NG
+flag is set, then
+.Va traffic
+and
+.Va tparam
+contain meaningful information.
+.Pp
+The
+.Va aal
+field
+contains one of the following values:
+.Pp
+.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
+.It Dv ATMIO_AAL_0
+AAL 0 (raw cells)
+.It Dv ATMIO_AAL_34
+AAL 3 or AAL 4
+.It Dv ATMIO_AAL_5
+AAL 5
+.It Dv ATMIO_AAL_RAW
+device specific raw cells
+.El
+.Pp
+The
+.Va traffic
+field
+can have one of the following values (not all drivers support
+all traffic types however):
+.Pp
+.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact
+.It Dv ATMIO_TRAFFIC_UBR
+.It Dv ATMIO_TRAFFIC_CBR
+.It Dv ATMIO_TRAFFIC_ABR
+.It Dv ATMIO_TRAFFIC_VBR
+.El
+.It Dv NGM_ATM_CPCS_INIT
+Initialize a VCC for sending and receiving.
+The argument is a structure:
+.Bd -literal
+struct ng_atm_cpcs_init {
+ char name[NG_HOOKSIZ];
+ uint32_t flags; /* flags. (if_natmio.h) */
+ uint16_t vci; /* VCI to open */
+ uint16_t vpi; /* VPI to open */
+ uint16_t rmtu; /* receive maximum PDU */
+ uint16_t tmtu; /* transmit maximum PDU */
+ uint8_t aal; /* AAL type (if_natmio.h) */
+ uint8_t traffic; /* traffic type (if_natmio.h) */
+ uint32_t pcr; /* Peak cell rate */
+ uint32_t scr; /* Sustainable cell rate */
+ uint32_t mbs; /* Maximum burst size */
+ uint32_t mcr; /* Minimum cell rate */
+ uint32_t icr; /* ABR: Initial cell rate */
+ uint32_t tbe; /* ABR: Transmit buffer exposure */
+ uint8_t nrm; /* ABR: Nrm */
+ uint8_t trm; /* ABR: Trm */
+ uint16_t adtf; /* ABR: ADTF */
+ uint8_t rif; /* ABR: RIF */
+ uint8_t rdf; /* ABR: RDF */
+ uint8_t cdf; /* ABR: CDF */
+};
+.Ed
+.Pp
+The
+.Va name
+field
+is the name of the hook for which sending and receiving should be enabled.
+This hook must already be connected.
+The
+.Va vpi
+and
+.Va vci
+fields
+are the respective VPI and VCI values to use for the ATM cells.
+They must be
+within the range, given by the
+.Va maxvpi
+and
+.Va maxvci
+fields of the
+.Vt ng_atm_config
+structure.
+The
+.Va flags
+field
+contains the flags (see above) and the other fields describe the
+type of traffic.
+.It Dv NGM_ATM_CPCS_TERM
+Stop sending and receiving on the indicated hook.
+The argument is a
+.Bd -literal
+struct ng_atm_cpcs_term {
+ char name[NG_HOOKSIZ];
+};
+.Ed
+.El
+.Sh MANAGEMENT MESSAGES
+If the
+.Va manage
+hook is connected, certain messages are sent along the hook.
+They are
+received by the peer node with a cookie of
+.Dv NG_ATM_COOKIE .
+.Bl -tag -width 4n
+.It Dv NGM_ATM_CARRIER_CHANGE
+The carrier state of the ATM physical interface has changed.
+The message has the following structure:
+.Bd -literal
+struct ng_atm_carrier_change {
+ uint32_t node;
+ uint32_t state;
+};
+.Ed
+.Pp
+The
+.Va node
+field
+is the node ID of the ATM node.
+This can be used by the managing entity
+(for example
+.Xr ilmid 8 )
+to manage several interfaces at the same time through the same node.
+The
+.Va state
+field is 1 if the carrier was detected, and 0 if it was lost.
+.It Dv NGM_ATM_VCC_CHANGE
+A permanent VCC has been added, deleted or changed.
+This is used by
+.Xr ilmid 8
+to generate the appropriate ILMI traps.
+The structure of the message is:
+.Bd -literal
+struct ng_atm_vcc_change {
+ uint32_t node;
+ uint16_t vci;
+ uint8_t vpi;
+ uint8_t state;
+};
+.Ed
+Where
+.Va state
+is 0 if the PVC was deleted, and 1 if it was added or modified.
+.El
+.Sh FLOW CONTROL
+If the hardware driver supports it, the node can emit flow control messages
+along a user hook.
+The format of these messages is described in
+.In netgraph/ng_message.h .
+The
+.Nm atm
+node may generate
+.Dv NGM_HIGH_WATER_PASSED
+and
+.Dv NGM_LOW_WATER_PASSED
+messages.
+The first one indicates that the hardware driver has stopped output
+on the channel and drops new packets, the second one reports that
+output was reenabled.
+Currently, the structures are not filled with
+information.
+.Sh SHUTDOWN
+The nodes are persistent as long as the corresponding interface exists.
+Upon receipt of a
+.Dv NGM_SHUTDOWN
+messages, all hooks are disconnected and the node is reinitialized.
+All
+VCCs opened via
+.Xr netgraph 4
+are closed.
+When the ATM interface is unloaded,
+the node disappears.
+If the node is compiled with
+.Dv NGATM_DEBUG
+there is a sysctl
+.Va net.graph.atm.allow_shutdown
+which, when set to a non-zero value, allows the nodes to shut down.
+Note that this is intended for development only and may lead to kernel
+panics if set.
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr netgraph 4 ,
+.Xr ng_ether 4 ,
+.Xr ngctl 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/ng_atmllc.4 b/share/man/man4/ng_atmllc.4
new file mode 100644
index 000000000000..81768b54da7c
--- /dev/null
+++ b/share/man/man4/ng_atmllc.4
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2004 Benno Rice <benno@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 8, 2004
+.Dt NG_ATMLLC 4
+.Os
+.Sh NAME
+.Nm ng_atmllc
+.Nd ATM LLC netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_atmllc.h
+.Sh DESCRIPTION
+The
+.Nm atmllc
+node type translates frames in to and out of ATM LLC encapsulation,
+as specified by RFC 1483.
+In LLC encapsulation the protocol of a given protocol data unit (PDU) is
+specified by an IEEE 802.2 LLC header, possibly followed by an IEEE 802.1a
+SubNetwork Attachment Point (SNAP) header.
+This node currently handles the Ethernet and FDDI protocols.
+.Pp
+The node transmits and receives ATM PDUs on the
+.Va atm
+hook.
+Received PDUs are decoded and forwarded to the
+.Va ether
+or
+.Va fddi
+hooks as appropriate.
+Data received on the
+.Va ether
+or
+.Va fddi
+hooks are assumed to be full Ethernet or FDDI packets as appropriate and are
+encapsulated into a PDU and transmitted via the
+.Va atm
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Va atm
+ATM connection.
+Typically, this hook would be connected to a
+.Xr ng_atm 4
+node, which handles transmission of ATM PDUs over an ATM device.
+.It Va ether
+Ethernet connection.
+This hook sends and receives Ethernet frames.
+This would normally be connected to an
+.Xr ng_eiface 4
+node if in use.
+.It Va fddi
+FDDI connection.
+This hook sends and receives FDDI frames.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_atm 4 ,
+.Xr ng_eiface 4 ,
+.Xr ngctl 8
+.Rs
+.%A J. Heinanen
+.%T "Multiprotocol Encapsulation over ATM Adaptation Layer 5"
+.%O RFC 1483
+.Re
+.Sh AUTHORS
+.An Benno Rice Aq benno@FreeBSD.org
diff --git a/share/man/man4/ng_bluetooth.4 b/share/man/man4/ng_bluetooth.4
new file mode 100644
index 000000000000..2214172b1ada
--- /dev/null
+++ b/share/man/man4/ng_bluetooth.4
@@ -0,0 +1,112 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_bluetooth.4,v 1.3 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd November 9, 2002
+.Dt NG_BLUETOOTH 4
+.Os
+.Sh NAME
+.Nm ng_bluetooth
+.Nd placeholder for global Bluetooth variables
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_bluetooth.h
+.Sh DESCRIPTION
+The
+.Nm
+module is a placeholder for global Bluetooth variables.
+All Bluetooth variables can be examined and changed via
+.Xr sysctl 8 .
+.Ss Bluetooth Variables
+Below is the description of default variables.
+Each Bluetooth module might add its own variables to the tree.
+.Bl -tag -width indent
+.It Va net.bluetooth.version
+A read-only integer variable that shows the current version of the
+Bluetooth stack.
+.It Va net.bluetooth.hci.command_timeout
+A read-write integer variable that controls the Host Controller Interface
+(HCI) command timeout (in seconds), i.e., how long the HCI layer will wait
+for the
+.Dv Command_Complete
+or
+.Dv Command_Status
+event from a Bluetooth device.
+.It Va net.bluetooth.hci.connection_timeout
+A read-write integer variable that controls the HCI connection timeout, i.e.\&
+how long the HCI layer will wait for the
+.Dv Connection_Complete
+event.
+Normally this should not be required as Bluetooth devices have
+connection timeout of their own and will send event back.
+This timeout
+is required to ensure that no connection will stall in case when the HCI
+transport layer is broken.
+Be careful when changing this variable.
+Make sure you understand what you are doing.
+.It Va net.bluetooth.hci.max_neighbor_age
+A read-write integer variable that controls time-to-live (in seconds) for
+entries in the HCI neighbor cache.
+Every time a Bluetooth device performs an
+.Dv Inquiry
+operation, the results will be put in cache.
+Later when a Bluetooth device
+establishes a baseband connection, it will try to find the matching entry in
+the cache and use it.
+This might speed up establishment of the baseband
+connection.
+.It Va net.bluetooth.l2cap.rtx_timeout
+A read-write integer variable that controls the Link Layer Control and
+Adaptation Protocol (L2CAP) Retransmission Timeout (RTX) (in seconds).
+Every time the L2CAP layer submits a control command, the RTX timeout is set.
+The value of the RTX timeout should be greater or equal to the value of
+the HCI connection timeout.
+Be careful when changing this variable.
+Make sure you understand what you are doing.
+.It Va net.bluetooth.l2cap.ertx_timeout
+A read-write integer variable that controls the L2CAP Extended Retransmission
+Timeout (ERTX) (in seconds).
+In some cases remote peer may respond with
+.Dv PENDING
+status to the L2CAP control command.
+In this case the L2CAP command timeout is reset to the ERTX timeout value.
+The value of the ERTX timeout should be
+greater or equal to the value of the RTX timeout.
+Be careful when changing this variable.
+Make sure you understand what you are doing.
+.El
+.Sh SEE ALSO
+.Xr ng_btsocket 4 ,
+.Xr ng_hci 4 ,
+.Xr ng_l2cap 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+module was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
diff --git a/share/man/man4/ng_bpf.4 b/share/man/man4/ng_bpf.4
new file mode 100644
index 000000000000..4f89729785c6
--- /dev/null
+++ b/share/man/man4/ng_bpf.4
@@ -0,0 +1,191 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $
+.\"
+.Dd May 30, 2007
+.Dt NG_BPF 4
+.Os
+.Sh NAME
+.Nm ng_bpf
+.Nd Berkeley packet filter netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In net/bpf.h
+.In netgraph.h
+.In netgraph/ng_bpf.h
+.Sh DESCRIPTION
+The
+.Nm bpf
+node type allows Berkeley Packet Filter (see
+.Xr bpf 4 )
+filters to be applied to data travelling through a Netgraph network.
+Each node allows an arbitrary number of connections to arbitrarily
+named hooks.
+With each hook is associated a
+.Xr bpf 4
+filter program which is applied to incoming data only, a destination hook
+for matching packets, a destination hook for non-matching packets,
+and various statistics counters.
+.Pp
+A
+.Xr bpf 4
+program returns an unsigned integer, which is normally interpreted as
+the length of the prefix of the packet to return.
+In the context of this
+node type, returning zero is considered a non-match, in which case the
+entire packet is delivered out the non-match destination hook.
+Returning a value greater than zero causes the packet to be truncated
+to that length and delivered out the match destination hook.
+Either or both destination hooks may be the empty string, or may
+not exist, in which case the packet is dropped.
+.Pp
+New hooks are initially configured to drop all packets.
+A new filter program may be installed using the
+.Dv NGM_BPF_SET_PROGRAM
+control message.
+.Sh HOOKS
+This node type supports any number of hooks having arbitrary names.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_BPF_SET_PROGRAM
+This command sets the filter program that will be applied to incoming
+data on a hook.
+The following structure must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_bpf_hookprog {
+ char thisHook[NG_HOOKSIZ]; /* name of hook */
+ char ifMatch[NG_HOOKSIZ]; /* match dest hook */
+ char ifNotMatch[NG_HOOKSIZ]; /* !match dest hook */
+ int32_t bpf_prog_len; /* #isns in program */
+ struct bpf_insn bpf_prog[]; /* bpf program */
+};
+.Ed
+.Pp
+The hook to be updated is specified in
+.Dv thisHook .
+The BPF program is the sequence of instructions in the
+.Dv bpf_prog
+array; there must be
+.Dv bpf_prog_len
+of them.
+Matching and non-matching incoming packets are delivered out the hooks named
+.Dv ifMatch
+and
+.Dv ifNotMatch ,
+respectively.
+The program must be a valid
+.Xr bpf 4
+program or else
+.Er EINVAL
+is returned.
+.It Dv NGM_BPF_GET_PROGRAM
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the
+corresponding
+.Dv "struct ng_bpf_hookprog"
+as shown above.
+.It Dv NGM_BPF_GET_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the
+statistics associated with the hook as a
+.Dv "struct ng_bpf_hookstat" .
+.It Dv NGM_BPF_CLR_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and clears the
+statistics associated with the hook.
+.It Dv NGM_BPF_GETCLR_STATS
+This command is identical to
+.Dv NGM_BPF_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+It is possible to configure a node from the command line, using
+.Xr tcpdump 1
+to generate raw BPF instructions which are then fed into an
+.Xr awk 1
+script to create the ASCII form of a
+.Dv NGM_BPF_SET_PROGRAM
+control message, as demonstrated here:
+.Bd -literal -offset 4n
+#!/bin/sh
+
+PATTERN="tcp dst port 80"
+NODEPATH="my_node:"
+INHOOK="hook1"
+MATCHHOOK="hook2"
+NOTMATCHHOOK="hook3"
+
+BPFPROG=$( tcpdump -s 8192 -ddd ${PATTERN} | \\
+ ( read len ; \\
+ echo -n "bpf_prog_len=$len" ; \\
+ echo -n "bpf_prog=[" ; \\
+ while read code jt jf k ; do \\
+ echo -n " { code=$code jt=$jt jf=$jf k=$k }" ; \\
+ done ; \\
+ echo " ]" ) )
+
+ngctl msg ${NODEPATH} setprogram { thisHook=\\"${INHOOK}\\" \\
+ ifMatch=\\"${MATCHHOOK}\\" \\
+ ifNotMatch=\\"${NOTMATCHHOOK}\\" \\
+ ${BPFPROG} }
+.Ed
+.Sh SEE ALSO
+.Xr bpf 4 ,
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+When built as a loadable kernel module, this module includes the file
+.Pa net/bpf_filter.c .
+Although loading the module should fail if
+.Pa net/bpf_filter.c
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
diff --git a/share/man/man4/ng_bridge.4 b/share/man/man4/ng_bridge.4
new file mode 100644
index 000000000000..b00dc6088b8b
--- /dev/null
+++ b/share/man/man4/ng_bridge.4
@@ -0,0 +1,213 @@
+.\" Copyright (c) 2000 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 5, 2010
+.Dt NG_BRIDGE 4
+.Os
+.Sh NAME
+.Nm ng_bridge
+.Nd Ethernet bridging netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_bridge.h
+.Sh DESCRIPTION
+The
+.Nm bridge
+node type performs Ethernet bridging over one or more links.
+Each link (represented by a connected hook) is used to transmit
+and receive raw Ethernet frames.
+As packets are received, the node learns which link each
+host resides on.
+Packets unicast to a known host are directed out the appropriate
+link only, and other links are spared the traffic.
+This behavior is in contrast to a hub, which always forwards
+every received packet to every other link.
+.Sh LOOP DETECTION
+The
+.Nm bridge
+node incorporates a simple loop detection algorithm.
+A loop is when two ports are connected to the same physical medium.
+Loops are important to avoid because of packet storms, which severely
+degrade performance.
+A packet storm results when the same packet is sent and received
+over and over again.
+If a host is detected on link A, and is then detected on link B
+within a certain time period after first being detected on link A,
+then link B is considered to be a looped back link.
+The time period is called the minimum stable time.
+.Pp
+A looped back link will be temporarily muted, i.e., all traffic
+received on that link is ignored.
+.Sh IPFW PROCESSING
+Processing of IP packets via the
+.Xr ipfirewall 4
+mechanism on a per-link basis is not yet implemented.
+.Sh HOOKS
+This node type supports up to
+.Dv NG_BRIDGE_MAX_LINKS
+hooks.
+Each connected hook represents a bridged link.
+The hooks are named
+.Dv link0 ,
+.Dv link1 ,
+etc.
+Typically these hooks are connected to the
+.Dv lower
+hooks of one or more
+.Xr ng_ether 4
+nodes.
+To connect the host machine to a bridged network, simply connect the
+.Dv upper
+hook of an
+.Xr ng_ether 4
+node to the bridge node.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the
+following:
+.Bl -tag -width foo
+.It Dv NGM_BRIDGE_SET_CONFIG
+Set the node configuration.
+This command takes a
+.Dv "struct ng_bridge_config"
+as an argument:
+.Bd -literal -offset 0n
+/* Node configuration structure */
+struct ng_bridge_config {
+ u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */
+ u_char debugLevel; /* debug level */
+ uint32_t loopTimeout; /* link loopback mute time */
+ uint32_t maxStaleness; /* max host age before nuking */
+ uint32_t minStableAge; /* min time for a stable host */
+};
+.Ed
+.Pp
+The
+.Dv ipfw
+array enables
+.Xr ipfirewall 4
+processing of IP packets received on the corresponding links.
+The
+.Dv debugLevel
+field sets the debug level on the node.
+At level of 2 or greater, detected loops are logged.
+The default level is 1.
+.Pp
+The
+.Dv loopTimeout
+determines how long (in seconds) a looped link is muted.
+The default is 60 seconds.
+The
+.Dv maxStaleness
+parameter determines how long a period of inactivity before
+a host's entry is forgotten.
+The default is 15 minutes.
+The
+.Dv minStableAge
+determines how quickly a host must jump from one link to another
+before we declare a loopback condition.
+The default is one second.
+.Pp
+.It Dv NGM_BRIDGE_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_bridge_config" .
+.It Dv NGM_BRIDGE_RESET
+Causes the node to forget all hosts and unmute all links.
+The node configuration is not changed.
+.It Dv NGM_BRIDGE_GET_STATS
+This command takes a four byte link number as an argument and
+returns a
+.Dv "struct ng_bridge_link_stats"
+containing statistics for the corresponding link, which must be
+currently connected:
+.Bd -literal -offset 0n
+/* Statistics structure (one for each link) */
+struct ng_bridge_link_stats {
+ uint64_t recvOctets; /* total octets rec'd on link */
+ uint64_t recvPackets; /* total pkts rec'd on link */
+ uint64_t recvMulticasts; /* multicast pkts rec'd on link */
+ uint64_t recvBroadcasts; /* broadcast pkts rec'd on link */
+ uint64_t recvUnknown; /* pkts rec'd with unknown dest addr */
+ uint64_t recvRunts; /* pkts rec'd less than 14 bytes */
+ uint64_t recvInvalid; /* pkts rec'd with bogus source addr */
+ uint64_t xmitOctets; /* total octets xmit'd on link */
+ uint64_t xmitPackets; /* total pkts xmit'd on link */
+ uint64_t xmitMulticasts; /* multicast pkts xmit'd on link */
+ uint64_t xmitBroadcasts; /* broadcast pkts xmit'd on link */
+ uint64_t loopDrops; /* pkts dropped due to loopback */
+ uint64_t loopDetects; /* number of loop detections */
+ uint64_t memoryFailures; /* times couldn't get mem or mbuf */
+};
+.Ed
+.It Dv NGM_BRIDGE_CLR_STATS
+This command takes a four byte link number as an argument and
+clears the statistics for that link.
+.It Dv NGM_BRIDGE_GETCLR_STATS
+Same as
+.Dv NGM_BRIDGE_GET_STATS ,
+but also atomically clears the statistics as well.
+.It Dv NGM_BRIDGE_GET_TABLE
+Returns the current host mapping table used to direct packets, in a
+.Dv "struct ng_bridge_host_ary" .
+.It Dv NGM_BRIDGE_SET_PERSISTENT
+This command sets the persistent flag on the node, and takes no arguments.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected. Setting the
+persistent flag via a
+.Dv NGM_BRIDGE_SET_PERSISTENT
+control message disables automatic node shutdown when the last hook gets
+disconnected.
+.Sh FILES
+.Bl -tag -width XXXXXXXX -compact
+.It Pa /usr/share/examples/netgraph/ether.bridge
+Example script showing how to set up a bridging network
+.El
+.Sh SEE ALSO
+.Xr if_bridge 4 ,
+.Xr netgraph 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_hub 4 ,
+.Xr ng_one2many 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.2 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4
new file mode 100644
index 000000000000..157a3788dbfc
--- /dev/null
+++ b/share/man/man4/ng_bt3c.4
@@ -0,0 +1,129 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_bt3c.4,v 1.3 2003/09/14 23:28:51 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2004
+.Dt NG_BT3C 4
+.Os
+.Sh NAME
+.Nm ng_bt3c
+.Nd Netgraph node type that is also a 3Com Bluetooth PC card driver
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_bt3c.h
+.Sh DESCRIPTION
+The
+.Nm btccc
+node type is both a persistent Netgraph node type and a driver for the
+3Com Bluetooth PC card (3CRWB6096-HP).
+It implements a Bluetooth HCI
+UART transport layer as per chapter H4 of the Bluetooth Specification
+Book v1.1.
+A new node is created when the card is plugged.
+.Pp
+In order to use the card one
+.Em MUST
+download the firmware first.
+Due to copyright issues the firmware cannot be provided with this driver.
+The firmware can be obtained
+from the Windows driver package that can be downloaded from the 3Com web
+site at no charge.
+The firmware name is
+.Pa BT3CPCC.BIN .
+To load the firmware into the card, use
+.Xr bt3cfw 8 .
+I am using the original firmware that came with the card on CD-ROM.
+.Pp
+.Dl "MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1"
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the device are re-assembled into HCI frames
+(according to the length).
+Full HCI frames are sent out on the hook.
+HCI frames received on
+.Dv hook
+are transmitted out.
+No modification to the data is performed in either direction.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the 3Com/HP 3CRWB6096-A PCCARD bluetooth adapter.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Dv hook
+single HCI frame contained in single
+.Vt mbuf
+structure.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_BT3C_NODE_GET_STATE
+Returns the current receiving state for the node.
+.It Dv NGM_BT3C_NODE_GET_DEBUG
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_BT3C_NODE_SET_DEBUG
+This command takes an integer argument and sets the current debug level
+for the node.
+.It Dv NGM_BT3C_NODE_GET_QLEN
+This command takes a parameter that specifies queue number and returns
+the current length of the queue for the node.
+.It Dv NGM_BT3C_NODE_SET_QLEN
+This command takes two parameters that specify the queue number and
+the maximum length of the queue and sets the maximum length of the queue for
+the node.
+.It Dv NGM_BT3C_NODE_GET_STAT
+Returns various statistic information for the node, such as: number of
+bytes (frames) sent, number of bytes (frames) received and number of
+input (output) errors.
+.It Dv NGM_BT3C_NODE_RESET_STAT
+Reset all statistic counters to zero.
+.It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE
+Download card firmware.
+.El
+.Sh SHUTDOWN
+This node shuts down when the corresponding card is un-plugged.
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr netgraph 4 ,
+.Xr pccbb 4 ,
+.Xr pcic 4 ,
+.Xr pccard.conf 5 ,
+.Xr bt3cfw 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm btccc
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+The driver is based on information obtained from
+.An Jose Orlando Pereira Aq jop@di.uminho.pt
+and disassembled the W2K driver.
diff --git a/share/man/man4/ng_btsocket.4 b/share/man/man4/ng_btsocket.4
new file mode 100644
index 000000000000..22763f98626e
--- /dev/null
+++ b/share/man/man4/ng_btsocket.4
@@ -0,0 +1,354 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_btsocket.4,v 1.7 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd July 8, 2002
+.Dt NG_BTSOCKET 4
+.Os
+.Sh NAME
+.Nm ng_btsocket
+.Nd Bluetooth sockets layer
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In sys/bitstring.h
+.In netgraph/bluetooth/include/ng_hci.h
+.In netgraph/bluetooth/include/ng_l2cap.h
+.In netgraph/bluetooth/include/ng_btsocket.h
+.Sh DESCRIPTION
+The
+.Nm
+module implements three Netgraph node types.
+Each type in its turn implements one protocol within
+.Dv PF_BLUETOOTH
+domain.
+.Sh Dv BLUETOOTH_PROTO_HCI Sh protocol
+.Ss Dv SOCK_RAW Ss HCI sockets
+Implemented by
+.Nm btsock_hci_raw
+Netgraph type.
+Raw HCI sockets allow sending of raw HCI command datagrams
+only to correspondents named in
+.Xr send 2
+calls.
+Raw HCI datagrams (HCI commands, events and data) are generally received with
+.Xr recvfrom 2 ,
+which returns the next datagram with its return address.
+Raw HCI sockets can also be used to control HCI nodes.
+.Pp
+The Bluetooth raw HCI socket address is defined as follows:
+.Bd -literal -offset indent
+/* Bluetooth version of struct sockaddr for raw HCI sockets */
+struct sockaddr_hci {
+ u_char hci_len; /* total length */
+ u_char hci_family; /* address family */
+ char hci_node[16]; /* HCI node name */
+};
+.Ed
+.Pp
+Raw HCI sockets support a number of
+.Xr ioctl 2
+requests such as:
+.Bl -tag -width indent
+.It Dv SIOC_HCI_RAW_NODE_GET_STATE
+Returns current state for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_INIT
+Turn on
+.Dq inited
+bit for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_DEBUG
+Returns current debug level for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_SET_DEBUG
+Sets current debug level for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_BUFFER
+Returns current state of data buffers for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_BDADDR
+Returns BD_ADDR for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_FEATURES
+Returns the list of features supported by hardware for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_STAT
+Returns various statistic counters for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_RESET_STAT
+Resets all statistic counters for the HCI node to zero.
+.It Dv SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE
+Remove all neighbor cache entries for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE
+Returns content of the neighbor cache for the HCI node.
+.It Dv SIOC_HCI_RAW_NODE_GET_CON_LIST
+Returns list of active baseband connections (i.e., ACL and SCO links) for
+the HCI node.
+.It SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK
+Returns current link policy settings mask for the HCI node.
+.It SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK
+Sets current link policy settings mask for the HCI node.
+.It SIOC_HCI_RAW_NODE_GET_PACKET_MASK
+Returns current packet mask for the HCI node.
+.It SIOC_HCI_RAW_NODE_SET_PACKET_MASK
+Sets current packet mask for the HCI node.
+.It SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH
+Returns current value of the role switch parameter for the HCI node.
+.It SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH
+Sets new value of the role switch parameter for the HCI node.
+.El
+.Pp
+The
+.Va net.bluetooth.hci.sockets.raw.ioctl_timeout
+variable, that can be examined and set via
+.Xr sysctl 8 ,
+controls the control request timeout (in seconds) for raw HCI sockets.
+.Pp
+Raw HCI sockets support filters.
+The application can filter certain HCI datagram types.
+For HCI event datagrams the application can set additional filter.
+The raw HCI socket filter defined as follows:
+.Bd -literal -offset indent
+/*
+ * Raw HCI socket filter.
+ *
+ * For packet mask use (1 << (HCI packet indicator - 1))
+ * For event mask use (1 << (Event - 1))
+ */
+
+struct ng_btsocket_hci_raw_filter {
+ bitstr_t bit_decl(packet_mask, 32);
+ bitstr_t bit_decl(event_mask, (NG_HCI_EVENT_MASK_SIZE * 8));
+};
+.Ed
+.Pp
+The
+.Dv SO_HCI_RAW_FILTER
+option defined at
+.Dv SOL_HCI_RAW
+level can be used to obtain via
+.Xr getsockopt 2
+or change via
+.Xr setsockopt 2
+raw HCI socket's filter.
+.Sh Dv BLUETOOTH_PROTO_L2CAP Sh protocol
+The Bluetooth L2CAP socket address is defined as follows:
+.Bd -literal -offset indent
+/* Bluetooth version of struct sockaddr for L2CAP sockets */
+struct sockaddr_l2cap {
+ u_char l2cap_len; /* total length */
+ u_char l2cap_family; /* address family */
+ uint16_t l2cap_psm; /* Protocol/Service Multiplexor */
+ bdaddr_t l2cap_bdaddr; /* address */
+};
+.Ed
+.Ss Dv SOCK_RAW Ss L2CAP sockets
+Implemented by
+.Nm btsock_l2c_raw
+Netgraph type.
+Raw L2CAP sockets do not provide access to raw L2CAP datagrams.
+These
+sockets used to control L2CAP nodes and to issue special L2CAP requests
+such as
+.Dv ECHO_REQUEST
+and
+.Dv GET_INFO
+request.
+.Pp
+Raw L2CAP sockets support number of
+.Xr ioctl 2
+requests such as:
+.Bl -tag -width indent
+.It Dv SIOC_L2CAP_NODE_GET_FLAGS
+Returns current state for the L2CAP node.
+.It Dv SIOC_L2CAP_NODE_GET_DEBUG
+Returns current debug level for the L2CAP node.
+.It Dv SIOC_L2CAP_NODE_SET_DEBUG
+Sets current debug level for the L2CAP node.
+.It Dv SIOC_L2CAP_NODE_GET_CON_LIST
+Returns list of active baseband connections (i.e., ACL links) for the L2CAP
+node.
+.It Dv SIOC_L2CAP_NODE_GET_CHAN_LIST
+Returns list of active channels for the L2CAP node.
+.It Dv SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO
+Returns current value of the auto disconnect timeout for the L2CAP node.
+.It Dv SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO
+Sets current value of the auto disconnect timeout for the L2CAP node.
+.It Dv SIOC_L2CAP_L2CA_PING
+Issues L2CAP
+.Dv ECHO_REQUEST .
+.It Dv SIOC_L2CAP_L2CA_GET_INFO
+Issues L2CAP
+.Dv GET_INFO
+request.
+.El
+.Pp
+The
+.Va net.bluetooth.l2cap.sockets.raw.ioctl_timeout
+variable, that can be examined and set via
+.Xr sysctl 8 ,
+controls the control request timeout (in seconds) for raw L2CAP sockets.
+.Ss Dv SOCK_SEQPACKET Ss L2CAP sockets
+Implemented by
+.Nm btsock_l2c
+Netgraph type.
+L2CAP sockets are either
+.Dq active
+or
+.Dq passive .
+Active sockets initiate connections to passive sockets.
+By default, L2CAP sockets are created active; to create a passive socket, the
+.Xr listen 2
+system call must be used after binding the socket with the
+.Xr bind 2
+system call.
+Only passive sockets may use the
+.Xr accept 2
+call to accept incoming connections.
+Only active sockets may use the
+.Xr connect 2
+call to initiate connections.
+.Pp
+L2CAP sockets support
+.Dq "wildcard addressing" .
+In this case, socket must be bound to
+.Dv NG_HCI_BDADDR_ANY
+address.
+Note that PSM (Protocol/Service Multiplexor) field is always required.
+Once a connection has been established, the socket's address is
+fixed by the peer entity's location.
+The address assigned to the socket is
+the address associated with the Bluetooth device through which packets are
+being transmitted and received, and PSM (Protocol/Service Multiplexor).
+.Pp
+L2CAP sockets support number of options defined at
+.Dv SOL_L2CAP
+level which can be set with
+.Xr setsockopt 2
+and tested with
+.Xr getsockopt 2 :
+.Bl -tag -width indent
+.It Dv SO_L2CAP_IMTU
+Get (set) maximum payload size the local socket is capable of accepting.
+.It Dv SO_L2CAP_OMTU
+Get maximum payload size the remote socket is capable of accepting.
+.It Dv SO_L2CAP_IFLOW
+Get incoming flow specification for the socket.
+.Bf -emphasis
+Not implemented.
+.Ef
+.It Dv SO_L2CAP_OFLOW
+Get (set) outgoing flow specification for the socket.
+.Bf -emphasis
+Not implemented.
+.Ef
+.It Dv SO_L2CAP_FLUSH
+Get (set) value of the flush timeout.
+.Bf -emphasis
+Not implemented.
+.Ef
+.El
+.Sh Dv BLUETOOTH_PROTO_RFCOMM Sh protocol
+The Bluetooth RFCOMM socket address is defined as follows:
+.Bd -literal -offset indent
+/* Bluetooth version of struct sockaddr for RFCOMM sockets */
+struct sockaddr_rfcomm {
+ u_char rfcomm_len; /* total length */
+ u_char rfcomm_family; /* address family */
+ bdaddr_t rfcomm_bdaddr; /* address */
+ uint8_t rfcomm_channel; /* channel */
+};
+.Ed
+.Ss Dv SOCK_STREAM Ss RFCOMM sockets
+Note that RFCOMM sockets do not have associated Netgraph node type.
+RFCOMM sockets are implemented as additional layer on top of L2CAP sockets.
+RFCOMM sockets are either
+.Dq active
+or
+.Dq passive .
+Active sockets initiate connections to passive sockets.
+By default, RFCOMM sockets are created active; to create a passive socket, the
+.Xr listen 2
+system call must be used after binding the socket with the
+.Xr bind 2
+system call.
+Only passive sockets may use the
+.Xr accept 2
+call to accept incoming connections.
+Only active sockets may use the
+.Xr connect 2
+call to initiate connections.
+.Pp
+RFCOMM sockets support
+.Dq "wildcard addressing" .
+In this case, socket must be bound to
+.Dv NG_HCI_BDADDR_ANY
+address.
+Note that RFCOMM channel field is always required.
+Once a connection has been established, the socket's address is fixed by the
+peer entity's location.
+The address assigned to the socket is the address associated with the
+Bluetooth device through which packets are being transmitted and received,
+and RFCOMM channel.
+.Pp
+The following options, which can be tested with
+.Xr getsockopt 2
+call, are defined at
+.Dv SOL_RFCOMM
+level for RFCOMM sockets:
+.Bl -tag -width indent
+.It Dv SO_RFCOMM_MTU
+Returns the maximum transfer unit size (in bytes) for the underlying RFCOMM
+channel.
+Note that application still can write/read bigger chunks to/from the socket.
+.It Dv SO_RFCOMM_FC_INFO
+Return the flow control information for the underlying RFCOMM channel.
+.El
+.Pp
+The
+.Va net.bluetooth.rfcomm.sockets.stream.timeout
+variable, that can be examined and set via
+.Xr sysctl 8 ,
+controls the connection timeout (in seconds) for RFCOMM sockets.
+.Sh HOOKS
+These node types support hooks with arbitrary names (as long as they are
+unique) and always accept hook connection requests.
+.Sh NETGRAPH CONTROL MESSAGES
+These node types support the generic control messages.
+.Sh SHUTDOWN
+These nodes are persistent and cannot be shut down.
+.Sh SEE ALSO
+.Xr btsockstat 1 ,
+.Xr socket 2 ,
+.Xr netgraph 4 ,
+.Xr ng_bluetooth 4 ,
+.Xr ng_hci 4 ,
+.Xr ng_l2cap 4 ,
+.Xr ngctl 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+module was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+Most likely.
+Please report if found.
diff --git a/share/man/man4/ng_car.4 b/share/man/man4/ng_car.4
new file mode 100644
index 000000000000..79967e72dd5e
--- /dev/null
+++ b/share/man/man4/ng_car.4
@@ -0,0 +1,214 @@
+.\" Copyright (c) 2005 Nuno Antunes <nuno.antunes@gmail.com>
+.\" Copyright (c) 2007 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 11, 2007
+.Dt NG_CAR 4
+.Os
+.Sh NAME
+.Nm ng_car
+.Nd Committed Access Rate netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_car.h
+.Sh DESCRIPTION
+The
+.Nm car
+node type limits traffic flowing through it using:
+.Pp
+.Bl -bullet -compact
+.It
+Single rate three color marker as described in RFC 2697,
+.It
+Two rate three color marker as described in RFC 2698,
+.It
+RED-like rate limit algorithm used by Cisco,
+.It
+Traffic shaping with RED.
+.El
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Va upper
+Hook leading to upper layer protocols.
+.It Va lower
+Hook leading to lower layer protocols.
+.El
+.Pp
+Traffic flowing from
+.Va upper
+to
+.Va lower
+is considered
+.Sy downstream
+traffic.
+Traffic flowing from
+.Va lower
+to
+.Va upper
+is considered
+.Sy upstream
+traffic.
+.Sh MODES OF OPERATION
+Each hook can operate in one of the following modes:
+.Bl -tag -width indent
+.It Dv NG_CAR_SINGLE_RATE
+Single rate three color marker as described in RFC 2697.
+Committed burst packets are counted as green, extended burst packets are
+counted as yellow and exceeding packets are counted as red.
+Committed burst getting refilled with CIR (Committed Information Rate) speed.
+When it is full, exceeded burst getting refilled.
+.It Dv NG_CAR_DOUBLE_RATE
+Two rate three color marker as described in RFC 2698.
+Committed burst packets are counted as green, peak burst packets are counted
+as yellow and exceeding packets are counted as red.
+Committed burst getting refilled with CIR speed.
+Peak burst getting refilled with PIR (Peak Information Rate) speed at the
+same time.
+.It Dv NG_CAR_RED
+Similar to
+.Dv NG_CAR_SINGLE_RATE ,
+but with different understanding of extended burst.
+When normal burst exceeded and extended burst is used, packets are counted
+red with probability equal to part of extended burst consumed.
+Extended burst getting refilled first.
+When it is full, committed burst getting refilled.
+This behavior is similar to RED active queue management algorithm.
+.Pp
+This algorithm is more polite to the TCP traffic than NG_CAR_SINGLE_RATE.
+.It Dv NG_CAR_SHAPE
+Committed burst packets are counted as green, exceeding packets are delayed
+by queue with RED management and counted as yellow.
+Packets dropped by queue counted as red.
+Queue parameters are hardcoded: length 99 packets, min_th 8 packets, max_p 100%.
+.Pp
+Traffic shaping is much more polite to the TCP traffic than rate limit on
+links with bandwidth * delay product less than 6-8 TCP segments, but it
+consumes additional system resources for queue processing.
+.El
+By default, all information rates are measured in bits per second and bursts
+are measured in bytes. But when NG_CAR_COUNT_PACKETS option is enabled,
+rates are measured in packets per second and bursts are in packets.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages and the following
+specific messages.
+.Bl -tag -width indent
+.It Dv NGM_CAR_SET_CONF Pq Li setconf
+Set node configuration to the specified at
+.Vt "struct ng_car_bulkconf"
+.It Dv NGM_CAR_GET_CONF Pq Li getconf
+Return current node configuration as
+.Vt "struct ng_car_bulkconf"
+.Bd -literal
+struct ng_car_hookconf {
+ uint64_t cbs; /* Committed burst size */
+ uint64_t ebs; /* Exceeded/Peak burst size */
+ uint64_t cir; /* Committed information rate */
+ uint64_t pir; /* Peak information rate */
+ uint8_t green_action; /* Action for green packets */
+ uint8_t yellow_action; /* Action for yellow packets */
+ uint8_t red_action; /* Action for red packets */
+ uint8_t mode; /* operation mode */
+ uint8_t opt; /* mode options */
+};
+
+/* possible actions (..._action) */
+enum {
+ NG_CAR_ACTION_FORWARD = 1,
+ NG_CAR_ACTION_DROP
+};
+
+/* operation modes (mode) */
+enum {
+ NG_CAR_SINGLE_RATE = 0,
+ NG_CAR_DOUBLE_RATE,
+ NG_CAR_RED,
+ NG_CAR_SHAPE
+};
+
+/* mode options (opt) */
+#define NG_CAR_COUNT_PACKETS 2
+
+struct ng_car_bulkconf {
+ struct ng_car_hookconf upstream;
+ struct ng_car_hookconf downstream;
+};
+.Ed
+.It Dv NGM_CAR_GET_STATS Pq Li getstats
+Return node statistics as
+.Vt "struct ng_car_bulkstats"
+.Bd -literal
+struct ng_car_hookstats {
+ uint64_t passed_pkts;
+ uint64_t droped_pkts;
+ uint64_t green_pkts;
+ uint64_t yellow_pkts;
+ uint64_t red_pkts;
+ uint64_t errors;
+};
+
+struct ng_car_bulkstats {
+ struct ng_car_hookstats upstream;
+ struct ng_car_hookstats downstream;
+};
+.Ed
+.It Dv NGM_CAR_CLR_STATS Pq Li clrstats
+Clear node statistics.
+.It Dv NGM_CAR_GETCLR_STATS Pq Li getclrstats
+Atomically return and clear node statistics.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+Limit outgoing data rate over fxp0 Ethernet interface to 20Mbit/s
+and incoming packet rate to 5000pps.
+.Bd -literal -offset indent
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer fxp0: car lower lower
+ name fxp0:lower fxp0_car
+ connect fxp0: fxp0_car: upper upper
+ msg fxp0_car: setconf { downstream={ cir=20000000 cbs=2500000 ebs=2500000 greenAction=1 yellowAction=1 redAction=2 mode=2 } upstream={ cir=5000 cbs=100 ebs=100 greenAction=1 yellowAction=1 redAction=2 mode=2 opt=2 } }
+SEQ
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Rs
+.%A J. Heinanen
+.%T "A Single Rate Three Color Marker"
+.%O RFC 2697
+.Re
+.Rs
+.%A J. Heinanen
+.%T "A Two Rate Three Color Marker"
+.%O RFC 2698
+.Re
+.Sh AUTHORS
+.An Nuno Antunes Aq nuno.antunes@gmail.com
+.An Alexander Motin Aq mav@FreeBSD.org
+.Sh BUGS
+At this moment only DROP and FORWARD actions are implemented.
diff --git a/share/man/man4/ng_ccatm.4 b/share/man/man4/ng_ccatm.4
new file mode 100644
index 000000000000..1010c0fba5f3
--- /dev/null
+++ b/share/man/man4/ng_ccatm.4
@@ -0,0 +1,324 @@
+.\"
+.\" Copyright (c) 2001-2004
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\" Copyright (c) 2005
+.\" Hartmut Brandt.
+.\" All rights reserved.
+.\"
+.\" Author: Harti Brandt <harti@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 10, 2005
+.Dt NG_CCATM 4
+.Os
+.Sh NAME
+.Nm ng_ccatm
+.Nd "ATM Call Control netgraph node type"
+.Sh SYNOPSIS
+.In netnatm/unimsg.h
+.In netnatm/msg/unistruct.h
+.In netnatm/sig/unidef.h
+.In netnatm/api/unisap.h
+.In netnatm/api/atmapi.h
+.In netnatm/api/ccatm.h
+.In netgraph.h
+.In netgraph/ng_uni.h
+.In netgraph/ng_ccatm.h
+.Sh DESCRIPTION
+The
+.Nm
+node implements the API specified by the ATM Forum for access to ATM services
+(see ATM-Forum document
+.Pa af-saa-0108 ) .
+This document specifies the semantics
+of the API, not the exact language binding.
+For this reason, it is expected that
+this implementation is neither compile-time nor binary compatible with
+other implementations of this API.
+It should, however, be fairly straightforward
+to convert between different API implementations.
+.Pp
+This node is usually stacked on top of one or more UNI nodes (see
+.Xr ng_uni 4 ) .
+Each of these hooks appears as a
+.Dq port
+to the user of the node.
+It also has one hook connected to the ILMI daemon for management purposes.
+.Pp
+The node is removed when it receives a
+.Dv NGM_SHUTDOWN
+messages or when all hooks are disconnected.
+.Sh HOOKS
+The node understands a number of hooks with predefined names and an
+unlimited number of hooks for user connections.
+The predefined names are:
+.Bl -tag -width ".Va orphans"
+.It Va uni Ns Ar NNN
+These hooks stack the
+.Nm
+node on top of a UNI stack.
+The node expects the interface on these hooks
+to conform to the upper interface specified in
+.Xr ng_uni 4 .
+These hooks are forced into queuing mode, so that there are no circular
+calls from call control to UNI and UNI back to call control.
+The
+.Ar NNN
+in the hook name is the decimal port number and should not be zero.
+The port number is a 32-bit unsigned integer.
+.It Va manage
+This hook should be connected to the ILMI daemon.
+No data is ever sent on this hook and all received data is discarded.
+The hook is used to send control messages along.
+.It Va dump
+On receipt of a
+.Dv NGM_CCATM_DUMP
+command a textual description of the current state of the node is sent
+out of this hook.
+This text is sent as one large message consisting of more
+than one
+.Vt mbuf .
+.El
+.Pp
+All other hook names are taken to be user hooks and correspond to an
+ATM endpoint as specified in the ATM Forum document.
+The interface on these hooks is defined in
+.In atmapi.h
+and uses a structure
+.Bd -literal
+struct ccatm_op {
+ uint32_t op; /* request code */
+ u_char data[]; /* optional data */
+};
+.Ed
+.Pp
+This structure is followed directly by the data for the operation.
+The opcode is one of the following:
+.Bd -literal
+enum atmop {
+ ATMOP_RESP,
+ ATMOP_ABORT_CONNECTION,
+ ATMOP_ACCEPT_INCOMING_CALL,
+ ATMOP_ADD_PARTY,
+ ATMOP_ADD_PARTY_REJECT,
+ ATMOP_ADD_PARTY_SUCCESS,
+ ATMOP_ARRIVAL_OF_INCOMING_CALL,
+ ATMOP_CALL_RELEASE,
+ ATMOP_CONNECT_OUTGOING_CALL,
+ ATMOP_DROP_PARTY,
+ ATMOP_GET_LOCAL_PORT_INFO,
+ ATMOP_P2MP_CALL_ACTIVE,
+ ATMOP_P2P_CALL_ACTIVE,
+ ATMOP_PREPARE_INCOMING_CALL,
+ ATMOP_PREPARE_OUTGOING_CALL,
+ ATMOP_QUERY_CONNECTION_ATTRIBUTES,
+ ATMOP_REJECT_INCOMING_CALL,
+ ATMOP_SET_CONNECTION_ATTRIBUTES,
+ ATMOP_WAIT_ON_INCOMING_CALL,
+ ATMOP_SET_CONNECTION_ATTRIBUTES_X,
+ ATMOP_QUERY_CONNECTION_ATTRIBUTES_X,
+ ATMOP_QUERY_STATE
+};
+.Ed
+.Pp
+These codes correspond directly to the operations specified in the ATM
+Forum document with the following exceptions:
+.Bl -tag -width indent
+.It Dv ATMOP_RESP
+As discussed in
+.Xr ng_uni 4 ,
+this is used to
+.Dq synchronify
+the interface.
+The argument is a
+.Bd -literal
+struct atm_resp {
+ int32_t resp;
+ uint32_t data; /* type of attached data */
+};
+.Ed
+.Pp
+If the response code
+.Va resp
+is zero, the node has accepted the user request.
+If something goes wrong,
+.Va resp
+contains an error code.
+For requests that return data,
+.Va data
+contains a code describing the type of data and the data itself
+starts immediately after the structure.
+.It Dv ATMOP_QUERY_CONNECTION_ATTRIBUTES_X
+This is the same as
+.Dv ATMOP_QUERY_CONNECTION_ATTRIBUTES
+except that it allows to query several attributes
+within one request.
+.It Dv ATMOP_SET_CONNECTION_ATTRIBUTES_X
+This is the same as
+.Dv ATMOP_SET_CONNECTION_ATTRIBUTES
+except that it allows to set several attributes
+within one request.
+The list of attributes is followed directly by the attributes in the same
+order as they appear in the list.
+.El
+.Pp
+If a user hook is disconnected, an active connection on that hook is released.
+Incoming connections waiting to be accepted are reoffered to other
+listening hooks or rejected.
+.Sh CONTROL MESSAGES
+Besides the generic messages the node understands the following special
+messages:
+.Bl -tag -width indent
+.It Dv NGM_CCATM_DUMP
+This causes the internal state of the node to be dumped in ASCII to the
+.Va dump
+hook.
+.It Dv NGM_CCATM_STOP
+This message causes all connections on that port to be aborted (not released!\&)
+and all ATM endpoints which are bound to that port to be closed.
+It stops processing of all messages from the UNI stack on that port UNI stack.
+The argument is a
+.Bd -literal
+struct ngm_ccatm_port {
+ uint32_t port;
+};
+.Ed
+.Pp
+.It Dv NGM_CCATM_START
+Start processing on the port.
+The argument is a
+.Vt ngm_ccatm_port
+structure.
+.It Dv NGM_CCATM_CLEAR
+This message takes a
+.Vt ngm_ccatm_port
+structure and clears all prefixes and addresses on that port.
+If the port number is zero, all ports are cleared.
+.It Dv NGM_CCATM_GET_ADDRESSES
+Get the list of all registered addresses on the given port.
+The argument is a
+.Vt ngm_ccatm_port
+structure and the result is a
+.Vt ngm_ccatm_get_addresses
+structure:
+.Bd -literal
+struct ngm_ccatm_get_addresses {
+ uint32_t count;
+ struct ngm_ccatm_address_req addr[0];
+};
+struct ngm_ccatm_address_req {
+ uint32_t port;
+ struct uni_addr addr;
+};
+.Ed
+.Pp
+If the
+.Va port
+field is zero in the request, all addresses on all ports
+are returned.
+If it is not zero, only the addresses on that port are reported.
+The number of addresses is returned in the
+.Va count
+field.
+.It Dv NGM_CCATM_ADDRESS_REGISTERED
+This message is used by ILMI to inform the
+.Nm
+node that a previous address registration request was successful.
+This causes the node to activate that address.
+The argument to the message is a
+.Vt ngm_ccatm_address_req
+structure.
+.It Dv NGM_CCATM_ADDRESS_UNREGISTERED
+This message is used by ILMI to inform the
+.Nm
+node that an address has been unregistered.
+The node clears that address from its tables.
+The argument is a
+.Vt ngm_ccatm_address_req
+structure.
+.It Dv NGM_CCATM_SET_PORT_PARAM
+This request sets the parameters on the given port.
+The argument is a
+.Bd -literal
+struct ngm_ccatm_atm_port {
+ uint32_t port; /* port for which to set parameters */
+ uint32_t pcr; /* port peak cell rate */
+ uint32_t max_vpi_bits;
+ uint32_t max_vci_bits;
+ uint32_t max_svpc_vpi;
+ uint32_t max_svcc_vpi;
+ uint32_t min_svcc_vci;
+ uint8_t esi[6];
+ uint32_t num_addr;
+};
+.Ed
+.Pp
+This should be used only by ILMI and when that port is stopped and the
+address and prefix tables of that port are empty.
+The
+.Va num_addr
+field is ignored.
+.It Dv NGM_CCATM_GET_PORT_PARAM
+Retrieve the parameters of the given port.
+The argument is a
+.Vt ngm_ccatm_port
+and the result a
+.Vt ngm_ccatm_atm_port .
+.It Dv NGM_CCATM_GET_PORTLIST
+Get a list of all available ports on that node.
+This is returned as a
+.Bd -literal
+struct ngm_ccatm_portlist {
+ uint32_t nports;
+ uint32_t ports[];
+};
+.Ed
+.It Dv NGM_CCATM_GETSTATE
+Return the state of a port.
+The argument is a
+.Vt "struct ngm_ccatm_port"
+and the return values as a
+.Vt uint32_t .
+.It Dv NGM_CCATM_SETLOG
+This requests sets a new logging level and returns the previous one.
+The argument is either a
+.Vt uint32_t
+in which case it specifies the new logging level, or may be empty
+in which case just the old level is returned as a
+.Vt uint32_t .
+.It Dv NGM_CCATM_RESET
+Reset the node.
+This is allowed only if the number of user hooks and connected UNI stacks is
+zero.
+.It Dv NGM_CCATM_GET_EXSTAT
+Return extended status information from the node.
+.El
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_uni 4 ,
+.Xr ngctl 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/ng_cisco.4 b/share/man/man4/ng_cisco.4
new file mode 100644
index 000000000000..e4300a040b9c
--- /dev/null
+++ b/share/man/man4/ng_cisco.4
@@ -0,0 +1,184 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_cisco.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_CISCO 4
+.Os
+.Sh NAME
+.Nm ng_cisco
+.Nd Cisco HDLC protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In netgraph/ng_cisco.h
+.Sh DESCRIPTION
+The
+.Nm cisco
+node type performs encapsulation and de-encapsulation of packets
+using the Cisco HDLC protocol.
+This is a fairly simple
+protocol for the transmission of packets across
+high speed synchronous lines.
+Each packet is prepended with
+an Ethertype, indicating the protocol.
+There is also a
+.Dq keep alive
+and an
+.Dq inquire
+capability.
+.Pp
+The
+.Dv downstream
+hook should connect to the synchronous line.
+On the other side
+of the node are the
+.Dv inet ,
+.Dv inet6 ,
+.Dv atalk ,
+and
+.Dv ipx
+hooks, which transmit and receive raw IP, IPv6, AppleTalk, and IPX packets,
+respectively.
+Typically these hooks would connect to the corresponding
+hooks on an
+.Xr ng_iface 4
+type node.
+.Sh IP Configuration
+In order to function properly for IP traffic, the node must be informed
+of the local IP address and netmask setting.
+This is because the protocol
+includes an
+.Dq inquire
+packet which we must be prepared to answer.
+There are two ways to accomplish this, manually and automatically.
+.Pp
+Whenever such an inquire packet is received, the node sends a
+.Dv NGM_CISCO_GET_IPADDR
+control message to the peer node connected to the
+.Dv inet
+hook (if any).
+If the peer responds, then that response is used.
+This is the automatic method.
+.Pp
+If the peer does not respond, the node falls back on its cached value
+for the IP address and netmask.
+This cached value can be set at any time
+with a
+.Dv NGM_CISCO_SET_IPADDR
+message, and this is the manual method.
+.Pp
+If the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 4
+node, as is usually the case, then configuration is automatic as the
+.Xr ng_iface 4
+understands the
+.Dv NGM_CISCO_GET_IPADDR
+message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobarbazio
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv inet
+IP hook.
+.It Dv inet6
+IPv6 hook.
+.It Dv atalk
+AppleTalk hook.
+.It Dv ipx
+IPX hook
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_CISCO_SET_IPADDR
+This command takes an array of two
+.Dv "struct in_addr"
+arguments.
+The first is the IP address of the corresponding interface
+and the second is the netmask.
+.It Dv NGM_CISCO_GET_IPADDR
+This command returns the IP configuration in the same format used by
+.Dv NGM_CISCO_SET_IPADDR .
+This command is also
+.Em sent
+by this node type to the
+.Dv inet
+peer whenever an IP address inquiry packet is received.
+.It Dv NGM_CISCO_GET_STATUS
+Returns a
+.Dv "struct ngciscostat" :
+.Bd -literal -offset 4n
+struct ngciscostat {
+ uint32_t seq_retries; /* # unack'd retries */
+ uint32_t keepalive_period; /* in seconds */
+};
+.Ed
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_iface 4 ,
+.Xr ngctl 8
+.Rs
+.%A D. Perkins
+.%T "Requirements for an Internet Standard Point-to-Point Protocol"
+.%O RFC 1547
+.Re
+.Sh LEGAL
+.Tn Cisco
+is a trademark of Cisco Systems, Inc.
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org ,
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+Not all of the functionality has been implemented.
+For example,
+the node does not support querying the remote end for its IP address
+and netmask.
diff --git a/share/man/man4/ng_deflate.4 b/share/man/man4/ng_deflate.4
new file mode 100644
index 000000000000..11dc132074c6
--- /dev/null
+++ b/share/man/man4/ng_deflate.4
@@ -0,0 +1,158 @@
+.\"
+.\" Author: Alexander Motin <mav@alkar.net>
+.\"
+.\" Copyright (c) 2006, Alexander Motin <mav@alkar.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 2006
+.Dt NG_DEFLATE 4
+.Os
+.Sh NAME
+.Nm ng_deflate
+.Nd Deflate PPP compression (RFC 1979) netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_deflate.h
+.Sh DESCRIPTION
+The
+.Nm deflate
+node type implements the Deflate sub-protocols of the Compression Control
+Protocol (CCP).
+.Pp
+The node has two hooks,
+.Va comp
+for compression and
+.Va decomp
+for decompression.
+Only one of them can be connected at the same time, specifying node's
+operation mode.
+Typically that hooks would be connected to the
+.Xr ng_ppp 4
+node type hook of the same name.
+Corresponding
+.Xr ng_ppp 4
+node hook must be switched to
+.Dv NG_PPP_DECOMPRESS_FULL
+mode to permit sending uncompressed frames.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width decomp
+.It Va comp
+Connection to
+.Xr ng_ppp 4
+.Va comp
+hook.
+Incoming frames are compressed (if possible) and sent back out the same hook.
+.It Va decomp
+Connection to
+.Xr ng_ppp 4
+.Va decomp
+hook.
+Incoming frames are decompressed (if they are compressed), and sent
+back out the same hook.
+.El
+.Pp
+Only one hook can be connected at the same time, specifying node's
+operation mode.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_DEFLATE_CONFIG Pq Li config
+This command resets and configures the node for a session
+(i.e., for compression or decompression).
+This command takes a
+.Vt "struct ng_deflate_config"
+as an argument:
+.Bd -literal -offset 0n
+struct ng_deflate_config {
+ u_char enable; /* node enabled */
+ u_char windowBits; /* log2(Window size) */
+};
+.Ed
+The
+.Fa enabled
+field enables traffic flow through the node.
+The
+.Fa windowBits
+specify compression windows size as negotiated by the
+Compression Control Protocol (CCP) in PPP.
+.It Dv NGM_DEFLATE_RESETREQ Pq Li resetreq
+This message contains no arguments, and is bi-directional.
+If an error is detected during decompression, this message is sent by the
+node to the originator of the
+.Dv NGM_DEFLATE_CONFIG
+message that initiated the session.
+The receiver should respond by sending a PPP CCP Reset-Request to the peer.
+.Pp
+This message may also be received by this node type when a CCP Reset-Request
+or Reset-Ack is received by the local PPP entity.
+The node will respond by flushing its compression state so the sides
+can resynchronize.
+.It Dv NGM_DEFLATE_GET_STATS Pq Li getstats
+This control message obtains statistics for a given hook.
+The statistics are returned in
+.Vt "struct ng_deflate_stats" :
+.Bd -literal
+struct ng_deflate_stats {
+ uint64_t FramesPlain;
+ uint64_t FramesComp;
+ uint64_t FramesUncomp;
+ uint64_t InOctets;
+ uint64_t OutOctets;
+ uint64_t Errors;
+};
+.Ed
+.It Dv NGM_DEFLATE_CLR_STATS Pq Li clrstats
+This control message clears statistics for a given hook.
+.It Dv NGM_DEFLATE_GETCLR_STATS Pq Li getclrstats
+This control message obtains and clears statistics for a given hook.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when hook have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 4 ,
+.Xr ngctl 8
+.Rs
+.%A J. Woods
+.%T "PPP Deflate Protocol"
+.%O RFC 1979
+.Re
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Sh AUTHORS
+.An Alexander Motin Aq mav@alkar.net
+.Sh BUGS
+Due to nature of netgraph PPP implementation there are possible race conditions
+between data packet and ResetAck CCP packet in case of packet loss. As result,
+packet loss can produce bigger performance degradation than supposed by protocol.
diff --git a/share/man/man4/ng_device.4 b/share/man/man4/ng_device.4
new file mode 100644
index 000000000000..a03a03b6b0c2
--- /dev/null
+++ b/share/man/man4/ng_device.4
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2002 Mark Santcroos <marks@ripe.net>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 19, 2004
+.Dt NG_DEVICE 4
+.Os
+.Sh NAME
+.Nm ng_device
+.Nd device netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_device.h
+.Sh DESCRIPTION
+A
+.Nm device
+node is both a netgraph node and a system device interface.
+When a
+.Nm device
+node is created, a new device entry appears which is accessible via the
+regular file operators such as
+.Xr open 2 ,
+.Xr close 2 ,
+.Xr read 2 ,
+.Xr write 2 ,
+etc.
+.Pp
+The first node is created as
+.Pa /dev/ngd0 ,
+all subsequent nodes
+.Pa /dev/ngd1 , /dev/ngd2 ,
+etc.
+.Sh HOOKS
+A
+.Nm device
+node has a single hook with an arbitrary name.
+All data coming in over the hook will be presented to the device
+for
+.Xr read 2 .
+All data coming in from the device entry by
+.Xr write 2
+will be forwarded to the hook.
+.Sh CONTROL MESSAGES
+The
+.Nm device
+node supports one non-generic control message:
+.Bl -tag -width 3n
+.It Dv NGM_DEVICE_GET_DEVNAME
+Returns device name corresponding to a node.
+.El
+.\" Additionally, the node accepts
+.\" .Xr ioctl 2 Ns s
+.\" from the device entry.
+.\" These will be encapsulated into
+.\" .Xr netgraph 4
+.\" messages and send out to the hook.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or upon hook disconnection.
+The associated device entry is removed and becomes available
+for use by future
+.Nm device
+nodes.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm device
+node type was first implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Mark Santcroos Aq marks@ripe.net
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
diff --git a/share/man/man4/ng_echo.4 b/share/man/man4/ng_echo.4
new file mode 100644
index 000000000000..f502c621ac00
--- /dev/null
+++ b/share/man/man4/ng_echo.4
@@ -0,0 +1,73 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_echo.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_ECHO 4
+.Os
+.Sh NAME
+.Nm ng_echo
+.Nd netgraph echo node type
+.Sh SYNOPSIS
+.In netgraph/ng_echo.h
+.Sh DESCRIPTION
+The
+.Nm echo
+node type reflects all data and control messages back to the sender.
+This node type is used for testing and debugging.
+.Sh HOOKS
+A
+.Nm echo
+node accepts any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Any other control messages are reflected back to the sender.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_hole 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_eiface.4 b/share/man/man4/ng_eiface.4
new file mode 100644
index 000000000000..66991533c352
--- /dev/null
+++ b/share/man/man4/ng_eiface.4
@@ -0,0 +1,122 @@
+.\" Copyright (c) 2004 Gleb Smirnoff
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 3, 2005
+.Dt NG_EIFACE 4
+.Os
+.Sh NAME
+.Nm ng_eiface
+.Nd "generic Ethernet interface netgraph node type"
+.Sh SYNOPSIS
+.In netgraph/ng_eiface.h
+.Sh DESCRIPTION
+The
+.Vt eiface
+netgraph node implements the generic Ethernet interface.
+When
+.Vt eiface
+node is created, a new interface appears which is accessible via
+.Xr ifconfig 8 .
+These interfaces are named
+.Dq Li ngeth0 ,
+.Dq Li ngeth1 ,
+etc.
+When a node is shut down, the corresponding interface is removed,
+and the interface name becomes available for reuse by future
+.Vt eiface
+nodes.
+New nodes always take the first unused interface.
+.Sh HOOKS
+An
+.Vt eiface
+node has a single hook named
+.Va ether ,
+which should be connected to the
+Ethernet downstream, for example, to the
+.Xr ng_vlan 4
+node.
+Packets transmitted via the interface flow out this hook.
+Similarly, packets received on the hook go to the protocol stack as
+packets received by any real Ethernet interface.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_EIFACE_SET Pq Li set
+Set link-level address of the interface.
+Requires
+.Vt "struct ether_addr"
+as an argument.
+This message also has an
+.Tn ASCII
+version, called
+.Dq Li set ,
+which requires as an argument an
+.Tn ASCII
+string consisting of 6 colon-separated hex digits.
+.It Dv NGM_EIFACE_GET_IFNAME Pq Li getifname
+Return the name of the associated interface as a
+.Dv NUL Ns -terminated
+.Tn ASCII
+string.
+.It Dv NGM_EIFACE_GET_IFADDRS
+Return the list of link-level addresses associated with the node.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message.
+The associated interface is removed and its name becomes
+available for reuse by future
+.Vt eiface
+nodes.
+.Pp
+Unlike most other node types, an
+.Vt eiface
+node does
+.Em not
+go away when all hooks have been disconnected; rather, and explicit
+.Dv NGM_SHUTDOWN
+control message is required.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_vlan 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Vt eiface
+node type was implemented in
+.Fx 4.6 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Vt eiface
+node type was written by
+.An Vitaly V Belekhov .
+This manual page was written by
+.An Gleb Smirnoff .
diff --git a/share/man/man4/ng_etf.4 b/share/man/man4/ng_etf.4
new file mode 100644
index 000000000000..bc42726cbf38
--- /dev/null
+++ b/share/man/man4/ng_etf.4
@@ -0,0 +1,155 @@
+.\"
+.\" Copyright (c) 2001, FreeBSD Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 16, 2006
+.Dt NG_ETF 4
+.Os
+.Sh NAME
+.Nm ng_etf
+.Nd Ethertype filtering netgraph node type
+.Sh SYNOPSIS
+.In netgraph.h
+.In netgraph/ng_etf.h
+.Sh DESCRIPTION
+The
+.Nm etf
+node type multiplexes and filters data between hooks on the basis
+of the ethertype found in an Ethernet header, presumed to be in the
+first 14 bytes of the data.
+Incoming Ethernet frames are accepted on the
+.Em downstream
+hook and if the ethertype matches a value which the node has been configured
+to filter, the packet is forwarded out the hook which was identified
+at the time that value was configured.
+If it does not match a configured
+value, it is passed to the
+.Em nomatch
+hook.
+If the
+.Em nomatch
+hook is not connected, the packet is dropped.
+.Pp
+Packets travelling in the other direction (towards the
+.Em downstream
+hook) are also examined and filtered.
+If a packet has an ethertype that matches one of the values configured
+into the node, it must have arrived in on the hook for which that value
+was configured, otherwise it will be discarded.
+Ethertypes of values other
+than those configured by the control messages must have arrived via the
+.Em nomatch
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Em downstream"
+.It Em downstream
+Typically this hook would be connected to a
+.Xr ng_ether 4
+node, using the
+.Em lower
+hook.
+.It Em nomatch
+Typically this hook would also be connected to an
+.Xr ng_ether 4
+type node using the
+.Em upper
+hook.
+.It Aq Em "any legal name"
+Any other hook name will be accepted and can be used as the match target
+of an ethertype.
+Typically this hook would be attached to
+a protocol handling node that requires and generates packets
+with a particular set of ethertypes.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width 4n
+.It Dv NGM_ETF_GET_STATUS
+This command returns a
+.Vt "struct ng_etfstat"
+containing node statistics for packet counts.
+.It Dv NGM_ETF_SET_FILTER
+Sets the a new ethertype filter into the node and specifies the hook to and
+from which packets of that type should use.
+The hook and ethertype
+are specified in a structure of type
+.Vt "struct ng_etffilter" :
+.Bd -literal -offset 4n
+struct ng_etffilter {
+ char matchhook[NG_HOOKSIZ]; /* hook name */
+ uint16_t ethertype; /* catch these */
+};
+.Ed
+.El
+.Sh EXAMPLES
+Using
+.Xr ngctl 8
+it is possible to set a filter in place from the command line
+as follows:
+.Bd -literal -offset 4n
+#!/bin/sh
+ETHER_IF=fxp0
+MATCH1=0x834
+MATCH2=0x835
+cat <<DONE >/tmp/xwert
+# Make a new ethertype filter and attach to the Ethernet lower hook.
+# first remove left over bits from last time.
+shutdown ${ETHER_IF}:lower
+mkpeer ${ETHER_IF}: etf lower downstream
+# Give it a name to easily refer to it.
+name ${ETHER_IF}:lower etf
+# Connect the nomatch hook to the upper part of the same interface.
+# All unmatched packets will act as if the filter is not present.
+connect ${ETHER_IF}: etf: upper nomatch
+DONE
+ngctl -f /tmp/xwert
+
+# something to set a hook to catch packets and show them.
+echo "Unrecognised packets:"
+nghook -a etf: newproto &
+# Filter two random ethertypes to that hook.
+ngctl 'msg etf: setfilter { matchhook="newproto" ethertype=${MATCH1} }
+ngctl 'msg etf: setfilter { matchhook="newproto" ethertype=${MATCH2} }
+DONE
+.Ed
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ether 4 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_ether.4 b/share/man/man4/ng_ether.4
new file mode 100644
index 000000000000..6ca5c11bbbf6
--- /dev/null
+++ b/share/man/man4/ng_ether.4
@@ -0,0 +1,241 @@
+.\" Copyright (c) 2000 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 23, 2011
+.Dt NG_ETHER 4
+.Os
+.Sh NAME
+.Nm ng_ether
+.Nd Ethernet netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_ether.h
+.Sh DESCRIPTION
+The
+.Nm ether
+netgraph node type allows Ethernet interfaces to interact with
+the
+.Xr netgraph 4
+networking subsystem.
+Once the
+.Nm
+module is loaded into the kernel, a node is automatically created
+for each Ethernet interface in the system.
+Each node will attempt to name itself with the same name
+as the associated interface.
+.Pp
+Three hooks are supported:
+.Va lower , upper ,
+and
+.Va orphans .
+The hook name
+.Va divert
+may be used as an alias for
+.Va lower ,
+and is provided for backward compatibility.
+In reality, the two names represent the same hook.
+.Pp
+The
+.Va lower
+hook is a connection to the raw Ethernet device.
+When connected, all incoming packets are forwarded to this hook,
+instead of being passed to the kernel for upper layer processing.
+Writing to this hook results in a raw Ethernet frame being transmitted
+by the device.
+Normal outgoing packets are not affected by
+.Va lower
+being connected.
+.Pp
+The
+.Va upper
+hook is a connection to the upper protocol layers.
+When connected, all outgoing packets are forwarded to this hook,
+instead of being transmitted by the device.
+Writing to this hook results in a raw Ethernet frame being received by
+the kernel just as if it had come in over the wire.
+Normal incoming packets are not affected by
+.Va upper
+being connected.
+.Pp
+The
+.Va orphans
+hook is equivalent to
+.Va lower ,
+except that only unrecognized packets (that would otherwise be discarded)
+are written to the hook, while other normal incoming traffic is unaffected.
+Unrecognized packets written to
+.Va upper
+will be forwarded back out to
+.Va orphans
+if connected.
+.Pp
+In all cases, frames are raw Ethernet frames with the standard
+14 byte Ethernet header (but no checksum).
+.Pp
+When no hooks are connected,
+.Va upper
+and
+.Va lower
+are in effect connected together,
+so that packets flow normally upwards and downwards.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Va orphans"
+.It Va lower
+Connection to the lower device link layer.
+.It Va upper
+Connection to the upper protocol layers.
+.It Va orphans
+Like
+.Va lower ,
+but only receives unrecognized packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_ETHER_GET_IFNAME Pq Li getifname
+Returns the name of the associated interface as a
+.Dv NUL Ns -terminated
+.Tn ASCII
+string.
+Normally this is the same as the name of the node.
+.It Dv NGM_ETHER_GET_IFINDEX Pq Li getifindex
+Returns the global index of the associated interface as a 32 bit integer.
+.It Dv NGM_ETHER_GET_ENADDR Pq Li getenaddr
+Returns the device's unique six byte Ethernet address.
+.It Dv NGM_ETHER_SET_ENADDR Pq Li setenaddr
+Sets the device's unique six byte Ethernet address.
+This control message is equivalent to using the
+.Dv SIOCSIFLLADDR
+.Xr ioctl 2
+system call.
+.It Dv NGM_ETHER_SET_PROMISC Pq Li setpromisc
+Enable or disable promiscuous mode.
+This message includes a single 32 bit integer flag that enables or
+disables promiscuous mode on the interface.
+Any non-zero value enables promiscuous mode.
+.It Dv NGM_ETHER_GET_PROMISC Pq Li getpromisc
+Get the current value of the node's promiscuous flag.
+The returned value is always either one or zero.
+Note that this flag reflects the node's own promiscuous setting
+and does not necessarily reflect the promiscuous state of the actual
+interface, which can be affected by other means (e.g.,
+.Xr bpf 4 ) .
+.It Dv NGM_ETHER_SET_AUTOSRC Pq Li setautosrc
+Sets the automatic source address override flag.
+This message includes a single 32 bit integer flag that causes
+all outgoing packets to have their source Ethernet
+address field overwritten with the device's unique Ethernet address.
+If this flag is set to zero, the source address in outgoing packets
+is not modified.
+The default setting for this flag is disabled.
+.It Dv NGM_ETHER_GET_AUTOSRC Pq Li getautosrc
+Get the current value of the node's source address override flag.
+The returned value is always either one or zero.
+.It Dv NGM_ETHER_ADD_MULTI Pq Li addmulti
+Join Ethernet multicast group.
+This control message is equivalent to using the
+.Dv SIOCADDMULTI
+.Xr ioctl 2
+system call.
+.It Dv NGM_ETHER_DEL_MULTI Pq Li delmulti
+Leave Ethernet multicast group.
+This control message is equivalent to using the
+.Dv SIOCDELMULTI
+.Xr ioctl 2
+system call.
+.It Dv NGM_ETHER_DETACH Pq Li detach
+Detach from underlying Ethernet interface and shut down node.
+.El
+.Sh SHUTDOWN
+Upon receipt of the
+.Dv NGM_SHUTDOWN
+control message, all hooks are disconnected, promiscuous mode is disabled,
+but the node is not removed.
+Node can be shut down only using
+.Dv NGM_ETHER_DETACH
+control message.
+If the interface itself is detached (e.g., because of PC Card removal), the
+node disappears as well.
+.Sh EXAMPLES
+This command dumps all unrecognized packets received by the
+.Dq Li fxp0
+interface to standard output decoded in hex and
+.Tn ASCII :
+.Pp
+.Dl "nghook -a fxp0: orphans"
+.Pp
+This command sends the contents of
+.Pa sample.pkt
+out the interface
+.Dq Li fxp0 :
+.Pp
+.Dl "cat sample.pkt | nghook fxp0: orphans"
+.Pp
+These commands insert an
+.Xr ng_tee 4
+node between the
+.Va lower
+and
+.Va upper
+protocol layers, which can be used for
+tracing packet flow, statistics, etc.:
+.Bd -literal -offset indent
+ngctl mkpeer fxp0: tee lower right
+ngctl connect fxp0: lower upper left
+.Ed
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+The automatic KLD module loading mechanism that works for most
+other Netgraph node types does not work for the
+.Nm ether
+node type,
+because
+.Nm ether
+nodes are not created on demand; instead, they are created when
+Ethernet interfaces are attached or when the KLD is first loaded.
+Therefore, if the KLD is not statically compiled into the kernel,
+it is necessary to load the KLD manually in order to bring the
+.Nm ether
+nodes into existence.
diff --git a/share/man/man4/ng_ether_echo.4 b/share/man/man4/ng_ether_echo.4
new file mode 100644
index 000000000000..2f9dd38aa415
--- /dev/null
+++ b/share/man/man4/ng_ether_echo.4
@@ -0,0 +1,77 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_echo.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd December 24, 2008
+.Dt NG_ETHER_ECHO 4
+.Os
+.Sh NAME
+.Nm ng_ether_echo
+.Nd netgraph ether_echo node type
+.Sh SYNOPSIS
+.In netgraph/ng_ether_echo.h
+.Sh DESCRIPTION
+The
+.Nm ether_echo
+node type reflects all data and control messages back to the sender.
+It assumes (and does not check) that the packet is an ethernet frame,
+and swaps the source and destination addresses before echoing it.
+This node type is used for testing and debugging.
+.Sh HOOKS
+A
+.Nm ether_echo
+node accepts any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Any other control messages are reflected back to the sender.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_hole 4 ,
+.Xr ng_echo 4 ,
+.Xr ng_ether 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_fec.4 b/share/man/man4/ng_fec.4
new file mode 100644
index 000000000000..26004eee4dd0
--- /dev/null
+++ b/share/man/man4/ng_fec.4
@@ -0,0 +1,109 @@
+.\" Copyright (c) 2004 Gleb Smirnoff
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 22, 2004
+.Dt NG_FEC 4
+.Os
+.Sh NAME
+.Nm ng_fec
+.Nd netgraph Fast EtherChannel node
+.Sh SYNOPSIS
+.In netgraph/ng_fec.h
+.Sh DESCRIPTION
+The
+.Nm fec
+node implements Ethernet port trunking using the
+.Dq Cisco Fast EtherChannel
+protocol.
+Upon creation, a
+.Nm fec
+node creates a network interface associated with it.
+Interfaces are named
+.Dq Li fec0 ,
+.Dq Li fec1 ,
+etc.
+New nodes take the first available unit.
+.Sh HOOKS
+The
+.Nm fec
+node accepts any hooks.
+However it does not use them.
+Under normal operation, a
+.Nm fec
+node should not have any hooks.
+.Sh CONTROL MESSAGES
+Interface membership in the FEC group is configured with the following
+control messages:
+.Bl -tag -width indent
+.It Dv NGM_FEC_ADD_IFACE Pq Dq Li add_iface
+Attach interface to the FEC group.
+The target interface name is passed as a string argument.
+.It Dv NGM_FEC_DEL_IFACE Pq Dq Li del_iface
+Remove interface from the trunk.
+The target interface name is passed as a string argument.
+.El
+.Pp
+The following control messages define the forwarding method for a node:
+.Bl -tag -width indent
+.It Dv NGM_FEC_SET_MODE_MAC Pq Dq Li set_mode_mac
+Forwarding decisions will be based on the link-layer MAC address of the destination.
+.It Dv NGM_FEC_SET_MODE_INET Pq Dq Li set_mode_inet
+Forwarding decisions will be based on the IP address of the destination.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message.
+.Sh EXAMPLES
+The following example script creates an
+.Nm fec
+node, attaches four Ethernet interfaces to it and
+sets the forwarding method to be IP-address based:
+.Bd -literal -offset indent
+/usr/sbin/ngctl -f- << SEQ
+ mkpeer fec dummy fec
+ msg fec0: add_iface "dc0"
+ msg fec0: add_iface "dc1"
+ msg fec0: add_iface "dc2"
+ msg fec0: add_iface "dc3"
+ msg fec0: set_mode_inet
+SEQ
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4
+.Sh HISTORY
+The
+.Nm fec
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm fec
+node was written by
+.An "Bill Paul" Aq wpaul@FreeBSD.org .
+This manual page was written by
+.An "Gleb Smirnoff" Aq glebius@FreeBSD.org .
diff --git a/share/man/man4/ng_frame_relay.4 b/share/man/man4/ng_frame_relay.4
new file mode 100644
index 000000000000..edc8a8ca3e14
--- /dev/null
+++ b/share/man/man4/ng_frame_relay.4
@@ -0,0 +1,99 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_frame_relay.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_FRAME_RELAY 4
+.Os
+.Sh NAME
+.Nm ng_frame_relay
+.Nd frame relay netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_frame_relay.h
+.Sh DESCRIPTION
+The
+.Nm frame_relay
+node type performs encapsulation, de-encapsulation, and multiplexing
+of packets using the frame relay protocol.
+It supports up to 1024 DLCI's.
+The LMI protocol is handled by a separate node type (see
+.Xr ng_lmi 4 ) .
+.Pp
+The
+.Dv downstream
+hook should be connected to the synchronous line, i.e., the switch.
+Then hooks
+.Dv dlci0 ,
+.Dv dlci1 ,
+through
+.Dv dlci1023
+are available to connect to each of the DLCI channels.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobar
+.It Dv downstream
+The connection to the synchronous line.
+.It Dv dlciX
+Here X is a decimal number from 0 to 1023.
+This hook corresponds
+to the DLCI X frame relay virtual channel.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_lmi 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
+.Sh BUGS
+Technically, frames on DLCI X should not be transmitted to the switch
+until the LMI protocol entity on both ends has configured DLCI X as active.
+The
+.Nm
+node type ignores this restriction, and will always pass data received
+on a DLCI hook to
+.Dv downstream .
+Instead, it should query the LMI node first.
diff --git a/share/man/man4/ng_gif.4 b/share/man/man4/ng_gif.4
new file mode 100644
index 000000000000..6c4dad257d11
--- /dev/null
+++ b/share/man/man4/ng_gif.4
@@ -0,0 +1,126 @@
+.\" Copyright 2000 The Aerospace Corporation. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions, and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of The Aerospace Corporation may not be used to endorse or
+.\" promote products derived from this software.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Brooks Davis <brooks@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2001
+.Dt NG_GIF 4
+.Os
+.Sh NAME
+.Nm ng_gif
+.Nd generic tunnel interface netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_gif.h
+.Sh DESCRIPTION
+The
+.Nm
+netgraph node type allows
+.Xr gif 4
+interfaces to interact with
+the
+.Xr netgraph 4
+networking subsystem.
+Once the
+.Nm
+module is loaded in the kernel, a node is automatically created
+for each
+.Xr gif 4
+interface in the system.
+Each node will attempt to name itself with the same name
+as the associated interface.
+All
+.Nm
+nodes are persistent for as long as the interface itself exists.
+.Pp
+Two hooks are supported:
+.Dv lower
+and
+.Dv orphans .
+The hook name
+.Dv divert
+may be used as an alias for
+.Dv lower ,
+and is provided for compatibility with
+.Xr ng_ether 4 .
+In reality the two names represent the same hook.
+.Pp
+The
+.Dv lower
+hook is a connection to the raw
+.Xr gif 4
+device.
+When connected, all incoming packets are diverted out this hook.
+Writing to this hook results in a raw encapsulated packet being transmitted
+by the device.
+Normal outgoing packets are not affected by
+.Dv lower
+being connected.
+.Pp
+The
+.Dv orphans
+hook is equivalent to
+.Dv lower ,
+except that only unrecognized packets (that would otherwise be discarded)
+are written to the hook, and normal incoming traffic is unaffected.
+At most one of
+.Dv orphans
+and
+.Dv lower
+may be connected at any time.
+.Pp
+In all cases, frames are raw packets with the address family of the
+packet attached to the front.
+.Pp
+When no hooks are connected, packets flow normally upwards and downwards.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Dv orphans"
+.It Dv lower
+Connection to the lower device link layer.
+.It Dv orphans
+Like
+.Dv lower ,
+but only receives unrecognized packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh EXAMPLES
+This command dumps all unrecognized packets received by the
+.Li gif0
+interface to standard output decoded in hex and ASCII:
+.Pp
+.Dl "nghook -a gif0: orphans"
+.Sh SEE ALSO
+.Xr gif 4 ,
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh AUTHORS
+.An Brooks Davis Aq brooks@FreeBSD.org
diff --git a/share/man/man4/ng_gif_demux.4 b/share/man/man4/ng_gif_demux.4
new file mode 100644
index 000000000000..e549728c4cd5
--- /dev/null
+++ b/share/man/man4/ng_gif_demux.4
@@ -0,0 +1,107 @@
+.\" Copyright 2000 The Aerospace Corporation. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions, and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of The Aerospace Corporation may not be used to endorse or
+.\" promote products derived from this software.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Brooks Davis <brooks@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2001
+.Dt NG_GIF_DEMUX 4
+.Os
+.Sh NAME
+.Nm ng_gif_demux
+.Nd demultiplexer for packets from
+.Xr ng_gif 4
+nodes
+.Sh SYNOPSIS
+.In netgraph/ng_gif_demux.h
+.Sh DESCRIPTION
+The
+.Nm
+netgraph node type demultiplexes the output from
+.Xr ng_gif 4
+nodes in the
+.Xr netgraph 4
+networking subsystem.
+.Pp
+The
+.Dv gif
+hook is meant to be connected to the
+.Dv lower
+or
+.Dv orphans
+hook of an
+.Xr ng_gif 4
+node.
+The
+.Dv inet , inet6 , atalk , ipx , atm , natm ,
+and
+.Dv ns
+hooks output frames of the given type when they are received on the
+.Dv gif
+hook.
+When a frame is received on one of these hooks, it is encapsulated and
+sent out the
+.Dv gif
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Dv inet6"
+.It Dv gif
+Connection to the
+.Dv lower
+or
+.Dv orphans
+hook of an
+.Xr ng_gif 4
+node.
+.It Dv inet
+Hook for input and output of IP frames.
+.It Dv inet6
+Hook for input and output of IPv6 frames.
+.It Dv atalk
+Hook for input and output of AppleTalk frames.
+.It Dv ipx
+Hook for input and output of IPX frames.
+.It Dv atm
+Hook for input and output of ATM frames.
+.It Dv natm
+Hook for input and output of NATM frames.
+.It Dv ns
+Hook for input and output of NS frames.
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SEE ALSO
+.Xr gif 4 ,
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr ng_gif 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh AUTHORS
+.An Brooks Davis Aq brooks@FreeBSD.org
diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4
new file mode 100644
index 000000000000..cda15e409069
--- /dev/null
+++ b/share/man/man4/ng_h4.4
@@ -0,0 +1,123 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_h4.4,v 1.2 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd June 14, 2002
+.Dt NG_H4 4
+.Os
+.Sh NAME
+.Nm ng_h4
+.Nd Netgraph node type that is also an H4 line discipline
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_h4.h
+.Sh DESCRIPTION
+The
+.Nm h4
+node type is both a persistent Netgraph node type and a H4 line
+discipline.
+It implements a Bluetooth HCI UART transport layer as
+per chapter H4 of the Bluetooth Specification Book v1.1.
+A new node is created when the corresponding line discipline,
+.Dv H4DISC ,
+is registered on a tty device (see
+.Xr tty 4 ) .
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the tty device are re-assembled into
+HCI frames (according to the length).
+Full HCI frames are sent out on the hook.
+HCI frames received on
+.Dv hook
+are transmitted out on the tty device.
+No modification to the data is performed in either direction.
+While the line discipline is installed on a tty, the normal
+read and write operations are unavailable, returning
+.Er EIO .
+.Pp
+Information about the node is available via the netgraph
+.Xr ioctl 2
+command
+.Dv NGIOCGINFO .
+This command returns a
+.Vt "struct nodeinfo"
+similar to the
+.Dv NGM_NODEINFO
+.Xr netgraph 4
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Dv hook
+single HCI frame contained in single
+.Vt mbuf
+structure.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_H4_NODE_RESET
+Reset the node.
+.It Dv NGM_H4_NODE_GET_STATE
+Returns current receiving state for the node.
+.It Dv NGM_H4_NODE_GET_DEBUG
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_H4_NODE_SET_DEBUG
+This command takes an integer argument and sets current debug level
+for the node.
+.It Dv NGM_H4_NODE_GET_QLEN
+Returns current length of outgoing queue for the node.
+.It Dv NGM_H4_NODE_SET_QLEN
+This command takes an integer argument and sets maximum length of
+outgoing queue for the node.
+.It Dv NGM_H4_NODE_GET_STAT
+Returns various statistic information for the node, such as: number of
+bytes (frames) sent, number of bytes (frames) received and number of
+input (output) errors.
+.It Dv NGM_H4_NODE_RESET_STAT
+Reset all statistic counters to zero.
+.El
+.Sh SHUTDOWN
+This node shuts down when the corresponding device is closed
+(or the line discipline is uninstalled on the device).
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr netgraph 4 ,
+.Xr tty 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm h4
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+This node still uses
+.Xr spltty 9
+to lock tty layer.
+This is wrong.
diff --git a/share/man/man4/ng_hci.4 b/share/man/man4/ng_hci.4
new file mode 100644
index 000000000000..0234d4105a6f
--- /dev/null
+++ b/share/man/man4/ng_hci.4
@@ -0,0 +1,387 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_hci.4,v 1.3 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd June 25, 2002
+.Dt NG_HCI 4
+.Os
+.Sh NAME
+.Nm ng_hci
+.Nd Netgraph node type that is also a Bluetooth Host Controller Interface
+(HCI) layer
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_hci.h
+.Sh DESCRIPTION
+The
+.Nm hci
+node type is a Netgraph node type that implements Bluetooth Host Controller
+Interface (HCI) layer as per chapter H1 of the Bluetooth Specification Book
+v1.1.
+.Sh INTRODUCTION TO BLUETOOTH
+Bluetooth is a short-range radio link intended to replace the cable(s)
+connecting portable and/or fixed electronic devices.
+Bluetooth operates in the unlicensed ISM band at 2.4 GHz.
+The Bluetooth protocol uses a
+combination of circuit and packet switching.
+Bluetooth can support an
+asynchronous data channel, up to three simultaneous synchronous voice
+channels, or a channel which simultaneously supports asynchronous data
+and synchronous voice.
+Each voice channel supports a 64 kb/s synchronous
+(voice) channel in each direction.
+The asynchronous channel can support
+maximal 723.2 kb/s asymmetric (and still up to 57.6 kb/s in the return
+direction), or 433.9 kb/s symmetric.
+.Pp
+The Bluetooth system provides a point-to-point connection (only two
+Bluetooth units involved), or a point-to-multipoint connection.
+In the point-to-multipoint connection,
+the channel is shared among several Bluetooth units.
+Two or more units sharing the same channel form a
+.Dq piconet .
+One Bluetooth unit acts as the master of the piconet, whereas the other
+unit(s) acts as slave(s).
+Up to seven slaves can be active in the piconet.
+In addition, many more slaves can remain locked to the master in a so-called
+parked state.
+These parked slaves cannot be active on the channel, but remain
+synchronized to the master.
+Both for active and parked slaves, the channel
+access is controlled by the master.
+.Pp
+Multiple piconets with overlapping coverage areas form a
+.Dq scatternet .
+Each piconet can only have a single master.
+However, slaves can participate
+in different piconets on a time-division multiplex basis.
+In addition, a master in one piconet can be a slave in another piconet.
+The piconets shall not be frequency-synchronized.
+Each piconet has its own hopping channel.
+.Ss Time Slots
+The channel is divided into time slots, each 625 usec in length.
+The time
+slots are numbered according to the Bluetooth clock of the piconet master.
+The slot numbering ranges from 0 to 2^27 -1 and is cyclic with a cycle length
+of 2^27.
+In the time slots, master and slave can transmit packets.
+.Ss SCO Link
+The SCO link is a symmetric, point-to-point link between the master and a
+specific slave.
+The SCO link reserves slots and can therefore be considered
+as a circuit-switched connection between the master and the slave.
+The SCO link typically supports time-bounded information like voice.
+The master can
+support up to three SCO links to the same slave or to different slaves.
+A slave can support up to three SCO links from the same master, or two SCO
+links if the links originate from different masters.
+SCO packets are never retransmitted.
+.Ss ACL Link
+In the slots not reserved for SCO links, the master can exchange packets
+with any slave on a per-slot basis.
+The ACL link provides a packet-switched
+connection between the master and all active slaves participating in the
+piconet.
+Both asynchronous and isochronous services are supported.
+Between a master and a slave only a single ACL link can exist.
+For most ACL packets,
+packet retransmission is applied to assure data integrity.
+.Sh HOST CONTROLLER INTERFACE (HCI)
+The HCI provides a command interface to the baseband controller and link
+manager, and access to hardware status and control registers.
+This interface
+provides a uniform method of accessing the Bluetooth baseband capabilities.
+.Pp
+The HCI layer on the Host exchanges data and commands with the HCI firmware
+on the Bluetooth hardware.
+The Host Controller Transport Layer (i.e., physical
+bus) driver provides both HCI layers with the ability to exchange information
+with each other.
+.Pp
+The Host will receive asynchronous notifications of HCI events independent
+of which Host Controller Transport Layer is used.
+HCI events are used for
+notifying the Host when something occurs.
+When the Host discovers that an
+event has occurred it will then parse the received event packet to determine
+which event occurred.
+The next sections specify the HCI packet formats.
+.Ss HCI Command Packet
+.Bd -literal -offset indent
+#define NG_HCI_CMD_PKT 0x01
+typedef struct {
+ uint8_t type; /* MUST be 0x1 */
+ uint16_t opcode; /* OpCode */
+ uint8_t length; /* parameter(s) length in bytes */
+} __attribute__ ((packed)) ng_hci_cmd_pkt_t;
+.Ed
+.Pp
+The HCI command packet is used to send commands to the Host Controller
+from the Host.
+When the Host Controller completes most of the commands,
+a Command Complete event is sent to the Host.
+Some commands do not receive
+a Command Complete event when they have been completed.
+Instead, when the
+Host Controller receives one of these commands the Host Controller sends
+a Command Status event back to the Host when it has begun to execute the
+command.
+Later on, when the actions associated with the command have finished,
+an event that is associated with the sent command will be sent by the Host
+Controller to the Host.
+.Ss HCI Event Packet
+.Bd -literal -offset indent
+#define NG_HCI_EVENT_PKT 0x04
+typedef struct {
+ uint8_t type; /* MUST be 0x4 */
+ uint8_t event; /* event */
+ uint8_t length; /* parameter(s) length in bytes */
+} __attribute__ ((packed)) ng_hci_event_pkt_t;
+.Ed
+.Pp
+The HCI event packet is used by the Host Controller to notify the Host
+when events occur.
+.Ss HCI ACL Data Packet
+.Bd -literal -offset indent
+#define NG_HCI_ACL_DATA_PKT 0x02
+typedef struct {
+ uint8_t type; /* MUST be 0x2 */
+ uint16_t con_handle; /* connection handle + PB + BC flags */
+ uint16_t length; /* payload length in bytes */
+} __attribute__ ((packed)) ng_hci_acldata_pkt_t;
+.Ed
+.Pp
+HCI ACL data packets are used to exchange ACL data between the Host and
+Host Controller.
+.Ss HCI SCO Data Packet
+.Bd -literal -offset indent
+#define NG_HCI_SCO_DATA_PKT 0x03
+typedef struct {
+ uint8_t type; /* MUST be 0x3 */
+ uint16_t con_handle; /* connection handle + reserved bits */
+ uint8_t length; /* payload length in bytes */
+} __attribute__ ((packed)) ng_hci_scodata_pkt_t;
+.Ed
+.Pp
+HCI SCO data packets are used to exchange SCO data between the Host and
+Host Controller.
+.Sh HCI INITIALIZATION
+On initialization, HCI control application must issue the following HCI
+commands (in any order).
+.Bl -tag -width indent
+.It Dv Read_BD_ADDR
+To obtain BD_ADDR of the Bluetooth unit.
+.It Dv Read_Local_Supported_Features
+To obtain the list of features supported by Bluetooth unit.
+.It Dv Read_Buffer_Size
+To determine the maximum size of HCI ACL and SCO HCI data packets (excluding
+header) that can be sent from the Host to the Host Controller.
+There are also
+two additional return parameters that specify the total number of HCI ACL and
+SCO data packets that the Host Controller can have waiting for transmission in
+its buffers.
+.El
+.Pp
+As soon as HCI initialization has been successfully performed, HCI control
+application must turn on
+.Dq inited
+bit for the node.
+Once HCI node has been initialized all upstream hooks
+will receive a
+.Dv NGM_HCI_NODE_UP
+Netgraph message defined as follows.
+.Bd -literal -offset indent
+#define NGM_HCI_NODE_UP 112 /* HCI -> Upper */
+typedef struct {
+ uint16_t pkt_size; /* max. ACL/SCO packet size (w/o hdr) */
+ uint16_t num_pkts; /* ACL/SCO packet queue size */
+ uint16_t reserved; /* place holder */
+ bdaddr_t bdaddr; /* bdaddr */
+} ng_hci_node_up_ep;
+.Ed
+.Sh HCI FLOW CONTROL
+HCI layer performs flow control on baseband connection basis (i.e., ACL and
+SCO link).
+Each baseband connection has
+.Dq "connection handle"
+and queue of outgoing data packets.
+Upper layers protocols are allowed to
+send up to
+.Dv ( num_pkts
+\-
+.Dv pending )
+packets at one time.
+HCI layer will send
+.Dv NGM_HCI_SYNC_CON_QUEUE
+Netgraph messages to inform upper layers about current queue state for each
+connection handle.
+The
+.Dv NGM_HCI_SYNC_CON_QUEUE
+Netgraph message is defined as follows.
+.Bd -literal -offset indent
+#define NGM_HCI_SYNC_CON_QUEUE 113 /* HCI -> Upper */
+typedef struct {
+ uint16_t con_handle; /* connection handle */
+ uint16_t completed; /* number of completed packets */
+} ng_hci_sync_con_queue_ep;
+.Ed
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Dv drv
+Bluetooth Host Controller Transport Layer hook.
+Single HCI packet contained in single
+.Vt mbuf
+structure.
+.It Dv acl
+Upper layer protocol/node is connected to the hook.
+Single HCI ACL data packet contained in single
+.Vt mbuf
+structure.
+.It Dv sco
+Upper layer protocol/node is connected to the hook.
+Single HCI SCO data packet contained in single
+.Vt mbuf
+structure.
+.It Dv raw
+Raw hook.
+Every HCI frame (including HCI command frame) that goes in
+or out will be delivered to the hook.
+Usually the Bluetooth raw HCI socket layer is connected to the hook.
+Single HCI frame contained in single
+.Vt mbuf
+structure.
+.El
+.Sh BLUETOOTH UPPER LAYER PROTOCOLS INTERFACE (LP CONTROL MESSAGES)
+.Bl -tag -width indent
+.It Dv NGM_HCI_LP_CON_REQ
+Requests the lower protocol to create a connection.
+If a physical link
+to the remote device does not exist, this message must be sent to the lower
+protocol (baseband) to establish the physical connection.
+.It Dv NGM_HCI_LP_DISCON_REQ
+Requests the lower protocol (baseband) to terminate a connection.
+.It Dv NGM_HCI_LP_CON_CFM
+Confirms success or failure of the
+.Dv NGM_HCI_LP_CON_REQ
+request to establish a lower layer (baseband) connection.
+This includes passing the authentication challenge if authentication is
+required to establish the physical link.
+.It Dv NGM_HCI_LP_CON_IND
+Indicates the lower protocol (baseband) has successfully established
+incoming connection.
+.It Dv NGM_HCI_LP_CON_RSP
+A response accepting or rejecting the previous connection indication request.
+.It Dv NGM_HCI_LP_DISCON_IND
+Indicates the lower protocol (baseband) has terminated connection.
+This could be a response to
+.Dv NGM_HCI_LP_DISCON_REQ
+or a timeout event.
+.It Dv NGM_HCI_LP_QOS_REQ
+Requests the lower protocol (baseband) to accommodate a particular QoS
+parameter set.
+.It Dv NGM_HCI_LP_QOS_CFM
+Confirms success or failure of the request for a given quality of service.
+.It Dv NGM_HCI_LP_QOS_IND
+Indicates the lower protocol (baseband) has detected a violation of the QoS
+agreement.
+.El
+.Sh NETGRAPH CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_HCI_NODE_GET_STATE
+Returns current state for the node.
+.It Dv NGM_HCI_NODE_INIT
+Turn on
+.Dq inited
+bit for the node.
+.It Dv NGM_HCI_NODE_GET_DEBUG
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_HCI_NODE_SET_DEBUG
+This command takes an integer argument and sets current debug level
+for the node.
+.It Dv NGM_HCI_NODE_GET_BUFFER
+Returns current state of data buffers.
+.It Dv NGM_HCI_NODE_GET_BDADDR
+Returns BD_ADDR as cached in the node.
+.It Dv NGM_HCI_NODE_GET_FEATURES
+Returns the list of features supported by hardware (as cached by the node).
+.It Dv NGM_HCI_NODE_GET_NEIGHBOR_CACHE
+Returns content of the neighbor cache.
+.It Dv NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE
+Remove all neighbor cache entries.
+.It Dv NGM_HCI_NODE_GET_CON_LIST
+Returns list of active baseband connections (i.e., ACL and SCO links).
+.It Dv NGM_HCI_NODE_GET_STAT
+Returns various statistic counters.
+.It Dv NGM_HCI_NODE_RESET_STAT
+Resets all statistic counters to zero.
+.It NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK
+Sets current link policy settings mask.
+After the new ACL connection is
+created the HCI node will try set link policy for the ACL connection.
+By default, every supported Link Manager (LM) mode will be enabled.
+User can
+override this by setting link policy settings mask which specifies LM
+modes to be enabled.
+.It NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK
+Returns current link policy settings mask.
+.It NGM_HCI_NODE_SET_PACKET_MASK
+Sets current packet mask.
+When new baseband (ACL or SCO) connection is
+created the HCI node will specify every packet type supported by the device.
+User can override this by setting packet mask which specifies packet types
+to be used for new baseband connections.
+.It NGM_HCI_NODE_GET_PACKET_MASK
+Returns current packet mask.
+.It NGM_HCI_NODE_SET_ROLE_SWITCH
+Sets the value of the role switch.
+Role switch is enabled when this value is not zero.
+This is the default state.
+Note that actual role switch at Bluetooth link level will only be performed if
+hardware supports role switch and it was enabled.
+.It NGM_HCI_NODE_GET_ROLE_SWITCH
+Returns the value of the role switch for the node.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or
+when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr hccontrol 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm hci
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+Most likely.
+Please report if found.
diff --git a/share/man/man4/ng_hole.4 b/share/man/man4/ng_hole.4
new file mode 100644
index 000000000000..0199d74b9795
--- /dev/null
+++ b/share/man/man4/ng_hole.4
@@ -0,0 +1,91 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_hole.8,v 1.4 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd May 19, 2004
+.Dt NG_HOLE 4
+.Os
+.Sh NAME
+.Nm ng_hole
+.Nd netgraph discard node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_hole.h
+.Sh DESCRIPTION
+The
+.Nm hole
+node type silently discards all data and control messages it receives.
+This type is used for testing and debugging.
+.Sh HOOKS
+A
+.Nm
+node accepts any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the
+following:
+.Bl -tag -width indent
+.It Dv NGM_HOLE_GET_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the statistics
+associated with the hook as a
+.Vt "struct ng_hole_hookstat" .
+.It Dv NGM_HOLE_CLR_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and clears the statistics
+associated with the hook.
+.It Dv NGM_HOLE_GETCLR_STATS
+This command is identical to
+.Dv NGM_HOLE_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_echo 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_hub.4 b/share/man/man4/ng_hub.4
new file mode 100644
index 000000000000..c52aba048477
--- /dev/null
+++ b/share/man/man4/ng_hub.4
@@ -0,0 +1,75 @@
+.\" Copyright (c) 2004 Ruslan Ermilov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 5, 2010
+.Dt NG_HUB 4
+.Os
+.Sh NAME
+.Nm ng_hub
+.Nd packet distribution netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_hub.h
+.Sh DESCRIPTION
+The
+.Nm hub
+node type provides a simple mechanism for distributing packets over
+several links.
+Packets received on any of the hooks are forwarded out the other hooks.
+Packets are not altered in any way.
+.Sh HOOKS
+A
+.Nm hub
+node accepts any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the
+following:
+.Bl -tag -width foo
+.It Dv NGM_HUB_SET_PERSISTENT
+This command sets the persistent flag on the node, and takes no arguments.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected. Setting the
+persistent flag via a
+.Dv NGM_HUB_SET_PERSISTENT
+control message disables automatic node shutdown when the last hook gets
+disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_bridge 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_one2many 4 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh HISTORY
+The
+.Nm
+node type appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An Ruslan Ermilov Aq ru@FreeBSD.org
diff --git a/share/man/man4/ng_iface.4 b/share/man/man4/ng_iface.4
new file mode 100644
index 000000000000..76ec47fc5b7d
--- /dev/null
+++ b/share/man/man4/ng_iface.4
@@ -0,0 +1,171 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
+.\"
+.Dd October 28, 2005
+.Dt NG_IFACE 4
+.Os
+.Sh NAME
+.Nm ng_iface
+.Nd interface netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_iface.h
+.Sh DESCRIPTION
+An
+.Nm iface
+node is both a netgraph node and a system networking interface.
+When an
+.Nm iface
+node is created, a new interface appears which is accessible via
+.Xr ifconfig 8 .
+.Nm Iface
+node interfaces are named
+.Dv ng0 ,
+.Dv ng1 ,
+etc.
+When a node is shutdown, the corresponding interface is removed
+and the interface name becomes available for reuse by future
+.Nm iface
+nodes; new nodes always take the first unused interface.
+The node itself is assigned the same name as its interface, unless the name
+already exists, in which case the node remains unnamed.
+.Pp
+An
+.Nm iface
+node has a single hook corresponding to each supported protocol.
+Packets transmitted via the interface flow out the corresponding
+protocol-specific hook.
+Similarly, packets received on a hook appear on the interface as
+packets received into the corresponding protocol stack.
+The currently supported protocols are IP, IPv6, AppleTalk, IPX, ATM,
+NATM, and NS.
+.Pp
+An
+.Nm iface
+node can be configured as a point-to-point interface or a broadcast interface.
+The configuration can only be changed when the interface is down.
+The default mode is point-to-point.
+.Pp
+.Nm Iface
+nodes support the Berkeley Packet Filter (BPF).
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobar
+.It Dv inet
+Transmission and reception of IP packets.
+.It Dv inet6
+Transmission and reception of IPv6 packets.
+.It Dv atalk
+Transmission and reception of AppleTalk packets.
+.It Dv ipx
+Transmission and reception of IPX packets.
+.It Dv atm
+Transmission and reception of ATM packets.
+.It Dv natm
+Transmission and reception of NATM packets.
+.It Dv ns
+Transmission and reception of NS packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_IFACE_GET_IFNAME
+Returns the name of the associated interface as a
+.Dv NUL Ns -terminated
+.Tn ASCII
+string.
+Normally this is the same as the name of the node.
+.It Dv NGM_IFACE_GET_IFINDEX
+Returns the global index of the associated interface as a 32 bit integer.
+.It Dv NGM_IFACE_POINT2POINT
+Set the interface to point-to-point mode.
+The interface must not currently be up.
+.It Dv NGM_IFACE_BROADCAST
+Set the interface to broadcast mode.
+The interface must not currently be up.
+.It Dv NGM_CISCO_GET_IPADDR
+This message is defined by the
+.Xr ng_cisco 4
+node type; see
+.Xr ng_cisco 4
+for a description.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message.
+The associated interface is removed and becomes available
+for use by future
+.Nm iface
+nodes.
+.Pp
+Unlike most other node types, an
+.Nm iface
+node does
+.Em not
+go away when all hooks have been disconnected; rather, and explicit
+.Dv NGM_SHUTDOWN
+control message is required.
+.Sh ALTQ Support
+The
+.Nm
+interface supports ALTQ bandwidth management feature.
+However,
+.Nm
+is a special case, since it is not a physical interface with limited bandwidth.
+One should not turn ALTQ on
+.Nm
+if the latter corresponds to some tunneled connection, e.g.\& PPPoE or PPTP.
+In this case, ALTQ should be configured on the interface that is used to
+transmit the encapsulated packets.
+In case when your graph ends up with some kind of serial line, either
+synchronous or modem, the
+.Nm
+is the right place to turn ALTQ on.
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr bpf 4 ,
+.Xr netgraph 4 ,
+.Xr ng_cisco 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm iface
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ng_ip_input.4 b/share/man/man4/ng_ip_input.4
new file mode 100644
index 000000000000..430f43c6eaa1
--- /dev/null
+++ b/share/man/man4/ng_ip_input.4
@@ -0,0 +1,102 @@
+.\" Copyright 2001 The Aerospace Corporation. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions, and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of The Aerospace Corporation may not be used to endorse or
+.\" promote products derived from this software.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Brooks Davis <brooks@FreeBSD.org>
+.\" Derived from: ng_hole.4
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 27, 2001
+.Dt NG_IP_INPUT 4
+.Os
+.Sh NAME
+.Nm ng_ip_input
+.Nd netgraph IP input node type
+.Sh SYNOPSIS
+.In netgraph/ng_ip_input.h
+.Sh DESCRIPTION
+The
+.Nm ip_input
+node type takes all received packets and queues them into the IP in
+input processing subsystem.
+.Sh HOOKS
+An
+.Nm
+node accepts any request to connect, regardless of the hook name,
+as long as the name is unique.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+Other control messages are silently discarded.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Brooks Davis Aq brooks@FreeBSD.org
+.Sh BUGS
+The
+.Nm
+node type should probably keep some sort of statistics.
diff --git a/share/man/man4/ng_ipfw.4 b/share/man/man4/ng_ipfw.4
new file mode 100644
index 000000000000..9a9099efd75c
--- /dev/null
+++ b/share/man/man4/ng_ipfw.4
@@ -0,0 +1,117 @@
+.\" Copyright (c) 2005 Gleb Smirnoff
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 2, 2010
+.Dt NG_IPFW 4
+.Os
+.Sh NAME
+.Nm ng_ipfw
+.Nd interface between netgraph and IP firewall
+.Sh SYNOPSIS
+.In netinet/ip_var.h
+.In netgraph/ng_ipfw.h
+.Sh DESCRIPTION
+The
+.Nm ipfw
+node implements interface between
+.Xr ipfw 4
+and
+.Xr netgraph 4
+subsystems.
+.Sh HOOKS
+The
+.Nm ipfw
+node supports an arbitrary number of hooks,
+which must be named using only numeric characters.
+.Sh OPERATION
+Once the
+.Nm
+module is loaded into the kernel, a single node named
+.Va ipfw
+is automatically created.
+No more
+.Nm ipfw
+nodes can be created.
+Once destroyed, the only way to recreate the node is to reload the
+.Nm
+module.
+.Pp
+Packets can be injected into
+.Xr netgraph 4
+using either the
+.Cm netgraph
+or
+.Cm ngtee
+commands of the
+.Xr ipfw 8
+utility.
+These commands require a numeric cookie to be supplied as an argument.
+Packets are sent out of the hook whose name equals the cookie value.
+If no hook matches, packets are discarded.
+Packets injected via the
+.Cm netgraph
+command are tagged with
+.Vt "struct ipfw_rule_ref" .
+This tag contains information that helps the packet to re-enter
+.Xr ipfw 4
+processing, should the packet come back from
+.Xr netgraph 4
+to
+.Xr ipfw 4 .
+.Pp
+Packets received by a node from
+.Xr netgraph 4
+subsystem must be tagged with
+.Vt "struct ipfw_rule_ref"
+tag.
+Packets re-enter IP firewall processing at the next rule.
+If no tag is supplied, packets are discarded.
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message.
+Do not do this, since the new
+.Nm ipfw
+node can only be created by reloading the
+.Nm
+module.
+.Sh SEE ALSO
+.Xr ipfw 4 ,
+.Xr netgraph 4 ,
+.Xr ipfw 8 ,
+.Xr mbuf_tags 9
+.Sh HISTORY
+The
+.Nm ipfw
+node type was implemented in
+.Fx 6.0 .
+.Sh AUTHORS
+The
+.Nm ipfw
+node was written by
+.An "Gleb Smirnoff" Aq glebius@FreeBSD.org .
diff --git a/share/man/man4/ng_ksocket.4 b/share/man/man4/ng_ksocket.4
new file mode 100644
index 000000000000..e74f61a2e435
--- /dev/null
+++ b/share/man/man4/ng_ksocket.4
@@ -0,0 +1,242 @@
+.\" Copyright (c) 1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 09, 2012
+.Dt NG_KSOCKET 4
+.Os
+.Sh NAME
+.Nm ng_ksocket
+.Nd kernel socket netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_ksocket.h
+.Sh DESCRIPTION
+A
+.Nm ksocket
+node is both a netgraph node and a
+.Bx
+socket.
+The
+.Nm
+node type allows one to open a socket inside the kernel and have
+it appear as a Netgraph node.
+The
+.Nm
+node type is the reverse of the socket node type (see
+.Xr ng_socket 4 ) :
+whereas the socket node type enables the user-level manipulation (via
+a socket) of what is normally a kernel-level entity (the associated
+Netgraph node), the
+.Nm
+node type enables the kernel-level manipulation (via a Netgraph node) of
+what is normally a user-level entity (the associated socket).
+.Pp
+A
+.Nm
+node allows at most one hook connection.
+Connecting to the node is
+equivalent to opening the associated socket.
+The name given to the hook
+determines what kind of socket the node will open (see below).
+When the hook is disconnected and/or the node is shutdown, the
+associated socket is closed.
+.Sh HOOKS
+This node type supports a single hook connection at a time.
+The name of the hook must be of the form
+.Em <family>/<type>/<proto> ,
+where the
+.Em family ,
+.Em type ,
+and
+.Em proto
+are the decimal equivalent of the same arguments to
+.Xr socket 2 .
+Alternately, aliases for the commonly used values are accepted as
+well.
+For example
+.Dv inet/dgram/udp
+is a more readable but equivalent version of
+.Dv 2/2/17 .
+.Pp
+Data received into socket is sent out via hook.
+Data received on hook is sent out from socket, if the latter is
+connected (an
+.Dv NGM_KSOCKET_CONNECT
+was sent to node before).
+If socket is not connected, destination
+.Vt "struct sockaddr"
+must be supplied in an mbuf tag with cookie
+.Dv NGM_KSOCKET_COOKIE
+and type
+.Dv NG_KSOCKET_TAG_SOCKADDR
+attached to data.
+Otherwise
+.Nm
+will return
+.Er ENOTCONN
+to sender.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_KSOCKET_BIND
+This functions exactly like the
+.Xr bind 2
+system call.
+The
+.Vt "struct sockaddr"
+socket address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_LISTEN
+This functions exactly like the
+.Xr listen 2
+system call.
+The backlog parameter (a single 32 bit
+.Dv int )
+should be supplied as an argument.
+.It Dv NGM_KSOCKET_CONNECT
+This functions exactly like the
+.Xr connect 2
+system call.
+The
+.Vt "struct sockaddr"
+destination address parameter should be supplied as an argument.
+.It Dv NGM_KSOCKET_ACCEPT
+Equivalent to the
+.Xr accept 2
+system call on a non-blocking socket.
+If there is a pending connection on the queue,
+a new socket and a corresponding cloned node are created.
+Returned are the cloned node's ID and a peer name (as
+.Vt "struct sockaddr" ) .
+If there are no pending connections,
+this control message returns nothing,
+and a connected node will receive the above message asynchronously,
+when a connection is established.
+.Pp
+A cloned node supports a single hook with an arbitrary name.
+If not connected, a node disappears when its parent node is destroyed.
+Once connected, it becomes an independent node.
+.It Dv NGM_KSOCKET_GETNAME
+Equivalent to the
+.Xr getsockname 2
+system call.
+The name is returned as a
+.Vt "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_GETPEERNAME
+Equivalent to the
+.Xr getpeername 2
+system call.
+The name is returned as a
+.Vt "struct sockaddr"
+in the arguments field of the reply.
+.It Dv NGM_KSOCKET_SETOPT
+Equivalent to the
+.Xr setsockopt 2
+system call, except that the option name, level, and value are passed in a
+.Vt "struct ng_ksocket_sockopt" .
+.It Dv NGM_KSOCKET_GETOPT
+Equivalent to the
+.Xr getsockopt 2
+system call, except that the option is passed in a
+.Vt "struct ng_ksocket_sockopt" .
+When sending this command, the
+.Dv value
+field should be empty; upon return, it will contain the
+retrieved value.
+.El
+.Sh ASCII FORM CONTROL MESSAGES
+For control messages that pass a
+.Vt "struct sockaddr"
+in the argument field, the normal
+.Tn ASCII
+equivalent of the C structure
+is an acceptable form.
+For the
+.Dv PF_INET
+and
+.Dv PF_LOCAL
+address families, a more convenient form is also used, which is
+the protocol family name, followed by a slash, followed by the actual
+address.
+For
+.Dv PF_INET ,
+the address is an IP address followed by an optional colon and port number.
+For
+.Dv PF_LOCAL ,
+the address is the pathname as a doubly quoted string.
+.Pp
+Examples:
+.Bl -tag -width "PF_LOCAL"
+.It Dv PF_LOCAL
+local/"/tmp/foo.socket"
+.It Dv PF_INET
+inet/192.168.1.1:1234
+.It Other
+.Dv "\&{ family=16 len=16 data=[0x70 0x00 0x01 0x23] \&}"
+.El
+.Pp
+For control messages that pass a
+.Vt "struct ng_ksocket_sockopt" ,
+the normal
+.Tn ASCII
+form for that structure is used.
+In the future, more
+convenient encoding of the more common socket options may be supported.
+.Pp
+Setting socket options example:
+.Bl -tag -width "PF_LOCAL"
+.It Set FIB 2 for a socket (SOL_SOCKET, SO_SETFIB):
+.Dv "setopt \&{ level=0xffff name=0x1014 data=[ 2 ] \&}"
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when the hook is disconnected.
+Shutdown of the node closes the associated socket.
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 4 ,
+.Xr ng_socket 4 ,
+.Xr ngctl 8 ,
+.Xr mbuf_tags 9 ,
+.Xr socket 9
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ng_l2cap.4 b/share/man/man4/ng_l2cap.4
new file mode 100644
index 000000000000..949b0390cabf
--- /dev/null
+++ b/share/man/man4/ng_l2cap.4
@@ -0,0 +1,422 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_l2cap.4,v 1.4 2003/09/14 23:37:52 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd July 4, 2002
+.Dt NG_L2CAP 4
+.Os
+.Sh NAME
+.Nm ng_l2cap
+.Nd Netgraph node type that implements Bluetooth Logical Link Control and
+Adaptation Protocol (L2CAP)
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_hci.h
+.In netgraph/bluetooth/include/ng_l2cap.h
+.Sh DESCRIPTION
+The
+.Nm l2cap
+node type is a Netgraph node type that implements Bluetooth Logical Link
+Control and Adaptation Protocol as per chapter D of the Bluetooth Specification
+Book v1.1.
+.Pp
+L2CAP provides connection-oriented and connectionless data services to upper
+layer protocols with protocol multiplexing capability, segmentation and
+reassembly operation, and group abstractions.
+L2CAP permits higher level
+protocols and applications to transmit and receive L2CAP data packets up to
+64 kilobytes in length.
+.Ss L2CAP Assumptions
+.Bl -enum -offset indent
+.It
+The ACL link between two units is set up.
+The Baseband provides orderly
+delivery of data packets, although there might be individual packet corruption
+and duplicates.
+No more than one ACL link exists between any two devices.
+.It
+The Baseband always provides the impression of full-duplex communication
+channels.
+This does not imply that all L2CAP communications are bi-directional.
+Multicasts and unidirectional traffic (e.g., video) do not require duplex
+channels.
+.It
+L2CAP provides a reliable channel using the mechanisms available at the
+Baseband layer.
+The Baseband always performs data integrity checks when
+requested and resends data until it has been successfully acknowledged or
+a timeout occurs.
+As acknowledgements may be lost, timeouts may
+occur even after the data has been successfully sent.
+.El
+.Sh L2CAP GENERAL OPERATION
+The Logical Link Control and Adaptation Protocol (L2CAP) is based around the
+concept of
+.Dq channels .
+Each channel is bound to a single protocol in a many-to-one fashion.
+Multiple
+channels can be bound to the same protocol, but a channel cannot be bound to
+multiple protocols.
+Each L2CAP packet received on a channel is directed to
+the appropriate higher level protocol.
+.Pp
+Each one of the end-points of an L2CAP channel is referred to by a channel
+identifier.
+Channel identifiers (CIDs) are local names representing a logical
+channel end-point on the device.
+Identifiers from 0x0001 to 0x003F are reserved
+for specific L2CAP functions.
+The null identifier (0x0000) is defined as an
+illegal identifier and must never be used as a destination end-point.
+All L2CAP signalling commands are sent to CID 0x0001.
+CID 0x0002 is reserved for group-oriented channel.
+The same CID must not be reused as a local L2CAP
+channel endpoint for multiple simultaneous L2CAP channels between a local
+device and some remote device.
+.Pp
+CID assignment is relative to a particular device and a device can assign CIDs
+independently from other devices.
+Thus, even if the same CID value has been
+assigned to (remote) channel endpoints by several remote devices connected
+to a single local device, the local device can still uniquely associate each
+remote CID with a different device.
+.Ss Channel Operational States
+.Bl -tag -width indent
+.It Dv NG_L2CAP_CLOSED
+In this state, there is no channel associated with this CID.
+This is the only
+state when a link level connection (Baseband) may not exist.
+Link disconnection
+forces all other states into the
+.Dv NG_L2CAP_CLOSED
+state.
+.It Dv NG_L2CAP_W4_L2CAP_CON_RSP
+In this state, the CID represents a local end-point and an L2CAP Connect
+Request message has been sent referencing this endpoint and it is now waiting
+for the corresponding L2CAP Connect Response message.
+.It Dv NG_L2CAP_W4_L2CA_CON_RSP
+In this state, the remote end-point exists and an L2CAP Connect Request has
+been received by the local L2CAP entity.
+An L2CA Connect Indication has been
+sent to the upper layer and the part of the local L2CAP entity processing the
+received L2CAP Connect Request waits for the corresponding response.
+The response may require a security check to be performed.
+.It Dv NG_L2CAP_CONFIG
+In this state, the connection has been established but both sides are still
+negotiating the channel parameters.
+The Configuration state may also be
+entered when the channel parameters are being renegotiated.
+Prior to entering the
+.Dv NG_L2CAP_CONFIG
+state, all outgoing data traffic is suspended since
+the traffic parameters of the data traffic are to be renegotiated.
+Incoming
+data traffic is accepted until the remote channel endpoint has entered
+the
+.Dv NG_L2CAP_CONFIG
+state.
+In the
+.Dv NG_L2CAP_CONFIG
+state, both sides will issue
+L2CAP Configuration Request messages if only defaults are being used, a null
+message will be sent.
+If a large amount of parameters need to be negotiated,
+multiple messages will be sent to avoid any MTU limitations and negotiate
+incrementally.
+Moving from the
+.Dv NG_L2CAP_CONFIG
+state to the
+.Dv NG_L2CAP_OPEN
+state requires both sides to be ready.
+An L2CAP entity is ready when it has received
+a positive response to its final request and it has positively responded to
+the final request from the remote device.
+.It Dv NG_L2CAP_OPEN
+In this state, the connection has been established and configured, and data
+flow may proceed.
+.It Dv NG_L2CAP_W4_L2CAP_DISCON_RSP
+In this state, the connection is shutting down and an L2CAP Disconnect Request
+message has been sent.
+This state is now waiting for the corresponding response.
+.It Dv NG_L2CAP_W4_L2CA_DISCON_RSP
+In this state, the connection on the remote endpoint is shutting down and an
+L2CAP Disconnect Request message has been received.
+An L2CA Disconnect
+Indication has been sent to the upper layer to notify the owner of the CID
+that the remote endpoint is being closed.
+This state is now waiting for the
+corresponding response from the upper layer before responding to the remote
+endpoint.
+.El
+.Ss Protocol Multiplexing
+L2CAP supports protocol multiplexing because the Baseband Protocol does not
+support any
+.Dq type
+field identifying the higher layer protocol being multiplexed above it.
+L2CAP is able to distinguish between upper layer protocols such as the Service
+Discovery Protocol, RFCOMM and Telephony Control.
+.Ss Segmentation and Reassembly
+The data packets defined by the Baseband Protocol are limited in size.
+Large
+L2CAP packets must be segmented into multiple smaller Baseband packets prior
+to their transmission over the air.
+Similarly, multiple received Baseband
+packets may be reassembled into a single larger L2CAP packet.
+.Ss Quality of Service
+The L2CAP connection establishment process allows the exchange of information
+regarding the quality of service (QoS) expected between two Bluetooth units.
+.Ss Groups
+The Baseband Protocol supports the concept of a piconet, a group of devices
+synchronously hopping together using the same clock.
+The L2CAP group
+abstraction permits implementations to efficiently map protocol groups on to
+piconets.
+.Pp
+The following features are outside the scope of L2CAP responsibilities:
+.Bl -dash -offset indent
+.It
+L2CAP does not transport audio designated for SCO links.
+.It
+L2CAP does not enforce a reliable channel or ensure data integrity,
+that is, L2CAP performs no retransmissions or checksum calculations.
+.It
+L2CAP does not support a reliable multicast channel.
+.It
+L2CAP does not support the concept of a global group name.
+.El
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Dv hci
+Bluetooth Host Controller Interface downstream hook.
+.It Dv l2c
+Upper layer protocol upstream hook.
+Usually the Bluetooth L2CAP socket layer is connected to the hook.
+.It Dv ctl
+Control hook.
+Usually the Bluetooth raw L2CAP sockets layer is connected to the hook.
+.El
+.Sh INTERFACE TO THE UPPER LAYER PROTOCOLS (L2CA CONTROL MESSAGES)
+Bluetooth specification says that L2CA request must block until response
+is ready.
+L2CAP node uses
+.Va token
+field from Netgraph message header to match L2CA request and response.
+The upper layer protocol must populate
+.Va token .
+L2CAP node will queue request and start processing.
+Later, when response is
+ready or timeout has occurred, L2CAP node will create new Netgraph message, set
+.Va token
+and
+.Dv NFG_RESP
+flag and send message to the upper layer.
+Note that L2CA indication messages
+will not populate
+.Va token
+and will not set
+.Dv NGF_RESP
+flag.
+There is no reason for this, because they are just notifications and do
+not require acknowledgment.
+.Bl -tag -width indent
+.It Dv NGM_L2CAP_L2CA_CON
+Requests the creation of a channel representing a logical connection to a
+physical address.
+Input parameters are the target protocol (PSM) and remote
+device's 48-bit address (BD_ADDR).
+Output parameters are the local CID (LCID)
+allocated by the local L2CAP entity, and Result of the request.
+If Result
+indicates a pending notification, the Status value may contain more information
+of what processing is delaying the establishment of the connection.
+.It Dv NGM_L2CAP_L2CA_CON_IND
+This message includes the parameters for the address of the remote device that
+issued the connection request, the local CID representing the channel being
+requested, the Identifier contained in the request, and the PSM value the
+request is targeting.
+.It Dv NGM_L2CAP_L2CA_CON_RSP
+Issues a response to a connection request event indication.
+Input parameters
+are the remote device's 48-bit address, Identifier sent in the request, local
+CID, the Response code, and the Status attached to the Response code.
+The output parameter is the Result of the service request.
+This primitive must be
+called no more than once after receiving the indication.
+.It Dv NGM_L2CAP_L2CA_CFG
+Requests the initial configuration (or reconfiguration) of a channel to a new
+set of channel parameters.
+Input parameters are the local CID endpoint, new
+incoming receivable MTU (InMTU), new outgoing flow spec-ification, and flush
+and link timeouts.
+Output parameters are the Result, accepted incoming MTU
+(InMTU), the remote side's flow requests, and flush and link timeouts.
+.It Dv NGM_L2CAP_L2CA_CFG_IND
+This message includes the parameters indicating the local CID of the channel
+the request has been sent to, the outgoing MTU size (maximum packet that can
+be sent across the channel) and the flowspec describing the characteristics of
+the incoming data.
+All other channel parameters are set to their default values
+if not provided by the remote device.
+.It Dv NGM_L2CAP_L2CA_CFG_RSP
+Issues a response to a configuration request event indication.
+Input parameters
+include the local CID of the endpoint being configured, outgoing transmit MTU
+(which may be equal or less to the OutMTU parameter in the configuration
+indication event) and the accepted flowspec for incoming traffic.
+The output parameter is the Result value.
+.It Dv NGM_L2CAP_L2CA_QOS_IND
+This message includes the parameter indicating the address of the remote
+Bluetooth device where the QoS contract has been violated.
+.It Dv NGM_L2CAP_L2CA_DISCON
+Requests the disconnection of the channel.
+Input parameter is the CID representing the local channel endpoint.
+Output parameter is Result.
+Result
+is zero if an L2CAP Disconnect Response is received, otherwise a non-zero value
+is returned.
+Once disconnection has been requested, no process will be able to
+successfully read or write from the CID.
+.It Dv NGM_L2CAP_L2CA_DISCON_IND
+This message includes the parameter indicating the local CID the request has
+been sent to.
+.It Dv NGM_L2CAP_L2CA_WRITE
+Response to transfer of data request.
+Actual data must be received from
+appropriate upstream hook and must be prepended with header defined as follows.
+.Bd -literal -offset indent
+/* L2CA data packet header */
+typedef struct {
+ uint32_t token; /* token to use in L2CAP_L2CA_WRITE */
+ uint16_t length; /* length of the data */
+ uint16_t lcid; /* local channel ID */
+} __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t;
+.Ed
+.Pp
+The output parameters are Result and Length of data written.
+.It Dv NGM_L2CAP_L2CA_GRP_CREATE
+Requests the creation of a CID to represent a logical connection to multiple
+devices.
+Input parameter is the PSM value that the outgoing connectionless
+traffic is labelled with, and the filter used for incoming traffic.
+Output parameter is the CID representing the local endpoint.
+On creation, the group
+is empty but incoming traffic destined for the PSM value is readable.
+.Bf -emphasis
+This request has not been implemented.
+.Ef
+.It Dv NGM_L2CAP_L2CA_GRP_CLOSE
+The use of this message closes down a Group.
+.Bf -emphasis
+This request has not been implemented.
+.Ef
+.It Dv NGM_L2CAP_L2CA_GRP_ADD_MEMBER
+Requests the addition of a member to a group.
+The input parameter includes the
+CID representing the group and the BD_ADDR of the group member to be added.
+The output parameter Result confirms the success or failure of the request.
+.Bf -emphasis
+This request has not been implemented.
+.Ef
+.It Dv NGM_L2CAP_L2CA_GRP_REM_MEMBER
+Requests the removal of a member from a group.
+The input parameters include
+the CID representing the group and BD_ADDR of the group member to be removed.
+The output parameter Result confirms the success or failure of the request.
+.Bf -emphasis
+This request has not been implemented.
+.Ef
+.It Dv NGM_L2CAP_L2CA_GRP_MEMBERSHIP
+Requests a report of the members of a group.
+The input parameter CID represents the group being queried.
+The output parameter Result confirms the success or
+failure of the operation.
+If the Result is successful, BD_ADDR_Lst is a list
+of the Bluetooth addresses of the N members of the group.
+.Bf -emphasis
+This request has not been implemented.
+.Ef
+.It Dv NGM_L2CAP_L2CA_PING
+Initiates an L2CA Echo Request message and the reception of the corresponding
+L2CAP Echo Response message.
+The input parameters are remote Bluetooth device
+BD_ADDR, Echo Data and Length of the echo data.
+The output parameters are
+Result, Echo Data and Length of the echo data.
+.It Dv NGM_L2CAP_L2CA_GET_INFO
+Initiates an L2CA Information Request message and the reception of the
+corresponding L2CAP Info Response message.
+The input parameters are remote Bluetooth device BD_ADDR and Information Type.
+The output parameters are
+Result, Information Data and Size of the information data.
+.It Dv NGM_L2CAP_L2CA_ENABLE_CLT
+Request to disable (enable) the reception of connectionless packets.
+The input
+parameter is the PSM value indicating service that should be blocked
+(unblocked) and Enable flag.
+.El
+.Sh NETGRAPH CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_L2CAP_NODE_GET_FLAGS
+Returns current state for the node.
+.It Dv NGM_L2CAP_NODE_GET_DEBUG
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_L2CAP_NODE_SET_DEBUG
+This command takes an integer argument and sets current debug level
+for the node.
+.It Dv NGM_L2CAP_NODE_GET_CON_LIST
+Returns list of active baseband connections (i.e., ACL links).
+.It Dv NGM_L2CAP_NODE_GET_CHAN_LIST
+Returns list of active L2CAP channels.
+.It Dv NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO
+Returns an integer containing the current value of the auto disconnect
+timeout (in sec).
+.It Dv NGM_L2CAP_NODE_SET_AUTO_DISCON_TIMO
+This command accepts an integer and sets the value of the auto disconnect
+timeout (in sec).
+The special value of 0 (zero) disables auto disconnect timeout.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of an
+.Dv NGM_SHUTDOWN
+control message, or
+when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr l2control 8 ,
+.Xr l2ping 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm l2cap
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+Most likely.
+Please report if found.
diff --git a/share/man/man4/ng_l2tp.4 b/share/man/man4/ng_l2tp.4
new file mode 100644
index 000000000000..c556a49b828e
--- /dev/null
+++ b/share/man/man4/ng_l2tp.4
@@ -0,0 +1,330 @@
+.\" Copyright (c) 2001-2002 Packet Design, LLC.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty,
+.\" use and redistribution of this software, in source or object code
+.\" forms, with or without modifications are expressly permitted by
+.\" Packet Design; provided, however, that:
+.\"
+.\" (i) Any and all reproductions of the source or object code
+.\" must include the copyright notice above and the following
+.\" disclaimer of warranties; and
+.\" (ii) No rights are granted, in any manner or form, to use
+.\" Packet Design trademarks, including the mark "PACKET DESIGN"
+.\" on advertising, endorsements, or otherwise except as such
+.\" appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
+.\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+.\" OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
+.\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
+.\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
+.\" RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
+.\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
+.\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
+.\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
+.\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
+.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 2, 2004
+.Dt NG_L2TP 4
+.Os
+.Sh NAME
+.Nm ng_l2tp
+.Nd L2TP protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_l2tp.h
+.Sh DESCRIPTION
+The
+.Nm l2tp
+node type implements the encapsulation layer of the L2TP protocol
+as described in RFC 2661.
+This includes adding the L2TP packet header for outgoing packets
+and verifying and removing it for incoming packets.
+The node maintains the L2TP sequence number state and handles
+control session packet acknowledgment and retransmission.
+.Sh HOOKS
+The
+.Nm l2tp
+node type supports the following hooks:
+.Pp
+.Bl -tag -compact -offset indent -width ".Dv session_hhhh"
+.It Dv lower
+L2TP frames.
+.It Dv ctrl
+Control packets.
+.It Dv session_hhhh
+Session 0xhhhh data packets.
+.El
+.Pp
+L2TP control and data packets are transmitted to, and received from,
+the L2TP peer via the
+.Dv lower
+hook.
+Typically this hook would be connected to the
+.Dv "inet/dgram/udp"
+hook of an
+.Xr ng_ksocket 4
+node for L2TP over UDP.
+.Pp
+The
+.Dv ctrl
+hook connects to the local L2TP management entity.
+L2TP control messages (without any L2TP headers) are transmitted
+and received on this hook.
+Messages written to this hook are guaranteed to be delivered to the
+peer reliably, in order, and without duplicates.
+.Pp
+Packets written to the
+.Dv ctrl
+hook must contain a two byte session ID prepended to the frame
+(in network order).
+This session ID is copied to the outgoing L2TP header.
+Similarly, packets read from the
+.Dv ctrl
+hook will have the received session ID prepended.
+.Pp
+Once an L2TP session has been created, the corresponding session
+hook may be used to transmit and receive the session's data frames:
+for the session with session ID
+.Dv 0xabcd ,
+the hook is named
+.Dv session_abcd .
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_L2TP_SET_CONFIG
+This command updates the configuration of the node.
+It takes a
+.Vt "struct ng_l2tp_config"
+as an argument:
+.Bd -literal
+/* Configuration for a node */
+struct ng_l2tp_config {
+ u_char enabled; /* enables traffic flow */
+ u_char match_id; /* tunnel id must match 'tunnel_id' */
+ uint16_t tunnel_id; /* local tunnel id */
+ uint16_t peer_id; /* peer's tunnel id */
+ uint16_t peer_win; /* peer's max recv window size */
+ uint16_t rexmit_max; /* max retransmits before failure */
+ uint16_t rexmit_max_to; /* max delay between retransmits */
+};
+.Ed
+.Pp
+The
+.Va enabled
+field enables packet processing.
+Each time this field is changed back to zero the sequence
+number state is reset.
+In this way, reuse of a node is possible.
+.Pp
+The
+.Va tunnel_id
+field configures the local tunnel ID for the control connection.
+The
+.Va match_id
+field determines how incoming L2TP packets with a tunnel ID
+field different from
+.Va tunnel_id
+are handled.
+If
+.Va match_id
+is non-zero, they will be dropped; otherwise, they will be dropped
+only if the tunnel ID is non-zero.
+Typically
+.Va tunnel_id
+is set to the local tunnel ID as soon as it is known and
+.Va match_id
+is set to non-zero after receipt of the SCCRP or SCCCN control message.
+.Pp
+The peer's tunnel ID should be set in
+.Va peer_id
+as soon as it is learned, typically after receipt of a SCCRQ or SCCRP
+control message.
+This value is copied into the L2TP header for outgoing packets.
+.Pp
+The
+.Va peer_win
+field should be set from the
+.Dq "Receive Window Size"
+AVP received from the peer.
+The default value for this field is one; zero is an invalid value.
+As long as
+.Va enabled
+is non-zero, this value may not be decreased.
+.Pp
+The
+.Va rexmit_max
+and
+.Va rexmit_max_to
+fields configure packet retransmission.
+.Va rexmit_max_to
+is the maximum retransmission delay between packets, in seconds.
+The retransmit delay will start at a small value and increase
+exponentially up to this limit.
+The
+.Va rexmit_max
+sets the maximum number of times a packet will be retransmitted
+without being acknowledged before a failure condition is declared.
+Once a failure condition is declared, each additional retransmission
+will cause the
+.Nm l2tp
+node to send a
+.Dv NGM_L2TP_ACK_FAILURE
+control message back to the node that sent the last
+.Dv NGM_L2TP_SET_CONFIG .
+Appropriate action should then be taken to shutdown the control connection.
+.It Dv NGM_L2TP_GET_CONFIG
+Returns the current configuration as a
+.Vt "struct ng_l2tp_config" .
+.It Dv NGM_L2TP_SET_SESS_CONFIG
+This control message configures a single data session.
+The corresponding hook must already be connected before sending this command.
+The argument is a
+.Vt "struct ng_l2tp_sess_config" :
+.Bd -literal
+/* Configuration for a session hook */
+struct ng_l2tp_sess_config {
+ uint16_t session_id; /* local session id */
+ uint16_t peer_id; /* peer's session id */
+ u_char control_dseq; /* we control data sequencing? */
+ u_char enable_dseq; /* enable data sequencing? */
+ u_char include_length; /* include length field? */
+};
+.Ed
+.Pp
+The
+.Va session_id
+and
+.Va peer_id
+fields configure the local and remote session IDs, respectively.
+.Pp
+The
+.Va control_dseq
+and
+.Va enable_dseq
+fields determine whether sequence numbers are used with L2TP data packets.
+If
+.Va enable_dseq
+is zero, then no sequence numbers are sent and incoming sequence numbers
+are ignored.
+Otherwise, sequence numbers are included on outgoing packets and checked
+on incoming packets.
+.Pp
+If
+.Va control_dseq
+is non-zero, then the setting of
+.Va enable_dseq
+will never change except by another
+.Dv NGM_L2TP_SET_SESS_CONFIG
+control message.
+If
+.Va control_dseq
+is zero, then the peer controls whether sequence numbers are used:
+if an incoming L2TP data packet contains sequence numbers,
+.Va enable_dseq
+is set to one, and conversely if an incoming L2TP data packet does not
+contain sequence numbers,
+.Va enable_dseq
+is set to zero.
+The current value of
+.Va enable_dseq
+is always accessible via the
+.Dv NGM_L2TP_GET_SESS_CONFIG
+control message (see below).
+Typically an LNS would set
+.Va control_dseq
+to one while a LAC would set
+.Va control_dseq
+to zero (if the Sequencing Required AVP were not sent), thus giving
+control of data packet sequencing to the LNS.
+.Pp
+The
+.Va include_length
+field determines whether the L2TP header length field is included
+in outgoing L2TP data packets.
+For incoming packets, the L2TP length field is always checked when present.
+.It Dv NGM_L2TP_GET_SESS_CONFIG
+This command takes a two byte session ID as an argument and returns
+the current configuration for the corresponding data session as a
+.Vt "struct ng_l2tp_sess_config" .
+The corresponding session hook must be connected.
+.It Dv NGM_L2TP_GET_STATS
+This command returns a
+.Vt "struct ng_l2tp_stats"
+containing statistics of the L2TP tunnel.
+.It Dv NGM_L2TP_CLR_STATS
+This command clears the statistics for the L2TP tunnel.
+.It Dv NGM_L2TP_GETCLR_STATS
+Same as
+.Dv NGM_L2TP_GET_STATS ,
+but also atomically clears the statistics as well.
+.It Dv NGM_L2TP_GET_SESSION_STATS
+This command takes a two byte session ID as an argument and returns a
+.Vt "struct ng_l2tp_session_stats"
+containing statistics for the corresponding data session.
+The corresponding session hook must be connected.
+.It Dv NGM_L2TP_CLR_SESSION_STATS
+This command takes a two byte session ID as an argument and
+clears the statistics for that data session.
+The corresponding session hook must be connected.
+.It Dv NGM_L2TP_GETCLR_SESSION_STATS
+Same as
+.Dv NGM_L2TP_GET_SESSION_STATS ,
+but also atomically clears the statistics as well.
+.It Dv NGM_L2TP_SET_SEQ
+This command sets the sequence numbers of a not yet enabled node.
+It takes a
+.Vt "struct ng_l2tp_seq_config"
+as argument, where
+.Va xack
+and
+.Va nr
+respectively
+.Va ns
+and
+.Va rack
+must be the same.
+This option is particularly useful if one receives and processes
+the first packet entirely in userspace and wants to hand over further
+processing to the node.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ksocket 4 ,
+.Xr ng_ppp 4 ,
+.Xr ng_pptpgre 4 ,
+.Xr ngctl 8
+.Rs
+.%A W. Townsley
+.%A A. Valencia
+.%A A. Rubens
+.%A G. Pall
+.%A G. Zorn
+.%A B. Palter
+.%T "Layer Two Tunneling Protocol L2TP"
+.%O RFC 2661
+.Re
+.Sh HISTORY
+The
+.Nm l2tp
+node type was developed at Packet Design, LLC,
+.Pa http://www.packetdesign.com/ .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@packetdesign.com
diff --git a/share/man/man4/ng_lmi.4 b/share/man/man4/ng_lmi.4
new file mode 100644
index 000000000000..a8fed52dbc0d
--- /dev/null
+++ b/share/man/man4/ng_lmi.4
@@ -0,0 +1,138 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_lmi.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_LMI 4
+.Os
+.Sh NAME
+.Nm ng_lmi
+.Nd frame relay LMI protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_lmi.h
+.Sh DESCRIPTION
+The
+.Nm lmi
+node type performs the frame relay LMI protocol.
+It supports
+the ITU Annex A, ANSI Annex D, and Group-of-four LMI types.
+It also supports auto-detection of the LMI type.
+.Pp
+To enable a specific LMI type, connect the corresponding hook
+.Dv ( annexA ,
+.Dv annexD ,
+or
+.Dv group4 ")"
+to DLCI 0 or 1023 of a
+.Xr ng_frame_relay 4
+node.
+Typically, Annex A and Annex D live on DLCI 0 while Group-of-four
+lives on DLCI 1023.
+.Pp
+To enable LMI type auto-detection, connect the
+.Dv auto0
+hook to DLCI 0 and the
+.Dv auto1023
+hook to DLCI 1023.
+The node will attempt to automatically determine
+which LMI type is running at the switch, and go into that mode.
+.Pp
+Only one fixed LMI type, or auto-detection, can be active at any given time.
+.Pp
+The
+.Dv NGM_LMI_GET_STATUS
+control message can be used at any time to query the current status
+of the LMI protocol and each DLCI channel.
+This node also supports the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobarbaz
+.It Dv annexA
+ITU Annex A LMI hook.
+.It Dv annexD
+ANSI Annex D LMI hook.
+.It Dv group4
+Group-of-four LMI hook.
+.It Dv auto0
+Auto-detection hook for DLCI 0.
+.It Dv auto1023
+Auto-detection hook for DLCI 1023.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_LMI_GET_STATUS
+This command returns status information in a
+.Dv "struct nglmistat" :
+.Bd -literal -offset 4n
+#define NGM_LMI_STAT_ARYSIZE (1024/8)
+
+struct nglmistat {
+ u_char proto[12]; /* Active proto (same as hook name) */
+ u_char hook[12]; /* Active hook */
+ u_char fixed; /* If set to fixed LMI mode */
+ u_char autod; /* If currently auto-detecting */
+ u_char seen[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs seen */
+ u_char up[NGM_LMI_STAT_ARYSIZE]; /* bitmap DLCIs up */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns is a human-readable version of the node status.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 4 ,
+.Xr ngctl 8
+.Rs
+.%T "ANSI T1.617-1991 Annex D"
+.Re
+.Rs
+.%T "ITU-T Q.933 Digital Subscriber Signaling System No. 1 - Signaling Specification for Frame Mode Basic Call Control, Annex A"
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_mppc.4 b/share/man/man4/ng_mppc.4
new file mode 100644
index 000000000000..df3b3a76bea0
--- /dev/null
+++ b/share/man/man4/ng_mppc.4
@@ -0,0 +1,194 @@
+.\" Copyright (c) 1996-2000 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $Whistle: ng_mppc.8,v 1.1 1999/12/08 20:20:39 archie Exp $
+.\" $FreeBSD$
+.\"
+.Dd December 8, 1999
+.Dt NG_MPPC 4
+.Os
+.Sh NAME
+.Nm ng_mppc
+.Nd Microsoft MPPC/MPPE compression and encryption netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_mppc.h
+.Sh DESCRIPTION
+The
+.Nm mppc
+node type implements the Microsoft Point-to-Point Compression (MPPC)
+and Microsoft Point-to-Point Encryption (MPPE) sub-protocols of
+the PPP protocol.
+These protocols are often used in conjunction with the Point-to-Point
+Tunneling Protocol (PPTP).
+.Pp
+The node has two hooks,
+.Dv "comp"
+for compression and
+.Dv "decomp"
+for decompression.
+Typically one or both of these hooks would be connected to the
+.Xr ng_ppp 4
+node type hook of the same name.
+Each direction of traffic flow is independent of the other.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv comp
+Connection to
+.Xr ng_ppp 4
+.Dv "comp"
+hook.
+Incoming frames are compressed and/or encrypted, and sent
+back out the same hook.
+.It Dv decomp
+Connection to
+.Xr ng_ppp 4
+.Dv "decomp"
+hook.
+Incoming frames are decompressed and/or decrypted, and sent
+back out the same hook.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_MPPC_CONFIG_COMP
+This command resets and configures the node for a session in the
+outgoing traffic direction (i.e., for compression and/or encryption).
+This command takes a
+.Dv "struct ng_mppc_config"
+as an argument:
+.Bd -literal -offset 0n
+/* Length of MPPE key */
+#define MPPE_KEY_LEN 16
+
+/* MPPC/MPPE PPP negotiation bits */
+#define MPPC_BIT 0x00000001 /* mppc compression bits */
+#define MPPE_40 0x00000020 /* use 40 bit key */
+#define MPPE_56 0x00000080 /* use 56 bit key */
+#define MPPE_128 0x00000040 /* use 128 bit key */
+#define MPPE_BITS 0x000000e0 /* mppe encryption bits */
+#define MPPE_STATELESS 0x01000000 /* use stateless mode */
+#define MPPC_VALID_BITS 0x010000e1 /* possibly valid bits */
+
+/* Configuration for a session */
+struct ng_mppc_config {
+ u_char enable; /* enable */
+ uint32_t bits; /* config bits */
+ u_char startkey[MPPE_KEY_LEN]; /* start key */
+};
+
+.Ed
+The
+.Dv enabled
+field enables traffic flow through the node.
+The
+.Dv bits
+field contains the bits as negotiated by the Compression Control Protocol
+(CCP) in PPP.
+The
+.Dv startkey
+is only necessary if MPPE was negotiated, and must be equal to the
+session start key as defined for MPPE.
+This key is based on the MS-CHAP credentials used at link authentication time.
+.It Dv NGM_MPPC_CONFIG_DECOMP
+This command resets and configures the node for a session in the
+incoming traffic direction (i.e., for decompression and/or decryption).
+This command takes a
+.Dv "struct ng_mppc_config"
+as an argument.
+.It Dv NGM_MPPC_RESETREQ
+This message contains no arguments, and is bi-directional.
+If an error is detected during decompression, this message is sent by the
+node to the originator of the
+.Dv NGM_MPPC_CONFIG_DECOMP
+message that initiated the session.
+The receiver should respond by sending a PPP CCP Reset-Request to the peer.
+.Pp
+This message may also be received by this node type when a CCP Reset-Request
+is received by the local PPP entity.
+The node will respond by flushing its outgoing compression and encryption
+state so the remote side can resynchronize.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh COMPILATION
+The kernel options
+.Dv NETGRAPH_MPPC_COMPRESSION
+and
+.Dv NETGRAPH_MPPC_ENCRYPTION
+are supplied to selectively compile in either or both capabilities.
+At least one of these must be defined, or else this node type is useless.
+.Pp
+The MPPC protocol requires proprietary compression code available
+from Hi/Fn (formerly STAC).
+These files must be obtained elsewhere and added to the kernel
+sources before this node type will compile with the
+.Dv NETGRAPH_MPPC_COMPRESSION
+option.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 4 ,
+.Xr ngctl 8
+.Rs
+.%A G. Pall
+.%T "Microsoft Point-To-Point Compression (MPPC) Protocol"
+.%O RFC 2118
+.Re
+.Rs
+.%A G. S. Pall
+.%A G. Zorn
+.%T "Microsoft Point-To-Point Encryption (MPPE) Protocol"
+.%O draft-ietf-pppext-mppe-04.txt
+.Re
+.Rs
+.%A K. Hamzeh
+.%A G. Pall
+.%A W. Verthein
+.%A J. Taarud
+.%A W. Little
+.%A G. Zorn
+.%T "Point-to-Point Tunneling Protocol (PPTP)"
+.%O RFC 2637
+.Re
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+In PPP, encryption should be handled by the Encryption Control Protocol (ECP)
+rather than CCP.
+However, Microsoft combined both compression and encryption into their
+``compression'' algorithm, which is confusing.
diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4
new file mode 100644
index 000000000000..9a3e9bc94fbc
--- /dev/null
+++ b/share/man/man4/ng_nat.4
@@ -0,0 +1,325 @@
+.\" Copyright (c) 2005 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2008
+.Dt NG_NAT 4
+.Os
+.Sh NAME
+.Nm ng_nat
+.Nd "NAT netgraph node type"
+.Sh SYNOPSIS
+.In netgraph/ng_nat.h
+.Sh DESCRIPTION
+An
+.Nm
+node performs network address translation (NAT) of packets
+passing through it.
+A
+.Nm nat
+node uses
+.Xr libalias 3
+engine for packet aliasing.
+.Sh HOOKS
+This node type has two hooks:
+.Bl -tag -width indent
+.It Va out
+Packets received on this hook are considered outgoing and will be
+masqueraded to a configured address.
+.It Va in
+Packets coming on this hook are considered incoming and will be
+dealiased.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_NAT_SET_IPADDR Pq Li setaliasaddr
+Configure aliasing address for a node.
+After both hooks have been connected and aliasing address was configured,
+a node is ready for aliasing operation.
+.It Dv NGM_NAT_SET_MODE Pq Li setmode
+Set node's operation mode using supplied
+.Vt "struct ng_nat_mode".
+.Bd -literal
+struct ng_nat_mode {
+ uint32_t flags;
+ uint32_t mask;
+};
+/* Supported flags: */
+#define NG_NAT_LOG 0x01
+#define NG_NAT_DENY_INCOMING 0x02
+#define NG_NAT_SAME_PORTS 0x04
+#define NG_NAT_UNREGISTERED_ONLY 0x10
+#define NG_NAT_RESET_ON_ADDR_CHANGE 0x20
+#define NG_NAT_PROXY_ONLY 0x40
+#define NG_NAT_REVERSE 0x80
+.Ed
+.It Dv NGM_NAT_SET_TARGET Pq Li settarget
+Configure target address for a node.
+When an incoming packet not associated with any pre-existing aliasing
+link arrives at the host machine, it will be sent to the specified address.
+.It Dv NGM_NAT_REDIRECT_PORT Pq Li redirectport
+Redirect incoming connections arriving to given port(s) to
+another host and port(s).
+The following
+.Vt "struct ng_nat_redirect_port"
+must be supplied as argument.
+.Bd -literal
+#define NG_NAT_DESC_LENGTH 64
+struct ng_nat_redirect_port {
+ struct in_addr local_addr;
+ struct in_addr alias_addr;
+ struct in_addr remote_addr;
+ uint16_t local_port;
+ uint16_t alias_port;
+ uint16_t remote_port;
+ uint8_t proto;
+ char description[NG_NAT_DESC_LENGTH];
+};
+.Ed
+.Pp
+Redirection is assigned an unique ID which is returned as
+response to this message, and
+information about redirection added to
+list of static redirects which later can be retrieved by
+.Dv NGM_NAT_LIST_REDIRECTS
+message.
+.It Dv NGM_NAT_REDIRECT_ADDR Pq Li redirectaddr
+Redirect traffic for public IP address to a machine on the
+local network.
+This function is known as
+.Em static NAT .
+The following
+.Vt "struct ng_nat_redirect_addr"
+must be supplied as argument.
+.Bd -literal
+struct ng_nat_redirect_addr {
+ struct in_addr local_addr;
+ struct in_addr alias_addr;
+ char description[NG_NAT_DESC_LENGTH];
+};
+.Ed
+.Pp
+Unique ID for this redirection is returned as response to this message.
+.It Dv NGM_NAT_REDIRECT_PROTO Pq Li redirectproto
+Redirect incoming IP packets of protocol
+.Va proto
+(see
+.Xr protocols 5 )
+to a machine on the local network.
+The following
+.Vt "struct ng_nat_redirect_proto"
+must be supplied as argument.
+.Bd -literal
+struct ng_nat_redirect_proto {
+ struct in_addr local_addr;
+ struct in_addr alias_addr;
+ struct in_addr remote_addr;
+ uint8_t proto;
+ char description[NG_NAT_DESC_LENGTH];
+};
+.Ed
+.Pp
+Unique ID for this redirection is returned as response to this message.
+.It Dv NGM_NAT_REDIRECT_DYNAMIC Pq Li redirectdynamic
+Mark redirection with specified ID as dynamic, i.e., it will serve
+for exactly one next connection and then will be automatically
+deleted from internal links table.
+Only fully specified links can be made dynamic.
+The redirection with this ID is also immediately deleted from
+user-visible list of static redirects (available through
+.Dv NGM_NAT_LIST_REDIRECTS
+message).
+.It Dv NGM_NAT_REDIRECT_DELETE Pq Li redirectdelete
+Delete redirection with specified ID (currently active
+connections are not affected).
+.It Dv NGM_NAT_ADD_SERVER Pq Li addserver
+Add another server to a pool.
+This is used to transparently offload network load on a single server
+and distribute the load across a pool of servers, also known as
+.Em LSNAT
+(RFC 2391).
+The following
+.Vt "struct ng_nat_add_server"
+must be supplied as argument.
+.Bd -literal
+struct ng_nat_add_server {
+ uint32_t id;
+ struct in_addr addr;
+ uint16_t port;
+};
+.Ed
+.Pp
+First, the redirection is set up by
+.Dv NGM_NAT_REDIRECT_PORT
+or
+.Dv NGM_NAT_REDIRECT_ADDR .
+Then, ID of that redirection is used in multiple
+.Dv NGM_NAT_ADD_SERVER
+messages to add necessary number of servers.
+For redirections created by
+.Dv NGM_NAT_REDIRECT_ADDR ,
+the
+.Va port
+is ignored and could have any value.
+Original redirection's parameters
+.Va local_addr
+and
+.Va local_port
+are also ignored after
+.Dv NGM_NAT_ADD_SERVER
+was used (they are effectively replaced by server pool).
+.It Dv NGM_NAT_LIST_REDIRECTS Pq Li listredirects
+Return list of configured static redirects as
+.Vt "struct ng_nat_list_redirects".
+.Bd -literal
+struct ng_nat_listrdrs_entry {
+ uint32_t id; /* Anything except zero */
+ struct in_addr local_addr;
+ struct in_addr alias_addr;
+ struct in_addr remote_addr;
+ uint16_t local_port;
+ uint16_t alias_port;
+ uint16_t remote_port;
+ uint16_t proto; /* Valid proto or NG_NAT_REDIRPROTO_ADDR */
+ uint16_t lsnat; /* LSNAT servers count */
+ char description[NG_NAT_DESC_LENGTH];
+};
+struct ng_nat_list_redirects {
+ uint32_t total_count;
+ struct ng_nat_listrdrs_entry redirects[];
+};
+#define NG_NAT_REDIRPROTO_ADDR (IPPROTO_MAX + 3)
+.Ed
+.Pp
+Entries of the
+.Va redirects
+array returned in the unified format for all redirect types.
+Ports are meaningful only if protocol is either TCP or UDP
+and
+.Em static NAT
+redirection (created by
+.Dv NGM_NAT_REDIRECT_ADDR )
+is indicated by
+.Va proto
+set to
+.Dv NG_NAT_REDIRPROTO_ADDR .
+If
+.Va lsnat
+servers counter is greater than zero, then
+.Va local_addr
+and
+.Va local_port
+are also meaningless.
+.It Dv NGM_NAT_PROXY_RULE Pq Li proxyrule
+Specify a transparent proxying rule (string must be
+supplied as argument).
+See
+.Xr libalias 3
+for details.
+.El
+.Pp
+In all redirection messages
+.Va local_addr
+and
+.Va local_port
+mean address and port of target machine in the internal network,
+respectively.
+If
+.Va alias_addr
+is zero, then default aliasing address (set by
+.Dv NGM_NAT_SET_IPADDR )
+is used.
+Connections can also be restricted to be accepted only
+from specific external machines by using non-zero
+.Va remote_addr
+and/or
+.Va remote_port .
+Each redirection assigned an ID which can be later used for
+redirection manipulation on individual basis (e.g., removal).
+This ID guaranteed to be unique until the node shuts down
+(it will not be reused after deletion), and is returned to
+user after making each new redirection or can be found in
+the stored list of all redirections.
+The
+.Va description
+passed to and from node unchanged, together with ID providing
+a way for several entities to concurrently manipulate
+redirections in automated way.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks are disconnected.
+.Sh EXAMPLES
+In the following example, the packets are injected into a
+.Nm nat
+node using the
+.Xr ng_ipfw 4
+node.
+.Bd -literal -offset indent
+# Create NAT node
+ngctl mkpeer ipfw: nat 60 out
+ngctl name ipfw:60 nat
+ngctl connect ipfw: nat: 61 in
+ngctl msg nat: setaliasaddr x.y.35.8
+
+# Divert traffic into NAT node
+ipfw add 300 netgraph 61 all from any to any in via fxp0
+ipfw add 400 netgraph 60 all from any to any out via fxp0
+
+# Let packets continue with after being (de)aliased
+sysctl net.inet.ip.fw.one_pass=0
+.Ed
+.Pp
+The
+.Nm
+node can be inserted right after the
+.Xr ng_iface 4
+node in the graph.
+In the following example, we perform masquerading on a
+serial line with HDLC encapsulation.
+.Bd -literal -offset indent
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer cp0: cisco rawdata downstream
+ name cp0:rawdata hdlc
+ mkpeer hdlc: nat inet in
+ name hdlc:inet nat
+ mkpeer nat: iface out inet
+ msg nat: setaliasaddr x.y.8.35
+SEQ
+ifconfig ng0 x.y.8.35 x.y.8.1
+.Ed
+.Sh SEE ALSO
+.Xr libalias 3 ,
+.Xr ng_ipfw 4 ,
+.Xr natd 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 6.0 .
+.Sh AUTHORS
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
diff --git a/share/man/man4/ng_netflow.4 b/share/man/man4/ng_netflow.4
new file mode 100644
index 000000000000..ca0020122307
--- /dev/null
+++ b/share/man/man4/ng_netflow.4
@@ -0,0 +1,348 @@
+.\" Copyright (c) 2004-2005 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 2, 2011
+.Dt NG_NETFLOW 4
+.Os
+.Sh NAME
+.Nm ng_netflow
+.Nd Cisco's NetFlow implementation
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In netgraph/netflow/ng_netflow.h
+.Sh DESCRIPTION
+The
+.Nm
+node implements Cisco's NetFlow export protocol on a router running
+.Fx .
+The
+.Nm
+node listens for incoming traffic and identifies unique flows in it.
+Flows are distinguished by endpoint IP addresses, TCP/UDP port numbers,
+ToS and input interface.
+Expired flows are exported out of the node in NetFlow version 5/9 UDP datagrams.
+Expiration reason can be one of the following:
+.Bl -dash
+.It
+RST or FIN TCP segment.
+.It
+Active timeout.
+Flows cannot live more than the specified period of time.
+The default is 1800 seconds (30 minutes).
+.It
+Inactive timeout.
+A flow was inactive for the specified period of time.
+The default is 15 seconds.
+.El
+.Pp
+Node supports IPv6 accounting (NetFlow v9 only) and is aware of multiple fibs.
+Different fibs are mapped to different domain_id in NetFlow V9 and different engine_id in NetFlow V5.
+.Sh HOOKS
+This node type supports up to
+.Dv NG_NETFLOW_MAXIFACES
+(default 65536) hooks named
+.Va iface0 , iface1 ,
+etc.,
+and the same number of hooks named
+.Va out0 , out1 ,
+etc.,
+plus two export hooks:
+.Va export
+(for NetFlow version 5) and
+.Va export9
+(for NetFlow version 9). Export can be done simultaneously for all supported
+export hooks. By default (ingress NetFlow enabled) node does NetFlow accounting of data
+received on
+.Va iface*
+hooks.
+If corresponding
+.Va out
+hook is connected, unmodified data is bypassed to it, otherwise data is freed.
+If data is received on
+.Va out
+hook, it is bypassed to corresponding
+.Va iface
+hook without any processing (egress NetFlow disabled by default).
+When full export datagram for an export protocol is built it is sent to the
+.Va export
+or
+.Va export9
+hook.
+In normal operation, one (or more) export hook is connected to the
+.Va inet/dgram/udp
+hook of the
+.Xr ng_ksocket 4
+node.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_NETFLOW_INFO
+Returns some node statistics and the current timeout values in a
+.Vt "struct ng_netflow_info" .
+.It Dv NGM_NETFLOW_IFINFO
+Returns information about the
+.Va iface Ns Ar N
+hook.
+The hook number is passed as an argument.
+.It Dv NGM_NETFLOW_SETDLT
+Sets data link type on the
+.Va iface Ns Ar N
+hook.
+Currently, supported types are raw IP datagrams and Ethernet.
+This message type uses
+.Vt "struct ng_netflow_setdlt"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_setdlt {
+ uint16_t iface; /* which iface to operate on */
+ uint8_t dlt; /* DLT_XXX from bpf.h */
+};
+.Ed
+.Pp
+The requested
+.Va iface Ns Ar N
+hook must already be connected, otherwise message send operation will
+return an error.
+.It Dv NGM_NETFLOW_SETIFINDEX
+In some cases,
+.Nm
+may be unable to determine the input interface index of a packet.
+This can happen if traffic enters the
+.Nm
+node before it comes to the system interface's input queue.
+An example of such a setup is capturing a traffic
+.Em between
+synchronous data line and
+.Xr ng_iface 4 .
+In this case, the input index should be associated with a given hook.
+The interface's index can be determined via
+.Xr if_nametoindex 3
+from userland.
+This message requires
+.Vt "struct ng_netflow_setifindex"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_setifindex {
+ uint16_t iface; /* which iface to operate on */
+ uint16_t index; /* new index */
+};
+.Ed
+.Pp
+The requested
+.Va iface Ns Ar N
+hook must already be connected, otherwise the message
+send operation will return an error.
+.It Dv NGM_NETFLOW_SETTIMEOUTS
+Sets values in seconds for NetFlow active/inactive timeouts.
+This message requires
+.Vt "struct ng_netflow_settimeouts"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_settimeouts {
+ uint32_t inactive_timeout;
+ uint32_t active_timeout;
+};
+.Ed
+.It Dv NGM_NETFLOW_SETCONFIG
+Sets configuration for the specified interface.
+This message requires
+.Vt "struct ng_netflow_setconfig"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_setconfig {
+ uint16_t iface;
+ uint32_t conf;
+#define NG_NETFLOW_CONF_INGRESS 1
+#define NG_NETFLOW_CONF_EGRESS 2
+#define NG_NETFLOW_CONF_ONCE 4
+#define NG_NETFLOW_CONF_THISONCE 8
+};
+.Ed
+.Pp
+Configuration is a bitmask of several options. Option NG_NETFLOW_CONF_INGRESS
+enabled by default enables ingress NetFlow generation (for data coming from
+ifaceX hook). Option NG_NETFLOW_CONF_EGRESS enables egress NetFlow (for data
+coming from outX hook). Option NG_NETFLOW_CONF_ONCE defines that packet should
+be accounted only once if it several times passes via netflow node. Option
+NG_NETFLOW_CONF_THISONCE defines that packet should be accounted only once
+if it several times passes via exactly this netflow node. Last two options are
+important to avoid duplicate accounting when both ingress and egress NetFlow
+are enabled.
+.It Dv NGM_NETFLOW_SETTEMPLATE
+Sets various timeouts to announce data flow templates
+(NetFlow v9-specific). This message requires
+.Vt "struct ng_netflow_settemplate"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_settemplate {
+ uint16_t time;
+ uint16_t packets;
+};
+.Ed
+.Pp
+Value of time field represents time in seconds to re-announce data templates.
+Value of packets field represents maximum packets count between
+re-announcing data templates.
+.It Dv NGM_NETFLOW_SETMTU
+Sets export interface MTU to build packets of specified size (NetFlow v9-specific).
+This message requires
+.Vt "struct ng_netflow_setmtu"
+as an argument:
+.Bd -literal -offset 4n
+struct ng_netflow_settemtu {
+ uint16_t mtu;
+};
+.Ed
+.Pp
+Default is 1500 bytes
+.It Dv NGM_NETFLOW_SHOW
+This control message asks a node to dump the entire contents of the flow cache.
+It is called from
+.Xr flowctl 8 ,
+not directly from
+.Xr ngctl 8 .
+See also
+.Sx BUGS
+section.
+.El
+.Sh ASCII CONTROL MESSAGES
+Most binary control messages have an
+.Tn ASCII
+equivalent.
+The supported
+.Tn ASCII
+commands are:
+.Pp
+.Bl -tag -width ".Dv NGM_NETFLOW_SETTIMEOUTS" -compact
+.It Dv NGM_NETFLOW_INFO
+.Qq Li info
+.It Dv NGM_NETFLOW_IFINFO
+.Qq Li "ifinfo %u"
+.It Dv NGM_NETFLOW_SETDLT
+.Qq Li "setdlt { iface = %u dlt = %u }"
+.It Dv NGM_NETFLOW_SETIFINDEX
+.Qq Li "setifindex { iface = %u index = %u }"
+.It Dv NGM_NETFLOW_SETTIMEOUTS
+.Qq Li "settimeouts { inactive = %u active = %u }"
+.It Dv NGM_NETFLOW_SETCONFIG
+.Qq Li "setconfig { iface = %u conf = %u }"
+.It Dv NGM_NETFLOW_SETTEMPLATE
+.Qq Li "settemplate { time = %u packets = %u }"
+.It Dv NGM_NETFLOW_SETMTU
+.Qq Li "setmtu { mtu = %u }"
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+The simplest possible configuration is one Ethernet interface, where
+flow collecting is enabled.
+.Bd -literal -offset indent
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer fxp0: netflow lower iface0
+ name fxp0:lower netflow
+ connect fxp0: netflow: upper out0
+ mkpeer netflow: ksocket export inet/dgram/udp
+ msg netflow:export connect inet/10.0.0.1:4444
+SEQ
+.Ed
+.Pp
+This is a more complicated example of a router with 2 NetFlow-enabled
+interfaces
+.Li fxp0
+and
+.Li ng0 .
+Note that the
+.Va ng0:
+node in this example is connected to
+.Xr ng_tee 4 .
+The latter sends us a copy of IP packets, which we analyze and free.
+On
+.Va fxp0:
+we do not use tee, but send packets back to ether node.
+.Bd -literal -offset indent
+/usr/sbin/ngctl -f- <<-SEQ
+ # connect ng0's tee to iface0 hook
+ mkpeer ng0:inet netflow right2left iface0
+ name ng0:inet.right2left netflow
+ # set DLT to raw mode
+ msg netflow: setdlt { iface=0 dlt=12 }
+ # set interface index (5 in this example)
+ msg netflow: setifindex { iface=0 index=5 }
+
+ # Connect fxp0: to iface1 and out1 hook
+ connect fxp0: netflow: lower iface1
+ connect fxp0: netflow: upper out1
+
+ # Create ksocket node on export hook, and configure it
+ # to send exports to proper destination
+ mkpeer netflow: ksocket export inet/dgram/udp
+ msg netflow:export connect inet/10.0.0.1:4444
+SEQ
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr setfib 2 ,
+.Xr ng_ether 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_ksocket 4 ,
+.Xr ng_tee 4 ,
+.Xr flowctl 8 ,
+.Xr ngctl 8
+.Rs
+.%A B. Claise, Ed
+.%T "Cisco Systems NetFlow Services Export Version 9"
+.%O RFC 3954
+.Re
+.Pp
+.Pa http://www.cisco.com/en/US/docs/ios/solutions_docs/netflow/nfwhite.html
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+node type was written by
+.An Gleb Smirnoff Aq glebius@FreeBSD.org ,
+.An Alexander Motin Aq mav@FreeBSD.org ,
+.An Alexander Chernikov Aq melifaro@ipfw.ru .
+The initial code was based on
+.Nm ng_ipacct
+written by
+.An Roman V. Palagin Aq romanp@unshadow.net .
+.Sh BUGS
+Cache snapshot obtained via
+.Dv NGM_NETFLOW_SHOW
+command may lack some percentage of entries under severe load.
+IPv6 flows are not shown.
+.Pp
+The
+.Nm
+node type does not fill in AS numbers.
+This is due to the lack of necessary information in the kernel routing table.
+However, this information can be injected into the kernel from a routing daemon
+such as GNU Zebra.
+This functionality may become available in future releases.
diff --git a/share/man/man4/ng_one2many.4 b/share/man/man4/ng_one2many.4
new file mode 100644
index 000000000000..948b763f911c
--- /dev/null
+++ b/share/man/man4/ng_one2many.4
@@ -0,0 +1,277 @@
+.\" Copyright (c) 2000 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2011
+.Dt NG_ONE2MANY 4
+.Os
+.Sh NAME
+.Nm ng_one2many
+.Nd packet multiplexing netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_one2many.h
+.Sh DESCRIPTION
+The
+.Nm one2many
+provides a simple mechanism for routing packets over several links
+in a one-to-many (and in the reverse direction, many-to-one) fashion.
+There is a single hook named
+.Dv one ,
+and multiple hooks named
+.Dv many0 ,
+.Dv many1 ,
+etc.
+Packets received on any of the
+.Dv many
+hooks are forwarded out the
+.Dv one
+hook.
+Packets received on the
+.Dv one
+hook are forwarded out one or more of the
+.Dv many
+hooks; which hook(s) is determined by the node's configured
+transmit algorithm.
+Packets are not altered in any way.
+.Pp
+Each of the connected many links may be considered to be up or down.
+Packets are never delivered out a many hook that is down.
+How a link is determined to be up or down depends on the node's
+configured link failure detection algorithm.
+.Pp
+Before an interface or link can be plumbed into a group, its status
+must be marked as being
+.Dq up .
+This is normally setup during the initial boot stages by
+.Xr rc.conf 5 .
+It is also possible to change an interface's status to
+.Dq up
+by using the
+.Xr ifconfig 8
+utility.
+.Sh TRANSMIT ALGORITHMS
+.Bl -tag -width foo
+.It Dv NG_ONE2MANY_XMIT_ROUNDROBIN
+Packets are delivered out the many hooks in sequential order.
+Each packet goes out on a different
+.Dv many
+hook.
+.It Dv NG_ONE2MANY_XMIT_ALL
+Packets are delivered out all the
+.Dv many
+hooks.
+Each packet goes out each
+.Dv many
+hook.
+.It Dv NG_ONE2MANY_XMIT_FAILOVER
+Packets are delivered out the first active
+.Dv many
+hook.
+.El
+.Pp
+In the future other algorithms may be added as well.
+.Sh LINK FAILURE DETECTION
+The node distinguishes between active and failed links.
+Data is sent only to active links.
+The following link failure detection algorithms are available:
+.Bl -tag -width indent
+.It Dv NG_ONE2MANY_FAIL_MANUAL
+The node is explicitly told which of the links are up via the
+.Dv NGM_ONE2MANY_SET_CONFIG
+control message (see below).
+Newly connected links are down until configured otherwise.
+.It Dv NG_ONE2MANY_FAIL_NOTIFY
+The node listens to flow control message from
+.Va many
+hooks, and considers link failed if
+.Dv NGM_LINK_IS_DOWN
+is received.
+If the
+.Dv NGM_LINK_IS_UP
+message is received, node considers link active.
+.El
+.Pp
+In the future other algorithms may be added as well.
+.Pp
+When all links are considered failed, node sends the
+.Dv NGM_LINK_IS_DOWN
+message towards the
+.Va one
+hook.
+When at least one link comes up, node sends the
+.Dv NGM_LINK_IS_UP
+message towards the
+.Va one
+hook.
+.Sh HOOKS
+This node type supports up to
+.Dv NG_ONE2MANY_MAX_LINKS
+hooks named
+.Dv many0 ,
+.Dv many1 ,
+etc.,
+plus a single hook named
+.Dv one .
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the
+following:
+.Bl -tag -width foo
+.It Dv NGM_ONE2MANY_SET_CONFIG
+Sets the node configuration using a
+.Dv "struct ng_one2many_link_config"
+as the control message argument:
+.Bd -literal
+/* Node configuration structure */
+struct ng_one2many_config {
+ uint32_t xmitAlg; /* how to distribute packets */
+ uint32_t failAlg; /* how to detect link failure */
+ u_char enabledLinks[NG_ONE2MANY_MAX_LINKS];
+};
+.Ed
+.Pp
+Currently, the valid settings for the
+.Dv xmitAlg
+field are
+.Dv NG_ONE2MANY_XMIT_ROUNDROBIN
+(default) or
+.Dv NG_ONE2MANY_XMIT_ALL .
+The valid settings for
+.Dv failAlg
+are
+.Dv NG_ONE2MANY_FAIL_MANUAL
+(default) or
+.Dv NG_ONE2MANY_FAIL_NOTIFY .
+.It Dv NGM_ONE2MANY_GET_CONFIG
+Returns the current node configuration in a
+.Dv "struct ng_one2many_link_config" .
+.It Dv NGM_ONE2MANY_GET_STATS
+This command takes a 32 bit link number as an argument and
+returns a
+.Dv "struct ng_one2many_link_stats"
+containing statistics for the corresponding
+.Dv many
+link, which may or may not be currently connected:
+.Bd -literal
+/* Statistics structure (one for each link) */
+struct ng_one2many_link_stats {
+ uint64_t recvOctets; /* total octets rec'd on link */
+ uint64_t recvPackets; /* total pkts rec'd on link */
+ uint64_t xmitOctets; /* total octets xmit'd on link */
+ uint64_t xmitPackets; /* total pkts xmit'd on link */
+};
+.Ed
+.Pp
+To access statistics for the
+.Dv one
+link, use the link number
+.Dv -1 .
+.It Dv NGM_ONE2MANY_CLR_STATS
+This command takes a 32 bit link number as an argument and
+clears the statistics for that link.
+.It Dv NGM_ONE2MANY_GETCLR_STATS
+Same as
+.Dv NGM_ONE2MANY_GET_STATS ,
+but also atomically clears the statistics for the link as well.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+The following commands will set up Ethernet interfaces
+.Dv fxp0
+to deliver packets alternating over the physical interfaces
+corresponding to networking interfaces
+.Dv fxp0
+through
+.Dv fxp3 :
+.Bd -literal
+ # Plumb nodes together
+
+ ngctl mkpeer fxp0: one2many upper one
+ ngctl connect fxp0: fxp0:upper lower many0
+ ngctl connect fxp1: fxp0:upper lower many1
+ ngctl connect fxp2: fxp0:upper lower many2
+ ngctl connect fxp3: fxp0:upper lower many3
+
+ # Allow fxp1 through fxp3 to xmit/recv fxp0 frames
+
+ ngctl msg fxp1: setpromisc 1
+ ngctl msg fxp2: setpromisc 1
+ ngctl msg fxp3: setpromisc 1
+ ngctl msg fxp1: setautosrc 0
+ ngctl msg fxp2: setautosrc 0
+ ngctl msg fxp3: setautosrc 0
+
+ # Configure all four links as up
+
+ ngctl msg fxp0:upper \\
+ setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 1 1 ] }"
+
+ # Bring up interface
+
+ ifconfig fxp0 192.168.1.1 netmask 0xfffffffc
+.Ed
+.Pp
+With a similar setup on a peer machine (using the address
+192.168.1.2), a point-to-point
+Ethernet connection with four times normal bandwidth is
+achieved.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_bridge 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_hub 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm one2many
+netgraph node (with round-robin algorithm) was written by
+.An Archie Cobbs
+.Aq archie@FreeBSD.org .
+The all algorithm was added by
+.An Rogier R. Mulhuijzen
+.Aq drwilco@drwilco.net .
+.Sh BUGS
+More transmit and link failure algorithms should be supported.
+A good candidate is Cisco's Etherchannel.
diff --git a/share/man/man4/ng_patch.4 b/share/man/man4/ng_patch.4
new file mode 100644
index 000000000000..e223c3966379
--- /dev/null
+++ b/share/man/man4/ng_patch.4
@@ -0,0 +1,235 @@
+.\" Copyright (c) 2010 Maxim Ignatenko <gelraen.ua@gmail.com>
+.\" Copyright (c) 2010 Vadim Goncharov <vadimnuclight@tpu.ru>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 5, 2012
+.Dt NG_PATCH 4
+.Os
+.Sh NAME
+.Nm ng_patch
+.Nd "trivial mbuf data modifying netgraph node type"
+.Sh SYNOPSIS
+.In netgraph/ng_patch.h
+.Sh DESCRIPTION
+The
+.Nm patch
+node performs data modification of packets passing through it.
+Modifications are restricted to a subset of C language operations
+on unsigned integers of 8, 16, 32 or 64 bit size.
+These are: set to new value (=), addition (+=), subtraction (-=),
+multiplication (*=), division (/=), negation (= -),
+bitwise AND (&=), bitwise OR (|=), bitwise eXclusive OR (^=),
+shift left (<<=), shift right (>>=).
+A negation operation is the one exception: integer is treated as signed
+and second operand (the
+.Va value )
+is not used.
+There may be several modification operations, they are all applied
+to a packet sequentially in order they were specified by user.
+Data payload of packet is viewed as array of bytes, with zero offset
+corresponding to the very first byte of packet headers, and
+.Va length
+bytes beginning from
+.Va offset
+are taken as a single integer in network byte order.
+.Sh HOOKS
+This node type has two hooks:
+.Bl -tag -width indent
+.It Va in
+Packets received on this hook are modified according to rules specified
+in config and then forwarded to
+.Ar out
+hook, if it exists and connected.
+Otherwise they are reflected back to the
+.Ar in
+hook.
+.It Va out
+Packets received on this hook are forwarded to
+.Ar in
+hook without any changes.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_PATCH_SETCONFIG Pq Li setconfig
+This command sets the sequence of modify operations
+that will be applied to incoming data on a hook.
+The following
+.Vt "struct ng_patch_config"
+must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_patch_op {
+ uint64_t value;
+ uint32_t offset;
+ uint16_t length; /* 1,2,4 or 8 bytes */
+ uint16_t mode;
+};
+/* Patching modes */
+#define NG_PATCH_MODE_SET 1
+#define NG_PATCH_MODE_ADD 2
+#define NG_PATCH_MODE_SUB 3
+#define NG_PATCH_MODE_MUL 4
+#define NG_PATCH_MODE_DIV 5
+#define NG_PATCH_MODE_NEG 6
+#define NG_PATCH_MODE_AND 7
+#define NG_PATCH_MODE_OR 8
+#define NG_PATCH_MODE_XOR 9
+#define NG_PATCH_MODE_SHL 10
+#define NG_PATCH_MODE_SHR 11
+
+struct ng_patch_config {
+ uint32_t count;
+ uint32_t csum_flags;
+ struct ng_patch_op ops[];
+};
+.Ed
+.Pp
+The
+.Va csum_flags
+can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_SCTP and CSUM_UDP
+(other values are ignored) for instructing the IP stack to recalculate the
+corresponding checksum before transmitting packet on output interface.
+The
+.Nm
+node does not do any checksum correction by itself.
+.It Dv NGM_PATCH_GETCONFIG Pq Li getconfig
+This control message obtains current set of modify operations,
+returned as
+.Vt "struct ng_patch_config" .
+.It Dv NGM_PATCH_GET_STATS Pq Li getstats
+Returns node statistics as a
+.Vt "struct ng_patch_stats" .
+.It Dv NGM_PATCH_CLR_STATS Pq Li clrstats
+Clear node statistics.
+.It Dv NGM_PATCH_GETCLR_STATS Pq Li getclrstats
+This command is identical to
+.Dv NGM_PATCH_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+The
+.Nm
+node allows to modify TTL and TOS/DSCP fields in IP packets.
+Suppose you have two adjacent simplex links to remote network
+(e.g.\& satellite), so that the packets expiring in between
+will generate unwanted ICMP-replies which have to go forth, not back.
+Thus you need to raise TTL of every packet entering link link by 2
+to ensure the TTL will not reach zero there.
+So you setup
+.Xr ipfw 8
+rule with
+.Cm netgraph
+action to inject packets going to other end of simplex link by the
+following
+.Xr ngctl 8
+script:
+.Bd -literal -offset 4n
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer ipfw: patch 200 in
+ name ipfw:200 ttl_add
+ msg ttl_add: setconfig { count=1 csum_flags=1 ops=[ \e
+ { mode=2 value=3 length=1 offset=8 } ] }
+SEQ
+/sbin/ipfw add 150 netgraph 200 ip from any to simplex.remote.net
+.Ed
+.Pp
+Here
+.Dq Li ttl_add
+node of type
+.Nm
+configured to add (mode
+.Dv NG_PATCH_MODE_ADD )
+a
+.Va value
+of 3 to a one-byte TTL field, which is 9th byte of IP packet header.
+.Pp
+Another example would be two consecutive modifications of packet TOS
+field: say, you need to clear the
+.Dv IPTOS_THROUGHPUT
+bit and set the
+.Dv IPTOS_MINCOST
+bit.
+So you do:
+.Bd -literal -offset 4n
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer ipfw: patch 300 in
+ name ipfw:300 tos_chg
+ msg tos_chg: setconfig { count=2 csum_flags=1 ops=[ \e
+ { mode=7 value=0xf7 length=1 offset=1 } \e
+ { mode=8 value=0x02 length=1 offset=1 } ] }
+SEQ
+/sbin/ipfw add 160 netgraph 300 ip from any to any not dst-port 80
+.Ed
+.Pp
+This first does
+.Dv NG_PATCH_MODE_AND
+clearing the fourth bit and then
+.Dv NG_PATCH_MODE_OR
+setting the third bit.
+.Pp
+In both examples the
+.Va csum_flags
+field indicates that IP checksum (but not TCP or UDP checksum) should be
+recalculated before transmit.
+.Pp
+Note: one should ensure that packets are returned to ipfw after processing
+inside
+.Xr netgraph 4 ,
+by setting appropriate
+.Xr sysctl 8
+variable:
+.Bd -literal -offset 4n
+sysctl net.inet.ip.fw.one_pass=0
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ipfw 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 8.1 .
+.Sh AUTHORS
+.An "Maxim Ignatenko" Aq gelraen.ua@gmail.com .
+This manual page was written by
+.An "Vadim Goncharov" Aq vadimnuclight@tpu.ru .
+.Sh BUGS
+Node blindly tries to apply every patching operation to each packet
+(except those which offset if greater than length of the packet),
+so be sure that you supply only the right packets to it (e.g. changing
+bytes in the ARP packets meant to be in IP header could corrupt
+them and make your machine unreachable from the network).
+.Pp
+.Em !!! WARNING !!!
+.Pp
+Output path of the IP stack assumes correct fields and lengths in the
+packets - changing them by mistake to incorrect values can cause
+unpredictable results including kernel panics.
diff --git a/share/man/man4/ng_ppp.4 b/share/man/man4/ng_ppp.4
new file mode 100644
index 000000000000..050d6399b51d
--- /dev/null
+++ b/share/man/man4/ng_ppp.4
@@ -0,0 +1,460 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd December 28, 2006
+.Dt NG_PPP 4
+.Os
+.Sh NAME
+.Nm ng_ppp
+.Nd PPP protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_ppp.h
+.Sh DESCRIPTION
+The
+.Nm ppp
+node type performs multiplexing for the PPP protocol.
+It handles only packets that contain data, and forwards protocol negotiation
+and control packets to a separate controlling entity (e.g., a
+user-land daemon).
+This approach combines the fast dispatch of
+kernel implementations with the configuration flexibility of a
+user-land implementations.
+The PPP node type directly supports
+multi-link PPP, Van Jacobson compression, PPP compression, PPP
+encryption, and the IP, IPX, and AppleTalk protocols.
+A single PPP node corresponds to one PPP multi-link bundle.
+.Pp
+There is a separate hook for each PPP link in the bundle, plus
+several hooks corresponding to the directly supported protocols.
+For compression and encryption, separate attached nodes are required
+to do the actual work.
+The node type used will of course depend on the algorithm negotiated.
+There is also a
+.Dv bypass
+hook which is used to handle any protocol not directly supported
+by the node.
+This includes all of the control protocols: LCP, IPCP,
+CCP, etc.
+Typically this node is connected to a user-land daemon via a
+.Xr ng_socket 4
+type node.
+.Sh ENABLING FUNCTIONALITY
+In general, the PPP node enables a specific link or functionality when
+(a) a
+.Dv NGM_PPP_SET_CONFIG
+message has been received which enables it, and
+(b) the corresponding hook(s) are connected.
+This allows the controlling entity to use either method (a) or (b)
+(or both) to control the node's behavior.
+When a link is connected but disabled, traffic can still flow on
+the link via the
+.Dv bypass
+hook (see below).
+.Sh LINK HOOKS
+During normal operation, the individual PPP links are connected to hooks
+.Dv link0 ,
+.Dv link1 ,
+etc.
+Up to
+.Dv NG_PPP_MAX_LINKS
+links are supported.
+These device-independent hooks transmit and receive full PPP
+frames, which include the PPP protocol, address, control, and
+information fields, but no checksum or other link-specific fields.
+.Pp
+On outgoing frames, when protocol compression
+has been enabled and the protocol number is suitable for compression,
+the protocol field will be compressed (i.e., sent as one byte
+instead of two).
+Either compressed or uncompressed protocol fields
+are accepted on incoming frames.
+Similarly, if address and control
+field compression has been enabled for the link, the address and
+control fields will be omitted (except for LCP frames as required
+by the standards).
+Incoming frames have the address and control fields
+stripped automatically if present.
+.Pp
+Since all negotiation is handled outside the PPP node, the links
+should not be connected and enabled until the corresponding link
+has reached the network phase (i.e., LCP negotiation and authentication
+have completed successfully) and the PPP node has been informed of
+the link parameters via the
+.Dv NGM_PPP_LINK_CONFIG
+message.
+.Pp
+When a link is connected but disabled, all received frames are forwarded
+directly out the
+.Dv bypass
+hook, and conversely, frames may be transmitted via the
+.Dv bypass
+hook as well.
+This mode is appropriate for the link authentication phase.
+As soon as the link is enabled, the PPP node will
+begin processing frames received on the link.
+.Sh COMPRESSION AND ENCRYPTION
+Compression is supported via two hooks,
+.Dv compress
+and
+.Dv decompress .
+Compression and decompression can be enabled by toggling the
+.Vt enableCompression
+and
+.Vt enableDecompression
+fields of the node configuration structure.
+(See below.)
+If
+.Vt enableCompression
+is set to
+.Dv NG_PPP_COMPRESS_SIMPLE ,
+then all outgoing frames are sent to the
+.Dv compress
+hook and all packets received on this hook are expected to be
+compressed, so the COMPD tag is put on them unconditionally.
+If
+.Vt enableCompression
+is set to
+.Dv NG_PPP_COMPRESS_FULL ,
+then packets received on the
+.Dv compress
+hook are resent as is.
+The compressor node should put the tag, if the packet was compressed.
+If
+.Vt enableDecompression
+is set to
+.Dv NG_PPP_DECOMPRESS_SIMPLE ,
+then the node will sent to the
+.Dv decompress
+hook only those frames, that are marked with the COMPD tag.
+If
+.Vt enableDecompression
+is set to
+.Dv NG_PPP_DECOMPRESS_FULL ,
+then the node will sent all incoming packets to the
+.Dv decompress
+hook.
+Compression and decompression can be completely disabled by setting the
+.Vt enableCompression
+and
+.Vt enableDecompression
+fields to the
+.Dv NG_PPP_COMPRESS_NONE
+and
+.Dv NG_PPP_DECOMPRESS_NONE ,
+respectively.
+.Pp
+Encryption works exactly analogously via the
+.Dv encrypt
+and
+.Dv decrypt
+nodes.
+Data is always compressed before being encrypted,
+and decrypted before being decompressed.
+.Pp
+Only bundle-level compression and encryption is directly supported;
+link-level compression and encryption can be handled transparently
+by downstream nodes.
+.Sh VAN JACOBSON COMPRESSION
+When all of the
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_vjip
+hooks are connected, and the corresponding configuration flag is
+enabled, Van Jacobson compression and/or decompression will become active.
+Normally these hooks connect to the corresponding hooks of a single
+.Xr ng_vjc 4
+node.
+The PPP node is compatible with the
+.Dq pass through
+modes of the
+.Xr ng_vjc 4
+node type.
+.Sh BYPASS HOOK
+When a frame is received on a link with an unsupported protocol,
+or a protocol which is disabled or for which the corresponding hook
+is unconnected, the PPP node forwards the frame out the
+.Dv bypass
+hook, prepended with a four byte prefix.
+This first two bytes of
+the prefix indicate the link number on which the frame was received
+(in network order).
+For such frames received over the bundle (i.e., encapsulated in the
+multi-link protocol), the special link number
+.Dv NG_PPP_BUNDLE_LINKNUM
+is used.
+After the two byte link number is the two byte PPP protocol number
+(also in network order).
+The PPP protocol number is two bytes long even if the original frame
+was protocol compressed.
+.Pp
+Conversely, any data written to the
+.Dv bypass
+hook is assumed to be in this same format.
+The four byte header is
+stripped off, the PPP protocol number is prepended (possibly compressed),
+and the frame is delivered over the desired link.
+If the link number is
+.Dv NG_PPP_BUNDLE_LINKNUM
+the frame will be delivered over the multi-link bundle; or, if multi-link
+is disabled, over the (single) PPP link.
+.Pp
+Typically when the controlling entity receives an unexpected packet on the
+.Dv bypass
+hook it responds either by dropping the frame (if it is not ready for
+the protocol) or with an LCP protocol reject (if it does not recognize
+or expect the protocol).
+.Sh MULTILINK OPERATION
+To enable multi-link PPP, the corresponding configuration flag must be set
+and at least one link connected.
+The PPP node will not allow more than
+one link to be connected if multi-link is not enabled, nor will it allow
+certain multi-link settings to be changed while multi-link operation is
+active (e.g., short sequence number header format).
+.Pp
+Since packets are sent as fragments across multiple individual links,
+it is important that when a link goes down the PPP node is notified
+immediately, either by disconnecting the corresponding hook or disabling
+the link via the
+.Dv NGM_PPP_SET_CONFIG
+control message.
+.Pp
+Each link has configuration parameters for latency (specified in
+milliseconds) and bandwidth (specified in tens of bytes per second).
+The PPP node can be configured for
+.Em round-robin
+or
+.Em optimized
+packet delivery.
+.Pp
+When configured for round-robin delivery, the latency and bandwidth
+values are ignored and the PPP node simply sends each frame as a
+single fragment, alternating frames across all the links in the
+bundle.
+This scheme has the advantage that even if one link fails
+silently, some packets will still get through.
+It has the disadvantage
+of sub-optimal overall bundle latency, which is important for
+interactive response time, and sub-optimal overall bundle bandwidth
+when links with different bandwidths exist in the same bundle.
+.Pp
+When configured for optimal delivery, the PPP node distributes the
+packet across the links in a way that minimizes the time it takes
+for the completed packet to be received by the far end.
+This involves taking into account each link's latency, bandwidth, and
+current queue length.
+Therefore these numbers should be configured as accurately as possible.
+The algorithm does require
+some computation, so may not be appropriate for very slow machines
+and/or very fast links.
+.Pp
+As a special case, if all links have identical latency and bandwidth,
+then the above algorithm is disabled (because it is unnecessary)
+and the PPP node simply fragments frames into equal sized portions
+across all of the links.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width vjc_vjuncomp
+.It Dv link<N>
+Individual PPP link number
+.Dv <N>
+.It Dv compress
+Connection to compression engine
+.It Dv decompress
+Connection to decompression engine
+.It Dv encrypt
+Connection to encryption engine
+.It Dv decrypt
+Connection to decryption engine
+.It Dv vjc_ip
+Connection to
+.Xr ng_vjc 4
+.Dv ip
+hook
+.It Dv vjc_vjcomp
+Connection to
+.Xr ng_vjc 4
+.Dv vjcomp
+hook
+.It Dv vjc_vjuncomp
+Connection to
+.Xr ng_vjc 4
+.Dv vjuncomp
+hook
+.It Dv vjc_vjip
+Connection to
+.Xr ng_vjc 4
+.Dv vjip
+hook
+.It Dv inet
+IP packet data
+.It Dv atalk
+AppleTalk packet data
+.It Dv ipx
+IPX packet data
+.It Dv bypass
+Bypass hook; frames have a four byte header consisting of
+a link number and a PPP protocol number.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PPP_SET_CONFIG
+This command configures all aspects of the node.
+This includes enabling
+multi-link PPP, encryption, compression, Van Jacobson compression, and IP,
+IPv6, AppleTalk, and IPX packet delivery.
+It includes per-link configuration,
+including enabling the link, setting latency and bandwidth parameters,
+and enabling protocol field compression.
+Note that no link or functionality
+is active until the corresponding hook is also connected.
+This command takes a
+.Dv "struct ng_ppp_node_conf"
+as an argument:
+.Bd -literal -offset 0n
+/* Per-link config structure */
+struct ng_ppp_link_conf {
+ u_char enableLink; /* enable this link */
+ u_char enableProtoComp;/* enable protocol field compression */
+ u_char enableACFComp; /* enable addr/ctrl field compression */
+ uint16_t mru; /* peer MRU */
+ uint32_t latency; /* link latency (in milliseconds) */
+ uint32_t bandwidth; /* link bandwidth (in bytes/second) */
+};
+
+/* Bundle config structure */
+struct ng_ppp_bund_conf {
+ uint16_t mrru; /* multilink peer MRRU */
+ u_char enableMultilink; /* enable multilink */
+ u_char recvShortSeq; /* recv multilink short seq # */
+ u_char xmitShortSeq; /* xmit multilink short seq # */
+ u_char enableRoundRobin; /* xmit whole packets */
+ u_char enableIP; /* enable IP data flow */
+ u_char enableIPv6; /* enable IPv6 data flow */
+ u_char enableAtalk; /* enable AppleTalk data flow */
+ u_char enableIPX; /* enable IPX data flow */
+ u_char enableCompression; /* enable PPP compression */
+ u_char enableDecompression; /* enable PPP decompression */
+ u_char enableEncryption; /* enable PPP encryption */
+ u_char enableDecryption; /* enable PPP decryption */
+ u_char enableVJCompression; /* enable VJ compression */
+ u_char enableVJDecompression; /* enable VJ decompression */
+};
+
+struct ng_ppp_node_conf {
+ struct ng_ppp_bund_conf bund;
+ struct ng_ppp_link_conf links[NG_PPP_MAX_LINKS];
+};
+.Ed
+.Pp
+.It Dv NGM_PPP_GET_CONFIG
+Returns the current configuration as a
+.Dv "struct ng_ppp_node_conf" .
+.It Dv NGM_PPP_GET_LINK_STATS
+This command takes a two byte link number as an argument and returns a
+.Dv "struct ng_ppp_link_stat"
+containing statistics for the corresponding link.
+Here
+.Dv NG_PPP_BUNDLE_LINKNUM
+is a valid link number corresponding to the multi-link bundle.
+.It Dv NGM_PPP_GET_LINK_STATS64
+Same as NGM_PPP_GET_LINK_STATS but returns
+.Dv "struct ng_ppp_link_stat64"
+containing 64bit counters.
+.It Dv NGM_PPP_CLR_LINK_STATS
+This command takes a two byte link number as an argument and
+clears the statistics for that link.
+.It Dv NGM_PPP_GETCLR_LINK_STATS
+Same as
+.Dv NGM_PPP_GET_LINK_STATS ,
+but also atomically clears the statistics as well.
+.It Dv NGM_PPP_GETCLR_LINK_STATS64
+Same as NGM_PPP_GETCLR_LINK_STATS but returns
+.Dv "struct ng_ppp_link_stat64"
+containing 64bit counters.
+.El
+.Pp
+This node type also accepts the control messages accepted by the
+.Xr ng_vjc 4
+node type.
+When received, these messages are simply forwarded to
+the adjacent
+.Xr ng_vjc 4
+node, if any.
+This is particularly useful when the individual
+PPP links are able to generate
+.Dv NGM_VJC_RECV_ERROR
+messages (see
+.Xr ng_vjc 4
+for a description).
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_async 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_mppc 4 ,
+.Xr ng_pppoe 4 ,
+.Xr ng_vjc 4 ,
+.Xr ngctl 8
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Rs
+.%A K. Sklower
+.%A B. Lloyd
+.%A G. McGregor
+.%A D. Carr
+.%A T. Coradetti
+.%T "The PPP Multilink Protocol (MP)"
+.%O RFC 1990
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
diff --git a/share/man/man4/ng_pppoe.4 b/share/man/man4/ng_pppoe.4
new file mode 100644
index 000000000000..e7a9939b29f5
--- /dev/null
+++ b/share/man/man4/ng_pppoe.4
@@ -0,0 +1,507 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pppoe.8,v 1.1 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd December 27, 2007
+.Dt NG_PPPOE 4
+.Os
+.Sh NAME
+.Nm ng_pppoe
+.Nd RFC 2516 PPPoE protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In net/ethernet.h
+.In netgraph.h
+.In netgraph/ng_pppoe.h
+.Sh DESCRIPTION
+The
+.Nm pppoe
+node type performs the PPPoE protocol.
+It is used in conjunction with the
+.Xr netgraph 4
+extensions to the Ethernet framework to divert and inject Ethernet packets
+to and from a PPP agent (which is not specified).
+.Pp
+The
+.Dv NGM_PPPOE_GET_STATUS
+control message can be used at any time to query the current status
+of the PPPoE module.
+The only statistics presently available are the
+total packet counts for input and output.
+This node does not yet support
+the
+.Dv NGM_TEXT_STATUS
+control message.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width [unspecified]
+.It Dv ethernet
+The hook that should normally be connected to an
+.Xr ng_ether 4
+node.
+Once connected,
+.Nm
+will send a message down this hook to determine Ethernet address of
+the underlying node.
+Obtained address will be stored and then used for outgoing datagrams.
+.It Dv debug
+Presently no use.
+.It Dv [unspecified]
+Any other name is assumed to be a session hook that will be connected to
+a PPP client agent, or a PPP server agent.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width 3n
+.It Dv NGM_PPPOE_GET_STATUS
+This command returns status information in a
+.Dv "struct ngpppoestat" :
+.Bd -literal -offset 4n
+struct ngpppoestat {
+ u_int packets_in; /* packets in from Ethernet */
+ u_int packets_out; /* packets out towards Ethernet */
+};
+.Ed
+.It Dv NGM_TEXT_STATUS
+This generic message returns a human-readable version of the node status.
+(not yet)
+.It Dv NGM_PPPOE_CONNECT
+Tell a nominated newly created hook that its session should enter
+the state machine as a client.
+It must be newly created and a service name can be given as an argument.
+It is legal to specify a zero-length service name, this is common
+on some DSL setups.
+It is possible to request a connection to a specific
+access concentrator by its name using the "AC-Name\\Service-Name" syntax.
+A session request packet will be broadcasted on the Ethernet.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_LISTEN
+Tell a nominated newly created hook that its session should enter
+the state machine as a server listener.
+The argument
+given is the name of the service to listen for.
+A zero-length service name will match all requests for service.
+A matching service request
+packet will be passed unmodified back to the process responsible
+for starting the service.
+It can then examine it and pass it on to
+the session that is started to answer the request.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.It Dv NGM_PPPOE_OFFER
+Tell a nominated newly created hook that its session should enter
+the state machine as a server.
+The argument given is the name of the service to offer.
+A zero-length service
+is legal.
+The State machine will progress to a state where it will await
+a request packet to be forwarded to it from the startup server,
+which in turn probably received it from a LISTEN mode hook (see above).
+This is so
+that information that is required for the session that is embedded in
+the original session request packet, is made available to the state machine
+that eventually answers the request.
+When the Session request packet is
+received, the session negotiation will proceed.
+This command uses the
+.Dv ngpppoe_init_data
+structure shown below.
+.El
+.Pp
+The three commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_init_data {
+ char hook[NG_HOOKSIZ]; /* hook to monitor on */
+ uint16_t data_len; /* service name length */
+ char data[0]; /* init data goes here */
+};
+.Ed
+.Bl -tag -width 3n
+.It Dv NGM_PPPOE_SUCCESS
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change.
+This message reports successful Session negotiation.
+It uses the structure shown below, and
+reports back the hook name corresponding to the successful session.
+.It Dv NGM_PPPOE_FAIL
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change.
+This message reports failed Session negotiation.
+It uses the structure shown below, and
+reports back the hook name corresponding to the failed session.
+The hook will probably have been removed immediately after sending this
+message.
+.It Dv NGM_PPPOE_CLOSE
+This command is sent to the node that started this session with one of the
+above messages, and reports a state change.
+This message reports a request to close a session.
+It uses the structure shown below, and
+reports back the hook name corresponding to the closed session.
+The hook will probably have been removed immediately after sending this
+message.
+At present this message is not yet used and a
+.Dv NGM_PPPOE_FAIL
+message
+will be received at closure instead.
+.It Dv NGM_PPPOE_ACNAME
+This command is sent to the node that started this session with one of the
+above messages, and reports the Access Concentrator Name.
+.El
+.Pp
+The four commands above use a common data structure:
+.Bd -literal -offset 4n
+struct ngpppoe_sts {
+ char hook[NG_HOOKSIZ]; /* hook associated with event session */
+};
+.Ed
+.Bl -tag -width 3n
+.It Dv NGM_PPPOE_GETMODE
+This command returns the current compatibility mode of the node
+as a string.
+.Tn ASCII
+form of this message is
+.Qq Li pppoe_getmode .
+The following keywords can be returned:
+.Bl -tag -width 3n
+.It Qq standard
+The node operates according to RFC 2516.
+.It Qq 3Com
+When
+.Nm
+is a PPPoE client, it initiates a session encapsulating packets into
+incorrect 3Com ethertypes.
+This compatibility option does not affect server mode.
+In server mode
+.Nm
+supports both modes simultaneously, depending on the ethertype, the
+client used when connecting.
+.It Qq D-Link
+When
+.Nm
+is a PPPoE server serving only specific Service-Name(s), it will respond
+to a PADI requests with empty Service-Name tag, returning all available
+Service-Name(s) on node.
+This option is necessary for compatibility with D-Link DI-614+ and DI-624+
+SOHO routers as clients, when serving only specific Service-Name.
+This compatibility option does not affect client mode.
+.El
+.It Dv NGM_PPPOE_SETMODE
+Configure node to the specified mode.
+The string argument is required.
+This command understands the same keywords that are returned by the
+.Dv NGM_PPPOE_GETMODE
+command.
+.Tn ASCII
+form of this message is
+.Qq Li pppoe_setmode .
+For example, the following command will configure the node to initiate
+the next session in the proprietary 3Com mode:
+.Bd -literal -offset indent
+ngctl msg fxp0:orphans pppoe_setmode '"3Com"'
+.Ed
+.It Dv NGM_PPPOE_SETENADDR
+Set the node Ethernet address for outgoing datagrams.
+This message is important when a node has failed to obtain an Ethernet
+address from its peer on the
+.Dv ethernet
+hook, or when user wants to override this address with another one.
+.Tn ASCII
+form of this message is
+.Qq Li setenaddr .
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, when all session have been disconnected or when the
+.Dv ethernet
+hook is disconnected.
+.Sh EXAMPLES
+The following code uses
+.Dv libnetgraph
+to set up a
+.Nm
+node and connect it to both a socket node and an Ethernet node.
+It can handle the case of when a
+.Nm
+node is already attached to the Ethernet.
+It then starts a client session.
+.Bd -literal
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include <errno.h>
+#include <err.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <net/ethernet.h>
+
+#include <netgraph.h>
+#include <netgraph/ng_ether.h>
+#include <netgraph/ng_pppoe.h>
+#include <netgraph/ng_socket.h>
+static int setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd);
+
+int
+main()
+{
+ int fd1, fd2;
+ setup("xl0", NULL, "fred", &fd1, &fd2);
+ sleep (30);
+}
+
+static int
+setup(char *ethername, char *service, char *sessname,
+ int *dfd, int *cfd)
+{
+ struct ngm_connect ngc; /* connect */
+ struct ngm_mkpeer mkp; /* mkpeer */
+ /******** nodeinfo stuff **********/
+ u_char rbuf[2 * 1024];
+ struct ng_mesg *const resp = (struct ng_mesg *) rbuf;
+ struct hooklist *const hlist
+ = (struct hooklist *) resp->data;
+ struct nodeinfo *const ninfo = &hlist->nodeinfo;
+ int ch, no_hooks = 0;
+ struct linkinfo *link;
+ struct nodeinfo *peer;
+ /****message to connect PPPoE session*****/
+ struct {
+ struct ngpppoe_init_data idata;
+ char service[100];
+ } message;
+ /********tracking our little graph ********/
+ char path[100];
+ char source_ID[NG_NODESIZ];
+ char pppoe_node_name[100];
+ int k;
+
+ /*
+ * Create the data and control sockets
+ */
+ if (NgMkSockNode(NULL, cfd, dfd) < 0) {
+ return (errno);
+ }
+ /*
+ * find the ether node of the name requested by asking it for
+ * it's inquiry information.
+ */
+ if (strlen(ethername) > 16)
+ return (EINVAL);
+ sprintf(path, "%s:", ethername);
+ if (NgSendMsg(*cfd, path, NGM_GENERIC_COOKIE,
+ NGM_LISTHOOKS, NULL, 0) < 0) {
+ return (errno);
+ }
+ /*
+ * the command was accepted so it exists. Await the reply (It's
+ * almost certainly already waiting).
+ */
+ if (NgRecvMsg(*cfd, resp, sizeof(rbuf), NULL) < 0) {
+ return (errno);
+ }
+ /**
+ * The following is available about the node:
+ * ninfo->name (string)
+ * ninfo->type (string)
+ * ninfo->id (uint32_t)
+ * ninfo->hooks (uint32_t) (count of hooks)
+ * check it is the correct type. and get it's ID for use
+ * with mkpeer later.
+ */
+ if (strncmp(ninfo->type, NG_ETHER_NODE_TYPE,
+ strlen(NG_ETHER_NODE_TYPE)) != 0) {
+ return (EPROTOTYPE);
+ }
+ sprintf(source_ID, "[%08x]:", ninfo->id);
+
+ /*
+ * look for a hook already attached.
+ */
+ for (k = 0; k < ninfo->hooks; k++) {
+ /**
+ * The following are available about each hook.
+ * link->ourhook (string)
+ * link->peerhook (string)
+ * peer->name (string)
+ * peer->type (string)
+ * peer->id (uint32_t)
+ * peer->hooks (uint32_t)
+ */
+ link = &hlist->link[k];
+ peer = &hlist->link[k].nodeinfo;
+
+ /* Ignore debug hooks */
+ if (strcmp("debug", link->ourhook) == 0)
+ continue;
+
+ /* If the orphans hook is attached, use that */
+ if (strcmp(NG_ETHER_HOOK_ORPHAN,
+ link->ourhook) == 0) {
+ break;
+ }
+ /* the other option is the 'divert' hook */
+ if (strcmp("NG_ETHER_HOOK_DIVERT",
+ link->ourhook) == 0) {
+ break;
+ }
+ }
+
+ /*
+ * See if we found a hook there.
+ */
+ if (k < ninfo->hooks) {
+ if (strcmp(peer->type, NG_PPPOE_NODE_TYPE) == 0) {
+ /*
+ * If it's a type PPPoE, we skip making one
+ * ourself, but we continue, using
+ * the existing one.
+ */
+ sprintf(pppoe_node_name, "[%08x]:", peer->id);
+ } else {
+ /*
+ * There is already someone hogging the data,
+ * return an error. Some day we'll try
+ * daisy-chaining..
+ */
+ return (EBUSY);
+ }
+ } else {
+
+ /*
+ * Try make a node of type PPPoE against node "ID"
+ * On hook NG_ETHER_HOOK_ORPHAN.
+ */
+ snprintf(mkp.type, sizeof(mkp.type),
+ "%s", NG_PPPOE_NODE_TYPE);
+ snprintf(mkp.ourhook, sizeof(mkp.ourhook),
+ "%s", NG_ETHER_HOOK_ORPHAN);
+ snprintf(mkp.peerhook, sizeof(mkp.peerhook),
+ "%s", NG_PPPOE_HOOK_ETHERNET);
+ /* Send message */
+ if (NgSendMsg(*cfd, source_ID, NGM_GENERIC_COOKIE,
+ NGM_MKPEER, &mkp, sizeof(mkp)) < 0) {
+ return (errno);
+ }
+ /*
+ * Work out a name for the new node.
+ */
+ sprintf(pppoe_node_name, "%s:%s",
+ source_ID, NG_ETHER_HOOK_ORPHAN);
+ }
+ /*
+ * We now have a PPPoE node attached to the Ethernet
+ * card. The Ethernet is addressed as ethername: The PPPoE
+ * node is addressed as pppoe_node_name: attach to it.
+ * Connect socket node to specified node Use the same hook
+ * name on both ends of the link.
+ */
+ snprintf(ngc.path, sizeof(ngc.path), "%s", pppoe_node_name);
+ snprintf(ngc.ourhook, sizeof(ngc.ourhook), "%s", sessname);
+ snprintf(ngc.peerhook, sizeof(ngc.peerhook), "%s", sessname);
+
+ if (NgSendMsg(*cfd, ".:", NGM_GENERIC_COOKIE,
+ NGM_CONNECT, &ngc, sizeof(ngc)) < 0) {
+ return (errno);
+ }
+
+#ifdef NONSTANDARD
+ /*
+ * In some cases we are speaking to 3Com hardware, so
+ * configure node to non-standard mode.
+ */
+ if (NgSendMsg(*cfd, ngc.path, NGM_PPPOE_COOKIE,
+ NGM_PPPOE_SETMODE, NG_PPPOE_NONSTANDARD,
+ strlen(NG_PPPOE_NONSTANDARD) + 1) == -1) {
+ return (errno);
+ }
+#endif
+
+ /*
+ * Send it a message telling it to start up.
+ */
+ bzero(&message, sizeof(message));
+ snprintf(message.idata.hook, sizeof(message.idata.hook),
+ "%s", sessname);
+ if (service == NULL) {
+ message.idata.data_len = 0;
+ } else {
+ snprintf(message.idata.data,
+ sizeof(message.idata.data), "%s", service);
+ message.idata.data_len = strlen(service);
+ }
+ /* Tell session/hook to start up as a client */
+ if (NgSendMsg(*cfd, ngc.path,
+ NGM_PPPOE_COOKIE, NGM_PPPOE_CONNECT, &message.idata,
+ sizeof(message.idata) + message.idata.data_len) < 0) {
+ return (errno);
+ }
+ return (0);
+}
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_ether 4 ,
+.Xr ng_ppp 4 ,
+.Xr ng_socket 4 ,
+.Xr ngctl 8 ,
+.Xr ppp 8
+.Rs
+.%A L. Mamakos
+.%A K. Lidl
+.%A J. Evarts
+.%A D. Carrel
+.%A D. Simone
+.%A R. Wheeler
+.%T "A Method for transmitting PPP over Ethernet (PPPoE)"
+.%O RFC 2516
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_pptpgre.4 b/share/man/man4/ng_pptpgre.4
new file mode 100644
index 000000000000..e0d41f1c0cfd
--- /dev/null
+++ b/share/man/man4/ng_pptpgre.4
@@ -0,0 +1,178 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_pptpgre.8,v 1.2 1999/12/08 00:20:53 archie Exp $
+.\"
+.Dd March 29, 2008
+.Dt NG_PPTPGRE 4
+.Os
+.Sh NAME
+.Nm ng_pptpgre
+.Nd PPTP GRE protocol netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_pptpgre.h
+.Sh DESCRIPTION
+The
+.Nm pptpgre
+node type performs Generic Routing Encapsulation (GRE) over IP
+for the PPTP protocol as specified by RFC 2637.
+This involves packet
+encapsulation, sequencing, acknowledgement, and an adaptive timeout
+sliding window mechanism.
+This node type does not handle any of
+the TCP control protocol or call negotiation defined by PPTP.
+.Pp
+This node type expects to receive complete IP packets,
+including the IP header, on the
+.Dq Li lower
+hook, but it transmits outgoing frames without any IP header.
+The typical use for this node type would be to connect the
+.Dq Li upper
+hook to one of the link hooks of a
+.Xr ng_ppp 4
+node, and the
+.Dq Li lower
+hook to the
+.Dq Li "inet/raw/gre"
+hook of a
+.Xr ng_ksocket 4
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width ".Li session_hhhh"
+.It Li session_hhhh
+Session 0xhhhh data packets to the upper protocol layers
+.It Li upper
+Same as session_hhhh, but for single session with configurable cid (legacy)
+.It Li lower
+Connection to the lower protocol layers
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_PPTPGRE_SET_CONFIG
+This command resets and configures hook for a session. If corresponding
+session_hhhh hook is not connected, upper hook will be configured.
+This command takes a
+.Vt "struct ng_pptpgre_conf"
+as an argument:
+.Bd -literal
+/* Configuration for a session */
+struct ng_pptpgre_conf {
+ u_char enabled; /* enables traffic flow */
+ u_char enableDelayedAck; /* enables delayed acks */
+ u_char enableAlwaysAck; /* always send ack with data */
+ u_char enableWindowing; /* enable windowing algorithm */
+ uint16_t cid; /* my call id */
+ uint16_t peerCid; /* peer call id */
+ uint16_t recvWin; /* peer recv window size */
+ uint16_t peerPpd; /* peer packet processing delay
+ (in 1/10 of a second) */
+};
+.Ed
+.Pp
+The
+.Va enabled
+field enables traffic flow through the node.
+The
+.Va enableDelayedAck
+field enables delayed acknowledgement (maximum 250 milliseconds), which
+is a useful optimization and should generally be turned on.
+.Va enableAlwaysAck
+field enables sending acknowledgements with every data packet, which
+is probably helpful as well.
+.Pp
+.Va enableWindowing
+enables the PPTP packet windowing mechanism specified by the protocol.
+Disabling this will cause the node to violate the protocol, possibly
+confusing other PPTP peers, but often results in better performance.
+The windowing mechanism is a design error in the PPTP protocol;
+L2TP, the successor to PPTP, removes it.
+.Pp
+The remaining fields are as supplied by the PPTP virtual call setup process.
+.It Dv NGM_PPTPGRE_GET_CONFIG
+Takes two byte argument as cid and returns the current configuration as a
+.Vt "struct ng_pptpgre_conf" .
+.It Dv NGM_PPTPGRE_GET_STATS
+This command returns a
+.Vt "struct ng_pptpgre_stats"
+containing various node statistics.
+.It Dv NGM_PPTPGRE_CLR_STATS
+This command resets the node statistics.
+.It Dv NGM_PPTPGRE_GETCLR_STATS
+This command atomically gets and resets the node statistics, returning a
+.Vt "struct ng_pptpgre_stats" .
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when both hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ksocket 4 ,
+.Xr ng_ppp 4 ,
+.Xr ngctl 8
+.Rs
+.%A K. Hamzeh
+.%A G. Pall
+.%A W. Verthein
+.%A J. Taarud
+.%A W. Little
+.%A G. Zorn
+.%T "Point-to-Point Tunneling Protocol (PPTP)"
+.%O RFC 2637
+.Re
+.Rs
+.%A S. Hanks
+.%A T. \&Li
+.%A D. Farinacci
+.%A P. Traina
+.%T "Generic Routing Encapsulation over IPv4 networks"
+.%O RFC 1702
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+The node should not expect incoming GRE packets to have an IP header.
+This behavior is inherited from the (converse) behavior of raw IP sockets.
+An intermediate node that strips IP headers in one direction
+should be used instead.
diff --git a/share/man/man4/ng_pred1.4 b/share/man/man4/ng_pred1.4
new file mode 100644
index 000000000000..a8c8c5e06d17
--- /dev/null
+++ b/share/man/man4/ng_pred1.4
@@ -0,0 +1,145 @@
+.\"
+.\" Copyright (c) 2006, Alexander Motin <mav@alkar.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 24, 2006
+.Dt NG_PRED1 4
+.Os
+.Sh NAME
+.Nm ng_pred1
+.Nd Predictor-1 PPP compression (RFC 1978) netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_pred1.h
+.Sh DESCRIPTION
+The
+.Nm pred1
+node type implements the Predictor-1 sub-protocols of the Compression Control
+Protocol (CCP).
+.Pp
+The node has two hooks,
+.Va comp
+for compression and
+.Va decomp
+for decompression.
+Only one of them can be connected at the same time, specifying node's
+operation mode.
+Typically that hooks would be connected to the
+.Xr ng_ppp 4
+node type hook of the same name.
+.Sh HOOKS
+This node type supports the following hooks:
+.Pp
+.Bl -tag -compact -width decomp
+.It Va comp
+Connection to
+.Xr ng_ppp 4
+.Va compress
+hook.
+Incoming frames are compressed and sent back out the same hook.
+.It Va decomp
+Connection to
+.Xr ng_ppp 4
+.Va decompress
+hook.
+Incoming frames are decompressed and sent back out the same hook.
+.El
+.Pp
+Only one hook can be connected at the same time,
+specifying node's operation mode.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_PRED1_CONFIG Pq Li config
+This command resets and configures the node for a session
+(i.e., for compression or decompression).
+This command takes a
+.Vt "struct ng_pred1_config"
+as an argument:
+.Bd -literal -offset 0n
+struct ng_pred1_config {
+ u_char enable; /* node enabled */
+};
+.Ed
+The
+.Ft enable
+field enables traffic flow through the node.
+.It Dv NGM_PRED1_RESETREQ Pq Li resetreq
+This message contains no arguments, and is bi-directional.
+If an error is detected during decompression, this message is sent by the
+node to the originator of the
+.Dv NGM_PRED1_CONFIG
+message that initiated the session.
+The receiver should respond by sending a PPP CCP Reset-Request to the peer.
+.Pp
+This message may also be received by this node type when a CCP Reset-Request
+or Reset-Ack is received by the local PPP entity.
+The node will respond by flushing its compression state so the sides
+can resynchronize.
+.It Dv NGM_PRED1_GET_STATS Pq Li getstats
+This control message obtains statistics for a given hook.
+The statistics are returned in
+.Vt "struct ng_pred1_stats" :
+.Bd -literal
+struct ng_pred1_stats {
+ uint64_t FramesPlain;
+ uint64_t FramesComp;
+ uint64_t FramesUncomp;
+ uint64_t InOctets;
+ uint64_t OutOctets;
+ uint64_t Errors;
+};
+.Ed
+.It Dv NGM_PRED1_CLR_STATS Pq Li clrstats
+This control message clears statistics for a given hook.
+.It Dv NGM_PRED1_GETCLR_STATS Pq Li getclrstats
+This control message obtains and clears statistics for a given hook.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when hook have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ppp 4 ,
+.Xr ngctl 8
+.Rs
+.%A D. Rand
+.%T "PPP Predictor Compression Protocol"
+.%O RFC 1978
+.Re
+.Rs
+.%A W. Simpson
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Sh AUTHORS
+.An Alexander Motin Aq mav@alkar.net
+.Sh BUGS
+Due to nature of netgraph PPP implementation there are possible race conditions
+between data packet and ResetAck CCP packet in case of packet loss. As result,
+packet loss can produce bigger performance degradation than supposed by protocol.
diff --git a/share/man/man4/ng_rfc1490.4 b/share/man/man4/ng_rfc1490.4
new file mode 100644
index 000000000000..472b30871c47
--- /dev/null
+++ b/share/man/man4/ng_rfc1490.4
@@ -0,0 +1,141 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_rfc1490.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_RFC1490 4
+.Os
+.Sh NAME
+.Nm ng_rfc1490
+.Nd RFC 1490 netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_rfc1490.h
+.Sh DESCRIPTION
+The
+.Nm rfc1490
+node type performs protocol encapsulation, de-encapsulation, and
+multiplexing according to RFC 1490 (which has since been updated by RFC 2427).
+This particular type of encapsulation is often used on top of frame relay
+DLCI channels.
+.Pp
+The
+.Dv downstream
+hook is used to transmit and receive encapsulated frames.
+On the other side of the node, the
+.Dv inet
+and
+.Dv ppp
+hooks are used to transmit and receive raw IP frames and PPP frames,
+respectively.
+PPP frames are transmitted and received according to
+RFC 1973; in particular, frames appearing on the
+.Dv ppp
+hook begin with the PPP protocol number.
+The
+.Dv ethernet
+hook can be used to transmit and receive Ethernet frames (without a
+checksum) in RFC 1490's bridging format.
+.Pp
+Typically the
+.Dv inet
+hook is connected to the
+.Dv inet
+hook of an
+.Xr ng_iface 4
+node.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobarbazum
+.It Dv downstream
+Connects to the RFC 1490 peer entity.
+.It Dv ethernet
+Transmits and receives bridged raw Ethernet frames, without a checksum.
+.It Dv inet
+Transmits and receives raw IP frames.
+.It Dv ppp
+Transmits and receives PPP frames.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_RFC1490_SETENCAP
+This command sets encapsulation method for the node.
+The desired method must be passed as a string message argument,
+and must be one of the following supported encapsulation modes:
+.Bl -tag -width ".Qq Li ietf-snap"
+.It Qq Li ietf-ip
+IP packets are sent using simple RFC1490/2427 encapsulation.
+.It Qq Li ietf-snap
+IP packets are sent inside SNAP frames.
+Also conforms to RFC1490/2427.
+.It Qq Li cisco
+IP packets are sent and received using proprietary Cisco encapsulation
+method.
+.El
+.It Dv NGM_RFC1490_GETENCAP
+This command returns current encapsulation method on the node.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_frame_relay 4 ,
+.Xr ng_iface 4 ,
+.Xr ngctl 8
+.Rs
+.%A C. Brown
+.%A A. Malis
+.%T "Multiprotocol Interconnect over Frame Relay"
+.%O RFC 2427
+.Re
+.Rs
+.%A W. Simpson
+.%T "PPP in Frame Relay"
+.%O RFC 1973
+.Re
+.Pp
+.Pa http://www.cisco.com/warp/public/121/frf8modes.pdf
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
+.Sh BUGS
+Not all of RFC 1490 is implemented.
diff --git a/share/man/man4/ng_socket.4 b/share/man/man4/ng_socket.4
new file mode 100644
index 000000000000..22c6638a0acf
--- /dev/null
+++ b/share/man/man4/ng_socket.4
@@ -0,0 +1,189 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_socket.8,v 1.5 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_SOCKET 4
+.Os
+.Sh NAME
+.Nm ng_socket
+.Nd netgraph socket node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_socket.h
+.Sh DESCRIPTION
+A
+.Nm socket
+node is both a
+.Bx
+socket and a netgraph node.
+The
+.Nm
+node type allows user-mode processes to participate in the kernel
+.Xr netgraph 4
+networking subsystem using the
+.Bx
+socket interface.
+The process must have
+root privileges to be able to create netgraph sockets however once created,
+any process that has one may use it.
+.Pp
+A new
+.Nm
+node is created by creating a new socket of type
+.Dv NG_CONTROL
+in the protocol family
+.Dv PF_NETGRAPH ,
+using the
+.Xr socket 2
+system call.
+Any control messages received by the node
+and not having a cookie value of
+.Dv NGM_SOCKET_COOKIE
+are received by the process, using
+.Xr recvfrom 2 ;
+the socket address argument is a
+.Dv "struct sockaddr_ng"
+containing the sender's netgraph address.
+Conversely, control messages can be sent to any node by calling
+.Xr sendto 2 ,
+supplying the recipient's address in a
+.Dv "struct sockaddr_ng" .
+The
+.Xr bind 2
+system call may be used to assign a global netgraph name to the node.
+.Pp
+To transmit and receive netgraph data packets, a
+.Dv NG_DATA
+socket must also be created using
+.Xr socket 2
+and associated with a
+.Nm
+node.
+.Dv NG_DATA sockets do not automatically
+have nodes associated with them; they are bound to a specific node via the
+.Xr connect 2
+system call.
+The address argument is the netgraph address of the
+.Nm
+node already created.
+Once a data socket is associated with a node,
+any data packets received by the node are read using
+.Xr recvfrom 2
+and any packets to be sent out from the node are written using
+.Xr sendto 2 .
+In the case of data sockets, the
+.Dv "struct sockaddr_ng"
+contains the name of the
+.Em hook
+on which the data was received or should be sent.
+.Pp
+As a special case, to allow netgraph data sockets to be used as stdin or stdout
+on naive programs, a
+.Xr sendto 2
+with a NULL sockaddr pointer, a
+.Xr send 2
+or a
+.Xr write 2
+will succeed in the case where there is exactly ONE hook attached to
+the socket node, (and thus the path is unambiguous).
+.Pp
+There is a user library that simplifies using netgraph sockets; see
+.Xr netgraph 3 .
+.Sh HOOKS
+This node type supports hooks with arbitrary names (as long as
+they are unique) and always accepts hook connection requests.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_SOCK_CMD_NOLINGER
+When the last hook is removed from this node, it will shut down as
+if it had received a
+.Dv NGM_SHUTDOWN
+message.
+Attempts to access the sockets associated will return
+.Er ENOTCONN .
+.It Dv NGM_SOCK_CMD_LINGER
+This is the default mode.
+When the last hook is removed, the node will
+continue to exist, ready to accept new hooks until it
+is explicitly shut down.
+.El
+.Pp
+All other messages
+with neither the
+.Dv NGM_SOCKET_COOKIE
+or
+.Dv NGM_GENERIC_COOKIE
+will be passed unaltered up the
+.Dv NG_CONTROL
+socket.
+.Sh SHUTDOWN
+This node type shuts down and disappears when both the associated
+.Dv NG_CONTROL
+and
+.Dv NG_DATA
+sockets have been closed, or a
+.Dv NGM_SHUTDOWN
+control message is received.
+In the latter case, attempts to write
+to the still-open sockets will return
+.Er ENOTCONN .
+If the
+.Dv NGM_SOCK_CMD_NOLINGER
+message has been received, closure of the last hook will also initiate
+a shutdown of the node.
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr netgraph 3 ,
+.Xr netgraph 4 ,
+.Xr ng_ksocket 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
+.Sh BUGS
+It is not possible to reject the connection of a hook, though any
+data received on that hook can certainly be ignored.
+.Pp
+The controlling process is not notified of all events that an in-kernel node
+would be notified of, e.g.\& a new hook, or hook removal.
+Some node-initiated messages should be defined for this purpose (to be
+sent up the control socket).
diff --git a/share/man/man4/ng_source.4 b/share/man/man4/ng_source.4
new file mode 100644
index 000000000000..7c55751cb93a
--- /dev/null
+++ b/share/man/man4/ng_source.4
@@ -0,0 +1,349 @@
+.\" Copyright 2002-2007 Sandvine Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Sandvine Inc.; provided,
+.\" however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Sandvine Inc.
+.\" trademarks, including the mark "SANDVINE" on advertising, endorsements,
+.\" or otherwise except as such appears in the above copyright notice or in
+.\" the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY SANDVINE "AS IS", AND TO THE MAXIMUM
+.\" EXTENT PERMITTED BY LAW, SANDVINE MAKES NO REPRESENTATIONS OR WARRANTIES,
+.\" EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, INCLUDING WITHOUT LIMITATION,
+.\" ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+.\" PURPOSE, OR NON-INFRINGEMENT. SANDVINE DOES NOT WARRANT, GUARANTEE, OR
+.\" MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE
+.\" USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY
+.\" OR OTHERWISE. IN NO EVENT SHALL SANDVINE BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" Author: Dave Chapeskie
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2007
+.Dt NG_SOURCE 4
+.Os
+.Sh NAME
+.Nm ng_source
+.Nd netgraph node for traffic generation
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_source.h
+.Sh DESCRIPTION
+The
+.Nm source
+node acts as a source of packets according to the parameters set up
+using control messages and input packets.
+The
+.Nm
+node type is used primarily for testing and benchmarking.
+.Sh HOOKS
+The
+.Nm source
+node has two hooks:
+.Va input
+and
+.Va output .
+The
+.Va output
+hook must remain connected, its disconnection will shutdown the node.
+.Sh OPERATION
+The operation of the node is as follows.
+Packets received on the
+.Va input
+hook are queued internally.
+When
+.Va output
+hook is connected,
+.Nm
+node assumes that its neighbour node is of
+.Xr ng_ether 4
+node type.
+The neighbour is queried for its interface name.
+The
+.Nm
+node then uses queue of the interface for its evil purposes.
+The
+.Nm
+node also disables
+.Va autosrc
+option on neighbour
+.Xr ng_ether 4
+node.
+If interface name cannot be obtained automatically, it should
+be configured explicitly with the
+.Dv NGM_SOURCE_SETIFACE
+control message, and
+.Va autosrc
+should be turned off on
+.Xr ng_ether 4
+node manually.
+.Pp
+Once interface is configured, upon receipt of a
+.Dv NGM_SOURCE_START
+control message the node starts sending
+the previously queued packets out the
+.Va output
+hook on every clock tick as fast
+as the connected interface will take them.
+While active, on every clock tick the node checks the available space
+in the interface queue and sends that many packets out its
+.Va output
+hook.
+Once the number of packets indicated in the start message has been
+sent, or upon receipt of a
+.Dv NGM_SOURCE_STOP
+message, the node stops sending data.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages as well as the following,
+which must be sent with the
+.Dv NGM_SOURCE_COOKIE
+attached.
+.Bl -tag -width indent
+.It Dv NGM_SOURCE_GET_STATS Pq Ic getstats
+Returns a structure containing the following fields:
+.Bl -tag -width indent
+.It Va outOctets
+The number of octets/bytes sent out the
+.Va output
+hook.
+.It Va outFrames
+The number of frames/packets sent out the
+.Va output
+hook.
+.It Va queueOctets
+The number of octets queued from the
+.Va input
+hook.
+.It Va queueFrames
+The number of frames queued from the
+.Va input
+hook.
+.It Va startTime
+The time the last start message was received.
+.It Va endTime
+The time the last end message was received or
+the output packet count was reached.
+.It Va elapsedTime
+Either
+.Va endTime Li \- Va startTime
+or current time
+\-
+.Va startTime .
+.El
+.It Dv NGM_SOURCE_CLR_STATS Pq Ic clrstats
+Clears and resets the statistics returned by
+.Ic getstats
+(except
+.Va queueOctets
+and
+.Va queueFrames ) .
+.It Dv NGM_SOURCE_GETCLR_STATS Pq Ic getclrstats
+As
+.Ic getstats
+but clears the statistics at the same time.
+.It Dv NGM_SOURCE_START Pq Ic start
+This message requires a single
+.Vt uint64_t
+parameter which is the number of packets to
+send before stopping.
+Node starts sending the queued packets out the
+.Va output
+hook.
+The
+.Va output
+hook must be connected and node must have
+interface configured.
+.It Dv NGM_SOURCE_STOP Pq Ic stop
+Stops the node if it is active.
+.It Dv NGM_SOURCE_CLR_DATA Pq Ic clrdata
+Clears the packets queued from the
+.Va input
+hook.
+.It Dv NGM_SOURCE_SETIFACE Pq Ic setiface
+This message requires the name of the interface
+to be configured as an argument.
+.It Dv NGM_SOURCE_SETPPS Pq Ic setpps
+This message requires a single
+.Vt uint32_t
+parameter which puts upper limit on the amount of packets
+sent per second.
+.It Dv NGM_SOURCE_SET_TIMESTAMP Pq Ic settimestamp
+This message specifies that a timestamp (in the format of a
+.Vt "struct timeval" )
+should be inserted in the transmitted packets.
+This message requires a structure containing the following fields:
+.Bl -tag -width indent
+.It Va offset
+The offset from the beginning of the packet at which the timestamp is to be
+inserted.
+.It Va flags
+Set to 1 to enable the timestamp.
+.El
+.It Dv NGM_SOURCE_GET_TIMESTAMP Pq Ic gettimestamp
+Returns the current timestamp settings in the form of the structure described
+above.
+.It Dv NGM_SOURCE_SET_COUNTER Pq Ic setcounter
+This message specifies that a counter should be embedded in transmitted
+packets.
+Up to four counters may be independently configured.
+This message requires a structure containing the following fields:
+.Bl -tag -width indent
+.It Va offset
+The offset from the beginning of the packet at which the counter is to be
+inserted.
+.It Va flags
+Set to 1 to enable the counter.
+.It Va width
+The byte width of the counter.
+It may be 1, 2, or 4.
+.It Va next_val
+The value for the next insertion of the counter.
+.It Va min_val
+The minimum value to be used by the counter.
+.It Va max_val
+The maximum value to be used by the counter.
+.It Va increment
+The value to be added to the counter after each insertion.
+It may be negative.
+.It Va index
+The counter to be configured, from 0 to 3.
+.El
+.It Dv NGM_SOURCE_GET_COUNTER Pq Ic getcounter
+This message requires a single
+.Vt uint8_t
+parameter which specifies the counter to query.
+Returns the current counter settings in the form of the structure described
+above.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, when all hooks have been disconnected, or when the
+.Va output
+hook has been disconnected.
+.Sh EXAMPLES
+Attach the node to an
+.Xr ng_ether 4
+node for an interface.
+If
+.Nm ng_ether
+is
+not already loaded you will need to do so.
+For example, these commands
+load the
+.Nm ng_ether
+module and attach the
+.Va output
+hook of a new
+.Nm source
+node to
+.Va orphans
+hook of the
+.Li bge0:
+.Nm ng_ether
+node.
+.Bd -literal -offset indent
+kldload ng_ether
+ngctl mkpeer bge0: source orphans output
+.Ed
+.Pp
+At this point the new node can be referred to as
+.Dq Li bge0:orphans .
+The
+node can be given its own name like this:
+.Pp
+.Dl "ngctl name bge0:orphans src0"
+.Pp
+After which it can be referred to as
+.Dq Li src0: .
+.Pp
+Once created, packets can be sent to the node as raw binary data.
+Each packet must be delivered in a separate netgraph message.
+.Pp
+The following example uses a short Perl script to convert the hex
+representation of an ICMP packet to binary and deliver it to the
+.Nm source
+node's
+.Va input
+hook via
+.Xr nghook 8 :
+.Bd -literal -offset indent
+perl -pe 's/(..)[ \et\en]*/chr(hex($1))/ge' <<EOF | nghook src0: input
+ff ff ff ff ff ff 00 00 00 00 00 00 08 00 45 00
+00 54 cb 13 00 00 40 01 b9 87 c0 a8 2b 65 0a 00
+00 01 08 00 f8 d0 c9 76 00 00 45 37 01 73 00 01
+04 0a 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15
+16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
+26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35
+36 37
+EOF
+.Ed
+.Pp
+To check that the node has queued these packets you can get the node
+statistics:
+.Bd -literal -offset indent
+ngctl msg bge0:orphans getstats
+Args: { queueOctets=64 queueFrames=1 }
+.Ed
+.Pp
+Send as many packets as required out the
+.Va output
+hook:
+.Pp
+.Dl "ngctl msg bge0:orphans start 16"
+.Pp
+Either wait for them to be sent (periodically fetching stats if desired)
+or send the stop message:
+.Pp
+.Dl "ngctl msg bge0:orphans stop"
+.Pp
+Check the statistics (here we use
+.Ic getclrstats
+to also clear the statistics):
+.Bd -literal -offset indent
+ngctl msg bge0:orphans getclrstats
+Args: { outOctets=1024 outFrames=16 queueOctets=64 queueFrames=1
+startTime={ tv_sec=1035305880 tv_usec=758036 } endTime={ tv_sec=1035305880
+tv_usec=759041 } elapsedTime={ tv_usec=1005 } }
+.Ed
+.Pp
+The times are from
+.Vt "struct timeval" Ns s ,
+the
+.Va tv_sec
+field is seconds since
+the Epoch and can be converted into a date string via TCL's [clock
+format] or via the
+.Xr date 1
+command:
+.Bd -literal -offset indent
+date -r 1035305880
+Tue Oct 22 12:58:00 EDT 2002
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_echo 4 ,
+.Xr ng_hole 4 ,
+.Xr ng_tee 4 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.8 .
+.Sh AUTHORS
+.An Dave Chapeskie
diff --git a/share/man/man4/ng_split.4 b/share/man/man4/ng_split.4
new file mode 100644
index 000000000000..9b74863a6641
--- /dev/null
+++ b/share/man/man4/ng_split.4
@@ -0,0 +1,88 @@
+.\" Copyright (c) 2001 FreeBSD inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by FreeBSD Inc.;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use FreeBSD
+.\" Inc., Inc. trademarks, including the mark "FREEBSD
+.\" INC." on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY FREEBSD INC. "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, FreeBSD Inc. MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" FreeBSD Inc. DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL FreeBSD Inc. BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF FreeBSD Inc. IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Julian Elischer <julian@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 19, 2001
+.Dt NG_SPLIT 4
+.Os
+.Sh NAME
+.Nm ng_split
+.Nd netgraph node to separate incoming and outgoing flows
+.Sh SYNOPSIS
+.In netgraph/ng_split.h
+.Sh DESCRIPTION
+The
+.Nm split
+node type is used to split a bidirectional stream of packets into
+two separate unidirectional streams of packets.
+.Sh HOOKS
+This node type supports the following three hooks:
+.Bl -tag -width foobar
+.It Dv in
+Packets received on
+.Em in
+are forwarded to
+.Em mixed .
+.It Dv out
+Packets received on
+.Em out
+will be discarded as illegal.
+.It Dv mixed
+Packets received on
+.Em mixed
+are forwarded to
+.Em out .
+.El
+.Sh CONTROL MESSAGES
+This node type supports only the generic control messages.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 3.5
+but incorporated into
+.Fx
+in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
+.An Vitaly V. Belekhov Aq vitaly@riss-telecom.ru
diff --git a/share/man/man4/ng_sppp.4 b/share/man/man4/ng_sppp.4
new file mode 100644
index 000000000000..49f8a4c27ae9
--- /dev/null
+++ b/share/man/man4/ng_sppp.4
@@ -0,0 +1,172 @@
+.\" Copyright (C) 2003-2004 Cronyx Engineering.
+.\" Copyright (C) 2003-2004 Roman Kurakin <rik@cronyx.ru>
+.\"
+.\" This software is distributed with NO WARRANTIES, not even the implied
+.\" warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\" Authors grant any other persons or organisations a permission to use,
+.\" modify and redistribute this software in source and binary forms,
+.\" as long as this message is kept with the software, all derivative
+.\" works or modified versions.
+.\"
+.\" Cronyx Id: ng_sppp.4,v 1.1.2.3 2004/03/30 14:28:34 rik Exp $
+.\" $FreeBSD$
+.\"
+.Dd February 3, 2005
+.Dt NG_SPPP 4
+.Os
+.Sh NAME
+.Nm ng_sppp
+.Nd sppp netgraph node type
+.Sh SYNOPSIS
+.In netgraph/ng_sppp.h
+.Sh DESCRIPTION
+An
+.Nm sppp
+node is a
+.Xr netgraph 4
+interface to the original
+.Xr sppp 4
+network module for synchronous lines.
+Currently,
+.Xr sppp 4
+supports PPP and Cisco HDLC protocols.
+An
+.Nm sppp
+node could be considered as an alternative kernel mode PPP
+implementation to
+.Pa net/mpd
+port +
+.Xr ng_ppp 4 ,
+and as an alternative to
+.Xr ng_cisco 4
+node.
+While having less features than
+.Pa net/mpd
++
+.Xr ng_ppp 4 ,
+it is significantly easier to use in the majority of simple configurations,
+and allows the administrator to not install the
+.Pa net/mpd
+port.
+With
+.Nm sppp
+you do not need any other nodes, not even an
+.Xr ng_iface 4
+node.
+When an
+.Nm sppp
+node is created, a new interface appears which is accessible via
+.Xr ifconfig 8 .
+Network interfaces corresponding to
+.Nm sppp
+nodes are named
+.Li sppp0 , sppp1 ,
+etc.
+When a node is shut down, the corresponding interface is removed,
+and the interface name becomes available for reuse by future
+.Nm sppp
+nodes.
+New nodes always take the first unused interface.
+The node itself is assigned the same name as its interface, unless the name
+already exists, in which case the node remains unnamed.
+The
+.Nm sppp
+node allows drivers written to the old
+.Xr sppp 4
+interface to be rewritten using the
+newer more powerful
+.Xr netgraph 4
+interface, and still behave in a compatible manner without supporting both
+network modules.
+.Pp
+An
+.Nm sppp
+node has a single hook named
+.Va downstream .
+Usually it is connected directly to
+a device driver hook.
+.Pp
+The
+.Nm sppp
+nodes support the Berkeley Packet Filter,
+.Xr bpf 4 .
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Va downstream"
+.It Va downstream
+The connection to the synchronous line.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_IFACE_GET_IFNAME
+Returns the name of the associated interface as a
+.Dv NUL Ns -terminated
+.Tn ASCII
+string.
+Normally this is the same as the name of the node.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message.
+The associated interface is removed and becomes available
+for use by future
+.Nm sppp
+nodes.
+.Pp
+Unlike most other node types and like
+.Xr ng_iface 4
+does, an
+.Nm sppp
+node does
+.Em not
+go away when all hooks have been disconnected; rather, an explicit
+.Dv NGM_SHUTDOWN
+control message is required.
+.Sh EXAMPLES
+For example, if you have the
+.Xr cx 4
+device, you could run PPP over it with just one command:
+.Pp
+.Dl "ngctl mkpeer cx0: sppp rawdata downstream"
+.Pp
+Now you have the
+.Li sppp0
+interface (if this was the first
+.Nm sppp
+node) which can be
+accessed via
+.Xr ifconfig 8
+as a normal network interface,
+or via
+.Xr spppcontrol 8
+as an
+.Xr sppp 4
+interface.
+.Sh SEE ALSO
+.Xr bpf 4 ,
+.Xr cx 4 ,
+.Xr netgraph 4 ,
+.Xr ng_cisco 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_ppp 4 ,
+.Xr sppp 4 ,
+.Xr ifconfig 8 ,
+.Xr ngctl 8 ,
+.Xr spppcontrol 8
+.Pp
+For complex networking topologies you may want to look at
+.Pa net/mpd
+port.
+.Sh HISTORY
+The
+.Nm sppp
+node type was implemented for
+.Fx 5.0 .
+It was included to the system since
+.Fx 5.3 .
+.Sh AUTHORS
+Copyright (C) 2003-2004
+.An Roman Kurakin Aq rik@cronyx.ru .
diff --git a/share/man/man4/ng_sscfu.4 b/share/man/man4/ng_sscfu.4
new file mode 100644
index 000000000000..0679d5805621
--- /dev/null
+++ b/share/man/man4/ng_sscfu.4
@@ -0,0 +1,161 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" ng_sscfu(4) man page
+.\"
+.Dd October 24, 2003
+.Dt NG_SSCFU 4
+.Os
+.Sh NAME
+.Nm ng_sscfu
+.Nd netgraph SSCF at the UNI node type
+.Sh SYNOPSIS
+.In netnatm/saal/sscopdef.h
+.In netnatm/saal/sscfudef.h
+.In netgraph/atm/ng_sscfu.h
+.Sh DESCRIPTION
+The
+.Nm sscfu
+netgraph node type implements ITU-T recommendation Q.2130.
+This recommendation specifies the Service Specific Coordination
+Function at the UNI.
+This is a thin sub-layer between the SSCOP (see
+.Xr ng_sscop 4 )
+and the UNI signalling.
+This node does not really implement a protocol but
+provides a mapping between the signals at the upper layer of the SSCOP and
+the signals the UNI expects at its lower layer.
+It also provides default values for the parameters of the SSCOP.
+.Pp
+After creation of the node, the SSCF instance must be created by sending
+an
+.Dq enable
+message to the node.
+If the node is enabled, default SSCOP parameters
+can be retrieved and set in the corresponding SSCOP instance.
+.Pp
+The node is shut down either by a
+.Dv NGM_SHUTDOWN
+message, or when all hooks are disconnected.
+.Sh HOOKS
+Each
+.Nm sscfu
+node has two hooks with fixed names:
+.Bl -tag -width ".Va upper"
+.It Va lower
+This hook is the interface to the SSCOP.
+The interface expected here is exactly
+that which is exported by the
+.Xr ng_sscop 4
+node type.
+.It Va upper
+This is the interface to the UNI.
+It uses the following message format:
+.Bd -literal
+struct sscfu_arg {
+ uint32_t sig;
+ u_char data[];
+};
+.Ed
+.Pp
+The
+.Va sig
+field
+is one of the following signals:
+.Bd -literal
+enum saal_sig {
+ SAAL_ESTABLISH_request, /* U -> SAAL: (UU) */
+ SAAL_ESTABLISH_indication, /* SAAL -> U: (UU) */
+ SAAL_ESTABLISH_confirm, /* SAAL -> U: (UU) */
+ SAAL_RELEASE_request, /* U -> SAAL: (UU) */
+ SAAL_RELEASE_confirm, /* SAAL -> U: */
+ SAAL_RELEASE_indication, /* SAAL -> U: (UU) */
+ SAAL_DATA_request, /* U -> SAAL: (DATA) */
+ SAAL_DATA_indication, /* SAAL -> U: (DATA) */
+ SAAL_UDATA_request, /* U -> SAAL: (UDATA) */
+ SAAL_UDATA_indication, /* SAAL -> U: (UDATA) */
+};
+.Ed
+.Pp
+The arrows in the comment show the direction of the signal, whether it
+is a signal that comes out of the node
+.Pq Ql -> ,
+or is sent by the node user to the node
+.Pq Ql <- .
+The type of the data expected for the signal is specified in parentheses.
+This data starts at the
+.Va data
+field of the message structure.
+.El
+.Pp
+If the
+.Va lower
+hook is disconnected and the node is enabled, the protocol state is
+reset.
+.Sh CONTROL MESSAGES
+The
+.Nm sscfu
+node understands the generic messages plus the following:
+.Bl -tag -width indent
+.It Dv NGM_SSCFU_GETDEFPARAM
+This message returns a
+.Vt sscop_param
+structure, which contains the default parameters for the SSCOP at the
+UNI.
+This structure should be used for a
+.Dv NGM_SSCOP_SETPARAM
+message to the SSCOP node below the SSCF.
+.It Dv NGM_SSCFU_ENABLE
+This message creates the actual SSCF instance and initializes it.
+Until this is done, parameters may neither be retrieved nor set,
+and all messages
+received on any hook are discarded.
+.It Dv NGM_SSCFU_DISABLE
+Destroy the SSCF instance.
+After this, all messages on any hooks are discarded.
+.It Dv NGM_SSCFU_GETDEBUG
+Retrieve the debugging flags in a
+.Vt uint32_t .
+.It Dv NGM_SSCFU_SETDEBUG
+Set debugging flags.
+The argument must be a
+.Vt uint32_t .
+.It Dv NGM_SSCFU_GETSTATE
+Retrieve the current state of the SSCFU instance in a
+.Vt uint32_t .
+If the node has not been enabled, 0 is returned.
+.El
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_atm 4 ,
+.Xr ng_sscop 4 ,
+.Xr ngctl 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/ng_sscop.4 b/share/man/man4/ng_sscop.4
new file mode 100644
index 000000000000..0c6f0d4564b9
--- /dev/null
+++ b/share/man/man4/ng_sscop.4
@@ -0,0 +1,403 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" ng_sscop(4) man page
+.\"
+.Dd October 24, 2003
+.Dt NG_SSCOP 4
+.Os
+.Sh NAME
+.Nm ng_sscop
+.Nd netgraph SSCOP node type
+.Sh SYNOPSIS
+.In netnatm/saal/sscopdef.h
+.In netgraph/atm/ng_sscop.h
+.Sh DESCRIPTION
+The
+.Nm sscop
+netgraph node type implements the ITU-T standard Q.2110.
+This standard describes
+the so called Service Specific Connection Oriented Protocol (SSCOP) that
+is used to carry signalling messages over the private and public UNIs and
+the public NNI.
+This protocol is a transport protocol with selective
+acknowledgements, and can be tailored to the environment.
+This implementation is a full implementation of that standard.
+.Pp
+After creation of the node, the SSCOP instance must be created by sending
+an
+.Dq enable
+message to the node.
+If the node is enabled, the SSCOP parameters
+can be retrieved and modified and the protocol can be started.
+.Pp
+The node is shut down either by a
+.Dv NGM_SHUTDOWN
+message, or when all hooks are disconnected.
+.Sh HOOKS
+Each
+.Nm sscop
+node has three hooks with fixed names:
+.Bl -tag -width ".Va manage"
+.It Va lower
+This hook must be connected to a node that ensures
+transport of packets to and from the remote peer node.
+Normally this is a
+.Xr ng_atm 4
+node with an AAL5 hook, but the
+.Nm sscop
+node is able to work on any packet-transporting layer, like, for example,
+IP or UDP.
+The node handles flow control messages received on
+this hook: if it receives a
+.Dv NGM_HIGH_WATER_PASSED
+message, it declares the
+.Dq "lower layer busy"
+state.
+If a
+.Dv NGM_LOW_WATER_PASSED
+message is received, the busy state is cleared.
+Note that the node does not
+look at the message contents of these flow control messages.
+.It Va upper
+This is the interface to the SSCOP user.
+This interface uses the following message format:
+.Bd -literal
+struct sscop_arg {
+ uint32_t sig;
+ uint32_t arg; /* opt. sequence number or clear-buff */
+ u_char data[];
+};
+.Ed
+.Pp
+The
+.Va sig
+field
+is one of the signals defined in the standard:
+.Bd -literal
+enum sscop_aasig {
+ SSCOP_ESTABLISH_request, /* <- UU, BR */
+ SSCOP_ESTABLISH_indication, /* -> UU */
+ SSCOP_ESTABLISH_response, /* <- UU, BR */
+ SSCOP_ESTABLISH_confirm, /* -> UU */
+
+ SSCOP_RELEASE_request, /* <- UU */
+ SSCOP_RELEASE_indication, /* -> UU, SRC */
+ SSCOP_RELEASE_confirm, /* -> */
+
+ SSCOP_DATA_request, /* <- MU */
+ SSCOP_DATA_indication, /* -> MU, SN */
+
+ SSCOP_UDATA_request, /* <- MU */
+ SSCOP_UDATA_indication, /* -> MU */
+
+ SSCOP_RECOVER_indication, /* -> */
+ SSCOP_RECOVER_response, /* <- */
+
+ SSCOP_RESYNC_request, /* <- UU */
+ SSCOP_RESYNC_indication, /* -> UU */
+ SSCOP_RESYNC_response, /* <- */
+ SSCOP_RESYNC_confirm, /* -> */
+
+ SSCOP_RETRIEVE_request, /* <- RN */
+ SSCOP_RETRIEVE_indication, /* -> MU */
+ SSCOP_RETRIEVE_COMPL_indication,/* -> */
+};
+.Ed
+.Pp
+The arrows in the comment show the direction of the signal, whether it
+is a signal that comes out of the node
+.Pq Ql -> ,
+or is sent by the node user to the node
+.Pq Ql <- .
+The
+.Va arg
+field contains the argument to some of the signals: it is either a PDU
+sequence number, or the
+.Dv CLEAR-BUFFER
+flag.
+There are a number of special sequence numbers for some operations:
+.Pp
+.Bl -tag -width ".Dv SSCOP_RETRIEVE_UNKNOWN" -offset indent -compact
+.It Dv SSCOP_MAXSEQNO
+maximum legal sequence number
+.It Dv SSCOP_RETRIEVE_UNKNOWN
+retrieve transmission queue
+.It Dv SSCOP_RETRIEVE_TOTAL
+retrieve transmission buffer and queue
+.El
+.Pp
+For signals that carry user data (as, for example,
+.Dv SSCOP_DATA_request )
+these two fields are followed by the variable sized user data.
+.Pp
+If the
+.Va upper
+hook is disconnected and the SSCOP instance is not in the idle
+state, and the
+.Va lower
+hook is still connected, an
+.Dv SSCOP_RELEASE_request
+is executed to release the SSCOP connection.
+.It Va manage
+This is the management interface defined in the standard.
+The data structure used here is:
+.Bd -literal
+struct sscop_marg {
+ uint32_t sig;
+ u_char data[];
+};
+.Ed
+.Pp
+Here
+.Va sig
+is one of
+.Bd -literal
+enum sscop_maasig {
+ SSCOP_MDATA_request, /* <- MU */
+ SSCOP_MDATA_indication, /* -> MU */
+ SSCOP_MERROR_indication, /* -> CODE, CNT */
+};
+.Ed
+.Pp
+The
+.Dv SSCOP_MDATA
+signals are followed by the actual management data, where the
+.Dv SSCOP_MERROR
+signal has the form:
+.Bd -literal
+struct sscop_merr {
+ uint32_t sig;
+ uint32_t err; /* error code */
+ uint32_t cnt; /* error count */
+};
+.Ed
+.El
+.Sh CONTROL MESSAGES
+The
+.Nm sscop
+node understands the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_SSCOP_SETPARAM
+Sets operational parameters of the SSCOP instance and takes the
+following structure:
+.Bd -literal
+struct ng_sscop_setparam {
+ uint32_t mask;
+ struct sscop_param param;
+};
+.Ed
+.Pp
+The sub-structure
+.Va param
+contains the parameters to set, and the
+.Va mask
+field contains a bit mask, telling which of the parameters to set, and which
+to ignore.
+If a bit is set, the corresponding parameter is set.
+The parameters are:
+.Bd -literal
+struct sscop_param {
+ uint32_t timer_cc; /* timer_cc in msec */
+ uint32_t timer_poll; /* timer_poll im msec */
+ uint32_t timer_keep_alive;/* timer_keep_alive in msec */
+ uint32_t timer_no_response;/*timer_no_response in msec */
+ uint32_t timer_idle; /* timer_idle in msec */
+ uint32_t maxk; /* maximum user data in bytes */
+ uint32_t maxj; /* maximum u-u info in bytes */
+ uint32_t maxcc; /* max. retransmissions for control packets */
+ uint32_t maxpd; /* max. vt(pd) before sending poll */
+ uint32_t maxstat; /* max. number of elements in stat list */
+ uint32_t mr; /* initial window */
+ uint32_t flags; /* flags */
+};
+.Ed
+.Pp
+The
+.Va flags
+field contains the following flags influencing SSCOP operation:
+.Pp
+.Bl -tag -width ".Dv SSCOP_POLLREX" -offset indent -compact
+.It Dv SSCOP_ROBUST
+enable atmf/97-0216 robustness enhancement
+.It Dv SSCOP_POLLREX
+send POLL after each retransmission
+.El
+.Pp
+The bitmap has the following bits:
+.Pp
+.Bl -tag -width ".Dv SSCOP_SET_POLLREX" -offset indent -compact
+.It Dv SSCOP_SET_TCC
+set
+.Va timer_cc
+.It Dv SSCOP_SET_TPOLL
+set
+.Va timer_poll
+.It Dv SSCOP_SET_TKA
+set
+.Va timer_keep_alive
+.It Dv SSCOP_SET_TNR
+set
+.Va timer_no_response
+.It Dv SSCOP_SET_TIDLE
+set
+.Va timer_idle
+.It Dv SSCOP_SET_MAXK
+set
+.Va maxk
+.It Dv SSCOP_SET_MAXJ
+set
+.Va maxj
+.It Dv SSCOP_SET_MAXCC
+set
+.Va maxcc
+.It Dv SSCOP_SET_MAXPD
+set
+.Va maxpd
+.It Dv SSCOP_SET_MAXSTAT
+set
+.Va maxstat
+.It Dv SSCOP_SET_MR
+set the initial window
+.It Dv SSCOP_SET_ROBUST
+set or clear
+.Dv SSCOP_ROBUST
+.It Dv SSCOP_SET_POLLREX
+set or clear
+.Dv SSCOP_POLLREX
+.El
+.Pp
+The node responds to the
+.Dv NGM_SSCOP_SETPARAM
+message with the following response:
+.Bd -literal
+struct ng_sscop_setparam_resp {
+ uint32_t mask;
+ int32_t error;
+};
+.Ed
+.Pp
+Here
+.Va mask
+contains a bitmask of the parameters that the user requested to set,
+but that could not be set and
+.Va error
+is an
+.Xr errno 2
+code describing why the parameter could not be set.
+.It Dv NGM_SSCOP_GETPARAM
+This message returns the current operational parameters of the SSCOP
+instance in a
+.Vt sscop_param
+structure.
+.It Dv NGM_SSCOP_ENABLE
+This message creates the actual SSCOP instance and initializes it.
+Until this is done, parameters may neither be retrieved nor set, and all
+messages received on any hook are discarded.
+.It Dv NGM_SSCOP_DISABLE
+Destroy the SSCOP instance.
+After this, all messages on any hooks are
+discarded.
+.It Dv NGM_SSCOP_SETDEBUG
+Set debugging flags.
+The argument is a
+.Vt uint32_t .
+.It Dv NGM_SSCOP_GETDEBUG
+Retrieve the actual debugging flags.
+Needs no arguments and responds with a
+.Vt uint32_t .
+.It Dv NGM_SSCOP_GETSTATE
+Responds with the current state of the SSCOP instance in a
+.Vt uint32_t .
+If the node is not enabled, the retrieved state is 0.
+.El
+.Sh FLOW CONTROL
+Flow control works on the upper and on the lower layer interface.
+At the lower
+layer interface, the two messages,
+.Dv NGM_HIGH_WATER_PASSED
+and
+.Dv NGM_LOW_WATER_PASSED ,
+are used to declare or clear the
+.Dq "lower layer busy"
+state of the protocol.
+.Pp
+At the upper layer interface, the
+.Nm sscop
+node handles three types of flow control messages:
+.Bl -tag -width indent
+.It Dv NGM_HIGH_WATER_PASSED
+If this message is received, the SSCOP stops moving the receive window.
+Each time a data message is handed over to the upper layer, the receive
+window is moved by one message.
+Stopping these updates
+means that the window will start to close and if the peer has sent
+all messages allowed by the current window, it stops transmission.
+This means that the upper layer must be able to still receive a full window
+amount of messages.
+.It Dv NGM_LOW_WATER_PASSED
+This will re-enable the automatic window updates, and if the space indicated
+in the message is larger than the current window, the window will be opened
+by that amount.
+The space is computed as the difference of the
+.Va max_queuelen_packets
+and
+.Va current
+members of the
+.Vt ngm_queue_state
+structure.
+.It Dv NGM_SYNC_QUEUE_STATE
+If the upper layer buffer filling state, as indicated by
+.Va current ,
+is equal to or greater than
+.Va high_watermark
+then the message is ignored.
+If this is not the case, the amount
+of receiver space is computed as the difference of
+.Va max_queuelen_packets
+and
+.Va current
+if automatic window updates are currently allowed, and as the difference of
+.Va high_water_mark
+and
+.Va current
+if window updates are disabled.
+If the resulting value is larger than the current window, the current window
+is opened up to this value.
+Automatic window updates are enabled if they
+were disabled.
+.El
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_atm 4 ,
+.Xr ng_sscfu 4 ,
+.Xr ngctl 8
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/ng_tag.4 b/share/man/man4/ng_tag.4
new file mode 100644
index 000000000000..98cfa24fae6f
--- /dev/null
+++ b/share/man/man4/ng_tag.4
@@ -0,0 +1,338 @@
+.\" Copyright (c) 2006 Vadim Goncharov <vadimnuclight@tpu.ru>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 10, 2006
+.Dt NG_TAG 4
+.Os
+.Sh NAME
+.Nm ng_tag
+.Nd "mbuf tags manipulating netgraph node type"
+.Sh SYNOPSIS
+.In netgraph/ng_tag.h
+.Sh DESCRIPTION
+The
+.Nm tag
+node type allows mbuf packet tags (see
+.Xr mbuf_tags 9 )
+to be examined, stripped or applied to data travelling through a
+Netgraph network.
+Mbuf tags are used in many parts of the
+.Fx
+kernel network subsystem,
+including the storage of VLAN tags as described in
+.Xr vlan 4 ,
+Mandatory Access Control (MAC) labels as described in
+.Xr mac 9 ,
+IPsec policy information as described in
+.Xr ipsec 4 ,
+and packet filter tags used by
+.Xr pf 4 .
+One should also consider useful setting or checking
+.Xr ipfw 8
+tags, which are implemented as mbuf tags, too.
+.Pp
+Each node allows an arbitrary number of connections to arbitrarily
+named hooks.
+With each hook is associated a tag which will be searched in the list
+of all tags attached to a packet incoming to this hook, a destination hook
+for matching packets, a destination hook for non-matching packets,
+a tag which will be appended to data leaving node through this hook,
+and various statistics counters.
+.Pp
+The list of incoming packet's tags is traversed to find a tag with
+specified
+.Va type
+and
+.Va cookie
+values.
+Upon match, if specified
+.Va tag_len
+is non-zero,
+.Va tag_data
+of tag is checked to be identical to that specified in the hook structure.
+Packets with matched tags are forwarded to
+.Dq match
+destination hook, or forwarded to
+.Dq non-match
+hook otherwise.
+Either or both destination hooks can be an empty string, or may
+not exist, in which case the packet is dropped.
+.Pp
+Tag list of packets leaving the node is extended with a new tag
+specified in outgoing hook structure (it is possible to avoid appending
+a new tag to pass packet completely unchanged by specifying zero
+.Va type
+and
+.Va cookie
+values in the structure of the corresponding outgoing hook).
+Additionally,
+a tag can be stripped from incoming packet after match if
+.Va strip
+flag is set.
+This can be used for simple tag removal or tag replacement, if combined
+with tag addition on outgoing matching hook.
+Note that new tag is appended unconditionally, without checking if
+such a tag is already present in the list (it is up to user to check
+if this is a concern).
+.Pp
+New hooks are initially configured to drop all incoming packets
+(as all hook names are empty strings; zero values can be specified
+to forward all packets to non-matching hook),
+and to forward all outgoing packets without any tag appending.
+.Pp
+Data payload of packets passing through the node is completely
+unchanged, all operations can affect tag list only.
+.Sh HOOKS
+This node type supports any number of hooks having arbitrary names.
+In order to allow internal optimizations, user should never try to
+configure a hook with a structure pointing to hooks which do not exist yet.
+The safe way is to create all hooks first, then begin to configure them.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_TAG_SET_HOOKIN
+This command sets tag values which will be searched in the tag list of
+incoming packets on a hook.
+The following structure must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_tag_hookin {
+ char thisHook[NG_HOOKSIZ]; /* name of hook */
+ char ifMatch[NG_HOOKSIZ]; /* match dest hook */
+ char ifNotMatch[NG_HOOKSIZ]; /* !match dest hook */
+ uint8_t strip; /* strip tag if found */
+ uint32_t tag_cookie; /* ABI/Module ID */
+ uint16_t tag_id; /* tag ID */
+ uint16_t tag_len; /* length of data */
+ uint8_t tag_data[0]; /* tag data */
+};
+.Ed
+.Pp
+The hook to be updated is specified in
+.Va thisHook .
+Data bytes of tag corresponding to specified
+.Va tag_id
+(type) and
+.Va tag_cookie
+are placed in the
+.Va tag_data
+array; there must be
+.Va tag_len
+of them.
+Matching and non-matching incoming packets are delivered out the hooks named
+.Va ifMatch
+and
+.Va ifNotMatch ,
+respectively.
+If
+.Va strip
+flag is non-zero, then found tag is deleted from list of packet tags.
+.It Dv NGM_TAG_GET_HOOKIN
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the
+corresponding
+.Vt "struct ng_tag_hookin"
+as shown above.
+.It Dv NGM_TAG_SET_HOOKOUT
+This command sets tags values which will be applied to outgoing
+packets.
+The following structure must be supplied as an argument:
+.Bd -literal -offset 4n
+struct ng_tag_hookout {
+ char thisHook[NG_HOOKSIZ]; /* name of hook */
+ uint32_t tag_cookie; /* ABI/Module ID */
+ uint16_t tag_id; /* tag ID */
+ uint16_t tag_len; /* length of data */
+ uint8_t tag_data[0]; /* tag data */
+};
+.Ed
+.Pp
+The hook to be updated is specified in
+.Va thisHook .
+Other variables mean basically the same as in
+.Vt "struct ng_tag_hookin"
+shown above, except used for setting values in a new tag.
+.It Dv NGM_TAG_GET_HOOKOUT
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the
+corresponding
+.Vt "struct ng_tag_hookout"
+as shown above.
+.It Dv NGM_TAG_GET_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and returns the
+statistics associated with the hook as a
+.Vt "struct ng_tag_hookstat" .
+.It Dv NGM_TAG_CLR_STATS
+This command takes an
+.Tn ASCII
+string argument, the hook name, and clears the
+statistics associated with the hook.
+.It Dv NGM_TAG_GETCLR_STATS
+This command is identical to
+.Dv NGM_TAG_GET_STATS ,
+except that the statistics are also atomically cleared.
+.El
+.Pp
+.Em Note:
+statistics counters as well as three statistics messages above work
+only if code was compiled with the
+.Dv NG_TAG_DEBUG
+option.
+The reason for this is that statistics is rarely used in practice,
+but still consumes CPU cycles for every packet.
+Moreover, it is even not accurate on SMP systems due to lack of
+synchronization between threads, as this is very expensive.
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh EXAMPLES
+It is possible to do a simple L7 filtering by using
+.Xr ipfw 8
+tags in conjunction with
+.Xr ng_bpf 4
+traffic analyzer.
+Example below explains how to filter DirectConnect P2P network data traffic,
+which cannot be done by usual means as it uses random ports.
+It is known that such data connection always contains a TCP packet with
+6-byte payload string "$Send|".
+So ipfw's
+.Cm netgraph
+action will be used to divert all TCP packets to an
+.Xr ng_bpf 4
+node which will check for the specified string and return non-matching
+packets to
+.Xr ipfw 8 .
+Matching packets are passed to
+.Xr ng_tag 4
+node, which will set a tag and pass them back to
+.Xr ng_bpf 4
+node on a hook programmed to accept all packets and pass them back to
+.Xr ipfw 8 .
+A script provided in
+.Xr ng_bpf 4
+manual page will be used for programming node.
+Note that packets diverted from
+.Xr ipfw 8
+to Netgraph have no link-level header, so offsets in
+.Xr tcpdump 1
+expressions must be altered accordingly.
+Thus, there will be expression
+.Dq Li "ether[40:2]=0x244c && ether[42:4]=0x6f636b20"
+on incoming hook and empty expression to match all packets from
+.Xr ng_tag 4 .
+.Pp
+So, this is
+.Xr ngctl 8
+script for nodes creating and naming for easier access:
+.Bd -literal -offset 4n
+/usr/sbin/ngctl -f- <<-SEQ
+ mkpeer ipfw: bpf 41 ipfw
+ name ipfw:41 dcbpf
+ mkpeer dcbpf: tag matched th1
+ name dcbpf:matched ngdc
+SEQ
+.Ed
+.Pp
+Now
+.Dq Li ngdc
+node (which is of type
+.Nm )
+must be programmed to echo all packets received on the
+.Dq Li th1
+hook back, with the
+.Xr ipfw 8
+tag 412 attached.
+.Dv MTAG_IPFW
+value for
+.Va tag_cookie
+was taken from file
+.In netinet/ip_fw.h
+and value for
+.Va tag_id
+is tag number (412), with zero tag length:
+.Bd -literal -offset 4n
+ngctl msg ngdc: sethookin { thisHook=\e"th1\e" ifNotMatch=\e"th1\e" }
+ngctl msg ngdc: sethookout { thisHook=\e"th1\e" \e
+ tag_cookie=1148380143 \e
+ tag_id=412 }
+.Ed
+.Pp
+Don't forget to program
+.Xr ng_bpf 4
+.Dq Li ipfw
+hook with the above expression (see
+.Xr ng_bpf 4
+for script doing this) and
+.Dq Li matched
+hook with an empty expression:
+.Bd -literal -offset 4n
+ngctl msg dcbpf: setprogram { thisHook=\e"matched\e" ifMatch=\e"ipfw\e" \e
+ bpf_prog_len=1 bpf_prog=[ { code=6 k=8192 } ] }
+.Ed
+.Pp
+After finishing with
+.Xr netgraph 4
+nodes,
+.Xr ipfw 8
+rules must be added to enable packet flow:
+.Bd -literal -offset 4n
+ipfw add 100 netgraph 41 tcp from any to any iplen 46
+ipfw add 110 reset tcp from any to any tagged 412
+.Ed
+.Pp
+Note: one should ensure that packets are returned to ipfw after processing
+inside
+.Xr netgraph 4 ,
+by setting appropriate
+.Xr sysctl 8
+variable:
+.Bd -literal -offset 4n
+sysctl net.inet.ip.fw.one_pass=0
+.Ed
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_bpf 4 ,
+.Xr ng_ipfw 4 ,
+.Xr ipfw 8 ,
+.Xr ngctl 8 ,
+.Xr mbuf_tags 9
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 6.2 .
+.Sh AUTHORS
+.An Vadim Goncharov Aq vadimnuclight@tpu.ru
+.Sh BUGS
+For manipulating any tags with data payload (that is, all tags with non-zero
+.Va tag_len )
+one should care about non-portable machine-dependent representation of
+tags on the low level as byte stream.
+Perhaps this should be done by another program rather than manually.
diff --git a/share/man/man4/ng_tcpmss.4 b/share/man/man4/ng_tcpmss.4
new file mode 100644
index 000000000000..fc610b6d6695
--- /dev/null
+++ b/share/man/man4/ng_tcpmss.4
@@ -0,0 +1,125 @@
+.\" Copyright (c) 2005 Gleb Smirnoff
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 9, 2005
+.Dt NG_TCPMSS 4
+.Os
+.Sh NAME
+.Nm ng_tcpmss
+.Nd "netgraph node to adjust TCP MSS option"
+.Sh SYNOPSIS
+.In netgraph.h
+.In netgraph/ng_tcpmss.h
+.Sh DESCRIPTION
+The
+.Nm tcpmss
+node type is designed to alter the Maximum Segment Size option
+of TCP packets.
+This node accepts an arbitrary number of hooks.
+Initially a new hook is considered unconfigured.
+The
+.Dv NG_TCPMSS_CONFIG
+control message is used to configure a hook.
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following.
+.Bl -tag -width indent
+.It Dv NGM_TCPMSS_CONFIG Pq Li config
+This control message configures node to do given MSS adjusting on
+a particular hook.
+It requires the
+.Vt "struct ng_tcpmss_config"
+to be supplied as an argument:
+.Bd -literal
+struct ng_tcpmss_config {
+ char inHook[NG_HOOKSIZ];
+ char outHook[NG_HOOKSIZ];
+ uint16_t maxMSS;
+}
+.Ed
+.Pp
+This means: packets received on
+.Va inHook
+would be checked for TCP MSS option and the latter would be
+reduced down to
+.Va maxMSS
+if it exceeds
+.Va maxMSS .
+After that, packets would be sent to hook
+.Va outHook .
+.It Dv NGM_TCPMSS_GET_STATS Pq Li getstats
+This control message obtains statistics for a given hook.
+The statistics are returned in
+.Vt "struct ng_tcpmss_hookstat" :
+.Bd -literal
+struct ng_tcpmss_hookstat {
+ uint64_t Octets; /* total bytes */
+ uint64_t Packets; /* total packets */
+ uint16_t maxMSS; /* maximum MSS */
+ uint64_t SYNPkts; /* TCP SYN packets */
+ uint64_t FixedPkts; /* changed packets */
+};
+.Ed
+.It Dv NGM_TCPMSS_CLR_STATS Pq Li clrstats
+This control message clears statistics for a given hook.
+.It Dv NGM_TCPMSS_GETCLR_STATS Pq Li getclrstats
+This control message obtains and clears statistics for a given hook.
+.El
+.Sh EXAMPLES
+In the following example, packets are injected into the
+.Nm tcpmss
+node using the
+.Xr ng_ipfw 4
+node.
+.Bd -literal -offset indent
+# Create tcpmss node and connect it to ng_ipfw node
+ngctl mkpeer ipfw: tcpmss 100 qqq
+
+# Adjust MSS to 1452
+ngctl msg ipfw:100 config '{ inHook="qqq" outHook="qqq" maxMSS=1452 }'
+
+# Divert traffic into tcpmss node
+ipfw add 300 netgraph 100 tcp from any to any tcpflags syn out via fxp0
+
+# Let packets continue with ipfw after being hacked
+sysctl net.inet.ip.fw.one_pass=0
+.Ed
+.Sh SHUTDOWN
+This node shuts down upon receipt of an
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_ipfw 4
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 6.0 .
+.Sh AUTHORS
+.An Alexey Popov Aq lollypop@flexuser.ru
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
+.Sh BUGS
+When running on SMP, system statistics may be broken.
diff --git a/share/man/man4/ng_tee.4 b/share/man/man4/ng_tee.4
new file mode 100644
index 000000000000..84801b7ad38d
--- /dev/null
+++ b/share/man/man4/ng_tee.4
@@ -0,0 +1,134 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tee.8,v 1.4 1999/01/25 23:46:27 archie Exp $
+.\"
+.Dd May 28, 2004
+.Dt NG_TEE 4
+.Os
+.Sh NAME
+.Nm ng_tee
+.Nd netgraph ``tee'' node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/ng_tee.h
+.Sh DESCRIPTION
+The
+.Nm tee
+node type has a purpose similar to the
+.Xr tee 1
+command.
+.Nm Tee
+nodes are useful for debugging or
+.Dq snooping
+on a connection
+between two netgraph nodes.
+.Nm Tee
+nodes have four hooks,
+.Dv right ,
+.Dv left ,
+.Dv right2left ,
+and
+.Dv left2right .
+All data received on
+.Dv right
+is sent unmodified to
+.Em both
+hooks
+.Dv left
+and
+.Dv right2left .
+Similarly, all data received on
+.Dv left
+is sent unmodified to both
+.Dv right
+and
+.Dv left2right .
+.Pp
+Packets may also be received on
+.Dv right2left
+and
+.Dv left2right ;
+if so, they are forwarded unchanged out hooks
+.Dv right
+and
+.Dv left ,
+respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobarbarfoo
+.It Dv right
+The connection to the node on the right.
+.It Dv left
+The connection to the node on the left.
+.It Dv right2left
+Tap for right to left traffic.
+.It Dv left2right
+Tap for left to right traffic.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following.
+.Bl -tag -width foo
+.It Dv NGM_TEE_GET_STATS
+Get statistics, returned as a
+.Dv "struct ng_tee_stats" .
+.It Dv NGM_TEE_CLR_STATS
+Clear statistics.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of an
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+If both
+.Dv right
+and
+.Dv left
+hooks are present, node removes itself from the chain gently,
+connecting
+.Dv right
+and
+.Dv left
+together.
+.Sh SEE ALSO
+.Xr tee 1 ,
+.Xr netgraph 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Julian Elischer Aq julian@FreeBSD.org
diff --git a/share/man/man4/ng_tty.4 b/share/man/man4/ng_tty.4
new file mode 100644
index 000000000000..dc73e58a2471
--- /dev/null
+++ b/share/man/man4/ng_tty.4
@@ -0,0 +1,129 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd December 25, 2008
+.Dt NG_TTY 4
+.Os
+.Sh NAME
+.Nm ng_tty
+.Nd netgraph node type that is also a TTY hook
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/ttycom.h
+.In netgraph/ng_tty.h
+.Sh DESCRIPTION
+The
+.Nm tty
+node type is both a netgraph node type and a TTY hook.
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the tty device are sent out on this hook,
+and frames received on
+.Dv hook
+are transmitted out on the tty device.
+No modification to the data is performed in either direction.
+While the hook is installed on a tty, the normal read and write
+operations are unavailable, returning
+.Er EIO .
+.Pp
+Incoming data is delivered directly to ng_tty via the tty bypass hook as a
+buffer pointer and length, this is converted to a mbuf and passed to the peer.
+.Pp
+The node supports an optional
+.Dq hot character .
+If the driver can not deliver data directly to the tty bypass hook then each
+character is input one at a time.
+If set to non-zero and bypass mode is unavailable, incoming
+data from the tty device is queued until this character is seen.
+This avoids sending lots of mbufs containing a small number of bytes,
+but introduces potentially infinite latency.
+The default hot character is 0x7e, consistent with
+.Dv hook
+being connected to a
+.Xr ng_async 4
+type node.
+The hot character has no effect on the transmission of data.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobar
+.It Dv hook
+.Xr tty 4
+serial data contained in
+.Dv mbuf
+structures, with arbitrary inter-frame boundaries.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_TTY_SET_HOTCHAR
+This command takes an integer argument and sets the hot character
+from the lower 8 bits.
+A hot character of zero disables queueing,
+so that all received data is forwarded immediately.
+.It Dv NGM_TTY_GET_HOTCHAR
+Returns an integer containing the current hot character in the lower
+eight bits.
+.It Dv NGM_TTY_SET_TTY
+This command takes integer process ID and file descriptor of open tty
+and registers the tty hooks.
+.El
+.Sh SHUTDOWN
+This node shuts down when the corresponding device is closed.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr netgraph 4 ,
+.Xr ng_async 4 ,
+.Xr tty 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
+.An Andrew Thompson Aq thompsa@FreeBSD.org
+.Sh BUGS
+The serial driver code also has a notion of a
+.Dq hot character .
+Unfortunately, this value is statically defined in terms of the
+line discipline and cannot be changed.
+Therefore, if a hot character other than 0x7e (the default) is set for the
+.Nm
+node, the node has no way to convey this information to the
+serial driver, and sub-optimal performance may result.
diff --git a/share/man/man4/ng_ubt.4 b/share/man/man4/ng_ubt.4
new file mode 100644
index 000000000000..ebb454d92a37
--- /dev/null
+++ b/share/man/man4/ng_ubt.4
@@ -0,0 +1,123 @@
+.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ng_ubt.4,v 1.3 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd September 13, 2004
+.Dt NG_UBT 4
+.Os
+.Sh NAME
+.Nm ng_ubt
+.Nd Netgraph node type that is also a driver for Bluetooth USB devices
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph/bluetooth/include/ng_ubt.h
+.Sh DESCRIPTION
+The
+.Nm ubt
+node type is both a persistent Netgraph node type and a driver for
+Bluetooth USB devices.
+It implements a Bluetooth USB transport layer
+as per chapter H2 of the Bluetooth Specification Book v1.1.
+A new node is created when a supported USB device is plugged in.
+.Pp
+The node has a single hook called
+.Dv hook .
+Incoming bytes received on the device are re-assembled into HCI frames
+(according to the length).
+Full HCI frames are sent out on the hook.
+The node will add a HCI frame indicator if the device did not send it.
+HCI frames received on
+.Dv hook
+are transmitted out.
+The node will drop the HCI frame indicator unless the device
+requires it to be present.
+.Sh HARDWARE
+The
+.Nm
+driver supports all Bluetooth USB devices that conform with
+the Bluetooth specification v1.1, including:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3CREB96
+.It
+AIPTEK BR0R02
+.It
+EPoX BT-DG02
+.It
+Mitsumi Bluetooth USB adapter
+.It
+MSI MS-6967
+.It
+TDK Bluetooth USB adapter
+.El
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width indent
+.It Dv hook
+single HCI frame contained in a single
+.Vt mbuf
+structure.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_UBT_NODE_GET_DEBUG
+Returns an integer containing the current debug level for the node.
+.It Dv NGM_UBT_NODE_SET_DEBUG
+This command takes an integer argument and sets the current debug level
+for the node.
+.It Dv NGM_UBT_NODE_GET_QLEN
+This command takes a parameter that specifies the queue number and returns
+the current maximal length of the queue for the node.
+.It Dv NGM_UBT_NODE_SET_QLEN
+This command takes two parameters that specify the queue number and the maximum
+length of the queue and sets the maximal length of the queue for the node.
+.It Dv NGM_UBT_NODE_GET_STAT
+Returns various statistic information for the node, such as: number of
+bytes (frames) sent, number of bytes (frames) received and number of
+input (output) errors.
+.It Dv NGM_UBT_NODE_RESET_STAT
+Reset all statistic counters to zero.
+.El
+.Sh SHUTDOWN
+This node shuts down when the corresponding USB device is un-plugged.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ugen 4 ,
+.Xr usb 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm ubt
+node type was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+Isochronous USB transfers are broken.
+This means that the USB device will not be able to transfer SCO data (voice).
+USB interrupt transfers are implemented as bulk-in transfers (not really a bug).
diff --git a/share/man/man4/ng_uni.4 b/share/man/man4/ng_uni.4
new file mode 100644
index 000000000000..f6eb05fdbe50
--- /dev/null
+++ b/share/man/man4/ng_uni.4
@@ -0,0 +1,420 @@
+.\"
+.\" Copyright (c) 2001-2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 6, 2003
+.Dt NG_UNI 4
+.Os
+.Sh NAME
+.Nm ng_uni
+.Nd netgraph UNI node type
+.Sh SYNOPSIS
+.In netnatm/msg/unistruct.h
+.In netnatm/sig/unidef.h
+.In netgraph/atm/ng_uni.h
+.Sh DESCRIPTION
+The
+.Nm uni
+netgraph node type implements ATM Forum signalling 4.0.
+.Pp
+After creation of the node, the UNI instance must be created by sending
+an
+.Dq enable
+message to the node.
+If the node is enabled, the UNI parameters
+can be retrieved and modified, and the protocol can be started.
+.Pp
+The node is shut down either by an
+.Dv NGM_SHUTDOWN
+message, or when all hooks are disconnected.
+.Sh HOOKS
+Each
+.Nm uni
+node has three hooks with fixed names:
+.Bl -tag -width ".Va upper"
+.It Va lower
+This hook is the interface of the UNI protocol to the transport layer of
+the ATM control plane.
+The node expects the interface exported by
+.Xr ng_sscfu 4
+at this hook.
+.It Va upper
+This hook is the
+.Dq user
+interface of the UNI protocol.
+Because there is no standardized interface
+at this point, this implementation follows more or less the interface
+specified by the SDL diagrams in ITU-T recommendations Q.2931 and Q.2971.
+Normally either a
+.Xr ng_ccatm 4
+or a switch CAC should be stacked at this interface.
+The message format at the
+.Va upper
+hook is described below.
+Because
+.Xr netgraph 4
+is functional, it makes sometimes sense to switch this hook to queueing mode
+from the peer node upon connection.
+.El
+.Pp
+The
+.Va upper
+interface of the
+.Nm uni
+node is loosely modelled after the interface specified in the ITU-T signalling
+standards.
+There is however one derivation from this: normally there exists
+four kinds of signals: requests, responses, indications and confirmations.
+These signals are usually triggered either by external events (receiving a
+message) or internal events (a timer or another signal).
+This scheme works
+fine for user APIs that are entirely asynchronous, and in cases where
+error handling is not taken into account.
+With synchronous APIs and error
+handling however, there is a problem.
+If, for example, the application
+issues a request to set up a connection,
+it may do it by sending a
+.Dv SETUP.request
+signal to the UNI.
+Normally, the UNI stack will send a SETUP message and
+receive a message from the switch (a RELEASE, CONNECT, CALL PROCEEDING or
+ALERTING), or a timer in the UNI stack will time out.
+In any of these cases,
+the UNI stack is supposed to report an event back to the application, and
+the application will unblock (in the case of a synchronous API) and handle
+the event.
+The problem occurs when an error happens.
+Suppose there is no
+memory to send the SETUP message and to start the timer.
+In this case, the
+application will block forever because no received message and no timer
+will wake it up.
+For this reason this implementation uses an additional message:
+for each signal sent from the application to the stack, the stack will
+respond with an error code.
+If this code is zero, the stack has accepted
+the signal and the application may block; if the code is non-zero, the signal
+is effectively ignored and the code describes what was wrong.
+This system
+makes it very easy to make a blocking interface out of the message based
+netgraph interface.
+.Pp
+The
+.Va upper
+interface uses the following structure:
+.Bd -literal
+struct uni_arg {
+ uint32_t sig;
+ uint32_t cookie;
+ u_char data[];
+};
+.Ed
+The
+.Va sig
+field contains the actual signal that is sent from the user to UNI or from
+UNI to the user.
+The
+.Va cookie
+can be used by the user to correlate requests with events and responses.
+If an error response, a confirmation or an indication was triggered by
+a request or response, the cookie from that request or response is carried in
+the message from the stack to the user.
+The
+.Va cookie
+field is followed by the actual data for the signal.
+.Pp
+The signal is one of the following:
+.Bd -literal
+enum uni_sig {
+ UNIAPI_ERROR, /* UNI -> API */
+
+ UNIAPI_CALL_CREATED, /* UNI -> API */
+ UNIAPI_CALL_DESTROYED, /* UNI -> API */
+ UNIAPI_PARTY_CREATED, /* UNI -> API */
+ UNIAPI_PARTY_DESTROYED, /* UNI -> API */
+
+ UNIAPI_LINK_ESTABLISH_request, /* API -> UNI */
+ UNIAPI_LINK_ESTABLISH_confirm, /* UNI -> API */
+ UNIAPI_LINK_RELEASE_request, /* API -> UNI */
+ UNIAPI_LINK_RELEASE_confirm, /* UNI -> API */
+
+ UNIAPI_RESET_request, /* API -> UNI */
+ UNIAPI_RESET_confirm, /* UNI -> API */
+ UNIAPI_RESET_indication, /* UNI -> API */
+ UNIAPI_RESET_ERROR_indication, /* UNI -> API */
+ UNIAPI_RESET_response, /* API -> UNI */
+ UNIAPI_RESET_ERROR_response, /* API -> UNI */
+ UNIAPI_RESET_STATUS_indication, /* UNI -> API */
+
+ UNIAPI_SETUP_request, /* API -> UNI */
+ UNIAPI_SETUP_indication, /* UNI -> API */
+ UNIAPI_SETUP_response, /* API -> UNI */
+ UNIAPI_SETUP_confirm, /* UNI -> API */
+ UNIAPI_SETUP_COMPLETE_indication, /* UNI -> API */
+ UNIAPI_ALERTING_request, /* API -> UNI */
+ UNIAPI_ALERTING_indication, /* UNI -> API */
+ UNIAPI_PROCEEDING_request, /* API -> UNI */
+ UNIAPI_PROCEEDING_indication, /* UNI -> API */
+ UNIAPI_RELEASE_request, /* API -> UNI */
+ UNIAPI_RELEASE_indication, /* UNI -> API */
+ UNIAPI_RELEASE_response, /* API -> UNI */
+ UNIAPI_RELEASE_confirm, /* UNI -> API */
+ UNIAPI_NOTIFY_request, /* API -> UNI */
+ UNIAPI_NOTIFY_indication, /* UNI -> API */
+ UNIAPI_STATUS_indication, /* UNI -> API */
+ UNIAPI_STATUS_ENQUIRY_request, /* API -> UNI */
+
+ UNIAPI_ADD_PARTY_request, /* API -> UNI */
+ UNIAPI_ADD_PARTY_indication, /* UNI -> API */
+ UNIAPI_PARTY_ALERTING_request, /* API -> UNI */
+ UNIAPI_PARTY_ALERTING_indication, /* UNI -> API */
+ UNIAPI_ADD_PARTY_ACK_request, /* API -> UNI */
+ UNIAPI_ADD_PARTY_ACK_indication, /* UNI -> API */
+ UNIAPI_ADD_PARTY_REJ_request, /* API -> UNI */
+ UNIAPI_ADD_PARTY_REJ_indication, /* UNI -> API */
+ UNIAPI_DROP_PARTY_request, /* API -> UNI */
+ UNIAPI_DROP_PARTY_indication, /* UNI -> API */
+ UNIAPI_DROP_PARTY_ACK_request, /* API -> UNI */
+ UNIAPI_DROP_PARTY_ACK_indication, /* UNI -> API */
+
+ UNIAPI_ABORT_CALL_request, /* API -> UNI */
+
+ UNIAPI_MAXSIG
+};
+.Ed
+.Pp
+The meaning of most of the signals can be deduced from the ITU-T SDLs.
+A number of signals, however, is unique to this implementation:
+.Bl -tag -width indent
+.It Dv UNIAPI_ERROR
+This is the error response, mentioned earlier.
+It carries an error code or
+zero, if the signal was accepted by the stack.
+.It Dv UNIAPI_CALL_CREATED
+The UNI stack has created a call instance either from an incoming SETUP or
+from the user requesting an outgoing SETUP.
+This may be used to synchronize
+the creation and destroying of call data between the UNI stack and the user.
+.It Dv UNIAPI_CALL_DESTROYED
+A call instance has been destroyed and all resources have been freed.
+.It Dv UNIAPI_PARTY_CREATED
+A new party has been created for an existing point-to-multipoint call.
+This may be used to synchronize the creation and destroying of party data
+between the UNI stack and the user.
+.It Dv UNIAPI_PARTY_DESTROYED
+A party has been destroyed and all resources have been freed.
+.It Dv UNIAPI_ABORT_CALL_request
+This requests the stack to destroy the call instance
+and free all its resources,
+without sending any messages to the network.
+.It Dv UNIAPI_MAXSIG
+This is not a signal, but rather a definition to get the number of defined
+signals.
+.El
+.Pp
+Each of the signals is followed by a fixed size structure defined in
+.In netnatm/sig/unidef.h .
+.Sh CONTROL MESSAGES
+The
+.Nm uni
+node understands the standard control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_UNI_SETDEBUG
+Set debugging facility levels.
+The UNI stack defines a number of debugging
+facilities, each one associated with a debugging level.
+If the debugging level
+of a facility is non-zero, text output will be generated to the console.
+The message uses the following structure:
+.Bd -literal
+struct ngm_uni_debug {
+ uint32_t level[UNI_MAXFACILITY];
+};
+.Ed
+.It Dv NGM_UNI_SETDEBUG
+Get debugging facility levels.
+This returns an
+.Vt ngm_uni_debug
+structure.
+.It Dv NGM_UNI_GET_CONFIG
+Retrieve the current configuration of the UNI instance.
+This message returns a
+.Vt uni_config
+structure:
+.Bd -literal
+struct uni_config {
+ uint32_t proto; /* which protocol */
+ uint32_t popt; /* protocol option */
+ uint32_t option; /* other options */
+ uint32_t timer301; /* T301 */
+ uint32_t timer303; /* T303 */
+ uint32_t init303; /* T303 retransmission count */
+ uint32_t timer308; /* T308 */
+ uint32_t init308; /* T308 retransmission count */
+ uint32_t timer309; /* T309 */
+ uint32_t timer310; /* T310 */
+ uint32_t timer313; /* T313 */
+ uint32_t timer316; /* T316 */
+ uint32_t init316; /* T316 retransmission count */
+ uint32_t timer317; /* T317 */
+ uint32_t timer322; /* T322 */
+ uint32_t init322; /* T322 retransmission count */
+ uint32_t timer397; /* T397 */
+ uint32_t timer398; /* T398 */
+ uint32_t timer399; /* T399 */
+};
+.Ed
+.Pp
+The field
+.Va proto
+specifies one of the following protocols:
+.Bd -literal
+enum uni_proto {
+ UNIPROTO_UNI40U, /* UNI4.0 user side */
+ UNIPROTO_UNI40N, /* UNI4.0 network side */
+ UNIPROTO_PNNI10, /* PNNI1.0 */
+};
+.Ed
+.Pp
+Some protocols may have options which can be set in
+.Va popt :
+.Bd -literal
+enum uni_popt {
+ UNIPROTO_GFP, /* enable GFP */
+};
+.Ed
+.Pp
+The
+.Va option
+field controls parsing and checking of messages:
+.Bd -literal
+enum uni_option {
+ UNIOPT_GIT_HARD, /* harder check of GIT IE */
+ UNIOPT_BEARER_HARD, /* harder check of BEARER IE */
+ UNIOPT_CAUSE_HARD, /* harder check of CAUSE IE */
+};
+.Ed
+.Pp
+All timer values are given in milliseconds.
+Note, however, that the actual
+resolution of the timers depend on system configuration (see
+.Xr timeout 9 ) .
+.It Dv NGM_UNI_SET_CONFIG
+Change the UNI configuration.
+This takes a
+.Bd -literal
+struct ngm_uni_set_config {
+ struct uni_config config;
+ struct ngm_uni_config_mask mask;
+};
+struct ngm_uni_config_mask {
+ uint32_t mask;
+ uint32_t popt_mask;
+ uint32_t option_mask;
+};
+.Ed
+.Pp
+The fields of the
+.Vt ngm_uni_config_mask
+specify which configuration parameter to change.
+The
+.Va mask
+field contains bit definitions for all timers, retransmission counters
+and the
+.Va proto
+field,
+.Va popt_mask
+selects which of the protocol options to change, and
+.Va option_mask
+specifies which options should be changed.
+The following bits are defined:
+.Bd -literal
+enum uni_config_mask {
+ UNICFG_PROTO,
+ UNICFG_TIMER301,
+ UNICFG_TIMER303,
+ UNICFG_INIT303,
+ UNICFG_TIMER308,
+ UNICFG_INIT308,
+ UNICFG_TIMER309,
+ UNICFG_TIMER310,
+ UNICFG_TIMER313,
+ UNICFG_TIMER316,
+ UNICFG_INIT316,
+ UNICFG_TIMER317,
+ UNICFG_TIMER322,
+ UNICFG_INIT322,
+ UNICFG_TIMER397,
+ UNICFG_TIMER398,
+ UNICFG_TIMER399,
+};
+.Ed
+.Pp
+For
+.Va popt_mask
+and
+.Va option_mask ,
+the definitions from
+.Vt "enum uni_popt"
+and
+.Vt "enum uni_option"
+should be used.
+.It Dv NGM_UNI_ENABLE
+Create the UNI instance and enable processing.
+Before the UNI is enabled parameters cannot be retrieved or set.
+.It Dv NGM_UNI_DISABLE
+Destroy the UNI instance and free all resources.
+Note, that connections are not released.
+.El
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_atm 4 ,
+.Xr ng_sscfu 4 ,
+.Xr ng_sscop 4 ,
+.Xr ngctl 8
+.Sh AUTHORS
+The
+.Nm uni
+netgraph node
+and this manual page were written by
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh BUGS
+.Bl -bullet -compact
+.It
+LIJ (leaf-initiated-join) is not implemented yet.
+.It
+GFP (generic functional protocol, Q.2932.1) is not yet implemented.
+.It
+More testing needed.
+.It
+PNNI not yet implemented.
+.It
+Need to implement connection modification and the Q.2931 amendments.
+.El
diff --git a/share/man/man4/ng_vjc.4 b/share/man/man4/ng_vjc.4
new file mode 100644
index 000000000000..714aa7e27323
--- /dev/null
+++ b/share/man/man4/ng_vjc.4
@@ -0,0 +1,238 @@
+.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Subject to the following obligations and disclaimer of warranty, use and
+.\" redistribution of this software, in source or object code forms, with or
+.\" without modifications are expressly permitted by Whistle Communications;
+.\" provided, however, that:
+.\" 1. Any and all reproductions of the source or object code must include the
+.\" copyright notice above and the following disclaimer of warranties; and
+.\" 2. No rights are granted, in any manner or form, to use Whistle
+.\" Communications, Inc. trademarks, including the mark "WHISTLE
+.\" COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+.\" such appears in the above copyright notice or in the software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+.\" OF SUCH DAMAGE.
+.\"
+.\" Author: Archie Cobbs <archie@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\" $Whistle: ng_vjc.8,v 1.4 1999/01/25 23:46:28 archie Exp $
+.\"
+.Dd January 19, 1999
+.Dt NG_VJC 4
+.Os
+.Sh NAME
+.Nm ng_vjc
+.Nd Van Jacobson compression netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip.h
+.In net/slcompress.h
+.In netgraph/ng_vjc.h
+.Sh DESCRIPTION
+The
+.Nm vjc
+node type performs Van Jacobson compression, which is used
+over PPP, SLIP, and other point-to-point IP connections to
+compress TCP packet headers.
+The
+.Dv ip
+hook represents the uncompressed side of the node, while the
+.Dv vjcomp ,
+.Dv vjuncomp ,
+and
+.Dv vjip
+hooks represent the compressed side of the node.
+Packets received on the
+.Dv ip
+will be compressed or passed through as appropriate.
+Packets received on the other three hooks will be uncompressed as appropriate.
+This node also supports
+.Dq always pass through
+mode in either direction.
+.Pp
+Van Jacobson compression only applies to TCP packets.
+Only
+.Dq normal
+(i.e., common case) TCP packets are actually compressed.
+These are output on the
+.Dv vjcomp
+hook.
+Other TCP packets are run through the state machine but not
+compressed; these appear on the
+.Dv vjuncomp
+hook.
+Other non-TCP IP packets are forwarded unchanged to
+.Dv vjip .
+.Pp
+When connecting to a
+.Xr ng_ppp 4
+node, the
+.Dv ip ,
+.Dv vjuncomp ,
+.Dv vjcomp ,
+and
+.Dv vjip
+hooks should be connected to the
+.Xr ng_ppp 4
+node's
+.Dv vjc_ip ,
+.Dv vjc_vjcomp ,
+.Dv vjc_vjuncomp ,
+and
+.Dv vjc_ip
+hooks, respectively.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width foobarbazi
+.It Dv ip
+Upstream (uncompressed) IP packets.
+.It Dv vjcomp
+Downstream compressed TCP packets.
+.It Dv vjuncomp
+Downstream uncompressed TCP packets.
+.It Dv vjip
+Downstream uncompressed IP packets.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width foo
+.It Dv NGM_VJC_SET_CONFIG
+This command resets the compression state and configures it according
+to the supplied
+.Dv "struct ngm_vjc_config"
+argument.
+This structure contains the following fields:
+.Bd -literal -offset 4n
+struct ngm_vjc_config {
+ u_char enableComp; /* Enable compression */
+ u_char enableDecomp; /* Enable decompression */
+ u_char maxChannel; /* Number of outgoing channels - 1 */
+ u_char compressCID; /* OK to compress outgoing CID's */
+};
+.Ed
+.Pp
+When
+.Dv enableComp
+is set to zero, all packets received on the
+.Dv ip
+hook are forwarded unchanged out the
+.Dv vjip
+hook.
+Similarly, when
+.Dv enableDecomp
+is set to zero, all packets received on the
+.Dv vjip
+hook are forwarded unchanged out the
+.Dv ip
+hook, and packets are not accepted on the
+.Dv vjcomp
+and
+.Dv vjuncomp
+hooks.
+When a node is first created,
+both compression and decompression are disabled and the node is
+therefore operating in bi-directional
+.Dq pass through
+mode.
+.Pp
+When enabling compression,
+.Dv maxChannel
+should be set to the number of outgoing compression channels minus one,
+and is a value between 3 and 15, inclusive.
+The
+.Dv compressCID
+field indicates whether it is OK to compress the CID header field for
+outgoing compressed TCP packets.
+This value should be zero unless
+either (a) it is not possible for an outgoing frame to be lost, or
+(b) lost frames can be reliably detected and immediately
+reported to the peer's decompression engine (see
+.Dv NGM_VJC_RECV_ERROR
+below).
+.It Dv NGM_VJC_GET_STATE
+This command returns the node's current state described by the
+.Dv "struct slcompress"
+structure, which is defined in
+.In net/slcompress.h .
+.It Dv NGM_VJC_CLR_STATS
+Clears the node statistics counters.
+Statistics are also cleared whenever the
+.Dv enableComp
+or
+.Dv enableDecomp
+fields are changed from zero to one by a
+.Dv NGM_VJC_SET_CONFIG
+control message.
+.It Dv NGM_VJC_RECV_ERROR
+When the peer has CID header field compression enabled,
+this message must be sent to the local
+.Nm vjc
+node immediately
+after detecting that a received frame has been lost, due to a bad
+checksum or for any other reason.
+Failing to do this can result in corrupted TCP stream data.
+.El
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_iface 4 ,
+.Xr ng_ppp 4 ,
+.Xr ngctl 8
+.Rs
+.%A V. Jacobson
+.%T "Compressing TCP/IP Headers"
+.%O RFC 1144
+.Re
+.Rs
+.%A G. McGregor
+.%T "The PPP Internet Control Protocol (IPCP)"
+.%O RFC 1332
+.Re
+.Sh HISTORY
+The
+.Nm
+node type was implemented in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Archie Cobbs Aq archie@FreeBSD.org
+.Sh BUGS
+As the initialization routine in the kernel implementation of
+Van Jacobson compression initializes both compression and decompression
+at once, this node does not allow compression and decompression to
+be enabled in separate operations.
+In order to enable one when
+the other is already enabled, first both must be disabled, then
+both enabled.
+This of course resets the node state.
+This restriction may be lifted in a later version.
+.Pp
+When built as a loadable kernel module, this module includes the file
+.Pa net/slcompress.c .
+Although loading the module should fail if
+.Pa net/slcompress.c
+already exists in the kernel, currently it does not, and the duplicate
+copies of the file do not interfere.
+However, this may change in the future.
diff --git a/share/man/man4/ng_vlan.4 b/share/man/man4/ng_vlan.4
new file mode 100644
index 000000000000..bf673cf3bd7f
--- /dev/null
+++ b/share/man/man4/ng_vlan.4
@@ -0,0 +1,145 @@
+.\" Copyright (c) 2003 Ruslan Ermilov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2004
+.Dt NG_VLAN 4
+.Os
+.Sh NAME
+.Nm ng_vlan
+.Nd IEEE 802.1Q VLAN tagging netgraph node type
+.Sh SYNOPSIS
+.In sys/types.h
+.In netgraph.h
+.In netgraph/ng_vlan.h
+.Sh DESCRIPTION
+The
+.Nm vlan
+node type multiplexes frames tagged according to
+the IEEE 802.1Q standard between different hooks.
+.Pp
+Each node has two special hooks,
+.Va downstream
+and
+.Va nomatch ,
+and an arbitrary number of
+.Dq vlan
+hooks, each associated with a particular VLAN tag.
+.Pp
+An
+.Dv ETHERTYPE_VLAN
+frame received on the
+.Va downstream
+hook with a tag that the node has been configured to filter
+is sent out the corresponding
+.Dq vlan
+hook.
+If it does not match any of the configured tags, or is not of a type
+.Dv ETHERTYPE_VLAN ,
+it is sent out the
+.Va nomatch
+hook.
+If the
+.Va nomatch
+hook is not connected, the packet is dropped.
+.Pp
+An Ethernet frame received on the
+.Va nomatch
+hook is passed unmodified to the
+.Va downstream
+hook.
+.Pp
+An Ethernet frame received on any of the
+.Dq vlan
+hooks is tagged accordingly and sent out the
+.Va downstream
+hook.
+.Sh HOOKS
+This node type supports the following hooks:
+.Bl -tag -width ".Va downstream"
+.It Va downstream
+Typically this hook would be connected to a
+.Xr ng_ether 4
+node, using the
+.Va lower
+hook.
+.It Va nomatch
+Typically this hook would also be connected to an
+.Xr ng_ether 4
+type node using the
+.Va upper
+hook.
+.It Aq Em "any valid name"
+Any other hook name will be accepted and should later be associated with
+a particular tag.
+Typically this hook would be attached to an
+.Xr ng_eiface 4
+type node using the
+.Va ether
+hook.
+.El
+.Sh CONTROL MESSAGES
+This node type supports the generic control messages, plus the following:
+.Bl -tag -width indent
+.It Dv NGM_VLAN_ADD_FILTER Pq Li addfilter
+Associates a hook with the tag.
+.It Dv NGM_VLAN_DEL_FILTER Pq Li delfilter
+Disassociates a hook from the tag.
+.It Dv NGM_VLAN_GET_TABLE Pq Li gettable
+Returns a table of all hook/tag associations.
+.El
+.Sh EXAMPLES
+.Bd -literal
+#!/bin/sh
+
+ETHER_IF=rl0
+
+ngctl -f- <<EOF
+shutdown ${ETHER_IF}:
+mkpeer ${ETHER_IF}: vlan lower downstream
+name ${ETHER_IF}:lower vlan
+connect ${ETHER_IF}: vlan: upper nomatch
+EOF
+
+ngctl mkpeer vlan: eiface vlan123 ether
+ngctl msg vlan: addfilter '{ vlan=123 hook="vlan123" }'
+.Ed
+.Sh SHUTDOWN
+This node shuts down upon receipt of a
+.Dv NGM_SHUTDOWN
+control message, or when all hooks have been disconnected.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_eiface 4 ,
+.Xr ng_ether 4 ,
+.Xr ngctl 8 ,
+.Xr nghook 8
+.Sh HISTORY
+The
+.Nm
+node type appeared in
+.Fx 4.10 .
+.Sh AUTHORS
+.An Ruslan Ermilov Aq ru@FreeBSD.org
diff --git a/share/man/man4/ngatmbase.4 b/share/man/man4/ngatmbase.4
new file mode 100644
index 000000000000..fd885ee51796
--- /dev/null
+++ b/share/man/man4/ngatmbase.4
@@ -0,0 +1,134 @@
+.\"
+.\" Copyright (c) 2004
+.\" Hartmut Brandt.
+.\" All rights reserved.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.\" ngatmbase(4) man page
+.\"
+.Dd August 24, 2004
+.Dt NGATMBASE 4
+.Os
+.Sh NAME
+.Nm ngatmbase
+.Nd netgraph ATM utility module
+.Sh SYNOPSIS
+.In netnatm/unimsg.h
+.In netgraph/atm/ngatmbase.h
+.Ft "struct mbuf *"
+.Fn uni_msg_pack_mbuf "struct uni_msg *msg" "void *hdr" "size_t len"
+.Ft "struct uni_msg *"
+.Fn uni_msg_alloc "size_t len"
+.Ft "struct uni_msg *"
+.Fn uni_msg_build "void *buf" ...
+.Ft void
+.Fn uni_msg_destroy "struct uni_msg *msg"
+.Ft int
+.Fn uni_msg_unpack_mbuf "struct mbuf *m" "struct uni_msg *msgp"
+.Sh DESCRIPTION
+This module provides utility functions for the handling of signalling
+messages to the NgATM modules.
+.Pp
+The
+.Fn uni_msg_pack_mbuf
+function
+packs a message into one or several
+.Vt mbuf Ns s
+optionally prepending a header.
+The header is given by its address
+.Fa hdr
+and length
+.Fa len .
+If
+.Fa hdr
+is
+.Dv NULL
+or
+.Fa len
+equals 0, no header is prepended.
+Either
+.Fa msg
+or
+.Fa hdr
+may be
+.Dv NULL
+but not both.
+The
+.Fn uni_msg_pack_mbuf
+function
+returns a pointer to the allocated
+.Vt mbuf
+chain or
+.Dv NULL
+in the case of an error.
+.Pp
+The
+.Fn uni_msg_alloc
+function
+allocates a new message with space for at least
+.Fa len
+bytes.
+In the case of an error
+.Dv NULL
+is returned.
+.Pp
+The
+.Fn uni_msg_build
+function constructs a message from pieces.
+Each piece is given by a pair of
+arguments, the first of type
+.Vt "void *"
+and the second a
+.Vt size_t .
+The list of pieces must be terminated by
+.Po Vt "void *" Pc Ns Dv NULL .
+.Pp
+The
+.Fn uni_msg_destroy
+function
+destroys the messages and frees all the messages's memory.
+.Pp
+The
+.Fn uni_msg_unpack_mbuf
+function
+unpacks an
+.Vt mbuf
+chain info a
+.Vt uni_msg .
+A pointer to the newly allocated message is stored in
+.Fa msgp
+and 0 is returned.
+In the case of an error (either when no packet header is found
+in the first mbuf or memory cannot be allocated) the function
+returns an appropriate error code.
+.Sh SEE ALSO
+.Xr ng_ccatm 4 ,
+.Xr ng_sscfu 4 ,
+.Xr ng_sscop 4 ,
+.Xr ng_uni 4
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/nge.4 b/share/man/man4/nge.4
new file mode 100644
index 000000000000..ec02052601c9
--- /dev/null
+++ b/share/man/man4/nge.4
@@ -0,0 +1,227 @@
+.\" Copyright (c) 2001 Wind River Systems
+.\" Copyright (c) 1997, 1998, 1999, 2000, 2001
+.\" Bill Paul <wpaul@bsdi.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 23, 2010
+.Dt NGE 4
+.Os
+.Sh NAME
+.Nm nge
+.Nd "National Semiconductor PCI Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device nge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_nge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs based on the National Semiconductor
+DP83820 and DP83821 Gigabit Ethernet controller chips.
+.Pp
+The DP83820 supports TBI (ten bit interface) and GMII
+transceivers, which means it can be used with either copper or 1000baseX
+fiber applications.
+The DP83820 supports TCP/IP checksum offload and
+VLAN tagging/insertion as well as a 2048-bit multicast hash filter
+and up to 4 pattern match buffers.
+.Pp
+Most cards also use the DP83861 10/100/1000 copper gigabit transceiver
+chip, which supports autonegotiation of 10, 100 and 1000Mbps modes in
+full or half duplex.
+.Pp
+The DP83820 and DP83821 also support jumbo frames, which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+Using jumbo frames can greatly improve performance for certain tasks,
+such as file transfers and data streaming.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width 10baseTXUTP
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Ic mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Ic mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.Cm full-duplex
+and
+.Cm half-duplex
+modes are supported.
+.It Cm 1000baseSX
+Set 1000Mbps (Gigabit Ethernet) operation.
+Both
+.Cm full-duplex
+and
+.Cm half-duplex
+modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width full-duplex
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports National Semiconductor DP83820 and DP83821 based
+Gigabit Ethernet adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+Addtron AEG320T
+.It
+Ark PC SOHO-GA2500T (32-bit PCI) and SOHO-GA2000T (64-bit PCI)
+.It
+Asante FriendlyNet GigaNIX 1000TA and 1000TPC
+.It
+D-Link DGE-500T
+.It
+Linksys EG1032, revision 1
+.It
+Netgear GA621
+.It
+Netgear GA622T
+.It
+SMC EZ Card 1000 (SMC9462TX)
+.It
+Surecom Technology EP-320G-TX
+.It
+Trendware TEG-PCITX (32-bit PCI) and TEG-PCITX2 (64-bit PCI)
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.nge.%d.int_holdoff
+Maximum amount of time to delay interrupt processing in units of
+100us.
+The accepted range is 0 to 255, the default is 1(100us).
+Value 0 completely disables the interrupt moderation.
+The interface has to be brought down and up again before a change
+takes effect.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "nge%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "nge%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "nge%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "nge%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "nge%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "nge%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "nge%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T National Semiconductor DP83820 datasheet
+.%U http://www.national.com
+.Re
+.Rs
+.%T National Semiconductor DP83861 datasheet
+.%U http://www.national.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@bsdi.com .
diff --git a/share/man/man4/nmdm.4 b/share/man/man4/nmdm.4
new file mode 100644
index 000000000000..7dccb00bf1bd
--- /dev/null
+++ b/share/man/man4/nmdm.4
@@ -0,0 +1,85 @@
+.\" Copyright (c) 2001
+.\" The FreeBSD Project
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 27, 2005
+.Dt NMDM 4
+.Os
+.Sh NAME
+.Nm nmdm
+.Nd nullmodem terminal driver
+.Sh SYNOPSIS
+.Cd "device nmdm"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides two
+.Xr tty 4
+devices connected
+by a virtual
+.Dq "null modem"
+cable.
+.Pp
+If either of the two tty devices have the
+.Dv CDSR_OFLOW
+bit
+.Pq Dq Li "stty dsrflow"
+set in their line discipline, the
+.Nm
+device will emulate the speed configured in the
+.Xr termios 4
+settings.
+The speed emulation works independently in the two directions,
+controlled by the slower end's termios settings
+.Va ( c_ispeed , c_ospeed ,
+.Dv CS5 ... CS8 , CSTOPB
+and
+.Dv PARENB ) .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/nmdm Ns Ar N Ns Op Pa AB" -compact
+.It Pa /dev/nmdm Ns Ar N Ns Op Pa AB
+nullmodem device nodes.
+Where the
+.Pa A
+node has a matching
+.Pa B
+node.
+.El
+.Pp
+The
+.Nm
+driver implements
+.Dq "on-demand device creation"
+so simply accessing a given instance in
+.Pa /dev
+will create it.
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr termios 4 ,
+.Xr tty 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.4 .
diff --git a/share/man/man4/nsp.4 b/share/man/man4/nsp.4
new file mode 100644
index 000000000000..7ff7fe176255
--- /dev/null
+++ b/share/man/man4/nsp.4
@@ -0,0 +1,98 @@
+.\" Copyright (c) 2003 Noriaki MITSUNAGA. All rights reserved.
+.\" Copyright (c) 2003 Hideyuki KURASHINA. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 8, 2004
+.Dt NSP 4
+.Os
+.Sh NAME
+.Nm nsp
+.Nd "Workbit Ninja SCSI-3 based PC-Card SCSI host adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device nsp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+nsp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to the
+.Tn SCSI
+bus connected to a PC-Card
+.Tn SCSI
+host adapter based on a Ninja SCSI-3 controller by Workbit.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Alpha-Data AD-PCS201
+.It
+I-O DATA CBSC16
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr pccard 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+driver has been developed for
+.Nx Ns / Ns Tn pc98
+and ported for
+.Fx .
+It first appeared in
+.Fx 3.4
+with PAO3 and merged in
+.Fx 4.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Naofumi HONDA .
+.Pp
+This manual page was written by
+.An Noriaki MITSUNAGA Aq non@FreeBSD.org
+and
+.An Hideyuki KURASHINA Aq rushani@FreeBSD.org .
+.Sh BUGS
+SMIT mode is only supported under OLDCARD now.
diff --git a/share/man/man4/null.4 b/share/man/man4/null.4
new file mode 100644
index 000000000000..cedfaeb9c7b4
--- /dev/null
+++ b/share/man/man4/null.4
@@ -0,0 +1,60 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)null.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt NULL 4
+.Os
+.Sh NAME
+.Nm null
+.Nd the null device
+.Sh DESCRIPTION
+The
+.Nm
+device accepts and reads data as any ordinary (and willing)
+file -
+but throws it away.
+The length of the
+.Nm
+device is always zero.
+.Sh FILES
+.Bl -tag -width /dev/null
+.It Pa /dev/null
+.El
+.Sh SEE ALSO
+.Xr zero 4
+.Sh HISTORY
+A
+.Nm
+device appeared in
+.At v7 .
diff --git a/share/man/man4/nve.4 b/share/man/man4/nve.4
new file mode 100644
index 000000000000..9e50d9c9ce00
--- /dev/null
+++ b/share/man/man4/nve.4
@@ -0,0 +1,141 @@
+.\" Copyright (c) 2003 Quinton Dolan
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: nvnet.4,v 1.1 2003/10/09 16:48:01 q Exp $
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2011
+.Dt NVE 4
+.Os
+.Sh NAME
+.Nm nve
+.Nd "NVIDIA nForce MCP Networking Adapter device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device nve"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_nve_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the NVIDIA nForce MCP and nForce2 MCP2
+networking adapter that is embedded in the southbridge of most
+nForce and nForce2 motherboards.
+.Pp
+This driver is a reimplementation of the NVIDIA supported Linux
+.Nm nvnet
+driver and uses the same closed source API library to access
+the underlying hardware.
+There is currently no programming documentation available for this
+device, and therefore little is known about the internal architecture
+of the MAC engine itself.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000Mbps (Gigabit Ethernet) operation.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm full-duplex
+Set full duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the NVIDIA MCP onboard adapters of mainboards with
+the following chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+nForce
+.It
+nForce2
+.It
+nForce3
+.It
+nForce4
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "nve%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "nve%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "nve%d: failed to allocate memory"
+There are not enough mbufs available for allocation.
+.It "nve%d: device timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr rgephy 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Quinton Dolan Aq q@onthenet.com.au
+and
+.An "David E. O'Brien" Aq obrien@FreeBSD.org .
+.Sh BUGS
+There are reports that when the card is in auto select mode,
+ifconfig output reports a 10baseT/UTP output while the LEDs and
+bandwidth show that the card is actually in 100baseTX mode.
diff --git a/share/man/man4/nvram.4 b/share/man/man4/nvram.4
new file mode 100644
index 000000000000..25d6852b46bb
--- /dev/null
+++ b/share/man/man4/nvram.4
@@ -0,0 +1,93 @@
+.\"
+.\"Copyright (c) 2010 iXsystems, Inc.
+.\"All rights reserved.
+.\" written by: Xin LI <delphij@FreeBSD.org>
+.\"
+.\"Redistribution and use in source and binary forms, with or without
+.\"modification, are permitted provided that the following conditions
+.\"are met:
+.\"1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt NVRAM 4
+.Os
+.Sh NAME
+.Nm nvram
+.Nd "non-volatile RAM"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device nvram"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+nvram_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides access to BIOS configuration NVRAM on i386 and amd64
+systems.
+.Pp
+PC motherboard uses a small non-volatile memory to store BIOS settings
+which is usually part of its clock chip and sometimes referred as
+.Dq CMOS SRAM .
+This driver exposes bytes 14 through 128 of the NVRAM, or a total of
+114 bytes, at offset zero of the device file
+.Pa /dev/nvram .
+.Pp
+This driver is useful for cloning machines that shares the same hardware
+configuration and need same BIOS setting tweaks.
+.Sh IMPLEMENTATION NOTES
+The BIOS NVRAM's bytes 16 through 31 are checksummed at byte 32.
+This driver
+.Em does not
+take care for these checksums.
+.Sh EXAMPLES
+Backup existing BIOS NVRAM to
+.Pa nvram.bin :
+.Pp
+.Dl dd if=/dev/nvram of=nvram.bin
+.Pp
+Restore BIOS NVRAM from
+.Pa nvram.bin :
+.Pp
+.Dl dd if=nvram.bin of=/dev/nvram
+.Sh SEE ALSO
+.Xr dd 1
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Peter Wemm .
+This manual page was written by
+.An Xin LI .
diff --git a/share/man/man4/nvram2env.4 b/share/man/man4/nvram2env.4
new file mode 100644
index 000000000000..36423fb96f99
--- /dev/null
+++ b/share/man/man4/nvram2env.4
@@ -0,0 +1,118 @@
+.\" Copyright (c) 2011 Aleksandr Rybalko
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 3, 2011
+.Dt NVRAM2ENV 4
+.Os
+.Sh NAME
+.Nm nvram2env
+.Nd "copy nvram-like data into kernel environment"
+.Sh SYNOPSIS
+.Cd "device nvram2env"
+.Sh DESCRIPTION
+.Nm
+implements a simple method of reading the NVRAM-like data and information
+stored in flash and storing it in the kernel environment. It can then be
+used by various device drivers at boot-time.
+.Pp
+The NVRAM-like data is an array of zero terminated strings. Each string contains
+the string name, "=" delimiter and the string value.
+.Pp
+.Nm
+copies the environment values into kernel environment using the kernel setenv call.
+.Pp
+Configuration of
+.Nm
+is done in
+.Xr device.hints 5
+defining the NVRAM base address, fallback base address, maxsize and flags.
+.Pp
+.Nm
+is currently MIPS-specific.
+.Ss base
+base - physical address where data block is stored.
+.Ss fallbackbase
+fallbackbase - physical address where data block is stored, but only
+if not found at base.
+.Ss maxsize
+maxsize - maximum size of data block.
+.Ss flags
+flags - control flags, used to select nvram type and enable/disable CRC check.
+.Bl -tag -width indent
+.It Fa 0x0001
+Avoid CRC checking. Currently CRC checking is not implemented, so to be future
+compatible, please set it to "1".
+.It Fa 0x0002
+Use format "Generic", skip uint32_t field, then zero terminating array of
+strings.
+.It Fa 0x0004
+Use Broadcom CFE format. uint32_t signature "FLSH", uint32_t size,
+three unused fields uint32_t, then data.
+.It Fa 0x0008
+Use U-Boot format, uint32_t crc, then zero terminating array of strings.
+.El
+.Sh EXAMPLES
+Usage in U-Boot case:
+.Bd -literal -offset indent
+hint.nvram.0.base=0x1f030000
+hint.nvram.0.maxsize=0x2000
+hint.nvram.0.flags=3 # 1 = No check, 2 = Format Generic
+hint.nvram.1.base=0x1f032000
+hint.nvram.1.maxsize=0x4000
+hint.nvram.1.flags=3 # 1 = No check, 2 = Format Generic
+.Ed
+.Pp
+CFE nvram with fallback:
+.Bd -literal -offset indent
+hint.nvram.0.base=0x1fff8000
+hint.nvram.0.fallbackbase=0x1fc00400
+hint.nvram.0.flags=4 # 4 = Format Broadcom
+.Ed
+.Pp
+but seems for CFE nvram preferred to read both blocks:
+.Pp
+NVRAM partition: Static, CFE internal
+.Bd -literal -offset indent
+hint.nvram.0.flags=0x05 # Broadcom + nocheck
+hint.nvram.0.base=0x1fc00400
+.Ed
+.Pp
+Dynamic, editable form CFE, override values from first
+.Bd -literal -offset indent
+hint.nvram.1.flags=0x05 # Broadcom + nocheck
+hint.nvram.1.base=0x1cff8000
+.Ed
+.Sh SEE ALSO
+.Xr kenv 1 ,
+.Xr kenv 2 .
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+.Nm
+.An Aleksandr Rybalko Aq ray@ddteam.net .
diff --git a/share/man/man4/nxge.4 b/share/man/man4/nxge.4
new file mode 100644
index 000000000000..8d94afc599b9
--- /dev/null
+++ b/share/man/man4/nxge.4
@@ -0,0 +1,97 @@
+.\" Copyright (c) 2007, Neterion Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 16, 2007
+.Dt NXGE 4
+.Os
+.Sh NAME
+.Nm nxge
+.Nd "Neterion Xframe 10GbE Server/Storage adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device nxge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_nxge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Neterion Xframe-I and Xframe-II adapters.
+The driver supports TCP Segmentation Offload (TSO/LSO),
+Large Receive Offload (LRO), Jumbo Frames (5 buffer mode),
+Header Separation (Rx 2 buffer mode), VLAN, and Promiscuous mode.
+.Pp
+For general information and support, please visit the Neterion support page
+.Pa http://www.neterion.com/support/support.html .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to transmit and receive Jumbo Frames.
+Xframe adapters support Jumbo Frames up to 9600 bytes.
+.Pp
+For Jumbo Frames, the driver will try to allocate physically contiguous buffers.
+Failures to do so may degrade the performance.
+To resolve such problems, please visit
+.Pa http://www.neterion.com
+where additional information and a kernel patch can be found.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Neterion Xframe 10 Gigabit Ethernet adapters listed in
+.Pa http://www.neterion.com/how/pricing.html .
+.Sh SUPPORT
+For troubleshooting tips and FAQs, please visit
+.Pa http://trac.neterion.com/cgi-bin/trac.cgi/wiki/TitleIndex?anonymous .
+.Pp
+For any issues please send an email to
+.Aq support@neterion.com .
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Neterion
+.Aq support@neterion.com .
diff --git a/share/man/man4/oce.4 b/share/man/man4/oce.4
new file mode 100644
index 000000000000..78043ffc32c8
--- /dev/null
+++ b/share/man/man4/oce.4
@@ -0,0 +1,135 @@
+.\" Copyright (C) 2012 Emulex
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright notice,
+.\" this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. Neither the name of the Emulex Corporation nor the names of its
+.\" contributors may be used to endorse or promote products derived from
+.\" this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" Contact Information:
+.\" freebsd-drivers@emulex.com
+.\"
+.\" Emulex
+.\" 3333 Susan Street
+.\" Costa Mesa, CA 92626
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 19, 2012
+.Dt OCE 4
+.Os
+.Sh NAME
+.Nm oce
+.Nd "Device driver for Emulex OneConnect 10Gb network adapters"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device oce"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_oce_load="YES"
+.Ed
+.Sh DESCRIPTION
+Emulex OneConnect adapters come in various skews and with
+different combinations of NIC, FCoE and iSCSI functions.
+The
+.Nm
+driver claims the NIC functions in all these adapters.
+.Pp
+The
+.Nm
+driver supports VLAN Hardware offload, TCP checksum offload,
+TCP segmentation offload (TSO), Large receive offload (LRO),
+Bonding, Jumbo frames (from 1500 - 9000), Multiple TX queues,
+Receive-Side Scaling (RSS) and MSI-X interrupts.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following network adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Emulex BladeEngine 2
+.It
+Emulex BladeEngine 3
+.It
+Emulex Lancer
+.El
+.Sh UPDATING FIRMWARE
+Adapter firmware updates are persistent.
+.Pp
+Firmware can be updated by following the steps below:
+.Bl -enum
+.It
+Copy the below code to a Makefile:
+.Bd -literal -offset indent
+\&.KMOD=elxflash
+FIRMWS=imagename.ufi:elxflash
+\&.include <bsd.kmod.mk>
+.Ed
+.It
+Replace imagename in above with UFI file name
+.It
+Copy Makefile and UFI file to a directory
+.It
+Execute make & copy generated elxflash.ko to
+.Pa /lib/modules
+.It
+sysctl dev.oce.<if_id>.fw_upgrade=elxflash
+.It
+Reboot the machine
+.El
+.Pp
+In case of issues with supplied UFI, flashing fails with one
+of the following errors.
+.Pp
+.Bl -enum -compact
+.It
+.Qq Invalid BE3 firmware image
+.It
+.Qq "Invalid Cookie. Firmware image corrupted ?"
+.It
+.Qq cmd to write to flash rom failed.
+.El
+.Sh SUPPORT
+For general information and support,
+go to the Emulex website at:
+.Pa http://www.Emulex.com/
+or E-Mail at
+.Pa freebsd-drivers@emulex.com .
+.Sh SEE ALSO
+.Xr ifconfig 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An freebsd-drivers@emulex.com .
diff --git a/share/man/man4/ohci.4 b/share/man/man4/ohci.4
new file mode 100644
index 000000000000..4a60c8bea5f6
--- /dev/null
+++ b/share/man/man4/ohci.4
@@ -0,0 +1,78 @@
+.\" Copyright (c) 1999
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 23, 2005
+.Dt OHCI 4
+.Os
+.Sh NAME
+.Nm ohci
+.Nd OHCI USB Host Controller driver
+.Sh SYNOPSIS
+.Cd "device ohci"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for OHCI-type PCI based USB controllers.
+.Sh HARDWARE
+The
+.Nm
+driver supports all OHCI v1.0 compliant controllers including:
+.Pp
+.Bl -bullet -compact
+.It
+AcerLabs M5237 (Aladdin-V)
+.It
+AMD-756
+.It
+OPTi 82C861 (FireLink)
+.It
+NEC uPD 9210
+.It
+CMD Tech 670 (USB0670)
+.It
+CMD Tech 673 (USB0673)
+.It
+NVIDIA nForce3
+.It
+Sun PCIO-2 (RIO USB)
+.El
+.Sh SEE ALSO
+.Xr xhci 4 ,
+.Xr ehci 4 ,
+.Xr uhci 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Lennart Augustsson Aq augustss@carlstedt.se
+for the
+.Nx
+project.
diff --git a/share/man/man4/orm.4 b/share/man/man4/orm.4
new file mode 100644
index 000000000000..2922cb68eade
--- /dev/null
+++ b/share/man/man4/orm.4
@@ -0,0 +1,47 @@
+.\" Copyright (c) 2000 Nikolai Saoukh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2000
+.Dt ORM 4
+.Os
+.Sh NAME
+.Nm orm
+.Nd ISA I/O space option ROM(s) driver
+.Sh SYNOPSIS
+.Nm
+is automatically included on all systems that have an ISA bus.
+.Sh DESCRIPTION
+The driver scans at boot time the ISA I/O memory space for option
+ROM(s) and claims them.
+Other drivers are thus precluded from using ISA I/O memory that is on
+top of an option ROM.
+.Sh AUTHORS
+This
+manual page was written by
+.An Nikolai Saoukh Aq nms@otdel-1.org .
+.Sh BUGS
+Due to the implementation of the resource manager,
+other drivers cannot attach to the option ROM address range.
diff --git a/share/man/man4/padlock.4 b/share/man/man4/padlock.4
new file mode 100644
index 000000000000..2a74f63939c0
--- /dev/null
+++ b/share/man/man4/padlock.4
@@ -0,0 +1,97 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2010
+.Dt PADLOCK 4
+.Os
+.Sh NAME
+.Nm padlock
+.Nd "driver for the cryptographic functions and RNG in VIA C3, C7 and Eden processors"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device padlock"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+padlock_load="YES"
+.Ed
+.Sh DESCRIPTION
+The C3 and Eden processor series from VIA include hardware acceleration for
+AES.
+The C7 series includes hardware acceleration for AES, SHA1, SHA256 and RSA.
+All of the above processor series include a hardware random number generator.
+.Pp
+The
+.Nm
+driver registers itself to accelerate AES operations and, if available, HMAC/SHA1
+and HMAC/SHA256 for
+.Xr crypto 4 .
+It also registers itself to accelerate other HMAC algorithms, although
+there is no hardware acceleration for those algorithms.
+This is only needed so
+.Nm
+can work with
+.Xr ipsec 4 .
+.Pp
+The hardware random number generator supplies data for the kernel
+.Xr random 4
+subsystem.
+.Sh SEE ALSO
+.Xr crypt 3 ,
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox .
+The first
+.Fx
+release to include it was
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver with AES encryption support was written by
+.An Jason Wright Aq jason@OpenBSD.org .
+It was ported to
+.Fx
+and then extended to support SHA1 and SHA256
+by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
+This manual page was written by
+.An Christian Brueffer Aq brueffer@FreeBSD.org .
diff --git a/share/man/man4/pass.4 b/share/man/man4/pass.4
new file mode 100644
index 000000000000..7819ea369b80
--- /dev/null
+++ b/share/man/man4/pass.4
@@ -0,0 +1,120 @@
+.\"
+.\" Copyright (c) 1998, 1999 Kenneth D. Merry.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 10, 1998
+.Dt PASS 4
+.Os
+.Sh NAME
+.Nm pass
+.Nd CAM application passthrough driver
+.Sh SYNOPSIS
+.Cd device pass
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a way for userland applications to issue CAM CCBs to the
+kernel.
+.Pp
+Since the
+.Nm
+driver allows direct access to the CAM subsystem, system administrators
+should exercise caution when granting access to this driver.
+If used
+improperly, this driver can allow userland applications to crash a machine
+or cause data loss.
+.Pp
+The
+.Nm
+driver attaches to every
+.Tn SCSI
+device found in the system.
+Since it attaches to every device, it provides a generic means of accessing
+.Tn SCSI
+devices, and allows the user to access devices which have no
+"standard" peripheral driver associated with them.
+.Sh KERNEL CONFIGURATION
+It is only necessary to configure one
+.Nm
+device in the kernel;
+.Nm
+devices are automatically allocated as
+.Tn SCSI
+devices are found.
+.Sh IOCTLS
+.Bl -tag -width 012345678901234
+.It CAMIOCOMMAND
+This ioctl takes most kinds of CAM CCBs and passes them through to the CAM
+transport layer for action.
+Note that some CCB types are not allowed
+through the passthrough device, and must be sent through the
+.Xr xpt 4
+device instead.
+Some examples of xpt-only CCBs are XPT_SCAN_BUS,
+XPT_DEV_MATCH, XPT_RESET_BUS, XPT_SCAN_LUN, XPT_ENG_INQ, and XPT_ENG_EXEC.
+These CCB types have various attributes that make it illogical or
+impossible to service them through the passthrough interface.
+.It CAMGETPASSTHRU
+This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device
+corresponding to the device in question.
+Although this ioctl is available through the
+.Nm
+driver, it is of limited use, since the caller must already know that
+the device in question is a passthrough device if they are issuing this
+ioctl.
+It is probably more useful to issue this ioctl through the
+.Xr xpt 4
+device.
+.El
+.Sh FILES
+.Bl -tag -width /dev/passn -compact
+.It Pa /dev/pass Ns Ar n
+Character device nodes for the
+.Nm
+driver.
+There should be one of these for each device accessed through the
+CAM subsystem.
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr cam 3 ,
+.Xr cam 4 ,
+.Xr cam_cdbparse 3 ,
+.Xr xpt 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The CAM passthrough driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An Kenneth Merry Aq ken@FreeBSD.org
+.Sh BUGS
+It might be nice to have a way to asynchronously send CCBs through the
+passthrough driver.
+This would probably require some sort of read/write
+interface or an asynchronous ioctl interface.
diff --git a/share/man/man4/patm.4 b/share/man/man4/patm.4
new file mode 100644
index 000000000000..443b9f7a8d43
--- /dev/null
+++ b/share/man/man4/patm.4
@@ -0,0 +1,192 @@
+.\"
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.\" patm(4) man page
+.\"
+.Dd July 15, 2003
+.Dt PATM 4
+.Os
+.Sh NAME
+.Nm patm
+.Nd "device driver for IDT77252 based ATM interfaces (ProSum and IDT)"
+.Sh SYNOPSIS
+.Cd device patm
+.Cd device utopia
+.Cd device atm
+.Pp
+.Cd options NATM
+.Cd options LIBMBPOOL
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports ATM cards based on the IDT77252 chip.
+It has been tested with ProSum's ProATM-155 cards and with IDT's evaluation
+boards.
+The driver interfaces with the
+.Xr natm 4
+framework,
+.Xr netgraph 4
+and HARP.
+It provides only PVC services.
+Signalling, ATMARP, ILMI and other
+higher layer protocols are implemented using
+.Xr netgraph 4
+or HARP.
+.Pp
+For configuring the card for IP see
+.Xr natmip 4 .
+.Pp
+The driver supports UBR, CBR, VBR and ABR traffic.
+Supported AALs are:
+AAL0 (cell payloads), AAL5 and raw AAL.
+The driver supports opening of VCI/VPI 0/0 in RX, raw AAL-mode.
+This VC will receive all incoming cells (even those with non-zero GFC
+fields and VPI/VCI values outside the allowed range) that are not
+claimed by other open connections.
+This may be used for monitoring purposes.
+.Pp
+The following sysctls are recognized by the driver additionally to those
+handled by
+.Xr utopia 4 :
+.Bl -tag -width indent
+.It Va hw.atm.patm Ns Ar N Ns Va .istats
+Returns a list of
+.Vt uint32_t
+statistic counters with internal driver statistics.
+.It Va hw.atm.patm Ns Ar N Ns Va .eeprom
+This is a read-only variable containing the contents of the on-board EEPROM
+device.
+.It Va hw.atm.patm Ns Ar N Ns Va .lbuf_max
+This puts an upper limit on the number of large receive buffers the
+driver will allocate.
+This is a read-only variable that can be set via a
+.Xr loader 8
+tunable.
+.It Va hw.atm.patm Ns Ar N Ns Va .tx_maxmaps
+This is the upper limit of transmission DMA maps the driver will allocate.
+This is read-only but may be set via a
+.Xr loader 8
+tunable.
+.It Va hw.atm.patm Ns Ar N Ns Va .debug
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+These are debugging flags.
+See
+.Pa src/sys/dev/patm/if_patmvar.h
+for the possible flags.
+This may be initialized via a
+.Xr loader 8
+tunable.
+.It Va hw.atm.patm Ns Ar N Ns Va .regs
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+Returns the current values of the card's registers.
+.It Va hw.atm.patm Ns Ar N Ns Va .tsq
+Returns the transmit status queue.
+.El
+.Pp
+When loaded, the driver initializes several variables from
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va hw.patm Ns Ar N Ns Va .lbuf_max
+This initializes the corresponding
+.Xr sysctl 8
+variable and defines an upper
+limit on the number of large receive buffers (mbuf clusters).
+.It Va hw.patm Ns Ar N Ns Va .tx_maxmaps
+This initializes the corresponding
+.Xr sysctl 8
+variable and is the maximum
+number of DMA maps for transmission that the driver will allocated.
+.It Va hw.patm Ns Ar N Ns Va .debug
+.Bf Em
+(Only if debugging enabled.)
+.Ef
+Initializes the debugging flags.
+.El
+.Pp
+The driver supports the media options
+.Cm sdh , noscramb
+and
+.Cm unassigned
+(see
+.Xr utopia 4 )
+when the card is a 155MBit card.
+Both PMC-Sierra S/UNI and IDT77155 PHY chips are supported for these cards.
+For 25MBit cards the IDT77105 is supported.
+.Sh DIAGNOSTICS
+.Bd -literal
+patm1: <NICStAR (77222/77252) ATM adapter> port 0xc000-0xc0ff mem 0xf8000000-0xf83fffff,0xf4000000-0xf4000fff irq 11 at device 8.0 on pci2
+patm1: IDT77252 155MBit interface; idt77252 Rev. G; IDT77155 PHY
+patm1: 128K x 32 SRAM; 4096 connections
+.Ed
+.Sh SEE ALSO
+.Xr natm 4 ,
+.Xr natmip 4 ,
+.Xr utopia 4
+.Sh ACKNOWLEDGEMENTS
+Thanks to Christian Bucari from ProSum for lending two of these cards to enable
+the development of this driver.
+Thanks also for answering my questions.
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh CAVEATS
+The card fails to generate an interrupt if a cell is received in AAL0 mode
+that has the MSB of the PTI field cleared.
+Therefore cells will be delivered on the next receive interrupt which can happen
+either when the receive status queue is full, or a cell with the last bit of
+the PTI set is received.
+.Pp
+Although the card supports AAL3/4 the driver does not.
+.Pp
+The rate tables used by this driver are not the tables recommended by IDT
+(they are wrong anyway).
+The driver's tables are slightly more aggressive than IDT's.
+That means, that the actual cell rate can be slightly higher than the
+specified.
+This is in contrast to the IDT tables where cell rates 5% less than the
+allowed one have been observed.
+This can be changed by changing the program that generates these tables,
+found in
+.Pa /usr/src/sys/dev/patm/genrtab ,
+and regenerating them.
+.Pp
+The reported media for the 155MBit cards will always be OC3/MM, because
+there is no (known to me) way to figure out the actual medium.
+The medium should really be coded in the EEPROM by the manufacturer.
+.Pp
+The Tx cell counter in the utopia statistics is wrong, because the chip
+uses idle cells for spacing and the PHY counts these cells.
+While there is a configuration option for the chip to switch of these cells
+and, according to the documentation, this should not influence cell spacing,
+it does, so the driver lets the chip generate idle cells.
diff --git a/share/man/man4/pccard.4 b/share/man/man4/pccard.4
new file mode 100644
index 000000000000..f955804978e2
--- /dev/null
+++ b/share/man/man4/pccard.4
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright (c) 2002 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2002
+.Dt PCCARD 4
+.Os
+.Sh NAME
+.Nm pccard
+.Nd PC Card bus driver
+.Sh SYNOPSIS
+.Cd device pccard
+.Sh DESCRIPTION
+The
+.Nm
+driver implements the PC Card bus.
+The
+.Nm
+driver supports all PC Card bridges in the system.
+.Sh TUNABLES
+The driver supports the following tunable parameters, which may be
+added to
+.Pa /boot/loader.conf
+or set via the
+.Xr sysctl 8
+command:
+.Bl -tag -width ".Cm hw.pccard.cis_debug" -compact
+.It Cm hw.pccard.debug
+Non-zero values cause more verbose information to be printed when a
+16-bit PC Card is inserted or removed.
+.It Cm hw.pccard.cis_debug
+Non-zero value causes the CIS parsing of the 16-bit PC Card to be much
+more verbose and include a complete CIS dump.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/pccard0.cis" -compact
+.It Pa /dev/pccard0.cis
+This exclusive-use device will report all the CIS chains present in a
+PC Card, if a 16-bit PC Card is inserted in the slot.
+Only one user at a time may access the CIS.
+The CIS is presented as the relevant byte stream from the PC Card.
+For CIS tuples in Attribute Memory (the default), only the even
+locations are presented (the ODD locations are undefined per the
+standard).
+For CIS tuples in Common Memory, every byte is presented to the user.
+Decoding of the CIS tuples is done via a userland program.
+All tuples are presented to the user.
+.El
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.\" .Xr mecia 4 ,
+.Xr pccbb 4
+.\" .Xr tcic 4
+.Rs
+.%T "PC Card Standard, Release 8"
+.Re
diff --git a/share/man/man4/pccbb.4 b/share/man/man4/pccbb.4
new file mode 100644
index 000000000000..d8d955e5538c
--- /dev/null
+++ b/share/man/man4/pccbb.4
@@ -0,0 +1,183 @@
+.\"
+.\" Copyright (c) 2002-2003 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2004
+.Dt PCCBB 4
+.Os
+.Sh NAME
+.Nm pccbb
+.Nd cardbus bridge driver
+.Sh SYNOPSIS
+.Cd device cbb
+.Cd device pccard
+.Cd device cardbus
+.Cd device exca
+.Sh DESCRIPTION
+The
+.Nm
+driver implements the Yenta specification for CardBus bridges.
+.Pp
+The following PCI cardbus and pcmcia bridges are supported:
+.Pp
+.Bl -item -compact
+.It
+Cirrus Logic PD6832
+.It
+Cirrus Logic PD6833
+.It
+Cirrus Logic PD6834
+.Pp
+.It
+O2micro OZ6812
+.It
+O2micro OZ6832
+.It
+O2micro OZ6833
+.It
+O2micro OZ6836
+.It
+O2micro OZ6860
+.It
+O2micro OZ6872
+.It
+O2micro OZ6912
+.It
+O2micro OZ6922
+.It
+O2micro OZ6933
+.It
+O2micro OZ6972
+.It
+O2Micro OZ711E1
+.It
+O2Micro OZ711M1
+.El
+.Bl -item -compact
+.It
+Ricoh RL4C475
+.It
+Ricoh RL4C476
+.It
+Ricoh RL4C477
+.It
+Ricoh RL4C478
+.Pp
+.It
+TI PCI-1031
+.It
+TI PCI-1130
+.It
+TI PCI-1131
+.It
+TI PCI-1210
+.It
+TI PCI-1211
+.It
+TI PCI-1220
+.It
+TI PCI-1221
+.It
+TI PCI-1225
+.It
+TI PCI-1250
+.It
+TI PCI-1251
+.It
+TI PCI-1251B
+.It
+TI PCI-1260
+.It
+TI PCI-1260B
+.It
+TI PCI-1410
+.It
+TI PCI-1420
+.It
+TI PCI-1450
+.It
+TI PCI-1451
+.It
+TI PCI-1510
+.It
+TI PCI-1515
+.It
+TI PCI-1520
+.It
+TI PCI-1530
+.It
+TI PCI-1620
+.It
+TI PCI-4410
+.It
+TI PCI-4450
+.It
+TI PCI-4451
+.It
+TI PCI-4510
+.It
+TI PCI-4520
+.It
+TI PCI-[67]x[12]1
+.It
+TI PCI-[67]x20
+.It
+ENE CB710
+.It
+ENE CB720
+.It
+ENE CB1211
+.It
+ENE CB1255
+.It
+ENE CB1410
+.It
+ENE CB1420
+.Pp
+.It
+Toshiba ToPIC95
+.It
+Toshiba ToPIC95B
+.It
+Toshiba ToPIC97
+.It
+Toshiba ToPIC100
+.El
+.Sh TUNABLES
+The driver supports the following tunable parameters, which may be
+added to
+.Pa /boot/loader.conf
+or set via the
+.Xr sysctl 8
+command:
+.Bl -tag -width ".Cm hw.cbb.debug" -compact
+.It Cm hw.cbb.debug
+Non-zero values cause more verbose information to be printed to aid in
+debugging problems with the bridge chipset.
+.El
+.Sh SEE ALSO
+.Xr cardbus 4 ,
+.Xr pccard 4 ,
+.Xr exca 4
diff --git a/share/man/man4/pcf.4 b/share/man/man4/pcf.4
new file mode 100644
index 000000000000..cc8915fa1222
--- /dev/null
+++ b/share/man/man4/pcf.4
@@ -0,0 +1,72 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 6, 1998
+.Dt PCF 4
+.Os
+.Sh NAME
+.Nm pcf
+.Nd Philips I2C bus controller
+.Sh SYNOPSIS
+.Cd "device pcf"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.pcf.0.at="isa"
+.Cd hint.pcf.0.port="0x320"
+.Cd hint.pcf.0.irq="5"
+.Pp
+For one or more iicbus busses:
+.Cd "device iicbus"
+.Sh DESCRIPTION
+The
+.Em pcf
+driver provides support to the Philips PCF8584 I2C controller for the
+.Xr iicbus 4
+system.
+.Pp
+The PCF8584 is an integrated circuit designed in CMOS technology which serves
+as an interface between most standard parallel-bus
+microcontrollers/microprocessors and the serial I2C-bus.
+The PCF8584
+provides both master and slave functions.
+Communication with I2C-bus is
+carried out on a byte-wise basis using interrupt or polled handshake.
+It
+controls all the I2C-bus specific sequences, protocol, arbitration and timing.
+The PCF8584 allows parallel-bus systems to communicate bidirectionally with
+the I2C-bus.
+.Sh SEE ALSO
+.Xr iicbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/pci.4 b/share/man/man4/pci.4
new file mode 100644
index 000000000000..c79626f57bda
--- /dev/null
+++ b/share/man/man4/pci.4
@@ -0,0 +1,343 @@
+.\"
+.\" Copyright (c) 1999 Kenneth D. Merry.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 3, 2008
+.Dt PCI 4
+.Os
+.Sh NAME
+.Nm pci
+.Nd generic PCI driver
+.Sh SYNOPSIS
+.Cd device pci
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a way for userland programs to read and write
+.Tn PCI
+configuration registers.
+It also provides a way for userland programs to get a list of all
+.Tn PCI
+devices, or all
+.Tn PCI
+devices that match various patterns.
+.Pp
+Since the
+.Nm
+driver provides a write interface for
+.Tn PCI
+configuration registers, system administrators should exercise caution when
+granting access to the
+.Nm
+device.
+If used improperly, this driver can allow userland applications to
+crash a machine or cause data loss.
+.Pp
+The
+.Nm
+driver implements the
+.Tn PCI
+bus in the kernel.
+It enumerates any devices on the
+.Tn PCI
+bus and gives
+.Tn PCI
+client drivers the chance to attach to them.
+It assigns resources to children, when the BIOS does not.
+It takes care of routing interrupts when necessary.
+It reprobes the unattached
+.Tn PCI
+children when
+.Tn PCI
+client drivers are dynamically
+loaded at runtime.
+.Sh KERNEL CONFIGURATION
+The
+.Nm
+device is included in the kernel as described in the SYNOPSIS section.
+The
+.Nm
+driver cannot be built as a
+.Xr kld 4 .
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls are supported by the
+.Nm
+driver.
+They are defined in the header file
+.In sys/pciio.h .
+.Bl -tag -width 012345678901234
+.It PCIOCGETCONF
+This
+.Xr ioctl 2
+takes a
+.Va pci_conf_io
+structure.
+It allows the user to retrieve information on all
+.Tn PCI
+devices in the system, or on
+.Tn PCI
+devices matching patterns supplied by the user.
+The call may set
+.Va errno
+to any value specified in either
+.Xr copyin 9
+or
+.Xr copyout 9 .
+The
+.Va pci_conf_io
+structure consists of a number of fields:
+.Bl -tag -width match_buf_len
+.It pat_buf_len
+The length, in bytes, of the buffer filled with user-supplied patterns.
+.It num_patterns
+The number of user-supplied patterns.
+.It patterns
+Pointer to a buffer filled with user-supplied patterns.
+.Va patterns
+is a pointer to
+.Va num_patterns
+.Va pci_match_conf
+structures.
+The
+.Va pci_match_conf
+structure consists of the following elements:
+.Bl -tag -width pd_vendor
+.It pc_sel
+.Tn PCI
+domain, bus, slot and function.
+.It pd_name
+.Tn PCI
+device driver name.
+.It pd_unit
+.Tn PCI
+device driver unit number.
+.It pc_vendor
+.Tn PCI
+vendor ID.
+.It pc_device
+.Tn PCI
+device ID.
+.It pc_class
+.Tn PCI
+device class.
+.It flags
+The flags describe which of the fields the kernel should match against.
+A device must match all specified fields in order to be returned.
+The match flags are enumerated in the
+.Va pci_getconf_flags
+structure.
+Hopefully the flag values are obvious enough that they do not need to
+described in detail.
+.El
+.It match_buf_len
+Length of the
+.Va matches
+buffer allocated by the user to hold the results of the
+.Dv PCIOCGETCONF
+query.
+.It num_matches
+Number of matches returned by the kernel.
+.It matches
+Buffer containing matching devices returned by the kernel.
+The items in this buffer are of type
+.Va pci_conf ,
+which consists of the following items:
+.Bl -tag -width pc_subvendor
+.It pc_sel
+.Tn PCI
+domain, bus, slot and function.
+.It pc_hdr
+.Tn PCI
+header type.
+.It pc_subvendor
+.Tn PCI
+subvendor ID.
+.It pc_subdevice
+.Tn PCI
+subdevice ID.
+.It pc_vendor
+.Tn PCI
+vendor ID.
+.It pc_device
+.Tn PCI
+device ID.
+.It pc_class
+.Tn PCI
+device class.
+.It pc_subclass
+.Tn PCI
+device subclass.
+.It pc_progif
+.Tn PCI
+device programming interface.
+.It pc_revid
+.Tn PCI
+revision ID.
+.It pd_name
+Driver name.
+.It pd_unit
+Driver unit number.
+.El
+.It offset
+The offset is passed in by the user to tell the kernel where it should
+start traversing the device list.
+The value passed out by the kernel
+points to the record immediately after the last one returned.
+The user may
+pass the value returned by the kernel in subsequent calls to the
+.Dv PCIOCGETCONF
+ioctl.
+If the user does not intend to use the offset, it must be set to zero.
+.It generation
+.Tn PCI
+configuration generation.
+This value only needs to be set if the offset is set.
+The kernel will compare the current generation number of its internal
+device list to the generation passed in by the user to determine whether
+its device list has changed since the user last called the
+.Dv PCIOCGETCONF
+ioctl.
+If the device list has changed, a status of
+.Va PCI_GETCONF_LIST_CHANGED
+will be passed back.
+.It status
+The status tells the user the disposition of his request for a device list.
+The possible status values are:
+.Bl -ohang
+.It PCI_GETCONF_LAST_DEVICE
+This means that there are no more devices in the PCI device list after the
+ones returned in the
+.Va matches
+buffer.
+.It PCI_GETCONF_LIST_CHANGED
+This status tells the user that the
+.Tn PCI
+device list has changed since his last call to the
+.Dv PCIOCGETCONF
+ioctl and he must reset the
+.Va offset
+and
+.Va generation
+to zero to start over at the beginning of the list.
+.It PCI_GETCONF_MORE_DEVS
+This tells the user that his buffer was not large enough to hold all of the
+remaining devices in the device list that possibly match his criteria.
+It is possible for this status to be returned, even when none of the remaining
+devices in the list would match the user's criteria.
+.It PCI_GETCONF_ERROR
+This indicates a general error while servicing the user's request.
+If the
+.Va pat_buf_len
+is not equal to
+.Va num_patterns
+times
+.Fn sizeof "struct pci_match_conf" ,
+.Va errno
+will be set to
+.Er EINVAL .
+.El
+.El
+.It PCIOCREAD
+This
+.Xr ioctl 2
+reads the
+.Tn PCI
+configuration registers specified by the passed-in
+.Va pci_io
+structure.
+The
+.Va pci_io
+structure consists of the following fields:
+.Bl -tag -width pi_width
+.It pi_sel
+A
+.Va pcisel
+structure which specifies the domain, bus, slot and function the user would
+like to query.
+If the specific bus is not found, errno will be set to ENODEV and -1 returned
+from the ioctl.
+.It pi_reg
+The
+.Tn PCI
+configuration register the user would like to access.
+.It pi_width
+The width, in bytes, of the data the user would like to read.
+This value
+may be either 1, 2, or 4.
+3-byte reads and reads larger than 4 bytes are
+not supported.
+If an invalid width is passed, errno will be set to EINVAL.
+.It pi_data
+The data returned by the kernel.
+.El
+.It PCIOCWRITE
+This
+.Xr ioctl 2
+allows users to write to the
+.Tn PCI
+specified in the passed-in
+.Va pci_io
+structure.
+The
+.Va pci_io
+structure is described above.
+The limitations on data width described for
+reading registers, above, also apply to writing
+.Tn PCI
+configuration registers.
+.El
+.Sh FILES
+.Bl -tag -width /dev/pci -compact
+.It Pa /dev/pci
+Character device for the
+.Nm
+driver.
+.El
+.Sh SEE ALSO
+.Xr pciconf 8
+.Sh HISTORY
+The
+.Nm
+driver (not the kernel's
+.Tn PCI
+support code) first appeared in
+.Fx 2.2 ,
+and was written by Stefan Esser and Garrett Wollman.
+Support for device listing and matching was re-implemented by
+Kenneth Merry, and first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An Kenneth Merry Aq ken@FreeBSD.org
+.Sh BUGS
+It is not possible for users to specify an accurate offset into the device
+list without calling the
+.Dv PCIOCGETCONF
+at least once, since they have no way of knowing the current generation
+number otherwise.
+This probably is not a serious problem, though, since
+users can easily narrow their search by specifying a pattern or patterns
+for the kernel to match against.
diff --git a/share/man/man4/pcib.4 b/share/man/man4/pcib.4
new file mode 100644
index 000000000000..e57b66c97ace
--- /dev/null
+++ b/share/man/man4/pcib.4
@@ -0,0 +1,49 @@
+.\"
+.\" Copyright (c) 2008 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 18, 2008
+.Dt PCIB 4
+.Os
+.Sh NAME
+.Nm pcib
+.Nd PCI bridge driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides for host and
+.Tn PCI
+bridges in a
+.Tn PCI
+system.
+.Sh BUGS
+This man page is too short.
diff --git a/share/man/man4/pcic.4 b/share/man/man4/pcic.4
new file mode 100644
index 000000000000..589a2ed5c9a0
--- /dev/null
+++ b/share/man/man4/pcic.4
@@ -0,0 +1,103 @@
+.\"
+.\" Copyright (c) 2001, 2002 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2002
+.Dt PCIC 4
+.Os
+.Sh NAME
+.Nm pcic
+.Nd PC Card bridge driver
+.Sh SYNOPSIS
+.Cd device pcic
+.Cd device pccard
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for older ISA and non-Yenta PCI PC Card bridges.
+The
+.Nm
+driver supports most
+.Tn ExCA
+devices attached to the
+.Tn ISA
+bus or
+.Tn PCI
+devices that do not conform to the Yenta specification.
+.Pp
+The following
+.Tn ISA
+devices, or true clones, are supported in the current code.
+.Pp
+.Bl -tag -width "Intel i82365SL Step A" -compact
+.It Intel i82365SL Step A
+.It Intel i82365SL Step B
+.It Intel i82365SL Step C
+.Tn Intel Ns 's
+original 16-bit PC Card controller.
+.It Intel i82365SL-DF
+.Tn Intel Ns 's
+last version of this device.
+3.3V support was added.
+.It VLSI 82C146
+An older VLSI part with some issues on some machines.
+.It Cirrus Logic PD-6710
+.It Cirrus Logic PD-6720
+.It Cirrus Logic PD-6722
+Cirrus Logic's pcic controller.
+Compatible with the i82365SL Step C with the addition of a different
+3.3V control.
+.It Ricoh RF5C296
+.It Ricoh RF5C396
+Ricoh's PC Card bridge chips.
+These are compatible with the i82365SL Step C, but with yet another
+different 3.3V control.
+.It Vadem 365
+.It Vadem 465
+Compatible with i82365SL Step C.
+.It Vadem 468
+.It Vadem 469
+Like the earlier Vadem models, but with Vadem's own, incompatible, 3.3V
+control system.
+.It IBM PCIC
+.Tn IBM
+clone of the original i82365SL part, with its own ID register value.
+Has no 3.3V ability.
+.El
+.Pp
+Many other vendors made parts in this arena, but most of them were
+compatible with one of the above chipsets.
+.Pp
+The following PCI pcmcia bridges are supported:
+.Pp
+.Bl -tag -width "Intel i82365SL Step A" -compact
+.It Cirrus Logic PD6729
+.It Cirrus Logic PD6730
+.Pp
+.It O2micro OZ6729
+.It O2micro OZ6730
+.El
+.Sh BUGS
+This does not work at all at the moment.
diff --git a/share/man/man4/pcii.4 b/share/man/man4/pcii.4
new file mode 100644
index 000000000000..3369d3ffc72f
--- /dev/null
+++ b/share/man/man4/pcii.4
@@ -0,0 +1,97 @@
+.\" Copyright (c) 2010, Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 24, 2010
+.Dt PCII 4
+.Os
+.Sh NAME
+.Nm pcii
+.Nd National Instruments PCIIA GPIB controller driver
+.Sh SYNOPSIS
+.Cd "device pcii"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.pcii.0.at="isa"
+.Cd hint.pcii.0.port="0x2e1"
+.Cd hint.pcii.0.irq="7"
+.Cd hint.pcii.0.drq="1"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for driving an IEEE-488 bus, also called
+IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
+Bus), or GPIB (General Purpose Instrument Bus).
+The driver supports National Instruments PCIIA cards (sometimes
+also referred to as PC2A) and compatibles.
+These cards use a NEC \(mcPD7210 controller IC as the main
+interface between the host computer and the instrument bus.
+.Ss IO memory space layout
+The PCIIA cards use a very specific IO memory space allocation layout.
+The address bits A0 through A9 (which have traditionally been the only
+address bits evaluated on IBM PC XT extension cards) are hardwired to
+address 0x2e1.
+Bits A10 through A12 are used by the \(mcPD7210 register select lines.
+This makes the individual 7210 registers being 0x400 bytes apart in the
+ISA bus address space.
+Address bits A13 and A14 are compared to a DIP switch setting on the
+card, allowing for up to 4 different cards being installed (at base
+addresses 0x2e1, 0x22e1, 0x42e1, and 0x62e1, respectively).
+A15 has been used to select an optional on-board time-of-day clock
+chip (MM58167A) on the original PCIIA rather than the \(mcPD7210
+(which is not implemented on later boards and clones).
+Finally, the IO addresses 0x2f0 ... 0x2f7 are used for a
+.Em special interrupt handling feature
+(re-enable interrupts so the IRQ can be shared), where actually only
+address 0x2f0 plus the actual IRQ level is required for each card.
+Some clones do not appear to require this special IRQ handling, and
+are thus likely to not support the shared IRQ feature.
+.Pp
+Only the base address of the card needs to be specified in the ISA
+device hints; the driver takes care to derive all other IO addresses
+needed during the probe phase.
+.Ss Supported cards
+The following cards are known to be supported:
+.Bl -bullet -offset indent
+.It
+B&C Microsystems PC488A-0
+.It
+National Instruments GPIB-PCII/PCIIA (in PCIIa mode)
+.It
+Axiom AX5488
+.El
+.Sh SEE ALSO
+.Xr gpib 3 ,
+.Xr gpib 4 ,
+.Xr device.hints 5
+.Sh HISTORY
+The
+.Nm
+driver was written by Poul-Henning Kamp, and first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .
diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4
new file mode 100644
index 000000000000..1ac5844a17b4
--- /dev/null
+++ b/share/man/man4/pcm.4
@@ -0,0 +1,796 @@
+.\"
+.\" Copyright (c) 2009-2011 Joel Dahl <joel@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 22, 2012
+.Dt SOUND 4
+.Os
+.Sh NAME
+.Nm sound ,
+.Nm pcm ,
+.Nm snd
+.Nd
+.Fx
+PCM audio device infrastructure
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver is the main component of the
+.Fx
+sound system.
+It works in conjunction with a bridge device driver on supported devices
+and provides PCM audio record and playback once it attaches.
+Each bridge device driver supports a specific set of audio chipsets and
+needs to be enabled together with the
+.Nm
+driver.
+PCI and ISA PnP audio devices identify themselves so users are usually not
+required to add anything to
+.Pa /boot/device.hints .
+.Pp
+Some of the main features of the
+.Nm
+driver are: multichannel audio, per-application
+volume control, dynamic mixing through virtual sound channels, true full
+duplex operation, bit perfect audio, rate conversion and low latency
+modes.
+.Pp
+The
+.Nm
+driver is enabled by default, along with several bridge device drivers.
+Those not enabled by default can be loaded during runtime with
+.Xr kldload 8
+or during boot via
+.Xr loader.conf 5 .
+The following bridge device drivers are available:
+.Pp
+.Bl -bullet -compact
+.It
+.Xr snd_ad1816 4
+.It
+.Xr snd_ai2s 4 (enabled by default on powerpc)
+.It
+.Xr snd_als4000 4
+.It
+.Xr snd_atiixp 4
+.It
+.Xr snd_audiocs 4 (enabled by default on sparc64)
+.It
+.Xr snd_cmi 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_cs4281 4
+.It
+.Xr snd_csa 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_davbus 4 (enabled by default on powerpc)
+.It
+.Xr snd_ds1 4
+.It
+.Xr snd_emu10k1 4
+.It
+.Xr snd_emu10kx 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_envy24 4
+.It
+.Xr snd_envy24ht 4
+.It
+.Xr snd_es137x 4 (enabled by default on amd64, i386, sparc64)
+.It
+.Xr snd_ess 4
+.It
+.Xr snd_fm801 4
+.It
+.Xr snd_gusc 4
+.It
+.Xr snd_hda 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_hdspe 4
+.It
+.Xr snd_ich 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_maestro 4
+.It
+.Xr snd_maestro3 4
+.It
+.Xr snd_mss 4
+.It
+.Xr snd_neomagic 4
+.It
+snd_sb16
+.It
+snd_sb8
+.It
+.Xr snd_sbc 4
+.It
+.Xr snd_solo 4
+.It
+.Xr snd_spicds 4
+.It
+.Xr snd_t4dwave 4 (enabled by default on sparc64)
+.It
+.Xr snd_uaudio 4 (enabled by default on amd64, i386, powerpc, sparc64)
+.It
+.Xr snd_via8233 4 (enabled by default on amd64, i386)
+.It
+.Xr snd_via82c686 4
+.It
+.Xr snd_vibes 4
+.El
+.Pp
+Refer to the manual page for each bridge device driver for driver specific
+settings and information.
+.Ss Legacy Hardware
+For old legacy
+.Tn ISA
+cards, the driver looks for
+.Tn MSS
+cards at addresses
+.Dv 0x530
+and
+.Dv 0x604 .
+These values can be overridden in
+.Pa /boot/device.hints .
+Non-PnP sound cards require the following lines in
+.Xr device.hints 5 :
+.Bd -literal -offset indent
+hint.pcm.0.at="isa"
+hint.pcm.0.irq="5"
+hint.pcm.0.drq="1"
+hint.pcm.0.flags="0x0"
+.Ed
+.Pp
+Apart from the usual parameters, the flags field is used to specify
+the secondary
+.Tn DMA
+channel (generally used for capture in full duplex cards).
+Flags are set to 0 for cards not using a secondary
+.Tn DMA
+channel, or to 0x10 + C to specify channel C.
+.Ss Boot Variables
+In general, the module
+.Pa snd_foo
+corresponds to
+.Cd "device snd_foo"
+and can be
+loaded by the boot
+.Xr loader 8
+via
+.Xr loader.conf 5
+or from the command line using the
+.Xr kldload 8
+utility.
+Options which can be specified in
+.Pa /boot/loader.conf
+include:
+.Bl -tag -width ".Va snd_driver_load" -offset indent
+.It Va snd_driver_load
+.Pq Dq Li NO
+If set to
+.Dq Li YES ,
+this option loads all available drivers.
+.It Va snd_hda_load
+.Pq Dq Li NO
+If set to
+.Dq Li YES ,
+only the Intel High Definition Audio bridge device driver and dependent
+modules will be loaded.
+.It Va snd_foo_load
+.Pq Dq Li NO
+If set to
+.Dq Li YES ,
+load driver for card/chipset foo.
+.El
+.Pp
+To define default values for the different mixer channels,
+set the channel to the preferred value using hints, e.g.:
+.Va hint.pcm.0.line Ns = Ns Qq Li 0 .
+This will mute the input channel per default.
+.Ss Multichannel Audio
+Multichannel audio, popularly referred to as
+.Dq surround sound
+is supported and enabled by default.
+The FreeBSD multichannel matrix processor supports up to 18 interleaved
+channels, but the limit is currently set to 8 channels (as commonly used
+for 7.1 surround sound).
+The internal matrix mapping can handle reduction, expansion or
+re-routing of channels.
+This provides a base interface for related multichannel
+.Fn ioctl
+support.
+Multichannel audio works both with and without
+.Tn VCHANs .
+.Pp
+Most bridge device drivers are still missing multichannel matrixing
+support, but in most cases this should be trivial to implement.
+Use the
+.Va dev.pcm.%d.[play|rec].vchanformat
+.Xr sysctl(8)
+to adjust the number of channels used.
+The current multichannel interleaved structure and arrangement was
+implemented by inspecting various popular UNIX applications.
+There were no single standard, so much care has been taken to try
+to satisfy each possible scenario, despite the fact that each
+application has its own conflicting standard.
+.Ss EQ
+The Parametric Software Equalizer (EQ) enables the use of
+.Dq tone
+controls (bass and treble).
+Commonly used for ear-candy or frequency compensation due to the vast
+difference in hardware quality.
+EQ is disabled by default, but can be enabled with the
+.Va hint.pcm.%d.eq
+tunable.
+.Ss VCHANs
+Each device can optionally support more playback and recording channels
+than physical hardware provides by using
+.Dq virtual channels
+or
+.Tn VCHANs .
+.Tn VCHAN
+options can be configured via the
+.Xr sysctl 8
+interface but can only be manipulated while the device is inactive.
+.Ss VPC
+FreeBSD supports independent and individual volume controls for each active
+application, without touching the master
+.Nm
+volume.
+This is sometimes referred to as Volume Per Channel (VPC).
+The
+.Tn VPC
+feature is enabled by default.
+.Ss Loader Tunables
+The following loader tunables are used to set driver configuration at the
+.Xr loader 8
+prompt before booting the kernel, or they can be stored in
+.Pa /boot/loader.conf
+in order to automatically set them before booting the kernel.
+It is also possible to use
+.Xr kenv 1
+to change these tunables before loading the
+.Nm
+driver.
+The following tunables can not be changed during runtime using
+.Xr sysctl 8 .
+.Bl -tag -width indent
+.It Va hint.pcm.%d.eq
+Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer.
+Requires a driver reload if changed.
+Enabling this will make bass and treble controls appear in mixer applications.
+This tunable is undefined by default.
+Equalizing is disabled by default.
+.It Va hint.pcm.%d.vpc
+Set to 1 or 0 to explicitly enable (1) or disable (0) the
+.Tn VPC
+feature.
+This tunable is undefined by default.
+.Tn VPC
+is however enabled by default.
+.El
+.Ss Runtime Configuration
+There are a number of
+.Xr sysctl 8
+variables available which can be modified during runtime.
+These values can also be stored in
+.Pa /etc/sysctl.conf
+in order to automatically set them during the boot process.
+.Va hw.snd.*
+are global settings and
+.Va dev.pcm.*
+are device specific.
+.Bl -tag -width indent
+.It Va hw.snd.compat_linux_mmap
+Linux
+.Xr mmap 2
+compatibility.
+The following values are supported (default is 0):
+.Bl -tag -width 2n
+.It -1
+Force disabling/denying PROT_EXEC
+.Xr mmap 2
+requests.
+.It 0
+Auto detect proc/ABI type, allow
+.Xr mmap 2
+for Linux applications, and deny for everything else.
+.It 1
+Always allow PROT_EXEC page mappings.
+.El
+.It Va hw.snd.default_auto
+Automatically assign the default sound unit.
+The following values are supported (default is 1):
+.Bl -tag -width 2n
+.It 0
+Do not assign the default sound unit automatically.
+.It 1
+Use the best available sound device based on playing and recording
+capabilities of the device.
+.It 2
+Use the most recently attached device.
+.El
+.It Va hw.snd.default_unit
+Default sound card for systems with multiple sound cards.
+When using
+.Xr devfs 5 ,
+the default device for
+.Pa /dev/dsp .
+Equivalent to a symlink from
+.Pa /dev/dsp
+to
+.Pa /dev/dsp Ns Va ${hw.snd.default_unit} .
+.It Va hw.snd.feeder_eq_exact_rate
+Only certain rates are allowed for precise processing.
+The default behavior is however to allow sloppy processing for all rates,
+even the unsupported ones.
+Enable to toggle this requirement and only allow processing for supported
+rates.
+.It Va hw.snd.feeder_rate_max
+Maximum allowable sample rate.
+.It Va hw.snd.feeder_rate_min
+Minimum allowable sample rate.
+.It Va hw.snd.feeder_rate_polyphase_max
+Adjust to set the maximum number of allowed polyphase entries during the
+process of building resampling filters.
+Disabling polyphase resampling has the benefit of reducing memory usage, at
+the expense of slower and lower quality conversion.
+Only applicable when the SINC interpolator is used.
+Default value is 183040.
+Set to 0 to disable polyphase resampling.
+.It Va hw.snd.feeder_rate_quality
+Sample rate converter quality.
+Default value is 1, linear interpolation.
+Available options include:
+.Bl -tag -width 2n
+.It 0
+Zero Order Hold, ZOH.
+Very fast, but with poor quality.
+.It 1
+Linear interpolation.
+Fast, quality is subject to personal preference.
+Technically the quality is poor however, due to the lack of anti-aliasing
+filtering.
+.It 2
+Bandlimited SINC interpolator.
+Implements polyphase banking to boost the conversion speed, at the cost of
+memory usage, with multiple high quality polynomial interpolators to improve
+the conversion accuracy.
+100% fixed point, 64bit accumulator with 32bit coefficients and high precision
+sample buffering.
+Quality values are 100dB stopband, 8 taps and 85% bandwidth.
+.It 3
+Continuation of the bandlimited SINC interpolator, with 100dB stopband, 36
+taps and 90% bandwidth as quality values.
+.It 4
+Continuation of the bandlimited SINC inteprolator, with 100dB stopband, 164
+taps and 97% bandwidth as quality values.
+.El
+.It Va hw.snd.feeder_rate_round
+Sample rate rounding threshold, to avoid large prime division at the
+cost of accuracy.
+All requested sample rates will be rounded to the nearest threshold value.
+Possible values range between 0 (disabled) and 500.
+Default is 25.
+.It Va hw.snd.latency
+Configure the buffering latency.
+Only affects applications that do not explicitly request
+blocksize / fragments.
+This tunable provides finer granularity than the
+.Va hw.snd.latency_profile
+tunable.
+Possible values range between 0 (lowest latency) and 10 (highest latency).
+.It Va hw.snd.latency_profile
+Define sets of buffering latency conversion tables for the
+.Va hw.snd.latency
+tunable.
+A value of 0 will use a low and aggressive latency profile which can result
+in possible underruns if the application cannot keep up with a rapid irq
+rate, especially during high workload.
+The default value is 1, which is considered a moderate/safe latency profile.
+.It Va hw.snd.maxautovchans
+Global
+.Tn VCHAN
+setting that only affects devices with at least one playback or recording channel available.
+The sound system will dynamically create up to this many
+.Tn VCHANs .
+Set to
+.Dq 0
+if no
+.Tn VCHANs
+are desired.
+Maximum value is 256.
+.It Va hw.snd.report_soft_formats
+Controls the internal format conversion if it is
+available transparently to the application software.
+When disabled or not available, the application will
+only be able to select formats the device natively supports.
+.It Va hw.snd.report_soft_matrix
+Enable seamless channel matrixing even if the hardware does not support it.
+Makes it possible to play multichannel streams even with a simple stereo
+sound card.
+.It Va hw.snd.verbose
+Level of verbosity for the
+.Pa /dev/sndstat
+device.
+Higher values include more output and the highest level,
+four, should be used when reporting problems.
+Other options include:
+.Bl -tag -width 2n
+.It 0
+Installed devices and their allocated bus resources.
+.It 1
+The number of playback, record, virtual channels, and
+flags per device.
+.It 2
+Channel information per device including the channel's
+current format, speed, and pseudo device statistics such as
+buffer overruns and buffer underruns.
+.It 3
+File names and versions of the currently loaded sound modules.
+.It 4
+Various messages intended for debugging.
+.El
+.It Va hw.snd.vpc_0db
+Default value for
+.Nm
+volume.
+Increase to give more room for attenuation control.
+Decrease for more amplification, with the possible cost of sound clipping.
+.It Va hw.snd.vpc_autoreset
+When a channel is closed the channel volume will be reset to 0db.
+This means that any changes to the volume will be lost.
+Enabling this will preserve the volume, at the cost of possible confusion
+when applications tries to re-open the same device.
+.It Va hw.snd.vpc_mixer_bypass
+The recommended way to use the
+.Tn VPC
+feature is to teach applications to use
+the correct
+.Fn ioctl :
+.Dv SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL,
+.Dv SNDCTL_DSP_SETRECVOL, SNDCTL_DSP_SETRECVOL.
+This is however not always possible.
+Enable this to allow applications to use their own existing mixer logic
+to control their own channel volume.
+.It Va hw.snd.vpc_reset
+Enable to restore all channel volumes back to the default value of 0db.
+.It Va dev.pcm.%d.bitperfect
+Enable or disable bitperfect mode.
+When enabled, channels will skip all dsp processing, such as channel
+matrixing, rate converting and equalizing.
+The pure
+.Nm
+stream will be fed directly to the hardware.
+If
+.Tn VCHANs
+are enabled, the bitperfect mode will use the
+.Tn VCHAN
+format/rate as the definitive format/rate target.
+The recommended way to use bitperfect mode is to disable
+.Tn VCHANs
+and enable this sysctl.
+Default is disabled.
+.It Va dev.pcm.%d.[play|rec].vchans
+The current number of
+.Tn VCHANs
+allocated per device.
+This can be set to preallocate a certain number of
+.Tn VCHANs .
+Setting this value to
+.Dq 0
+will disable
+.Tn VCHANs
+for this device.
+.It Va dev.pcm.%d.[play|rec].vchanformat
+Format for
+.Tn VCHAN
+mixing.
+All playback paths will be converted to this format before the mixing
+process begins.
+By default only 2 channels are enabled.
+Available options include:
+.Bl -tag -width 2n
+.It s16le:1.0
+Mono
+.It s16le:2.0
+Stereo, 2 channels (left, right).
+.It s16le:2.1
+3 channels (left, right, LFE).
+.It s16le:3.0
+3 channels (left, right, rear center).
+.It s16le:4.0
+Quadraphonic, 4 channels (front/rear left and right).
+.It s16le:4.1
+5 channels (4.0 + LFE).
+.It s16le:5.0
+5 channels (4.0 + center).
+.It s16le:5.1
+6 channels (4.0 + center + LFE).
+.It s16le:6.0
+6 channels (4.0 + front/rear center).
+.It s16le:6.1
+7 channels (6.0 + LFE).
+.It s16le:7.1
+8 channels (4.0 + center + LFE + left and right side).
+.El
+.It Va dev.pcm.%d.[play|rec].vchanmode
+.Tn VCHAN
+format/rate selection.
+Available options include:
+.Bl -tag -width 2n
+.It fixed
+Channel mixing is done using fixed format/rate.
+Advanced operations such as digital passthrough will not work.
+Can be considered as a
+.Dq legacy
+mode.
+This is the default mode for hardware channels which lack support for digital
+formats.
+.It passthrough
+Channel mixing is done using fixed format/rate, but advanced operations such
+as digital passthrough also work.
+All channels will produce sound as usual until a digital format playback is
+requested.
+When this happens all other channels will be muted and the latest incoming
+digital format will be allowed to pass through undisturbed.
+Multiple concurrent digital streams are supported, but the latest stream will
+take precedence and mute all other streams.
+.It adaptive
+Works like the
+.Dq passthrough
+mode, but is a bit smarter, especially for
+multiple
+.Nm
+channels with different format/rate.
+When a new channel is about to start, the entire list of virtual channels will
+be scanned, and the channel with the best format/rate (usually the
+highest/biggest) will be selected.
+This ensures that mixing quality depends on the best channel.
+The downside is that the hardware DMA mode needs to be restarted, which may
+cause annoying pops or clicks.
+.El
+.It Va dev.pcm.%d.[play|rec].vchanrate
+Sample rate speed for
+.Tn VCHAN
+mixing.
+All playback paths will be converted to this sample rate before the mixing
+process begins.
+.It Va dev.pcm.%d.polling
+Experimental polling mode support where the driver operates by querying the
+device state on each tick using a
+.Xr callout 9
+mechanism.
+Disabled by default and currently only available for a few device drivers.
+.El
+.Ss Recording Channels
+On devices that have more than one recording source (ie: mic and line),
+there is a corresponding
+.Pa /dev/dsp%d.r%d
+device.
+The
+.Xr mixer 8
+utility can be used to start and stop recording from an specific device.
+.Ss Statistics
+Channel statistics are only kept while the device is open.
+So with situations involving overruns and underruns, consider the output
+while the errant application is open and running.
+.Ss IOCTL Support
+The driver supports most of the
+.Tn OSS
+.Fn ioctl
+functions, and most applications work unmodified.
+A few differences exist, while memory mapped playback is
+supported natively and in
+.Tn Linux
+emulation, memory mapped recording is
+not due to
+.Tn VM
+system design.
+As a consequence, some applications may need to be recompiled
+with a slightly modified audio module.
+See
+.In sys/soundcard.h
+for a complete list of the supported
+.Fn ioctl
+functions.
+.Sh FILES
+The
+.Nm
+drivers may create the following
+device nodes:
+.Pp
+.Bl -tag -width ".Pa /dev/audio%d.%d" -compact
+.It Pa /dev/audio%d.%d
+Sparc-compatible audio device.
+.It Pa /dev/dsp%d.%d
+Digitized voice device.
+.It Pa /dev/dspW%d.%d
+Like
+.Pa /dev/dsp ,
+but 16 bits per sample.
+.It Pa /dev/dsp%d.p%d
+Playback channel.
+.It Pa /dev/dsp%d.r%d
+Record channel.
+.It Pa /dev/dsp%d.vp%d
+Virtual playback channel.
+.It Pa /dev/dsp%d.vr%d
+Virtual recording channel.
+.It Pa /dev/sndstat
+Current
+.Nm
+status, including all channels and drivers.
+.El
+.Pp
+The first number in the device node
+represents the unit number of the
+.Nm
+device.
+All
+.Nm
+devices are listed
+in
+.Pa /dev/sndstat .
+Additional messages are sometimes recorded when the
+device is probed and attached, these messages can be viewed with the
+.Xr dmesg 8
+utility.
+.Pp
+The above device nodes are only created on demand through the dynamic
+.Xr devfs 5
+clone handler.
+Users are strongly discouraged to access them directly.
+For specific sound card access, please instead use
+.Pa /dev/dsp
+or
+.Pa /dev/dsp%d .
+.Sh EXAMPLES
+Use the sound metadriver to load all
+.Nm
+bridge device drivers at once
+(for example if it is unclear which the correct driver to use is):
+.Pp
+.Dl kldload snd_driver
+.Pp
+Load a specific bridge device driver, in this case the Intel
+High Definition Audio driver:
+.Pp
+.Dl kldload snd_hda
+.Pp
+Check the status of all detected
+.Nm
+devices:
+.Pp
+.Dl cat /dev/sndstat
+.Pp
+Change the default sound device, in this case to the second device.
+This is handy if there are multiple
+.Nm
+devices available:
+.Pp
+.Dl sysctl hw.snd.default_unit=1
+.Sh DIAGNOSTICS
+.Bl -diag
+.It pcm%d:play:%d:dsp%d.p%d: play interrupt timeout, channel dead
+The hardware does not generate interrupts to serve incoming (play)
+or outgoing (record) data.
+.It unsupported subdevice XX
+A device node is not created properly.
+.El
+.Sh SEE ALSO
+.Xr snd_ad1816 4 ,
+.Xr snd_ai2s 4 ,
+.Xr snd_als4000 4 ,
+.Xr snd_atiixp 4 ,
+.Xr snd_audiocs 4 ,
+.Xr snd_cmi 4 ,
+.Xr snd_cs4281 4 ,
+.Xr snd_csa 4 ,
+.Xr snd_davbus 4 ,
+.Xr snd_ds1 4 ,
+.Xr snd_emu10k1 4 ,
+.Xr snd_emu10kx 4 ,
+.Xr snd_envy24 4 ,
+.Xr snd_envy24ht 4 ,
+.Xr snd_es137x 4 ,
+.Xr snd_ess 4 ,
+.Xr snd_fm801 4 ,
+.Xr snd_gusc 4 ,
+.Xr snd_hda 4 ,
+.Xr snd_hdspe 4 ,
+.Xr snd_ich 4 ,
+.Xr snd_maestro 4 ,
+.Xr snd_maestro3 4 ,
+.Xr snd_mss 4 ,
+.Xr snd_neomagic 4 ,
+.Xr snd_sbc 4 ,
+.Xr snd_solo 4 ,
+.Xr snd_spicds 4 ,
+.Xr snd_t4dwave 4 ,
+.Xr snd_uaudio 4 ,
+.Xr snd_via8233 4 ,
+.Xr snd_via82c686 4 ,
+.Xr snd_vibes 4 ,
+.Xr devfs 5 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr dmesg 8 ,
+.Xr kldload 8 ,
+.Xr mixer 8 ,
+.Xr sysctl 8
+.Rs
+.%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert Bristow-Johnson"
+.%U "http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt"
+.Re
+.Rs
+.%T "Julius O'Smith's Digital Audio Resampling"
+.%U "http://ccrma.stanford.edu/~jos/resample/"
+.Re
+.Rs
+.%T "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo"
+.%U "http://www.student.oulu.fi/~oniemita/dsp/deip.pdf"
+.Re
+.Rs
+.%T "The OSS API"
+.%U "http://www.opensound.com/pguide/oss.pdf"
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.2.6
+as
+.Nm pcm ,
+written by
+.An Luigi Rizzo .
+It was later
+rewritten in
+.Fx 4.0
+by
+.An Cameron Grant .
+The API evolved from the VOXWARE
+standard which later became OSS standard.
+.Sh AUTHORS
+.An -nosplit
+.An Luigi Rizzo Aq luigi@iet.unipi.it
+initially wrote the
+.Nm pcm
+device driver and this manual page.
+.An Cameron Grant Aq gandalf@vilnya.demon.co.uk
+later revised the device driver for
+.Fx 4.0 .
+.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
+revised this manual page.
+It was then rewritten for
+.Fx 5.2 .
+.Sh BUGS
+Some features of your sound card (e.g., global volume control) might not
+be supported on all devices.
diff --git a/share/man/man4/pcn.4 b/share/man/man4/pcn.4
new file mode 100644
index 000000000000..82720c925278
--- /dev/null
+++ b/share/man/man4/pcn.4
@@ -0,0 +1,191 @@
+.\" Copyright (c) Berkeley Software Design, Inc.
+.\" Copyright (c) 1997, 1998, 1999, 2000
+.\" Bill Paul <wpaul@osd.bsdi.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 31, 2006
+.Dt PCN 4
+.Os
+.Sh NAME
+.Nm pcn
+.Nd "AMD PCnet/PCI Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device pcn"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_pcn_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the AMD PCnet/FAST, PCnet/FAST+, PCnet/FAST III,
+PCnet/PRO and PCnet/Home Ethernet controller chips.
+Supported NIC's include the Allied Telesyn AT-2700 family.
+.Pp
+The PCnet/PCI chips include a 100Mbps Ethernet MAC and support
+both a serial and MII-compliant transceiver interface.
+They use a bus master DMA and a scatter/gather descriptor scheme.
+The AMD chips provide a mechanism for zero-copy receive,
+providing good performance in server environments.
+Receive address filtering is provided using a single perfect filter entry
+for the station address and a 64-bit multicast hash table.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width 10baseTXUTP
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Sq full-duplex
+or
+.Sq half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Sq full-duplex
+or
+.Sq half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width full-duplex
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports adapters and embedded controllers based on the AMD PCnet/FAST,
+PCnet/FAST+, PCnet/FAST III, PCnet/PRO and PCnet/Home Fast Ethernet chips:
+.Pp
+.Bl -bullet -compact
+.It
+AMD Am79C971 PCnet-FAST
+.It
+AMD Am79C972 PCnet-FAST+
+.It
+AMD Am79C973/Am79C975 PCnet-FAST III
+.It
+AMD Am79C976 PCnet-PRO
+.It
+AMD Am79C978 PCnet-Home
+.It
+Allied-Telesis LA-PCI
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "pcn%d: couldn't map ports/memory"
+A fatal initialization error has occurred.
+.It "pcn%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "pcn%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (e.g.\& a cable fault).
+.It "pcn%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "pcn%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "pcn%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform a
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Rs
+.%T AMD PCnet/FAST, PCnet/FAST+ and PCnet/Home datasheets
+.%U http://www.amd.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.3 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@osd.bsdi.com .
diff --git a/share/man/man4/pim.4 b/share/man/man4/pim.4
new file mode 100644
index 000000000000..7d334b27fd34
--- /dev/null
+++ b/share/man/man4/pim.4
@@ -0,0 +1,201 @@
+.\" Copyright (c) 2001-2003 International Computer Science Institute
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" The names and trademarks of copyright holders may not be used in
+.\" advertising or publicity pertaining to the software without specific
+.\" prior permission. Title to copyright in this software and any associated
+.\" documentation will at all times remain with the copyright holders.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 12, 2007
+.Dt PIM 4
+.Os
+.\"
+.Sh NAME
+.Nm pim
+.Nd Protocol Independent Multicast
+.\"
+.Sh SYNOPSIS
+.Cd "options MROUTING"
+.Pp
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/ip_mroute.h
+.In netinet/pim.h
+.Ft int
+.Fn getsockopt "int s" IPPROTO_IP MRT_PIM "void *optval" "socklen_t *optlen"
+.Ft int
+.Fn setsockopt "int s" IPPROTO_IP MRT_PIM "const void *optval" "socklen_t optlen"
+.Ft int
+.Fn getsockopt "int s" IPPROTO_IPV6 MRT6_PIM "void *optval" "socklen_t *optlen"
+.Ft int
+.Fn setsockopt "int s" IPPROTO_IPV6 MRT6_PIM "const void *optval" "socklen_t optlen"
+.Sh DESCRIPTION
+.Tn PIM
+is the common name for two multicast routing protocols:
+Protocol Independent Multicast - Sparse Mode (PIM-SM) and
+Protocol Independent Multicast - Dense Mode (PIM-DM).
+.Pp
+PIM-SM is a multicast routing protocol that can use the underlying
+unicast routing information base or a separate multicast-capable
+routing information base.
+It builds unidirectional shared trees rooted at a Rendezvous
+Point (RP) per group,
+and optionally creates shortest-path trees per source.
+.Pp
+PIM-DM is a multicast routing protocol that uses the underlying
+unicast routing information base to flood multicast datagrams
+to all multicast routers.
+Prune messages are used to prevent future datagrams from propagating
+to routers with no group membership information.
+.Pp
+Both PIM-SM and PIM-DM are fairly complex protocols,
+though PIM-SM is much more complex.
+To enable PIM-SM or PIM-DM multicast routing in a router,
+the user must enable multicast routing and PIM processing in the kernel
+(see
+.Sx SYNOPSIS
+about the kernel configuration options),
+and must run a PIM-SM or PIM-DM capable user-level process.
+From developer's point of view,
+the programming guide described in the
+.Sx "Programming Guide"
+section should be used to control the PIM processing in the kernel.
+.\"
+.Ss Programming Guide
+After a multicast routing socket is open and multicast forwarding
+is enabled in the kernel
+(see
+.Xr multicast 4 ) ,
+one of the following socket options should be used to enable or disable
+PIM processing in the kernel.
+Note that those options require certain privilege
+(i.e., root privilege):
+.Bd -literal
+/* IPv4 */
+int v = 1; /* 1 to enable, or 0 to disable */
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)&v, sizeof(v));
+.Ed
+.Bd -literal
+/* IPv6 */
+int v = 1; /* 1 to enable, or 0 to disable */
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)&v, sizeof(v));
+.Ed
+.Pp
+After PIM processing is enabled, the multicast-capable interfaces
+should be added
+(see
+.Xr multicast 4 ) .
+In case of PIM-SM, the PIM-Register virtual interface must be added
+as well.
+This can be accomplished by using the following options:
+.Bd -literal
+/* IPv4 */
+struct vifctl vc;
+memset(&vc, 0, sizeof(vc));
+/* Assign all vifctl fields as appropriate */
+\&...
+if (is_pim_register_vif)
+ vc.vifc_flags |= VIFF_REGISTER;
+setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)&vc,
+ sizeof(vc));
+.Ed
+.Bd -literal
+/* IPv6 */
+struct mif6ctl mc;
+memset(&mc, 0, sizeof(mc));
+/* Assign all mif6ctl fields as appropriate */
+\&...
+if (is_pim_register_vif)
+ mc.mif6c_flags |= MIFF_REGISTER;
+setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)&mc,
+ sizeof(mc));
+.Ed
+.Pp
+Sending or receiving of PIM packets can be accomplished by
+opening first a
+.Dq raw socket
+(see
+.Xr socket 2 ) ,
+with protocol value of
+.Dv IPPROTO_PIM :
+.Bd -literal
+/* IPv4 */
+int pim_s4;
+pim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM);
+.Ed
+.Bd -literal
+/* IPv6 */
+int pim_s6;
+pim_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM);
+.Ed
+.Pp
+Then, the following system calls can be used to send or receive PIM
+packets:
+.Xr sendto 2 ,
+.Xr sendmsg 2 ,
+.Xr recvfrom 2 ,
+.Xr recvmsg 2 .
+.\"
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr recvfrom 2 ,
+.Xr recvmsg 2 ,
+.Xr sendmsg 2 ,
+.Xr sendto 2 ,
+.Xr setsockopt 2 ,
+.Xr socket 2 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr multicast 4
+.\"
+.Sh STANDARDS
+.\" XXX the PIM-SM number must be updated after RFC 2362 is
+.\" replaced by a new RFC by the end of year 2003 or so.
+The PIM-SM protocol is specified in RFC 2362 (to be replaced by
+.%T draft-ietf-pim-sm-v2-new-* ) .
+The PIM-DM protocol is specified in
+.%T draft-ietf-pim-dm-new-v2-* ) .
+.\"
+.Sh AUTHORS
+.An -nosplit
+The original IPv4 PIM kernel support for IRIX and SunOS-4.x was
+implemented by
+.An Ahmed Helmy
+(USC and SGI).
+Later the code was ported to various
+.Bx
+flavors and modified by
+.An George Edmond Eddy
+(Rusty) (ISI),
+.An Hitoshi Asaeda
+(WIDE Project), and
+.An Pavlin Radoslavov
+(USC/ISI and ICSI).
+The IPv6 PIM kernel support was implemented by the KAME project
+.Pq Pa http://www.kame.net ,
+and was based on the IPv4 PIM kernel support.
+.Pp
+This manual page was written by
+.An Pavlin Radoslavov
+(ICSI).
diff --git a/share/man/man4/polling.4 b/share/man/man4/polling.4
new file mode 100644
index 000000000000..2c711cc7d8d6
--- /dev/null
+++ b/share/man/man4/polling.4
@@ -0,0 +1,221 @@
+.\" Copyright (c) 2002 Luigi Rizzo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 6, 2007
+.Dt POLLING 4
+.Os
+.Sh NAME
+.Nm polling
+.Nd device polling support
+.Sh SYNOPSIS
+.Cd "options DEVICE_POLLING"
+.Sh DESCRIPTION
+Device polling
+.Nm (
+for brevity) refers to a technique that
+lets the operating system periodically poll devices, instead of
+relying on the devices to generate interrupts when they need attention.
+This might seem inefficient and counterintuitive, but when done
+properly,
+.Nm
+gives more control to the operating system on
+when and how to handle devices, with a number of advantages in terms
+of system responsiveness and performance.
+.Pp
+In particular,
+.Nm
+reduces the overhead for context
+switches which is incurred when servicing interrupts, and
+gives more control on the scheduling of the CPU between various
+tasks (user processes, software interrupts, device handling)
+which ultimately reduces the chances of livelock in the system.
+.Ss Principles of Operation
+In the normal, interrupt-based mode, devices generate an interrupt
+whenever they need attention.
+This in turn causes a
+context switch and the execution of an interrupt handler
+which performs whatever processing is needed by the device.
+The duration of the interrupt handler is potentially unbounded
+unless the device driver has been programmed with real-time
+concerns in mind (which is generally not the case for
+.Fx
+drivers).
+Furthermore, under heavy traffic load, the system might be
+persistently processing interrupts without being able to
+complete other work, either in the kernel or in userland.
+.Pp
+Device polling disables interrupts by polling devices at appropriate
+times, i.e., on clock interrupts and within the idle loop.
+This way, the context switch overhead is removed.
+Furthermore,
+the operating system can control accurately how much work to spend
+in handling device events, and thus prevent livelock by reserving
+some amount of CPU to other tasks.
+.Pp
+Enabling
+.Nm
+also changes the way software network interrupts
+are scheduled, so there is never the risk of livelock because
+packets are not processed to completion.
+.Ss Enabling polling
+Currently only network interface drivers support the
+.Nm
+feature.
+It is turned on and off with help of
+.Xr ifconfig 8
+command.
+.Pp
+The historic
+.Va kern.polling.enable ,
+which enabled polling for all interfaces, can be replaced with the following
+code:
+.Bd -literal
+for i in `ifconfig -l` ;
+ do ifconfig $i polling; # use -polling to disable
+done
+.Ed
+.Ss MIB Variables
+The operation of
+.Nm
+is controlled by the following
+.Xr sysctl 8
+MIB variables:
+.Pp
+.Bl -tag -width indent -compact
+.It Va kern.polling.user_frac
+When
+.Nm
+is enabled, and provided that there is some work to do,
+up to this percent of the CPU cycles is reserved to userland tasks,
+the remaining fraction being available for
+.Nm
+processing.
+Default is 50.
+.Pp
+.It Va kern.polling.burst
+Maximum number of packets grabbed from each network interface in
+each timer tick.
+This number is dynamically adjusted by the kernel,
+according to the programmed
+.Va user_frac , burst_max ,
+CPU speed, and system load.
+.Pp
+.It Va kern.polling.each_burst
+The burst above is split into smaller chunks of this number of
+packets, going round-robin among all interfaces registered for
+.Nm .
+This prevents the case that a large burst from a single interface
+can saturate the IP interrupt queue
+.Pq Va net.inet.ip.intr_queue_maxlen .
+Default is 5.
+.Pp
+.It Va kern.polling.burst_max
+Upper bound for
+.Va kern.polling.burst .
+Note that when
+.Nm
+is enabled, each interface can receive at most
+.Pq Va HZ No * Va burst_max
+packets per second unless there are spare CPU cycles available for
+.Nm
+in the idle loop.
+This number should be tuned to match the expected load
+(which can be quite high with GigE cards).
+Default is 150 which is adequate for 100Mbit network and HZ=1000.
+.Pp
+.It Va kern.polling.idle_poll
+Controls if
+.Nm
+is enabled in the idle loop.
+There are no reasons (other than power saving or bugs in the scheduler's
+handling of idle priority kernel threads) to disable this.
+.Pp
+.It Va kern.polling.reg_frac
+Controls how often (every
+.Va reg_frac No / Va HZ
+seconds) the status registers of the device are checked for error
+conditions and the like.
+Increasing this value reduces the load on the bus, but also delays
+the error detection.
+Default is 20.
+.Pp
+.It Va kern.polling.handlers
+How many active devices have registered for
+.Nm .
+.Pp
+.It Va kern.polling.short_ticks
+.It Va kern.polling.lost_polls
+.It Va kern.polling.pending_polls
+.It Va kern.polling.residual_burst
+.It Va kern.polling.phase
+.It Va kern.polling.suspect
+.It Va kern.polling.stalled
+Debugging variables.
+.El
+.Sh SUPPORTED DEVICES
+Device polling requires explicit modifications to the device drivers.
+As of this writing, the
+.Xr bge 4 ,
+.Xr dc 4 ,
+.Xr em 4 ,
+.Xr fwe 4 ,
+.Xr fwip 4 ,
+.Xr fxp 4 ,
+.Xr ixgb 4 ,
+.Xr nfe 4 ,
+.Xr nge 4 ,
+.Xr re 4 ,
+.Xr rl 4 ,
+.Xr sf 4 ,
+.Xr sis 4 ,
+.Xr ste 4 ,
+.Xr stge 4 ,
+.Xr vge 4 ,
+.Xr vr 4 ,
+and
+.Xr xl 4
+devices are supported, with others in the works.
+The modifications are rather straightforward, consisting in
+the extraction of the inner part of the interrupt service routine
+and writing a callback function,
+.Fn *_poll ,
+which is invoked
+to probe the device for events and process them.
+(See the
+conditionally compiled sections of the devices mentioned above
+for more details.)
+.Pp
+As in the worst case the devices are only polled on clock interrupts,
+in order to reduce the latency in processing packets, it is not advisable
+to decrease the frequency of the clock below 1000 Hz.
+.Sh HISTORY
+Device polling first appeared in
+.Fx 4.6
+and
+.Fx 5.0 .
+.Sh AUTHORS
+Device polling was written by
+.An Luigi Rizzo Aq luigi@iet.unipi.it .
diff --git a/share/man/man4/ppbus.4 b/share/man/man4/ppbus.4
new file mode 100644
index 000000000000..327b7c949319
--- /dev/null
+++ b/share/man/man4/ppbus.4
@@ -0,0 +1,363 @@
+.\" Copyright (c) 1998, 1999 Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 1998
+.Dt PPBUS 4
+.Os
+.Sh NAME
+.Nm ppbus
+.Nd Parallel Port Bus system
+.Sh SYNOPSIS
+.Cd "device ppbus"
+.Pp
+.Cd "device vpo"
+.Pp
+.Cd "device lpt"
+.Cd "device plip"
+.Cd "device ppi"
+.Cd "device pps"
+.Cd "device lpbb"
+.Sh DESCRIPTION
+The
+.Em ppbus
+system provides a uniform, modular and architecture-independent
+system for the implementation of drivers to control various parallel devices,
+and to utilize different parallel port chipsets.
+.Sh DEVICE DRIVERS
+In order to write new drivers or port existing drivers, the ppbus system
+provides the following facilities:
+.Bl -bullet -offset indent
+.It
+architecture-independent macros or functions to access parallel ports
+.It
+mechanism to allow various devices to share the same parallel port
+.It
+a user interface named
+.Xr ppi 4
+that allows parallel port access from outside the kernel without conflicting
+with kernel-in drivers.
+.El
+.Ss Developing new drivers
+The ppbus system has been designed to support the development of standard
+and non-standard software:
+.Pp
+.Bl -column "Driver" -compact
+.It Em Driver Ta Em Description
+.It Sy vpo Ta "VPI0 parallel to Adaptec AIC-7110 SCSI controller driver" .
+It uses standard and non-standard parallel port accesses.
+.It Sy ppi Ta "Parallel port interface for general I/O"
+.It Sy pps Ta "Pulse per second Timing Interface"
+.It Sy lpbb Ta "Philips official parallel port I2C bit-banging interface"
+.El
+.Ss Porting existing drivers
+Another approach to the ppbus system is to port existing drivers.
+Various drivers have already been ported:
+.Pp
+.Bl -column "Driver" -compact
+.It Em Driver Ta Em Description
+.It Sy lpt Ta "lpt printer driver"
+.It Sy plip Ta "lp parallel network interface driver"
+.El
+.Pp
+ppbus should let you port any other software even from other operating systems
+that provide similar services.
+.Sh PARALLEL PORT CHIPSETS
+Parallel port chipset support is provided by
+.Xr ppc 4 .
+.Pp
+The ppbus system provides functions and macros to allocate a new
+parallel port bus, then initialize it and upper peripheral device drivers.
+.Pp
+ppc makes chipset detection and initialization and then calls ppbus attach
+functions to initialize the ppbus system.
+.Sh PARALLEL PORT MODEL
+The logical parallel port model chosen for the ppbus system is the PC's
+parallel port model.
+Consequently, for the i386 implementation of ppbus,
+most of the services provided by ppc are macros for inb()
+and outb() calls.
+But, for an other architecture, accesses to one of our logical
+registers (data, status, control...) may require more than one I/O access.
+.Ss Description
+The parallel port may operate in the following modes:
+.Bl -bullet -offset indent
+.It
+compatible mode, also called Centronics mode
+.It
+bidirectional 8/4-bits mode, also called NIBBLE mode
+.It
+byte mode, also called PS/2 mode
+.It
+Extended Capability Port mode, ECP
+.It
+Enhanced Parallel Port mode, EPP
+.It
+mixed ECP+EPP or ECP+PS/2 modes
+.El
+.Ss Compatible mode
+This mode defines the protocol used by most PCs to transfer data to a printer.
+In this mode, data is placed on the port's data lines, the printer status is
+checked for no errors and that it is not busy, and then a data Strobe is
+generated by the software to clock the data to the printer.
+.Pp
+Many I/O controllers have implemented a mode that uses a FIFO buffer to
+transfer data with the Compatibility mode protocol.
+This mode is referred to as
+"Fast Centronics" or "Parallel Port FIFO mode".
+.Ss Bidirectional mode
+The NIBBLE mode is the most common way to get reverse channel data from a
+printer or peripheral.
+Combined with the standard host to printer mode, it
+provides a complete bidirectional channel.
+.Pp
+In this mode, outputs are 8-bits long.
+Inputs are accomplished by reading
+4 of the 8 bits of the status register.
+.Ss Byte mode
+In this mode, the data register is used either for outputs and inputs.
+Then,
+any transfer is 8-bits long.
+.Ss Extended Capability Port mode
+The ECP protocol was proposed as an advanced mode for communication with
+printer and scanner type peripherals.
+Like the EPP protocol, ECP mode provides
+for a high performance bidirectional communication path between the host
+adapter and the peripheral.
+.Pp
+ECP protocol features include:
+.Bl -item -offset indent
+.It
+Run_Length_Encoding (RLE) data compression for host adapters
+.It
+FIFOs for both the forward and reverse channels
+.It
+DMA as well as programmed I/O for the host register interface.
+.El
+.Ss Enhanced Parallel Port mode
+The EPP protocol was originally developed as a means to provide a high
+performance parallel port link that would still be compatible with the
+standard parallel port.
+.Pp
+The EPP mode has two types of cycle: address and data.
+What makes the
+difference at hardware level is the strobe of the byte placed on the data
+lines.
+Data are strobed with nAutofeed, addresses are strobed with
+nSelectin signals.
+.Pp
+A particularity of the ISA implementation of the EPP protocol is that an
+EPP cycle fits in an ISA cycle.
+In this fashion, parallel port peripherals can
+operate at close to the same performance levels as an equivalent ISA plug-in
+card.
+.Pp
+At software level, you may implement the protocol you wish, using data and
+address cycles as you want.
+This is for the IEEE1284 compatible part.
+Then,
+peripheral vendors may implement protocol handshake with the following
+status lines: PError, nFault and Select.
+Try to know how these lines toggle
+with your peripheral, allowing the peripheral to request more data, stop the
+transfer and so on.
+.Pp
+At any time, the peripheral may interrupt the host with the nAck signal without
+disturbing the current transfer.
+.Ss Mixed modes
+Some manufacturers, like SMC, have implemented chipsets that support mixed
+modes.
+With such chipsets, mode switching is available at any time by
+accessing the extended control register.
+.Sh IEEE1284-1994 Standard
+.Ss Background
+This standard is also named "IEEE Standard Signaling Method for a
+Bidirectional Parallel Peripheral Interface for Personal Computers".
+It
+defines a signaling method for asynchronous, fully interlocked, bidirectional
+parallel communications between hosts and printers or other peripherals.
+It
+also specifies a format for a peripheral identification string and a method of
+returning this string to the host outside of the bidirectional data stream.
+.Pp
+This standard is architecture independent and only specifies dialog handshake
+at signal level.
+One should refer to architecture specific documentation in
+order to manipulate machine dependent registers, mapped memory or other
+methods to control these signals.
+.Pp
+The IEEE1284 protocol is fully oriented with all supported parallel port
+modes.
+The computer acts as master and the peripheral as slave.
+.Pp
+Any transfer is defined as a finite state automaton.
+It allows software to
+properly manage the fully interlocked scheme of the signaling method.
+The compatible mode is supported "as is" without any negotiation because it
+is compatible.
+Any other mode must be firstly negotiated by the host to check
+it is supported by the peripheral, then to enter one of the forward idle
+states.
+.Pp
+At any time, the slave may want to send data to the host.
+This is only
+possible from forward idle states (nibble, byte, ecp...).
+So, the
+host must have previously negotiated to permit the peripheral to
+request transfer.
+Interrupt lines may be dedicated to the requesting signals
+to prevent time consuming polling methods.
+.Pp
+But peripheral requests are only a hint to the master host.
+If the host
+accepts the transfer, it must firstly negotiate the reverse mode and then
+starts the transfer.
+At any time during reverse transfer, the host may
+terminate the transfer or the slave may drive wires to signal that no more
+data is available.
+.Ss Implementation
+IEEE1284 Standard support has been implemented at the top of the ppbus system
+as a set of procedures that perform high level functions like negotiation,
+termination, transfer in any mode without bothering you with low level
+characteristics of the standard.
+.Pp
+IEEE1284 interacts with the ppbus system as little as possible.
+That means
+you still have to request the ppbus when you want to access it, the negotiate
+function does not do it for you.
+And of course, release it later.
+.Sh ARCHITECTURE
+.Ss adapter, ppbus and device layers
+First, there is the
+.Em adapter
+layer, the lowest of the ppbus system.
+It provides
+chipset abstraction throw a set of low level functions that maps the logical
+model to the underlying hardware.
+.Pp
+Secondly, there is the
+.Em ppbus
+layer that provides functions to:
+.Bl -enum -offset indent
+.It
+share the parallel port bus among the daisy-chain like connected devices
+.It
+manage devices linked to ppbus
+.It
+propose an arch-independent interface to access the hardware layer.
+.El
+.Pp
+Finally, the
+.Em device
+layer gathers the parallel peripheral device drivers.
+.Ss Parallel modes management
+We have to differentiate operating modes at various ppbus system layers.
+Actually, ppbus and adapter operating modes on one hands and for each
+one, current and available modes are separated.
+.Pp
+With this level of abstraction a particular chipset may commute from any
+native mode to any other mode emulated with extended modes without
+disturbing upper layers.
+For example, most chipsets support NIBBLE mode as
+native and emulated with ECP and/or EPP.
+.Pp
+This architecture should support IEEE1284-1994 modes.
+.Sh FEATURES
+.Ss The boot process
+The boot process starts with the probe stage of the
+.Xr ppc 4
+driver during ISA bus (PC architecture) initialization.
+During attachment of
+the ppc driver, a new ppbus structure is allocated, then probe and attachment
+for this new bus node are called.
+.Pp
+ppbus attachment tries to detect any PnP parallel peripheral (according to
+.%T "Plug and Play Parallel Port Devices"
+draft from (c)1993-4 Microsoft Corporation)
+then probes and attaches known device drivers.
+.Pp
+During probe, device drivers are supposed to request the ppbus and try to
+set their operating mode.
+This mode will be saved in the context structure and
+returned each time the driver requests the ppbus.
+.Ss Bus allocation and interrupts
+ppbus allocation is mandatory not to corrupt I/O of other devices.
+Another
+usage of ppbus allocation is to reserve the port and receive incoming
+interrupts.
+.Pp
+High level interrupt handlers are connected to the ppbus system thanks to the
+newbus
+.Fn BUS_SETUP_INTR
+and
+.Fn BUS_TEARDOWN_INTR
+functions.
+But, in order to attach a handler, drivers must
+own the bus.
+Consequently, a ppbus request is mandatory in order to call the above
+functions (see existing drivers for more info).
+Note that the interrupt handler
+is automatically released when the ppbus is released.
+.Ss Microsequences
+.Em Microsequences
+is a general purpose mechanism to allow fast low-level
+manipulation of the parallel port.
+Microsequences may be used to do either
+standard (in IEEE1284 modes) or non-standard transfers.
+The philosophy of
+microsequences is to avoid the overhead of the ppbus layer and do most of
+the job at adapter level.
+.Pp
+A microsequence is an array of opcodes and parameters.
+Each opcode codes an
+operation (opcodes are described in
+.Xr microseq 9 ) .
+Standard I/O operations are implemented at ppbus level whereas basic I/O
+operations and microseq language are coded at adapter level for efficiency.
+.Pp
+As an example, the
+.Xr vpo 4
+driver uses microsequences to implement:
+.Bl -bullet -offset indent
+.It
+a modified version of the NIBBLE transfer mode
+.It
+various I/O sequences to initialize, select and allocate the peripheral
+.El
+.Sh SEE ALSO
+.Xr lpt 4 ,
+.Xr plip 4 ,
+.Xr ppc 4 ,
+.Xr ppi 4 ,
+.Xr vpo 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/ppc.4 b/share/man/man4/ppc.4
new file mode 100644
index 000000000000..9b96625cb6ec
--- /dev/null
+++ b/share/man/man4/ppc.4
@@ -0,0 +1,136 @@
+.\" Copyright (c) 1998, 1999, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 5, 1998
+.Dt PPC 4
+.Os
+.Sh NAME
+.Nm ppc
+.Nd Parallel Port Chipset driver
+.Sh SYNOPSIS
+.Cd "device ppc"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.ppc.0.at="isa"
+.Cd hint.ppc.0.irq="7"
+.Pp
+For one or more PPBUS busses:
+.Cd "device ppbus"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides low level support to various parallel port chipsets for the
+.Xr ppbus 4
+system.
+.Pp
+During the probe phase,
+.Nm
+detects parallel port chipsets and initializes
+private data according to their operating mode: COMPATIBLE,
+NIBBLE, PS/2, EPP, ECP and other mixed modes.
+If a mode is provided at startup through the
+.Va flags
+variable of the boot
+interface, the operating mode of the chipset is forced according to
+.Va flags
+and the hardware supported modes.
+.Pp
+During the attach phase,
+.Nm
+allocates a ppbus structure, initializes it and calls the ppbus
+attach function.
+.Ss Supported flags
+.Bl -item -offset indent
+.It
+bits 0-3: chipset forced mode(s)
+.Bd -literal
+PPB_COMPATIBLE 0x0 /* Centronics compatible mode */
+PPB_NIBBLE 0x1 /* reverse 4 bit mode */
+PPB_PS2 0x2 /* PS/2 byte mode */
+PPB_EPP 0x4 /* EPP mode, 32 bit */
+PPB_ECP 0x8 /* ECP mode */
+.Ed
+.Pp
+And any mixed values.
+.It
+bit 4: EPP protocol (0 EPP 1.9, 1 EPP 1.7)
+.It
+bit 5: activate IRQ (1 IRQ disabled, 0 IRQ enabled)
+.It
+bit 6: disable chipset specific detection
+.It
+bit 7: disable FIFO detection
+.El
+.Ss Supported chipsets
+Some parallel port chipsets are explicitly supported:
+detection and initialisation code has been written according to
+their datasheets.
+.Bl -bullet -offset indent
+.It
+SMC FDC37C665GT and FDC37C666GT chipsets
+.It
+Natsemi PC873xx-family (PC87332 and PC87306)
+.It
+Winbond W83877xx-family (W83877F and W83877AF)
+.It
+SMC-like chipsets with mixed modes (see
+.Xr ppbus 4 )
+.El
+.Ss Adding support to a new chipset
+You may want to add support for the newest chipset your motherboard was
+sold with.
+For the ISA bus, just retrieve the specs of the chipset and write the
+corresponding
+.Fn ppc_mychipset_detect ""
+function.
+Then add an entry to the general purpose
+.Fn ppc_detect ""
+function.
+.Pp
+Your
+.Fn ppc_mychipset_detect ""
+function should ensure that if the mode field of the
+.Va flags
+boot variable is not null, then the operating
+mode is forced to the given mode and no other mode is available and
+ppb->ppb_avm field contains the available modes of the chipset.
+.Sh SEE ALSO
+.Xr ppbus 4 ,
+.Xr ppi 4 ,
+.Xr device.hints 5
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Nicolas Souchu .
+.Sh BUGS
+The chipset detection process may corrupt your chipset configuration.
+You may
+disable chipset specific detection by using the above flags.
diff --git a/share/man/man4/ppi.4 b/share/man/man4/ppi.4
new file mode 100644
index 000000000000..a4084ad63648
--- /dev/null
+++ b/share/man/man4/ppi.4
@@ -0,0 +1,107 @@
+.\" Copyright (c) 1997
+.\" Michael Smith
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 2, 1998
+.Dt PPI 4
+.Os
+.Sh NAME
+.Nm ppi
+.Nd "user-space interface to ppbus parallel 'geek' port"
+.Sh SYNOPSIS
+.Cd "device ppi"
+.Pp
+Minor numbering: unit numbers correspond directly to ppbus numbers.
+.Pp
+.In dev/ppbus/ppi.h
+.In dev/ppbus/ppbconf.h
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a convenient means for user applications to manipulate the
+state of the parallel port, enabling easy low-speed I/O operations without
+the security problems inherent with the use of the
+.Pa /dev/io
+interface.
+.Sh PROGRAMMING INTERFACE
+All I/O on the
+.Nm
+interface is performed using
+.Fn ioctl
+calls.
+Each command takes a single
+.Ft uint8_t
+argument, transferring one byte of data.
+The following commands are available:
+.Bl -tag -width indent
+.It Dv PPIGDATA , PPISDATA
+Get and set the contents of the data register.
+.It Dv PPIGSTATUS , PPISSTATUS
+Get and set the contents of the status register.
+.It Dv PPIGCTRL , PPISCTRL
+Get and set the contents of the control register.
+The following defines correspond to bits in this register.
+Setting a bit in the control register drives the corresponding output low.
+.Bl -tag -width indent -compact
+.It Dv STROBE
+.It Dv AUTOFEED
+.It Dv nINIT
+.It Dv SELECTIN
+.It Dv PCD
+.El
+.It Dv PPIGEPP , PPISEPP
+Get and set the contents of the EPP control register.
+.It Dv PPIGECR , PPISECR
+Get and set the contents of the ECP control register.
+.It Dv PPIGFIFO , PPISFIFO
+Read and write the ECP FIFO (8-bit operations only).
+.El
+.Sh EXAMPLES
+To present the value 0x5a to the data port, drive STROBE low and then high
+again, the following code fragment can be used:
+.Bd -literal -compact
+
+ int fd;
+ uint8_t val;
+
+ val = 0x5a;
+ ioctl(fd, PPISDATA, &val);
+ ioctl(fd, PPIGCTRL, &val);
+ val |= STROBE;
+ ioctl(fd, PPISCTRL, &val);
+ val &= ~STROBE;
+ ioctl(fd, PPISCTRL, &val);
+
+.Ed
+.Sh BUGS
+The inverse sense of signals is confusing.
+.Pp
+The
+.Fn ioctl
+interface is slow, and there is no way (yet) to chain multiple operations together.
+.Pp
+The headers required for user applications are not installed as part of the
+standard system.
diff --git a/share/man/man4/psm.4 b/share/man/man4/psm.4
new file mode 100644
index 000000000000..caf01357cbbc
--- /dev/null
+++ b/share/man/man4/psm.4
@@ -0,0 +1,865 @@
+.\"
+.\" Copyright (c) 1997
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 27, 2012
+.Dt PSM 4
+.Os
+.Sh NAME
+.Nm psm
+.Nd PS/2 mouse style pointing device driver
+.Sh SYNOPSIS
+.Cd "options KBD_RESETDELAY=N"
+.Cd "options KBD_MAXWAIT=N"
+.Cd "options PSM_DEBUG=N"
+.Cd "options KBDIO_DEBUG=N"
+.Cd "device psm"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.psm.0.at="atkbdc"
+.Cd hint.psm.0.irq="12"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the PS/2 mouse style pointing device.
+Currently there can be only one
+.Nm
+device node in the system.
+As the PS/2 mouse port is located
+at the auxiliary port of the keyboard controller,
+the keyboard controller driver,
+.Nm atkbdc ,
+must also be configured in the kernel.
+Note that there is currently no provision of changing the
+.Em irq
+number.
+.Pp
+Basic PS/2 style pointing device has two or three buttons.
+Some devices may have a roller or a wheel and/or additional buttons.
+.Ss Device Resolution
+The PS/2 style pointing device usually has several grades of resolution,
+that is, sensitivity of movement.
+They are typically 25, 50, 100 and 200
+pulse per inch.
+Some devices may have finer resolution.
+The current resolution can be changed at runtime.
+The
+.Nm
+driver allows the user to initially set the resolution
+via the driver flag
+(see
+.Sx "DRIVER CONFIGURATION" )
+or change it later via the
+.Xr ioctl 2
+command
+.Dv MOUSE_SETMODE
+(see
+.Sx IOCTLS ) .
+.Ss Report Rate
+Frequency, or report rate, at which the device sends movement
+and button state reports to the host system is also configurable.
+The PS/2 style pointing device typically supports 10, 20, 40, 60, 80, 100
+and 200 reports per second.
+60 or 100 appears to be the default value for many devices.
+Note that when there is no movement and no button has changed its state,
+the device will not send anything to the host system.
+The report rate can be changed via an ioctl call.
+.Ss Operation Levels
+The
+.Nm
+driver has three levels of operation.
+The current operation level can be set via an ioctl call.
+.Pp
+At the level zero the basic support is provided; the device driver will report
+horizontal and vertical movement of the attached device
+and state of up to three buttons.
+The movement and status are encoded in a series of fixed-length data packets
+(see
+.Sx "Data Packet Format" ) .
+This is the default level of operation and the driver is initially
+at this level when opened by the user program.
+.Pp
+The operation level one, the `extended' level, supports a roller (or wheel),
+if any, and up to 11 buttons.
+The movement of the roller is reported as movement along the Z axis.
+8 byte data packets are sent to the user program at this level.
+.Pp
+At the operation level two, data from the pointing device is passed to the
+user program as is. Conversely, command from the user program is passed
+to the pointing device as is and the user program is responsible for
+status validation and error recovery.
+Modern PS/2 type pointing devices often use proprietary data format.
+Therefore, the user program is expected to have
+intimate knowledge about the format from a particular device when operating
+the driver at this level.
+This level is called `native' level.
+.Ss Data Packet Format
+Data packets read from the
+.Nm
+driver are formatted differently at each operation level.
+.Pp
+A data packet from the PS/2 mouse style pointing device
+is three bytes long at the operation level zero:
+.Pp
+.Bl -tag -width Byte_1 -compact
+.It Byte 1
+.Bl -tag -width bit_7 -compact
+.It bit 7
+One indicates overflow in the vertical movement count.
+.It bit 6
+One indicates overflow in the horizontal movement count.
+.It bit 5
+Set if the vertical movement count is negative.
+.It bit 4
+Set if the horizontal movement count is negative.
+.It bit 3
+Always one.
+.\" The ALPS GlidePoint clears this bit when the user `taps' the surface of
+.\" the pad, otherwise the bit is set.
+.\" Most, if not all, other devices always set this bit.
+.It bit 2
+Middle button status; set if pressed.
+For devices without the middle
+button, this bit is always zero.
+.It bit 1
+Right button status; set if pressed.
+.It bit 0
+Left button status; set if pressed.
+.El
+.It Byte 2
+Horizontal movement count in two's complement;
+-256 through 255.
+Note that the sign bit is in the first byte.
+.It Byte 3
+Vertical movement count in two's complement;
+-256 through 255.
+Note that the sign bit is in the first byte.
+.El
+.Pp
+At the level one, a data packet is encoded
+in the standard format
+.Dv MOUSE_PROTO_SYSMOUSE
+as defined in
+.Xr mouse 4 .
+.Pp
+At the level two, native level, there is no standard on the size and format
+of the data packet.
+.Ss Acceleration
+The
+.Nm
+driver can somewhat `accelerate' the movement of the pointing device.
+The faster you move the device, the further the pointer
+travels on the screen.
+The driver has an internal variable which governs the effect of
+the acceleration.
+Its value can be modified via the driver flag
+or via an ioctl call.
+.Sh DRIVER CONFIGURATION
+.Ss Kernel Configuration Options
+There are following kernel configuration options to control the
+.Nm
+driver.
+They may be set in the kernel configuration file
+(see
+.Xr config 8 ) .
+.Bl -tag -width MOUSE
+.It Em KBD_RESETDELAY=X , KBD_MAXWAIT=Y
+The
+.Nm
+driver will attempt to reset the pointing device during the boot process.
+It sometimes takes a long while before the device will respond after
+reset.
+These options control how long the driver should wait before
+it eventually gives up waiting.
+The driver will wait
+.Fa X
+*
+.Fa Y
+msecs at most.
+If the driver seems unable to detect your pointing
+device, you may want to increase these values.
+The default values are
+200 msec for
+.Fa X
+and 5
+for
+.Fa Y .
+.It Em PSM_DEBUG=N , KBDIO_DEBUG=N
+Sets the debug level to
+.Fa N .
+The default debug level is zero.
+See
+.Sx DIAGNOSTICS
+for debug logging.
+.El
+.Ss Driver Flags
+The
+.Nm
+driver accepts the following driver flags.
+Set them in
+.Pa /boot/device.hints
+(see
+.Sx EXAMPLES
+below).
+.Bl -tag -width MOUSE
+.It bit 0..3 RESOLUTION
+This flag specifies the resolution of the pointing device.
+It must be zero through four.
+The greater the value
+is, the finer resolution the device will select.
+Actual resolution selected by this field varies according to the model
+of the device.
+Typical resolutions are:
+.Pp
+.Bl -tag -width 0_(medium_high)__ -compact
+.It Em 1 (low)
+25 pulse per inch (ppi)
+.It Em 2 (medium low)
+50 ppi
+.It Em 3 (medium high)
+100 ppi
+.It Em 4 (high)
+200 ppi
+.El
+.Pp
+Leaving this flag zero will selects the default resolution for the
+device (whatever it is).
+.It bit 4..7 ACCELERATION
+This flag controls the amount of acceleration effect.
+The smaller the value of this flag is, more sensitive the movement becomes.
+The minimum value allowed, thus the value for the most sensitive setting,
+is one.
+Setting this flag to zero will completely disables the
+acceleration effect.
+.It bit 8 NOCHECKSYNC
+The
+.Nm
+driver tries to detect the first byte of the data packet by checking
+the bit pattern of that byte.
+Although this method should work with most
+PS/2 pointing devices, it may interfere with some devices which are not
+so compatible with known devices.
+If you think your pointing device is not functioning as expected,
+and the kernel frequently prints the following message to the console,
+.Bd -literal -offset indent
+psmintr: out of sync (xxxx != yyyy).
+.Ed
+.Pp
+set this flag to disable synchronization check and see if it helps.
+.It bit 9 NOIDPROBE
+The
+.Nm
+driver will not try to identify the model of the pointing device and
+will not carry out model-specific initialization.
+The device should always act like a standard PS/2 mouse without such
+initialization.
+Extra features, such as wheels and additional buttons, will not be
+recognized by the
+.Nm
+driver.
+.It bit 10 NORESET
+When this flag is set, the
+.Nm
+driver will not reset the pointing device when initializing the device.
+If the
+.Fx
+kernel
+is started after another OS has run, the pointing device will inherit
+settings from the previous OS.
+However, because there is no way for the
+.Nm
+driver to know the settings, the device and the driver may not
+work correctly.
+The flag should never be necessary under normal circumstances.
+.It bit 11 FORCETAP
+Some pad devices report as if the fourth button is pressed
+when the user `taps' the surface of the device (see
+.Sx CAVEATS ) .
+This flag will make the
+.Nm
+driver assume that the device behaves this way.
+Without the flag, the driver will assume this behavior
+for ALPS GlidePoint models only.
+.It bit 12 IGNOREPORTERROR
+This flag makes
+.Nm
+driver ignore certain error conditions when probing the PS/2 mouse port.
+It should never be necessary under normal circumstances.
+.It bit 13 HOOKRESUME
+The built-in PS/2 pointing device of some laptop computers is somehow
+not operable immediately after the system `resumes' from
+the power saving mode,
+though it will eventually become available.
+There are reports that
+stimulating the device by performing I/O will help
+waking up the device quickly.
+This flag will enable a piece of code in the
+.Nm
+driver to hook
+the `resume' event and exercise some harmless I/O operations on the
+device.
+.It bit 14 INITAFTERSUSPEND
+This flag adds more drastic action for the above problem.
+It will cause the
+.Nm
+driver to reset and re-initialize the pointing device
+after the `resume' event.
+.El
+.Sh LOADER TUNABLES
+Extended support for Synaptics touchpads can be enabled by setting
+.Va hw.psm.synaptics_support
+to
+.Em 1
+at boot-time.
+This will enable
+.Nm
+to handle packets from guest devices (sticks) and extra buttons.
+.Pp
+Tap and drag gestures can be disabled by setting
+.Va hw.psm.tap_enabled
+to
+.Em 0
+at boot-time.
+Currently, this is only supported on Synaptics touchpads with Extended
+support disabled. The behaviour may be changed after boot by setting
+the sysctl with the same name and by restarting
+.Xr moused 8
+using
+.Pa /etc/rc.d/moused .
+.Sh IOCTLS
+There are a few
+.Xr ioctl 2
+commands for mouse drivers.
+These commands and related structures and constants are defined in
+.In sys/mouse.h .
+General description of the commands is given in
+.Xr mouse 4 .
+This section explains the features specific to the
+.Nm
+driver.
+.Pp
+.Bl -tag -width MOUSE -compact
+.It Dv MOUSE_GETLEVEL Ar int *level
+.It Dv MOUSE_SETLEVEL Ar int *level
+These commands manipulate the operation level of the
+.Nm
+driver.
+.Pp
+.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
+Returns the hardware information of the attached device in the following
+structure.
+.Bd -literal
+typedef struct mousehw {
+ int buttons; /* number of buttons */
+ int iftype; /* I/F type */
+ int type; /* mouse/track ball/pad... */
+ int model; /* I/F dependent model ID */
+ int hwid; /* I/F dependent hardware ID */
+} mousehw_t;
+.Ed
+.Pp
+The
+.Dv buttons
+field holds the number of buttons on the device.
+The
+.Nm
+driver currently can detect the 3 button mouse from Logitech and report
+accordingly.
+The 3 button mouse from the other manufacturer may or may not be
+reported correctly.
+However, it will not affect the operation of
+the driver.
+.Pp
+The
+.Dv iftype
+is always
+.Dv MOUSE_IF_PS2 .
+.Pp
+The
+.Dv type
+tells the device type:
+.Dv MOUSE_MOUSE ,
+.Dv MOUSE_TRACKBALL ,
+.Dv MOUSE_STICK ,
+.Dv MOUSE_PAD ,
+or
+.Dv MOUSE_UNKNOWN .
+The user should not heavily rely on this field, as the
+driver may not always, in fact it is very rarely able to, identify
+the device type.
+.Pp
+The
+.Dv model
+is always
+.Dv MOUSE_MODEL_GENERIC
+at the operation level 0.
+It may be
+.Dv MOUSE_MODEL_GENERIC
+or one of
+.Dv MOUSE_MODEL_XXX
+constants at higher operation levels.
+Again the
+.Nm
+driver may or may not set an appropriate value in this field.
+.Pp
+The
+.Dv hwid
+is the ID value returned by the device.
+Known IDs include:
+.Pp
+.Bl -tag -width 0__ -compact
+.It Em 0
+Mouse (Microsoft, Logitech and many other manufacturers)
+.It Em 2
+Microsoft Ballpoint mouse
+.It Em 3
+Microsoft IntelliMouse
+.El
+.Pp
+.It Dv MOUSE_SYN_GETHWINFO Ar synapticshw_t *synhw
+Retrieves extra information associated with Synaptics Touchpad.
+Only available when a supported device has been detected.
+.Bd -literal
+typedef struct synapticshw {
+ int infoMajor; /* major hardware revision */
+ int infoMinor; /* minor hardware revision */
+ int infoRot180; /* touchpad is rotated */
+ int infoPortrait; /* touchpad is a portrait */
+ int infoSensor; /* sensor model */
+ int infoHardware; /* hardware model */
+ int infoNewAbs; /* supports the newabs format */
+ int capPen; /* can detect a pen */
+ int infoSimpleC; /* supports simple commands */
+ int infoGeometry; /* touchpad dimensions */
+ int capExtended; /* supports extended packets */
+ int capSleep; /* can be suspended/resumed */
+ int capFourButtons; /* has four buttons */
+ int capMultiFinger; /* can detect multiple fingers */
+ int capPalmDetect; /* can detect a palm */
+ int capPassthrough; /* can passthrough guest packets */
+} synapticshw_t;
+.Ed
+.Pp
+See the
+.Em Synaptics TouchPad Interfacing Guide
+for more information about the fields in this structure.
+.Pp
+.It Dv MOUSE_GETMODE Ar mousemode_t *mode
+The command gets the current operation parameters of the mouse
+driver.
+.Bd -literal
+typedef struct mousemode {
+ int protocol; /* MOUSE_PROTO_XXX */
+ int rate; /* report rate (per sec), -1 if unknown */
+ int resolution; /* MOUSE_RES_XXX, -1 if unknown */
+ int accelfactor; /* acceleration factor */
+ int level; /* driver operation level */
+ int packetsize; /* the length of the data packet */
+ unsigned char syncmask[2]; /* sync. bits */
+} mousemode_t;
+.Ed
+.Pp
+The
+.Dv protocol
+is
+.Dv MOUSE_PROTO_PS2
+at the operation level zero and two.
+.Dv MOUSE_PROTO_SYSMOUSE
+at the operation level one.
+.Pp
+The
+.Dv rate
+is the status report rate (reports/sec) at which the device will send
+movement report to the host computer.
+Typical supported values are 10, 20, 40, 60, 80, 100 and 200.
+Some mice may accept other arbitrary values too.
+.Pp
+The
+.Dv resolution
+of the pointing device must be one of
+.Dv MOUSE_RES_XXX
+constants or a positive value.
+The greater the value
+is, the finer resolution the mouse will select.
+Actual resolution selected by the
+.Dv MOUSE_RES_XXX
+constant varies according to the model of mouse.
+Typical resolutions are:
+.Pp
+.Bl -tag -width MOUSE_RES_MEDIUMHIGH__ -compact
+.It Dv MOUSE_RES_LOW
+25 ppi
+.It Dv MOUSE_RES_MEDIUMLOW
+50 ppi
+.It Dv MOUSE_RES_MEDIUMHIGH
+100 ppi
+.It Dv MOUSE_RES_HIGH
+200 ppi
+.El
+.Pp
+The
+.Dv accelfactor
+field holds a value to control acceleration feature
+(see
+.Sx Acceleration ) .
+It must be zero or greater.
+If it is zero, acceleration is disabled.
+.Pp
+The
+.Dv packetsize
+field specifies the length of the data packet.
+It depends on the
+operation level and the model of the pointing device.
+.Pp
+.Bl -tag -width level_0__ -compact
+.It Em level 0
+3 bytes
+.It Em level 1
+8 bytes
+.It Em level 2
+Depends on the model of the device
+.El
+.Pp
+The array
+.Dv syncmask
+holds a bit mask and pattern to detect the first byte of the
+data packet.
+.Dv syncmask[0]
+is the bit mask to be ANDed with a byte.
+If the result is equal to
+.Dv syncmask[1] ,
+the byte is likely to be the first byte of the data packet.
+Note that this detection method is not 100% reliable,
+thus, should be taken only as an advisory measure.
+.Pp
+.It Dv MOUSE_SETMODE Ar mousemode_t *mode
+The command changes the current operation parameters of the mouse driver
+as specified in
+.Ar mode .
+Only
+.Dv rate ,
+.Dv resolution ,
+.Dv level
+and
+.Dv accelfactor
+may be modifiable.
+Setting values in the other field does not generate
+error and has no effect.
+.Pp
+If you do not want to change the current setting of a field, put -1
+there.
+You may also put zero in
+.Dv resolution
+and
+.Dv rate ,
+and the default value for the fields will be selected.
+.\" .Pp
+.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
+.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
+.\" These commands are not supported by the
+.\" .Nm
+.\" driver.
+.Pp
+.It Dv MOUSE_READDATA Ar mousedata_t *data
+.\" The command reads the raw data from the device.
+.\" .Bd -literal
+.\" typedef struct mousedata {
+.\" int len; /* # of data in the buffer */
+.\" int buf[16]; /* data buffer */
+.\" } mousedata_t;
+.\" .Ed
+.\" .Pp
+.\" Upon returning to the user program, the driver will place the number
+.\" of valid data bytes in the buffer in the
+.\" .Dv len
+.\" field.
+.\" .Pp
+.It Dv MOUSE_READSTATE Ar mousedata_t *state
+.\" The command reads the hardware settings from the device.
+.\" Upon returning to the user program, the driver will place the number
+.\" of valid data bytes in the buffer in the
+.\" .Dv len
+.\" field. It is usually 3 bytes.
+.\" The buffer is formatted as follows:
+.\" .Pp
+.\" .Bl -tag -width Byte_1 -compact
+.\" .It Byte 1
+.\" .Bl -tag -width bit_6 -compact
+.\" .It bit 7
+.\" Reserved.
+.\" .It bit 6
+.\" 0 - stream mode, 1 - remote mode.
+.\" In the stream mode, the pointing device sends the device status
+.\" whenever its state changes. In the remote mode, the host computer
+.\" must request the status to be sent.
+.\" The
+.\" .Nm
+.\" driver puts the device in the stream mode.
+.\" .It bit 5
+.\" Set if the pointing device is currently enabled. Otherwise zero.
+.\" .It bit 4
+.\" 0 - 1:1 scaling, 1 - 2:1 scaling.
+.\" 1:1 scaling is the default.
+.\" .It bit 3
+.\" Reserved.
+.\" .It bit 2
+.\" Left button status; set if pressed.
+.\" .It bit 1
+.\" Middle button status; set if pressed.
+.\" .It bit 0
+.\" Right button status; set if pressed.
+.\" .El
+.\" .It Byte 2
+.\" .Bl -tag -width bit_6_0 -compact
+.\" .It bit 7
+.\" Reserved.
+.\" .It bit 6..0
+.\" Resolution code: zero through three. Actual resolution for
+.\" the resolution code varies from one device to another.
+.\" .El
+.\" .It Byte 3
+.\" The status report rate (reports/sec) at which the device will send
+.\" movement report to the host computer.
+.\" .El
+These commands are not currently supported by the
+.Nm
+driver.
+.Pp
+.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
+The command returns the current state of buttons and
+movement counts as described in
+.Xr mouse 4 .
+.El
+.Sh FILES
+.Bl -tag -width /dev/npsm0 -compact
+.It Pa /dev/psm0
+`non-blocking' device node
+.It Pa /dev/bpsm0
+`blocking' device node
+.El
+.Sh EXAMPLES
+In order to install the
+.Nm
+driver, you need to add
+.Pp
+.Dl "device atkbdc"
+.Dl "device psm"
+.Pp
+to your kernel configuration file, and put the following lines to
+.Pa /boot/device.hints .
+.Pp
+.Dl hint.atkbdc.0.at="isa"
+.Dl hint.atkbdc.0.port="0x060"
+.Dl hint.psm.0.at="atkbdc"
+.Dl hint.psm.0.irq="12"
+.Pp
+If you add the following statement to
+.Pa /boot/device.hints ,
+.Pp
+.Dl hint.psm.0.flags="0x2000"
+.Pp
+you will add the optional code to stimulate the pointing device
+after the `resume' event.
+.Pp
+.Dl hint.psm.0.flags="0x24"
+.Pp
+The above line will set the device resolution high (4)
+and the acceleration factor to 2.
+.Sh DIAGNOSTICS
+At debug level 0, little information is logged except for the following
+line during boot process:
+.Bd -literal -offset indent
+psm0: device ID X
+.Ed
+.Pp
+where
+.Fa X
+the device ID code returned by the found pointing device.
+See
+.Dv MOUSE_GETINFO
+for known IDs.
+.Pp
+At debug level 1 more information will be logged
+while the driver probes the auxiliary port (mouse port).
+Messages are logged with the LOG_KERN facility at the LOG_DEBUG level
+(see
+.Xr syslogd 8 ) .
+.Bd -literal -offset indent
+psm0: current command byte:xxxx
+kbdio: TEST_AUX_PORT status:0000
+kbdio: RESET_AUX return code:00fa
+kbdio: RESET_AUX status:00aa
+kbdio: RESET_AUX ID:0000
+[...]
+psm: status 00 02 64
+psm0 irq 12 on isa
+psm0: model AAAA, device ID X, N buttons
+psm0: config:00000www, flags:0000uuuu, packet size:M
+psm0: syncmask:xx, syncbits:yy
+.Ed
+.Pp
+The first line shows the command byte value of the keyboard
+controller just before the auxiliary port is probed.
+It usually is 4D, 45, 47 or 65, depending on how the motherboard BIOS
+initialized the keyboard controller upon power-up.
+.Pp
+The second line shows the result of the keyboard controller's
+test on the auxiliary port interface, with zero indicating
+no error; note that some controllers report no error even if
+the port does not exist in the system, however.
+.Pp
+The third through fifth lines show the reset status of the pointing device.
+The functioning device should return the sequence of FA AA <ID>.
+The ID code is described above.
+.Pp
+The seventh line shows the current hardware settings.
+.\" See
+.\" .Dv MOUSE_READSTATE
+.\" for definitions.
+These bytes are formatted as follows:
+.Pp
+.Bl -tag -width Byte_1 -compact
+.It Byte 1
+.Bl -tag -width bit_6 -compact
+.It bit 7
+Reserved.
+.It bit 6
+0 - stream mode, 1 - remote mode.
+In the stream mode, the pointing device sends the device status
+whenever its state changes.
+In the remote mode, the host computer
+must request the status to be sent.
+The
+.Nm
+driver puts the device in the stream mode.
+.It bit 5
+Set if the pointing device is currently enabled.
+Otherwise zero.
+.It bit 4
+0 - 1:1 scaling, 1 - 2:1 scaling.
+1:1 scaling is the default.
+.It bit 3
+Reserved.
+.It bit 2
+Left button status; set if pressed.
+.It bit 1
+Middle button status; set if pressed.
+.It bit 0
+Right button status; set if pressed.
+.El
+.It Byte 2
+.Bl -tag -width bit_6_0 -compact
+.It bit 7
+Reserved.
+.It bit 6..0
+Resolution code: zero through three.
+Actual resolution for
+the resolution code varies from one device to another.
+.El
+.It Byte 3
+The status report rate (reports/sec) at which the device will send
+movement report to the host computer.
+.El
+.Pp
+Note that the pointing device will not be enabled until the
+.Nm
+driver is opened by the user program.
+.Pp
+The rest of the lines show the device ID code, the number of detected
+buttons and internal variables.
+.Pp
+At debug level 2, much more detailed information is logged.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr syslog 3 ,
+.Xr atkbdc 4 ,
+.Xr mouse 4 ,
+.Xr mse 4 ,
+.Xr sysmouse 4 ,
+.Xr moused 8 ,
+.Xr syslogd 8
+.Rs
+.%T Synaptics TouchPad Interfacing Guide
+.%U http://www.synaptics.com/
+.Re
+.\".Sh HISTORY
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver is based on the work done by quite a number of people, including
+.An Eric Forsberg ,
+.An Sandi Donno ,
+.An Rick Macklem ,
+.An Andrew Herbert ,
+.An Charles Hannum ,
+.An Shoji Yuen
+and
+.An Kazutaka Yokota
+to name the few.
+.Pp
+This manual page was written by
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+.Sh CAVEATS
+Many pad devices behave as if the first (left) button were pressed if
+the user `taps' the surface of the pad.
+In contrast, some pad products, e.g.\& some versions of ALPS GlidePoint
+and Interlink VersaPad, treat the tapping action
+as fourth button events.
+.Pp
+It is reported that ALPS GlidePoint, Synaptics Touchpad, and
+Interlink VersaPad require
+.Em INITAFTERSUSPEND
+flag in order to recover from suspended state.
+This flag is automatically set when one of these devices is detected by the
+.Nm
+driver.
+.Pp
+Some PS/2 mouse models from MouseSystems require to be put in the
+high resolution mode to work properly.
+Use the driver flag to
+set resolution.
+.Pp
+There is not a guaranteed way to re-synchronize with the first byte
+of the packet once we are out of synchronization with the data
+stream.
+However, if you are using the \fIXFree86\fP server and experiencing
+the problem, you may be able to make the X server synchronize with the mouse
+by switching away to a virtual terminal and getting back to the X server,
+unless the X server is accessing the mouse via
+.Xr moused 8 .
+Clicking any button without moving the mouse may also work.
+.Sh BUGS
+The ioctl command
+.Dv MOUSEIOCREAD
+has been removed.
+It was never functional anyway.
+.Pp
+Enabling the extended support for Synaptics touchpads has been reported to
+cause problems with responsivity on some (newer) models of Synaptics
+hardware, particularly those with guest devices.
diff --git a/share/man/man4/pst.4 b/share/man/man4/pst.4
new file mode 100644
index 000000000000..3ce95d858890
--- /dev/null
+++ b/share/man/man4/pst.4
@@ -0,0 +1,76 @@
+.\"
+.\" Copyright (c) 2001,2002 Søren Schmidt
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2004
+.Dt PST 4
+.Os
+.Sh NAME
+.Nm pst
+.Nd device driver for Promise Supertrak SX6000
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pst"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+pst_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver is for the Promise Supertrak SX6000 ATA hardware RAID controller.
+It supports (in hardware) RAID levels 0, 1, 0+1, 3, 5 and JBOD on up to
+6 ATA disk drives, including automatic rebuild and hotswap, and supports
+signalling disk status on LEDs on Promise Superswap disk enclosures.
+The Supertrak line of controllers does not support non-disk devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the Promise Supertrak SX6000 ATA hardware RAID
+controller.
+.Sh NOTES
+The
+.Nm
+driver does not support manipulating the RAID from the OS, RAIDs need
+to be set up from the onboard BIOS.
+However, hot swap, hot spare, and
+automatic rebuilds are supported without a reboot.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.7 .
+.Sh AUTHORS
+The
+.Nm
+driver and man page was written by
+.An S\(/oren Schmidt
+.Aq sos@FreeBSD.org .
diff --git a/share/man/man4/pt.4 b/share/man/man4/pt.4
new file mode 100644
index 000000000000..4400af91a10b
--- /dev/null
+++ b/share/man/man4/pt.4
@@ -0,0 +1,91 @@
+.\" Copyright (c) 1995
+.\" Peter Dufault, All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 2, 1995
+.Dt PT 4
+.Os
+.Sh NAME
+.Nm pt
+.Nd SCSI processor type driver
+.Sh SYNOPSIS
+.Cd device pt
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for a
+.Tn SCSI
+processor type device.
+These are usually scanners and other devices using the
+.Tn SCSI
+link as a communication interface with device
+specific commands embedded in the data stream.
+.Pp
+A
+.Tn SCSI
+adapter must be separately configured into the system
+before this driver can be used.
+.Pp
+This device supports
+.Xr read 2
+and
+.Xr write 2 ,
+and the
+.Xr ioctl 2
+calls described below.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls are supported by the
+.Nm
+driver.
+They are defined in the header file
+.In sys/ptio.h .
+.Bl -tag -width 012345678901234
+.It PTIOCGETTIMEOUT
+This ioctl allows userland applications to fetch the current
+.Nm
+driver read and write timeout.
+The value returned is in seconds.
+.It PTIOCSETTIMEOUT
+This ioctl allows userland applications to set the current
+.Nm
+driver read and write timeouts.
+The value should be in seconds.
+.El
+.Sh FILES
+.Bl -tag -width /dev/ptQQQ -compact
+.It Pa /dev/pt Ns Ar N
+the
+.Ar N Ns th processor device.
+.El
+.Sh SEE ALSO
+.Xr cam 4
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 2.1 .
diff --git a/share/man/man4/pts.4 b/share/man/man4/pts.4
new file mode 100644
index 000000000000..3faab8bbe5ee
--- /dev/null
+++ b/share/man/man4/pts.4
@@ -0,0 +1,162 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)pty.4 8.2 (Berkeley) 11/30/93
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2008
+.Dt PTS 4
+.Os
+.Sh NAME
+.Nm pts
+.Nd pseudo-terminal driver
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for a device-pair termed a
+.Em pseudo-terminal .
+A pseudo-terminal is a pair of character devices, a
+.Em master
+device and a
+.Em slave
+device.
+The slave device provides to a process an interface identical
+to that described in
+.Xr tty 4 .
+However, whereas all other devices which provide the
+interface described in
+.Xr tty 4
+have a hardware device of some sort behind them, the slave
+device has, instead, another process manipulating
+it through the master half of the pseudo-terminal.
+That is, anything written on the master device is
+given to the slave device as input and anything written
+on the slave device is presented as input on the master
+device.
+.Pp
+The following
+.Xr ioctl 2
+calls apply only to pseudo-terminals:
+.Bl -tag -width TIOCPTMASTER
+.It Dv TIOCPKT
+Enable/disable
+.Em packet
+mode.
+Packet mode is enabled by specifying (by reference)
+a nonzero parameter and disabled by specifying (by reference)
+a zero parameter.
+When applied to the master side of a pseudo-terminal, each subsequent
+.Xr read 2
+from the terminal will return data written on the slave part of
+the pseudo-terminal preceded by a zero byte (symbolically
+defined as
+.Dv TIOCPKT_DATA ) ,
+or a single byte reflecting control
+status information.
+In the latter case, the byte is an inclusive-or
+of zero or more of the bits:
+.Bl -tag -width TIOCPKT_FLUSHWRITE
+.It Dv TIOCPKT_FLUSHREAD
+whenever the read queue for the terminal is flushed.
+.It Dv TIOCPKT_FLUSHWRITE
+whenever the write queue for the terminal is flushed.
+.It Dv TIOCPKT_STOP
+whenever output to the terminal is stopped a la
+.Ql ^S .
+.It Dv TIOCPKT_START
+whenever output to the terminal is restarted.
+.It Dv TIOCPKT_DOSTOP
+whenever
+.Dv VSTOP
+is
+.Ql ^S
+and
+.Dv VSTART
+is
+.Ql ^Q .
+.It Dv TIOCPKT_NOSTOP
+whenever the start and stop characters are not
+.Ql ^S/^Q .
+.El
+.Pp
+While this mode is in use, the presence of control status information
+to be read from the master side may be detected by a
+.Xr select 2
+for exceptional conditions.
+.Pp
+This mode is used by
+.Xr rlogin 1
+and
+.Xr rlogind 8
+to implement a remote-echoed, locally
+.Ql ^S/^Q
+flow-controlled
+remote login with proper back-flushing of output; it can be
+used by other similar programs.
+.It Dv TIOCGPTN
+Obtain device unit number, which can be used to generate the filename of
+the pseudo-terminal slave device. This
+.Xr ioctl 2
+should not be used directly. Instead, the
+.Xr ptsname 3
+function should be used.
+.It Dv TIOCPTMASTER
+Determine whether the file descriptor is pointing to a pseudo-terminal
+master device.
+This
+.Xr ioctl 2
+should not be used directly. It is used to implement routines like
+.Xr grantpt 3 .
+.El
+.Sh FILES
+The files used by this
+pseudo-terminals implementation are:
+.Bl -tag -width ".Pa /dev/pts/[num]"
+.It Pa /dev/pts/[num]
+Pseudo-terminal slave devices.
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr grantpt 3 ,
+.Xr posix_openpt 2 ,
+.Xr ptsname 3 ,
+.Xr pty 4 ,
+.Xr tty 4
+.Sh HISTORY
+A
+pseudo-terminal driver appeared in
+.Bx 4.2 .
+In
+.Fx 8.0 ,
+it was replaced with the
+.Nm
+driver.
diff --git a/share/man/man4/pty.4 b/share/man/man4/pty.4
new file mode 100644
index 000000000000..80b584f7629f
--- /dev/null
+++ b/share/man/man4/pty.4
@@ -0,0 +1,97 @@
+.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed under sponsorship from Snow
+.\" B.V., the Netherlands.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2008
+.Dt PTY 4
+.Os
+.Sh NAME
+.Nm pty
+.Nd BSD-style and System V-style compatibility pseudo-terminal driver
+.Sh SYNOPSIS
+.Cd "device pty"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the traditional BSD naming scheme that was
+used for accessing pseudo-terminals.
+When the device
+.Pa /dev/ptyXX
+is being opened, a new terminal shall be created with the
+.Xr pts 4
+driver.
+A device node for this terminal shall be created, which has the name
+.Pa /dev/ttyXX .
+.Pp
+The
+.Nm
+driver also provides a cloning System V
+.Pa /dev/ptmx
+device.
+.Pp
+New code should not try to allocate pseudo-terminals using this
+interface.
+It is only provided for compatibility with older C libraries
+that tried to open such devices when
+.Xr posix_openpt 2
+was being called.
+.Sh FILES
+The BSD-style compatibility pseudo-terminal driver uses the following
+device names:
+.Bl -tag -width ".Pa /dev/pty[l-sL-S][0-9a-v]"
+.It Pa /dev/pty[l-sL-S][0-9a-v]
+Pseudo-terminal master devices.
+.It Pa /dev/tty[l-sL-S][0-9a-v]
+Pseudo-terminal slave devices.
+.It Pa /dev/ptmx
+Control device, returns a file descriptor to a new master
+pseudo-terminal when opened.
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr posix_openpt 2 ,
+.Xr pts 4 ,
+.Xr tty 4
+.Sh HISTORY
+A
+pseudo-terminal driver appeared in
+.Bx 4.2 .
+.Sh BUGS
+Unlike previous implementations, the master and slave device nodes are
+destroyed when the PTY becomes unused.
+A call to
+.Xr stat 2
+on a nonexistent master device will already cause a new master device
+node to be created.
+The master device can only be destroyed by opening and closing it.
+.Pp
+The
+.Nm
+driver cannot be unloaded, because it cannot determine if it is being
+used.
diff --git a/share/man/man4/puc.4 b/share/man/man4/puc.4
new file mode 100644
index 000000000000..34880cd9d301
--- /dev/null
+++ b/share/man/man4/puc.4
@@ -0,0 +1,57 @@
+.\" Copyright (c) 2002 John Hay.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 24, 2008
+.Dt PUC 4
+.Os
+.Sh NAME
+.Nm puc
+.Nd PCI
+.Dq Universal
+Communications driver
+.Sh SYNOPSIS
+.Cd "device pci"
+.Cd "device puc"
+.Cd "device uart"
+.Cd "device ppc"
+.Sh DESCRIPTION
+This driver acts as a shim to connect PCI serial and parallel ports to the
+.Xr uart 4
+and
+.Xr ppc 4
+driver.
+.Pp
+The list of supported devices is in
+.Pa sys/dev/puc/pucdata.c .
+Support for new cards should be added there.
+.Sh SEE ALSO
+.Xr ppc 4 ,
+.Xr uart 4
+.Sh HISTORY
+This driver took the idea from the
+.Nx
+.Xr puc 4
+driver.
diff --git a/share/man/man4/qlxgb.4 b/share/man/man4/qlxgb.4
new file mode 100644
index 000000000000..c76386f540ae
--- /dev/null
+++ b/share/man/man4/qlxgb.4
@@ -0,0 +1,93 @@
+.\"-
+.\" Copyright (c) 2011 "Bjoern A. Zeeb" <bz@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 3, 2011
+.Dt QLXGB 4
+.Os
+.Sh NAME
+.Nm qlxgb
+.Nd "QLogic 10 Gigabit Ethernet & CNA Adapter Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device qlxgb"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_qlxgb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports IPv4 checksum offload,
+TCP and UDP checksum offload for both IPv4 and IPv6,
+Large Segment Offload for both IPv4 and IPv6,
+Jumbo frames, VLAN Tag, and
+Receive Side scaling.
+For further hardware information, see
+.Pa http://www.qlogic.com/ .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10 Gigabit Ethernet & CNA Adapter based on the following
+chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+QLogic 3200 series
+.It
+QLogic 8200 series
+.El
+.Sh SUPPORT
+For support questions please contact your QLogic approved reseller or
+QLogic Technical Support at
+.Pa http://support.qlogic.com ,
+or by E-mail at
+.Aq support@qlogic.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An David C Somayajulu
+at QLogic Corporation.
diff --git a/share/man/man4/ral.4 b/share/man/man4/ral.4
new file mode 100644
index 000000000000..f2e0e5fe9d2a
--- /dev/null
+++ b/share/man/man4/ral.4
@@ -0,0 +1,259 @@
+.\" Copyright (c) 2005, 2006
+.\" Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 8, 2009
+.Dt RAL 4
+.Os
+.Sh NAME
+.Nm ral
+.Nd "Ralink Technology IEEE 802.11 wireless network driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ral"
+.Cd "device ralfw"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ral_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports PCI/CardBus wireless adapters based on the Ralink Technology
+RT2500, RT2501, and RT2600 chipsets.
+.Pp
+The RT2500 chipset is the first generation of 802.11b/g adapters from Ralink.
+It consists of two integrated chips, a RT2560 MAC/BBP and a RT2525 radio
+transceiver.
+.Pp
+The RT2501 chipset is the second generation of 802.11b/g adapters from Ralink.
+It consists of two integrated chips, a RT2561 MAC/BBP and a RT2527 radio
+transceiver.
+This chipset provides support for the IEEE 802.11e standard with multiple
+hardware transmission queues and allows scatter/gather for efficient DMA
+operations.
+.Pp
+The RT2600 chipset consists of two integrated chips, a RT2661 MAC/BBP and a
+RT2529 radio transceiver.
+This chipset uses the MIMO (multiple-input multiple-output) technology with
+multiple antennas to extend the operating range of the adapter and to achieve
+higher throughput.
+MIMO is the basis of the forthcoming IEEE 802.11n standard.
+.Pp
+The transmit speed is user-selectable or can be adapted automatically by the
+driver depending on the received signal strength and on the number of hardware
+transmission retries.
+.Pp
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+.Cm hostap ,
+.Cm mesh ,
+.Cm wds ,
+and
+.Cm monitor
+mode operation.
+Only one
+.Cm hostap
+or
+.Cm mesh
+virtual interface may be configured at a time.
+Any number of
+.Cm wds
+virtual interfaces may be configured together with a
+.Cm hostap
+interface.
+Multiple
+.Cm station
+interfaces may be operated together with a
+.Cm hostap
+interface to construct a wireless repeater device.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports PCI/CardBus wireless adapters based on the Ralink Technology
+RT2500, RT2501, and RT2600 chipsets, including:
+.Pp
+.Bl -column -compact ".Li Atlantis Land A02-PCM-W54" "RT2561S" "CardBus"
+.It Em Card Ta Em MAC/BBP Ta Em Bus
+.It "A-Link WL54H" Ta RT2560 Ta PCI
+.It "A-Link WL54PC" Ta RT2560 Ta CardBus
+.It "AirLink101 AWLC5025" Ta RT2661 Ta CardBus
+.It "AirLink101 AWLH5025" Ta RT2661 Ta PCI
+.It "Amigo AWI-914W" Ta RT2560 Ta CardBus
+.It "Amigo AWI-922W" Ta RT2560 Ta mini-PCI
+.It "Amigo AWI-926W" Ta RT2560 Ta PCI
+.It "AMIT WL531C" Ta RT2560 Ta CardBus
+.It "AMIT WL531P" Ta RT2560 Ta PCI
+.It "AOpen AOI-831" Ta RT2560 Ta PCI
+.It "ASUS WL-107G" Ta RT2560 Ta CardBus
+.It "ASUS WL-130g" Ta RT2560 Ta PCI
+.It "Atlantis Land A02-PCI-W54" Ta RT2560 Ta PCI
+.It "Atlantis Land A02-PCM-W54" Ta RT2560 Ta CardBus
+.It "Belkin F5D7000 v3" Ta RT2560 Ta PCI
+.It "Belkin F5D7010 v2" Ta RT2560 Ta CardBus
+.It "Billionton MIWLGRL" Ta RT2560 Ta mini-PCI
+.It "Canyon CN-WF511" Ta RT2560 Ta PCI
+.It "Canyon CN-WF513" Ta RT2560 Ta CardBus
+.It "CC&C WL-2102" Ta RT2560 Ta CardBus
+.It "CNet CWC-854" Ta RT2560 Ta CardBus
+.It "CNet CWP-854" Ta RT2560 Ta PCI
+.It "Compex WL54G" Ta RT2560 Ta CardBus
+.It "Compex WLP54G" Ta RT2560 Ta PCI
+.It "Conceptronic C54RC" Ta RT2560 Ta CardBus
+.It "Conceptronic C54Ri" Ta RT2560 Ta PCI
+.It "Digitus DN-7001G-RA" Ta RT2560 Ta CardBus
+.It "Digitus DN-7006G-RA" Ta RT2560 Ta PCI
+.It "E-Tech WGPC02" Ta RT2560 Ta CardBus
+.It "E-Tech WGPI02" Ta RT2560 Ta PCI
+.It "Edimax EW-7108PCg" Ta RT2560 Ta CardBus
+.It "Edimax EW-7128g" Ta RT2560 Ta PCI
+.It "Eminent EM3036" Ta RT2560 Ta CardBus
+.It "Eminent EM3037" Ta RT2560 Ta PCI
+.It "Encore ENLWI-G-RLAM" Ta RT2560 Ta PCI
+.It "Encore ENPWI-G-RLAM" Ta RT2560 Ta CardBus
+.It "Fiberline WL-400P" Ta RT2560 Ta PCI
+.It "Fibreline WL-400X" Ta RT2560 Ta CardBus
+.It "Gigabyte GN-WI01GS" Ta RT2561S Ta mini-PCI
+.It "Gigabyte GN-WIKG" Ta RT2560 Ta mini-PCI
+.It "Gigabyte GN-WMKG" Ta RT2560 Ta CardBus
+.It "Gigabyte GN-WP01GS" Ta RT2561S Ta PCI
+.It "Gigabyte GN-WPKG" Ta RT2560 Ta PCI
+.It "Hawking HWC54GR" Ta RT2560 Ta CardBus
+.It "Hawking HWP54GR" Ta RT2560 Ta PCI
+.It "iNexQ CR054g-009 (R03)" Ta RT2560 Ta PCI
+.It "JAHT WN-4054P" Ta RT2560 Ta CardBus
+.It "JAHT WN-4054PCI" Ta RT2560 Ta PCI
+.It "LevelOne WNC-0301 v2" Ta RT2560 Ta PCI
+.It "LevelOne WPC-0301 v2" Ta RT2560 Ta CardBus
+.It "Linksys WMP54G v4" Ta RT2560 Ta PCI
+.It "Micronet SP906GK" Ta RT2560 Ta PCI
+.It "Micronet SP908GK V3" Ta RT2560 Ta CardBus
+.It "Minitar MN54GCB-R" Ta RT2560 Ta CardBus
+.It "Minitar MN54GPC-R" Ta RT2560 Ta PCI
+.It "MSI CB54G2" Ta RT2560 Ta CardBus
+.It "MSI MP54G2" Ta RT2560 Ta mini-PCI
+.It "MSI PC54G2" Ta RT2560 Ta PCI
+.It "OvisLink EVO-W54PCI" Ta RT2560 Ta PCI
+.It "PheeNet HWL-PCIG/RA" Ta RT2560 Ta PCI
+.It "Pro-Nets CB80211G" Ta RT2560 Ta CardBus
+.It "Pro-Nets PC80211G" Ta RT2560 Ta PCI
+.It "Repotec RP-WB7108" Ta RT2560 Ta CardBus
+.It "Repotec RP-WP0854" Ta RT2560 Ta PCI
+.It "SATech SN-54C" Ta RT2560 Ta CardBus
+.It "SATech SN-54P" Ta RT2560 Ta PCI
+.It "Sitecom WL-112" Ta RT2560 Ta CardBus
+.It "Sitecom WL-115" Ta RT2560 Ta PCI
+.It "SMC SMCWCB-GM" Ta RT2661 Ta CardBus
+.It "SMC SMCWPCI-GM" Ta RT2661 Ta PCI
+.It "SparkLAN WL-685R" Ta RT2560 Ta CardBus
+.It "Surecom EP-9321-g" Ta RT2560 Ta PCI
+.It "Surecom EP-9321-g1" Ta RT2560 Ta PCI
+.It "Surecom EP-9428-g" Ta RT2560 Ta CardBus
+.It "Sweex LC500050" Ta RT2560 Ta CardBus
+.It "Sweex LC700030" Ta RT2560 Ta PCI
+.It "TekComm NE-9321-g" Ta RT2560 Ta PCI
+.It "TekComm NE-9428-g" Ta RT2560 Ta CardBus
+.It "Unex CR054g-R02" Ta RT2560 Ta PCI
+.It "Unex MR054g-R02" Ta RT2560 Ta CardBus
+.It "Zinwell ZWX-G160" Ta RT2560 Ta CardBus
+.It "Zinwell ZWX-G360" Ta RT2560 Ta mini-PCI
+.It "Zinwell ZWX-G361" Ta RT2560 Ta PCI
+.It "Zonet ZEW1500" Ta RT2560 Ta CardBus
+.It "Zonet ZEW1600" Ta RT2560 Ta PCI
+.El
+.Pp
+An up to date list can be found at
+.Pa http://damien.bergamini.free.fr/ral/list.html .
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Pp
+.Dl "ifconfig wlan create wlandev ral0 inet 192.168.0.20 netmask 0xffffff00"
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ral0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net
+.Ed
+.Pp
+Join a specific BSS network with 40-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ral0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1
+.Ed
+.Pp
+Join a specific BSS network with 104-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ral0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ral%d: could not load 8051 microcode"
+An error occurred while attempting to upload the microcode to the onboard 8051
+microcontroller unit.
+.It "ral%d: timeout waiting for MCU to initialize"
+The onboard 8051 microcontroller unit failed to initialize in time.
+.It "ral%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr cardbus 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr hostapd 8 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8 .
+.Rs
+.%T "Ralink Technology"
+.%U http://www.ralinktech.com/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 3.7 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien@FreeBSD.org .
+.Sh BUGS
+Host AP mode doesn't support client power save.
+Clients using power save mode will experience
+packet loss (disabling power saving on the client will fix this).
diff --git a/share/man/man4/random.4 b/share/man/man4/random.4
new file mode 100644
index 000000000000..9ba00c043b0c
--- /dev/null
+++ b/share/man/man4/random.4
@@ -0,0 +1,326 @@
+.\" Copyright (c) 2001 Mark R V Murray. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2006
+.Dt RANDOM 4
+.Os
+.Sh NAME
+.Nm random
+.Nd the entropy device
+.Sh SYNOPSIS
+.Cd "device random"
+.Sh DESCRIPTION
+The
+.Nm
+device
+returns an endless supply of random bytes when read.
+It also accepts and reads data
+as any ordinary (and willing) file,
+but discards data written to it.
+The device will probe for
+certain hardware entropy sources,
+and use these in preference to the fallback,
+which is a generator implemented in software.
+.Pp
+If the device is using
+the software generator,
+writing data to
+.Nm
+would perturb the internal state.
+This perturbation of the internal state
+is the only userland method of introducing
+extra entropy into the device.
+If the writer has superuser privilege,
+then closing the device after writing
+will make the software generator reseed itself.
+This can be used for extra security,
+as it immediately introduces any/all new entropy
+into the PRNG.
+The hardware generators will generate
+sufficient quantities of entropy,
+and will therefore ignore user-supplied input.
+The software
+.Nm
+device may be controlled with
+.Xr sysctl 8 .
+.Pp
+To see the current settings of the software
+.Nm
+device, use the command line:
+.Pp
+.Dl sysctl kern.random
+.Pp
+which results in something like:
+.Bd -literal -offset indent
+kern.random.sys.seeded: 1
+kern.random.sys.harvest.ethernet: 1
+kern.random.sys.harvest.point_to_point: 1
+kern.random.sys.harvest.interrupt: 1
+kern.random.sys.harvest.swi: 0
+kern.random.yarrow.gengateinterval: 10
+kern.random.yarrow.bins: 10
+kern.random.yarrow.fastthresh: 192
+kern.random.yarrow.slowthresh: 256
+kern.random.yarrow.slowoverthresh: 2
+.Ed
+.Pp
+(These would not be seen if a
+hardware generator is present.)
+.Pp
+All settings are read/write.
+.Pp
+The
+.Va kern.random.sys.seeded
+variable indicates whether or not the
+.Nm
+device is in an acceptably secure state
+as a result of reseeding.
+If set to 0, the device will block (on read) until the next reseed
+(which can be from an explicit write,
+or as a result of entropy harvesting).
+A reseed will set the value to 1 (non-blocking).
+.Pp
+The
+.Va kern.random.sys.harvest.ethernet
+variable is used to select LAN traffic as an entropy source.
+A 0 (zero) value means that LAN traffic
+is not considered as an entropy source.
+Set the variable to 1 (one)
+if you wish to use LAN traffic for entropy harvesting.
+.Pp
+The
+.Va kern.random.sys.harvest.point_to_point
+variable is used to select serial line traffic as an entropy source.
+(Serial line traffic includes PPP, SLIP and all tun0 traffic.)
+A 0 (zero) value means such traffic
+is not considered as an entropy source.
+Set the variable to 1 (one)
+if you wish to use it for entropy harvesting.
+.Pp
+The
+.Va kern.random.sys.harvest.interrupt
+variable is used to select hardware interrupts
+as an entropy source.
+A 0 (zero) value means hardware interrupts
+are not considered as an entropy source.
+Set the variable to 1 (one)
+if you wish to use them for entropy harvesting.
+All hardware interrupt harvesting is set up by the
+individual device drivers.
+.Pp
+The
+.Va kern.random.sys.harvest.swi
+variable is used to select software interrupts
+as an entropy source.
+A 0 (zero) value means software interrupts
+are not considered as an entropy source.
+Set the variable to 1 (one)
+if you wish to use them for entropy harvesting.
+.Pp
+The other variables are explained in the paper describing the
+.Em Yarrow
+algorithm at
+.Pa http://www.counterpane.com/yarrow.html .
+.Pp
+These variables are all limited
+in terms of the values they may contain:
+.Bl -tag -width "kern.random.yarrow.gengateinterval" -compact -offset indent
+.It Va kern.random.yarrow.gengateinterval
+.Bq 4..64
+.It Va kern.random.yarrow.bins
+.Bq 2..16
+.It Va kern.random.yarrow.fastthresh
+.Bq 64..256
+.It Va kern.random.yarrow.slowthresh
+.Bq 64..256
+.It Va kern.random.yarrow.slowoverthresh
+.Bq 1..5
+.El
+.Pp
+Internal
+.Xr sysctl 3
+handlers force the above variables
+into the stated ranges.
+.Sh RANDOMNESS
+The use of randomness in the field of computing
+is a rather subtle issue because randomness means
+different things to different people.
+Consider generating a password randomly,
+simulating a coin tossing experiment or
+choosing a random back-off period when a server does not respond.
+Each of these tasks requires random numbers,
+but the random numbers in each case have different requirements.
+.Pp
+Generation of passwords, session keys and the like
+requires cryptographic randomness.
+A cryptographic random number generator should be designed
+so that its output is difficult to guess,
+even if a lot of auxiliary information is known
+(such as when it was seeded, subsequent or previous output, and so on).
+On
+.Fx ,
+seeding for cryptographic random number generators is provided by the
+.Nm
+device,
+which provides real randomness.
+The
+.Xr arc4random 3
+library call provides a pseudo-random sequence
+which is generally reckoned to be suitable for
+simple cryptographic use.
+The OpenSSL library also provides functions for managing randomness
+via functions such as
+.Xr RAND_bytes 3
+and
+.Xr RAND_add 3 .
+Note that OpenSSL uses the
+.Nm
+device for seeding automatically.
+.Pp
+Randomness for simulation is required in engineering or
+scientific software and games.
+The first requirement of these applications is
+that the random numbers produced conform to some well-known,
+usually uniform, distribution.
+The sequence of numbers should also appear numerically uncorrelated,
+as simulation often assumes independence of its random inputs.
+Often it is desirable to reproduce
+the results of a simulation exactly,
+so that if the generator is seeded in the same way,
+it should produce the same results.
+A peripheral concern for simulation is
+the speed of a random number generator.
+.Pp
+Another issue in simulation is
+the size of the state associated with the random number generator, and
+how frequently it repeats itself.
+For example,
+a program which shuffles a pack of cards should have 52!\& possible outputs,
+which requires the random number generator to have 52!\& starting states.
+This means the seed should have at least log_2(52!) ~ 226 bits of state
+if the program is to stand a chance of outputting all possible sequences,
+and the program needs some unbiased way of generating these bits.
+Again,
+the
+.Nm
+device could be used for seeding here,
+but in practice, smaller seeds are usually considered acceptable.
+.Pp
+.Fx
+provides two families of functions which are considered
+suitable for simulation.
+The
+.Xr random 3
+family of functions provides a random integer
+between 0 to
+.if t 2\u\s731\s10\d\(mi1.
+.if n (2**31)\(mi1.
+The functions
+.Xr srandom 3 ,
+.Xr initstate 3
+and
+.Xr setstate 3
+are provided for deterministically setting
+the state of the generator and
+the function
+.Xr srandomdev 3
+is provided for setting the state via the
+.Nm
+device.
+The
+.Xr drand48 3
+family of functions are also provided,
+which provide random floating point numbers in various ranges.
+.Pp
+Randomness that is used for collision avoidance
+(for example, in certain network protocols)
+has slightly different semantics again.
+It is usually expected that the numbers will be uniform,
+as this produces the lowest chances of collision.
+Here again,
+the seeding of the generator is very important,
+as it is required that different instances of
+the generator produce independent sequences.
+However, the guessability or reproducibility of the sequence is unimportant,
+unlike the previous cases.
+.Pp
+One final consideration for the seeding of random number generators
+is a bootstrapping problem.
+In some cases, it may be difficult to find enough randomness to
+seed a random number generator until a system is fully operational,
+but the system requires random numbers to become fully operational.
+There is no substitute for careful thought here,
+but the
+.Fx
+.Nm
+device,
+which is based on the Yarrow system,
+should be of some help in this area.
+.Pp
+.Fx
+does also provide the traditional
+.Xr rand 3
+library call,
+for compatibility purposes.
+However,
+it is known to be poor for simulation and
+absolutely unsuitable for cryptographic purposes,
+so its use is discouraged.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/random"
+.It Pa /dev/random
+.El
+.Sh SEE ALSO
+.Xr arc4random 3 ,
+.Xr drand48 3 ,
+.Xr rand 3 ,
+.Xr RAND_add 3 ,
+.Xr RAND_bytes 3 ,
+.Xr random 3 ,
+.Xr sysctl 8
+.Sh HISTORY
+A
+.Nm
+device appeared in
+.Fx 2.2 .
+The early version was taken from Theodore Ts'o's entropy driver for Linux.
+The current software implementation,
+introduced in
+.Fx 5.0 ,
+is a complete rewrite by
+.An Mark R V Murray ,
+and is an implementation of the
+.Em Yarrow
+algorithm by Bruce Schneier,
+.Em et al .
+The only hardware implementation
+currently is for the
+.Tn VIA C3 Nehemiah
+(stepping 3 or greater)
+CPU.
+More will be added in the future.
+.Pp
+The author gratefully acknowledges
+significant assistance from VIA Technologies, Inc.
diff --git a/share/man/man4/rc.4 b/share/man/man4/rc.4
new file mode 100644
index 000000000000..60c4fa501f07
--- /dev/null
+++ b/share/man/man4/rc.4
@@ -0,0 +1,125 @@
+.\"
+.\" Copyright (c) 2004 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 18, 2005
+.Dt RC 4
+.Os
+.Sh NAME
+.Nm rc
+.Nd RISCom/8 multiport card
+.Sh SYNOPSIS
+.Cd device isa
+.Cd device rc
+.Sh DESCRIPTION
+The
+.Tn RISCom/8
+is an eight port
+.Tn ISA
+.Tn RS-232C
+communications multiplexer with a built in
+.Tn RISC
+processor.
+It uses a block of sixteen
+.Tn I/O
+ports in the range 0x200 to 0x3f0 selectable by on-board
+switches or jumpers.
+The block must be aligned on a sixteen port boundary.
+The jumper-selectable hardware interrupt level may be set to
+be detected during system
+initialization using settings found in the
+.Pa /boot/device.hints
+file.
+.Pp
+This driver is mostly based on the Cirrus Logic CL-CD180 driver.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the
+.Tn SDL
+Communications
+.Tn RISCom/8
+boards.
+.Sh DIAGNOSTICS
+The following driver specific error messages
+may be reported:
+.Bl -diag
+.It "rc%d channel%d: interrupt-level buffer overflow"
+An internal buffer overflow error has occurred on
+the listed channel.
+The
+.Nm
+driver will need to be reloaded to correct this.
+.It "rc%d: Bad char chan %d"
+The channel has obtained a bad set of characters.
+.It "rc%d: Got extra chars chan %d"
+The
+.Nm
+driver got more characters than expected on the channel shown.
+.It "rc%d: data mismatch chan %d ptr %d (%d != %d)"
+Data sent from channel
+.Ar %d
+to the rx buffer was different then expected.
+.It "rc%d: channel %d command timeout, rc.c line: %d"
+A command timeout has occurred on the channel, the
+.Pa src/sys/dev/rc/rc.c
+file can be consulted for more information.
+.El
+.Sh SEE ALSO
+.Xr tty 1 ,
+.Xr ttyname 3 ,
+.Xr sio 4 ,
+.Xr tty 4 ,
+.Xr device.hints 5 ,
+.Xr comcontrol 8 ,
+.Xr getty 8 ,
+.Xr mutex 9 ,
+.Xr splx 9
+.Pp
+.Pa http://www.sdlcomm.com
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.0.5 .
+This manual page first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver code still uses the
+.Xr spl 9
+functions.
+These should be replaced by
+.Xr mutex 9
+functions.
+.Pp
+The various
+.Fn ttyld_*
+functions should be documented.
diff --git a/share/man/man4/re.4 b/share/man/man4/re.4
new file mode 100644
index 000000000000..bd720f47fc18
--- /dev/null
+++ b/share/man/man4/re.4
@@ -0,0 +1,285 @@
+.\" Copyright (c) 2003
+.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2011
+.Dt RE 4
+.Os
+.Sh NAME
+.Nm re
+.Nd "RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device re"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_re_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs based on the RealTek RTL8139C+,
+RTL8169, RTL816xS, RTL811xS, RTL8168, RTL810xE and RTL8111 PCI and
+PCIe Ethernet controllers.
+.Pp
+NICs based on the 8139C+ and 810xE are capable of 10 and 100Mbps speeds
+over CAT5 cable.
+NICs based on the 8169, 816xS, 811xS, 8168 and 8111 are capable of 10, 100
+and 1000Mbps operation.
+.Pp
+All NICs supported by the
+.Nm
+driver have TCP/IP checksum offload and hardware VLAN tagging/insertion
+features, and use a descriptor-based DMA mechanism.
+They are also
+capable of TCP large send (TCP segmentation offload).
+.Pp
+The 8139C+ is a single-chip solution combining both a 10/100 MAC and PHY.
+The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY.
+The 816xS, 811xS, 8168 and 8111 are single-chip devices containing both a
+10/100/1000 MAC and 10/100/1000 copper PHY.
+Standalone 10/100/1000 cards are available
+in both 32-bit PCI and 64-bit PCI models.
+The 8110S is designed for
+embedded LAN-on-motherboard applications.
+.Pp
+The 8169, 8169S and 8110S also support jumbo frames, which can be configured
+via the interface MTU setting.
+The MTU is limited to 7422, since the chip cannot transmit larger frames.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+The RealTek gigE chips support 1000Mbps in
+.Cm full-duplex
+mode only.
+.\" .It Cm 1000baseSX
+.\" Set 1000Mbps (Gigabit Ethernet) operation.
+.\" Both
+.\" .Cm full-duplex
+.\" and
+.\" .Cm half-duplex
+.\" modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports RealTek RTL8139C+, RTL8169, RTL816xS, RTL811xS, RTL8168,
+RTL810xE and RTL8111 based Fast Ethernet and Gigabit Ethernet adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+Alloy Computer Products EtherGOLD 1439E 10/100 (8139C+)
+.It
+Compaq Evo N1015v Integrated Ethernet (8139C+)
+.It
+Corega CG-LAPCIGT Gigabit Ethernet (8169S)
+.It
+D-Link DGE-528(T) Gigabit Ethernet (8169S)
+.It
+Gigabyte 7N400 Pro2 Integrated Gigabit Ethernet (8110S)
+.It
+LevelOne GNC-0105T (8169S)
+.It
+LinkSys EG1032 (32-bit PCI)
+.It
+PLANEX COMMUNICATIONS Inc.\& GN-1200TC (8169S)
+.It
+USRobotics USR997902 Gigabit Ethernet (8169S)
+.It
+Xterasys XN-152 10/100/1000 NIC (8169)
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.re.intr_filter
+This tunable makes driver use interrupt filter handler on
+controllers that support MSI/MSI-X capability.
+If MSI/MSI-X is disabled by administrator this tunable has no
+effect and driver will use interrupt filter handler.
+The default value is 0 to use interrupt thread handler.
+.It Va hw.re.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.re.msix_disable
+This tunable disables MSI-X support on the Ethernet hardware.
+The default value is 0.
+.It Va hw.re.prefer_iomap
+This tunable controls which register mapping should be used on the
+specified device.
+A non-zero value enables I/O space register mapping.
+The default value is 0 to use memory space register mapping.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.re.%d.int_rx_mod
+Maximum amount of time to delay receive interrupt processing in
+units of 1us.
+The accepted range is 0 to 65, the default is 65(65us).
+Value 0 completely disables the interrupt moderation.
+The interface need to be brought down and up again before a change
+takes effect.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "re%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "re%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "re%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "re%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "re%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "re%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "re%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr rgephy 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T RealTek Semiconductor RTL8139C+, RTL8169, RTL8169S and RTL8110S datasheets
+.%U http://www.realtek.com.tw/
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@windriver.com .
+.Sh BUGS
+The Xterasys XN-152 32-bit PCI NIC, which uses the RTL8169 MAC and
+Marvell 88E1000 PHY, has a defect that causes DMA corruption
+if the board is plugged into a 64-bit PCI slot.
+The defect
+lies in the board design, not the chip itself: the PCI REQ64# and ACK64#
+lines should be pulled high, but they are not.
+The result is that the
+8169 chip is tricked into performing 64-bit DMA transfers even though
+a 64-bit data path between the NIC and the bus does not actually exist.
+.Pp
+Unfortunately, it is not possible to correct this problem in software,
+however it is possible to detect it.
+When the
+.Nm
+driver is loaded, it will run a diagnostic routine designed to
+validate DMA operation by placing the chip in digital loopback mode
+and initiating a packet transmission.
+If the card functions properly,
+the transmitted data will
+be echoed back unmodified.
+If the echoed data is corrupt, the driver
+will print an error message on the console and abort the device attach.
+The
+user should ensure the NIC is installed in a 32-bit PCI slot to
+avoid this problem.
+.Pp
+The RealTek 8169, 8169S and 8110S chips appear to only be capable of
+transmitting jumbo frames up to 7.5K in size.
diff --git a/share/man/man4/rgephy.4 b/share/man/man4/rgephy.4
new file mode 100644
index 000000000000..4e9e8e13d5bf
--- /dev/null
+++ b/share/man/man4/rgephy.4
@@ -0,0 +1,96 @@
+.\"
+.\" Copyright (c) 2011 Marius Strobl <marius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2011
+.Dt RGEPHY 4
+.Os
+.Sh NAME
+.Nm rgephy
+.Nd RealTek RTL8168/8169/8110/8211 series 10/100/1000 Gigabit Ethernet PHY driver
+.Sh SYNOPSIS
+To compile all available PHY drivers into the kernel,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Ed
+.Pp
+Alternatively, to selectively compile this driver into the kernel,
+place the following lines in your kernel configuration file instead:
+.Bd -ragged -offset indent
+.Cd "device mii"
+.Cd "device rgephy"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the RealTek RTL8168, RTL8169, RTL8110 and RTL8211 series
+integrated 10/100/1000 Gigabit Ethernet PHYs.
+.Pp
+In order to get a list of media types and options supported by a specific
+instance of the
+.Nm
+driver, run
+.Li ifconfig -m
+on the instance of its parent MAC driver.
+.Pp
+Additionally,
+the
+.Nm
+driver supports the following special media option:
+.Bl -tag -width ".Cm flag0"
+.It Cm flag0
+When manually setting media type and options via
+.Xr ifconfig 8 ,
+the
+.Nm
+driver by default also triggers an autonegotiation advertising the selected
+media.
+This is done in order to work around hardware issues in certain scenarios.
+It is believed that this behavior does not cause harm in general but in fact
+can have an adverse effect in edge cases.
+In order to manually set the media type and options without also triggering
+an autonegotiation,
+the
+.Nm
+driver allows to turn this behavior off via the
+.Cm flag0
+media option.
+.El
+.Pp
+Note that this special media option will not show up in the output of
+.Xr ifconfig 8 ,
+even when set.
+.Sh EXAMPLES
+Manually set 100BASE-TX full-duplex without also triggering an
+autonegotiation:
+.Pp
+.Dl "ifconfig re0 media 100baseTX mediaopt full-duplex,flag0"
+.Sh SEE ALSO
+.\".Xr ifmedia 4 ,
+.Xr intro 4 ,
+.Xr miibus 4 ,
+.Xr ifconfig 8
diff --git a/share/man/man4/rl.4 b/share/man/man4/rl.4
new file mode 100644
index 000000000000..33db96665463
--- /dev/null
+++ b/share/man/man4/rl.4
@@ -0,0 +1,310 @@
+.\" Copyright (c) 1997, 1998
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 22, 2010
+.Dt RL 4
+.Os
+.Sh NAME
+.Nm rl
+.Nd "RealTek 8129/8139 Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device rl"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_rl_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the RealTek 8129 and 8139 Fast Ethernet controller
+chips.
+.Pp
+The RealTek 8129/8139 series controllers use bus master DMA but do not use a
+descriptor-based data transfer mechanism.
+The receiver uses a
+single fixed size ring buffer from which packets must be copied
+into mbufs.
+For transmission, there are only four outbound packet
+address registers which require all outgoing packets to be stored
+as contiguous buffers.
+Furthermore, outbound packet buffers must
+be longword aligned or else transmission will fail.
+.Pp
+The 8129 differs from the 8139 in that the 8139 has an internal
+PHY which is controlled through special direct access registers
+whereas the 8129 uses an external PHY via an MII bus.
+The 8139
+supports both 10 and 100Mbps speeds in either full or half duplex.
+The 8129 can support the same speeds and modes given an appropriate
+PHY chip.
+.Pp
+Note: support for the 8139C+ chip is provided by the
+.Xr re 4
+driver.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+This is only
+supported if the PHY chip attached to the RealTek controller
+supports NWAY autonegotiation.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+Note that the 100baseTX media type is only available if supported
+by the adapter.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Accton
+.Dq Cheetah
+EN1207D (MPX 5030/5038; RealTek 8139 clone)
+.It
+Allied Telesyn AT2550
+.It
+Allied Telesyn AT2500TX
+.It
+Belkin F5D5000
+.It
+BUFFALO (Melco INC.) LPC-CB-CLX (CardBus)
+.It
+Compaq HNE-300
+.It
+CompUSA no-name 10/100 PCI Ethernet NIC
+.It
+Corega FEther CB-TXD
+.It
+Corega FEtherII CB-TXD
+.It
+D-Link DFE-528TX
+.It
+D-Link DFE-530TX+
+.It
+D-Link DFE-538TX
+.It
+D-Link DFE-690TXD
+.It
+Edimax EP-4103DL CardBus
+.It
+Encore ENL832-TX 10/100 M PCI
+.It
+Farallon NetLINE 10/100 PCI
+.It
+Genius GF100TXR
+.It
+GigaFast Ethernet EE100-AXP
+.It
+KTX-9130TX 10/100 Fast Ethernet
+.It
+LevelOne FPC-0106TX
+.It
+Longshine LCS-8038TX-R
+.It
+NDC Communications NE100TX-E
+.It
+Netronix Inc.\& EA-1210 NetEther 10/100
+.It
+Nortel Networks 10/100BaseTX
+.It
+OvisLink LEF-8129TX
+.It
+OvisLink LEF-8139TX
+.It
+Peppercon AG ROL-F
+.It
+Planex FNW-3603-TX
+.It
+Planex FNW-3800-TX
+.It
+SMC EZ Card 10/100 PCI 1211-TX
+.It
+SOHO (PRAGMATIC) UE-1211C
+.El
+.Sh LOADER TUNABLES
+.Bl -tag -width indent
+.It Va dev.rl.%unit.prefer_iomap
+This tunable controls which register mapping should be used on the
+specified device.
+A non-zero value enables I/O space register mapping.
+For controllers that have no I/O space register mapping this tunable
+should be set to 0 to use memory space register mapping.
+The default value is 1 to use I/O space register mapping.
+.It Va dev.rl.%unit.twister_enable
+Non-zero value enables the long cable tuning on the specified device.
+Disabled by default.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "rl%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "rl%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "rl%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "rl%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "rl%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "rl%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr ifconfig 8
+.Rs
+.%B The RealTek 8129, 8139 and 8139C+ datasheets
+.%U http://www.realtek.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
+.Sh BUGS
+Since outbound packets must be longword aligned, the transmit
+routine has to copy an unaligned packet into an mbuf cluster buffer
+before transmission.
+The driver abuses the fact that the cluster buffer
+pool is allocated at system startup time in a contiguous region starting
+at a page boundary.
+Since cluster buffers are 2048 bytes, they are
+longword aligned by definition.
+The driver probably should not be
+depending on this characteristic.
+.Pp
+The RealTek data sheets are of especially poor quality,
+and there is a lot of information missing
+particularly concerning the receiver operation.
+One particularly
+important fact that the data sheets fail to mention relates to the
+way in which the chip fills in the receive buffer.
+When an interrupt
+is posted to signal that a frame has been received, it is possible that
+another frame might be in the process of being copied into the receive
+buffer while the driver is busy handling the first one.
+If the driver
+manages to finish processing the first frame before the chip is done
+DMAing the rest of the next frame, the driver may attempt to process
+the next frame in the buffer before the chip has had a chance to finish
+DMAing all of it.
+.Pp
+The driver can check for an incomplete frame by inspecting the frame
+length in the header preceding the actual packet data: an incomplete
+frame will have the magic length of 0xFFF0.
+When the driver encounters
+this value, it knows that it has finished processing all currently
+available packets.
+Neither this magic value nor its significance are
+documented anywhere in the RealTek data sheets.
diff --git a/share/man/man4/rndtest.4 b/share/man/man4/rndtest.4
new file mode 100644
index 000000000000..67448d80dd91
--- /dev/null
+++ b/share/man/man4/rndtest.4
@@ -0,0 +1,72 @@
+.\"-
+.\" Copyright (c) 2003 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 11, 2003
+.Dt RNDTEST 4
+.Os
+.Sh NAME
+.Nm rndtest
+.Nd FIPS 140-2 random number generator test monitor
+.Sh SYNOPSIS
+.Cd "device rndtest"
+.Sh DESCRIPTION
+The
+.Nm
+driver
+.Dq "hooks up"
+to hardware crypto devices to monitor the
+entropy data passed to the
+.Xr random 4
+subsystem.
+This data is periodically tested for FIPS 140-2 compliance and
+statistics are collected.
+If the harvested entropy fails any of the FIPS test suite, then
+it is discarded and testing is continuously applied until
+.Dq "good data"
+is received from the device.
+Failures are optionally reported on the console.
+.Sh SEE ALSO
+.Xr crypto 4 ,
+.Xr hifn 4 ,
+.Xr random 4 ,
+.Xr safe 4 ,
+.Xr ubsec 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The idea for this and the original code came from
+.An "Jason L. Wright" .
+The
+.Nm
+device driver first appeared in
+.Fx 5.0 .
+.Sh BUGS
+Crypto device drivers must be compiled specially to make use of this driver;
+this should not be necessary.
+This feature might better be integrated into the
+.Xr random 4
+subsystem where it can be applied to devices that claim to supply
+.Dq "pure entropy" .
diff --git a/share/man/man4/route.4 b/share/man/man4/route.4
new file mode 100644
index 000000000000..b85b41cbe5a1
--- /dev/null
+++ b/share/man/man4/route.4
@@ -0,0 +1,335 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)route.4 8.6 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd November 4, 2004
+.Dt ROUTE 4
+.Os
+.Sh NAME
+.Nm route
+.Nd kernel packet forwarding database
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/time.h
+.In sys/socket.h
+.In net/if.h
+.In net/route.h
+.Ft int
+.Fn socket PF_ROUTE SOCK_RAW "int family"
+.Sh DESCRIPTION
+.Fx
+provides some packet routing facilities.
+The kernel maintains a routing information database, which
+is used in selecting the appropriate network interface when
+transmitting packets.
+.Pp
+A user process (or possibly multiple co-operating processes)
+maintains this database by sending messages over a special kind
+of socket.
+This supplants fixed size
+.Xr ioctl 2 Ns 's
+used in earlier releases.
+Routing table changes may only be carried out by the super user.
+.Pp
+The operating system may spontaneously emit routing messages in response
+to external events, such as receipt of a re-direct, or failure to
+locate a suitable route for a request.
+The message types are described in greater detail below.
+.Pp
+Routing database entries come in two flavors: for a specific
+host, or for all hosts on a generic subnetwork (as specified
+by a bit mask and value under the mask.
+The effect of wildcard or default route may be achieved by using
+a mask of all zeros, and there may be hierarchical routes.
+.Pp
+When the system is booted and addresses are assigned
+to the network interfaces, each protocol family
+installs a routing table entry for each interface when it is ready for traffic.
+Normally the protocol specifies the route
+through each interface as a
+.Dq direct
+connection to the destination host
+or network.
+If the route is direct, the transport layer of
+a protocol family usually requests the packet be sent to the
+same host specified in the packet.
+Otherwise, the interface
+is requested to address the packet to the gateway listed in the routing entry
+(i.e., the packet is forwarded).
+.Pp
+When routing a packet,
+the kernel will attempt to find
+the most specific route matching the destination.
+(If there are two different mask and value-under-the-mask pairs
+that match, the more specific is the one with more bits in the mask.
+A route to a host is regarded as being supplied with a mask of
+as many ones as there are bits in the destination).
+If no entry is found, the destination is declared to be unreachable,
+and a routing-miss message is generated if there are any
+listeners on the routing control socket described below.
+.Pp
+A wildcard routing entry is specified with a zero
+destination address value, and a mask of all zeroes.
+Wildcard routes will be used
+when the system fails to find other routes matching the
+destination.
+The combination of wildcard
+routes and routing redirects can provide an economical
+mechanism for routing traffic.
+.Pp
+One opens the channel for passing routing control messages
+by using the socket call shown in the synopsis above:
+.Pp
+The
+.Fa family
+parameter may be
+.Dv AF_UNSPEC
+which will provide
+routing information for all address families, or can be restricted
+to a specific address family by specifying which one is desired.
+There can be more than one routing socket open per system.
+.Pp
+Messages are formed by a header followed by a small
+number of sockaddrs (now variable length particularly
+in the
+.Tn ISO
+case), interpreted by position, and delimited
+by the new length entry in the sockaddr.
+An example of a message with four addresses might be an
+.Tn ISO
+redirect:
+Destination, Netmask, Gateway, and Author of the redirect.
+The interpretation of which address are present is given by a
+bit mask within the header, and the sequence is least significant
+to most significant bit within the vector.
+.Pp
+Any messages sent to the kernel are returned, and copies are sent
+to all interested listeners.
+The kernel will provide the process
+ID for the sender, and the sender may use an additional sequence
+field to distinguish between outstanding messages.
+However, message replies may be lost when kernel buffers are exhausted.
+.Pp
+The kernel may reject certain messages, and will indicate this
+by filling in the
+.Ar rtm_errno
+field.
+The routing code returns
+.Er EEXIST
+if
+requested to duplicate an existing entry,
+.Er ESRCH
+if
+requested to delete a non-existent entry,
+or
+.Er ENOBUFS
+if insufficient resources were available
+to install a new route.
+In the current implementation, all routing processes run locally,
+and the values for
+.Ar rtm_errno
+are available through the normal
+.Em errno
+mechanism, even if the routing reply message is lost.
+.Pp
+A process may avoid the expense of reading replies to
+its own messages by issuing a
+.Xr setsockopt 2
+call indicating that the
+.Dv SO_USELOOPBACK
+option
+at the
+.Dv SOL_SOCKET
+level is to be turned off.
+A process may ignore all messages from the routing socket
+by doing a
+.Xr shutdown 2
+system call for further input.
+.Pp
+If a route is in use when it is deleted,
+the routing entry will be marked down and removed from the routing table,
+but the resources associated with it will not
+be reclaimed until all references to it are released.
+User processes can obtain information about the routing
+entry to a specific destination by using a
+.Dv RTM_GET
+message, or by calling
+.Xr sysctl 3 .
+.Pp
+Messages include:
+.Bd -literal
+#define RTM_ADD 0x1 /* Add Route */
+#define RTM_DELETE 0x2 /* Delete Route */
+#define RTM_CHANGE 0x3 /* Change Metrics, Flags, or Gateway */
+#define RTM_GET 0x4 /* Report Information */
+#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
+#define RTM_REDIRECT 0x6 /* Told to use different route */
+#define RTM_MISS 0x7 /* Lookup failed on this address */
+#define RTM_LOCK 0x8 /* fix specified metrics */
+#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
+#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
+#define RTM_RESOLVE 0xb /* request to resolve dst to LL addr - unused */
+#define RTM_NEWADDR 0xc /* address being added to iface */
+#define RTM_DELADDR 0xd /* address being removed from iface */
+#define RTM_IFINFO 0xe /* iface going up/down etc. */
+#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
+#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
+#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */
+#define RTM_IEEE80211 0x12 /* IEEE80211 wireless event */
+.Ed
+.Pp
+A message header consists of one of the following:
+.Bd -literal
+struct rt_msghdr {
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_index; /* index for associated ifp */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ pid_t rtm_pid; /* identify sender */
+ int rtm_seq; /* for sender to identify action */
+ int rtm_errno; /* why failed */
+ int rtm_fmask; /* bitmask used in RTM_CHANGE message */
+ u_long rtm_inits; /* which metrics we are initializing */
+ struct rt_metrics rtm_rmx; /* metrics themselves */
+};
+
+struct if_msghdr {
+ u_short ifm_msglen; /* to skip over non-understood messages */
+ u_char ifm_version; /* future binary compatibility */
+ u_char ifm_type; /* message type */
+ int ifm_addrs; /* like rtm_addrs */
+ int ifm_flags; /* value of if_flags */
+ u_short ifm_index; /* index for associated ifp */
+ struct if_data ifm_data; /* statistics and other data about if */
+};
+
+struct ifa_msghdr {
+ u_short ifam_msglen; /* to skip over non-understood messages */
+ u_char ifam_version; /* future binary compatibility */
+ u_char ifam_type; /* message type */
+ int ifam_addrs; /* like rtm_addrs */
+ int ifam_flags; /* value of ifa_flags */
+ u_short ifam_index; /* index for associated ifp */
+ int ifam_metric; /* value of ifa_metric */
+};
+
+struct ifma_msghdr {
+ u_short ifmam_msglen; /* to skip over non-understood messages */
+ u_char ifmam_version; /* future binary compatibility */
+ u_char ifmam_type; /* message type */
+ int ifmam_addrs; /* like rtm_addrs */
+ int ifmam_flags; /* value of ifa_flags */
+ u_short ifmam_index; /* index for associated ifp */
+};
+
+struct if_announcemsghdr {
+ u_short ifan_msglen; /* to skip over non-understood messages */
+ u_char ifan_version; /* future binary compatibility */
+ u_char ifan_type; /* message type */
+ u_short ifan_index; /* index for associated ifp */
+ char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ u_short ifan_what; /* what type of announcement */
+};
+.Ed
+.Pp
+The
+.Dv RTM_IFINFO
+message uses a
+.Ar if_msghdr
+header, the
+.Dv RTM_NEWADDR
+and
+.Dv RTM_DELADDR
+messages use a
+.Ar ifa_msghdr
+header, the
+.Dv RTM_NEWMADDR
+and
+.Dv RTM_DELMADDR
+messages use a
+.Vt ifma_msghdr
+header, the
+.Dv RTM_IFANNOUNCE
+message uses a
+.Vt if_announcemsghdr
+header,
+and all other messages use the
+.Ar rt_msghdr
+header.
+.Pp
+The
+.Dq Li "struct rt_metrics"
+and the flag bits are as defined in
+.Xr rtentry 9 .
+.Pp
+Specifiers for metric values in rmx_locks and rtm_inits are:
+.Bd -literal
+#define RTV_MTU 0x1 /* init or lock _mtu */
+#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
+#define RTV_EXPIRE 0x4 /* init or lock _expire */
+#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
+#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
+#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
+#define RTV_RTT 0x40 /* init or lock _rtt */
+#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
+#define RTV_WEIGHT 0x100 /* init or lock _weight */
+.Ed
+.Pp
+Specifiers for which addresses are present in the messages are:
+.Bd -literal
+#define RTA_DST 0x1 /* destination sockaddr present */
+#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
+#define RTA_NETMASK 0x4 /* netmask sockaddr present */
+#define RTA_GENMASK 0x8 /* cloning mask sockaddr present - unused */
+#define RTA_IFP 0x10 /* interface name sockaddr present */
+#define RTA_IFA 0x20 /* interface addr sockaddr present */
+#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
+#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
+.Ed
+.Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr route 8 ,
+.Xr rtentry 9
+.Pp
+The constants for the
+.Va rtm_flags
+field are documented in the manual page for the
+.Xr route 8
+utility.
+.Sh HISTORY
+A
+.Dv PF_ROUTE
+protocol family first appeared in
+.Bx 4.3 reno .
diff --git a/share/man/man4/rp.4 b/share/man/man4/rp.4
new file mode 100644
index 000000000000..a894f1242c76
--- /dev/null
+++ b/share/man/man4/rp.4
@@ -0,0 +1,195 @@
+.\" Copyright (c) 1995 Comtrol, Inc.
+.\" All rights reserved.
+.\"
+.\" $FreeBSD$
+.Dd November 15, 1995
+.Dt RP 4
+.Os
+.Sh NAME
+.Nm rp
+.Nd "driver for Comtrol RocketPort Intelligent Serial Port Cards"
+.Sh SYNOPSIS
+.Cd "device rp"
+.Pp
+For ISA cards, you must specify the port address in
+.Pa /boot/device.hints :
+.Cd hint.rp.0.at="isa"
+.Cd hint.rp.0.port="0x100"
+.Sh DESCRIPTION
+This driver provides a kernel device driver for the
+.Tn RocketPort
+and
+.Tn RocketPort RA
+serial boards.
+These boards provide 8, 16, or 32 high-speed serial ports
+while requiring only 68 bytes of I/O space for all 8, 16,
+or 32 ports, and do not require an interrupt channel.
+This driver supports up to four
+.Tn RocketPort
+or
+.Tn RocketPort RA
+boards in one machine simultaneously.
+If you are using four 32 port
+.Tn RocketPort
+boards, you can put as many as 128 intelligent serial ports
+on your system.
+.Pp
+The
+.Nm
+driver supports the following speeds: 50, 75, 110, 134, 150,
+200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 7200,
+14400, 57600, 76800, 115200, and 230400.
+(You must use
+.Xr termios 4 ,
+rather than the old style ioctl interface to use non-traditional
+speeds.)
+.Pp
+An open on the
+.Nm
+driver will block until carrier is present, unless
+.Dv O_NONBLOCK
+or
+.Dv CLOCAL
+is set.
+.Sh HARDWARE CONFIGURATION
+The first
+.Tn RocketPort
+or
+.Tn RocketPort RA
+card requires a 68-byte contiguous block of I/O addresses,
+starting at one of the following:
+0x100h, 0x140h, 0x180h, 0x200h, 0x240h, 0x280h, 0x300h, 0x340h,
+0x380h.
+The second, third, and fourth
+.Tn RocketPort
+cards require only a
+64-byte contiguous block of I/O addresses, starting at one of the
+above address ranges.
+The I/O address range used by any of the
+.Tn RocketPort
+cards must not conflict with any other cards in the system,
+including other
+.Tn RocketPort
+cards.
+The starting range of the I/O ports used by each card
+must match with the I/O address specified in
+.Pa /boot/device.hints .
+.Pp
+Since the first
+.Tn RocketPort
+uses 68 I/O addresses, if the first card is
+set to use an I/O block starting at 0x100,
+it will occupy the I/O ports between 0x100 and 0x143.
+This means that the second, third, or fourth
+.Tn RocketPort
+board may not use the block of addresses starting at 0x140,
+since the first three I/O addresses of that range
+are used by the first board.
+This is an important point to keep in mind.
+.Pp
+If you have two ISA cards, one installed at 0x100 and the
+second installed at 0x180, then you should add the following to
+.Pa /boot/device.hints :
+.Pp
+.Dl hint.rp.0.at="isa"
+.Dl hint.rp.0.port="0x100"
+.Dl hint.rp.1.at="isa"
+.Dl hint.rp.1.port="0x180"
+.Pp
+The configuration of the
+.Tn RocketPort
+cards is done via the set of 8 DIP switches,
+labeled SW1 on the
+.Tn RocketPort
+card:
+.Bd -literal -offset indent
++-------------------------------+
+| 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
++-------+-------+---------------+
+| Unused| Card | I/O Port Block|
++-------------------------------+
+.Ed
+.Pp
+DIP switches 7 and 8 are unused, and must be left on.
+.Pp
+DIP switches 6 and 5 identify the card number of each
+.Tn RocketPort
+card.
+The first card installed in the system must have its DIP switches set
+as card number one; the second card installed in the system must have
+its DIP switches set as card number two; and so on.
+As shipped from
+the factory, DIP switches 6 and 5 are both on by default, indicating
+that this is the first card installed on the system:
+.Bd -literal -offset indent
+DIP Switches
+6 5
+===================
+On On First Card
+On Off Second Card
+Off On Third Card
+Off Off Fourth Card
+.Ed
+.Pp
+DIP switches 4, 3, 2, and 1 indicate the I/O address range used by the
+first
+.Tn RocketPort
+card.
+If there are more than one
+.Tn RocketPort
+cards installed in a system,
+the second, third and fourth
+.Tn RocketPort
+cards must
+also be set to the I/O address range used by the first
+.Tn RocketPort
+card;
+all cards must have these DIP switches set identically
+for proper operation.
+As shipped from the factory, DIP switch 4 is on,
+and switches 3, 2, and 1 are off by default,
+indicating an I/O address range used by the first
+card which starts at 0x180 and extends to 0x1C3.
+.Bd -literal -offset indent
+DIP Switches I/O Address Range
+4 3 2 1 Used by the First Card
+=====================================
+On Off On Off 100-143
+On Off Off On 140-183
+On Off Off Off 180-1C3
+Off On On Off 200-243
+Off On Off On 240-283
+Off On Off Off 280-2C3
+Off Off On Off 300-343
+Off Off Off On 340-383
+Off Off Off Off 380-3C3
+.Ed
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ttyR[0-4][0-9a-f]"
+.It Pa /dev/ttyR[0-4][0-9a-f]
+.El
+.Sh AUTHORS
+.An Theodore Ts'o Aq tytso@mit.edu
+.Pp
+This driver was written under contract for Comtrol Corporation.
+For dealer, distributor and other information regarding Comtrol
+.Tn RocketPort ,
+contact Comtrol Corporation at (800) 926-6876 or send email to
+.Aq info@comtrol.com .
+To report bugs for this driver, please send email to
+.Aq bug-bsdi-rocketport@comtrol.com .
+.Sh BUGS
+If incoming software flow control is enabled on a 486 or Pentium
+machine, and the flow control is very heavily exercised, on rare occasions
+a character will get dropped.
+This problem does not occur on a 386, and
+it is not currently known whether the bug is in the
+.Nm
+driver
+or in the
+.Bsx
+tty layer.
+.\" (Although my bet is that it's in the higher-level tty layer;
+.\" given the bugs I found while writing this driver, it's clear
+.\" the BSD software flow control code has not been tested very much
+.\" at all! -- TYT)
diff --git a/share/man/man4/rue.4 b/share/man/man4/rue.4
new file mode 100644
index 000000000000..06f91e8a0a02
--- /dev/null
+++ b/share/man/man4/rue.4
@@ -0,0 +1,154 @@
+.\"
+.\" Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2011
+.Dt RUE 4
+.Os
+.Sh NAME
+.Nm rue
+.Nd "RealTek RTL8150 USB to Fast Ethernet controller driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device rue"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_rue_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB Ethernet adapters based on the RealTek
+RTL8150 USB to Fast Ethernet controller chip.
+.Pp
+The RTL8150 contains an integrated Fast Ethernet MAC, which supports
+both 10 and 100Mbps speeds in either full or half duplex.
+Although designed to interface with
+100Mbps peripheral, the existing USB standard specifies a maximum
+transfer speed of 12Mbps.
+Users should therefore not expect to actually
+achieve 100Mbps speeds with this device.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable auto selection of the media type and options.
+The user can manually override
+the auto selected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports RealTek RTL8150 based USB Ethernet
+adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+Buffalo (Melco Inc.) LUA-KTX
+.It
+Green House GH-USB100B
+.It
+LinkSys USB100M
+.It
+Billionton 10/100 FastEthernet USBKR2
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "rue%d: watchdog timeout"
+A packet was queued for transmission and a transmit command was
+issued, however the device failed to acknowledge the transmission
+before a timeout expired.
+.It "rue%d: rx list init failed"
+The driver failed to allocate an mbuf for the transmitter ring.
+.It "rue%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Rs
+.%T "RealTek RTL8150 data sheet"
+.%U http://pdf.seekdatasheet.com/2008714/200807142333305235.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Shunsuke Akiyama Aq akiyama@FreeBSD.org .
diff --git a/share/man/man4/rum.4 b/share/man/man4/rum.4
new file mode 100644
index 000000000000..6e456894175a
--- /dev/null
+++ b/share/man/man4/rum.4
@@ -0,0 +1,187 @@
+.\"
+.\" Copyright (c) 2005-2007
+.\" Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2008
+.Dt RUM 4
+.Os
+.Sh NAME
+.Nm rum
+.Nd Ralink Technology USB IEEE 802.11a/b/g wireless network device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device rum"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_rum_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports USB 2.0 and PCI Express Mini Card wireless adapters
+based on the Ralink RT2501USB and RT2601USB chipsets.
+.Pp
+Ralink PCI Express Mini Card adapters show up as normal USB 2.0
+devices and are thus handled by the
+.Nm
+driver.
+.Pp
+The RT2501USB chipset is the second generation of 802.11a/b/g adapters from
+Ralink.
+It consists of two integrated chips, an RT2571W MAC/BBP and an RT2528 or
+RT5226 radio transceiver.
+.Pp
+The RT2601USB chipset consists of two integrated chips, an RT2671
+MAC/BBP and an RT2527 or RT5225 radio transceiver.
+This chipset uses the MIMO (multiple-input multiple-output) technology
+with multiple antennas to extend the operating range of the adapter
+and to achieve higher throughput.
+.Pp
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+.Cm hostap ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports USB 2.0 wireless
+adapters based on the Ralink RT2501USB and RT2601USB chipsets,
+including:
+.Pp
+.Bl -column -compact "Atlantis Land A02-PCM-W54" "Bus"
+.It Em Card Ta Em Bus
+.It "3Com Aolynk WUB320g" Ta USB
+.It "Abocom WUG2700 Ta" Ta USB
+.It "Airlink101 AWLL5025" Ta USB
+.It "ASUS WL-167g ver 2" Ta USB
+.It "Belkin F5D7050 ver 3" Ta USB
+.It "Belkin F5D9050 ver 3" Ta USB
+.It "Buffalo WLI-U2-SG54HP" Ta USB
+.It "Buffalo WLI-U2-SG54HG" Ta USB
+.It "Buffalo WLI-U2-G54HP" Ta USB
+.It "Buffalo WLI-UC-G" Ta USB
+.It "CNet CWD-854 ver F" Ta USB
+.It "Conceptronic C54RU ver 2" Ta USB
+.It "Corega CG-WLUSB2GO" Ta USB
+.It "D-Link DWA-110" Ta USB
+.It "D-Link DWA-111" Ta USB
+.It "D-Link DWL-G122 rev C1" Ta USB
+.It "D-Link WUA-1340" Ta USB
+.It "Digitus DN-7003GR" Ta USB
+.It "Edimax EW-7318USG" Ta USB
+.It "Gigabyte GN-WB01GS" Ta USB
+.It "Gigabyte GN-WI05GS" Ta USB
+.It "Hawking HWUG1" Ta USB
+.It "Hawking HWU54DM" Ta USB
+.It "Hercules HWGUSB2-54-LB" Ta USB
+.It "Hercules HWGUSB2-54V2-AP" Ta USB
+.It "LevelOne WNC-0301USB v3" Ta USB
+.It "Linksys WUSB54G rev C" Ta USB
+.It "Linksys WUSB54GR" Ta USB
+.It "Planex GW-US54HP" Ta USB
+.It "Planex GW-US54Mini2" Ta USB
+.It "Planex GW-USMM" Ta USB
+.It "Senao NUB-3701" Ta USB
+.It "Sitecom WL-113 ver 2" Ta USB
+.It "Sitecom WL-172" Ta USB
+.It "Sweex LW053" Ta USB
+.It "TP-LINK TL-WN321G" Ta USB
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev rum0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev rum0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev rum0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev rum0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "rum%d: could not load 8051 microcode"
+An error occurred while attempting to upload the microcode to the onboard 8051
+microcontroller unit.
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr ifconfig 8 ,
+.Xr hostapd 8 ,
+.Xr wpa_supplicant 8 .
+.Rs
+.%T "Ralink Technology"
+.%U http://www.ralinktech.com/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.0 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Niall O'Higgins Aq niallo@openbsd.org
+and
+.An Damien Bergamini Aq damien@openbsd.org .
+.Sh BUGS
+Host AP mode doesn't support client power save.
+Clients using power save mode will experience
+packet loss (disabling power saving on the client will fix this).
diff --git a/share/man/man4/run.4 b/share/man/man4/run.4
new file mode 100644
index 000000000000..5f895e1a29d1
--- /dev/null
+++ b/share/man/man4/run.4
@@ -0,0 +1,229 @@
+.\" $OpenBSD: run.4,v 1.22 2009/11/23 06:16:32 jmc Exp $
+.\"
+.\" Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 12, 2011
+.Dt RUN 4
+.Os
+.Sh NAME
+.Nm run
+.Nd Ralink Technology USB IEEE 802.11a/g/n wireless network device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device run"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Ed
+.Pp
+Firmware is also needed, and provided by:
+.Bd -ragged -offset indent
+.Cd "device runfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_run_load="YES"
+runfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports USB 2.0 wireless adapters based on the Ralink RT2700U,
+RT2800U and RT3000U chipsets.
+.Pp
+The RT2700U chipset consists of two integrated chips, an RT2770 MAC/BBP and
+an RT2720 (1T2R) or RT2750 (dual-band 1T2R) radio transceiver.
+.Pp
+The RT2800U chipset consists of two integrated chips, an RT2870 MAC/BBP and
+an RT2820 (2T3R) or RT2850 (dual-band 2T3R) radio transceiver.
+.Pp
+The RT3000U is a single-chip solution based on an RT3070 MAC/BBP and
+an RT3020 (1T1R), RT3021 (1T2R) or RT3022 (2T2R) single-band radio
+transceiver.
+.Pp
+These are the modes the
+.Nm
+driver can operate in:
+.Bl -tag -width "IBSS-masterXX"
+.It BSS mode
+Also known as
+.Em infrastructure
+mode, this is used when associating with an access point, through
+which all traffic passes.
+This mode is the default.
+.It Host AP mode
+In this mode the driver acts as an access point (base station)
+for other cards.
+.It monitor mode
+In this mode the driver is able to receive packets without
+associating with an access point.
+This disables the internal receive filter and enables the card to
+capture packets from networks which it wouldn't normally have access to,
+or to scan for access points.
+.El
+.Pp
+The
+.Nm
+driver can be configured to use
+Wired Equivalent Privacy (WEP) or
+Wi-Fi Protected Access (WPA-PSK and WPA2-PSK).
+WPA is the de facto encryption standard for wireless networks.
+It is strongly recommended that WEP
+not be used as the sole mechanism
+to secure wireless communication,
+due to serious weaknesses in it.
+The
+.Nm
+driver offloads both encryption and decryption of data frames to the
+hardware for the WEP40, WEP104, TKIP(+MIC) and CCMP ciphers.
+.Pp
+The
+.Nm
+driver can be configured at runtime with
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following wireless adapters:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It Airlink101 AWLL6090
+.It ASUS USB-N11
+.It ASUS USB-N13
+.It ASUS WL-160N
+.It Belkin F5D8051 ver 3000
+.It Belkin F5D8053
+.It Belkin F5D8055
+.It Belkin F6D4050 ver 1
+.It Buffalo WLI-UC-AG300N
+.It Buffalo WLI-UC-G300N
+.It Buffalo WLI-UC-G301N
+.It Buffalo WLI-UC-GN
+.It Corega CG-WLUSB2GNL
+.It Corega CG-WLUSB2GNR
+.It Corega CG-WLUSB300AGN
+.It Corega CG-WLUSB300GNM
+.It D-Link DWA-130 rev B1
+.It D-Link DWA-140
+.It DrayTek Vigor N61
+.It Edimax EW-7711UAn
+.It Edimax EW-7711UTn
+.It Edimax EW-7717Un
+.It Edimax EW-7718Un
+.It Gigabyte GN-WB30N
+.It Gigabyte GN-WB31N
+.It Gigabyte GN-WB32L
+.It Hawking HWDN1
+.It Hawking HWUN1
+.It Hawking HWUN2
+.It Hercules HWNU-300
+.It Linksys WUSB54GC v3
+.It Linksys WUSB600N
+.It Mvix Nubbin MS-811N
+.It Planex GW-USMicroN
+.It Planex GW-US300MiniS
+.It Sitecom WL-182
+.It Sitecom WL-188
+.It Sitecom WL-301
+.It Sitecom WL-302
+.It Sitecom WL-315
+.It SMC SMCWUSBS-N2
+.It Sweex LW303
+.It Sweex LW313
+.It Unex DNUR-81
+.It Unex DNUR-82
+.It ZyXEL NWD210N
+.It ZyXEL NWD270N
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev run0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev run0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev run0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev run0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "run%d: faild load firmware of file runfw"
+For some reason, the driver was unable to read the microcode file from the
+filesystem.
+The file might be missing or corrupted.
+.It "run%d: could not load 8051 microcode"
+An error occurred while attempting to upload the microcode to the onboard 8051
+microcontroller unit.
+.It "run%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr runfw 4 ,
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr ifconfig 8 ,
+.Xr hostapd 8 ,
+.Xr wpa_supplicant 8 .
+.Pp
+Ralink Technology:
+.Pa http://www.ralinktech.com/
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.5 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien@openbsd.org .
+.Sh CAVEATS
+The
+.Nm
+driver does not support any of the 802.11n capabilities offered by the
+RT2800 and RT3000 chipsets.
diff --git a/share/man/man4/runfw.4 b/share/man/man4/runfw.4
new file mode 100644
index 000000000000..6bb86c742273
--- /dev/null
+++ b/share/man/man4/runfw.4
@@ -0,0 +1,50 @@
+.\" Copyright (c) 2010 Akinori Furukoshi <moonlightakkiy@yahoo.ca>
+.\" Copyright (c) 2010 Warren Block <wblock@wonkity.com>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 12, 2011
+.Dt RUNFW 4
+.Os
+.Sh NAME
+.Nm runfw
+.Nd "Firmware Module for Ralink driver"
+.Sh SYNOPSIS
+To compile this module into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device runfw"
+.Ed
+.Pp
+This will include two firmware images, RT2870 and RT3071, inside the kernel.
+.Xr run 4
+will load the appropriate image into the chip.
+.Pp
+Alternatively, to load the firmware images as a module at boot time, place
+the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+runfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module provides firmware sets for the Ralink RT2700U,
+RT2800U and RT3000U chip based USB WiFi adapters.
+Please read Ralink's license, src/sys/contrib/dev/run/LICENSE.
+.Sh SEE ALSO
+.Xr run 4 ,
+.Xr firmware 9
diff --git a/share/man/man4/sa.4 b/share/man/man4/sa.4
new file mode 100644
index 000000000000..eae3bf5b1fd5
--- /dev/null
+++ b/share/man/man4/sa.4
@@ -0,0 +1,247 @@
+.\" Copyright (c) 1996
+.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1999
+.Dt SA 4
+.Os
+.Sh NAME
+.Nm sa
+.Nd SCSI Sequential Access device driver
+.Sh SYNOPSIS
+.Cd device sa
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all
+.Tn SCSI
+devices of the sequential access class that are attached to the system
+through a supported
+.Tn SCSI
+Host Adapter.
+The sequential access class includes tape and other linear access devices.
+.Pp
+A
+.Tn SCSI
+Host
+adapter must also be separately configured into the system
+before a
+.Tn SCSI
+sequential access device can be configured.
+.Sh MOUNT SESSIONS
+The
+.Nm
+driver is based around the concept of a
+.Dq Em mount session ,
+which is defined as the period between the time that a tape is
+mounted, and the time when it is unmounted.
+Any parameters set during
+a mount session remain in effect for the remainder of the session or
+until replaced.
+The tape can be unmounted, bringing the session to a
+close in several ways.
+These include:
+.Bl -enum
+.It
+Closing a `rewind device',
+referred to as sub-mode 00 below.
+An example is
+.Pa /dev/sa0 .
+.It
+Using the MTOFFL
+.Xr ioctl 2
+command, reachable through the
+.Sq Cm offline
+command of
+.Xr mt 1 .
+.El
+.Pp
+It should be noted that tape devices are exclusive open devices, except in
+the case where a control mode device is opened.
+In the latter case, exclusive
+access is only sought when needed (e.g., to set parameters).
+.Sh SUB-MODES
+Bits 0 and 1 of the minor number are interpreted as
+.Sq sub-modes .
+The sub-modes differ in the action taken when the device is closed:
+.Bl -tag -width XXXX
+.It 00
+A close will rewind the device; if the tape has been
+written, then a file mark will be written before the rewind is requested.
+The device is unmounted.
+.It 01
+A close will leave the tape mounted.
+If the tape was written to, a file mark will be written.
+No other head positioning takes place.
+Any further reads or writes will occur directly after the
+last read, or the written file mark.
+.It 10
+A close will rewind the device.
+If the tape has been
+written, then a file mark will be written before the rewind is requested.
+On completion of the rewind an unload command will be issued.
+The device is unmounted.
+.El
+.Sh BLOCKING MODES
+.Tn SCSI
+tapes may run in either
+.Sq Em variable
+or
+.Sq Em fixed
+block-size modes.
+Most
+.Tn QIC Ns -type
+devices run in fixed block-size mode, where most nine-track tapes and
+many new cartridge formats allow variable block-size.
+The difference between the two is as follows:
+.Bl -inset
+.It Variable block-size:
+Each write made to the device results in a single logical record
+written to the tape.
+One can never read or write
+.Em part
+of a record from tape (though you may request a larger block and read
+a smaller record); nor can one read multiple blocks.
+Data from a single write is therefore read by a single read.
+The block size used
+may be any value supported by the device, the
+.Tn SCSI
+adapter and the system (usually between 1 byte and 64 Kbytes,
+sometimes more).
+.Pp
+When reading a variable record/block from the tape, the head is
+logically considered to be immediately after the last item read,
+and before the next item after that.
+If the next item is a file mark,
+but it was never read, then the next
+process to read will immediately hit the file mark and receive an end-of-file notification.
+.It Fixed block-size:
+Data written by the user is passed to the tape as a succession of
+fixed size blocks.
+It may be contiguous in memory, but it is
+considered to be a series of independent blocks.
+One may never write
+an amount of data that is not an exact multiple of the blocksize.
+One may read and write the same data as a different set of records.
+In other words, blocks that were written together may be read separately,
+and vice-versa.
+.Pp
+If one requests more blocks than remain in the file, the drive will
+encounter the file mark.
+As there is some data to return (unless
+there were no records before the file mark), the read will succeed,
+returning that data.
+The next read will return immediately with a value
+of 0.
+(As above, if the file mark is never read, it remains for the next
+process to read if in no-rewind mode.)
+.El
+.Sh FILE MARK HANDLING
+The handling of file marks on write is automatic.
+If the user has
+written to the tape, and has not done a read since the last write,
+then a file mark will be written to the tape when the device is
+closed.
+If a rewind is requested after a write, then the driver
+assumes that the last file on the tape has been written, and ensures
+that there are two file marks written to the tape.
+The exception to
+this is that there seems to be a standard (which we follow, but do not
+understand why) that certain types of tape do not actually write two
+file marks to tape, but when read, report a `phantom' file mark when the
+last file is read.
+These devices include the QIC family of devices.
+(It might be that this set of devices is the same set as that of fixed
+block devices.
+This has not been determined yet, and they are treated
+as separate behaviors by the driver at this time.)
+.Sh IOCTLS
+The
+.Nm
+driver supports all of the ioctls of
+.Xr mtio 4 .
+.Sh FILES
+.Bl -tag -width /dev/[n][e]sa[0-9] -compact
+.It Pa /dev/[n][e]sa[0-9]
+general form:
+.It Pa /dev/sa0
+Rewind on close
+.It Pa /dev/nsa0
+No rewind on close
+.It Pa /dev/esa0
+Eject on close (if capable)
+.It Pa /dev/sa0.ctl
+Control mode device (to examine state while another program is
+accessing the device, e.g.).
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr mt 1
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for the
+.Tn CAM
+.Tn SCSI
+subsystem by
+.An Justin T. Gibbs
+and
+.An Kenneth Merry .
+Many ideas were gleaned from the
+.Nm st
+device driver written and ported from
+.Tn Mach
+2.5
+by
+.An Julian Elischer .
+.Pp
+The current owner of record is
+.An Matthew Jacob
+who has suffered too many
+years of breaking tape drivers.
+.Sh BUGS
+This driver lacks many of the hacks required to deal with older devices.
+Many older
+.Tn SCSI-1
+devices may not work properly with this driver yet.
+.Pp
+Additionally, certain
+tapes (QIC tapes mostly) that were written under
+.Fx
+2.X
+are not automatically read correctly with this driver: you may need to
+explicitly set variable block mode or set to the blocksize that works best
+for your device in order to read tapes written under
+.Fx
+2.X.
+.Pp
+Fine grained density and compression mode support that is bound to specific
+device names needs to be added.
+.Pp
+Support for fast indexing by use of partitions is missing.
diff --git a/share/man/man4/safe.4 b/share/man/man4/safe.4
new file mode 100644
index 000000000000..5cb085fd2bdc
--- /dev/null
+++ b/share/man/man4/safe.4
@@ -0,0 +1,129 @@
+.\"-
+.\" Copyright (c) 2003 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"/
+.Dd April 1, 2006
+.Dt SAFE 4
+.Os
+.Sh NAME
+.Nm safe
+.Nd SafeNet crypto accelerator
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device cryptodev"
+.Cd "device safe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+safe_load="YES"
+.Ed
+.Pp
+.Nm sysctl Va hw.safe.debug
+.Nm sysctl Va hw.safe.dump
+.Nm sysctl Va hw.safe.rnginterval
+.Nm sysctl Va hw.safe.rngbufsize
+.Nm sysctl Va hw.safe.rngmaxalarm
+.Sh DESCRIPTION
+The
+.Nm
+driver supports cards containing SafeNet crypto accelerator chips.
+.Pp
+The
+.Nm
+driver registers itself to accelerate DES, Triple-DES, AES, MD5-HMAC,
+SHA1-HMAC, and NULL operations for
+.Xr ipsec 4
+and
+.Xr crypto 4 .
+.Pp
+On all models, the driver registers itself to provide random data to the
+.Xr random 4
+subsystem.
+Periodically the driver will poll the hardware RNG and retrieve
+data for use by the system.
+If the driver detects that the hardware RNG is resonating with any local
+signal, it will reset the oscillators that generate random data.
+Three
+.Xr sysctl 8
+settings control this procedure:
+.Va hw.safe.rnginterval
+specifies the time, in seconds, between polling operations,
+.Va hw.safe.rngbufsize
+specifies the number of 32-bit words to retrieve on each poll,
+and
+.Va hw.safe.rngmaxalarm
+specifies the threshold for resetting the oscillators.
+.Pp
+When the driver is compiled with
+.Dv SAFE_DEBUG
+defined, two
+.Xr sysctl 8
+variables are provided for debugging purposes:
+.Va hw.safe.debug
+can be set to a non-zero value to enable debugging messages to be sent
+to the console for each cryptographic operation,
+.Va hw.safe.dump
+is a write-only variable that can be used to force driver state to be sent
+to the console.
+Set this variable to
+.Dq Li ring
+to dump the current state of the descriptor ring,
+to
+.Dq Li dma
+to dump the hardware DMA registers,
+or
+to
+.Dq Li int
+to dump the hardware interrupt registers.
+.Sh HARDWARE
+The
+.Nm
+driver supports cards containing any of the following chips:
+.Bl -tag -width "SafeNet 1141" -offset indent
+.It SafeNet 1141
+The original chipset.
+Supports DES, Triple-DES, AES, MD5, and SHA-1
+symmetric crypto operations, RNG, public key operations, and full IPsec
+packet processing.
+.It SafeNet 1741
+A faster version of the 1141.
+.El
+.Sh SEE ALSO
+.Xr crypt 3 ,
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh BUGS
+Public key support is not implemented.
diff --git a/share/man/man4/sbp.4 b/share/man/man4/sbp.4
new file mode 100644
index 000000000000..eeddd5da02c9
--- /dev/null
+++ b/share/man/man4/sbp.4
@@ -0,0 +1,97 @@
+.\" Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the acknowledgement as bellow:
+.\"
+.\" This product includes software developed by K. Kobayashi
+.\"
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt SBP 4
+.Os
+.Sh NAME
+.Nm sbp
+.Nd Serial Bus Protocol 2 (SBP-2) Mass Storage Devices driver
+.Sh SYNOPSIS
+.Cd "kldload firewire"
+.Cd "kldload cam"
+.Cd "kldload sbp"
+.Pp
+or
+.Pp
+.Cd "device sbp"
+.Cd "device firewire"
+.Cd "device scbus"
+.Cd "device da"
+.Cd "device cd"
+.Cd "device pass"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for SBP-2 devices that attach to the FireWire
+(IEEE 1394) port.
+It should work with SBP-2 devices which the CAM layer supports, for example,
+HDDs, CDROM drives and DVD drives.
+.Pp
+Some users familiar with
+.Xr umass 4
+might wonder why the device is not detached at the CAM layer when the device
+is unplugged.
+It is detached only if the device has not been plugged again
+during several bus resets.
+This is for preventing to detach an active file system
+even when the device cannot be probed correctly for some reason after a bus reset
+or when the device is temporary disconnected because the user changes the bus
+topology.
+If you want to force to detach the device, run
+.Dq Nm fwcontrol Fl r
+several times or set hw.firewire.hold_count=0 by
+.Xr sysctl 8 .
+.Pp
+Some (broken) HDDs do not work well with tagged queuing.
+If you have problems with such drives, try
+.Dq Nm camcontrol [device id] tags -N 1
+to disable tagged queuing.
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr firewire 4 ,
+.Xr camcontrol 8 ,
+.Xr fwcontrol 8 ,
+.Xr kldload 8 ,
+.Xr sysctl 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Katsushi Kobayashi
+and
+.An Hidetoshi Shimokawa .
+.Pp
+This manual page was written by
+.An Katsushi Kobayashi .
diff --git a/share/man/man4/sbp_targ.4 b/share/man/man4/sbp_targ.4
new file mode 100644
index 000000000000..9a81a99a9b42
--- /dev/null
+++ b/share/man/man4/sbp_targ.4
@@ -0,0 +1,98 @@
+.\" Copyright (c) 2003 Hidetoshi Shimokawa
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the acknowledgement as bellow:
+.\"
+.\" This product includes software developed by H. Shimokawa
+.\"
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 7, 2003
+.Dt SBP_TARG 4
+.Os
+.Sh NAME
+.Nm sbp_targ
+.Nd Serial Bus Protocol 2 (SBP-2) Target Mode devices driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sbp_targ"
+.Cd "device firewire"
+.Cd "device scbus"
+.Cd "device targ"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+firewire_load="YES"
+cam_load="YES"
+sbp_targ_load"YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for SBP-2 target mode.
+This driver is supposed to work with
+.Xr cam 4 ,
+.Xr targ 4
+and
+.Xr firewire 4 .
+You also need to use
+.Xr scsi_target 8 ,
+which can be found in
+.Pa /usr/share/examples/scsi_target ,
+to provide actual devices.
+.Sh EXAMPLES
+.Bd -literal -offset indent
+# mdconfig -a -t malloc -s 10m
+md0
+# scsi_target 0:0:0 /dev/md0
+(Assuming sbp_targ0 on scbus0)
+.Ed
+.Sh SEE ALSO
+.Xr cam 4 ,
+.Xr firewire 4 ,
+.Xr targ 4 ,
+.Xr camcontrol 8 ,
+.Xr fwcontrol 8 ,
+.Xr kldload 8 ,
+.Xr scsi_target 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Hidetoshi Shimokawa .
+.Sh BUGS
+This driver is
+.Ud
+It does not work correctly in multi-initiator environments
+or after the bus topology has been changed.
diff --git a/share/man/man4/scc.4 b/share/man/man4/scc.4
new file mode 100644
index 000000000000..b08b3f8dbac6
--- /dev/null
+++ b/share/man/man4/scc.4
@@ -0,0 +1,75 @@
+.\"
+.\" Copyright (c) 2006 Marcel Moolenaar
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2006
+.Dt SCC 4
+.Os
+.\"
+.Sh NAME
+.Nm scc
+.Nd driver for Serial Communications Controllers (SCC) devices
+.\"
+.Sh SYNOPSIS
+.Cd "device scc"
+.Cd "device uart"
+.\"
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for various classes of SCCs.
+It is an umbrella driver that delegates control of each independent
+communication channel to subordinate drivers.
+These subordinate drivers, like
+.Xr uart 4 ,
+take care of the details of the communication itself.
+.\"
+.Sh HARDWARE
+The
+.Nm
+driver supports the following classes of SCCs:
+.Pp
+.Bl -bullet -compact
+.It
+SAB82532: Siemens SAB 82532 based serial communications controllers.
+.It
+Z8530: Zilog 8530 based serial communications controllers.
+.El
+.\"
+.Sh SEE ALSO
+.Xr puc 4 ,
+.Xr uart 4
+.\"
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver and this manual page were written by
+.An Marcel Moolenaar Aq marcel@xcllnt.net .
diff --git a/share/man/man4/scd.4 b/share/man/man4/scd.4
new file mode 100644
index 000000000000..dbbb18f35133
--- /dev/null
+++ b/share/man/man4/scd.4
@@ -0,0 +1,74 @@
+.\"
+.\" Copyright (c) 1995 Jordan K. Hubbard
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 17, 2008
+.Dt SCD 4
+.Os
+.Sh NAME
+.Nm scd
+.Nd Sony CDU31/33 CD-ROM driver
+.Sh SYNOPSIS
+.Cd "device scd"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.scd.0.at="isa"
+.Cd hint.scd.0.port="0x230"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a data interface to the Sony CDU31 and CDU33A CD-ROM
+drives.
+The drive must be hooked to a Sony proprietary interface
+card or a compatible clone.
+.Sh FILES
+.Bl -tag -width /dev/[r]scd0a -compact
+.It Pa /dev/[r]scd0a
+accesses
+.Bx
+partition on the disc.
+Normally, there is only
+one file system on a CDROM disc.
+.It Pa /dev/[r]scd0c
+accesses the raw device.
+.El
+.Sh SEE ALSO
+.Pa /sys/dev/scd/scd.c
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.0.5 .
+.Sh AUTHORS
+.An -nosplit
+The driver was written by
+.An Mikael Hybsch
+with code contributed by
+.An Holger Veit
+and
+.An Brian Moore .
diff --git a/share/man/man4/sched_4bsd.4 b/share/man/man4/sched_4bsd.4
new file mode 100644
index 000000000000..a02c40eb58a8
--- /dev/null
+++ b/share/man/man4/sched_4bsd.4
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2008
+.Dt SCHED_4BSD 4
+.Os
+.Sh NAME
+.Nm sched_4bsd
+.Nd "4.4BSD scheduler"
+.Sh SYNOPSIS
+.Cd "options SCHED_4BSD"
+.Sh DESCRIPTION
+The
+.Nm
+scheduler
+is the traditional system scheduler, providing both high throughput and solid
+interactive response in the presence of load.
+.Pp
+The following sysctls are relevant to the operation of
+.Nm :
+.Bl -tag -width indent
+.It Va kern.sched.name
+This read-only sysctl reports the name of the active scheduler.
+.It Va kern.sched.quantum
+This read-write sysctl reports or sets the length of the quantum (in
+micro-seconds) granted to a thread.
+.It Va kern.sched.ipiwakeup.enabled
+This read-write sysctl sets whether or not the scheduler will generate an
+inter-processor interrupt (IPI) to an idle CPU when a thread is woken up.
+Otherwise, idle CPUs will wait until the next clock tick before looking for
+new work.
+.It Va kern.sched.preemption
+This read-only sysctl reports whether or not the kernel is configured to
+support preemption, which reduces the latency to run lower priority threads
+on wakeup.
+.El
+.Pp
+Some sysctls will be available only on systems supporting SMP.
+.Sh SEE ALSO
+.Xr sched_ule 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+scheduler has been present, in various forms, since the inception of
+.Bx .
+.Sh BUGS
+While a highly robust and time-tested scheduler,
+.Nm
+lacks specific knowledge of how to schedule advantageously in non-symmetric
+processor configurations, such as hyper-threading.
diff --git a/share/man/man4/sched_ule.4 b/share/man/man4/sched_ule.4
new file mode 100644
index 000000000000..fdb96f1c8280
--- /dev/null
+++ b/share/man/man4/sched_ule.4
@@ -0,0 +1,73 @@
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2008
+.Dt SCHED_ULE 4
+.Os
+.Sh NAME
+.Nm sched_ule
+.Nd ULE scheduler
+.Sh SYNOPSIS
+.Cd "options SCHED_ULE"
+.Sh DESCRIPTION
+The
+.Nm
+scheduler
+provides a number of advanced scheduler
+features not present in
+.Xr sched_4bsd 4 ,
+the traditional system scheduler.
+These features address SMP and interactivity and include:
+.Pp
+.Bl -bullet -compact -offset indent
+.It
+Thread CPU affinity.
+.It
+CPU topology awareness, including for hyper-threading.
+.It
+Per-CPU run queues.
+.It
+Interactivity heuristics that detect interactive applications and schedules
+them preferentially under high load.
+.El
+.Pp
+The following sysctls are relevant to the operation of
+.Nm :
+.Bl -tag -width indent
+.It Va kern.sched.name
+This read-only sysctl reports the name of the active scheduler.
+.El
+.Sh SEE ALSO
+.Xr sched_4bsd 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+scheduler first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+.An Jeff Roberson
+.Aq jeff@FreeBSD.org
diff --git a/share/man/man4/screen.4 b/share/man/man4/screen.4
new file mode 100644
index 000000000000..0b6ac2d93133
--- /dev/null
+++ b/share/man/man4/screen.4
@@ -0,0 +1,241 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 6, 2000
+.Dt SCREEN 4
+.Os
+.Sh NAME
+.Nm screen
+.Nd pc display interface
+.Sh DESCRIPTION
+Access to the
+.Em virtual consoles
+are obtained through the device files
+.Pa /dev/ttyv0
+-
+.Pa /dev/ttyvb .
+Each of these files correspond to a separate
+virtual console.
+All virtual console devices can be open at once, but only one is
+active at a time.
+The active virtual console "owns" the keyboard and
+display screen.
+.Pp
+Output to a virtual console that not currently is on the display is
+saved in a buffer that holds a "screenfull" (normally 25) lines.
+Any output written to
+.Pa /dev/console
+(the original console device) is echoed to
+.Pa /dev/ttyv0 .
+.Pp
+To switch between the virtual consoles one uses the sequence
+.Em ALT+Fn ,
+which means hold down ALT and press one of the function keys.
+The
+virtual console with the same number as the function key is then
+selected as the current virtual console, and given exclusive use of
+the keyboard and display.
+This switch sequence can be changed via
+the keyboard mapping ioctl call (see
+.Xr keyboard 4 ) .
+.Pp
+The console allows entering values that are not physically
+present on the keyboard via a special keysequence.
+To use this facility press and hold down ALT,
+then enter a decimal number from 0-255 via the numerical keypad, then
+release ALT.
+The entered value is then used as the ASCII value for one
+character.
+This way it is possible to enter any ASCII value.
+The console driver also includes a history function.
+It is activated by
+pressing the scroll-lock key.
+This holds the display, and enables the cursor
+arrows for scrolling up and down through the last scrolled out lines.
+.Pp
+The console understands a subset of the ANSI x3.64 character
+sequences.
+For compatibility with the old pccons, the PC3 character
+sequences are also supported.
+.Bd -literal
+ANSI Seq Function Termcap entry
+======= ======= ===================================== ==============
+
+-- E7 Save cursor position sc
+
+-- E8 Restore saved cursor position rc
+
+-- Ec Reset rs
+
+-- EM move cursor up 1 line, --
+ scroll if at top
+
+CUU E[nA move cursor up n lines up/UP (ku)
+
+CUD E[nB move cursor down n lines do/DO (kd)
+
+CUF E[nC move cursor right n characters nd/RI (kr)
+
+CUB E[nD move cursor left n characters --/LE (kl)
+
+HPA E[n` move cursor to character position n ch
+
+HPR E[na move cursor right n characters --
+
+VPA E[nd move cursor to line n cv
+
+VPR E[ne move cursor down n lines --
+
+CPL E[nF move cursor to start of line, -- (@7)
+ n lines up
+
+CNL E[nE move cursor to start of line, nw
+ n lines down
+
+CUP E[y;xH Move cursor to x, y cm
+
+HVP E[y;xf Move cursor to x, y --
+
+CBT E[nZ Move cursor back n tab stops bt (kB)
+
+IL E[nL Insert n blank lines al/AL
+
+ICH E[n@ Insert n blank characters ic/IC
+
+DL E[nM Delete n lines dl/DL
+
+DCH E[nP Delete n characters dc/DC
+
+ED E[nJ Erase part or all of display: cd
+ n=0 from cursor to end of display,
+ n=1 from begin of display to cursor,
+ n=2 entire display.
+
+EL E[nK Erase part or all of line: ce
+ n=0 from cursor to end of line,
+ n=1 from begin of line to cursor,
+ n=2 entire line.
+
+ECH E[nX Erase n characters ec
+
+SU E[nS Scroll display n lines up (forward) sf/SF
+
+SD E[nT Scroll display n lines down (reverse) sr/SR
+
+
+SGR E[nm Set character attributes: --
+ n= 0 normal attribute (all off)
+ n= 1 bold (highlight)
+ n= 4 underscore (if supported by HW)
+ n= 5 blink (if supported by HW)
+ n= 7 reverse
+ n= 22 remove bold
+ n= 24 remove underscore
+ n= 25 remove blink
+ n= 27 remove reverse
+ n= 3X set ANSI foreground color
+ (see table)
+ n= 4X set ANSI background color
+ (see table)
+
+ X=0 black X=1 red
+ X=2 green X=3 brown
+ X=4 blue X=5 magenta
+ X=6 cyan X=7 light grey
+ X=9 reset to the normal color
+
+-- E[s Save cursor position sc
+
+-- E[u Restore saved cursor position rc
+
+-- E[x Reset normal colors and attributes --
+ to their default values
+
+-- E[nz Switch to virtual console n --
+
+-- E[1;nx Set normal ANSI background color --
+ to n (see table)
+
+-- E[2;nx Set normal ANSI foreground color --
+ to n (see table)
+
+-- E[3;nx Set normal video attribute directly --
+ to n (n from 0 to 255)
+
+-- E[5;nx Set normal ANSI reverse background --
+ color to n (see table)
+
+-- E[6;nx Set normal ANSI reverse foreground --
+ color to n (see table)
+
+ n= 0 black n= 8 dark grey
+ n= 1 red n= 9 light red
+ n= 2 green n=10 light green
+ n= 3 brown n=11 yellow
+ n= 4 blue n=12 light blue
+ n= 5 magenta n=13 light magenta
+ n= 6 cyan n=14 light cyan
+ n= 7 light grey n=15 white
+
+-- E[7;nx Set normal reverse video attribute --
+ directly to n (n from 0 to 255)
+
+-- E[=p;dB Set bell pitch (p) and duration (d), --
+ pitch is in units of 840 nS,
+ duration is units of 0,1 S.
+
+-- E[=tC Set global cursor type (see table) --
+
+ t=0 normal non-blinking
+ t=1 normal blinking
+ t=2 custom non-blinking
+ t=3 custom blinking
+ t=4 reset cursor (resets custom
+ cursor shape and sets current
+ cursor type to 0)
+ t=5 hide cursor
+
+-- E[=s;eC Set custom cursor shape, where --
+ s is the starting and e is the ending
+ scanlines of the cursor.
+
+-- E[=s;e;dC --
+ Same as above, except d specifies the
+ direction. If 0, scanlines are counted
+ from the top to the bottom. If 1, from
+ the bottom to the top.
+
+-- E[=tS Set local cursor type (see table) --
+
+ t=0 normal (global) ve
+ t=1 invisible vi
+ t=2 very visible vs
+
+-- E[=nA Set the border color to n --
+ (see table) (if supported by HW)
+
+-- E[=nF Set normal foreground color to n --
+ (see table)
+
+-- E[=nG Set normal background color to n --
+ (see table)
+
+-- E[=nH Set normal reverse foreground color --
+ to n (see table)
+
+-- E[=nI Set normal reverse background color --
+ to n (see table)
+
+ n= 0 black n= 8 dark grey
+ n= 1 blue n= 9 light blue
+ n= 2 green n=10 light green
+ n= 3 cyan n=11 light cyan
+ n= 4 red n=12 light red
+ n= 5 magenta n=13 light magenta
+ n= 6 brown n=14 yellow
+ n= 7 light grey n=15 white
+
+note: the first E in the sequences stands for ESC (0x1b)
+.Ed
+.Sh AUTHORS
+.An S\(/oren Schmidt Aq sos@FreeBSD.org
diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4
new file mode 100644
index 000000000000..ad52663c070d
--- /dev/null
+++ b/share/man/man4/scsi.4
@@ -0,0 +1,363 @@
+.\" Copyright (c) 1996
+.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd March 4, 2010
+.Dt CAM 4
+.Os
+.Sh NAME
+.Nm CAM
+.Nd Common Access Method SCSI/ATA subsystem
+.Sh SYNOPSIS
+.Cd "device scbus"
+.Cd "device ada"
+.Cd "device cd"
+.Cd "device ch"
+.Cd "device da"
+.Cd "device pass"
+.Cd "device pt"
+.Cd "device sa"
+.Cd "options CAMDEBUG"
+.Cd "options CAM_DEBUG_BUS=-1"
+.Cd "options CAM_DEBUG_TARGET=-1"
+.Cd "options CAM_DEBUG_LUN=-1"
+.Cd "options CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_CDB"
+.Cd "options CAM_MAX_HIGHPOWER=4"
+.Cd "options SCSI_NO_SENSE_STRINGS"
+.Cd "options SCSI_NO_OP_STRINGS"
+.Cd "options SCSI_DELAY=8000"
+.Sh DESCRIPTION
+The
+.Nm
+subsystem provides a uniform and modular system for the implementation
+of drivers to control various
+.Tn SCSI
+and
+.Tn ATA
+devices, and to utilize different
+.Tn SCSI
+and
+.Tn ATA
+host adapters through host adapter drivers.
+When the system probes busses, it attaches any devices it finds to the
+appropriate drivers.
+The
+.Xr pass 4
+driver, if it is configured in the kernel, will attach to all devices.
+.Sh KERNEL CONFIGURATION
+There are a number of generic kernel configuration options for the
+.Nm
+subsystem:
+.Bl -tag -width SCSI_NO_SENSE_STRINGS
+.It Dv CAMDEBUG
+This option enables the
+.Nm
+debugging printf code.
+This will not actually
+cause any debugging information to be printed out when included by itself.
+Enabling printouts requires additional configuration.
+See below for details.
+.It Dv "CAM_MAX_HIGHPOWER=4"
+This sets the maximum allowable number of concurrent "high power" commands.
+A "high power" command is a command that takes more electrical power than
+most to complete.
+An example of this is the
+.Tn SCSI
+START UNIT command.
+Starting a disk often takes significantly more electrical power than normal
+operation.
+This option allows the
+user to specify how many concurrent high power commands may be outstanding
+without overloading the power supply on his computer.
+.It Dv SCSI_NO_SENSE_STRINGS
+This eliminates text descriptions of each
+.Tn SCSI
+Additional Sense Code and Additional Sense Code Qualifier pair.
+Since this
+is a fairly large text database, eliminating it reduces the size of the
+kernel somewhat.
+This is primarily necessary for boot floppies and other
+low disk space or low memory space environments.
+In most cases, though,
+this should be enabled, since it speeds the interpretation of
+.Tn SCSI
+error messages.
+Do not let the "kernel bloat" zealots get to you -- leave
+the sense descriptions in your kernel!
+.It Dv SCSI_NO_OP_STRINGS
+This disables text descriptions of each
+.Tn SCSI
+opcode.
+This option, like the sense string option above, is primarily
+useful for environments like a boot floppy where kernel size is critical.
+Enabling this option for normal use is not recommended, since it slows
+debugging of
+.Tn SCSI
+problems.
+.It Dv SCSI_DELAY=8000
+This is the
+.Tn SCSI
+"bus settle delay."
+In
+.Nm ,
+it is specified in
+.Em milliseconds ,
+not seconds like the old
+.Tn SCSI
+layer used to do.
+When the kernel boots, it sends a bus reset to each
+.Tn SCSI
+bus to tell each device to reset itself to a default set of transfer
+negotiations and other settings.
+Most
+.Tn SCSI
+devices need some amount of time to recover from a bus reset.
+Newer disks
+may need as little as 100ms, while old, slow devices may need much longer.
+If the
+.Dv SCSI_DELAY
+is not specified, it defaults to 2 seconds.
+The minimum allowable value for
+.Dv SCSI_DELAY
+is "100", or 100ms.
+One special case is that if the
+.Dv SCSI_DELAY
+is set to 0, that will be taken to mean the "lowest possible value."
+In that case, the
+.Dv SCSI_DELAY
+will be reset to 100ms.
+.El
+.Pp
+All devices and busses support dynamic allocation so that
+an upper number of devices and controllers does not need to be configured;
+.Cd "device da"
+will suffice for any number of disk drivers.
+.Pp
+The devices are either
+.Em wired
+so they appear as a particular device unit or
+.Em counted
+so that they appear as the next available unused unit.
+.Pp
+Units are wired down by setting kernel environment hints.
+This is usually done either interactively from the
+.Xr loader 8 ,
+or automatically via the
+.Pa /boot/device.hints
+file.
+The basic syntax is:
+.Bd -literal -offset indent
+hint.device.unit.property="value"
+.Ed
+.Pp
+Individual
+.Nm
+bus numbers can be wired down to specific controllers with
+a config line similar to the following:
+.Bd -literal -offset indent
+hint.scbus.0.at="ahd1"
+.Ed
+.Pp
+This assigns
+.Nm
+bus number 0 to the
+.Em ahd1
+driver instance.
+For controllers supporting more than one bus, a particular bus can be assigned
+as follows:
+.Bd -literal -offset indent
+hint.scbus.0.at="ahc1"
+hint.scbus.0.bus="1"
+.Ed
+.Pp
+This assigns
+.Nm
+bus 0 to the bus 1 instance on
+.Em ahc0 .
+Peripheral drivers can be wired to a specific bus, target, and lun as so:
+.Bd -literal -offset indent
+hint.da.0.at="scbus0"
+hint.da.0.target="0"
+hint.da.0.unit="0"
+.Ed
+.Pp
+This assigns
+.Em da0
+to target 0, unit (lun) 0 of scbus 0.
+Omitting the target or unit hints will instruct
+.Nm
+to treat them as wildcards
+and use the first respective counted instances.
+These examples can be combined together to allow a peripheral device to be
+wired to any particular controller, bus, target, and/or unit instance.
+.Pp
+When you have a mixture of wired down and counted devices then the
+counting begins with the first non-wired down unit for a particular
+type.
+That is, if you have a disk wired down as
+.Em "device da1" ,
+then the first non-wired disk shall come on line as
+.Em da2 .
+.Sh ADAPTERS
+The system allows common device drivers to work through many different
+types of adapters.
+The adapters take requests from the upper layers and do
+all IO between the
+.Tn SCSI
+or
+.Tn ATA
+bus and the system.
+The maximum size of a transfer is governed by the
+adapter.
+Most adapters can transfer 64KB in a single operation, however
+many can transfer larger amounts.
+.Sh TARGET MODE
+Some adapters support
+.Em target mode
+in which the system is capable of operating as a device, responding to
+operations initiated by another system.
+Target mode is supported for
+some adapters, but is not yet complete for this version of the
+.Nm
+.Tn SCSI
+subsystem.
+.Sh FILES
+see other
+.Nm
+device entries.
+.Sh DIAGNOSTICS
+When the kernel is compiled with options CAMDEBUG, an XPT_DEBUG CCB can be
+used to enable various amounts of tracing information on any
+specific device.
+Devices not being traced will not produce trace information.
+There are currently four debugging flags that may be turned on:
+.Bl -tag -width CAM_DEBUG_SUBTRACE
+.It Dv CAM_DEBUG_INFO
+This debugging flag enables general informational printfs for the device
+or devices in question.
+.It Dv CAM_DEBUG_TRACE
+This debugging flag enables function-level command flow tracing.
+i.e.\&
+kernel printfs will happen at the entrance and exit of various functions.
+.It Dv CAM_DEBUG_SUBTRACE
+This debugging flag enables debugging output internal to various functions.
+.It Dv CAM_DEBUG_CDB
+This debugging flag will cause the kernel to print out all
+.Tn SCSI
+commands sent to a particular device or devices.
+.El
+.Pp
+Some of these flags, most notably
+.Dv CAM_DEBUG_TRACE
+and
+.Dv CAM_DEBUG_SUBTRACE
+will produce kernel printfs in EXTREME numbers,
+and because of that, they are not especially useful.
+There are not many things logged at the
+.Dv CAM_DEBUG_INFO
+level, so it is not especially useful.
+The most useful debugging flag is the
+.Dv CAM_DEBUG_CDB
+flag.
+Users can enable debugging from their kernel config file, by using
+the following kernel config options:
+.Bl -tag -width CAM_DEBUG_TARGET
+.It Dv CAMDEBUG
+This enables
+.Nm
+debugging.
+Without this option, users will not even be able
+to turn on debugging from userland via
+.Xr camcontrol 8 .
+.It Dv CAM_DEBUG_FLAGS
+This allows the user to set the various debugging flags described above
+in a kernel config file.
+Flags may be ORed together if the user wishes to
+see printfs for multiple debugging levels.
+.It Dv CAM_DEBUG_BUS
+Specify a bus to debug.
+To debug all busses, set this to -1.
+.It Dv CAM_DEBUG_TARGET
+Specify a target to debug.
+To debug all targets, set this to -1.
+.It Dv CAM_DEBUG_LUN
+Specify a lun to debug.
+To debug all luns, set this to -1.
+.El
+.Pp
+When specifying a bus, target or lun to debug, you
+.Em MUST
+specify all three bus/target/lun options above.
+Using wildcards, you
+should be able to enable debugging on most anything.
+.Pp
+Users may also enable debugging printfs on the fly, if the
+.Dv CAMDEBUG
+option is their config file, by using the
+.Xr camcontrol 8
+utility.
+See
+.Xr camcontrol 8
+for details.
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr aha 4 ,
+.Xr ahb 4 ,
+.Xr ahc 4 ,
+.Xr ahci 4 ,
+.Xr ata 4 ,
+.Xr bt 4 ,
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr pass 4 ,
+.Xr pt 4 ,
+.Xr sa 4 ,
+.Xr xpt 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The
+.Nm
+.Tn SCSI
+subsystem first appeared in
+.Fx 3.0 .
+The
+.Nm
+ATA support was added in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+.Tn SCSI
+subsystem was written by
+.An Justin Gibbs
+and
+.An Kenneth Merry .
+The
+.Nm
+.Tn ATA
+support was added by
+.An Alexander Motin Aq mav@FreeBSD.org .
diff --git a/share/man/man4/sctp.4 b/share/man/man4/sctp.4
new file mode 100644
index 000000000000..8547428a10c8
--- /dev/null
+++ b/share/man/man4/sctp.4
@@ -0,0 +1,425 @@
+.\" Copyright (c) 2006, Randall Stewart.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2006
+.Dt SCTP 4
+.Os
+.Sh NAME
+.Nm sctp
+.Nd Internet Stream Control Transmission Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/sctp.h
+.Ft int
+.Fn socket AF_INET SOCK_STREAM IPPROTO_SCTP
+.Ft int
+.Fn socket AF_INET SOCK_SEQPACKET IPPROTO_SCTP
+.Sh DESCRIPTION
+The
+.Tn SCTP
+protocol provides reliable, flow-controlled, two-way
+transmission of data.
+It is a message oriented protocol and can
+support the
+.Dv SOCK_STREAM
+and
+.Dv SOCK_SEQPACKET
+abstractions.
+.Tn SCTP
+uses the standard
+Internet address format and, in addition, provides a per-host
+collection of
+.Dq "port addresses" .
+Thus, each address is composed of an Internet address specifying
+the host and network, with a specific
+.Tn SCTP
+port on the host identifying the peer entity.
+.Pp
+There are two models of programming in SCTP.
+The first uses the
+.Dv SOCK_STREAM
+abstraction.
+In this abstraction sockets utilizing the
+.Tn SCTP
+protocol are either
+.Dq active
+or
+.Dq passive .
+Active sockets initiate connections to passive
+sockets.
+By default,
+.Tn SCTP
+sockets are created active; to create a
+passive socket, the
+.Xr listen 2
+system call must be used after binding the socket with the
+.Xr bind 2
+or
+.Xr sctp_bindx 3
+system calls.
+Only passive sockets may use the
+.Xr accept 2
+call to accept incoming connections.
+Only active sockets may use the
+.Xr connect 2
+call to initiate connections.
+.Pp
+The other abstraction
+.Dv SOCK_SEQPACKET
+provides a
+.Dq connectionless
+mode of operation in that the user may send to an address
+(using any of the valid send calls that carry a
+socket address) and an association will be setup
+implicitly by the underlying
+.Tn SCTP
+transport stack.
+This abstraction is the only one capable of sending data on the
+third leg of the four-way handshake.
+A user must still call
+.Xr listen 2
+to allow the socket to accept connections.
+Calling
+.Xr listen 2
+however does not restrict the user from still initiating
+implicit connections to other peers.
+.Pp
+The
+.Tn SCTP
+protocol directly supports multi-homing.
+So when binding a socket with the
+.Dq wildcard
+address
+.Dv INADDR_ANY ,
+the
+.Tn SCTP
+stack will inform the peer about all of the local addresses
+that are deemed in scope of the peer.
+The peer will then possibly have multiple paths to reach the local host.
+.Pp
+The
+.Tn SCTP
+transport protocol is also multi-streamed.
+Multi-streaming refers to the ability to send sub-ordered flows of
+messages.
+A user performs this by specifying a specific stream in one of the
+extended send calls such as the
+.Xr sctp_send 3
+function call.
+Sending messages on different streams will allow parallel delivery
+of data i.e., a message loss in stream 1 will not block the delivery
+of messages sent in stream 2.
+.Pp
+The
+.Tn SCTP
+transport protocol also provides a unordered service as well.
+The unordered service allows a message to be sent and delivered
+with no regard to the ordering of any other message.
+.Ss Extensions
+The FreeBSD implementation of
+.Tn SCTP
+also supports the following extensions:
+.Bl -hang -width indent
+.It "sctp partial reliability"
+This extension allows one to have message be skipped and
+not delivered based on some user specified parameters.
+.It "sctp dynamic addressing"
+This extension allows addresses to be added and deleted
+dynamically from an existing association.
+.It "sctp authentication"
+This extension allows the user to authenticate specific
+peer chunks (including data) to validate that the peer
+who sent the message is in fact the peer who setup the
+association.
+A shared key option is also provided for
+so that two stacks can pre-share keys.
+.It "packet drop"
+Some routers support a special satellite protocol that
+will report losses due to corruption.
+This allows retransmissions without subsequent loss in bandwidth
+utilization.
+.It "stream reset"
+This extension allows a user on either side to reset the
+stream sequence numbers used by any or all streams.
+.El
+.Pp
+.Tn SCTP
+supports a number of socket options which can be set with
+.Xr setsockopt 2
+and tested with
+.Xr getsockopt 2
+or
+.Xr sctp_opt_info 3 :
+.Bl -tag -width ".Dv SCTP_SET_PEER_PRIMARY_ADDR"
+.It Dv SCTP_NODELAY
+Under most circumstances,
+.Tn SCTP
+sends data when it is presented; when outstanding data has not
+yet been acknowledged, it gathers small amounts of output to be
+sent in a single packet once an acknowledgement is received.
+For some clients, such as window systems that send a stream of
+mouse events which receive no replies, this packetization may
+cause significant delays.
+The boolean option
+.Dv SCTP_NODELAY
+defeats this algorithm.
+.It Dv SCTP_RTOINFO
+This option returns specific information about an associations
+.Dq "Retransmission Time Out" .
+It can also be used to change the default values.
+.It Dv SCTP_ASSOCINFO
+This option returns specific information about the requested
+association.
+.It Dv SCTP_INITMSG
+This option allows you to get or set the default sending
+parameters when an association is implicitly setup.
+It allows you to change such things as the maximum number of
+streams allowed inbound and the number of streams requested
+of the peer.
+.It Dv SCTP_AUTOCLOSE
+For the one-to-many model
+.Dv ( SOCK_SEQPACKET )
+associations are setup implicitly.
+This option allows the user to specify a default number of idle
+seconds to allow the association be maintained.
+After the idle timer (where no user message have been sent or have
+been received from the peer) the association will be gracefully
+closed.
+The default for this value is 0, or unlimited (i.e., no automatic
+close).
+.It Dv SCTP_SET_PEER_PRIMARY_ADDR
+The dynamic address extension allows a peer to also request a
+particular address of its be made into the primary address.
+This option allows the caller to make such a request to a peer.
+Note that if the peer does not also support the dynamic address
+extension, this call will fail.
+Note the caller must provide a valid local address that the peer has
+been told about during association setup or dynamically.
+.It Dv SCTP_PRIMARY_ADDR
+This option allows the setting of the primary address
+that the caller wishes to send to.
+The caller provides the address of a peer that is to be made primary.
+.It Dv SCTP_ADAPTATION_LAYER
+The dynamic address extension also allows a user to
+pass a 32 bit opaque value upon association setup.
+This option allows a user to set or get this value.
+.It Dv SCTP_DISABLE_FRAGMENTS
+By default
+.Tn SCTP
+will fragment user messages into multiple pieces that
+will fit on the network and then later, upon reception, reassemble
+the pieces into a single user message.
+If this option is enabled instead, any send that exceeds the path
+maximum transfer unit (P-MTU) will fail and the message will NOT be
+sent.
+.It Dv SCTP_PEER_ADDR_PARAMS
+This option will allow a user to set or get specific
+peer address parameters.
+.It Dv SCTP_DEFAULT_SEND_PARAM
+When a user does not use one of the extended send
+calls (e.g.,
+.Xr sctp_sendmsg 3 )
+a set of default values apply to each send.
+These values include things like the stream number to send
+to as well as the per-protocol id.
+This option lets a caller both get and set these values.
+If the user changes these default values, then these new values will
+be used as the default whenever no information is provided by the
+sender (i.e., the non-extended API is used).
+.It Dv SCTP_EVENTS
+.Tn SCTP
+has non-data events that it can communicate
+to its application.
+By default these are all disabled since they arrive in the data path
+with a special flag
+.Dv MSG_NOTIFICATION
+set upon the received message.
+This option lets a caller
+both get what events are current being received
+as well as set different events that they may be interested
+in receiving.
+.It Dv SCTP_I_WANT_MAPPED_V4_ADDR
+.Tn SCTP
+supports both IPV4 and IPV6.
+An association may span both IPV4 and IPV6 addresses since
+.Tn SCTP
+is multi-homed.
+By default, when opening an IPV6 socket, when
+data arrives on the socket from a peer's
+V4 address the V4 address will be presented with an address family
+of AF_INET.
+If this is undesirable, then this option
+can be enabled which will then convert all V4 addresses
+into mapped V6 representations.
+.It Dv SCTP_MAXSEG
+By default
+.Tn SCTP
+chooses its message fragmentation point
+based upon the smallest P-MTU of the peer.
+This option lets the caller set it to a smaller value.
+Note that while the user can change this value, if the P-MTU
+is smaller than the value set by the user, then the P-MTU
+value will override any user setting.
+.It Dv SCTP_DELAYED_ACK_TIME
+This option lets the user both set and get the
+delayed ack time (in milliseconds) that
+.Tn SCTP
+is using.
+The default is 200 milliseconds.
+.It Dv SCTP_PARTIAL_DELIVERY_POINT
+.Tn SCTP
+at times may need to start delivery of a
+very large message before the entire message has
+arrived.
+By default SCTP waits until the incoming
+message is larger than one fourth of the receive
+buffer.
+This option allows the stacks value
+to be overridden with a smaller value.
+.It Dv SCTP_FRAGMENT_INTERLEAVE
+.Tn SCTP
+at times will start partial delivery (as mentioned above).
+In the normal case successive reads will continue to return
+the rest of the message, blocking if needed, until all of
+that message is read.
+However this means other messages may have arrived and be ready
+for delivery and be blocked behind the message being partially
+delivered.
+If this option is enabled, when a partial delivery
+message has no more data to be received, then a subsequent
+read may return a different message that is ready for delivery.
+By default this option is off since the user must be using the
+extended API's to be able to tell the difference between
+messages (via the stream and stream sequence number).
+.It Dv SCTP_AUTH_CHUNK
+By default only the dynamic addressing chunks are
+authenticated.
+This option lets a user request an
+additional chunk be authenticated as well.
+Note that successive calls to this option will work and continue
+to add more chunks that require authentication.
+Note that this option only effects future associations and
+not existing ones.
+.It Dv SCTP_AUTH_KEY
+This option allows a user to specify a shared
+key that can be later used to authenticate
+a peer.
+.It Dv SCTP_HMAC_IDENT
+This option will let you get or set the list of
+HMAC algorithms used to authenticate peers.
+Note that the HMAC values are in priority order where
+the first HMAC identifier is the most preferred
+and the last is the least preferred.
+.It Dv SCTP_AUTH_ACTIVE_KEY
+This option allows you to make a key active for
+the generation of authentication information.
+Note that the peer must have the same key or else the
+data will be discarded.
+.It Dv SCTP_AUTH_DELETE_KEY
+This option allows you to delete an old key.
+.It Dv SCTP_USE_EXT_RECVINFO
+The sockets api document allows an extended
+send/receive information structure to be used.
+The extended structure includes additional fields
+related to the next message to be received (after the
+current receive completes) if such information is known.
+By default the system will not pass this information.
+This option allows the user to request this information.
+.It Dv SCTP_AUTO_ASCONF
+By default when bound to all address and the system administrator has
+enables automatic dynamic addresses, the
+.Tn SCTP
+stack will automatically generate address changes into add and
+delete requests to any peers by setting this option to
+true.
+This option allows an endpoint to disable that behavior.
+.It Dv SCTP_MAXBURST
+By default
+.Tn SCTP
+implements micro-burst control so that as the congestion window
+opens up no large burst of packets can be generated.
+The default burst limit is four.
+This option lets the user change this value.
+.It Dv SCTP_CONTEXT
+Many sctp extended calls have a context field.
+The context field is a 32 bit opaque value that will be returned in
+send failures.
+This option lets the caller set the default
+context value to use when none is provided by the user.
+.It Dv SCTP_EXPLICIT_EOR
+By default, a single send is a complete message.
+.Tn SCTP
+generates an implied record boundary.
+If this option is enabled, then all sends are part of the same message
+until the user indicates an end of record with the
+special flag
+.Dv SCTP_EOR
+passed in the sctp_sndrcvinfo flags field.
+This effectively makes all sends part of the same message
+until the user specifies differently.
+This means that a caller must NOT change the stream number until
+after the
+.Dv SCTP_EOR
+is passed to
+.Tn SCTP
+else an error will be returned.
+.It Dv SCTP_STATUS
+This option is a read only option that returns
+various status information about the specified association.
+.It Dv SCTP_GET_PEER_ADDR_INFO
+This read only option returns information about a peer
+address.
+.It Dv SCTP_PEER_AUTH_CHUNKS
+This read only option returns a list of the chunks
+the peer requires to be authenticated.
+.It Dv SCTP_LOCAL_AUTH_CHUNKS
+This read only option returns a list of the locally
+required chunks that must be authenticated.
+.It Dv SCTP_RESET_STREAMS
+This socket option is used to cause a stream sequence
+number or all stream sequence numbers to be reset.
+Note that the peer
+.Tn SCTP
+endpoint must also support the stream reset extension
+as well.
+.El
+.Sh SEE ALSO
+.Xr accept 2 ,
+.Xr bind 2 ,
+.Xr connect 2 ,
+.Xr listen 2 ,
+.Xr sctp_bindx 3 ,
+.Xr sctp_connectx 3 ,
+.Xr sctp_opt_info 3 ,
+.Xr sctp_recvmsg 3 ,
+.Xr sctp_sendmsg 3
diff --git a/share/man/man4/sdhci.4 b/share/man/man4/sdhci.4
new file mode 100644
index 000000000000..e9729a1e46e2
--- /dev/null
+++ b/share/man/man4/sdhci.4
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 9, 2012
+.Dt SDHCI 4
+.Os
+.Sh NAME
+.Nm sdhci
+.Nd PCI SD Host Controller bridge driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mmc"
+.Cd "device mmcsd"
+.Cd "device sdhci"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mmc_load="YES"
+mmcsd_load="YES"
+sdhci_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports PCI devices with class 8 and subclass 5 according to
+SD Host Controller Specification.
+Driver supports up to six high speed 4bit MMC/SD slots per controller.
+Driver attaches mmc bus to the respective slot on card insertion and
+detaches it on card removing.
+.Sh HARDWARE
+The
+.Nm
+driver supports different specification compatible chips. The following
+chips have been verified to work:
+.Pp
+.Bl -bullet -compact
+.It
+ENE CB712
+.It
+ENE CB714
+.It
+RICOH R5C822
+.It
+RICOH R5CE823
+.It
+TI PCIXX21/XX11
+.El
+.Sh SEE ALSO
+.Xr mmc 4 ,
+.Xr mmcsd 4
+.Rs
+.%T "SD Specifications, Part 2, SD Host Controller, Simplified Specification"
+.Re
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org .
+.Sh BUGS
+Many of existing SD controller chips have some nonstandard requirements,
+proprietary registers and hardware bugs, requiring additional handling.
+ENE chips are handled to work fine, while some revisions of RICOH and TI
+controllers still don't see cards without some additional initialization.
diff --git a/share/man/man4/sem.4 b/share/man/man4/sem.4
new file mode 100644
index 000000000000..3cc3a499a71f
--- /dev/null
+++ b/share/man/man4/sem.4
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2002 Tim J. Robbins
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 3, 2011
+.Dt SEM 4
+.Os
+.Sh NAME
+.Nm sem
+.Nd POSIX semaphores
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options P1003_1B_SEMAPHORES"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+sem_load="YES"
+.Ed
+.Pp
+.Dl "kldload sem"
+.Sh DESCRIPTION
+The
+.Nm
+facility provides system calls used by the standard C library
+.Pq Pa libc
+to implement
+.Tn POSIX
+semaphores.
+This facility offers support for such functions as
+.Fn sem_init
+and
+.Fn sem_wait .
+It is available both as a kernel option for static inclusion and as a
+dynamic kernel module.
+.Sh SEE ALSO
+.Xr sem_destroy 3 ,
+.Xr sem_getvalue 3 ,
+.Xr sem_init 3 ,
+.Xr sem_open 3 ,
+.Xr sem_post 3 ,
+.Xr sem_wait 3 ,
+.Xr config 8 ,
+.Xr kldload 8 ,
+.Xr kldunload 8
+.Sh HISTORY
+The
+.Nm
+facility appeared in
+.Fx 5.0 .
diff --git a/share/man/man4/send.4 b/share/man/man4/send.4
new file mode 100644
index 000000000000..9cfcd530cb27
--- /dev/null
+++ b/share/man/man4/send.4
@@ -0,0 +1,217 @@
+.\"-
+.\" Copyright (c) 2010 Ana Kukec
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 19, 2010
+.Dt SEND 4
+.Os
+.Sh NAME
+.Nm send
+.Nd "Kernel side support for Secure Neighbor Discovery (SeND)"
+.Sh SYNOPSIS
+.In sys/socket.h
+.In netinet/in.h
+.In netinet6/send.h
+.Ft int
+.Fn socket PF_INET6 SOCK_RAW IPPROTO_SEND
+.Pp
+To enable
+.Ns Nm
+support, load the kernel side SeND as a module.
+To load it at boot time, add the following line to
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+send_load="YES"
+.Ed
+.Sh DESCRIPTION
+IPv6 nodes use the Neighbor Discovery Protocol (NDP) to discover other nodes
+on the link, to determine their link-layer addresses to find routers, and
+to maintain reachability information about the paths to active members.
+NDP is vulnerable to various attacks [RFC3756].
+Secure Neighbor Discovery is a set of extensions to NDP that counter threats
+to NDP [RFC3971].
+.Pp
+Kernel side support for SeND consists of a kernel module with hooks that
+divert relevant packets (Neighbor Solicitations, Neighbor Advertisements,
+Router Solicitations, Router Advertisements and Redirects) from the NDP stack,
+send them to user space on a dedicated socket and reinject them back for
+further processing.
+Hooks are triggered only if the
+.Nm
+module is loaded.
+.Pp
+The native SeND socket is similar to a raw IP socket, but with its own,
+internal pseudo-protocol (IPPROTO_SEND).
+Struct sockaddr_send is defined in
+.In netinet6/send.h .
+It defines the total length of the structure, the address family, packet's
+incoming or outgoing direction from the interface's point of view, and the
+interface index.
+.Bd -literal
+struct sockaddr_send {
+ unsigned char send_len; /* total length */
+ sa_family_t send_family; /* address family */
+ int send_direction;
+ int send_ifidx;
+ char send_zero[8];
+};
+.Ed
+.Pp
+The address family is always
+.Va AF_INET6 .
+The
+.Va send_direction
+variable denotes the direction of the packet from the interface's
+point of view and has either the value
+.Dv SND_IN
+or
+.Dv SND_OUT .
+The
+.Va send_ifidx
+variable is the interface index of the receiving or sending interface.
+The
+.Va send_zero
+variable is padding and must always be zero.
+.Pp
+In case that no user space application is connected to the send socket,
+processing continues normally as if the module was not loaded.
+.Sh INPUT HOOK
+The input hook is named after the input path of the incoming or outgoing
+NDP packets, on the way from the wire, through the nd6 stack, to user
+space.
+Relevant packets are identified by adding an mbuf_tag
+(see
+.Xr mbuf_tags 9 )
+to the
+.Xr mbuf 9 ,
+if the
+.Nm
+module is loaded.
+It is then passed on to the kernel-userland interface
+for either cryptographic protection or validation by the SeND application.
+The hook takes an argument that describes the direction of the packet, both
+in case of incoming and outgoing packets.
+.Dv SND_IN
+is the direction of the incoming packets that are usually protected
+by the SeND options and then sent to user space for cryptographic validation.
+.Dv SND_OUT
+is the outgoing direction.
+It describes both reply and locally
+originated outgoing packets that are sent to user space for the addition
+of SeND options.
+.Sh INCOMING PACKETS
+The incoming ND packet from the wire:
+.Bd -literal
+ kernelspace ( userspace
+ )
+ incoming SeND/ND packet (
+ | )
+ v ( SND_IN ) (
+ icmp6_input() -> send_input_hook ---> send socket ----+
+ : ) |
+ : # # ( |
+ normal : # # ) v
+ processing : # send.ko # ( SeND application
+ path : # # ) |
+ : # # ( |
+ v ) |
+ icmp6/nd6_??_input() <- protocol switch <--- send socket <---+
+ | structure (IPPPROTO_SEND) )
+ | ( SND_IN ) (
+ v )
+ continue normal ND processing (
+.Ed
+.Sh OUTGOING PACKETS
+Outgoing ND packet (reply or locally triggered):
+.Bd -literal
+ kernelspace ( userspace
+ )
+ nd6_na_input() (
+ +PACKET_TAG_ND_OUTGOING )
+ | )
+ | outgoing packet (
+ | | )
+ | v (
+ | icmp6_redirect_output() )
+ | nd6_ns_output() (
+ | nd6_na_output() )
+ | +PACKET_TAG_ND_OUTGOING (
+ | | )
+ | +-----------<- rip6_output() <----------)----- rtsol/rtadvd/..
+ | | +PACKET_TAG_ND_OUTGOING (
+ | v )
+ | ip6_output() (
+ | | )
+ +-------->-+ (
+ | )
+ v ( SND_OUT ) (
+ nd6_output_lle() -> send_input_hook ---> send socket ----+
+ -PACKET_TAG_ND_OUTGOING ) |
+ : # # ( |
+ normal : # # ) v
+ processing : # send.ko # ( SeND application
+ path : # # ) |
+ : # # ( |
+ v ) |
+ (*ifp->if_output)() <- protocol switch <--- send socket <---+
+ | structure (IPPPROTO_SEND) )
+ | ( SND_OUT ) (
+ v )
+ continue with normal packet output (
+.Ed
+.Sh ERRORS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width Er
+.It Bq Er EEXIST
+Another user space SeND application is bound to the socket.
+.It Bq Er ENOBUFS
+Shortage of space to receive the incoming (SeND-protected) or outgoing
+(SeND-validated) packet from the SeND application.
+.It Bq Er ENOSYS
+A packet received from user space and passed to the NDP stack for further
+processing is neither Neighbor Solicitation, Neighbor Advertisement,
+Router Solicitation, Router Advertisement nor Redirect.
+.It Bq Er ENOENT
+Occurs if interface output routines fail to send the packet out of the
+interface.
+.El
+.Sh SEE ALSO
+.Xr recvfrom 2
+.Xr sendto 2
+.Xr socket 2
+.Xr loader.conf 5
+.Sh HISTORY
+The
+.Nm
+module first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An Ana Kukec Aq anchie@FreeBSD.org ,
+University of Zagreb
+.Sh BUGS
+Due to the lack of NDP locking, it is currently not possible to unload the
+.Nm
+module.
diff --git a/share/man/man4/ses.4 b/share/man/man4/ses.4
new file mode 100644
index 000000000000..3d9528517bc7
--- /dev/null
+++ b/share/man/man4/ses.4
@@ -0,0 +1,134 @@
+.\" Copyright (c) 2000
+.\" Matthew Jacob <mjacob@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 29, 2000
+.Dt SES 4
+.Os
+.Sh NAME
+.Nm ses
+.Nd SCSI Environmental Services driver
+.Sh SYNOPSIS
+.Cd device ses
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all
+.Tn SCSI
+devices of the environmental services class that are attached to the system
+through a supported
+.Tn SCSI
+Host Adapter, as well as emulated support for SAF-TE (SCSI Accessible
+Fault Tolerant Enclosures).
+The environmental services class generally are enclosure devices that
+provide environmental information such as number of power supplies (and
+state), temperature, device slots, and so on.
+.Pp
+A
+.Tn SCSI
+Host
+adapter must also be separately configured into the system
+before a
+.Tn SCSI
+Environmental Services device can be configured.
+.Sh KERNEL CONFIGURATION
+It is only necessary to explicitly configure one
+.Nm
+device; data structures are dynamically allocated as devices are found
+on the
+.Tn SCSI
+bus.
+.Pp
+A separate option,
+.Va SES_ENABLE_PASSTHROUGH ,
+may be specified to allow the
+.Nm
+driver to perform functions on devices of other classes that claim to
+also support
+.Nm
+functionality.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls apply to
+.Nm
+devices.
+They are defined in the header file
+.In cam/scsi/scsi_ses.h
+(\fIq.v.\fR).
+.Bl -tag -width SESIOC_GETENCSTAT
+.It Dv SESIOC_GETNOBJ
+Used to find out how many
+.Nm
+objects are driven by this particular device instance.
+.It Dv SESIOC_GETOBJMAP
+Read, from the kernel, an array of SES objects which contains
+the object identifier, which subenclosure it is in, and the
+.Nm
+type of the object.
+.It Dv SESIOC_GETENCSTAT
+Get the overall enclosure status.
+.It Dv SESIOC_SETENCSTAT
+Set the overall enclosure status.
+.It Dv SESIOC_GETOBJSTAT
+Get the status of a particular object.
+.It Dv SESIOC_SETOBJSTAT
+Set the status of a particular object.
+.It Dv SESIOC_GETTEXT
+Get the associated help text for an object (not yet implemented).
+.Nm
+devices often have descriptive text for an object which can tell
+you things like location (e.g, "left power supply").
+.It Dv SESIOC_INIT
+Initialize the enclosure.
+.El
+.Sh EXAMPLE USAGE
+The files contained in
+.In usr/share/examples/ses
+show simple mechanisms for how to use these interfaces, as well as a
+very stupid simple monitoring daemon.
+.Sh FILES
+.Bl -tag -width /dev/rsdXXXXX -compact
+.It Pa /dev/ses Ns Ar N
+The
+.Em Nth
+.Nm SES
+device.
+.El
+.Sh DIAGNOSTICS
+When the kernel is configured with
+.Tn DEBUG
+enabled, the first open to an SES device will spit out overall enclosure
+parameters to the console.
+.Sh HISTORY
+The
+.Nm
+driver was written for the
+.Tn CAM
+.Tn SCSI
+subsystem by Matthew Jacob.
+This is a functional equivalent of a similar
+driver available in Solaris, Release 7.
diff --git a/share/man/man4/sf.4 b/share/man/man4/sf.4
new file mode 100644
index 000000000000..80ba44e19bfe
--- /dev/null
+++ b/share/man/man4/sf.4
@@ -0,0 +1,209 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 21, 2008
+.Dt SF 4
+.Os
+.Sh NAME
+.Nm sf
+.Nd "Adaptec AIC-6915"
+.Qq Starfire
+PCI Fast Ethernet adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device sf"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sf_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Adaptec Duralink Fast Ethernet adapters
+based on the Adaptec AIC-6915 "Starfire" chipset.
+.Pp
+The AIC-6915 is a bus master controller with an MII interface.
+It
+supports high and low priority transmit and receive queues, TCP/IP
+checksum offload, multiple DMA descriptor formats and both polling
+and producer/consumer DMA models.
+The AIC-6915 receive filtering
+options include a 16 entry perfect filter, a 512-bit hash table
+for multicast addresses, a 512-bit hash table for priority address
+matching and VLAN filtering.
+An external MII-compliant transceiver
+is required for media interfacing.
+.Pp
+Multiport adapters consist of several AIC-6915 controllers connected
+via a PCI to PCI bridge.
+Each controller is treated as a separate
+interface by the
+.Nm
+driver.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+ANA-62011 64-bit single port 10/100baseTX adapter
+.It
+ANA-62022 64-bit dual port 10/100baseTX adapter
+.It
+ANA-62044 64-bit quad port 10/100baseTX adapter
+.It
+ANA-69011 32-bit single port 10/100baseTX adapter
+.It
+ANA-62020 64-bit single port 100baseFX adapter
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va dev.sf.%d.int_mod
+Maximum amount of time to delay interrupt processing in units of
+102.4us.
+The accepted range is 0 to 31, the default value is 1 (102.4us).
+Value 0 completely disables the interrupt moderation.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.It Va dev.sf.%d.stats
+Display lots of useful MAC counters maintained in the driver.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "sf%d: couldn't map memory"
+A fatal initialization error has occurred.
+This may
+happen if the PCI BIOS not configured the device, which may be because
+the BIOS has been configured for a "Plug and Play" operating system.
+The "Plug and Play OS" setting in the BIOS should be set to "no" or
+"off" in order for PCI devices to work properly with
+.Fx .
+.It "sf%d: couldn't map ports"
+A fatal initialization error has occurred.
+This may
+happen if the PCI BIOS not configured the device, which may be because
+the BIOS has been configured for a "Plug and Play" operating system.
+The "Plug and Play OS" setting in the BIOS should be set to "no" or
+"off" in order for PCI devices to work properly with
+.Fx .
+.It "sf%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "sf%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "sf%d: failed to enable I/O ports/memory mapping!"
+The driver failed to initialize PCI I/O port or shared memory access.
+This might happen if the card is not in a bus-master slot.
+.It "sf%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T The Adaptec AIC-6915 Programmer's Manual
+.%U http://download.adaptec.com/pdfs/user_guides/aic6915_pg.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/share/man/man4/sfxge.4 b/share/man/man4/sfxge.4
new file mode 100644
index 000000000000..5e4935d465ee
--- /dev/null
+++ b/share/man/man4/sfxge.4
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2011 Solarflare Communications, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt SFXGE 4
+.Os
+.Sh NAME
+.Nm sfxge
+.Nd "Solarflare 10Gb Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sfxge"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+sfxge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for 10Gb Ethernet adapters based on
+Solarflare SFC9000 family controllers.
+The driver supports jumbo
+frames, transmit/receive checksum offload, TCP Segmentation Offload
+(TSO), Large Receive Offload (LRO), VLAN checksum offload, VLAN TSO,
+and Receive Side Scaling (RSS) using MSI-X interrupts.
+.Pp
+The driver allocates 1 receive queue, transmit queue, event queue and
+IRQ per CPU up to a maximum of 64.
+IRQ affinities should be spread out using
+.Xr cpuset 1 .
+Interrupt moderation may be controlled through the sysctl
+.Va dev.sfxge.%d.int_mod
+(units are microseconds).
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+A large number of MAC, PHY and data path statistics are available
+under the sysctl
+.Va dev.sfxge.%d.stats .
+The adapter's VPD
+fields including its serial number are available under the sysctl
+.Va dev.sfxge.%d.vpd .
+.Sh HARDWARE
+The
+.Nm
+driver supports all 10Gb Ethernet adapters based on Solarflare SFC9000
+family controllers.
+.Sh SUPPORT
+For general information and support,
+go to the Solarflare support website at:
+.Pa https://support.solarflare.com .
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr cpuset 1 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Philip Paeps
+and
+.An Solarflare Communications, Inc.
diff --git a/share/man/man4/sge.4 b/share/man/man4/sge.4
new file mode 100644
index 000000000000..5d6ecf86cbea
--- /dev/null
+++ b/share/man/man4/sge.4
@@ -0,0 +1,121 @@
+.\" Copyright (c) 2010 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2011
+.Dt SGE 4
+.Os
+.Sh NAME
+.Nm sge
+.Nd Silicon Integrated Systems SiS190/191 Fast/Gigabit Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device sge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sge="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for SiS190 Fast Ethernet
+controllers and SiS191 Fast/Gigabit Ethernet controllers.
+.Pp
+All LOMs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for transmit and receive,
+TCP segmentation offload (TSO), hardware VLAN tag stripping/insertion
+features.
+Due to lack of documentation Wake On Lan (WOL), Jumbo frame and an
+interrupt moderation mechanism are not supported yet.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+device driver provides support for the following Ethernet controllers:
+.Pp
+.Bl -bullet -compact
+.It
+SiS190 Fast Ethernet controller
+.It
+SiS191 Fast/Gigabit Ethernet controller
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr rgephy 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Alexander Pohoyda
+.Aq alexander.pohoyda@gmx.net .
+And enhanced by
+.An Nikolay Denev
+.Aq ndenev@gmail.com .
+It first appeared in
+.Fx 8.1 .
diff --git a/share/man/man4/si.4 b/share/man/man4/si.4
new file mode 100644
index 000000000000..5eb7629d979d
--- /dev/null
+++ b/share/man/man4/si.4
@@ -0,0 +1,181 @@
+.\" $FreeBSD$
+.Dd September 16, 1995
+.Dt SI 4
+.Os
+.Sh NAME
+.Nm si
+.Nd "driver for Specialix International SI/XIO or SX intelligent serial card"
+.Sh SYNOPSIS
+.Cd "device si"
+.Pp
+For ISA host cards put the following lines in
+.Pa /boot/device.hints :
+.Cd hint.si.0.at="isa"
+.Cd hint.si.0.maddr="0xd0000"
+.Cd hint.si.0.irq="12"
+.Sh DESCRIPTION
+The Specialix SI/XIO and SX hardware makes up an 8 to 32 port RS-232 serial
+multiplexor.
+.Pp
+The system uses two components: a "Host adapter", which is plugged into
+an ISA, EISA or PCI slot and provides intelligence and buffering/processing
+capabilities, as well as an external bus in the form of a 37 pin cable.
+.Pp
+On this cable, "modules" are connected.
+The "SI" module comes in a 4 and 8 port version.
+The "XIO" and "SX" modules come only in
+8 port versions.
+.Pp
+The host adapter polls and transfers data between the modules and the rest
+of the machine.
+The Host adapter provides a 256 byte transmit and 256 byte
+receive FIFO for each of the 32 ports that it can maintain.
+.Pp
+The XIO modules can operate each of their 8 ports at 115,200 baud.
+The SI version can run at 57,600 baud.
+The SX modules can operate each of their
+8 ports at up to 921,600 baud.
+.Pp
+SX modules are only supported when connected to an SX host card.
+SI or
+XIO modules are supported on any host card.
+.Pp
+The host adapter uses a shared memory block in the traditional ISA bus
+"hole" between 0xA0000 and 0xEFFFF.
+The adapter can be configured outside
+range, but requires the memory range to be explicitly non-cached.
+The driver does not yet support this mode of operation.
+.Pp
+SX ISA Host cards have an 8/16 bit mode switch or jumper on them.
+This switch
+or jumper MUST be set for 8 bit mode.
+.Pp
+The ISA adapters can use Irq's 11, 12 or 15 (and 9 and 10 in the case of
+SX host cards).
+.Pp
+The si device driver may have some of its configuration settings changed
+at run-time with the
+.Xr sicontrol 8
+utility.
+.Pp
+The si device driver also responds to the
+.Xr comcontrol 8
+utility for configuring drain-on-close timeouts.
+.Pp
+The driver also defines 3 sysctl variables that can be manipulated:
+machdep.si_debug sets the debug level for the whole driver.
+It depends
+on the driver being compiled with SI_DEBUG.
+machdep.si_pollrate
+sets how often per second the driver polls for lost interrupts.
+machdep.si_realpoll sets whether or not the card will treat the
+poll intervals as if they were interrupts.
+.Pp
+An open on a /dev device node controlled by the si driver obeys the same
+semantics as the
+.Xr sio 4
+driver.
+It fully supports the usual semantics of the cua ports, and the
+"initial termios" and "locked termios" settings.
+In summary, an open on a
+tty port will block until DCD is raised, unless O_NONBLOCK is specified.
+CLOCAL is honored.
+An open on a cua port will always succeed, but DCD
+transitions will be honored after DCD rises for the first time.
+.Pp
+Up to four SI/XIO host cards may be controlled by the si driver.
+Due to the lack of available interrupts, only 3 ISA SI/XIO host cards can be
+used at once.
+.Pp
+The lowest 5 bits of the minor device number are used to select the port
+number on the module cluster.
+The next 2 bits select which of 4 host adapter
+cards.
+This allows a maximum of 128 ports on this driver.
+.Pp
+Bit 7 is used to differentiate a tty/dialin port (bit 7=0) and a
+cua/callout port (bit 7=1).
+.Pp
+Bit 8 through 15 (on
+.Fx )
+are unavailable as they are a shadow of the
+major device number.
+.Pp
+If bit 16 is a 1, the device node is referring to the "initial state" device.
+This "initial state" is used to prime the
+.Xr termios 4
+settings of the device when it is initially opened.
+If bit 17 is a 1, the device node is referring to the "locked state" device.
+The "locked state" is used to prevent the
+.Xr termios 4
+settings from being changed.
+.Pp
+To manipulate the initial/locked settings, the
+.Xr stty 1
+command is useful.
+When setting the "locked" variables, enabling the mode
+on the lock device will lock the termios mode, while disabling the mode will
+unlock it.
+.Sh FILES
+.Bl -tag -width /dev/si_control -compact
+.It Pa /dev/si_control
+global driver control file for
+.Xr sicontrol 8
+.It Pa /dev/ttyA*
+terminal/dialin ports
+.It Pa /dev/cuaA*
+dialout ports
+.It Pa /dev/ttyiA*
+initial termios state devices
+.It Pa /dev/ttylA*
+locked termios state devices
+.It Pa /dev/cuaiA*
+initial termios state devices for dialout ports
+.It Pa /dev/cualA*
+locked termios state devices for dialout ports
+.El
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr sio 4 ,
+.Xr termios 4 ,
+.Xr tty 4 ,
+.Xr comcontrol 8 ,
+.Xr sicontrol 8
+.Sh HISTORY
+This driver is loosely based on driver code originating at Specialix, which
+was ported to run on BSDI by
+.An Andy Rutter Aq andy@specialix.co.uk .
+The System V driver source is/was available by ftp from
+.Sy ftp.specialix.co.uk .
+.Pp
+This driver is not supported by Specialix International.
+.Sh AUTHORS
+.An -nosplit
+.An Peter Wemm Aq peter@netplex.com.au
+obtained the code from
+.An Andy Rutter
+and ported it to
+.Fx
+and threw the man page together.
+.An Bruce Evans Aq bde@zeta.org.au
+provided a large amount of assistance during porting.
+.An Nick Sayer Aq nick@specialix.com
+wrote the EISA, PCI and SX portions.
+.Sh BUGS
+The interrupt tuning rate is not believed to be optimal at this time for
+maximum efficiency.
+.Pp
+Polled mode (a feature of standard Specialix drivers) is not implemented,
+but it can be approximated by turning on machdep.si_realpoll.
+The poll
+frequency is set by machdep.si_pollrate (in units of 1/100th of a second).
+.Pp
+The driver does not yet support baud rates higher than 115,200 on SX
+modules.
+.Pp
+Operation outside the traditional ISA "hole" is not yet supported, although it
+should work if the test is removed from the probe routine.
+.Pp
+Multiple host cards are supported although combinations of hosts on
+different bus types have not been tested - device numbering is known to
+be a problem and may lead to unexpected results.
diff --git a/share/man/man4/siba.4 b/share/man/man4/siba.4
new file mode 100644
index 000000000000..288a13f1a145
--- /dev/null
+++ b/share/man/man4/siba.4
@@ -0,0 +1,90 @@
+.\" Copyright (c) 2010 Weongyo Jeong
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2010
+.Dt SIBA 4
+.Os
+.Sh NAME
+.Nm siba
+.Nd Sonic Inc. Silicon Backplane driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device siba"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time,
+place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+siba_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the Sonic Inc. Silicon Backplane, the interblock
+communications architecture that can be found in most Broadcom
+wireless NICs.
+.Pp
+A bus connects all of the Silicon Backplane's functional blocks.
+These functional blocks, known as cores, use the Open Core Protocol
+(OCP) interface to communicate with agents attached to the Silicon
+Backplane.
+.Pp
+Each NIC uses a chip from the same chip family.
+Each member of the family contains a different set of cores, but
+shares basic architectural features such as address space definition,
+interrupt and error architecture, and backplane register definitions.
+.Pp
+Each core can have an initiator agent that passes read and write
+requests onto the system backplane and a target agent that returns
+responses to those requests.
+Not all cores contain both an initiator and a target agent.
+Initiator agents are present in cores that contain
+host interfaces (PCI, PCMCIA), embedded processors (MIPS),
+or DMA processors associated with communications cores.
+.Pp
+All cores other than PCMCIA have a target agent.
+.Sh SEE ALSO
+.Xr bwn 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Bruce M. Simpson
+.Aq bms@FreeBSD.org
+and
+.An Weongyo Jeong
+.Aq weongyo@FreeBSD.org .
+.Sh CAVEATS
+Host mode is not supported at this moment.
diff --git a/share/man/man4/siftr.4 b/share/man/man4/siftr.4
new file mode 100644
index 000000000000..08d20e37b40c
--- /dev/null
+++ b/share/man/man4/siftr.4
@@ -0,0 +1,758 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 12, 2010
+.Dt SIFTR 4
+.Os
+.Sh NAME
+.Nm SIFTR
+.Nd Statistical Information For TCP Research
+.Sh SYNOPSIS
+To load
+.Ns Nm
+as a module at run-time, run the following command as root:
+.Bd -literal -offset indent
+kldload siftr
+.Ed
+.Pp
+Alternatively, to load
+.Ns Nm
+as a module at boot time, add the following line into the
+.Xr loader.conf 5
+file:
+.Bd -literal -offset indent
+siftr_load="YES"
+.Ed
+.Sh DESCRIPTION
+.Nm
+.Ns ( Em S Ns tatistical
+.Em I Ns nformation
+.Em F Ns or
+.Em T Ns CP
+.Em R Ns esearch )
+is a kernel module that logs a range of statistics on active TCP connections to
+a log file.
+It provides the ability to make highly granular measurements of TCP connection
+state, aimed at system administrators, developers and researchers.
+.Ss Compile-time Configuration
+The default operation of
+.Nm
+is to capture IPv4 TCP/IP packets.
+.Nm
+can be configured to support IPv4 and IPv6 by uncommenting:
+.Bd -literal -offset indent
+CFLAGS+=-DSIFTR_IPV6
+.Ed
+.Pp
+in
+.Aq sys/modules/siftr/Makefile
+and recompiling.
+.Pp
+In the IPv4-only (default) mode, standard dotted decimal notation (e.g.
+"136.186.229.95") is used to format IPv4 addresses for logging.
+In IPv6 mode, standard dotted decimal notation is used to format IPv4 addresses,
+and standard colon-separated hex notation (see RFC 4291) is used to format IPv6
+addresses for logging. Note that SIFTR uses uncompressed notation to format IPv6
+addresses.
+For example, the address "fe80::20f:feff:fea2:531b" would be logged as
+"fe80:0:0:0:20f:feff:fea2:531b".
+.Ss Run-time Configuration
+.Nm
+utilises the
+.Xr sysctl 8
+interface to export its configuration variables to user-space.
+The following variables are available:
+.Bl -tag -offset indent
+.It Va net.inet.siftr.enabled
+controls whether the module performs its
+measurements or not.
+By default, the value is set to 0, which means the module
+will not be taking any measurements.
+Having the module loaded with
+.Va net.inet.siftr.enabled
+set to 0 will have no impact on the performance of the network stack, as the
+packet filtering hooks are only inserted when
+.Va net.inet.siftr.enabled
+is set to 1.
+.El
+.Bl -tag -offset indent
+.It Va net.inet.siftr.ppl
+controls how many inbound/outbound packets for a given TCP connection will cause
+a log message to be generated for the connection.
+By default, the value is set to 1, which means the module will log a message for
+every packet of every TCP connection.
+The value can be set to any integer in the range [1,2^32], and can be changed at
+any time, even while the module is enabled.
+.El
+.Bl -tag -offset indent
+.It Va net.inet.siftr.logfile
+controls the path to the file that the module writes its log messages to.
+By default, the file /var/log/siftr.log is used.
+The path can be changed at any time, even while the module is enabled.
+.El
+.Bl -tag -offset indent
+.It Va net.inet.siftr.genhashes
+controls whether a hash is generated for each TCP packet seen by
+.Nm .
+By default, the value is set to 0, which means no hashes are generated.
+The hashes are useful to correlate which TCP packet triggered the generation of
+a particular log message, but calculating them adds additional computational
+overhead into the fast path.
+.El
+.Ss Log Format
+A typical
+.Nm
+log file will contain 3 different types of log message.
+All messages are written in plain ASCII text.
+.Pp
+Note: The
+.Qq \e
+present in the example log messages in this section indicates a
+line continuation and is not part of the actual log message
+.Pp
+The first type of log message is written to the file when the module is
+enabled and starts collecting data from the running kernel. The text below
+shows an example module enable log. The fields are tab delimited key-value
+pairs which describe some basic information about the system.
+.Bd -literal -offset indent
+enable_time_secs=1238556193 enable_time_usecs=462104 \\
+siftrver=1.2.2 hz=1000 tcp_rtt_scale=32 \\
+sysname=FreeBSD sysver=604000 ipmode=4
+.Ed
+.Pp
+Field descriptions are as follows:
+.Bl -tag -offset indent
+.It Va enable_time_secs
+time at which the module was enabled, in seconds since the UNIX epoch.
+.El
+.Bl -tag -offset indent
+.It Va enable_time_usecs
+time at which the module was enabled, in microseconds since enable_time_secs.
+.El
+.Bl -tag -offset indent
+.It Va siftrver
+version of
+.Nm .
+.El
+.Bl -tag -offset indent
+.It Va hz
+tick rate of the kernel in ticks per second.
+.El
+.Bl -tag -offset indent
+.It Va tcp_rtt_scale
+smoothed RTT estimate scaling factor
+.El
+.Bl -tag -offset indent
+.It Va sysname
+operating system name
+.El
+.Bl -tag -offset indent
+.It Va sysver
+operating system version
+.El
+.Bl -tag -offset indent
+.It Va ipmode
+IP mode as defined at compile time.
+An ipmode of "4" means IPv6 is not supported and IP addresses are logged in
+regular dotted quad format.
+An ipmode of "6" means IPv6 is supported, and IP addresses are logged in dotted
+quad or hex format, as described in the
+.Qq Compile-time Configuration
+subsection.
+.El
+.Pp
+The second type of log message is written to the file when a data log message
+is generated.
+The text below shows an example data log triggered by an IPv4
+TCP/IP packet.
+The data is CSV formatted.
+.Bd -literal -offset indent
+o,0xbec491a5,1238556193.463551,172.16.7.28,22,172.16.2.5,55931, \\
+1073725440,172312,6144,66560,66608,8,1,4,1448,936,1,996,255, \\
+33304,208,66608,0,208,0
+.Ed
+.Pp
+Field descriptions are as follows:
+.Bl -tag -offset indent
+.It Va 1
+Direction of packet that triggered the log message.
+Either
+.Qq i
+for in, or
+.Qq o
+for out.
+.El
+.Bl -tag -offset indent
+.It Va 2
+Hash of the packet that triggered the log message.
+.El
+.Bl -tag -offset indent
+.It Va 3
+Time at which the packet that triggered the log message was processed by
+the
+.Xr pfil 9
+hook function, in seconds and microseconds since the UNIX epoch.
+.El
+.Bl -tag -offset indent
+.It Va 4
+The IPv4 or IPv6 address of the local host, in dotted quad (IPv4 packet)
+or colon-separated hex (IPv6 packet) notation.
+.El
+.Bl -tag -offset indent
+.It Va 5
+The TCP port that the local host is communicating via.
+.El
+.Bl -tag -offset indent
+.It Va 6
+The IPv4 or IPv6 address of the foreign host, in dotted quad (IPv4 packet)
+or colon-separated hex (IPv6 packet) notation.
+.El
+.Bl -tag -offset indent
+.It Va 7
+The TCP port that the foreign host is communicating via.
+.El
+.Bl -tag -offset indent
+.It Va 8
+The slow start threshold for the flow, in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 9
+The current congestion window for the flow, in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 10
+The current bandwidth-controlled window for the flow, in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 11
+The current sending window for the flow, in bytes.
+The post scaled value is reported, except during the initial handshake (first
+few packets), during which time the unscaled value is reported.
+.El
+.Bl -tag -offset indent
+.It Va 12
+The current receive window for the flow, in bytes.
+The post scaled value is always reported.
+.El
+.Bl -tag -offset indent
+.It Va 13
+The current window scaling factor for the sending window.
+.El
+.Bl -tag -offset indent
+.It Va 14
+The current window scaling factor for the receiving window.
+.El
+.Bl -tag -offset indent
+.It Va 15
+The current state of the TCP finite state machine, as defined
+in
+.Aq Pa netinet/tcp_fsm.h .
+.El
+.Bl -tag -offset indent
+.It Va 16
+The maximum segment size for the flow, in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 17
+The current smoothed RTT estimate for the flow, in units of TCP_RTT_SCALE * HZ,
+where TCP_RTT_SCALE is a define found in tcp_var.h, and HZ is the kernel's tick
+timer.
+Divide by TCP_RTT_SCALE * HZ to get the RTT in secs. TCP_RTT_SCALE and HZ are
+reported in the enable log message.
+.El
+.Bl -tag -offset indent
+.It Va 18
+SACK enabled indicator. 1 if SACK enabled, 0 otherwise.
+.El
+.Bl -tag -offset indent
+.It Va 19
+The current state of the TCP flags for the flow.
+See
+.Aq Pa netinet/tcp_var.h
+for information about the various flags.
+.El
+.Bl -tag -offset indent
+.It Va 20
+The current retransmission timeout length for the flow, in units of HZ, where HZ
+is the kernel's tick timer.
+Divide by HZ to get the timeout length in seconds. HZ is reported in the
+enable log message.
+.El
+.Bl -tag -offset indent
+.It Va 21
+The current size of the socket send buffer in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 22
+The current number of bytes in the socket send buffer.
+.El
+.Bl -tag -offset indent
+.It Va 23
+The current size of the socket receive buffer in bytes.
+.El
+.Bl -tag -offset indent
+.It Va 24
+The current number of bytes in the socket receive buffer.
+.El
+.Bl -tag -offset indent
+.It Va 25
+The current number of unacknowledged bytes in-flight.
+Bytes acknowledged via SACK are not excluded from this count.
+.El
+.Bl -tag -offset indent
+.It Va 26
+The current number of segments in the reassembly queue.
+.El
+.Pp
+The third type of log message is written to the file when the module is disabled
+and ceases collecting data from the running kernel.
+The text below shows an example module disable log.
+The fields are tab delimited key-value pairs which provide statistics about
+operations since the module was most recently enabled.
+.Bd -literal -offset indent
+disable_time_secs=1238556197 disable_time_usecs=933607 \\
+num_inbound_tcp_pkts=356 num_outbound_tcp_pkts=627 \\
+total_tcp_pkts=983 num_inbound_skipped_pkts_malloc=0 \\
+num_outbound_skipped_pkts_malloc=0 num_inbound_skipped_pkts_mtx=0 \\
+num_outbound_skipped_pkts_mtx=0 num_inbound_skipped_pkts_tcb=0 \\
+num_outbound_skipped_pkts_tcb=0 num_inbound_skipped_pkts_icb=0 \\
+num_outbound_skipped_pkts_icb=0 total_skipped_tcp_pkts=0 \\
+flow_list=172.16.7.28;22-172.16.2.5;55931,
+.Ed
+.Pp
+Field descriptions are as follows:
+.Bl -tag -offset indent
+.It Va disable_time_secs
+Time at which the module was disabled, in seconds since the UNIX epoch.
+.El
+.Bl -tag -offset indent
+.It Va disable_time_usecs
+Time at which the module was disabled, in microseconds since disable_time_secs.
+.El
+.Bl -tag -offset indent
+.It Va num_inbound_tcp_pkts
+Number of TCP packets that traversed up the network stack.
+This only includes inbound TCP packets during the periods when
+.Nm
+was enabled.
+.El
+.Bl -tag -offset indent
+.It Va num_outbound_tcp_pkts
+Number of TCP packets that traversed down the network stack.
+This only includes outbound TCP packets during the periods when
+.Nm
+was enabled.
+.El
+.Bl -tag -offset indent
+.It Va total_tcp_pkts
+The summation of num_inbound_tcp_pkts and num_outbound_tcp_pkts.
+.El
+.Bl -tag -offset indent
+.It Va num_inbound_skipped_pkts_malloc
+Number of inbound packets that were not processed because of failed malloc() calls.
+.El
+.Bl -tag -offset indent
+.It Va num_outbound_skipped_pkts_malloc
+Number of outbound packets that were not processed because of failed malloc() calls.
+.El
+.Bl -tag -offset indent
+.It Va num_inbound_skipped_pkts_mtx
+Number of inbound packets that were not processed because of failure to add the
+packet to the packet processing queue.
+.El
+.Bl -tag -offset indent
+.It Va num_outbound_skipped_pkts_mtx
+Number of outbound packets that were not processed because of failure to add the
+packet to the packet processing queue.
+.El
+.Bl -tag -offset indent
+.It Va num_inbound_skipped_pkts_tcb
+Number of inbound packets that were not processed because of failure to find the
+TCP control block associated with the packet.
+.El
+.Bl -tag -offset indent
+.It Va num_outbound_skipped_pkts_tcb
+Number of outbound packets that were not processed because of failure to find
+the TCP control block associated with the packet.
+.El
+.Bl -tag -offset indent
+.It Va num_inbound_skipped_pkts_icb
+Number of inbound packets that were not processed because of failure to find the
+IP control block associated with the packet.
+.El
+.Bl -tag -offset indent
+.It Va num_outbound_skipped_pkts_icb
+Number of outbound packets that were not processed because of failure to find
+the IP control block associated with the packet.
+.El
+.Bl -tag -offset indent
+.It Va total_skipped_tcp_pkts
+The summation of all skipped packet counters.
+.El
+.Bl -tag -offset indent
+.It Va flow_list
+A CSV list of TCP flows that triggered data log messages to be generated since
+the module was loaded.
+Each flow entry in the CSV list is
+formatted as
+.Qq local_ip;local_port-foreign_ip;foreign_port .
+If there are no entries in the list (i.e. no data log messages were generated),
+the value will be blank.
+If there is at least one entry in the list, a trailing comma will always be
+present.
+.El
+.Pp
+The total number of data log messages found in the log file for a module
+enable/disable cycle should equate to total_tcp_pkts - total_skipped_tcp_pkts.
+.Sh IMPLEMENTATION NOTES
+.Nm
+hooks into the network stack using the
+.Xr pfil 9
+interface.
+In its current incarnation, it hooks into the AF_INET/AF_INET6 (IPv4/IPv6)
+.Xr pfil 9
+filtering points, which means it sees packets at the IP layer of the network
+stack.
+This means that TCP packets inbound to the stack are intercepted before
+they have been processed by the TCP layer.
+Packets outbound from the stack are intercepted after they have been processed
+by the TCP layer.
+.Pp
+The diagram below illustrates how
+.Nm
+inserts itself into the stack.
+.Bd -literal -offset indent
+----------------------------------
+ Upper Layers
+----------------------------------
+ ^ |
+ | |
+ | |
+ | v
+ TCP in TCP out
+----------------------------------
+ ^ |
+ |________ _________|
+ | |
+ | v
+ ---------
+ | SIFTR |
+ ---------
+ ^ |
+ ________| |__________
+ | |
+ | v
+IPv{4/6} in IPv{4/6} out
+----------------------------------
+ ^ |
+ | |
+ | v
+Layer 2 in Layer 2 out
+----------------------------------
+ Physical Layer
+----------------------------------
+.Ed
+.Pp
+.Nm
+uses the
+.Xr alq 9
+interface to manage writing data to disk.
+.Pp
+At first glance, you might mistakenly think that
+.Nm
+extracts information from
+individual TCP packets.
+This is not the case.
+.Nm
+uses TCP packet events (inbound and outbound) for each TCP flow originating from
+the system to trigger a dump of the state of the TCP control block for that
+flow.
+With the PPL set to 1, we are in effect sampling each TCP flow's control block
+state as frequently as flow packets enter/leave the system.
+For example, setting PPL to 2 halves the sampling rate i.e. every second flow
+packet (inbound OR outbound) causes a dump of the control block state.
+.Pp
+The distinction between interrogating individual packets vs interrogating the
+control block is important, because
+.Nm
+does not remove the need for packet capturing tools like
+.Xr tcpdump 1 .
+.Nm
+allows you to correlate and observe the cause-and-affect relationship between
+what you see on the wire (captured using a tool like
+.Xr tcpdump 1 Ns )
+and changes in the TCP control block corresponding to the flow of interest.
+It is therefore useful to use
+.Nm
+and a tool like
+.Xr tcpdump 1
+to gather the necessary data to piece together the complete picture.
+Use of either tool on its own will not be able to provide all of the necessary
+data.
+.Pp
+As a result of needing to interrogate the TCP control block, certain packets
+during the lifecycle of a connection are unable to trigger a
+.Nm
+log message.
+The initial handshake takes place without the existence of a control block and
+the final ACK is exchanged when the connection is in the TIMEWAIT state.
+.Pp
+.Nm
+was designed to minimise the delay introduced to packets traversing the network
+stack.
+This design called for a highly optimised and minimal hook function that
+extracted the minimal details necessary whilst holding the packet up, and
+passing these details to another thread for actual processing and logging.
+.Pp
+This multithreaded design does introduce some contention issues when accessing
+the data structure shared between the threads of operation.
+When the hook function tries to place details in the structure, it must first
+acquire an exclusive lock.
+Likewise, when the processing thread tries to read details from the structure,
+it must also acquire an exclusive lock to do so.
+If one thread holds the lock, the other must wait before it can obtain it.
+This does introduce some additional bounded delay into the kernel's packet
+processing code path.
+.Pp
+In some cases (e.g. low memory, connection termination), TCP packets that enter
+the
+.Nm
+.Xr pfil 9
+hook function will not trigger a log message to be generated.
+.Nm
+refers to this outcome as a
+.Qq skipped packet .
+Note that
+.Nm
+always ensures that packets are allowed to continue through the stack, even if
+they could not successfully trigger a data log message.
+.Nm
+will therefore not introduce any packet loss for TCP/IP packets traversing the
+network stack.
+.Ss Important Behaviours
+The behaviour of a log file path change whilst the module is enabled is as
+follows:
+.Bl -enum
+.It
+Attempt to open the new file path for writing.
+If this fails, the path change will fail and the existing path will continue to
+be used.
+.It
+Assuming the new path is valid and opened successfully:
+.Bl -dash
+.It
+Flush all pending log messages to the old file path.
+.It
+Close the old file path.
+.It
+Switch the active log file pointer to point at the new file path.
+.It
+Commence logging to the new file.
+.El
+.El
+.Pp
+During the time between the flush of pending log messages to the old file and
+commencing logging to the new file, new log messages will still be generated and
+buffered.
+As soon as the new file path is ready for writing, the accumulated log messages
+will be written out to the file.
+.Sh EXAMPLES
+To enable the module's operations, run the following command as root:
+sysctl net.inet.siftr.enabled=1
+.Pp
+To change the granularity of log messages such that 1 log message is
+generated for every 10 TCP packets per connection, run the following
+command as root:
+sysctl net.inet.siftr.ppl=10
+.Pp
+To change the log file location to /tmp/siftr.log, run the following
+command as root:
+sysctl net.inet.siftr.logfile=/tmp/siftr.log
+.Sh SEE ALSO
+.Xr tcpdump 1 ,
+.Xr tcp 4 ,
+.Xr sysctl 8 ,
+.Xr alq 9 ,
+.Xr pfil 9
+.Sh ACKNOWLEDGEMENTS
+Development of this software was made possible in part by grants from the
+Cisco University Research Program Fund at Community Foundation Silicon Valley,
+and the FreeBSD Foundation.
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 7.4
+and
+.Fx 8.2 .
+.Pp
+.Nm
+was first released in 2007 by Lawrence Stewart and James Healy whilst working on
+the NewTCP research project at Swinburne University of Technology's Centre for
+Advanced Internet Architectures, Melbourne, Australia, which was made possible
+in part by a grant from the Cisco University Research Program Fund at Community
+Foundation Silicon Valley.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Pp
+Work on
+.Nm
+v1.2.x was sponsored by the FreeBSD Foundation as part of
+the
+.Qq Enhancing the FreeBSD TCP Implementation
+project 2008-2009.
+More details are available at:
+.Pp
+http://www.freebsdfoundation.org/
+.Pp
+http://caia.swin.edu.au/freebsd/etcp09/
+.Sh AUTHORS
+.An -nosplit
+.Nm
+was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org
+and
+.An James Healy Aq jimmy@deefa.com .
+.Pp
+This manual page was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
+.Sh BUGS
+Current known limitations and any relevant workarounds are outlined below:
+.Bl -dash
+.It
+The internal queue used to pass information between the threads of operation is
+currently unbounded.
+This allows
+.Nm
+to cope with bursty network traffic, but sustained high packet-per-second
+traffic can cause exhaustion of kernel memory if the processing thread cannot
+keep up with the packet rate.
+.It
+If using
+.Nm
+on a machine that is also running other modules utilising the
+.Xr pfil 9
+framework e.g.
+.Xr dummynet 4 ,
+.Xr ipfw 8 ,
+.Xr pf 4 Ns ,
+the order in which you load the modules is important.
+You should kldload the other modules first, as this will ensure TCP packets
+undergo any necessary manipulations before
+.Nm
+.Qq sees
+and processes them.
+.It
+There is a known, harmless lock order reversal warning between the
+.Xr pfil 9
+mutex and tcbinfo TCP lock reported by
+.Xr witness 4
+when
+.Nm
+is enabled in a kernel compiled with
+.Xr witness 4
+support.
+.It
+There is no way to filter which TCP flows you wish to capture data for.
+Post processing is required to separate out data belonging to particular flows
+of interest.
+.It
+The module does not detect deletion of the log file path.
+New log messages will simply be lost if the log file being used by
+.Nm
+is deleted whilst the module is set to use the file.
+Switching to a new log file using the
+.Em net.inet.siftr.logfile
+variable will create the new file and allow log messages to begin being written
+to disk again.
+The new log file path must differ from the path to the deleted file.
+.It
+The hash table used within the code is sized to hold 65536 flows. This is not a
+hard limit, because chaining is used to handle collisions within the hash table
+structure.
+However, we suspect (based on analogies with other hash table performance data)
+that the hash table look up performance (and therefore the module's packet
+processing performance) will degrade in an exponential manner as the number of
+unique flows handled in a module enable/disable cycle approaches and surpasses
+65536.
+.It
+There is no garbage collection performed on the flow hash table.
+The only way currently to flush it is to disable
+.Nm .
+.It
+The PPL variable applies to packets that make it into the processing thread,
+not total packets received in the hook function.
+Packets are skipped before the PPL variable is applied, which means there may be
+a slight discrepancy in the triggering of log messages.
+For example, if PPL was set to 10, and the 8th packet since the last log message
+is skipped, the 11th packet will actually trigger the log message to be
+generated.
+This is discussed in greater depth in CAIA technical report 070824A.
+.It
+At the time of writing, there was no simple way to hook into the TCP layer
+to intercept packets.
+.Nm Ap s
+use of IP layer hook points means all IP
+traffic will be processed by the
+.Nm
+.Xr pfil 9
+hook function, which introduces minor, but nonetheless unnecessary packet delay
+and processing overhead on the system for non-TCP packets as well.
+Hooking in at the IP layer is also not ideal from the data gathering point of
+view.
+Packets traversing up the stack will be intercepted and cause a log message
+generation BEFORE they have been processed by the TCP layer, which means we
+cannot observe the cause-and-affect relationship between inbound events and the
+corresponding TCP control block as precisely as could be.
+Ideally,
+.Nm
+should intercept packets after they have been processed by the TCP layer i.e.
+intercept packets coming up the stack after they have been processed by
+tcp_input(), and intercept packets coming down the stack after they have been
+processed by tcp_output().
+The current code still gives satisfactory granularity though, as inbound events
+tend to trigger outbound events, allowing the cause-and-effect to be observed
+indirectly by capturing the state on outbound events as well.
+.It
+The
+.Qq inflight bytes
+value logged by
+.Nm
+does not take into account bytes that have been
+.No SACK Ap ed
+by the receiving host.
+.It
+Packet hash generation does not currently work for IPv6 based TCP packets.
+.It
+Compressed notation is not used for IPv6 address representation.
+This consumes more bytes than is necessary in log output.
+.El
diff --git a/share/man/man4/siis.4 b/share/man/man4/siis.4
new file mode 100644
index 000000000000..8bf03dd3ea1b
--- /dev/null
+++ b/share/man/man4/siis.4
@@ -0,0 +1,139 @@
+.\" Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 8, 2011
+.Dt SIIS 4
+.Os
+.Sh NAME
+.Nm siis
+.Nd SiliconImage Serial ATA Host Controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device siis"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+siis_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.siis. Ns Ar X Ns Va .msi
+controls Message Signaled Interrupts (MSI) usage by the specified controller.
+.It Va hint.siisch. Ns Ar X Ns Va .pm_level
+controls SATA interface Power Management for the specified channel,
+allowing some power to be saved at the cost of additional command
+latency.
+Possible values:
+.Bl -tag -compact
+.It 0
+interface Power Management is disabled (default);
+.It 1
+device is allowed to initiate PM state change, host is passive.
+.El
+Note that interface Power Management is not compatible with
+device presence detection.
+A manual bus reset is needed on device hot-plug.
+.It Va hint.siisch. Ns Ar X Ns Va .sata_rev
+setting to nonzero value limits maximum SATA revision (speed).
+Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps.
+.El
+.Sh DESCRIPTION
+This driver provides the
+.Xr CAM 4
+subsystem with native access to the
+.Tn SATA
+ports of controller.
+Each SATA port is represented to CAM as a separate bus with 16 targets.
+Most of the bus-management details are handled by the SATA-specific
+transport of CAM.
+Connected ATA disks are handled by the ATA protocol disk peripheral driver
+.Xr ada 4 .
+ATAPI devices are handled by the SCSI protocol peripheral drivers
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr sa 4 ,
+etc.
+.Pp
+Driver features include support for Serial ATA and ATAPI devices,
+Port Multipliers (including FIS-based switching), hardware command queues
+(31 command per port), Native Command Queuing, SATA interface Power Management,
+device hot-plug and Message Signaled Interrupts.
+.Pp
+The activity LEDs of the adapters supported by the
+.Nm
+driver can be controlled via the
+.Xr led 4
+API for localization or status reporting purposes.
+.Pp
+Same hardware is also supported by the atasiliconimage driver from
+.Xr ata 4
+subsystem.
+If both drivers are loaded at the same time, this one will be
+given precedence as the more functional of the two.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following controller chips:
+.Bl -bullet -compact
+.It
+SiI3124 (PCI-X 133MHz/64bit, 4 ports)
+.It
+SiI3131 (PCIe 1.0 x1, 1 port)
+.It
+SiI3132 (PCIe 1.0 x1, 2 ports)
+.It
+SiI3531 (PCIe 1.0 x1, 1 port)
+.El
+.Sh FILES
+.Bl -tag -width /dev/led/siisch*
+.It Pa /dev/led/siisch*
+identification LED device nodes
+.El
+.Sh SEE ALSO
+.Xr ada 4 ,
+.Xr ata 4 ,
+.Xr cam 4 ,
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr led 4 ,
+.Xr sa 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org .
diff --git a/share/man/man4/simplebus.4 b/share/man/man4/simplebus.4
new file mode 100644
index 000000000000..72bc0e81efb6
--- /dev/null
+++ b/share/man/man4/simplebus.4
@@ -0,0 +1,81 @@
+.\"
+.\" Copyright (c) 2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed by Semihalf under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 12, 2010
+.Dt SIMPLEBUS 4
+.Os
+.Sh NAME
+.Nm simplebus
+.Nd ePAPR simple-bus driver
+.Sh SYNOPSIS
+.Cd "options FDT"
+.Sh DESCRIPTION
+This bus driver is dedicated for the
+.Pa simple-bus
+node of a flattened device tree compliant with the
+.Pa ePAPR
+specification.
+.Pp
+The
+.Nm
+entity does not represent any physical element by itself, it is rather an
+umbrella node grouping integrated on-chip peripherals like interrupt
+controller, connectivity controllers, accelerating engines and so on.
+.Pp
+The driver is generic and common for all flattened device tree nodes claiming
+.Pa simple-bus
+compatibility. It iterates over direct descendants of the
+.Pa simple-bus
+node, instantiates newbus children and assigns resources to them, based on the
+configuration data retrieved from the nodes properties in
+.Xr fdt 4 .
+.Pp
+Note the
+.Nm
+does not manage device resources and passes through any requests to the
+.Xr fdtbus 4 layer.
+.Sh SEE ALSO
+.Xr fdt 4 ,
+.Xr fdtbus 4 ,
+.Xr openfirm 4 ,
+.Sh STANDARDS
+Power.org Standard for Embedded Power Architecture Platform Requirements
+.Pq Vt ePAPR .
+.Sh HISTORY
+The
+.Nm
+support first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+The
+.Nm
+support was developed by Semihalf under sponsorship from the FreeBSD
+Foundation. This manual page was written by
+.An Rafal Jaworowski .
diff --git a/share/man/man4/sio.4 b/share/man/man4/sio.4
new file mode 100644
index 000000000000..07e076d9110a
--- /dev/null
+++ b/share/man/man4/sio.4
@@ -0,0 +1,414 @@
+.\" Copyright (c) 1990, 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Systems Programming Group of the University of Utah Computer
+.\" Science Department.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91
+.\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
+.\" $FreeBSD$
+.\"
+.Dd August 30, 2006
+.Dt SIO 4
+.Os
+.Sh NAME
+.Nm sio
+.Nd "fast interrupt driven asynchronous serial communications interface"
+.Sh SYNOPSIS
+For standard ISA ports:
+.Bd -ragged -offset indent -compact
+.Cd "device sio"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sio.0.at="isa"
+.Cd hint.sio.0.port="0x3f8"
+.Cd hint.sio.0.flags="0x10"
+.Cd hint.sio.0.irq="4"
+.Cd hint.sio.1.at="isa"
+.Cd hint.sio.1.port="0x2f8"
+.Cd hint.sio.1.flags="0x0"
+.Cd hint.sio.1.irq="3"
+.Ed
+.Pp
+For AST compatible multiport cards with 4 ports:
+.Bd -ragged -offset indent -compact
+.Cd "options COM_MULTIPORT"
+.Cd "device sio"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sio.4.at="isa"
+.Cd hint.sio.4.port="0x2a0"
+.Cd hint.sio.4.flags="0x701"
+.Cd hint.sio.5.at="isa"
+.Cd hint.sio.5.port="0x2a8"
+.Cd hint.sio.5.flags="0x701"
+.Cd hint.sio.6.at="isa"
+.Cd hint.sio.6.port="0x2b0"
+.Cd hint.sio.6.flags="0x701"
+.Cd hint.sio.7.at="isa"
+.Cd hint.sio.7.port="0x2b8"
+.Cd hint.sio.7.flags="0x701"
+.Cd hint.sio.7.irq="12"
+.Ed
+.Pp
+For Boca Board compatible multiport cards with 8 ports:
+.Bd -ragged -offset indent -compact
+.Cd "options COM_MULTIPORT"
+.Cd "device sio"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sio.4.at="isa"
+.Cd hint.sio.4.port="0x100"
+.Cd hint.sio.4.flags="0xb05"
+.Cd "..."
+.Cd hint.sio.11.at="isa"
+.Cd hint.sio.11.port="0x138"
+.Cd hint.sio.11.flags="0xb05"
+.Cd hint.sio.11.irq="12"
+.Ed
+.Pp
+For Netmos Nm9845 multiport cards with 6 ports:
+.Bd -ragged -offset indent -compact
+.Cd "options COM_MULTIPORT"
+.Cd "device sio"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sio.4.at="isa"
+.Cd hint.sio.4.port="0xb000"
+.Cd hint.sio.4.flags="0x901"
+.Cd hint.sio.5.at="isa"
+.Cd hint.sio.5.port="0xb400"
+.Cd hint.sio.5.flags="0x901"
+.Cd hint.sio.6.at="isa"
+.Cd hint.sio.6.port="0xb800"
+.Cd hint.sio.6.flags="0x901"
+.Cd hint.sio.7.at="isa"
+.Cd hint.sio.7.port="0xbc00"
+.Cd hint.sio.7.flags="0x901"
+.Cd hint.sio.8.at="isa"
+.Cd hint.sio.8.port="0xc000"
+.Cd hint.sio.8.flags="0x901"
+.Cd hint.sio.9.at="isa"
+.Cd hint.sio.9.port="0xac00"
+.Cd hint.sio.9.flags="0x901"
+.Cd hint.sio.9.irq="12"
+.Ed
+.Pp
+For Hayes ESP cards:
+.Bd -ragged -offset indent -compact
+.Cd "options COM_ESP"
+.Cd "device sio"
+.Cd "..."
+.Ed
+.Pp
+For single port PCI and PCCARD cards:
+.Bd -ragged -offset indent -compact
+.Cd "device sio"
+.Pp
+No lines are required in
+.Pa /boot/device.hints
+for these cards.
+.Ed
+.Pp
+For dual port PCI cards that share an interrupt:
+.Bd -ragged -offset indent -compact
+.Cd "device sio"
+.Cd "options COM_MULTIPORT"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sio.2.flags="0x201"
+.Cd hint.sio.3.flags="0x201"
+.Ed
+.Pp
+Meaning of
+.Ar flags :
+.Bl -tag -offset indent -compact -width 0x000000
+.It 0x00001
+shared IRQs
+.It 0x00002
+disable FIFO
+.It 0x00004
+no AST/4 compatible IRQ control register
+.It 0x00008
+recover sooner from lost output interrupts
+.It 0x00010
+device is potential system console
+.It 0x00020
+device is forced to become system console
+.It 0x00040
+device is reserved for low-level IO (e.g.\& for remote kernel debugging)
+.It 0x00080
+use this port for remote kernel debugging
+.It 0x0 Ns Em ?? Ns 00
+minor number of master port
+.It 0x10000
+PPS timestamping on CTS instead of DCD
+.It 0x20000
+device is assumed to use a 16650A-type (extended FIFO) chip
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for NS8250-, NS16450-, NS16550 and NS16550A-based
+.Tn EIA
+.Tn RS-232C
+.Pf ( Tn CCITT
+.Tn V.24 )
+communications interfaces.
+The NS8250 and NS16450 have single character
+buffers, the NS16550A has 16 character FIFO input and output buffers.
+.Pp
+Input and output for each line may set to one of following baud rates;
+50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
+19200, 28800, 38400, 57600, or 115200.
+Your hardware may limit your baud rate choices.
+.Pp
+The driver supports `multiport' cards.
+Multiport cards are those that have one or more groups of ports
+that share an Interrupt Request (IRQ) line per group.
+Shared IRQs on different cards are not supported.
+Frequently 4 ports share 1 IRQ; some 8 port cards have 2 groups of 4 ports,
+thus using 2 IRQs.
+Some cards allow the first 2 serial ports to have separate IRQs per port
+(as per DOS PC standard).
+.Pp
+Some cards have an IRQ control register for each group.
+Some cards require special initialization related to such registers.
+Only AST/4 compatible IRQ control registers are supported.
+Some cards have an IRQ status register for each group.
+The driver does not require or use such registers yet.
+To work, the control and status registers for a group, if any,
+must be mapped to the scratch register (register 7)
+of a port in the group.
+Such a port is called a
+.Em master
+port.
+.Pp
+The driver supports controller based PCI modems.
+The 3Com FaxModem PCI and the Advantec 56k Voice Messaging PCI
+FaxModem are the only cards supported.
+WinModems, softmodems, hfc modems and any other modems that are not
+controller based are not supported.
+.Pp
+The
+.Em flags
+keyword may be used on each
+.Em device sio
+line in the kernel configuration file
+to disable the FIFO on 16550A UARTs
+(see the synopsis).
+Disabling the FIFO should rarely be necessary.
+.Pp
+The
+.Em flags
+keyword
+.Em must
+be used for all ports that are part of an IRQ sharing group.
+One bit specifies IRQ sharing; another bit specifies whether the port does
+.Em not
+require AST/4 compatible initialization.
+The minor number of the device corresponding a master port
+for the group is encoded as a bitfield in the high byte.
+The same master port must be specified for all ports in a group.
+.Pp
+The
+.Em irq
+specification must be given for master ports
+and for ports that are not part of an IRQ sharing group,
+and not for other ports.
+.Pp
+In the synopsis,
+.Em flags 0x701
+means that the 8th port (sio7) is the master
+port, and that the port is on a multiport card with shared IRQs
+and an AST/4 compatible IRQ control register.
+.Pp
+.Em flags 0xb05
+means that the 12th port (sio11) is the master
+port, and that the port is on a multiport card with shared IRQs
+and no special IRQ control register.
+.Pp
+Which port is the master port depends on the card type.
+Consult the hardware documentation of your card.
+Since IRQ status registers are never used,
+and IRQ control registers are only used for AST/4 compatible cards,
+and some cards map the control/status registers to all ports in a group,
+any port in a group will sometimes do for the master port.
+Choose a port containing an IRQ status register for forwards compatibility,
+and the highest possible port for consistency.
+.Pp
+Serial ports controlled by the
+.Nm
+driver can be used for both `callin' and `callout'.
+For each port there is a callin device and a callout device.
+The minor number of the callout device is 128 higher
+than that of the corresponding callin port.
+The callin device is general purpose.
+Processes opening it normally wait for carrier
+and for the callout device to become inactive.
+The callout device is used to steal the port from
+processes waiting for carrier on the callin device.
+Processes opening it do not wait for carrier
+and put any processes waiting for carrier on the callin device into
+a deeper sleep so that they do not conflict with the callout session.
+The callout device is abused for handling programs that are supposed
+to work on general ports and need to open the port without waiting
+but are too stupid to do so.
+.Pp
+The
+.Nm
+driver also supports an initial-state and a lock-state control
+device for each of the callin and the callout "data" devices.
+The termios settings of a data device are copied
+from those of the corresponding initial-state device
+on first opens and are not inherited from previous opens.
+Use
+.Xr stty 1
+in the normal way on the initial-state devices to program
+initial termios states suitable for your setup.
+.Pp
+The lock termios state acts as flags to disable changing
+the termios state.
+E.g., to lock a flag variable such as CRTSCTS, use
+.Em stty crtscts
+on the lock-state device.
+Speeds and special characters
+may be locked by setting the corresponding value in the lock-state
+device to any nonzero value.
+E.g., to lock a speed to 115200, use
+.Dq Li stty 115200
+on the initial-state device and
+.Dq Li stty 1
+on the lock-state device.
+.Pp
+Correct programs talking to correctly wired external devices
+work with almost arbitrary initial states and almost no locking,
+but other setups may benefit from changing some of the default
+initial state and locking the state.
+In particular, the initial states for non (POSIX) standard flags
+should be set to suit the devices attached and may need to be
+locked to prevent buggy programs from changing them.
+E.g., CRTSCTS should be locked on for devices that support
+RTS/CTS handshaking at all times and off for devices that do not
+support it at all.
+CLOCAL should be locked on for devices that do not support carrier.
+HUPCL may be locked off if you do not
+want to hang up for some reason.
+In general, very bad things happen
+if something is locked to the wrong state, and things should not
+be locked for devices that support more than one setting.
+The CLOCAL flag on callin ports should be locked off for logins
+to avoid certain security holes, but this needs to be done by
+getty if the callin port is used for anything else.
+.Sh FILES
+.Bl -tag -width /dev/ttyd?.init -compact
+.It Pa /dev/ttyd?
+for callin ports
+.It Pa /dev/ttyd?.init
+.It Pa /dev/ttyd?.lock
+corresponding callin initial-state and lock-state devices
+.Pp
+.It Pa /dev/cuad?
+for callout ports
+.It Pa /dev/cuad?.init
+.It Pa /dev/cuad?.lock
+corresponding callout initial-state and lock-state devices
+.El
+.Pp
+.Bl -tag -width /etc/rc.d/serial -compact
+.It Pa /etc/rc.d/serial
+examples of setting the initial-state and lock-state devices
+.El
+.Pp
+The device numbers are made from the set [0-9a-v] so that more than
+10 ports can be supported.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It sio%d: silo overflow.
+Problem in the interrupt handler.
+.El
+.Bl -diag
+.It sio%d: interrupt-level buffer overflow.
+Problem in the bottom half of the driver.
+.El
+.Bl -diag
+.It sio%d: tty-level buffer overflow.
+Problem in the application.
+Input has arrived faster than the given module could process it
+and some has been lost.
+.El
+.\" .Bl -diag
+.\" .It sio%d: reduced fifo trigger level to %d.
+.\" Attempting to avoid further silo overflows.
+.\" .El
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr termios 4 ,
+.Xr tty 4 ,
+.Xr comcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver is derived from the
+.Tn HP9000/300
+.Xr dca 4
+driver and is
+.Ud
+.Sh BUGS
+Data loss may occur at very high baud rates on slow systems,
+or with too many ports on any system,
+or on heavily loaded systems when crtscts cannot be used.
+The use of NS16550A's reduces system load and helps to avoid data loss.
+.Pp
+Stay away from plain NS16550's.
+These are early implementations of the chip with non-functional FIFO hardware.
+.Pp
+The constants which define the locations
+of the various serial ports are holdovers from
+.Tn DOS .
+As shown, hex addresses can be and for clarity probably should be used instead.
+.Pp
+Note that on the AST/4 the card's dipswitches should
+.Em not
+be set to use interrupt sharing.
+AST/4-like interrupt sharing is only used when
+.Em multiple
+AST/4 cards are installed in the same system.
+The
+.Nm
+driver does not support more than 1 AST/4 on one IRQ.
+.Pp
+The examples in the synopsis are too vendor-specific.
diff --git a/share/man/man4/sis.4 b/share/man/man4/sis.4
new file mode 100644
index 000000000000..365b0a250d11
--- /dev/null
+++ b/share/man/man4/sis.4
@@ -0,0 +1,226 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 2, 2010
+.Dt SIS 4
+.Os
+.Sh NAME
+.Nm sis
+.Nd "SiS 900, SiS 7016 and NS DP83815/DP83816 Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device sis"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sis_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the Silicon Integrated Systems SiS 900
+and SiS 7016 Fast Ethernet controller chips.
+.Pp
+This driver also supports
+adapters based on the National Semiconductor DP83815 (MacPhyter) and DP83816
+PCI Ethernet controller chip.
+.Pp
+The SiS 900 is a 100Mbps Ethernet MAC and MII-compliant transceiver
+in a single package.
+It uses a bus master DMA and a scatter/gather
+descriptor scheme.
+The SiS 7016 is similar to the SiS 900 except
+that it has no internal PHY, requiring instead an external transceiver
+to be attached to its MII interface.
+The SiS 900 and SiS 7016 both have a 128-bit multicast hash filter
+and a single perfect filter entry for the station address.
+.Pp
+The NS DP83815 is also a 100Mbps Ethernet MAC with integrated PHY.
+The NatSemi chip and the SiS 900 share many of the same features and
+a fairly similar programming interface, hence both chips are supported
+by the same driver.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width 10baseTXUTP
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Sq full-duplex
+or
+.Sq half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Sq full-duplex
+or
+.Sq half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width full-duplex
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Silicon Integrated Systems SiS 900 and SiS 7016 based
+Fast Ethernet adapters and embedded controllers, as well as Fast Ethernet
+adapters based on the National Semiconductor DP83815 (MacPhyter) and DP83816
+chips.
+Supported adapters include:
+.Pp
+.Bl -bullet -compact
+.It
+@Nifty FNECHARD IFC USUP-TX
+.It
+MELCO LGY-PCI-TXC
+.It
+Netgear FA311-TX (DP83815)
+.It
+Netgear FA312-TX (DP83815)
+.It
+SiS 630, 635, and 735 motherboard chipsets
+.It
+Soekris Engineering net45xx, net48xx, lan1621, and lan1641
+.El
+.Sh SYSCTL VARIABLES
+The following variable is available as both
+.Xr sysctl 8
+variable and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.sis.%unit.manual_pad
+This variable controls how to pad short frames for DP83815/DP83816
+controllers on the specified device.
+DP83815/DP83816 controllers are known to pad 0xFF for short frames
+which is violation of RFC 1042.
+Set this variable to a non-zero value to let driver manually pad
+each short frame with zeros at the cost of extra CPU cycles.
+The default value is 0 to let hardware perform automatic padding.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "sis%d: couldn't map ports/memory"
+A fatal initialization error has occurred.
+.It "sis%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "sis%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (e.g.\& a cable fault).
+.It "sis%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "sis%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "sis%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform a
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T SiS 900 and SiS 7016 datasheets
+.%U http://www.sis.com.tw
+.Re
+.Rs
+.%T NatSemi DP83815 datasheet
+.%U http://www.national.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
diff --git a/share/man/man4/sk.4 b/share/man/man4/sk.4
new file mode 100644
index 000000000000..71e30c90a405
--- /dev/null
+++ b/share/man/man4/sk.4
@@ -0,0 +1,241 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 23, 2010
+.Dt SK 4
+.Os
+.Sh NAME
+.Nm sk
+.Nd "SysKonnect SK-984x and SK-982x PCI Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device sk"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sk_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the SysKonnect SK-984x and SK-982x series PCI
+Gigabit Ethernet adapters.
+.Pp
+The SysKonnect adapters consist of two main components: the XaQti Corp.
+XMAC II gigabit MAC and the SysKonnect GEnesis controller ASIC.
+The
+XMAC provides the gigabit MAC and PHY support while the GEnesis
+provides an interface to the PCI bus, DMA support, packet buffering
+and arbitration.
+The GEnesis can control up to two XMACs simultaneously,
+allowing dual-port NIC configurations.
+.Pp
+The SK-982x 1000baseT adapters also include a Broadcom BCM5400 1000baseTX
+PHY which is used in place of the XMAC's internal PHY.
+The Broadcom PHY is connected to the XMAC via its GMII port.
+.Pp
+The
+.Nm
+driver configures dual port SysKonnect adapters such that each XMAC
+is treated as a separate logical network interface.
+Both ports can
+operate independently of each other and can be connected to separate
+networks.
+The SysKonnect driver software currently only uses the
+second port on dual port adapters for failover purposes: if the link
+on the primary port fails, the SysKonnect driver will automatically
+switch traffic onto the second port.
+.Pp
+Also supported is the Marvell Semiconductor 88E100* gigabit PHY.
+.Pp
+The XaQti XMAC II supports full and half duplex operation with
+autonegotiation.
+The XMAC also supports unlimited frame sizes.
+Support for jumbo frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+Using jumbo frames can greatly improve performance for certain tasks,
+such as file transfers and data streaming.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 1000baseTX
+Set 1000baseTX operation over twisted pair.
+This is only available
+for SK-982x series adapters with 1000baseT ports.
+Both
+.Ar full-duplex
+and
+.Ar half-duplex
+modes are supported.
+.It 1000baseSX
+Set 1000Mbps (Gigabit Ethernet) operation.
+Both
+.Ar full-duplex
+and
+.Ar half-duplex
+modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+Adapters supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3C940 single port, 1000baseT adapter
+.It
+3Com 3C2000-T single port, 1000baseT adapter
+.It
+Belkin F5D5005 single port, 1000baseT adapter
+.It
+D-Link DGE-530T single port, 1000baseT adapter
+.It
+Linksys (revision 2) single port, 1000baseT adapter
+.It
+SK-9521 SK-NET GE-T single port, 1000baseT adapter
+.It
+SK-9821 SK-NET GE-T single port, 1000baseT adapter
+.It
+SK-9822 SK-NET GE-T dual port, 1000baseT adapter
+.It
+SK-9841 SK-NET GE-LX single port, single mode fiber adapter
+.It
+SK-9842 SK-NET GE-LX dual port, single mode fiber adapter
+.It
+SK-9843 SK-NET GE-SX single port, multimode fiber adapter
+.It
+SK-9844 SK-NET GE-SX dual port, multimode fiber adapter
+.It
+SMC 9452TX single port, 1000baseT adapter
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width xxxxxx
+.It Va hw.skc.jumbo_disable
+Disable jumbo frame support.
+Systems with less memory can set it to a non-zero value to save memory.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variable is available as both
+.Xr sysctl 8
+variable and
+.Xr loader 8
+tunable:
+.Bl -tag -width xxxxxx
+.It Va dev.skc.%d.int_mod
+This variable controls interrupt moderation.
+The accepted range is 10 to 10000.
+The default value is 100 microseconds.
+The interface has to be brought down and up again before a change takes effect.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "sk%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "sk%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "sk%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "sk%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "sk%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "sk%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "sk%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T XaQti XMAC II datasheet
+.%U http://www.xaqti.com
+.Re
+.Rs
+.%T SysKonnect GEnesis programming manual
+.%U http://www.syskonnect.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/share/man/man4/smb.4 b/share/man/man4/smb.4
new file mode 100644
index 000000000000..afe4605b449f
--- /dev/null
+++ b/share/man/man4/smb.4
@@ -0,0 +1,204 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" Copyright (c) 2004, Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 6, 2009
+.Dt SMB 4
+.Os
+.Sh NAME
+.Nm smb
+.Nd SMB generic I/O device driver
+.Sh SYNOPSIS
+.Cd "device smb"
+.Sh DESCRIPTION
+The
+.Em smb
+character device driver provides generic i/o to any
+.Xr smbus 4
+instance.
+In order to control SMB devices, use
+.Pa /dev/smb?
+with the ioctls described below.
+Any of these ioctl commands takes a pointer to
+.Vt struct smbcmd
+as its argument.
+.Bd -literal
+#include <sys/types.h>
+
+struct smbcmd {
+ char cmd;
+ int count;
+ u_char slave;
+ union {
+ char byte;
+ short word;
+
+ char *byte_ptr;
+ short *word_ptr;
+
+ struct {
+ short sdata;
+ short *rdata;
+ } process;
+ } data;
+};
+.Ed
+.Pp
+The
+.Fa slave
+field is always used, and provides the address of the
+SMBus slave device to talk to.
+The slave address is specified in the seven most significant bits
+.Pq i.e. Dq "left-justified" .
+The least significant bit of the slave address must be zero.
+.Pp
+.Bl -column ".Dv SMB_QUICK_WRITE" -compact
+.It Em Ioctl Ta Em Description
+.Pp
+.It Dv SMB_QUICK_WRITE Ta
+The
+.Em QuickWrite
+command just issues the device address with write intent
+to the bus, without transferring any data.
+.It Dv SMB_QUICK_READ Ta
+The
+.Em QuickRead
+command just issues the device address with read intent
+to the bus, without transferring any data.
+.It Dv SMB_SENDB Ta
+The
+.Em SendByte
+command sends the byte provided in the
+.Fa cmd
+field to the device.
+.It Dv SMB_RECVB Ta
+The
+.Em ReceiveByte
+command reads a single byte from the device which will
+be returned in the
+.Fa cmd
+field.
+.It Dv SMB_WRITEB Ta
+The
+.Em WriteByte
+command first sends the byte from the
+.Fa cmd
+field to the device, followed by the byte given in
+.Fa data.byte .
+.It Dv SMB_WRITEW Ta
+The
+.Em WriteWord
+command first sends the byte from the
+.Fa cmd
+field to the device, followed by the word given in
+.Fa data.word .
+Note that the SMBus byte-order is little-endian by definition.
+.It Dv SMB_READB Ta
+The
+.Em ReadByte
+command first sends the byte from the
+.Fa cmd
+field to the device, and then reads one byte of data from
+the device.
+The returned data will be stored in the location pointed to by
+.Fa data.byte_ptr .
+.It Dv SMB_READW Ta
+The
+.Em ReadWord
+command first sends the byte from the
+.Fa cmd
+field to the device, and then reads one word of data from
+the device.
+The returned data will be stored in the location pointed to by
+.Fa data.word_ptr .
+.It Dv SMB_PCALL Ta
+The
+.Em ProcedureCall
+command first sends the byte from the
+.Fa cmd
+field to the device, followed by the word provided in
+.Fa data.process.sdata .
+It then reads one word of data from the device, and returns it
+in the location pointed to by
+.Fa data.process.rdata .
+.It Dv SMB_BWRITE Ta
+The
+.Em BlockWrite
+command first sends the byte from the
+.Fa cmd
+field to the device, followed by
+.Fa count
+bytes of data that are taken from the buffer pointed to by
+.Fa data.byte_ptr .
+The SMBus specification mandates that no more than 32 bytes of
+data can be transferred in a single block read or write command.
+This value is available in the constant
+.Dv SMB_MAXBLOCKSIZE .
+.It Dv SMB_BREAD Ta
+The
+.Em BlockRead
+command first sends the byte from the
+.Fa cmd
+field to the device, and then reads
+.Fa count
+bytes of data that from the device.
+These data will be returned in the buffer pointed to by
+.Fa data.byte_ptr .
+.El
+.Pp
+The
+.Xr read 2
+and
+.Xr write 2
+system calls are not implemented by this driver.
+.Sh ERRORS
+The
+.Xr ioctl 2
+commands can cause the following driver-specific errors:
+.Bl -tag -width Er
+.It Bq Er ENXIO
+Device did not respond to selection.
+.It Bq Er EBUSY
+Device still in use.
+.It Bq Er ENODEV
+Operation not supported by device (not supposed to happen).
+.It Bq Er EINVAL
+General argument error.
+.It Bq Er EWOULDBLOCK
+SMBus transaction timed out.
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/smbus.4 b/share/man/man4/smbus.4
new file mode 100644
index 000000000000..1d23117f0ac6
--- /dev/null
+++ b/share/man/man4/smbus.4
@@ -0,0 +1,80 @@
+.\" Copyright (c) 1998, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 1998
+.Dt SMBUS 4
+.Os
+.Sh NAME
+.Nm smbus
+.Nd System Management Bus
+.Sh SYNOPSIS
+.Cd "device smbus"
+.Pp
+.Cd "device iicsmb"
+.Cd "device bktr"
+.Sh DESCRIPTION
+The
+.Em smbus
+system provides a uniform, modular and architecture-independent
+system for the implementation of drivers to control various SMB devices
+and to utilize different SMB controllers (I2C, PIIX4, Brooktree848, vm86...).
+.Sh System Management Bus
+The
+.Em System Management Bus
+is a two-wire interface through which simple power-related chips can communicate
+with rest of the system.
+It uses I2C as its backbone (see
+.Xr iicbus 4 ) .
+.Pp
+A system using SMB passes messages to and from devices instead of tripping
+individual control lines.
+.Pp
+With the SMBus, a device can provide manufacturer information, tell the
+system what its model/part number is, save its state for a suspend event,
+report different types of errors, accept control parameters, and return its
+status.
+.Pp
+The SMBus may share the same host device and physical bus as ACCESS bus
+components provided that an appropriate electrical bridge is provided
+between the internal SMB devices and external ACCESS bus devices.
+.Sh SEE ALSO
+.Xr bktr 4 ,
+.Xr iicbus 4 ,
+.Xr iicsmb 4 ,
+.Xr smb 4
+.Rs
+.%T The SMBus specification
+.%U http://www.smbus.org/specs/
+.Re
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
diff --git a/share/man/man4/smp.4 b/share/man/man4/smp.4
new file mode 100644
index 000000000000..1dfd283e45d0
--- /dev/null
+++ b/share/man/man4/smp.4
@@ -0,0 +1,163 @@
+.\" Copyright (c) 1997
+.\" Steve Passe <fsmp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the developer may NOT be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 7, 2008
+.Dt SMP 4
+.Os
+.Sh NAME
+.Nm SMP
+.Nd description of the FreeBSD Symmetric Multi-Processor kernel
+.Sh SYNOPSIS
+.Cd options SMP
+.Sh DESCRIPTION
+The
+.Nm
+kernel implements symmetric multi-processor support.
+.Sh COMPATIBILITY
+Support for multi-processor systems is present for all Tier-1
+architectures on
+.Fx .
+Currently, this includes amd64, i386, ia64, and sparc64.
+Support is enabled using
+.Cd options SMP .
+It is permissible to use the SMP kernel configuration on non-SMP equipped
+motherboards.
+.Sh I386 NOTES
+For i386 systems, the
+.Nm
+kernel supports motherboards that follow the Intel MP specification,
+version 1.4.
+In addition to
+.Cd options SMP ,
+i386 also requires
+.Cd device apic .
+The
+.Xr mptable 1
+command may be used to view the status of multi-processor support.
+.Pp
+The number of CPUs detected by the system is available in
+the read-only sysctl variable
+.Va hw.ncpu .
+.Pp
+.Fx
+allows specific CPUs on a multi-processor system to be disabled.
+This can be done using the
+.Va hint.lapic.X.disabled
+tunable, where X is the APIC ID of a CPU.
+Setting this tunable to 1 will result in the corresponding CPU being
+disabled.
+.Pp
+The
+.Xr sched_ule 4
+scheduler implements CPU topology detection and adjusts the scheduling
+algorithms to make better use of modern multi-core CPUs.
+The sysctl variable
+.Va kern.sched.topology_spec
+reflects the detected CPU hardware in a parsable XML format.
+The top level XML tag is <groups>, which encloses one or more <group> tags
+containing data about individual CPU groups.
+A CPU group contains CPUs that are detected to be "close" together, usually
+by being cores in a single multi-core processor.
+Attributes available in a <group> tag are "level", corresponding to the
+nesting level of the CPU group and "cache-level", corresponding to the
+level of CPU caches shared by the CPUs in the group.
+The <group> tag contains the <cpu> and <flags> tags.
+The <cpu> tag describes CPUs in the group.
+Its attributes are "count", corresponding to the number of CPUs in the
+group and "mask", corresponding to the integer binary mask in which
+each bit position set to 1 signifies a CPU belonging to the group.
+The contents (CDATA) of the <cpu> tag is the comma-delimited list
+of CPU indexes (derived from the "mask" attribute).
+The <flags> tag contains special tags (if any) describing the relation
+of the CPUs in the group.
+The possible flags are currently "HTT" and "SMT", corresponding to
+the various implementations of hardware multithreading.
+An example topology_spec output for a system consisting of
+two quad-core processors is:
+.Bd -literal
+<groups>
+ <group level="1" cache-level="0">
+ <cpu count="8" mask="0xff">0, 1, 2, 3, 4, 5, 6, 7</cpu>
+ <flags></flags>
+ <children>
+ <group level="2" cache-level="0">
+ <cpu count="4" mask="0xf">0, 1, 2, 3</cpu>
+ <flags></flags>
+ </group>
+ <group level="2" cache-level="0">
+ <cpu count="4" mask="0xf0">4, 5, 6, 7</cpu>
+ <flags></flags>
+ </group>
+ </children>
+ </group>
+</groups>
+.Ed
+.Pp
+This information is used internally by the kernel to schedule related
+tasks on CPUs that are closely grouped together.
+.Pp
+.Fx
+supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms.
+Because using logical CPUs can cause performance penalties under certain loads,
+the logical CPUs can be disabled by setting the
+.Va machdep.hyperthreading_allowed
+tunable to zero.
+.Sh SEE ALSO
+.Xr cpuset 1 ,
+.Xr mptable 1 ,
+.Xr sched_4bsd 4 ,
+.Xr sched_ule 4 ,
+.Xr loader 8 ,
+.Xr sysctl 8 ,
+.Xr condvar 9 ,
+.Xr msleep 9 ,
+.Xr mtx_pool 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sx 9
+.Sh HISTORY
+The
+.Nm
+kernel's early history is not (properly) recorded.
+It was developed
+in a separate CVS branch until April 26, 1997, at which point it was
+merged into 3.0-current.
+By this date 3.0-current had already been
+merged with Lite2 kernel code.
+.Pp
+.Fx 5.0
+introduced support for a host of new synchronization primitives, and
+a move towards fine-grained kernel locking rather than reliance on
+a Giant kernel lock.
+The SMPng Project relied heavily on the support of BSDi, who provided
+reference source code from the fine-grained SMP implementation found
+in
+.Bsx .
+.Pp
+.Fx 5.0
+also introduced support for SMP on the ia64 and sparc64 architectures.
+.Sh AUTHORS
+.An Steve Passe Aq fsmp@FreeBSD.org
diff --git a/share/man/man4/sn.4 b/share/man/man4/sn.4
new file mode 100644
index 000000000000..00c9411c9009
--- /dev/null
+++ b/share/man/man4/sn.4
@@ -0,0 +1,109 @@
+.\"
+.\" Copyright (c) 2000 Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt SN 4
+.Os
+.Sh NAME
+.Nm sn
+.Nd "Ethernet driver for SMC91Cxx based cards"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sn"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sn_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver supports SMC91Cxx based ISA and PCMCIA cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports SMC91Cxx based ISA and PCMCIA cards including:
+.Pp
+.Bl -bullet -compact
+.It
+3Com Megahertz X-Jack Ethernet PC Card XJ10BT, XJ10BC
+.It
+3Com Megahertz XJEM and CCEM series: CCEM3288C, CCEM3288T, CCEM3336,
+CEM3336C, CCEM3336T, XJEM1144C, XJEM1144T, XJEM3288C, XJEM3288T, XJEM3336
+.It
+Farallon EtherMac PC Card 595a
+.It
+Motorola Mariner Ethernet/Modem PC Card
+.It
+Ositech Seven of Diamonds Ethernet PC Card
+.It
+Ositech Jack of Hearts Ethernet/Modem PC Card
+.It
+Psion Gold Card Netglobal Ethernet PC Card
+.It
+Psion Gold Card Netglobal 10/100 Fast Ethernet PC Card
+.It
+Psion Gold Card Netglobal 56k+10Mb Ethernet PC Card
+.It
+SMC EZEther PC Card (8020BT)
+.It
+SMC EZEther PC Card (8020T)
+.El
+.Pp
+The
+.Nm
+driver supports the SMC 91C90, SMC 91C92, SMC 91C94, SMC 91C95, SMC 91C96,
+SMC91C100 and SMC 91C100FD chips from SMC.
+.Pp
+The Farallon EtherWave and EtherMac card came in two varieties.
+The
+.Xr ep 4
+driver supports the 595 and 895 cards.
+These cards have the blue arrow on the front along with a 3Com logo.
+The Farallon 595a cards, which have a red arrow on the front,
+are also called EtherWave and EtherMac.
+They are supported by the
+.Nm
+driver.
+.Sh SEE ALSO
+.Xr ed 4 ,
+.Xr ep 4 ,
+.Xr ie 4 ,
+.Xr intro 4 ,
+.Xr ng_ether 4 ,
+.Xr vx 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 4.0 .
diff --git a/share/man/man4/snd_ad1816.4 b/share/man/man4/snd_ad1816.4
new file mode 100644
index 000000000000..3d2cb0c444a1
--- /dev/null
+++ b/share/man/man4/snd_ad1816.4
@@ -0,0 +1,81 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_AD1816 4
+.Os
+.Sh NAME
+.Nm snd_ad1816
+.Nd "Analog Devices AD1816 ISA bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_ad1816"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_ad1816_load="YES"
+.Ed
+.Pp
+Non-PnP cards require the following lines in
+.Xr device.hints 5 :
+.Bd -literal -offset indent
+hint.pcm.0.at="isa"
+hint.pcm.0.irq="10"
+hint.pcm.0.drq="1"
+hint.pcm.0.flags="0x0"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the AD1816 sound card.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Analog Devices AD1816
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An "Cameron Grant" Aq cg@FreeBSD.org
+.An "Luigi Rizzo" Aq luigi@FreeBSD.org
+.An "Hannu Savolainen"
diff --git a/share/man/man4/snd_als4000.4 b/share/man/man4/snd_als4000.4
new file mode 100644
index 000000000000..a13779a29046
--- /dev/null
+++ b/share/man/man4/snd_als4000.4
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_ALS4000 4
+.Os
+.Sh NAME
+.Nm snd_als4000
+.Nd "Avance Logic ALS4000 PCI bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_als4000"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_als4000_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the ALS4000 sound card.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Avance Logic ALS4000
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+.An "Orion Hodson" Aq oho@acm.org
diff --git a/share/man/man4/snd_atiixp.4 b/share/man/man4/snd_atiixp.4
new file mode 100644
index 000000000000..ba02da648bd2
--- /dev/null
+++ b/share/man/man4/snd_atiixp.4
@@ -0,0 +1,100 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 29, 2006
+.Dt SND_ATIIXP 4
+.Os
+.Sh NAME
+.Nm snd_atiixp
+.Nd "ATI IXP bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_atiixp"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_atiixp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach to ATI IXP audio devices.
+This driver supports 16bit playback and recording, and 32bit native playback
+and recording.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+variables are available in addition to those available to all
+.Xr sound 4
+devices:
+.Bl -tag -width ".Va dev.pcm.%d.polling" -offset indent
+.It Va dev.pcm.%d.polling
+Experimental polling mode, where the driver operates by querying the device
+state on each tick using
+.Xr callout 9 .
+Polling is disabled by default.
+Do not enable it unless you are facing weird interrupt problems or if the
+device cannot generate interrupts at all.
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+ATI IXP 200
+.It
+ATI IXP 300
+.It
+ATI IXP 400
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.1 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver
+does not support S/PDIF, but implementing it should be fairly easy if the
+right hardware is available.
+.Pp
+32bit native recording is broken on some hardware.
diff --git a/share/man/man4/snd_cmi.4 b/share/man/man4/snd_cmi.4
new file mode 100644
index 000000000000..d6dc088215c7
--- /dev/null
+++ b/share/man/man4/snd_cmi.4
@@ -0,0 +1,76 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_CMI 4
+.Os
+.Sh NAME
+.Nm snd_cmi
+.Nd "CMedia CMI8338/CMI8738 PCI bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_cmi"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_cmi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the CMedia CMI8338/CMI8738 audio cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+CMedia CMI8338A
+.It
+CMedia CMI8338B
+.It
+CMedia CMI8738
+.It
+CMedia CMI8738B
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.3 .
+.Sh AUTHORS
+.An "Orion Hodson" Aq O.Hodson@cs.ucl.ac.uk
diff --git a/share/man/man4/snd_cs4281.4 b/share/man/man4/snd_cs4281.4
new file mode 100644
index 000000000000..2b94174dde54
--- /dev/null
+++ b/share/man/man4/snd_cs4281.4
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_CS4281 4
+.Os
+.Sh NAME
+.Nm snd_cs4281
+.Nd "Crystal Semiconductor CS4281 PCI bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_cs4281"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_cs4281_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the CS4281 sound card.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Crystal Semiconductor CS4281
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.3 .
+.Sh AUTHORS
+.An "Orion Hodson" Aq O.Hodson@cs.ucl.ac.uk
diff --git a/share/man/man4/snd_csa.4 b/share/man/man4/snd_csa.4
new file mode 100644
index 000000000000..36a6857e8ffd
--- /dev/null
+++ b/share/man/man4/snd_csa.4
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright (c) 1999 Seigo Tanimura
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_CSA 4
+.Os
+.Sh NAME
+.Nm snd_csa
+.Nd Crystal Semiconductor CS461x/462x/4280 PCI bridge device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_csa"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_csa_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to Crystal Semiconductor CS461x/462x/4280 based sound cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Crystal Semiconductor CS4280
+.It
+Crystal Semiconductor CS4610
+.It
+Crystal Semiconductor CS4611
+.It
+Crystal Semiconductor CS4614
+.It
+Crystal Semiconductor CS4615
+.It
+Crystal Semiconductor CS4622
+.It
+Crystal Semiconductor CS4624
+.It
+Crystal Semiconductor CS4630
+.It
+Genius Soundmaker 128 Value
+.It
+Hercules Game Theatre XP
+.It
+Turtle Beach Santa Cruz
+.El
+.Pp
+Some onboard CS4610 chips are accompanied by the CS423x ISA codec
+instead of the CS4297 AC97 codec.
+Such configurations are not
+supported by the
+.Nm
+driver yet.
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
diff --git a/share/man/man4/snd_ds1.4 b/share/man/man4/snd_ds1.4
new file mode 100644
index 000000000000..d6919244c80c
--- /dev/null
+++ b/share/man/man4/snd_ds1.4
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_DS1 4
+.Os
+.Sh NAME
+.Nm snd_ds1
+.Nd "Yamaha DS-1 PCI bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_ds1"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_ds1_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the Yamaha DS-1 sound card.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Yamaha DS-1
+.It
+Yamaha DS-1E
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An "Cameron Grant" Aq cg@FreeBSD.org
diff --git a/share/man/man4/snd_emu10k1.4 b/share/man/man4/snd_emu10k1.4
new file mode 100644
index 000000000000..3052f1238bb0
--- /dev/null
+++ b/share/man/man4/snd_emu10k1.4
@@ -0,0 +1,82 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_EMU10K1 4
+.Os
+.Sh NAME
+.Nm snd_emu10k1
+.Nd "SoundBlaster Live! and Audigy PCI bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_emu10k1"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_emu10k1_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the SoundBlaster Live!\& and Audigy audio cards.
+.Pp
+Digital output is supported by default.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Creative SoundBlaster Live!\& (EMU10K1 Chipset)
+.It
+Creative SoundBlaster Audigy (EMU10K2 Chipset)
+.It
+Creative SoundBlaster Audigy 2 (EMU10K2 Chipset)
+.It
+Creative SoundBlaster Audigy 2 (EMU10K3 Chipset)
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An "David O'Brien" Aq obrien@FreeBSD.org
+.An "Orlando Bassotto" Aq orlando.bassotto@ieo-research.it
+.An "Cameron Grant" Aq cg@FreeBSD.org
+.Sh BUGS
+Fancy features like DD5.1 output are not supported.
diff --git a/share/man/man4/snd_emu10kx.4 b/share/man/man4/snd_emu10kx.4
new file mode 100644
index 000000000000..72568c3ffec6
--- /dev/null
+++ b/share/man/man4/snd_emu10kx.4
@@ -0,0 +1,296 @@
+.\"
+.\" Copyright (c) 2003-2007 Yuriy Tsibizov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 28, 2008
+.Dt SND_EMU10KX 4
+.Os
+.Sh NAME
+.Nm snd_emu10kx
+.Nd Creative SoundBlaster Live! and Audigy sound cards device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_emu10kx"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_emu10kx_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to Creative sound cards based on the EMU10K1, CA0100, CA0101, CA0102
+and CA0108 DSPs.
+.Pp
+The
+.Nm
+sound cards have a PCM part, which is accessible through one to five
+.Xr pcm 4
+devices (see
+.Sx MULTICHANNEL PLAYBACK
+for details), and MPU401-compatible MIDI I/O controller, which is accessible
+through the midi device.
+Wave table synthesizer support is not available.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Creative Sound Blaster Live!\& (EMU10K1 Chipset).
+Both PCM and MIDI interfaces are available.
+.It
+Creative Sound Blaster Audigy (CA0100 and CA0101 Chipset).
+PCM and two MIDI interfaces available.
+.It
+Creative Sound Blaster Audigy 2 and Creative Sound Blaster Audigy 4 (CA0102
+Chipset).
+PCM support is limited to 48kHz/16 bit stereo (192kHz/24 bit part
+of this chipset is not supported).
+.It
+Creative Sound Blaster Audigy 2 Value (CA0108 Chipset).
+PCM support is limited
+to 48kHz/16 bit stereo (192kHz/24 bit part of this chipset is not supported).
+There is no MIDI support for this card.
+.El
+.Pp
+The
+.Nm
+driver does
+.Em not
+support the following sound cards (although they have names
+similar to some supported ones):
+.Pp
+.Bl -bullet -compact
+.It
+Creative Sound Blaster Live!\& 24-Bit, identified by
+.Fx
+as
+.Qq Li "emu10k1x Soundblaster Live! 5.1" .
+.It
+Creative Sound Blaster Audigy LS / ES, identified by
+.Fx
+as
+.Qq Li "CA0106-DAT Audigy LS" .
+.It
+All other Creative sound cards with -DAT chipsets.
+.It
+All Creative X-Fi series sound cards.
+.El
+.Sh MULTICHANNEL PLAYBACK
+By default the
+.Nm
+driver is loaded with multichannel playback capabilities enabled.
+If you do not set the
+.Dv hint.emu10kx.0.multichannel_disabled
+option in your
+.Xr loader.conf 5
+configuration file you will get up to five DSP devices, one for each
+sound card output.
+You can use additional software (like
+.Em audio/pulseaudio
+from
+.Em The Ports Collection )
+to do sound stream demultiplexing.
+Only
+.Dq FRONT
+output can play and record sound from external
+sources (like line or S/PDIF inputs).
+.Sh MULTICHANNEL RECORDING
+By default multichannel recording capabilities are not enabled when you load
+the
+.Nm
+driver.
+If you enable the
+.Dv hint.emu10kx.0.multichannel_recording
+option in
+.Xr loader.conf 5
+you will get one more DSP device that is rate-locked to 48kHz/16bit/mono.
+This is actually 48kHz/16bit/32 channels on SB Live! cards and
+48kHz/16bit/64channels on Audigy cards, but the current implementation of
+the sound subsystem does not support such an amount of PCM channels.
+This device can not be opened for read, thus confusing many applications.
+.Pp
+Within a multichannel stream, the first half (0-15 or 0-31) is a copy of all DSP
+outputs, the second half (15-30 or 32-63) is a copy of some DSP inputs.
+On Live! cards the last substream (31) is used as a sync stream and is always
+set to 0xc0de.
+Audigy cards do not need such sync data, because a stream always starts with
+substream 0.
+.Ss SB Live! substream map (in byte offsets, each substream is 2 bytes LE)
+.Bl -tag -width ".Dv +0x00..+0x1E"
+.It Dv Offset
+Substream
+.It +0x00..+0x1E
+PCM streams 0..15
+.It +0x20, +0x22
+Empty
+.It +0x24..+0x2A
+PCM inputs: front left, front right, rear left, rear right, center, sub
+.It +0x2C..+0x3C
+DSP inputs 0..8:
+.It +0x3E
+sync substream (0xc0de)
+.El
+.Ss Audigy substream map (in byte offsets, each substream is 2 bytes LE)
+.Bl -tag -width ".Dv +0x00..+0x3E"
+.It Dv Offset
+Substream
+.It +0x00..+0x3E
+PCM streams 0..31
+.It +0x40..+0x5E
+PCM inputs: front LR, rear LR, center, sub, ...
+.It +0x60..+0x7E
+DSP inputs 0..16
+.El
+.Sh OSS MIXER CONTROLS
+These are the controls available through the standard OSS programming interface.
+You can use
+.Xr mixer 8
+to change them.
+.Pp
+On EMU10K1-based cards the OSS mixer directly controls the AC97 codec.
+On newer cards the OSS mixer controls some parameters of the AC97 codec and
+some DSP-based mixer controls.
+.Bl -inset
+.It Qq vol
+mixer control for the overall sound volume.
+.It Qq pcm
+mixer control for the PCM playback volume.
+It controls only front output
+volume in multichannel mode and all output volume in single channel mode.
+.It Qq rec
+mixer control acts very differently on EMU10K1 and other cards.
+On EMU10K1 cards it controls the AC97 codec recording level.
+On non-EMU10K1 cards it controls the amount of AC97
+.Dq stereo mix
+ entering the DSP.
+AC97 recording level and AC97 recording source are fixed on CA0100, CA0101,
+CA0102 and CA0108 cards.
+The AC97 recording levels are always set to maximum and recording source is always
+.Dq Li "stereo mix" .
+.It Qq dig1
+is a CD S/PDIF (on-card) volume control
+.It Qq dig2
+is an AudigyDrive S/PDIF (Audigy series) or TOSLink (SB Live! series) volume
+control
+.It Qq dig3
+is an on-card S/PDIF volume control
+.It Qq line2
+is AudigyDrive "Line In 2" volume control
+.It Qq line3
+is AudigyDrive "AUX In 2" volume control
+.El
+.Pp
+Other OSS mixer controls control the inputs of the AC97 codec.
+.Sh PRIVATE DEVICE CONTROLS
+You can control some of EMU10Kx's operation and configuration parameters through
+.Va dev.emu10kx. Ns Aq Ar X
+sysctls.
+These
+.Xr sysctl 8
+values are temporary and should not be relied upon.
+.Sh DRIVER CONFIGURATION
+Loader tunables are used to set driver configuration.
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or they can be stored in
+.Pa /boot/loader.conf .
+These tunables cannot be changed from a machine
+.Xr sysctl 8
+entry after boot, but you can change them using
+.Xr kenv 1
+before loading the
+.Nm
+driver.
+.Bl -tag -width indent
+.It Va hint.emu10kx. Ns Ao Ar X Ac Ns Va .disabled
+Disables loading a driver instance.
+.It Va hint.emu10kx. Ns Ao Ar X Ac Ns Va .multichannel_disabled
+Disables multichannel playback support, when one card is represented as
+several PCM devices.
+.It Va hint.emu10kx. Ns Ao Ar X Ac Ns Va .multichannel_recording
+Enables experimental multichannel recording support.
+.It Va hint.emu10kx. Ns Ao Ar X Ac Ns Va .debug
+Set debug output level.
+.Bl -tag -width 2n
+.It 0
+No additional debug options enabled
+.It 1
+Enables all DSP outputs to be connected, even those
+that are known to be unused on a particular card.
+.It 2
+Additional debug messages about in-driver events will be printed.
+.It 2
+Additional debug messages will be printed when memory allocation fails.
+.El
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/emu10kx?" -compact
+.It Pa /dev/emu10kx?
+.Nm
+management interface
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The PCM part of the driver is based on the
+.Xr snd_emu10k1 4
+SB Live!\& driver by
+.An Cameron Grant Aq cg@FreeBSD.org .
+The MIDI interface is based on the
+.Xr snd_emu10k1 4
+MIDI interface code by
+.An Mathew Kanner Aq matk@FreeBSD.org .
+The
+.Nm
+device driver and this manual page were written by
+.An Yuriy Tsibizov .
+.Sh BUGS
+The driver does not detect lost S/PDIF signals and produces noise when
+S/PDIF is not connected and S/PDIF volume is not zero.
+.Pp
+The PCM driver cannot detect the presence of Live!Drive or AudigyDrive
+breakout boxes and tries to use them (and list their connectors in the
+mixer).
+.Pp
+The MIDI driver cannot detect the presence of Live!Drive or AudigyDrive
+breakout boxes and tries to enable the IR receiver on them anyway.
diff --git a/share/man/man4/snd_envy24.4 b/share/man/man4/snd_envy24.4
new file mode 100644
index 000000000000..30f13341c457
--- /dev/null
+++ b/share/man/man4/snd_envy24.4
@@ -0,0 +1,82 @@
+.\" Copyright (c) 2006 Alexander Leidinger
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 30, 2006
+.Dt SND_ENVY24 4
+.Os
+.Sh NAME
+.Nm snd_envy24
+.Nd "VIA Envy24 and compatible bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_envy24"
+.Cd "device snd_spicds"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_envy24_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to VIA Envy24 (ICE1724 or VT1724 chipset) and compatible audio
+devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+M-Audio Audiophile 2496
+.It
+M-Audio Delta Dio 2496
+.It
+Terratec DMX 6fire
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Katsurajima Naoto .
+This manual page was written by
+.An Alexander Leidinger Aq netchild@FreeBSD.org .
diff --git a/share/man/man4/snd_envy24ht.4 b/share/man/man4/snd_envy24ht.4
new file mode 100644
index 000000000000..807ba6219da1
--- /dev/null
+++ b/share/man/man4/snd_envy24ht.4
@@ -0,0 +1,105 @@
+.\" Copyright (c) 2006 Alexander Leidinger
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 28, 2007
+.Dt SND_ENVY24HT 4
+.Os
+.Sh NAME
+.Nm snd_envy24ht
+.Nd "VIA Envy24HT and compatible bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_envy24ht"
+.Cd "device snd_spicds"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_envy24ht_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to VIA Envy24HT (ICE1724 or VT1724 chipset) and compatible audio
+devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+Audiotrak Prodigy 7.1
+.It
+Audiotrak Prodigy 7.1 LT
+.It
+Audiotrak Prodigy 7.1 XT
+.It
+Audiotrak Prodigy HD2
+.It
+ESI Juli@
+.It
+M-Audio Audiophile 192
+.It
+M-Audio Revolution 5.1
+.It
+M-Audio Revolution 7.1
+.It
+Terratec Aureon 5.1 Sky
+.It
+Terratec Aureon 7.1 Space
+.It
+Terratec Aureon 7.1 Universe
+.It
+Terratec PHASE 22
+.It
+Terratec PHASE 28
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Konstantin Dimitrov
+based upon the
+.Xr snd_envy24 4
+driver.
+This manual page was written by
+.An Alexander Leidinger Aq netchild@FreeBSD.org .
diff --git a/share/man/man4/snd_es137x.4 b/share/man/man4/snd_es137x.4
new file mode 100644
index 000000000000..9602fcec96e2
--- /dev/null
+++ b/share/man/man4/snd_es137x.4
@@ -0,0 +1,117 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 29, 2006
+.Dt SND_ES137X 4
+.Os
+.Sh NAME
+.Nm snd_es137x
+.Nd "Ensoniq AudioPCI ES137x bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_es137x"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_es137x_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the Ensoniq 137x audio cards.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+variables are available in addition to those available to all
+.Xr sound 4
+devices:
+.Bl -tag -width ".Va hw.snd.pcm%d.latency_timer" -offset indent
+.It Va hw.snd.pcm%d.latency_timer
+Controls the PCI latency timer setting.
+Increasing this value will solve most popping and crackling issues
+(especially on VIA motherboards).
+.It Va hw.snd.pcm%d.spdif_enabled
+Enables S/PDIF output on the primary playback channel.
+This
+.Xr sysctl 8
+variable is available only if the device is known to support S/PDIF output.
+.It Va dev.pcm.%d.polling
+Experimental polling mode, where the driver operates by querying the device
+state on each tick using
+.Xr callout 9 .
+Polling is disabled by default.
+Do not enable it unless you are facing weird interrupt problems or if the
+device cannot generate interrupts at all.
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Creative CT5880-A
+.It
+Creative CT5880-C
+.It
+Creative CT5880-D
+.It
+Creative CT5880-E
+.It
+Creative SB AudioPCI CT4730
+.It
+Ensoniq AudioPCI ES1370
+.It
+Ensoniq AudioPCI ES1371-A
+.It
+Ensoniq AudioPCI ES1371-B
+.It
+Ensoniq AudioPCI ES1373-A
+.It
+Ensoniq AudioPCI ES1373-B
+.It
+Ensoniq AudioPCI ES1373-8
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An "Russell Cattelan" Aq cattelan@thebarn.com
+.An "Cameron Grant" Aq cg@FreeBSD.org
+.An "Joachim Kuebart"
+.An "Jonathan Noack" Aq noackjr@alumni.rice.edu
diff --git a/share/man/man4/snd_ess.4 b/share/man/man4/snd_ess.4
new file mode 100644
index 000000000000..bd0d6d75ec03
--- /dev/null
+++ b/share/man/man4/snd_ess.4
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_ESS 4
+.Os
+.Sh NAME
+.Nm snd_ess
+.Nd "Ensoniq ESS ISA PnP/non-PnP bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_ess"
+.Cd "device snd_sbc"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_ess_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the ESS ISA sound cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Ensoniq ESS ISA PnP/non-PnP
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An "Cameron Grant" Aq cg@FreeBSD.org
+.An "Luigi Rizzo" Aq luigi@FreeBSD.org
diff --git a/share/man/man4/snd_fm801.4 b/share/man/man4/snd_fm801.4
new file mode 100644
index 000000000000..0e6650451d56
--- /dev/null
+++ b/share/man/man4/snd_fm801.4
@@ -0,0 +1,78 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_FM801 4
+.Os
+.Sh NAME
+.Nm snd_fm801
+.Nd "Forte Media FM801 bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_fm801"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_fm801_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach audio devices based on the Forte Media FM801 chipset.
+This is a common chipset found in various parts used by OEM manufacturers.
+.Sh HARDWARE
+The
+.Nm
+driver supports audio devices based on the following chipset:
+.Pp
+.Bl -bullet -compact
+.It
+Forte Media FM801
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
+.Sh BUGS
+The Forte Media FM801 chipset is a sort of PCI bridge, not an actual
+sound controller, making it possible to have soundless support.
+One problem is that both chipsets, with and without sound support, use the
+same PCI ID.
+This makes it impossible to determine which one is installed.
diff --git a/share/man/man4/snd_gusc.4 b/share/man/man4/snd_gusc.4
new file mode 100644
index 000000000000..99df5403e158
--- /dev/null
+++ b/share/man/man4/snd_gusc.4
@@ -0,0 +1,97 @@
+.\"
+.\" Copyright (c) 1999 Seigo Tanimura
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_GUSC 4
+.Os
+.Sh NAME
+.Nm snd_gusc
+.Nd Gravis UltraSound ISA bridge device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_gusc"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_gusc_load="YES"
+.Ed
+.Pp
+Non-PnP cards require the following lines in
+.Xr device.hints 5 :
+.Bd -literal -offset indent
+hint.gusc.0.at="isa"
+hint.gusc.0.port="0x220"
+hint.gusc.0.irq="5"
+hint.gusc.0.drq="1"
+hint.gusc.0.flags="0x13"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to Gravis UltraSound sound cards.
+.Pp
+The value of flags specifies the secondary DMA channel.
+If the secondary
+DMA channel is C, set the flags to (C | 0x10).
+For a sound card without the
+secondary DMA channel, the flags should be set to zero.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Gravis UltraSound MAX
+.It
+Gravis UltraSound PnP
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It xxx: gus pcm not attached, out of memory
+There are not enough memory to drive the device.
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Ville-Pertti Keinonen Aq will@iki.fi
+.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
+.Sh BUGS
+Recording pcm sound data is not supported yet.
diff --git a/share/man/man4/snd_hda.4 b/share/man/man4/snd_hda.4
new file mode 100644
index 000000000000..6f7e8bdee6d1
--- /dev/null
+++ b/share/man/man4/snd_hda.4
@@ -0,0 +1,635 @@
+.\" Copyright (c) 2006-2008 Joel Dahl <joel@FreeBSD.org>
+.\" Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 25, 2012
+.Dt SND_HDA 4
+.Os
+.Sh NAME
+.Nm snd_hda
+.Nd "Intel High Definition Audio bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_hda"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_hda_load="YES"
+.Ed
+.Sh DESCRIPTION
+The High Definition (HD) Audio specification was developed by Intel as the
+logical successor of the old AC'97 specification and has several advantages,
+such as higher bandwidth which allows more channels and more detailed formats,
+support for several logical audio devices, and general purpose DMA channels.
+.Pp
+The
+.Nm
+driver includes HDA bus controller driver (hdac), HDA codec driver (hdacc)
+and HDA codecs audio functions bridge driver (hdaa) that allows
+the generic audio driver,
+.Xr sound 4 ,
+to be used with this hardware.
+Only audio functions are supported by
+.Nm .
+Modem and other possible functions are not implemented.
+.Pp
+The
+.Nm
+driver supports hardware that conforms with revision 1.0 of the Intel High
+Definition Audio specification and tries to behave much like the Microsoft
+Universal Audio Architecture (UAA) draft (revision 0.7b) for handling audio
+devices.
+.Pp
+According to HDA and UAA specifications, depending on the number of HDA buses
+and codecs present in system, their audio capabilities and BIOS provided
+configuration, the
+.Nm
+driver often provides several PCM audio devices.
+For example, one device for main rear 7.1 output and inputs, one device
+for independent headset connectors at front and one device for SPDIF or
+HDMI audio input/output.
+The assignment of audio inputs and outputs may be tuned with
+.Xr device.hints 5
+or
+.Xr sysctl 8 .
+The driver's verbose boot messages provide a lot of information about
+the operation of the driver and present audio setup.
+.Pp
+The default audio device may be tuned by setting the
+.Ar hw.snd.default_unit
+sysctl, as described in
+.Xr sound 4 ,
+or explicitly specified in application settings.
+.Ss Boot-time Configuration
+The following variables are available at boot-time through the
+.Xr device.hints 5
+file:
+.Bl -tag -width ".Va hint.hdac.%d.config"-offset indent
+.It Va hint.hdac.%d.config
+Configures a range of possible controller options.
+Possible values are:
+.Dq Li 64bit ,
+.Dq Li dmapos ,
+.Dq Li msi .
+An option prefixed with
+.Dq Li no ,
+such as
+.Dq Li nomsi ,
+will do the opposite and takes precedence.
+Options can be separated by whitespace and commas.
+.It Va hint.hdac.%d.msi
+Controls MSI (Message Signaled Interrupts) support.
+.It Va hint.hdac.%d.cad%d.nid%d.config
+Same as
+.Va hint.hdaa.%d.nid%d.config
+.It Va hint.hdaa.%d.config
+Configures a range of possible audio function options.
+Possible values are:
+.Dq Li eapdinv ,
+.Dq Li ivref ,
+.Dq Li ivref50 ,
+.Dq Li ivref80 ,
+.Dq Li ivref100 ,
+.Dq Li fixedrate ,
+.Dq Li forcestereo ,
+.Dq Li ovref ,
+.Dq Li ovref50 ,
+.Dq Li ovref80 ,
+.Dq Li ovref100 ,
+.Dq Li senseinv ,
+.Dq Li softpcmvol ,
+and
+.Dq Li vref .
+An option prefixed with
+.Dq Li no ,
+such as
+.Dq Li nofixedrate ,
+will do the opposite and takes precedence.
+Options can be separated by whitespace and commas.
+.Pp
+The
+.Dq Li eapdinv
+option inverts External Amplifier Power Down signal.
+The
+.Dq Li fixedrate
+denies all sampling rates except 48KHz.
+The
+.Dq Li forcestereo
+denies mono playback/recording.
+The
+.Dq Li senseinv
+option inverts jack sensing logic.
+The
+.Dq Li ivref Ns Ar X
+and
+.Dq Li ovref Ns Ar X
+options control the voltage used to power external microphones.
+.It Va hint.hdaa.%d.gpio_config
+Overrides audio function GPIO pins configuration set by BIOS.
+May be specified as a set of space-separated
+.Dq Ar num Ns = Ns Ar value
+pairs, where
+.Ar num
+is GPIO line number, and
+.Ar value
+is one of:
+.Dq Li keep ,
+.Dq Li set ,
+.Dq Li clear ,
+.Dq Li disable
+and
+.Dq Li input .
+.Pp
+.Dq Li GPIO Ns s
+are a codec's General Purpose I/O pins which system integrators sometimes
+use to control external muters, amplifiers and so on.
+If you have no sound, or sound volume is not adequate, you may have to
+experiment a bit with the GPIO setup to find the optimal setup for your
+system.
+.It Va hint.hdaa.%d.nid%d.config
+Overrides audio function pin configuration set by BIOS.
+May be specified as a 32-bit hexadecimal value with a leading
+.Dq 0x ,
+or as a set of space-separated
+.Dq Ar option Ns = Ns Ar value
+pairs.
+.It Va hint.pcm.%d.rec.autosrc
+Controls automatic recording source feature:
+.Bl -tag -compact
+.It 0
+disabled,
+.It 1
+once on attach,
+.It 2
+enabled.
+.El
+When enabled, driver will automatically set recording source of the mixer to
+connected input using jack presence detection statuses.
+.El
+.Pp
+Pin configuration is the UAA driver's main source of information about codec
+usage.
+This information is usually provided by the codec manufacturer and tuned
+by system integrators for specific system requirements.
+The
+.Nm
+driver allows users to override it to fix integrator mistakes or to use the
+available codec in alternative ways (for example to get stereo output and 2
+inputs instead of a single 5.1 output).
+.Pp
+The following options are supported:
+.Bl -tag -width ".Va device=" -offset indent
+.It Va as
+Association number.
+Associations are used to group individual pins to form a complex multi-pin
+device.
+For example, to group 4 connectors for 7.1 input/output, or to treat several
+input connectors as sources for the same input device.
+Association numbers can be specified as numeric values from 0 to 15.
+A value of 0 means disabled pin.
+A value of 15 is a set of independent unassociated pins.
+Each association includes only pins of the same direction (in/out) and is
+detected atomically (all pins or none).
+A separate PCM audio device is created for every pair of input and
+output associations.
+.It Va seq
+Sequence number.
+A unique, per-association number used to order pins inside the
+particular association.
+Sequence numbers can be specified as numeric values from 0 to 15.
+.Pp
+The sequence number 15 has a special meaning for output associations.
+Output pins with this number and device type
+.Dq Ar Headphones
+will duplicate (with automatic mute if jack detection is supported) the
+first pin in that association.
+.Pp
+The sequence numbers 14 and 15 has a special meaning for input associations.
+Their presence in association defines it as multiplexed or mixed respectively.
+If none of them present and there are more then one pin in association,
+the association will provide multichannel input.
+.Pp
+For multichannel input/output assotiations sequence numbers encode
+channel pairs positions:
+0 - Front, 1 - Center/LFE, 2 - Back, 3 - Front Wide Center, 4 - Side.
+Standard combinations are: (0) - Stereo; (0, 2), (0, 4) - Quadro;
+(0, 1, 2), (0, 1, 4) - 5.1; (0, 1, 2, 4) - 7.1.
+.It Va device
+Device type.
+Can be specified as a number from 0 to 15 or as a name:
+.Dq Li Line-out ,
+.Dq Li Speaker ,
+.Dq Li Headphones,
+.Dq Li CD ,
+.Dq Li SPDIF-out ,
+.Dq Li Digital-out ,
+.Dq Li Modem-line ,
+.Dq Li Modem-handset ,
+.Dq Li Line-in ,
+.Dq Li AUX ,
+.Dq Li Mic ,
+.Dq Li Telephony ,
+.Dq Li SPDIF-in ,
+.Dq Li Digital-in ,
+.Dq Li Res.E ,
+or
+.Dq Li Other .
+The device type also describes the pin direction (in/out).
+For example,
+.Dq Li CD
+always means an input pin, while
+.Dq Li Headphones
+always means an output.
+.It Va conn
+Connection type.
+Can be specified as a number from 0 to 3.
+The connection type can also be specified as one of the special names
+.Dq Li Jack ,
+.Dq Li None ,
+.Dq Li Fixed ,
+or
+.Dq Li Both .
+Pins with a connection type of
+.Dq Li None
+are disabled.
+.It Va ctype
+Connector physical type.
+Can be specified as a number from 0 to 15.
+This is a reference only value.
+It is ignored by the
+.Nm
+driver.
+.It Va color
+Connector color.
+Can be specified as a number from 0 to 15 or as one of the names
+.Dq Li Unknown ,
+.Dq Li Black ,
+.Dq Li Grey ,
+.Dq Li Blue ,
+.Dq Li Green ,
+.Dq Li Red ,
+.Dq Li Orange ,
+.Dq Li Yellow ,
+.Dq Li Purple ,
+.Dq Li Pink ,
+.Dq Li Res.A ,
+.Dq Li Res.B ,
+.Dq Li Res.C ,
+.Dq Li Res.D ,
+.Dq Li White ,
+or
+.Dq Li Other .
+This is a reference only value.
+It is ignored by the
+.Nm
+driver.
+.It Va loc
+Connector physical location.
+Can be specified as a number from 0 to 63.
+This is a reference only value.
+It is ignored by the
+.Nm
+driver.
+.It Va misc
+Misc bits.
+Can be specified as a number from 0 to 15.
+Bit 0 has a special meaning. When set it means that jack detection is
+not implemented in hardware.
+.El
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+variables are available in addition to those available to all
+.Xr sound 4
+devices:
+.Bl -tag -width ".Va dev.hdaa.%d.nid%d_original" -offset indent
+.It Va dev.hdac.%d.pindump
+Setting this to a non-zero value dumps the current pin configuration, main
+capabilities and jack sense status of all audio functions on the controller
+to console and syslog.
+.It Va dev.hdac.%d.polling
+Enables polling mode.
+In this mode the driver operates by querying the device state on timer
+ticks using
+.Xr callout 9
+instead of interrupts.
+Polling is disabled by default.
+Do not enable it unless you are facing weird interrupt problems or if the
+device cannot generate interrupts at all.
+.It Va dev.hdaa.%d.config
+Run-time equivalent of the
+.Va hint.hdaa.%d.config
+tunable.
+.It Va dev.hdaa.%d.gpi_state
+Current state of GPI lines.
+.It Va dev.hdaa.%d.gpio_state
+Current state of GPIO lines.
+.It Va dev.hdaa.%d.gpio_config
+Run-time equivalent of the
+.Va hint.hdaa.%d.gpio.config
+tunable.
+.It Va dev.hdaa.%d.gpo_state
+Current state of GPO lines.
+.It Va dev.hdaa.%d.nid%d_config
+Run-time equivalent of the
+.Va hint.hdaa.%d.nid%d.config
+tunable.
+.It Va dev.hdaa.%d.nid%d_original
+Original pin configuration written by BIOS.
+.It Va dev.hdaa.%d.reconfig
+Setting this to a non-zero value makes driver to destroy existing pcm devices
+and process new pins configuration set via
+.Va dev.hdaa.%d.nid%d_config.
+.It Va dev.pcm.%d.play.32bit , dev.pcm.%d.rec.32bit
+HDA controller uses 32bit representation for all samples of more then 16 bits.
+These variables allow to specify how many bits of these 32 should be
+used by CODEC.
+Depending on codec capabilities, possible values are 20, 24 and 32 bit.
+The default value is 24.
+.It Va dev.pcm.%d.rec.autosrc
+Run-time equivalent of the
+.Va hint.pcm.%d.rec.autosrc
+tunable.
+.El
+.Sh EXAMPLES
+Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example.
+This system has two audio connectors on a front side, three audio connectors
+on a rear side and one internal speaker.
+According to verbose driver output and the codec datasheet,
+this codec has five stereo DACs and two stereo ADCs, all of them are routable to
+any codec pin (external connector).
+All codec pins are reversible (could be configured either as input or output).
+.Pp
+So high codec uniformity and flexibility allow driver to configure it in many
+different ways, depending on requested pins usage described by pins configuration.
+The driver reports such default pin configuration when verbose messages enabled:
+.Bd -literal
+hdaa0: nid 0x as seq device conn jack loc color misc
+hdaa0: 20 01014020 2 0 Line-out Jack 1/8 Rear Green 0
+hdaa0: 21 99130110 1 0 Speaker Fixed ATAPI Onboard Unknown 1
+hdaa0: 22 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
+hdaa0: 23 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
+hdaa0: 24 01a19830 3 0 Mic Jack 1/8 Rear Pink 8
+hdaa0: 25 02a1983f 3 15 Mic Jack 1/8 Front Pink 8
+hdaa0: 26 01813031 3 1 Line-in Jack 1/8 Rear Blue 0
+hdaa0: 27 0221401f 1 15 Headphones Jack 1/8 Front Green 0
+hdaa0: 28 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
+hdaa0: 30 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
+hdaa0: 31 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
+.Ed
+.Pp
+Here we can see, that the nodes with ID (nid) 25 and 27 are front panel
+connectors (Jack, Front), nids 20, 24 and 26 are rear panel connectors
+(Jack, Rear) and nid 21 is a built-in speaker (Fixed, Onboard).
+Pins with nids 22, 23, 28, 30 and 31 will be disabled by driver due to "None"
+connectivity. So the pin count and description matches to connectors that
+we have.
+.Pp
+Using association (as) and sequence (seq) fields values pins are grouped into
+3 associations:
+.Bd -literal
+hdaa0: Association 0 (1) out:
+hdaa0: Pin nid=21 seq=0
+hdaa0: Pin nid=27 seq=15
+hdaa0: Association 1 (2) out:
+hdaa0: Pin nid=20 seq=0
+hdaa0: Association 2 (3) in:
+hdaa0: Pin nid=24 seq=0
+hdaa0: Pin nid=26 seq=1
+hdaa0: Pin nid=25 seq=15
+.Ed
+.Pp
+Each
+.Xr pcm 4
+device uses two associations: one for playback and one for recording.
+Associations processed and assigned to
+.Xr pcm 4
+devices in increasing numerical order.
+In this case association #0 (1) will become
+.Li pcm0
+device playback, using the internal speakers and
+.Ar Headphones
+jack with speaker automute on the headphones jack connection.
+Association #1 (2) will become
+.Li pcm1
+playback, using the
+.Ar Line-out
+jack.
+Association #2 (3) will become
+.Li pcm0
+recording, using the external microphones and the
+.Ar Line-in
+jack.
+.Pp
+The
+.Nm
+driver provides extensive verbose messages to diagnose its operation
+logic and describe its current codec configuration.
+.Pp
+Using
+.Xr device.hints 5
+it is possible to modify the configuration of the existing pins,
+allowing a broad range of different audio setups.
+Here are a few examples of some setups possible for this particular
+hardware:
+.Ss Example 1
+Setting the
+.Xr device.hints 5
+options
+.Bd -literal
+hint.hdac.0.cad0.nid20.config="as=1"
+hint.hdac.0.cad0.nid21.config="as=2"
+.Ed
+.Pp
+will swap line-out and speaker functions.
+So the
+.Li pcm0
+device will play to the line-out and headphones jacks. Line-out will
+be muted on the headphones jack connection.
+Recording on
+.Li pcm0
+will go from two external microphones and line-in jacks.
+.Li pcm1
+playback will go to the internal speaker.
+.Ss Example 2
+Setting the
+.Xr device.hints 5
+options
+.Bd -literal
+hint.hdac.0.cad0.nid20.config="as=1 seq=15 device=Headphones"
+hint.hdac.0.cad0.nid27.config="as=2 seq=0"
+hint.hdac.0.cad0.nid25.config="as=4 seq=0"
+.Ed
+.Pp
+will split the headphones and one of the microphones to a separate device.
+The
+.Li pcm0
+device will play to the internal speaker and to the line-out jack, with
+speaker automute on the line-out jack connection.
+Recording on
+.Li pcm0
+will use input from one external microphone and the line-in jacks.
+The
+.Li pcm1
+device will be completely dedicated to a headset (headphones and mic)
+connected to the front connectors.
+.Ss Example 3
+Setting the
+.Xr device.hints 5
+options
+.Bd -literal
+hint.hdac.0.cad0.nid20.config="as=1 seq=0"
+hint.hdac.0.cad0.nid26.config="as=2 seq=0"
+hint.hdac.0.cad0.nid27.config="as=3 seq=0"
+hint.hdac.0.cad0.nid25.config="as=4 seq=0"
+hint.hdac.0.cad0.nid24.config="as=5 seq=0 device=Line-out"
+hint.hdac.0.cad0.nid21.config="as=6 seq=0"
+.Ed
+.Pp
+will give 4 independent devices:
+.Li pcm0
+.Pq line-out and line-in ,
+.Li pcm1
+.Pq headphones and mic ,
+.Li pcm2
+.Pq additional line-out via retasked rear mic jack ,
+and
+.Li pcm3
+.Pq internal speaker .
+.Ss Example 4
+Setting the
+.Xr device.hints 5
+options
+.Bd -literal
+hint.hdac.0.cad0.nid20.config="as=1 seq=0"
+hint.hdac.0.cad0.nid24.config="as=1 seq=1 device=Line-out"
+hint.hdac.0.cad0.nid26.config="as=1 seq=2 device=Line-out"
+hint.hdac.0.cad0.nid21.config="as=2 seq=0"
+.Ed
+.Pp
+will give 2 devices:
+.Li pcm0
+for 5.1 playback via 3 rear connectors (line-out and retasked
+mic and line-in) and headset (headphones and mic) at front connectors.
+.Li pcm1
+for internal speaker playback.
+On headphones connection rear connectors will be muted.
+.Sh MIXER CONTROLS
+Depending on codec configuration, these controls and signal sources could be
+reported to
+.Xr sound 4 :
+.Bl -tag -width ".Va speaker" -offset indent
+.It Va vol
+overall output level (volume)
+.It Va rec
+overall recording level
+.It Va igain
+input-to-output monitoring loopback level
+.It Va ogain
+external amplifier control
+.It Va pcm
+PCM playback
+.It Va mix
+input mix
+.It Va mic
+first external or second internal microphone input
+.It Va monitor
+first internal or second external microphone input
+.It Va line , Va line1 , Va line2, Va line3
+analog (line) inputs
+.It Va dig1 , Va dig2 , Va dig3
+digital (S/PDIF, HDMI or DisplayPort) inputs
+.It Va cd
+CD input
+.It Va speaker
+PC speaker input
+.It Va phin , Va phout , Va radio . Va video
+other random inputs
+.El
+.Pp
+Controls have different precision. Some could be just an on/off triggers.
+Most of controls use logarithmic scale.
+.Sh HARDWARE
+The
+.Nm
+driver supports controllers having PCI class 4 (multimedia) and
+subclass 3 (HDA), compatible with Intel HDA specification.
+.Pp
+The
+.Nm
+driver supports more then two hundred different controllers and CODECs.
+There is no sense to list all of them here, as in most cases specific CODEC
+configuration and wiring are more important then type of the CODEC itself.
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr snd_ich 4 ,
+.Xr device.hints 5 ,
+.Xr loader.conf 5 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Stephane E. Potvin Aq sepotvin@videotron.ca ,
+.An Ariff Abdullah Aq ariff@FreeBSD.org
+and
+.An Alexander Motin Aq mav@FreeBSD.org .
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org ,
+.An Alexander Motin Aq mav@FreeBSD.org
+and
+.An Giorgos Keramidas Aq keramida@FreeBSD.org .
+.Sh BUGS
+Some Hardware/OEM vendors tend to screw up BIOS settings or use custom
+unusual CODEC wiring that create problems to the driver.
+This may result in missing pcm devices, or a state where the
+.Nm
+driver seems to attach and work, but no sound is played.
+Some cases can be solved by tuning
+.Pa loader.conf
+variables.
+But before trying to fix problem that way, make sure that there really is
+a problem and that the PCM audio device in use really corresponds to the
+expected audio connector.
+.Pp
+Some vendors use non-standardized General Purpose I/O (GPIO) pins of the codec
+to control external amplifiers.
+In some cases setting a combination of GPIO bits may be needed to make
+sound work on a specific device.
+.Pp
+HDMI and DisplayPort audio may also require support from video driver.
diff --git a/share/man/man4/snd_hdspe.4 b/share/man/man4/snd_hdspe.4
new file mode 100644
index 000000000000..a403a178dd20
--- /dev/null
+++ b/share/man/man4/snd_hdspe.4
@@ -0,0 +1,76 @@
+.\" Copyright (c) 2012 Ruslan Bukin <br@bsdpad.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2012
+.Dt SND_HDSPE 4
+.Os
+.Sh NAME
+.Nm snd_hdspe
+.Nd "RME HDSPe brigde device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_hdspe"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_hdspe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to RME HDSPe audio devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+RME HDSPe AIO
+.It
+RME HDSPe RayDAT
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Ruslan Bukin <br@bsdpad.com> .
diff --git a/share/man/man4/snd_ich.4 b/share/man/man4/snd_ich.4
new file mode 100644
index 000000000000..c4359c85acc2
--- /dev/null
+++ b/share/man/man4/snd_ich.4
@@ -0,0 +1,111 @@
+.\" Copyright (c) 2004 Jorge Mario G. Mazo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2009
+.Dt SND_ICH 4
+.Os
+.Sh NAME
+.Nm snd_ich
+.Nd "Intel ICH AC'97 and compatible bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_ich"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_ich_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to Intel ICH AC'97 and compatible audio devices.
+.Pp
+Some later chips, like ICH6/ICH7, depending on wiring can instead implement
+newer Intel HD Audio specification, which is supported by
+.Xr snd_hda 4
+driver.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+AMD 768
+.It
+AMD 8111
+.It
+Intel 443MX
+.It
+Intel ICH
+.It
+Intel ICH revision 1
+.It
+Intel ICH2
+.It
+Intel ICH3
+.It
+Intel ICH4
+.It
+Intel ICH5
+.It
+Intel ICH6
+.It
+Intel ICH7
+.It
+NVIDIA nForce
+.It
+NVIDIA nForce2
+.It
+NVIDIA nForce2 400
+.It
+NVIDIA nForce3
+.It
+NVIDIA nForce3 250
+.It
+NVIDIA nForce4
+.It
+SiS 7012
+.El
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr snd_hda 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Jorge Mario G. Mazo Aq jgutie11@eafit.edu.co .
diff --git a/share/man/man4/snd_maestro.4 b/share/man/man4/snd_maestro.4
new file mode 100644
index 000000000000..d630a3324f97
--- /dev/null
+++ b/share/man/man4/snd_maestro.4
@@ -0,0 +1,78 @@
+.\" Copyright (c) 2004 Jorge Mario G. Mazo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_MAESTRO 4
+.Os
+.Sh NAME
+.Nm snd_maestro
+.Nd "ESS Maestro bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_maestro"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_maestro_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to ESS Maestro based sound chips.
+This chipset is very popular in notebook computers, but it is
+also very used in a wide selection of cheap OEM sound cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following PCI sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+ESS Technology Maestro-1
+.It
+ESS Technology Maestro-2
+.It
+ESS Technology Maestro-2E
+.El
+.Sh SEE ALSO
+.Xr snd_maestro3 4 ,
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Jorge Mario G. Mazo Aq jgutie11@eafit.edu.co .
diff --git a/share/man/man4/snd_maestro3.4 b/share/man/man4/snd_maestro3.4
new file mode 100644
index 000000000000..4fadd0453cae
--- /dev/null
+++ b/share/man/man4/snd_maestro3.4
@@ -0,0 +1,94 @@
+.\" Copyright (c) 2001 Scott Long
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 15, 2005
+.Dt SND_MAESTRO3 4
+.Os
+.Sh NAME
+.Nm snd_maestro3
+.Nd "ESS Maestro3/Allegro-1 bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_maestro3"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_maestro3_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the ESS Maestro3 and Allegro-1 sound chips
+under the PCM framework.
+These chips are mostly found in laptop computers and feature an AC97 mixer,
+a multi-channel sample rate converter that can mix up to four digital audio
+streams in hardware, recording support, and external volume control buttons.
+.Pp
+The firmware for the sound processor is licensed under the GNU Public
+License, and thus this driver is not included in the default
+.Pa GENERIC
+kernel.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+ESS Technology Allegro-1
+.It
+ESS Technology Maestro3
+.El
+.Sh DIAGNOSTICS
+The hardware volume control buttons can be connected to two different pin
+sets (GPIO or GD) on the chip, depending on the manufacturer.
+The driver has no way of determining this configuration, so a hint may be
+used to override the default guess.
+The default setting for hardware volume control assumes that GD pins
+are wired to control the hardware volume.
+For systems that have the GPIO pins wired to the hardware volume control
+buttons, add the line
+.Dq Li hint.pcm.0.hwvol_config="0"
+to the file
+.Pa /boot/device.hints
+to override the default setting.
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr loader.conf 5
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.3 .
+.Sh AUTHORS
+.An Scott Long Aq scottl@FreeBSD.org
+.An Darrel Anderson Aq anderson@cs.duke.edu
diff --git a/share/man/man4/snd_mss.4 b/share/man/man4/snd_mss.4
new file mode 100644
index 000000000000..76ef18339c6b
--- /dev/null
+++ b/share/man/man4/snd_mss.4
@@ -0,0 +1,116 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_MSS 4
+.Os
+.Sh NAME
+.Nm snd_mss
+.Nd "Microsoft Sound System ISA PnP/non-PnP bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_mss"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_mss_load="YES"
+.Ed
+.Pp
+Non-PnP cards require the following lines in
+.Xr device.hints 5 :
+.Bd -literal -offset indent
+hint.pcm.0.at="isa"
+hint.pcm.0.irq="10"
+hint.pcm.0.drq="1"
+hint.pcm.0.flags="0x0"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach to the supported audio devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+AD1845
+.It
+AD1848
+.It
+Aztech 2320
+.It
+CMedia CMI8330
+.It
+Crystal Semiconductor CS4231
+.It
+Crystal Semiconductor CS4232
+.It
+Crystal Semiconductor CS4234
+.It
+Crystal Semiconductor CS4235
+.It
+Crystal Semiconductor CS4236
+.It
+Crystal Semiconductor CS4237
+.It
+ENSONIQ SoundscapeVIVO ENS4081
+.It
+NeoMagic 256AV (non-AC97)
+.It
+OPTi 924
+.It
+OPTi 925
+.It
+OPTi 930
+.It
+OPTi 931
+.It
+OPTi 933
+.It
+Yamaha OPL-SA2
+.It
+Yamaha OPL-SA3
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.2.6 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
diff --git a/share/man/man4/snd_neomagic.4 b/share/man/man4/snd_neomagic.4
new file mode 100644
index 000000000000..430220c23152
--- /dev/null
+++ b/share/man/man4/snd_neomagic.4
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_NEOMAGIC 4
+.Os
+.Sh NAME
+.Nm snd_neomagic
+.Nd "NeoMagic 256AV/ZX bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_neomagic"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_neomagic_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach to the NeoMagic 256AV/ZX audio devices.
+These chips are mostly found in laptop computers.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+NeoMagic 256AV
+.It
+NeoMagic 256ZX
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
diff --git a/share/man/man4/snd_sbc.4 b/share/man/man4/snd_sbc.4
new file mode 100644
index 000000000000..8b53c8eb9eaa
--- /dev/null
+++ b/share/man/man4/snd_sbc.4
@@ -0,0 +1,132 @@
+.\"
+.\" Copyright (c) 1999 Seigo Tanimura
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 17, 2007
+.Dt SND_SBC 4
+.Os
+.Sh NAME
+.Nm snd_sbc ,
+.Nm snd_sb16 ,
+.Nm snd_sb8
+.Nd Creative Sound Blaster ISA and compatible bridge device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_sbc"
+.Cd "device snd_sb16"
+.Cd "device snd_sb8"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_sbc_load="YES"
+snd_sb16_load="YES"
+snd_sb8_load="YES"
+.Ed
+.Pp
+Non-PnP cards require the following lines in
+.Xr device.hints 5 :
+.Bd -literal -offset indent
+hint.sbc.0.at="isa"
+hint.sbc.0.port="0x220"
+hint.sbc.0.irq="5"
+hint.sbc.0.drq="1"
+hint.sbc.0.flags="0x15"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to Creative Sound Blaster ISA (mostly SB16 or SB8, known as
+SoundBlaster Pro) compatible audio cards.
+.Pp
+The value of flags specifies the secondary DMA channel.
+If the secondary
+DMA channel is C, set the flags to (C | 0x10).
+For a sound card without the
+secondary DMA channel, the flags should be set to zero.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+Avance Asound 110
+.It
+Avance Logic ALS100+
+.It
+Avance Logic ALS120
+.It
+Creative SB16
+.It
+Creative SB32
+.It
+Creative AWE64
+.It
+Creative AWE64 Gold
+.It
+Creative ViBRA16C
+.It
+Creative ViBRA16X
+.It
+ESS ES1681
+.It
+ESS ES1688
+.It
+ESS ES1868
+.It
+ESS ES1869
+.It
+ESS ES1878
+.It
+ESS ES1879
+.It
+ESS ES1888
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It sb_dspwr(XX) timed out.
+A command to the DSP has timed out.
+Check the I/O port configuration.
+.It bad irq XX (5/7/9/10 valid)
+The IRQ given to the driver is not valid.
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
diff --git a/share/man/man4/snd_solo.4 b/share/man/man4/snd_solo.4
new file mode 100644
index 000000000000..55e12fc002cb
--- /dev/null
+++ b/share/man/man4/snd_solo.4
@@ -0,0 +1,66 @@
+.\" Copyright (c) 2004 Atte Peltomaki
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 28, 2005
+.Dt SND_SOLO 4
+.Os
+.Sh NAME
+.Nm snd_solo
+.Nd "ESS Solo-1/1E PCI bridge device driver"
+.Sh SYNOPSIS
+.Cd "device sound"
+.Cd "device snd_solo"
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver
+.Xr sound 4
+to attach to the ESS Solo-1x PCI cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
+.Pp
+.Bl -bullet -compact
+.It
+ESS Solo-1 (ES1938 Chipset)
+.It
+ESS Solo-1E (ES1946 Chipset)
+.El
+.Pp
+Note that older ESS ISA cards with ES18xx chipset are supported via
+.Xr snd_ess 4
+and/or
+.Xr snd_sbc 4 .
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An "Cameron Grant" Aq cg@FreeBSD.org
diff --git a/share/man/man4/snd_spicds.4 b/share/man/man4/snd_spicds.4
new file mode 100644
index 000000000000..7b95b8689bd3
--- /dev/null
+++ b/share/man/man4/snd_spicds.4
@@ -0,0 +1,89 @@
+.\" Copyright (c) 2006 Alexander Leidinger
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 28, 2007
+.Dt SND_SPICDS 4
+.Os
+.Sh NAME
+.Nm snd_spicds
+.Nd "I2S SPI audio codec driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device snd_spicds"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_spicds_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+I2S codec driver is used by several sound drivers for soundcards which use
+the supported codec chips.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following codecs:
+.Pp
+.Bl -bullet -compact
+.It
+AK4358
+.It
+AK4381
+.It
+AK4396
+.It
+AK4524
+.It
+AK4528
+.It
+WM8770
+.El
+.Sh SEE ALSO
+.Xr snd_envy24 4 ,
+.Xr snd_envy24ht 4 ,
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Konstantin Dimitrov
+based upon the
+.Xr snd_envy24 4
+driver.
+This manual page was written by
+.An Alexander Leidinger Aq netchild@FreeBSD.org .
diff --git a/share/man/man4/snd_t4dwave.4 b/share/man/man4/snd_t4dwave.4
new file mode 100644
index 000000000000..ef916659115f
--- /dev/null
+++ b/share/man/man4/snd_t4dwave.4
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_T4DWAVE 4
+.Os
+.Sh NAME
+.Nm snd_t4dwave
+.Nd "Trident 4DWave bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_t4dwave"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_t4dwave_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach to Trident 4DWave audio devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio devices:
+.Pp
+.Bl -bullet -compact
+.It
+Acer Labs M5451
+.It
+SIS 7018
+.It
+Trident 4DWave DX
+.It
+Trident 4DWave NX
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
diff --git a/share/man/man4/snd_uaudio.4 b/share/man/man4/snd_uaudio.4
new file mode 100644
index 000000000000..b045851692b1
--- /dev/null
+++ b/share/man/man4/snd_uaudio.4
@@ -0,0 +1,102 @@
+.\" $NetBSD: uaudio.4,v 1.15 2002/02/12 19:53:57 jdolecek Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 24, 2011
+.Dt SND_UAUDIO 4
+.Os
+.Sh NAME
+.Nm snd_uaudio
+.Nd USB audio and MIDI device driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device usb"
+.Cd "device snd_uaudio"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_uaudio_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for
+.Tn USB
+audio class devices and
+.Tn USB
+MIDI class devices.
+.Pp
+A
+.Tn USB
+audio device consists of a number of components:
+input terminals (e.g.\& USB digital input), output terminals (e.g.\&
+speakers), and a number of units in between (e.g.\& volume control).
+.Pp
+Refer to the
+.Ql USB Audio Class Specification
+for more information.
+.Sh SEE ALSO
+.Xr sound 4 ,
+.Xr usb 4
+.Rs
+.%T "USB Audio Class Specifications"
+.%U http://www.usb.org/developers/devclass_docs/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 4.7 .
+.Sh AUTHORS
+This manual page was adopted from
+.Nx 1.6
+and modified for
+.Fx
+by
+.An Hiten Pandya Aq hmp@FreeBSD.org .
+.Sh BUGS
+The
+.Tn PCM
+framework in
+.Fx ,
+as of this writing, does not handle device un-registrations in a properly
+abstracted manner, i.e., a detach request is refused by the
+.Tn PCM
+framework if the device is in use.
+It is necessary to allow the device un-registration to complete
+successfully, otherwise the
+.Tn PCM
+layer will panic.
diff --git a/share/man/man4/snd_via8233.4 b/share/man/man4/snd_via8233.4
new file mode 100644
index 000000000000..377fbd3ee0b1
--- /dev/null
+++ b/share/man/man4/snd_via8233.4
@@ -0,0 +1,105 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 29, 2006
+.Dt SND_VIA8233 4
+.Os
+.Sh NAME
+.Nm snd_via8233
+.Nd "VIA Technologies VT8233 bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_via8233"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_via8233_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach to the VIA VT8233 audio devices.
+These audio chipsets are integrated in the southbridge on many VIA based
+motherboards.
+.Ss Runtime Configuration
+The following
+.Xr sysctl 8
+variables are available in addition to those available to all
+.Xr sound 4
+devices:
+.Bl -tag -width ".Va dev.pcm.%d.polling" -offset indent
+.It Va dev.pcm.%d.polling
+Experimental polling mode, where the driver operates by querying the device
+state on each tick using
+.Xr callout 9 .
+Polling is disabled by default.
+Do not enable it unless you are facing weird interrupt problems or if the
+device cannot generate interrupts at all.
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following audio chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+VIA VT8233
+.It
+VIA VT8233A
+.It
+VIA VT8233C
+.It
+VIA VT8235
+.It
+VIA VT8237
+.It
+VIA VT8251
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.7 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+driver
+does not support S/PDIF.
+There is partial support in the code, so implementing it should be fairly
+easy if the right hardware is available.
diff --git a/share/man/man4/snd_via82c686.4 b/share/man/man4/snd_via82c686.4
new file mode 100644
index 000000000000..183684ec1170
--- /dev/null
+++ b/share/man/man4/snd_via82c686.4
@@ -0,0 +1,71 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_VIA82C686 4
+.Os
+.Sh NAME
+.Nm snd_via82c686
+.Nd "VIA Technologies 82C686A bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_via82c686"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_via82c686_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach audio devices based on the VIA 82C686A chipset.
+.Sh HARDWARE
+The
+.Nm
+driver supports audio devices based on the following chipset:
+.Pp
+.Bl -bullet -compact
+.It
+VIA 82C686A
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
diff --git a/share/man/man4/snd_vibes.4 b/share/man/man4/snd_vibes.4
new file mode 100644
index 000000000000..716a65cd299a
--- /dev/null
+++ b/share/man/man4/snd_vibes.4
@@ -0,0 +1,71 @@
+.\" Copyright (c) 2005 Joel Dahl
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2005
+.Dt SND_VIBES 4
+.Os
+.Sh NAME
+.Nm snd_vibes
+.Nd "S3 SonicVibes bridge device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sound"
+.Cd "device snd_vibes"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the
+following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+snd_vibes_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+bridge driver allows the generic audio driver,
+.Xr sound 4 ,
+to attach audio devices based on the S3 SonicVibes chipset.
+.Sh HARDWARE
+The
+.Nm
+driver supports audio devices based on the following chipset:
+.Pp
+.Bl -bullet -compact
+.It
+S3 SonicVibes
+.El
+.Sh SEE ALSO
+.Xr sound 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+This manual page was written by
+.An Joel Dahl Aq joel@FreeBSD.org .
diff --git a/share/man/man4/snp.4 b/share/man/man4/snp.4
new file mode 100644
index 000000000000..2545164436a1
--- /dev/null
+++ b/share/man/man4/snp.4
@@ -0,0 +1,99 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 5, 2008
+.Dt SNP 4
+.Os
+.Sh NAME
+.Nm snp
+.Nd tty snoop interface
+.Sh SYNOPSIS
+.In sys/snoop.h
+.Ft int
+.Fn ioctl fd SNPSTTY &dev
+.Ft int
+.Fn ioctl fd SNPGTTY &dev
+.Ft int
+.Fn ioctl fd FIONREAD &result
+.Sh DESCRIPTION
+.Pa /dev/snp
+is a snoop device which allows users to attach to any tty
+and watch activities on it.
+The kernel must be compiled with
+.Cd "device snp" ,
+or the
+.Nm
+module must be loaded,
+for these devices to be available.
+.Pp
+To associate a given
+.Nm
+device with a tty to be observed, open the
+.Nm
+device and a tty device, and then issue the
+.Dv SNPSTTY
+ioctl on
+.Nm
+device.
+The argument passed to the
+.Xr ioctl 2
+is the address of a variable of type
+.Vt int ,
+holding the file descriptor of a tty device.
+To detach the
+.Nm
+device from a tty use a pointer to a value of
+\-1.
+.Pp
+The
+.Dv SNPGTTY
+ioctl returns information about the current tty attached to
+the open
+.Nm
+device.
+.Pp
+The
+.Dv FIONREAD
+ioctl returns a positive value equal to the number of characters
+in a read buffer.
+Special values defined are:
+.Bl -tag -width ".Dv SNP_TTYCLOSE"
+.It Dv SNP_OFLOW
+device overflow occurred, device detached.
+.It Dv SNP_TTYCLOSE
+tty not attached.
+.It Dv SNP_DETACH
+.Nm
+device has been detached by user or tty device has been closed
+and detached.
+.El
+.Sh SEE ALSO
+.Xr pty 4 ,
+.Xr sio 4 ,
+.Xr kldload 8 ,
+.Xr watch 8
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Fx 2.1 .
+In
+.Fx 8.0
+the
+.Nm
+driver was rewritten to work with the replaced TTY subsystem.
+.Sh AUTHORS
+The author of the current implementation is
+.An Ed Schouten Aq ed@FreeBSD.org .
+Previous versions of
+.Nm
+were based on code written by
+.An Ugen J.S. Antsilevich Aq ugen@NetVision.net.il .
+.Sh BUGS
+This version of
+.Nm
+does not return proper error codes when calling
+.Dv FIONREAD .
+It also does not allow
+.Dv SNPSTTY
+to detach itself from the TTY.
diff --git a/share/man/man4/spic.4 b/share/man/man4/spic.4
new file mode 100644
index 000000000000..a398007f88ed
--- /dev/null
+++ b/share/man/man4/spic.4
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright (c) 2002 Will Andrews
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 20, 2002
+.Dt SPIC 4
+.Os
+.Sh NAME
+.Nm spic
+.Nd Sony Programmable I/O Controller device driver
+.Sh SYNOPSIS
+.Cd "device spic"
+.Sh DESCRIPTION
+The
+.Nm
+driver allows using
+.Xr moused 8
+to drive the Sony Vaio Jogdial device found on several Sony Vaio models.
+It works by mapping the forward, backwards, up, and down inputs to
+.Dq l ,
+.Dq r ,
+.Dq u ,
+and
+.Dq d ,
+respectively.
+From that a program reading the Jogdial can decide what to do.
+Some actions might include scrolling, mimicking mouse buttons, launching
+applications, or other useful things.
+.Sh SEE ALSO
+.Xr moused 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 4.6 .
+.Sh AUTHORS
+.An Nick Sayer Aq nsayer@FreeBSD.org
+.An Will Andrews Aq will@FreeBSD.org
diff --git a/share/man/man4/spkr.4 b/share/man/man4/spkr.4
new file mode 100644
index 000000000000..1f39a1eec0ec
--- /dev/null
+++ b/share/man/man4/spkr.4
@@ -0,0 +1,249 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 10, 2005
+.Dt SPKR 4
+.Os
+.Sh NAME
+.Nm speaker ,
+.Nm spkr
+.Nd console speaker device driver
+.Sh SYNOPSIS
+.Cd device speaker
+.In dev/speaker/speaker.h
+.Sh DESCRIPTION
+The speaker device driver allows applications to control the PC console
+speaker on an
+.Tn IBM-PC Ns --compatible
+machine running
+.Fx .
+.Pp
+Only one process may have this device open at any given time;
+.Xr open 2
+and
+.Xr close 2
+are used to lock and relinquish it.
+An attempt to open when
+another process has the device locked will return -1 with an
+.Er EBUSY
+error
+indication.
+Writes to the device are interpreted as `play strings' in a
+simple ASCII melody notation.
+An
+.Xr ioctl 2
+request
+for tone generation at arbitrary
+frequencies is also supported.
+.Pp
+Sound-generation does not monopolize the processor; in fact, the driver
+spends most of its time sleeping while the PC hardware is emitting
+tones.
+Other processes may emit beeps while the driver is running.
+.Pp
+Applications may call
+.Xr ioctl 2
+on a speaker file descriptor to control the
+speaker driver directly; definitions for the
+.Xr ioctl 2
+interface are in
+.In dev/speaker/speaker.h .
+The
+.Li tone_t
+structure used in these calls has two fields,
+specifying a frequency (in Hz) and a duration (in 1/100ths of a second).
+A frequency of zero is interpreted as a rest.
+.Pp
+At present there are two such
+.Xr ioctl 2
+calls.
+.Dv SPKRTONE
+accepts a pointer to a
+single tone structure as third argument and plays it.
+.Dv SPKRTUNE
+accepts a
+pointer to the first of an array of tone structures and plays them in
+continuous sequence; this array must be terminated by a final member with
+a zero duration.
+.Pp
+The play-string language is modeled on the PLAY statement conventions of
+.Tn IBM
+Advanced BASIC 2.0.
+The
+.Li MB ,
+.Li MF ,
+and
+.Li X
+primitives of PLAY are not
+useful in a timesharing environment and are omitted.
+The `octave-tracking'
+feature and the slur mark are new.
+.Pp
+There are 84 accessible notes numbered 1-84 in 7 octaves, each running from
+C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
+with middle C.
+By default, the play function emits half-second notes with the
+last 1/16th second being `rest time'.
+.Pp
+Play strings are interpreted left to right as a series of play command groups;
+letter case is ignored.
+Play command groups are as follows:
+.Bl -tag -width CDEFGABxx
+.It Li CDEFGAB
+Letters A through G cause the corresponding note to be played in the
+current octave.
+A note letter may optionally be followed by an
+.Dq Em "accidental sign" ,
+one of # + or -; the first two of these cause it to be sharped one
+half-tone, the last causes it to be flatted one half-tone.
+It may
+also be followed by a time value number and by sustain dots (see
+below).
+Time values are interpreted as for the L command below.
+.It Ns Li O Sy n
+If
+.Sy n
+is numeric, this sets the current octave.
+.Sy n
+may also be one of
+.Li L
+or
+.Li N
+to enable or disable octave-tracking (it is disabled by default).
+When octave-tracking is on, interpretation of a pair of letter notes
+will change octaves if necessary in order to make the smallest
+possible jump between notes.
+Thus ``olbc'' will be played as
+``olb>c'', and ``olcb'' as ``olc<b''.
+Octave locking is disabled for
+one letter note following >, < and O[0123456].
+(The octave-locking
+feature is not supported in
+.Tn IBM
+BASIC.)
+.It Li >
+Bump the current octave up one.
+.It Li <
+Drop the current octave down one.
+.It Ns Li N Sy n
+Play note
+.Sy n ,
+.Sy n
+being 1 to 84 or 0 for a rest of current time value.
+May be followed by sustain dots.
+.It Ns Li L Sy n
+Sets the current time value for notes.
+The default is
+.Li L4 ,
+quarter or crotchet notes.
+The lowest possible value is 1; values up
+to 64 are accepted.
+.Li L1
+sets whole notes,
+.Li L2
+sets half notes,
+.Li L4
+sets quarter notes, etc.
+.It Ns Li P Sy n
+Pause (rest), with
+.Sy n
+interpreted as for
+.Li L Sy n .
+May be followed by
+sustain dots.
+May also be written
+.Li ~ .
+.It Ns Li T Sy n
+Sets the number of quarter notes per minute; default is 120.
+Musical
+names for common tempi are:
+.Bd -literal -offset indent
+ Tempo Beats Per Minute
+very slow Larghissimo
+ Largo 40-60
+ Larghetto 60-66
+ Grave
+ Lento
+ Adagio 66-76
+slow Adagietto
+ Andante 76-108
+medium Andantino
+ Moderato 108-120
+fast Allegretto
+ Allegro 120-168
+ Vivace
+ Veloce
+ Presto 168-208
+very fast Prestissimo
+.Ed
+.It Li M[LNS]
+Set articulation.
+.Li MN
+.Li ( N
+for normal) is the default; the last 1/8th of
+the note's value is rest time.
+You can set
+.Li ML
+for legato (no rest space) or
+.Li MS
+for staccato (1/4 rest space).
+.El
+.Pp
+Notes (that is,
+.Li CDEFGAB
+or
+.Li N
+command character groups) may be followed by
+sustain dots.
+Each dot causes the note's value to be lengthened by one-half
+for each one.
+Thus, a note dotted once is held for 3/2 of its undotted value;
+dotted twice, it is held 9/4, and three times would give 27/8.
+.Pp
+A note and its sustain dots may also be followed by a slur mark (underscore).
+This causes the normal micro-rest after the note to be filled in, slurring it
+to the next one.
+(The slur feature is not supported in
+.Tn IBM
+BASIC.)
+.Pp
+Whitespace in play strings is simply skipped and may be used to separate
+melody sections.
+.Sh FILES
+.Bl -tag -width /dev/speakerxx
+.It Pa /dev/speaker
+speaker device file
+.El
+.Sh SEE ALSO
+.Xr spkrtest 8
+.Sh HISTORY
+The
+.Nm
+device appeared in
+.Fx 1.0 .
+.Sh AUTHORS
+.An Eric S. Raymond Aq esr@snark.thyrsus.com
+June 1990
+.Sh "PORTED BY"
+.An Andrew A. Chernov Aq ache@astral.msk.su
+.Sh BUGS
+Due to roundoff in the pitch tables and slop in the tone-generation and timer
+hardware (neither of which was designed for precision), neither pitch accuracy
+nor timings will be mathematically exact.
+There is no volume control.
+.Pp
+The action of two or more sustain dots does not reflect standard musical
+notation, in which each dot adds half the value of the previous dot
+modifier, not half the value of the note as modified.
+Thus, a note dotted
+once is held for 3/2 of its undotted value; dotted twice, it is held 7/4,
+and three times would give 15/8.
+The multiply-by-3/2 interpretation,
+however, is specified in the
+.Tn IBM
+BASIC manual and has been retained for
+compatibility.
+.Pp
+In play strings which are very long (longer than your system's physical I/O
+blocks) note suffixes or numbers may occasionally be parsed incorrectly due
+to crossing a block boundary.
diff --git a/share/man/man4/splash.4 b/share/man/man4/splash.4
new file mode 100644
index 000000000000..4b5f22426b56
--- /dev/null
+++ b/share/man/man4/splash.4
@@ -0,0 +1,293 @@
+.\"
+.\" Copyright (c) 1999
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 29, 2010
+.Dt SPLASH 4
+.Os
+.Sh NAME
+.Nm splash
+.Nd splash screen / screen saver interface
+.Sh SYNOPSIS
+.Cd "device splash"
+.Sh DESCRIPTION
+The
+.Nm
+pseudo device driver adds support for the splash screen and screen
+savers to the kernel.
+This driver is required if the splash bitmap image is to be loaded or
+any screen saver is to be used.
+.Ss Splash screen
+You can load and display an arbitrary bitmap image file as a welcome banner
+on the screen when the system is about to start.
+This image will remain on the screen
+during kernel initialization process
+until the login prompt appears on the screen
+or until a screen saver is loaded and initialized.
+The image will also disappear if you hit any key,
+although this may not work immediately
+if the kernel is still probing devices.
+.Pp
+If you specify the
+.Fl c
+or
+.Fl v
+boot option when loading the kernel, the splash image will not appear.
+However, it
+is still loaded and can be used as a screen saver later: see below.
+.Pp
+In order to display the bitmap, the bitmap file itself and the
+matching splash image decoder module must be loaded by the boot loader.
+Currently the following decoder modules are available:
+.Pp
+.Bl -tag -width splash_decoder -compact
+.It Pa splash_bmp.ko
+W*ndows BMP file decoder.
+While the BMP file format allows images of various color depths, this
+decoder currently only handles 256 color bitmaps.
+Bitmaps of other color depths will not be displayed.
+.It Pa splash_pcx.ko
+ZSoft PCX decoder.
+This decoder currently only supports version 5 8-bpp single-plane
+images.
+.It Pa splash_txt.ko
+TheDraw binary ASCII drawing file decoder.
+Displays a text-mode 80x25 ASCII drawing, such as that produced by
+the Binary save format in TheDraw.
+This format consists of a sequence
+of two byte pairs representing the 80x25 display, where the first byte
+is the ASCII character to draw and the second byte indicates the
+colors/attributes to use when drawing the character.
+.El
+.Pp
+The
+.Sx EXAMPLES
+section illustrates how to set up the splash screen.
+.Pp
+If the standard VGA video mode is used,
+the size of the bitmap must be 320x200 or less.
+If you enable the VESA mode support in the kernel,
+either by statically linking the VESA module or by loading the VESA module
+(see
+.Xr vga 4 ) ,
+you can load bitmaps up to a resolution of 1024x768, depending on the VESA
+BIOS and the amount of video memory on the video card.
+.Ss Screen saver
+The screen saver will activate when the system is considered idle: i.e.\&
+when the user has not typed a key or moved the mouse for a specified period
+of time.
+As the screen saver is an optional module,
+it must be explicitly loaded into memory.
+Currently the following screen saver modules are available:
+.Pp
+.Bl -tag -width splash_module.ko -compact
+.It Pa blank_saver.ko
+This screen saver simply blanks the screen.
+.It Pa beastie_saver.ko
+Animated graphical
+.Bx
+Daemon.
+.It Pa daemon_saver.ko
+Animated
+.Bx
+Daemon screen saver.
+.It Pa dragon_saver.ko
+Draws a random dragon curve.
+.It Pa fade_saver.ko
+The screen will gradually fade away.
+.It Pa fire_saver.ko
+A fire which becomes higher as load increases.
+.It Pa green_saver.ko
+The screen will be blanked, similar to
+.Pa blank_saver.ko .
+If the monitor and the video card's BIOS support it
+the screen will also be powered off.
+.It Pa logo_saver.ko
+Animated graphical
+.Fx
+logo.
+.It Pa rain_saver.ko
+Draws a shower on the screen.
+.It Pa snake_saver.ko
+Draws a snake of string.
+.It Pa star_saver.ko
+Twinkling stars.
+.It Pa warp_saver.ko
+Streaking stars.
+.El
+.Pp
+Screen saver modules can be loaded using
+.Xr kldload 8 :
+.Pp
+.Dl kldload logo_saver
+.Pp
+The timeout value in seconds can be specified as follows:
+.Pp
+.Dl vidcontrol -t N
+.Pp
+Alternatively, you can set the
+.Ar saver
+variable in the
+.Pa /etc/rc.conf
+to the screen saver of your choice and
+the timeout value to the
+.Ar blanktime
+variable so that the screen saver is automatically loaded
+and the timeout value is set when the system starts.
+.Pp
+The screen saver may be instantly activated by hitting the
+.Ar saver
+key: the defaults are
+.Em Shift-Pause
+on the AT enhanced keyboard and
+.Em Shift-Ctrl-NumLock/Pause
+on the AT 84 keyboard.
+You can change the
+.Ar saver
+key by modifying the keymap
+(see
+.Xr kbdcontrol 1 ,
+.Xr keymap 5 ) ,
+and assign the
+.Ar saver
+function to a key of your preference.
+.Pp
+The screen saver will not run if the screen is not in text mode.
+.Ss Splash screen as a screen saver
+If you load a splash image but do not load a screen saver,
+you can continue using the splash module as a screen saver.
+The screen blanking interval can be specified as described in the
+.Sx Screen saver
+section above.
+.\".Sh DRIVER CONFIGURATION
+.Sh FILES
+.Bl -tag -width /boot/kernel/splash_xxxx.ko -compact
+.It Pa /boot/defaults/loader.conf
+boot loader configuration defaults
+.It Pa /etc/rc.conf
+system configuration information
+.It Pa /boot/kernel/splash_*.ko
+splash image decoder modules
+.It Pa /boot/kernel/*_saver.ko
+screen saver modules
+.It Pa /boot/kernel/vesa.ko
+the VESA support module
+.El
+.Sh EXAMPLES
+In order to load the splash screen or the screen saver, you must
+have the following line in the kernel configuration file.
+.Pp
+.Dl device splash
+.Pp
+Next, edit
+.Pa /boot/loader.conf
+(see
+.Xr loader.conf 5 )
+and include the following lines:
+.Bd -literal -offset indent
+splash_bmp_load="YES"
+bitmap_load="YES"
+bitmap_name="/boot/chuck.bmp"
+.Ed
+.Pp
+In the above example, the file
+.Pa /boot/chuck.bmp
+is loaded.
+In the following example, the VESA module
+is loaded so that a bitmap file which cannot be displayed in standard
+VGA modes may be shown using one of the VESA video modes.
+.Bd -literal -offset indent
+splash_pcx_load="YES"
+vesa_load="YES"
+bitmap_load="YES"
+bitmap_name="/boot/chuck.pcx"
+.Ed
+.Pp
+If the VESA support is statically linked to the kernel, it is not
+necessary to load the VESA module.
+Just load the bitmap file and the splash decoder module as in the
+first example above.
+.Pp
+To load a binary ASCII drawing and display this while booting, include the
+following into your
+.Pa /boot/loader.conf
+:
+.Bd -literal -offset indent
+splash_txt_load="YES"
+bitmap_load="YES"
+bitmap_name="/boot/splash.bin"
+.Ed
+.\".Sh DIAGNOSTICS
+.Sh SEE ALSO
+.Xr vidcontrol 1 ,
+.Xr syscons 4 ,
+.Xr vga 4 ,
+.Xr loader.conf 5 ,
+.Xr rc.conf 5 ,
+.Xr kldload 8 ,
+.Xr kldunload 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+The
+.Pa splash_bmp
+module was written by
+.An Michael Smith Aq msmith@FreeBSD.org
+and
+.An Kazutaka Yokota .
+The
+.Pa splash_pcx
+module was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org
+based on the
+.Pa splash_bmp
+code.
+The
+.Pa splash_txt
+module was written by
+.An Antony Mawer Aq antony@mawer.org
+based on the
+.Pa splash_bmp
+code, with some additional inspiration from the
+.Pa daemon_saver
+code.
+.Sh CAVEATS
+Both the splash screen and the screen saver work with
+.Xr syscons 4
+only.
+.Sh BUGS
+If you load a screen saver while another screen saver has already
+been loaded, the first screen saver will not be automatically unloaded
+and will remain in memory, wasting kernel memory space.
diff --git a/share/man/man4/sppp.4 b/share/man/man4/sppp.4
new file mode 100644
index 000000000000..519120f4fdaf
--- /dev/null
+++ b/share/man/man4/sppp.4
@@ -0,0 +1,240 @@
+.\"
+.\" Copyright (c) 1997, 2001 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2008
+.Dt SPPP 4
+.Os
+.Sh NAME
+.Nm sppp
+.Nd point to point protocol network layer for synchronous lines
+.Sh SYNOPSIS
+.Cd "device sppp"
+.Sh DESCRIPTION
+The
+.Nm
+network layer implements the state machine and the Link Control
+Protocol (LCP) of the
+.Em point to point protocol (PPP)
+as described in RFC 1661.
+Note that this layer does not provide
+network interfaces of its own, it is rather intended to be layered on
+top of drivers providing a synchronous point-to-point connection that
+wish to run a PPP stack over it.
+The corresponding network interfaces
+have to be provided by these hardware drivers.
+.Pp
+The
+.Nm
+layer provides three basic modes of operation.
+The default mode,
+with no special flags to be set, is to create the PPP connection
+(administrative
+.Em Open
+event to the LCP layer) as soon as the interface is taken up with the
+.Xr ifconfig 8
+command.
+Taking the interface down again will terminate the LCP layer
+and thus all other layers on top.
+The link will also terminate itself as
+soon as no Network Control Protocol (NCP) is open anymore, indicating
+that the lower layers are no longer needed.
+.Pp
+Setting the link-level flag
+.Em link0
+with
+.Xr ifconfig 8
+will cause the respective network interface to go into
+.Em passive
+mode.
+This means, the administrative
+.Em Open
+event to the LCP layer will be delayed until after the lower layers
+signals an
+.Em Up
+event (rise of
+.Dq carrier ) .
+This can be used by lower layers to support
+a dialin connection where the physical layer is not available
+immediately at startup, but only after some external event arrives.
+Receipt of a
+.Em Down
+event from the lower layer will not take the interface completely down
+in this case.
+.Pp
+Finally, setting the flag
+.Em link1
+will cause the interface to operate in
+.Em dial-on-demand
+mode.
+This is also only useful if the lower layer supports the notion
+of a carrier.
+Upon configuring the
+respective interface, it will delay the administrative
+.Em Open
+event to the LCP layer until either an outbound network packet
+arrives, or until the lower layer signals an
+.Em Up
+event, indicating an inbound connection.
+As with passive mode, receipt
+of a
+.Em Down
+event (loss of carrier) will not automatically take the interface down,
+thus it remains available for further connections.
+.Pp
+The
+.Nm
+layer supports the
+.Em debug
+interface flag that can be set with
+.Xr ifconfig 8 .
+If this flag is set, the various control protocol packets being
+exchanged as well as the option negotiation between both ends of the
+link will be logged at level
+.Dv LOG_DEBUG .
+This can be helpful to examine configuration problems during the first
+attempts to set up a new configuration.
+Without this flag being set,
+only the major phase transitions will be logged at level
+.Dv LOG_INFO .
+.Pp
+It is possible to leave the local interface IP address open for
+negotiation by setting it to 0.0.0.0.
+This requires that the remote
+peer can correctly supply a value for it based on the identity of the
+caller, or on the remote address supplied by this side.
+Due to the
+way the IPCP option negotiation works, this address is being supplied
+late during the negotiation, which might cause the remote peer to make
+wrong assumptions.
+.Pp
+In a similar spirit the remote address can be set to the magical
+value
+.Li 0.0.0. Ns Em *
+which means that we do not care what address the remote
+side will use, as long as it is not 0.0.0.0.
+This is useful if your ISP has several dial-in
+servers.
+You can of course
+.Nm route Cm add Ar something_or_other 0.0.0. Ns Em *
+and it will do exactly what you would want it to.
+.Pp
+The PAP and CHAP authentication protocols as described in RFC 1334,
+and RFC 1994 resp., are also implemented.
+Their parameters are being
+controlled by the
+.Xr spppcontrol 8
+utility.
+.Pp
+VJ header compression is implemented, and enabled by default.
+It can be
+disabled using
+.Xr spppcontrol 8 .
+.Sh DIAGNOSTICS
+.Bl -diag
+.It <ifname><ifnum>: <proto> illegal <event> in state <statename>
+An event happened that should not happen for the current state
+the respective control protocol is in.
+See RFC 1661 for a description
+of the state automaton.
+.It <ifname><ifnum>: loopback
+The state automaton detected a line loopback (that is, it was talking
+with itself).
+The interface will be temporarily disabled.
+.It <ifname><ifnum>: up
+The LCP layer is running again, after a line loopback had previously
+been detected.
+.It <ifname><ifnum>: down
+The keepalive facility detected the line being unresponsive.
+Keepalive must be explicitly requested by the lower layers in order to
+take place.
+.El
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ppp 4 ,
+.Xr ifconfig 8 ,
+.Xr spppcontrol 8
+.Rs
+.%A W. Simpson, Editor
+.%T "The Point-to-Point Protocol (PPP)"
+.%O RFC 1661
+.Re
+.Rs
+.%A G. McGregor
+.%T "The PPP Internet Protocol Control Protocol (IPCP)"
+.%O RFC 1332
+.Re
+.Rs
+.%A B. Lloyd
+.%A W. Simpson
+.%T "PPP Authentication Protocols"
+.%O RFC 1334
+.Re
+.Rs
+.%A W. Simpson
+.%T "PPP Challenge Handshake Authentication Protocol (CHAP)"
+.%O RFC 1994
+.Re
+.Sh AUTHORS
+.An -nosplit
+The original implementation of
+.Nm
+was written in 1994 at Cronyx Ltd., Moscow by
+.An Serge Vakulenko Aq vak@cronyx.ru .
+.An J\(:org Wunsch
+.Aq joerg_wunsch@uriah.heep.sax.de
+rewrote a large part in 1997 in order
+to fully implement the state machine as described in RFC 1661, so it
+could also be used for dialup lines.
+He also wrote this man page.
+Serge later on wrote a basic implementation for PAP and CHAP, which
+served as the base for the current implementation, done again by
+.An J\(:org Wunsch .
+.Sh BUGS
+Many.
+.Pp
+Currently, only the
+.Em IPCP
+control protocol and
+.Xr ip 4
+network protocol is supported.
+More NCPs should be implemented, as well as other control protocols
+for authentication and link quality reporting.
+.Pp
+Negotiation loop avoidance is not fully implemented.
+If the negotiation
+does not converge, this can cause an endless loop.
+.Pp
+The various parameters that should be adjustable per RFC 1661 are
+currently hard-coded into the kernel, and should be made accessible
+through
+.Xr spppcontrol 8 .
+.Pp
+.Em Passive
+mode has not been tested extensively.
+.Pp
+Link-level compression protocols should be supported.
diff --git a/share/man/man4/ste.4 b/share/man/man4/ste.4
new file mode 100644
index 000000000000..02644ae32c05
--- /dev/null
+++ b/share/man/man4/ste.4
@@ -0,0 +1,204 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 24, 2009
+.Dt STE 4
+.Os
+.Sh NAME
+.Nm ste
+.Nd "Sundance Technologies ST201 Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device ste"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ste_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the Sundance Technologies ST201 PCI Fast
+Ethernet controller chip.
+.Pp
+The Sundance ST201 uses bus master DMA and is designed to be a
+3Com Etherlink XL workalike.
+It uses the same DMA descriptor
+structure and is very similar in operation, however its register
+layout is different.
+The ST201 has a 64-bit multicast hash filter
+and a single perfect filter entry for the station address.
+It supports both 10 and 100Mbps speeds in either full or half duplex
+using an MII transceiver.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Sundance Technologies ST201 based Fast Ethernet
+adapters and embedded controllers including:
+.Pp
+.Bl -bullet -compact
+.It
+D-Link DFE-530TXS
+.It
+D-Link DFE-550TX
+.It
+D-Link DFE-580TX
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.ste.%d.int_rx_mod
+Maximum number of time to delay RX interrupts.
+The valid range is 0 to 209712 in units of 1us, the default is
+150 (150us).
+The value 0 effectively disables the RX interrupt moderation.
+The resolution of of timer is about 3.2us so finer tuning than
+3.2us wouldn't be available.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ste%d: couldn't map ports/memory"
+A fatal initialization error has occurred.
+.It "ste%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "ste%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "ste%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "ste%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "ste%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform a second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T Sundance ST201 data sheet
+.%U http://www.sundanceti.com
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ee.columbia.edu .
diff --git a/share/man/man4/stf.4 b/share/man/man4/stf.4
new file mode 100644
index 000000000000..1178e03bb304
--- /dev/null
+++ b/share/man/man4/stf.4
@@ -0,0 +1,267 @@
+.\" $KAME: stf.4,v 1.35 2001/05/02 06:24:49 itojun Exp $
+.\"
+.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2011
+.Dt STF 4
+.Os
+.Sh NAME
+.Nm stf
+.Nd
+.Tn 6to4
+tunnel interface
+.Sh SYNOPSIS
+.Cd "device stf"
+.Sh DESCRIPTION
+The
+.Nm
+interface supports
+.Dq 6to4
+IPv6 in IPv4 encapsulation.
+It can tunnel IPv6 traffic over IPv4, as specified in
+.Li RFC3056 .
+.Pp
+For ordinary nodes in 6to4 site, you do not need
+.Nm
+interface.
+The
+.Nm
+interface is necessary for site border router
+(called
+.Dq 6to4 router
+in the specification).
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Pp
+Due to the way 6to4 protocol is specified,
+.Nm
+interface requires certain configuration to work properly.
+Single
+(no more than 1)
+valid 6to4 address needs to be configured to the interface.
+.Dq A valid 6to4 address
+is an address which has the following properties.
+If any of the following properties are not satisfied,
+.Nm
+raises runtime error on packet transmission.
+Read the specification for more details.
+.Bl -bullet
+.It
+matches
+.Li 2002:xxyy:zzuu::/48
+where
+.Li xxyy:zzuu
+is a hexadecimal notation of an IPv4 address for the node.
+IPv4 address can be taken from any of interfaces your node has.
+Since the specification forbids the use of IPv4 private address,
+the address needs to be a global IPv4 address.
+.It
+Subnet identifier portion
+(48th to 63rd bit)
+and interface identifier portion
+(lower 64 bits)
+are properly filled to avoid address collisions.
+.El
+.Pp
+If you would like the node to behave as a relay router,
+the prefix length for the IPv6 interface address needs to be 16 so that
+the node would consider any 6to4 destination as
+.Dq on-link .
+If you would like to restrict 6to4 peers to be inside certain IPv4 prefix,
+you may want to configure IPv6 prefix length as
+.Dq 16 + IPv4 prefix length .
+.Nm
+interface will check the IPv4 source address on packets,
+if the IPv6 prefix length is larger than 16.
+.Pp
+.Nm
+can be configured to be ECN friendly.
+This can be configured by
+.Dv IFF_LINK1 .
+See
+.Xr gif 4
+for details.
+.Pp
+Please note that 6to4 specification is written as
+.Dq accept tunnelled packet from everyone
+tunnelling device.
+By enabling
+.Nm
+device, you are making it much easier for malicious parties to inject
+fabricated IPv6 packet to your node.
+Also, malicious party can inject an IPv6 packet with fabricated source address
+to make your node generate improper tunnelled packet.
+Administrators must take caution when enabling the interface.
+To prevent possible attacks,
+.Nm
+interface filters out the following packets.
+Note that the checks are no way complete:
+.Bl -bullet
+.It
+Packets with IPv4 unspecified address as outer IPv4 source/destination
+.Pq Li 0.0.0.0/8
+.It
+Packets with loopback address as outer IPv4 source/destination
+.Pq Li 127.0.0.0/8
+.It
+Packets with IPv4 multicast address as outer IPv4 source/destination
+.Pq Li 224.0.0.0/4
+.It
+Packets with limited broadcast address as outer IPv4 source/destination
+.Pq Li 255.0.0.0/8
+.It
+Packets with private address as outer IPv4 source/destination
+.Pq Li 10.0.0.0/8 , 172.16.0.0/12 , 192.168.0.0/16
+.It
+Packets with subnet broadcast address as outer IPv4 source/destination.
+The check is made against subnet broadcast addresses for
+all of the directly connected subnets.
+.It
+Packets that does not pass ingress filtering.
+Outer IPv4 source address must meet the IPv4 topology on the routing table.
+Ingress filter can be turned off by
+.Dv IFF_LINK2
+bit.
+.It
+The same set of rules are applied against the IPv4 address embedded into
+inner IPv6 address, if the IPv6 address matches 6to4 prefix.
+.El
+.Pp
+It is recommended to filter/audit
+incoming IPv4 packet with IP protocol number 41, as necessary.
+It is also recommended to filter/audit encapsulated IPv6 packets as well.
+You may also want to run normal ingress filter against inner IPv6 address
+to avoid spoofing.
+.Pp
+By setting the
+.Dv IFF_LINK0
+flag on the
+.Nm
+interface, it is possible to disable the input path,
+making the direct attacks from the outside impossible.
+Note, however, there are other security risks exist.
+If you wish to use the configuration,
+you must not advertise your 6to4 address to others.
+.\"
+.Sh EXAMPLES
+Note that
+.Li 8504:0506
+is equal to
+.Li 133.4.5.6 ,
+written in hexadecimals.
+.Bd -literal
+# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
+# ifconfig stf0 inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
+ prefixlen 16 alias
+.Ed
+.Pp
+The following configuration accepts packets from IPv4 source
+.Li 9.1.0.0/16
+only.
+It emits 6to4 packet only for IPv6 destination 2002:0901::/32
+(IPv4 destination will match
+.Li 9.1.0.0/16 ) .
+.Bd -literal
+# ifconfig ne0 inet 9.1.2.3 netmask 0xffff0000
+# ifconfig stf0 inet6 2002:0901:0203:0000:a00:5aff:fe38:6f86 \\
+ prefixlen 32 alias
+.Ed
+.Pp
+The following configuration uses the
+.Nm
+interface as an output-only device.
+You need to have alternative IPv6 connectivity
+(other than 6to4)
+to use this configuration.
+For outbound traffic, you can reach other 6to4 networks efficiently via
+.Nm stf .
+For inbound traffic, you will not receive any 6to4-tunneled packets
+(less security drawbacks).
+Be careful not to advertise your 6to4 prefix to others
+.Pq Li 2002:8504:0506::/48 ,
+and not to use your 6to4 prefix as a source.
+.Bd -literal
+# ifconfig ne0 inet 133.4.5.6 netmask 0xffffff00
+# ifconfig stf0 inet6 2002:8504:0506:0000:a00:5aff:fe38:6f86 \\
+ prefixlen 16 alias deprecated link0
+# route add -inet6 2002:: -prefixlen 16 ::1
+# route change -inet6 2002:: -prefixlen 16 ::1 -ifp stf0
+.Ed
+.\"
+.Sh SEE ALSO
+.Xr gif 4 ,
+.Xr inet 4 ,
+.Xr inet6 4
+.Pp
+.Pa http://www.ipv6day.org/action.php?n=En.IPv6day
+.Rs
+.%A Brian Carpenter
+.%A Keith Moore
+.%T "Connection of IPv6 Domains via IPv4 Clouds"
+.%D February 2001
+.%R RFC
+.%N 3056
+.Re
+.Rs
+.%A Jun-ichiro itojun Hagino
+.%T "Possible abuse against IPv6 transition technologies"
+.%D July 2000
+.%N draft-itojun-ipv6-transition-abuse-01.txt
+.%O work in progress
+.Re
+.\"
+.Sh HISTORY
+The
+.Nm
+device first appeared in WIDE/KAME IPv6 stack.
+.\"
+.Sh BUGS
+No more than one
+.Nm
+interface is allowed for a node,
+and no more than one IPv6 interface address is allowed for an
+.Nm
+interface.
+It is to avoid source address selection conflicts
+between IPv6 layer and IPv4 layer,
+and to cope with ingress filtering rule on the other side.
+This is a feature to make
+.Nm
+work right for all occasions.
diff --git a/share/man/man4/stg.4 b/share/man/man4/stg.4
new file mode 100644
index 000000000000..1d088b0077a6
--- /dev/null
+++ b/share/man/man4/stg.4
@@ -0,0 +1,110 @@
+.\"
+.\" Copyright (c) 2003 Bob Bishop
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 8, 2004
+.Dt STG 4
+.Os
+.Sh NAME
+.Nm stg
+.Nd driver for Future Domain based SCSI controllers
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device stg"
+.Pp
+For one or more ISA cards:
+.Cd "device isa"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.stg.0.at="isa"
+.Pp
+For one or more PCI cards:
+.Cd "device pci"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+stg_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for ISA, PCCARD and PCI controllers based on
+Future Domain SCSI controller chips including the TMC-16C30, 16C50 and 32C60.
+.Sh HARDWARE
+Controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec 2920/A
+.It
+Future Domain SCSI2GO
+.It
+Future Domain TMC-18XX/3260
+.It
+IBM SCSI PCMCIA Card
+.It
+ICM PSC-2401 SCSI
+.It
+MELCO IFC-SC
+.It
+RATOC REX-5536, REX-5536AM, REX-5536M, REX-9836A
+.El
+.Pp
+Note that the Adaptec 2920C is supported by the
+.Xr ahc 4
+driver.
+.Sh SEE ALSO
+.Xr ahc 4 ,
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr sa 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+device driver has been developed for
+.Nx Ns / Ns Tn pc98
+and ported for
+.Fx .
+It first appeared in
+.Fx 2.2
+with PAO and merged in
+.Fx 4.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Naofumi HONDA .
diff --git a/share/man/man4/stge.4 b/share/man/man4/stge.4
new file mode 100644
index 000000000000..bfcaab0533c2
--- /dev/null
+++ b/share/man/man4/stge.4
@@ -0,0 +1,202 @@
+.\" $NetBSD: stge.4,v 1.7 2003/02/14 15:20:20 grant Exp $
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 23, 2010
+.Dt STGE 4
+.Os
+.Sh NAME
+.Nm stge
+.Nd Sundance/Tamarack TC9021 Gigabit Ethernet adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device stge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_stge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for various NICs based on the
+Sundance/Tamarack TC9021 Gigabit Ethernet controller chip.
+.Pp
+The Sundance/Tamarack TC9021 is found on the D-Link DGE-550T
+and the Antares Microsystems Gigabit Ethernet board.
+It uses an external PHY or an external 10-bit interface.
+.Pp
+All NICs supported by the
+.Nm
+driver have TCP/UDP/IP checksum offload for both receive and
+transmit, hardware VLAN tag stripping/insertion features, and
+receive interrupt moderation mechanism as well as a 64-bit
+multicast hash filter.
+The Sundance/Tamarack TC9021 supports TBI (ten bit interface)
+and GMII transceivers, which means it can be used with either
+copper or 1000baseX fiber applications.
+.Pp
+The Sundance/Tamarack TC9021 also supports jumbo frames, which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+The Sundance/Tamarack supports 1000Mbps in
+.Cm autoselect
+mode only.
+.\" .It Cm 1000baseSX
+.\" Set 1000Mbps (Gigabit Ethernet) operation.
+.\" Both
+.\" .Cm full-duplex
+.\" and
+.\" .Cm half-duplex
+.\" modes are supported.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver provides support for various NICs based on the Sundance/Tamarack
+TC9021 based Gigabit Ethernet controller chips, including:
+.Pp
+.Bl -bullet -compact
+.It
+Antares Microsystems Gigabit Ethernet
+.It
+ASUS NX1101 Gigabit Ethernet
+.It
+D-Link DL-4000 Gigabit Ethernet
+.It
+IC Plus IP1000A Gigabit Ethernet
+.It
+Sundance ST-2021 Gigabit Ethernet
+.It
+Sundance ST-2023 Gigabit Ethernet
+.It
+Sundance TC9021 Gigabit Ethernet
+.It
+Tamarack TC9021 Gigabit Ethernet
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va dev.stge.%d.rxint_nframe
+Number of frames between RxDMAComplete interrupts.
+The accepted range is 1 to 255, default value is 8 frames.
+The interface has to be brought down and up again before a change takes effect.
+.It Va dev.stge.%d.rxint_dmawait
+Maximum amount of time to wait in 1us increments before issuing
+an Rx interrupt if the number of frames received is less than
+.Va rxint_nframe .
+The accepted range is 0 to 4194, default value is 30 microseconds.
+The interface has to be brought down and up again before a change takes effect.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was ported from
+.Nx
+and first appeared in
+.Fx 6.2 .
+The
+.Nx
+version was written by
+.An Jason R. Thorpe
+.Aq thorpej@NetBSD.org .
+.Sh AUTHORS
+The
+.Nm
+driver was ported by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
diff --git a/share/man/man4/sym.4 b/share/man/man4/sym.4
new file mode 100644
index 000000000000..205fe8650563
--- /dev/null
+++ b/share/man/man4/sym.4
@@ -0,0 +1,382 @@
+.\"
+.\" Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010
+.\" PCI SCSI controllers.
+.\"
+.\" Copyright (C) 1999-2000 Gerard Roudier <groudier@club-internet.fr>
+.\"
+.\" This driver also supports the following Symbios/LSI PCI SCSI chips:
+.\" 53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895,
+.\" 53C810, 53C815, 53C825 and the 53C1510D is 53C8XX mode.
+.\"
+.\"
+.\" This driver for FreeBSD-CAM is derived from the Linux sym53c8xx driver.
+.\" Copyright (C) 1998-1999 Gerard Roudier
+.\"
+.\" The sym53c8xx driver is derived from the ncr53c8xx driver that had been
+.\" a port of the FreeBSD ncr driver to Linux-1.2.13.
+.\"
+.\" The original ncr driver has been written for 386bsd and FreeBSD by
+.\" Wolfgang Stanglmeier <wolf@cologne.de>
+.\" Stefan Esser <se@mi.Uni-Koeln.de>
+.\" Copyright (C) 1994 Wolfgang Stanglmeier
+.\"
+.\" The initialization code, and part of the code that addresses
+.\" FreeBSD-CAM services is based on the aic7xxx driver for FreeBSD-CAM
+.\" written by Justin T. Gibbs.
+.\"
+.\" Other major contributions:
+.\"
+.\" NVRAM detection and reading.
+.\" Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
+.\"
+.\" ----------------------------------------------------------------------------
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 19, 2004
+.Dt SYM 4
+.Os
+.Sh NAME
+.Nm sym
+.Nd NCR/Symbios/LSI Logic 53C8XX PCI SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device sym"
+.Pp
+To disable PCI parity checking (needed for broken bridges):
+.Cd "options SYM_SETUP_PCI_PARITY=<boolean>"
+.Pp
+To control driver probing against HVD buses:
+.Cd "options SYM_SETUP_SCSI_DIFF=<bit combination>"
+.Pp
+To control chip attachment balancing between the ncr driver and this driver:
+.Cd "options SYM_SETUP_LP_PROBE_MAP=<bit combination>"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+sym_load="YES"
+.Ed
+.Sh DESCRIPTION
+This driver provides support for the Symbios/LSI Logic 53C8XX
+PCI SCSI controllers.
+.Pp
+Driver features include support for wide SCSI busses and fast10, fast20,
+fast40 and fast80-dt synchronous data transfers depending on controller
+capabilities.
+It also provides generic SCSI features such as tagged command
+queueing and auto-request sense.
+This driver is configured by default
+for a maximum of 446 outstanding commands per bus, 8 LUNs per target
+and 64 tagged tasks per LUN.
+These numbers are not so much limited by design
+as they are considered reasonable values for current SCSI technology.
+These values can be increased by changing appropriate
+constants in driver header files (not recommended).
+.Pp
+This driver supports the entire Symbios 53C8XX family of PCI SCSI
+controllers.
+It also offers the advantage of architectural improvements available
+only with newer chips.
+.Pp
+.Nm
+notably handles phase mismatch from SCRIPTS for the 53C896, 53C895A,
+and 53C1010 cores.
+As a result, it guarantees that no more than 1 interrupt
+per IO completion is delivered to the CPU, and that the SCRIPTS processor
+is never stalled waiting for CPU attention in normal situations.
+.Pp
+.Nm
+also uses LOAD/STORE SCRIPTS instructions for chips that support it.
+Only the early 810, 815 and 825 NCR chips do not support LOAD/STORE.
+Use of LOAD/STORE instead of MEMORY MOVE allows SCRIPTS to access IO
+registers internal to the chip (no external PCI cycles).
+As a result, the driver guarantees that no PCI self-mastering will occur
+for chips that support LOAD/STORE.
+.Pp
+LOAD/STORE instructions are also faster than MEMORY MOVE because
+they do not involve the chip DMA FIFO and are coded on 2 DWORDs
+instead of 3.
+.Pp
+For the early NCR 810, 815 and 825 chips, the driver uses a separate
+SCRIPTS set that uses MEMORY MOVE instructions for data movements.
+This is because LOAD/STORE are not supported by these chips.
+.Pp
+HVD/LVD capable controllers (895, 895A, 896, and 897) report
+the actual bus mode in the STEST4 chip IO registers.
+This feature
+allows the driver to safely probe against bus mode and to set up the chip
+accordingly.
+By default the driver only supports HVD for these chips.
+For other chips that can support HVD but not LVD, the driver has to probe
+implementation dependent registers (GPIO) in order to detect HVD bus mode.
+Only HVD implementations that conform with Symbios Logic recommendations can
+be detected by the driver.
+When the
+.Ar SYM_SETUP_SCSI_DIFF
+kernel option is assigned
+a value of 1, the driver will also probe against HVD for 825a, 875, 876 and
+885 chips, assuming Symbios Logic compatible implementation of HVD.
+.Pp
+When the
+.Ar SYM_SETUP_PCI_PARITY
+is assigned a value of 0, the
+driver will not enable PCI parity checking for 53C8XX devices.
+PCI parity
+checking should not be an option for PCI SCSI controllers, but some
+systems have been reported to fail using 53C8XX chips, due to spurious or
+permanent PCI parity errors detected.
+This option is supplied for
+convenience but it is neither recommended nor supported.
+.Pp
+The generic
+.Xr ncr 4
+driver also supports SYM53C8XX based PCI SCSI controllers,
+except for the SYM53C1010, which is only supported by the
+.Nm
+driver.
+.Pp
+By default, when both the
+.Xr ncr 4
+and
+.Nm
+drivers are configured, the
+.Nm
+driver takes precedence over the
+.Xr ncr 4
+driver.
+The user can indicate a balancing of chip types between the two drivers
+by defining the
+.Ar SYM_SETUP_LP_PROBE_MAP
+kernel configuration option as follows:
+.Bl -column "0x40"
+.It Em "Bit Devices to be attached by ncr instead"
+.It "0x01 53C810a, 53C860"
+.It "0x02 53C825a, 53C875, 53C876, 53C885, 53C895"
+.It "0x04 53C895a, 53C896, 53C897, 53C1510d"
+.It "0x40 53C810, 53C815, 53C825"
+.El
+.Pp
+For example, if
+.Ar SYM_SETUP_LP_PROBE_MAP
+is supplied with the value 0x41, the
+.Xr ncr 4
+driver will attach to 53C810, 53C815, 53C825, 53C810a, and 53C860 based
+controllers,
+and the
+.Nm
+driver will attach to all other 53C8XX based controllers.
+.Pp
+When only the
+.Nm
+driver is configured, the
+.Ar SYM_SETUP_LP_PROBE_MAP
+option has no effect.
+Thus, in this case, the
+.Nm
+driver will attach all 53C8XX based controllers present in the system.
+.Pp
+This driver offers other options
+that are not currently exported to the user.
+They are defined and documented in the
+.Pa sym_conf.h
+driver file.
+Changing these options is not recommended unless absolutely necessary.
+Some of these
+options are planned to be exported through
+.Xr sysctl 3
+or an equivalent mechanism
+in a future driver releases and therefore,
+no compatibility is guaranteed.
+.Pp
+At initialization, the driver tries to detect and read user settings from
+controller NVRAM.
+The Symbios/Logic NVRAM layout and the Tekram NVRAM
+layout are currently supported.
+If the reading of the NVRAM succeeds, the
+following settings are taken into account and reported to CAM:
+.Bl -column "SCSI parity checking" "Symbios"
+.It Em "Host settings Symbios Tekram"
+.It "SCSI parity checking Y N"
+.It "Host SCSI ident Y Y"
+.It "Verbose messages Y N"
+.It "Scan targets hi-lo Y N"
+.It "Avoid SCSI bus reset Y N"
+.El
+.Bl -column "Synchronous period" "Symbios"
+.It Em "Device settings Symbios Tekram"
+.It "Synchronous period Y Y"
+.It "SCSI bus width Y Y"
+.It "Queue tag enable Y Y"
+.It "Number of tags NA Y"
+.It "Disconnect enable Y Y"
+.It "Scan at boot time Y N"
+.It "Scan LUN Y N"
+.El
+.Pp
+Devices that are configured as disabled for 'scan' in the NVRAM are not
+reported to CAM at system start-up.
+They can be discovered later using
+the
+.Ql camcontrol rescan
+command.
+.Pp
+The table below summarizes the main features and capabilities of the
+NCR/Symbios/LSI Logic 53C8XX family of PCI SCSI controllers.
+.Bl -column sym53c1510d "80MHz" "Width" "SRAM" "PCI64"
+.It Em "Chip Sync Width SRAM PCI64 Supported"
+.It "sym53c810 10MHz 8Bit N N Y"
+.It "sym53c810a 10MHz 8Bit N N Y"
+.It "sym53c815 10MHz 8Bit N N Y"
+.It "sym53c825 10MHz 16Bit N N Y"
+.It "sym53c825a 10MHz 16Bit 4KB N Y"
+.It "sym53c860 20MHz 8Bit N N Y"
+.It "sym53c875 20MHz 16Bit 4KB N Y"
+.It "sym53c876 20MHz 16Bit 4KB N Y"
+.It "sym53c885 20MHz 16Bit 4KB N Y"
+.It "sym53c895 40MHz 16Bit 4KB N Y"
+.It "sym53c895A 40MHz 16Bit 8KB N Y"
+.It "sym53c896 40MHz 16Bit 8KB Y Y"
+.It "sym53c897 40MHz 16Bit 8KB Y Y"
+.It "sym53c1510D 40MHz 16Bit 4KB Y Y"
+.It "sym53c1010 80MHz 16Bit 8KB Y Y"
+.El
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following Symbios/LSI Logic PCI SCSI
+controllers:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn 53C810
+.It
+.Tn 53C810A
+.It
+.Tn 53C815
+.It
+.Tn 53C825
+.It
+.Tn 53C825A
+.It
+.Tn 53C860
+.It
+.Tn 53C875
+.It
+.Tn 53C876
+.It
+.Tn 53C895
+.It
+.Tn 53C895A
+.It
+.Tn 53C896
+.It
+.Tn 53C897
+.It
+.Tn 53C1000
+.It
+.Tn 53C1000R
+.It
+.Tn 53C1010-33
+.It
+.Tn 53C1010-66
+.It
+.Tn 53C1510D
+.El
+.Pp
+The SCSI controllers supported by
+.Nm
+can be either embedded on a motherboard, or on
+one of the following add-on boards:
+.Pp
+.Bl -bullet -compact
+.It
+ASUS SC-200, SC-896
+.It
+Data Technology DTC3130 (all variants)
+.It
+DawiControl DC2976UW
+.It
+Diamond FirePort (all)
+.It
+I-O DATA SC-UPCI (PC-98)
+.It
+Logitec LHA-521UA (PC-98)
+.It
+NCR cards (all)
+.It
+Symbios cards (all)
+.It
+Tekram DC390W, 390U, 390F, 390U2B, 390U2W, 390U3D, and 390U3W
+.It
+Tyan S1365
+.El
+.Sh MISC
+The DEC KZPCA-AA is a rebadged SYM8952U.
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr da 4 ,
+.Xr ncr 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Gerard Roudier
+and is derived from the
+Linux sym53c8xx driver from the same author.
+The sym53c8xx driver is derived from the ncr53c8xx driver,
+which was ported from the
+.Fx
+.Xr ncr 4
+driver to Linux-1.2.13.
+The original
+.Xr ncr 4
+driver was written for
+.Bx 386
+and
+.Fx
+by
+.An Wolfgang Stanglmeier
+and
+.An Stefan Esser .
+.Sh BUGS
+No known bugs.
diff --git a/share/man/man4/syncache.4 b/share/man/man4/syncache.4
new file mode 100644
index 000000000000..45dcf2c9b8b0
--- /dev/null
+++ b/share/man/man4/syncache.4
@@ -0,0 +1,215 @@
+.\"
+.\" syncache - TCP SYN caching to handle SYN flood DoS.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2008
+.Dt SYNCACHE 4
+.Os
+.Sh NAME
+.Nm syncache , syncookies
+.Nd
+.Xr sysctl 8
+MIBs for controlling TCP SYN caching
+.Sh SYNOPSIS
+.Bl -item -compact
+.It
+.Nm sysctl Cm net.inet.tcp.syncookies
+.It
+.Nm sysctl Cm net.inet.tcp.syncookies_only
+.El
+.Pp
+.Bl -item -compact
+.It
+.Nm sysctl Cm net.inet.tcp.syncache.hashsize
+.It
+.Nm sysctl Cm net.inet.tcp.syncache.bucketlimit
+.It
+.Nm sysctl Cm net.inet.tcp.syncache.cachelimit
+.It
+.Nm sysctl Cm net.inet.tcp.syncache.rexmtlimit
+.It
+.Nm sysctl Cm net.inet.tcp.syncache.count
+.El
+.Sh DESCRIPTION
+The
+.Nm
+.Xr sysctl 8
+MIB is used to control the TCP SYN caching in the system, which
+is intended to handle SYN flood Denial of Service attacks.
+.Pp
+When a TCP SYN segment is received on a port corresponding to a listen
+socket, an entry is made in the
+.Nm ,
+and a SYN,ACK segment is
+returned to the peer.
+The
+.Nm
+entry holds the TCP options from the initial SYN,
+enough state to perform a SYN,ACK retransmission, and takes up less
+space than a TCP control block endpoint.
+An incoming segment which contains an ACK for the SYN,ACK
+and matches a
+.Nm
+entry will cause the system to create a TCP control block
+with the options stored in the
+.Nm
+entry, which is then released.
+.Pp
+The
+.Nm
+protects the system from SYN flood DoS attacks by minimizing
+the amount of state kept on the server, and by limiting the overall size
+of the
+.Nm .
+.Pp
+.Nm Syncookies
+provides a way to virtually expand the size of the
+.Nm
+by keeping state regarding the initial SYN in the network.
+Enabling
+.Nm syncookies
+sends a cryptographic value in the SYN,ACK reply to
+the client machine, which is then returned in the client's ACK.
+If the corresponding entry is not found in the
+.Nm ,
+but the value
+passes specific security checks, the connection will be accepted.
+This is only used if the
+.Nm
+is unable to handle the volume of
+incoming connections, and a prior entry has been evicted from the cache.
+.Pp
+.Nm Syncookies
+have a certain number of disadvantages that a paranoid
+administrator may wish to take note of.
+Since the TCP options from the initial SYN are not saved, they are not
+applied to the connection, precluding use of features like window scale,
+timestamps, or exact MSS sizing.
+As the returning ACK establishes the connection, it may be possible for
+an attacker to ACK flood a machine in an attempt to create a connection.
+While steps have been taken to mitigate this risk, this may provide a way
+to bypass firewalls which filter incoming segments with the SYN bit set.
+.Pp
+To disable the
+.Nm syncache
+and run only with
+.Nm syncookies ,
+set
+.Va net.inet.tcp.syncookies_only
+to 1.
+.Pp
+The
+.Nm
+implements a number of variables in
+the
+.Va net.inet.tcp.syncache
+branch of the
+.Xr sysctl 3
+MIB.
+Several of these may be tuned by setting the corresponding
+variable in the
+.Xr loader 8 .
+.Bl -tag -width ".Va bucketlimit"
+.It Va hashsize
+Size of the
+.Nm
+hash table, must be a power of 2.
+Read-only, tunable via
+.Xr loader 8 .
+.It Va bucketlimit
+Limit on the number of entries permitted in each bucket of the hash table.
+This should be left at a low value to minimize search time.
+Read-only, tunable via
+.Xr loader 8 .
+.It Va cachelimit
+Limit on the total number of entries in the
+.Nm .
+Defaults to
+.Va ( hashsize No \(mu Va bucketlimit ) ,
+may be set lower to minimize memory
+consumption.
+Read-only, tunable via
+.Xr loader 8 .
+.It Va rexmtlimit
+Maximum number of times a SYN,ACK is retransmitted before being discarded.
+The default of 3 retransmits corresponds to a 45 second timeout, this value
+may be increased depending on the RTT to client machines.
+Tunable via
+.Xr sysctl 3 .
+.It Va count
+Number of entries present in the
+.Nm
+(read-only).
+.El
+.Pp
+Statistics on the performance of the
+.Nm
+may be obtained via
+.Xr netstat 1 ,
+which provides the following counts:
+.Bl -tag -width ".Li cookies received"
+.It Li "syncache entries added"
+Entries successfully inserted in the
+.Nm .
+.It Li retransmitted
+SYN,ACK retransmissions due to a timeout expiring.
+.It Li dupsyn
+Incoming SYN segment matching an existing entry.
+.It Li dropped
+SYNs dropped because SYN,ACK could not be sent.
+.It Li completed
+Successfully completed connections.
+.It Li "bucket overflow"
+Entries dropped for exceeding per-bucket size.
+.It Li "cache overflow"
+Entries dropped for exceeding overall cache size.
+.It Li reset
+RST segment received.
+.It Li stale
+Entries dropped due to maximum retransmissions or listen socket disappearance.
+.It Li aborted
+New socket allocation failures.
+.It Li badack
+Entries dropped due to bad ACK reply.
+.It Li unreach
+Entries dropped due to ICMP unreachable messages.
+.It Li "zone failures"
+Failures to allocate new
+.Nm
+entry.
+.It Li "cookies received"
+Connections created from segment containing ACK.
+.El
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr tcp 4 ,
+.Xr loader 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The existing
+.Nm
+implementation
+first appeared in
+.Fx 4.5 .
+The original concept of a
+.Nm
+originally appeared in
+.Bsx ,
+and was later modified by
+.Nx ,
+then further extended here.
+.Sh AUTHORS
+The
+.Nm
+code and manual page were written by
+.An Jonathan Lemon Aq jlemon@FreeBSD.org .
diff --git a/share/man/man4/syncer.4 b/share/man/man4/syncer.4
new file mode 100644
index 000000000000..30b38e40ee4a
--- /dev/null
+++ b/share/man/man4/syncer.4
@@ -0,0 +1,92 @@
+.\" Copyright (c) 2000 Sheldon Hearn <sheldonh@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2000
+.Dt SYNCER 4
+.Os
+.Sh NAME
+.Nm syncer
+.Nd file system synchronizer kernel process
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+kernel process helps protect the integrity of disk volumes
+by flushing volatile cached file system data to disk.
+.Pp
+The kernel places all
+.Xr vnode 9 Ns 's
+in a number of queues.
+The
+.Nm
+process works through the queues
+in a round-robin fashion,
+usually processing one queue per second.
+For each
+.Xr vnode 9
+on that queue,
+the
+.Nm
+process forces a write out to disk of its dirty buffers.
+.Pp
+The usual delay between the time buffers are dirtied
+and the time they are synced
+is controlled by the following
+.Xr sysctl 8
+tunable variables:
+.Bl -column "filedelayXXXX" "DefaultXX" "DescriptionXX"
+.It Em Variable Ta Em Default Ta Em Description
+.It Va kern.filedelay Ta 30 Ta "time to delay syncing files"
+.It Va kern.dirdelay Ta 29 Ta "time to delay syncing directories"
+.It Va kern.metadelay Ta 28 Ta "time to delay syncing metadata"
+.El
+.Sh SEE ALSO
+.Xr sync 2 ,
+.Xr fsck 8 ,
+.Xr sync 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+process is a descendant of the
+.Sq update
+command, which appeared in
+.At v6 ,
+and was usually started by
+.Pa /etc/rc
+when the system went multi-user.
+A kernel initiated
+.Sq update
+process first appeared in
+.Fx 2.0 .
+.Sh BUGS
+It is possible on some systems that a
+.Xr sync 2
+occurring simultaneously with a crash may cause
+file system damage.
+See
+.Xr fsck 8 .
diff --git a/share/man/man4/syscons.4 b/share/man/man4/syscons.4
new file mode 100644
index 000000000000..d9f8d24e6d10
--- /dev/null
+++ b/share/man/man4/syscons.4
@@ -0,0 +1,565 @@
+.\"
+.\" Copyright (c) 1999
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 11, 2009
+.Dt SYSCONS 4
+.Os
+.Sh NAME
+.Nm syscons ,
+.Nm sc
+.Nd the console driver
+.Sh SYNOPSIS
+.Cd "options MAXCONS=N"
+.Cd "options SC_ALT_MOUSE_IMAGE"
+.Cd "options SC_CUT_SEPCHARS=_characters_"
+.Cd "options SC_CUT_SPACES2TABS"
+.Cd "options SC_DISABLE_KDBKEY"
+.Cd "options SC_DISABLE_REBOOT"
+.Cd "options SC_HISTORY_SIZE=N"
+.Cd "options SC_MOUSE_CHAR=C"
+.Cd "options SC_NO_CUTPASTE"
+.Cd "options SC_NO_FONT_LOADING"
+.Cd "options SC_NO_HISTORY"
+.Cd "options SC_NO_PALETTE_LOADING"
+.Cd "options SC_NO_SUSPEND_VTYSWITCH"
+.Cd "options SC_NO_SYSMOUSE"
+.Cd "options SC_PIXEL_MODE"
+.Cd "options SC_TWOBUTTON_MOUSE"
+.Cd "options SC_NORM_ATTR=_attribute_"
+.Cd "options SC_NORM_REV_ATTR=_attribute_"
+.Cd "options SC_KERNEL_CONS_ATTR=_attribute_"
+.Cd "options SC_KERNEL_CONS_REV_ATTR=_attribute_"
+.Cd "options SC_DFLT_FONT"
+.Cd "makeoptions SC_DFLT_FONT=_font_name_"
+.Cd "device sc"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.sc.0.at="isa"
+.Cd hint.sc.0.vesa_mode=0x103
+.Sh DESCRIPTION
+The
+.Nm
+driver provides multiple virtual terminals.
+It resembles the SCO color console driver.
+.Pp
+The
+.Nm
+driver is implemented on top of the keyboard driver
+.Pq Xr atkbd 4
+and the video card driver
+.Pq Xr vga 4
+and so requires both of them to be configured in the system.
+.Pp
+There can be only one
+.Nm
+device defined in the system.
+.Ss Virtual Terminals
+The
+.Nm
+driver provides multiple virtual terminals which appear as if they were
+separate terminals.
+One virtual terminal is considered current and exclusively
+occupies the screen and the keyboard; the other virtual terminals
+are placed in the background.
+.Pp
+In order to use virtual terminals, they must be individually
+marked ``on'' in
+.Pa /etc/ttys
+so that
+.Xr getty 8
+will recognize them to be active and run
+.Xr login 1
+to let the user log in to the system.
+By default, only the first eight virtual terminals are activated in
+.Pa /etc/ttys .
+.Pp
+You press the
+.Dv Alt
+key and a switch key to switch between
+virtual terminals.
+The following table summarizes the correspondence between the switch
+key and the virtual terminal.
+.Bd -literal -offset indent
+Alt-F1 ttyv0 Alt-F7 ttyv6 Shift-Alt-F1 ttyva
+Alt-F2 ttyv1 Alt-F8 ttyv7 Shift-Alt-F2 ttyvb
+Alt-F3 ttyv2 Alt-F9 ttyv8 Shift-Alt-F3 ttyvc
+Alt-F4 ttyv3 Alt-F10 ttyv9 Shift-Alt-F4 ttyvd
+Alt-F5 ttyv4 Alt-F11 ttyva Shift-Alt-F5 ttyve
+Alt-F6 ttyv5 Alt-F12 ttyvb Shift-Alt-F6 ttyvf
+.Ed
+.Pp
+You can also use the ``nscr'' key (usually the
+.Dv PrintScreen
+key on the AT Enhanced keyboard) to cycle available virtual terminals.
+.Pp
+The default number of available virtual terminals is 16.
+This can be changed with the kernel configuration option
+.Dv MAXCONS
+(see below).
+.Pp
+Note that the X server usually requires a virtual terminal for display
+purposes, so at least one terminal must be left unused by
+.Xr getty 8
+so that it can be used by the X server.
+.Ss Key Definitions and Function Key Strings
+The
+.Nm
+driver, in conjunction with the keyboard driver, allows the user
+to change key definitions and function key strings.
+The
+.Xr kbdcontrol 1
+command will load a key definition file (known as ``keymap'' file),
+dump the current keymap, and assign a string to a function key.
+See
+.Xr keyboard 4
+and
+.Xr kbdmap 5
+for the keymap file.
+.Pp
+You may want to set the
+.Ar keymap
+variable in
+.Pa /etc/rc.conf.local
+to the desired keymap file so that it will be automatically loaded
+when the system starts up.
+.Ss Software Font
+For most modern video cards, e.g., VGA, the
+.Nm
+driver and the video card driver allow the user to change
+the font used on the screen.
+The
+.Xr vidcontrol 1
+command can be used to load a font file from
+.Pa /usr/share/syscons/fonts .
+.Pp
+The font comes in various sizes: 8x8, 8x14 and 8x16.
+The 8x16 font is typically used for the VGA card in the
+80-column-by-25-line mode.
+Other video modes may require different font sizes.
+It is better to always load all three sizes of the same font.
+.Pp
+You may set
+.Ar font8x8 ,
+.Ar font8x14
+and
+.Ar font8x16
+variables in
+.Pa /etc/rc.conf
+to the desired font files so that they will be automatically loaded
+when the system starts up.
+.Pp
+Optionally you can specify a particular font file as the default.
+See the
+.Dv SC_DFLT_FONT
+option below.
+.Ss Screen Map
+If your video card does not support software fonts, you may still be able
+to achieve a similar effect by re-mapping the font built into your video card.
+Use
+.Xr vidcontrol 1
+to load a screen map file which defines the mapping between character codes.
+.Ss Mouse Support and Copy-and-Paste
+You can use your mouse to copy text on the screen and paste it as if
+it was typed by hand.
+You must be running the mouse daemon
+.Xr moused 8
+and enable the mouse cursor in the virtual terminal via
+.Xr vidcontrol 1 .
+.Pp
+Pressing mouse button 1 (usually the left button) will start selection.
+Releasing button 1 will end the selection process.
+The selected text will be marked by inverting foreground and
+background colors.
+You can press button 3 (usually the right button) to extend
+the selected region.
+The selected text is placed in the copy buffer and can be pasted
+at the cursor position by pressing button 2 (usually the
+middle button) as many times as you like.
+.Pp
+If your mouse has only two buttons, you may want to use the
+.Dv SC_TWOBUTTON_MOUSE
+option below to make the right button to paste the text.
+Alternatively you can make the mouse daemon
+emulate the middle button.
+See the man page for
+.Xr moused 8
+for more details.
+.Ss Back Scrolling
+The
+.Nm
+driver allows the user to browse the output which has ``scrolled off''
+the top of the screen.
+.Pp
+Press the ``slock'' key (usually
+.Dv ScrllLock
+/
+.Dv Scroll Lock
+or
+.Dv Pause
+on many keyboards) and the terminal is
+in the ``scrollback'' mode.
+It is indicated by the
+.Dv Scroll Lock
+LED.
+Use the arrow keys, the
+.Dv Page Up/Down
+keys and the
+.Dv Home/End
+keys to scroll buffered terminal output.
+Press the ``slock'' key again to get back to the normal terminal mode.
+.Pp
+The size of the scrollback buffer can be set by the
+.Dv SC_HISTORY_SIZE
+option described below.
+.Ss Screen Saver
+The
+.Nm
+driver can be made to put up the screen saver if the current
+virtual terminal is idle, that is, the user is not typing
+on the keyboard nor moving the mouse.
+See
+.Xr splash 4
+and
+.Xr vidcontrol 1
+for more details.
+.Sh DRIVER CONFIGURATION
+.Ss Kernel Configuration Options
+The following kernel configuration options control the
+.Nm
+driver.
+.Bl -tag -width MOUSE
+.It Dv MAXCONS=N
+This option sets the number of virtual terminals to
+.Fa N .
+The default value is 16.
+.It Dv SC_ALT_MOUSE_IMAGE
+This option selects the alternative way of displaying the mouse cursor
+in the virtual terminal.
+It may be expensive for some video cards to draw the arrow-shaped
+cursor, and you may want to try this option.
+However, the appearance of the alternative mouse cursor may not be
+very appealing.
+Note that if you use the
+.Dv SC_NO_FONT_LOADING
+option then you must also use this option if you wish to be able to use
+the mouse.
+.It Dv SC_CUT_SEPCHARS=_characters_
+This options specifies characters that will be looked for when the
+driver searches for words boundaries when doing cut operation.
+By default, its value is
+.Qq Li \ex20
+\(em a space character.
+.It Dv SC_CUT_SPACES2TABS
+This options instructs the driver to convert leading spaces into tabs
+when copying data into cut buffer.
+This might be useful to preserve
+indentation when copying tab-indented text.
+.It Dv SC_DISABLE_KDBKEY
+This option disables the ``debug'' key combination (by default, it is
+.Dv Alt-Esc ,
+or
+.Dv Ctl-PrintScreen ) .
+It will prevent users from
+entering the kernel debugger (KDB) by pressing the key combination.
+KDB will still be invoked when the kernel panics or hits a break point
+if it is included in the kernel.
+If this option is not defined, this behavior may be controlled at runtime
+by the
+.Xr sysctl 8
+variable
+.Va hw.syscons.kbd_debug .
+.It Dv SC_DISABLE_REBOOT
+This option disables the ``reboot'' key (by default, it is
+.Dv Ctl-Alt-Del ) ,
+so that the casual user may not accidentally reboot the system.
+If this option is not defined, this behavior may be controlled at runtime
+by the
+.Xr sysctl 8
+variable
+.Va hw.syscons.kbd_reboot .
+.It Dv SC_HISTORY_SIZE=N
+Sets the size of back scroll buffer to
+.Fa N
+lines.
+The default value is 100.
+.It Dv SC_MOUSE_CHAR=C
+Unless the
+.Dv SC_ALT_MOUSE_IMAGE
+option above is specified, the
+.Nm
+driver reserves four consecutive character codes in order to display the
+mouse cursor in the virtual terminals in some systems.
+This option specifies the first character code to
+.Fa C
+to be used for this purpose.
+The default value is 0xd0.
+A good candidate is 0x03.
+.It Dv SC_PIXEL_MODE
+Adds support for pixel (raster) mode console.
+This mode is useful on some laptop computers, but less so on
+most other systems, and it adds substantial amount of code to syscons.
+If this option is NOT defined, you can reduce the kernel size a lot.
+See the
+.Dv VESAMODE
+flag below.
+.It Dv SC_TWOBUTTON_MOUSE
+If you have a two button mouse, you may want to add this option
+to use the right button of the mouse to paste text.
+See
+.Sx Mouse Support and Copy-and-Paste
+above.
+.It Dv SC_NORM_ATTR=_attribute_
+.It Dv SC_NORM_REV_ATTR=_attribute_
+.It Dv SC_KERNEL_CONS_ATTR=_attribute_
+.It Dv SC_KERNEL_CONS_REV_ATTR=_attribute_
+These options will set the default colors.
+Available colors are defined in
+.In machine/pc/display.h .
+See
+.Sx EXAMPLES
+below.
+.It Dv SC_DFLT_FONT
+This option will specify the default font.
+Available fonts are: iso, iso2, koi8-r, koi8-u, cp437, cp850, cp865,
+cp866 and cp866u.
+16-line, 14-line and 8-line font data will be compiled in.
+Without this option, the
+.Nm
+driver will use whatever font is already loaded in the video card,
+unless you explicitly load a software font at startup.
+See
+.Sx EXAMPLES
+below.
+.It Dv SC_NO_SUSPEND_VTYSWITCH
+This option, which is also available as
+.Xr loader 8
+tunable and
+.Xr sysctl 8
+variable
+.Va hw.syscons.sc_no_suspend_vtswitch ,
+disables switching between virtual terminals (graphics <-> text) during
+suspend/resume (ACPI and APM).
+Use this option if your system is freezing
+when you are running X and trying to suspend.
+.El
+.Pp
+The following options will remove some features from the
+.Nm
+driver and save kernel memory.
+.Bl -tag -width MOUSE
+.It Dv SC_NO_CUTPASTE
+This option disables ``copy and paste'' operation in virtual
+terminals.
+.It Dv SC_NO_FONT_LOADING
+The
+.Nm
+driver can load software fonts on some video cards.
+This option removes this feature.
+Note that if you still wish to use
+the mouse with this option then you must also use the
+.Dv SC_ALT_MOUSE_IMAGE
+option.
+.It Dv SC_NO_HISTORY
+This option disables back-scrolling in virtual terminals.
+.\".It Dv SC_NO_PALETTE_LOADING
+.It Dv SC_NO_SYSMOUSE
+This option removes mouse support in the
+.Nm
+driver.
+The mouse daemon
+.Xr moused 8
+will fail if this option is defined.
+This option implies the
+.Dv SC_NO_CUTPASTE
+option too.
+.El
+.Ss Driver Flags
+The following driver flags can be used to control the
+.Nm
+driver.
+They can be set either in
+.Pa /boot/device.hints ,
+or else at the loader prompt (see
+.Xr loader 8 ) .
+.Bl -tag -width bit_0
+.\".It bit 0 (VISUAL_BELL)
+.\"Uses the ``visual'' bell.
+.\"The screen will blink instead of generating audible sound.
+.\".It bit 1,2 (CURSOR_TYPE)
+.\"This option specifies the cursor appearance.
+.\"Possible values are:
+.\".Bl -tag -width TYPE -compact
+.\".It Dv 0
+.\"normal block cursor
+.\".It Dv 2
+.\"blinking block cursor
+.\".It Dv 4
+.\"underline cursor
+.\".It Dv 6
+.\"blinking underline (aka destructive) cursor
+.\".El
+.\".It bit 6 (QUIET_BELL)
+.\"This option suppresses the bell, whether audible or visual,
+.\"if it is rung in a background virtual terminal.
+.It 0x0080 (VESAMODE)
+This option puts the video card in the VESA mode specified by
+.Pa /boot/device.hints
+variable
+.Va vesa_mode
+during kernel initialization.
+Note that in order for this flag to work, the kernel must be
+compiled with the
+.Dv SC_PIXEL_MODE
+option explained above.
+A list of the available mode can be obtained via
+.Xr vidcontrol 1 .
+.\"Note also that the ``copy-and-paste'' function is not currently supported
+.\"in this mode and the mouse pointer will not be displayed.
+.It 0x0100 (AUTODETECT_KBD)
+This option instructs the syscons driver to periodically scan
+for a keyboard device if it is not currently attached to one.
+Otherwise, the driver only probes for a keyboard once during bootup.
+.El
+.Sh FILES
+.Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact
+.It Pa /dev/console
+.It Pa /dev/consolectl
+.It Pa /dev/ttyv?
+virtual terminals
+.It Pa /etc/ttys
+terminal initialization information
+.It Pa /usr/share/syscons/fonts/*
+font files
+.It Pa /usr/share/syscons/keymaps/*
+key map files
+.It Pa /usr/share/syscons/scrmaps/*
+screen map files
+.El
+.Sh EXAMPLES
+As the
+.Nm
+driver requires the keyboard driver and the video card driver,
+the kernel configuration file should contain the following lines.
+.Bd -literal -offset indent
+device atkbdc
+device atkbd
+device vga
+device sc
+
+device splash
+.Ed
+You also need the following lines in
+.Pa /boot/device.hints
+for these drivers.
+.Bd -literal -offset indent
+hint.atkbdc.0.at="isa"
+hint.atkbdc.0.port="0x060"
+hint.atkbd.0.at="atkbdc"
+hint.atkbd.0.irq="1"
+hint.vga.0.at="isa"
+hint.sc.0.at="isa"
+.Ed
+.Pp
+If you do not intend to load the splash image or use the screen saver,
+the last line is not necessary, and can be omitted.
+.Pp
+Note that the keyboard controller driver
+.Nm atkbdc
+is required by the keyboard driver
+.Nm atkbd .
+.Pp
+The following lines will set the default colors.
+The normal text will be green on black background.
+The reversed text will be yellow on green background.
+Note that you cannot put any white space inside the quoted string,
+because of the current implementation of
+.Xr config 8 .
+.Pp
+.Dl "options SC_NORM_ATTR=(FG_GREEN|BG_BLACK)"
+.Dl "options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)"
+.Pp
+The following lines will set the default colors of the kernel message.
+The kernel message will be printed bright red on black background.
+The reversed message will be black on red background.
+.Pp
+.Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)"
+.Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)"
+.Pp
+The following example adds the font files
+.Pa cp850-8x16.fnt ,
+.Pa cp850-8x14.font
+and
+.Pa cp850-8x8.font
+to the kernel.
+.Pp
+.Dl "options SC_DFLT_FONT"
+.Dl "makeoptions SC_DFLT_FONT=cp850"
+.Dl "device sc"
+.\".Sh DIAGNOSTICS
+.Sh SEE ALSO
+.Xr kbdcontrol 1 ,
+.Xr login 1 ,
+.Xr vidcontrol 1 ,
+.Xr atkbd 4 ,
+.Xr atkbdc 4 ,
+.Xr keyboard 4 ,
+.Xr screen 4 ,
+.Xr splash 4 ,
+.Xr ukbd 4 ,
+.Xr vga 4 ,
+.Xr kbdmap 5 ,
+.Xr rc.conf 5 ,
+.Xr ttys 5 ,
+.Xr config 8 ,
+.Xr getty 8 ,
+.Xr kldload 8 ,
+.Xr moused 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 1.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An S\(/oren Schmidt Aq sos@FreeBSD.org .
+This manual page was written by
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+.Sh CAVEATS
+The amount of data that is possible to insert from the cut buffer is limited
+by the
+.Brq Dv MAX_INPUT ,
+a system limit on the number of bytes that may be stored in the terminal
+input queue - usually 1024 bytes
+(see
+.Xr termios 4 ) .
+.Sh BUGS
+This manual page is incomplete and urgently needs revision.
diff --git a/share/man/man4/sysmouse.4 b/share/man/man4/sysmouse.4
new file mode 100644
index 000000000000..e3972fec5e17
--- /dev/null
+++ b/share/man/man4/sysmouse.4
@@ -0,0 +1,477 @@
+.\" Copyright (c) 1997
+.\" John-Mark Gurney. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2010
+.Dt SYSMOUSE 4
+.Os
+.Sh NAME
+.Nm sysmouse
+.\" .Nd supplies mouse data from syscons for other applications
+.Nd virtualized mouse driver
+.Sh SYNOPSIS
+.In sys/mouse.h
+.In sys/consio.h
+.Sh DESCRIPTION
+The console driver, in conjunction with the mouse daemon
+.Xr moused 8 ,
+supplies mouse data to the user process in the standardized way via the
+.Nm
+driver.
+This arrangement makes it possible for the console and the user process
+(such as the
+.Tn X\ Window System )
+to share the mouse.
+.Pp
+The user process which wants to utilize mouse operation simply opens
+.Pa /dev/sysmouse
+with a
+.Xr open 2
+call and reads
+mouse data from the device via
+.Xr read 2 .
+Make sure that
+.Xr moused 8
+is running, otherwise the user process will not see any data coming from
+the mouse.
+.Pp
+.Ss Operation Levels
+The
+.Nm
+driver has two levels of operation.
+The current operation level can be referred to and changed via ioctl calls.
+.Pp
+The level zero, the basic level, is the lowest level at which the driver
+offers the basic service to user programs.
+The
+.Nm
+driver
+provides horizontal and vertical movement of the mouse
+and state of up to three buttons in the
+.Tn MouseSystems
+format as follows.
+.Pp
+.Bl -tag -width Byte_1 -compact
+.It Byte 1
+.Bl -tag -width bit_7 -compact
+.It bit 7
+Always one.
+.It bit 6..3
+Always zero.
+.It bit 2
+Left button status; cleared if pressed, otherwise set.
+.It bit 1
+Middle button status; cleared if pressed, otherwise set.
+Always one,
+if the device does not have the middle button.
+.It bit 0
+Right button status; cleared if pressed, otherwise set.
+.El
+.It Byte 2
+The first half of horizontal movement count in two's complement;
+\-128 through 127.
+.It Byte 3
+The first half of vertical movement count in two's complement;
+\-128 through 127.
+.It Byte 4
+The second half of the horizontal movement count in two's complement;
+\-128 through 127.
+To obtain the full horizontal movement count, add
+the byte 2 and 4.
+.It Byte 5
+The second half of the vertical movement count in two's complement;
+\-128 through 127.
+To obtain the full vertical movement count, add
+the byte 3 and 5.
+.El
+.Pp
+At the level one, the extended level, mouse data is encoded
+in the standard format
+.Dv MOUSE_PROTO_SYSMOUSE
+as defined in
+.Xr mouse 4 .
+.\" .Ss Acceleration
+.\" The
+.\" .Nm
+.\" driver can somewhat `accelerate' the movement of the pointing device.
+.\" The faster you move the device, the further the pointer
+.\" travels on the screen.
+.\" The driver has an internal variable which governs the effect of
+.\" the acceleration. Its value can be modified via the driver flag
+.\" or via an ioctl call.
+.Sh IOCTLS
+This section describes two classes of
+.Xr ioctl 2
+commands:
+commands for the
+.Nm
+driver itself, and commands for the console and the console control drivers.
+.Ss Sysmouse Ioctls
+There are a few commands for mouse drivers.
+General description of the commands is given in
+.Xr mouse 4 .
+Following are the features specific to the
+.Nm
+driver.
+.Pp
+.Bl -tag -width MOUSE -compact
+.It Dv MOUSE_GETLEVEL Ar int *level
+.It Dv MOUSE_SETLEVEL Ar int *level
+These commands manipulate the operation level of the mouse driver.
+.Pp
+.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
+Returns the hardware information of the attached device in the following
+structure.
+Only the
+.Va iftype
+field is guaranteed to be filled with the correct value in the current
+version of the
+.Nm
+driver.
+.Bd -literal
+typedef struct mousehw {
+ int buttons; /* number of buttons */
+ int iftype; /* I/F type */
+ int type; /* mouse/track ball/pad... */
+ int model; /* I/F dependent model ID */
+ int hwid; /* I/F dependent hardware ID */
+} mousehw_t;
+.Ed
+.Pp
+The
+.Va buttons
+field holds the number of buttons detected by the driver.
+.Pp
+The
+.Va iftype
+is always
+.Dv MOUSE_IF_SYSMOUSE .
+.Pp
+The
+.Va type
+tells the device type:
+.Dv MOUSE_MOUSE ,
+.Dv MOUSE_TRACKBALL ,
+.Dv MOUSE_STICK ,
+.Dv MOUSE_PAD ,
+or
+.Dv MOUSE_UNKNOWN .
+.Pp
+The
+.Va model
+is always
+.Dv MOUSE_MODEL_GENERIC
+at the operation level 0.
+It may be
+.Dv MOUSE_MODEL_GENERIC
+or one of
+.Dv MOUSE_MODEL_XXX
+constants at higher operation levels.
+.Pp
+The
+.Va hwid
+is always zero.
+.Pp
+.It Dv MOUSE_GETMODE Ar mousemode_t *mode
+The command gets the current operation parameters of the mouse
+driver.
+.Bd -literal
+typedef struct mousemode {
+ int protocol; /* MOUSE_PROTO_XXX */
+ int rate; /* report rate (per sec) */
+ int resolution; /* MOUSE_RES_XXX, -1 if unknown */
+ int accelfactor; /* acceleration factor */
+ int level; /* driver operation level */
+ int packetsize; /* the length of the data packet */
+ unsigned char syncmask[2]; /* sync. bits */
+} mousemode_t;
+.Ed
+.Pp
+The
+.Va protocol
+field tells the format in which the device status is returned
+when the mouse data is read by the user program.
+It is
+.Dv MOUSE_PROTO_MSC
+at the operation level zero.
+.Dv MOUSE_PROTO_SYSMOUSE
+at the operation level one.
+.Pp
+The
+.Va rate
+is always set to \-1.
+.Pp
+The
+.Va resolution
+is always set to \-1.
+.Pp
+The
+.Va accelfactor
+is always 0.
+.Pp
+The
+.Va packetsize
+field specifies the length of the data packet.
+It depends on the
+operation level.
+.Pp
+.Bl -tag -width level_0__ -compact
+.It Em level 0
+5 bytes
+.It Em level 1
+8 bytes
+.El
+.Pp
+The array
+.Va syncmask
+holds a bit mask and pattern to detect the first byte of the
+data packet.
+.Va syncmask[0]
+is the bit mask to be ANDed with a byte.
+If the result is equal to
+.Va syncmask[1] ,
+the byte is likely to be the first byte of the data packet.
+Note that this method of detecting the first byte is not 100% reliable;
+thus, it should be taken only as an advisory measure.
+.Pp
+.It Dv MOUSE_SETMODE Ar mousemode_t *mode
+The command changes the current operation parameters of the mouse driver
+as specified in
+.Ar mode .
+Only
+.Va level
+may be modifiable.
+Setting values in the other field does not generate
+error and has no effect.
+.\" .Pp
+.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
+.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
+.\" These commands are not supported by the
+.\" .Nm
+.\" driver.
+.Pp
+.It Dv MOUSE_READDATA Ar mousedata_t *data
+.It Dv MOUSE_READSTATE Ar mousedata_t *state
+These commands are not supported by the
+.Nm
+driver.
+.Pp
+.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
+The command returns the current state of buttons and
+movement counts in the structure as defined in
+.Xr mouse 4 .
+.El
+.Ss Console and Consolectl Ioctls
+The user process issues console
+.Fn ioctl
+calls to the current virtual console in order to control
+the mouse pointer.
+The console
+.Fn ioctl
+also provides a method for the user process to receive a
+.Xr signal 3
+when a button is pressed.
+.Pp
+The mouse daemon
+.Xr moused 8
+uses
+.Fn ioctl
+calls to the console control device
+.Pa /dev/consolectl
+to inform the console of mouse actions including mouse movement
+and button status.
+.Pp
+Both classes of
+.Fn ioctl
+commands are defined as
+.Dv CONS_MOUSECTL
+which takes the following argument.
+.Bd -literal
+struct mouse_info {
+ int operation;
+ union {
+ struct mouse_data data;
+ struct mouse_mode mode;
+ struct mouse_event event;
+ } u;
+};
+.Ed
+.Pp
+.Bl -tag -width operation -compact
+.It Va operation
+This can be one of
+.Pp
+.Bl -tag -width MOUSE_MOVEABS -compact
+.It Dv MOUSE_SHOW
+Enables and displays mouse cursor.
+.It Dv MOUSE_HIDE
+Disables and hides mouse cursor.
+.It Dv MOUSE_MOVEABS
+Moves mouse cursor to position supplied in
+.Va u.data .
+.It Dv MOUSE_MOVEREL
+Adds position supplied in
+.Va u.data
+to current position.
+.It Dv MOUSE_GETINFO
+Returns current mouse position in the current virtual console
+and button status in
+.Va u.data .
+.It Dv MOUSE_MODE
+This sets the
+.Xr signal 3
+to be delivered to the current process when a button is pressed.
+The signal to be delivered is set in
+.Va u.mode .
+.El
+.Pp
+The above operations are for virtual consoles.
+The operations defined
+below are for the console control device and are used by
+.Xr moused 8
+to pass mouse data to the console driver.
+.Pp
+.Bl -tag -width MOUSE_MOVEABS -compact
+.It Dv MOUSE_ACTION
+.It Dv MOUSE_MOTION_EVENT
+These operations take the information in
+.Va u.data
+and act upon it.
+Mouse data will be sent to the
+.Nm
+driver if it is open.
+.Dv MOUSE_ACTION
+also processes button press actions and sends signal to the process if
+requested or performs cut and paste operations
+if the current console is a text interface.
+.It Dv MOUSE_BUTTON_EVENT
+.Va u.data
+specifies a button and its click count.
+The console driver will
+use this information for signal delivery if requested or
+for cut and paste operations if the console is in text mode.
+.El
+.Pp
+.Dv MOUSE_MOTION_EVENT
+and
+.Dv MOUSE_BUTTON_EVENT
+are newer interface and are designed to be used together.
+They are intended to replace functions performed by
+.Dv MOUSE_ACTION
+alone.
+.Pp
+.It Va u
+This union is one of
+.Pp
+.Bl -tag -width data -compact
+.It Va data
+.Bd -literal
+struct mouse_data {
+ int x;
+ int y;
+ int z;
+ int buttons;
+};
+.Ed
+.Pp
+.Va x , y
+and
+.Va z
+represent movement of the mouse along respective directions.
+.Va buttons
+tells the state of buttons.
+It encodes up to 31 buttons in the bit 0 though
+the bit 30.
+If a button is held down, the corresponding bit is set.
+.Pp
+.It Va mode
+.Bd -literal
+struct mouse_mode {
+ int mode;
+ int signal;
+};
+.Ed
+.Pp
+The
+.Va signal
+field specifies the signal to be delivered to the process.
+It must be
+one of the values defined in
+.In signal.h .
+The
+.Va mode
+field is currently unused.
+.Pp
+.It Va event
+.Bd -literal
+struct mouse_event {
+ int id;
+ int value;
+};
+.Ed
+.Pp
+The
+.Va id
+field specifies a button number as in
+.Va u.data.buttons .
+Only one bit/button is set.
+The
+.Va value
+field
+holds the click count: the number of times the user has clicked the button
+successively.
+.Pp
+.El
+.El
+.Sh FILES
+.Bl -tag -width /dev/consolectl -compact
+.It Pa /dev/consolectl
+device to control the console
+.It Pa /dev/sysmouse
+virtualized mouse driver
+.It Pa /dev/ttyv%d
+virtual consoles
+.El
+.Sh SEE ALSO
+.Xr vidcontrol 1 ,
+.Xr ioctl 2 ,
+.Xr signal 3 ,
+.Xr mouse 4 ,
+.Xr moused 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+This
+manual page was written by
+.An John-Mark Gurney Aq gurney_j@efn.org
+and
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
diff --git a/share/man/man4/tap.4 b/share/man/man4/tap.4
new file mode 100644
index 000000000000..3bfab5b77136
--- /dev/null
+++ b/share/man/man4/tap.4
@@ -0,0 +1,317 @@
+.\" $FreeBSD$
+.\" Based on PR#2411
+.\"
+.Dd January 26, 2012
+.Dt TAP 4
+.Os
+.Sh NAME
+.Nm tap
+.Nd Ethernet tunnel software network interface
+.Sh SYNOPSIS
+.Cd device tap
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software loopback mechanism that can be loosely
+described as the network interface analog of the
+.Xr pty 4 ,
+that is,
+.Nm
+does for network interfaces what the
+.Nm pty
+driver does for terminals.
+.Pp
+The
+.Nm
+driver, like the
+.Nm pty
+driver, provides two interfaces: an interface like the usual facility
+it is simulating
+(an Ethernet network interface in the case of
+.Nm ,
+or a terminal for
+.Nm pty ) ,
+and a character-special device
+.Dq control
+interface.
+.Pp
+The network interfaces are named
+.Dq Li tap0 ,
+.Dq Li tap1 ,
+etc., one for each control device that has been opened.
+These Ethernet network interfaces persist until
+.Pa if_tap.ko
+module is unloaded, or until removed with "ifconfig destroy" (see below).
+.Pp
+.Nm
+devices are created using interface cloning.
+This is done using the
+.Dq ifconfig tap Ns Sy N No create
+command.
+This is the preferred method of creating
+.Nm
+devices.
+The same method allows removal of interfaces.
+For this, use the
+.Dq ifconfig tap Ns Sy N No destroy
+command.
+.Pp
+If the
+.Xr sysctl 8
+variable
+.Va net.link.tap.devfs_cloning
+is non-zero, the
+.Nm
+interface
+permits opens on the special control device
+.Pa /dev/tap .
+When this device is opened,
+.Nm
+will return a handle for the lowest unused
+.Nm
+device (use
+.Xr devname 3
+to determine which).
+.Pp
+.Bf Em
+Disabling the legacy devfs cloning functionality may break existing
+applications which use
+.Nm ,
+such as
+.Tn VMware
+and
+.Xr ssh 1 .
+It therefore defaults to being enabled until further notice.
+.Ef
+.Pp
+Control devices (once successfully opened) persist until
+.Pa if_tap.ko
+is unloaded or the interface is destroyed.
+.Pp
+Each interface supports the usual Ethernet network interface
+.Xr ioctl 2 Ns s
+and thus can be used with
+.Xr ifconfig 8
+like any other Ethernet interface.
+When the system chooses to transmit
+an Ethernet frame on the network interface, the frame can be read from
+the control device
+(it appears as
+.Dq input
+there);
+writing an Ethernet frame to the control device generates an input frame on
+the network interface, as if the
+(non-existent)
+hardware had just received it.
+.Pp
+The Ethernet tunnel device, normally
+.Pa /dev/tap Ns Sy N ,
+is exclusive-open
+(it cannot be opened if it is already open)
+and is restricted to the super-user, unless the
+.Xr sysctl 8
+variable
+.Va net.link.tap.user_open
+is non-zero.
+If the
+.Xr sysctl 8
+variable
+.Va net.link.tap.up_on_open
+is non-zero, the tunnel device will be marked
+.Dq up
+when the control device is opened.
+A
+.Fn read
+call will return an error
+.Pq Er EHOSTDOWN
+if the interface is not
+.Dq ready .
+Once the interface is ready,
+.Fn read
+will return an Ethernet frame if one is available; if not, it will
+either block until one is or return
+.Er EWOULDBLOCK ,
+depending on whether non-blocking I/O has been enabled.
+If the frame
+is longer than is allowed for in the buffer passed to
+.Fn read ,
+the extra data will be silently dropped.
+.Pp
+A
+.Xr write 2
+call passes an Ethernet frame in to be
+.Dq received
+on the pseudo-interface.
+Each
+.Fn write
+call supplies exactly one frame; the frame length is taken from the
+amount of data provided to
+.Fn write .
+Writes will not block; if the frame cannot be accepted
+for a transient reason
+(e.g., no buffer space available),
+it is silently dropped; if the reason is not transient
+(e.g., frame too large),
+an error is returned.
+The following
+.Xr ioctl 2
+calls are supported
+(defined in
+.In net/if_tap.h ) :
+.Bl -tag -width VMIO_SIOCSETMACADDR
+.It Dv TAPSIFINFO
+Set network interface information (line speed, MTU and type).
+The argument should be a pointer to a
+.Va struct tapinfo .
+.It Dv TAPGIFINFO
+Retrieve network interface information (line speed, MTU and type).
+The argument should be a pointer to a
+.Va struct tapinfo .
+.It Dv TAPSDEBUG
+The argument should be a pointer to an
+.Va int ;
+this sets the internal debugging variable to that value.
+What, if
+anything, this variable controls is not documented here; see the source
+code.
+.It Dv TAPGDEBUG
+The argument should be a pointer to an
+.Va int ;
+this stores the internal debugging variable's value into it.
+.It Dv TAPGIFNAME
+Retrieve network interface name.
+The argument should be a pointer to a
+.Va struct ifreq .
+The interface name will be returned in the
+.Va ifr_name
+field.
+.It Dv FIONBIO
+Turn non-blocking I/O for reads off or on, according as the argument
+.Va int Ns 's
+value is or is not zero
+(Writes are always nonblocking).
+.It Dv FIOASYNC
+Turn asynchronous I/O for reads
+(i.e., generation of
+.Dv SIGIO
+when data is available to be read)
+off or on, according as the argument
+.Va int Ns 's
+value is or is not zero.
+.It Dv FIONREAD
+If any frames are queued to be read, store the size of the first one into the argument
+.Va int ;
+otherwise, store zero.
+.It Dv TIOCSPGRP
+Set the process group to receive
+.Dv SIGIO
+signals, when asynchronous I/O is enabled, to the argument
+.Va int
+value.
+.It Dv TIOCGPGRP
+Retrieve the process group value for
+.Dv SIGIO
+signals into the argument
+.Va int
+value.
+.It Dv SIOCGIFADDR
+Retrieve the Media Access Control
+.Pq Dv MAC
+address of the
+.Dq remote
+side.
+This command is used by the VMware port and expected to be executed on
+descriptor, associated with control device
+(usually
+.Pa /dev/vmnet Ns Sy N
+or
+.Pa /dev/tap Ns Sy N ) .
+The
+.Va buffer ,
+which is passed as the argument, is expected to have enough space to store
+the
+.Dv MAC
+address.
+At the open time both
+.Dq local
+and
+.Dq remote
+.Dv MAC
+addresses are the same, so this command could be used to retrieve the
+.Dq local
+.Dv MAC
+address.
+.It Dv SIOCSIFADDR
+Set the Media Access Control
+.Pq Dv MAC
+address of the
+.Dq remote
+side.
+This command is used by VMware port and expected to be executed on
+a descriptor, associated with control device
+(usually
+.Pa /dev/vmnet Ns Sy N ) .
+.El
+.Pp
+The control device also supports
+.Xr select 2
+for read; selecting for write is pointless, and always succeeds, since
+writes are always non-blocking.
+.Pp
+On the last close of the data device, the interface is
+brought down
+(as if with
+.Dq ifconfig tap Ns Sy N No down )
+unless the device is a
+.Em VMnet
+device.
+All queued frames are thrown away.
+If the interface is up when the data
+device is not open, output frames are thrown away rather than
+letting them pile up.
+.Pp
+The
+.Nm
+device can also be used with the VMware port as a replacement
+for the old
+.Em VMnet
+device driver.
+The driver uses the minor number
+to select between
+.Nm
+and
+.Nm vmnet
+devices.
+.Em VMnet
+minor numbers begin at
+.Va 0x800000
++
+.Va N ;
+where
+.Va N
+is a
+.Em VMnet
+unit number.
+In this case the control device is expected to be
+.Pa /dev/vmnet Ns Sy N ,
+and the network interface will be
+.Sy vmnet Ns Ar N .
+Additionally,
+.Em VMnet
+devices do not
+.Xr ifconfig 8
+themselves down when the
+control device is closed.
+Everything else is the same.
+.Pp
+In addition to the above mentioned
+.Xr ioctl 2
+calls, there is an additional one for the VMware port.
+.Bl -tag -width VMIO_SIOCSETMACADDR
+.It Dv VMIO_SIOCSIFFLAGS
+VMware
+.Dv SIOCSIFFLAGS .
+.El
+.Sh SEE ALSO
+.Xr inet 4 ,
+.Xr intro 4
diff --git a/share/man/man4/targ.4 b/share/man/man4/targ.4
new file mode 100644
index 000000000000..6c61735ff370
--- /dev/null
+++ b/share/man/man4/targ.4
@@ -0,0 +1,152 @@
+.\" Copyright (c) 2002
+.\" Nate Lawson. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Nate Lawson AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 13, 2011
+.Dt TARG 4
+.Os
+.Sh NAME
+.Nm targ
+.Nd SCSI target emulator driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device targ"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides an interface for usermode programs to emulate SCSI target
+devices.
+A sample program that emulates a disk drive (similar to
+.Xr da 4 )
+can be found in
+.Pa /usr/share/examples/scsi_target .
+.Pp
+The
+.Nm
+driver supplies the control device
+.Pa /dev/targ .
+After opening the device, the file descriptor must be bound to a
+specific bus/target/LUN and enabled to process CCBs using the
+.Dv TARGIOCENABLE
+ioctl.
+The process then uses
+.Xr write 2
+to send CCBs to the SIM and
+.Xr poll 2
+or
+.Xr kqueue 2
+to see if responses are ready.
+Pointers to completed CCBs are returned via
+.Xr read 2 .
+Any data transfers requested by the user CCBs are done via zero-copy IO.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls are defined in the header file
+.In cam/scsi/scsi_targetio.h .
+.Bl -tag -width ".Dv TARGIOCDISABLE"
+.It Dv TARGIOCENABLE
+.Pq Vt "struct ioc_enable_lun"
+Enable target mode on the LUN specified by the following structure:
+.Bd -literal -offset indent
+struct ioc_enable_lun {
+ path_id_t path_id;
+ target_id_t target_id;
+ lun_id_t lun_id;
+ int grp6_len;
+ int grp7_len;
+};
+.Ed
+.Pp
+The selected path (bus), target, and LUN must not already be in use or
+.Er EADDRINUSE
+is returned.
+If
+.Va grp6_len
+or
+.Va grp7_len
+are non-zero, reception of vendor-specific commands
+is enabled.
+.It Dv TARGIOCDISABLE
+Disable target mode and abort all pending CCBs.
+The CCBs may optionally be read as they complete.
+.Dv TARGIOCENABLE
+can then be called to activate a different LUN.
+Multiple disable calls have no effect.
+The
+.Xr close 2
+system call automatically disables target mode if enabled.
+.It Dv TARGIOCDEBUG
+.Pq Vt int
+Enables
+.Dv CAM_PERIPH
+debugging if the argument is non-zero, otherwise disables
+it.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /sys/cam/scsi/scsi_target.c" -compact
+.It In cam/scsi/scsi_targetio.h
+describes the usermode interface.
+.It Pa /sys/cam/scsi/scsi_target.c
+is the driver source file.
+.It Pa /dev/targ
+is the control device.
+.El
+.Sh SEE ALSO
+.Pa /usr/share/examples/scsi_target ,
+.Xr ahc 4 ,
+.Xr isp 4 ,
+.Xr scsi 4
+.Rs
+.%T "FreeBSD Target Information"
+.%U http://www.root.org/~nate/freebsd/
+.Re
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver first appeared in
+.Fx 3.0
+and was written by
+.An Justin T. Gibbs .
+It was rewritten
+for
+.Fx 5.0
+by
+.An Nate Lawson Aq nate@root.org .
+.Sh BUGS
+Currently, only the
+.Xr ahc 4
+and
+.Xr isp 4
+drivers fully support target mode.
+.Pp
+The
+.Xr ahc 4
+driver does not support tagged queuing in target mode.
diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4
new file mode 100644
index 000000000000..aa2755eca009
--- /dev/null
+++ b/share/man/man4/tcp.4
@@ -0,0 +1,600 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California.
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this documentation were written at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by David Hayes under sponsorship from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd March 7, 2012
+.Dt TCP 4
+.Os
+.Sh NAME
+.Nm tcp
+.Nd Internet Transmission Control Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket AF_INET SOCK_STREAM 0
+.Sh DESCRIPTION
+The
+.Tn TCP
+protocol provides reliable, flow-controlled, two-way
+transmission of data.
+It is a byte-stream protocol used to
+support the
+.Dv SOCK_STREAM
+abstraction.
+.Tn TCP
+uses the standard
+Internet address format and, in addition, provides a per-host
+collection of
+.Dq "port addresses" .
+Thus, each address is composed
+of an Internet address specifying the host and network,
+with a specific
+.Tn TCP
+port on the host identifying the peer entity.
+.Pp
+Sockets utilizing the
+.Tn TCP
+protocol are either
+.Dq active
+or
+.Dq passive .
+Active sockets initiate connections to passive
+sockets.
+By default,
+.Tn TCP
+sockets are created active; to create a
+passive socket, the
+.Xr listen 2
+system call must be used
+after binding the socket with the
+.Xr bind 2
+system call.
+Only passive sockets may use the
+.Xr accept 2
+call to accept incoming connections.
+Only active sockets may use the
+.Xr connect 2
+call to initiate connections.
+.Pp
+Passive sockets may
+.Dq underspecify
+their location to match
+incoming connection requests from multiple networks.
+This technique, termed
+.Dq "wildcard addressing" ,
+allows a single
+server to provide service to clients on multiple networks.
+To create a socket which listens on all networks, the Internet
+address
+.Dv INADDR_ANY
+must be bound.
+The
+.Tn TCP
+port may still be specified
+at this time; if the port is not specified, the system will assign one.
+Once a connection has been established, the socket's address is
+fixed by the peer entity's location.
+The address assigned to the
+socket is the address associated with the network interface
+through which packets are being transmitted and received.
+Normally, this address corresponds to the peer entity's network.
+.Pp
+.Tn TCP
+supports a number of socket options which can be set with
+.Xr setsockopt 2
+and tested with
+.Xr getsockopt 2 :
+.Bl -tag -width ".Dv TCP_CONGESTION"
+.It Dv TCP_INFO
+Information about a socket's underlying TCP session may be retrieved
+by passing the read-only option
+.Dv TCP_INFO
+to
+.Xr getsockopt 2 .
+It accepts a single argument: a pointer to an instance of
+.Vt "struct tcp_info" .
+.Pp
+This API is subject to change; consult the source to determine
+which fields are currently filled out by this option.
+.Fx
+specific additions include
+send window size,
+receive window size,
+and
+bandwidth-controlled window space.
+.It Dv TCP_CONGESTION
+Select or query the congestion control algorithm that TCP will use for the
+connection.
+See
+.Xr mod_cc 4
+for details.
+.It Dv TCP_KEEPINIT
+This write-only
+.Xr setsockopt 2
+option accepts a per-socket timeout argument of
+.Vt "u_int"
+in seconds, for new, non-established
+.Tn TCP
+connections.
+For the global default in milliseconds see
+.Va keepinit
+in the
+.Sx MIB Variables
+section further down.
+.It Dv TCP_KEEPIDLE
+This write-only
+.Xr setsockopt 2
+option accepts an argument of
+.Vt "u_int"
+for the amount of time, in seconds, that the connection must be idle
+before keepalive probes (if enabled) are sent for the connection of this
+socket.
+If set on a listening socket, the value is inherited by the newly created
+socket upon
+.Xr accept 2 .
+For the global default in milliseconds see
+.Va keepidle
+in the
+.Sx MIB Variables
+section further down.
+.It Dv TCP_KEEPINTVL
+This write-only
+.Xr setsockopt 2
+option accepts an argument of
+.Vt "u_int"
+to set the per-socket interval, in seconds, between keepalive probes sent
+to a peer.
+If set on a listening socket, the value is inherited by the newly created
+socket upon
+.Xr accept 2 .
+For the global default in milliseconds see
+.Va keepintvl
+in the
+.Sx MIB Variables
+section further down.
+.It Dv TCP_KEEPCNT
+This write-only
+.Xr setsockopt 2
+option accepts an argument of
+.Vt "u_int"
+and allows a per-socket tuning of the number of probes sent, with no response,
+before the connection will be dropped.
+If set on a listening socket, the value is inherited by the newly created
+socket upon
+.Xr accept 2 .
+For the global default see the
+.Va keepcnt
+in the
+.Sx MIB Variables
+section further down.
+.It Dv TCP_NODELAY
+Under most circumstances,
+.Tn TCP
+sends data when it is presented;
+when outstanding data has not yet been acknowledged, it gathers
+small amounts of output to be sent in a single packet once
+an acknowledgement is received.
+For a small number of clients, such as window systems
+that send a stream of mouse events which receive no replies,
+this packetization may cause significant delays.
+The boolean option
+.Dv TCP_NODELAY
+defeats this algorithm.
+.It Dv TCP_MAXSEG
+By default, a sender- and
+.No receiver- Ns Tn TCP
+will negotiate among themselves to determine the maximum segment size
+to be used for each connection.
+The
+.Dv TCP_MAXSEG
+option allows the user to determine the result of this negotiation,
+and to reduce it if desired.
+.It Dv TCP_NOOPT
+.Tn TCP
+usually sends a number of options in each packet, corresponding to
+various
+.Tn TCP
+extensions which are provided in this implementation.
+The boolean option
+.Dv TCP_NOOPT
+is provided to disable
+.Tn TCP
+option use on a per-connection basis.
+.It Dv TCP_NOPUSH
+By convention, the
+.No sender- Ns Tn TCP
+will set the
+.Dq push
+bit, and begin transmission immediately (if permitted) at the end of
+every user call to
+.Xr write 2
+or
+.Xr writev 2 .
+When this option is set to a non-zero value,
+.Tn TCP
+will delay sending any data at all until either the socket is closed,
+or the internal send buffer is filled.
+.It Dv TCP_MD5SIG
+This option enables the use of MD5 digests (also known as TCP-MD5)
+on writes to the specified socket.
+Outgoing traffic is digested;
+digests on incoming traffic are verified if the
+.Va net.inet.tcp.signature_verify_input
+sysctl is nonzero.
+The current default behavior for the system is to respond to a system
+advertising this option with TCP-MD5; this may change.
+.Pp
+One common use for this in a
+.Fx
+router deployment is to enable
+based routers to interwork with Cisco equipment at peering points.
+Support for this feature conforms to RFC 2385.
+Only IPv4
+.Pq Dv AF_INET
+sessions are supported.
+.Pp
+In order for this option to function correctly, it is necessary for the
+administrator to add a tcp-md5 key entry to the system's security
+associations database (SADB) using the
+.Xr setkey 8
+utility.
+This entry must have an SPI of 0x1000 and can therefore only be specified
+on a per-host basis at this time.
+.Pp
+If an SADB entry cannot be found for the destination, the outgoing traffic
+will have an invalid digest option prepended, and the following error message
+will be visible on the system console:
+.Em "tcp_signature_compute: SADB lookup failed for %d.%d.%d.%d" .
+.El
+.Pp
+The option level for the
+.Xr setsockopt 2
+call is the protocol number for
+.Tn TCP ,
+available from
+.Xr getprotobyname 3 ,
+or
+.Dv IPPROTO_TCP .
+All options are declared in
+.In netinet/tcp.h .
+.Pp
+Options at the
+.Tn IP
+transport level may be used with
+.Tn TCP ;
+see
+.Xr ip 4 .
+Incoming connection requests that are source-routed are noted,
+and the reverse source route is used in responding.
+.Pp
+The default congestion control algorithm for
+.Tn TCP
+is
+.Xr cc_newreno 4 .
+Other congestion control algorithms can be made available using the
+.Xr mod_cc 4
+framework.
+.Ss MIB Variables
+The
+.Tn TCP
+protocol implements a number of variables in the
+.Va net.inet.tcp
+branch of the
+.Xr sysctl 3
+MIB.
+.Bl -tag -width ".Va TCPCTL_DO_RFC1323"
+.It Dv TCPCTL_DO_RFC1323
+.Pq Va rfc1323
+Implement the window scaling and timestamp options of RFC 1323
+(default is true).
+.It Dv TCPCTL_MSSDFLT
+.Pq Va mssdflt
+The default value used for the maximum segment size
+.Pq Dq MSS
+when no advice to the contrary is received from MSS negotiation.
+.It Dv TCPCTL_SENDSPACE
+.Pq Va sendspace
+Maximum
+.Tn TCP
+send window.
+.It Dv TCPCTL_RECVSPACE
+.Pq Va recvspace
+Maximum
+.Tn TCP
+receive window.
+.It Va log_in_vain
+Log any connection attempts to ports where there is not a socket
+accepting connections.
+The value of 1 limits the logging to
+.Tn SYN
+(connection establishment) packets only.
+That of 2 results in any
+.Tn TCP
+packets to closed ports being logged.
+Any value unlisted above disables the logging
+(default is 0, i.e., the logging is disabled).
+.It Va msl
+The Maximum Segment Lifetime, in milliseconds, for a packet.
+.It Va keepinit
+Timeout, in milliseconds, for new, non-established
+.Tn TCP
+connections.
+The default is 75000 msec.
+.It Va keepidle
+Amount of time, in milliseconds, that the connection must be idle
+before keepalive probes (if enabled) are sent.
+The default is 7200000 msec (2 hours).
+.It Va keepintvl
+The interval, in milliseconds, between keepalive probes sent to remote
+machines, when no response is received on a
+.Va keepidle
+probe.
+The default is 75000 msec.
+.It Va keepcnt
+Number of probes sent, with no response, before a connection
+is dropped.
+The default is 8 packets.
+.It Va always_keepalive
+Assume that
+.Dv SO_KEEPALIVE
+is set on all
+.Tn TCP
+connections, the kernel will
+periodically send a packet to the remote host to verify the connection
+is still up.
+.It Va icmp_may_rst
+Certain
+.Tn ICMP
+unreachable messages may abort connections in
+.Tn SYN-SENT
+state.
+.It Va do_tcpdrain
+Flush packets in the
+.Tn TCP
+reassembly queue if the system is low on mbufs.
+.It Va blackhole
+If enabled, disable sending of RST when a connection is attempted
+to a port where there is not a socket accepting connections.
+See
+.Xr blackhole 4 .
+.It Va delayed_ack
+Delay ACK to try and piggyback it onto a data packet.
+.It Va delacktime
+Maximum amount of time, in milliseconds, before a delayed ACK is sent.
+.It Va path_mtu_discovery
+Enable Path MTU Discovery.
+.It Va tcbhashsize
+Size of the
+.Tn TCP
+control-block hash table
+(read-only).
+This may be tuned using the kernel option
+.Dv TCBHASHSIZE
+or by setting
+.Va net.inet.tcp.tcbhashsize
+in the
+.Xr loader 8 .
+.It Va pcbcount
+Number of active process control blocks
+(read-only).
+.It Va syncookies
+Determines whether or not
+.Tn SYN
+cookies should be generated for outbound
+.Tn SYN-ACK
+packets.
+.Tn SYN
+cookies are a great help during
+.Tn SYN
+flood attacks, and are enabled by default.
+(See
+.Xr syncookies 4 . )
+.It Va isn_reseed_interval
+The interval (in seconds) specifying how often the secret data used in
+RFC 1948 initial sequence number calculations should be reseeded.
+By default, this variable is set to zero, indicating that
+no reseeding will occur.
+Reseeding should not be necessary, and will break
+.Dv TIME_WAIT
+recycling for a few minutes.
+.It Va rexmit_min , rexmit_slop
+Adjust the retransmit timer calculation for
+.Tn TCP .
+The slop is
+typically added to the raw calculation to take into account
+occasional variances that the
+.Tn SRTT
+(smoothed round-trip time)
+is unable to accommodate, while the minimum specifies an
+absolute minimum.
+While a number of
+.Tn TCP
+RFCs suggest a 1
+second minimum, these RFCs tend to focus on streaming behavior,
+and fail to deal with the fact that a 1 second minimum has severe
+detrimental effects over lossy interactive connections, such
+as a 802.11b wireless link, and over very fast but lossy
+connections for those cases not covered by the fast retransmit
+code.
+For this reason, we use 200ms of slop and a near-0
+minimum, which gives us an effective minimum of 200ms (similar to
+.Tn Linux ) .
+.It Va rfc3042
+Enable the Limited Transmit algorithm as described in RFC 3042.
+It helps avoid timeouts on lossy links and also when the congestion window
+is small, as happens on short transfers.
+.It Va rfc3390
+Enable support for RFC 3390, which allows for a variable-sized
+starting congestion window on new connections, depending on the
+maximum segment size.
+This helps throughput in general, but
+particularly affects short transfers and high-bandwidth large
+propagation-delay connections.
+.It Va sack.enable
+Enable support for RFC 2018, TCP Selective Acknowledgment option,
+which allows the receiver to inform the sender about all successfully
+arrived segments, allowing the sender to retransmit the missing segments
+only.
+.It Va sack.maxholes
+Maximum number of SACK holes per connection.
+Defaults to 128.
+.It Va sack.globalmaxholes
+Maximum number of SACK holes per system, across all connections.
+Defaults to 65536.
+.It Va maxtcptw
+When a TCP connection enters the
+.Dv TIME_WAIT
+state, its associated socket structure is freed, since it is of
+negligible size and use, and a new structure is allocated to contain a
+minimal amount of information necessary for sustaining a connection in
+this state, called the compressed TCP TIME_WAIT state.
+Since this structure is smaller than a socket structure, it can save
+a significant amount of system memory.
+The
+.Va net.inet.tcp.maxtcptw
+MIB variable controls the maximum number of these structures allocated.
+By default, it is initialized to
+.Va kern.ipc.maxsockets
+/ 5.
+.It Va nolocaltimewait
+Suppress creating of compressed TCP TIME_WAIT states for connections in
+which both endpoints are local.
+.It Va fast_finwait2_recycle
+Recycle
+.Tn TCP
+.Dv FIN_WAIT_2
+connections faster when the socket is marked as
+.Dv SBS_CANTRCVMORE
+(no user process has the socket open, data received on
+the socket cannot be read).
+The timeout used here is
+.Va finwait2_timeout .
+.It Va finwait2_timeout
+Timeout to use for fast recycling of
+.Tn TCP
+.Dv FIN_WAIT_2
+connections.
+Defaults to 60 seconds.
+.It Va ecn.enable
+Enable support for TCP Explicit Congestion Notification (ECN).
+ECN allows a TCP sender to reduce the transmission rate in order to
+avoid packet drops.
+.It Va ecn.maxretries
+Number of retries (SYN or SYN/ACK retransmits) before disabling ECN on a
+specific connection. This is needed to help with connection establishment
+when a broken firewall is in the network path.
+.El
+.Sh ERRORS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width Er
+.It Bq Er EISCONN
+when trying to establish a connection on a socket which
+already has one;
+.It Bq Er ENOBUFS
+when the system runs out of memory for
+an internal data structure;
+.It Bq Er ETIMEDOUT
+when a connection was dropped
+due to excessive retransmissions;
+.It Bq Er ECONNRESET
+when the remote peer
+forces the connection to be closed;
+.It Bq Er ECONNREFUSED
+when the remote
+peer actively refuses connection establishment (usually because
+no process is listening to the port);
+.It Bq Er EADDRINUSE
+when an attempt
+is made to create a socket with a port which has already been
+allocated;
+.It Bq Er EADDRNOTAVAIL
+when an attempt is made to create a
+socket with a network address for which no network interface
+exists;
+.It Bq Er EAFNOSUPPORT
+when an attempt is made to bind or connect a socket to a multicast
+address.
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr socket 2 ,
+.Xr sysctl 3 ,
+.Xr blackhole 4 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr mod_cc 4 ,
+.Xr siftr 4 ,
+.Xr syncache 4 ,
+.Xr setkey 8
+.Rs
+.%A "V. Jacobson"
+.%A "R. Braden"
+.%A "D. Borman"
+.%T "TCP Extensions for High Performance"
+.%O "RFC 1323"
+.Re
+.Rs
+.%A "A. Heffernan"
+.%T "Protection of BGP Sessions via the TCP MD5 Signature Option"
+.%O "RFC 2385"
+.Re
+.Rs
+.%A "K. Ramakrishnan"
+.%A "S. Floyd"
+.%A "D. Black"
+.%T "The Addition of Explicit Congestion Notification (ECN) to IP"
+.%O "RFC 3168"
+.Re
+.Sh HISTORY
+The
+.Tn TCP
+protocol appeared in
+.Bx 4.2 .
+The RFC 1323 extensions for window scaling and timestamps were added
+in
+.Bx 4.4 .
+The
+.Dv TCP_INFO
+option was introduced in
+.Tn Linux 2.6
+and is
+.Em subject to change .
diff --git a/share/man/man4/tdfx.4 b/share/man/man4/tdfx.4
new file mode 100644
index 000000000000..b785c75ad86e
--- /dev/null
+++ b/share/man/man4/tdfx.4
@@ -0,0 +1,93 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 19, 2001
+.Dt TDFX 4
+.Os
+.Sh NAME
+.Nm tdfx
+.Nd Voodoo Graphics and VoodooII Memory Access GLIDE device driver
+.Sh SYNOPSIS
+.Cd device tdfx
+.Cd device tdfx_linux
+.Sh DESCRIPTION
+This driver creates an entry in
+.Pa /dev
+that allows programs (mostly
+.Em GLIDE-based software )
+to access the device memory of the Voodoo Graphics and
+VoodooII 3D accelerators created by
+.Em 3Dfx, Inc .
+This provides an interface
+for applications based on the
+.Em GLIDE API
+or that simply use the API
+provided by the linux
+.Pa /dev/3dfx
+device to use the video device.
+.Pp
+Supports all cards based on the following chipsets:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Em 3Dfx Voodoo Graphics
+.It
+.Em 3Dfx Voodoo II
+.El
+.Pp
+Specifically, the following cards should work:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Em Diamond Multimedia Monster 3D
+.It
+.Em Diamond Multimedia Monster 3D II
+.El
+.Pp
+Note that this driver does not currently have support for the Voodoo
+Banshee, Voodoo3, Voodoo5, or Voodoo6 based cards.
+It also does not currently support the Voodoo Rush.
+It also does not yet handle the SLI feature of the Voodoo II boards.
+You can only use each of them separately.
+.Pp
+By including
+.Nm tdfx_linux ,
+you can enable the linux ioctl code for this driver, where the only supported
+applications currently reside.
+.Sh FILES
+.Bl -tag -width /dev/voodoo* -compact
+.It Pa /dev/3dfx
+Symlinked to default
+.Em 3dfx
+board
+.It Pa /dev/3dfx*
+.Em Character Device
+programming interface
+.Pp
+.It Pa /dev/voodoo
+Mirrors of above interfaces
+.It Pa /dev/voodoo*
+(Some apps use
+.Pa /dev/voodoo )
+.El
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 5.0 ,
+and was originally developed for Linux kernel 2.0.x, later written for
+2.2.x and 2.4.x.
+.Sh AUTHORS
+.An -nosplit
+The driver was developed by
+.An Coleman Kane Aq cokane@micro.ti.com
+after the linux version of this driver by
+.An Darryll Straus ,
+.An John Taylor ,
+.An Jens Axboe ,
+.An Carlo Wood Aq carlo@alinoe.com
+and
+.An Joseph Kain Aq joseph@3dfx.com
+to be directly compatible with it and support the many GLIDE based games
+available for Linux and
+.Ux .
diff --git a/share/man/man4/termios.4 b/share/man/man4/termios.4
new file mode 100644
index 000000000000..2a69d7b508c0
--- /dev/null
+++ b/share/man/man4/termios.4
@@ -0,0 +1,1586 @@
+.\" Copyright (c) 1991, 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)termios.4 8.4 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd December 26, 2009
+.Dt TERMIOS 4
+.Os
+.Sh NAME
+.Nm termios
+.Nd general terminal line discipline
+.Sh SYNOPSIS
+.In termios.h
+.Sh DESCRIPTION
+This describes a general terminal line discipline that is
+supported on tty asynchronous communication ports.
+.Ss Opening a Terminal Device File
+When a terminal file is opened, it normally causes the process to wait
+until a connection is established.
+For most hardware, the presence
+of a connection is indicated by the assertion of the hardware
+.Dv CARRIER
+line.
+If the termios structure associated with the terminal file has the
+.Dv CLOCAL
+flag set in the cflag, or if the
+.Dv O_NONBLOCK
+flag is set
+in the
+.Xr open 2
+call, then the open will succeed even without
+a connection being present.
+In practice, applications
+seldom open these files; they are opened by special programs, such
+as
+.Xr getty 8
+or
+.Xr rlogind 8 ,
+and become
+an application's standard input, output, and error files.
+.Ss Job Control in a Nutshell
+Every process is associated with a particular process group and session.
+The grouping is hierarchical: every member of a particular process group is a
+member of the same session.
+This structuring is used in managing groups
+of related processes for purposes of
+.\" .Gw "job control" ;
+.Em "job control" ;
+that is, the
+ability from the keyboard (or from program control) to simultaneously
+stop or restart
+a complex command (a command composed of one or more related
+processes).
+The grouping into process groups allows delivering
+of signals that stop or start the group as a whole, along with
+arbitrating which process group has access to the single controlling
+terminal.
+The grouping at a higher layer into sessions is to restrict
+the job control related signals and system calls to within processes
+resulting from a particular instance of a
+.Dq login .
+Typically, a session
+is created when a user logs in, and the login terminal is setup
+to be the controlling terminal; all processes spawned from that
+login shell are in the same session, and inherit the controlling
+terminal.
+.Pp
+A job control shell
+operating interactively (that is, reading commands from a terminal)
+normally groups related processes together by placing them into the
+same process group.
+A set of processes in the same process group
+is collectively referred to as a
+.Dq job .
+When the foreground process
+group of the terminal is the same as the process group of a particular
+job, that job is said to be in the
+.Dq foreground .
+When the process group of the terminal is different from the process group of
+a job (but is still the controlling terminal), that job is said
+to be in the
+.Dq background .
+Normally the
+shell reads a command and starts the job that implements that
+command.
+If the command is to be started in the foreground (typical), it
+sets the process group of the terminal to the process group
+of the started job, waits for the job to complete, and then
+sets the process group of the terminal back to its own process
+group (it puts itself into the foreground).
+If the job is to
+be started in the background (as denoted by the shell operator "&"),
+it never changes the process group of the terminal and does not
+wait for the job to complete (that is, it immediately attempts to read the next
+command).
+If the job is started in the foreground, the user may
+type a key (usually
+.Ql \&^Z )
+which generates the terminal stop signal
+.Pq Dv SIGTSTP
+and has the effect of stopping the entire job.
+The shell will notice that the job stopped, and will resume running after
+placing itself in the foreground.
+The shell also has commands for placing stopped jobs in the background,
+and for placing stopped or background jobs into the foreground.
+.Ss Orphaned Process Groups
+An orphaned process group is a process group that has no process
+whose parent is in a different process group, yet is in the same
+session.
+Conceptually it means a process group that does not have
+a parent that could do anything if it were to be stopped.
+For example,
+the initial login shell is typically in an orphaned process group.
+Orphaned process groups are immune to keyboard generated stop
+signals and job control signals resulting from reads or writes to the
+controlling terminal.
+.Ss The Controlling Terminal
+A terminal may belong to a process as its controlling terminal.
+Each
+process of a session that has a controlling terminal has the same
+controlling terminal.
+A terminal may be the controlling terminal for at
+most one session.
+The controlling terminal for a session is allocated by
+the session leader by issuing the
+.Dv TIOCSCTTY
+ioctl.
+A controlling terminal
+is never acquired by merely opening a terminal device file.
+When a controlling terminal becomes
+associated with a session, its foreground process group is set to
+the process group of the session leader.
+.Pp
+The controlling terminal is inherited by a child process during a
+.Xr fork 2
+function call.
+A process relinquishes its controlling terminal when it
+creates a new session with the
+.Xr setsid 2
+function; other processes
+remaining in the old session that had this terminal as their controlling
+terminal continue to have it.
+A process does not relinquish its
+controlling terminal simply by closing all of its file descriptors
+associated with the controlling terminal if other processes continue to
+have it open.
+.Pp
+When a controlling process terminates, the controlling terminal is
+disassociated from the current session, allowing it to be acquired by a
+new session leader.
+Subsequent access to the terminal by other processes
+in the earlier session will be denied, with attempts to access the
+terminal treated as if modem disconnect had been sensed.
+.Ss Terminal Access Control
+If a process is in the foreground process group of its controlling
+terminal, read operations are allowed.
+Any attempts by a process
+in a background process group to read from its controlling terminal
+causes a
+.Dv SIGTTIN
+signal to be sent to
+the process's group
+unless one of the
+following special cases apply: if the reading process is ignoring or
+blocking the
+.Dv SIGTTIN
+signal, or if the process group of the reading
+process is orphaned, the
+.Xr read 2
+returns -1 with
+.Va errno set to
+.Er EIO
+and no
+signal is sent.
+The default action of the
+.Dv SIGTTIN
+signal is to stop the
+process to which it is sent.
+.Pp
+If a process is in the foreground process group of its controlling
+terminal, write operations are allowed.
+Attempts by a process in a background process group to write to its
+controlling terminal will cause the process group to be sent a
+.Dv SIGTTOU
+signal unless one of the following special cases apply: if
+.Dv TOSTOP
+is not
+set, or if
+.Dv TOSTOP
+is set and the process is ignoring or blocking the
+.Dv SIGTTOU
+signal, the process is allowed to write to the terminal and the
+.Dv SIGTTOU
+signal is not sent.
+If
+.Dv TOSTOP
+is set, and the process group of
+the writing process is orphaned, and the writing process is not ignoring
+or blocking
+.Dv SIGTTOU ,
+the
+.Xr write 2
+returns -1 with
+errno set to
+.Er EIO
+and no signal is sent.
+.Pp
+Certain calls that set terminal parameters are treated in the same
+fashion as write, except that
+.Dv TOSTOP
+is ignored; that is, the effect is
+identical to that of terminal writes when
+.Dv TOSTOP
+is set.
+.Ss Input Processing and Reading Data
+A terminal device associated with a terminal device file may operate in
+full-duplex mode, so that data may arrive even while output is occurring.
+Each terminal device file has associated with it an input queue, into
+which incoming data is stored by the system before being read by a
+process.
+The system imposes a limit,
+.Pf \&{ Dv MAX_INPUT Ns \&} ,
+on the number of
+bytes that may be stored in the input queue.
+The behavior of the system
+when this limit is exceeded depends on the setting of the
+.Dv IMAXBEL
+flag in the termios
+.Fa c_iflag .
+If this flag is set, the terminal
+is sent an
+.Tn ASCII
+.Dv BEL
+character each time a character is received
+while the input queue is full.
+Otherwise, the input queue is flushed upon receiving the character.
+.Pp
+Two general kinds of input processing are available, determined by
+whether the terminal device file is in canonical mode or noncanonical
+mode.
+Additionally,
+input characters are processed according to the
+.Fa c_iflag
+and
+.Fa c_lflag
+fields.
+Such processing can include echoing, which
+in general means transmitting input characters immediately back to the
+terminal when they are received from the terminal.
+This is useful for terminals that can operate in full-duplex mode.
+.Pp
+The manner in which data is provided to a process reading from a terminal
+device file is dependent on whether the terminal device file is in
+canonical or noncanonical mode.
+.Pp
+Another dependency is whether the
+.Dv O_NONBLOCK
+flag is set by
+.Xr open 2
+or
+.Xr fcntl 2 .
+If the
+.Dv O_NONBLOCK
+flag is clear, then the read request is
+blocked until data is available or a signal has been received.
+If the
+.Dv O_NONBLOCK
+flag is set, then the read request is completed, without
+blocking, in one of three ways:
+.Bl -enum -offset indent
+.It
+If there is enough data available to satisfy the entire request,
+and the read completes successfully the number of
+bytes read is returned.
+.It
+If there is not enough data available to satisfy the entire
+request, and the read completes successfully, having read as
+much data as possible, the number of bytes read is returned.
+.It
+If there is no data available, the read returns -1, with
+errno set to
+.Er EAGAIN .
+.El
+.Pp
+When data is available depends on whether the input processing mode is
+canonical or noncanonical.
+.Ss Canonical Mode Input Processing
+In canonical mode input processing, terminal input is processed in units
+of lines.
+A line is delimited by a newline
+.Ql \&\en
+character, an end-of-file
+.Pq Dv EOF
+character, or an end-of-line
+.Pq Dv EOL
+character.
+See the
+.Sx "Special Characters"
+section for
+more information on
+.Dv EOF
+and
+.Dv EOL .
+This means that a read request will
+not return until an entire line has been typed, or a signal has been
+received.
+Also, no matter how many bytes are requested in the read call,
+at most one line is returned.
+It is not, however, necessary to
+read a whole line at once; any number of bytes, even one, may be
+requested in a read without losing information.
+.Pp
+.Pf \&{ Dv MAX_CANON Ns \&}
+is a limit on the
+number of bytes in a line.
+The behavior of the system when this limit is
+exceeded is the same as when the input queue limit
+.Pf \&{ Dv MAX_INPUT Ns \&} ,
+is exceeded.
+.Pp
+Erase and kill processing occur when either of two special characters,
+the
+.Dv ERASE
+and
+.Dv KILL
+characters (see the
+.Sx "Special Characters"
+section), is received.
+This processing affects data in the input queue that has not yet been
+delimited by a newline
+.Dv NL ,
+.Dv EOF ,
+or
+.Dv EOL
+character.
+This un-delimited
+data makes up the current line.
+The
+.Dv ERASE
+character deletes the last
+character in the current line, if there is any.
+The
+.Dv KILL
+character
+deletes all data in the current line, if there is any.
+The
+.Dv ERASE
+and
+.Dv KILL
+characters have no effect if there is no data in the current line.
+The
+.Dv ERASE
+and
+.Dv KILL
+characters themselves are not placed in the input
+queue.
+.Ss Noncanonical Mode Input Processing
+In noncanonical mode input processing, input bytes are not assembled into
+lines, and erase and kill processing does not occur.
+The values of the
+.Dv VMIN
+and
+.Dv VTIME
+members of the
+.Fa c_cc
+array are used to determine how to
+process the bytes received.
+.Pp
+.Dv MIN
+represents the minimum number of bytes that should be received when
+the
+.Xr read 2
+function successfully returns.
+.Dv TIME
+is a timer of 0.1 second
+granularity that is used to time out bursty and short term data
+transmissions.
+If
+.Dv MIN
+is greater than
+.Dv \&{ Dv MAX_INPUT Ns \&} ,
+the response to the
+request is undefined.
+The four possible values for
+.Dv MIN
+and
+.Dv TIME
+and
+their interactions are described below.
+.Ss "Case A: MIN > 0, TIME > 0"
+In this case
+.Dv TIME
+serves as an inter-byte timer and is activated after
+the first byte is received.
+Since it is an inter-byte timer, it is reset
+after a byte is received.
+The interaction between
+.Dv MIN
+and
+.Dv TIME
+is as
+follows: as soon as one byte is received, the inter-byte timer is
+started.
+If
+.Dv MIN
+bytes are received before the inter-byte timer expires
+(remember that the timer is reset upon receipt of each byte), the read is
+satisfied.
+If the timer expires before
+.Dv MIN
+bytes are received, the
+characters received to that point are returned to the user.
+Note that if
+.Dv TIME
+expires at least one byte is returned because the timer would
+not have been enabled unless a byte was received.
+In this case
+.Pf \&( Dv MIN
+> 0,
+.Dv TIME
+> 0) the read blocks until the
+.Dv MIN
+and
+.Dv TIME
+mechanisms are
+activated by the receipt of the first byte, or a signal is received.
+If data is in the buffer at the time of the
+.Fn read ,
+the result is as
+if data had been received immediately after the
+.Fn read .
+.Ss "Case B: MIN > 0, TIME = 0"
+In this case, since the value of
+.Dv TIME
+is zero, the timer plays no role
+and only
+.Dv MIN
+is significant.
+A pending read is not satisfied until
+.Dv MIN
+bytes are received (i.e., the pending read blocks until
+.Dv MIN
+bytes
+are received), or a signal is received.
+A program that uses this case to read record-based terminal
+.Dv I/O
+may block indefinitely in the read
+operation.
+.Ss "Case C: MIN = 0, TIME > 0"
+In this case, since
+.Dv MIN
+= 0,
+.Dv TIME
+no longer represents an inter-byte
+timer.
+It now serves as a read timer that is activated as soon as the
+read function is processed.
+A read is satisfied as soon as a single
+byte is received or the read timer expires.
+Note that in this case if the timer expires, no bytes are returned.
+If the timer does not
+expire, the only way the read can be satisfied is if a byte is received.
+In this case the read will not block indefinitely waiting for a byte; if
+no byte is received within
+.Dv TIME Ns *0.1
+seconds after the read is initiated,
+the read returns a value of zero, having read no data.
+If data is
+in the buffer at the time of the read, the timer is started as if
+data had been received immediately after the read.
+.Ss Case D: MIN = 0, TIME = 0
+The minimum of either the number of bytes requested or the number of
+bytes currently available is returned without waiting for more
+bytes to be input.
+If no characters are available, read returns a
+value of zero, having read no data.
+.Ss Writing Data and Output Processing
+When a process writes one or more bytes to a terminal device file, they
+are processed according to the
+.Fa c_oflag
+field (see the
+.Sx "Output Modes"
+section).
+The
+implementation may provide a buffering mechanism; as such, when a call to
+.Fn write
+completes, all of the bytes written have been scheduled for
+transmission to the device, but the transmission will not necessarily
+have been completed.
+.\" See also .Sx "6.4.2" for the effects of
+.\" .Dv O_NONBLOCK
+.\" on write.
+.Ss Special Characters
+Certain characters have special functions on input or output or both.
+These functions are summarized as follows:
+.Bl -tag -width indent
+.It Dv INTR
+Special character on input and is recognized if the
+.Dv ISIG
+flag (see the
+.Sx "Local Modes"
+section) is enabled.
+Generates a
+.Dv SIGINT
+signal which is sent to all processes in the foreground
+process group for which the terminal is the controlling
+terminal.
+If
+.Dv ISIG
+is set, the
+.Dv INTR
+character is
+discarded when processed.
+.It Dv QUIT
+Special character on input and is recognized if the
+.Dv ISIG
+flag is enabled.
+Generates a
+.Dv SIGQUIT
+signal which is
+sent to all processes in the foreground process group
+for which the terminal is the controlling terminal.
+If
+.Dv ISIG
+is set, the
+.Dv QUIT
+character is discarded when
+processed.
+.It Dv ERASE
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Erases the last character in the
+current line; see
+.Sx "Canonical Mode Input Processing" .
+It does not erase beyond
+the start of a line, as delimited by an
+.Dv NL ,
+.Dv EOF ,
+or
+.Dv EOL
+character.
+If
+.Dv ICANON
+is set, the
+.Dv ERASE
+character is
+discarded when processed.
+.It Dv KILL
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Deletes the entire line, as
+delimited by a
+.Dv NL ,
+.Dv EOF ,
+or
+.Dv EOL
+character.
+If
+.Dv ICANON
+is set, the
+.Dv KILL
+character is discarded when processed.
+.It Dv EOF
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+When received, all the bytes
+waiting to be read are immediately passed to the
+process, without waiting for a newline, and the
+.Dv EOF
+is discarded.
+Thus, if there are no bytes waiting (that is, the
+.Dv EOF
+occurred at the beginning of a line), a byte
+count of zero is returned from the
+.Fn read ,
+representing an end-of-file indication.
+If
+.Dv ICANON
+is
+set, the
+.Dv EOF
+character is discarded when processed.
+.It Dv NL
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+It is the line delimiter
+.Ql \&\en .
+.It Dv EOL
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Is an additional line delimiter, like
+.Dv NL .
+.It Dv SUSP
+If the
+.Dv ISIG
+flag is enabled, receipt of the
+.Dv SUSP
+character causes a
+.Dv SIGTSTP
+signal to be sent to all processes in the
+foreground process group for which the terminal is the
+controlling terminal, and the
+.Dv SUSP
+character is
+discarded when processed.
+.It Dv STOP
+Special character on both input and output and is
+recognized if the
+.Dv IXON
+(output control) or
+.Dv IXOFF
+(input
+control) flag is set.
+Can be used to temporarily suspend output.
+It is useful with fast terminals to
+prevent output from disappearing before it can be read.
+If
+.Dv IXON
+is set, the
+.Dv STOP
+character is discarded when
+processed.
+.It Dv START
+Special character on both input and output and is
+recognized if the
+.Dv IXON
+(output control) or
+.Dv IXOFF
+(input
+control) flag is set.
+Can be used to resume output that has been suspended by a
+.Dv STOP
+character.
+If
+.Dv IXON
+is set, the
+.Dv START
+character is discarded when processed.
+.It Dv CR
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set; it is the
+.Ql \&\er ,
+as denoted in the
+.Tn \&C
+Standard {2}.
+When
+.Dv ICANON
+and
+.Dv ICRNL
+are set and
+.Dv IGNCR
+is not set, this character is translated into a
+.Dv NL ,
+and
+has the same effect as a
+.Dv NL
+character.
+.El
+.Pp
+The following special characters are extensions defined by this
+system and are not a part of
+.St -p1003.1
+termios.
+.Bl -tag -width indent
+.It Dv EOL2
+Secondary
+.Dv EOL
+character.
+Same function as
+.Dv EOL .
+.It Dv WERASE
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Erases the last word in the current line according to one of two algorithms.
+If the
+.Dv ALTWERASE
+flag is not set, first any preceding whitespace is
+erased, and then the maximal sequence of non-whitespace
+characters.
+If
+.Dv ALTWERASE
+is set, first any preceding
+whitespace is erased, and then the maximal sequence
+of alphabetic/underscores or non alphabetic/underscores.
+As a special case in this second algorithm, the first previous
+non-whitespace character is skipped in determining
+whether the preceding word is a sequence of
+alphabetic/underscores.
+This sounds confusing but turns out to be quite practical.
+.It Dv REPRINT
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Causes the current input edit line to be retyped.
+.It Dv DSUSP
+Has similar actions to the
+.Dv SUSP
+character, except that
+the
+.Dv SIGTSTP
+signal is delivered when one of the processes
+in the foreground process group issues a
+.Fn read
+to the
+controlling terminal.
+.It Dv LNEXT
+Special character on input and is recognized if the
+.Dv IEXTEN
+flag is set.
+Receipt of this character causes the next character to be taken literally.
+.It Dv DISCARD
+Special character on input and is recognized if the
+.Dv IEXTEN
+flag is set.
+Receipt of this character toggles the flushing of terminal output.
+.It Dv STATUS
+Special character on input and is recognized if the
+.Dv ICANON
+flag is set.
+Receipt of this character causes a
+.Dv SIGINFO
+signal to be sent to the foreground process group of the
+terminal.
+Also, if the
+.Dv NOKERNINFO
+flag is not set, it
+causes the kernel to write a status message to the terminal
+that displays the current load average, the name of the
+command in the foreground, its process ID, the symbolic
+wait channel, the number of user and system seconds used,
+the percentage of cpu the process is getting, and the resident
+set size of the process.
+.El
+.Pp
+The
+.Dv NL
+and
+.Dv CR
+characters cannot be changed.
+The values for all the remaining characters can be set and are
+described later in the document under
+Special Control Characters.
+.Pp
+Special
+character functions associated with changeable special control characters
+can be disabled individually by setting their value to
+.Dv {_POSIX_VDISABLE} ;
+see
+.Sx "Special Control Characters" .
+.Pp
+If two or more special characters have the same value, the function
+performed when that character is received is undefined.
+.Ss Modem Disconnect
+If a modem disconnect is detected by the terminal interface for a
+controlling terminal, and if
+.Dv CLOCAL
+is not set in the
+.Fa c_cflag
+field for
+the terminal, the
+.Dv SIGHUP
+signal is sent to the controlling
+process associated with the terminal.
+Unless other arrangements have
+been made, this causes the controlling process to terminate.
+Any subsequent call to the
+.Fn read
+function returns the value zero,
+indicating end of file.
+Thus, processes that read a terminal
+file and test for end-of-file can terminate appropriately after a
+disconnect.
+.\" If the
+.\" .Er EIO
+.\" condition specified in 6.1.1.4 that applies
+.\" when the implementation supports job control also exists, it is
+.\" unspecified whether the
+.\" .Dv EOF
+.\" condition or the
+.\" .Pf [ Dv EIO
+.\" ] is returned.
+Any
+subsequent
+.Fn write
+to the terminal device returns -1, with
+.Va errno
+set to
+.Er EIO ,
+until the device is closed.
+.Sh General Terminal Interface
+.Ss Closing a Terminal Device File
+The last process to close a terminal device file causes any output
+to be sent to the device and any input to be discarded.
+Then, if
+.Dv HUPCL
+is set in the control modes, and the communications port supports a
+disconnect function, the terminal device performs a disconnect.
+.Ss Parameters That Can Be Set
+Routines that need to control certain terminal
+.Tn I/O
+characteristics
+do so by using the termios structure as defined in the header
+.In termios.h .
+This structure contains minimally four scalar elements of bit flags
+and one array of special characters.
+The scalar flag elements are named:
+.Fa c_iflag ,
+.Fa c_oflag ,
+.Fa c_cflag ,
+and
+.Fa c_lflag .
+The character array is named
+.Fa c_cc ,
+and its maximum index is
+.Dv NCCS .
+.Ss Input Modes
+Values of the
+.Fa c_iflag
+field describe the basic
+terminal input control, and are composed of
+following masks:
+.Pp
+.Bl -tag -width IMAXBEL -offset indent -compact
+.It Dv IGNBRK
+/* ignore BREAK condition */
+.It Dv BRKINT
+/* map BREAK to SIGINTR */
+.It Dv IGNPAR
+/* ignore (discard) parity errors */
+.It Dv PARMRK
+/* mark parity and framing errors */
+.It Dv INPCK
+/* enable checking of parity errors */
+.It Dv ISTRIP
+/* strip 8th bit off chars */
+.It Dv INLCR
+/* map NL into CR */
+.It Dv IGNCR
+/* ignore CR */
+.It Dv ICRNL
+/* map CR to NL (ala CRMOD) */
+.It Dv IXON
+/* enable output flow control */
+.It Dv IXOFF
+/* enable input flow control */
+.It Dv IXANY
+/* any char will restart after stop */
+.It Dv IMAXBEL
+/* ring bell on input queue full */
+.El
+.Pp
+In the context of asynchronous serial data transmission, a break
+condition is defined as a sequence of zero-valued bits that continues for
+more than the time to send one byte.
+The entire sequence of zero-valued
+bits is interpreted as a single break condition, even if it continues for
+a time equivalent to more than one byte.
+In contexts other than
+asynchronous serial data transmission the definition of a break condition
+is implementation defined.
+.Pp
+If
+.Dv IGNBRK
+is set, a break condition detected on input is ignored, that
+is, not put on the input queue and therefore not read by any process.
+If
+.Dv IGNBRK
+is not set and
+.Dv BRKINT
+is set, the break condition flushes the
+input and output queues and if the terminal is the controlling terminal
+of a foreground process group, the break condition generates a
+single
+.Dv SIGINT
+signal to that foreground process group.
+If neither
+.Dv IGNBRK
+nor
+.Dv BRKINT
+is set, a break condition is read as a single
+.Ql \&\e0 ,
+or if
+.Dv PARMRK
+is set, as
+.Ql \&\e377 ,
+.Ql \&\e0 ,
+.Ql \&\e0 .
+.Pp
+If
+.Dv IGNPAR
+is set, a byte with a framing or parity error (other than
+break) is ignored.
+.Pp
+If
+.Dv PARMRK
+is set, and
+.Dv IGNPAR
+is not set, a byte with a framing or parity
+error (other than break) is given to the application as the
+three-character sequence
+.Ql \&\e377 ,
+.Ql \&\e0 ,
+X, where
+.Ql \&\e377 ,
+.Ql \&\e0
+is a two-character
+flag preceding each sequence and X is the data of the character received
+in error.
+To avoid ambiguity in this case, if
+.Dv ISTRIP
+is not set, a valid
+character of
+.Ql \&\e377
+is given to the application as
+.Ql \&\e377 ,
+.Ql \&\e377 .
+If
+neither
+.Dv PARMRK
+nor
+.Dv IGNPAR
+is set, a framing or parity error (other than
+break) is given to the application as a single character
+.Ql \&\e0 .
+.Pp
+If
+.Dv INPCK
+is set, input parity checking is enabled.
+If
+.Dv INPCK
+is not set,
+input parity checking is disabled, allowing output parity generation
+without input parity errors.
+Note that whether input parity checking is
+enabled or disabled is independent of whether parity detection is enabled
+or disabled (see
+.Sx "Control Modes" ) .
+If parity detection is enabled but input
+parity checking is disabled, the hardware to which the terminal is
+connected recognizes the parity bit, but the terminal special file
+does not check whether this bit is set correctly or not.
+.Pp
+If
+.Dv ISTRIP
+is set, valid input bytes are first stripped to seven bits,
+otherwise all eight bits are processed.
+.Pp
+If
+.Dv INLCR
+is set, a received
+.Dv NL
+character is translated into a
+.Dv CR
+character.
+If
+.Dv IGNCR
+is set, a received
+.Dv CR
+character is ignored (not
+read).
+If
+.Dv IGNCR
+is not set and
+.Dv ICRNL
+is set, a received
+.Dv CR
+character is
+translated into a
+.Dv NL
+character.
+.Pp
+If
+.Dv IXON
+is set, start/stop output control is enabled.
+A received
+.Dv STOP
+character suspends output and a received
+.Dv START
+character
+restarts output.
+If
+.Dv IXANY
+is also set, then any character may
+restart output.
+When
+.Dv IXON
+is set,
+.Dv START
+and
+.Dv STOP
+characters are not
+read, but merely perform flow control functions.
+When
+.Dv IXON
+is not set,
+the
+.Dv START
+and
+.Dv STOP
+characters are read.
+.Pp
+If
+.Dv IXOFF
+is set, start/stop input control is enabled.
+The system shall transmit one or more
+.Dv STOP
+characters, which are intended to cause the
+terminal device to stop transmitting data, as needed to prevent the input
+queue from overflowing and causing the undefined behavior described in
+.Sx "Input Processing and Reading Data" ,
+and shall transmit one or more
+.Dv START
+characters, which are
+intended to cause the terminal device to resume transmitting data, as
+soon as the device can continue transmitting data without risk of
+overflowing the input queue.
+The precise conditions under which
+.Dv STOP
+and
+.Dv START
+characters are transmitted are implementation defined.
+.Pp
+If
+.Dv IMAXBEL
+is set and the input queue is full, subsequent input shall cause an
+.Tn ASCII
+.Dv BEL
+character to be transmitted to
+the output queue.
+.Pp
+The initial input control value after
+.Fn open
+is implementation defined.
+.Ss Output Modes
+Values of the
+.Fa c_oflag
+field describe the basic terminal output control,
+and are composed of the following masks:
+.Pp
+.Bl -tag -width ONOEOT -offset indent -compact
+.It Dv OPOST
+/* enable following output processing */
+.It Dv ONLCR
+/* map NL to CR-NL (ala
+.Dv CRMOD )
+*/
+.It Dv OCRNL
+/* map CR to NL */
+.It Dv TABDLY
+/* tab delay mask */
+.It Dv TAB0
+/* no tab delay and expansion */
+.It Dv TAB3
+/* expand tabs to spaces */
+.It Dv ONOEOT
+/* discard
+.Dv EOT Ns 's
+.Ql \&^D
+on output) */
+.It Dv ONOCR
+/* do not transmit CRs on column 0 */
+.It Dv ONLRET
+/* on the terminal NL performs the CR function */
+.El
+.Pp
+If
+.Dv OPOST
+is set, the remaining flag masks are interpreted as follows;
+otherwise characters are transmitted without change.
+.Pp
+If
+.Dv ONLCR
+is set, newlines are translated to carriage return, linefeeds.
+.Pp
+If
+.Dv OCRNL
+is set, carriage returns are translated to newlines.
+.Pp
+The
+.Dv TABDLY
+bits specify the tab delay.
+The
+.Fa c_oflag
+is masked with
+.Dv TABDLY
+and compared with the
+values
+.Dv TAB0
+or
+.Dv TAB3 .
+If
+.Dv TAB3
+is set, tabs are expanded to the appropriate number of
+spaces (assuming 8 column tab stops).
+.Pp
+If
+.Dv ONOEOT
+is set,
+.Tn ASCII
+.Dv EOT Ns 's
+are discarded on output.
+.Pp
+If
+.Dv ONOCR
+is set, no CR character is transmitted when at column 0 (first position).
+.Pp
+If
+.Dv ONLRET
+is set, the NL character is assumed to do the carriage-return function;
+the column pointer will be set to 0.
+.Ss Control Modes
+Values of the
+.Fa c_cflag
+field describe the basic
+terminal hardware control, and are composed of the
+following masks.
+Not all values
+specified are supported by all hardware.
+.Pp
+.Bl -tag -width CRTSXIFLOW -offset indent -compact
+.It Dv CSIZE
+/* character size mask */
+.It Dv CS5
+/* 5 bits (pseudo) */
+.It Dv CS6
+/* 6 bits */
+.It Dv CS7
+/* 7 bits */
+.It Dv CS8
+/* 8 bits */
+.It Dv CSTOPB
+/* send 2 stop bits */
+.It Dv CREAD
+/* enable receiver */
+.It Dv PARENB
+/* parity enable */
+.It Dv PARODD
+/* odd parity, else even */
+.It Dv HUPCL
+/* hang up on last close */
+.It Dv CLOCAL
+/* ignore modem status lines */
+.It Dv CCTS_OFLOW
+/*
+.Dv CTS
+flow control of output */
+.It Dv CRTSCTS
+/* same as
+.Dv CCTS_OFLOW
+*/
+.It Dv CRTS_IFLOW
+/* RTS flow control of input */
+.It Dv MDMBUF
+/* flow control output via Carrier */
+.El
+.Pp
+The
+.Dv CSIZE
+bits specify the byte size in bits for both transmission and
+reception.
+The
+.Fa c_cflag
+is masked with
+.Dv CSIZE
+and compared with the
+values
+.Dv CS5 ,
+.Dv CS6 ,
+.Dv CS7 ,
+or
+.Dv CS8 .
+This size does not include the parity bit, if any.
+If
+.Dv CSTOPB
+is set, two stop bits are used, otherwise one stop bit.
+For example, at 110 baud, two stop bits are normally used.
+.Pp
+If
+.Dv CREAD
+is set, the receiver is enabled.
+Otherwise, no character is received.
+Not all hardware supports this bit.
+In fact, this flag is pretty silly and if it were not part of the
+.Nm
+specification
+it would be omitted.
+.Pp
+If
+.Dv PARENB
+is set, parity generation and detection are enabled and a parity
+bit is added to each character.
+If parity is enabled,
+.Dv PARODD
+specifies
+odd parity if set, otherwise even parity is used.
+.Pp
+If
+.Dv HUPCL
+is set, the modem control lines for the port are lowered
+when the last process with the port open closes the port or the process
+terminates.
+The modem connection is broken.
+.Pp
+If
+.Dv CLOCAL
+is set, a connection does not depend on the state of the modem
+status lines.
+If
+.Dv CLOCAL
+is clear, the modem status lines are
+monitored.
+.Pp
+Under normal circumstances, a call to the
+.Fn open
+function waits for
+the modem connection to complete.
+However, if the
+.Dv O_NONBLOCK
+flag is set
+or if
+.Dv CLOCAL
+has been set, the
+.Fn open
+function returns
+immediately without waiting for the connection.
+.Pp
+The
+.Dv CCTS_OFLOW
+.Pf ( Dv CRTSCTS )
+flag is currently unused.
+.Pp
+If
+.Dv MDMBUF
+is set then output flow control is controlled by the state
+of Carrier Detect.
+.Pp
+If the object for which the control modes are set is not an asynchronous
+serial connection, some of the modes may be ignored; for example, if an
+attempt is made to set the baud rate on a network connection to a
+terminal on another host, the baud rate may or may not be set on the
+connection between that terminal and the machine it is directly connected
+to.
+.Ss Local Modes
+Values of the
+.Fa c_lflag
+field describe the control of
+various functions, and are composed of the following
+masks.
+.Pp
+.Bl -tag -width NOKERNINFO -offset indent -compact
+.It Dv ECHOKE
+/* visual erase for line kill */
+.It Dv ECHOE
+/* visually erase chars */
+.It Dv ECHO
+/* enable echoing */
+.It Dv ECHONL
+/* echo
+.Dv NL
+even if
+.Dv ECHO
+is off */
+.It Dv ECHOPRT
+/* visual erase mode for hardcopy */
+.It Dv ECHOCTL
+/* echo control chars as ^(Char) */
+.It Dv ISIG
+/* enable signals
+.Dv INTR ,
+.Dv QUIT ,
+.Dv [D]SUSP
+*/
+.It Dv ICANON
+/* canonicalize input lines */
+.It Dv ALTWERASE
+/* use alternate
+.Dv WERASE
+algorithm */
+.It Dv IEXTEN
+/* enable
+.Dv DISCARD
+and
+.Dv LNEXT
+*/
+.It Dv EXTPROC
+/* external processing */
+.It Dv TOSTOP
+/* stop background jobs from output */
+.It Dv FLUSHO
+/* output being flushed (state) */
+.It Dv NOKERNINFO
+/* no kernel output from
+.Dv VSTATUS
+*/
+.It Dv PENDIN
+/* XXX retype pending input (state) */
+.It Dv NOFLSH
+/* don't flush after interrupt */
+.El
+.Pp
+If
+.Dv ECHO
+is set, input characters are echoed back to the terminal.
+If
+.Dv ECHO
+is not set, input characters are not echoed.
+.Pp
+If
+.Dv ECHOE
+and
+.Dv ICANON
+are set, the
+.Dv ERASE
+character causes the terminal
+to erase the last character in the current line from the display, if
+possible.
+If there is no character to erase, an implementation may echo
+an indication that this was the case or do nothing.
+.Pp
+If
+.Dv ECHOK
+and
+.Dv ICANON
+are set, the
+.Dv KILL
+character causes
+the current line to be discarded and the system echoes the
+.Ql \&\en
+character after the
+.Dv KILL
+character.
+.Pp
+If
+.Dv ECHOKE
+and
+.Dv ICANON
+are set, the
+.Dv KILL
+character causes
+the current line to be discarded and the system causes
+the terminal
+to erase the line from the display.
+.Pp
+If
+.Dv ECHOPRT
+and
+.Dv ICANON
+are set, the system assumes
+that the display is a printing device and prints a
+backslash and the erased characters when processing
+.Dv ERASE
+characters, followed by a forward slash.
+.Pp
+If
+.Dv ECHOCTL
+is set, the system echoes control characters
+in a visible fashion using a caret followed by the control character.
+.Pp
+If
+.Dv ALTWERASE
+is set, the system uses an alternative algorithm
+for determining what constitutes a word when processing
+.Dv WERASE
+characters (see
+.Dv WERASE ) .
+.Pp
+If
+.Dv ECHONL
+and
+.Dv ICANON
+are set, the
+.Ql \&\en
+character echoes even if
+.Dv ECHO
+is not set.
+.Pp
+If
+.Dv ICANON
+is set, canonical processing is enabled.
+This enables the
+erase and kill edit functions, and the assembly of input characters into
+lines delimited by
+.Dv NL ,
+.Dv EOF ,
+and
+.Dv EOL ,
+as described in
+.Sx "Canonical Mode Input Processing" .
+.Pp
+If
+.Dv ICANON
+is not set, read requests are satisfied directly from the input
+queue.
+A read is not satisfied until at least
+.Dv MIN
+bytes have been
+received or the timeout value
+.Dv TIME
+expired between bytes.
+The time value
+represents tenths of seconds.
+See
+.Sx "Noncanonical Mode Input Processing"
+for more details.
+.Pp
+If
+.Dv ISIG
+is set, each input character is checked against the special
+control characters
+.Dv INTR ,
+.Dv QUIT ,
+and
+.Dv SUSP
+(job control only).
+If an input
+character matches one of these control characters, the function
+associated with that character is performed.
+If
+.Dv ISIG
+is not set, no
+checking is done.
+Thus these special input functions are possible only
+if
+.Dv ISIG
+is set.
+.Pp
+If
+.Dv IEXTEN
+is set, implementation-defined functions are recognized
+from the input data.
+How
+.Dv IEXTEN
+being set
+interacts with
+.Dv ICANON ,
+.Dv ISIG ,
+.Dv IXON ,
+or
+.Dv IXOFF
+is implementation defined.
+If
+.Dv IEXTEN
+is not set, then
+implementation-defined functions are not recognized, and the
+corresponding input characters are not processed as described for
+.Dv ICANON ,
+.Dv ISIG ,
+.Dv IXON ,
+and
+.Dv IXOFF .
+.Pp
+If
+.Dv NOFLSH
+is set, the normal flush of the input and output queues
+associated with the
+.Dv INTR ,
+.Dv QUIT ,
+and
+.Dv SUSP
+characters
+are not be done.
+.Pp
+If
+.Dv TOSTOP
+is set, the signal
+.Dv SIGTTOU
+is sent to the process group of a process that tries to write to
+its controlling terminal if it is not in the foreground process group for
+that terminal.
+This signal, by default, stops the members of the process group.
+Otherwise, the output generated by that process is output to the
+current output stream.
+Processes that are blocking or ignoring
+.Dv SIGTTOU
+signals are excepted and allowed to produce output and the
+.Dv SIGTTOU
+signal
+is not sent.
+.Pp
+If
+.Dv NOKERNINFO
+is set, the kernel does not produce a status message
+when processing
+.Dv STATUS
+characters (see
+.Dv STATUS ) .
+.Ss Special Control Characters
+The special control characters values are defined by the array
+.Fa c_cc .
+This table lists the array index, the corresponding special character,
+and the system default value.
+For an accurate list of
+the system defaults, consult the header file
+.In sys/ttydefaults.h .
+.Pp
+.Bl -column "Index Name" "Special Character" -offset indent -compact
+.It Em "Index Name Special Character Default Value"
+.It Dv VEOF Ta EOF Ta \&^D
+.It Dv VEOL Ta EOL Ta _POSIX_VDISABLE
+.It Dv VEOL2 Ta EOL2 Ta _POSIX_VDISABLE
+.It Dv VERASE Ta ERASE Ta \&^? Ql \&\e177
+.It Dv VWERASE Ta WERASE Ta \&^W
+.It Dv VKILL Ta KILL Ta \&^U
+.It Dv VREPRINT Ta REPRINT Ta \&^R
+.It Dv VINTR Ta INTR Ta \&^C
+.It Dv VQUIT Ta QUIT Ta \&^\e\e Ql \&\e34
+.It Dv VSUSP Ta SUSP Ta \&^Z
+.It Dv VDSUSP Ta DSUSP Ta \&^Y
+.It Dv VSTART Ta START Ta \&^Q
+.It Dv VSTOP Ta STOP Ta \&^S
+.It Dv VLNEXT Ta LNEXT Ta \&^V
+.It Dv VDISCARD Ta DISCARD Ta \&^O
+.It Dv VMIN Ta --- Ta \&1
+.It Dv VTIME Ta --- Ta \&0
+.It Dv VSTATUS Ta STATUS Ta \&^T
+.El
+.Pp
+If the
+value of one of the changeable special control characters (see
+.Sx "Special Characters" )
+is
+.Dv {_POSIX_VDISABLE} ,
+that function is disabled; that is, no input
+data is recognized as the disabled special character.
+If
+.Dv ICANON
+is
+not set, the value of
+.Dv {_POSIX_VDISABLE}
+has no special meaning for the
+.Dv VMIN
+and
+.Dv VTIME
+entries of the
+.Fa c_cc
+array.
+.Pp
+The initial values of the flags and control characters
+after
+.Fn open
+is set according to
+the values in the header
+.In sys/ttydefaults.h .
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr tcgetsid 3 ,
+.Xr tcsendbreak 3 ,
+.Xr tcsetattr 3 ,
+.Xr tcsetsid 3 ,
+.Xr tty 4
diff --git a/share/man/man4/textdump.4 b/share/man/man4/textdump.4
new file mode 100644
index 000000000000..c104630e069c
--- /dev/null
+++ b/share/man/man4/textdump.4
@@ -0,0 +1,172 @@
+.\"
+.\" Copyright (c) 2007 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 24, 2008
+.Dt TEXTDUMP 4
+.Os
+.Sh NAME
+.Nm textdump
+.Nd textdump kernel dumping facility
+.Sh SYNOPSIS
+.Cd options KDB
+.Cd options DDB
+.Sh DESCRIPTION
+The
+.Nm
+facility allows the capture of kernel debugging information to disk in a
+human-readable rather than the machine-readable form normally used with
+kernel memory dumps and minidumps.
+This representation, while less complete in that it does not capture full
+kernel state, can provide debugging information in a more compact, portable,
+and persistent form than a traditional dump.
+By combining
+.Nm
+with other
+.Xr ddb 4
+facilities, such as scripting and output capture, detailed bug information
+can be captured in a fully automated manner.
+.Sh FORMAT
+.Nm
+data is stored in a dump partition in the same style as a regular memory
+dump, and will be automatically extracted by
+.Xr savecore 8
+if present on boot.
+.Pp
+.Nm
+files are stored in the
+.Xr tar 5
+format, and consist of one or more text files, each storing a particular type
+of debugging output.
+The following parts may be present:
+.Bl -tag -width version.txt
+.It Pa ddb.txt
+Captured
+.Xr ddb 4
+output, if the capture facility has been used.
+May be disabled by clearing the
+.Dv debug.ddb.textdump.do_ddb
+sysctl.
+.It Pa config.txt
+Kernel configuration, if
+.Cd options INCLUDE_CONFIG_FILE
+has been compiled into the kernel.
+May be disabled by clearing the
+.Dv debug.ddb.textdump.do_config
+sysctl.
+.It Pa msgbuf.txt
+Kernel message buffer, including recent console output if the capture
+facility has been used.
+May be disabled by clearing the
+.Dv debug.ddb.textdump.do_msgbuf
+sysctl.
+.It Pa panic.txt
+Kernel panic string, if the kernel panicked before the dump was generated.
+May be disabled by clearing the
+.Dv debug.ddb.textdump.do_panic
+sysctl.
+.It Pa version.txt
+Kernel version string.
+My be disabled by clearing the
+.Dv debug.ddb.textdump.do_version
+sysctl.
+.El
+.Pp
+Kernel textdumps may be extracted using
+.Xr tar 1 .
+.Sh CONFIGURATION
+The
+.Nm
+facility is enabled as part of the kernel debugger using
+.Cd options KDB
+and
+.Cd options DDB .
+By default, kernel dumps generated on panic or via explicit requests for a
+dump will be regular memory dumps; however, by using the
+.Ic textdump set
+command in
+.Xr ddb 4 ,
+or by setting the
+.Dv debug.ddb.textdump.pending
+sysctl to 1 using
+.Xr sysctl 8 ,
+it is possible to request that the next dump be a textdump.
+.Pp
+If at the
+.Xr ddb 4
+command line, the commands
+.Ic textdump set ,
+.Ic textdump status ,
+and
+.Ic textdump unset
+may be used to set, query, and clear the textdump pending flag.
+.Pp
+As with regular kernel dumps, a dump partition must be automatically or
+manually configured using
+.Xr dumpon 8 .
+.Sh EXAMPLES
+In the following example, the script
+.Dv kdb.enter.panic
+will run when the kernel debugger is entered as a result of a panic, enable
+output capture, dump several useful pieces of debugging information, and then
+invoke panic in order to force a kernel dump to be written out followed by a
+reboot:
+.Bd -literal -offset indent
+script kdb.enter.panic=textdump set; capture on; show allpcpu; bt;
+ ps; alltrace; show alllocks; call doadump; reset
+.Ed
+.Pp
+In the following example, the script
+.Dv kdb.enter.witness
+will run when the kernel debugger is entered as a result of a witness
+violation, printing lock-related information for the user:
+.Bd -literal -offset indent
+script kdb.enter.witness=show locks
+.Ed
+.Pp
+These scripts may also be configured using the
+.Xr ddb 8
+utility.
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr ddb 4 ,
+.Xr tar 5 ,
+.Xr ddb 8 ,
+.Xr dumpon 8 ,
+.Xr savecore 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+facility first appeared in
+.Fx 7.1 .
+.Sh AUTHORS
+The
+.Nm
+facility was created by
+.An Robert N. M. Watson .
diff --git a/share/man/man4/ti.4 b/share/man/man4/ti.4
new file mode 100644
index 000000000000..2ef606c30b23
--- /dev/null
+++ b/share/man/man4/ti.4
@@ -0,0 +1,425 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 14, 2011
+.Dt TI 4
+.Os
+.Sh NAME
+.Nm ti
+.Nd "Alteon Networks Tigon I and Tigon II Gigabit Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ti"
+.Cd "options TI_SF_BUF_JUMBO"
+.Cd "options TI_JUMBO_HDRSPLIT"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ti_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Gigabit Ethernet adapters based on
+the Alteon Networks Tigon Gigabit Ethernet controller chip.
+The Tigon
+contains an embedded R4000 CPU, gigabit MAC, dual DMA channels and
+a PCI interface unit.
+The Tigon II contains two R4000 CPUs and other
+refinements.
+Either chip can be used in either a 32-bit or 64-bit PCI
+slot.
+Communication with the chip is achieved via PCI shared memory
+and bus master DMA.
+The Tigon I and II support hardware multicast
+address filtering, VLAN tag extraction and insertion, and jumbo
+Ethernet frames sizes up to 9000 bytes.
+Note that the Tigon I chipset
+is no longer in active production: all new adapters should come equipped
+with Tigon II chipsets.
+.Pp
+While the Tigon chipset supports 10, 100 and 1000Mbps speeds, support for
+10 and 100Mbps speeds is only available on boards with the proper
+transceivers.
+Most adapters are only designed to work at 1000Mbps,
+however the driver should support those NICs that work at lower speeds
+as well.
+.Pp
+Support for jumbo frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit jumbo frames.
+Using jumbo frames can greatly improve performance for certain tasks,
+such as file transfers and data streaming.
+.Pp
+Header splitting support for Tigon 2 boards (this option has no effect for
+the Tigon 1) can be turned on with the
+.Dv TI_JUMBO_HDRSPLIT
+option.
+See
+.Xr zero_copy 9
+for more discussion on zero copy receive and header splitting.
+.Pp
+The
+.Nm
+driver uses UMA backed jumbo receive buffers, but can be configured
+to use
+.Xr sendfile 2
+buffer allocator.
+To turn on
+.Xr sendfile 2
+buffer allocator, use the
+.Dv TI_SF_BUF_JUMBO
+option.
+.Pp
+Support for vlans is also available using the
+.Xr vlan 4
+mechanism.
+See the
+.Xr vlan 4
+man page for more details.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 1000baseSX
+Set 1000Mbps (Gigabit Ethernet) operation.
+Only full
+.Ar full-duplex
+mode is supported at this speed.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Gigabit Ethernet adapters based on the
+Alteon Tigon I and II chips.
+The
+.Nm
+driver has been tested with the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c985-SX Gigabit Ethernet adapter (Tigon 1)
+.It
+3Com 3c985B-SX Gigabit Ethernet adapter (Tigon 2)
+.It
+Alteon AceNIC V Gigabit Ethernet adapter (1000baseSX)
+.It
+Alteon AceNIC V Gigabit Ethernet adapter (1000baseT)
+.It
+Digital EtherWORKS 1000SX PCI Gigabit adapter
+.It
+Netgear GA620 Gigabit Ethernet adapter (1000baseSX)
+.It
+Netgear GA620T Gigabit Ethernet adapter (1000baseT)
+.El
+.Pp
+The following adapters should also be supported but have
+not yet been tested:
+.Pp
+.Bl -bullet -compact
+.It
+Asante GigaNIX1000T Gigabit Ethernet adapter
+.It
+Asante PCI 1000BASE-SX Gigabit Ethernet adapter
+.It
+Farallon PN9000SX Gigabit Ethernet adapter
+.It
+NEC Gigabit Ethernet
+.It
+Silicon Graphics PCI Gigabit Ethernet adapter
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.ti.%d.dac
+If this tunable is set to 0 it will disable DAC (Dual Address Cycle).
+The default value is 1 which means driver will use full 64bit
+DMA addressing.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables.
+The interface has to be brought down and up again before a
+change takes effect when any of the following tunables are
+changed.
+The one microsecond clock tick referenced below is a nominal
+time and the actual hardware may not provide granularity to
+this level.
+For example, on Tigon 2 (revision 6) cards with release 12.0
+the clock granularity is 5 microseconds.
+.Bl -tag -width "xxxxxx"
+.It Va dev.ti.%d.rx_coal_ticks
+This value, receive coalesced ticks, controls the number of clock
+ticks (of 1 microseconds each) that must elapse before the NIC DMAs
+the receive return producer pointer to the Host and generates an
+interrupt.
+This parameter works in conjunction with the rx_max_coal_bds,
+receive max coalesced BDs, tunable parameter.
+The NIC will return the receive return producer pointer to the Host
+when either of the thresholds is exceeded.
+A value of 0 means that this parameter is ignored and receive BDs
+will only be returned when the receive max coalesced BDs value is
+reached.
+The default valus is 170.
+.It Va dev.ti.%d.rx_max_coal_bds
+This value, receive max coalesced BDs, controls the number of
+receive buffer descriptors that will be coalesced before the NIC
+updates the receive return ring producer index.
+If this value is set to 0 it will disable receive buffer descriptor
+coalescing.
+The default valus is 64.
+.It Va dev.ti.%d.ti_tx_coal_ticks
+This value, send coalesced ticks, controls the number of clock
+ticks (of 1 microseconds each) that must elapse before the NIC DMAs
+the send consumer pointer to the Host and generates an interrupt.
+This parameter works in conjunction with the tx_max_coal_bds,
+send max coalesced BDs, tunable parameter.
+The NIC will return the send consumer pointer to the Host when
+either of the thresholds is exceeded.
+A value of 0 means that this parameter is ignored and send BDs will
+only be returned when the send max coalesced BDs value is reached.
+The default value is 2000.
+.It Va dev.ti.%d.tx_max_coal_bds
+This value, send max coalesced BDs, controls the number of send
+buffer descriptors that will be coalesced before the NIC updates
+the send consumer index.
+If this valus is set to 0 it will disable send buffer descriptor
+coalescing.
+The default valus is 32.
+.It Va dev.ti.%d.tx_buf_ratio
+This value controls the ratio of the remaining memory in the NIC
+that should be devoted to transmit buffer vs. receive buffer.
+The lower 7 bits are used to indicate the ratio in 1/64th increments.
+For example, setting this value to 16 will set the transmit buffer
+to 1/4 of the remaining buffer space.
+In no cases will the transmit or receive buffer be reduced below
+68 KB.
+For a 1 MB NIC the approximate total space for data buffers is
+800 KB.
+For a 512 KB NIC that number is 300 KB.
+The default value is 21.
+.It Va dev.ti.%d.stat_ticks
+The value, stat ticks, controls the number of clock ticks
+(of 1 microseconds each) that must elapse before the NIC DMAs
+the statistics block to the Host and generates a STATS_UPDATED
+event.
+If set to zero then statistics are never DMAed to the Host.
+It is recommended that this value be set to a high enough
+frequency to not mislead someone reading statistics refreshes.
+Several times a second is enough.
+The default value is 2000000 (2 seconds).
+.El
+.Sh IOCTLS
+In addition to the standard
+.Xr socket 2
+.Xr ioctl 2
+calls implemented by most network drivers, the
+.Nm
+driver also includes a character device interface that can be used for
+additional diagnostics, configuration and debugging.
+With this character
+device interface, and a specially patched version of
+.Xr gdb 1 ,
+the user can
+debug firmware running on the Tigon board.
+.Pp
+These ioctls and their arguments are defined in the
+.In sys/tiio.h
+header file.
+.Bl -tag -width ".Dv ALT_WRITE_TG_MEM"
+.It Dv TIIOCGETSTATS
+Return card statistics DMAed from the card into kernel memory approximately
+every 2 seconds.
+(That time interval can be changed via the
+.Dv TIIOCSETPARAMS
+ioctl.)
+The argument is
+.Vt "struct ti_stats" .
+.It Dv TIIOCGETPARAMS
+Get various performance-related firmware parameters that largely affect how
+interrupts are coalesced.
+The argument is
+.Vt "struct ti_params" .
+.It Dv TIIOCSETPARAMS
+Set various performance-related firmware parameters that largely affect how
+interrupts are coalesced.
+The argument is
+.Vt "struct ti_params" .
+.It Dv TIIOCSETTRACE
+Tell the NIC to trace the requested types of information.
+The argument is
+.Vt ti_trace_type .
+.It Dv TIIOCGETTRACE
+Dump the trace buffer from the card.
+The argument is
+.Vt "struct ti_trace_buf" .
+.It Dv ALT_ATTACH
+This ioctl is used for compatibility with Alteon's Solaris driver.
+They apparently only have one character interface for debugging, so they have
+to tell it which Tigon instance they want to debug.
+This ioctl is a noop for
+.Fx .
+.It Dv ALT_READ_TG_MEM
+Read the requested memory region from the Tigon board.
+The argument is
+.Vt "struct tg_mem" .
+.It Dv ALT_WRITE_TG_MEM
+Write to the requested memory region on the Tigon board.
+The argument is
+.Vt "struct tg_mem" .
+.It Dv ALT_READ_TG_REG
+Read the requested register on the Tigon board.
+The argument is
+.Vt "struct tg_reg" .
+.It Dv ALT_WRITE_TG_REG
+Write to the requested register on the Tigon board.
+The argument is
+.Vt "struct tg_reg" .
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ti[0-255]" -compact
+.It Pa /dev/ti[0-255]
+Tigon driver character interface.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ti%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "ti%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "ti%d: no memory for softc struct!"
+The driver failed to allocate memory for per-device instance information
+during initialization.
+.It "ti%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "ti%d: no memory for jumbo buffers!"
+The driver failed to allocate memory for jumbo frames during
+initialization.
+.It "ti%d: bios thinks we're in a 64 bit slot, but we aren't"
+The BIOS has programmed the NIC as though it had been installed in
+a 64-bit PCI slot, but in fact the NIC is in a 32-bit slot.
+This happens
+as a result of a bug in some BIOSes.
+This can be worked around on the
+Tigon II, but on the Tigon I initialization will fail.
+.It "ti%d: board self-diagnostics failed!"
+The ROMFAIL bit in the CPU state register was set after system
+startup, indicating that the on-board NIC diagnostics failed.
+.It "ti%d: unknown hwrev"
+The driver detected a board with an unsupported hardware revision.
+The
+.Nm
+driver supports revision 4 (Tigon 1) and revision 6 (Tigon 2) chips
+and has firmware only for those devices.
+.It "ti%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr sendfile 2 ,
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8 ,
+.Xr zero_copy 9
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@bsdi.com .
+The header splitting firmware modifications, character
+.Xr ioctl 2
+interface and debugging support were written by
+.An Kenneth Merry Aq ken@FreeBSD.org .
+Initial zero copy support was written by
+.An Andrew Gallatin Aq gallatin@FreeBSD.org .
diff --git a/share/man/man4/timecounters.4 b/share/man/man4/timecounters.4
new file mode 100644
index 000000000000..b6fc85e8fd5f
--- /dev/null
+++ b/share/man/man4/timecounters.4
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 20, 2011
+.Dt TIMECOUNTERS 4
+.Os
+.Sh NAME
+.Nm timecounters
+.Nd kernel time counters subsystem
+.Sh SYNOPSIS
+Kernel uses several types of time-related devices, such as: real time clocks,
+time counters and event timers.
+Real time clocks responsible for tracking real world time, mostly when system
+is down.
+Time counters are responsible for tracking purposes, when system is running.
+Event timers are responsible for generating interrupts at specified time or
+periodically, to run different time-based events.
+This page is about the second.
+.Sh DESCRIPTION
+Time counters are the lowest level of time tracking in kernel.
+They provide monotonically increasing timestamps with known width and
+update frequency.
+They can overflow, drift, etc and so in raw form used only in very limited
+performance-critical places like process scheduler.
+.Pp
+More usable time is created by scaling the values read from the selected
+time counter and combining it with some offset, regularly updated by
+.Fn tc_windup
+on
+.Fn hardclock
+invocation.
+.Pp
+Different platforms provide different kinds of timer hardware.
+The goal of the time counters subsystem is to provide unified way to access
+that hardware.
+.Pp
+Each driver implementing time counters, registers them at the subsystem.
+It is possible to see the list of present time counters, like this, via
+.Va kern.timecounter
+sysctl:
+.Bd -literal
+kern.timecounter.choice: TSC-low(-100) HPET(950) i8254(0) ACPI-fast(900) dummy(-1000000)
+kern.timecounter.tc.ACPI-fast.mask: 16777215
+kern.timecounter.tc.ACPI-fast.counter: 13467909
+kern.timecounter.tc.ACPI-fast.frequency: 3579545
+kern.timecounter.tc.ACPI-fast.quality: 900
+kern.timecounter.tc.i8254.mask: 65535
+kern.timecounter.tc.i8254.counter: 62692
+kern.timecounter.tc.i8254.frequency: 1193182
+kern.timecounter.tc.i8254.quality: 0
+kern.timecounter.tc.HPET.mask: 4294967295
+kern.timecounter.tc.HPET.counter: 3013495652
+kern.timecounter.tc.HPET.frequency: 14318180
+kern.timecounter.tc.HPET.quality: 950
+kern.timecounter.tc.TSC-low.mask: 4294967295
+kern.timecounter.tc.TSC-low.counter: 4067509463
+kern.timecounter.tc.TSC-low.frequency: 11458556
+kern.timecounter.tc.TSC-low.quality: -100
+.Ed
+.Pp
+where:
+.Bl -inset
+.It Va kern.timecounter.tc. Ns Ar X Ns Va .mask
+is a bitmask, defining valid counter bits,
+.It Va kern.timecounter.tc. Ns Ar X Ns Va .counter
+is a present counter value,
+.It Va kern.timecounter.tc. Ns Ar X Ns Va .frequency
+is a counter update frequency,
+.It Va kern.timecounter.tc. Ns Ar X Ns Va .quality
+is an integral value, defining how good is this time counter,
+comparing to others.
+Negative value means that this time counter is broken and should not be used.
+.El
+.Pp
+Time management code of the kernel chooses one time counter from that list.
+Current choice can be read and affected via
+.Va kern.timecounter.hardware
+tunable/sysctl.
+.Sh SEE ALSO
+.Xr attimer 4 ,
+.Xr eventtimers 4 ,
+.Xr ffclock 4 ,
+.Xr hpet 4
diff --git a/share/man/man4/tl.4 b/share/man/man4/tl.4
new file mode 100644
index 000000000000..eb8351d49bff
--- /dev/null
+++ b/share/man/man4/tl.4
@@ -0,0 +1,185 @@
+.\" Copyright (c) 1997, 1998
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt TL 4
+.Os
+.Sh NAME
+.Nm tl
+.Nd "Texas Instruments ThunderLAN Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device tl"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_tl_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters based on the Texas
+Instruments ThunderLAN Ethernet controller chip.
+.Pp
+The ThunderLAN controller has a standard MII interface that supports
+up to 32 physical interface devices (PHYs).
+It also has a built-in
+10baseT PHY hardwired at MII address 31, which may be used in some
+10Mbps-only hardware configurations.
+In 100Mbps configurations, a
+National Semiconductor DP83840A or other MII-compliant PHY may be
+attached to the ThunderLAN's MII bus.
+If a DP83840A or equivalent
+is available, the ThunderLAN chip can operate at either 100Mbps or
+10Mbps in either half-duplex or full-duplex modes.
+The ThunderLAN's
+built-in PHY and the DP83840A also support autonegotiation.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+Note that this
+option is only available on those PHYs that support autonegotiation.
+Also, the PHY will not advertise those modes that have been explicitly
+disabled using the following media options.
+.It 10baseT/UTP
+Set 10Mbps operation
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation
+.It 10base5/AUI
+Enable AUI/BNC interface (useful only with the built-in PHY).
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.It hw-loopback
+Enable hardware loopback mode.
+.El
+.Pp
+Note that the 100baseTX media type is only available if supported
+by the PHY.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Texas Instruments ThunderLAN based
+Ethernet and Fast Ethernet adapters including a large
+number of Compaq PCI Ethernet adapters.
+Also supported are:
+.Pp
+.Bl -bullet -compact
+.It
+Olicom OC-2135/2138 10/100 TX UTP adapter
+.It
+Olicom OC-2325/OC-2326 10/100 TX UTP adapter
+.It
+Racore 8148 10baseT/100baseTX/100baseFX adapter
+.It
+Racore 8165 10/100baseTX adapter
+.El
+.Pp
+The
+.Nm
+driver also supports the built-in Ethernet adapters of
+various Compaq Prosignia servers and Compaq Deskpro desktop
+machines including:
+.Pp
+.Bl -bullet -compact
+.It
+Compaq Netelligent 10
+.It
+Compaq Netelligent 10 T PCI UTP/Coax
+.It
+Compaq Netelligent 10/100
+.It
+Compaq Netelligent 10/100 Dual-Port
+.It
+Compaq Netelligent 10/100 Proliant
+.It
+Compaq Netelligent 10/100 TX Embedded UTP
+.It
+Compaq Netelligent 10/100 TX UTP
+.It
+Compaq NetFlex 3P
+.It
+Compaq NetFlex 3P Integrated
+.It
+Compaq NetFlex 3P w/BNC
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "tl%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "tl%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "tl%d: device timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "tl%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "tl%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/share/man/man4/tnt4882.4 b/share/man/man4/tnt4882.4
new file mode 100644
index 000000000000..d95ff8981cf2
--- /dev/null
+++ b/share/man/man4/tnt4882.4
@@ -0,0 +1,55 @@
+.\" Copyright (c) 2010, Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 24, 2010
+.Dt TNT4882 4
+.Os
+.Sh NAME
+.Nm tnt4882
+.Nd National Instruments TNT4882A GPIB controller driver
+.Sh SYNOPSIS
+.Cd "device tnt4882"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for driving an IEEE-488 bus, also called
+IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
+Bus), or GPIB (General Purpose Instrument Bus).
+The driver supports National Instruments PCI GPIB cards using
+the TNT4882 bus interface chip.
+This chip emulates a NEC \(mcPD7210 controller IC as the main
+interface between the host computer and the instrument bus.
+.Sh SEE ALSO
+.Xr gpib 3 ,
+.Xr gpib 4 ,
+.Sh HISTORY
+The
+.Nm
+driver was written by Poul-Henning Kamp, and first appeared in
+.Fx 5.4 .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .
diff --git a/share/man/man4/tpm.4 b/share/man/man4/tpm.4
new file mode 100644
index 000000000000..897aa00fbb88
--- /dev/null
+++ b/share/man/man4/tpm.4
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright (c) 2010 Hans-Joerg Hoexer
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 15, 2010
+.Dt TPM 4
+.Os
+.Sh NAME
+.Nm tpm
+.Nd Trusted Platform Module
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device tpm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+tpm_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.tpm.0.at="isa"
+.Cd hint.tpm.0.maddr="0xfed40000"
+.Cd hint.tpm.0.msize="0x5000"
+.Cd hint.tpm.1.at="isa"
+.Cd hint.tpm.1.maddr="0xfed40000"
+.Cd hint.tpm.1.msize="0x1000"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various trusted platform modules (TPM) that can
+store cryptographic keys.
+.Pp
+Supported modules:
+.Pp
+.Bl -bullet -compact -offset indent
+.It
+Atmel 97SC3203
+.It
+Broadcom BCM0102
+.It
+Infineon IFX SLD 9630 TT 1.1 and IFX SLB 9635 TT 1.2
+.It
+Intel INTC0102
+.It
+Sinosun SNS SSX35
+.It
+STM ST19WP18
+.It
+Winbond WEC WPCT200
+.El
+.Pp
+The driver can be configured to use an IRQ by providing a free ISA
+interrupt vector in
+.Pa /boot/device.hints .
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr device.hints 5 ,
+.Xr config 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Michael Shalayeff
+and
+.An Hans-Joerg Hoexer .
diff --git a/share/man/man4/trm.4 b/share/man/man4/trm.4
new file mode 100644
index 000000000000..6180c9423d38
--- /dev/null
+++ b/share/man/man4/trm.4
@@ -0,0 +1,107 @@
+.\" $NetBSD: trm.4,v 1.3 2001/11/11 05:24:45 tsutsui Exp $
+.\"
+.\" Copyright (c) 2002, David E O'Brien. All rights reserved.
+.\" Copyright (c) 2001, Izumi Tsutsui. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 8, 2002
+.Dt TRM 4
+.Os
+.Sh NAME
+.Nm trm
+.Nd Tekram TRM-S1040 ASIC based PCI SCSI host adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device trm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+trm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports PCI SCSI host adapters based on the Tekram TRM-S1040 SCSI ASIC.
+.Sh HARDWARE
+SCSI controllers supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+.Tn Tekram DC-315
+PCI Ultra SCSI adapter without BIOS and internal SCSI connector
+.It
+.Tn Tekram DC-315U
+PCI Ultra SCSI adapter without BIOS
+.It
+.Tn Tekram DC-395F
+PCI Ultra-Wide SCSI adapter with flash BIOS and 68-pin external SCSI connector
+.It
+.Tn Tekram DC-395U
+PCI Ultra SCSI adapter with flash BIOS
+.It
+.Tn Tekram DC-395UW
+PCI Ultra-Wide SCSI adapter with flash BIOS
+.It
+.Tn Tekram DC-395U2W
+PCI Ultra2-Wide SCSI adapter with flash BIOS
+.El
+.Pp
+For the Tekram DC-310/U and DC-390F/U/UW/U2B/U2W/U3W PCI SCSI host adapters,
+use the
+.Xr sym 4
+driver.
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr ch 4 ,
+.Xr da 4 ,
+.Xr intro 4 ,
+.Xr sa 4 ,
+.Xr scsi 4 ,
+.Xr sym 4
+.Pp
+.Pa http://www.tekram.com/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was originally written for
+.Fx 3.0 Ns /i386
+by
+.An Erich Chen
+of Tekram Technology,
+and ported to
+.Fx 5.0
+by
+.An Olivier Houchard Aq cognet@FreeBSD.org .
diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4
new file mode 100644
index 000000000000..6e7c8527684f
--- /dev/null
+++ b/share/man/man4/tty.4
@@ -0,0 +1,371 @@
+.\" Copyright (c) 1991, 1992, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)tty.4 8.3 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd December 26, 2009
+.Dt TTY 4
+.Os
+.Sh NAME
+.Nm tty
+.Nd general terminal interface
+.Sh SYNOPSIS
+.In sys/ioctl.h
+.Sh DESCRIPTION
+This section describes the interface to the terminal drivers
+in the system.
+.Ss Terminal Special Files
+Each hardware terminal port on the system usually has a terminal special device
+file associated with it in the directory ``/dev/'' (for
+example, ``/dev/tty03'').
+When a user logs into
+the system on one of these hardware terminal ports, the system has already
+opened the associated device and prepared the line for normal interactive
+use (see
+.Xr getty 8 . )
+There is also a special case of a terminal file that connects not to
+a hardware terminal port, but to another program on the other side.
+These special terminal devices are called
+.Em ptys
+and provide the mechanism necessary to give users the same interface to the
+system when logging in over a network (using
+.Xr rlogin 1 ,
+or
+.Xr telnet 1
+for example).
+Even in these cases the details of how the terminal
+file was opened and set up is already handled by special software
+in the system.
+Thus, users do not normally need to worry about the details of
+how these lines are opened or used.
+Also, these lines are often used
+for dialing out of a system (through an out-calling modem), but again
+the system provides programs that hide the details of accessing
+these terminal special files (see
+.Xr tip 1 ) .
+.Pp
+When an interactive user logs in, the system prepares the line to
+behave in a certain way (called a
+.Em "line discipline" ) ,
+the particular details of which is described in
+.Xr stty 1
+at the command level, and in
+.Xr termios 4
+at the programming level.
+A user may be concerned with changing
+settings associated with his particular login terminal and should refer
+to the preceding man pages for the common cases.
+The remainder of this man page is concerned
+with describing details of using and controlling terminal devices
+at a low level, such as that possibly required by a program wishing
+to provide features similar to those provided by the system.
+.Ss Terminal File Operations
+All of the following operations are invoked using the
+.Xr ioctl 2
+system call.
+Refer to that man page for a description of the
+.Em request
+and
+.Em argp
+parameters.
+In addition to the ioctl
+.Em requests
+defined here, the specific line discipline
+in effect will define other
+.Em requests
+specific to it (actually
+.Xr termios 4
+defines them as function calls, not ioctl
+.Em requests . )
+The following section lists the available ioctl requests.
+The name of the request, a description of its purpose, and the typed
+.Em argp
+parameter (if any)
+are listed.
+For example, the first entry says
+.Pp
+.D1 Em "TIOCSPGRP int *tpgrp"
+.Pp
+and would be called on the terminal associated with
+file descriptor zero by the following code fragment:
+.Bd -literal
+ int pgrp;
+
+ pgrp = getpgrp();
+ ioctl(0, TIOCSPGRP, &pgrp);
+.Ed
+.Ss Terminal File Request Descriptions
+.Bl -tag -width TIOCGWINSZ
+.It Dv TIOCSETD Fa int *ldisc
+This call is obsolete but left for compatibility.
+Before
+.Fx 8.0 ,
+it would change to the new line discipline pointed to by
+.Fa ldisc .
+.Pp
+.It Dv TIOCGETD Fa int *ldisc
+Return the current line discipline in the integer pointed to by
+.Fa ldisc .
+.It Dv TIOCSBRK Fa void
+Set the terminal hardware into BREAK condition.
+.It Dv TIOCCBRK Fa void
+Clear the terminal hardware BREAK condition.
+.It Dv TIOCSDTR Fa void
+Assert data terminal ready (DTR).
+.It Dv TIOCCDTR Fa void
+Clear data terminal ready (DTR).
+.It Dv TIOCGPGRP Fa int *tpgrp
+Return the current process group with which the terminal is associated
+in the integer pointed to by
+.Fa tpgrp .
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcgetattr
+call.
+.It Dv TIOCSPGRP Fa int *tpgrp
+Associate the terminal with the process group (as an integer) pointed to by
+.Fa tpgrp .
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcsetattr
+call.
+.It Dv TIOCGETA Fa struct termios *term
+Place the current value of the termios state associated with the
+device in the termios structure pointed to by
+.Fa term .
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcgetattr
+call.
+.It Dv TIOCSETA Fa struct termios *term
+Set the termios state associated with the device immediately.
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcsetattr
+call with the
+.Dv TCSANOW
+option.
+.It Dv TIOCSETAW Fa struct termios *term
+First wait for any output to complete, then set the termios state
+associated with the device.
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcsetattr
+call with the
+.Dv TCSADRAIN
+option.
+.It Dv TIOCSETAF Fa struct termios *term
+First wait for any output to complete, clear any pending input,
+then set the termios state associated with the device.
+This is the underlying call that implements the
+.Xr termios 4
+.Fn tcsetattr
+call with the
+.Dv TCSAFLUSH
+option.
+.It Dv TIOCOUTQ Fa int *num
+Place the current number of characters in the output queue in the
+integer pointed to by
+.Fa num .
+.It Dv TIOCSTI Fa char *cp
+Simulate typed input.
+Pretend as if the terminal received the character pointed to by
+.Fa cp .
+.It Dv TIOCNOTTY Fa void
+This call is obsolete but left for compatibility.
+In the past, when a process that did not have a controlling terminal (see
+.Em The Controlling Terminal
+in
+.Xr termios 4 )
+first opened a terminal device, it acquired that terminal as its
+controlling terminal.
+For some programs this was a hazard as they
+did not want a controlling terminal in the first place, and this
+provided a mechanism to disassociate the controlling terminal from
+the calling process.
+It
+.Em must
+be called by opening the file
+.Pa /dev/tty
+and calling
+.Dv TIOCNOTTY
+on that file descriptor.
+.Pp
+The current system does not allocate a controlling terminal to
+a process on an
+.Fn open
+call: there is a specific ioctl called
+.Dv TIOCSCTTY
+to make a terminal the controlling
+terminal.
+In addition, a program can
+.Fn fork
+and call the
+.Fn setsid
+system call which will place the process into its own session - which
+has the effect of disassociating it from the controlling terminal.
+This is the new and preferred method for programs to lose their controlling
+terminal.
+.It Dv TIOCSTOP Fa void
+Stop output on the terminal (like typing ^S at the keyboard).
+.It Dv TIOCSTART Fa void
+Start output on the terminal (like typing ^Q at the keyboard).
+.It Dv TIOCSCTTY Fa void
+Make the terminal the controlling terminal for the process (the process
+must not currently have a controlling terminal).
+.It Dv TIOCDRAIN Fa void
+Wait until all output is drained.
+.It Dv TIOCEXCL Fa void
+Set exclusive use on the terminal.
+No further opens are permitted except by root.
+Of course, this means that programs that are run by
+root (or setuid) will not obey the exclusive setting - which limits
+the usefulness of this feature.
+.It Dv TIOCNXCL Fa void
+Clear exclusive use of the terminal.
+Further opens are permitted.
+.It Dv TIOCFLUSH Fa int *what
+If the value of the int pointed to by
+.Fa what
+contains the
+.Dv FREAD
+bit as defined in
+.In sys/file.h ,
+then all characters in the input queue are cleared.
+If it contains the
+.Dv FWRITE
+bit, then all characters in the output queue are cleared.
+If the value of the integer is zero, then it behaves as if both the
+.Dv FREAD
+and
+.Dv FWRITE
+bits were set (i.e., clears both queues).
+.It Dv TIOCGWINSZ Fa struct winsize *ws
+Put the window size information associated with the terminal in the
+.Va winsize
+structure pointed to by
+.Fa ws .
+The window size structure contains the number of rows and columns (and pixels
+if appropriate) of the devices attached to the terminal.
+It is set by user software
+and is the means by which most full\&-screen oriented programs determine the
+screen size.
+The
+.Va winsize
+structure is defined in
+.In sys/ioctl.h .
+.It Dv TIOCSWINSZ Fa struct winsize *ws
+Set the window size associated with the terminal to be the value in
+the
+.Va winsize
+structure pointed to by
+.Fa ws
+(see above).
+.It Dv TIOCCONS Fa int *on
+If
+.Fa on
+points to a non-zero integer, redirect kernel console output (kernel printf's)
+to this terminal.
+If
+.Fa on
+points to a zero integer, redirect kernel console output back to the normal
+console.
+This is usually used on workstations to redirect kernel messages
+to a particular window.
+.It Dv TIOCMSET Fa int *state
+The integer pointed to by
+.Fa state
+contains bits that correspond to modem state.
+Following is a list of defined variables and the modem state they represent:
+.Pp
+.Bl -tag -width TIOCMXCTS -compact
+.It TIOCM_LE
+Line Enable.
+.It TIOCM_DTR
+Data Terminal Ready.
+.It TIOCM_RTS
+Request To Send.
+.It TIOCM_ST
+Secondary Transmit.
+.It TIOCM_SR
+Secondary Receive.
+.It TIOCM_CTS
+Clear To Send.
+.It TIOCM_CAR
+Carrier Detect.
+.It TIOCM_CD
+Carrier Detect (synonym).
+.It TIOCM_RNG
+Ring Indication.
+.It TIOCM_RI
+Ring Indication (synonym).
+.It TIOCM_DSR
+Data Set Ready.
+.El
+.Pp
+This call sets the terminal modem state to that represented by
+.Fa state .
+Not all terminals may support this.
+.It Dv TIOCMGET Fa int *state
+Return the current state of the terminal modem lines as represented
+above in the integer pointed to by
+.Fa state .
+.It Dv TIOCMBIS Fa int *state
+The bits in the integer pointed to by
+.Fa state
+represent modem state as described above, however the state is OR-ed
+in with the current state.
+.It Dv TIOCMBIC Fa int *state
+The bits in the integer pointed to by
+.Fa state
+represent modem state as described above, however each bit which is on
+in
+.Fa state
+is cleared in the terminal.
+.El
+.Sh IMPLEMENTATION NOTES
+The total number of input and output bytes
+through all terminal devices
+are available via the
+.Va kern.tk_nin
+and
+.Va kern.tk_nout
+read-only
+.Xr sysctl 8
+variables.
+.Sh SEE ALSO
+.Xr stty 1 ,
+.Xr ioctl 2 ,
+.Xr ng_tty 4 ,
+.Xr pty 4 ,
+.Xr termios 4 ,
+.Xr getty 8
diff --git a/share/man/man4/tun.4 b/share/man/man4/tun.4
new file mode 100644
index 000000000000..b5139a7cdf0d
--- /dev/null
+++ b/share/man/man4/tun.4
@@ -0,0 +1,313 @@
+.\" $NetBSD: tun.4,v 1.1 1996/06/25 22:17:37 pk Exp $
+.\" $FreeBSD$
+.\" Based on PR#2411
+.\"
+.Dd February 4, 2007
+.Dt TUN 4
+.Os
+.Sh NAME
+.Nm tun
+.Nd tunnel software network interface
+.Sh SYNOPSIS
+.Cd device tun
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software loopback mechanism that can be loosely
+described as the network interface analog of the
+.Xr pty 4 ,
+that is,
+.Nm
+does for network interfaces what the
+.Xr pty 4
+driver does for terminals.
+.Pp
+The
+.Nm
+driver, like the
+.Xr pty 4
+driver, provides two interfaces: an interface like the usual facility
+it is simulating
+(a network interface in the case of
+.Nm ,
+or a terminal for
+.Xr pty 4 ) ,
+and a character-special device
+.Dq control
+interface.
+.Pp
+The network interfaces are named
+.Dq Li tun0 ,
+.Dq Li tun1 ,
+etc., one for each control device that has been opened.
+These network interfaces persist until the
+.Pa if_tun.ko
+module is unloaded, or until removed with the
+.Xr ifconfig 8
+command.
+.Pp
+.Nm
+devices are created using interface cloning.
+This is done using the
+.Dq ifconfig tun Ns Sy N No create
+command.
+This is the preferred method of creating
+.Nm
+devices.
+The same method allows removal of interfaces.
+For this, use the
+.Dq ifconfig tun Ns Sy N No destroy
+command.
+.Pp
+If the
+.Xr sysctl 8
+variable
+.Va net.link.tun.devfs_cloning
+is non-zero, the
+.Nm
+interface
+permits opens on the special control device
+.Pa /dev/tun .
+When this device is opened,
+.Nm
+will return a handle for the lowest unused
+.Nm
+device (use
+.Xr devname 3
+to determine which).
+.Pp
+.Bf Em
+Disabling the legacy devfs cloning functionality may break existing
+applications which use
+.Nm ,
+such as
+.Xr ppp 8
+and
+.Xr ssh 1 .
+It therefore defaults to being enabled until further notice.
+.Ef
+.Pp
+Control devices (once successfully opened) persist until
+.Pa if_tun.ko
+is unloaded in the same way that network interfaces persist (see above).
+.Pp
+Each interface supports the usual network-interface
+.Xr ioctl 2 Ns s ,
+such as
+.Dv SIOCAIFADDR
+and thus can be used with
+.Xr ifconfig 8
+like any other interface.
+At boot time, they are
+.Dv POINTOPOINT
+interfaces, but this can be changed; see the description of the control
+device, below.
+When the system chooses to transmit a packet on the
+network interface, the packet can be read from the control device
+(it appears as
+.Dq input
+there);
+writing a packet to the control device generates an input
+packet on the network interface, as if the (non-existent)
+hardware had just received it.
+.Pp
+The tunnel device
+.Pq Pa /dev/tun Ns Ar N
+is exclusive-open
+(it cannot be opened if it is already open).
+A
+.Xr read 2
+call will return an error
+.Pq Er EHOSTDOWN
+if the interface is not
+.Dq ready
+(which means that the control device is open and the interface's
+address has been set).
+.Pp
+Once the interface is ready,
+.Xr read 2
+will return a packet if one is available; if not, it will either block
+until one is or return
+.Er EWOULDBLOCK ,
+depending on whether non-blocking I/O has been enabled.
+If the packet is longer than is allowed for in the buffer passed to
+.Xr read 2 ,
+the extra data will be silently dropped.
+.Pp
+If the
+.Dv TUNSLMODE
+ioctl has been set, packets read from the control device will be prepended
+with the destination address as presented to the network interface output
+routine,
+.Fn tunoutput .
+The destination address is in
+.Vt struct sockaddr
+format.
+The actual length of the prepended address is in the member
+.Va sa_len .
+If the
+.Dv TUNSIFHEAD
+ioctl has been set, packets will be prepended with a four byte address
+family in network byte order.
+.Dv TUNSLMODE
+and
+.Dv TUNSIFHEAD
+are mutually exclusive.
+In any case, the packet data follows immediately.
+.Pp
+A
+.Xr write 2
+call passes a packet in to be
+.Dq received
+on the pseudo-interface.
+If the
+.Dv TUNSIFHEAD
+ioctl has been set, the address family must be prepended, otherwise the
+packet is assumed to be of type
+.Dv AF_INET .
+Each
+.Xr write 2
+call supplies exactly one packet; the packet length is taken from the
+amount of data provided to
+.Xr write 2
+(minus any supplied address family).
+Writes will not block; if the packet cannot be accepted for a
+transient reason
+(e.g., no buffer space available),
+it is silently dropped; if the reason is not transient
+(e.g., packet too large),
+an error is returned.
+.Pp
+The following
+.Xr ioctl 2
+calls are supported
+(defined in
+.In net/if_tun.h ) :
+.Bl -tag -width ".Dv TUNSIFMODE"
+.It Dv TUNSDEBUG
+The argument should be a pointer to an
+.Vt int ;
+this sets the internal debugging variable to that value.
+What, if anything, this variable controls is not documented here; see
+the source code.
+.It Dv TUNGDEBUG
+The argument should be a pointer to an
+.Vt int ;
+this stores the internal debugging variable's value into it.
+.It Dv TUNSIFINFO
+The argument should be a pointer to an
+.Vt struct tuninfo
+and allows setting the MTU, the type, and the baudrate of the tunnel
+device.
+The
+.Vt struct tuninfo
+is declared in
+.In net/if_tun.h .
+.Pp
+The use of this ioctl is restricted to the super-user.
+.It Dv TUNGIFINFO
+The argument should be a pointer to an
+.Vt struct tuninfo ,
+where the current MTU, type, and baudrate will be stored.
+.It Dv TUNSIFMODE
+The argument should be a pointer to an
+.Vt int ;
+its value must be either
+.Dv IFF_POINTOPOINT
+or
+.Dv IFF_BROADCAST
+and should have
+.Dv IFF_MULTICAST
+OR'd into the value if multicast support is required.
+The type of the corresponding
+.Dq Li tun Ns Ar N
+interface is set to the supplied type.
+If the value is outside the above range, an
+.Er EINVAL
+error is returned.
+The interface must be down at the time; if it is up, an
+.Er EBUSY
+error is returned.
+.It Dv TUNSLMODE
+The argument should be a pointer to an
+.Vt int ;
+a non-zero value turns off
+.Dq multi-af
+mode and turns on
+.Dq link-layer
+mode, causing packets read from the tunnel device to be prepended with
+the network destination address (see above).
+.It Dv TUNSIFPID
+Will set the pid owning the tunnel device to the current process's pid.
+.It Dv TUNSIFHEAD
+The argument should be a pointer to an
+.Vt int ;
+a non-zero value turns off
+.Dq link-layer
+mode, and enables
+.Dq multi-af
+mode, where every packet is preceded with a four byte address family.
+.It Dv TUNGIFHEAD
+The argument should be a pointer to an
+.Vt int ;
+the ioctl sets the value to one if the device is in
+.Dq multi-af
+mode, and zero otherwise.
+.It Dv FIONBIO
+Turn non-blocking I/O for reads off or on, according as the argument
+.Vt int Ns 's
+value is or is not zero.
+(Writes are always non-blocking.)
+.It Dv FIOASYNC
+Turn asynchronous I/O for reads
+(i.e., generation of
+.Dv SIGIO
+when data is available to be read)
+off or on, according as the argument
+.Vt int Ns 's
+value is or is not zero.
+.It Dv FIONREAD
+If any packets are queued to be read, store the size of the first one
+into the argument
+.Vt int ;
+otherwise, store zero.
+.It Dv TIOCSPGRP
+Set the process group to receive
+.Dv SIGIO
+signals, when asynchronous I/O is enabled, to the argument
+.Vt int
+value.
+.It Dv TIOCGPGRP
+Retrieve the process group value for
+.Dv SIGIO
+signals into the argument
+.Vt int
+value.
+.El
+.Pp
+The control device also supports
+.Xr select 2
+for read; selecting for write is pointless, and always succeeds, since
+writes are always non-blocking.
+.Pp
+On the last close of the data device, by default, the interface is
+brought down
+(as if with
+.Nm ifconfig Ar tunN Cm down ) .
+All queued packets are thrown away.
+If the interface is up when the data device is not open
+output packets are always thrown away rather than letting
+them pile up.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr read 2 ,
+.Xr select 2 ,
+.Xr write 2 ,
+.Xr devname 3 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr pty 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+This manual page was originally obtained from
+.Nx .
diff --git a/share/man/man4/twa.4 b/share/man/man4/twa.4
new file mode 100644
index 000000000000..32cccfc37e9d
--- /dev/null
+++ b/share/man/man4/twa.4
@@ -0,0 +1,135 @@
+.\"
+.\" Copyright (c) 2004 3ware, Inc.
+.\" Copyright (c) 2000 BSDi
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 9, 2007
+.Dt TWA 4
+.Os
+.Sh NAME
+.Nm twa
+.Nd 3ware 9000/9500/9550/9650 series SATA RAID controllers driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device twa"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+twa_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for AMCC's 3ware 9000/9500/9550/9650 series
+SATA controllers.
+.Pp
+These controllers are available in 4, 8, 12 or 16-port configurations,
+and support the following RAID levels: 0, 1, 10, 5, 50.
+The device nodes for the controllers are of the form
+.Pa /dev/twa Ns Ar X ,
+where
+.Ar X
+is the controller number.
+The driver is implemented as a SCSI SIM
+under CAM, and, as such, the logical units that it controls are accessible
+via the device nodes,
+.Pa /dev/da Ns Ar Y ,
+where
+.Ar Y
+is the logical unit number.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SATA RAID controllers:
+.Pp
+.Bl -bullet -compact
+.It
+AMCC's 3ware 9500S-4LP
+.It
+AMCC's 3ware 9500S-8
+.It
+AMCC's 3ware 9500S-8MI
+.It
+AMCC's 3ware 9500S-12
+.It
+AMCC's 3ware 9500S-12MI
+.It
+AMCC's 3ware 9500SX-4LP
+.It
+AMCC's 3ware 9500SX-8LP
+.It
+AMCC's 3ware 9500SX-12
+.It
+AMCC's 3ware 9500SX-12MI
+.It
+AMCC's 3ware 9500SX-16ML
+.It
+AMCC's 3ware 9550SX-4LP
+.It
+AMCC's 3ware 9550SX-8LP
+.It
+AMCC's 3ware 9550SX-12
+.It
+AMCC's 3ware 9550SX-12MI
+.It
+AMCC's 3ware 9550SX-16ML
+.It
+AMCC's 3ware 9650SE-2LP
+.It
+AMCC's 3ware 9650SE-4LPML
+.It
+AMCC's 3ware 9650SE-8LPML
+.It
+AMCC's 3ware 9650SE-12ML
+.It
+AMCC's 3ware 9650SE-16ML
+.It
+AMCC's 3ware 9650SE-24M8
+.El
+.Sh DIAGNOSTICS
+Whenever the driver encounters a command failure, it prints out an error code in
+the format:
+.Qq Li "ERROR: (<error source>: <error code>):" ,
+followed by a text description of the error.
+There are other error messages and warnings that the
+driver prints out, depending on the kinds of errors that it encounters.
+If the driver is compiled with
+.Dv TWA_DEBUG
+defined, it prints out a whole bunch of debug
+messages, the quantity of which varies depending on the value assigned to
+.Dv TWA_DEBUG
+(0 to 10).
+.Sh AUTHORS
+The
+.Nm
+driver and manpage were written by
+.An Vinod Kashyap Aq vkashyap@FreeBSD.org .
diff --git a/share/man/man4/twe.4 b/share/man/man4/twe.4
new file mode 100644
index 000000000000..fc73a012cb4e
--- /dev/null
+++ b/share/man/man4/twe.4
@@ -0,0 +1,278 @@
+.\"
+.\" Copyright (c) 2000 Michael Smith
+.\" Copyright (c) 2000 BSDi
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 15, 2004
+.Dt TWE 4
+.Os
+.Sh NAME
+.Nm twe
+.Nd 3ware 5000/6000/7000/8000 series PATA/SATA RAID adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device twe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+twe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for AMCC's 3ware 5000/6000/7000/8000 series
+PATA/SATA RAID adapters.
+These adapters were formerly known as
+.Dq 3ware Escalade .
+.Pp
+These devices support 2, 4, 8, or 12 ATA disk drives
+and provide RAID0 (striping) and RAID1 (mirroring) functionality.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following PATA/SATA RAID
+controllers:
+.Pp
+.Bl -bullet -compact
+.It
+AMCC's 3ware 5000 series
+.It
+AMCC's 3ware 6000 series
+.It
+AMCC's 3ware 7000-2
+.It
+AMCC's 3ware 7006-2
+.It
+AMCC's 3ware 7500-4LP
+.It
+AMCC's 3ware 7500-8
+.It
+AMCC's 3ware 7500-12
+.It
+AMCC's 3ware 7506-4LP
+.It
+AMCC's 3ware 7506-8
+.It
+AMCC's 3ware 7506-12
+.It
+AMCC's 3ware 8006-2LP
+.It
+AMCC's 3ware 8500-4LP
+.It
+AMCC's 3ware 8500-8
+.It
+AMCC's 3ware 8500-12
+.It
+AMCC's 3ware 8506-4LP
+.It
+AMCC's 3ware 8506-8
+.It
+AMCC's 3ware 8506-8MI
+.It
+AMCC's 3ware 8506-12
+.It
+AMCC's 3ware 8506-12MI
+.El
+.Sh DIAGNOSTICS
+.Ss Controller initialisation phase
+.Bl -diag
+.It twe%d: microcontroller not ready
+.Pp
+The controller's onboard CPU is not reporting that it is ready;
+this may be due to either a board or system failure.
+Initialisation has failed.
+.It twe%d: no attention interrupt
+.It twe%d: can't drain AEN queue
+.It twe%d: reset not reported
+.It twe%d: controller errors detected
+.It twe%d: can't drain response queue
+.It twe%d: reset %d failed, trying again
+.Pp
+The controller is not responding correctly to
+the driver's attempts to reset and initialise it.
+This process is retried several times.
+.It twe%d: can't initialise controller, giving up
+.Pp
+Several attempts to reset and initialise the controller have failed;
+initialisation has failed
+and the driver will not attach to this controller.
+.El
+.Ss Driver initialisation/shutdown phase
+.Bl -diag
+.It twe%d: register window not available
+.It twe%d: can't allocate register window
+.It twe%d: can't allocate parent DMA tag
+.It twe%d: can't allocate interrupt
+.It twe%d: can't set up interrupt
+.It twe%d: can't establish configuration hook
+.Pp
+A resource allocation error occurred while initialising the driver;
+initialisation has failed
+and the driver will not attach to this controller.
+.It twe%d: can't detect attached units
+.Pp
+Fetching the list of attached units failed; initialisation has failed.
+.It twe%d: error fetching capacity for unit %d
+.It twe%d: error fetching state for unit %d
+.It twe%d: error fetching descriptor size for unit %d
+.It twe%d: error fetching descriptor for unit %d
+.It twe%d: device_add_child failed
+.It twe%d: bus_generic_attach returned %d
+.Pp
+Creation of the disk devices failed, either due to communication
+problems with the adapter or due to resource shortage;
+attachment of one or more units may have been aborted.
+.El
+.Ss Operational phase
+.Bl -diag
+.It twe%d: command completed - %s
+.El
+.Pp
+A command was reported completed with a warning by the controller.
+The warning may be one of:
+.Bl -diag
+.It redundant/inconsequential request ignored
+.It failed to write zeroes to LBA 0
+.It failed to profile TwinStor zones
+.El
+.Bl -diag
+.It twe%d: command failed - %s
+.El
+.Pp
+A command was reported as failed by the controller.
+The failure message may be one of:
+.Bl -diag
+.It aborted due to system command or reconfiguration
+.It aborted
+.It access error
+.It access violation
+.It device failure
+.It controller error
+.It timed out
+.It invalid unit number
+.It unit not available
+.It undefined opcode
+.It request incompatible with unit
+.It invalid request
+.It firmware error, reset requested
+.Pp
+The command will be returned to the operating system after a
+fatal error.
+.El
+.Bl -diag
+.It twe%d: command failed submission - controller wedged
+.Pp
+A command could not be delivered to the controller because
+the controller is unresponsive.
+.It twe%d: AEN: <%s>
+.El
+.Pp
+The controller has reported a change in status using an AEN
+(Asynchronous Event Notification).
+The following AENs may be reported:
+.Bl -diag
+.It queue empty
+.It soft reset
+.It degraded mirror
+.It controller error
+.It rebuild fail
+.It rebuild done
+.It incomplete unit
+.It initialisation done
+.It unclean shutdown detected
+.It drive timeout
+.It drive error
+.It rebuild started
+.It aen queue full
+.Pp
+AENs are also queued internally for use by management tools.
+.El
+.Bl -diag
+.It twe%d: error polling for signalled AENs
+.Pp
+The controller has reported
+that one or more status messages are ready for the driver,
+but attempting to fetch one of these has returned an error.
+.It twe%d: AEN queue overflow, lost AEN <%s>
+.Pp
+A status message was retrieved from the controller,
+but there is no more room to queue it in the driver.
+The message is lost (but will be printed to the console).
+.It twe%d: missing expected status bits %s
+.It twe%d: unexpected status bits %s
+.Pp
+A check of the controller's status bits
+indicates an unexpected condition.
+.It twe%d: host interrupt
+.Pp
+The controller has signalled a host interrupt.
+This serves an unknown purpose and is ignored.
+.It twe%d: command interrupt
+.Pp
+The controller has signalled a command interrupt.
+This is not used, and will be disabled.
+.It twe%d: controller reset in progress...
+.Pp
+The controller is being reset by the driver.
+Typically this is done when the driver has determined that the
+controller is in an unrecoverable state.
+.It twe%d: can't reset controller, giving up
+.Pp
+The driver has given up on resetting the controller.
+No further I/O will be handled.
+.It controller reset done, %d commands restarted
+.Pp
+The controller was successfully reset,
+and outstanding commands were restarted.
+.El
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and manual page were written by
+.An Michael Smith
+.Aq msmith@FreeBSD.org .
+.Pp
+Extensive work done on the driver by
+.An Vinod Kashyap
+.Aq vkashyap@FreeBSD.org
+and
+.An Paul Saab
+.Aq ps@FreeBSD.org .
+.Sh BUGS
+The controller cannot handle I/O transfers
+that are not aligned to a 512-byte boundary.
+In order to support raw device access from user-space,
+the driver will perform alignment fixup on non-aligned data.
+This process is inefficient,
+and thus in order to obtain best performance
+user-space applications accessing the device
+should do so with aligned buffers.
diff --git a/share/man/man4/tws.4 b/share/man/man4/tws.4
new file mode 100644
index 000000000000..9ce154e1f265
--- /dev/null
+++ b/share/man/man4/tws.4
@@ -0,0 +1,118 @@
+.\"
+.\"Copyright (c) 2010, 2011 iXsystems, Inc.
+.\"All rights reserved.
+.\" written by: Xin LI <delphij@FreeBSD.org>
+.\"
+.\"Redistribution and use in source and binary forms, with or without
+.\"modification, are permitted provided that the following conditions
+.\"are met:
+.\"1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 4, 2011
+.Dt TWS 4
+.Os
+.Sh NAME
+.Nm tws
+.Nd 3ware 9750 SATA+SAS 6Gb/s RAID controller card driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device tws"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+tws_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for LSI's 3ware 9750 SATA+SAS 6Gb/s RAID controller cards.
+.Pp
+These controllers feature the LSISAS2108 6Gb/s SAS RAID-on-Chip (ROC)
+and are available in 4- and 8-port configurations, supports RAID levels
+0, 1, 5, 6, 10, 50 and single disk, with 96 SATA and/or SAS hard drives and SSDs.
+.Pp
+For further hardware information, see
+.Pa http://www.lsi.com/.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following SATA/SAS RAID controller:
+.Pp
+.Bl -bullet -compact
+.It
+LSI's 3ware SAS 9750 series
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "hw.tws.use_32bit_sgls"
+.It Va hw.tws.cam_depth
+The maximium queued CAM SIM requests for one controller.
+The default value is 256.
+.It Va hw.tws.enable_msi
+This tunable enables MSI support on the controller if set to a non-zero value.
+The default value is 0.
+.It Va hw.tws.queue_depth
+The maximium queued requests for one controller.
+.It Va hw.tws.use_32bit_sgls
+Limit the driver to use only 32-bit SG elements regardless whether the operating
+system is running in 64-bit mode.
+The default value is 0.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/tws?" -compact
+.It Pa /dev/da?
+array/logical disk interface
+.It Pa /dev/tws?
+management interface
+.El
+.Sh DIAGNOSTICS
+Whenever the driver encounters a command failure, it prints out an error code in
+the format:
+.Qq Li "ERROR: (<error source>: <error code>):" ,
+followed by a text description of the error.
+There are other error messages and warnings that the
+driver prints out, depending on the kinds of errors that it encounters.
+If the driver is compiled with
+.Dv TWS_DEBUG
+defined, it prints out a whole bunch of debug
+messages.
+.Sh SEE ALSO
+.Xr da 4 ,
+.Xr scsi 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Manjunath Ranganathaiah
+for LSI and this manual page was written by
+.An Xin LI Aq delphij@FreeBSD.org
+for iXsystems, Inc.
diff --git a/share/man/man4/tx.4 b/share/man/man4/tx.4
new file mode 100644
index 000000000000..2f7ea5986195
--- /dev/null
+++ b/share/man/man4/tx.4
@@ -0,0 +1,120 @@
+.\"
+.\" Copyright (c) 1998-2001 Semen Ustimenko <semenu@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt TX 4
+.Os
+.Sh NAME
+.Nm tx
+.Nd "SMC 83c17x Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device tx"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_tx_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Ethernet adapters based on the
+SMC 83c17x (EPIC) chips.
+These are mostly SMC 9432 series cards.
+.Pp
+The
+.Nm
+driver supports the following media types (depending on card's capabilities):
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autonegotiation (default).
+.It Cm 100baseFX
+Set 100Mbps (Fast Ethernet) fiber optic operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) twisted pair operation.
+.It Cm 10baseT/UTP
+Set 10Mbps on 10baseT port.
+.It Cm 10base2/BNC
+Set 10Mbps on 10base2 port.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Set full-duplex operation.
+.El
+.Pp
+The
+.Nm
+driver supports oversized Ethernet packets (up to 1600 bytes).
+Refer to the
+.Xr ifconfig 8
+man page on setting the interface's MTU.
+.Pp
+The old
+.Dq Li "ifconfig tx0 linkN"
+method of configuration is not supported.
+.Ss "VLAN (IEEE 802.1Q) support"
+The
+.Nm
+driver supports the VLAN operation (using
+.Xr vlan 4
+interfaces) without decreasing the MTU on the
+.Xr vlan 4
+interfaces.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "tx%d: device timeout %d packets"
+The device stops responding.
+Device and driver reset follows this error.
+.It "tx%d: PCI fatal error occurred (%s)"
+One of following errors occurred: PCI Target Abort, PCI Master Abort, Data
+Parity Error or Address Parity Error.
+Device and driver reset follows this error.
+.It "tx%d: cannot allocate mbuf header/cluster"
+Cannot allocate memory for received packet.
+Packet thrown away.
+.It "tx%d: can't stop %s DMA"
+While resetting, the driver failed to stop the device correctly.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh BUGS
+The auto-negotiation does not work very well.
diff --git a/share/man/man4/txp.4 b/share/man/man4/txp.4
new file mode 100644
index 000000000000..e30f8b7bf84b
--- /dev/null
+++ b/share/man/man4/txp.4
@@ -0,0 +1,140 @@
+.\" $OpenBSD: txp.4,v 1.8 2001/06/26 02:09:11 pjanzen Exp $
+.\"
+.\" Copyright (c) 2001 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 26, 2012
+.Dt TXP 4
+.Os
+.Sh NAME
+.Nm txp
+.Nd "3Com 3XP Typhoon/Sidewinder (3CR990) Ethernet interface"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device txp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_txp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+interface provides access to the 10Mb/s and 100Mb/s Ethernet networks via the
+.Tn 3Com
+.Tn Typhoon/Sidewinder
+chipset.
+.Pp
+Basic Ethernet functions are provided as well as support for
+.Xr vlan 4
+tag removal and insertion assistance, receive
+.Xr ip 4 ,
+.Xr tcp 4 ,
+and
+.Xr udp 4
+checksum offloading,
+and
+transmit
+.Xr ip 4
+checksum offloading.
+There is currently no support for
+transmit
+.Xr tcp 4
+or
+.Xr udp 4
+checksum offloading,
+.Xr tcp 4
+segmentation, nor
+.Xr ipsec 4
+acceleration.
+.Pp
+When a
+.Nm
+interface is brought up, by default, it will attempt to auto-negotiate the
+link speed and duplex mode.
+The speeds, in order of attempt, are:
+100Mb/s Full Duplex, 100Mb/s Half Duplex, 10 Mb/s Full Duplex, and
+10 Mb/s Half Duplex.
+.Pp
+The
+.Nm
+supports several media types, which are selected via the
+.Xr ifconfig 8
+command.
+The supported media types are:
+.Bl -tag -width indent
+.It Cm media autoselect
+Attempt to autoselect the media type (default)
+.It Cm media 100baseTX mediaopt full-duplex
+Use 100baseTX, full duplex
+.It Cm media 100baseTX Op Cm mediaopt half-duplex
+Use 100baseTX, half duplex
+.It Cm media 10baseT mediaopt full-duplex
+Use 10baseT, full duplex
+.It Cm media 10baseT Op Cm mediaopt half-duplex
+Use 10baseT, half duplex
+.El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+3Com 3CR990-TX-95
+.It
+3Com 3CR990-TX-97
+.It
+3Com 3cR990B-TXM
+.It
+3Com 3CR990SVR95
+.It
+3Com 3CR990SVR97
+.It
+3Com 3cR990B-SRV
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ip 4 ,
+.Xr miibus 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 2.9 .
diff --git a/share/man/man4/u3g.4 b/share/man/man4/u3g.4
new file mode 100644
index 000000000000..db560441bedc
--- /dev/null
+++ b/share/man/man4/u3g.4
@@ -0,0 +1,119 @@
+.\"
+.\" Copyright (c) 2008 AnyWi Technologies
+.\" All rights reserved.
+.\"
+.\" This code is derived from uark.c
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt U3G 4
+.Os
+.Sh NAME
+.Nm u3g
+.Nd USB support for 3G datacards
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device u3g"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+u3g_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the multiple USB-to-serial interfaces exposed by
+many 3G USB/PCCard modems.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Option GT 3G Fusion, GT Fusion Quad, etc. (only 3G part, not WLAN)
+.It
+Option GT 3G, GT 3G Quad, etc.
+.It
+Vodafone Mobile Connect Card 3G
+.It
+Vodafone Mobile Broadband K3772-Z
+.It
+Qualcomm Inc. CDMA MSM
+.It
+Huawei B190, E180v, E220 ('<Huawei Mobile>')
+.It
+Novatel U740, MC950D, X950D, etc.
+.It
+Sierra MC875U, MC8775U, etc.
+.El
+.Pp
+(See
+.Pa /sys/dev/usb/serial/u3g.c
+for the complete list of supported cards for each vendor
+mentioned above.)
+.Pp
+The supported 3G cards provide the necessary modem port for ppp, or mpd
+connections as well as extra ports (depending on the specific device) to
+provide other functions (additional command port, diagnostic port, SIM toolkit
+port).
+.Pp
+In some of these devices a mass storage device supported by the
+.Xr umass 4
+driver is present which contains Windows and Mac OS X drivers.
+The device starts up in disk mode (TruInstall, ZeroCD, etc.) and requires
+additional commands to switch it to modem mode. If your device is not
+switching automatically, please try to add quirks. See
+.Xr usbconfig 8
+and
+.Xr usb_quirk 4 .
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4 ,
+.Xr usb_quirk 4 ,
+.Xr usbconfig 8
+.Sh HISTORY
+The
+.Nm
+driver appeared in
+.Fx 7.2 ,
+is based on the
+.Xr uark 4
+driver, and written by
+.An Andrea Guzzo Aq aguzzo@anywi.com
+in September 2008.
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Andrea Guzzo Aq aguzzo@anywi.com
+and
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
+Hardware for testing was provided by AnyWi Technologies, Leiden, NL.
diff --git a/share/man/man4/uark.4 b/share/man/man4/uark.4
new file mode 100644
index 000000000000..a4e2e5664f50
--- /dev/null
+++ b/share/man/man4/uark.4
@@ -0,0 +1,85 @@
+.\" $OpenBSD: uark.4,v 1.3 2006/10/26 19:42:36 jmc Exp $
+.\"
+.\" Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UARK 4
+.Os
+.Sh NAME
+.Nm uark
+.Nd Arkmicro Technologies ARK3116 based USB serial adapter
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uark"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uark_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Arkmicro Technologies ARK3116 based serial adapters.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+HL USB-RS232
+.It
+HugePine USB-UART
+.It
+KQ-U8A Data Cable
+.It
+Skymaster USB to RS232
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 4.0 .
+The first
+.Fx
+release to include it was
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Jonathan Gray
+.Aq jsg@openbsd.org .
+.Sh CAVEATS
+Setting hardware flow control is not currently supported.
+It is not yet known how to ask the hardware to send a break.
+.Pp
+Arkmicro Technologies do not reply to requests of documentation
+for their products.
diff --git a/share/man/man4/uart.4 b/share/man/man4/uart.4
new file mode 100644
index 000000000000..644c37dfb55e
--- /dev/null
+++ b/share/man/man4/uart.4
@@ -0,0 +1,181 @@
+.\"
+.\" Copyright (c) 2003 Marcel Moolenaar
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 12, 2008
+.Dt UART 4
+.Os
+.Sh NAME
+.Nm uart
+.Nd driver for Universal Asynchronous Receiver/Transmitter (UART) devices
+.Sh SYNOPSIS
+.Cd "device uart"
+.Pp
+.Cd "device puc"
+.Cd "device uart"
+.Pp
+.Cd "device scc"
+.Cd "device uart"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.uart.0.disabled="1"
+.Cd hint.uart.0.baud="38400"
+.Cd hint.uart.0.port="0x3f8"
+.Cd hint.uart.0.flags="0x10"
+.Pp
+With
+.Ar flags
+encoded as:
+.Bl -tag -compact -width 0x000000
+.It 0x00010
+device is potential system console
+.It 0x00080
+use this port for remote kernel debugging
+.It 0x00100
+set RX FIFO trigger level to ``low'' (NS8250 only)
+.It 0x00200
+set RX FIFO trigger level to ``medium low'' (NS8250 only)
+.It 0x00400
+set RX FIFO trigger level to ``medium high'' (default, NS8250 only)
+.It 0x00800
+set RX FIFO trigger level to ``high'' (NS8250 only)
+.El
+.\"
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for various classes of UARTs implementing the
+EIA RS-232C (CCITT V.24) serial communications interface.
+Each such interface is controlled by a separate and independent instance of
+the
+.Nm
+driver.
+The primary support for devices that contain multiple serial interfaces or
+that contain other functionality besides one or more serial interfaces is
+provided by the
+.Xr puc 4 ,
+or
+.Xr scc 4
+device drivers.
+However, the serial interfaces of those devices that are managed by the
+.Xr puc 4 ,
+or
+.Xr scc 4
+driver are each independently controlled by the
+.Nm
+driver.
+As such, the
+.Xr puc 4 ,
+or
+.Xr scc 4
+driver provides umbrella functionality for the
+.Nm
+driver and hides the complexities that are inherent when elementary components
+are packaged together.
+.Pp
+The
+.Nm
+driver has a modular design to allow it to be used on differing hardware and
+for various purposes.
+In the following sections the components are discussed in detail.
+Options are described in the section that covers the component to which each
+option applies.
+.\"
+.Ss CORE COMPONENT
+At the heart of the
+.Nm
+driver is the core component.
+It contains the bus attachments and the low-level interrupt handler.
+.\"
+.Ss HARDWARE DRIVERS
+The core component and the kernel interfaces talk to the hardware through the
+hardware interface.
+This interface serves as an abstraction of the hardware and allows varying
+UARTs to be used for serial communications.
+.\"
+.Ss SYSTEM DEVICES
+System devices are UARTs that have a special purpose by way of hardware
+design or software setup.
+For example, Sun UltraSparc machines use UARTs as their keyboard interface.
+Such an UART cannot be used for general purpose communications.
+Likewise, when the kernel is configured for a serial console, the
+corresponding UART will in turn be a system device so that the kernel can
+output boot messages early on in the boot process.
+.\"
+.Ss KERNEL INTERFACES
+The last but not least of the components is the kernel interface.
+This component ultimately determines how the UART is made visible to the
+kernel in particular and to users in general.
+The default kernel interface is the TTY interface.
+This allows the UART to be used for terminals, modems and serial line IP
+applications.
+System devices, with the notable exception of serial consoles, generally
+have specialized kernel interfaces.
+.\"
+.Sh HARDWARE
+The
+.Nm
+driver supports the following classes of UARTs:
+.Pp
+.Bl -bullet -compact
+.It
+NS8250: standard hardware based on the 8250, 16450, 16550, 16650, 16750 or
+the 16950 UARTs.
+.It
+SCC: serial communications controllers supported by the
+.Xr scc 4
+device driver.
+.El
+.\"
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ttyu?.init" -compact
+.It Pa /dev/ttyu?
+for callin ports
+.It Pa /dev/ttyu?.init
+.It Pa /dev/ttyu?.lock
+corresponding callin initial-state and lock-state devices
+.Pp
+.It Pa /dev/cuau?
+for callout ports
+.It Pa /dev/cuau?.init
+.It Pa /dev/cuau?.lock
+corresponding callout initial-state and lock-state devices
+.El
+.Sh SEE ALSO
+.Xr puc 4 ,
+.Xr scc 4
+.\"
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.2 .
+.Sh AUTHORS
+The
+.Nm
+device driver and this manual page were written by
+.An Marcel Moolenaar Aq marcel@xcllnt.net .
diff --git a/share/man/man4/uath.4 b/share/man/man4/uath.4
new file mode 100644
index 000000000000..e93094e4148d
--- /dev/null
+++ b/share/man/man4/uath.4
@@ -0,0 +1,187 @@
+.\"
+.\" Copyright (c) 2006
+.\" Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 7, 2009
+.Dt UATH 4
+.Os
+.Sh NAME
+.Nm uath
+.Nd Atheros USB IEEE 802.11a/b/g wireless network device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device uath"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_uath_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports USB 2.0 wireless network devices based on Atheros
+Communications fifth generation AR5005UG and AR5005UX chipsets.
+.Pp
+The AR5005UG chipset is made of an AR5523 multiprotocol MAC/baseband processor
+and an AR2112 Radio-on-a-Chip that can operate between 2300 and 2500 MHz
+(802.11b/g).
+.Pp
+The AR5005UX chipset is made of an AR5523 multiprotocol MAC/baseband processor
+and an AR5112 dual band Radio-on-a-Chip that can operate between 2300 and
+2500 MHz (802.11b/g) or 4900 and 5850 MHz (802.11a).
+.Pp
+The AR5005UG and AR5005UX chipsets both have an integrated 32-bit MIPS
+R4000-class processor that runs a firmware and manages, among other things,
+the automatic control of the transmit rate and the calibration of the radio.
+.Pp
+.Nm
+supports
+.Cm station ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh FIRMWARE
+.Nm
+requires firmware that is downloaded to the device.
+This is normally done by the
+.Xr uathload 8
+utility that is launched by
+.Xr devd 8
+when the device is inserted.
+.Xr uathload
+includes the firmware in the binary program.
+This firmware is licensed for general use and is included in the base system.
+.Sh HARDWARE
+The
+.Nm
+driver should work with the following adapters:
+.Bl -column "TRENDware International TEW-444UB" "AR5005UX"
+.It Em "Adapter" Ta Em "Chipset"
+.\".It Belkin F6D3050 AR5005UX
+.It Li "Compex WLU108AG" Ta AR5005UX
+.It Li "Compex WLU108G" Ta AR5005UG
+.\".It Li "D-Link DWL-AG132" Ta AR5005UX
+.It Li "D-Link DWL-G132" Ta AR5005UG
+.\".It Li "Edimax EW-7315Ug" Ta AR5005UG (AR2414???)
+.\".It Li "Lancom USB-54ag" Ta AR5005UX
+.\".It Li "NEC WL54TU" Ta AR5005UX
+.It Li "IODATA WN-G54/US" Ta AR5005UG
+.It Li "MELCO WLI-U2-KAMG54" Ta AR5005UX
+.It Li "Netgear WG111T" Ta AR5005UG
+.It Li "Netgear WG111U" Ta AR5005UX
+.It Li "Netgear WPN111" Ta AR5005UG
+.It Li "Olitec 000544" Ta AR5005UG
+.It Li "PLANET WDL-U357" Ta AR5005UX
+.\".It Li "Senao WUB-8004" Ta AR5005UX
+.It Li "Siemens Gigaset 108" Ta AR5005UG
+.It Li "SMC SMCWUSBT-G" Ta AR5005UG
+.It Li "SMC SMCWUSBT-G2" Ta AR5005UG
+.\".It Li "SparkLAN WL-685GS" Ta AR5005UG
+.It Li "SparkLAN WL-785A" Ta AR5005UX
+.It Li "TP-Link TL-WN620G" Ta AR5005UG
+.It Li "TRENDware International TEW-444UB" Ta AR5005UG
+.It Li "TRENDware International TEW-504UB" Ta AR5005UX
+.It Li "Unex Technology UR054ag" Ta AR5005UX
+.\".It Li "Wistron NeWeb DCUA-81" Ta AR5005UX
+.\".It Li "Wistron NeWeb DRUA-81" Ta AR5005UG
+.\".It Li "Wistron NeWeb DRUA-82" Ta AR5005UX
+.\".It Li "ZyXEL G-200 v2" Ta AR5005UG
+.It Li "ZyXEL XtremeMIMO M-202" Ta AR5005UX
+.El
+.Pp
+An up to date list can be found at
+.Pa http://customerproducts.atheros.com/customerproducts/default.asp .
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev uath0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev uath0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev uath0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev uath0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "uath%d: could not send command (error=%s)"
+An attempt to send a command to the firmware failed.
+.It "uath%d: timeout waiting for command reply"
+A read command was sent to the firmware but the firmware failed to reply in
+time.
+.It "uath%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr devd 8 ,
+.Xr ifconfig 8 ,
+.Xr uathload 8 ,
+.Xr wpa_supplicant 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Weongyo Jeong Aq weongyo@FreeBSD.org
+and
+.An Sam Leffler Aq sam@FreeBSD.org .
+It is distantly related to a driver written by
+.An Damien Bergamini Aq damien@openbsd.org .
+.Sh CAVEATS
+Atheros proprietary 108 Mbps mode (aka Super AG mode) is not supported.
+.Pp
+Dual-band adapters are presently not working;
+to workaround, restriction operation to 2.4GHz channels.
diff --git a/share/man/man4/ubsa.4 b/share/man/man4/ubsa.4
new file mode 100644
index 000000000000..df9002cb9c4a
--- /dev/null
+++ b/share/man/man4/ubsa.4
@@ -0,0 +1,109 @@
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UBSA 4
+.Os
+.Sh NAME
+.Nm ubsa
+.Nd USB support for Belkin serial adapters
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device ubsa"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ubsa_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the USB-to-RS232 Bridge chip used by a variety of
+serial adapters from Belkin and other vendors.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+AnyData ADU-500A EV-DO modem
+.It
+AnyData ADU-E100A (no EV-DO mode support)
+.It
+Belkin F5U103
+.It
+Belkin F5U120
+.It
+e-Tek Labs Kwik232
+.It
+GoHubs GoCOM232
+.It
+Peracom single port serial adapter
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Fx 5.0 .
+The
+.Xr uplcom 4
+manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002 and modified for the
+.Nm
+driver by
+.An Alexander Kabaev Aq kan@FreeBSD.org
+in October 2002.
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Alexander Kabaev Aq kan@FreeBSD.org .
diff --git a/share/man/man4/ubsec.4 b/share/man/man4/ubsec.4
new file mode 100644
index 000000000000..4675da074026
--- /dev/null
+++ b/share/man/man4/ubsec.4
@@ -0,0 +1,123 @@
+.\" $OpenBSD: ubsec.4,v 1.25 2003/08/12 19:42:46 jason Exp $
+.\"
+.\" Copyright (c) 2000 Jason L. Wright (jason@thought.net)
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 16, 2009
+.Dt UBSEC 4
+.Os
+.Sh NAME
+.Nm ubsec
+.Nd Broadcom and BlueSteel uBsec 5x0x crypto accelerator
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device cryptodev"
+.Cd "device ubsec"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ubsec_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports cards containing Broadcom and BlueSteel uBsec 5x0x
+crypto accelerator chips.
+.Pp
+The
+.Nm
+driver registers itself to accelerate DES, Triple-DES, MD5-HMAC,
+and SHA1-HMAC operations for
+.Xr ipsec 4
+and
+.Xr crypto 4 .
+.Pp
+On those models which contain a public key engine (almost all of the
+more recent ones), this feature is registered with the
+.Xr crypto 4
+subsystem.
+.Pp
+On all models except the Bluesteel 5501 and Broadcom 5801, the driver
+registers itself to provide random data to the
+.Xr random 4
+subsystem.
+.Sh HARDWARE
+The
+.Nm
+driver supports cards containing any of the following chips:
+.Bl -tag -width "Broadcom BCM5822" -offset indent
+.It Bluesteel 5501
+The original chipset, no longer made.
+This extremely rare unit
+was not very fast, lacked an RNG, and had a number of other bugs.
+.It Bluesteel 5601
+A faster and fixed version of the original, with a random number
+unit and large number engine added.
+.It Broadcom BCM5801
+A BCM5805 without public key engine or random number generator.
+.It Broadcom BCM5802
+A slower version of the BCM5805.
+.It Broadcom BCM5805
+Faster version of Bluesteel 5601.
+.It Broadcom BCM5820
+64 bit version of the chip, and significantly more advanced.
+.It Broadcom BCM5821
+Faster version of the BCM5820.
+This is the chip found on the Sun Crypto Accelerator 1000.
+.It Broadcom BCM5822
+Faster version of the BCM5820.
+.It Broadcom BCM5823
+A BCM5822 with AES capability.
+.It Broadcom BCM5825
+Faster version of the BCM5823.
+.El
+.Sh SEE ALSO
+.Xr crypt 3 ,
+.Xr crypto 4 ,
+.Xr intro 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Ox 2.8 .
+The
+.Nm
+device driver was imported to
+.Fx 5.0 .
+.Sh BUGS
+The BCM5801 and BCM5802 have not actually been tested.
+The AES capability of the BCM5823 is not yet supported; it is awaiting
+public disclosure of programming information from Broadcom.
diff --git a/share/man/man4/ubser.4 b/share/man/man4/ubser.4
new file mode 100644
index 000000000000..556d4ec3a41e
--- /dev/null
+++ b/share/man/man4/ubser.4
@@ -0,0 +1,69 @@
+.\" Copyright (c) 2004 Bernd Walter <ticso@FreeBSD.org>
+.\"
+.\" $URL: https://devel.bwct.de/svn/projects/ubser/ubser.4 $
+.\" $Date: 2004-02-29 21:54:17 +0100 (Sun, 29 Feb 2004) $
+.\" $Author: ticso $
+.\" $Rev: 1130 $
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UBSER 4
+.Os
+.Sh NAME
+.Nm ubser
+.Nd USB support for BWCT console serial adapters
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device ubser"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ubser_load="YES"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the BWCT console management serial adapters.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ttyy??" -compact
+.It Pa /dev/ttyy??
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Fx 5.2 .
diff --git a/share/man/man4/ubtbcmfw.4 b/share/man/man4/ubtbcmfw.4
new file mode 100644
index 000000000000..8451c6f7a489
--- /dev/null
+++ b/share/man/man4/ubtbcmfw.4
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: ubtbcmfw.4,v 1.3 2003/05/21 19:37:35 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UBTBCMFW 4
+.Os
+.Sh NAME
+.Nm ubtbcmfw
+.Nd Firmware driver for Broadcom BCM2033 chip based Bluetooth USB devices
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ubtbcmfw"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ubtbcmfw_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+is a firmware driver for Broadcom BCM2033 chip based Bluetooth USB devices.
+It provides minimal access to the parts of the device required to download
+firmware.
+.Pp
+The
+.Nm
+driver creates three fixed endpoint device nodes.
+.Pp
+The control transfers can only happen on the control endpoint which
+is always endpoint 0.
+Control requests are issued by
+.Xr ioctl 2
+calls.
+.Pp
+Only incoming transfers are supported on an interrupt endpoint.
+To perform I/O on an interrupt endpoint,
+.Xr read 2
+should be used.
+All I/O operations on an interrupt endpoint are unbuffered.
+Interrupt endpoint is always endpoint 1.
+.Pp
+Only outgoing bulk transfers are supported on a bulk endpoint.
+To perform I/O on a bulk endpoint,
+.Xr write 2
+should be used.
+All I/O operations on a bulk endpoint are unbuffered.
+Outgoing bulk endpoint is always endpoint 2.
+.Pp
+The control endpoint (endpoint 0) handles the following
+.Xr ioctl 2
+calls:
+.Bl -tag -width indent
+.It Dv USB_GET_DEVICE_DESC Pq Vt usb_device_descriptor_t
+Return the device descriptor.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ubtbcmfw Ns Ar N Ns Pa \&. Ns Ar EE" -compact
+.It Pa /dev/ubtbcmfw Ns Ar N Ns Pa \&. Ns Ar EE
+Endpoint
+.Ar EE
+of device
+.Ar N .
+.El
+.Sh SEE ALSO
+.Xr ng_ubt 4 ,
+.Xr ugen 4 ,
+.Xr usb 4 ,
+.Xr bcmfw 8
+.Sh HISTORY
+The
+.Nm
+driver was implemented in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh BUGS
+Most likely.
+Please report if found.
diff --git a/share/man/man4/uchcom.4 b/share/man/man4/uchcom.4
new file mode 100644
index 000000000000..d7c0abc7659d
--- /dev/null
+++ b/share/man/man4/uchcom.4
@@ -0,0 +1,88 @@
+.\" $NetBSD: uchcom.4,v 1.2 2008/04/30 13:10:54 martin Exp $
+.\"
+.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Takuya SHIOZAKI (tshiozak@netbsd.org).
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UCHCOM 4
+.Os
+.Sh NAME
+.Nm uchcom
+.Nd WinChipHead CH341/CH340 serial adapter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uchcom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uchcom_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the WinChipHead CH341/CH340 USB-to-RS-232
+Bridge chip.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+HL USB-RS232
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx .
+The first
+.Fx
+release to include it was
+.Fx 8.0 .
+.Sh BUGS
+Actually, this chip seems unable to drive other than 8 data bits and
+1 stop bit line.
diff --git a/share/man/man4/ucom.4 b/share/man/man4/ucom.4
new file mode 100644
index 000000000000..8898872fab8c
--- /dev/null
+++ b/share/man/man4/ucom.4
@@ -0,0 +1,106 @@
+.\" $NetBSD: ucom.4,v 1.9 2002/03/22 00:39:40 augustss Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2008
+.Dt UCOM 4
+.Os
+.Sh NAME
+.Nm ucom
+.Nd USB tty support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ucom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ucom_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver attaches to USB modems, serial ports, and other devices that need
+to look like a tty.
+The
+.Nm
+driver shows a behavior like a
+.Xr tty 4 .
+This means that normal programs such as
+.Xr tip 1
+or
+.Xr ppp 8
+can be used to access the device.
+.Pp
+The
+.Va portno
+locater can be used to decide which port to use for devices that have
+multiple external ports.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/cuaU?"
+.It Pa /dev/cuaU?
+.It Pa /dev/ttyU?
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr uark 4 ,
+.Xr uchcom 4 ,
+.Xr uftdi 4 ,
+.Xr umcs 4 ,
+.Xr umct 4 ,
+.Xr umodem 4 ,
+.Xr uplcom 4 ,
+.Xr usb 4 ,
+.Xr uvisor 4 ,
+.Xr uvscom 4
+.Sh HISTORY
+The
+.Nm
+driver was adopted from
+.Nx
+in March of 2002.
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
+.Sh BUGS
+Prior to
+.Fx 6.0
+.Nm
+created
+.Pa /dev/ucom?
+rather than the uniform device names created today.
+Old scripts must be adjusted accordingly.
diff --git a/share/man/man4/ucycom.4 b/share/man/man4/ucycom.4
new file mode 100644
index 000000000000..063d419ccf60
--- /dev/null
+++ b/share/man/man4/ucycom.4
@@ -0,0 +1,87 @@
+.\"-
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UCYCOM 4
+.Os
+.Sh NAME
+.Nm ucycom
+.Nd device driver for Cypress CY7C63743 and CY7C64013 USB to RS232 bridges
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device ucycom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ucycom_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Cypress CY7C63743 and CY7C64013 bridge
+chips.
+These chips were designed to provide a low-cost transition path to USB
+for existing RS232 devices, and have fairly limited capabilities.
+.Pp
+The
+.Nm
+driver behaves like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver currently supports the following devices which incorporate
+Cypress USB to RS232 bridge chips:
+.Pp
+.Bl -bullet -compact
+.It
+DeLorme Earthmate USB GPS receiver
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
diff --git a/share/man/man4/udav.4 b/share/man/man4/udav.4
new file mode 100644
index 000000000000..d970143ac745
--- /dev/null
+++ b/share/man/man4/udav.4
@@ -0,0 +1,101 @@
+.\" $NetBSD$
+.\"
+.\" Copyright (c) 2003
+.\" Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Shingo WATANABE.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt UDAV 4
+.Os
+.Sh NAME
+.Nm udav
+.Nd "Davicom DM9601 USB Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device udav"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_udav_load="YES"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Corega FEther USB-TXC
+.It
+ShanTou ST268 USB NIC
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB
+.Tn Ethernet
+adapters based on the Davicom DM9601 chipset.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr usb 4 ,
+.Xr ifconfig 8
+.Rs
+.%T "Davicom DM9601 data sheet"
+.%U http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Nx 2.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Shingo WATANABE Aq nabe@nabechan.org .
diff --git a/share/man/man4/udbp.4 b/share/man/man4/udbp.4
new file mode 100644
index 000000000000..45afd790ae49
--- /dev/null
+++ b/share/man/man4/udbp.4
@@ -0,0 +1,124 @@
+.\" Copyright (c) 1999
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UDBP 4
+.Os
+.Sh NAME
+.Nm udbp
+.Nd USB Double Bulk Pipe driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device udbp"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+udbp_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for host-to-host cables
+that contain at least two bulk pipes (one for each direction),
+for example
+the EzLink cable and the NetChip 1080 chip.
+.Pp
+.\" XXX The description of how to add netgraph to the kernel
+.\" is out of place here. It should be limited to the
+.\" netgraph(4) manpage only. However, that page does
+.\" not yet give instructions for kldload(8) for the
+.\" clueless. Working on it -- sheldonh
+It requires
+.Xr netgraph 4
+to be available.
+This can be done either by adding
+.Cd "options NETGRAPH"
+to your kernel configuration file, or alternatively loading
+.Xr netgraph 4
+as a module, either from
+.Pa /boot/loader.conf
+or from the command line, before the
+.Nm
+module.
+.Sh EXAMPLES
+.Dl options NETGRAPH
+.Dl device udbp
+.Pp
+Add the
+.Nm
+driver to the kernel.
+.Pp
+.Dl kldload netgraph
+.Dl kldload udbp
+.Pp
+Load the
+.Xr netgraph 4
+module and then the
+.Nm
+driver.
+.Pp
+.Dl ngctl mkpeer udbp0: iface data inet
+.Dl ifconfig ng0 10.0.0.1 10.0.0.2
+.Pp
+Create a new network interface node
+and connect its inet hook to the data hook of the
+.Nm
+node.
+.Xr ifconfig 8
+configures the resulting network interface ng0 with a local
+IP address of 10.0.0.1 and a remote IP address of 10.0.0.2.
+On the remote host, the two
+IP addresses should of course be reversed.
+.Sh SEE ALSO
+.Xr netgraph 4 ,
+.Xr ng_iface 4 ,
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4 ,
+.Xr ngctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Doug Ambrisko Aq ambrisko@whistle.com ,
+.An Julian Elischer Aq julian@FreeBSD.org
+and
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
diff --git a/share/man/man4/udp.4 b/share/man/man4/udp.4
new file mode 100644
index 000000000000..03d6db2eef20
--- /dev/null
+++ b/share/man/man4/udp.4
@@ -0,0 +1,170 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)udp.4 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt UDP 4
+.Os
+.Sh NAME
+.Nm udp
+.Nd Internet User Datagram Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.Ft int
+.Fn socket AF_INET SOCK_DGRAM 0
+.Sh DESCRIPTION
+.Tn UDP
+is a simple, unreliable datagram protocol which is used
+to support the
+.Dv SOCK_DGRAM
+abstraction for the Internet
+protocol family.
+.Tn UDP
+sockets are connectionless, and are
+normally used with the
+.Xr sendto 2
+and
+.Xr recvfrom 2
+calls, though the
+.Xr connect 2
+call may also be used to fix the destination for future
+packets (in which case the
+.Xr recv 2
+or
+.Xr read 2
+and
+.Xr send 2
+or
+.Xr write 2
+system calls may be used).
+.Pp
+.Tn UDP
+address formats are identical to those used by
+.Tn TCP .
+In particular
+.Tn UDP
+provides a port identifier in addition
+to the normal Internet address format.
+Note that the
+.Tn UDP
+port
+space is separate from the
+.Tn TCP
+port space (i.e., a
+.Tn UDP
+port
+may not be
+.Dq connected
+to a
+.Tn TCP
+port).
+In addition broadcast
+packets may be sent (assuming the underlying network supports
+this) by using a reserved
+.Dq broadcast address ;
+this address
+is network interface dependent.
+.Pp
+Options at the
+.Tn IP
+transport level may be used with
+.Tn UDP ;
+see
+.Xr ip 4 .
+.Sh ERRORS
+A socket operation may fail with one of the following errors returned:
+.Bl -tag -width Er
+.It Bq Er EISCONN
+when trying to establish a connection on a socket which
+already has one, or when trying to send a datagram with the destination
+address specified and the socket is already connected;
+.It Bq Er ENOTCONN
+when trying to send a datagram, but
+no destination address is specified, and the socket has not been
+connected;
+.It Bq Er ENOBUFS
+when the system runs out of memory for
+an internal data structure;
+.It Bq Er EADDRINUSE
+when an attempt
+is made to create a socket with a port which has already been
+allocated;
+.It Bq Er EADDRNOTAVAIL
+when an attempt is made to create a
+socket with a network address for which no network interface
+exists.
+.El
+.Sh MIB VARIABLES
+The
+.Nm
+protocol implements a number of variables in the
+.Li net.inet
+branch of the
+.Xr sysctl 3
+MIB.
+.Bl -tag -width UDPCTL_RECVSPACEX
+.It UDPCTL_CHECKSUM
+.Pq udp.checksum
+Enable udp checksums (enabled by default).
+.It UDPCTL_MAXDGRAM
+.Pq udp.maxdgram
+Maximum outgoing UDP datagram size
+.It UDPCTL_RECVSPACE
+.Pq udp.recvspace
+Maximum space for incoming UDP datagrams
+.It udp.log_in_vain
+For all udp datagrams, to ports on which there is no socket
+listening, log the connection attempt (disabled by default).
+.It udp.blackhole
+When a datagram is received on a port where there is no socket
+listening, do not return an ICMP port unreachable message.
+(Disabled by default.
+See
+.Xr blackhole 4 . )
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr socket 2 ,
+.Xr blackhole 4 ,
+.Xr inet 4 ,
+.Xr intro 4 ,
+.Xr ip 4
+.Sh HISTORY
+The
+.Nm
+protocol appeared in
+.Bx 4.2 .
diff --git a/share/man/man4/uep.4 b/share/man/man4/uep.4
new file mode 100644
index 000000000000..74b65f37b233
--- /dev/null
+++ b/share/man/man4/uep.4
@@ -0,0 +1,79 @@
+.\" Copyright (c) 2010 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2010
+.Dt UEP 4
+.Os
+.Sh NAME
+.Nm uep
+.Nd eGalax touchscreen driver
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines into
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uep"
+.Cd "device usb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uep_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the eGalax onscreen touch panels.
+.Pp
+The driver is stub.
+It just probes and attaches to USB device, creates device entry
+and feeds reassembled packets from the hardware to it.
+.Pp
+To get mouse working in
+.Xr X 7 ,
+one needs to install
+.Pa ports/x11-drivers/xf86-input-egalax .
+.Sh FILES
+.Nm
+creates a blocking pseudo\-device file,
+.Pa /dev/uep0 .
+.Sh SEE ALSO
+.Xr usb 4 ,
+.Xr loader.conf 5 ,
+.Xr xorg.conf 5 Pq Pa ports/x11/xorg ,
+.Xr egalax 4 Pq Pa ports/x11-drivers/xf86-input-egalax .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
+.Sh BUGS
+.Nm
+can't act like
+.Xr sysmouse 4 ,
+since the latter does not support absolute motion events.
diff --git a/share/man/man4/ufm.4 b/share/man/man4/ufm.4
new file mode 100644
index 000000000000..7ae11bd6112c
--- /dev/null
+++ b/share/man/man4/ufm.4
@@ -0,0 +1,85 @@
+.\" Copyright (c) 2003 M. Warner Losh
+.\" <imp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UFM 4
+.Os
+.Sh NAME
+.Nm ufm
+.Nd USB driver for Cypress Semiconductor FM Radio
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ufm"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ufm_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the D-Link/GEMTEK FM tuner.
+The USB interface chip is the common Cypress 63001, and the tuner is a
+Philips TEA5757 radio chip that uses a serial interface to set the
+tuner parameters.
+This design is used in the D-Link DSB-R100 USB Radio.
+.Pp
+The
+.Nm
+device must be configured in the kernel, along with
+.Xr usb 4
+and one of the
+.Xr uhci 4
+or
+.Xr ohci 4
+controllers.
+.Pp
+Subsequently, the
+.Pa /dev/ufm0
+device can be used by userland applications.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ufm0" -compact
+.It Pa /dev/ufm0
+blocking device node
+.El
+.Sh SEE ALSO
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An M. Warner Losh Aq imp@FreeBSD.org
+for
+.Fx .
diff --git a/share/man/man4/ufoma.4 b/share/man/man4/ufoma.4
new file mode 100644
index 000000000000..19028d99eb03
--- /dev/null
+++ b/share/man/man4/ufoma.4
@@ -0,0 +1,141 @@
+.\" Copyright (c) 2006 Takanori Watanabe.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UFOMA 4
+.Os
+.Sh NAME
+.Nm ufoma
+.Nd USB mobile phone support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device ufoma"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ufoma_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB mobile phone terminals in the subset of
+the Mobile Computing Promotion Consortium USB Implementation Guideline,
+which is adopted by FOMA, the NTT DoCoMo 3G system, terminal.
+These are partly like CDC ACM model based modems, which are supported
+by
+.Xr umodem 4 ,
+but the
+.Nm
+driver recognizes a specific USB descriptor that describes its role and
+interface structure, and it will negotiate its role when the device is open.
+They support a regular AT command set and
+the commands can either be multiplexed with the data stream
+or handled through separate pipes.
+In the latter case the AT
+commands have to be given on a device separate from the data device.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh SYSCTLS
+These devices often have a few interface sets and these interfaces
+have their role, sometimes multiplexed.
+These roles are identified with the following sysctl MIBs:
+.Bl -tag -width indent
+.It Va dev.ucom.%d.supportmode
+The modes which are supported by the interface.
+.It Va dev.ucom.%d.currentmode
+Current mode of the interface.
+.It Va dev.ucom.%d.openmode
+Mode to transit when the device is open next.
+.El
+The modes are as follows:
+.Bl -tag -width indent
+.It Li modem
+Accepts AT commands and go and pass packet communication data.
+.It Li handsfree
+Accepts AT commands but it does not pass data.
+.It Li obex
+Accepts OBEX frame which is used to exchange telephone book, etc.
+.It Li vendor1 , vendor2
+Vendor specific data may be passed.
+.It Li deactivated
+When an interface is recognized by the system but not used, the interface
+will be set to this mode.
+.It Li unlinked
+When an interface is not yet negotiated, the interface is in this mode.
+.El
+.Sh HARDWARE
+Devices supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+SHARP FOMA SH902i
+.It
+KYOCERA PHS AH-K3001V (a.k.a Kyopon)
+.It
+SANYO Vodafone3G V801SA
+.El
+.Sh SEE ALSO
+Specification can be found at:
+.Pp
+.Bl -item -compact
+.It
+.Pa http://www.nttdocomo.co.jp/corporate/technology/document/foma/index.html
+.It
+.Pa http://www.mcpc-jp.org/doclist.htm
+.El
+.Pp
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr umodem 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Fx 7.0 ,
+partly derived from the
+.Xr umodem 4
+code.
+.Sh BUGS
+Interfaces with multiplexed commands and data and interfaces with
+commands only are supported.
diff --git a/share/man/man4/uftdi.4 b/share/man/man4/uftdi.4
new file mode 100644
index 000000000000..db75c68a6201
--- /dev/null
+++ b/share/man/man4/uftdi.4
@@ -0,0 +1,96 @@
+.\" $NetBSD: uftdi.4,v 1.5 2002/02/07 03:15:08 ross Exp $
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UFTDI 4
+.Os
+.Sh NAME
+.Nm uftdi
+.Nd USB support for serial adapters based on the FT8U100AX and FT8U232AM chips
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uftdi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uftdi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various serial adapters based on the FTDI
+FT2232C, FT8U100AX and FT8U232AM chips.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+B&B Electronics USB->RS422/485 adapter
+.It
+Elexol USB MOD1 and USB MOD3
+.It
+HP USB-Serial adapter shipped with some HP laptops
+.It
+Inland UAS111
+.It
+QVS USC-1000
+.It
+Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote
+.It
+Prologix GPIB-USB Controller
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Fx 4.8
+from
+.Nx 1.5 .
diff --git a/share/man/man4/ugen.4 b/share/man/man4/ugen.4
new file mode 100644
index 000000000000..9b149fb0062f
--- /dev/null
+++ b/share/man/man4/ugen.4
@@ -0,0 +1,321 @@
+.\" $NetBSD: ugen.4,v 1.13 2001/09/11 22:52:54 wiz Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UGEN 4
+.Os
+.Sh NAME
+.Nm ugen
+.Nd USB generic device support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ugen"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ugen_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all USB devices that do not have
+a special driver.
+It supports access to all parts of the device,
+but not in a way that is as convenient as a special purpose driver.
+.Pp
+There can be up to 127 USB devices connected to a USB bus.
+Each USB device can have up to 16 endpoints.
+Each of these endpoints
+will communicate in one of four different modes: control, isochronous,
+bulk, or interrupt.
+Each of the endpoints will have a different
+device node.
+The four least significant bits in the minor device
+number determines which endpoint the device accesses and the rest
+of the bits determines which USB device.
+.Pp
+If an endpoint address is used both for input and output the device
+can be opened for both read or write.
+.Pp
+To find out what endpoints that exist there are a series of
+.Xr ioctl 2
+operation on the control endpoint that returns the USB descriptors
+of the device, configurations, interfaces, and endpoints.
+.Pp
+The control transfer mode can only happen on the control endpoint
+which is always endpoint 0.
+The control endpoint accepts request
+and may respond with an answer to such request.
+Control request
+are issued by
+.Xr ioctl 2
+calls.
+.\" .Pp
+.\" The isochronous transfer mode can be in or out depending on the
+.\" endpoint.
+.\" To perform I/O on an isochronous endpoint
+.\" .Xr read 2
+.\" and
+.\" .Xr write 2
+.\" should be used.
+.\" Before any I/O operations can take place the transfer rate in
+.\" bytes/second has to be set.
+.\" This is done with
+.\" .Xr ioctl 2
+.\" .Dv USB_SET_ISO_RATE .
+.\" Performing this call sets up a buffer corresponding to
+.\" about 1 second of data.
+.Pp
+The bulk transfer mode can be in or out depending on the
+endpoint.
+To perform I/O on a bulk endpoint
+.Xr read 2
+and
+.Xr write 2
+should be used.
+All I/O operations on a bulk endpoint are unbuffered.
+.Pp
+The interrupt transfer mode can be in or out depending on the
+endpoint.
+To perform I/O on an interrupt endpoint
+.Xr read 2
+and
+.Xr write 2
+should be used.
+A moderate amount of buffering is done
+by the driver.
+.Pp
+All endpoints handle the following
+.Xr ioctl 2
+calls:
+.Bl -tag -width indent
+.It Dv USB_SET_SHORT_XFER Pq Vt int
+Allow short read transfer.
+Normally a transfer from the device
+which is shorter than the request specified is reported as an
+error.
+.It Dv USB_SET_TIMEOUT Pq Vt int
+Set the timeout on the device operations, the time is specified
+in milliseconds.
+The value 0 is used to indicate that there is
+no timeout.
+.El
+.Pp
+The control endpoint (endpoint 0) handles the following
+.Xr ioctl 2
+calls:
+.Bl -tag -width indent
+.It Dv USB_GET_CONFIG Pq Vt int
+Get the device configuration number.
+.It Dv USB_SET_CONFIG Pq Vt int
+Set the device into the given configuration number.
+.Pp
+This operation can only be performed when the control endpoint
+is the sole open endpoint.
+.It Dv USB_GET_ALTINTERFACE Pq Vt "struct usb_alt_interface"
+Get the alternative setting number for the interface with the given
+index.
+The
+.Va uai_config_index
+is ignored in this call.
+.Bd -literal
+struct usb_alt_interface {
+ int uai_config_index;
+ int uai_interface_index;
+ int uai_alt_no;
+};
+.Ed
+.It Dv USB_SET_ALTINTERFACE Pq Vt "struct usb_alt_interface"
+Set the alternative setting to the given number in the interface with the
+given index.
+The
+.Va uai_config_index
+is ignored in this call.
+.Pp
+This operation can only be performed when no endpoints for the interface
+are open.
+.It Dv USB_GET_NO_ALT Pq Vt "struct usb_alt_interface"
+Return the number of different alternate settings in the
+.Va uai_alt_no
+field.
+.It Dv USB_GET_DEVICE_DESC Pq Vt usb_device_descriptor_t
+Return the device descriptor.
+.It Dv USB_GET_CONFIG_DESC Pq Vt "struct usb_config_desc"
+Return the descriptor for the configuration with the given index.
+For convenience the current configuration can be specified by
+.Dv USB_CURRENT_CONFIG_INDEX .
+.Bd -literal
+struct usb_config_desc {
+ int ucd_config_index;
+ usb_config_descriptor_t ucd_desc;
+};
+.Ed
+.It Dv USB_GET_INTERFACE_DESC Pq Vt "struct usb_interface_desc"
+Return the interface descriptor for an interface specified by its
+configuration index, interface index, and alternative index.
+For convenience the current alternative can be specified by
+.Dv USB_CURRENT_ALT_INDEX .
+.Bd -literal
+struct usb_interface_desc {
+ int uid_config_index;
+ int uid_interface_index;
+ int uid_alt_index;
+ usb_interface_descriptor_t uid_desc;
+};
+.Ed
+.It Dv USB_GET_ENDPOINT_DESC Pq Vt "struct usb_endpoint_desc"
+Return the endpoint descriptor for the endpoint specified by its
+configuration index, interface index, alternative index, and
+endpoint index.
+.Bd -literal
+struct usb_endpoint_desc {
+ int ued_config_index;
+ int ued_interface_index;
+ int ued_alt_index;
+ int ued_endpoint_index;
+ usb_endpoint_descriptor_t ued_desc;
+};
+.Ed
+.It Dv USB_GET_FULL_DESC Pq Vt "struct usb_full_desc"
+Return all the descriptors for the given configuration.
+.Bd -literal
+struct usb_full_desc {
+ int ufd_config_index;
+ u_int ufd_size;
+ u_char *ufd_data;
+};
+.Ed
+The
+.Va ufd_data
+field should point to a memory area of the size given in the
+.Va ufd_size
+field.
+The proper size can be determined by first issuing a
+.Dv USB_GET_CONFIG_DESC
+and inspecting the
+.Va wTotalLength
+field.
+.It Dv USB_GET_STRING_DESC Pq Vt "struct usb_string_desc"
+Get a string descriptor for the given language ID and
+string index.
+.Bd -literal
+struct usb_string_desc {
+ int usd_string_index;
+ int usd_language_id;
+ usb_string_descriptor_t usd_desc;
+};
+.Ed
+.It Dv USB_DO_REQUEST Pq Vt "struct usb_ctl_request"
+Send a USB request to the device on the control endpoint.
+Any data sent to/from the device is located at
+.Va ucr_data .
+The size of the transferred data is determined from the
+.Va ucr_request .
+The
+.Va ucr_addr
+field is ignored in this call.
+The
+.Va ucr_flags
+field can be used to flag that the request is allowed to
+be shorter than the requested size, and the
+.Va ucr_actlen
+will contain the actual size on completion.
+.Bd -literal
+struct usb_ctl_request {
+ int ucr_addr;
+ usb_device_request_t ucr_request;
+ void *ucr_data;
+ int ucr_flags;
+#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */
+ int ucr_actlen; /* actual length transferred */
+};
+.Ed
+This is a dangerous operation in that it can perform arbitrary operations
+on the device.
+Some of the most dangerous (e.g., changing the device
+address) are not allowed.
+.It Dv USB_GET_DEVICEINFO Pq Vt "struct usb_device_info"
+Get an information summary for the device.
+This call will not
+issue any USB transactions.
+.El
+.Pp
+Note that there are two different ways of addressing configurations, interfaces,
+alternatives, and endpoints: by index or by number.
+The index is the ordinal number (starting from 0) of the descriptor
+as presented by the device.
+The number is the respective number of
+the entity as found in its descriptor.
+Enumeration of descriptors
+use the index, getting and setting typically uses numbers.
+.Pp
+Example:
+all endpoints (except the control endpoint) for the current configuration
+can be found by iterating the
+.Va interface_index
+from 0 to
+.Va config_desc->bNumInterface Ns \-1
+and for each of these iterating the
+.Va endpoint_index
+from 0 to
+.Va interface_desc->bNumEndpoints .
+The
+.Va config_index
+should set to
+.Dv USB_CURRENT_CONFIG_INDEX
+and
+.Va alt_index
+should be set to
+.Dv USB_CURRENT_ALT_INDEX .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar EE" -compact
+.It Pa /dev/ugen Ns Ar N Ns Pa \&. Ns Ar EE
+Endpoint
+.Ar EE
+of device
+.Ar N .
+.El
+.Sh SEE ALSO
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Nx 1.4 .
+.\" .Sh BUGS
+.\" The driver is not yet finished; there is no access to isochronous endpoints.
diff --git a/share/man/man4/uhci.4 b/share/man/man4/uhci.4
new file mode 100644
index 000000000000..6c8b65937c44
--- /dev/null
+++ b/share/man/man4/uhci.4
@@ -0,0 +1,68 @@
+.\" Copyright (c) 1999
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 20, 2005
+.Dt UHCI 4
+.Os
+.Sh NAME
+.Nm uhci
+.Nd UHCI USB Host Controller driver
+.Sh SYNOPSIS
+.Cd "device uhci"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for UHCI-type PCI based USB controllers.
+.Sh HARDWARE
+The
+.Nm
+driver supports all UHCI v1.1 compliant controllers including:
+.Pp
+.Bl -bullet -compact
+.It
+Intel 82371AB/EB (PIIX4)
+.It
+Intel 82371SB (PIIX3)
+.It
+VIA 83C572
+.El
+.Sh SEE ALSO
+.Xr xhci 4 ,
+.Xr ehci 4 ,
+.Xr ohci 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Lennart Augustsson Aq augustss@carlstedt.se
+for the
+.Nx
+project.
diff --git a/share/man/man4/uhid.4 b/share/man/man4/uhid.4
new file mode 100644
index 000000000000..b6274ba83e93
--- /dev/null
+++ b/share/man/man4/uhid.4
@@ -0,0 +1,147 @@
+.\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss Exp $
+.\"
+.\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UHID 4
+.Os
+.Sh NAME
+.Nm uhid
+.Nd USB generic HID support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhid"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uhid_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for all HID (Human Interface Device) interfaces
+in USB devices that do not have a special driver.
+.Pp
+The device handles the following
+.Xr ioctl 2
+calls:
+.Bl -tag -width indent
+.It Dv USB_GET_REPORT_ID Pq Vt int
+Get the report identifier used by this HID report.
+.It Dv USB_GET_REPORT_DESC Pq Vt "struct usb_ctl_report_desc"
+Get the HID report descriptor.
+Using
+this descriptor the exact layout and meaning of data to/from
+the device can be found.
+The report descriptor is delivered
+without any processing.
+.Bd -literal
+struct usb_ctl_report_desc {
+ int ucrd_size;
+ u_char ucrd_data[1024]; /* filled data size will vary */
+};
+.Ed
+.It Dv USB_SET_IMMED Pq Vt int
+Sets the device in a mode where each
+.Xr read 2
+will return the current value of the input report.
+Normally
+a
+.Xr read 2
+will only return the data that the device reports on its
+interrupt pipe.
+This call may fail if the device does not support
+this feature.
+.It Dv USB_GET_REPORT Pq Vt "struct usb_ctl_report"
+Get a report from the device without waiting for data on
+the interrupt pipe.
+The
+.Va report
+field indicates which report is requested.
+It should be
+.Dv UHID_INPUT_REPORT ,
+.Dv UHID_OUTPUT_REPORT ,
+or
+.Dv UHID_FEATURE_REPORT .
+This call may fail if the device does not support this feature.
+.Bd -literal
+struct usb_ctl_report {
+ int ucr_report;
+ u_char ucr_data[1024]; /* used data size will vary */
+};
+.Ed
+.It Dv USB_SET_REPORT Pq Vt "struct usb_ctl_report"
+Set a report in the device.
+The
+.Va report
+field indicates which report is to be set.
+It should be
+.Dv UHID_INPUT_REPORT ,
+.Dv UHID_OUTPUT_REPORT ,
+or
+.Dv UHID_FEATURE_REPORT .
+This call may fail if the device does not support this feature.
+.El
+.Pp
+Use
+.Xr read 2
+to get data from the device.
+Data should be read in chunks of the
+size prescribed by the report descriptor.
+.Pp
+Use
+.Xr write 2
+to send data to the device.
+Data should be written in chunks of the
+size prescribed by the report descriptor.
+.Sh FILES
+.Bl -tag -width ".Pa /dev/uhid?"
+.It Pa /dev/uhid?
+.El
+.Sh SEE ALSO
+.Xr usbhidctl 1 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Nx 1.4 .
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
diff --git a/share/man/man4/uhso.4 b/share/man/man4/uhso.4
new file mode 100644
index 000000000000..26d169badbc1
--- /dev/null
+++ b/share/man/man4/uhso.4
@@ -0,0 +1,142 @@
+.\" Copyright (c) 2009 Fredrik Lindberg
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 20, 2010
+.Dt UHSO 4
+.Os
+.Sh NAME
+.Nm uhso
+.Nd support for several HSxPA devices from Option N.V.
+.Sh SYNOPSIS
+The module can be loaded at boot time by placing the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uhso_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for several HSxPA devices from Option N.V. that are
+based on their packet interface.
+Each device has a set of serial ports and a raw IP packet interface.
+The serial ports of the device are accessed through the
+.Xr ucom 4
+driver which makes them behave like
+.Xr tty 4
+devices.
+The packet interface is exposed as a network interface.
+.Pp
+Establishing a connection on the packet interface is achieved by using the
+proprietary AT commands
+.Dq Li AT_OWANCALL
+and
+.Dq Li AT_OWANDATA
+on any of the available serial ports.
+.Pp
+The network interface must be configured manually using the data obtain from
+these calls.
+.Pp
+Each device usually have at least two or more serial ports, their individual purpose
+can be identified through
+.Xr sysctl 8 .
+Ports identified as
+.Dq Modem
+features a normal modem interface that can be used with PPP.
+Ports identified as
+.Dq Diagnostic
+uses a proprietary binary interface used for firmware upgrades, this port does not
+have a AT command interface and can not be used to control the device.
+Other ports features an AT command interface that can be used for normal device control.
+.Sh HARDWARE
+The
+.Nm
+driver should work with most devices from Option.
+The following devices have been verified to work
+.Pp
+.Bl -bullet -compact
+.It
+Option GlobeSurfer iCON 7.2 (new firmware)
+.It
+Option GlobeTrotter Max 7.2 (new firmware)
+.It
+Option iCON 225
+.It
+Option iCON 452
+.It
+Option iCON 505
+.El
+.Pp
+The device features a mass storage device referred to as
+.Dq Zero-CD
+which contains drivers for Microsoft Windows; this is the default
+mode for the device.
+The
+.Nm
+driver automatically switches the device from
+.Dq Zero-CD
+mode to modem mode.
+This behavior can be disabled by setting
+.Va hw.usb.uhso.auto_switch
+to 0 using
+.Xr sysctl 8
+.Sh FILES
+.Bl -tag -width "XXXXXX"
+.It Pa /dev/cuaU?.?
+.El
+.Sh EXAMPLES
+Establishing a packet interface connection using the AT command interface available
+at one of the serial ports
+.Bd -literal -offset indent
+AT+CGDCONT=1,,"apn.provider"
+AT_OWANCALL=1,1,1
+OK
+_OWANCALL=1,1
+
+AT_OWANDATA=1
+_OWANDATA: 1, 10.11.12.13, 0.0.0.0, 10.2.3.4, 10.2.3.5, \e
+ 0.0.0.0, 0.0.0.0, 72000
+.Ed
+.Pp
+Configuring the interface
+.Bd -literal -offset indent
+ifconfig uhso0 10.11.12.13 up
+route add default -interface uhso0
+echo "nameserver 10.2.3.4" > /etc/resolv.conf
+echo "nameserver 10.2.3.5" >> /etc/resolv.conf
+.Ed
+.Pp
+The connection can be terminated with
+.Bd -literal -offset indent
+AT_OWANCALL=1,0,1
+.Ed
+.Sh SEE ALSO
+.Xr uhsoctl 1 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Fredrik Lindberg Aq fli@shapeshifter.se .
diff --git a/share/man/man4/uipaq.4 b/share/man/man4/uipaq.4
new file mode 100644
index 000000000000..96b23e3c2fdf
--- /dev/null
+++ b/share/man/man4/uipaq.4
@@ -0,0 +1,98 @@
+.\" $OpenBSD: uipaq.4,v 1.1 2005/06/17 23:50:35 deraadt Exp $
+.\" $NetBSD: uipaq.4,v 1.3 2008/04/30 13:10:54 martin Exp $
+.\"
+.\" Copyright (c) 2001-2005 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UIPAQ 4
+.Os
+.Sh NAME
+.Nm uipaq
+.Nd USB support for iPAQ units
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uipaq"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uipaq_load="YES"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It ASUS P535 PDA
+.It Casio BE300 PDA
+.It Compaq IPaq PocketPC
+.It HP Jornada 568
+.It HP iPAQ 22xx/Jornada 548
+.It HTC PPC6700 Modem
+.It HTC Smart Phone
+.It HTC Winmobile
+.It Sharp W-ZERO3 ES Spart Phone
+.It Most Windows CE based phones
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the USB serial emulation provided
+by the iPAQ devices.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr uhub 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Fx
+support was imported from
+.Nx
+for
+.Fx 7.0 .
+.Nx
+added support in
+.Nx 4.0
+and it was imported from
+.Ox 3.8 .
diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4
new file mode 100644
index 000000000000..71ee348e0717
--- /dev/null
+++ b/share/man/man4/ukbd.4
@@ -0,0 +1,171 @@
+.\" Copyright (c) 1997, 1998
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UKBD 4
+.Os
+.Sh NAME
+.Nm ukbd
+.Nd USB keyboard driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ukbd"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ukbd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for keyboards that attach to the USB port.
+.Xr usb 4
+and one of
+.Xr uhci 4
+or
+.Xr ohci 4
+must be configured in the kernel as well.
+.Sh CONFIGURATION
+By default, the keyboard subsystem does not create the appropriate devices yet.
+Make sure you reconfigure your kernel with the following option in the kernel
+config file:
+.Pp
+.Dl "options KBD_INSTALL_CDEV"
+.Pp
+If both an AT keyboard USB keyboards are used at the same time, the
+AT keyboard will appear as
+.Pa kbd0
+in
+.Pa /dev .
+The USB keyboards will be
+.Pa kbd1 , kbd2 ,
+etc.
+You can see some information about the keyboard with the following command:
+.Pp
+.Dl "kbdcontrol -i < /dev/kbd1"
+.Pp
+or load a keymap with
+.Pp
+.Dl "kbdcontrol -l keymaps/pt.iso < /dev/kbd1"
+.Pp
+See
+.Xr kbdcontrol 1
+for more possible options.
+.Pp
+You can swap console keyboards by using the command
+.Pp
+.Dl "kbdcontrol -k /dev/kbd1"
+.Pp
+From this point on, the first USB keyboard will be the keyboard
+to be used by the console.
+.Pp
+If you want to use a USB keyboard as your default and not use an AT keyboard at
+all, you will have to remove the
+.Cd "device atkbd"
+line from the kernel configuration file.
+Because of the device initialization order,
+the USB keyboard will be detected
+.Em after
+the console driver
+initializes itself and you have to explicitly tell the console
+driver to use the existence of the USB keyboard.
+This can be done in
+one of the following two ways.
+.Pp
+Run the following command as a part of system initialization:
+.Pp
+.Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null"
+.Pp
+(Note that as the USB keyboard is the only keyboard, it is accessed as
+.Pa /dev/kbd0 )
+or otherwise tell the console driver to periodically look for a
+keyboard by setting a flag in the kernel configuration file:
+.Pp
+.Dl "device sc0 at isa? flags 0x100"
+.Pp
+With the above flag, the console driver will try to detect any
+keyboard in the system if it did not detect one while it was
+initialized at boot time.
+.Sh DRIVER CONFIGURATION
+.D1 Cd "options KBD_INSTALL_CDEV"
+.Pp
+Make the keyboards available through a character device in
+.Pa /dev .
+.Pp
+.D1 Cd options UKBD_DFLT_KEYMAP
+.D1 Cd makeoptions UKBD_DFLT_KEYMAP=fr.iso
+.Pp
+The above lines will put the French ISO keymap in the ukbd driver.
+You can specify any keymap in
+.Pa /usr/share/syscons/keymaps
+with this option.
+.Pp
+.D1 Cd "options KBD_DISABLE_KEYMAP_LOADING"
+.Pp
+Do not allow the user to change the keymap.
+Note that these options also affect the AT keyboard driver,
+.Xr atkbd 4 .
+.Sh FILES
+.Bl -tag -width ".Pa /dev/kbd*" -compact
+.It Pa /dev/kbd*
+blocking device nodes
+.El
+.Sh EXAMPLES
+.D1 Cd "device ukbd"
+.Pp
+Add the
+.Nm
+driver to the kernel.
+.Sh SEE ALSO
+.Xr kbdcontrol 1 ,
+.Xr ohci 4 ,
+.Xr syscons 4 ,
+.Xr uhci 4 ,
+.Xr usb 4 ,
+.Xr config 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Lennart Augustsson Aq augustss@cs.chalmers.se
+for
+.Nx
+and was substantially rewritten for
+.Fx
+by
+.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp .
+.Pp
+This manual page was written by
+.An Nick Hibma Aq n_hibma@FreeBSD.org
+with a large amount of input from
+.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp .
diff --git a/share/man/man4/ulpt.4 b/share/man/man4/ulpt.4
new file mode 100644
index 000000000000..cd92bfdf54c8
--- /dev/null
+++ b/share/man/man4/ulpt.4
@@ -0,0 +1,110 @@
+.\" $NetBSD: ulpt.4,v 1.6 2002/02/05 00:37:48 augustss Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt ULPT 4
+.Os
+.Sh NAME
+.Nm ulpt
+.Nd USB printer support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ulpt"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ulpt_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB printers that follow the printer
+bi- or uni-directional protocol.
+The bits in the minor number select various features of the driver.
+.Bl -column "Minor Bit" "Functionxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -offset indent
+.Em "Minor Bit Function"
+64 "Do not initialize (reset) the device on the port."
+.El
+.Pp
+Some printers cannot handle the reset on open; in case of problems try the
+.Pa unlpt
+device.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for USB printers and parallel printer
+conversion cables, including the following:
+.Pp
+.Bl -bullet -compact
+.It
+ATen parallel printer adapter
+.It
+Belkin F5U002 parallel printer adapter
+.It
+Canon BJ F850, S600
+.It
+Canon LBP-1310, 350
+.It
+Entrega USB-to-parallel printer adapter
+.It
+Hewlett-Packard HP Deskjet 3420 (P/N: C8947A #ABJ)
+.It
+Oki Data MICROLINE ML660PS
+.It
+Seiko Epson PM-900C, 880C, 820C, 730C
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/unlpt?" -compact
+.It Pa /dev/ulpt?
+device with reset
+.It Pa /dev/unlpt?
+device without reset
+.El
+.Sh SEE ALSO
+.Xr lpt 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Nx 1.4 .
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
diff --git a/share/man/man4/umass.4 b/share/man/man4/umass.4
new file mode 100644
index 000000000000..3b6bc1f53640
--- /dev/null
+++ b/share/man/man4/umass.4
@@ -0,0 +1,257 @@
+.\" Copyright (c) 1999
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 22, 2009
+.Dt UMASS 4
+.Os
+.Sh NAME
+.Nm umass
+.Nd USB Mass Storage Devices driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device usb"
+.Cd "device umass"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+umass_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Mass Storage devices that attach to the USB
+port.
+.Pp
+To use the
+.Nm
+driver,
+.Xr usb 4
+and one of
+.Xr uhci 4
+or
+.Xr ohci 4
+must be configured in the kernel.
+Additionally, since
+.Nm
+uses the SCSI subsystem and sometimes acts as a SCSI device, it
+requires
+.Xr da 4
+and
+.Xr scbus 4
+to be included in the kernel.
+.Sh HARDWARE
+The
+.Nm
+driver supports USB Mass Storage devices, including:
+.Pp
+.Bl -bullet -compact
+.It
+ADTEC Stick Drive AD-UST32M, 64M, 128M, 256M
+.It
+Denno FireWire/USB2 Removable 2.5-inch HDD Case MIFU-25CB20
+.It
+FujiFilm Zip USB Drive ZDR100 USB A
+.It
+GREEN HOUSE USB Flash Memory "PicoDrive" GH-UFD32M, 64M, 128M
+.It
+Huawei Mobile (SD slot)
+.It
+IBM 32MB USB Memory Key (P/N 22P5296)
+.It
+IBM 256MB USB Drive (MSYSTEM DiskOnKey2)
+.It
+IBM ThinkPad USB Portable CD-ROM Drive (P/N 33L5151)
+.It
+I-O DATA USB CD/CD-R/CD-RW/DVD-R/DVD-RW/DVD-RAM/DVD-ROM Drive DVR-iUH2 (CDROM, DVD-RAM only)
+.It
+I-O DATA USB x6 CD-RW Drive CDRW-i64/USB (CDROM only)
+.It
+I-O DATA USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI
+.It
+Iomega USB Zip 100/250 drive
+.It
+Iomega Zip750 USB2.0 drive
+.It
+Keian USB1.1/2.0 3.5-inch HDD Case KU350A
+.It
+Kurouto Shikou USB 2.5-inch HDD Case GAWAP2.5PS-USB2.0
+.It
+LaCie P3 HardDrive USB 200GB
+.It
+Logitec LDR-H443U2 DVD-RAM/-R/+R/-RW/+RW drive
+.It
+Logitec Mobile USB Memory LMC-256UD
+.It
+Logitec USB1.1/2.0 HDD Unit SHD-E60U2
+.It
+Logitec USB Double-Speed Floppy Drive LFD-31U2
+.It
+Logitec USB/IEEE1394 DVD-RAM/R/RW Unit LDR-N21FU2 (CDROM only)
+.It
+MELCO USB Flash Disk "ClipDrive", RUF-C32M, -C64M, -C128M, -C256M, -C512M
+.It
+MELCO USB Flash Disk "PetitDrive", RUF-32M, -64M, -128M, -256Mm
+.It
+MELCO USB2.0 Flash Disk "PetitDrive2", RUF-256M/U2, -512M/U2
+.It
+MELCO USB2.0 MO Drive MO-CH640U2
+.It
+Matshita CF-VFDU03 floppy drive
+.It
+Merlin SM300 MP3/WMA Player (256Mb)
+.It
+Microtech International, Inc.\& USB-SCSI-HD 50 USB to SCSI cable
+.It
+Motorola E398 Mobile Phone (TransFlash memory card)
+.It
+NOVAC USB2.0 2.5/3.5-inch HDD Case NV-HD351U
+.It
+PNY Attache Flash Drive
+.It
+Panasonic ("Matshita FDD CF-VFDU03")
+.It
+Panasonic KXL-CB20AN Portable DVD-ROM/CD-R/RW
+.It
+Panasonic KXL-CB35AN (DVD-ROM & CD-R/RW)
+.It
+Panasonic USB2.0 Portable CD-RW Drive KXL-RW40AN (CDROM only)
+.It
+Panasonic floppy drive
+.It
+Qware BeatZkey!\& Pro
+.It
+RATOC Systems USB2.0 Removable HDD Case U2-MDK1, U2-MDK1B
+.It
+SanDisk SDDR-31 (Compact Flash)
+.It
+SanDisk SDDR-75 (only Compact Flash port works)
+.It
+Sitecom CN-300 MultiFlash (MMC/SD, SmartMedia, CF, MemoryStick)
+.It
+Sony Portable CD-R/RW Drive CRX10U (CDROM only)
+.It
+TEAC Portable USB CD-ROM Unit CD-110PU/210PU
+.It
+Time DPA20B MP3 Player (1Gb)
+.It
+Trek Thumbdrive 8MB
+.It
+VAIO floppy drive (includes Y-E Data Flashbuster-U)
+.It
+Y-E Data floppy drive (720/1.44/2.88Mb)
+.El
+.Pp
+Among the supported digital cameras are:
+.Pp
+.Bl -bullet -compact
+.It
+Asahi Optical (PENTAX) Optio 230 & 330
+.El
+.Sh EXAMPLES
+.Bd -literal -offset indent
+device umass
+device scbus
+device da
+device pass
+.Ed
+.Pp
+Add the
+.Nm
+driver to the kernel.
+.Pp
+.Dl "camcontrol rescan 0"
+.Pp
+Rescan a Zip drive that was added after boot.
+The command above
+assumes that the Zip drive is on the first SCSI bus in the system.
+.Bd -literal -offset indent
+camcontrol rescan 0:0:0
+camcontrol rescan 0:0:1
+camcontrol rescan 0:0:2
+camcontrol rescan 0:0:3
+.Ed
+.Pp
+Rescan all slots on a multi-slot flash reader, where the slots map to separate
+LUNs on a single SCSI ID.
+Typically only the first slot will be enabled at boot time.
+Again, this assumes that the flash reader is the first SCSI bus in the system.
+.Bd -literal -offset indent
+bsdlabel -w da0 zip100
+newfs da0c
+mount -t ufs /dev/da0c /mnt
+.Ed
+.Pp
+Write a disklabel to the Zip drive (see
+.Xr vpo 4
+for the
+.Xr disktab 5
+entry), creates the file system and mounts the new file system on /mnt.
+.Pp
+.Dl "newfs_msdos /dev/da0"
+.Pp
+Create a new FAT type file system.
+Care should be taken not to run
+.Xr newfs 8
+on devices that already contain data, as this will result in the
+information being lost.
+.Pp
+Many consumer devices such as digital cameras automatically create
+.Tn MS-DOS
+based file systems when storing information such as images and
+videos.
+These file systems can be accessed by specifying the file system
+type as
+.Cm msdosfs
+when using
+.Xr mount 8 .
+.Sh SEE ALSO
+.Xr ehci 4 ,
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4 ,
+.Xr vpo 4 ,
+.Xr disktab 5 ,
+.Xr bsdlabel 8 ,
+.Xr camcontrol 8
+.\".Sh HISTORY
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An MAEKAWA Masahide Aq bishop@rr.iij4u.or.jp
+and
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
diff --git a/share/man/man4/umcs.4 b/share/man/man4/umcs.4
new file mode 100644
index 000000000000..8ccd2ca38d26
--- /dev/null
+++ b/share/man/man4/umcs.4
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2010 Lev Serebryakov <lev@FreeBSD.org>.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt UMCS 4
+.Os
+.Sh NAME
+.Nm umcs
+.Nd USB support for serial adapters based on the MCS7820 and MCS7840 chips
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device umcs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+umcs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various multiport serial adapters based on the MosCom
+MCS7820 and MCS7840 chips.
+They are 2- or 4-port adapters with full-featured
+16550-compatible UARTs and very flexible baud generators.
+Also, these chips
+support RS422/RS485 and IrDA operations.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Pp
+Different ports on device are presented as sub-units, like
+.Pa /dev/ttyU0.1
+and
+.Pa /dev/ttyU0.2
+.Sh HARDWARE
+The
+.Nm
+driver was tested on the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+ST Lab U-360 two-port serial USB adapter
+.It
+ST Lab U-400 four-port serial USB adapter
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in ports since December of 2010.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Lev Serebryakov
+.Aq lev@FreeBSD.org .
+.Sh BUGS
+This driver doesn't support access to any fine tunes of
+chip, like RS522/RS485 mode, non-standard baudrates, etc.
diff --git a/share/man/man4/umct.4 b/share/man/man4/umct.4
new file mode 100644
index 000000000000..e40e146b2c31
--- /dev/null
+++ b/share/man/man4/umct.4
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2004 Scott Long
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UMCT 4
+.Os
+.Sh NAME
+.Nm umct
+.Nd Magic Control Technology USB-RS232 converter driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device umct"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+umct_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB to RS-232 converters based on the Magic
+Control Technology USB-232 design.
+These devices support most of the
+standard RS-232 features including baud rates ranging from 300 to 115200
+bits per second.
+However, neither hardware nor software flow control
+seems to be supported.
+.Pp
+Access to devices under this driver is via the
+.Xr ucom 4
+framework and device nodes.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+Belkin F5U109
+.It
+Belkin F5U409
+.It
+D-Link DU-H3SP USB BAY Hub
+.It
+Magic Control Technology USB-232
+.It
+Sitecom USB-232
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Fx 5.2 .
+It is loosely based on the
+.Xr ubsa 4
+driver by
+.An Alexander Kabaev Aq kan@FreeBSD.org
+with documentation from
+.An Wolfgang Grandeggar Aq wolfgang@cec.ch .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Scott Long Aq scottl@FreeBSD.org .
diff --git a/share/man/man4/umodem.4 b/share/man/man4/umodem.4
new file mode 100644
index 000000000000..594f4b000137
--- /dev/null
+++ b/share/man/man4/umodem.4
@@ -0,0 +1,113 @@
+.\" $NetBSD: umodem.4,v 1.6 2001/09/11 23:18:55 wiz Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UMODEM 4
+.Os
+.Sh NAME
+.Nm umodem
+.Nd USB modem support
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device umodem"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+umodem_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB modems in the Communication
+Device Class using the Abstract Control Model.
+These modems are basically standard serial line modems, but they are
+accessed via USB instead.
+They support a regular AT command set.
+The commands can either be multiplexed with the data stream
+or handled through separate pipes.
+In the latter case the AT
+commands have to be given on a device separate from the data device.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+Devices supported by the
+.Nm
+driver include:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 5605
+.It
+Curitel PC5740 Wireless Modem
+.It
+Kyocera AH-K3001V Mobile Phone(WILLCOM)
+.It
+Kyocera WX320K Mobile Phone(WILLCOM)
+.It
+Metricom Ricochet GS USB wireless modem
+.It
+Sierra MC5720 Wireless Modem
+.It
+Yamaha Broadband Wireless Router RTW65b
+.It
+ELSA MicroLink 56k USB modem
+.It
+Sony Ericsson W810i phone
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Nx 1.5 .
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
+.Sh BUGS
+Only modems with multiplexed commands and data are supported
+at the moment.
diff --git a/share/man/man4/ums.4 b/share/man/man4/ums.4
new file mode 100644
index 000000000000..6c052a1858cb
--- /dev/null
+++ b/share/man/man4/ums.4
@@ -0,0 +1,113 @@
+.\" Copyright (c) 1999
+.\" Nick Hibma <n_hibma@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 27, 2006
+.Dt UMS 4
+.Os
+.Sh NAME
+.Nm ums
+.Nd USB mouse driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ums"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ums_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for mice that attach to the USB port.
+Supported are
+mice with any number of buttons and mice with a wheel.
+.Pp
+The
+.Pa /dev/ums0
+device presents the mouse as a
+.Ar sysmouse
+or
+.Ar mousesystems
+type device.
+See
+.Xr moused 8
+for an explanation of these mouse types.
+.Sh FILES
+.Bl -tag -width /dev/ums0 -compact
+.It Pa /dev/ums0
+blocking device node
+.El
+.Sh EXAMPLES
+Use the first
+USB mouse on the system as your console mouse:
+.Pp
+.Dl moused -p /dev/ums0 -t auto
+.Pp
+To be able to use the USB mouse under X, change the "Pointer" section in
+.Nm xorg.conf
+to the following:
+.Pp
+.Dl Device "/dev/ums0"
+.Dl Protocol "Auto"
+.Pp
+If you want to be able to use the mouse in both virtual consoles as well
+as in X change it to:
+.Pp
+.Dl Device "/dev/sysmouse"
+.Dl Protocol "Auto"
+.Sh SEE ALSO
+.Xr ohci 4 ,
+.Xr sysmouse 4 ,
+.Xr uhci 4 ,
+.Xr usb 4 ,
+.Xr xorg.conf 5 Pq Pa ports/x11/xorg ,
+.Xr moused 8
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Lennart Augustsson Aq augustss@cs.chalmers.se
+for
+.Nx
+and was adopted for
+.Fx
+by
+.An MAEKAWA Masahide Aq bishop@rr.iij4u.or.jp .
+.Pp
+This manual page was written by
+.An Nick Hibma Aq n_hibma@FreeBSD.org
+with input from
+.An Kazutaka YOKOTA Aq yokota@zodiac.mech.utsunomiya-u.ac.jp .
diff --git a/share/man/man4/unix.4 b/share/man/man4/unix.4
new file mode 100644
index 000000000000..97e797c2f9e2
--- /dev/null
+++ b/share/man/man4/unix.4
@@ -0,0 +1,280 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)unix.4 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2009
+.Dt UNIX 4
+.Os
+.Sh NAME
+.Nm unix
+.Nd UNIX-domain protocol family
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/un.h
+.Sh DESCRIPTION
+The
+.Ux Ns -domain
+protocol family is a collection of protocols
+that provides local (on-machine) interprocess
+communication through the normal
+.Xr socket 2
+mechanisms.
+The
+.Ux Ns -domain
+family supports the
+.Dv SOCK_STREAM ,
+.Dv SOCK_SEQPACKET ,
+and
+.Dv SOCK_DGRAM
+socket types and uses
+file system pathnames for addressing.
+.Sh ADDRESSING
+.Ux Ns -domain
+addresses are variable-length file system pathnames of
+at most 104 characters.
+The include file
+.In sys/un.h
+defines this address:
+.Bd -literal -offset indent
+struct sockaddr_un {
+ u_char sun_len;
+ u_char sun_family;
+ char sun_path[104];
+};
+.Ed
+.Pp
+Binding a name to a
+.Ux Ns -domain
+socket with
+.Xr bind 2
+causes a socket file to be created in the file system.
+This file is
+.Em not
+removed when the socket is closed \(em
+.Xr unlink 2
+must be used to remove the file.
+.Pp
+The length of
+.Ux Ns -domain
+address, required by
+.Xr bind 2
+and
+.Xr connect 2 ,
+can be calculated by the macro
+.Fn SUN_LEN
+defined in
+.In sys/un.h .
+The
+.Va sun_path
+field must be terminated by a
+.Dv NUL
+character to be used with
+.Fn SUN_LEN ,
+but the terminating
+.Dv NUL
+is
+.Em not
+part of the address.
+.Pp
+The
+.Ux Ns -domain
+protocol family does not support broadcast addressing or any form
+of
+.Dq wildcard
+matching on incoming messages.
+All addresses are absolute- or relative-pathnames
+of other
+.Ux Ns -domain
+sockets.
+Normal file system access-control mechanisms are also
+applied when referencing pathnames; e.g., the destination
+of a
+.Xr connect 2
+or
+.Xr sendto 2
+must be writable.
+.Sh PROTOCOLS
+The
+.Ux Ns -domain
+protocol family is comprised of simple
+transport protocols that support the
+.Dv SOCK_STREAM ,
+.Dv SOCK_SEQPACKET ,
+and
+.Dv SOCK_DGRAM
+abstractions.
+.Dv SOCK_STREAM
+and
+.Dv SOCK_SEQPACKET
+sockets also support the communication of
+.Ux
+file descriptors through the use of the
+.Va msg_control
+field in the
+.Fa msg
+argument to
+.Xr sendmsg 2
+and
+.Xr recvmsg 2 .
+.Pp
+Any valid descriptor may be sent in a message.
+The file descriptor(s) to be passed are described using a
+.Vt "struct cmsghdr"
+that is defined in the include file
+.In sys/socket.h .
+The type of the message is
+.Dv SCM_RIGHTS ,
+and the data portion of the messages is an array of integers
+representing the file descriptors to be passed.
+The number of descriptors being passed is defined
+by the length field of the message;
+the length field is the sum of the size of the header
+plus the size of the array of file descriptors.
+.Pp
+The received descriptor is a
+.Em duplicate
+of the sender's descriptor, as if it were created with a call to
+.Xr dup 2 .
+Per-process descriptor flags, set with
+.Xr fcntl 2 ,
+are
+.Em not
+passed to a receiver.
+Descriptors that are awaiting delivery, or that are
+purposely not received, are automatically closed by the system
+when the destination socket is closed.
+.Pp
+The effective credentials (i.e., the user ID and group list) of a
+peer on a
+.Dv SOCK_STREAM
+socket may be obtained using the
+.Dv LOCAL_PEERCRED
+socket option.
+This may be used by a server to obtain and verify the credentials of
+its client, and vice versa by the client to verify the credentials
+of the server.
+These will arrive in the form of a filled in
+.Vt "struct xucred"
+(defined in
+.In sys/ucred.h ) .
+The credentials presented to the server (the
+.Xr listen 2
+caller) are those of the client when it called
+.Xr connect 2 ;
+the credentials presented to the client (the
+.Xr connect 2
+caller) are those of the server when it called
+.Xr listen 2 .
+This mechanism is reliable; there is no way for either party to influence
+the credentials presented to its peer except by calling the appropriate
+system call (e.g.,
+.Xr connect 2
+or
+.Xr listen 2 )
+under different effective credentials.
+.Pp
+.Tn UNIX
+domain sockets support a number of socket options which can be set with
+.Xr setsockopt 2
+and tested with
+.Xr getsockopt 2 :
+.Bl -tag -width ".Dv LOCAL_CONNWAIT"
+.It Dv LOCAL_CREDS
+This option may be enabled on
+.Dv SOCK_DGRAM ,
+.Dv SOCK_SEQPACKET ,
+or a
+.Dv SOCK_STREAM
+socket.
+This option provides a mechanism for the receiver to
+receive the credentials of the process as a
+.Xr recvmsg 2
+control message.
+The
+.Va msg_control
+field in the
+.Vt msghdr
+structure points to a buffer that contains a
+.Vt cmsghdr
+structure followed by a variable length
+.Vt sockcred
+structure, defined in
+.In sys/socket.h
+as follows:
+.Bd -literal
+struct sockcred {
+ uid_t sc_uid; /* real user id */
+ uid_t sc_euid; /* effective user id */
+ gid_t sc_gid; /* real group id */
+ gid_t sc_egid; /* effective group id */
+ int sc_ngroups; /* number of supplemental groups */
+ gid_t sc_groups[1]; /* variable length */
+};
+.Ed
+.Pp
+The
+.Fn SOCKCREDSIZE
+macro computes the size of the
+.Vt sockcred
+structure for a specified number
+of groups.
+The
+.Vt cmsghdr
+fields have the following values:
+.Bd -literal
+cmsg_len = CMSG_LEN(SOCKCREDSIZE(ngroups))
+cmsg_level = SOL_SOCKET
+cmsg_type = SCM_CREDS
+.Ed
+.It Dv LOCAL_CONNWAIT
+Used with
+.Dv SOCK_STREAM
+sockets, this option causes the
+.Xr connect 2
+function to block until
+.Xr accept 2
+has been called on the listening socket.
+.El
+.Sh SEE ALSO
+.Xr socket 2 ,
+.Xr intro 4
+.Rs
+.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
+.%B PS1
+.%N 7
+.Re
+.Rs
+.%T "An Advanced 4.3 BSD Interprocess Communication Tutorial"
+.%B PS1
+.%N 8
+.Re
diff --git a/share/man/man4/upgt.4 b/share/man/man4/upgt.4
new file mode 100644
index 000000000000..7b8143888abb
--- /dev/null
+++ b/share/man/man4/upgt.4
@@ -0,0 +1,222 @@
+.\" $OpenBSD: upgt.4,v 1.6 2008/04/17 14:01:22 jmc Exp $
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
+.\" Copyright (c) 2005-2007
+.\" Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\"
+.\"
+.\" Copyright (c) 2006 Theo de Raadt.
+.\" Copyright (c) 2006 The DragonFly Project. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\" 3. Neither the name of The DragonFly Project nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific, prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd April 17, 2008
+.Dt UPGT 4
+.Os
+.Sh NAME
+.Nm upgt
+.Nd Conexant/Intersil PrismGT SoftMAC USB IEEE 802.11b/g wireless network
+device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device upgt"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_upgt_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports the USB 2.0 Conexant/Intersil PrismGT series wireless
+adapters based on the GW3887 chipset.
+.Pp
+These are the modes the
+.Nm
+driver can operate in:
+.Bl -tag -width "IBSS-masterXX"
+.It BSS mode
+Also known as
+.Em infrastructure
+mode, this is used when associating with an access point, through
+which all traffic passes.
+This mode is the default.
+.\" .It IBSS mode
+.\" Also known as
+.\" .Em IEEE ad-hoc
+.\" mode or
+.\" .Em peer-to-peer
+.\" mode.
+.\" This is the standardized method of operating without an access point.
+.\" Stations associate with a service set.
+.\" However, actual connections between stations are peer-to-peer.
+.\" .It Host AP
+.\" In this mode the driver acts as an access point (base station)
+.\" for other cards.
+.It monitor mode
+In this mode the driver is able to receive packets without
+associating with an access point.
+This disables the internal receive filter and enables the card to
+capture packets from networks which it wouldn't normally have access to,
+or to scan for access points.
+.El
+.Pp
+.Nm
+supports software WEP.
+Wired Equivalent Privacy (WEP) is the de facto encryption standard
+for wireless networks.
+It can be typically configured in one of three modes:
+no encryption; 40-bit encryption; or 104-bit encryption.
+Unfortunately, due to serious weaknesses in WEP protocol
+it is strongly recommended that it not be used as the
+sole mechanism to secure wireless communication.
+WEP is not enabled by default.
+.\".Pp
+.\"The transmit speed is user-selectable or can be adapted automatically by the
+.\"driver depending on the received signal strength and on the number of hardware
+.\"transmission retries.
+.Pp
+The
+.Nm
+driver can be configured at runtime with
+.Xr ifconfig 8 .
+.Sh FILES
+.\".Pp
+.\"These firmware files are not free because Conexant/Intersil refuses
+.\"to grant distribution rights.
+.\"As a result, even though
+.\".Ox
+.\"includes the driver, the firmware files cannot be included and
+.\"users have to download these files on their own.
+This driver requires the
+.Nm upgtfw
+firmware to be installed before it will work.
+The firmware files are not publicly available.
+A package of the firmware which can be installed via
+.Xr pkg_add 1
+is available:
+.Bd -literal -offset indent
+http://weongyo.org/project/upgt/upgt-firmware-2.13.1.0.tar.gz
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver supports USB 2.0 Conexant/Intersil PrismGT series wireless
+adapters based on the GW3887 chipset, among them:
+.Pp
+.Bl -bullet -compact
+.It
+Belkin F5D7050 (version 1000)
+.It
+Cohiba Proto Board
+.It
+D-Link DWL-G120 Cohiba
+.It
+FSC Connect2Air E-5400 USB D1700
+.It
+Gigaset USB Adapter 54
+.It
+Inventel UR045G
+.It
+SMC EZ ConnectG SMC2862W-G
+.It
+Sagem XG703A
+.It
+Spinnaker DUT
+.It
+Spinnaker Proto Board
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev upgt0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev upgt0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev upgt0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 4.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Marcus Glocker Aq mglocker@openbsd.org .
+.Pp
+The hardware specification was reverse engineered by the people at
+.Pa http://www.prism54.org .
+.Sh CAVEATS
+The
+.Nm
+driver just supports the USB 2.0 devices (GW3887 chipset) but not the
+USB 1.0 devices containing the NET2280, ISL3880, and ISL3886 chipsets.
+Some further efforts would be necessary to add USB 1.0 support to the
+driver.
diff --git a/share/man/man4/uplcom.4 b/share/man/man4/uplcom.4
new file mode 100644
index 000000000000..05b4ff329ac0
--- /dev/null
+++ b/share/man/man4/uplcom.4
@@ -0,0 +1,195 @@
+.\" $NetBSD: uplcom.4,v 1.9 2002/02/07 03:15:09 ross Exp $
+.\"
+.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UPLCOM 4
+.Os
+.Sh NAME
+.Nm uplcom
+.Nd USB support for Prolific PL-2303/2303X/2303HX serial adapters driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uplcom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uplcom_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various serial adapters based on the Prolific
+PL-2303, PL-2303X and PL-2303HX USB-to-RS232 Bridge chips.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following devices and adapters:
+.Pp
+.Bl -bullet -compact
+.It
+ADLINK ND-6530 USB-Serial Adapter
+.It
+Alcatel One Touch 535/735 Phone
+.It
+Alcor AU9720 USB-RS232 Serial Adapter
+.It
+AlDiga AL-11U Modem
+.It
+Alltronix ACM003U00 Modem
+.It
+Anchor Serial adapter
+.It
+ATEN UC-232A
+.It
+BAFO BF-800 and BF-810
+.It
+Belkin F5U257
+.It
+BenQ S81 Phone
+.It
+Corega CG-USBRS232R Serial Adapter
+.It
+Cressi Edy (Seiko) Diving Computer
+.It
+ELECOM UC-SGT Serial Adapter
+.It
+HAL Corporation Crossam2+USB IR commander
+.It
+Hama USB RS-232 Serial Adapter
+.It
+Hamlet exagerate XURS232
+.It
+HP LD220 Point-Of-Sale (POS) Display
+.It
+IOGEAR UC-232A
+.It
+I/O DATA USB-RSAQ, USB-RSAQ2, USB-RSAQ3 and USB-RSAQ5
+.It
+iTegno WM1080A GSM/GFPRS Modem
+.It
+iTegno WM2080A CDMA Modem
+.It
+Leadtek 9531 GPS
+.It
+Micromax 610U Modem
+.It
+Microsoft Palm 700WX
+.It
+Mobile Action MA-620 Infrared Adapter
+.It
+Nokia CA-42 Cable
+.It
+OTI DKU-5 cable
+.It
+Panasonic TY-TP50P6-S flat screen
+.It
+PLX CA-42 Phone Cable
+.It
+PLANEX USB-RS232 URS-03
+.It
+Prolific Generic USB-Serial Adapters
+.It
+Prolific Pharos USB-Serial Adapter
+.It
+RATOC REX-USB60
+.It
+Radio Shack USB Serial Cable
+.It
+Sagem USB-Serial Adapter
+.It
+Samsung I330 Phone Cradle
+.It
+Sandberg USB to Serial Link (model number 133-08)
+.It
+Sanwa KB-USB2 Multimeter cable
+.It
+Siemens/BenQ EF81, SX1, X65 and X75 Mobile Phones
+.It
+Sitecom USB-Serial Adapter
+.It
+SMART Technologies USB-Serial Adapter
+.It
+Sony QN3 Phone Cable
+.It
+Sony Ericsson Datapilot
+.It
+Sony Ericsson DCU-10 and DCU-11 (Susteen) USB Cables
+.It
+SOURCENEXT KeikaiDenwa 8 (with and without charger)
+.It
+Speed Dragon USB-Serial Cable
+.It
+Syntech CPT-8001C Barcode Scanner
+.It
+TDK UHA6400 and UPA9664 USB-PHS Adapters
+.It
+TRENDnet USB to Serial Converter (TU-S9)
+.It
+Tripp-Lite U209-000-R USB-Serial Adapter
+.It
+UIC HCR331 Magnetic Stripe Card Reader
+.It
+UIC MSR206 Magnetic Stripe Card Reader
+.It
+Willcom W-SIM DD PHS terminal.(WS002IN)
+.It
+YC-Cable USB-Serial Adapter
+.It
+Zeagle N2iTion3 Diving Computer
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver
+appeared in
+.Nx 1.6 .
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
diff --git a/share/man/man4/ural.4 b/share/man/man4/ural.4
new file mode 100644
index 000000000000..4ae6c18ebcf7
--- /dev/null
+++ b/share/man/man4/ural.4
@@ -0,0 +1,165 @@
+.\" Copyright (c) 2005, 2006
+.\" Damien Bergamini <damien.bergamini@free.fr>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2008
+.Dt URAL 4
+.Os
+.Sh NAME
+.Nm ural
+.Nd "Ralink Technology RT2500USB IEEE 802.11 driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device ural"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ural_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports USB 2.0 wireless adapters based on the RT2500USB chipset.
+.Pp
+The RT2500USB chipset consists of two integrated chips, a RT2570 MAC/BBP
+and a radio transceiver (the model of which depends on the card revision).
+.Pp
+The RT2522, RT2523, RT2524, RT2525, RT2525e and RT2526 radio transceivers
+operate in the 2.4GHz band (802.11b/g) whereas the RT5222 is a dual-band radio
+transceiver that can operate in the 2.4GHz and 5.2GHz bands (802.11a).
+.Pp
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+.Cm hostap ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports USB 2.0 wireless adapters based on the Ralink Technology
+RT2500USB chipset, including:
+.Pp
+.Bl -column -compact ".Li Atlantis Land A02-PCM-W54" "Bus"
+.It Em Card Ta Em Bus
+.It "AMIT WL532U" Ta USB
+.It "ASUS WL-167g" Ta USB
+.It "Belkin F5D7050 v2000" Ta USB
+.It "Buffalo WLI-U2-KG54-AI" Ta USB
+.It "CNet CWD-854" Ta USB
+.It "Compex WLU54G 2A1100" Ta USB
+.It "Conceptronic C54RU" Ta USB
+.It "D-Link DWL-G122 b1" Ta USB
+.It "Dynalink WLG25USB" Ta USB
+.It "E-Tech WGUS02" Ta USB
+.It "Gigabyte GN-WBKG" Ta USB
+.It "Hercules HWGUSB2-54" Ta USB
+.It "KCORP LifeStyle KLS-685" Ta USB
+.It "Linksys WUSB54G v4" Ta USB
+.It "Linksys WUSB54GP v4" Ta USB
+.It "MSI MS-6861" Ta USB
+.It "MSI MS-6865" Ta USB
+.It "MSI MS-6869" Ta USB
+.It "NovaTech NV-902" Ta USB
+.It "OvisLink Evo-W54USB" Ta USB
+.It "SerComm UB801R" Ta USB
+.It "SparkLAN WL-685R" Ta USB
+.It "Surecom EP-9001-g" Ta USB
+.It "Sweex LC100060" Ta USB
+.It "Tonze UW-6200C" Ta USB
+.It "Zinwell ZWX-G261" Ta USB
+.It "Zonet ZEW2500P" Ta USB
+.El
+.Pp
+An up to date list can be found at
+.Pa http://ralink.rapla.net/ .
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ural0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev ural0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ural0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev ural0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "ural%d: device timeout"
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr ifconfig 8 ,
+.Xr hostapd 8 ,
+.Xr wpa_supplicant 8 .
+.Rs
+.%T "Ralink Technology"
+.%U http://www.ralinktech.com/
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 3.7 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Damien Bergamini Aq damien.bergamini@free.fr
+.Sh BUGS
+Host AP mode doesn't support client power save.
+Clients using power save mode will experience
+packet loss (disabling power saving on the client will fix this).
diff --git a/share/man/man4/urio.4 b/share/man/man4/urio.4
new file mode 100644
index 000000000000..68a4964cab3c
--- /dev/null
+++ b/share/man/man4/urio.4
@@ -0,0 +1,130 @@
+.\" Copyright (c) 2000 Dirk-Willem van Gulik <dirkx@webweaving.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt URIO 4
+.Os
+.Sh NAME
+.Nm urio
+.Nd "USB driver for the Rio MP3 players"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device urio"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+urio_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Rio MP3 players from Diamond MultiMedia
+which attaches to the USB port.
+The
+.Nm
+device must be configured in the kernel, along with
+.Em usb
+and one of the
+.Em uhci
+or
+.Em ohci
+controllers.
+.Pp
+Subsequently, the
+.Pa /dev/urio0
+device can be used by the Rio userland applications.
+.Sh HARDWARE
+The following devices are supported by the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+Diamond MultiMedia Rio 500
+.It
+Diamond MultiMedia Rio 600
+.It
+Diamond MultiMedia Rio 800
+.El
+.Sh FILES
+.Bl -tag -width /dev/ums0 -compact
+.It Pa /dev/urio0
+blocking device node
+.El
+.Sh EXAMPLES
+The following line in the kernel configuration file adds the
+.Nm
+driver to the kernel:
+.Dl device urio
+.Pp
+To download a song over the
+.Tn USB
+connection into the Rio using the
+.Xr rio_add_song 1
+utility (see the
+.Sx SEE ALSO
+section):
+.Dl rio_add_song /usr/local/MP3/TracyChapman/02-Fast-Car.mp3
+.Sh SEE ALSO
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4
+.Rs
+.%T The Rio 500 SourceForge Project Web Page
+.%U http://rio500.sourceforge.net/
+.Re
+.Pp
+The Rio500 tools from SourceForge
+are the actual userland tools used to download,
+format or rename songs on players.
+When compiling these tools,
+the following pre-build configuration command will ensure that
+.Pa rio_usb.h
+is available in the include path
+and that the device used is
+.Pa /dev/urio0 :
+.Bd -literal -offset indent
+CFLAGS="-I/usr/include/dev/usb" ./configure \\
+ --with-devicepath='/dev' --with-deviceentry='urio0'
+.Ed
+.\".Sh HISTORY
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Iwasa Kazmi Aq kzmi@ca2.so-net.ne.jp
+for
+.Fx .
+.Pp
+This manual page was written by
+.An Dirk-Willem van Gulik Aq dirkx@webweaving.org .
diff --git a/share/man/man4/urtw.4 b/share/man/man4/urtw.4
new file mode 100644
index 000000000000..58f291ffcd45
--- /dev/null
+++ b/share/man/man4/urtw.4
@@ -0,0 +1,126 @@
+.\" Copyright (c) 2008 Weongyo Jeong
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 17, 2009
+.Dt URTW 4
+.Os
+.Sh NAME
+.Nm urtw
+.Nd Realtek RTL8187B/L USB IEEE 802.11b/g wireless network device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device urtw"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time,
+place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_urtw_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports USB 802.11b/g wireless adapters based on the
+Realtek RTL8187B/L.
+.Pp
+.Nm
+supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Realtek RTL8187B/L based wireless network devices, including:
+.Pp
+.Bl -column "Shuttle XPC Accessory PN20" "RTL8225" "USB" -compact -offset 6n
+.It Em "Card Radio Bus"
+.It "Belkin F5D7050E RTL8225 USB"
+.It "Linksys WUSB54GCv2 RTL8225 USB"
+.It "Netgear WG111v2 RTL8225 USB"
+.It "Netgear WG111v3 RTL8225 USB"
+.It "Safehome WLG-1500SMA5 RTL8225 USB"
+.It "Shuttle XPC Accessory PN20 RTL8225 USB"
+.It "Sitecom WL168v1 RTL8225 USB"
+.It "Sitecom WL168v4 RTL8225 USB"
+.It "SureCom EP-9001-g(2A) RTL8225 USB"
+.It "TRENDnet TEW-424UB V3.xR RTL8225 USB"
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev urtw0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan create wlandev urtw0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev urtw0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Rs
+.%T Realtek
+.%U http://www.realtek.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Weongyo Jeong
+.Aq weongyo@FreeBSD.org .
diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4
new file mode 100644
index 000000000000..f3f8104616a4
--- /dev/null
+++ b/share/man/man4/usb.4
@@ -0,0 +1,181 @@
+.\" Copyright (c) 1997, 1998 Nick Hibma <n_hibma@FreeBSD.org>
+.\" Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 20, 2009
+.Dt USB 4
+.Os
+.Sh NAME
+.Nm usb
+.Nd Universal Serial Bus
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+usb_load="YES"
+.Ed
+.Sh USERLAND PROGRAMMING
+USB functions can be accessed from userland through the libusb library.
+See
+.Xr libusb 3
+for more information.
+.Sh DESCRIPTION
+.Fx
+provides machine-independent bus support and drivers for
+.Tn USB
+devices in host and device side mode.
+.Pp
+The
+.Nm
+driver has three layers:
+.Bl -tag
+.It USB Controller (Bus)
+.It USB Device
+.It USB Driver
+.El
+.Pp
+The controller attaches to a physical bus
+like
+.Xr pci 4 .
+The
+.Tn USB
+bus attaches to the controller, and the root hub attaches
+to the controller.
+Any devices attached to the bus will attach to the root hub
+or another hub attached to the
+.Tn USB
+bus.
+.Pp
+The
+.Nm uhub
+device will always be present as it is needed for the
+root hub.
+.Sh INTRODUCTION TO USB
+The
+.Tn USB
+is a system where external devices can be connected to a PC.
+The most common USB speeds are:
+.Bl -tag
+.It Low Speed (1.5MBit/sec)
+.It Full Speed (12MBit/sec)
+.It High Speed (480MBit/sec)
+.El
+.Pp
+Each
+.Tn USB
+has a USB controller that is the master of the bus.
+The physical communication is simplex which means the host controller only communicates with one USB device at a time.
+.Pp
+There can be up to 127 devices connected to an USB HUB tree.
+The addresses are assigned
+dynamically by the host when each device is attached to the bus.
+.Pp
+Within each device there can be up to 16 endpoints.
+Each endpoint
+is individually addressed and the addresses are static.
+Each of these endpoints will communicate in one of four different modes:
+.Em control , isochronous , bulk ,
+or
+.Em interrupt .
+A device always has at least one endpoint.
+This endpoint has address 0 and is a control
+endpoint and is used to give commands to and extract basic data,
+such as descriptors, from the device.
+Each endpoint, except the control endpoint, is unidirectional.
+.Pp
+The endpoints in a device are grouped into interfaces.
+An interface is a logical unit within a device; e.g.\&
+a compound device with both a keyboard and a trackball would present
+one interface for each.
+An interface can sometimes be set into different modes,
+called alternate settings, which affects how it operates.
+Different alternate settings can have different endpoints
+within it.
+.Pp
+A device may operate in different configurations.
+Depending on the
+configuration, the device may present different sets of endpoints
+and interfaces.
+.Pp
+The bus enumeration of the
+.Tn USB
+bus proceeds in several steps:
+.Bl -enum
+.It
+Any interface specific driver can attach to the device.
+.It
+If none is found, generic interface class drivers can attach.
+.El
+.Sh SEE ALSO
+The
+.Tn USB
+specifications can be found at:
+.Pp
+.D1 Pa http://www.usb.org/developers/docs/
+.Pp
+.Xr libusb 3 ,
+.Xr usbdi 4 ,
+.Xr aue 4 ,
+.Xr axe 4 ,
+.Xr cue 4 ,
+.Xr ehci 4 ,
+.Xr kue 4 ,
+.Xr mos 4 ,
+.Xr ohci 4 ,
+.Xr pci 4 ,
+.Xr rue 4 ,
+.Xr ucom 4 ,
+.Xr udav 4 ,
+.Xr uhci 4 ,
+.Xr uhid 4 ,
+.Xr ukbd 4 ,
+.Xr ulpt 4 ,
+.Xr umass 4 ,
+.Xr ums 4 ,
+.Xr uplcom 4 ,
+.Xr urio 4 ,
+.Xr uvscom 4 ,
+.Xr usbconfig 8 ,
+.Xr xhci 4
+.Sh STANDARDS
+The
+.Nm
+module complies with the USB 2.0 standard.
+.Sh HISTORY
+The
+.Nm
+module has been inspired by the NetBSD USB stack initially written by
+Lennart Augustsson. The
+.Nm
+module was written by
+.An Hans Petter Selasky Aq hselasky@FreeBSD.org .
diff --git a/share/man/man4/usb2_template.4 b/share/man/man4/usb2_template.4
new file mode 100644
index 000000000000..92abef38fcd1
--- /dev/null
+++ b/share/man/man4/usb2_template.4
@@ -0,0 +1,84 @@
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd September 21, 2008
+.Dt USB2_TEMPLATE 4
+.Os
+.
+.Sh NAME
+.
+.
+.Nm usb2_template
+.
+.Nd "USB templates"
+.
+.
+.Sh SYNOPSIS
+To compile this module into the kernel, place the following line in
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb2_template"
+.Ed
+.Pp
+To load the module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+usb2_template_load="YES"
+.Ed
+.
+.Sh DESCRIPTION
+The
+.Nm
+module implements various USB templates that are needed when
+programming an USB device side driver.
+.
+A USB template consists of an USB device descriptor, one or more USB
+configuration descriptors, one or more USB interface descriptors, one
+or more USB endpoint descriptors, USB strings and additional USB
+descriptors.
+.
+The USB template module currently has templates for USB Mass Storage,
+USB CDC Ethernet and Message Transfer Protocol.
+.
+USB templates are currently selected using the "hw.usb2.template"
+sysctl.
+.
+The "hw.usb2.template" value can be changed at any time, but will not
+have any effect until the USB device has been re-enumerated.
+.
+.
+.
+.Sh SEE ALSO
+.Xr usb2_controller 4
+.Xr usb2_core 4
+.Sh STANDARDS
+The
+.Nm
+module complies with the USB 2.0 standard.
+.Sh HISTORY
+The
+.Nm
+module was written by
+.An Hans Petter Selasky Aq hselasky@FreeBSD.org .
diff --git a/share/man/man4/usb_quirk.4 b/share/man/man4/usb_quirk.4
new file mode 100644
index 000000000000..23234956886a
--- /dev/null
+++ b/share/man/man4/usb_quirk.4
@@ -0,0 +1,195 @@
+.\"
+.\" Copyright (c) 2010 AnyWi Technologies
+.\" All rights reserved.
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt USB_QUIRK 4
+.Os
+.Sh NAME
+.Nm usb_quirk
+.Nd USB quirks module
+.Sh SYNOPSIS
+To compile this module into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb_quirk"
+.Ed
+.Pp
+Alternatively, to load the module at boot
+time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+usb_quirk_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+module provides support for dynamically adding and removing quirks for
+USB devices with
+.Xr usbconfig 8 .
+.Sh General quirks:
+.Bl -tag -width Ds
+.It UQ_AUDIO_SWAP_LR
+swap left and right channels
+.It UQ_AU_INP_ASYNC
+input is async despite claim of adaptive
+.It UQ_AU_NO_FRAC
+don't adjust for fractional samples
+.It UQ_AU_NO_XU
+audio device has broken extension unit
+.It UQ_BAD_ADC
+bad audio spec version number
+.It UQ_BAD_AUDIO
+device claims audio class, but isn't
+.It UQ_BROKEN_BIDIR
+printer has broken bidir mode
+.It UQ_BUS_POWERED
+device is bus powered, despite claim
+.It UQ_HID_IGNORE
+device should be ignored by hid class
+.It UQ_KBD_IGNORE
+device should be ignored by kbd class
+.It UQ_KBD_BOOTPROTO
+device should set the boot protocol
+.It UQ_MS_BAD_CLASS
+doesn't identify properly
+.It UQ_MS_LEADING_BYTE
+mouse sends an unknown leading byte
+.It UQ_MS_REVZ
+mouse has Z-axis reversed
+.It UQ_NO_STRINGS
+string descriptors are broken
+.It UQ_OPEN_CLEARSTALL
+device needs clear endpoint stall
+.It UQ_POWER_CLAIM
+hub lies about power status
+.It UQ_SPUR_BUT_UP
+spurious mouse button up events
+.It UQ_SWAP_UNICODE
+has some Unicode strings swapped
+.It UQ_CFG_INDEX_1
+select configuration index 1 by default
+.It UQ_CFG_INDEX_2
+select configuration index 2 by default
+.It UQ_CFG_INDEX_3
+select configuration index 3 by default
+.It UQ_CFG_INDEX_4
+select configuration index 4 by default
+.It UQ_CFG_INDEX_0
+select configuration index 0 by default
+.It UQ_ASSUME_CM_OVER_DATA
+assume cm over data feature
+.El
+.Sh USB Mass Storage Quirks
+.Bl -tag -width Ds
+.It UQ_MSC_NO_TEST_UNIT_READY
+send start/stop instead of TUR
+.It UQ_MSC_NO_RS_CLEAR_UA
+does not reset Unit Att.
+.It UQ_MSC_NO_START_STOP
+does not support start/stop
+.It UQ_MSC_NO_GETMAXLUN
+does not support get max LUN
+.It UQ_MSC_NO_INQUIRY
+fake generic inq response
+.It UQ_MSC_NO_INQUIRY_EVPD
+does not support inq EVPD
+.It UQ_MSC_NO_SYNC_CACHE
+does not support sync cache
+.It UQ_MSC_SHUTTLE_INIT
+requires Shuttle init sequence
+.It UQ_MSC_ALT_IFACE_1
+switch to alternate interface 1
+.It UQ_MSC_FLOPPY_SPEED
+does floppy speeds (20kb/s)
+.It UQ_MSC_IGNORE_RESIDUE
+gets residue wrong
+.It UQ_MSC_WRONG_CSWSIG
+uses wrong CSW signature
+.It UQ_MSC_RBC_PAD_TO_12
+pad RBC requests to 12 bytes
+.It UQ_MSC_READ_CAP_OFFBY1
+reports sector count, not max sec.
+.It UQ_MSC_FORCE_SHORT_INQ
+does not support full inq.
+.It UQ_MSC_FORCE_WIRE_BBB
+force BBB wire protocol
+.It UQ_MSC_FORCE_WIRE_CBI
+force CBI wire protocol
+.It UQ_MSC_FORCE_WIRE_CBI_I
+force CBI with int. wire protocol
+.It UQ_MSC_FORCE_PROTO_SCSI
+force SCSI command protocol
+.It UQ_MSC_FORCE_PROTO_ATAPI
+force ATAPI command protocol
+.It UQ_MSC_FORCE_PROTO_UFI
+force UFI command protocol
+.It UQ_MSC_FORCE_PROTO_RBC
+force RBC command protocol
+.El
+.Sh Mass Storage Change (u3g) quirks:
+.Bl -tag -width Ds
+.It UQ_MSC_EJECT_HUAWEI
+ejects after Huawei USB command
+.It UQ_MSC_EJECT_SIERRA
+ejects after Sierra USB command
+.It UQ_MSC_EJECT_SCSIEJECT
+ejects after SCSI eject command
+0x1b0000000200
+.It UQ_MSC_EJECT_REZERO
+ejects after SCSI rezero command
+0x010000000000
+.It UQ_MSC_EJECT_ZTESTOR
+ejects after ZTE SCSI command
+0x850101011801010101010000
+.It UQ_MSC_EJECT_CMOTECH
+ejects after C-motech SCSI command
+0xff52444556434847
+.It UQ_MSC_EJECT_WAIT
+wait for the device to eject
+.It UQ_MSC_EJECT_SAEL_M460
+ejects after Sael USB commands
+.It UQ_MSC_EJECT_HUAWEISCSI
+ejects after Huawei SCSI command
+0x11060000000000000000000000000000
+.It UQ_MSC_EJECT_TCT
+ejects after TCT SCSI command
+0x06f504025270
+.El
+See
+.Pa /sys/dev/usb/quirk/usb_quirk.h
+for the complete list of supported quirks.
+.Sh EXAMPLES
+After attaching a
+.Nm u3g
+device which appears as a USB device on
+.Pa ugen0.3 :
+.Bd -literal -offset indent
+usbconfig -d ugen0.3 add_quirk UQ_MSC_EJECT_WAIT
+.Ed
+.Sh SEE ALSO
+.Xr usbconfig 8
+.Sh HISTORY
+The
+.Nm
+module appeared in
+.Fx 8.0 ,
+and was written by
+.An Hans Petter Selasky Aq hselasky@FreeBSD.org .
+This manual page was written by
+.An Nick Hibma Aq n_hibma@FreeBSD.org .
diff --git a/share/man/man4/uslcom.4 b/share/man/man4/uslcom.4
new file mode 100644
index 000000000000..a2a2dcc67846
--- /dev/null
+++ b/share/man/man4/uslcom.4
@@ -0,0 +1,98 @@
+.\" $OpenBSD: uslcom.4,v 1.6 2007/10/08 03:10:42 jcs Exp $
+.\"
+.\" Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt USLCOM 4
+.Os
+.Sh NAME
+.Nm uslcom
+.Nd Silicon Laboratories CP2101/CP2102 based USB serial adapter
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uslcom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uslcom_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Silicon Laboratories CP2101/CP2102 based serial adapters.
+.Sh HARDWARE
+The following devices should work with the
+.Nm
+driver:
+.Pp
+.Bl -bullet -compact
+.It
+Argussoft ISP
+.It
+Baltech card reader
+.It
+Burnside Telecom Desktop Mobile
+.It
+chip45.com Crumb128 module
+.It
+Jablotron PC-60B
+.It
+Lipowsky Baby-JTAG
+.It
+Lipowsky Baby-LIN
+.It
+Lipowsky HARP-1
+.It
+Pololu USB to Serial
+.It
+Silicon Laboratories CP2101
+.It
+Silicon Laboratories CP2102
+.It
+Track Systems Traqmate
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Ox 4.0 .
+The first
+.Fx
+release to include it was
+.Fx 7.1 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Jonathan Gray Aq jsg@openbsd.org .
+.Sh CAVEATS
+Setting hardware flow control is not currently supported.
+.Pp
+Silicon Laboratories do not release any programming information
+on their products.
diff --git a/share/man/man4/utopia.4 b/share/man/man4/utopia.4
new file mode 100644
index 000000000000..00020ea76ac6
--- /dev/null
+++ b/share/man/man4/utopia.4
@@ -0,0 +1,196 @@
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2006
+.Dt UTOPIA 4
+.Os
+.Sh NAME
+.Nm utopia
+.Nd "driver module for ATM PHY chips"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device utopia"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+utopia_load="YES"
+.Ed
+.Sh DESCRIPTION
+This module is used by all ATM drivers for cards that use
+PMC-Sierra S/Uni and IDT77105/IDT77155
+chips to provide uniform functionality.
+The module implements status monitoring
+in either interrupt or polling mode, media option handling and application
+access to chip registers.
+.Pp
+The driver implements several sysctls that are accessible under the
+.Va hw.atm. Ns Ao Ar iface Ac Ns Va .\&
+tree, where
+.Ar iface
+is the name of the ATM interface:
+.Bl -tag -width indent
+.It Va phy_regs
+When reading this sysctl an array of 8-bit unsigned integers is returned
+containing all accessible chip registers starting at register 0.
+A register can be written by writing three 8-bit unsigned integers to the
+sysctl: the register number, the new value and a bit mask.
+This changes all bits in the register for which the corresponding bit in the
+mask is one to the bit values from value.
+Note that not all registers may
+be writeable.
+.It Va phy_loopback
+allows to put the interface in one of several loopback modes.
+Not all modes and all combinations of modes are supported on all chips.
+The possible modes are:
+.Bl -tag -width indent
+.It Dv UTP_LOOP_NONE Pq No 0x00
+No loopback, normal operation.
+.It Dv UTP_LOOP_TIME Pq No 0x01
+Timing source loopback.
+When this is set the transmitter's clock is
+derived from the receiver's clock.
+.It Dv UTP_LOOP_DIAG Pq No 0x02
+Diagnostic loopback.
+In this mode the receiver's input is connected to the
+transmitter's output.
+The receiver gets back everything that is sent.
+The
+transmitter operates normally.
+.It Dv UTP_LOOP_LINE Pq No 0x04
+Serial line loopback.
+This connects the line receiver to the line transmitter.
+The chip transmits all cells back that it receives.
+The receiver operates
+normally.
+.It Dv UTP_LOOP_PARAL Pq No 0x08
+Parallel diagnostic loopback.
+This feeds back all transmitted cells into the
+receiver between the parallel/serial converters.
+The transmitter
+operates normally.
+.It Dv UTP_LOOP_TWIST Pq No 0x10
+Twisted pair diagnostic loopback.
+Connects the high speed receive data to the
+high speed transmit data.
+All received data is sent back.
+The receiver
+operates normally.
+.It Dv UTP_LOOP_PATH Pq No 0x20
+Diagnostic path loopback.
+This connects the receiver input to the transmitter
+output just between the path overhead processor and the byte mux.
+The
+transmitter operates normally.
+.El
+.It Va phy_type
+This is the detected type of the phy chip.
+Currently the following chips are
+supported:
+.Bl -tag -width indent
+.It Dv UTP_TYPE_UNKNOWN Pq No 0
+The module could not determine the type of the PHY chip.
+.It Dv UTP_TYPE_SUNI_LITE Pq No 1
+PMC-5346 (S/Uni-Lite)
+.It Dv UTP_TYPE_SUNI_ULTRA Pq No 2
+PMC-5350 (S/Uni-Ultra)
+.It Dv UTP_TYPE_SUNI_622 Pq No 3
+PMC-5355 (S/Uni-622)
+.It Dv UTP_TYPE_IDT77105 Pq No 4
+IDT77105 (25.6MBit UTP interface)
+.It Dv UTP_TYPE_IDT77155 Pq No 5
+IDT77155 (155MBit interface)
+.El
+.It Va phy_name
+This is a string describing the type of the PHY chip.
+.It Va phy_stats
+Physical and some ATM layer statistics.
+These are the statistics usually
+provided by the chip.
+The data is a returned in the following structure:
+.Bd -literal
+struct utopia_stats1 {
+ uint32_t version; /* version of this struct */
+ uint32_t fill;
+ uint64_t rx_sbip; /* rx section BIP errors */
+ uint64_t rx_lbip; /* rx line BIP errors */
+ uint64_t rx_lfebe; /* rx line far end block errors */
+ uint64_t rx_pbip; /* rx path BIP errors */
+ uint64_t rx_pfebe; /* rx path far end block errors */
+ uint64_t rx_cells; /* received cells */
+ uint64_t rx_corr; /* correctable cell errors */
+ uint64_t rx_uncorr; /* uncorrectable cell errors */
+ uint64_t rx_symerr; /* symbol errors */
+ uint64_t tx_cells; /* transmitted cells */
+};
+.Ed
+.Pp
+The current version is 1.
+The statistics are updated from the chip once
+a second.
+On overflow the counters wrap to zero.
+Note that not all counters
+are meaningful for all PHY chips.
+The statistics are cleared by writing an
+arbitrary new value (the value is ignored).
+.El
+.Pp
+The
+.Nm
+module also interfaces with the ifmedia system.
+The module reports the current state of the carrier and will issue a
+warning message when the carrier state changes.
+While the physical media itself cannot be changed, several media options can:
+.Bl -tag -width indent
+.It Cm SDH
+If the PHY is a Sonet/SDH chip this flag switches the interface into SDH mode.
+If this option is not set (the default) the interface is in Sonet mode.
+.It Cm noscramb
+If the PHY is a Sonet/SDH chip disable scrambling.
+This may be useful for debugging purposes.
+.It Cm unassigned
+Normally the interface emits idle cells when there are no other cells to
+transmit.
+This changes the default cell type to unassigned cells.
+This
+may be needed for interworking with public networks.
+.El
+.Sh SEE ALSO
+.Xr en 4 ,
+.Xr fatm 4 ,
+.Xr hatm 4 ,
+.Xr patm 4 ,
+.Xr utopia 9
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man4/uvisor.4 b/share/man/man4/uvisor.4
new file mode 100644
index 000000000000..2397e4522f2e
--- /dev/null
+++ b/share/man/man4/uvisor.4
@@ -0,0 +1,142 @@
+.\" $NetBSD: uvisor.4,v 1.3 2001/01/23 21:31:10 augustss Exp $
+.\"
+.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UVISOR 4
+.Os
+.Sh NAME
+.Nm uvisor
+.Nd "USB support for the PalmOS based PDAs"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uvisor"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uvisor_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB based PalmOS PDAs, like Handspring
+Visor, Palm Mxxx series, and Sony Clie.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+The device has several ports for different purposes, each of them gets its
+own
+.Xr ucom 4
+device.
+The attach message describes the purpose of each port.
+.Pp
+The usual Pilot tools can be used to access the attached device on the
+HotSync port.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following devices:
+.Pp
+.Bl -bullet -compact
+.It
+Aceeca Mez1000 RDA
+.It
+Handspring Treo
+.It
+Handspring Treo 600
+.It
+Handspring Visor
+.It
+Palm I705
+.It
+Palm M125
+.It
+Palm M130
+.It
+Palm M500
+.It
+Palm M505
+.It
+Palm M515
+.It
+Palm Tungsten T
+.It
+Palm Tungsten Z
+.It
+Palm Zire
+.It
+Palm Zire 31
+.It
+Sony Clie 4.0
+.It
+Sony Clie 4.1
+.It
+Sony Clie 5.0
+.It
+Sony Clie PEG-S500C
+.It
+Sony Clie NX60
+.It
+Sony Clie S360
+.It
+Sony Clie TJ37
+.El
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver was adopted from
+.Nx 1.5
+in August 2002.
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+at that time.
+.Sh BUGS
+The code to provide multiple
+.Xr ucom 4
+instances has not yet been ported from
+.Nx .
+It is unclear whether this driver works in its
+current state.
diff --git a/share/man/man4/uvscom.4 b/share/man/man4/uvscom.4
new file mode 100644
index 000000000000..be40518c20ee
--- /dev/null
+++ b/share/man/man4/uvscom.4
@@ -0,0 +1,95 @@
+.\" $NetBSD: uvscom.4,v 1.1 2002/03/19 15:17:49 augustss Exp $
+.\"
+.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2011
+.Dt UVSCOM 4
+.Os
+.Sh NAME
+.Nm uvscom
+.Nd USB support for SUNTAC Slipper U VS-10U serial adapters driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device usb"
+.Cd "device ucom"
+.Cd "device uvscom"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+uvscom_load="YES"
+.Ed
+.Sh HARDWARE
+The
+.Nm
+driver supports the following adapters:
+.Pp
+.Bl -bullet -compact
+.It
+DDI Pocket Air H" C@rd
+.It
+DDI Pocket Air H" C@rd 64
+.It
+NTT P-in
+.It
+NTT P-in m@ster
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the SUNTAC Slipper U VS-10U chip.
+Slipper U is a PC Card to USB converter for data communication card
+adapters.
+.Pp
+The device is accessed through the
+.Xr ucom 4
+driver which makes it behave like a
+.Xr tty 4 .
+.Sh SEE ALSO
+.Xr tty 4 ,
+.Xr ucom 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx
+and later in
+.Nx 1.6 .
+This manual page was adopted from
+.Nx
+by
+.An Tom Rhodes Aq trhodes@FreeBSD.org
+in April 2002.
diff --git a/share/man/man4/vga.4 b/share/man/man4/vga.4
new file mode 100644
index 000000000000..b102d2f6f5d8
--- /dev/null
+++ b/share/man/man4/vga.4
@@ -0,0 +1,185 @@
+.\"
+.\" Copyright (c) 1999
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 30, 1999
+.Dt VGA 4
+.Os
+.Sh NAME
+.Nm vga
+.Nd generic video card interface
+.Sh SYNOPSIS
+.Cd "options VESA"
+.Cd "options VESA_DEBUG=N"
+.Cd "options VGA_ALT_SEQACCESS"
+.Cd "options VGA_NO_FONT_LOADING"
+.Cd "options VGA_NO_MODE_CHANGE"
+.Cd "options VGA_SLOW_IOACCESS"
+.Cd "options VGA_WIDTH90"
+.Cd "device vga"
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.vga.0.at="isa"
+.Sh DESCRIPTION
+The
+.Nm
+driver is a generic video card driver which provides access to
+video cards.
+This driver is required for the console driver
+.Xr syscons 4 .
+The console driver will call the
+.Nm
+driver to manipulate video hardware (changing video modes, loading font, etc).
+.Pp
+The
+.Nm
+driver supports the standard video cards: MDA, CGA, EGA and VGA.
+In
+addition, the driver can utilize VESA BIOS extensions if the video card
+supports them.
+VESA support can either be statically included in the kernel
+or can be loaded as a separate module.
+.Pp
+In order to statically link the VESA support to the kernel, the
+.Dv VESA
+option (see below) must be defined in the kernel configuration file.
+.Pp
+The
+.Nm vesa
+module can be dynamically loaded into the kernel using
+.Xr kldload 8 .
+.Sh DRIVER CONFIGURATION
+.Ss Kernel Configuration Options
+The following kernel configuration options
+(see
+.Xr config 8 )
+can be used to control the
+.Nm
+driver.
+These options provide compatibility with certain VGA cards.
+.Bl -tag -width MOUSE
+.It Dv VGA_ALT_SEQACCESS
+You may want to try this option if the mouse pointer is not drawn correctly
+or the font does not seem to be loaded properly on the VGA card.
+However, it may cause flicker on some systems.
+.It Dv VGA_SLOW_IOACCESS
+Older VGA cards may require this option for proper operation.
+It makes the driver perform byte-wide I/O to VGA registers and
+slow down a little.
+.It Dv VGA_WIDTH90
+This option enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60.
+These modes are not always supported by the video card and the display.
+It is highly likely that LCD display cannot work with these modes.
+.El
+.Pp
+The following options add optional features to the driver.
+.Bl -tag -width MOUSE
+.It Dv VESA
+Add VESA BIOS support to the driver.
+If the VGA card has the VESA BIOS extension 1.2 or later,
+this option will utilize the VESA BIOS service to switch to high
+resolution modes.
+.It Dv VESA_DEBUG=N
+Set the VESA support debug level to
+.Fa N .
+The default value is zero, which suppresses all debugging output.
+.El
+.Pp
+The following options will remove some features from the
+.Nm
+driver and save kernel memory.
+.Bl -tag -width MOUSE
+.It Dv VGA_NO_FONT_LOADING
+The
+.Nm
+driver can load software font to EGA and VGA cards.
+This option removes this feature.
+Note that if you use this option and
+still wish to use the mouse on the console then you must also use the
+.Dv SC_ALT_MOUSE_IMAGE
+option.
+See
+.Xr syscons 4 .
+.It Dv VGA_NO_MODE_CHANGE
+This option prevents the driver from changing video modes.
+.El
+.\".Sh FILES
+.Sh EXAMPLES
+Your kernel configuration should normally have:
+.Pp
+.Dl "device vga"
+.Pp
+And you need the following line in
+.Pa /boot/device.hints .
+.Pp
+.Dl hint.vga.0.at="isa"
+.Pp
+The following lines should be included in the kernel configuration file
+in order to enable the VESA BIOS Extension support.
+.Pp
+.Dl "options VESA"
+.Dl "device vga"
+.Pp
+If you do not want VESA support included in the kernel, but
+want to use occasionally, do not add the
+.Dv VESA
+option.
+And load the
+.Nm vesa
+module as desired:
+.Pp
+.Dl kldload vesa
+.\".Sh DIAGNOSTICS
+.\".Sh CAVEATS
+.\".Sh BUGS
+.Sh SEE ALSO
+.Xr vgl 3 ,
+.Xr syscons 4 ,
+.Xr config 8 ,
+.Xr kldload 8 ,
+.Xr kldunload 8
+.Sh STANDARDS
+.Rs
+.%T "VESA BIOS Extension (VBE)"
+.%A Video Electronics Standards Association
+.Re
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An S\(/oren Schmidt Aq sos@FreeBSD.org
+and
+.An Kazutaka Yokota Aq yokota@FreeBSD.org .
+This manual page was written by
+.An Kazutaka Yokota .
diff --git a/share/man/man4/vge.4 b/share/man/man4/vge.4
new file mode 100644
index 000000000000..5d488504e205
--- /dev/null
+++ b/share/man/man4/vge.4
@@ -0,0 +1,225 @@
+.\" Copyright (c) 2004
+.\" Bill Paul <wpaul@windriver.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 29, 2011
+.Dt VGE 4
+.Os
+.Sh NAME
+.Nm vge
+.Nd "VIA Networking Technologies Velocity Gigabit Ethernet adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device vge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for various NICs and embedded Ethernet interfaces
+based on the VIA Technologies VT6120, VT6122, VT6130 and VT6132 Velocity
+Family Gigabit Ethernet controller chips.
+.Pp
+The VT6120/VT6122 is a 33/66MHz 64-bit PCI device which combines a tri-speed
+MAC with an integrated 10/100/1000 copper PHY.
+(Some older cards use an external PHY.)
+The VT6130/VT6132 is the PCI express version of Velocity family.
+The MAC supports TCP/IP hardware
+checksums (IPv4 only), TCP large send, VLAN tag insertion and stripping,
+as well as VLAN filtering, a 64-entry CAM filter and a 64-entry VLAN filter,
+64-bit multicast hash filter, 4 separate transmit DMA queues, flow control
+and jumbo frames (not on VT6130/VT6132) up to 16K in size.
+The Velocity family controllers have a 16K receive FIFO and 48K transmit FIFO.
+.Pp
+The
+.Nm
+driver takes advantage of the controller's checksum offload and VLAN
+tagging features, as well as the jumbo frame (except VT6130/VT6132) and CAM
+filter support.
+The CAM filter is used for multicast address filtering to provide
+64 perfect multicast address filter support.
+If it is necessary for the interface to join more than 64 multicast
+groups, the driver will switch over to using the hash filter.
+.Pp
+The jumbo frame support can be enabled by setting the interface MTU
+to any value larger than the default of 1500 bytes, up to a maximum
+of 9000 bytes.
+Jumbo frames are disabled on the VT6130/VT6132 controllers because the TX
+MAC will hang when trying to send a frame that is larger than 4K.
+The receive and transmit checksum offload support
+can be toggled on and off using the
+.Xr ifconfig 8
+utility.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseTX
+Set 1000baseTX operation over twisted pair.
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
+.Cm full-duplex
+or
+.Cm half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports VIA Networking VT6120, VT6122, VT6130 and VT6132 based
+Gigabit Ethernet adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+VIA Networking LAN-on-motherboard Gigabit Ethernet
+.It
+ZyXEL GN650-T 64-bit PCI Gigabit Ethernet NIC (ZX1701)
+.It
+ZyXEL GN670-T 32-bit PCI Gigabit Ethernet NIC (ZX1702)
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.vge.msi_disable
+This tunable disables MSI support on the Ethernet hardware.
+The default value is 0.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.vge.%d.int_holdoff
+Maximum number of time to delay interrupts.
+The valid range is 0 to 5100 in units of 1us, the default is
+150 (150us).
+The resolution of of timer is about 20us so finer tuning than
+20us wouldn't be available.
+The interface should be brought down and up again before a change
+takes effect.
+.It Va dev.vge.%d.rx_coal_pkt
+Maximum number of packets to fire Rx completion interrupt.
+The valid range is 1 to 255, the default is 64.
+.It Va dev.vge.%d.tx_coal_pkt
+Maximum number of packets to fire Tx completion interrupt.
+The valid range is 1 to 255, the default is 128.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "vge%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "vge%d: couldn't map ports"
+A fatal initialization error has occurred.
+.It "vge%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "vge%d: failed to enable memory mapping!"
+The driver failed to initialize PCI shared memory mapping.
+This might
+happen if the card is not in a bus-master slot.
+.It "vge%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@windriver.com .
diff --git a/share/man/man4/viapm.4 b/share/man/man4/viapm.4
new file mode 100644
index 000000000000..851c1fc79229
--- /dev/null
+++ b/share/man/man4/viapm.4
@@ -0,0 +1,72 @@
+.\" Copyright (c) 2002 Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 20, 2002
+.Dt VIAPM 4
+.Os
+.Sh NAME
+.Nm viapm
+.Nd VIA chipsets Power Management controller driver
+.Sh SYNOPSIS
+.Cd device iicbb
+.Cd device iicbus
+.Cd device iicsmb
+.Cd device smbus
+.Cd device smb
+.Cd device viapm
+.Sh DESCRIPTION
+This driver provides access to the
+.Tn "VIA chipset Power Management Unit"
+family.
+They are
+VT82C586B, VT82C596A, VT82C596B, VT82C686A and VT8233.
+.Pp
+The embedded controller of the VIA chipset may give you access
+to the monitoring facilities of your mainboard.
+.Pp
+The 586B support is made by software whereas other controllers support
+the SMBus protocol by hardware.
+See
+.Xr smb 4
+for writing user code to fetch voltages, temperature and so on from the
+monitoring chip of your mainboard.
+.Sh SEE ALSO
+.Xr iicbb 4 ,
+.Xr iicbus 4 ,
+.Xr iicsmb 4 ,
+.Xr smb 4 ,
+.Xr smbus 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 4.5 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu Aq nsouch@FreeBSD.org .
+.Sh BUGS
+Only polling mode is supported.
diff --git a/share/man/man4/viawd.4 b/share/man/man4/viawd.4
new file mode 100644
index 000000000000..47473cf395e2
--- /dev/null
+++ b/share/man/man4/viawd.4
@@ -0,0 +1,79 @@
+.\"-
+.\" Copyright (c) 2011 Fabien Thomas <fabient@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2011
+.Dt VIAWD 4
+.Os
+.Sh NAME
+.Nm viawd
+.Nd device driver for VIA south bridge watchdog timer
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device viawd"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+viawd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog interrupt timer present on
+VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900).
+.Pp
+The VIA south bridge have a built-in watchdog timer,
+which can be enabled and disabled by user's program and set between
+1 to 1023 seconds.
+.Pp
+The
+.Nm
+driver when unloaded with running watchdog will reschedule the watchdog
+to 5 minutes.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this manual page were written by
+.An Fabien Thomas Aq fabient@FreeBSD.org .
diff --git a/share/man/man4/vinum.4 b/share/man/man4/vinum.4
new file mode 100644
index 000000000000..4a59cb97ab66
--- /dev/null
+++ b/share/man/man4/vinum.4
@@ -0,0 +1,1171 @@
+.\" Hey, Emacs, edit this file in -*- nroff-fill -*- mode
+.\"-
+.\" Copyright (c) 1997, 1998, 2003
+.\" Nan Yang Computer Services Limited. All rights reserved.
+.\"
+.\" This software is distributed under the so-called ``Berkeley
+.\" License'':
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Nan Yang Computer
+.\" Services Limited.
+.\" 4. Neither the name of the Company nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" This software is provided ``as is'', and any express or implied
+.\" warranties, including, but not limited to, the implied warranties of
+.\" merchantability and fitness for a particular purpose are disclaimed.
+.\" In no event shall the company or contributors be liable for any
+.\" direct, indirect, incidental, special, exemplary, or consequential
+.\" damages (including, but not limited to, procurement of substitute
+.\" goods or services; loss of use, data, or profits; or business
+.\" interruption) however caused and on any theory of liability, whether
+.\" in contract, strict liability, or tort (including negligence or
+.\" otherwise) arising in any way out of the use of this software, even if
+.\" advised of the possibility of such damage.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 16, 2002
+.Dt VINUM 4
+.Os
+.Sh NAME
+.Nm vinum
+.Nd Logical Volume Manager
+.Sh SYNOPSIS
+.Cd "device vinum"
+.Sh DESCRIPTION
+.Nm
+is a logical volume manager inspired by, but not derived from, the Veritas
+Volume Manager.
+It provides the following features:
+.Bl -bullet
+.It
+It provides device-independent logical disks, called
+.Em volumes .
+Volumes are
+not restricted to the size of any disk on the system.
+.It
+The volumes consist of one or more
+.Em plexes ,
+each of which contain the
+entire address space of a volume.
+This represents an implementation of RAID-1
+(mirroring).
+Multiple plexes can also be used for:
+.\" XXX What about sparse plexes? Do we want them?
+.Bl -bullet
+.It
+Increased read throughput.
+.Nm
+will read data from the least active disk, so if a volume has plexes on multiple
+disks, more data can be read in parallel.
+.Nm
+reads data from only one plex, but it writes data to all plexes.
+.It
+Increased reliability.
+By storing plexes on different disks, data will remain
+available even if one of the plexes becomes unavailable.
+In comparison with a
+RAID-5 plex (see below), using multiple plexes requires more storage space, but
+gives better performance, particularly in the case of a drive failure.
+.It
+Additional plexes can be used for on-line data reorganization.
+By attaching an
+additional plex and subsequently detaching one of the older plexes, data can be
+moved on-line without compromising access.
+.It
+An additional plex can be used to obtain a consistent dump of a file system.
+By
+attaching an additional plex and detaching at a specific time, the detached plex
+becomes an accurate snapshot of the file system at the time of detachment.
+.\" Make sure to flush!
+.El
+.It
+Each plex consists of one or more logical disk slices, called
+.Em subdisks .
+Subdisks are defined as a contiguous block of physical disk storage.
+A plex may
+consist of any reasonable number of subdisks (in other words, the real limit is
+not the number, but other factors, such as memory and performance, associated
+with maintaining a large number of subdisks).
+.It
+A number of mappings between subdisks and plexes are available:
+.Bl -bullet
+.It
+.Em "Concatenated plexes"
+consist of one or more subdisks, each of which
+is mapped to a contiguous part of the plex address space.
+.It
+.Em "Striped plexes"
+consist of two or more subdisks of equal size.
+The file
+address space is mapped in
+.Em stripes ,
+integral fractions of the subdisk
+size.
+Consecutive plex address space is mapped to stripes in each subdisk in
+turn.
+.if t \{\
+.ig
+.\" FIXME
+.br
+.ne 1.5i
+.PS
+move right 2i
+down
+SD0: box
+SD1: box
+SD2: box
+
+"plex 0" at SD0.n+(0,.2)
+"subdisk 0" rjust at SD0.w-(.2,0)
+"subdisk 1" rjust at SD1.w-(.2,0)
+"subdisk 2" rjust at SD2.w-(.2,0)
+.PE
+..
+.\}
+The subdisks of a striped plex must all be the same size.
+.It
+.Em "RAID-5 plexes"
+require at least three equal-sized subdisks.
+They
+resemble striped plexes, except that in each stripe, one subdisk stores parity
+information.
+This subdisk changes in each stripe: in the first stripe, it is the
+first subdisk, in the second it is the second subdisk, etc.
+In the event of a
+single disk failure,
+.Nm
+will recover the data based on the information stored on the remaining subdisks.
+This mapping is particularly suited to read-intensive access.
+The subdisks of a
+RAID-5 plex must all be the same size.
+.\" Make sure to flush!
+.El
+.It
+.Em Drives
+are the lowest level of the storage hierarchy.
+They represent disk special
+devices.
+.It
+.Nm
+offers automatic startup.
+Unlike
+.Ux
+file systems,
+.Nm
+volumes contain all the configuration information needed to ensure that they are
+started correctly when the subsystem is enabled.
+This is also a significant
+advantage over the Veritas\(tm File System.
+This feature regards the presence
+of the volumes.
+It does not mean that the volumes will be mounted
+automatically, since the standard startup procedures with
+.Pa /etc/fstab
+perform this function.
+.El
+.Sh KERNEL CONFIGURATION
+.Nm
+is currently supplied as a KLD module, and does not require
+configuration.
+As with other KLDs, it is absolutely necessary to match the KLD
+to the version of the operating system.
+Failure to do so will cause
+.Nm
+to issue an error message and terminate.
+.Pp
+It is possible to configure
+.Nm
+in the kernel, but this is not recommended.
+To do so, add this line to the
+kernel configuration file:
+.Pp
+.D1 Cd "device vinum"
+.Ss Debug Options
+The current version of
+.Nm ,
+both the kernel module and the user program
+.Xr gvinum 8 ,
+include significant debugging support.
+It is not recommended to remove
+this support at the moment, but if you do you must remove it from both the
+kernel and the user components.
+To do this, edit the files
+.Pa /usr/src/sbin/vinum/Makefile
+and
+.Pa /usr/src/sys/modules/vinum/Makefile
+and edit the
+.Va CFLAGS
+variable to remove the
+.Li -DVINUMDEBUG
+option.
+If you have
+configured
+.Nm
+into the kernel, either specify the line
+.Pp
+.D1 Cd "options VINUMDEBUG"
+.Pp
+in the kernel configuration file or remove the
+.Li -DVINUMDEBUG
+option from
+.Pa /usr/src/sbin/vinum/Makefile
+as described above.
+.Pp
+If the
+.Va VINUMDEBUG
+variables do not match,
+.Xr gvinum 8
+will fail with a message
+explaining the problem and what to do to correct it.
+.Ss Other Options
+.Cd "options VINUM_AUTOSTART"
+.Pp
+Make
+.Nm
+automatically scan all available disks at attach time.
+This is a deprecated way that is primarily intended for environments
+that do not want to rely on kernel environment variables set by
+.Xr loader 8 .
+.Pp
+.Nm
+was previously available in two versions: a freely available version which did
+not contain RAID-5 functionality, and a full version including RAID-5
+functionality, which was available only from Cybernet Systems Inc.
+The present
+version of
+.Nm
+includes the RAID-5 functionality.
+.Sh RUNNING VINUM
+.Nm
+is part of the base
+.Fx
+system.
+It does not require installation.
+To start it, start the
+.Xr gvinum 8
+program, which will load the KLD if it is not already present.
+Before using
+.Nm ,
+it must be configured.
+See
+.Xr gvinum 8
+for information on how to create a
+.Nm
+configuration.
+.Pp
+Normally, you start a configured version of
+.Nm
+at boot time.
+Set the variable
+.Va start_vinum
+in
+.Pa /etc/rc.conf
+to
+.Dq Li YES
+to start
+.Nm
+at boot time.
+(See
+.Xr rc.conf 5
+for more details.)
+.Pp
+If
+.Nm
+is loaded as a KLD (the recommended way), the
+.Nm vinum Cm stop
+command will unload it
+(see
+.Xr gvinum 8 ) .
+You can also do this with the
+.Xr kldunload 8
+command.
+.Pp
+The KLD can only be unloaded when idle, in other words when no volumes are
+mounted and no other instances of the
+.Xr gvinum 8
+program are active.
+Unloading the KLD does not harm the data in the volumes.
+.Ss Configuring and Starting Objects
+Use the
+.Xr gvinum 8
+utility to configure and start
+.Nm
+objects.
+.Sh AUTOMATIC STARTUP
+The
+.Nm
+subsystem can be automatically started at attach time.
+There are two kernel environment variables that can be set in
+.Xr loader.conf 5
+to accomplish this.
+.Bl -tag -width ".Va vinum.autostart" -offset indent
+.It Va vinum.autostart
+If this variable is set (to any value), the attach function will attempt
+to scan all available disks for valid
+.Nm
+configuration records.
+This is the preferred way if automatic startup is desired.
+.Pp
+Example:
+.Dl vinum.autostart="YES"
+.It Va vinum.drives
+Alternatively, this variable can enumerate a list of disk devices
+to scan for configuration records.
+Note that only the
+.Dq bare
+device names need to be given, since
+.Nm
+will automatically scan all possible slices and partitions.
+.Pp
+Example:
+.Dl vinum.drives="da0 da1"
+.El
+.Pp
+If automatic startup is used, it is not necessary to set the
+.Va start_vinum
+variable of
+.Xr rc.conf 5 .
+Note that if
+.Nm
+is to supply to the volume for the root file system, it is necessary
+to start the subsystem early.
+This can be achieved by specifying
+.Pp
+.Dl vinum_load="YES"
+.Pp
+in
+.Xr loader.conf 5 .
+.Sh IOCTL CALLS
+.Xr ioctl 2
+calls are intended for the use of the
+.Xr gvinum 8
+configuration program only.
+They are described in the header file
+.Pa /sys/dev/vinum/vinumio.h .
+.Ss Disk Labels
+Conventional disk special devices have a
+.Em "disk label"
+in the second sector of the device.
+This disk label describes the layout of the partitions within
+the device.
+.Nm
+does not subdivide volumes, so volumes do not contain a physical disk label.
+For convenience,
+.Nm
+implements the ioctl calls
+.Dv DIOCGDINFO
+(get disk label),
+.Dv DIOCGPART
+(get partition information),
+.Dv DIOCWDINFO
+(write partition information) and
+.Dv DIOCSDINFO
+(set partition information).
+.Dv DIOCGDINFO
+and
+.Dv DIOCGPART
+refer to an internal
+representation of the disk label which is not present on the volume.
+As a
+result, the
+.Fl r
+option of
+.Xr disklabel 8 ,
+which reads the
+.Dq "raw disk" ,
+will fail.
+.Pp
+In general,
+.Xr disklabel 8
+serves no useful purpose on a
+.Nm
+volume.
+If you run it, it will show you
+three partitions,
+.Ql a ,
+.Ql b
+and
+.Ql c ,
+all the same except for the
+.Va fstype ,
+for example:
+.Bd -literal
+3 partitions:
+# size offset fstype [fsize bsize bps/cpg]
+ a: 2048 0 4.2BSD 1024 8192 0 # (Cyl. 0 - 0)
+ b: 2048 0 swap # (Cyl. 0 - 0)
+ c: 2048 0 unused 0 0 # (Cyl. 0 - 0)
+.Ed
+.Pp
+.Nm
+ignores the
+.Dv DIOCWDINFO
+and
+.Dv DIOCSDINFO
+ioctls, since there is nothing to change.
+As a result, any attempt to modify the disk label will be silently ignored.
+.Sh MAKING FILE SYSTEMS
+Since
+.Nm
+volumes do not contain partitions, the names do not need to conform to the
+standard rules for naming disk partitions.
+For a physical disk partition, the
+last letter of the device name specifies the partition identifier (a to h).
+.Nm
+volumes need not conform to this convention, but if they do not,
+.Xr newfs 8
+will complain that it cannot determine the partition.
+To solve this problem,
+use the
+.Fl v
+flag to
+.Xr newfs 8 .
+For example, if you have a volume
+.Pa concat ,
+use the following command to create a UFS file system on it:
+.Pp
+.Dl "newfs -v /dev/vinum/concat"
+.Sh OBJECT NAMING
+.Nm
+assigns default names to plexes and subdisks, although they may be overridden.
+We do not recommend overriding the default names.
+Experience with the
+Veritas\(tm
+volume manager, which allows arbitrary naming of objects, has shown that this
+flexibility does not bring a significant advantage, and it can cause confusion.
+.Pp
+Names may contain any non-blank character, but it is recommended to restrict
+them to letters, digits and the underscore characters.
+The names of volumes,
+plexes and subdisks may be up to 64 characters long, and the names of drives may
+up to 32 characters long.
+When choosing volume and plex names, bear in mind
+that automatically generated plex and subdisk names are longer than the name
+from which they are derived.
+.Bl -bullet
+.It
+When
+.Nm
+creates or deletes objects, it creates a directory
+.Pa /dev/vinum ,
+in which it makes device entries for each volume it finds.
+It also creates
+subdirectories,
+.Pa /dev/vinum/plex
+and
+.Pa /dev/vinum/sd ,
+in which it stores device entries for plexes and subdisks.
+In addition, it creates two more directories,
+.Pa /dev/vinum/vol
+and
+.Pa /dev/vinum/drive ,
+in which it stores hierarchical information for volumes and drives.
+.It
+In addition,
+.Nm
+creates three super-devices,
+.Pa /dev/vinum/control ,
+.Pa /dev/vinum/Control
+and
+.Pa /dev/vinum/controld .
+.Pa /dev/vinum/control
+is used by
+.Xr gvinum 8
+when it has been compiled without the
+.Dv VINUMDEBUG
+option,
+.Pa /dev/vinum/Control
+is used by
+.Xr gvinum 8
+when it has been compiled with the
+.Dv VINUMDEBUG
+option, and
+.Pa /dev/vinum/controld
+is used by the
+.Nm
+daemon.
+The two control devices for
+.Xr gvinum 8
+are used to synchronize the debug status of kernel and user modules.
+.It
+Unlike
+.Ux
+drives,
+.Nm
+volumes are not subdivided into partitions, and thus do not contain a disk
+label.
+Unfortunately, this confuses a number of utilities, notably
+.Xr newfs 8 ,
+which normally tries to interpret the last letter of a
+.Nm
+volume name as a partition identifier.
+If you use a volume name which does not
+end in the letters
+.Ql a
+to
+.Ql c ,
+you must use the
+.Fl v
+flag to
+.Xr newfs 8
+in order to tell it to ignore this convention.
+.\"
+.It
+Plexes do not need to be assigned explicit names.
+By default, a plex name is
+the name of the volume followed by the letters
+.Pa .p
+and the number of the
+plex.
+For example, the plexes of volume
+.Pa vol3
+are called
+.Pa vol3.p0 , vol3.p1
+and so on.
+These names can be overridden, but it is not recommended.
+.It
+Like plexes, subdisks are assigned names automatically, and explicit naming is
+discouraged.
+A subdisk name is the name of the plex followed by the letters
+.Pa .s
+and a number identifying the subdisk.
+For example, the subdisks of
+plex
+.Pa vol3.p0
+are called
+.Pa vol3.p0.s0 , vol3.p0.s1
+and so on.
+.It
+By contrast,
+.Em drives
+must be named.
+This makes it possible to move a drive to a different location
+and still recognize it automatically.
+Drive names may be up to 32 characters
+long.
+.El
+.Ss Example
+Assume the
+.Nm
+objects described in the section
+.Sx "CONFIGURATION FILE"
+in
+.Xr gvinum 8 .
+The directory
+.Pa /dev/vinum
+looks like:
+.Bd -literal -offset indent
+# ls -lR /dev/vinum
+total 5
+brwxr-xr-- 1 root wheel 25, 2 Mar 30 16:08 concat
+brwx------ 1 root wheel 25, 0x40000000 Mar 30 16:08 control
+brwx------ 1 root wheel 25, 0x40000001 Mar 30 16:08 controld
+drwxrwxrwx 2 root wheel 512 Mar 30 16:08 drive
+drwxrwxrwx 2 root wheel 512 Mar 30 16:08 plex
+drwxrwxrwx 2 root wheel 512 Mar 30 16:08 rvol
+drwxrwxrwx 2 root wheel 512 Mar 30 16:08 sd
+brwxr-xr-- 1 root wheel 25, 3 Mar 30 16:08 strcon
+brwxr-xr-- 1 root wheel 25, 1 Mar 30 16:08 stripe
+brwxr-xr-- 1 root wheel 25, 0 Mar 30 16:08 tinyvol
+drwxrwxrwx 7 root wheel 512 Mar 30 16:08 vol
+brwxr-xr-- 1 root wheel 25, 4 Mar 30 16:08 vol5
+
+/dev/vinum/drive:
+total 0
+brw-r----- 1 root operator 4, 15 Oct 21 16:51 drive2
+brw-r----- 1 root operator 4, 31 Oct 21 16:51 drive4
+
+/dev/vinum/plex:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x10000002 Mar 30 16:08 concat.p0
+brwxr-xr-- 1 root wheel 25, 0x10010002 Mar 30 16:08 concat.p1
+brwxr-xr-- 1 root wheel 25, 0x10000003 Mar 30 16:08 strcon.p0
+brwxr-xr-- 1 root wheel 25, 0x10010003 Mar 30 16:08 strcon.p1
+brwxr-xr-- 1 root wheel 25, 0x10000001 Mar 30 16:08 stripe.p0
+brwxr-xr-- 1 root wheel 25, 0x10000000 Mar 30 16:08 tinyvol.p0
+brwxr-xr-- 1 root wheel 25, 0x10000004 Mar 30 16:08 vol5.p0
+brwxr-xr-- 1 root wheel 25, 0x10010004 Mar 30 16:08 vol5.p1
+
+/dev/vinum/sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000002 Mar 30 16:08 concat.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100002 Mar 30 16:08 concat.p0.s1
+brwxr-xr-- 1 root wheel 25, 0x20010002 Mar 30 16:08 concat.p1.s0
+brwxr-xr-- 1 root wheel 25, 0x20000003 Mar 30 16:08 strcon.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100003 Mar 30 16:08 strcon.p0.s1
+brwxr-xr-- 1 root wheel 25, 0x20010003 Mar 30 16:08 strcon.p1.s0
+brwxr-xr-- 1 root wheel 25, 0x20110003 Mar 30 16:08 strcon.p1.s1
+brwxr-xr-- 1 root wheel 25, 0x20000001 Mar 30 16:08 stripe.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100001 Mar 30 16:08 stripe.p0.s1
+brwxr-xr-- 1 root wheel 25, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
+brwxr-xr-- 1 root wheel 25, 0x20000004 Mar 30 16:08 vol5.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100004 Mar 30 16:08 vol5.p0.s1
+brwxr-xr-- 1 root wheel 25, 0x20010004 Mar 30 16:08 vol5.p1.s0
+brwxr-xr-- 1 root wheel 25, 0x20110004 Mar 30 16:08 vol5.p1.s1
+
+/dev/vinum/vol:
+total 5
+brwxr-xr-- 1 root wheel 25, 2 Mar 30 16:08 concat
+drwxr-xr-x 4 root wheel 512 Mar 30 16:08 concat.plex
+brwxr-xr-- 1 root wheel 25, 3 Mar 30 16:08 strcon
+drwxr-xr-x 4 root wheel 512 Mar 30 16:08 strcon.plex
+brwxr-xr-- 1 root wheel 25, 1 Mar 30 16:08 stripe
+drwxr-xr-x 3 root wheel 512 Mar 30 16:08 stripe.plex
+brwxr-xr-- 1 root wheel 25, 0 Mar 30 16:08 tinyvol
+drwxr-xr-x 3 root wheel 512 Mar 30 16:08 tinyvol.plex
+brwxr-xr-- 1 root wheel 25, 4 Mar 30 16:08 vol5
+drwxr-xr-x 4 root wheel 512 Mar 30 16:08 vol5.plex
+
+/dev/vinum/vol/concat.plex:
+total 2
+brwxr-xr-- 1 root wheel 25, 0x10000002 Mar 30 16:08 concat.p0
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 concat.p0.sd
+brwxr-xr-- 1 root wheel 25, 0x10010002 Mar 30 16:08 concat.p1
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 concat.p1.sd
+
+/dev/vinum/vol/concat.plex/concat.p0.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000002 Mar 30 16:08 concat.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100002 Mar 30 16:08 concat.p0.s1
+
+/dev/vinum/vol/concat.plex/concat.p1.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20010002 Mar 30 16:08 concat.p1.s0
+
+/dev/vinum/vol/strcon.plex:
+total 2
+brwxr-xr-- 1 root wheel 25, 0x10000003 Mar 30 16:08 strcon.p0
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 strcon.p0.sd
+brwxr-xr-- 1 root wheel 25, 0x10010003 Mar 30 16:08 strcon.p1
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 strcon.p1.sd
+
+/dev/vinum/vol/strcon.plex/strcon.p0.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000003 Mar 30 16:08 strcon.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100003 Mar 30 16:08 strcon.p0.s1
+
+/dev/vinum/vol/strcon.plex/strcon.p1.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20010003 Mar 30 16:08 strcon.p1.s0
+brwxr-xr-- 1 root wheel 25, 0x20110003 Mar 30 16:08 strcon.p1.s1
+
+/dev/vinum/vol/stripe.plex:
+total 1
+brwxr-xr-- 1 root wheel 25, 0x10000001 Mar 30 16:08 stripe.p0
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 stripe.p0.sd
+
+/dev/vinum/vol/stripe.plex/stripe.p0.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000001 Mar 30 16:08 stripe.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100001 Mar 30 16:08 stripe.p0.s1
+
+/dev/vinum/vol/tinyvol.plex:
+total 1
+brwxr-xr-- 1 root wheel 25, 0x10000000 Mar 30 16:08 tinyvol.p0
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 tinyvol.p0.sd
+
+/dev/vinum/vol/tinyvol.plex/tinyvol.p0.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000000 Mar 30 16:08 tinyvol.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100000 Mar 30 16:08 tinyvol.p0.s1
+
+/dev/vinum/vol/vol5.plex:
+total 2
+brwxr-xr-- 1 root wheel 25, 0x10000004 Mar 30 16:08 vol5.p0
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 vol5.p0.sd
+brwxr-xr-- 1 root wheel 25, 0x10010004 Mar 30 16:08 vol5.p1
+drwxr-xr-x 2 root wheel 512 Mar 30 16:08 vol5.p1.sd
+
+/dev/vinum/vol/vol5.plex/vol5.p0.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20000004 Mar 30 16:08 vol5.p0.s0
+brwxr-xr-- 1 root wheel 25, 0x20100004 Mar 30 16:08 vol5.p0.s1
+
+/dev/vinum/vol/vol5.plex/vol5.p1.sd:
+total 0
+brwxr-xr-- 1 root wheel 25, 0x20010004 Mar 30 16:08 vol5.p1.s0
+brwxr-xr-- 1 root wheel 25, 0x20110004 Mar 30 16:08 vol5.p1.s1
+.Ed
+.Pp
+In the case of unattached plexes and subdisks, the naming is reversed.
+Subdisks
+are named after the disk on which they are located, and plexes are named after
+the subdisk.
+.\" XXX
+.Bf -symbolic
+This mapping is still to be determined.
+.Ef
+.Ss Object States
+Each
+.Nm
+object has a
+.Em state
+associated with it.
+.Nm
+uses this state to determine the handling of the object.
+.Ss Volume States
+Volumes may have the following states:
+.Bl -hang -width 14n
+.It Em down
+The volume is completely inaccessible.
+.It Em up
+The volume is up and at least partially functional.
+Not all plexes may be
+available.
+.El
+.Ss "Plex States"
+Plexes may have the following states:
+.Bl -hang -width 14n
+.It Em referenced
+A plex entry which has been referenced as part of a volume, but which is
+currently not known.
+.It Em faulty
+A plex which has gone completely down because of I/O errors.
+.It Em down
+A plex which has been taken down by the administrator.
+.It Em initializing
+A plex which is being initialized.
+.El
+.Pp
+The remaining states represent plexes which are at least partially up.
+.Bl -hang -width 14n
+.It Em corrupt
+A plex entry which is at least partially up.
+Not all subdisks are available,
+and an inconsistency has occurred.
+If no other plex is uncorrupted, the volume
+is no longer consistent.
+.It Em degraded
+A RAID-5 plex entry which is accessible, but one subdisk is down, requiring
+recovery for many I/O requests.
+.It Em flaky
+A plex which is really up, but which has a reborn subdisk which we do not
+completely trust, and which we do not want to read if we can avoid it.
+.It Em up
+A plex entry which is completely up.
+All subdisks are up.
+.El
+.Ss "Subdisk States"
+Subdisks can have the following states:
+.Bl -hang -width 14n
+.It Em empty
+A subdisk entry which has been created completely.
+All fields are correct, and
+the disk has been updated, but the on the disk is not valid.
+.It Em referenced
+A subdisk entry which has been referenced as part of a plex, but which is
+currently not known.
+.It Em initializing
+A subdisk entry which has been created completely and which is currently being
+initialized.
+.El
+.Pp
+The following states represent invalid data.
+.Bl -hang -width 14n
+.It Em obsolete
+A subdisk entry which has been created completely.
+All fields are correct, the
+config on disk has been updated, and the data was valid, but since then the
+drive has been taken down, and as a result updates have been missed.
+.It Em stale
+A subdisk entry which has been created completely.
+All fields are correct, the
+disk has been updated, and the data was valid, but since then the drive has been
+crashed and updates have been lost.
+.El
+.Pp
+The following states represent valid, inaccessible data.
+.Bl -hang -width 14n
+.It Em crashed
+A subdisk entry which has been created completely.
+All fields are correct, the
+disk has been updated, and the data was valid, but since then the drive has gone
+down.
+No attempt has been made to write to the subdisk since the crash, so the
+data is valid.
+.It Em down
+A subdisk entry which was up, which contained valid data, and which was taken
+down by the administrator.
+The data is valid.
+.It Em reviving
+The subdisk is currently in the process of being revived.
+We can write but not
+read.
+.El
+.Pp
+The following states represent accessible subdisks with valid data.
+.Bl -hang -width 14n
+.It Em reborn
+A subdisk entry which has been created completely.
+All fields are correct, the
+disk has been updated, and the data was valid, but since then the drive has gone
+down and up again.
+No updates were lost, but it is possible that the subdisk
+has been damaged.
+We will not read from this subdisk if we have a choice.
+If this
+is the only subdisk which covers this address space in the plex, we set its
+state to up under these circumstances, so this status implies that there is
+another subdisk to fulfill the request.
+.It Em up
+A subdisk entry which has been created completely.
+All fields are correct, the
+disk has been updated, and the data is valid.
+.El
+.Ss "Drive States"
+Drives can have the following states:
+.Bl -hang -width 14n
+.It Em referenced
+At least one subdisk refers to the drive, but it is not currently accessible to
+the system.
+No device name is known.
+.It Em down
+The drive is not accessible.
+.It Em up
+The drive is up and running.
+.El
+.Sh SEE ALSO
+.Xr loader.conf 5 ,
+.Xr disklabel 8 ,
+.Xr gvinum 8 ,
+.Xr loader 8 ,
+.Xr newfs 8
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 3.0 .
+The RAID-5 component of
+.Nm
+was developed by Cybernet Inc.\&
+.Pq Pa http://www.cybernet.com/ ,
+for its NetMAX product.
+.Sh AUTHORS
+.An Greg Lehey Aq grog@lemis.com .
+.Sh BUGS
+.Nm
+is a new product.
+Bugs can be expected.
+The configuration mechanism is not yet
+fully functional.
+If you have difficulties, please look at the section
+.Sx "DEBUGGING PROBLEMS WITH VINUM"
+before reporting problems.
+.Pp
+Kernels with the
+.Nm
+device appear to work, but are not supported.
+If you have trouble with
+this configuration, please first replace the kernel with a
+.No non- Ns Nm
+kernel and test with the KLD module.
+.Pp
+Detection of differences between the version of the kernel and the KLD is not
+yet implemented.
+.Pp
+The RAID-5 functionality is new in
+.Fx 3.3 .
+Some problems have been
+reported with
+.Nm
+in combination with soft updates, but these are not reproducible on all
+systems.
+If you are planning to use
+.Nm
+in a production environment, please test carefully.
+.Sh DEBUGGING PROBLEMS WITH VINUM
+Solving problems with
+.Nm
+can be a difficult affair.
+This section suggests some approaches.
+.Ss Configuration problems
+It is relatively easy (too easy) to run into problems with the
+.Nm
+configuration.
+If you do, the first thing you should do is stop configuration
+updates:
+.Pp
+.Dl "vinum setdaemon 4"
+.Pp
+This will stop updates and any further corruption of the on-disk configuration.
+.Pp
+Next, look at the on-disk configuration, using a Bourne-style shell:
+.Bd -literal
+rm -f log
+for i in /dev/da0s1h /dev/da1s1h /dev/da2s1h /dev/da3s1h; do
+ (dd if=$i skip=8 count=6|tr -d '\e000-\e011\e200-\e377'; echo) >> log
+done
+.Ed
+.Pp
+The names of the devices are the names of all
+.Nm
+slices.
+The file
+.Pa log
+should then contain something like this:
+.Bd -literal
+.if t .ps -3
+.if t .vs -3
+IN VINOpanic.lemis.comdrive1}6E7~^K6T^Yfoovolume obj state up
+volume src state up
+volume raid state down
+volume r state down
+volume foo state up
+plex name obj.p0 state corrupt org concat vol obj
+plex name obj.p1 state corrupt org striped 128b vol obj
+plex name src.p0 state corrupt org striped 128b vol src
+plex name src.p1 state up org concat vol src
+plex name raid.p0 state faulty org disorg vol raid
+plex name r.p0 state faulty org disorg vol r
+plex name foo.p0 state up org concat vol foo
+plex name foo.p1 state faulty org concat vol foo
+sd name obj.p0.s0 drive drive2 plex obj.p0 state reborn len 409600b driveoffset 265b plexoffset 0b
+sd name obj.p0.s1 drive drive4 plex obj.p0 state up len 409600b driveoffset 265b plexoffset 409600b
+sd name obj.p1.s0 drive drive1 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 0b
+sd name obj.p1.s1 drive drive2 plex obj.p1 state reborn len 204800b driveoffset 409865b plexoffset 128b
+sd name obj.p1.s2 drive drive3 plex obj.p1 state up len 204800b driveoffset 265b plexoffset 256b
+sd name obj.p1.s3 drive drive4 plex obj.p1 state up len 204800b driveoffset 409865b plexoffset 384b
+.if t .vs
+.if t .ps
+.Ed
+.Pp
+The first line contains the
+.Nm
+label and must start with the text
+.Dq Li "IN VINO" .
+It also contains the name of the system.
+The exact definition is contained in
+.Pa /usr/src/sys/dev/vinum/vinumvar.h .
+The saved configuration starts in the middle of the line with the text
+.Dq Li "volume obj state up"
+and starts in sector 9 of the disk.
+The rest of the output shows the remainder of the on-disk configuration.
+It
+may be necessary to increase the
+.Cm count
+argument of
+.Xr dd 1
+in order to see the complete configuration.
+.Pp
+The configuration on all disks should be the same.
+If this is not the case,
+please report the problem with the exact contents of the file
+.Pa log .
+There is probably little that can be done to recover the on-disk configuration,
+but if you keep a copy of the files used to create the objects, you should be
+able to re-create them.
+The
+.Ic create
+command does not change the subdisk data, so this will not cause data
+corruption.
+You may need to use the
+.Ic resetconfig
+command if you have this kind of trouble.
+.Ss Kernel Panics
+In order to analyse a panic which you suspect comes from
+.Nm
+you will need to build a debug kernel.
+See the online handbook at
+.Pa /usr/share/doc/en/books/developers-handbook/kerneldebug.html
+(if installed) or
+.Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-\%handbook/kerneldebug.html
+for more details of how to do this.
+.Pp
+Perform the following steps to analyse a
+.Nm
+problem:
+.Bl -enum
+.It
+Copy the following files to the directory in which you will be
+performing the analysis, typically
+.Pa /var/crash :
+.Pp
+.Bl -bullet -compact
+.It
+.Pa /usr/src/sys/modules/vinum/.gdbinit.crash ,
+.It
+.Pa /usr/src/sys/modules/vinum/.gdbinit.kernel ,
+.It
+.Pa /usr/src/sys/modules/vinum/.gdbinit.serial ,
+.It
+.Pa /usr/src/sys/modules/vinum/.gdbinit.vinum
+and
+.It
+.Pa /usr/src/sys/modules/vinum/.gdbinit.vinum.paths
+.El
+.It
+Make sure that you build the
+.Nm
+module with debugging information.
+The standard
+.Pa Makefile
+builds a module with debugging symbols by default.
+If the version of
+.Nm
+in
+.Pa /boot/kernel
+does not contain symbols, you will not get an error message, but the stack trace
+will not show the symbols.
+Check the module before starting
+.Xr gdb 1 :
+.Bd -literal
+$ file /boot/kernel/vinum.ko
+/boot/kernel/vinum.ko: ELF 32-bit LSB shared object, Intel 80386,
+ version 1 (FreeBSD), not stripped
+.Ed
+.Pp
+If the output shows that
+.Pa /boot/kernel/vinum.ko
+is stripped, you will have to find a version which is not.
+Usually this will be
+either in
+.Pa /usr/obj/sys/modules/vinum/vinum.ko
+(if you have built
+.Nm
+with a
+.Dq Li "make world" )
+or
+.Pa /usr/src/sys/modules/vinum/vinum.ko
+(if you have built
+.Nm
+in this directory).
+Modify the file
+.Pa .gdbinit.vinum.paths
+accordingly.
+.It
+Either take a dump or use remote serial
+.Xr gdb 1
+to analyse the problem.
+To analyse a dump, say
+.Pa /var/crash/vmcore.5 ,
+link
+.Pa /var/crash/.gdbinit.crash
+to
+.Pa /var/crash/.gdbinit
+and enter:
+.Bd -literal -offset indent
+cd /var/crash
+gdb -k kernel.debug vmcore.5
+.Ed
+.Pp
+This example assumes that you have installed the correct debug kernel at
+.Pa /var/crash/kernel.debug .
+If not, substitute the correct name of the debug kernel.
+.Pp
+To perform remote serial debugging,
+link
+.Pa /var/crash/.gdbinit.serial
+to
+.Pa /var/crash/.gdbinit
+and enter
+.Bd -literal -offset indent
+cd /var/crash
+gdb -k kernel.debug
+.Ed
+.Pp
+In this case, the
+.Pa .gdbinit
+file performs the functions necessary to establish connection.
+The remote
+machine must already be in debug mode: enter the kernel debugger and select
+.Ic gdb
+(see
+.Xr ddb 4
+for more details).
+The serial
+.Pa .gdbinit
+file expects the serial connection to run at 38400 bits per second; if you run
+at a different speed, edit the file accordingly (look for the
+.Va remotebaud
+specification).
+.Pp
+The following example shows a remote debugging session using the
+.Ic debug
+command of
+.Xr gvinum 8 :
+.Bd -literal
+.if t .ps -3
+.if t .vs -3
+GDB 4.16 (i386-unknown-freebsd), Copyright 1996 Free Software Foundation, Inc.
+Debugger (msg=0xf1093174 "vinum debug") at ../../i386/i386/db_interface.c:318
+318 in_Debugger = 0;
+#1 0xf108d9bc in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6dedee0 "",
+ flag=0x3, p=0xf68b7940) at
+ /usr/src/sys/modules/Vinum/../../dev/Vinum/vinumioctl.c:102
+102 Debugger ("vinum debug");
+(kgdb) bt
+#0 Debugger (msg=0xf0f661ac "vinum debug") at ../../i386/i386/db_interface.c:318
+#1 0xf0f60a7c in vinumioctl (dev=0x40001900, cmd=0xc008464b, data=0xf6923ed0 "",
+ flag=0x3, p=0xf688e6c0) at
+ /usr/src/sys/modules/vinum/../../dev/vinum/vinumioctl.c:109
+#2 0xf01833b7 in spec_ioctl (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:424
+#3 0xf0182cc9 in spec_vnoperate (ap=0xf6923e0c) at ../../miscfs/specfs/spec_vnops.c:129
+#4 0xf01eb3c1 in ufs_vnoperatespec (ap=0xf6923e0c) at ../../ufs/ufs/ufs_vnops.c:2312
+#5 0xf017dbb1 in vn_ioctl (fp=0xf1007ec0, com=0xc008464b, data=0xf6923ed0 "",
+ p=0xf688e6c0) at vnode_if.h:395
+#6 0xf015dce0 in ioctl (p=0xf688e6c0, uap=0xf6923f84) at ../../kern/sys_generic.c:473
+#7 0xf0214c0b in syscall (frame={tf_es = 0x27, tf_ds = 0x27, tf_edi = 0xefbfcff8,
+ tf_esi = 0x1, tf_ebp = 0xefbfcf90, tf_isp = 0xf6923fd4, tf_ebx = 0x2,
+ tf_edx = 0x804b614, tf_ecx = 0x8085d10, tf_eax = 0x36, tf_trapno = 0x7,
+ tf_err = 0x2, tf_eip = 0x8060a34, tf_cs = 0x1f, tf_eflags = 0x286,
+ tf_esp = 0xefbfcf78, tf_ss = 0x27}) at ../../i386/i386/trap.c:1100
+#8 0xf020a1fc in Xint0x80_syscall ()
+#9 0x804832d in ?? ()
+#10 0x80482ad in ?? ()
+#11 0x80480e9 in ?? ()
+.if t .vs
+.if t .ps
+.Ed
+.Pp
+When entering from the debugger, it is important that the source of frame 1
+(listed by the
+.Pa .gdbinit
+file at the top of the example) contains the text
+.Dq Li "Debugger (\*[q]vinum debug\*[q]);" .
+.Pp
+This is an indication that the address specifications are correct.
+If you get
+some other output, your symbols and the kernel module are out of sync, and the
+trace will be meaningless.
+.El
+.Pp
+For an initial investigation, the most important information is the output of
+the
+.Ic bt
+(backtrace) command above.
+.Ss Reporting Problems with Vinum
+If you find any bugs in
+.Nm ,
+please report them to
+.An Greg Lehey Aq grog@lemis.com .
+Supply the following
+information:
+.Bl -bullet
+.It
+The output of the
+.Nm vinum Cm list
+command
+(see
+.Xr gvinum 8 ) .
+.It
+Any messages printed in
+.Pa /var/log/messages .
+All such messages will be identified by the text
+.Dq Li vinum
+at the beginning.
+.It
+If you have a panic, a stack trace as described above.
+.El
diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4
new file mode 100644
index 000000000000..f30f339e25cd
--- /dev/null
+++ b/share/man/man4/virtio.4
@@ -0,0 +1,92 @@
+.\" Copyright (c) 2011 Bryan Venteicher
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2012
+.Dt VIRTIO 4
+.Os
+.Sh NAME
+.Nm virtio
+.Nd VirtIO Device Support
+.Sh SYNOPSIS
+To compile VirtIO device support into the kernel, place the following lines
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device virtio"
+.Cd "device virtio_pci"
+.Ed
+.Pp
+Alternatively, to load VirtIO support as modules at boot time, place the
+following lines in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+virtio_load="YES"
+virtio_pci_load="YES"
+.Ed
+.Sh DESCRIPTION
+VirtIO is a specification for para-virtualized I/O in a virtual machine (VM).
+Traditionally, the hypervisor emulated real devices such as an Ethernet
+interface or disk controller to provide the VM with I/O.
+This emulation is often inefficient.
+.Pp
+VirtIO defines an interface for efficient I/O between the hypervisor and VM.
+The
+.Xr virtio 4
+module provides a shared memory transport called a virtqueue.
+The
+.Xr virtio_pci 4
+device driver represents an emulated PCI device that the hypervisor makes
+available to the VM.
+This device provides the probing, configuration, and
+interrupt notifications needed to interact with the hypervisor.
+.Fx
+supports the following VirtIO devices:
+.Bl -hang -offset indent -width xxxxxxxx
+.It Nm Ethernet
+An emulated Ethernet device is provided by the
+.Xr vtnet 4
+device driver.
+.It Nm Block
+An emulated disk controller is provided by the
+.Xr virtio_blk 4
+device driver.
+.It Nm Balloon
+A pseudo-device to allow the VM to release memory back to the hypervisor is
+provided by the
+.Xr virtio_balloon 4
+device driver.
+.El
+.Sh SEE ALSO
+.Xr virtio_balloon 4 ,
+.Xr virtio_blk 4 ,
+.Xr vtnet 4
+.Sh HISTORY
+Support for VirtIO first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+.Fx
+support for VirtIO was first added by
+.An Bryan Venteicher Aq bryanv@daemoninthecloset.org .
diff --git a/share/man/man4/virtio_balloon.4 b/share/man/man4/virtio_balloon.4
new file mode 100644
index 000000000000..96e8c736f4d4
--- /dev/null
+++ b/share/man/man4/virtio_balloon.4
@@ -0,0 +1,64 @@
+.\" Copyright (c) 2011 Bryan Venteicher
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2012
+.Dt VIRTIO_BALLOON 4
+.Os
+.Sh NAME
+.Nm virtio_balloon
+.Nd VirtIO Memory Balloon driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device virtio_balloon"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+virtio_balloon_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for VirtIO memory balloon devices.
+.Pp
+The memory balloon allows the guest to, at the request of the
+hypervisor, return memory allocated to the hypervisor so it can
+be made available to other guests.
+The hypervisor can later signal the balloon to return the memory.
+.Sh SEE ALSO
+.Xr virtio 4
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Bryan Venteicher Aq bryanv@daemoninthecloset.org .
+It first appeared in
+.Fx 9.0 .
diff --git a/share/man/man4/virtio_blk.4 b/share/man/man4/virtio_blk.4
new file mode 100644
index 000000000000..7be4425bdc60
--- /dev/null
+++ b/share/man/man4/virtio_blk.4
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2011 Bryan Venteicher
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2012
+.Dt VIRTIO_BLK 4
+.Os
+.Sh NAME
+.Nm virtio_blk
+.Nd VirtIO Block driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device virtio_blk"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+virtio_blk_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for VirtIO block devices.
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.vtblk.no_ident
+This tunable disables retrieving the device identification string
+from the hypervisor.
+The default value is 0.
+.El
+.Sh SEE ALSO
+.Xr virtio 4
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Bryan Venteicher Aq bryanv@daemoninthecloset.org .
+It first appeared in
+.Fx 9.0 .
diff --git a/share/man/man4/vkbd.4 b/share/man/man4/vkbd.4
new file mode 100644
index 000000000000..debdd3eea528
--- /dev/null
+++ b/share/man/man4/vkbd.4
@@ -0,0 +1,153 @@
+.\" $Id: vkbd.4,v 1.4 2004/11/16 16:49:39 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd August 12, 2004
+.Dt VKBD 4
+.Os
+.Sh NAME
+.Nm vkbd
+.Nd the virtual AT keyboard interface
+.Sh SYNOPSIS
+.Cd "device vkbd"
+.Sh DESCRIPTION
+The
+.Nm
+interface is a software loopback mechanism that can be loosely
+described as the virtual AT keyboard analog of the
+.Xr pty 4 ,
+that is,
+.Nm
+does for virtual AT keyboards what the
+.Xr pty 4
+driver does for terminals.
+.Pp
+The
+.Nm
+driver, like the
+.Xr pty 4
+driver, provides two interfaces: a keyboard interface like the usual
+facility it is simulating (a virtual AT keyboard in the case of
+.Nm ,
+or a terminal for
+.Xr pty 4 ) ,
+and a character-special device
+.Dq control
+interface.
+.Pp
+The virtual AT keyboards are named
+.Pa vkbd0 , vkbd1 ,
+etc., one for each control device that has been opened.
+.Pp
+The
+.Nm
+interface permits opens on the special control device
+.Pa /dev/vkbdctl .
+When this device is opened,
+.Nm
+will return a handle for the lowest unused
+.Pa vkbdctl
+device (use
+.Xr devname 3
+to determine which).
+.Pp
+Each virtual AT keyboard supports the usual keyboard interface
+.Xr ioctl 2 Ns s ,
+and thus can be used with
+.Xr kbdcontrol 1
+like any other keyboard.
+The control device supports exactly the same
+.Xr ioctl 2 Ns s
+as the virtual AT keyboard device.
+Writing AT scan codes to the control device generates an input on
+the virtual AT keyboard, as if the
+(non-existent)
+hardware had just received it.
+.Pp
+The virtual AT keyboard control device, normally
+.Pa /dev/vkbdctl Ns Aq Ar N ,
+is exclusive-open
+(it cannot be opened if it is already open)
+and is restricted to the super-user.
+A
+.Xr read 2
+call will return the virtual AT keyboard status structure
+(defined in
+.In dev/vkbd/vkbd_var.h )
+if one is available;
+if not, it will either block until one is or return
+.Er EWOULDBLOCK ,
+depending on whether non-blocking I/O has been enabled.
+.Pp
+A
+.Xr write 2
+call passes AT scan codes to be
+.Dq received
+from the virtual AT keyboard.
+Each AT scan code must be passed as
+.Vt "unsigned int" .
+Although AT scan codes must be passes as
+.Vt "unsigned int" Ns s ,
+the size of the buffer passed to
+.Xr write 2
+still should be in bytes, i.e.,
+.Bd -literal -offset indent
+static unsigned int codes[] =
+{
+/* Make Break */
+ 0x1e, 0x9e
+};
+
+int
+main(void)
+{
+ int fd, len;
+
+ fd = open("/dev/vkbdctl0", O_RDWR);
+ if (fd < 0)
+ err(1, "open");
+
+ /* Note sizeof(codes) - not 2! */
+ len = write(fd, codes, sizeof(codes));
+ if (len < 0)
+ err(1, "write");
+
+ close(fd);
+
+ return (0);
+}
+.Ed
+.Pp
+Write will block if there is not enough space in the input queue.
+.Pp
+The control device also supports
+.Xr select 2
+for read and write.
+.Pp
+On the last close of the control device, the virtual AT keyboard is removed.
+All queued scan codes are thrown away.
+.Sh SEE ALSO
+.Xr kbdcontrol 1 ,
+.Xr atkbdc 4 ,
+.Xr psm 4 ,
+.Xr syscons 4
+.Sh HISTORY
+The
+.Nm
+module was implemented in
+.Fx 6.0 .
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
+.Sh CAVEATS
+The
+.Nm
+interface is a software loopback mechanism, and, thus
+.Xr ddb 4
+will not work with it.
+Current implementation of the
+.Xr syscons 4
+driver can accept input from only one keyboard, even if it is virtual.
+Thus it is not possible to have both wired and virtual keyboard to be active
+at the same time.
+It is, however, in principal possible to obtain AT scan
+codes from the different sources and write them into the same virtual keyboard.
+The virtual keyboard state synchronization is the user's responsibility.
diff --git a/share/man/man4/vlan.4 b/share/man/man4/vlan.4
new file mode 100644
index 000000000000..4ef65cbf13f0
--- /dev/null
+++ b/share/man/man4/vlan.4
@@ -0,0 +1,209 @@
+.\"
+.\" Copyright (c) 2001 Yar Tikhiy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 25, 2011
+.Dt VLAN 4
+.Os
+.Sh NAME
+.Nm vlan
+.Nd "IEEE 802.1Q VLAN network interface"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device vlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vlan_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver demultiplexes frames tagged according to
+the IEEE 802.1Q standard into logical
+.Nm
+network interfaces, which allows routing/bridging between
+multiple VLANs through a single switch trunk port.
+.Pp
+Each
+.Nm
+interface is created at runtime using interface cloning.
+This is
+most easily done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va cloned_interfaces
+variable in
+.Xr rc.conf 5 .
+.Pp
+To function, a
+.Nm
+interface must be assigned a parent interface and
+numeric VLAN tag using
+.Xr ifconfig 8 .
+A single parent can be assigned to multiple
+.Nm
+interfaces provided they have different tags.
+The parent interface is likely to be an Ethernet card connected
+to a properly configured switch port.
+The VLAN tag should match one of those set up in the switched
+network.
+.Pp
+Initially
+.Nm
+assumes the same minimum length for tagged and untagged frames.
+This mode is selected by the
+.Xr sysctl 8
+variable
+.Va net.link.vlan.soft_pad
+set to 0 (default).
+However, there are network devices that fail to adjust frame length,
+should it fall below the allowed minimum due to untagging.
+Such devices should be able to interoperate with
+.Nm
+after changing the value of
+.Va net.link.vlan.soft_pad
+to 1.
+In the latter mode,
+.Nm
+will pad short frames before tagging them
+so that their length stays not less than the minimum value
+after untagging by the non-compliant devices.
+.Sh HARDWARE
+The
+.Nm
+driver supports efficient operation over parent interfaces that can provide
+help in processing VLANs.
+Such interfaces are automatically recognized by their capabilities.
+Depending on the level of sophistication found in a physical
+interface, it may do full VLAN processing or just be able to
+receive and transmit long frames (up to 1522 bytes including an Ethernet
+header and FCS).
+The capabilities may be user-controlled by the respective parameters to
+.Xr ifconfig 8 ,
+.Cm vlanhwtag
+and
+.Cm vlanmtu .
+However, a physical interface is not obliged to react to them:
+It may have either capability enabled permanently without
+a way to turn it off.
+The whole issue is very specific to a particular device and its driver.
+.Pp
+By now, the list of physical interfaces able of full VLAN processing
+in the hardware is limited to the following devices:
+.Xr ae 4 ,
+.Xr age 4 ,
+.Xr alc 4 ,
+.Xr ale 4 ,
+.Xr bce 4 ,
+.Xr bge 4 ,
+.Xr cxgb 4 ,
+.Xr cxgbe 4 ,
+.Xr em 4 ,
+.Xr igb 4 ,
+.Xr ixgb 4 ,
+.Xr ixgbe 4 ,
+.Xr jme 4 ,
+.Xr msk 4 ,
+.Xr mxge 4 ,
+.Xr nxge 4 ,
+.Xr nge 4 ,
+.Xr re 4 ,
+.Xr sge 4 ,
+.Xr stge 4 ,
+.Xr ti 4 ,
+.Xr txp 4 ,
+and
+.Xr vge 4 .
+.Pp
+The rest of the Ethernet interfaces can run
+VLANs using software emulation in the
+.Nm
+driver.
+However, some of them lack the capability
+of transmitting and receiving long frames.
+Assigning such an interface as the parent to
+.Nm
+will result in a reduced MTU on the corresponding
+.Nm
+interfaces.
+In the modern Internet, this is likely to cause
+.Xr tcp 4
+connectivity problems due to massive, inadequate
+.Xr icmp 4
+filtering that breaks the Path MTU Discovery mechanism.
+.Pp
+The following interfaces support long frames for
+.Nm
+natively:
+.Xr axe 4 ,
+.Xr bfe 4 ,
+.Xr cas 4 ,
+.Xr dc 4 ,
+.Xr et 4 ,
+.Xr fwe 4 ,
+.Xr fxp 4 ,
+.Xr gem 4 ,
+.Xr hme 4 ,
+.Xr le 4 ,
+.Xr nfe 4 ,
+.Xr nve 4 ,
+.Xr rl 4 ,
+.Xr sf 4 ,
+.Xr sis 4 ,
+.Xr sk 4 ,
+.Xr ste 4 ,
+.Xr tl 4 ,
+.Xr tx 4 ,
+.Xr vr 4 ,
+.Xr vte 4 ,
+and
+.Xr xl 4 .
+.Pp
+The
+.Nm
+driver automatically recognizes devices that natively support long frames
+for
+.Nm
+use and calculates the appropriate frame MTU based on the
+capabilities of the parent interface.
+Some other interfaces not listed above may handle long frames,
+but they do not advertise this ability of theirs.
+The MTU setting on
+.Nm
+can be corrected manually if used in conjunction with such a parent interface.
+.Sh SEE ALSO
+.Xr ifconfig 8 ,
+.Xr sysctl 8
+.Sh BUGS
+No 802.1Q features except VLAN tagging are implemented.
diff --git a/share/man/man4/vpo.4 b/share/man/man4/vpo.4
new file mode 100644
index 000000000000..722a18ff53a4
--- /dev/null
+++ b/share/man/man4/vpo.4
@@ -0,0 +1,105 @@
+.\" Copyright (c) 1998, 1999, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2004
+.Dt VPO 4
+.Os
+.Sh NAME
+.Nm vpo
+.Nd parallel to SCSI interface driver
+.Sh SYNOPSIS
+.Cd "device vpo"
+.Pp
+For one or more SCSI busses:
+.Cd "device scbus"
+.Sh DESCRIPTION
+The
+.Nm
+driver provide access to parallel port Iomega Zip and Jaz drives.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following parallel to SCSI interfaces:
+.Pp
+.Bl -bullet -compact
+.It
+Adaptec AIC-7110 Parallel to SCSI interface (built-in to Iomega ZIP
+drives)
+.It
+Iomega Jaz Traveller interface
+.It
+Iomega MatchMaker SCSI interface (built-in to Iomega ZIP+ drives)
+.El
+.Sh USAGE
+The driver should let you use a printer connected to the drive while
+transferring data.
+.Pp
+DOS and
+.Fx
+file systems are supported.
+When mounting a DOS file system or
+formatting a
+.Fx
+file system, check the slice of the disk with the
+.Xr fdisk 8
+utility.
+.Pp
+In order to unixify a ZIP disk, put the following in /etc/disktab:
+.Bd -literal
+zip|zip 100:\\
+ :ty=removable:se#512:nc#96:nt#64:ns#32:\\
+ :pa#196608:oa#0:ba#4096:fa#512:\\
+ :pb#196608:ob#0:bb#4096:fb#512:\\
+ :pc#196608:oc#0:bc#4096:fc#512:
+.Ed
+.Pp
+and use
+.Xr bsdlabel 8 .
+.Pp
+If you have trouble with your driver, your parallel chipset may not run
+properly at the detected mode (NIBBLE, PS2 or EPP).
+Tune the
+.Xr ppc 4
+bootflags to force other modes.
+.Sh SEE ALSO
+.Xr da 4 ,
+.Xr lpt 4 ,
+.Xr ppbus 4 ,
+.Xr ppc 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
+.Sh BUGS
+During boot, the driver first tries to detect a classic ZIP, then a ZIP+.
+The ZIP+ detection is intrusive and may send erroneous characters to your
+printer if the drive is not connected to your parallel port.
diff --git a/share/man/man4/vr.4 b/share/man/man4/vr.4
new file mode 100644
index 000000000000..cd49f4be74f4
--- /dev/null
+++ b/share/man/man4/vr.4
@@ -0,0 +1,217 @@
+.\" Copyright (c) 1997, 1998
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt VR 4
+.Os
+.Sh NAME
+.Nm vr
+.Nd "VIA Technologies Rhine I/II/III Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device vr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vr_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the VIA Technologies VT3043 Rhine I,
+VT86C100A Rhine II, and VT6105/VT6105M Rhine III Fast Ethernet
+controller chips.
+.Pp
+The VIA Rhine chips use bus master DMA and have a descriptor layout
+designed to resemble that of the DEC 21x4x
+.Dq tulip
+chips.
+The register
+layout is different however and the receive filter in the Rhine chips
+is much simpler and is programmed through registers rather than by
+downloading a special setup frame through the transmit DMA engine.
+Transmit and receive DMA buffers must be longword
+aligned.
+The Rhine chips are meant to be interfaced with external
+physical layer devices via an MII bus.
+They support both
+10 and 100Mbps speeds in either full or half duplex.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+Note that the 100baseTX media type is only available if supported
+by the adapter.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports VIA Technologies Rhine I, Rhine II, and Rhine III based
+Fast Ethernet adapters including:
+.Pp
+.Bl -bullet -compact
+.It
+AOpen/Acer ALN-320
+.It
+D-Link DFE520-TX
+.It
+D-Link DFE530-TX
+.It
+Hawking Technologies PN102TX
+.It
+Soekris Engineering net5501
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as
+.Xr sysctl 8
+variables:
+.Bl -tag -width indent
+.It Va dev.vr.%d.stats
+Display lots of useful MAC counters maintained in the driver.
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "vr%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "vr%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "vr%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "vr%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "vr%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "vr%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr polling 4 ,
+.Xr ifconfig 8
+.Rs
+.%T The VIA Technologies VT86C100A data sheet
+.%U http://www.via.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
+.Sh BUGS
+The
+.Nm
+driver always copies transmit mbuf chains into longword-aligned
+buffers prior to transmission in order to pacify the Rhine chips.
+If buffers are not aligned correctly, the chip will round the
+supplied buffer address and begin DMAing from the wrong location.
+This buffer copying impairs transmit performance on slower systems but cannot
+be avoided.
+On faster machines (e.g.\& a Pentium II), the performance
+impact is much less noticeable.
diff --git a/share/man/man4/vte.4 b/share/man/man4/vte.4
new file mode 100644
index 000000000000..18b39d0b9481
--- /dev/null
+++ b/share/man/man4/vte.4
@@ -0,0 +1,152 @@
+.\" Copyright (c) 2010 Pyun YongHyeon
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 30, 2010
+.Dt VTE 4
+.Os
+.Sh NAME
+.Nm vte
+.Nd Vortex86 RDC R6040 Fast Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device vte"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vte_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for RDC R6040 Fast Ethernet controller
+which is commonly found on Vortex86 System On a Chip (SoC).
+.Pp
+The RDC R6040 has integrated 10/100 PHY for 10/100Mbps support in full
+or half-duplex.
+The controller supports interrupt moderation mechanism, a 64-bit multicast
+hash filter, VLAN over-size frame and four station addresses.
+The
+.Nm
+device driver uses three station addresses out of four as perfect
+multicast filter.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm 10baseT/UTP"
+.It Cm autoselect
+Enable autoselection of the media type and options.
+The user can manually override
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
+.It Cm 10baseT/UTP
+Set 10Mbps operation.
+.It Cm 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width ".Cm full-duplex"
+.It Cm full-duplex
+Force full duplex operation.
+.It Cm half-duplex
+Force half duplex operation.
+.El
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+device driver provides support for the following Ethernet controllers:
+.Pp
+.Bl -bullet -compact
+.It
+DM&P Vortex86 RDC R6040 Fast Ethernet controller
+.El
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.vte.tx_deep_copy
+The RDC R6040 controller has no auto-padding support for short
+frames and the controller's DMA engine does not have capability to
+handle multiple buffers for a TX frame such that driver has to
+create a single contiguous TX buffer.
+This hardware limitation leads to poor TX performance since most of
+CPU cycles are wasted on both de-fragmenting mbuf chains and padding.
+This tunable enables deep copy operation for TX frames such that
+driver will spend less CPU cycles in de-fragmentation with the
+cost of extra TX buffer memory.
+The default value is 1 to use deep copy.
+.El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.vte.%d.rx_mod
+Maximum number of packets to fire RX completion interrupt.
+The accepted range is 0 to 15, the default is 15.
+.It Va dev.vte.%d.tx_mod
+Maximum number of packets to fire TX completion interrupt.
+The accepted range is 0 to 15, the default is 15.
+.It Va dev.vte.%d.stats
+Show hardware MAC statistics maintained in driver.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Rs
+.%T "DM&P Electronics Inc. Vortex86"
+.%U http://www.dmp.com.tw
+.Re
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Pyun YongHyeon
+.Aq yongari@FreeBSD.org .
+It first appeared in
+.Fx 8.3 .
diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4
new file mode 100644
index 000000000000..febb0ac75f24
--- /dev/null
+++ b/share/man/man4/vtnet.4
@@ -0,0 +1,99 @@
+.\" Copyright (c) 2011 Bryan Venteicher
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2012
+.Dt VTNET 4
+.Os
+.Sh NAME
+.Nm vtnet
+.Nd VirtIO Ethernet driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device if_vtnet"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vtnet_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for VirtIO Ethernet devices.
+.Pp
+If the hypervisor advertises the appreciate features, the
+.Nm
+driver supports TCP/UDP checksum offload for both transmit and receive,
+TCP segmentation offload (TSO), TCP large receive offload (LRO), and
+hardware VLAN tag stripping/insertion features, as well as a multicast
+hash filter, as well as Jumbo Frames (up to 9216 bytes), which can be
+configured via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to receive and transmit Jumbo Frames.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width "xxxxxx"
+.It Va hw.vtnet.csum_disable
+This tunable disables receive and send checksum offload.
+The default value is 0.
+.It Va hw.vtnet.tso_disable
+This tunable disables TSO.
+The default value is 0.
+.It Va hw.vtnet.lro_disable
+This tunable disables LRO.
+The default value is 0.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr virtio 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver was written by
+.An Bryan Venteicher Aq bryanv@daemoninthecloset.org .
+It first appeared in
+.Fx 9.0 .
+.Sh CAVEATS
+The
+.Nm
+driver only supports LRO when the hypervisor advertises the
+mergeable buffer feature.
diff --git a/share/man/man4/vxge.4 b/share/man/man4/vxge.4
new file mode 100644
index 000000000000..fdca8e2b65f8
--- /dev/null
+++ b/share/man/man4/vxge.4
@@ -0,0 +1,110 @@
+.\" Copyright (c) 2002-2011 Exar Corp.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 16, 2011
+.Dt VXGE 4
+.Os
+.Sh NAME
+.Nm vxge
+.Nd "Neterion X3100 10GbE Server/Storage adapter driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device vxge"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_vxge_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Neterion X3100 adapters.
+The driver supports TCP Segmentation Offload (TSO/LSO),
+Large Receive Offload (LRO), Jumbo Frames, Receive Traffic Hash (RTH),
+VLAN, Promiscuous mode and Multi function mode.
+.Pp
+The
+.Nm
+driver supports the following function modes:
+.Bd -ragged -offset indent
+.Cd "SF1_VP17 - 1 function with 17 VPATHs"
+.Ed
+.Bd -ragged -offset indent
+.Cd "MF8_VP2 - 8 functions with 2 VPATHs per function"
+.Ed
+.Bd -ragged -offset indent
+.Cd "MF2_VP8 - 2 functions, 8 Paths/Function"
+.Ed
+.Bd -ragged -offset indent
+.Cd "MF4_VP4 - 4 Functions, 4 Paths/Function"
+.Ed
+.Bd -ragged -offset indent
+.Cd "MF8P_VP2 - 8 functions with 2 VPATHs per function required for DirectIO"
+.Ed
+.Pp
+For general information and support, please visit the Neterion support page
+.Pa http://www.neterion.com/support/support.html .
+.Pp
+Support for Jumbo Frames is provided via the interface MTU setting.
+Selecting an MTU larger than 1500 bytes with the
+.Xr ifconfig 8
+utility configures the adapter to transmit and receive Jumbo Frames.
+X3100 adapters support Jumbo Frames up to 9600 bytes.
+.Pp
+For Jumbo Frames, the driver will try to allocate physically contiguous buffers.
+Failures to do so may degrade the performance.
+To resolve such problems, please visit
+.Pa http://www.neterion.com
+where additional information and a kernel patch can be found.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Neterion X3100 10 Gigabit Ethernet adapters listed in
+.Pa http://www.neterion.com .
+.Sh SUPPORT
+For troubleshooting tips and FAQs, please visit
+.Pa http://trac.neterion.com/cgi-bin/trac.cgi/wiki/TitleIndex?anonymous .
+.Pp
+For any issues please send an email to
+.Aq support@neterion.com .
+.Sh SEE ALSO
+.Xr arp 8 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Neterion
+.Aq support@neterion.com .
diff --git a/share/man/man4/watchdog.4 b/share/man/man4/watchdog.4
new file mode 100644
index 000000000000..b0a52b179901
--- /dev/null
+++ b/share/man/man4/watchdog.4
@@ -0,0 +1,147 @@
+.\" Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org>
+.\" Copyright (c) 2003, 2004 Sean M. Kelly <smkelly@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 21, 2009
+.Dt WATCHDOG 4
+.Os
+.Sh NAME
+.Nm watchdog
+.Nd "hardware and software watchdog"
+.Sh SYNOPSIS
+.In sys/watchdog.h
+.Sh DESCRIPTION
+The
+.Nm
+facility is used for controlling hardware and software watchdogs.
+.Pp
+.Pa /dev/fido
+responds to a single
+.Xr ioctl 2
+call,
+.Dv WDIOCPATPAT .
+It takes a single argument which represents a timeout value specified as a
+power of two nanoseconds, or-ed with a flag selecting active or passive control
+of the watchdog.
+.Pp
+.Dv WD_ACTIVE
+indicates that the
+.Nm
+will be kept from timing out from userland, for instance by the
+.Xr watchdogd 8
+daemon.
+.Dv WD_PASSIVE
+indicates that the
+.Nm
+will be kept from timing out from the kernel.
+.Pp
+The
+.Xr ioctl 2
+call will return success if just one of the available
+.Xr watchdog 9
+implementations supports setting the timeout to the specified timeout.
+This
+means that at least one watchdog is armed.
+If the call fails, for instance if
+none of
+.Xr watchdog 9
+implementations support the timeout length, all watchdogs are disabled and must
+be explicitly re-enabled.
+.Pp
+To disable the watchdogs pass
+.Dv WD_TO_NEVER .
+If disarming the watchdog(s) failed an error is returned.
+The watchdog might
+still be armed!
+.Sh RETURN VALUES
+The ioctl returns zero on success and non-zero on failure.
+.Bl -tag -width Er
+.It Bq Er EOPNOTSUPP
+No watchdog present in the kernel or
+none of the watchdogs supports the requested timeout value
+(timeout value other than 0).
+.It Bq Er EOPNOTSUPP
+Watchdog could not be disabled (timeout value of 0).
+.It Bq Er EINVAL
+Invalid flag combination passed.
+.El
+.Sh EXAMPLES
+.Bd -literal -offset indent
+#include <paths.h>
+#include <sys/watchdog.h>
+
+#define WDPATH "/dev/" _PATH_WATCHDOG
+int wdfd = -1;
+
+static void
+wd_init(void)
+{
+ wdfd = open(WDPATH, O_RDWR);
+ if (wdfd == -1)
+ err(1, WDPATH);
+}
+static void
+wd_reset(u_int timeout)
+{
+ if (ioctl(wdfd, WDIOCPATPAT, &timeout) == -1)
+ err(1, "WDIOCPATPAT");
+}
+
+/* in main() */
+wd_init();
+wd_reset(WD_ACTIVE|WD_TO_8SEC);
+/* potential freeze point */
+wd_reset(WD_TO_NEVER);
+.Ed
+.Pp
+Enables a watchdog to recover from a potentially freezing piece of code.
+.Pp
+.Dl "options SW_WATCHDOG"
+.Pp
+in your kernel config adds a software watchdog in the kernel, dropping to KDB
+or panic-ing when firing.
+.Sh SEE ALSO
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+code first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+The software watchdog code and this manual page were written by
+.An Sean Kelly Aq smkelly@FreeBSD.org .
+Some contributions were made by
+.An Jeff Roberson Aq jeff@FreeBSD.org .
+.Sh BUGS
+The
+.Dv WD_PASSIVE
+option has not yet been implemented.
diff --git a/share/man/man4/wb.4 b/share/man/man4/wb.4
new file mode 100644
index 000000000000..038af892f221
--- /dev/null
+++ b/share/man/man4/wb.4
@@ -0,0 +1,196 @@
+.\" Copyright (c) 1997, 1998
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt WB 4
+.Os
+.Sh NAME
+.Nm wb
+.Nd "Winbond W89C840F Fast Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device wb"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_wb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the Winbond W89C840F Fast Ethernet controller
+chip.
+The 840F should not be confused with the 940F, which is
+an NE2000 clone and only supports 10Mbps speeds.
+.Pp
+The Winbond controller uses bus master DMA and is designed to be
+a DEC 'tulip' workalike.
+It differs from the standard DEC design
+in several ways: the control and status registers are spaced 4
+bytes apart instead of 8, and the receive filter is programmed through
+registers rather than by downloading a special setup frame via
+the transmit DMA engine.
+Using an external PHY, the Winbond chip
+supports both 10 and 100Mbps speeds in either full or half duplex.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+This is only
+supported if the PHY chip attached to the Winbond controller
+supports NWAY autonegotiation.
+The user can manually override
+the autoselected mode by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+Note that the 100baseTX media type is only available if supported
+by the adapter.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports Winbond W89C840F based Fast Ethernet
+adapters and embedded controllers including:
+.Pp
+.Bl -bullet -compact
+.It
+Trendware TE100-PCIE
+.El
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "wb%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "wb%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "wb%d: watchdog timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "wb%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "wb%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "wb%d: chip is in D3 power state -- setting to D0"
+This message applies only to adapters which support power
+management.
+Some operating systems place the controller in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The controller loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
+.Sh BUGS
+The Winbond chip seems to behave strangely in some cases when the
+link partner switches modes.
+If for example both sides are set to
+10Mbps half-duplex, and the other end is changed to 100Mbps
+full-duplex, the Winbond's receiver suddenly starts writing trash
+all over the RX descriptors.
+The
+.Nm
+driver handles this by forcing a reset of both the controller
+chip and attached PHY.
+This is drastic, but it appears to be the
+only way to recover properly from this condition.
diff --git a/share/man/man4/wbwd.4 b/share/man/man4/wbwd.4
new file mode 100644
index 000000000000..67af2ec844a5
--- /dev/null
+++ b/share/man/man4/wbwd.4
@@ -0,0 +1,117 @@
+.\"-
+.\" Copyright (c) 2012 Bjoern A. Zeeb <bz@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 6, 2012
+.Dt WBWD 4
+.Os
+.Sh NAME
+.Nm wbwd
+.Nd device driver for watchdog timer found on Winbond Super I/O chips
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device wbwd"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place the following
+line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+wbwd_load="YES"
+.Ed
+.Pp
+In
+.Pa /boot/device.hints :
+.Cd hint.wbwd.0.at="isa"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog interrupt timer present on at least the following
+Winbond Super I/O chips:
+.Pp
+.Bl -bullet -compact
+.It
+83627HF/F/HG/G Rev. G
+.It
+83627HF/F/HG/G Rev. J
+.It
+83627HF/F/HG/G Rev. UD-A
+.It
+83627DHG IC ver. 5
+.El
+.Sh SYSCTL VARIABLES
+The
+.Nm
+driver provides the following options as
+.Xr sysctl 8
+variables.
+.Bl -tag -width "xxxxxx"
+.It Va dev.wbwd.0.timeout_override
+This variable allows to program the timer to a value independent on the one
+provided by the
+.Xr watchdog 4
+framework while still relying on the regular updates from e.g.
+.Xr watchdogd 8 .
+This is particularly useful if your system provides multiple watchdogs and
+you want them to fire in a special sequence to trigger an NMI after a shorter
+period than the reset timeout for example.
+The value set must not be lower than the sleep time of
+.Xr watchdogd 8 .
+A value of 0 disables this feature and the timeout value provided by
+.Xr watchdog 4
+will be used.
+.It Va dev.wbwd.0.debug_verbose
+If set this sysctl will tell the driver to log its current state before and
+after the timer reset on each invocation from
+.Xr watchdog 9
+to the kernel message buffer for debugging.
+.It Va dev.wbwd.0.debug
+This read-only value gives the state of some registers on last update.
+.El
+.Pp
+The
+.Nm
+driver also provides further sysctl options that are hidden by default.
+See the source code for more information.
+.Sh SEE ALSO
+.Xr watchdog 4 ,
+.Xr device.hints 5 ,
+.Xr watchdog 8 ,
+.Xr watchdogd 8 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Bjoern A. Zeeb Aq bz@FreeBSD.org .
diff --git a/share/man/man4/wi.4 b/share/man/man4/wi.4
new file mode 100644
index 000000000000..92dedff7a1d5
--- /dev/null
+++ b/share/man/man4/wi.4
@@ -0,0 +1,377 @@
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" $OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $
+.\"
+.Dd July 23, 2011
+.Dt WI 4
+.Os
+.Sh NAME
+.Nm wi
+.Nd "Lucent Hermes, and Intersil PRISM IEEE 802.11 driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device wi"
+.Cd "device wlan"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_wi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for 802.11b wireless network adapters based around
+the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, and Intersil
+Prism-3 chipsets.
+All chipsets provide a similar interface to the driver.
+Only the Intersil chipsets support access point operation or WPA.
+Very old versions of firmware are not supported at all.
+Older versions of the firmware that are supported may severely limit
+the ability to use these cards in newer networks.
+Only relatively recent versions of Intersil firmware supports WPA.
+See CAVEATS for details.
+All host/device interaction is via programmed I/O, even on those cards
+that support a DMA interface.
+.Pp
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+.Cm adhoc-demo ,
+.Cm hostap ,
+and
+.Cm monitor
+mode operation.
+Only one
+virtual interface may be configured at a time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+Cards supported by the
+.Nm
+driver come in a variety of packages, though the most common
+are of the PCMCIA type.
+In many cases, the PCI version of a wireless card is simply
+a PCMCIA card bundled with a PCI adapter.
+The PCI adapters come in two flavors: true PCMCIA bridges and
+dumb PCMCIA bridges.
+A true PCMCIA bridge (such as those sold by Lucent) will attach
+as a real PCMCIA controller.
+The wireless card will then attach to the PCMCIA bus.
+Wireless cards in PCMCIA slots may be inserted and ejected on the fly.
+.Pp
+A dumb bridge, on the other hand, does not show up as a true PCMCIA bus.
+The wireless card will simply appear to the host as a normal PCI
+device and will not require any PCMCIA support.
+Cards in this type of adapter should only be removed when the
+machine is powered down.
+.Pp
+The following cards are among those supported by the
+.Nm
+driver:
+.Pp
+.Bl -column -compact "Linksys Instant Wireless WPC11 2.5" "Spectrum24" "PCI or PCMCIA"
+.Em "Card Chip Bus"
+3Com AirConnect 3CRWE777A Prism-II PCI
+Accton airDirect WN3301 PCMCIA
+ACTIONTEC HWC01170 Prism-2.5 PCMCIA
+Adaptech ANW-8030 Prism-3 PCMCIA
+Addtron AWP-100 Prism-II PCMCIA
+Adtec Adlink/340C Prism-II PCMCIA
+Airvast WN 100 Prism-3 PCMCIA
+Airway 802.11 Adapter PCMCIA
+Agere Orinoco Hermes PCMCIA
+Allied Telesis WR211PCM Prism-II PCMCIA
+ArTem OnAir Prism? PCMCIA
+Asus WL100 Prism-2.5 PCMCIA
+Avaya Wireless Prism-II PCMCIA
+Bay eMobility 11B Prism-2.5? PCMCIA
+Blue Concentric Circle WL-379F Prism-II CF
+BreezeNet Wireless Prism-II PCMCIA
+Buffalo WLI-PCM-S11 Prism-II PCMCIA
+Buffalo WLI-PCM-L11G Hermes PCMCIA
+Buffalo WLI-CF-S11G Prism-II CF
+Buffalo WLI2-CF-S11G Prism 2.5 CF
+Cabletron RoamAbout Hermes PCMCIA
+Compaq Agency NC5004 Prism-II PCMCIA
+Compaq WL100 Prism-II PCMCIA
+Compaq WL110 Hermes PCMCIA
+Compaq WL200 Prism-II PCMCIA
+Contec FLEXLAN/FX-DS110-PCC Prism-II PCMCIA
+Corega PCC-11 Prism-II PCMCIA
+Corega PCCA-11 Prism-II PCMCIA
+Corega PCCB-11 Prism-II PCMCIA
+Corega CGWLPCIA11 Prism-II PCI
+Dell TrueMobile 1150 Hermes PCMCIA
+Dlink Air 660 Prism-II PCMCIA
+Dlink DWL520 Prism-2.5 PCI
+Dlink DWL650 Prism-2.5 PCMCIA
+ELECOM Air@Hawk/LD-WL11/PCC PCMCIA
+ELSA MC-11 PCMCIA
+ELSA XI300 Prism-II PCMCIA
+ELSA XI325 Prism-2.5 PCMCIA
+ELSA APDL325 Prism-2.5 PCMCIA
+ELSA XI330 Prism-3 PCMCIA
+ELSA XI800 Prism-II CF
+EMTAC A2424i Prism-II PCMCIA
+Farallon Skyline Prism-II PCMCIA
+Gemtek WL-311 Prism-2.5 PCMCIA
+Hawking Technology WE110P Prism-2.5 PCMCIA
+Home Wireless Networks Prism-II PCMCIA
+IBM High Rate Wireless Hermes PCMCIA
+ICOM SL-1100 Prism-II PCMCIA
+I-O DATA WN-B11/PCM Prism-II PCMCIA
+Intersil Prism II Prism-II PCMCIA
+Intersil Mini-PCI Prism-2.5 PCI
+Intersil ISL37100P Prism-3 PCMCIA
+Intersil ISL37110P Prism-3 PCMCIA
+Intersil ISL37300P Prism-3 PCMCIA
+Laneed Wireless PCMCIA
+Linksys Instant Wireless WPC11 Prism-II PCMCIA
+Linksys Instant Wireless WPC11 2.5 Prism-2.5 PCMCIA
+Linksys Instant Wireless WPC11 3.0 Prism-3 PCMCIA
+Linksys WCF11 Prism-3 PCMCIA
+Linksys WCF12 Prism-3 CF
+Lucent WaveLAN Hermes PCMCIA
+Melco Airconnect Prism-II PCMCIA
+Microsoft MN-520 WLAN Prism-II PCMCIA
+NANOSPEED ROOT-RZ2000 Prism-II PCMCIA
+NCR WaveLAN/IEEE 802.11 PCMCIA
+NDC/Sohoware NCP130 Prism-II PCI
+NEC CMZ-RT-WP Prism-II PCMCIA
+NEC PK-WL001 Lucent PCMCIA
+NEC PC-WL/11C Prism-II PCMCIA
+Netgear MA311 Prism-2.5 PCI
+Netgear MA401 Prism-II/2.5 PCMCIA
+Netgear MA401RA Prism-II PCMCIA
+Netgear MA701 Prism-II CF
+NOKIA C020 WLAN Prism-II PCMCIA
+NOKIA C110 WLAN Prism-2.5 PCMCIA
+NTT-ME 11Mbps Wireless LAN Prism-II PCMCIA
+Planex GeoWave/GW-NS110 Prism-II PCMCIA
+Planex GW-NS11H Prism-II PCMCIA
+Proxim Harmony Prism-II PCMCIA
+Proxim RangeLAN-DS Prism-II PCMCIA
+Samsung MagicLAN SWL-2000N Prism-II PCMCIA
+SENAO SL-2511CD Prism-3 PCMCIA
+Siemens SpeedStream SS1021 Prism-II PCMCIA
+Siemens SpeedStream SS1021 Prism-3 PCMCIA
+SMC 2532W-B Prism-II PCMCIA
+SMC 2602 EZ Connect (3.3V) Prism-II PCI or PCMCIA
+SMC 2632 EZ Connect Prism-II PCMCIA
+Socket Low Power WLAN-CF Prism-II CF
+Sony PCWA-C100 Lucent PCMCIA
+Sony PEGA-WL110 Prism-2.5 PCMCIA
+TDK LAK-CD011WL Prism-II PCMCIA
+Toshiba Wireless LAN Card Prism-II PCMCIA
+U.S.\& Robotics Wireless Card 2410 Prism-II PCMCIA
+YIS YWL-11B Prism-II PCMCIA
+.El
+.Pp
+Several vendors sell PCI adapters built around the PLX Technology 9050
+or 9052 chip.
+The following such adapters are supported or expected to work:
+.Pp
+.Bl -item -compact
+.It
+3Com AirConnect 3CRWE777A (3.3V)
+.It
+Belkin F5D6000 (a rebadged WL11000P)
+.It
+Eumitcom WL11000P
+.It
+Global Sun Technology GL24110P (untested)
+.It
+Global Sun Technology GL24110P02
+.It
+LinkSys WDT11 (a rebadged GL24110P02)
+.It
+Netgear MA301
+.It
+US Robotics 2415 (rebadged WL11000P)
+.It
+Wisecom Wireless LAN PCI Adapter
+.El
+.Pp
+The following adapters have the same model numbers as those listed
+above, but might not work if the actual card is after the change away
+from the Prism family:
+.Pp
+.Bl -item -compact
+.It
+DLink DWL520
+.El
+.Sh EXAMPLES
+Join an existing BSS network (ie: connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net
+.Ed
+.Pp
+Join a specific BSS network with WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
+ netmask 0xffffff00 ssid my_net \e
+ wepmode on wepkey 0x8736639624 weptxkey 1
+.Ed
+.Pp
+Join a Lucent legacy demo ad-hoc network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 wlanmode ahdemo \e
+ inet 192.168.0.20 netmask 0xffffff00 ssid my_net
+.Ed
+.Pp
+Join/create an IBSS network with network name
+.Dq Li my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 wlanmode adhoc wi0 \e
+ inet 192.168.0.22 netmask 0xffffff00 ssid my_net
+.Ed
+.Pp
+Create a host-based access point (Prism only):
+.Bd -literal -offset indent
+ifconfig wlan create wlandev wi0 wlanmode hostap \e
+ inet 192.168.0.10 netmask 0xffffff00 ssid my_ap
+.Ed
+.Pp
+Create a host-based access point with WEP enabled (Prism only)
+and plumb it into bridge to fxp0:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev wi0 wlanmode hostap \e
+ inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e
+ wepmode on wepkey 0x1234567890 weptxkey 1
+ifconfig bridge0 create
+ifconfig bridge0 addm wlan0 addm fxp0 up
+.Ed
+.Pp
+This will give you the same functionality as an access point.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "wi%d: init failed"
+The WaveLAN card failed to become ready after an initialization command
+was issued.
+.It "wi%d: failed to allocate %d bytes on NIC"
+The driver was unable to allocate memory for transmit frames in the
+NIC's on-board RAM.
+This can also be an indication of an incorrectly configured interrupt.
+.It "wi%d: device timeout"
+The WaveLAN card failed to generate an interrupt to acknowledge a transmit
+command.
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr pccard 4 ,
+.Xr pccbb 4 ,
+.Xr pcic 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr hostapd 8 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8 .
+.Rs
+.%T HCF Light programming specification
+.%U http://web.archive.org/web/20040130141721/http://wavelan.com/
+.Re
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The original
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
+This man page comes from
+.Ox .
+.Sh CAVEATS
+The driver will reject devices with old firmware to
+avoid dealing with numerous defects.
+Unfortunately the driver does not support downloading new firmware
+to the card so if new firmware is needed users will have to boot
+a different system to accomplish this.
+.Pp
+Intersil Prism cards must have firmware versions 0.8.0 or later and
+version 1.7.0 or later are required to support functionality such as WPA.
+Some users of Prism-II and 2.5 based cards report that station firmware
+version 1.3.4 works better for them in hostap than 1.4.9.
+Older versions of the Prism station firmware have a number of issues
+with hostap mode.
+The IBSS/adhoc mode appears to work well on station firmware 1.3.1 and
+later.
+The IBSS/adhoc mode appears to have problems for some people with
+older versions of station firmware.
+.Pp
+Lucent cards prior to firmware version 6.0.6 do not implement IBSS
+mode and are not supported.
+.Pp
+Prior versions of
+.Nm
+supported Symbol firmware.
+That support has been removed due to persistent problems with this
+firmware as well as getting proper documentation on this firmware.
+.Pp
+Hermes 2 and Hermes 3 chips are not supported by this driver.
+.Pp
+Here's the above requirements in the form of a table
+.Pp
+.Bl -column -compact "Prims II/2.5" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx"
+.Em "Firmware Minimum WPA Host AP Adhoc/IBSS"
+Prism II/2.5 0.8.0 1.7.0 1.3.4 1.3.1
+Prism 3 0.8.0 1.7.0 1.4.9 1.3.1
+Hermes 6.0.6 none none 6.0.6
+Symbol none none none none
+.El
+.Sh BUGS
+Not all the new messages are documented here, and many of them are
+indications of transient errors that are not indications of serious
+problems.
diff --git a/share/man/man4/witness.4 b/share/man/man4/witness.4
new file mode 100644
index 000000000000..c0014fa79d1c
--- /dev/null
+++ b/share/man/man4/witness.4
@@ -0,0 +1,144 @@
+.\" Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 18, 2001
+.Dt WITNESS 4
+.Os
+.Sh NAME
+.Nm witness
+.Nd lock validation facility
+.Sh SYNOPSIS
+.Cd options WITNESS
+.Cd options WITNESS_KDB
+.Cd options WITNESS_SKIPSPIN
+.Sh DESCRIPTION
+The
+.Nm
+module keeps track of the locks acquired and released by each thread.
+It also keeps track of the order in which locks are acquired with respect
+to each other.
+Each time a lock is acquired,
+.Nm
+uses these two lists to verify that a lock is not being acquired in the
+wrong order.
+If a lock order violation is detected, then a message is output to the
+kernel console detailing the locks involved and the locations in question.
+Witness can also be configured to drop into the kernel debugger when an order
+violation occurs.
+.Pp
+The
+.Nm
+code also checks various other conditions such as verifying that one
+does not recurse on a non-recursive lock.
+For sleep locks,
+.Nm
+verifies that a new process would not be switched to when a lock is released
+or a lock is blocked on during an acquire while any spin locks are held.
+If any of these checks fail, then the kernel will panic.
+.Pp
+The flag that controls whether or not the kernel debugger is entered when a
+lock order violation is detected can be set in a variety of ways.
+By default, the flag is off, but if the
+.Dv WITNESS_KDB
+kernel option is
+specified, then the flag will default to on.
+It can also be set from the
+.Xr loader 8
+via the
+.Va debug.witness.kdb
+environment variable or after the kernel has booted via the
+.Va debug.witness.kdb
+sysctl.
+If the flag is set to zero, then the debugger will not be entered.
+If the flag is non-zero, then the debugger will be entered.
+.Pp
+The
+.Nm
+code can also be configured to skip all checks on spin mutexes.
+By default, this flag defaults to off, but it can be turned on by
+specifying the
+.Dv WITNESS_SKIPSPIN
+kernel option.
+The flag can also be set via the
+.Xr loader 8
+environment variable
+.Va debug.witness.skipspin .
+If the variable is set to a non-zero value, then spin mutexes are skipped.
+Once the kernel has booted, the status of this flag can be examined but not
+set via the read-only sysctl
+.Va debug.witness.skipspin .
+.Pp
+The sysctl
+.Va debug.witness.watch
+specifies the level of witness involvement in the system.
+A value of 1 specifies that witness is enabled.
+A value of 0 specifies that witness is disabled, but that can be enabled
+again. This will maintain a small amount of overhead in the system.
+A value of -1 specifies that witness is disabled permanently and that
+cannot be enabled again.
+The sysctl
+.Va debug.witness.watch
+can be set via
+.Xr loader 8 .
+.Pp
+The
+.Nm
+code also provides two extra
+.Xr ddb 4
+commands if both
+.Nm
+and
+.Xr ddb 4
+are compiled into the kernel:
+.Bl -ohang
+.It Ic show locks
+Outputs the list of locks held by the current thread to the kernel console
+along with the filename and line number at which each lock was last acquired
+by this thread.
+.It Ic show witness
+Dump the current order list to the kernel console.
+The code first displays the lock order tree for all of the sleep locks.
+Then it displays the lock order tree for all of the spin locks.
+Finally, it displays a list of locks that have not yet been acquired.
+.El
+.Sh SEE ALSO
+.Xr ddb 4 ,
+.Xr loader 8 ,
+.Xr sysctl 8 ,
+.Xr mutex 9
+.Sh HISTORY
+The
+.Nm
+code first appeared in
+.Bsx 5.0
+and was imported from there into
+.Fx 5.0 .
+.Sh BUGS
+The
+.Nm
+code currently does not handle recursion of shared
+.Xr sx 9
+locks properly.
diff --git a/share/man/man4/wlan.4 b/share/man/man4/wlan.4
new file mode 100644
index 000000000000..76e797cc51c9
--- /dev/null
+++ b/share/man/man4/wlan.4
@@ -0,0 +1,219 @@
+.\"
+.\" Copyright (c) 2003 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 22, 2012
+.Dt WLAN 4
+.Os
+.Sh NAME
+.Nm wlan
+.Nd generic 802.11 link-layer support
+.Sh SYNOPSIS
+.Cd "device wlan"
+.Sh DESCRIPTION
+The
+.Nm
+module provides generic code to support 802.11 drivers.
+Where a device does not directly support 802.11 functionality
+this layer fills in.
+The
+.Nm
+module is required by all native 802.11 drivers as well as the
+.Xr ndis 4
+support.
+.Pp
+.Nm
+supports multi-mode devices capable of
+operating in both 2.4GHz and 5GHz bands and supports numerous
+802.11 standards: 802.11a, 802.11b, 802.11g, 802.11n, and 802.11s (Draft 3.0).
+The WPA, 802.11i, and 802.1x security protocols are supported
+through a combination of in-kernel code and user-mode applications.
+The WME/WMM multi-media protocols are supported entirely within
+the
+.Nm
+module but require a suitably capable hardware device.
+Likewise the 802.11h specification is supported only by suitably
+capable devices.
+.Pp
+Drivers provide 802.11 functionality through
+.Nm
+interfaces that are created at runtime using interface cloning.
+This is done with the
+.Xr ifconfig 8
+.Cm create
+command or using the
+.Va wlans_IFX
+variable in
+.Xr rc.conf 5 .
+Some drivers support the creation of multiple
+.Nm
+interfaces that share the same underlying device;
+this is the way by which ``multi-bss support'' is provided but it
+can also be used to create WDS links and other interesting applications.
+.Pp
+There are several types of
+.Nm
+interfaces that may be created:
+.Bl -tag -width monitor
+.It Cm sta
+A client station in an infrastructure bss
+(i.e. one that associates to an access point).
+.It Cm hostap
+An access point in an infrastructure bss.
+.It Cm mesh
+A mesh station in an MBSS network.
+.It Cm adhoc
+A station in an IBSS network.
+.It Cm ahdemo
+A station operating in ``adhoc demo mode''.
+This is essentially an IBSS station that does not use management
+frames (e.g. no beacons are transmitted).
+An
+.Cm ahdemo
+interface is especially useful for applications that want to transmit
+and receive raw 802.11 packets.
+.It Cm monitor
+An interface used exclusively for capturing 802.11 frames.
+In particular this specified to have read-only properties
+which enables it to be operated on frequencies where one
+would otherwise not be allowed.
+.It Cm wds
+A station that passes 4-address 802.11 traffic for the purpose
+of tunneling traffic over a wireless link.
+Typically this station would share the same MAC address as a
+.Cm hostap
+interface.
+It may be possible to create
+.Cm wds
+interfaces without a companion
+.Cm hostap
+interface but that is not guaranteed; one may need to create a
+.Cm hostap
+interface that does not send beacon frames before
+.Cm wds
+interfaces may be created.
+.El
+.Pp
+Note that an interface's type cannot be changed once it is created.
+.Pp
+.Nm
+defines several mechanisms by which plugin modules may
+be used to extend its functionality.
+Cryptographic support such as WEP, TKIP, and AES-CCMP are implemented
+as standalone modules (if not statically configured into a system)
+that register with
+.Nm .
+Similarly there is an authenticator framework for defining 802.11
+authentication services and a framework for integrating access
+control mechanisms specific to the 802.11 protocol.
+.Sh DEBUGGING
+If the
+.Dv IEEE80211_DEBUG
+option is included in the kernel configuration,
+debugging controls are available using:
+.Pp
+.Dl "sysctl net.wlan.X.debug=mask"
+.Pp
+where
+.Ar X
+is the number of the
+.Nm
+instance and mask is a bit-or of control bits that determine which
+debugging messages to enable.
+For example,
+.Pp
+.Dl "sysctl net.wlan.0.debug=0x00200000"
+.Pp
+enables debugging messages related to scanning for an access point,
+adhoc neighbor, or an unoccupied channel when operation as an access point.
+The
+.Xr wlandebug 8
+tool provides a more user-friendly mechanism for doing the same thing.
+Note that
+.Pp
+.Dl "sysctl net.wlan.debug=mask"
+.Pp
+defines the initial value of the debugging flags for each cloned
+.Nm
+interface; this is useful to enable debug messages during interface creation.
+.Sh COMPATIBILITY
+The module name of
+.Nm
+was used to be compatible with
+.Nx .
+.Pp
+Mesh stations follow the 802.11s Draft 3.0 specification which is
+not ratified and subject to change.
+Beware that this specification is incompatible with earlier drafts;
+and stations implementing earlier drafts (e.g. Linux)
+may not interoperate.
+.Sh SEE ALSO
+.Xr an 4 ,
+.Xr ath 4 ,
+.Xr bwi 4 ,
+.Xr bwn 4 ,
+.Xr ipw 4 ,
+.Xr iwi 4 ,
+.Xr iwn 4 ,
+.Xr malo 4 ,
+.Xr mwl 4 ,
+.Xr netintro 4 ,
+.Xr ral 4 ,
+.Xr rum 4 ,
+.Xr run 4 ,
+.Xr uath 4 ,
+.Xr upgt 4 ,
+.Xr ural 4 ,
+.Xr urtw 4 ,
+.Xr wi 4 ,
+.Xr wlan_acl 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr wlan_xauth 4 ,
+.Xr wpi 4 ,
+.Xr zyd 4
+.Sh STANDARDS
+More information can be found in the IEEE 802.11 Standards.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+Atsushi Onoe is the author of original
+.Nx
+software from which this work began.
+.An -nosplit
+.An Sam Leffler
+brought the code into
+.Fx
+and then rewrote it to support multi-mode devices,
+802.11g, 802.11n, WPA/802.11i, WME, multi-bss, and
+add the extensible frameworks
+for cryptographic, authentication, and access control plugins.
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man4/wlan_acl.4 b/share/man/man4/wlan_acl.4
new file mode 100644
index 000000000000..25314bd6a38f
--- /dev/null
+++ b/share/man/man4/wlan_acl.4
@@ -0,0 +1,57 @@
+.\"
+.\" Copyright (c) 2004 Sam Leffler
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2004
+.Dt WLAN_ACL 4
+.Os
+.Sh NAME
+.Nm wlan_acl
+.Nd MAC-based ACL support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_acl"
+.Sh DESCRIPTION
+The
+.Nm
+module implements a MAC-based access control plugin for use
+with 802.11 devices operating as an access point.
+The
+.Nm
+must be loaded for
+.Xr ifconfig 8
+to handle the
+.Cm mac:*
+requests.
+.Sh SEE ALSO
+.Xr wlan 4 ,
+.Xr ifconfig 8
+.Sh STANDARDS
+More information can be found in the IEEE 802.11 Standard.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wlan_amrr.4 b/share/man/man4/wlan_amrr.4
new file mode 100644
index 000000000000..92477677ffdb
--- /dev/null
+++ b/share/man/man4/wlan_amrr.4
@@ -0,0 +1,59 @@
+.\"
+.\" Copyright (c) 2007 Kevin Lo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2008
+.Dt WLAN_AMRR 4
+.Os
+.Sh NAME
+.Nm wlan_amrr
+.Nd AMRR rate adaptation algorithm support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_amrr"
+.Sh DESCRIPTION
+The
+.Nm
+module implements the Adaptive Multi-Rate Retry tx rate control
+algorithm for use by 802.11 device drivers.
+.Sh SEE ALSO
+.Xr bwi 4 ,
+.Xr iwn 4 ,
+.Xr ral 4 ,
+.Xr rum 4 ,
+.Xr ural 4 ,
+.Xr wlan 4 ,
+.Xr wpi 4 ,
+.Xr zyd 4
+.Sh STANDARDS
+More information can be found in the paper describing the
+.Em AMRR
+algorithm at
+.Pa http://hal.inria.fr/inria-00070784/en/ .
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wlan_ccmp.4 b/share/man/man4/wlan_ccmp.4
new file mode 100644
index 000000000000..ccf7a2720635
--- /dev/null
+++ b/share/man/man4/wlan_ccmp.4
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2004 Sam Leffler
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2004
+.Dt WLAN_CCMP 4
+.Os
+.Sh NAME
+.Nm wlan_ccmp
+.Nd AES-CCMP crypto support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_ccmp"
+.Sh DESCRIPTION
+The
+.Nm
+module handles the AES-CCMP cryptographic requirements of the
+WPA and 802.11i protocols.
+It does encapsulation and decapsulation of CCMP-encoded 802.11 frames
+and optionally calculates the AES-CCMP cipher.
+The
+.Nm
+module is an 802.11 cryptographic plugin module for use by the
+.Xr wlan 4
+module.
+This module is automatically loaded if an AES-CCMP key is configured;
+typically by a WPA supplicant program such as wpa_supplicant,
+or a WPA authenticator program such as
+.Nm hostapd .
+Should the underlying network device not be capable of doing the AES-CCMP
+calculations in hardware, the
+.Nm
+module will do the work.
+.Sh SEE ALSO
+.Xr wlan 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4
+.Sh STANDARDS
+More information can be found in the IEEE 802.11, WPA, and 802.11i Standards.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wlan_tkip.4 b/share/man/man4/wlan_tkip.4
new file mode 100644
index 000000000000..2a2a254fd329
--- /dev/null
+++ b/share/man/man4/wlan_tkip.4
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2004 Sam Leffler
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2004
+.Dt WLAN_TKIP 4
+.Os
+.Sh NAME
+.Nm wlan_tkip
+.Nd TKIP and Michael crypto support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_tkip"
+.Sh DESCRIPTION
+The
+.Nm
+module handles the TKIP and Michael cryptographic requirements of the
+WPA and 802.11i protocols.
+It does encapsulation and decapsulation of TKIP-encoded 802.11 frames
+and optionally calculates the TKIP cipher and Michael MIC.
+The
+.Nm
+module is an 802.11 cryptographic plugin module for use by the
+.Xr wlan 4
+module.
+This module is automatically loaded if a TKIP key is configured;
+typically by a WPA supplicant program such as wpa_supplicant,
+or a WPA authenticator program such as
+.Nm hostapd .
+Should the underlying network device not be capable of doing the TKIP
+and/or Michael calculations in hardware, the
+.Nm
+module will do the work.
+.Sh SEE ALSO
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_wep 4
+.Sh STANDARDS
+More information can be found in the IEEE 802.11, WPA, and 802.11i Standards.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wlan_wep.4 b/share/man/man4/wlan_wep.4
new file mode 100644
index 000000000000..3bf1040d34b5
--- /dev/null
+++ b/share/man/man4/wlan_wep.4
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (c) 2004 Sam Leffler
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2004
+.Dt WLAN_WEP 4
+.Os
+.Sh NAME
+.Nm wlan_wep
+.Nd WEP crypto support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_wep"
+.Sh DESCRIPTION
+The
+.Nm
+module handles the WEP cryptographic requirements of the 802.11 protocol.
+It does encapsulation and decapsulation of WEP-encoded 802.11 frames
+and optionally calculates the WEP cipher.
+The
+.Nm
+module is an 802.11 cryptographic plugin module for use by the
+.Xr wlan 4
+module.
+This module is automatically loaded if a WEP key is configured with
+.Xr ifconfig 8 .
+Should the underlying network device not be capable of doing the WEP
+calculations in hardware, the
+.Nm
+module will do the work.
+.Sh SEE ALSO
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4
+.Sh STANDARDS
+More information can be found in the IEEE 802.11 Standard.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wlan_xauth.4 b/share/man/man4/wlan_xauth.4
new file mode 100644
index 000000000000..b1fdfc5d4fd0
--- /dev/null
+++ b/share/man/man4/wlan_xauth.4
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright (c) 2004 Sam Leffler
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2004
+.Dt WLAN_XAUTH 4
+.Os
+.Sh NAME
+.Nm wlan_xauth
+.Nd External authenticator support for 802.11 devices
+.Sh SYNOPSIS
+.Cd "device wlan_xauth"
+.Sh DESCRIPTION
+The
+.Nm
+module is a
+.Xr wlan 4
+authenticator plugin
+for use with user-mode authentication implementations such
+as
+.Nm hostapd .
+It hooks into the 802.11 layer and does nothing.
+As a result, 802.11 stations that associate are not authorized to
+send or receive frames until they are authorized by an external agent;
+typically using a protocol such as WPA, 802.1x, or 802.11i.
+.Pp
+This module is automatically loaded by the rc script that normally
+starts
+.Xr hostapd 8 .
+.Sh SEE ALSO
+.Xr wlan 4
+.Sh STANDARDS
+More information can be found in the IEEE 802.11, WPA, and 802.11i Standards.
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.0 .
diff --git a/share/man/man4/wpi.4 b/share/man/man4/wpi.4
new file mode 100644
index 000000000000..efcfdbaa09b6
--- /dev/null
+++ b/share/man/man4/wpi.4
@@ -0,0 +1,144 @@
+.\" Copyright (c) 2004-2007
+.\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
+.\" Benjamin Close <Benjamin.Close@clearchain.com>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice unmodified, this list of conditions, and the following
+.\" disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2008
+.Dt WPI 4
+.Os
+.Sh NAME
+.Nm wpi
+.Nd "Intel 3945ABG Wireless LAN IEEE 802.11 driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device wpi"
+.Cd "device wpifw"
+.Cd "device pci"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Cd "device firmware"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_wpi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn Intel
+3945ABG Wireless network adapter
+.Nm
+supports
+.Cm station ,
+.Cm adhoc ,
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Pp
+This driver requires the firmware built with the
+.Nm wpifw
+module to work.
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/doc/legal/intel_wpi/LICENSE" -compact
+.It Pa /usr/share/doc/legal/intel_wpi/LICENSE
+.Nm
+firmware license
+.El
+.Sh EXAMPLES
+Join an existing BSS network (i.e., connect to an access point):
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev wpi0 inet 192.168.0.20 \e
+ netmask 0xffffff00
+.Ed
+.Pp
+Join a specific BSS network with network name
+.Dq Li my_net :
+.Pp
+.Dl "ifconfig wlan0 create wlandev wpi0 ssid my_net up"
+.Pp
+Join a specific BSS network with 64-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev wpi0 ssid my_net \e
+ wepmode on wepkey 0x1234567890 weptxkey 1 up
+.Ed
+.Pp
+Join a specific BSS network with 128-bit WEP encryption:
+.Bd -literal -offset indent
+ifconfig wlan0 create wlandev wpi0 wlanmode adhoc ssid my_net \e
+ wepmode on wepkey 0x01020304050607080910111213 weptxkey 1
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "wpi%d: could not load firmware image '%s'"
+The driver failed to load the firmware image using the
+.Xr firmware 9
+subsystem.
+Verify the
+.Xr wpifw
+firmware module is installed.
+.It "wpi%d: fatal firmware error"
+An unknown error has occurred in the uploaded firmware, you may have to
+unload/reload the driver to continue.
+.It "wpi%d: Radio transmitter is switched off"
+The hardware switch controlling the radio is currently turned off.
+Data transmission is not possible in this state.
+.El
+.Sh SEE ALSO
+.Xr wpifw 4 ,
+.Xr pci 4 ,
+.Xr wlan 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8 .
+.Sh AUTHORS
+.An -nosplit
+The original
+.Nm
+driver was written for
+.Ox
+by
+.An Damien Bergamini Aq damien.bergamini@free.fr .
+.An Benjamin Close Aq benjsc@FreeBSD.org
+ported
+.Nm
+to
+.Fx .
+.Sh BUGS
+Not all the error messages are documented here.
+.Pp
+Background scanning is not currently supported.
diff --git a/share/man/man4/xe.4 b/share/man/man4/xe.4
new file mode 100644
index 000000000000..0935884badc9
--- /dev/null
+++ b/share/man/man4/xe.4
@@ -0,0 +1,168 @@
+.\"
+.\" Copyright (c) 2003 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 16, 2005
+.Dt XE 4
+.Os
+.Sh NAME
+.Nm xe
+.Nd "Xircom PCMCIA Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device xe"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_xe_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports
+.Tn PCMCIA
+Ethernet adapters based on Xircom CE2- and CE3-class hardware.
+This includes devices made by Xircom along with
+various
+.Tn OEM
+manufacturers.
+.Pp
+Please note that the
+.Nm
+driver only supports
+.Tn PCMCIA
+cards and their Ethernet functions.
+.Nm
+does not support the on-board modem device located on some
+version of the Ethernet/modem combo cards.
+In particular, Xircom RealPort2 cards are not supported by this driver.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width ".Cm autoselect"
+.It Cm autoselect
+Enable autoselection of media type and options.
+.It Cm 10Base2/BNC
+Select 10Mbps operation on a BNC coaxial connector.
+.It Cm 10BaseT/UTP
+Select 10Mbps operation on a RJ-45 connector.
+.It Cm 100BaseTX
+Select 100Mbps operation.
+.El
+.Pp
+Note that 100BaseTX operation is not available on CE2-class cards,
+while the 10Base2/BNC mode is only available on CE2-class cards.
+Full-duplex
+operation is currently not supported.
+For more information on configuring network interface devices,
+see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following cards:
+.Pp
+.Bl -bullet -compact
+.It
+Xircom CreditCard Ethernet (PS-CE2-10)
+.It
+Xircom CreditCard Ethernet + Modem 28 (PS-CEM-28)
+.It
+Xircom CreditCard Ethernet + Modem 33 (CEM33)
+.It
+Xircom CreditCard 10/100 (CE3, CE3B)
+.It
+Xircom CreditCard Ethernet 10/100 + Modem 56 (CEM56)
+.It
+Xircom RealPort Ethernet 10 (RE10)
+.It
+Xircom RealPort Ethernet 10/100 (RE100)
+.It
+Xircom RealPort Ethernet 10/100 + Modem 56 (REM56, REM56G)
+.It
+Accton Fast EtherCard-16 (EN2226)
+.It
+Compaq Microcom CPQ550 Ethernet/Modem PC Card
+.It
+Compaq Netelligent 10/100 PC Card (CPQ-10/100)
+.It
+Intel EtherExpress Pro/100 PC Card Mobile Adapter 16 (Pro/100 M16A)
+.It
+Intel EtherExpress Pro/100 LAN/Modem PC Card Adapter (Pro/100 M16B)
+.El
+.Pp
+Other similar devices using the same hardware may also be supported.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "xe%d: Cannot allocate ioport"
+.It "xe%d: Cannot allocate irq"
+A fatal initialization error occurred while attempting to allocate
+system resources for the card.
+.It "xe%d: Unable to fix your %s combo card"
+A fatal initialization error occurred while attempting to attach an
+Ethernet/modem combo card.
+.It "xe%d: watchdog timeout: resetting card"
+The card failed to generate an interrupt acknowledging a
+transmitted packet.
+May indicate a
+.Tn PCMCIA
+configuration problem.
+.It "xe%d: no carrier"
+The card has lost all contact with the network; this
+usually indicates a cable problem.
+.El
+.Sh SEE ALSO
+.Xr pccard 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 3.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+device driver was written by
+.An Scott Mitchell Aq rsm@FreeBSD.org .
+This manual page was written by
+.An Scott Mitchell Aq rsm@FreeBSD.org ,
+and
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
+.Sh BUGS
+Supported devices will fail to attach on some machines using the
+.Tn NEWCARD
+.Tn PC
+Card framework.
+.Pp
+Automatic media selection is usually unreliable.
diff --git a/share/man/man4/xen.4 b/share/man/man4/xen.4
new file mode 100644
index 000000000000..e053fc53580e
--- /dev/null
+++ b/share/man/man4/xen.4
@@ -0,0 +1,185 @@
+.\" Copyright (c) 2010 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" This software was developed by SRI International and the University of
+.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+.\" ("CTSRD"), as part of the DARPA CRASH research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 17, 2010
+.Dt XEN 4
+.Os
+.Sh NAME
+.Nm xen
+.Nd Xen Hypervisor Guest (DomU) Support
+.Sh SYNOPSIS
+To compile para-virtualized (PV) Xen guest support into an i386 kernel, place
+the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options PAE"
+.Cd "options XEN"
+.Cd "nooptions NATIVE"
+.Ed
+.Pp
+To compile hardware-assisted virtualization (HVM) Xen guest support with
+para-virtualized drivers into an amd64 kernel, place the following lines in
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options XENHVM"
+.Cd "device xenpci"
+.Ed
+.Sh DESCRIPTION
+The Xen Hypervisor allows multiple virtual machines to be run on a single
+computer system.
+When first released, Xen required that i386 kernels be compiled
+"para-virtualized" as the x86 instruction set was not fully virtualizable.
+Primarily, para-virtualization modifies the virtual memory system to use
+hypervisor calls (hypercalls) rather than direct hardware instructions to
+modify the TLB, although para-virtualized device drivers were also required
+to access resources such as virtual network interfaces and disk devices.
+.Pp
+With later instruction set extensions from AMD and Intel to support fully
+virtualizable instructions, unmodified virtual memory systems can also be
+supported; this is referred to as hardware-assisted virtualization (HVM).
+HVM configurations may either rely on transparently emulated hardware
+peripherals, or para-virtualized drivers, which are aware of virtualization,
+and hence able to optimize certain behaviors to improve performance or
+semantics.
+.Pp
+.Fx
+supports a fully para-virtualized (PV) kernel on the i386 architecture using
+.Cd "options XEN"
+and
+.Cd "nooptions NATIVE" ;
+currently, this requires use of a PAE kernel, enabled via
+.Cd "options PAE" .
+.Pp
+.Fx
+supports hardware-assisted virtualization (HVM) on both the i386 and amd64
+kernels; however, PV device drivers with an HVM kernel are only supported on
+the amd64 architecture, and require
+.Cd "options XENHVM"
+and
+.Cd "device xenpci" .
+.Pp
+Para-virtualized device drivers are required in order to support certain
+functionality, such as processing management requests, returning idle
+physical memory pages to the hypervisor, etc.
+.Ss Xen DomU device drivers
+Xen para-virtualized drivers are automatically added to the kernel if a PV
+kernel is compiled using
+.Cd "options XEN" ;
+for HVM environments,
+.Cd "options XENHVM"
+and
+.Cd "device xenpci"
+are required.
+The follow drivers are supported:
+.Bl -hang -offset indent -width blkfront
+.It Nm balloon
+Allow physical memory pages to be returned to the hypervisor as a result of
+manual tuning or automatic policy.
+.It Nm blkback
+Exports local block devices or files to other Xen domains where they can
+then be imported via
+.Nm blkfront .
+.It Nm blkfront
+Import block devices from other Xen domains as local block devices, to be
+used for file systems, swap, etc.
+.It Nm console
+Export the low-level system console via the Xen console service.
+.It Nm control
+Process management operations from Domain 0, including power off, reboot,
+suspend, crash, and halt requests.
+.It Nm evtchn
+Expose Xen events via the
+.Pa /dev/xen/evtchn
+special device.
+.It Nm netback
+Export local network interfaces to other Xen domains where they can be
+imported via
+.Nm netfront .
+.It Nm netfront
+Import network interfaces from other Xen domains as local network interfaces,
+which may be used for IPv4, IPv6, etc.
+.It Nm pcifront
+Allow physical PCI devices to be passed through into a PV domain.
+.It Nm xenpci
+Represents the Xen PCI device, an emulated PCI device that is exposed to
+HVM domains.
+This device allows detection of the Xen hypervisor, and provides interrupt
+and shared memory services required to interact with the hypervisor.
+.El
+.Ss Performance considerations
+In general, PV drivers will perform better than emulated hardware, and are
+the recommended configuration for HVM installations.
+.Pp
+Using a hypervisor introduces a second layer of scheduling that may limit the
+effectiveness of certain
+.Fx
+scheduling optimisations.
+Among these is adaptive locking, which is no longer able to determine whether
+a thread holding a lock is in execution.
+It is recommended that adaptive locking be disabled when using Xen:
+.Bd -unfilled -offset indent
+.Cd "options NO_ADAPTIVE_MUTEXES"
+.Cd "options NO_ADAPTIVE_RWLOCKS"
+.Cd "options NO_ADAPTIVE_SX"
+.Ed
+.Sh SEE ALSO
+.Xr pae 4
+.Sh HISTORY
+Support for
+.Nm
+first appeared in
+.Fx 8.1 .
+.Sh AUTHORS
+.An -nosplit
+.Fx
+support for Xen was first added by
+.An Kip Macy Aq kmacy@FreeBSD.org
+and
+.An Doug Rabson Aq dfr@FreeBSD.org .
+Further refinements were made by
+.An Justin Gibbs Aq gibbs@FreeBSD.org ,
+.An Adrian Chadd Aq adrian@FreeBSD.org ,
+and
+.An Colin Percival Aq cperciva@FreeBSD.org .
+This manual page was written by
+.An Robert Watson Aq rwatson@FreeBSD.org .
+.Sh BUGS
+.Fx
+is only able to run as a Xen guest (DomU) and not as a Xen host (Dom0).
+.Pp
+A fully para-virtualized (PV) kernel is only supported on i386, and not
+amd64.
+.Pp
+Para-virtualized drivers under hardware-assisted virtualization (HVM) kernel
+are only supported on amd64, not i386.
+.Pp
+As of this release, Xen PV DomU support is not heavily tested; instability
+has been reported during VM migration of PV kernels.
+.Pp
+Certain PV driver features, such as the balloon driver, are under-exercised.
diff --git a/share/man/man4/xhci.4 b/share/man/man4/xhci.4
new file mode 100644
index 000000000000..09f3185353c5
--- /dev/null
+++ b/share/man/man4/xhci.4
@@ -0,0 +1,68 @@
+.\"
+.\" Copyright (c) 2011 Hans Petter Selasky. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 17, 2011
+.Dt XHCI 4
+.Os
+.Sh NAME
+.Nm xhci
+.Nd USB eXtensible Host Controller driver
+.Sh SYNOPSIS
+.Cd "device xhci"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.Tn USB
+eXtensible Host Controller Interface,
+which allows use of
+.Tn USB
+1.0, 2.0 and 3.0 devices on the same
+.Tn USB
+port.
+.Pp
+The
+.Tn XHCI
+controller supports
+.Tn USB
+connection speeds up to 5.0Gbps when using a USB 3.0 compliant device.
+.Sh HARDWARE
+The
+.Nm
+driver supports
+.Tn XHCI
+compatible controllers having PCI class 12 (serial bus),
+subclass 3 (USB) and programming interface 48 (XHCI).
+.Sh SEE ALSO
+.Xr ehci 4 ,
+.Xr ohci 4 ,
+.Xr uhci 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 8.2 .
diff --git a/share/man/man4/xl.4 b/share/man/man4/xl.4
new file mode 100644
index 000000000000..9c8e8b0a5fdf
--- /dev/null
+++ b/share/man/man4/xl.4
@@ -0,0 +1,270 @@
+.\" Copyright (c) 1997, 1998
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 23, 2008
+.Dt XL 4
+.Os
+.Sh NAME
+.Nm xl
+.Nd "3Com Etherlink XL and Fast Etherlink XL Ethernet device driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device miibus"
+.Cd "device xl"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_xl_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for PCI Ethernet adapters and embedded
+controllers based on the 3Com "boomerang," "cyclone," "hurricane"
+and "tornado" bus-master Etherlink XL chips.
+.Pp
+The Etherlink XL chips support built-in 10baseT, 10base2 and 10base5
+transceivers as well as an MII bus for externally attached PHY
+transceivers.
+The 3c905 series typically uses a National Semiconductor
+NS 83840A 10/100 PHY for 10/100 Mbps support in full or half-duplex.
+The 3c905B adapters have built-in autonegotiation logic mapped onto
+the MII for compatibility with previous drivers.
+Fast Etherlink XL
+adapters such as the 3c905-TX and 3c905B-TX are capable of 10 or
+100Mbps data rates in either full or half duplex and can be manually
+configured for any supported mode or automatically negotiate the highest
+possible mode with a link partner.
+.Pp
+The
+.Nm
+driver supports the following media types:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It autoselect
+Enable autoselection of the media type and options.
+Note that this
+option is only available with the 3c905 and 3c905B adapters with
+external PHYs or built-in autonegotiation logic.
+For 3c900 adapters,
+the driver will choose the mode specified in the EEPROM.
+The user can
+change this by adding media options to the
+.Pa /etc/rc.conf
+file.
+.It 10baseT/UTP
+Set 10Mbps operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 100baseTX
+Set 100Mbps (Fast Ethernet) operation.
+The
+.Ar mediaopt
+option can also be used to select either
+.Ar full-duplex
+or
+.Ar half-duplex
+modes.
+.It 10base5/AUI
+Enable AUI transceiver (available only on COMBO cards).
+.It 10base2/BNC
+Enable BNC coax transceiver (available only on COMBO cards).
+.El
+.Pp
+The
+.Nm
+driver supports the following media options:
+.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
+.It full-duplex
+Force full duplex operation
+.It half-duplex
+Force half duplex operation.
+.El
+.Pp
+Note that the 100baseTX media type is only available if supported
+by the adapter.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The
+.Nm
+driver supports the following hardware:
+.Pp
+.Bl -bullet -compact
+.It
+3Com 3c900-TPO
+.It
+3Com 3c900-COMBO
+.It
+3Com 3c905-TX
+.It
+3Com 3c905-T4
+.It
+3Com 3c900B-TPO
+.It
+3Com 3c900B-TPC
+.It
+3Com 3c900B-FL
+.It
+3Com 3c900B-COMBO
+.It
+3Com 3c905B-T4
+.It
+3Com 3c905B-TX
+.It
+3Com 3c905B-FX
+.It
+3Com 3c905B-COMBO
+.It
+3Com 3c905C-TX
+.It
+3Com 3c980, 3c980B, and 3c980C server adapters
+.It
+3Com 3cSOHO100-TX OfficeConnect adapters
+.It
+3Com 3c450 HomeConnect adapters
+.It
+3Com 3c555, 3c556 and 3c556B mini-PCI adapters
+.It
+3Com 3C3SH573BT, 3C575TX, 3CCFE575BT, 3CXFE575BT, 3CCFE575CT, 3CXFE575CT,
+3CCFEM656, 3CCFEM656B, and 3CCFEM656C, 3CXFEM656, 3CXFEM656B, and
+3CXFEM656C CardBus adapters
+.It
+3Com 3c905-TX, 3c905B-TX 3c905C-TX, 3c920B-EMB, and 3c920B-EMB-WNM embedded adapters
+.El
+.Pp
+Both the 3C656 family of CardBus cards and the 3C556 family of MiniPCI
+cards have a built-in proprietary modem.
+Neither the
+.Nm
+driver nor any other
+.Fx
+driver supports this modem.
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "xl%d: couldn't map memory"
+A fatal initialization error has occurred.
+.It "xl%d: couldn't map interrupt"
+A fatal initialization error has occurred.
+.It "xl%d: device timeout"
+The device has stopped responding to the network, or there is a problem with
+the network connection (cable).
+.It "xl%d: no memory for rx list"
+The driver failed to allocate an mbuf for the receiver ring.
+.It "xl%d: no memory for tx list"
+The driver failed to allocate an mbuf for the transmitter ring when
+allocating a pad buffer or collapsing an mbuf chain into a cluster.
+.It "xl%d: command never completed!"
+Some commands issued to the 3c90x ASIC take time to complete: the
+driver is supposed to wait until the 'command in progress' bit in
+the status register clears before continuing.
+In rare instances, this
+bit may not clear.
+To avoid getting caught in an infinite wait loop,
+the driver only polls the bit for a finite number of times before
+giving up, at which point it issues this message.
+This message may
+be printed during driver initialization on slower machines.
+If you
+see this message but the driver continues to function normally, the
+message can probably be ignored.
+.It "xl%d: chip is in D3 power state -- setting to D0"
+This message applies only to 3c905B adapters, which support power
+management.
+Some operating systems place the 3c905B in low power
+mode when shutting down, and some PCI BIOSes fail to bring the chip
+out of this state before configuring it.
+The 3c905B loses all of
+its PCI configuration in the D3 state, so if the BIOS does not set
+it back to full power mode in time, it will not be able to configure it
+correctly.
+The driver tries to detect this condition and bring
+the adapter back to the D0 (full power) state, but this may not be
+enough to return the driver to a fully operational condition.
+If
+you see this message at boot time and the driver fails to attach
+the device as a network interface, you will have to perform second
+warm boot to have the device properly configured.
+.Pp
+Note that this condition only occurs when warm booting from another
+operating system.
+If you power down your system prior to booting
+.Fx ,
+the card should be configured correctly.
+.It "xl%d: WARNING: no media options bits set in the media options register!"
+This warning may appear when using the driver on some Dell Latitude
+docking stations with built-in 3c905-TX adapters.
+For whatever the
+reason, the 'MII available' bit in the media options register on
+this particular equipment is not set, even though it should be (the
+3c905-TX always uses an external PHY transceiver).
+The driver will
+attempt to guess the proper media type based on the PCI device ID
+word.
+The driver makes a lot of noise about this condition because
+the author considers it a manufacturing defect.
+.It xl%d: transmission error: %d
+.It xl%d: tx underrun, increasing tx start threshold to %d bytes
+This message may appear while the adapter tunes its transmission
+buffers under various load amounts and are mostly harmless.
+It is probably safe to ignore them.
+.El
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr cardbus 4 ,
+.Xr miibus 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr pccard 4 ,
+.Xr polling 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Bill Paul Aq wpaul@ctr.columbia.edu .
diff --git a/share/man/man4/xnb.4 b/share/man/man4/xnb.4
new file mode 100644
index 000000000000..d4ebae842ce8
--- /dev/null
+++ b/share/man/man4/xnb.4
@@ -0,0 +1,141 @@
+.\" Copyright (c) 2012 Spectra Logic Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\" substantially similar to the "NO WARRANTY" disclaimer below
+.\" ("Disclaimer") and any redistribution must be conditioned upon
+.\" including a substantially similar Disclaimer requirement for further
+.\" binary redistribution.
+.\"
+.\" NO WARRANTY
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+.\" HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGES.
+.\"
+.\" Authors: Alan Somers (Spectra Logic Corporation)
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2012
+.Dt XNB 4
+.Os
+.Sh NAME
+.Nm xnb
+.Nd "Xen Paravirtualized Backend Ethernet Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options XENHVM"
+.Cd "device xenpci"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides the back half of a paravirtualized
+.Xr xen 4
+network connection.
+The netback and netfront drivers appear to their respective operating
+systems as Ethernet devices linked by a crossover cable.
+Typically,
+.Nm
+will run on Domain 0 and the netfront driver will run on a guest domain.
+However, it is also possible to run
+.Nm
+on a guest domain.
+It may be bridged or routed to provide the netfront's
+domain access to other guest domains or to a physical network.
+.Pp
+In most respects, the
+.Nm
+device appears to the OS as an other Ethernet device.
+It can be configured at runtime entirely with
+.Xr ifconfig 8 .
+In particular, it supports MAC changing, arbitrary MTU sizes, checksum
+offload for IP, UDP, and TCP for both receive and transmit, and TSO.
+However, see
+.Sx CAVEATS
+before enabling txcsum, rxcsum, or tso.
+.Sh SYSCTL VARIABLES
+The following read-only variables are available via
+.Xr sysctl 8 :
+.Bl -tag -width indent
+.It Va dev.xnb.%d.dump_rings
+Displays information about the ring buffers used to pass requests between the
+netfront and netback.
+Mostly useful for debugging, but can also be used to
+get traffic statistics.
+.It Va dev.xnb.%d.unit_test_results
+Runs a builtin suite of unit tests and displays the results.
+Does not affect the operation of the driver in any way.
+Note that the test suite simulates error conditions; this will result in
+error messages being printed to the system system log.
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr xen 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by
+.An Alan Somers
+.Aq alans@spectralogic.com
+and
+.An John Suykerbuyk
+.Aq johns@spectralogic.com
+.Sh CAVEATS
+Packets sent through Xennet pass over shared memory, so the protocol includes
+no form of link-layer checksum or CRC.
+Furthermore, Xennet drivers always report to their hosts that they support
+receive and transmit checksum offloading.
+They "offload" the checksum calculation by simply skipping it.
+That works fine for packets that are exchanged between two domains on the same
+machine.
+However, when a Xennet interface is bridged to a physical interface,
+a correct checksum must be attached to any packets bound for that physical
+interface.
+Currently, FreeBSD lacks any mechanism for an ethernet device to
+inform the OS that newly received packets are valid even though their checksums
+are not.
+So if the netfront driver is configured to offload checksum calculations,
+it will pass non-checksumed packets to
+.Nm ,
+which must then calculate the checksum in software before passing the packet
+to the OS.
+.Pp
+For this reason, it is recommended that if
+.Nm
+is bridged to a physcal interface, then transmit checksum offloading should be
+disabled on the netfront.
+The Xennet protocol does not have any mechanism for the netback to request
+the netfront to do this; the operator must do it manually.
+.Sh BUGS
+The
+.Nm
+driver does not properly checksum UDP datagrams that span more than one
+Ethernet frame.
+Nor does it correctly checksum IPv6 packets.
+To workaround that bug, disable transmit checksum offloading on the
+netfront driver.
diff --git a/share/man/man4/xpt.4 b/share/man/man4/xpt.4
new file mode 100644
index 000000000000..e670acb199c8
--- /dev/null
+++ b/share/man/man4/xpt.4
@@ -0,0 +1,108 @@
+.\"
+.\" Copyright (c) 1998 Kenneth D. Merry.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 10, 1998
+.Dt XPT 4
+.Os
+.Sh NAME
+.Nm xpt
+.Nd CAM transport layer interface
+.Sh SYNOPSIS
+None.
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a way for userland applications to issue certain CAM CCBs
+to the kernel.
+.Pp
+Since the
+.Nm
+driver allows direct access to the CAM subsystem, system administrators
+should exercise caution when granting access to this driver.
+If used
+improperly, this driver can allow userland applications to crash a machine
+or cause data loss.
+.Sh KERNEL CONFIGURATION
+There is no kernel configuration required for the
+.Nm
+driver.
+It is enabled when
+.Tn SCSI
+support is enabled in the kernel.
+There is one instance of the xpt driver
+per CAM transport layer instance.
+Since there is currently only one CAM
+transport layer, there will only be one instance of this driver.
+.Sh IOCTLS
+.Bl -tag -width 01234567890123
+.It CAMIOCOMMAND
+This ioctl takes certain kinds of CAM CCBs and passes them through to the
+CAM transport layer for action.
+Only the following CCB types are
+supported:
+.Pp
+.Bl -tag -width XPT_DEV_MATCH -compact
+.It XPT_SCAN_BUS
+.It XPT_RESET_BUS
+.It XPT_SCAN_LUN
+.It XPT_ENG_INQ
+.It XPT_ENG_EXEC
+.It XPT_DEBUG
+.It XPT_DEV_MATCH
+.It XPT_PATH_INQ
+.El
+.Pp
+The above CCBs are the only ones supported since it makes more sense to
+send them through a generic passthrough device rather than a passthrough
+device tied to a particular underlying
+.Tn SCSI
+device.
+.It CAMGETPASSTHRU
+This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device
+corresponding to the device in question.
+.El
+.Sh FILES
+.Bl -tag -width /dev/xpt0 -compact
+.It Pa /dev/xpt0
+Character device node for the
+.Nm
+driver.
+.El
+.Sh DIAGNOSTICS
+None.
+.Sh SEE ALSO
+.Xr cam 3 ,
+.Xr cam_cdbparse 3 ,
+.Xr pass 4 ,
+.Xr camcontrol 8
+.Sh HISTORY
+The CAM transport layer driver first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An Kenneth Merry Aq ken@FreeBSD.org
diff --git a/share/man/man4/zero.4 b/share/man/man4/zero.4
new file mode 100644
index 000000000000..cb73a2c6549f
--- /dev/null
+++ b/share/man/man4/zero.4
@@ -0,0 +1,57 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Mike Pritchard and
+.\" contributors.
+.\" 4. Neither the name of the author nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 7, 1996
+.Dt ZERO 4
+.Os
+.Sh NAME
+.Nm zero
+.Nd the zero device
+.Sh DESCRIPTION
+The
+.Nm
+device accepts and reads data as any ordinary (and willing)
+file,
+but throws away any data written to it, and returns an endless
+supply of null bytes when read.
+.Sh FILES
+.Bl -tag -width /dev/zero
+.It Pa /dev/zero
+.El
+.Sh SEE ALSO
+.Xr null 4
+.Sh HISTORY
+A
+.Nm
+device appeared in
+.Bx 4.4 .
diff --git a/share/man/man4/zyd.4 b/share/man/man4/zyd.4
new file mode 100644
index 000000000000..ba8f5737df6b
--- /dev/null
+++ b/share/man/man4/zyd.4
@@ -0,0 +1,186 @@
+.\" $OpenBSD: zyd.4,v 1.22 2007/05/24 02:49:57 cnst Exp $
+.\" $NetBSD: zyd.4,v 1.1 2007/06/09 11:20:55 kiyohara Exp $
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 1997, 1998, 1999
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 2, 2009
+.Dt ZYD 4
+.Os
+.Sh NAME
+.Nm zyd
+.Nd ZyDAS ZD1211/ZD1211B USB IEEE 802.11b/g wireless network device
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ehci"
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device zyd"
+.Cd "device wlan"
+.Cd "device wlan_amrr"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_zyd_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for wireless network adapters based around
+the ZyDAS ZD1211 and ZD1211B USB chips.
+.Pp
+.Nm
+supports
+.Cm station
+and
+.Cm monitor
+mode operation.
+Only one virtual interface may be configured at any time.
+For more information on configuring this device, see
+.Xr ifconfig 8 .
+.Sh HARDWARE
+The following devices are known to be supported by the
+.Nm
+driver:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It 3COM 3CRUSB10075
+.It Acer WLAN-G-US1
+.It Airlink+ AWLL3025
+.It Airlink 101 AWLL3026
+.It AOpen 802.11g WL54
+.It Asus A9T integrated wireless
+.It Asus WL-159g
+.It Belkin F5D7050 v.4000
+.It Billion BiPAC 3011G
+.It Buffalo WLI-U2-KG54L
+.It CC&C WL-2203B
+.It DrayTek Vigor 550
+.It Edimax EW-7317UG
+.It Edimax EW-7317LDG
+.It Fiberline Networks WL-43OU
+.It iNexQ UR055g
+.It Linksys WUSBF54G
+.It Longshine LCS-8131G3
+.It MSI US54SE
+.It MyTek MWU-201 USB adapter
+.It Philips SNU5600
+.It Planet WL-U356
+.It Planex GW-US54GZ
+.It Planex GW-US54GZL
+.It Planex GW-US54Mini
+.It Safecom SWMULZ-5400
+.It Sagem XG 760A
+.It Sagem XG 76NA
+.It Sandberg Wireless G54 USB
+.It Sitecom WL-113
+.It SMC SMCWUSB-G
+.It Sweex wireless USB 54 Mbps
+.It Tekram/Siemens USB adapter
+.It Telegent TG54USB
+.It Trendnet TEW-424UB rev A
+.It Trendnet TEW-429UB
+.It TwinMOS G240
+.It Unicorn WL-54G
+.It US Robotics 5423
+.It X-Micro XWL-11GUZX
+.It Yakumo QuickWLAN USB
+.It Zonet ZEW2501
+.It ZyXEL ZyAIR G-220
+.El
+.Sh EXAMPLES
+The following
+example configures zyd0 to join any BSS network using WEP key
+.Dq 0x1deadbeef1 ,
+channel 11:
+.Bd -literal -offset indent
+ifconfig wlan create wlandev zyd0 channel 11 \e
+ wepmode on wepkey 0x1deadbeef1 weptxkey 1 \e
+ inet 192.168.1.1 netmask 255.255.255.0
+.Ed
+.Pp
+Join an existing BSS network,
+.Dq my_net :
+.Bd -literal -offset indent
+ifconfig wlan create wlandev zyd0 192.168.0.2 \e
+ netmask 0xffffff00 ssid my_net
+.Ed
+.Sh DIAGNOSTICS
+.Bl -diag
+.It "zyd%d: could not load firmware (error=%d)"
+An error occurred while attempting to upload the firmware to the onboard
+microcontroller unit.
+.It "zyd%d: could not send command (error=%s)"
+An attempt to send a command to the firmware failed.
+.It "zyd%d: sorry, radio %s is not supported yet"
+Support for the specified radio chip is not yet implemented in the driver.
+The device will not attach.
+.It "zyd%d: device version mismatch: 0x%x (only >= 43.30 supported)"
+Early revisions of the ZD1211 chipset are not supported by this driver.
+The device will not attach.
+.It "zyd%d: device timeout"
+A frame dispatched to the hardware for transmission did not complete in time.
+The driver will reset the hardware.
+This should not happen.
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr netintro 4 ,
+.Xr usb 4 ,
+.Xr wlan 4 ,
+.Xr wlan_amrr 4 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4 ,
+.Xr ifconfig 8 ,
+.Xr wpa_supplicant 8
+.Sh AUTHORS
+.An -nosplit
+The original
+.Nm
+driver was written by
+.An Florian Stoehr Aq ich@florian-stoehr.de ,
+.An Damien Bergamini Aq damien@openbsd.org ,
+and
+.An Jonathan Gray Aq jsg@openbsd.org .
+.Sh CAVEATS
+The
+.Nm
+driver does not support a lot of the functionality available in the hardware.
+More work is required to properly support the IBSS and power management
+features.
diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile
new file mode 100644
index 000000000000..b05c1eb924da
--- /dev/null
+++ b/share/man/man5/Makefile
@@ -0,0 +1,92 @@
+# @(#)Makefile 8.1 (Berkeley) 6/5/93
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+#MISSING: dump.5 plot.5
+MAN= acct.5 \
+ ar.5 \
+ a.out.5 \
+ bluetooth.device.conf.5 \
+ bluetooth.hosts.5 \
+ bluetooth.protocols.5 \
+ ${_boot.config.5} \
+ core.5 \
+ devfs.5 \
+ devfs.conf.5 \
+ devfs.rules.5 \
+ device.hints.5 \
+ dir.5 \
+ disktab.5 \
+ elf.5 \
+ ethers.5 \
+ eui64.5 \
+ ext2fs.5 \
+ fbtab.5 \
+ fdescfs.5 \
+ forward.5 \
+ freebsd-update.conf.5 \
+ fs.5 \
+ fstab.5 \
+ group.5 \
+ hosts.5 \
+ hosts.equiv.5 \
+ hosts.lpd.5 \
+ intro.5 \
+ libmap.conf.5 \
+ link.5 \
+ linprocfs.5 \
+ linsysfs.5 \
+ mailer.conf.5 \
+ make.conf.5 \
+ moduli.5 \
+ motd.5 \
+ mqueuefs.5 \
+ msdosfs.5 \
+ networks.5 \
+ nsmb.conf.5 \
+ nsswitch.conf.5 \
+ nullfs.5 \
+ passwd.5 \
+ pbm.5 \
+ periodic.conf.5 \
+ phones.5 \
+ portindex.5 \
+ portsnap.conf.5 \
+ procfs.5 \
+ protocols.5 \
+ quota.user.5 \
+ rc.conf.5 \
+ rctl.conf.5 \
+ regdomain.5 \
+ reiserfs.5 \
+ remote.5 \
+ resolver.5 \
+ services.5 \
+ shells.5 \
+ src.conf.5 \
+ stab.5 \
+ style.Makefile.5 \
+ sysctl.conf.5 \
+ tmpfs.5 \
+ xfs.5
+
+MLINKS= dir.5 dirent.5
+MLINKS+=fs.5 inode.5
+MLINKS+=hosts.equiv.5 rhosts.5
+MLINKS+=msdosfs.5 msdos.5
+MLINKS+=passwd.5 master.passwd.5
+MLINKS+=portindex.5 INDEX.5
+MLINKS+=quota.user.5 quota.group.5
+MLINKS+=rc.conf.5 rc.conf.local.5
+MLINKS+=resolver.5 resolv.conf.5
+
+.if ${MK_HESIOD} != "no"
+MAN+= hesiod.conf.5
+.endif
+
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+_boot.config.5= boot.config.5
+.endif
+
+.include <bsd.prog.mk>
diff --git a/share/man/man5/a.out.5 b/share/man/man5/a.out.5
new file mode 100644
index 000000000000..d6318efdda16
--- /dev/null
+++ b/share/man/man5/a.out.5
@@ -0,0 +1,460 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This manual page is derived from documentation contributed to Berkeley by
+.\" Donn Seeley at UUNET Technologies, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)a.out.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 10, 2010
+.Dt A.OUT 5
+.Os
+.Sh NAME
+.Nm a.out
+.Nd format of executable binary files
+.Sh SYNOPSIS
+.In a.out.h
+.Sh DESCRIPTION
+The include file
+.In a.out.h
+declares three structures and several macros.
+The structures describe the format of
+executable machine code files
+.Pq Sq binaries
+on the system.
+.Pp
+A binary file consists of up to 7 sections.
+In order, these sections are:
+.Bl -tag -width "text relocations"
+.It exec header
+Contains parameters used by the kernel
+to load a binary file into memory and execute it,
+and by the link editor
+.Xr ld 1
+to combine a binary file with other binary files.
+This section is the only mandatory one.
+.It text segment
+Contains machine code and related data
+that are loaded into memory when a program executes.
+May be loaded read-only.
+.It data segment
+Contains initialized data; always loaded into writable memory.
+.It text relocations
+Contains records used by the link editor
+to update pointers in the text segment when combining binary files.
+.It data relocations
+Like the text relocation section, but for data segment pointers.
+.It symbol table
+Contains records used by the link editor
+to cross reference the addresses of named variables and functions
+.Pq Sq symbols
+between binary files.
+.It string table
+Contains the character strings corresponding to the symbol names.
+.El
+.Pp
+Every binary file begins with an
+.Fa exec
+structure:
+.Bd -literal -offset indent
+struct exec {
+ unsigned long a_midmag;
+ unsigned long a_text;
+ unsigned long a_data;
+ unsigned long a_bss;
+ unsigned long a_syms;
+ unsigned long a_entry;
+ unsigned long a_trsize;
+ unsigned long a_drsize;
+};
+.Ed
+.Pp
+The fields have the following functions:
+.Bl -tag -width a_trsize
+.It Fa a_midmag
+This field is stored in host byte-order.
+It has a number of sub-components accessed by the macros
+.Fn N_GETFLAG ,
+.Fn N_GETMID ,
+and
+.Fn N_GETMAGIC ,
+and set by the macro
+.Fn N_SETMAGIC .
+.Pp
+The macro
+.Fn N_GETFLAG
+returns a few flags:
+.Bl -tag -width EX_DYNAMIC
+.It Dv EX_DYNAMIC
+indicates that the executable requires the services of the run-time link editor.
+.It Dv EX_PIC
+indicates that the object contains position independent code.
+This flag is
+set by
+.Xr as 1
+when given the
+.Sq -k
+flag and is preserved by
+.Xr ld 1
+if necessary.
+.El
+.Pp
+If both EX_DYNAMIC and EX_PIC are set, the object file is a position independent
+executable image (e.g.\& a shared library), which is to be loaded into the
+process address space by the run-time link editor.
+.Pp
+The macro
+.Fn N_GETMID
+returns the machine-id.
+This indicates which machine(s) the binary is intended to run on.
+.Pp
+.Fn N_GETMAGIC
+specifies the magic number, which uniquely identifies binary files
+and distinguishes different loading conventions.
+The field must contain one of the following values:
+.Bl -tag -width ZMAGIC
+.It Dv OMAGIC
+The text and data segments immediately follow the header
+and are contiguous.
+The kernel loads both text and data segments into writable memory.
+.It Dv NMAGIC
+As with
+.Dv OMAGIC ,
+text and data segments immediately follow the header and are contiguous.
+However, the kernel loads the text into read-only memory
+and loads the data into writable memory at the next
+page boundary after the text.
+.It Dv ZMAGIC
+The kernel loads individual pages on demand from the binary.
+The header, text segment and data segment are all
+padded by the link editor to a multiple of the page size.
+Pages that the kernel loads from the text segment are read-only,
+while pages from the data segment are writable.
+.El
+.It Fa a_text
+Contains the size of the text segment in bytes.
+.It Fa a_data
+Contains the size of the data segment in bytes.
+.It Fa a_bss
+Contains the number of bytes in the
+.Sq bss segment
+and is used by the kernel to set the initial break
+.Pq Xr brk 2
+after the data segment.
+The kernel loads the program so that this amount of writable memory
+appears to follow the data segment and initially reads as zeroes.
+.Em ( bss
+= block started by symbol)
+.It Fa a_syms
+Contains the size in bytes of the symbol table section.
+.It Fa a_entry
+Contains the address in memory of the entry point
+of the program after the kernel has loaded it;
+the kernel starts the execution of the program
+from the machine instruction at this address.
+.It Fa a_trsize
+Contains the size in bytes of the text relocation table.
+.It Fa a_drsize
+Contains the size in bytes of the data relocation table.
+.El
+.Pp
+The
+.In a.out.h
+include file defines several macros which use an
+.Fa exec
+structure to test consistency or to locate section offsets in the binary file.
+.Bl -tag -width N_BADMAG(exec)
+.It Fn N_BADMAG exec
+Nonzero if the
+.Fa a_magic
+field does not contain a recognized value.
+.It Fn N_TXTOFF exec
+The byte offset in the binary file of the beginning of the text segment.
+.It Fn N_SYMOFF exec
+The byte offset of the beginning of the symbol table.
+.It Fn N_STROFF exec
+The byte offset of the beginning of the string table.
+.El
+.Pp
+Relocation records have a standard format which
+is described by the
+.Fa relocation_info
+structure:
+.Bd -literal -offset indent
+struct relocation_info {
+ int r_address;
+ unsigned int r_symbolnum : 24,
+ r_pcrel : 1,
+ r_length : 2,
+ r_extern : 1,
+ r_baserel : 1,
+ r_jmptable : 1,
+ r_relative : 1,
+ r_copy : 1;
+};
+.Ed
+.Pp
+The
+.Fa relocation_info
+fields are used as follows:
+.Bl -tag -width r_symbolnum
+.It Fa r_address
+Contains the byte offset of a pointer that needs to be link-edited.
+Text relocation offsets are reckoned from the start of the text segment,
+and data relocation offsets from the start of the data segment.
+The link editor adds the value that is already stored at this offset
+into the new value that it computes using this relocation record.
+.It Fa r_symbolnum
+Contains the ordinal number of a symbol structure
+in the symbol table (it is
+.Em not
+a byte offset).
+After the link editor resolves the absolute address for this symbol,
+it adds that address to the pointer that is undergoing relocation.
+(If the
+.Fa r_extern
+bit is clear, the situation is different; see below.)
+.It Fa r_pcrel
+If this is set,
+the link editor assumes that it is updating a pointer
+that is part of a machine code instruction using pc-relative addressing.
+The address of the relocated pointer is implicitly added
+to its value when the running program uses it.
+.It Fa r_length
+Contains the log base 2 of the length of the pointer in bytes;
+0 for 1-byte displacements, 1 for 2-byte displacements,
+2 for 4-byte displacements.
+.It Fa r_extern
+Set if this relocation requires an external reference;
+the link editor must use a symbol address to update the pointer.
+When the
+.Fa r_extern
+bit is clear, the relocation is
+.Sq local ;
+the link editor updates the pointer to reflect
+changes in the load addresses of the various segments,
+rather than changes in the value of a symbol (except when
+.Fa r_baserel
+is also set (see below).
+In this case, the content of the
+.Fa r_symbolnum
+field is an
+.Fa n_type
+value (see below);
+this type field tells the link editor
+what segment the relocated pointer points into.
+.It Fa r_baserel
+If set, the symbol, as identified by the
+.Fa r_symbolnum
+field, is to be relocated to an offset into the Global Offset Table.
+At run-time, the entry in the Global Offset Table at this offset is set to
+be the address of the symbol.
+.It Fa r_jmptable
+If set, the symbol, as identified by the
+.Fa r_symbolnum
+field, is to be relocated to an offset into the Procedure Linkage Table.
+.It Fa r_relative
+If set, this relocation is relative to the (run-time) load address of the
+image this object file is going to be a part of.
+This type of relocation
+only occurs in shared objects.
+.It Fa r_copy
+If set, this relocation record identifies a symbol whose contents should
+be copied to the location given in
+.Fa r_address .
+The copying is done by the run-time link-editor from a suitable data
+item in a shared object.
+.El
+.Pp
+Symbols map names to addresses (or more generally, strings to values).
+Since the link-editor adjusts addresses,
+a symbol's name must be used to stand for its address
+until an absolute value has been assigned.
+Symbols consist of a fixed-length record in the symbol table
+and a variable-length name in the string table.
+The symbol table is an array of
+.Fa nlist
+structures:
+.Bd -literal -offset indent
+struct nlist {
+ union {
+ const char *n_name;
+ long n_strx;
+ } n_un;
+ unsigned char n_type;
+ char n_other;
+ short n_desc;
+ unsigned long n_value;
+};
+.Ed
+.Pp
+The fields are used as follows:
+.Bl -tag -width n_un.n_strx
+.It Fa n_un.n_strx
+Contains a byte offset into the string table
+for the name of this symbol.
+When a program accesses a symbol table with the
+.Xr nlist 3
+function,
+this field is replaced with the
+.Fa n_un.n_name
+field, which is a pointer to the string in memory.
+.It Fa n_type
+Used by the link editor to determine
+how to update the symbol's value.
+The
+.Fa n_type
+field is broken down into three sub-fields using bitmasks.
+The link editor treats symbols with the
+.Dv N_EXT
+type bit set as
+.Sq external
+symbols and permits references to them from other binary files.
+The
+.Dv N_TYPE
+mask selects bits of interest to the link editor:
+.Bl -tag -width N_TEXT
+.It Dv N_UNDF
+An undefined symbol.
+The link editor must locate an external symbol with the same name
+in another binary file to determine the absolute value of this symbol.
+As a special case, if the
+.Fa n_value
+field is nonzero and no binary file in the link-edit defines this symbol,
+the link-editor will resolve this symbol to an address
+in the bss segment,
+reserving an amount of bytes equal to
+.Fa n_value .
+If this symbol is undefined in more than one binary file
+and the binary files do not agree on the size,
+the link editor chooses the greatest size found across all binaries.
+.It Dv N_ABS
+An absolute symbol.
+The link editor does not update an absolute symbol.
+.It Dv N_TEXT
+A text symbol.
+This symbol's value is a text address and
+the link editor will update it when it merges binary files.
+.It Dv N_DATA
+A data symbol; similar to
+.Dv N_TEXT
+but for data addresses.
+The values for text and data symbols are not file offsets but
+addresses; to recover the file offsets, it is necessary
+to identify the loaded address of the beginning of the corresponding
+section and subtract it, then add the offset of the section.
+.It Dv N_BSS
+A bss symbol; like text or data symbols but
+has no corresponding offset in the binary file.
+.It Dv N_FN
+A filename symbol.
+The link editor inserts this symbol before
+the other symbols from a binary file when
+merging binary files.
+The name of the symbol is the filename given to the link editor,
+and its value is the first text address from that binary file.
+Filename symbols are not needed for link-editing or loading,
+but are useful for debuggers.
+.El
+.Pp
+The
+.Dv N_STAB
+mask selects bits of interest to symbolic debuggers
+such as
+.Xr gdb 1 ;
+the values are described in
+.Xr stab 5 .
+.It Fa n_other
+This field provides information on the nature of the symbol independent of
+the symbol's location in terms of segments as determined by the
+.Fa n_type
+field.
+Currently, the lower 4 bits of the
+.Fa n_other
+field hold one of two values:
+.Dv AUX_FUNC
+and
+.Dv AUX_OBJECT
+(see
+.In link.h
+for their definitions).
+.Dv AUX_FUNC
+associates the symbol with a callable function, while
+.Dv AUX_OBJECT
+associates the symbol with data, irrespective of their locations in
+either the text or the data segment.
+This field is intended to be used by
+.Xr ld 1
+for the construction of dynamic executables.
+.It Fa n_desc
+Reserved for use by debuggers; passed untouched by the link editor.
+Different debuggers use this field for different purposes.
+.It Fa n_value
+Contains the value of the symbol.
+For text, data and bss symbols, this is an address;
+for other symbols (such as debugger symbols),
+the value may be arbitrary.
+.El
+.Pp
+The string table consists of an
+.Em unsigned long
+length followed by null-terminated symbol strings.
+The length represents the size of the entire table in bytes,
+so its minimum value (or the offset of the first string)
+is always 4 on 32-bit machines.
+.Sh SEE ALSO
+.Xr as 1 ,
+.Xr gdb 1 ,
+.Xr ld 1 ,
+.Xr brk 2 ,
+.Xr execve 2 ,
+.Xr nlist 3 ,
+.Xr core 5 ,
+.Xr elf 5 ,
+.Xr link 5 ,
+.Xr stab 5
+.Sh HISTORY
+The
+.In a.out.h
+include file appeared in
+.At v7 .
+.Sh BUGS
+Since not all of the supported architectures use the
+.Fa a_midmag
+field,
+it can be difficult to determine what
+architecture a binary will execute on
+without examining its actual machine code.
+Even with a machine identifier,
+the byte order of the
+.Fa exec
+header is machine-dependent.
diff --git a/share/man/man5/acct.5 b/share/man/man5/acct.5
new file mode 100644
index 000000000000..48283a58a6f1
--- /dev/null
+++ b/share/man/man5/acct.5
@@ -0,0 +1,131 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)acct.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2007
+.Dt ACCT 5
+.Os
+.Sh NAME
+.Nm acct
+.Nd execution accounting file
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/acct.h
+.Sh DESCRIPTION
+The kernel maintains the following
+.Fa acct
+information structure for all
+processes.
+If a process terminates, and accounting is enabled,
+the kernel calls the
+.Xr acct 2
+function call to prepare and append the record
+to the accounting file.
+.Bd -literal
+#define AC_COMM_LEN 16
+
+/*
+ * Accounting structure version 2 (current).
+ * The first byte is always zero.
+ * Time units are microseconds.
+ */
+
+struct acctv2 {
+ uint8_t ac_zero; /* zero identifies new version */
+ uint8_t ac_version; /* record version number */
+ uint16_t ac_len; /* record length */
+
+ char ac_comm[AC_COMM_LEN]; /* command name */
+ float ac_utime; /* user time */
+ float ac_stime; /* system time */
+ float ac_etime; /* elapsed time */
+ time_t ac_btime; /* starting time */
+ uid_t ac_uid; /* user id */
+ gid_t ac_gid; /* group id */
+ float ac_mem; /* average memory usage */
+ float ac_io; /* count of IO blocks */
+ __dev_t ac_tty; /* controlling tty */
+
+ uint16_t ac_len2; /* record length */
+ union {
+ __dev_t ac_align; /* force v1 compatible alignment */
+
+#define AFORK 0x01 /* forked but not exec'ed */
+/* ASU is no longer supported */
+#define ASU 0x02 /* used super-user permissions */
+#define ACOMPAT 0x04 /* used compatibility mode */
+#define ACORE 0x08 /* dumped core */
+#define AXSIG 0x10 /* killed by a signal */
+#define ANVER 0x20 /* new record version */
+
+ uint8_t ac_flag; /* accounting flags */
+ } ac_trailer;
+
+#define ac_flagx ac_trailer.ac_flag
+};
+.Ed
+.Pp
+If a terminated process was created by an
+.Xr execve 2 ,
+the name of the executed file (at most ten characters of it)
+is saved in the field
+.Fa ac_comm
+and its status is saved by setting one of more of the following flags in
+.Fa ac_flag :
+.Dv AFORK ,
+.Dv ACOMPAT ,
+.Dv ACORE
+and
+.Dv ASIG .
+.Dv ASU
+is no longer supported.
+.Dv ANVER
+is always set in the above structure.
+.Sh SEE ALSO
+.Xr lastcomm 1 ,
+.Xr acct 2 ,
+.Xr execve 2 ,
+.Xr sa 8
+.Sh HISTORY
+A
+.Nm
+file format appeared in
+.At v7 .
+The current record format was introduced on May 2007.
+It is backwards compatible with the previous format,
+which is still documented in
+.In sys/acct.h
+and supported by
+.Xr lastcomm 1
+and
+.Xr sa 8 .
diff --git a/share/man/man5/ar.5 b/share/man/man5/ar.5
new file mode 100644
index 000000000000..1c1d79bc26cd
--- /dev/null
+++ b/share/man/man5/ar.5
@@ -0,0 +1,327 @@
+.\" Copyright (c) 2010 Joseph Koshy. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 28, 2010
+.Dt AR 5
+.Os
+.Sh NAME
+.Nm ar
+.Nd archive file format for
+.Xr ar 1
+and
+.Xr ranlib 1
+.Sh SYNOPSIS
+.In ar.h
+.Sh DESCRIPTION
+.Xr ar 1
+archives are created and managed by the
+.Xr ar 1
+and
+.Xr ranlib 1
+utilities.
+These archives are typically used during program development to
+hold libraries of program objects.
+An
+.Xr ar 1
+archive is contained in a single operating system file.
+.Pp
+This manual page documents two variants of the
+.Xr ar 1
+archive format: the BSD archive format, and the SVR4/GNU archive
+format.
+.Pp
+In both variants the archive file starts with an identifying byte
+sequence of the seven ASCII characters
+.Sq Li "!<arch>"
+followed by a ASCII linefeed character
+.Po
+see the constant
+.Dq ARMAG
+in the header file
+.In ar.h
+.Pc .
+.Pp
+Archive members follow the initial identifying byte sequence.
+Each archive member is prefixed by a fixed size header describing the
+file attributes associated with the member.
+.Ss "Archive Headers"
+An archive header describes the file attributes for the archive member that
+follows it.
+The
+.Xr ar 5
+format only supports a limited number of attributes: the file name,
+the file creation time stamp, the uid and gid of the creator, the file
+mode and the file size.
+.Pp
+Archive headers are placed at an even byte offset in the archive file.
+If the data for an archive member ends at an odd byte offset, then a
+padding byte with value 0x0A is used to position the next archive
+header on an even byte offset.
+.Pp
+An archive header comprises the following fixed sized fields:
+.Bl -tag -width "Li ar_name"
+.It Ar ar_name
+(16 bytes) The file name of the archive member.
+The format of this field varies between the BSD and SVR4/GNU formats and
+is described in more detail in the section
+.Sx "Representing File Names"
+below.
+.It Ar ar_date
+(12 bytes) The file modification time for the member in seconds since the
+epoch, encoded as a decimal number.
+.It Ar ar_uid
+(6 bytes) The uid associated with the archive member, encoded as a
+decimal number.
+.It Ar ar_gid
+(6 bytes) The gid associated with the archive member, encoded as a
+decimal number.
+.It Ar ar_mode
+(8 bytes) The file mode for the archive member, encoded as an octal
+number.
+.It Ar ar_size
+(10 bytes) In the SVR4/GNU archive format this field holds the size in
+bytes of the archive member, encoded as a decimal number.
+In the BSD archive format, for short file names, this field
+holds the size in bytes of the archive member, encoded as a decimal
+number.
+For long file names
+.Po
+see
+.Sx "Representing File Names"
+below
+.Pc ,
+the field contains the combined size of the
+archive member and its file name, encoded as a decimal number.
+.It Ar ar_fmag
+(2 bytes) This field holds 2 bytes with values 0x96 and 0x0A
+respectively, marking the end of the header.
+.El
+.Pp
+Unused bytes in the fields of an archive header are set to the value
+0x20.
+.Ss "Representing File Names"
+The BSD and SVR4/GNU variants use different schemes for encoding file
+names for members.
+.Bl -tag -width "SVR4/GNU"
+.It "BSD"
+File names that are up to 16 bytes long and which do not contain
+embedded spaces are stored directly in the
+.Ar ar_name
+field of the archive header.
+File names that are either longer than 16 bytes or which contain
+embedded spaces are stored immediately after the archive header
+and the
+.Ar ar_name
+field of the archive header is set to the string
+.Dq "#1/"
+followed by a decimal representation of the number of bytes needed for
+the file name.
+In addition, the
+.Ar ar_size
+field of the archive header is set to the decimal representation of
+the combined sizes of the archive member and the file name.
+The file contents of the member follows the file name without further
+padding.
+.Pp
+As an example, if the file name for a member was
+.Dq "A B"
+and its contents was the string
+.Dq "C D" ,
+then the
+.Ar ar_name
+field of the header would contain
+.Dq Li "#1/3" ,
+the
+.Ar ar_size
+field of the header would contain
+.Dq Li 6 ,
+and the bytes immediately following the header would be 0x41, 0x20,
+0x42, 0x43, 0x20 and 0x44
+.Po
+ASCII
+.Dq "A BC D"
+.Pc .
+.It "SVR4/GNU"
+File names that are up to 15 characters long are stored directly in the
+.Ar ar_name
+field of the header, terminated by a
+.Dq Li /
+character.
+.Pp
+If the file name is larger than would fit in space for the
+.Ar ar_name
+field, then the actual file name is kept in the archive
+string table
+.Po
+see
+.Sx "Archive String Tables"
+below
+.Pc ,
+and the decimal offset of the file name in the string table is stored
+in the
+.Ar ar_name
+field, prefixed by a
+.Dq Li /
+character.
+.Pp
+As an example, if the real file name has been stored at offset 768 in
+the archive string table, the
+.Ar ar_name
+field of the header will contain the string
+.Dq /768 .
+.El
+.Ss "Special Archive Members"
+The following archive members are special.
+.Bl -tag -width indent
+.It Dq Li /
+In the SVR4/GNU variant of the archive format, the archive member with
+name
+.Dq Li /
+denotes an archive symbol table.
+If present, this member will be the very first member in the
+archive.
+.It Dq Li //
+In the SVR4/GNU variant of the archive format, the archive member with
+name
+.Dq Li //
+denotes the archive string table.
+This special member is used to hold filenames that do not fit in the
+file name field of the header
+.Po
+see
+.Sx "Representing File Names"
+above
+.Pc .
+If present, this member immediately follows the archive symbol table
+if an archive symbol table is present, or is the first member otherwise.
+.It Dq Li "__.SYMDEF"
+This special member contains the archive symbol table in the BSD
+variant of the archive format.
+If present, this member will be the very first member in the
+archive.
+.El
+.Ss "Archive String Tables"
+An archive string table is used in the SVR4/GNU archive format to hold
+file names that are too large to fit into the constraints of the
+.Ar ar_name
+field of the archive header.
+An archive string table contains a sequence of file names.
+Each file name in the archive string table is terminated by the
+byte sequence 0x2F, 0x0A
+.Po
+the ASCII string
+.Dq "/\en"
+.Pc .
+No padding is used to separate adjacent file names.
+.Ss "Archive Symbol Tables"
+Archive symbol tables are used to speed up link editing by providing a
+mapping between the program symbols defined in the archive
+and the corresponding archive members.
+Archive symbol tables are managed by the
+.Xr ranlib 1
+utility.
+.Pp
+The format of archive symbol tables is as follows:
+.Bl -tag -width "SVR4/GNU"
+.It BSD
+In the BSD archive format, the archive symbol table comprises
+of two parts: a part containing an array of
+.Vt "struct ranlib"
+descriptors, followed by a part containing a symbol string table.
+The sizes and layout of the structures that make up a BSD format
+archive symbol table are machine dependent.
+.Pp
+The part containing
+.Vt "struct ranlib"
+descriptors begins with a field containing the size in bytes of the
+array of
+.Vt "struct ranlib"
+descriptors encoded as a C
+.Vt long
+value.
+.Pp
+The array of
+.Vt "struct ranlib"
+descriptors follows the size field.
+Each
+.Vt "struct ranlib"
+descriptor describes one symbol.
+.Pp
+A
+.Vt "struct ranlib"
+descriptor comprises two fields:
+.Bl -tag -width "Ar ran_strx" -compact
+.It Ar ran_strx
+.Pq C Vt long
+This field contains the zero-based offset of the symbol name in the
+symbol string table.
+.It Ar ran_off
+.Pq C Vt long
+This field is the file offset to the archive header for the archive
+member defining the symbol.
+.El
+.Pp
+The part containing the symbol string table begins with a field
+containing the size in bytes of the string table, encoded as a C
+.Vt long
+value.
+This string table follows the size field, and contains
+NUL-terminated strings for the symbols in the symbol table.
+.It SVR4/GNU
+In the SVR4/GNU archive format, the archive symbol table starts with a
+4-byte binary value containing the number of entries contained in the
+archive symbol table.
+This count of entries is stored most significant byte first.
+.Pp
+Next, there are
+.Ar count
+4-byte numbers, each stored most significant byte first.
+Each number is a binary offset to the archive header for the member in
+the archive file for the corresponding symbol table entry.
+.Pp
+After the binary offset values, there are
+.Ar count
+NUL-terminated strings in sequence, holding the symbol names for
+the corresponding symbol table entries.
+.El
+.Sh STANDARDS COMPLIANCE
+The
+.Xr ar 1
+archive format is not currently specified by a standard.
+.Pp
+This manual page documents the
+.Xr ar 1
+archive formats used by the
+.Bx 4.4
+and
+.Ux SVR4
+operating system releases.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr ld 1 ,
+.Xr ranlib 1 ,
+.Xr elf 3 ,
+.Xr elf_getarsym 3 ,
+.Xr elf_rand 3
diff --git a/share/man/man5/bluetooth.device.conf.5 b/share/man/man5/bluetooth.device.conf.5
new file mode 100644
index 000000000000..d8abb9ec85eb
--- /dev/null
+++ b/share/man/man5/bluetooth.device.conf.5
@@ -0,0 +1,186 @@
+.\" Copyright (c) 2005 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 27, 2008
+.Dt BLUETOOTH.DEVICE.CONF 5
+.Os
+.Sh NAME
+.Nm bluetooth.device.conf
+.Nd Bluetooth device configuration file
+.Sh DESCRIPTION
+Bluetooth device configuration framework provides ability to adjust certain
+Bluetooth device parameters on per-device basis.
+.Pp
+Bluetooth device configuration files are plain text files that should conform
+to basic
+.Xr sh 1
+syntax.
+Even though Bluetooth device are not exactly shell scripts,
+they are parsed and passed through shell
+.Ic eval
+command.
+This makes it possible to use various shell tricks in the Bluetooth device
+configuration files.
+.Pp
+The
+.Pa /etc/rc.d/bluetooth
+script is used to start and stop Bluetooth devices.
+This script is not executed by default when system boots.
+It is called by
+.Xr devd 8
+in response to Bluetooth device arrival and departure events.
+It is possible to execute this script by hand if required.
+The script accepts Bluetooth device driver name as an extra parameter.
+.Pp
+The system wide Bluetooth device configuration file is called
+.Pa /etc/defaults/\:bluetooth.device.conf .
+Configuration parameters set in the system wide Bluetooth device configuration
+file apply to every Bluetooth device connected to the system.
+.Pp
+Configuration parameters overrides for the specific Bluetooth device
+should be placed in the
+.Pa /etc/bluetooth/ Ns Ar DEVICE_DRIVER_NAME Ns Pa .conf
+file.
+Where
+.Ar DEVICE_DRIVER_NAME
+is the device driver name of the Bluetooth device.
+.Pp
+The following list provides a name and short description for each
+variable that can be set in a Bluetooth device configuration file.
+.Bl -tag -width indent-two
+.It Va authentication_enable
+.Pq Vt bool
+The
+.Va authentication_enable
+parameter controls if the device requires to authenticate the remote device
+at connection setup.
+If set to
+.Dq Li YES ,
+the device will try to authenticate the other device at connection setup.
+Bluetooth authentication requests are handled by
+.Xr hcsecd 8
+daemon.
+.It Va class
+.Pq Vt str
+The
+.Va class
+parameter is used to indicate the capabilities of the device to
+other devices.
+For more details see
+.Dq Assigned Numbers - Bluetooth Baseband
+document.
+.It Va connectable
+.Pq Vt bool
+The
+.Va connectable
+parameter controls whether or not the device should periodically scan for
+page attempts from other devices.
+If set to
+.Dq Li YES ,
+the device will periodically scan for page attempts from other devices.
+.It Va discoverable
+.Pq Vt bool
+The
+.Va discoverable
+parameter controls whether or not the device should periodically scan for
+inquiry requests from other devices.
+If set to
+.Dq Li YES ,
+the device will periodically scan for inquiry requests from other devices.
+.It Va encryption_mode
+.Pq Vt str
+The
+.Va encryption_mode
+parameter controls if the device requires encryption to the remote device
+at connection setup.
+At connection setup, only the devices with the
+.Va authentication_enable
+parameter enabled and
+.Va encryption_mode
+parameter enabled will try to encrypt the connection to the other device.
+Possible values are
+.Dq Li NONE
+encryption disabled,
+.Dq Li P2P
+encryption for only point-to-point packets,
+or
+.Dq Li ALL
+encryption for both point-to-point and broadcast packets.
+.It Va hci_debug_level
+.Pq Vt int
+HCI node debug level.
+Higher values mean more verbose output.
+.It Va l2cap_debug_level
+.Pq Vt int
+L2CAP node debug level.
+Higher values mean more verbose output.
+.It Va local_name
+.Pq Vt str
+The
+.Va local_name
+parameter provides the ability to modify the user friendly name for the device.
+.It Va role_switch
+.Pq Vt bool
+The
+.Va role_switch
+parameter controls whether the local device should perform role switch.
+By default, if role switch is supported, the local device will try to perform
+role switch and become Master on incoming connection.
+Some devices do not support role switch and thus incoming connections from
+such devices will fail.
+If
+.Va role switch
+is disabled then accepting device will remain Slave.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/defaults/bluetooth.device.conf" -compact
+.It Pa /etc/defaults/bluetooth.device.conf
+.It Pa /etc/rc.d/bluetooth
+.El
+.Sh EXAMPLES
+The
+.Pa /etc/bluetooth/ubt0.conf
+file should be used to specify configuration parameters overrides for the
+first USB Bluetooth device
+(device driver name is
+.Li ubt0 ) .
+.Pp
+The
+.Pa /etc/bluetooth/ubt1.conf
+file should be used to specify configuration parameters overrides for the
+second USB Bluetooth device.
+.Sh SEE ALSO
+.Xr ng_bt3c 4 ,
+.Xr ng_h4 4 ,
+.Xr ng_hci 4 ,
+.Xr ng_l2cap 4 ,
+.Xr ng_ubt 4 ,
+.Xr devd 8 ,
+.Xr hccontrol 8 ,
+.Xr hcsecd 8 ,
+.Xr l2control 8
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
diff --git a/share/man/man5/bluetooth.hosts.5 b/share/man/man5/bluetooth.hosts.5
new file mode 100644
index 000000000000..bda4d920496d
--- /dev/null
+++ b/share/man/man5/bluetooth.hosts.5
@@ -0,0 +1,63 @@
+.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: bluetooth.hosts.5,v 1.5 2003/05/20 22:52:39 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd May 8, 2003
+.Dt BLUETOOTH.HOSTS 5
+.Os
+.Sh NAME
+.Nm bluetooth.hosts
+.Nd Bluetooth host name database
+.Sh DESCRIPTION
+The
+.Pa /etc/bluetooth/hosts
+file contains information regarding the known Bluetooth hosts.
+For each Bluetooth host a single line should be present with the
+following information:
+.Bd -unfilled -offset indent
+Bluetooth address
+official host name
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or tab characters.
+A
+.Ql #
+indicates the beginning of a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+Bluetooth addresses are specified as six hex bytes separated by columns
+(BD_ADDR).
+Host names may contain any printable character other than a field
+delimiter, newline, or comment character.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact
+.It Pa /etc/bluetooth/hosts
+.El
+.Sh SEE ALSO
+.Xr bluetooth 3
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
diff --git a/share/man/man5/bluetooth.protocols.5 b/share/man/man5/bluetooth.protocols.5
new file mode 100644
index 000000000000..64a7dd56367b
--- /dev/null
+++ b/share/man/man5/bluetooth.protocols.5
@@ -0,0 +1,62 @@
+.\" Copyright (c) 2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: bluetooth.protocols.5,v 1.1 2003/05/20 22:52:39 max Exp $
+.\" $FreeBSD$
+.\"
+.Dd May 8, 2003
+.Dt BLUETOOTH.PROTOCOLS 5
+.Os
+.Sh NAME
+.Nm bluetooth.protocols
+.Nd Bluetooth Protocol Service Multiplexor database
+.Sh DESCRIPTION
+The
+.Pa /etc/bluetooth/protocols
+file contains information regarding the known Bluetooth Protocol Service
+Multiplexor values.
+For each Bluetooth Protocol Service Multiplexor a single line should be
+present with the following information:
+.Bd -unfilled -offset indent
+official Protocol Service Multiplexor name
+official Protocol Service Multiplexor value
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or tab characters.
+A
+.Ql #
+indicates the beginning of a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+Bluetooth Protocol Service Multiplexor names may contain any printable
+character other than a field delimiter, newline, or comment character.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/bluetooth/hosts" -compact
+.It Pa /etc/bluetooth/protocols
+.El
+.Sh SEE ALSO
+.Xr bluetooth 3
+.Sh AUTHORS
+.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
diff --git a/share/man/man5/boot.config.5 b/share/man/man5/boot.config.5
new file mode 100644
index 000000000000..681fc3aa765f
--- /dev/null
+++ b/share/man/man5/boot.config.5
@@ -0,0 +1,103 @@
+.\" Copyright (c) 2007 Daniel Gerzo <danger@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd May 13, 2007
+.Dt BOOT.CONFIG 5
+.Os
+.Sh NAME
+.Nm boot.config
+.Nd "Configuration file for the boot blocks"
+.Sh DESCRIPTION
+The
+.Nm
+file contains options for the
+.Fx
+boot block code.
+.Pp
+When the
+.Fx
+boot loader runs, it searches the
+.Dq Li a
+slice of the boot partition for a
+.Nm
+file (as a result, slices which are missing an
+.Dq Li a
+partition require user intervention during the boot process).
+If the
+.Nm
+file is found, its contents are used as the default configuration
+options for the boot block code and are echoed to the system console.
+.Pp
+A valid format of this file is to put BIOS drive number, a controller
+type, a unit number, a partition, a kernel file name, and any other
+valid
+.Xr boot 8
+option on a single line, as it is done at the
+.Dq Li "boot:"
+prompt.
+.Pp
+The options related to the boot image selection described below and all
+the other options available for
+.Nm
+are documented in detail in the
+.Xr boot 8
+manual page.
+.Sh FILES
+.Bl -tag -width /boot.config -compact
+.It Pa /boot.config
+parameters for the boot blocks (optional)
+.El
+.Sh EXAMPLES
+The command:
+.Bd -literal -offset indent
+# echo "-P" > /boot.config
+.Ed
+.Pp
+will activate the serial console of
+.Fx .
+.Pp
+The command:
+.Bd -literal -offset indent
+# echo "1:ad(1,a)/boot/loader" > /boot.config
+.Ed
+.Pp
+will instruct the second stage of
+.Xr boot 8
+on the first disk to boot with the third
+.Xr boot 8
+stage from the second disk.
+.Pp
+The command:
+.Bd -literal -offset indent
+# echo "1:ad(1,a)/boot/loader -P" > /boot.config
+.Ed
+.Pp
+will do both of the above.
+.Sh SEE ALSO
+.Xr boot 8 ,
+.Xr loader 8
+.Sh AUTHORS
+This manual page was written by
+.An Daniel Gerzo Aq danger@FreeBSD.org .
diff --git a/share/man/man5/core.5 b/share/man/man5/core.5
new file mode 100644
index 000000000000..9847ccd8d37a
--- /dev/null
+++ b/share/man/man5/core.5
@@ -0,0 +1,144 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)core.5 8.3 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd December 22, 2010
+.Dt CORE 5
+.Os
+.Sh NAME
+.Nm core
+.Nd memory image file format
+.Sh SYNOPSIS
+.In sys/param.h
+.Sh DESCRIPTION
+A small number of signals which cause abnormal termination of a process
+also cause a record of the process's in-core state to be written
+to disk for later examination by one of the available debuggers.
+(See
+.Xr sigaction 2 . )
+This memory image is written to a file named by default
+.Nm programname.core
+in the working directory;
+provided the terminated process had write permission in the directory,
+and provided the abnormality did not cause
+a system crash.
+(In this event, the decision to save the core file is arbitrary, see
+.Xr savecore 8 . )
+.Pp
+The maximum size of a core file is limited by
+.Xr setrlimit 2 .
+Files which would be larger than the limit are not created.
+.Pp
+The name of the file is controlled via the
+.Xr sysctl 8
+variable
+.Va kern.corefile .
+The contents of this variable describes a filename to store
+the core image to.
+This filename can be absolute, or relative (which
+will resolve to the current working directory of the program
+generating it).
+.Pp
+The following format specifiers may be used in the
+.Va kern.corefile
+sysctl to insert additional information into the resulting core file
+name:
+.Bl -tag -width "1234567890" -compact -offset "12345"
+.It Em \&%H
+Machine hostname.
+.It Em \&%I
+An index starting at zero until the sysctl
+.Em debug.num_cores
+is reached. This can be useful for limiting the number of corefiles
+generated by a particular process.
+.It Em \&%N
+process name.
+.It Em \&%P
+processes PID.
+.It Em \&%U
+process UID.
+.El
+.Pp
+The name defaults to
+.Em \&%N.core ,
+yielding the traditional
+.Fx
+behaviour.
+.Pp
+By default, a process that changes user or group credentials whether
+real or effective will not create a corefile.
+This behaviour can be
+changed to generate a core dump by setting the
+.Xr sysctl 8
+variable
+.Va kern.sugid_coredump
+to 1.
+.Pp
+Corefiles can be compressed by the kernel if the following items
+are included in the kernel configuration file:
+.Bl -tag -width "1234567890" -compact -offset "12345"
+.It options
+COMPRESS_USER_CORES
+.It devices
+gzio
+.El
+.Pp
+When COMPRESS_USER_CORES is included the following sysctls can control
+if core files will be compressed:
+.Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345"
+.It Em kern.compress_user_cores_gzlevel
+Gzip compression level. Defaults to -1.
+.It Em kern.compress_user_cores
+Actually compress user cores. Core files will have the suffix
+.Em .gz
+appended to them.
+.El
+.Sh EXAMPLES
+In order to store all core images in per-user private areas under
+.Pa /var/coredumps ,
+the following
+.Xr sysctl 8
+command can be used:
+.Pp
+.Dl sysctl kern.corefile=/var/coredumps/\&%U/\&%N.core
+.Sh SEE ALSO
+.Xr gdb 1 ,
+.Xr kgdb 1 ,
+.Xr setrlimit 2 ,
+.Xr sigaction 2 ,
+.Xr sysctl 8
+.Sh HISTORY
+A
+.Nm
+file format appeared in
+.At v6 .
diff --git a/share/man/man5/devfs.5 b/share/man/man5/devfs.5
new file mode 100644
index 000000000000..504a0627f428
--- /dev/null
+++ b/share/man/man5/devfs.5
@@ -0,0 +1,152 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Copyright (c) 1992, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software donated to Berkeley by
+.\" Jan-Simon Pendry.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 9, 2012
+.Dt DEVFS 5
+.Os
+.Sh NAME
+.Nm devfs
+.Nd device file system
+.Sh SYNOPSIS
+.Bd -literal
+devfs /dev devfs rw 0 0
+.Ed
+.Sh DESCRIPTION
+The device file system, or
+.Nm ,
+provides access to kernel's device
+namespace in the global file system namespace.
+The conventional mount point is
+.Pa /dev .
+.Pp
+The file system includes several directories, links, symbolic links
+and devices, some of which can also be written.
+In a chroot'ed
+environment,
+.Nm
+can be used to create a new
+.Pa /dev
+mount point.
+.Pp
+The
+.Xr mknod 8
+tool can be used to recover deleted device entries under
+.Nm .
+.Pp
+The
+.Xr fdescfs 5
+filesystem is an alternate means for populating
+.Pa /dev/fd .
+The character devices that both
+.Nm
+and
+.Xr fdescfs 5
+present in
+.Pa /dev/fd
+correspond to the open file descriptors of the process
+accessing the directory.
+.Nm
+only creates files for the standard file descriptors
+.Pa 0 ,
+.Pa 1
+and
+.Pa 2 .
+.Xr fdescfs 5
+creates files for all open descriptors.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl o Ar options
+Use the specified mount
+.Ar options ,
+as described in
+.Xr mount 8 .
+The following devfs file system-specific options are available:
+.Bl -tag -width indent
+.It Cm ruleset Ns No = Ns Ar ruleset
+Set ruleset number
+.Ar ruleset
+as the current ruleset for the mount-point and apply all its rules.
+If the ruleset number
+.Ar ruleset
+does not exist, an empty ruleset with the number
+.Ar ruleset
+is created.
+See
+.Xr devfs 8
+for more information on working with devfs rulesets.
+.El
+.El
+.Sh FILES
+.Bl -tag -width /dev/XXXX -compact
+.It Pa /dev
+The normal
+.Nm
+mount point.
+.El
+.Sh EXAMPLES
+To mount a
+.Nm
+volume located on
+.Pa /mychroot/dev :
+.Pp
+.Dl "mount -t devfs devfs /mychroot/dev"
+.Sh SEE ALSO
+.Xr fdescfs 5 ,
+.Xr devfs 8 ,
+.Xr mount 8
+.Sh HISTORY
+The
+.Nm
+file system first appeared in
+.Fx 2.0 .
+It became the preferred method for accessing devices in
+.Fx 5.0
+and the only method in
+.Fx 6.0 .
+The
+.Nm
+manual page first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+The
+.Nm
+manual page was written by
+.An Mike Pritchard Aq mpp@FreeBSD.org .
diff --git a/share/man/man5/devfs.conf.5 b/share/man/man5/devfs.conf.5
new file mode 100644
index 000000000000..9d837263f1a4
--- /dev/null
+++ b/share/man/man5/devfs.conf.5
@@ -0,0 +1,140 @@
+.\" Copyright (c) 2004 Roland Smith <rsmith@xs4all.nl>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 17, 2005
+.Dt DEVFS.CONF 5
+.Os
+.Sh NAME
+.Nm devfs.conf
+.Nd boot-time devfs configuration information
+.Sh DESCRIPTION
+The
+.Nm
+file provides an easy way to set ownership and permissions, or create
+links for devices available at boot.
+.Pp
+It does not work for devices plugged in and out after the system is up
+and running, e.g.\& USB devices.
+See
+.Xr devfs.rules 5
+for setting ownership and permissions for all device nodes, and
+.Xr devd.conf 5
+for actions to be taken when devices are attached or detached.
+.Pp
+Lines starting with a hash sign
+.Pq Ql #
+and empty lines are ignored.
+The lines that specify
+.Nm
+rules consist of three parameters separated by whitespace:
+.Bl -tag -width indent
+.It Ar action
+The action to take for the device.
+The action names are only significant to the first unique character.
+.It Ar devname
+The name of the device created by
+.Xr devfs 5 .
+.It Ar arg
+The argument of the
+.Ar action .
+.El
+.Pp
+The actions currently supported are:
+.Bl -tag -width indent
+.It Ic link
+This action creates a symbolic link named
+.Ar arg
+that points to
+.Ar devname ,
+the name of the device created by
+.Xr devfs 5 .
+.It Ic own
+This action changes the ownership of
+.Ar devname .
+The
+.Ar arg
+parameter must be in the form of an
+.Ar owner Ns : Ns Ar group
+pair, in the same format used by
+.Xr chown 8 .
+.It Ic perm
+This action changes the permissions of
+.Ar devname .
+The
+.Ar arg
+parameter must be a
+.Ar mode
+as explained in
+.Xr chmod 1 .
+.El
+.Sh FILES
+.Bl -tag -compact
+.It Pa /etc/devfs.conf
+.It Pa /usr/share/examples/etc/devfs.conf
+.El
+.Sh EXAMPLES
+To create a
+.Pa /dev/cdrom
+link that points to the first
+.Xr SCSI 4
+or
+.Xr atapicam 4
+CD-ROM,
+the following may be added to
+.Nm :
+.Bd -literal -offset indent
+link cd0 cdrom
+.Ed
+.Pp
+Similarly, to link
+.Pa /dev/cdrom
+to the first ATAPI CD-ROM device, the following action may be used:
+.Bd -literal -offset indent
+link acd0 cdrom
+.Ed
+.Pp
+To set the owner of a device, the
+.Ic own
+action may be specified:
+.Bd -literal -offset indent
+own cd0 root:cdrom
+.Ed
+.Pp
+To set the permissions of a device, a
+.Ic perm
+action should be used:
+.Bd -literal -offset indent
+perm cd0 0660
+.Ed
+.Sh SEE ALSO
+.Xr chmod 1 ,
+.Xr devd.conf 5 ,
+.Xr devfs 5 ,
+.Xr devfs.rules 5 ,
+.Xr chown 8
+.Sh AUTHORS
+This manual page was written by
+.An "Roland Smith" Aq rsmith@xs4all.nl .
diff --git a/share/man/man5/devfs.rules.5 b/share/man/man5/devfs.rules.5
new file mode 100644
index 000000000000..8a7b3d665ab2
--- /dev/null
+++ b/share/man/man5/devfs.rules.5
@@ -0,0 +1,127 @@
+.\" Copyright (c) 2004 Roland Smith <rsmith@xs4all.nl>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 21, 2010
+.Dt DEVFS.RULES 5
+.Os
+.Sh NAME
+.Nm devfs.rules
+.Nd devfs configuration information
+.Sh DESCRIPTION
+The
+.Nm
+file provides an easy way to create and apply
+.Xr devfs 8
+rules, even for devices that are not available at boot.
+.Pp
+For devices available at boot, see
+.Xr devfs.conf 5 .
+.Pp
+The format of this file is simple.
+Empty lines and lines beginning with a hash sign
+.Pq Ql #
+are ignored.
+A line between brackets denotes the start of a ruleset.
+In the brackets should be the name of the ruleset and its number,
+separated by an equal sign.
+.Pp
+Other lines are rule specifications as documented in
+.Xr devfs 8 ,
+in the section
+.Sx "Rule Specification" .
+These lines are prepended with
+.Dq Li rule
+and are passed to
+.Xr devfs 8
+by the startup scripts of the system.
+It is important to put path elements that contain
+.Xr glob 3
+special characters between quotes.
+.Pp
+Rulesets should have a unique name and number.
+.Pp
+All rules that follow a ruleset declaration belong to that ruleset, until a
+new ruleset is started.
+.Pp
+One custom ruleset has to be enabled in
+.Pa /etc/rc.conf ,
+otherwise it will not be applied to the
+.Pa /dev
+file system by the default system startup process.
+For example, to enable a
+.Dq Li localrules
+ruleset for the
+.Pa /dev
+file system, you would have to use something like this in your
+.Pa rc.conf
+file:
+.Bd -literal -offset indent
+devfs_system_ruleset="localrules"
+.Ed
+.Sh FILES
+.Bl -tag -compact
+.It Pa /etc/defaults/devfs.rules
+Default
+.Nm
+configuration file.
+.It Pa /etc/devfs.rules
+Local
+.Nm
+configuration file. Rulesets in here override those in
+.Pa /etc/defaults/devfs.rules
+with the same ruleset number, otherwise the two files are effectively merged.
+.El
+.Sh EXAMPLES
+To make all the partitions of
+.Xr da 4
+devices readable and writable by their owner and the
+.Dq Li usb
+group, the following rule may be used:
+.Pp
+.Dl "[localrules=10]"
+.Dl "add path 'da*s*' mode 0660 group usb"
+.Pp
+The first line declares and starts a new ruleset, with the name
+.Va localrules
+and the number 10.
+.Pp
+To give
+.Xr usbconfig 8
+and
+.Xr libusb 3
+enabled applications permission to all usb devices for their owner and the
+.Dq Li usb
+group, a similar rule may be used:
+.Pp
+.Dl "add path 'usb/*' mode 0660 group usb"
+.Sh SEE ALSO
+.Xr glob 3 ,
+.Xr devfs 5 ,
+.Xr devfs.conf 5 ,
+.Xr devfs 8
+.Sh AUTHORS
+This manual page was written by
+.An "Roland Smith" Aq rsmith@xs4all.nl .
diff --git a/share/man/man5/device.hints.5 b/share/man/man5/device.hints.5
new file mode 100644
index 000000000000..9dcaccd71beb
--- /dev/null
+++ b/share/man/man5/device.hints.5
@@ -0,0 +1,170 @@
+.\" Copyright (c) 2001
+.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 11, 2009
+.Dt DEVICE.HINTS 5
+.Os
+.Sh NAME
+.Nm device.hints
+.Nd device resource hints
+.Sh DESCRIPTION
+The
+.Nm
+file is read in by the boot
+.Xr loader 8
+when the system is about to start, and its contents are
+passed to the kernel.
+It contains various variables to control the boot behavior of
+the kernel.
+These variables are typically
+.Dq device hints .
+.\" .Dq device hints ,
+.\" and other control variables.
+.Pp
+The file contains one variable per line.
+Lines starting with the
+.Ql #
+character are comments and are ignored by the boot loader.
+.Pp
+After the file is read by the boot loader, you may examine
+the variables with the
+.Ic show
+command, and may add a new variable, modify an existing one,
+or delete a variable with the
+.Ic set
+and
+.Ic unset
+commands of the boot loader
+(see
+.Xr loader 8 ) .
+.Pp
+After the system has started, you can dump these variables
+with the
+.Xr kenv 1
+command.
+.Sh DEVICE HINTS
+Device hint variables are used by device drivers to set up
+the device.
+They are most often used by ISA device drivers to specify
+where the driver will probe for the relevant devices, and what
+resources it will attempt to use.
+.Pp
+A device hint line looks like:
+.Pp
+.Sm off
+.D1 Li hint. Ar driver . Ar unit . Ar keyword Li = Qq Ar value
+.Sm on
+.Pp
+where
+.Ar driver
+is the name of a device driver,
+.Ar unit
+is the unit number, and
+.Ar keyword
+is the keyword of the hint.
+The keyword may be:
+.Pp
+.Bl -tag -width ".Li disabled" -compact -offset indent
+.It Li at
+specifies a bus to which the device is attached.
+.It Li port
+specifies the start address of I/O ports to be used by the device.
+.It Li portsize
+specifies the number of ports used by the device.
+.It Li irq
+is the interrupt line number to be used.
+.It Li drq
+is the DMA channel number.
+.It Li maddr
+specifies the physical memory address used by the device.
+.It Li msize
+specifies the physical memory size used by the device.
+.It Li flags
+sets various flag bits for the device.
+.It Li disabled
+can be set to
+.Qq 1
+to disable the device.
+.El
+.Pp
+A device driver may require one or more hint lines with these keywords,
+and may accept other keywords not listed here, through
+.Xr resource_int_value 9 .
+Consult individual device drivers' manual pages for available
+keywords and their possible values.
+.\" .Sh CONTROL VARIABLES
+.\" Lines not starting with
+.\" .Dq hint.
+.\" specify other control variables for the kernel.
+.\" They look:
+.\" .Pp
+.\" .Dl <name>="<value>"
+.\" XXX
+.\" WE SHOULD LIST AVAILABLE VARIABLE NAMES AND THEIR POSSIBLE VALUES HERE!
+.\" .Pp
+.Sh FILES
+.Bl -tag -width ".Pa /sys/ Ns Ar ARCH Ns Pa /conf/GENERIC.hints" -compact
+.It Pa /boot/device.hints
+Device resource hints file.
+.It Pa /sys/ Ns Ar ARCH Ns Pa /conf/GENERIC.hints
+Sample resource hints for the
+.Pa GENERIC
+kernel.
+.It Pa /sys/ Ns Ar ARCH Ns Pa /conf/NOTES
+Notes on the kernel configuration file and device resource hints.
+.El
+.Sh EXAMPLES
+The following example sets up resources for the
+.Xr sio 4
+driver on the ISA bus:
+.Bd -literal -offset indent
+hint.sio.0.at="isa"
+hint.sio.0.port="0x3F8"
+hint.sio.0.flags="0x10"
+hint.sio.0.irq="4"
+.Ed
+.Pp
+The following example disables the ACPI driver:
+.Bd -literal -offset indent
+hint.acpi.0.disabled="1"
+.Ed
+.\" .Pp
+.\" A control variable may look like:
+.\" .Pp
+.\" .Bd -literal -offset indent
+.\" debug.acpi.layer="ACPI_RESOURCES"
+.\" .Ed
+.Sh SEE ALSO
+.Xr kenv 1 ,
+.Xr loader.conf 5 ,
+.Xr loader 8 ,
+.Xr resource_int_value 9 .
+.Sh HISTORY
+The
+.Nm
+file first appeared in
+.Fx 5.0 .
diff --git a/share/man/man5/dir.5 b/share/man/man5/dir.5
new file mode 100644
index 000000000000..c47104344bf8
--- /dev/null
+++ b/share/man/man5/dir.5
@@ -0,0 +1,160 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)dir.5 8.3 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd April 19, 1994
+.Dt DIR 5
+.Os
+.Sh NAME
+.Nm dir ,
+.Nm dirent
+.Nd directory file format
+.Sh SYNOPSIS
+.In dirent.h
+.Sh DESCRIPTION
+Directories provide a convenient hierarchical method of grouping
+files while obscuring the underlying details of the storage medium.
+A directory file is differentiated from a plain file
+by a flag in its
+.Xr inode 5
+entry.
+It consists of records (directory entries) each of which contains
+information about a file and a pointer to the file itself.
+Directory entries may contain other directories
+as well as plain files; such nested directories are referred to as
+subdirectories.
+A hierarchy of directories and files is formed in this manner
+and is called a file system (or referred to as a file system tree).
+.\" An entry in this tree,
+.\" nested or not nested,
+.\" is a pathname.
+.Pp
+Each directory file contains two special directory entries; one is a pointer
+to the directory itself
+called dot
+.Ql .\&
+and the other a pointer to its parent directory called dot-dot
+.Ql \&.. .
+Dot and dot-dot
+are valid pathnames, however,
+the system root directory
+.Ql / ,
+has no parent and dot-dot points to itself like dot.
+.Pp
+File system nodes are ordinary directory files on which has
+been grafted a file system object, such as a physical disk or a
+partitioned area of such a disk.
+(See
+.Xr mount 2
+and
+.Xr mount 8 . )
+.Pp
+The directory entry format is defined in the file
+.In sys/dirent.h
+(which should not be included directly by applications):
+.Bd -literal
+#ifndef _SYS_DIRENT_H_
+#define _SYS_DIRENT_H_
+
+#include <machine/ansi.h>
+
+/*
+ * The dirent structure defines the format of directory entries returned by
+ * the getdirentries(2) system call.
+ *
+ * A directory entry has a struct dirent at the front of it, containing its
+ * inode number, the length of the entry, and the length of the name
+ * contained in the entry. These are followed by the name padded to a 4
+ * byte boundary with null bytes. All names are guaranteed null terminated.
+ * The maximum length of a name in a directory is MAXNAMLEN.
+ */
+
+struct dirent {
+ __uint32_t d_fileno; /* file number of entry */
+ __uint16_t d_reclen; /* length of this record */
+ __uint8_t d_type; /* file type, see below */
+ __uint8_t d_namlen; /* length of string in d_name */
+#ifdef _POSIX_SOURCE
+ char d_name[255 + 1]; /* name must be no longer than this */
+#else
+#define MAXNAMLEN 255
+ char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
+#endif
+};
+
+/*
+ * File types
+ */
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+/*
+ * Convert between stat structure types and directory types.
+ */
+#define IFTODT(mode) (((mode) & 0170000) >> 12)
+#define DTTOIF(dirtype) ((dirtype) << 12)
+
+/*
+ * The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
+ * the directory entry. This requires the amount of space in struct direct
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ */
+#define _GENERIC_DIRSIZ(dp) \
+ ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
+
+#ifdef _KERNEL
+#define GENERIC_DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
+#endif
+
+#endif /* !_SYS_DIRENT_H_ */
+.Ed
+.Sh SEE ALSO
+.Xr fs 5 ,
+.Xr inode 5
+.Sh HISTORY
+A
+.Nm
+file format appeared in
+.At v7 .
+.Sh BUGS
+The usage of the member d_type of struct dirent is unportable as it is
+.Fx Ns -specific .
+It also may fail on certain file systems, for example the cd9660 file system.
diff --git a/share/man/man5/disktab.5 b/share/man/man5/disktab.5
new file mode 100644
index 000000000000..d564b87af3b8
--- /dev/null
+++ b/share/man/man5/disktab.5
@@ -0,0 +1,143 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)disktab.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd October 14, 2006
+.Dt DISKTAB 5
+.Os
+.Sh NAME
+.Nm disktab
+.Nd disk description file
+.Sh SYNOPSIS
+.In disklabel.h
+.Sh DESCRIPTION
+.Nm Disktab
+is a simple database which describes disk geometries and
+disk partition characteristics.
+It is used
+.\"by the formatter(\c
+.\"IR.Xr format 8 )
+.\"to determine how to format the disk, and
+to initialize the disk label on the disk.
+The format is patterned
+after the
+.Xr termcap 5
+terminal data base.
+Entries in
+.Nm
+consist of a number of `:'-separated fields.
+The
+first field for each entry gives the names by which a
+disk's entry may be selected, separated by `|' characters.
+The
+last name given should be a long name fully identifying
+the disk.
+.Pp
+The optional fields for each entry are:
+.Bl -column "indent" "boolx"
+.It Sy "ID Type Description"
+.It "\&ty str Type of disk (e.g. removable, winchester)"
+.It "\&dt str Type of controller (e.g."
+.Tn SMD , ESDI ,
+floppy)
+.It "\&ns num Number of sectors per track"
+.It "\&nt num Number of tracks per cylinder"
+.It "\&nc num Total number of cylinders on the disk"
+.It "\&sc num Number of sectors per cylinder, ns*nt default"
+.It "\&su num Number of sectors per unit, sc*nc default"
+.It "\&se num Sector size in bytes,"
+.Dv DEV_BSIZE
+default
+.It "\&sf bool Controller supports bad144-style bad sector forwarding"
+.It "\&rm num Rotation speed, rpm, 3600 default"
+.It "\&sk num Sector skew per track, default 0"
+.It "\&cs num Sector skew per cylinder, default 0"
+.It "\&hs num Headswitch time, usec, default 0"
+.It "\&ts num One-cylinder seek time, usec, default 0"
+.It "\&il num Sector interleave (n:1), 1 default"
+.It "\&d[0-4] num Drive-type-dependent parameters"
+.It "\&bs num Boot block size, default"
+.Dv BBSIZE
+.It "\&sb num Superblock size, default 0"
+.It "\&ba num Block size for partition `a' (bytes)"
+.It "\&bd num Block size for partition `d' (bytes)"
+.It "\&be num Block size for partition `e' (bytes)"
+.It "\&bf num Block size for partition `f' (bytes)"
+.It "\&bg num Block size for partition `g' (bytes)"
+.It "\&bh num Block size for partition `h' (bytes)"
+.It "\&fa num Fragment size for partition `a' (bytes)"
+.It "\&fd num Fragment size for partition `d' (bytes)"
+.It "\&fe num Fragment size for partition `e' (bytes)"
+.It "\&ff num Fragment size for partition `f' (bytes)"
+.It "\&fg num Fragment size for partition `g' (bytes)"
+.It "\&fh num Fragment size for partition `h' (bytes)"
+.It "\&oa num Offset of partition `a' in sectors"
+.It "\&ob num Offset of partition `b' in sectors"
+.It "\&oc num Offset of partition `c' in sectors"
+.It "\&od num Offset of partition `d' in sectors"
+.It "\&oe num Offset of partition `e' in sectors"
+.It "\&of num Offset of partition `f' in sectors"
+.It "\&og num Offset of partition `g' in sectors"
+.It "\&oh num Offset of partition `h' in sectors"
+.It "\&pa num Size of partition `a' in sectors"
+.It "\&pb num Size of partition `b' in sectors"
+.It "\&pc num Size of partition `c' in sectors"
+.It "\&pd num Size of partition `d' in sectors"
+.It "\&pe num Size of partition `e' in sectors"
+.It "\&pf num Size of partition `f' in sectors"
+.It "\&pg num Size of partition `g' in sectors"
+.It "\&ph num Size of partition `h' in sectors"
+.It "\&ta str Partition type of partition `a'"
+.Pf ( Bx 4.2
+file system, swap, etc)
+.It "\&tb str Partition type of partition `b'"
+.It "\&tc str Partition type of partition `c'"
+.It "\&td str Partition type of partition `d'"
+.It "\&te str Partition type of partition `e'"
+.It "\&tf str Partition type of partition `f'"
+.It "\&tg str Partition type of partition `g'"
+.It "\&th str Partition type of partition `h'"
+.El
+.Sh FILES
+.Bl -tag -width /etc/disktab -compact
+.It Pa /etc/disktab
+.El
+.Sh SEE ALSO
+.Xr getdiskbyname 3 ,
+.Xr bsdlabel 8 ,
+.Xr newfs 8
+.Sh HISTORY
+The
+.Nm
+description file appeared in
+.Bx 4.2 .
diff --git a/share/man/man5/elf.5 b/share/man/man5/elf.5
new file mode 100644
index 000000000000..b68363ef12c3
--- /dev/null
+++ b/share/man/man5/elf.5
@@ -0,0 +1,1313 @@
+.\" Copyright (c) 1999 Jeroen Ruigrok van der Werven
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 18, 2005
+.Dt ELF 5
+.Os
+.Sh NAME
+.Nm elf
+.Nd format of ELF executable binary files
+.Sh SYNOPSIS
+.In elf.h
+.Sh DESCRIPTION
+The header file
+.In elf.h
+defines the format of ELF executable binary files.
+Amongst these files are
+normal executable files, relocatable object files, core files and shared
+libraries.
+.Pp
+An executable file using the ELF file format consists of an ELF header,
+followed by a program header table or a section header table, or both.
+The ELF header is always at offset zero of the file.
+The program header
+table and the section header table's offset in the file are defined in the
+ELF header.
+The two tables describe the rest of the particularities of
+the file.
+.Pp
+Applications which wish to process ELF binary files for their native
+architecture only should include
+.In elf.h
+in their source code.
+These applications should need to refer to
+all the types and structures by their generic names
+.Dq Elf_xxx
+and to the macros by
+.Dq ELF_xxx .
+Applications written this way can be compiled on any architecture,
+regardless whether the host is 32-bit or 64-bit.
+.Pp
+Should an application need to process ELF files of an unknown
+architecture then the application needs to include both
+.In sys/elf32.h
+and
+.In sys/elf64.h
+instead of
+.In elf.h .
+Furthermore, all types and structures need to be identified by either
+.Dq Elf32_xxx
+or
+.Dq Elf64_xxx .
+The macros need to be identified by
+.Dq ELF32_xxx
+or
+.Dq ELF64_xxx .
+.Pp
+Whatever the system's architecture is, it will always include
+.In sys/elf_common.h
+as well as
+.In sys/elf_generic.h .
+.Pp
+These header files describe the above mentioned headers as C structures
+and also include structures for dynamic sections, relocation sections and
+symbol tables.
+.Pp
+The following types are being used for 32-bit architectures:
+.Bd -literal -offset indent
+Elf32_Addr Unsigned 32-bit program address
+Elf32_Half Unsigned 16-bit field
+Elf32_Lword Unsigned 64-bit field
+Elf32_Off Unsigned 32-bit file offset
+Elf32_Sword Signed 32-bit field or integer
+Elf32_Word Unsigned 32-bit field or integer
+.Ed
+.Pp
+For 64-bit architectures we have the following types:
+.Bd -literal -offset indent
+Elf64_Addr Unsigned 64-bit program address
+Elf64_Half Unsigned 16-bit field
+Elf64_Lword Unsigned 64-bit field
+Elf64_Off Unsigned 64-bit file offset
+Elf64_Sword Signed 32-bit field
+Elf64_Sxword Signed 64-bit field or integer
+Elf64_Word Unsigned 32-bit field
+Elf64_Xword Unsigned 64-bit field or integer
+.Ed
+.Pp
+All data structures that the file format defines follow the
+.Dq natural
+size and alignment guidelines for the relevant class.
+If necessary,
+data structures contain explicit padding to ensure 4-byte alignment
+for 4-byte objects, to force structure sizes to a multiple of 4, etc.
+.Pp
+The ELF header is described by the type Elf32_Ehdr or Elf64_Ehdr:
+.Bd -literal -offset indent
+typedef struct {
+ unsigned char e_ident[EI_NIDENT];
+ Elf32_Half e_type;
+ Elf32_Half e_machine;
+ Elf32_Word e_version;
+ Elf32_Addr e_entry;
+ Elf32_Off e_phoff;
+ Elf32_Off e_shoff;
+ Elf32_Word e_flags;
+ Elf32_Half e_ehsize;
+ Elf32_Half e_phentsize;
+ Elf32_Half e_phnum;
+ Elf32_Half e_shentsize;
+ Elf32_Half e_shnum;
+ Elf32_Half e_shstrndx;
+} Elf32_Ehdr;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+.Ed
+.Pp
+The fields have the following meanings:
+.Pp
+.Bl -tag -width "e_phentsize" -compact -offset indent
+.It Dv e_ident
+This array of bytes specifies to interpret the file,
+independent of the processor or the file's remaining contents.
+Within this array everything is named by macros, which start with
+the prefix
+.Sy EI_
+and may contain values which start with the prefix
+.Sy ELF .
+The following macros are defined:
+.Pp
+.Bl -tag -width "EI_ABIVERSION" -compact
+.It Dv EI_MAG0
+The first byte of the magic number.
+It must be filled with
+.Sy ELFMAG0 .
+.It Dv EI_MAG1
+The second byte of the magic number.
+It must be filled with
+.Sy ELFMAG1 .
+.It Dv EI_MAG2
+The third byte of the magic number.
+It must be filled with
+.Sy ELFMAG2 .
+.It Dv EI_MAG3
+The fourth byte of the magic number.
+It must be filled with
+.Sy ELFMAG3 .
+.It Dv EI_CLASS
+The fifth byte identifies the architecture for this binary:
+.Pp
+.Bl -tag -width "ELFCLASSNONE" -compact
+.It Dv ELFCLASSNONE
+This class is invalid.
+.It Dv ELFCLASS32
+This defines the 32-bit architecture.
+It supports machines with files
+and virtual address spaces up to 4 Gigabytes.
+.It Dv ELFCLASS64
+This defines the 64-bit architecture.
+.El
+.It Dv EI_DATA
+The sixth byte specifies the data encoding of the processor-specific
+data in the file.
+Currently these encodings are supported:
+.Pp
+.Bl -tag -width "ELFDATA2LSB" -compact
+.It Dv ELFDATANONE
+Unknown data format.
+.It Dv ELFDATA2LSB
+Two's complement, little-endian.
+.It Dv ELFDATA2MSB
+Two's complement, big-endian.
+.El
+.It Dv EI_VERSION
+The version number of the ELF specification:
+.Pp
+.Bl -tag -width "EV_CURRENT" -compact
+.It Dv EV_NONE
+Invalid version.
+.It Dv EV_CURRENT
+Current version.
+.El
+.It Dv EI_OSABI
+This byte identifies the operating system
+and ABI to which the object is targeted.
+Some fields in other ELF structures have flags
+and values that have platform specific meanings;
+the interpretation of those fields is determined by the value of this byte.
+The following values are currently defined:
+.Pp
+.Bl -tag -width "ELFOSABI_STANDALONE" -compact
+.It Dv ELFOSABI_SYSV
+UNIX System V ABI.
+.It Dv ELFOSABI_HPUX
+HP-UX operating system ABI.
+.It Dv ELFOSABI_NETBSD
+.Nx
+operating system ABI.
+.It Dv ELFOSABI_LINUX
+GNU/Linux operating system ABI.
+.It Dv ELFOSABI_HURD
+GNU/Hurd operating system ABI.
+.It Dv ELFOSABI_86OPEN
+86Open Common IA32 ABI.
+.It Dv ELFOSABI_SOLARIS
+Solaris operating system ABI.
+.It Dv ELFOSABI_MONTEREY
+Monterey project ABI.
+.It Dv ELFOSABI_IRIX
+IRIX operating system ABI.
+.It Dv ELFOSABI_FREEBSD
+.Fx
+operating system ABI.
+.It Dv ELFOSABI_TRU64
+TRU64 UNIX operating system ABI.
+.It Dv ELFOSABI_ARM
+ARM architecture ABI.
+.It Dv ELFOSABI_STANDALONE
+Standalone (embedded) ABI.
+.El
+.It Dv EI_ABIVERSION
+This byte identifies the version of the ABI
+to which the object is targeted.
+This field is used to distinguish among incompatible versions of an ABI.
+The interpretation of this version number
+is dependent on the ABI identified by the EI_OSABI field.
+Applications conforming to this specification use the value 0.
+.It Dv EI_PAD
+Start of padding.
+These bytes are reserved and set to zero.
+Programs
+which read them should ignore them.
+The value for EI_PAD will change in
+the future if currently unused bytes are given meanings.
+.It Dv EI_BRAND
+Start of architecture identification.
+.It Dv EI_NIDENT
+The size of the e_ident array.
+.El
+.Pp
+.It Dv e_type
+This member of the structure identifies the object file type:
+.Pp
+.Bl -tag -width "ET_NONE" -compact
+.It Dv ET_NONE
+An unknown type.
+.It Dv ET_REL
+A relocatable file.
+.It Dv ET_EXEC
+An executable file.
+.It Dv ET_DYN
+A shared object.
+.It Dv ET_CORE
+A core file.
+.El
+.Pp
+.It Dv e_machine
+This member specifies the required architecture for an individual file:
+.Pp
+.Bl -tag -width "EM_MIPS_RS4_BE" -compact
+.It Dv EM_NONE
+An unknown machine.
+.It Dv EM_M32
+AT&T WE 32100.
+.It Dv EM_SPARC
+Sun Microsystems SPARC.
+.It Dv EM_386
+Intel 80386.
+.It Dv EM_68K
+Motorola 68000.
+.It Dv EM_88K
+Motorola 88000.
+.It Dv EM_486
+Intel 80486.
+.It Dv EM_860
+Intel 80860.
+.It Dv EM_MIPS
+MIPS RS3000 (big-endian only).
+.It Dv EM_MIPS_RS4_BE
+MIPS RS4000 (big-endian only).
+.It Dv EM_SPARC64
+SPARC v9 64-bit unofficial.
+.It Dv EM_PARISC
+HPPA.
+.It Dv EM_PPC
+PowerPC.
+.It Dv EM_ALPHA
+Compaq [DEC] Alpha.
+.El
+.Pp
+.It Dv e_version
+This member identifies the file version:
+.Pp
+.Bl -tag -width "EV_CURRENT" -compact
+.It Dv EV_NONE
+Invalid version
+.It Dv EV_CURRENT
+Current version
+.El
+.It Dv e_entry
+This member gives the virtual address to which the system first transfers
+control, thus starting the process.
+If the file has no associated entry
+point, this member holds zero.
+.It Dv e_phoff
+This member holds the program header table's file offset in bytes.
+If
+the file has no program header table, this member holds zero.
+.It Dv e_shoff
+This member holds the section header table's file offset in bytes.
+If the
+file has no section header table this member holds zero.
+.It Dv e_flags
+This member holds processor-specific flags associated with the file.
+Flag
+names take the form EF_`machine_flag'.
+Currently no flags have been defined.
+.It Dv e_ehsize
+This member holds the ELF header's size in bytes.
+.It Dv e_phentsize
+This member holds the size in bytes of one entry in the file's program header
+table; all entries are the same size.
+.It Dv e_phnum
+This member holds the number of entries in the program header
+table.
+If the file is using extended program header numbering, then the
+.Sy e_phnum
+member will contain the value
+.Dv PN_XNUM
+and the actual number of program header table entries will be stored
+in the
+.Sy sh_info
+member of the section header at index
+.Dv SHN_UNDEF .
+The product of
+.Sy e_phentsize
+and the number of program header table entries gives the program
+header table's size in bytes.
+If a file has no program header,
+.Sy e_phnum
+holds the value zero.
+.It Dv e_shentsize
+This member holds a sections header's size in bytes.
+A section header is one
+entry in the section header table; all entries are the same size.
+.It Dv e_shnum
+This member holds the number of entries in the section header table.
+If the file is using extended section numbering, then the
+.Sy e_shnum
+member will be zero and the actual section number will be stored in the
+.Sy sh_size
+member of the section header at index
+.Dv SHN_UNDEF .
+If a file has no section header table, both the
+.Sy e_shnum
+and the
+.Sy e_shoff
+fields of the ELF header will be zero.
+The product of
+.Sy e_shentsize
+and the number of sections in the file gives the section header
+table's size in bytes.
+.It Dv e_shstrndx
+This member holds the section header table index of the entry associated
+with the section name string table.
+If extended section numbering is being used, this field will hold the
+value
+.Sy SHN_XINDEX ,
+and the actual section header table index will be present in the
+.Sy sh_link
+field of the section header entry at index
+.Dv SHN_UNDEF .
+If the file has no section name string
+table, this member holds the value
+.Sy SHN_UNDEF .
+.El
+.Pp
+An executable or shared object file's program header table is an array of
+structures, each describing a segment or other information the system needs
+to prepare the program for execution.
+An object file
+.Em segment
+contains one or more
+.Em sections .
+Program headers are meaningful only for executable and shared object files.
+A file specifies its own program header size with the ELF header's
+.Sy e_phentsize
+and
+.Sy e_phnum
+members.
+As with the Elf executable header, the program header
+also has different versions depending on the architecture:
+.Bd -literal -offset indent
+typedef struct {
+ Elf32_Word p_type;
+ Elf32_Off p_offset;
+ Elf32_Addr p_vaddr;
+ Elf32_Addr p_paddr;
+ Elf32_Word p_filesz;
+ Elf32_Word p_memsz;
+ Elf32_Word p_flags;
+ Elf32_Word p_align;
+} Elf32_Phdr;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ Elf64_Word p_type;
+ Elf64_Word p_flags;
+ Elf64_Off p_offset;
+ Elf64_Addr p_vaddr;
+ Elf64_Addr p_paddr;
+ Elf64_Xword p_filesz;
+ Elf64_Xword p_memsz;
+ Elf64_Xword p_align;
+} Elf64_Phdr;
+.Ed
+.Pp
+The main difference between the 32-bit and the 64-bit program header lies
+only in the location of a
+.Sy p_flags
+member in the total struct.
+.Pp
+.Bl -tag -width "p_offset" -compact -offset indent
+.It Dv p_type
+This member of the Phdr struct tells what kind of segment this array
+element describes or how to interpret the array element's information.
+.Pp
+.Bl -tag -width "PT_DYNAMIC" -compact
+.It Dv PT_NULL
+The array element is unused and the other members' values are undefined.
+This lets the program header have ignored entries.
+.It Dv PT_LOAD
+The array element specifies a loadable segment, described by
+.Sy p_filesz
+and
+.Sy p_memsz .
+The bytes from the file are mapped to the beginning of the memory
+segment.
+If the segment's memory size
+.Pq Sy p_memsz
+is larger than the file size
+.Pq Sy p_filesz ,
+the
+.Dq extra
+bytes are defined to hold the value 0 and to follow the segment's
+initialized area.
+The file size may not be larger than the memory size.
+Loadable segment entries in the program header table appear in ascending
+order, sorted on the
+.Sy p_vaddr
+member.
+.It Dv PT_DYNAMIC
+The array element specifies dynamic linking information.
+.It Dv PT_INTERP
+The array element specifies the location and size of a null-terminated
+path name to invoke as an interpreter.
+This segment type is meaningful
+only for executable files (though it may occur for shared objects).
+However
+it may not occur more than once in a file.
+If it is present it must precede
+any loadable segment entry.
+.It Dv PT_NOTE
+The array element specifies the location and size for auxiliary information.
+.It Dv PT_SHLIB
+This segment type is reserved but has unspecified semantics.
+Programs that
+contain an array element of this type do not conform to the ABI.
+.It Dv PT_PHDR
+The array element, if present, specifies the location and size of the program
+header table itself, both in the file and in the memory image of the program.
+This segment type may not occur more than once in a file.
+Moreover, it may
+only occur if the program header table is part of the memory image of the
+program.
+If it is present it must precede any loadable segment entry.
+.It Dv PT_LOPROC
+This value up to and including
+.Sy PT_HIPROC
+are reserved for processor-specific semantics.
+.It Dv PT_HIPROC
+This value down to and including
+.Sy PT_LOPROC
+are reserved for processor-specific semantics.
+.El
+.Pp
+.It Dv p_offset
+This member holds the offset from the beginning of the file at which
+the first byte of the segment resides.
+.It Dv p_vaddr
+This member holds the virtual address at which the first byte of the
+segment resides in memory.
+.It Dv p_paddr
+On systems for which physical addressing is relevant, this member is
+reserved for the segment's physical address.
+Under
+.Bx
+this member is
+not used and must be zero.
+.It Dv p_filesz
+This member holds the number of bytes in the file image of the segment.
+It may be zero.
+.It Dv p_memsz
+This member holds the number of bytes in the memory image of the segment.
+It may be zero.
+.It Dv p_flags
+This member holds flags relevant to the segment:
+.Pp
+.Bl -tag -width "PF_X" -compact
+.It Dv PF_X
+An executable segment.
+.It Dv PF_W
+A writable segment.
+.It Dv PF_R
+A readable segment.
+.El
+.Pp
+A text segment commonly has the flags
+.Sy PF_X
+and
+.Sy PF_R .
+A data segment commonly has
+.Sy PF_X ,
+.Sy PF_W
+and
+.Sy PF_R .
+.It Dv p_align
+This member holds the value to which the segments are aligned in memory
+and in the file.
+Loadable process segments must have congruent values for
+.Sy p_vaddr
+and
+.Sy p_offset ,
+modulo the page size.
+Values of zero and one mean no alignment is required.
+Otherwise,
+.Sy p_align
+should be a positive, integral power of two, and
+.Sy p_vaddr
+should equal
+.Sy p_offset ,
+modulo
+.Sy p_align .
+.El
+.Pp
+An file's section header table lets one locate all the file's sections.
+The
+section header table is an array of Elf32_Shdr or Elf64_Shdr structures.
+The
+ELF header's
+.Sy e_shoff
+member gives the byte offset from the beginning of the file to the section
+header table.
+.Sy e_shnum
+holds the number of entries the section header table contains.
+.Sy e_shentsize
+holds the size in bytes of each entry.
+.Pp
+A section header table index is a subscript into this array.
+Some section
+header table indices are reserved.
+An object file does not have sections for
+these special indices:
+.Pp
+.Bl -tag -width "SHN_LORESERVE" -compact
+.It Dv SHN_UNDEF
+This value marks an undefined, missing, irrelevant, or otherwise meaningless
+section reference.
+For example, a symbol
+.Dq defined
+relative to section number
+.Sy SHN_UNDEF
+is an undefined symbol.
+.It Dv SHN_LORESERVE
+This value specifies the lower bound of the range of reserved indices.
+.It Dv SHN_LOPROC
+This value up to and including
+.Sy SHN_HIPROC
+are reserved for processor-specific semantics.
+.It Dv SHN_HIPROC
+This value down to and including
+.Sy SHN_LOPROC
+are reserved for processor-specific semantics.
+.It Dv SHN_ABS
+This value specifies absolute values for the corresponding reference.
+For
+example, symbols defined relative to section number
+.Sy SHN_ABS
+have absolute values and are not affected by relocation.
+.It Dv SHN_COMMON
+Symbols defined relative to this section are common symbols, such as FORTRAN
+COMMON or unallocated C external variables.
+.It Dv SHN_HIRESERVE
+This value specifies the upper bound of the range of reserved indices.
+The
+system reserves indices between
+.Sy SHN_LORESERVE
+and
+.Sy SHN_HIRESERVE ,
+inclusive.
+The section header table does not contain entries for the
+reserved indices.
+.El
+.Pp
+The section header has the following structure:
+.Bd -literal -offset indent
+typedef struct {
+ Elf32_Word sh_name;
+ Elf32_Word sh_type;
+ Elf32_Word sh_flags;
+ Elf32_Addr sh_addr;
+ Elf32_Off sh_offset;
+ Elf32_Word sh_size;
+ Elf32_Word sh_link;
+ Elf32_Word sh_info;
+ Elf32_Word sh_addralign;
+ Elf32_Word sh_entsize;
+} Elf32_Shdr;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+} Elf64_Shdr;
+.Ed
+.Pp
+.Bl -tag -width "sh_addralign" -compact
+.It Dv sh_name
+This member specifies the name of the section.
+Its value is an index
+into the section header string table section, giving the location of
+a null-terminated string.
+.It Dv sh_type
+This member categorizes the section's contents and semantics.
+.Pp
+.Bl -tag -width "SHT_PROGBITS" -compact
+.It Dv SHT_NULL
+This value marks the section header as inactive.
+It does not
+have an associated section.
+Other members of the section header
+have undefined values.
+.It Dv SHT_PROGBITS
+The section holds information defined by the program, whose
+format and meaning are determined solely by the program.
+.It Dv SHT_SYMTAB
+This section holds a symbol table.
+Typically,
+.Sy SHT_SYMTAB
+provides symbols for link editing, though it may also be used
+for dynamic linking.
+As a complete symbol table, it may contain
+many symbols unnecessary for dynamic linking.
+An object file can
+also contain a
+.Sy SHN_DYNSYM
+section.
+.It Dv SHT_STRTAB
+This section holds a string table.
+An object file may have multiple
+string table sections.
+.It Dv SHT_RELA
+This section holds relocation entries with explicit addends, such
+as type
+.Sy Elf32_Rela
+for the 32-bit class of object files.
+An object may have multiple
+relocation sections.
+.It Dv SHT_HASH
+This section holds a symbol hash table.
+All object participating in
+dynamic linking must contain a symbol hash table.
+An object file may
+have only one hash table.
+.It Dv SHT_DYNAMIC
+This section holds information for dynamic linking.
+An object file may
+have only one dynamic section.
+.It Dv SHT_NOTE
+This section holds information that marks the file in some way.
+.It Dv SHT_NOBITS
+A section of this type occupies no space in the file but otherwise
+resembles
+.Sy SHN_PROGBITS .
+Although this section contains no bytes, the
+.Sy sh_offset
+member contains the conceptual file offset.
+.It Dv SHT_REL
+This section holds relocation offsets without explicit addends, such
+as type
+.Sy Elf32_Rel
+for the 32-bit class of object files.
+An object file may have multiple
+relocation sections.
+.It Dv SHT_SHLIB
+This section is reserved but has unspecified semantics.
+.It Dv SHT_DYNSYM
+This section holds a minimal set of dynamic linking symbols.
+An
+object file can also contain a
+.Sy SHN_SYMTAB
+section.
+.It Dv SHT_LOPROC
+This value up to and including
+.Sy SHT_HIPROC
+are reserved for processor-specific semantics.
+.It Dv SHT_HIPROC
+This value down to and including
+.Sy SHT_LOPROC
+are reserved for processor-specific semantics.
+.It Dv SHT_LOUSER
+This value specifies the lower bound of the range of indices reserved for
+application programs.
+.It Dv SHT_HIUSER
+This value specifies the upper bound of the range of indices reserved for
+application programs.
+Section types between
+.Sy SHT_LOUSER
+and
+.Sy SHT_HIUSER
+may be used by the application, without conflicting with current or future
+system-defined section types.
+.El
+.Pp
+.It Dv sh_flags
+Sections support one-bit flags that describe miscellaneous attributes.
+If a flag bit is set in
+.Sy sh_flags ,
+the attribute is
+.Dq on
+for the section.
+Otherwise, the attribute is
+.Dq off
+or does not apply.
+Undefined attributes are set to zero.
+.Pp
+.Bl -tag -width "SHF_EXECINSTR" -compact
+.It Dv SHF_WRITE
+This section contains data that should be writable during process
+execution.
+.It Dv SHF_ALLOC
+The section occupies memory during process execution.
+Some control
+sections do not reside in the memory image of an object file.
+This
+attribute is off for those sections.
+.It Dv SHF_EXECINSTR
+The section contains executable machine instructions.
+.It Dv SHF_MASKPROC
+All bits included in this mask are reserved for processor-specific
+semantics.
+.El
+.Pp
+.It Dv sh_addr
+If the section will appear in the memory image of a process, this member
+holds the address at which the section's first byte should reside.
+Otherwise, the member contains zero.
+.It Dv sh_offset
+This member's value holds the byte offset from the beginning of the file
+to the first byte in the section.
+One section type,
+.Sy SHT_NOBITS ,
+occupies no space in the file, and its
+.Sy sh_offset
+member locates the conceptual placement in the file.
+.It Dv sh_size
+This member holds the section's size in bytes.
+Unless the section type
+is
+.Sy SHT_NOBITS ,
+the section occupies
+.Sy sh_size
+bytes in the file.
+A section of type
+.Sy SHT_NOBITS
+may have a non-zero size, but it occupies no space in the file.
+.It Dv sh_link
+This member holds a section header table index link, whose interpretation
+depends on the section type.
+.It Dv sh_info
+This member holds extra information, whose interpretation depends on the
+section type.
+.It Dv sh_addralign
+Some sections have address alignment constraints.
+If a section holds a
+doubleword, the system must ensure doubleword alignment for the entire
+section.
+That is, the value of
+.Sy sh_addr
+must be congruent to zero, modulo the value of
+.Sy sh_addralign .
+Only zero and positive integral powers of two are allowed.
+Values of zero
+or one mean the section has no alignment constraints.
+.It Dv sh_entsize
+Some sections hold a table of fixed-sized entries, such as a symbol table.
+For such a section, this member gives the size in bytes for each entry.
+This member contains zero if the section does not hold a table of
+fixed-size entries.
+.El
+.Pp
+Various sections hold program and control information:
+.Bl -tag -width ".shstrtab" -compact
+.It .bss
+(Block Started by Symbol)
+This section holds uninitialized data that contributes to the program's
+memory image.
+By definition, the system initializes the data with zeros
+when the program begins to run.
+This section is of type
+.Sy SHT_NOBITS .
+The attributes types are
+.Sy SHF_ALLOC
+and
+.Sy SHF_WRITE .
+.It .comment
+This section holds version control information.
+This section is of type
+.Sy SHT_PROGBITS .
+No attribute types are used.
+.It .data
+This section holds initialized data that contribute to the program's
+memory image.
+This section is of type
+.Sy SHT_PROGBITS .
+The attribute types are
+.Sy SHF_ALLOC
+and
+.Sy SHF_WRITE .
+.It .data1
+This section holds initialized data that contribute to the program's
+memory image.
+This section is of type
+.Sy SHT_PROGBITS .
+The attribute types are
+.Sy SHF_ALLOC
+and
+.Sy SHF_WRITE .
+.It .debug
+This section holds information for symbolic debugging.
+The contents
+are unspecified.
+This section is of type
+.Sy SHT_PROGBITS .
+No attribute types are used.
+.It .dynamic
+This section holds dynamic linking information.
+The section's attributes
+will include the
+.Sy SHF_ALLOC
+bit.
+Whether the
+.Sy SHF_WRITE
+bit is set is processor-specific.
+This section is of type
+.Sy SHT_DYNAMIC .
+See the attributes above.
+.It .dynstr
+This section holds strings needed for dynamic linking, most commonly
+the strings that represent the names associated with symbol table entries.
+This section is of type
+.Sy SHT_STRTAB .
+The attribute type used is
+.Sy SHF_ALLOC .
+.It .dynsym
+This section holds the dynamic linking symbol table.
+This section is of type
+.Sy SHT_DYNSYM .
+The attribute used is
+.Sy SHF_ALLOC .
+.It .fini
+This section holds executable instructions that contribute to the process
+termination code.
+When a program exits normally the system arranges to
+execute the code in this section.
+This section is of type
+.Sy SHT_PROGBITS .
+The attributes used are
+.Sy SHF_ALLOC
+and
+.Sy SHF_EXECINSTR .
+.It .got
+This section holds the global offset table.
+This section is of type
+.Sy SHT_PROGBITS .
+The attributes are processor-specific.
+.It .hash
+This section holds a symbol hash table.
+This section is of type
+.Sy SHT_HASH .
+The attribute used is
+.Sy SHF_ALLOC .
+.It .init
+This section holds executable instructions that contribute to the process
+initialization code.
+When a program starts to run the system arranges to
+execute the code in this section before calling the main program entry point.
+This section is of type
+.Sy SHT_PROGBITS .
+The attributes used are
+.Sy SHF_ALLOC
+and
+.Sy SHF_EXECINSTR .
+.It .interp
+This section holds the pathname of a program interpreter.
+If the file has
+a loadable segment that includes the section, the section's attributes will
+include the
+.Sy SHF_ALLOC
+bit.
+Otherwise, that bit will be off.
+This section is of type
+.Sy SHT_PROGBITS .
+.It .line
+This section holds line number information for symbolic debugging, which
+describes the correspondence between the program source and the machine code.
+The contents are unspecified.
+This section is of type
+.Sy SHT_PROGBITS .
+No attribute types are used.
+.It .note
+This section holds information in the
+.Dq Note Section
+format described below.
+This section is of type
+.Sy SHT_NOTE .
+No attribute types are used.
+.It .plt
+This section holds the procedure linkage table.
+This section is of type
+.Sy SHT_PROGBITS .
+The attributes are processor-specific.
+.It .relNAME
+This section holds relocation information as described below.
+If the file
+has a loadable segment that includes relocation, the section's attributes
+will include the
+.Sy SHF_ALLOC
+bit.
+Otherwise the bit will be off.
+By convention,
+.Dq NAME
+is supplied by the section to which the relocations apply.
+Thus a relocation
+section for
+.Sy .text
+normally would have the name
+.Sy .rel.text .
+This section is of type
+.Sy SHT_REL .
+.It .relaNAME
+This section holds relocation information as described below.
+If the file
+has a loadable segment that includes relocation, the section's attributes
+will include the
+.Sy SHF_ALLOC
+bit.
+Otherwise the bit will be off.
+By convention,
+.Dq NAME
+is supplied by the section to which the relocations apply.
+Thus a relocation
+section for
+.Sy .text
+normally would have the name
+.Sy .rela.text .
+This section is of type
+.Sy SHT_RELA .
+.It .rodata
+This section holds read-only data that typically contributes to a
+non-writable segment in the process image.
+This section is of type
+.Sy SHT_PROGBITS .
+The attribute used is
+.Sy SHF_ALLOC .
+.It .rodata1
+This section hold read-only data that typically contributes to a
+non-writable segment in the process image.
+This section is of type
+.Sy SHT_PROGBITS .
+The attribute used is
+.Sy SHF_ALLOC .
+.It .shstrtab
+This section holds section names.
+This section is of type
+.Sy SHT_STRTAB .
+No attribute types are used.
+.It .strtab
+This section holds strings, most commonly the strings that represent the
+names associated with symbol table entries.
+If the file has a loadable
+segment that includes the symbol string table, the section's attributes
+will include the
+.Sy SHF_ALLOC
+bit.
+Otherwise the bit will be off.
+This section is of type
+.Sy SHT_STRTAB .
+.It .symtab
+This section holds a symbol table.
+If the file has a loadable segment
+that includes the symbol table, the section's attributes will include
+the
+.Sy SHF_ALLOC
+bit.
+Otherwise the bit will be off.
+This section is of type
+.Sy SHT_SYMTAB .
+.It .text
+This section holds the
+.Dq text ,
+or executable instructions, of a program.
+This section is of type
+.Sy SHT_PROGBITS .
+The attributes used are
+.Sy SHF_ALLOC
+and
+.Sy SHF_EXECINSTR .
+.It .jcr
+This section holds information about Java classes that must
+be registered.
+.It .eh_frame
+This section holds information used for C++ exception-handling.
+.El
+.Pp
+String table sections hold null-terminated character sequences, commonly
+called strings.
+The object file uses these strings to represent symbol
+and section names.
+One references a string as an index into the string
+table section.
+The first byte, which is index zero, is defined to hold
+a null character.
+Similarly, a string table's last byte is defined to
+hold a null character, ensuring null termination for all strings.
+.Pp
+An object file's symbol table holds information needed to locate and
+relocate a program's symbolic definitions and references.
+A symbol table
+index is a subscript into this array.
+.Bd -literal -offset indent
+typedef struct {
+ Elf32_Word st_name;
+ Elf32_Addr st_value;
+ Elf32_Word st_size;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf32_Half st_shndx;
+} Elf32_Sym;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ Elf64_Word st_name;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf64_Half st_shndx;
+ Elf64_Addr st_value;
+ Elf64_Xword st_size;
+} Elf64_Sym;
+.Ed
+.Pp
+.Bl -tag -width "st_value" -compact
+.It Dv st_name
+This member holds an index into the object file's symbol string table,
+which holds character representations of the symbol names.
+If the value
+is non-zero, it represents a string table index that gives the symbol
+name.
+Otherwise, the symbol table has no name.
+.It Dv st_value
+This member gives the value of the associated symbol.
+.It Dv st_size
+Many symbols have associated sizes.
+This member holds zero if the symbol
+has no size or an unknown size.
+.It Dv st_info
+This member specifies the symbol's type and binding attributes:
+.Pp
+.Bl -tag -width "STT_SECTION" -compact
+.It Dv STT_NOTYPE
+The symbol's type is not defined.
+.It Dv STT_OBJECT
+The symbol is associated with a data object.
+.It Dv STT_FUNC
+The symbol is associated with a function or other executable code.
+.It Dv STT_SECTION
+The symbol is associated with a section.
+Symbol table entries of
+this type exist primarily for relocation and normally have
+.Sy STB_LOCAL
+bindings.
+.It Dv STT_FILE
+By convention the symbol's name gives the name of the source file
+associated with the object file.
+A file symbol has
+.Sy STB_LOCAL
+bindings, its section index is
+.Sy SHN_ABS ,
+and it precedes the other
+.Sy STB_LOCAL
+symbols of the file, if it is present.
+.It Dv STT_LOPROC
+This value up to and including
+.Sy STT_HIPROC
+are reserved for processor-specific semantics.
+.It Dv STT_HIPROC
+This value down to and including
+.Sy STT_LOPROC
+are reserved for processor-specific semantics.
+.El
+.Pp
+.Bl -tag -width "STB_GLOBAL" -compact
+.It Dv STB_LOCAL
+Local symbols are not visible outside the object file containing their
+definition.
+Local symbols of the same name may exist in multiple file
+without interfering with each other.
+.It Dv STB_GLOBAL
+Global symbols are visible to all object files being combined.
+One file's
+definition of a global symbol will satisfy another file's undefined
+reference to the same symbol.
+.It Dv STB_WEAK
+Weak symbols resemble global symbols, but their definitions have lower
+precedence.
+.It Dv STB_LOPROC
+This value up to and including
+.Sy STB_HIPROC
+are reserved for processor-specific semantics.
+.It Dv STB_HIPROC
+This value down to and including
+.Sy STB_LOPROC
+are reserved for processor-specific semantics.
+.Pp
+There are macros for packing and unpacking the binding and type fields:
+.Pp
+.Bl -tag -width "ELF32_ST_INFO(bind, type)" -compact
+.It Xo
+.Fn ELF32_ST_BIND info
+.Xc
+or
+.Fn ELF64_ST_BIND info
+extract a binding from an st_info value.
+.It Xo
+.Fn ELF64_ST_TYPE info
+.Xc
+or
+.Fn ELF32_ST_TYPE info
+extract a type from an st_info value.
+.It Xo
+.Fn ELF32_ST_INFO bind type
+.Xc
+or
+.Fn ELF64_ST_INFO bind type
+convert a binding and a type into an st_info value.
+.El
+.El
+.Pp
+.It Dv st_other
+This member currently holds zero and has no defined meaning.
+.It Dv st_shndx
+Every symbol table entry is
+.Dq defined
+in relation to some section.
+This member holds the relevant section
+header table index.
+.El
+.Pp
+Relocation is the process of connecting symbolic references with
+symbolic definitions.
+Relocatable files must have information that
+describes how to modify their section contents, thus allowing executable
+and shared object files to hold the right information for a process'
+program image.
+Relocation entries are these data.
+.Pp
+Relocation structures that do not need an addend:
+.Bd -literal -offset indent
+typedef struct {
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+} Elf32_Rel;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ Elf64_Addr r_offset;
+ Elf64_Xword r_info;
+} Elf64_Rel;
+.Ed
+.Pp
+Relocation structures that need an addend:
+.Bd -literal -offset indent
+typedef struct {
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+ Elf32_Sword r_addend;
+} Elf32_Rela;
+.Ed
+.Bd -literal -offset indent
+typedef struct {
+ Elf64_Addr r_offset;
+ Elf64_Xword r_info;
+ Elf64_Sxword r_addend;
+} Elf64_Rela;
+.Ed
+.Pp
+.Bl -tag -width "r_offset" -compact
+.It Dv r_offset
+This member gives the location at which to apply the relocation action.
+For a relocatable file, the value is the byte offset from the beginning
+of the section to the storage unit affected by the relocation.
+For an
+executable file or shared object, the value is the virtual address of
+the storage unit affected by the relocation.
+.It Dv r_info
+This member gives both the symbol table index with respect to which the
+relocation must be made and the type of relocation to apply.
+Relocation
+types are processor-specific.
+When the text refers to a relocation
+entry's relocation type or symbol table index, it means the result of
+applying
+.Sy ELF_[32|64]_R_TYPE
+or
+.Sy ELF[32|64]_R_SYM ,
+respectively to the entry's
+.Sy r_info
+member.
+.It Dv r_addend
+This member specifies a constant addend used to compute the value to be
+stored into the relocatable field.
+.El
+.Sh SEE ALSO
+.Xr as 1 ,
+.Xr gdb 1 ,
+.Xr ld 1 ,
+.Xr objdump 1 ,
+.Xr execve 2 ,
+.Xr ar 5 ,
+.Xr core 5
+.Rs
+.%A Hewlett Packard
+.%B Elf-64 Object File Format
+.Re
+.Rs
+.%A Santa Cruz Operation
+.%B System V Application Binary Interface
+.Re
+.Rs
+.%A Unix System Laboratories
+.%T Object Files
+.%B "Executable and Linking Format (ELF)"
+.Re
+.Sh HISTORY
+The ELF header files made their appearance in
+.Fx 2.2.6 .
+ELF in itself first appeared in
+.At V .
+The ELF format is an adopted standard.
+.Sh AUTHORS
+This manual page was written by
+.An Jeroen Ruigrok van der Werven
+.Aq asmodai@FreeBSD.org
+with inspiration from BSDi's
+.Bsx
+.Xr elf 5
+manpage.
diff --git a/share/man/man5/ethers.5 b/share/man/man5/ethers.5
new file mode 100644
index 000000000000..e10bf3009e3b
--- /dev/null
+++ b/share/man/man5/ethers.5
@@ -0,0 +1,102 @@
+.\" Copyright (c) 1995
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 12, 1995
+.Dt ETHERS 5
+.Os
+.Sh NAME
+.Nm ethers
+.Nd ethernet address database
+.Sh DESCRIPTION
+The
+.Nm
+database contains information regarding known 48-bit ethernet addresses
+of hosts on an Internetwork.
+The data is stored in a file called
+.Pa /etc/ethers
+in the following format:
+.Pp
+.D1 Ar ethernet-address fully-qualified-host-name
+.Pp
+Items are separated by any number of blanks and/or
+tab characters.
+A ``#'' at the start of a line indicates the
+beginning of a comment that extends to the end of the line.
+A ``+'' at
+the start of a line will cause the
+.Xr ethers 3
+library functions to use data stored in the
+.Tn NIS
+.Pa ethers.byname
+and
+.Pa ethers.byaddr
+maps in addition to the data in the
+.Pa /etc/ethers
+file.
+.Pp
+An ethernet address is expressed in
+.Tn ASCII
+form as "x:x:x:x:x:x" where
+.Ar x
+is a hexadecimal value between 0x00 and 0xFF.
+The address values
+should be in network order.
+Hostnames specified in the
+.Pa /etc/ethers
+database should correspond to entries in the
+.Xr hosts 5
+file.
+.Pp
+The
+.Fn ether_line
+function in the standard C library can be used to break individual
+lines in the
+.Pa /etc/ethers
+database into their individual components: a binary Ethernet address
+stored as an
+.Pa ether_addr
+structure, and a hostname stored as a character string.
+.Sh FILES
+.Bl -tag -width /etc/services -compact
+.It Pa /etc/ethers
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr ethers 3 ,
+.Xr yp 8
+.Sh HISTORY
+The
+.Nm
+format is based on the format used in SunOS 4.1.x.
diff --git a/share/man/man5/eui64.5 b/share/man/man5/eui64.5
new file mode 100644
index 000000000000..4e2dda6159c7
--- /dev/null
+++ b/share/man/man5/eui64.5
@@ -0,0 +1,110 @@
+.\" Copyright (c) 1995
+.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 11, 2004
+.Dt EUI64 5
+.Os
+.Sh NAME
+.Nm eui64
+.Nd IEEE EUI-64 address database
+.Sh DESCRIPTION
+The
+.Nm
+database contains information regarding known IEEE EUI-64s of hosts.
+The data is stored in a file called
+.Pa /etc/eui64
+in the following format:
+.Bd -ragged -offset indent
+.Em EUI-64 host-name
+.Ed
+.Pp
+Items are separated by any number of blanks and/or
+tab characters.
+A
+.Ql #
+at the start of a line indicates the
+beginning of a comment that extends to the end of the line.
+Valid lines may also contain comments.
+A
+.Ql +
+at the start of a line will cause the
+.Xr eui64 3
+library functions to use data stored in the
+NIS
+.Pa eui64.byname
+and
+.Pa eui64.byid
+maps in addition to the data in the
+.Pa /etc/eui64
+file.
+.Pp
+An EUI-64 is expressed in
+.Tn ASCII
+form as
+.Qq x-x-x-x-x-x-x-x
+where
+.Ar x
+is a hexadecimal value between 0x00 and 0xFF.
+The address values
+should be in network order.
+Hostnames specified in the
+.Pa /etc/eui64
+database should correspond to entries in the
+.Xr hosts 5
+file.
+.\" .Pp
+.\" The
+.\" .Fn eui64_line
+.\" function in the standard C library can be used to break individual
+.\" lines in the
+.\" .Pa /etc/eui64
+.\" database into their individual components: a binary EUI-64 is
+.\" stored as an
+.\" .Pa eui64_addr
+.\" structure, and a hostname stored as a character string.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/eui64" -compact
+.It Pa /etc/eui64
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr eui64 3 ,
+.Xr yp 8
+.Sh HISTORY
+The
+.Nm
+format is based on the
+.Xr ethers 5
+format.
diff --git a/share/man/man5/ext2fs.5 b/share/man/man5/ext2fs.5
new file mode 100644
index 000000000000..a74e5997ac63
--- /dev/null
+++ b/share/man/man5/ext2fs.5
@@ -0,0 +1,83 @@
+.\"
+.\" Copyright (c) 2006 Craig Rodrigues
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 16, 2006
+.Dt EXT2FS 5
+.Os
+.Sh NAME
+.Nm ext2fs
+.Nd "Ext2fs file system"
+.Sh SYNOPSIS
+To link into the kernel:
+.Bd -ragged -offset indent
+.Cd "options EXT2FS"
+.Ed
+.Pp
+To load as a kernel loadable module:
+.Pp
+.Dl "kldload ext2fs"
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to access
+.Tn Ext2
+file systems.
+.Sh EXAMPLES
+To mount a
+.Nm
+volume located on
+.Pa /dev/ad1s1 :
+.Pp
+.Dl "mount -t ext2fs /dev/ad1s1 /mnt"
+.Sh SEE ALSO
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5 ,
+.Xr mount 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+kernel implementation was written by
+.An Godmar Back
+or modified by him using the CSRG sources.
+.Pp
+.An John Dyson
+and others in the
+.Fx
+Project made modifications.
+.Pp
+This manual page was written by
+.An Craig Rodrigues Aq rodrigc@FreeBSD.org .
diff --git a/share/man/man5/fbtab.5 b/share/man/man5/fbtab.5
new file mode 100644
index 000000000000..0598fd119903
--- /dev/null
+++ b/share/man/man5/fbtab.5
@@ -0,0 +1,47 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 22, 1994
+.Dt FBTAB 5
+.Os
+.Sh NAME
+.Nm fbtab
+.Nd change device protection upon login
+.Sh DESCRIPTION
+The
+.Nm
+file contains a number of lines specifying a device together with a list
+of devices with associated protections.
+Comments start with a
+.Ql #
+and extend to the end of the line.
+.Pp
+Blank lines or lines with only a comment are ignored.
+.Pp
+All other lines consist of three fields delimited by
+whitespace: a login device
+.Pq Pa /dev/ttyv0 ,
+an octal permission number (0600), and a colon
+.Pq Ql \&:
+delimited list of device patterns
+.Pq Pa /dev/console , /dev/dsp* .
+All device patterns are absolute paths.
+.Pp
+If the tty argument (relative path) matches a login device
+name (absolute path), the permissions of the devices in the
+colon-delimited list are set as specified in the second
+field, and their ownership is changed to that of the UID
+and GID arguments.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/fbtab" -compact
+.It Pa /etc/fbtab
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr login 1 ,
+.Xr getty 8
+.Sh AUTHORS
+.An Guido van Rooij
diff --git a/share/man/man5/fdescfs.5 b/share/man/man5/fdescfs.5
new file mode 100644
index 000000000000..9c615817d51a
--- /dev/null
+++ b/share/man/man5/fdescfs.5
@@ -0,0 +1,130 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Copyright (c) 1992, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software donated to Berkeley by
+.\" Jan-Simon Pendry.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2010
+.Dt FDESCFS 5
+.Os
+.Sh NAME
+.Nm fdescfs
+.Nd file-descriptor file system
+.Sh SYNOPSIS
+.Bd -literal
+fdescfs /dev/fd fdescfs rw 0 0
+.Ed
+.Sh DESCRIPTION
+The file-descriptor file system, or
+.Nm ,
+provides access to the per-process file descriptor
+namespace in the global file system namespace.
+The conventional mount point is
+.Pa /dev/fd .
+.Pp
+The file system's contents
+appear as a list of numbered files
+which correspond to the open files of the process reading the
+directory.
+The files
+.Pa /dev/fd/0
+through
+.Pa /dev/fd/#
+refer to file descriptors which can be accessed through the file
+system.
+If the file descriptor is open and the mode the file is being opened
+with is a subset of the mode of the existing descriptor, the call:
+.Bd -literal -offset indent
+fd = open("/dev/fd/0", mode);
+.Ed
+.Pp
+and the call:
+.Bd -literal -offset indent
+fd = fcntl(0, F_DUPFD, 0);
+.Ed
+.Pp
+are equivalent.
+.Pp
+Flags to the
+.Xr open 2
+call other than
+.Dv O_RDONLY ,
+.Dv O_WRONLY
+and
+.Dv O_RDWR
+are ignored.
+.Pp
+.Em "Note:"
+.Pa /dev/fd/0 ,
+.Pa /dev/fd/1
+and
+.Pa /dev/fd/2
+files are created by default when devfs alone is mounted.
+.Nm
+creates entries for all file descriptors opened by the process.
+.Sh FILES
+.Bl -tag -width /dev/stderr -compact
+.It Pa /dev/fd/#
+.El
+.Sh EXAMPLES
+To mount a
+.Nm
+volume located on
+.Pa /dev/fd :
+.Pp
+.Dl "mount -t fdescfs null /dev/fd"
+.Sh SEE ALSO
+.Xr devfs 5 ,
+.Xr mount 8
+.Sh HISTORY
+The
+.Nm
+file system first appeared in
+.Bx 4.4 .
+The
+.Nm
+manual page first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+manual page was written by
+.An Mike Pritchard Aq mpp@FreeBSD.org ,
+and was based on the
+manual page written by
+.An Jan-Simon Pendry .
diff --git a/share/man/man5/forward.5 b/share/man/man5/forward.5
new file mode 100644
index 000000000000..2234ff359091
--- /dev/null
+++ b/share/man/man5/forward.5
@@ -0,0 +1,97 @@
+.\" Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Mike Pritchard and
+.\" contributors.
+.\" 4. Neither the name of the author nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 2, 1996
+.Dt FORWARD 5
+.Os
+.Sh NAME
+.Nm forward
+.Nd mail forwarding instructions
+.Sh DESCRIPTION
+The
+.Nm .forward
+file contains a list of mail addresses or programs
+that the user's mail should be redirected to.
+If the
+file is not present, then no mail forwarding will be done.
+Mail may also be forwarded as the standard input to a program
+by prefixing the line
+with the normal shell pipe symbol (|).
+If arguments
+are to be passed to the command, then the entire line
+should be enclosed in quotes.
+For security reasons, the
+.Nm .forward
+file must be owned by the user the mail is being sent to,
+or by root, and the user's shell must be listed in
+.Pa /etc/shells .
+.Pp
+For example, if a
+.Nm .forward
+file contained the following lines:
+.Bd -literal -offset indent
+nobody@FreeBSD.org
+"|/usr/bin/vacation nobody"
+.Ed
+.Pp
+Mail would be forwarded to
+.Aq nobody@FreeBSD.org
+and to the program
+.Pa /usr/bin/vacation
+with the single argument
+.Ar nobody .
+.Pp
+If a local user address is prefixed with a backslash
+character, mail is delivered directly to the user's
+mail spool file, bypassing further redirection.
+.Pp
+For example, if user chris had a
+.Nm .forward
+file containing the following lines:
+.Bd -literal -offset indent
+chris@otherhost
+\echris
+.Ed
+.Pp
+One copy of mail would be forwarded to
+.Ar chris@otherhost
+and another copy would be retained as mail for local user chris.
+.Sh FILES
+.Bl -tag -width $HOME/.forward -compact
+.It Pa $HOME/.forward
+The user's forwarding instructions.
+.El
+.Sh SEE ALSO
+.Xr aliases 5 ,
+.Xr mailaddr 7 ,
+.Xr sendmail 8
diff --git a/share/man/man5/freebsd-update.conf.5 b/share/man/man5/freebsd-update.conf.5
new file mode 100644
index 000000000000..653b0559f201
--- /dev/null
+++ b/share/man/man5/freebsd-update.conf.5
@@ -0,0 +1,233 @@
+.\"-
+.\" Copyright 2006 Colin Percival
+.\" All rights reserved
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted providing that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 19, 2009
+.Dt FREEBSD-UPDATE.CONF 5
+.Os FreeBSD
+.Sh NAME
+.Nm freebsd-update.conf
+.Nd configuration file for
+.Xr freebsd-update 8
+.Sh DESCRIPTION
+The
+.Nm
+file controls the behaviour of the
+.Xr freebsd-update 8
+utility.
+The file contains lines consisting of a case-sensitive option name and
+zero or more parameters.
+Empty lines and any part of a line following a
+.Ql #
+character are ignored.
+Unless stated otherwise, specifying an option multiple times is an
+error.
+.Pp
+The possible options and their meanings are as follows:
+.Bl -tag -width ".Cm BackupKernelSymbolFiles"
+.It Cm KeyPrint
+The single parameter following this keyword is the SHA256 hash
+of the RSA key which will be trusted to sign updates.
+.It Cm ServerName
+The single parameter following this keyword is the name of the
+server or server pool from which updates will be downloaded.
+.It Cm Components
+The parameters following this keyword are the components or
+sub-components of
+.Fx
+which will be updated.
+The components are
+.Dq src
+(source code),
+.Dq world
+(non-kernel binaries), and
+.Dq kernel ;
+the sub-components are the individual distribution sets generated as
+part of the release process (e.g.,
+.Dq src/base ,
+.Dq src/sys ,
+.Dq world/base ,
+.Dq world/catpages ,
+.Dq kernel/smp ) .
+Note that prior to
+.Fx 6.1 ,
+the
+.Dq kernel
+component was distributed as part of
+.Dq world/base .
+.Pp
+This option can be specified multiple times, and the parameters
+accumulate.
+.It Cm IgnorePaths
+The parameters following this keyword are regular expressions;
+updates to paths which start with a string matching one of
+these regular expressions will be ignored.
+.Pp
+This option can be specified multiple times, and the parameters
+accumulate.
+.It Cm IDSIgnorePaths
+The parameters following this keyword are regular expressions;
+paths which start with a string matching one of these regular
+expressions will be ignored by "freebsd-update IDS".
+.Pp
+This option can be specified multiple times, and the parameters
+accumulate.
+.It Cm UpdateIfUnmodified
+The parameters following this keyword are regular expressions;
+updates to paths which start with a string matching one of
+these regular expressions will be ignored if the files have
+been modified locally (unless they are merged -- see MergeChanges
+below).
+.Pp
+This option can be specified multiple times, and the parameters
+accumulate.
+.It Cm MergeChanges
+The parameters following this keyword are regular expressions;
+updates to paths which start with a string matching one of
+these regular expressions will be merged with local modifications.
+.Pp
+This option can be specified multiple times, and the parameters
+accumulate.
+.It Cm WorkDir
+The single parameter following this keyword is the directory
+in which temporary files and downloaded updates will be stored.
+.It Cm MailTo
+The single parameter following this keyword is the address
+to which
+.Cm cron
+output will be mailed.
+.It Cm AllowAdd
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+is allowed to create new files, directories, and symlinks if
+these are part of updates downloaded.
+Note that
+.Cm freebsd-update
+will not re-add files which have been deleted from a
+.Fx
+installation unless those files were previously added as part
+of an update.
+.It Cm AllowDelete
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+is allowed to delete files, directories, and symlinks as
+part of updates downloaded.
+.It Cm KeepModifiedMetadata
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+should keep existing file ownership, permissions, and flags
+when installing updates if these have been modified locally.
+.It Cm StrictComponents
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+should interpret the list of components of
+.Fx
+specified via the
+.Cm Components
+option strictly as a list of components installed which
+should be upgraded when the
+.Cm upgrade
+command is used ("yes"), or merely as a list of components
+which might be installed, of which
+.Cm freebsd-update
+should identify which in fact are present ("no").
+.It Cm BackupKernel
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will create a backup of the old kernel before installing a new kernel.
+This backup kernel can be used to recover a system where the newly
+installed kernel somehow did not work.
+Note that the backup kernel is not reverted to its original state by
+the
+.Cm freebsd-update
+rollback command.
+.It Cm BackupKernelDir
+This keyword sets the directory which is used to store a backup
+kernel, if the BackupKernel feature is enabled.
+If the directory already exist, and it was not created by
+.Cm freebsd-update ,
+the directory is skipped.
+In the case of the primary directory name not being usable, a number
+starting with
+.Sq 1
+is appended to the directory name.
+Like with the primary directory name, the constructed directory name is
+only used if the path name does not exist, or if the directory was
+previously created by
+.Cm freebsd-update .
+If the constructed directory still exist the appended number is
+incremented with 1 and the directory search process restarted.
+Should the number increment go above 9,
+.Cm freebsd-update
+will abort.
+.It Cm BackupKernelSymbolFiles
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will also backup kernel symbol files, if they exist.
+The kernel symbol files takes up a lot of disk space and are not
+needed for recovery purposes.
+If the symbol files are needed, after recovering a system using the
+backup kernel, the
+.Cm freebsd-update
+rollback command will recreate the symbol files along with the old
+kernel.
+.El
+.Sh FILES
+.Bl -tag -width "/etc/freebsd-update.conf"
+.It /etc/freebsd-update.conf
+Default location of the
+.Cm freebsd-update
+configuration file.
+.El
+.Sh SEE ALSO
+.Xr sha256 1 ,
+.Xr freebsd-update 8
+.Sh AUTHORS
+.An Colin Percival Aq cperciva@FreeBSD.org
diff --git a/share/man/man5/fs.5 b/share/man/man5/fs.5
new file mode 100644
index 000000000000..5a5171c21f61
--- /dev/null
+++ b/share/man/man5/fs.5
@@ -0,0 +1,450 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)fs.5 8.2 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd October 31, 2006
+.Dt FS 5
+.Os
+.Sh NAME
+.Nm fs ,
+.Nm inode
+.Nd format of file system volume
+.Sh SYNOPSIS
+.In sys/param.h
+.In ufs/ffs/fs.h
+.Pp
+.In sys/types.h
+.In sys/lock.h
+.In sys/extattr.h
+.In sys/acl.h
+.In ufs/ufs/quota.h
+.In ufs/ufs/dinode.h
+.In ufs/ufs/extattr.h
+.Sh DESCRIPTION
+The files
+.In fs.h
+and
+.In inode.h
+declare several structures, defined variables and macros
+which are used to create and manage the underlying format of
+file system objects on random access devices (disks).
+.Pp
+The block size and number of blocks which
+comprise a file system are parameters of the file system.
+Sectors beginning at
+.Dv BBLOCK
+and continuing for
+.Dv BBSIZE
+are used
+for a disklabel and for some hardware primary
+and secondary bootstrapping programs.
+.Pp
+The actual file system begins at sector
+.Dv SBLOCK
+with the
+.Em super-block
+that is of size
+.Dv SBLOCKSIZE .
+The following structure describes the super-block and is
+from the file
+.In ufs/ffs/fs.h :
+.Bd -literal
+/*
+ * Super block for an FFS filesystem.
+ */
+struct fs {
+ int32_t fs_firstfield; /* historic filesystem linked list, */
+ int32_t fs_unused_1; /* used for incore super blocks */
+ int32_t fs_sblkno; /* offset of super-block in filesys */
+ int32_t fs_cblkno; /* offset of cyl-block in filesys */
+ int32_t fs_iblkno; /* offset of inode-blocks in filesys */
+ int32_t fs_dblkno; /* offset of first data after cg */
+ int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */
+ int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */
+ int32_t fs_old_time; /* last time written */
+ int32_t fs_old_size; /* number of blocks in fs */
+ int32_t fs_old_dsize; /* number of data blocks in fs */
+ int32_t fs_ncg; /* number of cylinder groups */
+ int32_t fs_bsize; /* size of basic blocks in fs */
+ int32_t fs_fsize; /* size of frag blocks in fs */
+ int32_t fs_frag; /* number of frags in a block in fs */
+/* these are configuration parameters */
+ int32_t fs_minfree; /* minimum percentage of free blocks */
+ int32_t fs_old_rotdelay; /* num of ms for optimal next block */
+ int32_t fs_old_rps; /* disk revolutions per second */
+/* these fields can be computed from the others */
+ int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */
+ int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */
+ int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */
+ int32_t fs_fshift; /* ``numfrags'' calc number of frags */
+/* these are configuration parameters */
+ int32_t fs_maxcontig; /* max number of contiguous blks */
+ int32_t fs_maxbpg; /* max number of blks per cyl group */
+/* these fields can be computed from the others */
+ int32_t fs_fragshift; /* block to frag shift */
+ int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
+ int32_t fs_sbsize; /* actual size of super block */
+ int32_t fs_spare1[2]; /* old fs_csmask */
+ /* old fs_csshift */
+ int32_t fs_nindir; /* value of NINDIR */
+ int32_t fs_inopb; /* value of INOPB */
+ int32_t fs_old_nspf; /* value of NSPF */
+/* yet another configuration parameter */
+ int32_t fs_optim; /* optimization preference, see below */
+ int32_t fs_old_npsect; /* # sectors/track including spares */
+ int32_t fs_old_interleave; /* hardware sector interleave */
+ int32_t fs_old_trackskew; /* sector 0 skew, per track */
+ int32_t fs_id[2]; /* unique filesystem id */
+/* sizes determined by number of cylinder groups and their sizes */
+ int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */
+ int32_t fs_cssize; /* size of cyl grp summary area */
+ int32_t fs_cgsize; /* cylinder group size */
+ int32_t fs_spare2; /* old fs_ntrak */
+ int32_t fs_old_nsect; /* sectors per track */
+ int32_t fs_old_spc; /* sectors per cylinder */
+ int32_t fs_old_ncyl; /* cylinders in filesystem */
+ int32_t fs_old_cpg; /* cylinders per group */
+ int32_t fs_ipg; /* inodes per group */
+ int32_t fs_fpg; /* blocks per group * fs_frag */
+/* this data must be re-computed after crashes */
+ struct csum fs_old_cstotal; /* cylinder summary information */
+/* these fields are cleared at mount time */
+ int8_t fs_fmod; /* super block modified flag */
+ int8_t fs_clean; /* filesystem is clean flag */
+ int8_t fs_ronly; /* mounted read-only flag */
+ int8_t fs_old_flags; /* old FS_ flags */
+ u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
+ u_char fs_volname[MAXVOLLEN]; /* volume name */
+ uint64_t fs_swuid; /* system-wide uid */
+ int32_t fs_pad; /* due to alignment of fs_swuid */
+/* these fields retain the current block allocation info */
+ int32_t fs_cgrotor; /* last cg searched */
+ void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
+ uint8_t *fs_contigdirs; /* # of contiguously allocated dirs */
+ struct csum *fs_csp; /* cg summary info buffer for fs_cs */
+ int32_t *fs_maxcluster; /* max cluster in each cyl group */
+ u_int *fs_active; /* used by snapshots to track fs */
+ int32_t fs_old_cpc; /* cyl per cycle in postbl */
+ int32_t fs_maxbsize; /* maximum blocking factor permitted */
+ int64_t fs_unrefs; /* number of unreferenced inodes */
+ int64_t fs_sparecon64[16]; /* old rotation block list head */
+ int64_t fs_sblockloc; /* byte offset of standard superblock */
+ struct csum_total fs_cstotal; /* cylinder summary information */
+ ufs_time_t fs_time; /* last time written */
+ int64_t fs_size; /* number of blocks in fs */
+ int64_t fs_dsize; /* number of data blocks in fs */
+ ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */
+ int64_t fs_pendingblocks; /* blocks in process of being freed */
+ int32_t fs_pendinginodes; /* inodes in process of being freed */
+ int32_t fs_snapinum[FSMAXSNAP]; /* list of snapshot inode numbers */
+ int32_t fs_avgfilesize; /* expected average file size */
+ int32_t fs_avgfpdir; /* expected # of files per directory */
+ int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */
+ int32_t fs_sparecon32[26]; /* reserved for future constants */
+ int32_t fs_flags; /* see FS_ flags below */
+ int32_t fs_contigsumsize; /* size of cluster summary array */
+ int32_t fs_maxsymlinklen; /* max length of an internal symlink */
+ int32_t fs_old_inodefmt; /* format of on-disk inodes */
+ uint64_t fs_maxfilesize; /* maximum representable file size */
+ int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
+ int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
+ int32_t fs_state; /* validate fs_clean field */
+ int32_t fs_old_postblformat; /* format of positional layout tables */
+ int32_t fs_old_nrpos; /* number of rotational positions */
+ int32_t fs_spare5[2]; /* old fs_postbloff */
+ /* old fs_rotbloff */
+ int32_t fs_magic; /* magic number */
+};
+
+/*
+ * Filesystem identification
+ */
+#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast filesystem magic number */
+#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast filesystem magic number */
+#define FS_OKAY 0x7c269d38 /* superblock checksum */
+#define FS_42INODEFMT -1 /* 4.2BSD inode format */
+#define FS_44INODEFMT 2 /* 4.4BSD inode format */
+
+/*
+ * Preference for optimization.
+ */
+#define FS_OPTTIME 0 /* minimize allocation time */
+#define FS_OPTSPACE 1 /* minimize disk fragmentation */
+.Ed
+.Pp
+Each disk drive contains some number of file systems.
+A file system consists of a number of cylinder groups.
+Each cylinder group has inodes and data.
+.Pp
+A file system is described by its super-block, which in turn
+describes the cylinder groups.
+The super-block is critical
+data and is replicated in each cylinder group to protect against
+catastrophic loss.
+This is done at file system creation
+time and the critical
+super-block data does not change, so the copies need not be
+referenced further unless disaster strikes.
+.Pp
+Addresses stored in inodes are capable of addressing fragments
+of `blocks'.
+File system blocks of at most size
+.Dv MAXBSIZE
+can
+be optionally broken into 2, 4, or 8 pieces, each of which is
+addressable; these pieces may be
+.Dv DEV_BSIZE ,
+or some multiple of
+a
+.Dv DEV_BSIZE
+unit.
+.Pp
+Large files consist of exclusively large data blocks.
+To avoid
+undue wasted disk space, the last data block of a small file is
+allocated as only as many fragments of a large block as are
+necessary.
+The file system format retains only a single pointer
+to such a fragment, which is a piece of a single large block that
+has been divided.
+The size of such a fragment is determinable from
+information in the inode, using the
+.Fn blksize fs ip lbn
+macro.
+.Pp
+The file system records space availability at the fragment level;
+to determine block availability, aligned fragments are examined.
+.Pp
+The root inode is the root of the file system.
+Inode 0 cannot be used for normal purposes and
+historically bad blocks were linked to inode 1,
+thus the root inode is 2 (inode 1 is no longer used for
+this purpose, however numerous dump tapes make this
+assumption, so we are stuck with it).
+.Pp
+The
+.Fa fs_minfree
+element gives the minimum acceptable percentage of file system
+blocks that may be free.
+If the freelist drops below this level
+only the super-user may continue to allocate blocks.
+The
+.Fa fs_minfree
+element
+may be set to 0 if no reserve of free blocks is deemed necessary,
+however severe performance degradations will be observed if the
+file system is run at greater than 90% full; thus the default
+value of
+.Fa fs_minfree
+is 10%.
+.Pp
+Empirically the best trade-off between block fragmentation and
+overall disk utilization at a loading of 90% comes with a
+fragmentation of 8, thus the default fragment size is an eighth
+of the block size.
+.Pp
+The element
+.Fa fs_optim
+specifies whether the file system should try to minimize the time spent
+allocating blocks, or if it should attempt to minimize the space
+fragmentation on the disk.
+If the value of fs_minfree (see above) is less than 10%,
+then the file system defaults to optimizing for space to avoid
+running out of full sized blocks.
+If the value of minfree is greater than or equal to 10%,
+fragmentation is unlikely to be problematical, and
+the file system defaults to optimizing for time.
+.Pp
+.Em Cylinder group related limits :
+Each cylinder keeps track of the availability of blocks at different
+rotational positions, so that sequential blocks can be laid out
+with minimum rotational latency.
+With the default of 8 distinguished
+rotational positions, the resolution of the
+summary information is 2ms for a typical 3600 rpm drive.
+.Pp
+The element
+.Fa fs_old_rotdelay
+gives the minimum number of milliseconds to initiate
+another disk transfer on the same cylinder.
+It is used in determining the rotationally optimal
+layout for disk blocks within a file;
+the default value for
+.Fa fs_old_rotdelay
+is 2ms.
+.Pp
+Each file system has a statically allocated number of inodes.
+An inode is allocated for each
+.Dv NBPI
+bytes of disk space.
+The inode allocation strategy is extremely conservative.
+.Pp
+.Dv MINBSIZE
+is the smallest allowable block size.
+With a
+.Dv MINBSIZE
+of 4096
+it is possible to create files of size
+2^32 with only two levels of indirection.
+.Dv MINBSIZE
+must be big enough to hold a cylinder group block,
+thus changes to
+.Pq Fa struct cg
+must keep its size within
+.Dv MINBSIZE .
+Note that super-blocks are never more than size
+.Dv SBLOCKSIZE .
+.Pp
+The path name on which the file system is mounted is maintained in
+.Fa fs_fsmnt .
+.Dv MAXMNTLEN
+defines the amount of space allocated in
+the super-block for this name.
+The limit on the amount of summary information per file system
+is defined by
+.Dv MAXCSBUFS .
+For a 4096 byte block size, it is currently parameterized for a
+maximum of two million cylinders.
+.Pp
+Per cylinder group information is summarized in blocks allocated
+from the first cylinder group's data blocks.
+These blocks are read in from
+.Fa fs_csaddr
+(size
+.Fa fs_cssize )
+in addition to the super-block.
+.Pp
+.Sy N.B. :
+.Fn sizeof "struct csum"
+must be a power of two in order for
+the
+.Fn fs_cs
+macro to work.
+.Pp
+The
+.Em "Super-block for a file system" :
+The size of the rotational layout tables
+is limited by the fact that the super-block is of size
+.Dv SBLOCKSIZE .
+The size of these tables is
+.Em inversely
+proportional to the block
+size of the file system.
+The size of the tables is
+increased when sector sizes are not powers of two,
+as this increases the number of cylinders
+included before the rotational pattern repeats
+.Pq Fa fs_cpc .
+The size of the rotational layout
+tables is derived from the number of bytes remaining in
+.Pq Fa struct fs .
+.Pp
+The number of blocks of data per cylinder group
+is limited because cylinder groups are at most one block.
+The inode and free block tables
+must fit into a single block after deducting space for
+the cylinder group structure
+.Pq Fa struct cg .
+.Pp
+The
+.Em Inode :
+The inode is the focus of all file activity in the
+.Ux
+file system.
+There is a unique inode allocated
+for each active file,
+each current directory, each mounted-on file,
+text file, and the root.
+An inode is `named' by its device/i-number pair.
+For further information, see the include file
+.In ufs/ufs/inode.h .
+.Pp
+The format of an external attribute is defined by the extattr structure:
+.Bd -literal
+struct extattr {
+ int32_t ea_length; /* length of this attribute */
+ int8_t ea_namespace; /* name space of this attribute */
+ int8_t ea_contentpadlen; /* padding at end of attribute */
+ int8_t ea_namelength; /* length of attribute name */
+ char ea_name[1]; /* null-terminated attribute name */
+ /* extended attribute content follows */
+};
+.Ed
+.Pp
+Several macros are defined to manipulate these structures.
+Each macro takes a pointer to an extattr structure.
+.Bl -tag -width ".Dv EXTATTR_SET_LENGTHS(eap, size)"
+.It Dv EXTATTR_NEXT(eap)
+Returns a pointer to the next extended attribute following
+.Fa eap .
+.It Dv EXTATTR_CONTENT(eap)
+Returns a pointer to the extended attribute content referenced by
+.Fa eap .
+.It Dv EXTATTR_CONTENT_SIZE(eap)
+Returns the size of the extended attribute content referenced by
+.Fa eap .
+.It Dv EXTATTR_SET_LENGTHS(eap, size)
+Called with the size of the attribute content after initializing
+the attribute name to calculate and set the
+.Fa ea_length ,
+.Fa ea_namelength ,
+and
+.Fa ea_contentpadlen
+fields of the extended attribute structure.
+.El
+.Pp
+The following code identifies an ACL:
+.Bd -literal
+ if (eap->ea_namespace == EXTATTR_NAMESPACE_SYSTEM &&
+ !strcmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME) {
+ aclp = EXTATTR_CONTENT(eap);
+ acllen = EXTATTR_CONTENT_SIZE(eap);
+ ...
+ }
+.Ed
+.Pp
+The following code creates an extended attribute
+containing a copy of a structure
+.Fa mygif :
+.Bd -literal
+ eap->ea_namespace = EXTATTR_NAMESPACE_USER;
+ strcpy(eap->ea_name, "filepic.gif");
+ EXTATTR_SET_LENGTHS(eap, sizeof(struct mygif));
+ memcpy(EXTATTR_CONTENT(eap), &mygif, sizeof(struct mygif));
+.Ed
+.Sh HISTORY
+A super-block structure named filsys appeared in
+.At v6 .
+The file system described in this manual appeared
+in
+.Bx 4.2 .
diff --git a/share/man/man5/fstab.5 b/share/man/man5/fstab.5
new file mode 100644
index 000000000000..060d57ce51f8
--- /dev/null
+++ b/share/man/man5/fstab.5
@@ -0,0 +1,347 @@
+.\" Copyright (c) 1980, 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)fstab.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 7, 2011
+.Dt FSTAB 5
+.Os
+.Sh NAME
+.Nm fstab
+.Nd static information about the file systems
+.Sh SYNOPSIS
+.In fstab.h
+.Sh DESCRIPTION
+The file
+.Nm
+contains descriptive information about the various file
+systems.
+.Nm
+is only read by programs, and not written;
+it is the duty of the system administrator to properly create
+and maintain this file.
+Each file system is described on a separate line;
+fields on each line are separated by tabs or spaces.
+The order of records in
+.Nm
+is important because
+.Xr fsck 8 ,
+.Xr mount 8 ,
+and
+.Xr umount 8
+sequentially iterate through
+.Nm
+doing their thing.
+.Pp
+The first field,
+.Pq Fa fs_spec ,
+describes the special device or
+remote file system to be mounted.
+.Pp
+The second field,
+.Pq Fa fs_file ,
+describes the mount point for the file system.
+For swap partitions, this field should be specified as
+.Dq none .
+.Pp
+The third field,
+.Pq Fa fs_vfstype ,
+describes the type of the file system.
+The system can support various file system types.
+Only the root, /usr, and /tmp file systems need be statically
+compiled into the kernel;
+everything else will be automatically loaded at mount
+time.
+(Exception: the FFS cannot currently be demand-loaded.)
+Some people still prefer to statically
+compile other file systems as well.
+.Pp
+The fourth field,
+.Pq Fa fs_mntops ,
+describes the mount options associated with the file system.
+It is formatted as a comma separated list of options.
+It contains at least the type of mount (see
+.Fa fs_type
+below) plus any additional options appropriate to the file system type.
+See the options flag
+.Pq Fl o
+in the
+.Xr mount 8
+page and the file system specific page, such as
+.Xr mount_nfs 8 ,
+for additional options that may be specified.
+All options that can be given to the file system specific mount commands
+can be used in
+.Nm
+as well.
+They just need to be formatted a bit differently.
+The arguments of the
+.Fl o
+option can be used without the preceding
+.Fl o
+flag.
+Other options need both the file system specific flag and its argument,
+separated by an equal sign.
+For example, mounting an
+.Xr msdosfs 5
+filesystem, the options
+.Bd -literal -offset indent
+-o sync -o noatime -m 644 -M 755 -u foo -g bar
+.Ed
+.Pp
+should be written as
+.Bd -literal -offset indent
+sync,noatime,-m=644,-M=755,-u=foo,-g=bar
+.Ed
+.Pp
+in the option field of
+.Nm .
+.Pp
+If the options
+.Dq userquota
+and/or
+.Dq groupquota
+are specified,
+the file system is automatically processed by the
+.Xr quotacheck 8
+command, and user and/or group disk quotas are enabled with
+.Xr quotaon 8 .
+By default,
+file system quotas are maintained in files named
+.Pa quota.user
+and
+.Pa quota.group
+which are located at the root of the associated file system.
+These defaults may be overridden by putting an equal sign
+and an alternative absolute pathname following the quota option.
+Thus, if the user quota file for
+.Pa /tmp
+is stored in
+.Pa /var/quotas/tmp.user ,
+this location can be specified as:
+.Bd -literal -offset indent
+userquota=/var/quotas/tmp.user
+.Ed
+.Pp
+If the option
+.Dq failok
+is specified,
+the system will ignore any error which happens during the mount of that filesystem,
+which would otherwise cause the system to drop into single user mode.
+This option is implemented by the
+.Xr mount 8
+command and will not be passed to the kernel.
+.Pp
+If the option
+.Dq noauto
+is specified, the file system will not be automatically
+mounted at system startup.
+Note that, for network file systems
+of third party types
+(i.e., types supported by additional software
+not included in the base system)
+to be automatically mounted at system startup,
+the
+.Va extra_netfs_types
+.Xr rc.conf 5
+variable must be used to extend the
+.Xr rc 8
+startup script's list of network file system types.
+.Pp
+The type of the mount is extracted from the
+.Fa fs_mntops
+field and stored separately in the
+.Fa fs_type
+field (it is not deleted from the
+.Fa fs_mntops
+field).
+If
+.Fa fs_type
+is
+.Dq rw
+or
+.Dq ro
+then the file system whose name is given in the
+.Fa fs_file
+field is normally mounted read-write or read-only on the
+specified special file.
+If
+.Fa fs_type
+is
+.Dq sw
+then the special file is made available as a piece of swap
+space by the
+.Xr swapon 8
+command at the end of the system reboot procedure.
+The fields other than
+.Fa fs_spec
+and
+.Fa fs_type
+are unused.
+If
+.Fa fs_type
+is specified as
+.Dq xx
+the entry is ignored.
+This is useful to show disk partitions which are currently unused.
+.Pp
+The fifth field,
+.Pq Fa fs_freq ,
+is used for these file systems by the
+.Xr dump 8
+command to determine which file systems need to be dumped.
+If the fifth field is not present, a value of zero is returned and
+.Nm dump
+will assume that the file system does not need to be dumped.
+If the fifth field is greater than 0, then it specifies the number of days
+between dumps for this file system.
+.Pp
+The sixth field,
+.Pq Fa fs_passno ,
+is used by the
+.Xr fsck 8
+and
+.Xr quotacheck 8
+programs to determine the order in which file system and quota
+checks are done at reboot time.
+The
+.Fa fs_passno
+field can be any value between 0 and
+.Ql INT_MAX Ns -1 .
+.Pp
+The root file system should be specified with a
+.Fa fs_passno
+of 1, and other file systems should have a
+.Fa fs_passno
+of 2 or greater.
+A file system with a
+.Fa fs_passno
+value of 1 is always checked sequentially and be completed before
+another file system is processed, and it will be processed before
+all file systems with a larger
+.Fa fs_passno .
+.Pp
+For any given value of
+.Fa fs_passno ,
+file systems within a drive will be checked sequentially,
+but file systems on different drives will be checked at the
+same time to utilize parallelism available in the hardware.
+Once all file system checks are complete for the current
+.Fa fs_passno ,
+the same process will start over for the next
+.Fa fs_passno .
+.Pp
+If the sixth field is not present or is zero,
+a value of zero is returned and
+.Xr fsck 8
+and
+.Xr quotacheck 8
+will assume that the file system does not need to be checked.
+.Pp
+The
+.Fa fs_passno
+field can be used to implement finer control when
+the system utilities may determine that the file system resides
+on a different physical device, when it actually does not, as with a
+.Xr ccd 4
+device.
+All file systems with a lower
+.Fa fs_passno
+value will be completed before starting on file systems with a
+higher
+.Fa fs_passno
+value.
+E.g. all file systems with a
+.Fa fs_passno
+of 2 will be completed before any file systems with a
+.Fa fs_passno
+of 3 or greater are started.
+Gaps are allowed between the different
+.Fa fs_passno
+values.
+E.g. file systems listed in
+.Pa /etc/fstab
+may have
+.Fa fs_passno
+values such as 0, 1, 2, 15, 100, 200, 300, and may appear in any order
+within
+.Pa /etc/fstab .
+.Bd -literal
+#define FSTAB_RW "rw" /* read/write device */
+#define FSTAB_RQ "rq" /* read/write with quotas */
+#define FSTAB_RO "ro" /* read-only device */
+#define FSTAB_SW "sw" /* swap device */
+#define FSTAB_XX "xx" /* ignore totally */
+
+struct fstab {
+ char *fs_spec; /* block special device name */
+ char *fs_file; /* file system path prefix */
+ char *fs_vfstype; /* File system type, ufs, nfs */
+ char *fs_mntops; /* Mount options ala -o */
+ char *fs_type; /* FSTAB_* from fs_mntops */
+ int fs_freq; /* dump frequency, in days */
+ int fs_passno; /* pass number on parallel fsck */
+};
+.Ed
+.Pp
+The proper way to read records from
+.Pa fstab
+is to use the routines
+.Xr getfsent 3 ,
+.Xr getfsspec 3 ,
+.Xr getfstype 3 ,
+and
+.Xr getfsfile 3 .
+.Sh FILES
+.Bl -tag -width /etc/fstab -compact
+.It Pa /etc/fstab
+The file
+.Nm
+resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr getfsent 3 ,
+.Xr getvfsbyname 3 ,
+.Xr ccd 4 ,
+.Xr dump 8 ,
+.Xr fsck 8 ,
+.Xr mount 8 ,
+.Xr quotacheck 8 ,
+.Xr quotaon 8 ,
+.Xr swapon 8 ,
+.Xr umount 8
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.0 .
diff --git a/share/man/man5/group.5 b/share/man/man5/group.5
new file mode 100644
index 000000000000..4aa6affdd9fd
--- /dev/null
+++ b/share/man/man5/group.5
@@ -0,0 +1,164 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)group.5 8.3 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd September 29, 1994
+.Dt GROUP 5
+.Os
+.Sh NAME
+.Nm group
+.Nd format of the group permissions file
+.Sh DESCRIPTION
+The
+.Nm
+file is the local source of group information.
+It can be used in conjunction with the Hesiod domain
+`group', and the NIS maps `group.byname' and `group.bygid',
+as controlled by
+.Xr nsswitch.conf 5 .
+.Pp
+The file
+.Nm
+consists of newline separated
+.Tn ASCII
+records, one per group, containing four colon
+.Ql \&:
+separated fields.
+These fields are as follows:
+.Bl -tag -width password -offset indent -compact
+.It group
+Name of the group.
+.It passwd
+Group's
+.Em encrypted
+password.
+.It gid
+The group's decimal ID.
+.It member
+Group members.
+.El
+.Pp
+Lines whose first non-whitespace character is a pound-sign (#)
+are comments, and are ignored.
+Blank lines that consist
+only of spaces, tabs or newlines are also ignored.
+.Pp
+The
+.Ar group
+field is the group name used for granting file access to users
+who are members of the group.
+The
+.Ar gid
+field is the number associated with the group name.
+They should both be unique across the system (and often
+across a group of systems) since they control file access.
+The
+.Ar passwd
+field
+is an optional
+.Em encrypted
+password.
+This field is rarely used
+and an asterisk is normally placed in it rather than leaving it blank.
+The
+.Ar member
+field contains the names of users granted the privileges of
+.Ar group .
+The member names are separated by commas without spaces or newlines.
+A user is automatically in a group if that group was specified
+in their
+.Pa /etc/passwd
+entry and does not need to be added to that group in the
+.Nm
+file.
+.\" .Pp
+.\" When the system reads the file
+.\" .Pa /etc/group
+.\" the fields are read into the structure
+.\" .Fa group
+.\" declared in
+.\" .In grp.h :
+.\" .Bd -literal -offset indent
+.\" struct group {
+.\" char *gr_name; /* group name */
+.\" char *gr_passwd; /* group password */
+.\" int gr_gid; /* group id */
+.\" char **gr_mem; /* group members */
+.\" };
+.\" .Ed
+.Sh LIMITS
+There are various limitations which are explained in
+the function where they occur; see section
+.Sx SEE ALSO .
+.Pp
+In older implementations,
+a group cannot have more than 200 members.
+The maximum line length of
+.Pa /etc/group
+is 1024 characters.
+Longer lines will be skipped.
+This limitation disappeared in
+.Fx 3.0 .
+Older binaries that are statically linked, depend on old
+shared libraries, or
+.No non- Ns Fx
+binaries in compatibility mode
+may still have this limit.
+.Sh FILES
+.Bl -tag -width /etc/group -compact
+.It Pa /etc/group
+.El
+.Sh SEE ALSO
+.Xr passwd 1 ,
+.Xr setgroups 2 ,
+.Xr crypt 3 ,
+.Xr getgrent 3 ,
+.Xr initgroups 3 ,
+.Xr nsswitch.conf 5 ,
+.Xr passwd 5 ,
+.Xr chkgrp 8 ,
+.Xr pw 8 ,
+.Xr yp 8
+.Sh HISTORY
+A
+.Nm
+file format appeared in
+.At v6 .
+Support for comments first appeared in
+.Fx 3.0 .
+.Sh BUGS
+The
+.Xr passwd 1
+command does not change the
+.Nm
+passwords.
diff --git a/share/man/man5/hesiod.conf.5 b/share/man/man5/hesiod.conf.5
new file mode 100644
index 000000000000..364ea8041e6c
--- /dev/null
+++ b/share/man/man5/hesiod.conf.5
@@ -0,0 +1,80 @@
+.\" $NetBSD: hesiod.conf.5,v 1.2 1999/01/25 22:37:06 lukem Exp $
+.\"
+.\" from: #Id: hesiod.conf.5,v 1.1 1996/12/08 21:36:38 ghudson Exp #
+.\"
+.\" Copyright 1996 by the Massachusetts Institute of Technology.
+.\"
+.\" Permission to use, copy, modify, and distribute this
+.\" software and its documentation for any purpose and without
+.\" fee is hereby granted, provided that the above copyright
+.\" notice appear in all copies and that both that copyright
+.\" notice and this permission notice appear in supporting
+.\" documentation, and that the name of M.I.T. not be used in
+.\" advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.
+.\" M.I.T. makes no representations about the suitability of
+.\" this software for any purpose. It is provided "as is"
+.\" without express or implied warranty.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 30, 1996
+.Dt HESIOD.CONF 5
+.Os
+.Sh NAME
+.Nm hesiod.conf
+.Nd "configuration file for the Hesiod library"
+.Sh DESCRIPTION
+The file
+.Nm
+determines the behavior of the Hesiod library.
+Blank lines and lines beginning with a
+.Ql #
+character are ignored.
+All
+other lines should be of the form
+.Ar variable
+=
+.Ar value ,
+where the
+.Ar value
+should be a single word.
+Possible
+.Ar variables
+and
+.Ar values
+are:
+.Bl -tag -width classes
+.It Ic lhs
+Specifies the domain prefix used for Hesiod queries.
+In almost all cases, you should specify
+.Dq Li lhs=.ns .
+The default value if you do
+not specify an lhs value is no domain prefix, which is not compatible
+with most Hesiod domains.
+.It Ic rhs
+Specifies the default Hesiod domain; this value may be overridden by
+the
+.Ev HES_DOMAIN
+environment variable.
+You must specify an rhs line for the Hesiod
+library to work properly.
+.It Ic classes
+Specifies which DNS classes Hesiod should do lookups in.
+Possible values are
+.Cm IN
+(the preferred class) and
+.Cm HS
+(the deprecated class, still used by some sites).
+You may specify both classes separated by
+a comma to try one class first and then the other if no entry is
+available in the first class.
+The default value of the classes variable is
+.Dq Li IN,HS .
+.El
+.Sh SEE ALSO
+.Xr hesiod 3
+.Sh BUGS
+The default value for
+.Ic lhs
+should probably be more reasonable.
diff --git a/share/man/man5/hosts.5 b/share/man/man5/hosts.5
new file mode 100644
index 000000000000..218a4df37196
--- /dev/null
+++ b/share/man/man5/hosts.5
@@ -0,0 +1,116 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)hosts.5 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd December 11, 1993
+.Dt HOSTS 5
+.Os
+.Sh NAME
+.Nm hosts
+.Nd host name data base
+.Sh DESCRIPTION
+The
+.Nm
+file contains information regarding
+the known hosts on the network.
+It can be used in conjunction with DNS, and the NIS
+maps `hosts.byaddr' and `hosts.byname', as controlled by
+.Xr nsswitch.conf 5 .
+For each host a single line should be present
+with the following information:
+.Bd -unfilled -offset indent
+Internet address
+official host name
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or
+tab characters.
+A ``#'' indicates the beginning of
+a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+When using the name server
+.Xr named 8 ,
+this file provides a backup used when the name server
+is not running.
+For the name server, it is suggested that only a few addresses
+be included in this file.
+These include addresses for the local interfaces that
+.Xr ifconfig 8
+needs at boot time and a few machines on the local network.
+.Pp
+This file may be created from the official host
+data base maintained at the Network Information Control
+Center
+.Pq Tn NIC ,
+though local changes may be required
+to bring it up to date regarding unofficial aliases
+and/or unknown hosts.
+As the data base maintained at
+.Tn NIC
+is incomplete, use of the name server is recommended for
+sites on the
+.Tn DARPA
+Internet.
+.Pp
+Network addresses are specified in the conventional
+``.'' (dot) notation using the
+.Xr inet_addr 3
+routine
+from the Internet address manipulation library,
+.Xr inet 3 .
+Host names may contain any printable
+character other than a field delimiter, newline,
+or comment character.
+.Sh FILES
+.Bl -tag -width /etc/hosts -compact
+.It Pa /etc/hosts
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr nsswitch.conf 5 ,
+.Xr ifconfig 8 ,
+.Xr named 8
+.Rs
+.%T "Name Server Operations Guide for BIND"
+.Re
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
diff --git a/share/man/man5/hosts.equiv.5 b/share/man/man5/hosts.equiv.5
new file mode 100644
index 000000000000..6bf8e0d1e2c1
--- /dev/null
+++ b/share/man/man5/hosts.equiv.5
@@ -0,0 +1,149 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 8, 2007
+.Dt HOSTS.EQUIV 5
+.Os
+.Sh NAME
+.Nm hosts.equiv ,
+.Nm .rhosts
+.Nd trusted remote host and user name data base
+.Sh DESCRIPTION
+The
+.Nm
+and
+.Nm .rhosts
+files contain information regarding
+trusted hosts and users on the network.
+For each host a single line should be present
+with the following information:
+.Pp
+simple
+.Bd -unfilled -offset indent
+hostname [username]
+.Ed
+.Pp
+or the more verbose
+.Bd -unfilled -offset indent
+[+-][hostname|@netgroup] [[+-][username|@netgroup]]
+.Ed
+.Pp
+A
+.Dq @
+indicates a host by netgroup or user by netgroup.
+A single
+.Dq +
+matches all hosts or users.
+A host name with a leading
+.Dq -
+will reject
+all matching hosts and all their users.
+A user name with leading
+.Dq -
+will reject all matching users from matching hosts.
+.Pp
+Items are separated by any number of blanks and/or
+tab characters.
+A
+.Dq #
+indicates the beginning of
+a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+Host names are specified in the conventional Internet DNS
+dotted-domains
+.Dq .\&
+(dot) notation using the
+.Xr inet_addr 3
+routine
+from the Internet address manipulation library,
+.Xr inet 3 .
+Host names may contain any printable
+character other than a field delimiter, newline,
+or comment character.
+.Pp
+For security reasons, a user's
+.Nm .rhosts
+file will be ignored if it is not a regular file, or if it
+is not owned by the user, or
+if it is writable by anyone other than the user.
+.Sh FILES
+.Bl -tag -width /etc/hosts.equivxxx -compact
+.It Pa /etc/hosts.equiv
+The
+.Nm
+file resides in
+.Pa /etc .
+.It Pa $HOME/.rhosts
+.Nm .rhosts
+file resides in
+.Pa $HOME .
+.El
+.Sh EXAMPLES
+.Dl bar.com foo
+.Pp
+Trust user
+.Dq foo
+from host
+.Dq bar.com .
+.Pp
+.Dl +@allclient
+.Pp
+Trust all hosts from netgroup
+.Dq allclient .
+.Pp
+.Dl +@allclient -@dau
+.Pp
+Trust all hosts from netgroup
+.Dq allclient
+and their users
+except users from netgroup
+.Dq dau .
+.Sh SEE ALSO
+.Xr rcp 1 ,
+.Xr rlogin 1 ,
+.Xr rsh 1 ,
+.Xr gethostbyname 3 ,
+.Xr inet 3 ,
+.Xr innetgr 3 ,
+.Xr ruserok 3 ,
+.Xr netgroup 5 ,
+.Xr ifconfig 8 ,
+.Xr named 8 ,
+.Xr yp 8
+.Sh BUGS
+This manual page is incomplete.
+For more information read
+the source in
+.Pa src/lib/libc/net/rcmd.c
+or the SunOS manual page.
diff --git a/share/man/man5/hosts.lpd.5 b/share/man/man5/hosts.lpd.5
new file mode 100644
index 000000000000..910ac66c5964
--- /dev/null
+++ b/share/man/man5/hosts.lpd.5
@@ -0,0 +1,62 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 1, 1996
+.Dt HOSTS.LPD 5
+.Os
+.Sh NAME
+.Nm hosts.lpd
+.Nd trusted hosts that may use local print services
+.Sh DESCRIPTION
+The
+.Nm
+file contains a list of hostnames or IP addresses
+that are allowed to use your local print services.
+List every hostname or IP address on a line itself.
+.Pp
+If you want to allow access for any and all host,
+you can usually use the NIS netgroups feature to
+do this by adding a line with a single
+.Ql +
+character.
+.Sh FILES
+.Bl -tag -width /etc/hosts.lpdxxxxx -compact
+.It Pa /etc/hosts.lpd
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr printcap 5 ,
+.Xr lpd 8
diff --git a/share/man/man5/intro.5 b/share/man/man5/intro.5
new file mode 100644
index 000000000000..764ba4d2ba21
--- /dev/null
+++ b/share/man/man5/intro.5
@@ -0,0 +1,55 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 1997
+.Dt INTRO 5
+.Os
+.Sh NAME
+.Nm intro
+.Nd "introduction to file formats"
+.Sh DESCRIPTION
+This section contains information about file formats.
+.Sh FILES
+.Bl -tag -width /etc/shells -compact
+.It Pa /etc
+location of most system configuration files
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr intro 1 ,
+.Xr intro 8
+.Sh HISTORY
+The
+.Nm
+section manual page appeared in
+.Fx 2.2 .
diff --git a/share/man/man5/libmap.conf.5 b/share/man/man5/libmap.conf.5
new file mode 100644
index 000000000000..6959ce2aaa93
--- /dev/null
+++ b/share/man/man5/libmap.conf.5
@@ -0,0 +1,163 @@
+.\" Copyright (c) 2003 Matthew N. Dodd <winter@jurai.net>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 31, 2004
+.Dt LIBMAP.CONF 5
+.Os
+.Sh NAME
+.Nm libmap.conf
+.Nd "configuration file for dynamic object dependency mapping"
+.Sh DESCRIPTION
+The
+.Nm libmap
+functionality of
+.Xr ld-elf.so.1 1
+allows dynamic object dependencies to be mapped to arbitrary
+names.
+.Pp
+The configuration file consists of two whitespace separated columns; the
+left hand side containing the mapping candidate and the right hand
+side containing the mapping.
+Dependencies are matched against candidates and replaced with the mappings.
+.Pp
+Constrained mappings may be specified by enclosing the name of the
+executable or library in brackets.
+All mappings following a constraint will only be evaluated for that constraint.
+Constraints can be one of three types:
+.Bl -tag -width indent
+.It Exact
+The constraint is matched literally so that only an executable with an
+identical fully qualified pathname will match the constraint.
+This means that the executable
+.Pa /usr/bin/foo
+will not match a constraint for
+.Pa /usr/bin/./foo
+and vice-versa.
+This is the default constraint type.
+.It Basename
+A constraint with no path is matched against the basename of the
+executable.
+.Pa foo
+will match
+.Pa /bin/foo ,
+.Pa /usr/local/sbin/foo ,
+or any other executable named
+.Pa foo ,
+no matter what its path is.
+.It Directory
+A constraint with a trailing slash is prefix-matched against the full
+pathname of the executable.
+.Pa /usr/bin/
+will match any executable with a path starting with /usr/bin.
+.El
+.Pp
+Note that the executable path matched against is the
+.Fa path
+parameter in an
+.Fn exec*
+function call.
+The Directory or Exact constraints can only match when the executable
+is called with a full pathname.
+Most programs executed from a shell are run without a full path, via
+.Fn exec*p ,
+so the Basename constraint type is the most useful.
+.Pp
+WARNING!
+Constrained mappings must never appear first in the configuration file.
+While there is a way to specify the
+.Dq default
+constraint, its use is not recommended.
+.Pp
+The most common use at the date of writing is for allowing multiple
+.Tn POSIX
+threading libraries to be used on a system without relinking or
+changing symlinks.
+.Pp
+On 64-bit architectures that provide 32-bit runtime support,
+the libmap mechanism is available for 32-bit binaries too.
+The mappings has to be written into separate configuration file
+.Pa /etc/libmap32.conf .
+Currently only supported on amd64.
+.Pp
+This mechanism has also been used to create shims to allow Linux
+shared libraries to be dynamically loaded into
+.Fx
+binaries.
+In this case, an Exact constraint is used for the Linux shared library,
+mapping libraries it depends on to a wrapper.
+The wrapper then defines any needed symbols for the Linux shared library
+and relies on its libraries not being mapped to provide actual
+implementations.
+It appears that only libraries loaded via
+.Xr dlopen 3
+will work correctly.
+The symbol version information in shared libraries is checked at
+link time, but at run time the version information is currently
+ignored.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/libmap32.conf" -compact
+.It Pa /etc/libmap.conf
+The libmap configuration file.
+.It Pa /etc/libmap32.conf
+The libmap configuration file for 32-bit binaries on 64-bit system.
+.El
+.Sh EXAMPLES
+.Bd -literal
+# /etc/libmap.conf
+#
+# candidate mapping
+#
+libc_r.so.6 libpthread.so.2 # Everything that uses 'libc_r'
+libc_r.so libpthread.so # now uses 'libpthread'
+
+[/tmp/mplayer] # Test version of mplayer uses libc_r
+libpthread.so.2 libc_r.so.6
+libpthread.so libc_r.so
+
+[/usr/local/jdk1.4.1/] # All Java 1.4.1 programs use libthr
+ # This works because "javavms" executes
+ # programs with the full pathname
+libpthread.so.2 libthr.so.2
+libpthread.so libthr.so
+
+# Glue for Linux-only EPSON printer .so to be loaded into cups, etc.
+[/usr/local/lib/pips/libsc80c.so]
+libc.so.6 pluginwrapper/pips.so
+libdl.so.2 pluginwrapper/pips.so
+.Ed
+.Sh SEE ALSO
+.Xr ldd 1 ,
+.Xr rtld 1
+.Sh HISTORY
+The
+.Nm
+manual page and
+.Nm libmap
+functionality first appeared in
+.Fx 5.1 .
+.Sh AUTHORS
+This manual page was written by
+.An Matthew N. Dodd Aq winter@jurai.net .
diff --git a/share/man/man5/link.5 b/share/man/man5/link.5
new file mode 100644
index 000000000000..ca3e811fed9b
--- /dev/null
+++ b/share/man/man5/link.5
@@ -0,0 +1,590 @@
+.\" Copyright (c) 1993 Paul Kranenburg
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Paul Kranenburg.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 23, 1993
+.Dt LINK 5
+.Os
+.Sh NAME
+.Nm link
+.Nd dynamic loader and link editor interface
+.Sh SYNOPSIS
+.In sys/types.h
+.In nlist.h
+.In link.h
+.Sh DESCRIPTION
+The include file
+.In link.h
+declares several structures that are present in dynamically linked
+programs and libraries.
+The structures define the interface between several components of the
+link-editor and loader mechanism.
+The layout of a number of these
+structures within the binaries resembles the a.out format in many places
+as it serves such similar functions as symbol definitions (including the
+accompanying string table) and relocation records needed to resolve
+references to external entities.
+It also records a number of data structures
+unique to the dynamic loading and linking process.
+These include references
+to other objects that are required to complete the link-editing process and
+indirection tables to facilitate
+.Em Position Independent Code
+(PIC for short) to improve sharing of code pages among different processes.
+The collection of data structures described here will be referred to as the
+.Em Run-time Relocation Section (RRS)
+and is embedded in the standard text and data segments of the dynamically
+linked program or shared object image as the existing
+.Xr a.out 5
+format offers no room for it elsewhere.
+.Pp
+Several utilities cooperate to ensure that the task of getting a program
+ready to run can complete successfully in a way that optimizes the use
+of system resources.
+The compiler emits PIC code from which shared libraries
+can be built by
+.Xr ld 1 .
+The compiler also includes size information of any initialized data items
+through the .size assembler directive.
+PIC code differs from conventional code
+in that it accesses data variables through an indirection table, the
+Global Offset Table, by convention accessible by the reserved name
+.Dv _GLOBAL_OFFSET_TABLE_ .
+The exact mechanism used for this is machine dependent, usually a machine
+register is reserved for the purpose.
+The rational behind this construct
+is to generate code that is independent of the actual load address.
+Only
+the values contained in the Global Offset Table may need updating at run-time
+depending on the load addresses of the various shared objects in the address
+space.
+.Pp
+Likewise, procedure calls to globally defined functions are redirected through
+the Procedure Linkage Table (PLT) residing in the data segment of the core
+image.
+Again, this is done to avoid run-time modifications to the text segment.
+.Pp
+The linker-editor allocates the Global Offset Table and Procedure Linkage Table
+when combining PIC object files into an image suitable for mapping into the
+process address space.
+It also collects all symbols that may be needed by the
+run-time link-editor and stores these along with the image's text and data bits.
+Another reserved symbol,
+.Em _DYNAMIC
+is used to indicate the presence of the run-time linker structures.
+Whenever
+_DYNAMIC is relocated to 0, there is no need to invoke the run-time
+link-editor.
+If this symbol is non-zero, it points at a data structure from
+which the location of the necessary relocation- and symbol information can
+be derived.
+This is most notably used by the start-up module,
+.Em crt0 .
+The _DYNAMIC structure is conventionally located at the start of the data
+segment of the image to which it pertains.
+.Sh DATA STRUCTURES
+The data structures supporting dynamic linking and run-time relocation
+reside both in the text and data segments of the image they apply to.
+The text segments contain read-only data such as symbols descriptions and
+names, while the data segments contain the tables that need to be modified by
+during the relocation process.
+.Pp
+The _DYNAMIC symbol references a
+.Fa _dynamic
+structure:
+.Bd -literal -offset indent
+struct _dynamic {
+ int d_version;
+ struct so_debug *d_debug;
+ union {
+ struct section_dispatch_table *d_sdt;
+ } d_un;
+ struct ld_entry *d_entry;
+};
+.Ed
+.Bl -tag -width d_version
+.It Fa d_version
+This field provides for different versions of the dynamic linking
+implementation.
+The current version numbers understood by
+.Xr ld 1
+and
+.Xr ld.so 1
+are
+.Em LD_VERSION_SUN (3) ,
+which is used by the
+.Tn SunOS
+4.x releases, and
+.Em LD_VERSION_BSD (8) ,
+which has been in use since
+.Fx 1.1 .
+.It Fa d_un
+Refers to a
+.Em d_version
+dependent data structure.
+.It Fa so_debug
+this field provides debuggers with a hook to access symbol tables of shared
+objects loaded as a result of the actions of the run-time link-editor.
+.El
+.Pp
+The
+.Fa section_dispatch_table
+structure is the main
+.Dq dispatcher
+table, containing offsets into the image's segments where various symbol
+and relocation information is located.
+.Bd -literal -offset indent
+struct section_dispatch_table {
+ struct so_map *sdt_loaded;
+ long sdt_sods;
+ long sdt_filler1;
+ long sdt_got;
+ long sdt_plt;
+ long sdt_rel;
+ long sdt_hash;
+ long sdt_nzlist;
+ long sdt_filler2;
+ long sdt_buckets;
+ long sdt_strings;
+ long sdt_str_sz;
+ long sdt_text_sz;
+ long sdt_plt_sz;
+};
+.Ed
+.Bl -tag -width sdt_filler1
+.It Fa sdt_loaded
+A pointer to the first link map loaded (see below).
+This field is set by
+.Nm ld.so
+.It Fa sdt_sods
+The start of a (linked) list of shared object descriptors needed by
+.Em this
+object.
+.It Fa sdt_filler1
+Deprecated (used by SunOS to specify library search rules).
+.It Fa sdt_got
+The location of the Global Offset Table within this image.
+.It Fa sdt_plt
+The location of the Procedure Linkage Table within this image.
+.It Fa sdt_rel
+The location of an array of
+.Fa relocation_info
+structures
+(see
+.Xr a.out 5 )
+specifying run-time relocations.
+.It Fa sdt_hash
+The location of the hash table for fast symbol lookup in this object's
+symbol table.
+.It Fa sdt_nzlist
+The location of the symbol table.
+.It Fa sdt_filler2
+Currently unused.
+.It Fa sdt_buckets
+The number of buckets in
+.Fa sdt_hash
+.It Fa sdt_strings
+The location of the symbol string table that goes with
+.Fa sdt_nzlist .
+.It Fa sdt_str_sz
+The size of the string table.
+.It Fa sdt_text_sz
+The size of the object's text segment.
+.It Fa sdt_plt_sz
+The size of the Procedure Linkage Table.
+.El
+.Pp
+A
+.Fa sod
+structure describes a shared object that is needed
+to complete the link edit process of the object containing it.
+A list of such objects
+(chained through
+.Fa sod_next )
+is pointed at
+by the
+.Fa sdt_sods
+in the section_dispatch_table structure.
+.Bd -literal -offset indent
+struct sod {
+ long sod_name;
+ u_int sod_library : 1,
+ sod_reserved : 31;
+ short sod_major;
+ short sod_minor;
+ long sod_next;
+};
+.Ed
+.Bl -tag -width sod_library
+.It Fa sod_name
+The offset in the text segment of a string describing this link object.
+.It Fa sod_library
+If set,
+.Fa sod_name
+specifies a library that is to be searched for by
+.Nm ld.so .
+The path name
+is obtained by searching a set of directories
+(see also
+.Xr ldconfig 8 )
+for a shared object matching
+.Em lib\&<sod_name>\&.so.n.m .
+If not set,
+.Fa sod_name
+should point at a full path name for the desired shared object.
+.It Fa sod_major
+Specifies the major version number of the shared object to load.
+.It Fa sod_minor
+Specifies the preferred minor version number of the shared object to load.
+.El
+.Pp
+The run-time link-editor maintains a list of structures called
+.Em link maps
+to keep track of all shared objects loaded into a process' address space.
+These structures are only used at run-time and do not occur within
+the text or data segment of an executable or shared library.
+.Bd -literal -offset indent
+struct so_map {
+ caddr_t som_addr;
+ char *som_path;
+ struct so_map *som_next;
+ struct sod *som_sod;
+ caddr_t som_sodbase;
+ u_int som_write : 1;
+ struct _dynamic *som_dynamic;
+ caddr_t som_spd;
+};
+.Ed
+.Bl -tag -width som_dynamic
+.It Fa som_addr
+The address at which the shared object associated with this link map has
+been loaded.
+.It Fa som_path
+The full path name of the loaded object.
+.It Fa som_next
+Pointer to the next link map.
+.It Fa som_sod
+The
+.Fa sod
+structure that was responsible for loading this shared object.
+.It Fa som_sodbase
+Tossed out in later versions of the run-time linker.
+.It Fa som_write
+Set if (some portion of) this object's text segment is currently writable.
+.It Fa som_dynamic
+Pointer to this object's
+.Fa _dynamic
+structure.
+.It Fa som_spd
+Hook for attaching private data maintained by the run-time link-editor.
+.El
+.Pp
+Symbol description with size.
+This is simply an
+.Fa nlist
+structure with one field
+.Pq Fa nz_size
+added.
+Used to convey size information on items in the data segment
+of shared objects.
+An array of these lives in the shared object's
+text segment and is addressed by the
+.Fa sdt_nzlist
+field of
+.Fa section_dispatch_table .
+.Bd -literal -offset indent
+struct nzlist {
+ struct nlist nlist;
+ u_long nz_size;
+#define nz_un nlist.n_un
+#define nz_strx nlist.n_un.n_strx
+#define nz_name nlist.n_un.n_name
+#define nz_type nlist.n_type
+#define nz_value nlist.n_value
+#define nz_desc nlist.n_desc
+#define nz_other nlist.n_other
+};
+.Ed
+.Bl -tag -width nz_size
+.It Fa nlist
+(see
+.Xr nlist 3 ) .
+.It Fa nz_size
+The size of the data represented by this symbol.
+.El
+.Pp
+A hash table is included within the text segment of shared object
+to facilitate quick lookup of symbols during run-time link-editing.
+The
+.Fa sdt_hash
+field of the
+.Fa section_dispatch_table
+structure points at an array of
+.Fa rrs_hash
+structures:
+.Bd -literal -offset indent
+struct rrs_hash {
+ int rh_symbolnum; /* symbol number */
+ int rh_next; /* next hash entry */
+};
+.Ed
+.Bl -tag -width rh_symbolnum
+.It Fa rh_symbolnum
+The index of the symbol in the shared object's symbol table (as given by the
+.Fa ld_symbols
+field).
+.It Fa rh_next
+In case of collisions, this field is the offset of the next entry in this
+hash table bucket.
+It is zero for the last bucket element.
+.El
+The
+.Fa rt_symbol
+structure is used to keep track of run-time allocated commons
+and data items copied from shared objects.
+These items are kept on linked list
+and is exported through the
+.Fa dd_cc
+field in the
+.Fa so_debug
+structure (see below) for use by debuggers.
+.Bd -literal -offset indent
+struct rt_symbol {
+ struct nzlist *rt_sp;
+ struct rt_symbol *rt_next;
+ struct rt_symbol *rt_link;
+ caddr_t rt_srcaddr;
+ struct so_map *rt_smp;
+};
+.Ed
+.Bl -tag -width rt_scraddr
+.It Fa rt_sp
+The symbol description.
+.It Fa rt_next
+Virtual address of next rt_symbol.
+.It Fa rt_link
+Next in hash bucket.
+Used internally by
+.Nm ld.so .
+.It Fa rt_srcaddr
+Location of the source of initialized data within a shared object.
+.It Fa rt_smp
+The shared object which is the original source of the data that this
+run-time symbol describes.
+.El
+.Pp
+The
+.Fa so_debug
+structure is used by debuggers to gain knowledge of any shared objects
+that have been loaded in the process's address space as a result of run-time
+link-editing.
+Since the run-time link-editor runs as a part of process
+initialization, a debugger that wishes to access symbols from shared objects
+can only do so after the link-editor has been called from crt0.
+A dynamically linked binary contains a
+.Fa so_debug
+structure which can be located by means of the
+.Fa d_debug
+field in
+.Fa _dynamic .
+.Bd -literal -offset indent
+struct so_debug {
+ int dd_version;
+ int dd_in_debugger;
+ int dd_sym_loaded;
+ char *dd_bpt_addr;
+ int dd_bpt_shadow;
+ struct rt_symbol *dd_cc;
+};
+.Ed
+.Bl -tag -width dd_in_debugger
+.It Fa dd_version
+Version number of this interface.
+.It Fa dd_in_debugger
+Set by the debugger to indicate to the run-time linker that the program is
+run under control of a debugger.
+.It Fa dd_sym_loaded
+Set by the run-time linker whenever it adds symbols by loading shared objects.
+.It Fa dd_bpt_addr
+The address where a breakpoint will be set by the run-time linker to
+divert control to the debugger.
+This address is determined by the start-up
+module,
+.Pa crt0.o ,
+to be some convenient place before the call to _main.
+.It Fa dd_bpt_shadow
+Contains the original instruction that was at
+.Fa dd_bpt_addr .
+The debugger is expected to put this instruction back before continuing the
+program.
+.It Fa dd_cc
+A pointer to the linked list of run-time allocated symbols that the debugger
+may be interested in.
+.El
+.Pp
+The
+.Em ld_entry
+structure defines a set of service routines within
+.Nm ld.so .
+.\" See
+.\" .Xr libdl.a
+.\" for more information.
+.Bd -literal -offset indent
+struct ld_entry {
+ void *(*dlopen)(char *, int);
+ int (*dlclose)(void *);
+ void *(*dlsym)(void *, char *);
+ char *(*dlerror)(void);
+};
+.Ed
+.Pp
+The
+.Fa crt_ldso
+structure defines the interface between the start-up code in crt0 and
+.Nm ld.so .
+.Bd -literal -offset indent
+struct crt_ldso {
+ int crt_ba;
+ int crt_dzfd;
+ int crt_ldfd;
+ struct _dynamic *crt_dp;
+ char **crt_ep;
+ caddr_t crt_bp;
+ char *crt_prog;
+ char *crt_ldso;
+ struct ld_entry *crt_ldentry;
+};
+#define CRT_VERSION_SUN 1
+#define CRT_VERSION_BSD_2 2
+#define CRT_VERSION_BSD_3 3
+#define CRT_VERSION_BSD_4 4
+.Ed
+.Bl -tag -width crt_dzfd
+.It Fa crt_ba
+The virtual address at which
+.Nm ld.so
+was loaded by crt0.
+.It Fa crt_dzfd
+On SunOS systems, this field contains an open file descriptor to
+.Dq Pa /dev/zero
+used to get demand paged zeroed pages.
+On
+.Fx
+systems it contains -1.
+.It Fa crt_ldfd
+Contains an open file descriptor that was used by crt0 to load
+.Nm ld.so .
+.It Fa crt_dp
+A pointer to main's
+.Fa _dynamic
+structure.
+.It Fa crt_ep
+A pointer to the environment strings.
+.It Fa crt_bp
+The address at which a breakpoint will be placed by the run-time linker
+if the main program is run by a debugger.
+See
+.Fa so_debug
+.It Fa crt_prog
+The name of the main program as determined by crt0 (CRT_VERSION_BSD3 only).
+.It Fa crt_ldso
+The path of the run-time linker as mapped by crt0 (CRT_VERSION_BSD4 only).
+.El
+.Pp
+The
+.Fa hints_header
+and
+.Fa hints_bucket
+structures define the layout of the library hints, normally found in
+.Dq Pa /var/run/ld.so.hints ,
+which is used by
+.Nm ld.so
+to quickly locate the shared object images in the
+file system.
+The organization of the hints file is not unlike that of an
+.Dq a.out
+object file, in that it contains a header determining the offset and size
+of a table of fixed sized hash buckets and a common string pool.
+.Bd -literal -offset indent
+struct hints_header {
+ long hh_magic;
+#define HH_MAGIC 011421044151
+ long hh_version;
+#define LD_HINTS_VERSION_1 1
+ long hh_hashtab;
+ long hh_nbucket;
+ long hh_strtab;
+ long hh_strtab_sz;
+ long hh_ehints;
+};
+.Ed
+.Bl -tag -width hh_strtab_sz
+.It Fa hh_magic
+Hints file magic number.
+.It Fa hh_version
+Interface version number.
+.It Fa hh_hashtab
+Offset of hash table.
+.It Fa hh_strtab
+Offset of string table.
+.It Fa hh_strtab_sz
+Size of strings.
+.It Fa hh_ehints
+Maximum usable offset in hints file.
+.El
+.Bd -literal -offset indent
+/*
+ * Hash table element in hints file.
+ */
+struct hints_bucket {
+ int hi_namex;
+ int hi_pathx;
+ int hi_dewey[MAXDEWEY];
+ int hi_ndewey;
+#define hi_major hi_dewey[0]
+#define hi_minor hi_dewey[1]
+ int hi_next;
+};
+.Ed
+.Bl -tag -width hi_ndewey
+.It Fa hi_namex
+Index of the string identifying the library.
+.It Fa hi_pathx
+Index of the string representing the full path name of the library.
+.It Fa hi_dewey
+The version numbers of the shared library.
+.It Fa hi_ndewey
+The number of valid entries in
+.Fa hi_dewey .
+.It Fa hi_next
+Next bucket in case of hashing collisions.
+.El
+.Sh CAVEATS
+Only the (GNU) C compiler currently supports the creation of shared libraries.
+Other programming languages cannot be used.
diff --git a/share/man/man5/linprocfs.5 b/share/man/man5/linprocfs.5
new file mode 100644
index 000000000000..a85afe96fd31
--- /dev/null
+++ b/share/man/man5/linprocfs.5
@@ -0,0 +1,98 @@
+.\" $FreeBSD$
+.\" Written by Garrett Wollman
+.\" This file is in the public domain.
+.\"
+.Dd August 10, 1994
+.Dt LINPROCFS 5
+.Os
+.Sh NAME
+.Nm linprocfs
+.Nd Linux process file system
+.Sh SYNOPSIS
+.Bd -literal
+linproc /compat/linux/proc linprocfs rw 0 0
+.Ed
+.Sh DESCRIPTION
+The Linux process file system, or
+.Nm ,
+emulates a subset of Linux' process file system and is required for
+the complete operation of some Linux binaries.
+.Pp
+The
+.Nm
+provides a two-level view of process space.
+At the highest level, processes themselves are named, according to
+their process ids in decimal, with no leading zeros.
+There is also a special node called
+.Pa self
+which always refers to the process making the lookup request.
+.Pp
+Each node is a directory containing several files:
+.Bl -tag -width status
+.It Pa exe
+A reference to the vnode from which the process text was read.
+This can be used to gain access to the process' symbol table,
+or to start another copy of the process.
+.It Pa mem
+The complete virtual memory image of the process.
+Only those addresses which exist in the process can be accessed.
+Reads and writes to this file modify the process.
+Writes to the text segment remain private to the process.
+.El
+.Pp
+Each node is owned by the process's user, and belongs to that user's
+primary group, except for the
+.Pa mem
+node, which belongs to the
+.Li kmem
+group.
+.Sh FILES
+.Bl -tag -width /compat/linux/proc/self/XXXXXXX -compact
+.It Pa /compat/linux/proc
+The normal mount point for the
+.Nm .
+.It Pa /compat/linux/proc/cpuinfo
+CPU vendor and model information in human-readable form.
+.It Pa /compat/linux/proc/meminfo
+System memory information in human-readable form.
+.It Pa /compat/linux/proc/pid
+A directory containing process information for process
+.Pa pid .
+.It Pa /compat/linux/proc/self
+A directory containing process information for the current process.
+.It Pa /compat/linux/proc/self/exe
+The executable image for the current process.
+.It Pa /compat/linux/proc/self/mem
+The complete virtual address space of the current process.
+.El
+.Sh EXAMPLES
+To mount a
+.Nm
+file system on
+.Pa /compat/linux/proc :
+.Pp
+.Dl "mount -t linprocfs linproc /compat/linux/proc"
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr unmount 2 ,
+.Xr procfs 5 ,
+.Xr pseudofs 9
+.Sh HISTORY
+The
+.Nm
+first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+was derived from
+.Nm procfs
+by
+.An Pierre Beyssac .
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav ,
+based on the
+.Xr procfs 5
+manual page by
+.An Garrett Wollman .
diff --git a/share/man/man5/linsysfs.5 b/share/man/man5/linsysfs.5
new file mode 100644
index 000000000000..f3ea3cff08ed
--- /dev/null
+++ b/share/man/man5/linsysfs.5
@@ -0,0 +1,99 @@
+.\" Written by Garrett Wollman
+.\" This file is in the public domain.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 5, 2007
+.Dt LINSYSFS 5
+.Os
+.Sh NAME
+.Nm linsysfs
+.Nd Linux system file system
+.Sh SYNOPSIS
+.Bd -literal
+linsys /compat/linux/sys linsysfs rw 0 0
+.Ed
+.Sh DESCRIPTION
+The
+.Tn Linux
+system file system, or
+.Nm ,
+emulates a subset of the
+.Tn Linux
+sys file system and is required for
+the complete operation of some
+.Tn Linux
+binaries.
+.Pp
+The
+.Nm
+provides a two-level view of devices.
+At the highest level, PCI devices themselves are named, according to
+their bus, slot and function in the system hierarchy.
+PCI storage devices are listed in the
+.Pa scsi_host
+class with a device symlink
+to the PCI directories of the devices.
+.Pp
+Each device node is a directory containing some files and directories:
+.Bl -tag -width ".Pa status"
+.It Pa host
+A place holder for storage host information.
+.It Pa pci_id
+A directory for the
+.Pa pci_id
+that contains either the device information or another directory structure
+for a PCI bridge.
+.El
+.Pp
+Each host node of scsi_host is a directory containing some files and directories:
+.Bl -tag -width ".Pa proc_name"
+.It Pa proc_name
+The
+.Tn Linux
+registered driver name for these devices.
+.It Pa device
+A symlink to the PCI device directory.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /compat/linux/sys/devices/pci0000:00" -compact
+.It Pa /compat/linux/sys
+The normal mount point for
+.Nm .
+.It Pa /compat/linux/sys/class/scsi_host
+The storage host node.
+.It Pa /compat/linux/sys/devices/pci0000:00
+The PCI device hierarchy node.
+.El
+.Sh EXAMPLES
+The most common usage follows:
+.Pp
+.Dl "mount -t linsysfs linsys /compat/linux/sys"
+.Pp
+where
+.Pa /compat/linux/sys
+is a mount point.
+.Sh SEE ALSO
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr linprocfs 5 ,
+.Xr pseudofs 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 6.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was derived from
+.Nm linprocfs
+by
+.An Doug Ambrisko .
+This manual page was edited by
+.An Doug Ambrisko ,
+based on the
+.Xr linprocfs 5
+manual page by
+.An Garrett Wollman .
diff --git a/share/man/man5/mailer.conf.5 b/share/man/man5/mailer.conf.5
new file mode 100644
index 000000000000..2fb8236b52f7
--- /dev/null
+++ b/share/man/man5/mailer.conf.5
@@ -0,0 +1,161 @@
+.\" $NetBSD: mailer.conf.5,v 1.2 1999/05/29 18:18:30 christos Exp $
+.\"
+.\" Copyright (c) 1998
+.\" Perry E. Metzger. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgment:
+.\" This product includes software developed for the NetBSD Project
+.\" by Perry E. Metzger.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 8, 2010
+.Dt MAILER.CONF 5
+.Os
+.Sh NAME
+.Nm mailer.conf
+.Nd configuration file for
+.Xr mailwrapper 8
+.Sh DESCRIPTION
+The file
+.Pa /etc/mail/mailer.conf
+contains a series of lines of the form
+.Pp
+.Ar name
+.Ar program
+.Op Ar arguments ...
+.Pp
+The first word of each line is the
+.Ar name
+of a program invoking
+.Xr mailwrapper 8 .
+(For example, on a typical system
+.Pa /usr/sbin/sendmail
+would be a symbolic link to
+.Xr mailwrapper 8 ,
+as would
+.Xr newaliases 1
+and
+.Xr mailq 1 .
+Thus,
+.Ar name
+might be
+.Dq Li sendmail
+or
+.Dq Li newaliases
+etc.)
+.Pp
+The second word of each line is the name of the
+.Ar program
+to actually execute when the first name is invoked.
+.Pp
+The further
+.Ar arguments ,
+if any, are passed to the
+.Ar program ,
+followed by the arguments
+.Xr mailwrapper 8
+was called with.
+.Pp
+The file may also contain comment lines, denoted by a
+.Ql #
+mark in the first column of any line.
+.Sh FILES
+/etc/mail/mailer.conf
+.Sh EXAMPLES
+This example shows how to set up
+.Nm
+to invoke the traditional
+.Xr sendmail 8
+program:
+.Bd -literal -offset indent
+# Execute the "real" sendmail program located in
+# /usr/libexec/sendmail/sendmail
+sendmail /usr/libexec/sendmail/sendmail
+send-mail /usr/libexec/sendmail/sendmail
+mailq /usr/libexec/sendmail/sendmail
+newaliases /usr/libexec/sendmail/sendmail
+.Ed
+.Pp
+This example shows how to invoke a sendmail-workalike like
+.Nm Postfix
+in place of
+.Xr sendmail 8 :
+.Bd -literal -offset indent
+# Emulate sendmail using postfix
+sendmail /usr/local/sbin/sendmail
+send-mail /usr/local/sbin/sendmail
+mailq /usr/local/sbin/sendmail
+newaliases /usr/local/sbin/sendmail
+.Ed
+.Pp
+This example shows
+how to invoke
+a sendmail-workalike with
+.Nm Exim
+(from ports)
+in place of
+.Xr sendmail 8 :
+.Bd -literal -offset indent
+# Emulate sendmail using exim
+sendmail /usr/local/sbin/exim
+send-mail /usr/local/sbin/exim
+mailq /usr/local/sbin/exim -bp
+newaliases /usr/bin/true
+rmail /usr/local/sbin/exim -i -oee
+.Ed
+.Pp
+This example shows the use of the
+.Nm mini_sendmail
+package from ports in place of
+.Xr sendmail 8 .
+Note the use of additional arguments.
+.Bd -literal -offset indent
+# Send outgoing mail to a smart relay using mini_sendmail
+sendmail /usr/local/bin/mini_sendmail -srelayhost
+send-mail /usr/local/bin/mini_sendmail -srelayhost
+.Ed
+.Sh SEE ALSO
+.Xr mail 1 ,
+.Xr mailq 1 ,
+.Xr newaliases 1 ,
+.Xr mailwrapper 8 ,
+.Xr sendmail 8
+.Pp
+.Xr postfix 1 Pq Pa ports/mail/postfix ,
+.Xr mini_sendmail 8 Pq Pa ports/mail/mini_sendmail
+.Sh HISTORY
+.Nm
+appeared in
+.Nx 1.4 .
+.Sh AUTHORS
+.An Perry E. Metzger Aq perry@piermont.com
+.Sh BUGS
+The entire reason this program exists is a crock.
+Instead, a command
+for how to submit mail should be standardized, and all the "behave
+differently if invoked with a different name" behavior of things like
+.Xr mailq 1
+should go away.
diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5
new file mode 100644
index 000000000000..d9967ea317e3
--- /dev/null
+++ b/share/man/man5/make.conf.5
@@ -0,0 +1,792 @@
+.\" Copyright (c) 2000
+.\" Mike W. Meyer
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 11, 2011
+.Dt MAKE.CONF 5
+.Os
+.Sh NAME
+.Nm make.conf
+.Nd system build information
+.Sh DESCRIPTION
+The file
+.Nm
+contains system-wide settings that will apply to every build using
+.Xr make 1
+and the standard
+.Pa sys.mk
+file.
+This is achieved as follows:
+.Xr make 1
+processes the system makefile
+.Pa sys.mk
+before any other file by default, and
+.Pa sys.mk
+includes
+.Nm .
+.Pp
+The file
+.Nm
+uses the standard makefile syntax.
+However,
+.Nm
+should not specify any dependencies to
+.Xr make 1 .
+Instead,
+.Nm
+is to set
+.Xr make 1
+variables that control the actions of other makefiles.
+.Pp
+The default location of
+.Nm
+is
+.Pa /etc/make.conf ,
+though an alternative location can be specified in the
+.Xr make 1
+variable
+.Va __MAKE_CONF .
+You may need to override the location of
+.Nm
+if the system-wide settings are not suitable for a particular build.
+For instance, setting
+.Va __MAKE_CONF
+to
+.Pa /dev/null
+effectively resets all build controls to their defaults.
+.Pp
+The primary purpose of
+.Nm
+is to control the compilation of the
+.Fx
+sources, documentation, and ported applications,
+which are usually found in
+.Pa /usr/src ,
+.Pa /usr/doc ,
+and
+.Pa /usr/ports .
+As a rule, the system administrator creates
+.Nm
+when the values of certain control variables need to be changed
+from their defaults.
+.Pp
+The system build procedures occur in four broad areas:
+the world, the kernel, documentation and ports.
+Variables set in
+.Nm
+may be applicable in one, two, or all four of these areas.
+In addition, control variables can be specified
+for a particular build via the
+.Fl D
+option of
+.Xr make 1
+or in
+.Xr environ 7 .
+.Pp
+The following lists provide a name and short description for each
+variable you can use during the indicated builds.
+The values of
+variables flagged as
+.Vt bool
+are ignored; the variable being
+set at all (even to
+.Dq Li FALSE
+or
+.Dq Li NO )
+causes it to
+be treated as if it were set.
+.Pp
+The following list provides a name and short description for variables
+that are used for all builds, or are used by the
+.Pa makefiles
+for things other than builds.
+.Bl -tag -width Ar
+.It Va ALWAYS_CHECK_MAKE
+.Pq Vt bool
+Instructs the top-level makefile in the source tree (normally
+.Pa /usr/src )
+to always check if
+.Xr make 1
+is up-to-date.
+Normally this is only done for the world and buildworld targets to handle
+upgrades from older versions of
+.Fx .
+.It Va CFLAGS
+.Pq Vt str
+Controls the compiler setting when compiling C code.
+Optimization levels other than
+.Fl O
+and
+.Fl O2
+are not supported.
+.Va BDECFLAGS
+is provided as a set of
+.Xr gcc 1
+settings suggested by
+.An "Bruce Evans" Aq bde@FreeBSD.org
+for developing and testing changes.
+They can be used, if set, by:
+.Bd -literal -offset indent
+CFLAGS+=${BDECFLAGS}
+.Ed
+.It Va CPUTYPE
+.Pq Vt str
+Controls which processor should be targeted for generated
+code.
+This controls processor-specific optimizations in
+certain code (currently only OpenSSL) as well as modifying
+the value of
+.Va CFLAGS
+and
+.Va COPTFLAGS
+to contain the appropriate optimization directive to
+.Xr gcc 1 .
+The automatic setting of
+.Va CFLAGS
+and
+.Va COPTFLAGS
+may be overridden using the
+.Va NO_CPU_CFLAGS
+and
+.Va NO_CPU_COPTFLAGS
+variables, respectively.
+Refer to
+.Pa /usr/share/examples/etc/make.conf
+for a list of recognized
+.Va CPUTYPE
+options.
+.It Va CVS_UPDATE
+.Pq Vt bool
+Set this to use
+.Xr cvs 1
+to update your
+.Pa src , ports
+and
+.Pa doc
+trees with
+.Dq Li "make update" .
+.It Va CXXFLAGS
+.Pq Vt str
+Controls the compiler settings when compiling C++ code.
+.Va CXXFLAGS
+is initially set to the value of
+.Va CFLAGS .
+If you want to
+add to the
+.Va CXXFLAGS
+value, use
+.Dq Li +=
+instead of
+.Dq Li = .
+.It Va DOCSUPFILE
+.Pq Vt str
+The documentation
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+For example,
+.Pa /usr/share/examples/cvsup/doc-supfile .
+.It Va INSTALL
+.Pq Vt str
+the default install command.
+To install only files for which the target differs or does not exist, use
+.Bd -literal -offset indent
+INSTALL="install -C"
+.Ed
+Note that some makefiles (including those in
+.Pa /usr/share/mk )
+may hardcode options for the supplied install command.
+.It Va LOCAL_DIRS
+.Pq Vt str
+List any directories that should be entered when doing
+make's in
+.Pa /usr/src
+in this variable.
+.It Va MAKE_SHELL
+.Pq Vt str
+Controls the shell used internally by
+.Xr make 1
+to process the command scripts in makefiles.
+.Xr sh 1 ,
+.Xr ksh 1 ,
+and
+.Xr csh 1
+all currently supported.
+.Pp
+.Dl "MAKE_SHELL?=sh"
+.It Va MTREE_FOLLOWS_SYMLINKS
+.Pq Vt str
+Set this to
+.Dq Fl L
+to cause
+.Xr mtree 8
+to follow symlinks.
+.It Va NO_CPU_CFLAGS
+.Pq Vt str
+Setting this variable will prevent CPU specific compiler flags
+from being automatically added to
+.Va CFLAGS
+during compile time.
+.It Va NO_CPU_COPTFLAGS
+.Pq Vt str
+Setting this variable will prevent CPU specific compiler flags
+from being automatically added to
+.Va COPTFLAGS
+during compile time.
+.It Va NO_DOCUPDATE
+.Pq Vt bool
+Set this to not update the doc tree during
+.Dq Li "make update" .
+.It Va NO_PORTSUPDATE
+.Pq Vt bool
+Set this to not update the ports tree during
+.Dq Li "make update" .
+.It Va NO_WWWUPDATE
+.Pq Vt bool
+Set this to not update the www tree during
+.Dq Li "make update" .
+.It Va PORTSSUPFILE
+.Pq Vt str
+The ports
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+For example,
+.Pa /usr/share/examples/cvsup/ports-supfile .
+.It Va SUP
+.Pq Vt str
+The location of the
+.Xr csup 1
+or
+.Xr cvsup 1
+command for
+.Dq Li "make update" .
+.It Va SUPFILE
+.Pq Vt str
+The first
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+For example,
+.Pa /usr/share/examples/cvsup/standard-supfile .
+.It Va SUPFILE1
+.Pq Vt str
+The second
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+.It Va SUPFILE2
+.Pq Vt str
+The third
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+.It Va SUPFLAGS
+.Pq Vt str
+The flag for the
+.Xr sup 1
+command when doing
+.Dq Li "make update" .
+This defaults to
+.Op Fl g L Ar 2 .
+.It Va SUPHOST
+.Pq Vt str
+The hostname of the sup server to use when doing
+.Dq Li "make update" .
+.It Va SUP_UPDATE
+.Pq Vt bool
+Set this to use
+.Xr cvsup 1
+to update your
+.Pa src , ports , doc
+and
+.Pa www
+trees with
+.Dq Li "make update" .
+.It Va SVN_UPDATE
+.Pq Vt bool
+Set this to use
+.Xr svn 1
+to update your
+.Pa src
+tree with
+.Dq Li "make update" .
+Note that since a subversion client is not included in the base system,
+you will need to set
+.Va SVN
+to the full path of a
+.Xr svn 1
+binary.
+.It Va WWWSUPFILE
+.Pq Vt str
+The www
+.Ar supfile
+to use when doing a
+.Dq Li "make update" .
+For example,
+.Pa /usr/share/examples/cvsup/www-supfile .
+.El
+.Ss "BUILDING THE KERNEL"
+The following list provides a name and short description for variables
+that are only used doing a kernel build:
+.Bl -tag -width Ar
+.It Va BOOTWAIT
+.Pq Vt int
+Controls the amount of time the kernel waits for a console keypress
+before booting the default kernel.
+The value is approximately milliseconds.
+Keypresses are accepted by the BIOS before booting from disk,
+making it possible to give custom boot parameters even when this is
+set to 0.
+.It Va COPTFLAGS
+.Pq Vt str
+Controls the compiler settings when building the
+kernel.
+Optimization levels above
+.Oo Fl O ( O2 , No ...\& ) Oc
+are not guaranteed to work.
+.It Va KERNCONF
+.Pq Vt str
+Controls which kernel configurations will be
+built by
+.Dq Li "${MAKE} buildkernel"
+and installed by
+.Dq Li "${MAKE} installkernel" .
+For example,
+.Bd -literal -offset indent
+KERNCONF=MINE DEBUG GENERIC OTHERMACHINE
+.Ed
+.Pp
+will build the kernels specified by the config files
+.Pa MINE , DEBUG , GENERIC ,
+and
+.Pa OTHERMACHINE ,
+and install the kernel specified by the config file
+.Pa MINE .
+It defaults to
+.Pa GENERIC .
+.It Va MODULES_OVERRIDE
+.Pq Vt str
+Set to a list of modules to build instead of all of them.
+.It Va NO_KERNELCLEAN
+.Pq Vt bool
+Set this to skip running
+.Dq Li "${MAKE} clean"
+during
+.Dq Li "${MAKE} buildkernel" .
+.It Va NO_KERNELCONFIG
+.Pq Vt bool
+Set this to skip running
+.Xr config 8
+during
+.Dq Li "${MAKE} buildkernel" .
+.It Va NO_KERNELDEPEND
+.Pq Vt bool
+Set this to skip running
+.Dq Li "${MAKE} depend"
+during
+.Dq Li "${MAKE} buildkernel" .
+.It Va NO_KERNELOBJ
+.Pq Vt bool
+Set this to skip running
+.Dq Li "${MAKE} obj"
+during
+.Dq Li "${MAKE} buildkernel" .
+.It Va NO_MODULES
+.Pq Vt bool
+Set to not build modules with the kernel.
+.It Va PORTS_MODULES
+Set this to the list of ports you wish to rebuild every time the kernel
+is built.
+.It Va WITHOUT_MODULES
+.Pq Vt str
+Set to a list of modules to exclude from the build.
+This provides a
+somewhat easier way to exclude modules you are certain you will never
+need than specifying
+.Va MODULES_OVERRIDE .
+This is applied
+.Em after
+.Va MODULES_OVERRIDE .
+.El
+.Ss "BUILDING THE WORLD"
+The following list provides a name and short description for variables
+that are used during the world build:
+.Bl -tag -width Ar
+.It Va BOOT_COMCONSOLE_PORT
+.Pq Vt str
+The port address to use for the console if the boot blocks have
+been configured to use a serial console instead of the keyboard/video card.
+.It Va BOOT_COMCONSOLE_SPEED
+.Pq Vt int
+The baud rate to use for the console if the boot blocks have
+been configured to use a serial console instead of the keyboard/video card.
+.It Va BOOT_PXELDR_ALWAYS_SERIAL
+.Pq Vt bool
+Compile in the code into
+.Xr pxeboot 8
+that forces the use of a serial console.
+This is analogous to the
+.Fl h
+option in
+.Xr boot 8
+blocks.
+.It Va BOOT_PXELDR_PROBE_KEYBOARD
+.Pq Vt bool
+Compile in the code into
+.Xr pxeboot 8
+that probes the keyboard.
+If no keyboard is found, boot with the dual console configuration.
+This is analogous to the
+.Fl D
+option in
+.Xr boot 8
+blocks.
+.It Va ENABLE_SUID_K5SU
+.Pq Vt bool
+Set this if you wish to use the ksu utility.
+Otherwise, it will be
+installed without the set-user-ID bit set.
+.It Va ENABLE_SUID_NEWGRP
+.Pq Vt bool
+Set this to install
+.Xr newgrp 1
+with the set-user-ID bit set.
+Otherwise,
+.Xr newgrp 1
+will not be able to change users' groups.
+.It Va ENABLE_SUID_SSH
+.Pq Vt bool
+Set this to install
+.Xr ssh 1
+with the set-user-ID bit turned on.
+.It Va LOADER_TFTP_SUPPORT
+.Pq Vt bool
+By default the
+.Xr pxeboot 8
+loader retrieves the kernel via NFS.
+Defining this and recompiling
+.Pa /usr/src/sys/boot
+will cause it to retrieve the kernel via TFTP.
+This allows
+.Xr pxeboot 8
+to load a custom BOOTP diskless kernel yet
+still mount the server's
+.Pa /
+rather than load the server's kernel.
+.It Va LOADER_FIREWIRE_SUPPORT
+.Pq Vt bool
+Defining this and recompiling
+.Pa /usr/src/sys/boot/i386
+will add
+.Xr dcons 4
+console driver to
+.Xr loader 8
+and allow access over FireWire(IEEE1394) using
+.Xr dconschat 8 .
+Currently, only i386 and amd64 are supported.
+.It Va MALLOC_PRODUCTION
+.Pq Vt bool
+Set this to disable assertions and statistics gathering in
+.Xr malloc 3 .
+It also defaults the A and J runtime options to off.
+Disabled by default on -CURRENT.
+.It Va MODULES_WITH_WORLD
+.Pq Vt bool
+Set to build modules with the system instead of the kernel.
+.It Va NO_CLEAN
+.Pq Vt bool
+Set this to disable cleaning during
+.Dq Li "make buildworld" .
+This should not be set unless you know what you are doing.
+.It Va NO_CLEANDIR
+.Pq Vt bool
+Set this to run
+.Dq Li "${MAKE} clean"
+instead of
+.Dq Li "${MAKE} cleandir" .
+.It Va NO_MANCOMPRESS
+.Pq Vt bool
+Set to install manual pages uncompressed.
+.It Va NO_SHARE
+.Pq Vt bool
+Set to not build in the
+.Pa share
+subdir.
+.It Va NO_SHARED
+.Pq Vt bool
+Set to build
+.Pa /bin
+and
+.Pa /sbin
+statically linked, this can be bad.
+If set, every utility that uses
+.Pa bsd.prog.mk
+will be linked statically.
+.It Va PPP_NO_NAT
+.Pq Vt bool
+Build
+.Xr ppp 8
+without support for network address translation (NAT).
+.It Va PPP_NO_NETGRAPH
+.Pq Vt bool
+Set to build
+.Xr ppp 8
+without support for Netgraph.
+.It Va PPP_NO_RADIUS
+.Pq Vt bool
+Set to build
+.Xr ppp 8
+without support for RADIUS.
+.It Va PPP_NO_SUID
+.Pq Vt bool
+Set to disable the installation of
+.Xr ppp 8
+as a set-user-ID root program.
+.It Va SENDMAIL_ADDITIONAL_MC
+.Pq Vt str
+Additional
+.Pa .mc
+files which should be built into
+.Pa .cf
+files at build time.
+The value should include the full path to the
+.Pa .mc
+file(s), e.g.,
+.Pa /etc/mail/foo.mc
+.Pa /etc/mail/bar.mc .
+.It Va SENDMAIL_ALIASES
+.Pq Vt str
+List of
+.Xr aliases 5
+files to rebuild when using
+.Pa /etc/mail/Makefile .
+The default value is
+.Pa /etc/mail/aliases .
+.It Va SENDMAIL_CFLAGS
+.Pq Vt str
+Flags to pass to the compile command when building
+.Xr sendmail 8 .
+The
+.Va SENDMAIL_*
+flags can be used to provide SASL support with setting such as:
+.Bd -literal -offset indent
+SENDMAIL_CFLAGS=-I/usr/local/include -DSASL
+SENDMAIL_LDFLAGS=-L/usr/local/lib
+SENDMAIL_LDADD=-lsasl
+.Ed
+.It Va SENDMAIL_CF_DIR
+.Pq Vt str
+Override the default location for the
+.Xr m4 1
+configuration files used to build a
+.Pa .cf
+file from a
+.Pa .mc
+file.
+.It Va SENDMAIL_DPADD
+.Pq Vt str
+Extra dependencies to add when building
+.Xr sendmail 8 .
+.It Va SENDMAIL_LDADD
+.Pq Vt str
+Flags to add to the end of the
+.Xr ld 1
+command when building
+.Xr sendmail 8 .
+.It Va SENDMAIL_LDFLAGS
+.Pq Vt str
+Flags to pass to the
+.Xr ld 1
+command when building
+.Xr sendmail 8 .
+.It Va SENDMAIL_M4_FLAGS
+.Pq Vt str
+Flags passed to
+.Xr m4 1
+when building a
+.Pa .cf
+file from a
+.Pa .mc
+file.
+.It Va SENDMAIL_MAP_PERMS
+.Pq Vt str
+Mode to use when generating alias and map database files using
+.Pa /etc/mail/Makefile .
+The default value is 0640.
+.It Va SENDMAIL_MAP_SRC
+.Pq Vt str
+Additional maps to rebuild when using
+.Pa /etc/mail/Makefile .
+The
+.Pa access ,
+.Pa bitdomain ,
+.Pa domaintable ,
+.Pa genericstable ,
+.Pa mailertable ,
+.Pa uucpdomain ,
+and
+.Pa virtusertable
+maps are always rebuilt if they exist.
+.It Va SENDMAIL_MAP_TYPE
+.Pq Vt str
+Database map type to use when generating map database files using
+.Pa /etc/mail/Makefile .
+The default value is hash.
+The alternative is btree.
+.It Va SENDMAIL_MC
+.Pq Vt str
+The default
+.Xr m4 1
+configuration file to use at install time.
+The value should include the full path to the
+.Pa .mc
+file, e.g.,
+.Pa /etc/mail/myconfig.mc .
+Use with caution as a make install will overwrite any existing
+.Pa /etc/mail/sendmail.cf .
+Note that
+.Va SENDMAIL_CF
+is now deprecated.
+.It Va SENDMAIL_SET_USER_ID
+.Pq Vt bool
+If set, install
+.Xr sendmail 8
+as a set-user-ID root binary instead of a set-group-ID binary
+and do not install
+.Pa /etc/mail/submit.{cf,mc} .
+Use of this flag is not recommended and the alternative advice in
+.Pa /etc/mail/README
+should be followed instead if at all possible.
+.It Va SENDMAIL_START_SCRIPT
+.Pq Vt str
+The script used by
+.Pa /etc/mail/Makefile
+to start, stop, and restart
+.Xr sendmail 8 .
+The default value is
+.Pa /etc/rc.sendmail .
+This value should match the
+.Dq Li mta_start_script
+setting in
+.Xr rc.conf 5 .
+.It Va SENDMAIL_SUBMIT_MC
+.Pq Vt str
+The default
+.Xr m4 1
+configuration file for mail submission
+to use at install time.
+The value should include the full path to the
+.Pa .mc
+file, e.g.,
+.Pa /etc/mail/mysubmit.mc .
+Use with caution as a make install will overwrite any existing
+.Pa /etc/mail/submit.cf .
+.It Va TOP_TABLE_SIZE
+.Pq Vt int
+.Xr top 1
+uses a hash table for the user names.
+The size of this hash can be tuned to match the number of local users.
+The table size should be a prime number
+approximately twice as large as the number of lines in
+.Pa /etc/passwd .
+The default number is 20011.
+.It Va WANT_FORCE_OPTIMIZATION_DOWNGRADE
+.Pq Vt int
+Causes the system compiler to be built such that it forces high optimization
+levels to a lower one.
+.Xr gcc 1
+.Fl O2
+and above is known to trigger known optimizer bugs at various
+times.
+The value assigned is the highest optimization value used.
+.El
+.Ss "BUILDING DOCUMENTATION"
+The following list provides a name and short description for variables
+that are used when building documentation.
+.Bl -tag -width ".Va PRINTERDEVICE"
+.It Va DISTDIR
+.Pq Vt str
+Where distfiles are kept.
+Normally, this is
+.Pa distfiles
+in
+.Va PORTSDIR .
+.It Va DOC_LANG
+.Pq Vt str
+The list of languages and encodings to build and install.
+.It Va PRINTERDEVICE
+.Pq Vt str
+The default format for system documentation, depends on your
+printer.
+This can be set to
+.Dq Li ascii
+for simple printers, or
+.Dq Li ps
+for postscript or graphics printers with a ghostscript
+filter, or both.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
+.It Pa /etc/make.conf
+.It Pa /usr/doc/Makefile
+.It Pa /usr/ports/Makefile
+.It Pa /usr/share/examples/etc/make.conf
+.It Pa /usr/share/mk/sys.mk
+.It Pa /usr/src/Makefile
+.It Pa /usr/src/Makefile.inc1
+.El
+.Sh SEE ALSO
+.Xr gcc 1 ,
+.Xr install 1 ,
+.Xr make 1 ,
+.Xr src.conf 5 ,
+.Xr environ 7 ,
+.Xr ports 7 ,
+.Xr sendmail 8
+.Sh HISTORY
+The
+.Nm
+file appeared sometime before
+.Fx 4.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Mike W. Meyer Aq mwm@mired.org .
+.Sh CAVEATS
+Note, that
+.Ev MAKEOBJDIRPREFIX
+and
+.Ev MAKEOBJDIR
+are environment variables and should not be set in
+.Nm
+but in make's environment.
+.Sh BUGS
+This manual page may occasionally be out of date with respect to
+the options currently available for use in
+.Nm .
+Please check the
+.Pa /usr/share/examples/etc/make.conf
+file for the latest options which are available.
diff --git a/share/man/man5/moduli.5 b/share/man/man5/moduli.5
new file mode 100644
index 000000000000..32d7989236f3
--- /dev/null
+++ b/share/man/man5/moduli.5
@@ -0,0 +1,159 @@
+.\" $OpenBSD: moduli.5,v 1.3 2001/06/24 18:50:52 provos Exp $
+.\"
+.\" Copyright 1997, 2000 William Allen Simpson <wsimpson@greendragon.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software designed by William Allen Simpson.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 28, 1997
+.Dt MODULI 5
+.Os
+.Sh NAME
+.Nm moduli
+.Nd system moduli file
+.Sh DESCRIPTION
+The
+.Nm
+file contains the system-wide Diffie-Hellman prime moduli for the
+.Xr photurisd 8
+and
+.Xr sshd 8
+programs.
+.Pp
+Each line in this file contains the following fields:
+.Va Time , Type , Tests , Tries , Size , Generator ,
+and
+.Va Modulus .
+The fields are separated by white space (tab or blank).
+.Bl -tag -width indent
+.It Va Time Pq Vt yyyymmddhhmmss
+Specifies the system time that the line was appended to the file.
+The value 00000000000000 means unknown (historic).
+.\"The file is sorted in ascending order.
+.It Va Type Pq Vt decimal
+Specifies the internal structure of the prime modulus.
+.Pp
+.Bl -tag -width indent -compact
+.It 0
+unknown;
+often learned from peer during protocol operation,
+and saved for later analysis.
+.It 1
+unstructured;
+a common large number.
+.It 2
+safe (p = 2q + 1);
+meets basic structural requirements.
+.It 3
+Schnorr.
+.It 4
+Sophie-Germaine (q = (p-1)/2);
+usually generated in the process of testing safe or strong primes.
+.It 5
+strong;
+useful for RSA public key generation.
+.El
+.It Xo
+.Va Tests Pq Vt decimal
+(bit field)
+.Xc
+Specifies the methods used in checking for primality.
+Usually, more than one test is used.
+.Pp
+.Bl -tag -width indent -compact
+.It 0
+not tested;
+often learned from peer during protocol operation,
+and saved for later analysis.
+.It 1
+composite;
+failed one or more tests.
+In this case, the highest bit specifies the test that failed.
+.It 2
+sieve;
+checked for division by a range of smaller primes.
+.It 4
+Miller-Rabin.
+.It 8
+Jacobi.
+.It 16
+Elliptic Curve.
+.El
+.It Va Tries Pq Vt decimal
+Depends on the value of the highest valid Test bit,
+where the method specified is:
+.Pp
+.Bl -tag -width indent -compact
+.It 0
+not tested
+(always zero).
+.It 1
+composite
+(irrelevant).
+.It 2
+sieve;
+number of primes sieved.
+Commonly on the order of 32,000,000.
+.It 4
+Miller-Rabin;
+number of M-R iterations.
+Commonly on the order of 32 to 64.
+.It 8
+Jacobi;
+unknown
+(always zero).
+.It 16
+Elliptic Curve;
+unused
+(always zero).
+.El
+.It Va Size Pq Vt decimal
+Specifies the number of significant bits.
+.It Va Generator Pq Vt "hex string"
+Specifies the best generator for a Diffie-Hellman exchange.
+0 = unknown or variable,
+2, 3, 5, etc.
+.It Va Modulus Pq Vt "hex string"
+The prime modulus.
+.El
+.Pp
+The file is searched for moduli that meet the appropriate
+.Va Time , Size
+and
+.Va Generator
+criteria.
+When more than one meet the criteria,
+the selection should be weighted toward newer moduli,
+without completely disqualifying older moduli.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/ssh/moduli" -compact
+.It Pa /etc/ssh/moduli
+.El
+.Sh SEE ALSO
+.Xr photurisd 8 ,
+.Xr sshd 8
diff --git a/share/man/man5/motd.5 b/share/man/man5/motd.5
new file mode 100644
index 000000000000..2ffbc9e419bf
--- /dev/null
+++ b/share/man/man5/motd.5
@@ -0,0 +1,43 @@
+.\" $NetBSD: motd.5,v 1.2 1994/12/28 18:58:53 glass Exp $
+.\"
+.\" This file is in the public domain.
+.\" $FreeBSD$
+.\"
+.Dd February 13, 1997
+.Dt MOTD 5
+.Os
+.Sh NAME
+.Nm motd
+.Nd file containing message(s) of the day
+.Sh DESCRIPTION
+The file
+.Pa /etc/motd
+is normally displayed by
+.Xr login 1
+after a user has logged in but before the shell is run.
+It is generally used for important system-wide announcements.
+During system startup, a line containing the kernel version string is
+prepended to this file.
+.Pp
+Individual users may suppress the display of this file by
+creating a file named
+.Dq Pa .hushlogin
+in their home directories or through
+.Xr login.conf 5 .
+.Sh FILES
+.Bl -tag -width $HOME/.hushlogin -compact
+.It Pa /etc/motd
+The message of the day.
+.It Pa $HOME/.hushlogin
+Suppresses output of
+.Pa /etc/motd .
+.El
+.Sh EXAMPLES
+.Bd -literal
+FreeBSD 2.1.6.1-RELEASE (GENERIC) #0: Sun Dec 29 03:08:31 PST 1996
+
+/home is full. Please cleanup your directories.
+.Ed
+.Sh SEE ALSO
+.Xr login 1 ,
+.Xr login.conf 5
diff --git a/share/man/man5/mqueuefs.5 b/share/man/man5/mqueuefs.5
new file mode 100644
index 000000000000..2431267a8e3e
--- /dev/null
+++ b/share/man/man5/mqueuefs.5
@@ -0,0 +1,124 @@
+.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 30, 2005
+.Dt MQUEUEFS 5
+.Os
+.Sh NAME
+.Nm mqueuefs
+.Nd POSIX message queue file system
+.Sh SYNOPSIS
+To link into kernel:
+.Pp
+.Cd "options P1003_1B_MQUEUE"
+.Pp
+To load as a kernel loadable module:
+.Pp
+.Dl "kldload mqueuefs"
+.Sh DESCRIPTION
+The
+.Nm
+module will permit the
+.Fx
+kernel to support
+.Tn POSIX
+message queue.
+The module contains system calls to manipulate
+.Tn POSIX
+message queues.
+It also contains a file system to implement a view for all message queues of
+the system.
+This helps users to keep track of their message queues and make
+it more easily usable without having to invent additional tools.
+.Pp
+The most common usage is as follows:
+.Pp
+.Dl "mount -t mqueuefs null /mnt/mqueue"
+.Pp
+where
+.Pa /mnt/mqueue
+is a mount point.
+.Pp
+It is possible to define an entry in
+.Pa /etc/fstab
+that looks similar to:
+.Bd -literal
+null /mnt/mqueue mqueuefs rw 0 0
+.Ed
+.Pp
+This will mount
+.Nm
+at the
+.Pa /mnt/mqueue
+mount point during system boot.
+Using
+.Pa /mnt/mqueue
+as a permanent mount point is not advised as its intention
+has always been to be a temporary mount point.
+See
+.Xr hier 7
+for more information on
+.Fx
+directory layout.
+.Pp
+Some common tools can be used on the file system, e.g.:
+.Xr cat 1 ,
+.Xr chmod 1 ,
+.Xr chown 8 ,
+.Xr ls 1 ,
+.Xr rm 1 ,
+etc.
+To use only the message queue system calls, it is not necessary for
+user to mount the file system, just load the module or compile it
+into the kernel.
+Manually creating a file, for example,
+.Dq Li "touch /mnt/mqueue/myqueue" ,
+will create a message queue named
+.Pa myqueue
+in the kernel, default
+message queue attributes will be applied to the queue.
+It is not
+advised to use this method to create a queue;
+it is better to use the
+.Xr mq_open 2
+system call to create a queue as it
+allows the user to specify different attributes.
+.Pp
+To see the queue's attributes, just read the file:
+.Pp
+.Dl "cat /mnt/mqueue/myqueue"
+.Sh SEE ALSO
+.Xr mq_open 2 ,
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr mount 8 ,
+.Xr umount 8
+.Sh AUTHORS
+This manual page was written by
+.An "David Xu" Aq davidxu@FreeBSD.org .
diff --git a/share/man/man5/msdosfs.5 b/share/man/man5/msdosfs.5
new file mode 100644
index 000000000000..933577aeb5a2
--- /dev/null
+++ b/share/man/man5/msdosfs.5
@@ -0,0 +1,69 @@
+.\" $FreeBSD$
+.\" Written by Tom Rhodes
+.\" This file is in the public domain.
+.\"
+.Dd August 22, 2007
+.Dt MSDOSFS 5
+.Os
+.Sh NAME
+.Nm msdosfs
+.Nd MS-DOS file system
+.Sh SYNOPSIS
+.Cd "options MSDOSFS"
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to read and write
+.Tn MS-DOS
+based file systems.
+.Pp
+The most common usage follows:
+.Pp
+.Dl "mount -t msdosfs /dev/ad0sN /mnt"
+.Pp
+where
+.Ar N
+is the partition number and
+.Pa /mnt
+is a mount point.
+Some users tend to create a
+.Pa /dos
+directory for
+.Nm
+mount points.
+This helps to keep better track of the file system,
+and make it more easily accessible.
+.Pp
+It is possible to define an entry in
+.Pa /etc/fstab
+that looks similar to:
+.Bd -literal
+/dev/ad0sN /dos msdosfs rw 0 0
+.Ed
+.Pp
+This will mount an
+.Tn MS-DOS
+based partition at the
+.Pa /dos
+mount point during system boot.
+Using
+.Pa /mnt
+as a permanent mount point is not advised as its intention
+has always been to be a temporary mount point for floppy and
+ZIP disks.
+See
+.Xr hier 7
+for more information on
+.Fx
+directory layout.
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr unmount 2 ,
+.Xr mount 8 ,
+.Xr mount_msdosfs 8 ,
+.Xr umount 8
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man5/networks.5 b/share/man/man5/networks.5
new file mode 100644
index 000000000000..386ee7dd1021
--- /dev/null
+++ b/share/man/man5/networks.5
@@ -0,0 +1,89 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)networks.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt NETWORKS 5
+.Os
+.Sh NAME
+.Nm networks
+.Nd network name data base
+.Sh DESCRIPTION
+The
+.Nm
+file contains information regarding
+the known networks which comprise the
+.Tn DARPA
+Internet.
+For each network a single line should be present with the following information:
+.Bd -unfilled -offset indent
+official network name
+network number
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or tab characters.
+A ``#'' indicates the beginning of a comment; characters up to the end of
+the line are not interpreted by routines which search the file.
+This file is normally created from the official network data base
+maintained at the Network Information Control Center
+.Pq Tn NIC ,
+though local
+changes may be required to bring it up to date regarding unofficial aliases
+and/or unknown networks.
+.Pp
+Network numbers may be specified in the conventional
+``.'' (dot) notation using the
+.Xr inet_network 3
+routine
+from the Internet address manipulation library,
+.Xr inet 3 .
+Network names may contain any printable character other than a field
+delimiter, newline, or comment character.
+.Sh FILES
+.Bl -tag -width /etc/networks -compact
+.It Pa /etc/networks
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr getnetent 3
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
+.Sh BUGS
+A name server should be used instead of a static file.
diff --git a/share/man/man5/nsmb.conf.5 b/share/man/man5/nsmb.conf.5
new file mode 100644
index 000000000000..2548a05f8c92
--- /dev/null
+++ b/share/man/man5/nsmb.conf.5
@@ -0,0 +1,160 @@
+.\" Copyright (c) 2003
+.\" Originally written by Sergey A. Osokin
+.\" Rewritten by Tom Rhodes
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 19, 2010
+.Dt NSMB.CONF 5
+.Os
+.Sh NAME
+.Nm nsmb.conf
+.Nd configuration file for
+.Tn SMB
+requests
+.Sh DESCRIPTION
+The
+.Nm
+file contains information about the computers, users, and shares
+or mount points for the
+.Tn SMB
+network protocol.
+.Pp
+The configuration hierarchy is made up of several sections,
+each section containing a few or several lines of parameters
+and their assigned values.
+Each of these sections must begin with a section name enclosed within
+square brackets, similar to:
+.Pp
+.D1 Bq Ar section_name
+.Pp
+The end of each section is marked by either the start of a new section,
+or by the abrupt ending of the file, commonly referred to as the
+.Tn EOF .
+Each section may contain zero or more parameters such as:
+.Pp
+.D1 Bq Ar section_name
+.D1 Ar key Ns = Ns Ar value
+.Pp
+where
+.Ar key
+represents a parameter name, and
+.Ar value
+would be the parameter's assigned value.
+.Pp
+The
+.Tn SMB
+library uses the following information for section names:
+.Pp
+.Bl -tag -width indent -compact
+.It Ic A)
+.Bq Li default
+.It Ic B)
+.Bq Ar SERVER
+.It Ic C)
+.Bq Ar SERVER : Ns Ar USER
+.It Ic D)
+.Op Ar SERVER : Ns Ar USER : Ns Ar SHARE
+.El
+.Pp
+Possible keywords may include:
+.Bl -column ".Va retry_count" ".Sy Section"
+.It Sy "Keyword Section Comment"
+.It Sy " A B C D"
+.It Va addr Ta "- + - -" Ta "IP or IPX address of SMB server"
+.It Va charsets Ta "- + + +" Ta "local:remote charset pair"
+.It Va nbns Ta "+ + - -" Ta "address of NetBIOS name server (WINS)"
+.It Va nbscope Ta "+ + - -" Ta "NetBIOS scope"
+.It Va nbtimeout Ta "+ + - -" Ta "timeout for NetBIOS name servers"
+.It Va password Ta "- - + +" Ta "plain text or simple encrypted password used to access the given share"
+.It Va retry_count Ta "+ + - -" Ta "number of retries before connection is marked as broken"
+.It Va timeout Ta "+ + - -" Ta "SMB request timeout"
+.It Va workgroup Ta "+ + + +" Ta "workgroup name"
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/nsmb.conf"
+.It Pa /etc/nsmb.conf
+The default remote mount-point configuration file.
+.Pa "~/nsmb.conf"
+.It Pa ~/nsmb.conf
+The user specific remote mount-point configuration file.
+.El
+.Sh EXAMPLES
+What follows is a sample configuration file which may,
+or may not match your environment:
+.Bd -literal -offset indent
+# Configuration file for example.com
+[default]
+workgroup=SALES
+# The 'FSERVER' is an NT server.
+[FSERVER]
+charsets=koi8-r:cp866
+addr=fserv.example.com
+# User specific data for FSERVER
+[FSERVER:MYUSER]
+password=$$16144562c293a0314e6e1
+.Ed
+.Pp
+All lines which begin with the
+.Ql #
+character are comments and will not be parsed.
+The
+.Dq Li default
+section describes the default workgroup or domain, in this case
+.Dq Li SALES .
+The next section depicted here as
+.Dq Li FSERVER ,
+defines a server section and then assigns it a charset which is only
+required when Cyrillic characters are not used.
+The hostname value,
+.Dq Li fserv.example.com ,
+is also assigned in this section.
+.Dq Li FSERVER:USER ,
+defines the user settings and is useful for saving the password used
+during a specific connection.
+The password may be plaintext or obfuscated using simple encryption.
+The simple encrypted password starts with the `$$1' symbols.
+Warning: the encryption function is very weak and intended only to hide
+clear text passwords.
+If the use of simple encryption is desired, the following command may be
+used on a password:
+.Bd -literal -offset indent
+smbutil crypt
+.Ed
+.Sh COMPATIBILITY
+At the time of this writing, the
+.Tn IPX
+protocol remains unsupported.
+Future
+.Fx
+releases are expected to support this.
+.Sh SEE ALSO
+.Xr smbutil 1 ,
+.Xr mount_smbfs 8
+.Sh AUTHORS
+This manual page was written by
+.An -nosplit
+.An Sergey Osokin Aq osa@FreeBSD.org
+and
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man5/nsswitch.conf.5 b/share/man/man5/nsswitch.conf.5
new file mode 100644
index 000000000000..c28720b2f164
--- /dev/null
+++ b/share/man/man5/nsswitch.conf.5
@@ -0,0 +1,386 @@
+.\" $NetBSD: nsswitch.conf.5,v 1.14 1999/03/17 20:19:47 garbled Exp $
+.\"
+.\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Luke Mewburn.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+.\" OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+.\" TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 4, 2010
+.Dt NSSWITCH.CONF 5
+.Os
+.Sh NAME
+.Nm nsswitch.conf
+.Nd name-service switch configuration file
+.Sh DESCRIPTION
+The
+.Nm
+file specifies how the
+.Xr nsdispatch 3
+(name-service switch dispatcher) routines in the C library should operate.
+.Pp
+The configuration file controls how a process looks up various databases
+containing information regarding hosts, users (passwords), groups, etc.
+Each database comes from a source (such as local files, DNS,
+.Tn NIS ,
+and cache), and the order to look up the sources is specified in
+.Nm .
+.Pp
+Each entry in
+.Nm
+consists of a database name, and a space separated list of sources.
+Each source can have an optional trailing criterion that determines
+whether the next listed source is used, or the search terminates at
+the current source.
+Each criterion consists of one or more status codes, and actions to
+take if that status code occurs.
+.Ss Sources
+The following sources are implemented:
+.Pp
+.Bl -tag -width Source -compact
+.It Sy Source
+.Sy Description
+.It files
+Local files, such as
+.Pa /etc/hosts ,
+and
+.Pa /etc/passwd .
+.It db
+Local database.
+.It dns
+Internet Domain Name System.
+.Dq hosts
+and
+.Sq networks
+use
+.Sy IN
+class entries, all other databases use
+.Sy HS
+class (Hesiod) entries.
+.It nis
+NIS (formerly YP)
+.It compat
+support
+.Sq +/-
+in the
+.Dq passwd
+and
+.Dq group
+databases.
+If this is present, it must be the only source for that entry.
+.It cache
+makes use of the
+.Xr nscd 8
+daemon.
+.El
+.Ss Databases
+The following databases are used by the following C library functions:
+.Pp
+.Bl -tag -width networks -compact
+.It Sy Database
+.Sy "Used by"
+.It group
+.Xr getgrent 3 ,
+.Xr getgrent_r 3 ,
+.Xr getgrgid_r 3 ,
+.Xr getgrnam_r 3 ,
+.Xr setgrent 3 ,
+.Xr endgrent 3
+.It hosts
+.Xr getaddrinfo 3 ,
+.Xr gethostbyaddr 3 ,
+.Xr gethostbyaddr_r 3 ,
+.Xr gethostbyname 3 ,
+.Xr gethostbyname2 3 ,
+.Xr gethostbyname_r 3 ,
+.Xr getipnodebyaddr 3 ,
+.Xr getipnodebyname 3
+.It networks
+.Xr getnetbyaddr 3 ,
+.Xr getnetbyaddr_r 3 ,
+.Xr getnetbyname 3 ,
+.Xr getnetbyname_r 3
+.It passwd
+.Xr getpwent 3 ,
+.Xr getpwent_r 3 ,
+.Xr getpwnam_r 3 ,
+.Xr getpwuid_r 3 ,
+.Xr setpwent 3 ,
+.Xr endpwent 3
+.It shells
+.Xr getusershell 3
+.It services
+.Xr getservent 3
+.It rpc
+.Xr getrpcbyname 3 ,
+.Xr getrpcbynumber 3 ,
+.Xr getrpcent 3
+.It proto
+.Xr getprotobyname 3 ,
+.Xr getprotobynumber 3 ,
+.Xr getprotoent 3
+.It netgroup
+.Xr getnetgrent 3 ,
+.Xr setnetgrent 3 ,
+.Xr innetgr 3
+.El
+.Ss Status codes
+The following status codes are available:
+.Pp
+.Bl -tag -width tryagain -compact
+.It Sy Status
+.Sy Description
+.It success
+The requested entry was found.
+.It notfound
+The entry is not present at this source.
+.It tryagain
+The source is busy, and may respond to retries.
+.It unavail
+The source is not responding, or entry is corrupt.
+.El
+.Ss Actions
+For each of the status codes, one of two actions is possible:
+.Pp
+.Bl -tag -width continue -compact
+.It Sy Action
+.Sy Description
+.It continue
+Try the next source
+.It return
+Return with the current result
+.El
+.Ss Format of file
+A
+.Tn BNF
+description of the syntax of
+.Nm
+is:
+.Pp
+.Bl -tag -width <criterion> -compact
+.It <entry>
+::=
+<database> ":" [<source> [<criteria>]]*
+.It <criteria>
+::=
+"[" <criterion>+ "]"
+.It <criterion>
+::=
+<status> "=" <action>
+.It <status>
+::=
+"success" | "notfound" | "unavail" | "tryagain"
+.It <action>
+::=
+"return" | "continue"
+.El
+.Pp
+Each entry starts on a new line in the file.
+A
+.Sq #
+delimits a comment to end of line.
+Blank lines are ignored.
+A
+.Sq \e
+at the end of a line escapes the newline, and causes the next line to
+be a continuation of the current line.
+All entries are case-insensitive.
+.Pp
+The default criteria is to return on
+.Dq success ,
+and continue on anything else (i.e,
+.Li "[success=return notfound=continue unavail=continue tryagain=continue]" ) .
+.Ss Cache
+You can enable caching for the particular database by specifying
+.Dq cache
+as the first source in the
+.Xr nsswitch.conf 5
+file.
+You should also enable caching for this database in
+.Xr nscd.conf 5 .
+If for the particular query
+.Dq cache
+source returns success, no further sources are queried.
+On the other hand, if there are no previously cached data, the
+query result will be placed into the cache right after
+all other sources are processed.
+Note, that
+.Dq cache
+requires
+.Xr nscd 8
+daemon to be running.
+.Ss Compat mode: +/- syntax
+In historical multi-source implementations, the
+.Sq +
+and
+.Sq -
+characters are used to specify the importing of user password and
+group information from
+.Tn NIS .
+Although
+.Nm
+provides alternative methods of accessing distributed sources such as
+.Tn NIS ,
+specifying a sole source of
+.Dq compat
+will provide the historical behaviour.
+.Pp
+An alternative source for the information accessed via
+.Sq +/-
+can be used by specifying
+.Dq passwd_compat: source .
+.Dq source
+in this case can be
+.Sq dns ,
+.Sq nis ,
+or
+any other source except for
+.Sq files
+and
+.Sq compat .
+.Ss Notes
+Historically, many of the databases had enumeration functions, often of
+the form
+.Fn getXXXent .
+These made sense when the databases were in local files, but do not make
+sense or have lesser relevance when there are possibly multiple sources,
+each of an unknown size.
+The interfaces are still provided for compatibility, but the source
+may not be able to provide complete entries, or duplicate entries may
+be retrieved if multiple sources that contain similar information are
+specified.
+.Pp
+To ensure compatibility with previous and current implementations, the
+.Dq compat
+source must appear alone for a given database.
+.Ss Default source lists
+If, for any reason,
+.Nm
+does not exist, or it has missing or corrupt entries,
+.Xr nsdispatch 3
+will default to an entry of
+.Dq files
+for the requested database.
+Exceptions are:
+.Pp
+.Bl -tag -width services_compat -compact
+.It Sy Database
+.Sy "Default source list"
+.It group
+compat
+.It group_compat
+nis
+.It hosts
+files dns
+.It passwd
+compat
+.It passwd_compat
+nis
+.It services
+compat
+.It services_compat
+nis
+.El
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/nsswitch.conf
+The file
+.Nm
+resides in
+.Pa /etc .
+.El
+.Sh EXAMPLES
+To lookup hosts in cache, then in
+.Pa /etc/hosts
+and then from the DNS, and lookup user information from
+.Tn NIS
+then files, use:
+.Pp
+.Bl -tag -width passwd: -compact
+.It hosts:
+cache files dns
+.It passwd:
+nis [notfound=return] files
+.It group:
+nis [notfound=return] files
+.El
+.Pp
+The criteria
+.Dq [notfound=return]
+sets a policy of "if the user is notfound in nis, do not try files."
+This treats nis as the authoritative source of information, except
+when the server is down.
+.Sh NOTES
+If system got compiled with
+.Va WITHOUT_NIS
+you have to remove
+.Sq nis
+entries.
+.Pp
+.Fx Ns 's
+.Lb libc
+provides stubs for compatibility with NSS modules
+written for the
+.Tn GNU
+C Library
+.Nm nsswitch
+interface.
+However, these stubs only support the use of the
+.Dq Li passwd
+and
+.Dq Li group
+databases.
+.Sh SEE ALSO
+.Xr nsdispatch 3 ,
+.Xr nscd.conf 5 ,
+.Xr resolv.conf 5 ,
+.Xr nscd 8 ,
+.Xr named 8 ,
+.Xr ypbind 8
+.Sh HISTORY
+The
+.Nm
+file format first appeared in
+.Fx 5.0 .
+It was imported from the
+.Nx
+Project, where it appeared first in
+.Nx 1.4 .
+.Sh AUTHORS
+Luke Mewburn
+.Aq lukem@netbsd.org
+wrote this freely distributable name-service switch implementation,
+using ideas from the
+.Tn ULTRIX
+.Xr svc.conf 5
+and
+.Tn Solaris
+.Xr nsswitch.conf 4
+manual pages.
diff --git a/share/man/man5/nullfs.5 b/share/man/man5/nullfs.5
new file mode 100644
index 000000000000..653711b12bb2
--- /dev/null
+++ b/share/man/man5/nullfs.5
@@ -0,0 +1,75 @@
+.\"
+.\" Copyright (c) 2008 Daniel Gerzo
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2008
+.Dt NULLFS 5
+.Os
+.Sh NAME
+.Nm nullfs
+.Nd "null file system"
+.Sh SYNOPSIS
+To enable support for
+.Nm ,
+place the following line in the kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options NULLFS"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+nullfs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to mount a loopback file system sub-tree.
+.Sh EXAMPLES
+To mount a
+.Nm
+file system:
+.Pp
+.Dl "mount_nullfs /usr/ports /home/devel/ports"
+.Sh SEE ALSO
+.Xr fstab 5 ,
+.Xr mount_nullfs 8
+.Sh HISTORY
+The
+.Nm
+layer first appeared in
+.Bx 4.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+kernel implementation was written by
+.An John Heideman .
+.Pp
+This manual page was written by
+.An Daniel Gerzo Aq danger@FreeBSD.org .
diff --git a/share/man/man5/passwd.5 b/share/man/man5/passwd.5
new file mode 100644
index 000000000000..228c4e33a32e
--- /dev/null
+++ b/share/man/man5/passwd.5
@@ -0,0 +1,451 @@
+.\" $NetBSD: passwd.5,v 1.12.2.2 1999/12/17 23:14:50 he Exp $
+.\"
+.\" Copyright (c) 1988, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\" Portions Copyright (c) 1994, Jason Downs. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)passwd.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd May 8, 2007
+.Dt PASSWD 5
+.Os
+.Sh NAME
+.Nm passwd ,
+.Nm master.passwd
+.Nd format of the password file
+.Sh DESCRIPTION
+The
+.Nm
+files are the local source of password information.
+They can be used in conjunction with the Hesiod domains
+.Sq Li passwd
+and
+.Sq Li uid ,
+and the
+.Tn NIS
+maps
+.Sq Li passwd.byname ,
+.Sq Li passwd.byuid ,
+.Sq Li master.passwd.byname ,
+and
+.Sq Li master.passwd.byuid ,
+as controlled by
+.Xr nsswitch.conf 5 .
+.Pp
+For consistency, none of these files should ever be modified
+manually.
+.Pp
+The
+.Nm master.passwd
+file is readable only by root, and consists of newline separated
+records, one per user, containing ten colon
+.Pq Ql \&:
+separated
+fields.
+These fields are as follows:
+.Bl -tag -width ".Ar password" -offset indent
+.It Ar name
+User's login name.
+.It Ar password
+User's
+.Em encrypted
+password.
+.It Ar uid
+User's id.
+.It Ar gid
+User's login group id.
+.It Ar class
+User's login class.
+.It Ar change
+Password change time.
+.It Ar expire
+Account expiration time.
+.It Ar gecos
+General information about the user.
+.It Ar home_dir
+User's home directory.
+.It Ar shell
+User's login shell.
+.El
+.Pp
+The
+.Nm
+file is generated from the
+.Nm master.passwd
+file by
+.Xr pwd_mkdb 8 ,
+has the
+.Ar class ,
+.Ar change ,
+and
+.Ar expire
+fields removed, and the
+.Ar password
+field replaced by a
+.Ql *
+character.
+.Pp
+The
+.Ar name
+field is the login used to access the computer account, and the
+.Ar uid
+field is the number associated with it.
+They should both be unique
+across the system (and often across a group of systems) since they
+control file access.
+.Pp
+While it is possible to have multiple entries with identical login names
+and/or identical user id's, it is usually a mistake to do so.
+Routines
+that manipulate these files will often return only one of the multiple
+entries, and that one by random selection.
+.Pp
+The login name must never begin with a hyphen
+.Pq Ql - ;
+also, it is strongly
+suggested that neither upper-case characters or dots
+.Pq Ql \&.
+be part
+of the name, as this tends to confuse mailers.
+No field may contain a
+colon
+.Pq Ql \&:
+as this has been used historically to separate the fields
+in the user database.
+.Pp
+In the
+.Nm master.passwd
+file,
+the
+.Ar password
+field is the
+.Em encrypted
+form of the password, see
+.Xr crypt 3 .
+If the
+.Ar password
+field is empty, no password will be required to gain access to the
+machine.
+This is almost invariably a mistake, so authentication components
+such as PAM can forcibly disallow remote access to passwordless accounts.
+Because this file contains the encrypted user passwords, it should
+not be readable by anyone without appropriate privileges.
+.Pp
+A password of
+.Ql *
+indicates that
+password authentication is disabled for that account
+(logins through other forms of
+authentication, e.g., using
+.Xr ssh 1
+keys, will still work).
+The field only contains encrypted passwords, and
+.Ql *
+can never be the result of encrypting a password.
+.Pp
+An encrypted password prefixed by
+.Ql *LOCKED*
+means that the account is temporarily locked out
+and no one can log into it using any authentication.
+For a convenient command-line interface to account locking, see
+.Xr pw 8 .
+.Pp
+The
+.Ar group
+field is the group that the user will be placed in upon login.
+Since this system supports multiple groups (see
+.Xr groups 1 )
+this field currently has little special meaning.
+.Pp
+The
+.Ar class
+field is a key for a user's login class.
+Login classes
+are defined in
+.Xr login.conf 5 ,
+which is a
+.Xr termcap 5
+style database of user attributes, accounting, resource,
+and environment settings.
+.Pp
+The
+.Ar change
+field is the number of seconds from the epoch,
+.Dv UTC ,
+until the
+password for the account must be changed.
+This field may be left empty to turn off the password aging feature.
+.Pp
+The
+.Ar expire
+field is the number of seconds from the epoch,
+.Dv UTC ,
+until the
+account expires.
+This field may be left empty to turn off the account aging feature.
+.Pp
+The
+.Ar gecos
+field normally contains comma
+.Pq Ql \&,
+separated subfields as follows:
+.Pp
+.Bl -tag -width ".Ar office" -offset indent -compact
+.It Ar name
+user's full name
+.It Ar office
+user's office number
+.It Ar wphone
+user's work phone number
+.It Ar hphone
+user's home phone number
+.El
+.Pp
+The full
+.Ar name
+may contain an ampersand
+.Pq Ql &
+which will be replaced by
+the capitalized login
+.Ar name
+when the
+.Ar gecos
+field is displayed or used
+by various programs such as
+.Xr finger 1 ,
+.Xr sendmail 8 ,
+etc.
+.Pp
+The
+.Ar office
+and phone number subfields are used by the
+.Xr finger 1
+program, and possibly other applications.
+.Pp
+The user's home directory,
+.Ar home_dir ,
+is the full
+.Ux
+path name where the user
+will be placed on login.
+.Pp
+The
+.Ar shell
+field is the command interpreter the user prefers.
+If there is nothing in the
+.Ar shell
+field, the Bourne shell
+.Pq Pa /bin/sh
+is assumed.
+The conventional way to disable logging into an account once and for all,
+as it is done for system accounts,
+is to set its
+.Ar shell
+to
+.Xr nologin 8 .
+.Sh HESIOD SUPPORT
+If
+.Sq Li dns
+is specified for the
+.Sq Li passwd
+database in
+.Xr nsswitch.conf 5 ,
+then
+.Nm
+lookups occur from the
+.Sq Li passwd
+Hesiod domain.
+.Sh NIS SUPPORT
+If
+.Sq Li nis
+is specified for the
+.Sq Li passwd
+database in
+.Xr nsswitch.conf 5 ,
+then
+.Nm
+lookups occur from the
+.Sq Li passwd.byname ,
+.Sq Li passwd.byuid ,
+.Sq Li master.passwd.byname ,
+and
+.Sq Li master.passwd.byuid
+.Tn NIS
+maps.
+.Sh COMPAT SUPPORT
+If
+.Sq Li compat
+is specified for the
+.Sq Li passwd
+database, and either
+.Sq Li dns
+or
+.Sq Li nis
+is specified for the
+.Sq Li passwd_compat
+database in
+.Xr nsswitch.conf 5 ,
+then the
+.Nm
+file also supports standard
+.Sq Li + Ns / Ns Li -
+exclusions and inclusions, based on user names and netgroups.
+.Pp
+Lines beginning with a
+.Ql -
+(minus sign) are entries marked as being excluded
+from any following inclusions, which are marked with a
+.Ql +
+(plus sign).
+.Pp
+If the second character of the line is a
+.Ql @
+(at sign), the operation
+involves the user fields of all entries in the netgroup specified by the
+remaining characters of the
+.Ar name
+field.
+Otherwise, the remainder of the
+.Ar name
+field is assumed to be a specific user name.
+.Pp
+The
+.Ql +
+token may also be alone in the
+.Ar name
+field, which causes all users from either the Hesiod domain
+.Nm
+(with
+.Sq Li passwd_compat: dns )
+or
+.Sq Li passwd.byname
+and
+.Sq Li passwd.byuid
+.Tn NIS
+maps (with
+.Sq Li passwd_compat: nis )
+to be included.
+.Pp
+If the entry contains non-empty
+.Ar uid
+or
+.Ar gid
+fields, the specified numbers will override the information retrieved
+from the Hesiod domain or the
+.Tn NIS
+maps.
+As well, if the
+.Ar gecos ,
+.Ar dir
+or
+.Ar shell
+entries contain text, it will override the information included via
+Hesiod or
+.Tn NIS .
+On some systems, the
+.Ar passwd
+field may also be overridden.
+.Sh FILES
+.Bl -tag -width ".Pa /etc/master.passwd" -compact
+.It Pa /etc/passwd
+.Tn ASCII
+password file, with passwords removed
+.It Pa /etc/pwd.db
+.Xr db 3 Ns -format
+password database, with passwords removed
+.It Pa /etc/master.passwd
+.Tn ASCII
+password file, with passwords intact
+.It Pa /etc/spwd.db
+.Xr db 3 Ns -format
+password database, with passwords intact
+.El
+.Sh COMPATIBILITY
+The password file format has changed since
+.Bx 4.3 .
+The following awk script can be used to convert your old-style password
+file into a new style password file.
+The additional fields
+.Ar class ,
+.Ar change
+and
+.Ar expire
+are added, but are turned off by default.
+Class is currently not implemented, but change and expire are; to set them,
+use the current day in seconds from the epoch + whatever number of seconds
+of offset you want.
+.Bd -literal -offset indent
+BEGIN { FS = ":"}
+{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 }
+.Ed
+.Sh SEE ALSO
+.Xr chpass 1 ,
+.Xr login 1 ,
+.Xr passwd 1 ,
+.Xr crypt 3 ,
+.Xr getpwent 3 ,
+.Xr login.conf 5 ,
+.Xr netgroup 5 ,
+.Xr nsswitch.conf 5 ,
+.Xr adduser 8 ,
+.Xr nologin 8 ,
+.Xr pw 8 ,
+.Xr pwd_mkdb 8 ,
+.Xr vipw 8 ,
+.Xr yp 8
+.Pp
+.%T "Managing NFS and NIS"
+(O'Reilly & Associates)
+.Sh HISTORY
+A
+.Nm
+file format appeared in
+.At v6 .
+.Pp
+The
+.Tn NIS
+.Nm
+file format first appeared in SunOS.
+.Pp
+The Hesiod support first appeared in
+.Fx 4.1 .
+It was imported from the
+.Nx
+Project, where it first appeared in
+.Nx 1.4 .
+.Sh BUGS
+User information should (and eventually will) be stored elsewhere.
+.Pp
+Placing
+.Sq Li compat
+exclusions in the file after any inclusions will have
+unexpected results.
diff --git a/share/man/man5/pbm.5 b/share/man/man5/pbm.5
new file mode 100644
index 000000000000..55d2c5c1be39
--- /dev/null
+++ b/share/man/man5/pbm.5
@@ -0,0 +1,88 @@
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 27, 1991
+.Dt PBM 5
+.Os
+.Sh NAME
+.Nm pbm
+.Nd portable bitmap file format
+.Sh DESCRIPTION
+The portable bitmap format is a lowest common denominator monochrome
+file format.
+It was originally designed to make it reasonable to mail bitmaps
+between different types of machines using the typical stupid network
+mailers we have today.
+Now it serves as the common language of a large family of bitmap
+conversion filters.
+The definition is as follows:
+.Pp
+.Bl -bullet -compact
+.It
+A "magic number" for identifying the file type.
+A pbm file's magic number is the two characters "P1".
+.It
+Whitespace (blanks, TABs, CRs, LFs).
+.It
+A width, formatted as ASCII characters in decimal.
+.It
+Whitespace.
+.It
+A height, again in ASCII decimal.
+.It
+Whitespace.
+.It
+Width * height bits, each either '1' or '0', starting at the top-left
+corner of the bitmap, proceeding in normal English reading order.
+.It
+The character '1' means black, '0' means white.
+.It
+Whitespace in the bits section is ignored.
+.It
+Characters from a "#" to the next end-of-line are ignored (comments).
+.It
+No line should be longer than 70 characters.
+.El
+.Pp
+Here is an example of a small bitmap in this format:
+.Bd -literal
+P1
+# feep.pbm
+24 7
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
+0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
+0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
+0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
+0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+.Ed
+.Pp
+Programs that read this format should be as lenient as possible,
+accepting anything that looks remotely like a bitmap.
+.Pp
+There is also a variant on the format, available
+by setting the RAWBITS option at compile time.
+This variant is
+different in the following ways:
+.Pp
+.Bl -bullet -compact
+.It
+The "magic number" is "P4" instead of "P1".
+.It
+The bits are stored eight per byte, high bit first low bit last.
+.It
+No whitespace is allowed in the bits section, and only a single character
+of whitespace (typically a newline) is allowed after the height.
+.It
+The files are eight times smaller and many times faster to read and write.
+.El
+.Sh AUTHORS
+Copyright (C) 1989, 1991 by
+.An Jef Poskanzer .
+.\" Permission to use, copy, modify, and distribute this software and its
+.\" documentation for any purpose and without fee is hereby granted, provided
+.\" that the above copyright notice appear in all copies and that both that
+.\" copyright notice and this permission notice appear in supporting
+.\" documentation. This software is provided "as is" without express or
+.\" implied warranty.
diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5
new file mode 100644
index 000000000000..4ab009c18a98
--- /dev/null
+++ b/share/man/man5/periodic.conf.5
@@ -0,0 +1,826 @@
+.\"-
+.\" Copyright (c) 2000 Brian Somers <brian@Awfulhak.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 7, 2012
+.Dt PERIODIC.CONF 5
+.Os
+.Sh NAME
+.Nm periodic.conf
+.Nd periodic job configuration information
+.Sh DESCRIPTION
+The file
+.Nm
+contains a description of how daily, weekly and monthly system maintenance
+jobs should run.
+It resides in the
+.Pa /etc/defaults
+directory and parts may be overridden by a file of the same name in
+.Pa /etc ,
+which itself may be overridden by the
+.Pa /etc/periodic.conf.local
+file.
+.Pp
+The
+.Nm
+file
+is actually sourced as a shell script from each of the periodic scripts
+and is intended to simply provide default configuration variables.
+.Pp
+The following variables are used by
+.Xr periodic 8
+itself:
+.Bl -tag -offset 4n -width 2n
+.It Va local_periodic
+.Pq Vt str
+List of directories to search for periodic scripts.
+This list is always prefixed with
+.Pa /etc/periodic ,
+and is only used when an argument to
+.Xr periodic 8
+is not an absolute directory name.
+.It Ao Ar dir Ac Ns Va _output
+.Pq Vt path No or Vt list
+What to do with the output of the scripts executed from
+the directory
+.Ar dir .
+If this variable is set to an absolute path name, output is logged to
+that file, otherwise it is taken as one or more space separated email
+addresses and mailed to those users.
+If this variable is not set or is empty, output is sent to standard output.
+.Pp
+For an unattended machine, suitable values for
+.Va daily_output ,
+.Va weekly_output ,
+and
+.Va monthly_output
+might be
+.Dq Li /var/log/daily.log ,
+.Dq Li /var/log/weekly.log ,
+and
+.Dq Li /var/log/monthly.log
+respectively, as
+.Xr newsyslog 8
+will rotate these files (if they exists) at the appropriate times.
+.It Ao Ar dir Ac Ns Va _show_success
+.It Ao Ar dir Ac Ns Va _show_info
+.It Ao Ar dir Ac Ns Va _show_badconfig
+.Pq Vt bool
+These variables control whether
+.Xr periodic 8
+will mask the output of the executed scripts based on their return code
+(where
+.Ar dir
+is the base directory name in which each script resides).
+If the return code of a script is
+.Sq 0
+and
+.Ao Ar dir Ac Ns Va _show_success
+is set to
+.Dq Li NO ,
+.Xr periodic 8
+will mask the script's output.
+If the return code of a script is
+.Sq 1
+and
+.Ao Ar dir Ac Ns Va _show_info
+is set to
+.Dq Li NO ,
+.Xr periodic 8
+will mask the script's output.
+If the return code of a script is
+.Sq 2
+and
+.Ao Ar dir Ac Ns Va _show_badconfig
+is set to
+.Dq Li NO ,
+.Xr periodic 8
+will mask the script's output.
+If these variables are set to neither
+.Dq Li YES
+nor
+.Dq Li NO ,
+they default to
+.Dq Li YES ,
+.Dq Li YES
+and
+.Dq Li NO
+respectively.
+.Pp
+Refer to the
+.Xr periodic 8
+manual page for how script return codes are interpreted.
+.El
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/daily :
+.Bl -tag -offset 4n -width 2n
+.It Va daily_clean_disks_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to remove all files matching
+.Va daily_clean_disks_files
+daily.
+.It Va daily_clean_disks_files
+.Pq Vt str
+Set to a list of file names to match.
+Wild cards are permitted.
+.It Va daily_clean_disks_days
+.Pq Vt num
+When
+.Va daily_clean_disks_enable
+is set to
+.Dq Li YES ,
+this must also be set to the number of days old that a file's access
+and modification times must be before it is deleted.
+.It Va daily_clean_disks_verbose
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the removed files to be reported in your daily output.
+.It Va daily_clean_tmps_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to clear temporary directories daily.
+.It Va daily_clean_tmps_dirs
+.Pq Vt str
+Set to the list of directories to clear if
+.Va daily_clean_tmps_enable
+is set to
+.Dq Li YES .
+.It Va daily_clean_tmps_days
+.Pq Vt num
+When
+.Va daily_clean_tmps_enable
+is set, this must also be set to the number of days old that a file's access
+and modification times must be before it is deleted.
+.It Va daily_clean_tmps_ignore
+.Pq Vt str
+Set to the list of files that should not be deleted when
+.Va daily_clean_tmps_enable
+is set to
+.Dq Li YES .
+Wild card characters are permitted.
+.It Va daily_clean_tmps_verbose
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the removed files to be reported in your daily output.
+.It Va daily_clean_preserve_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you wish to remove old files from
+.Pa /var/preserve .
+.It Va daily_clean_preserve_days
+.Pq Vt num
+Set to the number of days that files must not have been modified before
+they are deleted.
+.It Va daily_clean_preserve_verbose
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the removed files to be reported in your daily output.
+.It Va daily_clean_msgs_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you wish old system messages to be purged.
+.It Va daily_clean_msgs_days
+.Pq Vt num
+Set to the number of days that files must not have been modified before
+they are deleted.
+If this variable is left blank, the
+.Xr msgs 1
+default is used.
+.It Va daily_clean_rwho_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you wish old files in
+.Pa /var/who
+to be purged.
+.It Va daily_clean_rwho_days
+.Pq Vt num
+Set to the number of days that files must not have been modified before
+they are deleted.
+.It Va daily_clean_rwho_verbose
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the removed files to be reported in your daily output.
+.It Va daily_clean_hoststat_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to run
+.Nm sendmail Fl bH
+to automatically purge stale entries from
+.Xr sendmail 8 Ns 's
+host status cache.
+Files will be deleted using the same criteria as
+.Xr sendmail 8
+would normally use when determining whether to believe the cached information,
+as configured in
+.Pa /etc/mail/sendmail.cf .
+.It Va daily_backup_passwd_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the
+.Pa /etc/master.passwd
+and
+.Pa /etc/group
+files backed up and reported on.
+Reporting consists of checking both files for modifications and running
+.Xr chkgrp 8
+on the
+.Pa group
+file.
+.It Va daily_backup_aliases_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the
+.Pa /etc/mail/aliases
+file backed up and modifications to be displayed in your daily output.
+.It Va daily_calendar_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm calendar Fl a
+daily.
+.It Va daily_accounting_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to rotate your daily accounting files.
+No rotations are necessary unless
+.Va accounting_enable
+is enabled in
+.Xr rc.conf 5 .
+.It Va daily_accounting_compress
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want your daily accounting files to be compressed using
+.Xr gzip 1 .
+.It Va daily_accounting_save
+.Pq Vt num
+When
+.Va daily_accounting_enable
+is set, this may also be set to the number of daily accounting files that are
+to be saved.
+The default is
+.Dq Li 3 .
+.It Va daily_accounting_flags
+.Pq Vt str
+Set to the arguments to pass to the
+.Xr sa 8
+utility (in addition to
+.Fl s )
+when
+.Va daily_accounting_enable
+is set to
+.Dq Li YES .
+The default is
+.Fl q .
+.It Va daily_news_expire_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Pa /etc/news.expire .
+.It Va daily_status_disks_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Xr df 1
+(with the arguments supplied in
+.Va daily_status_disks_df_flags )
+and
+.Nm dump Fl W .
+.It Va daily_status_disks_df_flags
+.Pq Vt str
+Set to the arguments for the
+.Xr df 1
+utility when
+.Va daily_status_disks_enable
+is set to
+.Dq Li YES .
+.It Va daily_status_zfs_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm zpool Cm status
+on your
+.Xr zfs 8
+pools.
+.It Va daily_status_zfs_zpool_list_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm zpool Cm list
+on your
+.Xr zfs 8
+pools.
+Requires
+.Va daily_status_zfs_enable
+to be set to
+.Li YES .
+.It Va daily_status_ata_raid_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm atacontrol Cm status
+on your
+.Xr ataraid 4
+arrays.
+.It Va daily_status_gmirror_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm gmirror Cm status
+on your
+.Xr gmirror 8
+devices.
+.It Va daily_status_graid3_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm graid3 Cm status
+on your
+.Xr graid3 8
+devices.
+.It Va daily_status_gstripe_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm gstripe Cm status
+on your
+.Xr gstripe 8
+devices.
+.It Va daily_status_gconcat_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm gconcat Cm status
+on your
+.Xr gconcat 8
+devices.
+.It Va daily_status_network_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Nm netstat Fl i .
+.It Va daily_status_network_usedns
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Xr netstat 1
+without the
+.Fl n
+option (to do DNS lookups).
+.It Va daily_status_rwho_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Xr uptime 1
+(or
+.Xr ruptime 1
+if
+.Va rwhod_enable
+is set to
+.Dq Li YES
+in
+.Pa /etc/rc.conf ) .
+.It Va daily_status_mailq_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Xr mailq 1 .
+.It Va daily_status_mailq_shorten
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to shorten the
+.Xr mailq 1
+output when
+.Va daily_status_mailq_enable
+is set to
+.Dq Li YES .
+.It Va daily_status_include_submit_mailq
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you also want to run
+.Xr mailq 1
+on the submit mail queue when
+.Va daily_status_mailq_enable
+is set to
+.Dq Li YES .
+This may not work with MTAs other than
+.Xr sendmail 8 .
+.It Va daily_status_security_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run the security check.
+The security check is another set of
+.Xr periodic 8
+scripts.
+The system defaults are in
+.Pa /etc/periodic/security .
+Local scripts should be placed in
+.Pa /usr/local/etc/periodic/security .
+See the
+.Xr periodic 8
+manual page for more information.
+.It Va daily_status_security_inline
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want the security check output inline.
+The default is to either mail or log the output according to the value of
+.Va daily_status_security_output .
+.It Va daily_status_security_output
+.Pq Vt str
+Where to send the output of the security check if
+.Va daily_status_security_inline
+is set to
+.Dq Li NO .
+This variable behaves in the same way as the
+.Va *_output
+variables above, namely it can be set either to one or more email addresses
+or to an absolute file name.
+.It Va daily_status_security_diff_flags
+.Pq Vt str
+Set to the arguments to pass to the
+.Xr diff 1
+utility when generating differences.
+The default is
+.Fl b u .
+.It Va daily_status_security_chksetuid_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to compare the modes and modification times of setuid executables with
+the previous day's values.
+.It Va daily_status_security_neggrpperm_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to check for files where the group of a file has less permissions than
+the world at large.
+When users are in more than 14 supplemental groups these negative
+permissions may not be enforced via NFS shares.
+.It Va daily_status_security_chkmounts_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to check for changes mounted file systems to the previous day's values.
+.It Va daily_status_security_noamd
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to ignore
+.Xr amd 8
+mounts when comparing against yesterday's file system mounts in the
+.Va daily_status_security_chkmounts_enable
+check.
+.It Va daily_status_security_chkuid0_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to check
+.Pa /etc/master.passwd
+for accounts with UID 0.
+.It Va daily_status_security_passwdless_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to check
+.Pa /etc/master.passwd
+for accounts with empty passwords.
+.It Va daily_status_security_logincheck_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to check
+.Pa /etc/login.conf
+ownership, see
+.Xr login.conf 5
+for more information.
+.It Va daily_status_security_ipfwdenied_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to show log entries for packets denied by
+.Xr ipfw 8
+since yesterday's check.
+.It Va daily_status_security_ipfdenied_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to show log entries for packets denied by
+.Xr ipf 8
+since yesterday's check.
+.It Va daily_status_security_pfdenied_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to show log entries for packets denied by
+.Xr pf 4
+since yesterday's check.
+.It Va daily_status_security_ipfwlimit_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to display
+.Xr ipfw 8
+rules that have reached their verbosity limit.
+.It Va daily_status_security_kernelmsg_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to show new
+.Xr dmesg 8
+entries since yesterday's check.
+.It Va daily_status_security_loginfail_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to display failed logins from
+.Pa /var/log/messages
+in the previous day.
+.It Va daily_status_security_tcpwrap_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to display connections denied by tcpwrappers (see
+.Xr hosts_access 5 )
+from
+.Pa /var/log/messages
+during the previous day.
+.It Va daily_status_mail_rejects_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to summarise mail rejections logged to
+.Pa /var/log/maillog
+for the previous day.
+.It Va daily_status_mail_rejects_logs
+.Pq Vt num
+Set to the number of maillog files that should be checked
+for yesterday's mail rejects.
+.It Va daily_status_named_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to summarise denied zone transfers (AXFR and IXFR)
+for the previous day.
+.It Va daily_status_named_usedns
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to enable reverse DNS lookups.
+.It Va daily_status_ntpd
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to enable NTP status check.
+.It Va daily_queuerun_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to manually run the mail queue at least once a day.
+.It Va daily_submit_queuerun
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you also want to manually run the submit mail queue at least once a day
+when
+.Va daily_queuerun_enable
+is set to
+.Dq Li YES .
+.It Va daily_scrub_zfs_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run a zfs scrub periodically.
+.It Va daily_scrub_zfs_pools
+.Pq Vt str
+A space separated list of names of zfs pools to scrub.
+If the list is empty or not set, all zfs pools are scrubbed.
+.It Va daily_scrub_zfs_default_threshold
+.Pq Vt int
+Number of days between a scrub if no pool-specific threshold is set.
+If not set, the default value is 35, corresponding to 5 weeks.
+.It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold
+.Pq Vt int
+The same as
+.Va daily_scrub_zfs_default_threshold
+but specific to the pool
+.Ao Ar poolname Ac Ns .
+.It Va daily_local
+.Pq Vt str
+Set to a list of extra scripts that should be run after all other
+daily scripts.
+All scripts must be absolute path names.
+.El
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/weekly :
+.Bl -tag -offset 4n -width 2n
+.It Va weekly_locate_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Pa /usr/libexec/locate.updatedb .
+This script is run using
+.Nm nice Fl 5
+as user
+.Dq Li nobody ,
+and generates the table used by the
+.Xr locate 1
+command.
+.It Va weekly_whatis_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Pa /usr/libexec/makewhatis.local .
+This script regenerates the database used by the
+.Xr apropos 1
+command.
+.It Va weekly_catman_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to run
+.Pa /usr/libexec/catman.local .
+This script processes all out of date manual pages, speeding up the
+.Xr man 1
+command at the expense of disk space.
+.It Va weekly_noid_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to locate orphaned files on the system.
+An orphaned file is one with an invalid owner or group.
+.It Va weekly_noid_dirs
+.Pq Vt str
+A list of directories under which orphaned files are searched for.
+This would usually be set to
+.Pa / .
+.It Va weekly_status_pkg_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to use
+.Xr pkg_version 1
+to list installed packages which are out of date.
+.It Va pkg_version
+.Pq Vt str
+When
+.Va weekly_status_pkg_enable
+is set to
+.Dq Li YES ,
+this variable specifies the program that is used to determine the out of
+date packages.
+If unset, the
+.Xr pkg_version 1
+program is used.
+As an example, this variable might be set to
+.Dq Li portversion
+if the
+.Pa ports/sysutils/portupgrade
+port has been installed.
+.It Va pkg_version_index
+.Pq Vt str
+This variable specifies the
+.Pa INDEX
+file from
+.Pa /usr/ports
+that should be used by
+.Xr pkg_version 1 .
+Because the dependency tree may be substantially different between versions of
+.Fx ,
+there may be more than one
+.Pa INDEX
+file in
+.Pa /usr/ports .
+.Pp
+Note, if the
+.Va pkg_version
+variable is set to
+.Dq Li portversion ,
+it will also be necessary to arrange that the correct
+.Pa INDEX
+file is specified
+using environment variables and that
+.Va pkg_version_index
+is cleared in
+.Pa /etc/periodic.conf
+.Pq Dq Li pkg_version_index= .
+.It Va weekly_local
+.Pq Vt str
+Set to a list of extra scripts that should be run after all other
+weekly scripts.
+All scripts must be absolute path names.
+.El
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/monthly :
+.Bl -tag -offset 4n -width 2n
+.It Va monthly_accounting_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+if you want to do login accounting using the
+.Xr ac 8
+command.
+.It Va monthly_local
+.Pq Vt str
+Set to a list of extra scripts that should be run after all other
+monthly scripts.
+All scripts must be absolute path names.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/defaults/periodic.conf"
+.It Pa /etc/defaults/periodic.conf
+The default configuration file.
+This file contains all default variables and values.
+.It Pa /etc/periodic.conf
+The usual system specific variable override file.
+.It Pa /etc/periodic.conf.local
+An additional override file, useful when
+.Pa /etc/periodic.conf
+is shared or distributed.
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr calendar 1 ,
+.Xr df 1 ,
+.Xr diff 1 ,
+.Xr gzip 1 ,
+.Xr locate 1 ,
+.Xr man 1 ,
+.Xr msgs 1 ,
+.Xr netstat 1 ,
+.Xr nice 1 ,
+.Xr pkg_version 1 ,
+.Xr login.conf 5 ,
+.Xr rc.conf 5 ,
+.Xr ac 8 ,
+.Xr chkgrp 8 ,
+.Xr dump 8 ,
+.Xr newsyslog 8 ,
+.Xr periodic 8 ,
+.Xr sendmail 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 4.1 .
+.Sh AUTHORS
+.An Brian Somers Aq brian@Awfulhak.org
diff --git a/share/man/man5/phones.5 b/share/man/man5/phones.5
new file mode 100644
index 000000000000..59b491b61eb9
--- /dev/null
+++ b/share/man/man5/phones.5
@@ -0,0 +1,82 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)phones.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt PHONES 5
+.Os
+.Sh NAME
+.Nm phones
+.Nd remote host phone number data base
+.Sh DESCRIPTION
+The file
+.Pa /etc/phones
+contains the system-wide
+private phone numbers for the
+.Xr tip 1
+program.
+This file is normally unreadable, and so may contain
+privileged information.
+The format of the file is a series of lines
+of the form: <system-name>[\ \et]*<phone-number>.
+The system name is
+one of those defined in the
+.Xr remote 5
+file and the phone number is constructed from any sequence of
+characters terminated only by ``,'' or the end of the line.
+The ``='' and ``*'' characters are
+indicators to the auto call units to pause and wait for a second dial
+tone (when going through an exchange).
+The ``='' is required by the
+.Tn DF02-AC
+and the ``*'' is required by the
+.Tn BIZCOMP
+1030.
+.Pp
+Only one phone number per line is permitted.
+However, if more than
+one line in the file contains the same system name
+.Xr tip 1
+will attempt to dial each one in turn, until it establishes a connection.
+.Sh FILES
+.Bl -tag -width /etc/phones -compact
+.It Pa /etc/phones
+.El
+.Sh SEE ALSO
+.Xr tip 1 ,
+.Xr remote 5
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Bx 4.2 .
diff --git a/share/man/man5/portindex.5 b/share/man/man5/portindex.5
new file mode 100644
index 000000000000..35261965f238
--- /dev/null
+++ b/share/man/man5/portindex.5
@@ -0,0 +1,101 @@
+.\"
+.\" Copyright (c) 2004 Paul Armstrong
+.\" Copyright (c) 2009 Thomas Abthorpe
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt PORTINDEX 5
+.Os
+.Sh NAME
+.Nm INDEX
+.Nd "File containing information about the state of the ports tree"
+.Sh DESCRIPTION
+The port index file in
+.Pa /usr/ports
+contains various bits of information about the ports tree.
+Each major branch of
+.Fx
+has a separate index file, named
+.Dq INDEX- Ns Ar N ,
+where
+.Ar N
+is the major version number of the
+.Fx
+branch, i.e.:
+.Pa INDEX-7 ,
+or
+.Pa INDEX-8 .
+.Bl -tag -compact -width indent
+.It Cm \&name
+The name of the package.
+.It Cm \&path
+The path to the port directory.
+.It Cm \&install prefix
+The default install prefix.
+.It Cm \&short description
+A short description.
+.It Cm \&full description
+The path to the full description.
+.It Cm \&maintainer email
+The email address of the maintainer.
+.It Cm \&index
+The categories this port is part of.
+.It Cm \&build dependencies
+Ports required to be installed prior to building this port.
+.It Cm \&run dependencies
+Ports required to be installed for this port to run.
+.It Cm \&website
+The project website for the port.
+.It Cm \&e-deps
+Ports that may be required to extract this port.
+.It Cm \&p-deps
+Ports that may be required to patch this port.
+.It Cm \&f-deps
+Ports that may be required to fetch this port.
+.El
+.Sh FILES
+.Bl -tag -width /usr/ports/INDEX-8
+.It Pa /usr/ports/INDEX- Ns Ar N
+where
+.Ar N
+is the major version number of the
+.Fx
+branch.
+.El
+.Sh EXAMPLES
+.Bd -literal
+vim-6.3.15|/usr/ports/editors/vim|/usr/local|Vi "workalike", with many additional features|/usr/ports/editors/vim/pkg-descr|obrien@FreeBSD.org|editors|libiconv-1.9.2_1|libiconv-1.9.2_1|http://www.vim.org/|||
+.Ed
+.Sh SEE ALSO
+.Xr build 7 ,
+.Xr csup 1 ,
+.Xr ports 7
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Paul Armstrong
+and
+.An Thomas Abthorpe Aq tabthorpe@FreeBSD.org .
diff --git a/share/man/man5/portsnap.conf.5 b/share/man/man5/portsnap.conf.5
new file mode 100644
index 000000000000..b936d98038b6
--- /dev/null
+++ b/share/man/man5/portsnap.conf.5
@@ -0,0 +1,143 @@
+.\"-
+.\" Copyright 2004-2005 Colin Percival
+.\" All rights reserved
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted providing that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 30, 2005
+.Dt PORTSNAP.CONF 5
+.Os FreeBSD
+.Sh NAME
+.Nm portsnap.conf
+.Nd configuration file for
+.Xr portsnap 8
+.Sh DESCRIPTION
+The
+.Nm
+file controls where
+.Xr portsnap 8
+fetches ports tree snapshots from,
+which RSA key should be trusted to sign the updates, and what
+directories should hold the compressed and live ports trees.
+.Pp
+A line of the form
+.Dl SERVERNAME=portsnap.example.com
+specifies the source from which snapshots should be fetched.
+This is equivalent to the
+.Fl s Ar server
+option to
+.Xr portsnap 8 , and will be ignored if the command-line
+option is used.
+.Pp
+A line of the form
+.Dl KEYPRINT=0123456789abc ... 456789abcdef
+(64 characters in total)
+specifies the SHA-256 hash of the OpenSSL public key file
+belonging to an RSA keypair which is trusted to sign updates.
+This is equivalent to the
+.Fl k Ar KEY
+option to
+.Xr portsnap 8 , and will be ignored if the command-line
+option is used.
+.Pp
+A line of the form
+.Dl WORKDIR=/path/to/workdir
+specifies the directory in which portsnap should maintain its compressed
+snapshot of the ports tree.
+This is equivalent to the
+.Fl d Ar workdir
+option to
+.Xr portsnap 8 , and will be ignored if the command-line option
+is used.
+.Pp
+A line of the form
+.Dl PORTSDIR=/path/to/portstree
+specifies the directory in which portsnap will create the live ports
+tree from its compressed snapshot via the
+.Cm extract
+and
+.Cm update
+commands.
+This is equivalent to the
+.Fl p Ar portsdir
+option to
+.Xr portsnap 8 , and will be ignored if the command-line option
+is used.
+.Pp
+If more than one line of any of the above forms is included in
+.Nm
+then only the last one will take effect.
+.Pp
+A line of the form
+.Dl INDEX INDEXFILE DESCRIBEFILE
+will instruct
+.Xr portsnap 8
+that the specified INDEX file is generated from the specified
+describe file distributed by the portsnap server.
+.Pp
+Finally, a line of the form
+.Dl REFUSE foo bar
+will instruct
+.Xr portsnap 8
+to ignore parts of the ports tree with paths starting with
+.Ar foo
+or
+.Ar bar ,
+which are interpreted as extended regular expressions by
+.Xr egrep 1 .
+This will result in those parts of the tree not being updated
+in the compressed snapshot when the
+.Cm fetch
+and
+.Cm cron
+commands are used and not being extracted when the
+.Cm extract
+command is used (unless a specific
+.Ar path
+is passed to
+.Xr portsnap 8 ) ,
+and if those parts of the ports tree are present they
+will not be updated when the
+.Cm update
+command is used.
+Unlike the other options, the parameters in REFUSE lines
+accumulate and all such lines are considered.
+.Bf Em
+Note that operating with an incomplete ports tree is not
+supported and may cause unexpected results.
+.Ef
+.Pp
+Any lines not of the above forms will be ignored.
+.Sh FILES
+.Bl -tag -width "/etc/portsnap.conf"
+.It /etc/portsnap.conf
+Default location of the portsnap configuration file.
+.El
+.Sh SEE ALSO
+.Xr egrep 1 ,
+.Xr fetch 1 ,
+.Xr portsnap 8 ,
+.Xr sha256 8
+.Sh AUTHORS
+.An Colin Percival Aq cperciva@FreeBSD.org
diff --git a/share/man/man5/procfs.5 b/share/man/man5/procfs.5
new file mode 100644
index 000000000000..17072732938c
--- /dev/null
+++ b/share/man/man5/procfs.5
@@ -0,0 +1,277 @@
+.\" $FreeBSD$
+.\" Written by Garrett Wollman
+.\" This file is in the public domain.
+.\"
+.Dd September 22, 2009
+.Dt PROCFS 5
+.Os
+.Sh NAME
+.Nm procfs
+.Nd process file system
+.Sh SYNOPSIS
+.Bd -literal
+proc /proc procfs rw 0 0
+.Ed
+.Sh DESCRIPTION
+The process file system, or
+.Nm ,
+implements a view of the system process table inside the file system.
+It is normally mounted on
+.Pa /proc ,
+and is required for the complete operation of programs such as
+.Xr ps 1
+and
+.Xr w 1 .
+.Pp
+The
+.Nm
+provides a two-level view of process space, unlike the previous
+.Fx 1.1
+.Nm
+implementation.
+At the highest level, processes themselves are named, according to
+their process ids in decimal, with no leading zeros.
+There is also a
+special node called
+.Pa curproc
+which always refers to the process making the lookup request.
+.Pp
+Each node is a directory which contains the following entries:
+.Pp
+Each directory contains several files:
+.Bl -tag -width status
+.It Pa ctl
+a write-only file which supports a variety
+of control operations.
+Control commands are written as strings to the
+.Pa ctl
+file.
+The control commands are:
+.Bl -tag -width detach -compact
+.It attach
+stops the target process and arranges for the sending
+process to become the debug control process.
+.It detach
+continue execution of the target process and
+remove it from control by the debug process (which
+need not be the sending process).
+.It run
+continue running the target process until
+a signal is delivered, a breakpoint is hit, or the
+target process exits.
+.It step
+single step the target process, with no signal delivery.
+.It wait
+wait for the target process to come to a steady
+state ready for debugging.
+The target process must be in this state before
+any of the other commands are allowed.
+.El
+.Pp
+The string can also be the name of a signal, lower case
+and without the
+.Dv SIG
+prefix,
+in which case that signal is delivered to the process
+(see
+.Xr sigaction 2 ) .
+.Pp
+The
+.Xr procctl 8
+utility can be used to clear tracepoints in a stuck process.
+.It Pa dbregs
+The debug registers as defined by
+.Dv "struct dbregs"
+in
+.In machine/reg.h .
+.Pa dbregs
+is currently only implemented on the i386 architecture.
+.It Pa etype
+The type of the executable referenced by the
+.Pa file
+entry.
+.It Pa file
+A symbolic link to the file from which the process text was read.
+This can be used to gain access to the process' symbol table,
+or to start another copy of the process.
+If the file cannot be found, the link target is
+.Ql unknown .
+.It Pa fpregs
+The floating point registers as defined by
+.Dv "struct fpregs"
+in
+.In machine/reg.h .
+.Pa fpregs
+is only implemented on machines which have distinct general
+purpose and floating point register sets.
+.It Pa map
+A map of the process' virtual memory.
+.It Pa mem
+The complete virtual memory image of the process.
+Only those address which exist in the process can be accessed.
+Reads and writes to this file modify the process.
+Writes to the text segment remain private to the process.
+.It Pa note
+Used for sending signals to the process.
+Not implemented.
+.It Pa notepg
+Used for sending signal to the process group.
+Not implemented.
+.It Pa osrel
+Allows read and write of the kernel osrel value assigned to the process.
+It affects the compatibility shims that are turned on and off
+depending on the value.
+Initial process value is read from the ABI note tag in the executed ELF image,
+and is zero if the tag not supported by binary format or was not found.
+.It Pa regs
+Allows read and write access to the process' register set.
+This file contains a binary data structure
+.Dv "struct regs"
+defined in
+.In machine/reg.h .
+.Pa regs
+can only be written when the process is stopped.
+.It Pa rlimit
+This is a read-only file containing the process current and maximum
+limits.
+Each line is of the format
+.Ar rlimit current max ,
+with -1
+indicating infinity.
+.It Pa status
+The process status.
+This file is read-only and returns a single line containing
+multiple space-separated fields as follows:
+.Pp
+.Bl -bullet -compact
+.It
+command name
+.It
+process id
+.It
+parent process id
+.It
+process group id
+.It
+session id
+.It
+.Ar major , Ns Ar minor
+of the controlling terminal, or
+.Dv -1,-1
+if there is no controlling terminal.
+.It
+a list of process flags:
+.Dv ctty
+if there is a controlling terminal,
+.Dv sldr
+if the process is a session leader,
+.Dv noflags
+if neither of the other two flags are set.
+.It
+the process start time in seconds and microseconds,
+comma separated.
+.It
+the user time in seconds and microseconds,
+comma separated.
+.It
+the system time in seconds and microseconds,
+comma separated.
+.It
+the wait channel message
+.It
+the process credentials consisting of
+the effective user id
+and the list of groups (whose first member
+is the effective group id)
+all comma separated.
+.It
+the hostname of the jail in which the process runs, or
+.Ql -
+to indicate that the process is not running within a jail.
+.El
+.El
+.Pp
+In a normal debugging environment,
+where the target is fork/exec'd by the debugger,
+the debugger should fork and the child should stop
+itself (with a self-inflicted
+.Dv SIGSTOP
+for example).
+The parent should issue a
+.Dv wait
+and then an
+.Dv attach
+command via the appropriate
+.Pa ctl
+file.
+The child process will receive a
+.Dv SIGTRAP
+immediately after the call to exec (see
+.Xr execve 2 ) .
+.Pp
+Each node is owned by the process's user, and belongs to that user's
+primary group, except for the
+.Pa mem
+node, which belongs to the
+.Li kmem
+group.
+.Sh FILES
+.Bl -tag -width /proc/curproc/XXXXXXX -compact
+.It Pa /proc
+normal mount point for the
+.Nm .
+.It Pa /proc/pid
+directory containing process information for process
+.Pa pid .
+.It Pa /proc/curproc
+directory containing process information for the current process
+.It Pa /proc/curproc/cmdline
+the process executable name
+.It Pa /proc/curproc/ctl
+used to send control messages to the process
+.It Pa /proc/curproc/etype
+executable type
+.It Pa /proc/curproc/file
+executable image
+.It Pa /proc/curproc/fpregs
+the process floating point register set
+.It Pa /proc/curproc/map
+virtual memory map of the process
+.It Pa /proc/curproc/mem
+the complete virtual address space of the process
+.It Pa /proc/curproc/note
+used for signaling the process
+.It Pa /proc/curproc/notepg
+used for signaling the process group
+.It Pa /proc/curproc/osrel
+the process osrel value
+.It Pa /proc/curproc/regs
+the process register set
+.It Pa /proc/curproc/rlimit
+the process current and maximum rlimit
+.It Pa /proc/curproc/status
+the process' current status
+.El
+.Sh EXAMPLES
+To mount a
+.Nm
+file system on
+.Pa /proc :
+.Pp
+.Dl "mount -t procfs proc /proc"
+.Sh SEE ALSO
+.Xr procstat 1 ,
+.Xr mount 2 ,
+.Xr sigaction 2 ,
+.Xr unmount 2 ,
+.Xr procctl 8 ,
+.Xr pseudofs 9
+.Sh AUTHORS
+.An -nosplit
+This manual page written by
+.An Garrett Wollman ,
+based on the description
+provided by
+.An Jan-Simon Pendry ,
+and revamped later by
+.An Mike Pritchard .
diff --git a/share/man/man5/protocols.5 b/share/man/man5/protocols.5
new file mode 100644
index 000000000000..37d3541daca0
--- /dev/null
+++ b/share/man/man5/protocols.5
@@ -0,0 +1,80 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)protocols.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt PROTOCOLS 5
+.Os
+.Sh NAME
+.Nm protocols
+.Nd protocol name data base
+.Sh DESCRIPTION
+The
+.Nm
+file contains information regarding the known protocols used in the
+.Tn DARPA
+Internet.
+For each protocol a single line should be present
+with the following information:
+.Bd -unfilled -offset indent
+official protocol name
+protocol number
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or
+tab characters.
+A ``#'' indicates the beginning of
+a comment; characters up to the end of the line are
+not interpreted by routines which search the file.
+.Pp
+Protocol names may contain any printable
+character other than a field delimiter, newline,
+or comment character.
+.Sh FILES
+.Bl -tag -width /etc/protocols -compact
+.It Pa /etc/protocols
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr getprotoent 3
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
+.Sh BUGS
+A name server should be used instead of a static file.
diff --git a/share/man/man5/quota.user.5 b/share/man/man5/quota.user.5
new file mode 100644
index 000000000000..c314b654ecb3
--- /dev/null
+++ b/share/man/man5/quota.user.5
@@ -0,0 +1,129 @@
+.\" Copyright (c) 2001 Nik Clayton
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 30, 2007
+.Dt QUOTA.USER 5
+.Os
+.Sh NAME
+.Nm quota.user , quota.group
+.Nd per file system quota database
+.Sh DESCRIPTION
+Each file system with active quotas should contain a
+.Pa quota.user
+and
+.Pa quota.group
+file in the file system root.
+These files are created by
+.Xr quotacheck 8 ,
+and should be edited with
+.Xr edquota 8 .
+It is possible to specify a different location and file name with the
+.Dq Li userquota
+and
+.Dq Li groupquota
+options in the
+.Xr fstab 5
+file.
+.Pp
+The data files contain the following information:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+Current block usage
+.It
+Current number of files
+.It
+Soft block limit
+.It
+Soft file limit
+.It
+Hard block limit
+.It
+Hard file limit
+.It
+Block grace time remaining if over the soft limit
+.It
+File grace time remaining if over the soft limit
+.El
+.Pp
+See
+.Xr edquota 8
+for an explanation on the various limits and grace periods.
+.Pp
+During normal quota operations the
+.Xr quotactl 2
+interface is used to query or set quota information and the kernel
+will maintain the data files as needed.
+If quotas are disabled on
+a file system, but marked as having quotas enabled in
+.Xr fstab 5 ,
+then the quota data files will be used directly.
+.Pp
+The data files are stored as an array of
+.Dq Li struct dqblk
+structures, as defined in
+.In ufs/ufs/quota.h ,
+and indexed by UID or GID.
+The data files will be written as a sparse file if possible.
+Data is only maintained for ids that have either non-zero usage or
+non-zero quota limits.
+If an attempt is made to access data for an id that would exist past the
+end of the current data file, a quota structure with all values set
+to zero will be created, and the data file extended as needed.
+The
+.Xr quotacheck 8
+utility will truncate the data files to the minimum size needed
+to store the highest id with either non-zero file usage or
+non-zero quota limits.
+.Pp
+The data record for id 0 has special meaning. If the
+.Dq Dv dqb_btime
+or
+.Dq Dv dbq_itime
+fields are non-zero, they are used to indicate the grace period on
+that file system for users who have exceeded their soft limit.
+These times can be set by
+.Xr edquota 8
+with the
+.Fl t
+flag.
+If no explicit grace period has been set with
+.Xr edquota 8 ,
+then the default value of 7 days will be used.
+The default values are defined by
+.Dv MAX_DQ_TIME
+and
+.Dv MAX_IQ_TIME
+in
+.In ufs/ufs/quota.h .
+.Sh SEE ALSO
+.Xr quota 1 ,
+.Xr quotactl 2 ,
+.Xr fstab 5 ,
+.Xr edquota 8 ,
+.Xr quotacheck 8 ,
+.Xr quotaoff 8 ,
+.Xr quotaon 8 ,
+.Xr repquota 8
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
new file mode 100644
index 000000000000..a45ee0132b75
--- /dev/null
+++ b/share/man/man5/rc.conf.5
@@ -0,0 +1,4630 @@
+.\" Copyright (c) 1995
+.\" Jordan K. Hubbard
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 27, 2012
+.Dt RC.CONF 5
+.Os
+.Sh NAME
+.Nm rc.conf
+.Nd system configuration information
+.Sh DESCRIPTION
+The file
+.Nm
+contains descriptive information about the local host name, configuration
+details for any potential network interfaces and which services should be
+started up at system initial boot time.
+In new installations, the
+.Nm
+file is generally initialized by the system installation utility,
+.Xr sysinstall 8 .
+.Pp
+The purpose of
+.Nm
+is not to run commands or perform system startup actions
+directly.
+Instead, it is included by the
+various generic startup scripts in
+.Pa /etc
+which conditionalize their
+internal actions according to the settings found there.
+.Pp
+The
+.Pa /etc/rc.conf
+file is included from the file
+.Pa /etc/defaults/rc.conf ,
+which specifies the default settings for all the available options.
+Options need only be specified in
+.Pa /etc/rc.conf
+when the system administrator wishes to override these defaults.
+The file
+.Pa /etc/rc.conf.local
+is used to override settings in
+.Pa /etc/rc.conf
+for historical reasons.
+In addition to
+.Pa /etc/rc.conf.local
+you can also place smaller configuration files for each
+.Xr rc 8
+script in the
+.Pa /etc/rc.conf.d
+directory, which will be included by the
+.Va load_rc_config
+function.
+For jail configurations you could use the file
+.Pa /etc/rc.conf.d/jail
+to store jail specific configuration options.
+Also see the
+.Va rc_conf_files
+variable below.
+.Pp
+Options are set with
+.Dq Ar name Ns Li = Ns Ar value
+assignments that use
+.Xr sh 1
+syntax.
+The following list provides a name and short description for each
+variable that can be set in the
+.Nm
+file:
+.Bl -tag -width indent-two
+.It Va rc_debug
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable output of debug messages from rc scripts.
+This variable can be helpful in diagnosing mistakes when
+editing or integrating new scripts.
+Beware that this produces copious output to the terminal and
+.Xr syslog 3 .
+.It Va rc_info
+.Pq Vt bool
+If set to
+.Dq Li NO ,
+disable informational messages from the rc scripts.
+Informational messages are displayed when
+a condition that is not serious enough to warrant a warning or
+an error occurs.
+.It Va rc_startmsgs
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+show
+.Dq Starting foo:
+when faststart is used (e.g., at boot time).
+.It Va early_late_divider
+.Pq Vt str
+The name of the script that should be used as the
+delimiter between the
+.Dq early
+and
+.Dq late
+stages of the boot process.
+The early stage should contain all the services needed to
+get the disks (local or remote) mounted so that the late
+stage can include scripts contained in the directories
+listed in the
+.Va local_startup
+variable (see below).
+Thus, the two likely candidates for this value are
+.Pa mountcritlocal
+for the typical system, and
+.Pa mountcritremote
+if the system needs remote file
+systems mounted to get access to the
+.Va local_startup
+directories; for example when
+.Pa /usr/local
+is NFS mounted.
+For
+.Pa rc.conf
+within a
+.Xr jail 8
+.Pa NETWORKING
+is likely to be an appropriate value.
+Extreme care should be taken when changing this value,
+and before changing it one should ensure that there are
+adequate provisions to recover from a failed boot
+(such as physical contact with the machine,
+or reliable remote console access).
+.It Va always_force_depends
+.Pq Vt bool
+Various
+.Pa rc.d
+scripts use the force_depend function to check whether required
+services are already running, and to start them if necessary.
+By default during boot time this check is bypassed if the
+required service is enabled in
+.Pa /etc/rc.conf[.local] .
+Setting this option will bypass that check at boot time and
+always test whether or not the service is actually running.
+Enabling this option is likely to increase your boot time if
+services are enabled that utilize the force_depend check.
+.It Va swapfile
+.Pq Vt str
+If set to
+.Dq Li NO ,
+no swapfile is installed, otherwise the value is used as the full
+pathname to a file to use for additional swap space.
+.It Va apm_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable support for Automatic Power Management with
+the
+.Xr apm 8
+command.
+.It Va apmd_enable
+.Pq Vt bool
+Run
+.Xr apmd 8
+to handle APM event from userland.
+This also enables support for APM.
+.It Va apmd_flags
+.Pq Vt str
+If
+.Va apmd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr apmd 8
+daemon.
+.It Va devd_enable
+.Pq Vt bool
+Run
+.Xr devd 8
+to handle device added, removed or unknown events from the kernel.
+.It Va ddb_enable
+.Pq Vt bool
+Run
+.Xr ddb 8
+to install
+.Xr ddb 4
+scripts at boot time.
+.It Va ddb_config
+.Pq Vt str
+Configuration file for
+.Xr ddb 8 .
+Default
+.Pa /etc/ddb.conf .
+.It Va kld_list
+.Pq Vt str
+A list of kernel modules to load right after the local
+disks are mounted.
+Loading modules at this point in the boot process is
+much faster than doing it via
+.Pa /boot/loader.conf
+for those modules not necessary for mounting local disk.
+.It Va kldxref_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Set to
+.Dq Li YES
+to automatically rebuild
+.Pa linker.hints
+files with
+.Xr kldxref 8
+at boot time.
+.It Va kldxref_clobber
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+If
+.Va kldxref_enable
+is true,
+setting to
+.Dq Li YES
+will overwrite existing
+.Pa linker.hints
+files at boot time.
+Otherwise,
+only missing
+.Pa linker.hints
+files are generated.
+.It Va kldxref_module_path
+.Pq Vt str
+Empty by default.
+A semi-colon
+.Pq Ql \&;
+delimited list of paths containing
+.Xr kld 4
+modules.
+If empty,
+the contents of the
+.Va kern.module_path
+.Xr sysctl 8
+are used.
+.It Va powerd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable the system power control facility with the
+.Xr powerd 8
+daemon.
+.It Va powerd_flags
+.Pq Vt str
+If
+.Va powerd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr powerd 8
+daemon.
+.It Va tmpmfs
+Controls the creation of a
+.Pa /tmp
+memory file system.
+Always happens if set to
+.Dq Li YES
+and never happens if set to
+.Dq Li NO .
+If set to anything else, a memory file system is created if
+.Pa /tmp
+is not writable.
+.It Va tmpsize
+Controls the size of a created
+.Pa /tmp
+memory file system.
+.It Va tmpmfs_flags
+Extra options passed to the
+.Xr mdmfs 8
+utility when the memory file system for
+.Pa /tmp
+is created.
+The default is
+.Dq Li "-S" ,
+which inhibits the use of softupdates on
+.Pa /tmp
+so that file system space is freed without delay
+after file truncation or deletion.
+See
+.Xr mdmfs 8
+for other options you can use in
+.Va tmpmfs_flags .
+.It Va varmfs
+Controls the creation of a
+.Pa /var
+memory file system.
+Always happens if set to
+.Dq Li YES
+and never happens if set to
+.Dq Li NO .
+If set to anything else, a memory file system is created if
+.Pa /var
+is not writable.
+.It Va varsize
+Controls the size of a created
+.Pa /var
+memory file system.
+.It Va varmfs_flags
+Extra options passed to the
+.Xr mdmfs 8
+utility when the memory file system for
+.Pa /var
+is created.
+The default is
+.Dq Li "-S" ,
+which inhibits the use of softupdates on
+.Pa /var
+so that file system space is freed without delay
+after file truncation or deletion.
+See
+.Xr mdmfs 8
+for other options you can use in
+.Va varmfs_flags .
+.It Va populate_var
+Controls the automatic population of the
+.Pa /var
+file system.
+Always happens if set to
+.Dq Li YES
+and never happens if set to
+.Dq Li NO .
+If set to anything else, a memory file system is created if
+.Pa /var
+is not writable.
+Note that this process requires access to certain commands in
+.Pa /usr
+before
+.Pa /usr
+is mounted on normal systems.
+.It Va cleanvar_enable
+.Pq Vt bool
+Clean the
+.Pa /var
+directory.
+.It Va local_startup
+.Pq Vt str
+List of directories to search for startup script files.
+.It Va script_name_sep
+.Pq Vt str
+The field separator to use for breaking down the list of startup script files
+into individual filenames.
+The default is a space.
+It is not necessary to change this unless there are startup scripts with names
+containing spaces.
+.It Va hostapd_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr hostapd 8
+at system boot time.
+.It Va hostname
+.Pq Vt str
+The fully qualified domain name (FQDN) of this host on the network.
+This should almost certainly be set to something meaningful, even if
+there is no network connection.
+If
+.Xr dhclient 8
+is used to set the hostname via DHCP,
+this variable should be set to an empty string.
+If this value remains unset when the system is done booting
+your console login will display the default hostname of
+.Dq Amnesiac.
+.It Va nisdomainname
+.Pq Vt str
+The NIS domain name of this host, or
+.Dq Li NO
+if NIS is not used.
+.It Va dhclient_program
+.Pq Vt str
+Path to the DHCP client program
+.Pa ( /sbin/dhclient ,
+the
+.Ox
+DHCP client,
+is the default).
+.It Va dhclient_flags
+.Pq Vt str
+Additional flags to pass to the DHCP client program.
+For the
+.Ox
+DHCP client, see the
+.Xr dhclient 8
+manpage for a description of the command line options available.
+.It Va dhclient_flags_ Ns Aq Ar iface
+Additional flags to pass to the DHCP client program running on
+.Ar iface
+only.
+When specified, this variable overrides
+.Va dhclient_flags .
+.It Va background_dhclient
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start the DHCP client in background.
+This can cause trouble with applications depending on
+a working network, but it will provide a faster startup
+in many cases.
+.It Va background_dhclient_ Ns Aq Ar iface
+When specified, this variable overrides the
+.Va background_dhclient
+variable for interface
+.Ar iface
+only.
+.It Va synchronous_dhclient
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr dhclient 8
+synchronously at startup.
+This behavior can be overridden on a per-interface basis by replacing
+the
+.Dq Li DHCP
+keyword in the
+.Va ifconfig_ Ns Aq Ar interface
+variable with
+.Dq Li SYNCDHCP
+or
+.Dq Li NOSYNCDHCP .
+.It Va defaultroute_delay
+.Pq Vt int
+When set to a positive value, wait up to this long after configuring
+DHCP interfaces at startup to give the interfaces time to receive a lease.
+.It Va firewall_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to load firewall rules at startup.
+If the kernel was not built with
+.Cd "options IPFIREWALL" ,
+the
+.Pa ipfw.ko
+kernel module will be loaded.
+See also
+.Va ipfilter_enable .
+.It Va firewall_script
+.Pq Vt str
+This variable specifies the full path to the firewall script to run.
+The default is
+.Pa /etc/rc.firewall .
+.It Va firewall_type
+.Pq Vt str
+Names the firewall type from the selection in
+.Pa /etc/rc.firewall ,
+or the file which contains the local firewall ruleset.
+Valid selections from
+.Pa /etc/rc.firewall
+are:
+.Pp
+.Bl -tag -width ".Li simple" -compact
+.It Li open
+unrestricted IP access
+.It Li closed
+all IP services disabled, except via
+.Dq Li lo0
+.It Li client
+basic protection for a workstation
+.It Li simple
+basic protection for a LAN.
+.El
+.Pp
+If a filename is specified, the full path
+must be given.
+.It Va firewall_quiet
+.Pq Vt bool
+Set to
+.Dq Li YES
+to disable the display of firewall rules on the console during boot.
+.It Va firewall_logging
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable firewall event logging.
+This is equivalent to the
+.Dv IPFIREWALL_VERBOSE
+kernel option.
+.It Va firewall_flags
+.Pq Vt str
+Flags passed to
+.Xr ipfw 8
+if
+.Va firewall_type
+specifies a filename.
+.It Va firewall_coscripts
+.Pq Vt str
+List of executables and/or rc scripts to run after firewall starts/stops.
+Default is empty.
+.\" ----- firewall_nat_enable setting --------------------------------
+.It Va firewall_nat_enable
+.Pq Vt bool
+The
+.Xr ipfw 8
+equivalent of
+.Va natd_enable .
+Setting this to
+.Dq Li YES
+enables kernel NAT.
+.Va firewall_enable
+must also be set to
+.Dq Li YES .
+.It Va firewall_nat_interface
+.Pq Vt str
+The
+.Xr ipfw 8
+equivalent of
+.Va natd_interface .
+This is the name of the public interface or IP address on which
+kernel NAT should run.
+.It Va firewall_nat_flags
+.Pq Vt str
+Additional configuration parameters for kernel NAT should be placed here.
+.It Va dummynet_enable
+.Pq Vt bool
+Setting this to
+.Dq Li YES
+will automatically load the
+.Xr dummynet 4
+module if
+.Va firewall_enable
+is also set to
+.Dq Li YES .
+.\" -------------------------------------------------------------------
+.It Va natd_program
+.Pq Vt str
+Path to
+.Xr natd 8 .
+.It Va natd_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable
+.Xr natd 8 .
+.Va firewall_enable
+must also be set to
+.Dq Li YES ,
+and
+.Xr divert 4
+sockets must be enabled in the kernel.
+If the kernel was not built with
+.Cd "options IPDIVERT" ,
+the
+.Pa ipdivert.ko
+kernel module will be loaded.
+.It Va natd_interface
+.Pq Vt str
+This is the name of the public interface on which
+.Xr natd 8
+should run.
+The interface may be given as an interface name or as an IP address.
+.It Va natd_flags
+.Pq Vt str
+Additional
+.Xr natd 8
+flags should be placed here.
+The
+.Fl n
+or
+.Fl a
+flag is automatically added with the above
+.Va natd_interface
+as an argument.
+.\" ----- ipfilter_enable setting --------------------------------
+.It Va ipfilter_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables
+.Xr ipf 8
+packet filtering.
+.Pp
+Typical usage will require putting
+.Bd -literal
+ipfilter_enable="YES"
+ipnat_enable="YES"
+ipmon_enable="YES"
+ipfs_enable="YES"
+.Ed
+.Pp
+into
+.Pa /etc/rc.conf
+and editing
+.Pa /etc/ipf.rules
+and
+.Pa /etc/ipnat.rules
+appropriately.
+.Pp
+Note that
+.Va ipfilter_enable
+and
+.Va ipnat_enable
+can be enabled independently.
+.Va ipmon_enable
+and
+.Va ipfs_enable
+both require at least one of
+.Va ipfilter_enable
+and
+.Va ipnat_enable
+to be enabled.
+.Pp
+Having
+.Bd -literal
+options IPFILTER
+options IPFILTER_LOG
+options IPFILTER_DEFAULT_BLOCK
+.Ed
+.Pp
+in the kernel configuration file is a good idea, too.
+.\" ----- ipfilter_program setting ------------------------------
+.It Va ipfilter_program
+.Pq Vt str
+Path to
+.Xr ipf 8
+(default
+.Pa /sbin/ipf ) .
+.\" ----- ipfilter_rules setting --------------------------------
+.It Va ipfilter_rules
+.Pq Vt str
+Set to
+.Pa /etc/ipf.rules
+by default.
+This variable contains the name of the filter rule definition file.
+The file is expected to be readable for the
+.Xr ipf 8
+command to execute.
+.\" ----- ipv6_ipfilter_rules setting ---------------------------
+.It Va ipv6_ipfilter_rules
+.Pq Vt str
+Set to
+.Pa /etc/ipf6.rules
+by default.
+This variable contains the IPv6 filter rule definition file.
+The file is expected to be readable for the
+.Xr ipf 8
+command to execute.
+.\" ----- ipfilter_flags setting --------------------------------
+.It Va ipfilter_flags
+.Pq Vt str
+Empty by default.
+This variable contains flags passed to the
+.Xr ipf 8
+program.
+.\" ----- ipnat_enable setting ----------------------------------
+.It Va ipnat_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Set it to
+.Dq Li YES
+to enable
+.Xr ipnat 8
+network address translation.
+See
+.Va ipfilter_enable
+for a detailed discussion.
+.\" ----- ipnat_program setting ---------------------------------
+.It Va ipnat_program
+.Pq Vt str
+Path to
+.Xr ipnat 8
+(default
+.Pa /sbin/ipnat ) .
+.\" ----- ipnat_rules setting -----------------------------------
+.It Va ipnat_rules
+.Pq Vt str
+Set to
+.Pa /etc/ipnat.rules
+by default.
+This variable contains the name of the file
+holding the network address translation definition.
+This file is expected to be readable for the
+.Xr ipnat 8
+command to execute.
+.\" ----- ipnat_flags setting -----------------------------------
+.It Va ipnat_flags
+.Pq Vt str
+Empty by default.
+This variable contains flags passed to the
+.Xr ipnat 8
+program.
+.\" ----- ipmon_enable setting ----------------------------------
+.It Va ipmon_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Set it to
+.Dq Li YES
+to enable
+.Xr ipmon 8
+monitoring (logging
+.Xr ipf 8
+and
+.Xr ipnat 8
+events).
+Setting this variable needs setting
+.Va ipfilter_enable
+or
+.Va ipnat_enable
+too.
+See
+.Va ipfilter_enable
+for a detailed discussion.
+.\" ----- ipmon_program setting ---------------------------------
+.It Va ipmon_program
+.Pq Vt str
+Path to
+.Xr ipmon 8
+(default
+.Pa /sbin/ipmon ) .
+.\" ----- ipmon_flags setting -----------------------------------
+.It Va ipmon_flags
+.Pq Vt str
+Set to
+.Dq Li -Ds
+by default.
+This variable contains flags passed to the
+.Xr ipmon 8
+program.
+Another typical example would be
+.Dq Fl D Pa /var/log/ipflog
+to have
+.Xr ipmon 8
+log directly to a file bypassing
+.Xr syslogd 8 .
+Make sure to adjust
+.Pa /etc/newsyslog.conf
+in such case like this:
+.Bd -literal
+/var/log/ipflog 640 10 100 * Z /var/run/ipmon.pid
+.Ed
+.\" ----- ipfs_enable setting -----------------------------------
+.It Va ipfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Set it to
+.Dq Li YES
+to enable
+.Xr ipfs 8
+saving the filter and NAT state tables during shutdown
+and reloading them during startup again.
+Setting this variable needs setting
+.Va ipfilter_enable
+or
+.Va ipnat_enable
+to
+.Dq Li YES
+too.
+See
+.Va ipfilter_enable
+for a detailed discussion.
+Note that if
+.Va kern_securelevel
+is set to 3,
+.Va ipfs_enable
+cannot be used
+because the raised securelevel will prevent
+.Xr ipfs 8
+from saving the state tables at shutdown time.
+.\" ----- ipfs_program setting ----------------------------------
+.It Va ipfs_program
+.Pq Vt str
+Path to
+.Xr ipfs 8
+(default
+.Pa /sbin/ipfs ) .
+.\" ----- ipfs_flags setting ------------------------------------
+.It Va ipfs_flags
+.Pq Vt str
+Empty by default.
+This variable contains flags passed to the
+.Xr ipfs 8
+program.
+.\" ----- end of added ipf hook ---------------------------------
+.It Va pf_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables
+.Xr pf 4
+packet filtering.
+.Pp
+Typical usage will require putting
+.Pp
+.Dl pf_enable="YES"
+.Pp
+into
+.Pa /etc/rc.conf
+and editing
+.Pa /etc/pf.conf
+appropriately.
+Adding
+.Pp
+.Dl "device pf"
+.Pp
+builds support for
+.Xr pf 4
+into the kernel, otherwise the
+kernel module will be loaded.
+.It Va pf_rules
+.Pq Vt str
+Path to
+.Xr pf 4
+ruleset configuration file
+(default
+.Pa /etc/pf.conf ) .
+.It Va pf_program
+.Pq Vt str
+Path to
+.Xr pfctl 8
+(default
+.Pa /sbin/pfctl ) .
+.It Va pf_flags
+.Pq Vt str
+If
+.Va pf_enable
+is set to
+.Dq Li YES ,
+these flags are passed to the
+.Xr pfctl 8
+program when loading the ruleset.
+.It Va pflog_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables
+.Xr pflogd 8
+which logs packets from the
+.Xr pf 4
+packet filter.
+.It Va pflog_logfile
+.Pq Vt str
+If
+.Va pflog_enable
+is set to
+.Dq Li YES
+this controls where
+.Xr pflogd 8
+stores the logfile
+(default
+.Pa /var/log/pflog ) .
+Check
+.Pa /etc/newsyslog.conf
+to adjust logfile rotation for this.
+.It Va pflog_program
+.Pq Vt str
+Path to
+.Xr pflogd 8
+(default
+.Pa /sbin/pflogd ) .
+.It Va pflog_flags
+.Pq Vt str
+Empty by default.
+This variable contains additional flags passed to the
+.Xr pflogd 8
+program.
+.It Va ftpproxy_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables
+.Xr ftp-proxy 8
+which supports the
+.Xr pf 4
+packet filter in translating ftp connections.
+.It Va ftpproxy_flags
+.Pq Vt str
+Empty by default.
+This variable contains additional flags passed to the
+.Xr ftp-proxy 8
+program.
+.It Va pfsync_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables exposing
+.Xr pf 4
+state changes to other hosts over the network by means of
+.Xr pfsync 4 .
+The
+.Va pfsync_syncdev
+variable
+must also be set then.
+.It Va pfsync_syncdev
+.Pq Vt str
+Empty by default.
+This variable specifies the name of the network interface
+.Xr pfsync 4
+should operate through.
+It must be set accordingly if
+.Va pfsync_enable
+is set to
+.Dq Li YES .
+.It Va pfsync_syncpeer
+.Pq Vt str
+Empty by default.
+This variable is optional.
+By default, state change messages are sent out on the synchronisation
+interface using IP multicast packets.
+The protocol is IP protocol 240, PFSYNC, and the multicast group used is
+224.0.0.240.
+When a peer address is specified using the
+.Va pfsync_syncpeer
+option, the peer address is used as a destination for the pfsync
+traffic, and the traffic can then be protected using
+.Xr ipsec 4 .
+See the
+.Xr pfsync 4
+manpage for more details about using
+.Xr ipsec 4
+with
+.Xr pfsync 4
+interfaces.
+.It Va pfsync_ifconfig
+.Pq Vt str
+Empty by default.
+This variable can contain additional options to be passed to the
+.Xr ifconfig 8
+command used to set up
+.Xr pfsync 4 .
+.It Va tcp_extensions
+.Pq Vt bool
+Set to
+.Dq Li YES
+by default.
+Setting this to
+.Dq Li NO
+disables certain TCP options as described by
+.Rs
+.%T "RFC 1323"
+.Re
+Setting this to
+.Dq Li NO
+might help remedy such problems with connections as randomly hanging
+or other weird behavior.
+Some network devices are known
+to be broken with respect to these options.
+.It Va log_in_vain
+.Pq Vt int
+Set to 0 by default.
+The
+.Xr sysctl 8
+variables,
+.Va net.inet.tcp.log_in_vain
+and
+.Va net.inet.udp.log_in_vain ,
+as described in
+.Xr tcp 4
+and
+.Xr udp 4 ,
+are set to the given value.
+.It Va tcp_keepalive
+.Pq Vt bool
+Set to
+.Dq Li YES
+by default.
+Setting to
+.Dq Li NO
+will disable probing idle TCP connections to verify that the
+peer is still up and reachable.
+.It Va tcp_drop_synfin
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting to
+.Dq Li YES
+will cause the kernel to ignore TCP frames that have both
+the SYN and FIN flags set.
+This prevents OS fingerprinting, but may
+break some legitimate applications.
+.It Va icmp_drop_redirect
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting to
+.Dq Li YES
+will cause the kernel to ignore ICMP REDIRECT packets.
+Refer to
+.Xr icmp 4
+for more information.
+.It Va icmp_log_redirect
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting to
+.Dq Li YES
+will cause the kernel to log ICMP REDIRECT packets.
+Note that
+the log messages are not rate-limited, so this option should only be used
+for troubleshooting networks.
+Refer to
+.Xr icmp 4
+for more information.
+.It Va icmp_bmcastecho
+.Pq Vt bool
+Set to
+.Dq Li YES
+to respond to broadcast or multicast ICMP ping packets.
+Refer to
+.Xr icmp 4
+for more information.
+.It Va ip_portrange_first
+.Pq Vt int
+If not set to
+.Dq Li NO ,
+this is the first port in the default portrange.
+Refer to
+.Xr ip 4
+for more information.
+.It Va ip_portrange_last
+.Pq Vt int
+If not set to
+.Dq Li NO ,
+this is the last port in the default portrange.
+Refer to
+.Xr ip 4
+for more information.
+.It Va network_interfaces
+.Pq Vt str
+Set to the list of network interfaces to configure on this host or
+.Dq Li AUTO
+(the default) for all current interfaces.
+Setting the
+.Va network_interfaces
+variable to anything other than the default is deprecated.
+Interfaces that the administrator wishes to store configuration for,
+but not start at boot should be configured with the
+.Dq Li NOAUTO
+keyword in their
+.Va ifconfig_ Ns Aq Ar interface
+variables as described below.
+.Pp
+An
+.Va ifconfig_ Ns Aq Ar interface
+variable is also assumed to exist for each value of
+.Ar interface .
+When an interface name contains any of the characters
+.Dq Li .-/+
+they are translated to
+.Dq Li _
+before lookup.
+The variable can contain arguments to
+.Xr ifconfig 8 ,
+as well as special case-insensitive keywords described below.
+Such keywords are removed before passing the value to
+.Xr ifconfig 8
+while the order of the other arguments is preserved.
+.Pp
+One can configure more than one IPv4 address with the
+.Va ipv4_addrs_ Ns Aq Ar interface
+variable.
+One or more IP addresses must be provided in Classless Inter-Domain
+Routing (CIDR) address notation, whose last byte can be a range like
+192.0.2.5-23/24.
+In this case the address 192.0.2.5 will be configured with the
+netmask /24 and the addresses 192.0.2.6 to 192.0.2.23 with
+the non-conflicting netmask /32 as explained in the
+.Xr ifconfig 8
+alias section.
+With the interface in question being
+.Li ed0 ,
+an example could look like:
+.Bd -literal
+ipv4_addrs_ed0="192.0.2.129/27 192.0.2.1-5/28"
+.Ed
+.Pp
+It is also possible to add IP alias entries using
+.Xr ifconfig 8
+syntax with the
+.Dq Li inet
+keyword.
+Assuming that the interface in question was
+.Li ed0 ,
+it might look
+something like this:
+.Bd -literal
+ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff"
+ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff"
+.Ed
+.Pp
+And so on.
+For each
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n
+entry with the
+.Dq Li inet
+keyword that is found,
+its contents are passed to
+.Xr ifconfig 8 .
+Execution stops at the first unsuccessful access, so if
+something like this is present:
+.Bd -literal
+ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff"
+ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff"
+ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff"
+ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff"
+.Ed
+.Pp
+Then note that alias4 would
+.Em not
+be added since the search would
+stop with the missing
+.Dq Li alias3
+entry.
+Due to this difficult to manage behavior, the
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n
+form is deprecated.
+.Pp
+If the
+.Pa /etc/start_if. Ns Aq Ar interface
+file is present, it is read and executed by the
+.Xr sh 1
+interpreter
+before configuring the interface as specified in the
+.Va ifconfig_ Ns Aq Ar interface
+and
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n
+variables.
+.Pp
+If a
+.Va vlans_ Ns Aq Ar interface
+variable is set,
+a
+.Xr vlan 4
+interface will be created for each item in the list with the
+.Ar vlandev
+argument set to
+.Ar interface .
+If a vlan interface's name is a number,
+then that number is used as the vlan tag and the new vlan interface is
+named
+.Ar interface . Ns Ar tag .
+Otherwise,
+the vlan tag must be specified via a
+.Va vlan
+parameter in the
+.Va create_args_ Ns Aq Ar interface
+variable.
+.Pp
+To create a vlan device named
+.Li em0.101
+on
+.Li em0
+with the vlan tag 101 and the optional the IPv4 address 192.0.2.1/24:
+.Bd -literal
+vlans_em0="101"
+ifconfig_em0_101="inet 192.0.2.1/24"
+.Ed
+.Pp
+To create a vlan device named
+.Li myvlan
+on
+.Li em0
+with the vlan tag 102:
+.Bd -literal
+vlans_em0="myvlan"
+create_args_myvlan="vlan 102"
+.Ed
+.Pp
+If a
+.Va wlans_ Ns Aq Ar interface
+variable is set,
+an
+.Xr wlan 4
+interface will be created for each item in the list with the
+.Ar wlandev
+argument set to
+.Ar interface .
+Further wlan cloning arguments may be passed to the
+.Xr ifconfig 8
+.Cm create
+command by setting the
+.Va create_args_ Ns Aq Ar interface
+variable.
+One or more
+.Xr wlan 4
+devices must be created for each wireless devices as of
+.Fx 8.0 .
+Debugging flags for
+.Xr wlan 4
+devices as set by
+.Xr wlandebug 8
+may be specified with an
+.Va wlandebug_ Ns Aq Ar interface
+variable.
+The contents of this variable will be passed directly to
+.Xr wlandebug 8 .
+.Pp
+If the
+.Va ifconfig_ Ns Aq Ar interface
+contains the keyword
+.Dq Li NOAUTO
+then the interface will not be configured
+at boot or by
+.Pa /etc/pccard_ether
+when
+.Va network_interfaces
+is set to
+.Dq Li AUTO .
+.Pp
+It is possible to bring up an interface with DHCP by adding
+.Dq Li DHCP
+to the
+.Va ifconfig_ Ns Aq Ar interface
+variable.
+For instance, to initialize the
+.Li ed0
+device via DHCP,
+it is possible to use something like:
+.Bd -literal
+ifconfig_ed0="DHCP"
+.Ed
+.Pp
+Also, if you want to configure your wireless interface with
+.Xr wpa_supplicant 8
+for use with WPA, EAP/LEAP or WEP, you need to add
+.Dq Li WPA
+to the
+.Va ifconfig_ Ns Aq Ar interface
+variable.
+.Pp
+Finally, you can add
+.Xr ifconfig 8
+options in this variable, in addition to the
+.Pa /etc/start_if. Ns Aq Ar interface
+file.
+For instance, to configure an
+.Xr ath 4
+wireless device in station mode with an address obtained
+via DHCP, using WPA authentication and 802.11b mode, it is
+possible to use something like:
+.Bd -literal
+wlans_ath0="wlan0"
+ifconfig_wlan0="DHCP WPA mode 11b"
+.Ed
+.Pp
+In addition to the
+.Va ifconfig_ Ns Aq Ar interface
+form, a fallback variable
+.Va ifconfig_DEFAULT
+may be configured.
+It will be used for all interfaces with no
+.Va ifconfig_ Ns Aq Ar interface
+variable.
+This is intended to replace the no longer supported
+.Va pccard_ifconfig
+variable.
+.Pp
+It is also possible to rename an interface by doing:
+.Bd -literal
+ifconfig_ed0_name="net0"
+ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00"
+.Ed
+.It Va ipv6_enable
+This variable is deprecated.
+Use
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+and
+.Va ipv6_activate_all_interfaces
+if necessary.
+.Pp
+.Pq Vt bool
+If the variable is
+.Dq Li YES ,
+.Dq Li inet6 accept_rtadv
+is added to all of
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+and the
+.Va ipv6_activate_all_interfaces
+is defined as
+.Dq Li YES .
+.It Va ipv6_prefer
+This variable is deprecated.
+Use
+.Va ip6addrctl_policy
+instead.
+.Pp
+.Pq Vt bool
+If the variable is
+.Dq Li YES ,
+the default address selection policy table set by
+.Xr ip6addrctl 8
+will be IPv6-preferred.
+.Pp
+If the variable is
+.Dq Li NO ,
+the default address selection policy table set by
+.Xr ip6addrctl 8
+will be IPv4-preferred.
+.It Va ipv6_activate_all_interfaces
+.Pq Vt bool
+This controls initial configuration on IPv6-capable
+interfaces with no corresponding
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+variable.
+Note that it is not always necessary to set this variable to
+.Dq YES
+to use IPv6 functionality on
+.Fx .
+In most cases, just configuring
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+variables works.
+.Pp
+If the variable is
+.Dq Li NO ,
+all interfaces which do not have a corresponding
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+variable will be marked as
+.Dq Li IFDISABLED
+at creation.
+This means that all of IPv6 functionality on that interface
+is completely disabled to enforce a security policy.
+If the variable is set to
+.Dq YES ,
+the flag will be cleared on all of the interfaces.
+.Pp
+In most cases, just defining an
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+for an IPv6-capable interface should be sufficient.
+However, if an interface is added dynamically
+.Pq by some tunneling protocols such as PPP, for example ,
+it is often difficult to define the variable in advance.
+In such a case, configuring the
+.Dq Li IFDISABLED
+flag can be disabled by setting this variable to
+.Dq YES .
+.Pp
+For more details of the
+.Dq Li IFDISABLED
+flag and keywords
+.Dq Li inet6 ifdisabled ,
+see
+.Xr ifconfig 8 .
+.Pp
+Default is
+.Dq Li NO .
+.It Va ipv6_privacy
+.Pq Vt bool
+If the variable is
+.Dq Li YES
+privacy addresses will be generated for each IPv6
+interface as described in RFC 4941.
+.It Va ipv6_network_interfaces
+.Pq Vt str
+This is the IPv6 equivalent of
+.Va network_interfaces .
+Normally manual configuration of this variable is not needed.
+.Pp
+.It Va ipv6_cpe_wanif
+.Pq Vt str
+If the variable is set to an interface name,
+the
+.Xr ifconfig 8
+options
+.Dq inet6 -no_radr accept_rtadv
+will be added to the specified interface automatically before evaluating
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 ,
+and two
+.Xr sysctl 8
+variables
+.Va net.inet6.ip6.rfc6204w3
+and
+.Va net.inet6.ip6.no_radr
+will be set to 1.
+.Pp
+This means the specified interface will accept ICMPv6 Router
+Advertisement messages on that link and add the discovered
+routers into the Default Router List.
+While the other interfaces can still accept RA messages if the
+.Dq inet6 accept_rtadv
+option is specified, adding
+routes into the Default Router List will be disabled by
+.Dq inet6 no_radr
+option by default.
+See
+.Xr ifconfig 8
+for more details.
+.Pp
+Note that ICMPv6 Router Advertisement messages will be
+accepted even when
+.Va net.inet6.ip6.forwarding
+is 1
+.Pq packet forwarding is enabled
+when
+.Va net.inet6.ip6.rfc6204w3
+is set to 1.
+.Pp
+Default is
+.Dq Li NO .
+.It Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+.Pq Vt str
+IPv6 functionality on an interface should be configured by
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 ,
+instead of setting ifconfig parameters in
+.Va ifconfig_ Ns Aq Ar interface .
+If this variable is empty, all of IPv6 configurations on the
+specified interface by other variables such as
+.Va ipv6_prefix_ Ns Ao Ar interface Ac
+will be ignored.
+.Pp
+Aliases should be set by
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n
+with
+.Dq Li inet6
+keyword.
+For example:
+.Bd -literal
+ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64"
+ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64"
+.Ed
+.Pp
+Interfaces that have an
+.Dq Li inet6 accept_rtadv
+keyword in
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+setting will be automatically configured by SLAAC
+.Pq StateLess Address AutoConfiguration
+described in
+.Rs
+.%T "RFC 4862"
+.Re
+.Pp
+Note that a link-local address will be automatically configured in
+addition to the configured global-scope addresses because the IPv6
+specifications require it on each link.
+The address is calculated from the MAC address by using an algorithm
+defined in
+.Rs
+.%T "RFC 4862"
+.%O "Section 5.3"
+.Re
+.Pp
+If only a link-local address is needed on the interface,
+the following configuration can be used:
+.Bd -literal
+ifconfig_ed0_ipv6="inet6 auto_linklocal"
+.Ed
+.Pp
+A link-local address can also be configured manually.
+This is useful for the default router address of an IPv6 router
+so that it does not change when the network interface
+card is replaced.
+For example:
+.Bd -literal
+ifconfig_ed0_ipv6="inet6 fe80::1 prefixlen 64"
+.Ed
+.It Va ipv6_prefix_ Ns Aq Ar interface
+.Pq Vt str
+If one or more prefixes are defined in
+.Va ipv6_prefix_ Ns Aq Ar interface
+addresses based on each prefix and the EUI-64 interface index will be
+configured on that interface.
+Note that this variable will be ignored when
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+is empty.
+.Pp
+For example, the following configuration
+.Bd -literal
+ipv6_prefix_ed0="2001:db8:1:0 2001:db8:2:0"
+.Ed
+.Pp
+is equivalent to the following:
+.Bd -literal
+ifconfig_ed0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64"
+ifconfig_ed0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast"
+ifconfig_ed0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64"
+ifconfig_ed0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast"
+.Ed
+.Pp
+These Subnet-Router anycast addresses will be added only when
+.Va ipv6_gateway_enable
+is YES.
+.It Va ipv6_default_interface
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+this is the default output interface for scoped addresses.
+This works only with ipv6_gateway_enable="NO".
+.It Va ip6addrctl_enable
+.Pq Vt bool
+This variable is to enable configuring default address selection policy table
+.Pq RFC 3484 .
+The table can be specified in another variable
+.Va ip6addrctl_policy .
+For
+.Va ip6addrctl_policy
+the following keywords can be specified:
+.Dq Li ipv4_prefer ,
+.Dq Li ipv6_prefer ,
+or
+.Dq Li AUTO .
+.Pp
+If
+.Dq Li ipv4_prefer
+or
+.Dq Li ipv6_prefer
+is specified,
+.Xr ip6addrctl 8
+installs a pre-defined policy table described in Section 2.1
+.Pq IPv6-preferred
+or 10.3
+.Pq IPv4-preferred
+of RFC 3484.
+.Pp
+If
+.Dq Li AUTO
+is specified, it attempts to read a file
+.Pa /etc/ip6addrctl.conf
+first.
+If this file is found,
+.Xr ip6addrctl 8
+reads and installs it.
+If not found, a policy is automatically set
+according to
+.Va ipv6_activate_all_interfaces
+variable; if the variable is set to
+.Dq Li YES
+the IPv6-preferred one is used.
+Otherwise IPv4-preferred.
+.Pp
+The default value of
+.Va ip6addrctl_enable
+and
+.Va ip6addrctl_policy
+are
+.Dq Li YES
+and
+.Dq Li AUTO ,
+respectively.
+.It Va cloned_interfaces
+.Pq Vt str
+Set to the list of clonable network interfaces to create on this host.
+Further cloning arguments may be passed to the
+.Xr ifconfig 8
+.Cm create
+command for each interface by setting the
+.Va create_args_ Ns Aq Ar interface
+variable.
+Entries in
+.Va cloned_interfaces
+are automatically appended to
+.Va network_interfaces
+for configuration.
+.It Va fec_interfaces
+.Pq Vt str
+Set to the list of
+.Xr ng_fec 4
+Fast EtherChannel interfaces to configure on this host.
+A
+.Va fecconfig_ Ns Aq Ar interface
+variable is assumed to exist for each value of
+.Ar interface .
+The value of this variable is used to configure link aggregated interfaces
+according to the syntax of the
+.Cm NGM_FEC_ADD_IFACE
+to
+.Xr ngctl 8
+msg.
+Additionally, this option ensures that each listed interface is created
+via the
+.Cm mkpeer
+command to
+.Xr ngctl 8
+before attempting to configure it.
+For example:
+.Bd -literal
+fec_interfaces="fec0"
+fecconfig_fec0="em0 em1"
+ifconfig_fec0="DHCP"
+.Ed
+.It Va gif_interfaces
+.Pq Vt str
+Set to the list of
+.Xr gif 4
+tunnel interfaces to configure on this host.
+A
+.Va gifconfig_ Ns Aq Ar interface
+variable is assumed to exist for each value of
+.Ar interface .
+The value of this variable is used to configure the link layer of the
+tunnel according to the syntax of the
+.Cm tunnel
+option to
+.Xr ifconfig 8 .
+Additionally, this option ensures that each listed interface is created
+via the
+.Cm create
+option to
+.Xr ifconfig 8
+before attempting to configure it.
+.It Va sppp_interfaces
+.Pq Vt str
+Set to the list of
+.Xr sppp 4
+interfaces to configure on this host.
+A
+.Va spppconfig_ Ns Aq Ar interface
+variable is assumed to exist for each value of
+.Ar interface .
+Each interface should also be configured by a general
+.Va ifconfig_ Ns Aq Ar interface
+setting.
+Refer to
+.Xr spppcontrol 8
+for more information about available options.
+.It Va ppp_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ppp 8
+daemon.
+.It Va ppp_profile
+.Pq Vt str
+The name of the profile to use from
+.Pa /etc/ppp/ppp.conf .
+Also used for per-profile overrides of
+.Va ppp_mode
+and
+.Va ppp_nat ,
+and
+.Va ppp_ Ns Ao Ar profile Ac Ns _unit .
+When the profile name contains any of the characters
+.Dq Li .-/+
+they are translated to
+.Dq Li _
+for the proposes of the override variable names.
+.It Va ppp_mode
+.Pq Vt str
+Mode in which to run the
+.Xr ppp 8
+daemon.
+.It Va ppp_ Ns Ao Ar profile Ac Ns _mode
+.Pq Vt str
+Overrides the global
+.Va ppp_mode
+for
+.Ar profile .
+Accepted modes are
+.Dq Li auto ,
+.Dq Li ddial ,
+.Dq Li direct
+and
+.Dq Li dedicated .
+See the manual for a full description.
+.It Va ppp_nat
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enables network address translation.
+Used in conjunction with
+.Va gateway_enable
+allows hosts on private network addresses access to the Internet using
+this host as a network address translating router.
+.It Va ppp_ Ns Ao Ar profile Ac Ns _nat
+.Pq Vt str
+Overrides the global
+.Va ppp_nat
+for
+.Ar profile .
+.It Va ppp_ Ns Ao Ar profile Ac Ns _unit
+.Pq Vt int
+Set the unit number to be used for this profile.
+See the manual description of
+.Fl unit Ns Ar N
+for details.
+.It Va ppp_user
+.Pq Vt str
+The name of the user under which
+.Xr ppp 8
+should be started.
+By
+default,
+.Xr ppp 8
+is started as
+.Dq Li root .
+.It Va rc_conf_files
+.Pq Vt str
+This option is used to specify a list of files that will override
+the settings in
+.Pa /etc/defaults/rc.conf .
+The files will be read in the order in which they are specified and should
+include the full path to the file.
+By default, the files specified are
+.Pa /etc/rc.conf
+and
+.Pa /etc/rc.conf.local
+.It Va zfs_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/rc.d/zfs
+will attempt to automatically mount ZFS file systems and initialize ZFS volumes
+(ZVOLs).
+.It Va gptboot_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/rc.d/gptboot
+will log if the system successfully (or not) booted from a GPT partition,
+which had the
+.Ar bootonce
+attribute set using
+.Xr gpart 8
+utility.
+.It Va gbde_autoattach_all
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/rc.d/gbde
+will attempt to automatically initialize your .bde devices in
+.Pa /etc/fstab .
+.It Va gbde_devices
+.Pq Vt str
+List the devices that the script should try to attach,
+or
+.Dq Li AUTO .
+.It Va gbde_lockdir
+.Pq Vt str
+The directory where the
+.Xr gbde 4
+lockfiles are located.
+The default lockfile directory is
+.Pa /etc .
+.Pp
+The lockfile for each individual
+.Xr gbde 4
+device can be overridden by setting the variable
+.Va gbde_lock_ Ns Aq Ar device ,
+where
+.Ar device
+is the encrypted device without the
+.Dq Pa /dev/
+and
+.Dq Pa .bde
+parts.
+.It Va gbde_attach_attempts
+.Pq Vt int
+Number of times to attempt attaching to a
+.Xr gbde 4
+device, i.e., how many times the user is asked for the pass-phrase.
+Default is 3.
+.It Va geli_devices
+.Pq Vt str
+List of devices to automatically attach on boot.
+Note that .eli devices from
+.Pa /etc/fstab
+are automatically appended to this list.
+.It Va geli_tries
+.Pq Vt int
+Number of times user is asked for the pass-phrase.
+If empty, it will be taken from
+.Va kern.geom.eli.tries
+sysctl variable.
+.It Va geli_default_flags
+.Pq Vt str
+Default flags to use by
+.Xr geli 8
+when configuring disk encryption.
+Flags can be configured for every device separately by defining
+.Va geli_ Ns Ao Ar device Ac Ns Va _flags
+variable.
+.It Va geli_autodetach
+.Pq Vt str
+Specifies if GELI devices should be marked for detach on last close after
+file systems are mounted.
+Default is
+.Dq Li YES .
+This can be changed for every device separately by defining
+.Va geli_ Ns Ao Ar device Ac Ns Va _autodetach
+variable.
+.It Va geli_swap_flags
+Options passed to the
+.Xr geli 8
+utility when encrypted GEOM providers for swap partitions are created.
+The default is
+.Dq Li "-e aes -l 256 -s 4096 -d" .
+.It Va root_rw_mount
+.Pq Vt bool
+Set to
+.Dq Li YES
+by default.
+After the file systems are checked at boot time, the root file system
+is remounted as read-write if this is set to
+.Dq Li YES .
+Diskless systems that mount their root file system from a read-only remote
+NFS share should set this to
+.Dq Li NO
+in their
+.Pa rc.conf .
+.It Va fsck_y_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Xr fsck 8
+will be run with the
+.Fl y
+flag if the initial preen
+of the file systems fails.
+.It Va background_fsck
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+the system will attempt to run
+.Xr fsck 8
+in the background where possible.
+.It Va background_fsck_delay
+.Pq Vt int
+The amount of time in seconds to sleep before starting a background
+.Xr fsck 8 .
+It defaults to sixty seconds to allow large applications such as
+the X server to start before disk I/O bandwidth is monopolized by
+.Xr fsck 8 .
+If set to a negative number, the background file system check will be
+delayed indefinitely to allow the administrator to run it at a more
+convenient time.
+For example it may be run from
+.Xr cron 8
+by adding a line like
+.Pp
+.Dl "0 4 * * * root /etc/rc.d/bgfsck forcestart"
+.Pp
+to
+.Pa /etc/crontab .
+.It Va netfs_types
+.Pq Vt str
+List of file system types that are network-based.
+This list should generally not be modified by end users.
+Use
+.Va extra_netfs_types
+instead.
+.It Va extra_netfs_types
+.Pq Vt str
+If set to something other than
+.Dq Li NO
+(the default),
+this variable extends the list of file system types
+for which automatic mounting at startup by
+.Xr rc 8
+should be delayed until the network is initialized.
+It should contain
+a whitespace-separated list of network file system descriptor pairs,
+each consisting of a file system type as passed to
+.Xr mount 8
+and a human-readable, one-word description,
+joined with a colon
+.Pq Ql \&: .
+Extending the default list in this way is only necessary
+when third party file system types are used.
+.It Va syslogd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr syslogd 8
+daemon.
+.It Va syslogd_program
+.Pq Vt str
+Path to
+.Xr syslogd 8
+(default
+.Pa /usr/sbin/syslogd ) .
+.It Va syslogd_flags
+.Pq Vt str
+If
+.Va syslogd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr syslogd 8 .
+.It Va inetd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr inetd 8
+daemon.
+.It Va inetd_program
+.Pq Vt str
+Path to
+.Xr inetd 8
+(default
+.Pa /usr/sbin/inetd ) .
+.It Va inetd_flags
+.Pq Vt str
+If
+.Va inetd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr inetd 8 .
+.It Va hastd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr hastd 8
+daemon.
+.It Va hastd_program
+.Pq Vt str
+Path to
+.Xr hastd 8
+(default
+.Pa /sbin/hastd ) .
+.It Va hastd_flags
+.Pq Vt str
+If
+.Va hastd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr hastd 8 .
+.It Va named_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr named 8
+daemon.
+.It Va named_program
+.Pq Vt str
+Path to
+.Xr named 8
+(default
+.Pa /usr/sbin/named ) .
+.It Va named_conf
+.Pq Vt str
+Path to
+.Xr named 8
+configuration file, (default
+.Pa /etc/namedb/named.conf ) .
+.It Va named_flags
+.Pq Vt str
+If
+.Va named_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr named 8 .
+.It Va named_uid
+.Pq Vt str
+The user that the
+.Xr named 8
+process should be run as.
+.It Va named_chrootdir
+.Pq Vt str
+The root directory for a name server run in a
+.Xr chroot 8
+environment (default
+.Pa /var/named ) .
+If left empty
+.Xr named 8
+will not be run in a
+.Xr chroot 8
+environment.
+.It Va named_chroot_autoupdate
+.Pq Vt bool
+Set to
+.Dq Li NO
+to disable automatic update of the
+.Xr chroot 8
+environment.
+.It Va named_symlink_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+to disable symlinking of
+daemon's PID file
+into the
+.Xr chroot 8
+environment.
+.It Va named_wait
+.Pq Vt bool
+Set to have
+.Pa /etc/rc.d/named
+loop until working name service is established.
+.It Va named_wait_host
+.Pq Vt str
+Name of host to lookup for the named_wait option.
+(Default localhost)
+.It Va named_auto_forward
+.Pq Vt bool
+Set to enable automatic creation of a forwarder
+configuration file derived from
+.Pa /etc/resolv.conf .
+.It Va named_auto_forward_only
+.Pq Vt bool
+Set to change the default forwarder configuration from
+.Dq forward first
+to
+.Dq forward only .
+.It Va kerberos5_server_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start a Kerberos 5 authentication server
+at boot time.
+.It Va kerberos5_server
+.Pq Vt str
+If
+.Va kerberos5_server_enable
+is set to
+.Dq Li YES
+this is the path to Kerberos 5 Authentication Server.
+.It Va kerberos5_server_flags
+.Pq Vt str
+Empty by default.
+This variable contains additional flags to be passed to the Kerberos 5
+authentication server.
+.It Va kadmind5_server_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr kadmind 8 ,
+the Kerberos 5 Administration Daemon; set to
+.Dq Li NO
+on a slave server.
+.It Va kadmind5_server
+.Pq Vt str
+If
+.Va kadmind5_server_enable
+is set to
+.Dq Li YES
+this is the path to Kerberos 5 Administration Daemon.
+.It Va kpasswdd_server_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr kpasswdd 8 ,
+the Kerberos 5 Password-Changing Daemon; set to
+.Dq Li NO
+on a slave server.
+.It Va kpasswdd_server
+.Pq Vt str
+If
+.Va kpasswdd_server_enable
+is set to
+.Dq Li YES
+this is the path to Kerberos 5 Password-Changing Daemon.
+.It Va rwhod_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rwhod 8
+daemon at boot time.
+.It Va rwhod_flags
+.Pq Vt str
+If
+.Va rwhod_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to it.
+.It Va amd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr amd 8
+daemon at boot time.
+.It Va amd_flags
+.Pq Vt str
+If
+.Va amd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to it.
+See the
+.Xr amd 8
+manpage for more information.
+.It Va amd_map_program
+.Pq Vt str
+If set,
+the specified program is run to get the list of
+.Xr amd 8
+maps.
+For example, if the
+.Xr amd 8
+maps are stored in NIS, one can set this to
+run
+.Xr ypcat 1
+to get a list of
+.Xr amd 8
+maps from the
+.Pa amd.master
+NIS map.
+.It Va update_motd
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Pa /etc/motd
+will be updated at boot time to reflect the kernel release
+being run.
+If set to
+.Dq Li NO ,
+.Pa /etc/motd
+will not be updated.
+.It Va nfs_client_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the NFS client daemons at boot time.
+.It Va nfs_access_cache
+.Pq Vt int
+If
+.Va nfs_client_enable
+is set to
+.Dq Li YES ,
+this can be set to
+.Dq Li 0
+to disable NFS ACCESS RPC caching, or to the number of seconds for which
+NFS ACCESS
+results should be cached.
+A value of 2-10 seconds will substantially reduce network
+traffic for many NFS operations.
+.It Va nfs_server_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the NFS server daemons at boot time.
+.It Va nfs_server_flags
+.Pq Vt str
+If
+.Va nfs_server_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr nfsd 8
+daemon.
+.It Va nfsv4_server_enable
+.Pq Vt bool
+If
+.Va nfs_server_enable
+is set to
+.Dq Li YES
+and
+.Va nfsv4_server_enable
+are set to
+.Dq Li YES ,
+enable the server for NFSv4 as well as NFSv2 and NFSv3.
+.It Va nfsuserd_enable
+.Pq Vt bool
+If
+.Va nfsuserd_enable
+is set to
+.Dq Li YES ,
+run the nfsuserd daemon, which is needed for NFSv4 in order
+to map between user/group names vs uid/gid numbers.
+If
+.Va nfsv4_server_enable
+is set to
+.Dq Li YES ,
+this will be forced enabled.
+.It Va nfsuserd_flags
+.Pq Vt str
+If
+.Va nfsuserd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr nfsuserd 8
+daemon.
+.It Va nfscbd_enable
+.Pq Vt bool
+If
+.Va nfscbd_enable
+is set to
+.Dq Li YES ,
+run the nfscbd daemon, which enables callbacks/delegations for the NFSv4 client.
+.It Va nfscbd_flags
+.Pq Vt str
+If
+.Va nfscbd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr nfscbd 8
+daemon.
+.It Va oldnfs_server_enable
+.Pq Vt bool
+If
+.Va oldnfs_server_enable
+is set to
+.Dq Li YES ,
+force the NFS server daemons to run the old NFS server code
+that does not support NFSv4.
+.It Va mountd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+and no
+.Va nfs_server_enable
+is set, start
+.Xr mountd 8 ,
+but not
+.Xr nfsd 8
+daemon.
+It is commonly needed to run CFS without real NFS used.
+.It Va mountd_flags
+.Pq Vt str
+If
+.Va mountd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr mountd 8
+daemon.
+.It Va weak_mountd_authentication
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+allow services like PCNFSD to make non-privileged mount
+requests.
+.It Va nfs_reserved_port_only
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+provide NFS services only on a secure port.
+.It Va nfs_bufpackets
+.Pq Vt int
+If set to a number, indicates the number of packets worth of
+socket buffer space to reserve on an NFS client.
+The kernel default is typically 4.
+Using a higher number may be
+useful on gigabit networks to improve performance.
+The minimum value is
+2 and the maximum is 64.
+.It Va rpc_lockd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and also an NFS server or client, run
+.Xr rpc.lockd 8
+at boot time.
+.It Va rpc_lockd_flags
+.Pq Vt str
+If
+.Va rpc_lockd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rpc.lockd 8
+daemon.
+.It Va rpc_statd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and also an NFS server or client, run
+.Xr rpc.statd 8
+at boot time.
+.It Va rpc_statd_flags
+.Pq Vt str
+If
+.Va rpc_statd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rpc.statd 8
+daemon.
+.It Va rpcbind_program
+.Pq Vt str
+Path to
+.Xr rpcbind 8
+(default
+.Pa /usr/sbin/rpcbind ) .
+.It Va rpcbind_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rpcbind 8
+service at boot time.
+.It Va rpcbind_flags
+.Pq Vt str
+If
+.Va rpcbind_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rpcbind 8
+daemon.
+.It Va keyserv_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr keyserv 8
+daemon on boot for running Secure RPC.
+.It Va keyserv_flags
+.Pq Vt str
+If
+.Va keyserv_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr keyserv 8
+daemon.
+.It Va pppoed_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr pppoed 8
+daemon at boot time to provide PPP over Ethernet services.
+.It Va pppoed_ Ns Aq Ar provider
+.Pq Vt str
+.Xr pppoed 8
+listens to requests to this
+.Ar provider
+and ultimately runs
+.Xr ppp 8
+with a
+.Ar system
+argument of the same name.
+.It Va pppoed_flags
+.Pq Vt str
+Additional flags to pass to
+.Xr pppoed 8 .
+.It Va pppoed_interface
+.Pq Vt str
+The network interface to run
+.Xr pppoed 8
+on.
+This is mandatory when
+.Va pppoed_enable
+is set to
+.Dq Li YES .
+.It Va timed_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr timed 8
+service at boot time.
+This command is intended for networks of
+machines where a consistent
+.Dq "network time"
+for all hosts must be established.
+This is often useful in large NFS
+environments where time stamps on files are expected to be consistent
+network-wide.
+.It Va timed_flags
+.Pq Vt str
+If
+.Va timed_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr timed 8
+service.
+.It Va ntpdate_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run
+.Xr ntpdate 8
+at system startup.
+This command is intended to
+synchronize the system clock only
+.Em once
+from some standard reference.
+An option to set this up initially
+(from a list of known servers) is also provided by the
+.Xr sysinstall 8
+program when the system is first installed.
+.It Va ntpdate_config
+.Pq Vt str
+Configuration file for
+.Xr ntpdate 8 .
+Default
+.Pa /etc/ntp.conf .
+.It Va ntpdate_hosts
+.Pq Vt str
+A whitespace-separated list of NTP servers to synchronize with at startup.
+The default is to use the servers listed in
+.Va ntpdate_config ,
+if that file exists.
+.It Va ntpdate_program
+.Pq Vt str
+Path to
+.Xr ntpdate 8
+(default
+.Pa /usr/sbin/ntpdate ) .
+.It Va ntpdate_flags
+.Pq Vt str
+If
+.Va ntpdate_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ntpdate 8
+command (typically a hostname).
+.It Va ntpd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ntpd 8
+command at boot time.
+.It Va ntpd_program
+.Pq Vt str
+Path to
+.Xr ntpd 8
+(default
+.Pa /usr/sbin/ntpd ) .
+.It Va ntpd_config
+.Pq Vt str
+Path to
+.Xr ntpd 8
+configuration file.
+Default
+.Pa /etc/ntp.conf .
+.It Va ntpd_flags
+.Pq Vt str
+If
+.Va ntpd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ntpd 8
+daemon.
+.It Va ntpd_sync_on_start
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+.Xr ntpd 8
+is run with the
+.Fl g
+flag, which syncs the system's clock on startup.
+See
+.Xr ntpd 8
+for more information regarding the
+.Fl g
+option.
+This is a preferred alternative to using
+.Xr ntpdate 8
+or specifying the
+.Va ntpdate_enable
+variable.
+.It Va nis_client_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ypbind 8
+service at system boot time.
+.It Va nis_client_flags
+.Pq Vt str
+If
+.Va nis_client_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ypbind 8
+service.
+.It Va nis_ypset_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ypset 8
+daemon at system boot time.
+.It Va nis_ypset_flags
+.Pq Vt str
+If
+.Va nis_ypset_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ypset 8
+daemon.
+.It Va nis_server_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ypserv 8
+daemon at system boot time.
+.It Va nis_server_flags
+.Pq Vt str
+If
+.Va nis_server_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ypserv 8
+daemon.
+.It Va nis_ypxfrd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rpc.ypxfrd 8
+daemon at system boot time.
+.It Va nis_ypxfrd_flags
+.Pq Vt str
+If
+.Va nis_ypxfrd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rpc.ypxfrd 8
+daemon.
+.It Va nis_yppasswdd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rpc.yppasswdd 8
+daemon at system boot time.
+.It Va nis_yppasswdd_flags
+.Pq Vt str
+If
+.Va nis_yppasswdd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rpc.yppasswdd 8
+daemon.
+.It Va rpc_ypupdated_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Nm rpc.ypupdated
+daemon at system boot time.
+.It Va bsnmpd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr bsnmpd 1
+daemon at system boot time.
+Be sure to understand the security implications of running SNMP daemon
+on your host.
+.It Va bsnmpd_flags
+.Pq Vt str
+If
+.Va bsnmpd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr bsnmpd 1
+daemon.
+.It Va defaultrouter
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+create a default route to this host name or IP address
+(use an IP address if this router is also required to get to the
+name server!).
+.It Va ipv6_defaultrouter
+.Pq Vt str
+The IPv6 equivalent of
+.Va defaultrouter .
+.It Va static_arp_pairs
+.Pq Vt str
+Set to the list of static ARP pairs that are to be added at system
+boot time.
+For each whitespace separated
+.Ar element
+in the value, a
+.Va static_arp_ Ns Aq Ar element
+variable is assumed to exist whose contents will later be passed to a
+.Dq Nm arp Cm -S
+operation.
+For example
+.Bd -literal
+static_arp_pairs="gw"
+static_arp_gw="192.168.1.1 00:01:02:03:04:05"
+.Ed
+.It Va static_ndp_pairs
+.Pq Vt str
+Set to the list of static NDP pairs that are to be added at system
+boot time.
+For each whitespace separated
+.Ar element
+in the value, a
+.Va static_ndp_ Ns Aq Ar element
+variable is assumed to exist whose contents will later be passed to a
+.Dq Nm ndp Cm -s
+operation.
+For example
+.Bd -literal
+static_ndp_pairs="gw"
+static_ndp_gw="2001:db8:3::1 00:01:02:03:04:05"
+.Ed
+.It Va static_routes
+.Pq Vt str
+Set to the list of static routes that are to be added at system
+boot time.
+If not set to
+.Dq Li NO
+then for each whitespace separated
+.Ar element
+in the value, a
+.Va route_ Ns Aq Ar element
+variable is assumed to exist
+whose contents will later be passed to a
+.Dq Nm route Cm add
+operation.
+For example:
+.Bd -literal
+static_routes="mcast gif0local"
+route_mcast="-net 224.0.0.0/4 -iface gif0"
+route_gif0local="-host 169.254.1.1 -iface lo0"
+.Ed
+.It Va ipv6_static_routes
+.Pq Vt str
+The IPv6 equivalent of
+.Va static_routes .
+If not set to
+.Dq Li NO
+then for each whitespace separated
+.Ar element
+in the value, a
+.Va ipv6_route_ Ns Aq Ar element
+variable is assumed to exist
+whose contents will later be passed to a
+.Dq Nm route Cm add Fl inet6
+operation.
+.It Va natm_static_routes
+.Pq Vt str
+The
+.Xr natmip 4
+equivalent of
+.Va static_routes .
+If not empty then for each whitespace separated
+.Ar element
+in the value, a
+.Va route_ Ns Aq Ar element
+variable is assumed to exist whose contents will later be passed to a
+.Dq Nm atmconfig Cm natm Cm add
+operation.
+.It Va gateway_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+configure host to act as an IP router, e.g.\& to forward packets
+between interfaces.
+.It Va ipv6_gateway_enable
+.Pq Vt bool
+The IPv6 equivalent of
+.Va gateway_enable .
+.It Va routed_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run a routing daemon of some sort, based on the
+settings of
+.Va routed_program
+and
+.Va routed_flags .
+.It Va route6d_enable
+.Pq Vt bool
+The IPv6 equivalent of
+.Va routed_enable .
+If set to
+.Dq Li YES ,
+run a routing daemon of some sort, based on the
+settings of
+.Va route6d_program
+and
+.Va route6d_flags .
+.It Va routed_program
+.Pq Vt str
+If
+.Va routed_enable
+is set to
+.Dq Li YES ,
+this is the name of the routing daemon to use.
+.It Va route6d_program
+.Pq Vt str
+The IPv6 equivalent of
+.Va routed_program .
+.It Va routed_flags
+.Pq Vt str
+If
+.Va routed_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the routing daemon.
+.It Va route6d_flags
+.Pq Vt str
+The IPv6 equivalent of
+.Va routed_flags .
+.It Va mrouted_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the multicast routing daemon,
+.Xr mrouted 8 .
+.It Va mroute6d_enable
+.Pq Vt bool
+The IPv6 equivalent of
+.Va mrouted_enable .
+If set to
+.Dq Li YES ,
+run the IPv6 multicast routing daemon.
+.Pp
+Note that multicast routing daemons are no longer included in the
+.Fx
+base system, however, both
+.Xr mrouted 8
+and
+.Xr pim6dd 8
+may be installed from the
+.Fx
+Ports Collection.
+.It Va mrouted_flags
+.Pq Vt str
+If
+.Va mrouted_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr mrouted 8
+daemon.
+.It Va mroute6d_flags
+.Pq Vt str
+The IPv6 equivalent of
+.Va mrouted_flags .
+If
+.Va mroute6d_enable
+is set to
+.Dq Li YES ,
+these are the flags passed to the IPv6 multicast routing daemon.
+.It Va mroute6d_program
+.Pq Vt str
+If
+.Va mroute6d_enable
+is set to
+.Dq Li YES ,
+this is the path to the IPv6 multicast routing daemon.
+.It Va rtadvd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rtadvd 8
+daemon at boot time.
+The
+.Xr rtadvd 8
+utility sends ICMPv6 Router Advertisement messages to
+the interfaces specified in
+.Va rtadvd_interfaces .
+This should only be enabled with great care.
+You may want to fine-tune
+.Xr rtadvd.conf 5 .
+.It Va rtadvd_interfaces
+.Pq Vt str
+If
+.Va rtadvd_enable
+is set to
+.Dq Li YES
+this is the list of interfaces to use.
+.It Va ipxgateway_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable the routing of IPX traffic.
+.It Va ipxrouted_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr IPXrouted 8
+daemon at system boot time.
+.It Va ipxrouted_flags
+.Pq Vt str
+If
+.Va ipxrouted_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr IPXrouted 8
+daemon.
+.It Va arpproxy_all
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable global proxy ARP.
+.It Va forward_sourceroute
+.Pq Vt bool
+If set to
+.Dq Li YES
+and
+.Va gateway_enable
+is also set to
+.Dq Li YES ,
+source-routed packets are forwarded.
+.It Va accept_sourceroute
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+the system will accept source-routed packets directed at it.
+.It Va rarpd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr rarpd 8
+daemon at system boot time.
+.It Va rarpd_flags
+.Pq Vt str
+If
+.Va rarpd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr rarpd 8
+daemon.
+.It Va bootparamd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr bootparamd 8
+daemon at system boot time.
+.It Va bootparamd_flags
+.Pq Vt str
+If
+.Va bootparamd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr bootparamd 8
+daemon.
+.It Va stf_interface_ipv4addr
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+this is the local IPv4 address for 6to4 (IPv6 over IPv4 tunneling
+interface).
+Specify this entry to enable the 6to4 interface.
+.It Va stf_interface_ipv4plen
+.Pq Vt int
+Prefix length for 6to4 IPv4 addresses, to limit peer address range.
+An effective value is 0-31.
+.It Va stf_interface_ipv6_ifid
+.Pq Vt str
+IPv6 interface ID for
+.Xr stf 4 .
+This can be set to
+.Dq Li AUTO .
+.It Va stf_interface_ipv6_slaid
+.Pq Vt str
+IPv6 Site Level Aggregator for
+.Xr stf 4 .
+.It Va ipv6_faith_prefix
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+this is the faith prefix to enable a FAITH IPv6-to-IPv4 TCP
+translator.
+You also need
+.Xr faithd 8
+setup.
+.It Va ipv6_ipv4mapping
+.Pq Vt bool
+If set to
+.Dq Li YES
+this enables IPv4 mapped IPv6 address communication (like
+.Li ::ffff:a.b.c.d ) .
+.It Va atm_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable the configuration of ATM interfaces at system boot time.
+For all of the ATM variables described below, please refer to the
+.Xr atm 8
+manual page for further details on the available command parameters.
+Also refer to the files in
+.Pa /usr/share/examples/atm
+for more detailed configuration information.
+.It Va atm_load
+.Pq Vt str
+This is a list of physical ATM interface drivers to load.
+Typical values are
+.Dq Li hfa_pci
+and/or
+.Dq Li hea_pci .
+.It Va atm_netif_ Ns Aq Ar intf
+.Pq Vt str
+For the ATM physical interface
+.Ar intf ,
+this variable defines the name prefix and count for the ATM network
+interfaces to be created.
+The value will be passed as the parameters of an
+.Dq Nm atm Cm "set netif" Ar intf
+command.
+.It Va atm_sigmgr_ Ns Aq Ar intf
+.Pq Vt str
+For the ATM physical interface
+.Ar intf ,
+this variable defines the ATM signalling manager to be used.
+The value will be passed as the parameters of an
+.Dq Nm atm Cm attach Ar intf
+command.
+.It Va atm_prefix_ Ns Aq Ar intf
+.Pq Vt str
+For the ATM physical interface
+.Ar intf ,
+this variable defines the NSAP prefix for interfaces using a UNI signalling
+manager.
+If set to
+.Dq Li ILMI ,
+the prefix will automatically be set via the
+.Xr ilmid 8
+daemon.
+Otherwise, the value will be passed as the parameters of an
+.Dq Nm atm Cm "set prefix" Ar intf
+command.
+.It Va atm_macaddr_ Ns Aq Ar intf
+.Pq Vt str
+For the ATM physical interface
+.Ar intf ,
+this variable defines the MAC address for interfaces using a UNI signalling
+manager.
+If set to
+.Dq Li NO ,
+the hardware MAC address contained in the ATM interface card will be used.
+Otherwise, the value will be passed as the parameters of an
+.Dq Nm atm Cm "set mac" Ar intf
+command.
+.It Va atm_arpserver_ Ns Aq Ar netif
+.Pq Vt str
+For the ATM network interface
+.Ar netif ,
+this variable defines the ATM address for a host which is to provide ATMARP
+service.
+This variable is only applicable to interfaces using a UNI signalling
+manager.
+If set to
+.Dq Li local ,
+this host will become an ATMARP server.
+The value will be passed as the parameters of an
+.Dq Nm atm Cm "set arpserver" Ar netif
+command.
+.It Va atm_scsparp_ Ns Aq Ar netif
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+SCSP/ATMARP service for the network interface
+.Ar netif
+will be initiated using the
+.Xr scspd 8
+and
+.Xr atmarpd 8
+daemons.
+This variable is only applicable if
+.Va atm_arpserver_ Ns Aq Ar netif
+is set to
+.Dq Li local .
+.It Va atm_pvcs
+.Pq Vt str
+Set to the list of ATM PVCs to be added at system
+boot time.
+For each whitespace separated
+.Ar element
+in the value, an
+.Va atm_pvc_ Ns Aq Ar element
+variable is assumed to exist.
+The value of each of these variables
+will be passed as the parameters of an
+.Dq Nm atm Cm "add pvc"
+command.
+.It Va atm_arps
+.Pq Vt str
+Set to the list of permanent ATM ARP entries to be added
+at system boot time.
+For each whitespace separated
+.Ar element
+in the value, an
+.Va atm_arp_ Ns Aq Ar element
+variable is assumed to exist.
+The value of each of these variables
+will be passed as the parameters of an
+.Dq Nm atm Cm "add arp"
+command.
+.It Va natm_interfaces
+.Pq Vt str
+Set to the list of
+.Xr natm 4
+interfaces that will also be used for HARP through
+.Xr harp 4 .
+If this list is not empty all interfaces in the list will be brought up
+with
+.Xr ifconfig 8
+and
+.Xr harp 4
+will be loaded.
+For this to work the interface drivers must be either compiled into the
+kernel or must reside on the root partition.
+.It Va keybell
+.Pq Vt str
+The keyboard bell sound.
+Set to
+.Dq Li normal ,
+.Dq Li visual ,
+.Dq Li off ,
+or
+.Dq Li NO
+if the default behavior is desired.
+For details, refer to the
+.Xr kbdcontrol 1
+manpage.
+.It Va keyboard
+.Pq Vt str
+If set to a non-null string, the virtual console's keyboard input is
+set to this device.
+.It Va keymap
+.Pq Vt str
+If set to
+.Dq Li NO ,
+no keymap is installed, otherwise the value is used to install
+the keymap file in
+.Pa /usr/share/syscons/keymaps/ Ns Ao Ar value Ac Ns Pa .kbd .
+.It Va keyrate
+.Pq Vt str
+The keyboard repeat speed.
+Set to
+.Dq Li slow ,
+.Dq Li normal ,
+.Dq Li fast ,
+or
+.Dq Li NO
+if the default behavior is desired.
+.It Va keychange
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+attempt to program the function keys with the value.
+The value should
+be a single string of the form:
+.Dq Ar funkey_number new_value Op Ar funkey_number new_value ... .
+.It Va cursor
+.Pq Vt str
+Can be set to the value of
+.Dq Li normal ,
+.Dq Li blink ,
+.Dq Li destructive ,
+or
+.Dq Li NO
+to set the cursor behavior explicitly or choose the default behavior.
+.It Va scrnmap
+.Pq Vt str
+If set to
+.Dq Li NO ,
+no screen map is installed, otherwise the value is used to install
+the screen map file in
+.Pa /usr/share/syscons/scrnmaps/ Ns Aq Ar value .
+.It Va font8x16
+.Pq Vt str
+If set to
+.Dq Li NO ,
+the default 8x16 font value is used for screen size requests, otherwise
+the value in
+.Pa /usr/share/syscons/fonts/ Ns Aq Ar value
+is used.
+.It Va font8x14
+.Pq Vt str
+If set to
+.Dq Li NO ,
+the default 8x14 font value is used for screen size requests, otherwise
+the value in
+.Pa /usr/share/syscons/fonts/ Ns Aq Ar value
+is used.
+.It Va font8x8
+.Pq Vt str
+If set to
+.Dq Li NO ,
+the default 8x8 font value is used for screen size requests, otherwise
+the value in
+.Pa /usr/share/syscons/fonts/ Ns Aq Ar value
+is used.
+.It Va blanktime
+.Pq Vt int
+If set to
+.Dq Li NO ,
+the default screen blanking interval is used, otherwise it is set
+to
+.Ar value
+seconds.
+.It Va saver
+.Pq Vt str
+If not set to
+.Dq Li NO ,
+this is the actual screen saver to use
+.Li ( blank , snake , daemon ,
+etc).
+.It Va moused_nondefault_enable
+.Pq Vt str
+If set to
+.Dq Li NO ,
+the mouse device specified on
+the command line is not automatically treated as enabled by the
+.Pa /etc/rc.d/moused
+script.
+Having this variable set to
+.Dq Li YES
+allows a
+.Xr usb 4
+mouse,
+for example,
+to be enabled as soon as it is plugged in.
+.It Va moused_enable
+.Pq Vt str
+If set to
+.Dq Li YES ,
+the
+.Xr moused 8
+daemon is started for doing cut/paste selection on the console.
+.It Va moused_type
+.Pq Vt str
+This is the protocol type of the mouse connected to this host.
+This variable must be set if
+.Va moused_enable
+is set to
+.Dq Li YES .
+The
+.Xr moused 8
+daemon
+is able to detect the appropriate mouse type automatically in many cases.
+Set this variable to
+.Dq Li auto
+to let the daemon detect it, or
+select one from the following list if the automatic detection fails.
+.Pp
+If the mouse is attached to the PS/2 mouse port, choose
+.Dq Li auto
+or
+.Dq Li ps/2 ,
+regardless of the brand and model of the mouse.
+Likewise, if the
+mouse is attached to the bus mouse port, choose
+.Dq Li auto
+or
+.Dq Li busmouse .
+All other protocols are for serial mice and will not work with
+the PS/2 and bus mice.
+If this is a USB mouse,
+.Dq Li auto
+is the only protocol type which will work.
+.Pp
+.Bl -tag -width ".Li x10mouseremote" -compact
+.It Li microsoft
+Microsoft mouse (serial)
+.It Li intellimouse
+Microsoft IntelliMouse (serial)
+.It Li mousesystems
+Mouse systems Corp.\& mouse (serial)
+.It Li mmseries
+MM Series mouse (serial)
+.It Li logitech
+Logitech mouse (serial)
+.It Li busmouse
+A bus mouse
+.It Li mouseman
+Logitech MouseMan and TrackMan (serial)
+.It Li glidepoint
+ALPS GlidePoint (serial)
+.It Li thinkingmouse
+Kensington ThinkingMouse (serial)
+.It Li ps/2
+PS/2 mouse
+.It Li mmhittab
+MM HitTablet (serial)
+.It Li x10mouseremote
+X10 MouseRemote (serial)
+.It Li versapad
+Interlink VersaPad (serial)
+.El
+.Pp
+Even if the mouse is not in the above list, it may be compatible
+with one in the list.
+Refer to the manual page for
+.Xr moused 8
+for compatibility information.
+.Pp
+It should also be noted that while this is enabled, any
+other client of the mouse (such as an X server) should access
+the mouse through the virtual mouse device,
+.Pa /dev/sysmouse ,
+and configure it as a
+.Dq Li sysmouse
+type mouse, since all
+mouse data is converted to this single canonical format when
+using
+.Xr moused 8 .
+If the client program does not support the
+.Dq Li sysmouse
+type,
+specify the
+.Dq Li mousesystems
+type.
+It is the second preferred type.
+.It Va moused_port
+.Pq Vt str
+If
+.Va moused_enable
+is set to
+.Dq Li YES ,
+this is the actual port the mouse is on.
+It might be
+.Pa /dev/cuad0
+for a COM1 serial mouse,
+.Pa /dev/psm0
+for a PS/2 mouse or
+.Pa /dev/mse0
+for a bus mouse, for example.
+.It Va moused_flags
+.Pq Vt str
+If
+.Va moused_flags
+is set, its value is used as an additional set of flags to pass to the
+.Xr moused 8
+daemon.
+.It Va "moused_" Ns Ar XXX Ns Va "_flags"
+When
+.Va moused_nondefault_enable
+is enabled, and a
+.Xr moused 8
+daemon is started for a non-default port, the
+.Va "moused_" Ns Ar XXX Ns Va "_flags"
+set of options has precedence over and replaces the default
+.Va moused_flags (where
+.Ar XXX
+is the name of the non-default port, i.e.\&
+.Ar ums0 ) .
+By setting
+.Va "moused_" Ns Ar XXX Ns Va "_flags"
+it is possible to set up a different set of default flags for each
+.Xr moused 8
+instance.
+For example, you can use
+.Dq Li "-3"
+for the default
+.Va moused_flags
+to make your laptop's touchpad more comfortable to use,
+but an empty set of options for
+.Va moused_ums0_flags
+when your
+.Xr usb 4
+mouse has three or more buttons.
+.It Va mousechar_start
+.Pq Vt int
+If set to
+.Dq Li NO ,
+the default mouse cursor character range
+.Li 0xd0 Ns - Ns Li 0xd3
+is used,
+otherwise the range start is set
+to
+.Ar value
+character, see
+.Xr vidcontrol 1 .
+Use if the default range is occupied in the language code table.
+.It Va allscreens_flags
+.Pq Vt str
+If set,
+.Xr vidcontrol 1
+is run with these options for each of the virtual terminals
+.Pq Pa /dev/ttyv* .
+For example,
+.Dq Fl m Cm on
+will enable the mouse pointer on all virtual terminals
+if
+.Va moused_enable
+is set to
+.Dq Li YES .
+.It Va allscreens_kbdflags
+.Pq Vt str
+If set,
+.Xr kbdcontrol 1
+is run with these options for each of the virtual terminals
+.Pq Pa /dev/ttyv* .
+For example,
+.Dq Fl h Li 200
+will set the
+.Xr syscons 4
+scrollback (history) buffer to 200 lines.
+.It Va cron_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr cron 8
+daemon at system boot time.
+.It Va cron_program
+.Pq Vt str
+Path to
+.Xr cron 8
+(default
+.Pa /usr/sbin/cron ) .
+.It Va cron_flags
+.Pq Vt str
+If
+.Va cron_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to
+.Xr cron 8 .
+.It Va cron_dst
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable the special handling of transitions to and from the
+Daylight Saving Time in
+.Xr cron 8
+(equivalent to using the flag
+.Fl s ) .
+.It Va lpd_program
+.Pq Vt str
+Path to
+.Xr lpd 8
+(default
+.Pa /usr/sbin/lpd ) .
+.It Va lpd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr lpd 8
+daemon at system boot time.
+.It Va lpd_flags
+.Pq Vt str
+If
+.Va lpd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr lpd 8
+daemon.
+.It Va chkprintcap_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr chkprintcap 8
+command before starting the
+.Xr lpd 8
+daemon.
+.It Va chkprintcap_flags
+.Pq Vt str
+If
+.Va lpd_enable
+and
+.Va chkprintcap_enable
+are set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr chkprintcap 8
+program.
+The default is
+.Dq Li -d ,
+which causes missing directories to be created.
+.It Va mta_start_script
+.Pq Vt str
+This variable specifies the full path to the script to run to start
+a mail transfer agent.
+The default is
+.Pa /etc/rc.sendmail .
+The
+.Va sendmail_*
+variables which
+.Pa /etc/rc.sendmail
+uses are documented in the
+.Xr rc.sendmail 8
+manual page.
+.It Va dumpdev
+.Pq Vt str
+Indicates the device (usually a swap partition) to which a crash dump
+should be written in the event of a system crash.
+If the value of this variable is
+.Dq Li AUTO ,
+the first suitable swap device listed in
+.Pa /etc/fstab
+will be used as dump device.
+Otherwise, the value of this variable is passed as the argument to
+.Xr dumpon 8 .
+To disable crash dumps, set this variable to
+.Dq Li NO .
+.It Va dumpdir
+.Pq Vt str
+When the system reboots after a crash and a crash dump is found on the
+device specified by the
+.Va dumpdev
+variable,
+.Xr savecore 8
+will save that crash dump and a copy of the kernel to the directory
+specified by the
+.Va dumpdir
+variable.
+The default value is
+.Pa /var/crash .
+Set to
+.Dq Li NO
+to not run
+.Xr savecore 8
+at boot time when
+.Va dumpdir
+is set.
+.It Va savecore_flags
+.Pq Vt str
+If crash dumps are enabled, these are the flags to pass to the
+.Xr savecore 8
+utility.
+.It Va quota_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to turn on user and group disk quotas on system startup via the
+.Xr quotaon 8
+command for all file systems marked as having quotas enabled in
+.Pa /etc/fstab .
+The kernel must be built with
+.Cd "options QUOTA"
+for disk quotas to function.
+.It Va check_quotas
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable user and group disk quota checking via the
+.Xr quotacheck 8
+command.
+.It Va quotacheck_flags
+.Pq Vt str
+If
+.Va quota_enable
+is set to
+.Dq Li YES ,
+and
+.Va check_quotas
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr quotacheck 8
+utility.
+The default is
+.Dq Li "-a" ,
+which checks quotas for all file systems with quotas enabled in
+.Pa /etc/fstab .
+.It Va quotaon_flags
+.Pq Vt str
+If
+.Va quota_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr quotaon 8
+utility.
+The default is
+.Dq Li "-a" ,
+which enables quotas for all file systems with quotas enabled in
+.Pa /etc/fstab .
+.It Va quotaoff_flags
+.Pq Vt str
+If
+.Va quota_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr quotaoff 8
+utility when shutting down the quota system.
+The default is
+.Dq Li "-a" ,
+which disables quotas for all file systems with quotas enabled in
+.Pa /etc/fstab .
+.It Va accounting_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable system accounting through the
+.Xr accton 8
+facility.
+.It Va ibcs2_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable iBCS2 (SCO) binary emulation at system initial boot
+time.
+.It Va ibcs2_loaders
+.Pq Vt str
+If not set to
+.Dq Li NO
+and if
+.Va ibcs2_enable
+is set to
+.Dq Li YES ,
+this specifies a list of additional iBCS2 loaders to enable.
+.It Va linux_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to enable Linux/ELF binary emulation at system initial
+boot time.
+.It Va svr4_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable SysVR4 emulation at boot time.
+.It Va sysvipc_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+load System V IPC primitives at boot time.
+.It Va clear_tmp_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to have
+.Pa /tmp
+cleaned at startup.
+.It Va clear_tmp_X
+.Pq Vt bool
+Set to
+.Dq Li NO
+to disable removing of X11 lock files,
+and the removal and (secure) recreation
+of the various socket directories for X11
+related programs.
+.It Va ldconfig_paths
+.Pq Vt str
+Set to the list of shared library paths to use with
+.Xr ldconfig 8 .
+NOTE:
+.Pa /usr/lib
+will always be added first, so it need not appear in this list.
+.It Va ldconfig32_paths
+.Pq Vt str
+Set to the list of 32-bit compatibility shared library paths to
+use with
+.Xr ldconfig 8 .
+.It Va ldconfig_paths_aout
+.Pq Vt str
+Set to the list of shared library paths to use with
+.Xr ldconfig 8
+legacy
+.Xr a.out 5
+support.
+.It Va ldconfig_insecure
+.Pq Vt bool
+The
+.Xr ldconfig 8
+utility normally refuses to use directories
+which are writable by anyone except root.
+Set this variable to
+.Dq Li YES
+to disable that security check during system startup.
+.It Va ldconfig_local_dirs
+.Pq Vt str
+Set to the list of local
+.Xr ldconfig 8
+directories.
+The names of all files in the directories listed will be
+passed as arguments to
+.Xr ldconfig 8 .
+.It Va ldconfig_local32_dirs
+.Pq Vt str
+Set to the list of local 32-bit compatibility
+.Xr ldconfig 8
+directories.
+The names of all files in the directories listed will be
+passed as arguments to
+.Dq Nm ldconfig Fl 32 .
+.It Va kern_securelevel_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to set the kernel security level at system startup.
+.It Va kern_securelevel
+.Pq Vt int
+The kernel security level to set at startup.
+The allowed range of
+.Ar value
+ranges from \-1 (the compile time default) to 3 (the
+most secure).
+See
+.Xr security 7
+for the list of possible security levels and their effect
+on system operation.
+.It Va sshd_program
+.Pq Vt str
+Path to the SSH server program
+.Pa ( /usr/sbin/sshd
+is the default).
+.It Va sshd_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr sshd 8
+at system boot time.
+.It Va sshd_flags
+.Pq Vt str
+If
+.Va sshd_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sshd 8
+daemon.
+.It Va ftpd_program
+.Pq Vt str
+Path to the FTP server program
+.Pa ( /usr/libexec/ftpd
+is the default).
+.It Va ftpd_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to start
+.Xr ftpd 8
+as a stand-alone daemon at system boot time.
+.It Va ftpd_flags
+.Pq Vt str
+If
+.Va ftpd_enable
+is set to
+.Dq Li YES ,
+these are the additional flags to pass to the
+.Xr ftpd 8
+daemon.
+.It Va watchdogd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+start the
+.Xr watchdogd 8
+daemon at boot time.
+This requires that the kernel have been compiled with a
+.Xr watchdog 4
+compatible device.
+.It Va watchdogd_flags
+.Pq Vt str
+If
+.Va watchdogd_enable
+is set to
+.Dq Li YES ,
+these are the flags passed to the
+.Xr watchdogd 8
+daemon.
+.It Va devfs_rulesets
+.Pq Vt str
+List of files containing sets of rules for
+.Xr devfs 8 .
+.It Va devfs_system_ruleset
+.Pq Vt str
+Rule name(s) to apply to the system
+.Pa /dev
+itself.
+.It Va devfs_set_rulesets
+.Pq Vt str
+Pairs of already-mounted
+.Pa dev
+directories and rulesets that should be applied to them.
+For example: /mount/dev=ruleset_name
+.It Va devfs_load_rulesets
+.Pq Vt bool
+If set, always load the default rulesets listed in
+.Va devfs_rulesets .
+.It Va performance_cx_lowest
+.Pq Vt str
+CPU idle state to use while on AC power.
+The string
+.Dq Li LOW
+indicates that
+.Xr acpi 4
+should use the lowest power state available while
+.Dq Li HIGH
+indicates that the lowest latency state (less power savings) should be used.
+.It Va performance_cpu_freq
+.Pq Vt str
+CPU clock frequency to use while on AC power.
+The string
+.Dq Li LOW
+indicates that
+.Xr cpufreq 4
+should use the lowest frequency available while
+.Dq Li HIGH
+indicates that the highest frequency (less power savings) should be used.
+.It Va economy_cx_lowest
+.Pq Vt str
+CPU idle state to use when off AC power.
+The string
+.Dq Li LOW
+indicates that
+.Xr acpi 4
+should use the lowest power state available while
+.Dq Li HIGH
+indicates that the lowest latency state (less power savings) should be used.
+.It Va economy_cpu_freq
+.Pq Vt str
+CPU clock frequency to use when off AC power.
+The string
+.Dq Li LOW
+indicates that
+.Xr cpufreq 4
+should use the lowest frequency available while
+.Dq Li HIGH
+indicates that the highest frequency (less power savings) should be used.
+.It Va jail_enable
+.Pq Vt bool
+If set to
+.Dq Li NO ,
+any configured jails will not be started.
+.It Va jail_parallel_start
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+all configured jails will be started in the background (in parallel).
+.It Va jail_list
+.Pq Vt str
+A space separated list of names for jails.
+This is purely a configuration aid to help identify and
+configure multiple jails.
+The names specified in this list will be used to
+identify settings common to an instance of a jail,
+and should contain alphanumeric characters only.
+Assuming that the jail in question was named
+.Li vjail ,
+you would have the following dependent variables:
+.Bd -literal
+jail_vjail_hostname="jail.example.com"
+jail_vjail_ip="192.0.2.100"
+jail_vjail_rootdir="/var/jails/vjail/root"
+.Ed
+.Pp
+.It Va jail_flags
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _flags
+for every jail in
+.Va jail_list .
+.It Va jail_interface
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _interface
+for every jail in
+.Va jail_list .
+.It Va jail_fstab
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _fstab
+for every jail in
+.Va jail_list .
+.It Va jail_mount_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+sets
+.Va jail_ Ns Ao Ar jname Ac Ns Va _mount_enable
+to
+.Dq Li YES
+by default for every jail in
+.Va jail_list .
+.It Va jail_devfs_ruleset
+.Pq Vt str
+Unset by default.
+When set, sets
+.Va jail_ Ns Ao Ar jname Ac Ns Va _devfs_ruleset
+to given value for every jail in
+.Va jail_list .
+.It Va jail_devfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+sets
+.Va jail_ Ns Ao Ar jname Ac Ns Va _devfs_enable
+to
+.Dq Li YES
+by default for every jail in
+.Va jail_list .
+.It Va jail_fdescfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+sets
+.Va jail_ Ns Ao Ar jname Ac Ns Va _fdescfs_enable
+to
+.Dq Li YES
+by default for every jail in
+.Va jail_list .
+.It Va jail_procfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+sets
+.Va jail_ Ns Ao Ar jname Ac Ns Va _fdescfs_enable
+to
+.Dq Li YES
+by default for every jail in
+.Va jail_list .
+.It Va jail_exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_start
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start
+for every jail in
+.Va jail_list .
+.It Va jail_exec_afterstart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_exec_stop
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
+for every jail in
+.Va jail_list .
+.It Va jail_exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+When set, use as default value for
+.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+for every jail in
+.Va jail_list .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir
+.Pq Vt str
+Unset by default.
+Set to the root directory used by jail
+.Va jname .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _hostname
+.Pq Vt str
+Unset by default.
+Set to the fully qualified domain name (FQDN) assigned to jail
+.Va jname .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _ip
+.Pq Vt str
+Unset by default.
+Set to the (primary) IPv4 and/or IPv6 address(es) assigned to the jail.
+The argument can be a sole address or a comma separated list of addresses.
+Additionally each address can be prefixed by the name of an interface
+followed by a pipe to overwrite
+.Va jail_ Ns Ao Ar jname Ac Ns Va _interface
+or
+.Va jail_interface
+and/or suffixed by a netmask, prefixlen or prefix.
+In case no netmask, prefixlen or prefix is given,
+.Sq /32
+will be used for IPv4 and
+.Sq /128
+will be used for an IPv6 address.
+If no address is given for the jail then the jail will be started with
+no networking support.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _ip_multi Ns Aq Ar n
+.Pq Vt str
+Unset by default.
+Set additional IPv4 and/or IPv6 address(es) assigned to the jail.
+The sequence starts with
+.Dq Li _multi0
+and the numbers have to be strictly ascending.
+These entries follow the same syntax as their primary
+.Va jail_ Ns Ao Ar jname Ac Ns Va _ip
+entry.
+The order of the entries can be important as the first address for
+each address family found will be the primary address of the jail.
+See
+.Va ip-addresses
+option in
+.Xr jail 8
+for more details.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _flags
+.Pq Vt str
+Set to
+.Dq Li -l -U root
+by default.
+These are flags to pass to
+.Xr jail 8 .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _interface
+.Pq Vt str
+Unset by default.
+When set, sets the interface to use when setting IP address alias.
+Note that the alias is created at jail startup and removed at jail shutdown.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _fib
+.Pq Vt str
+Unset by default.
+When set, the jail is started with the specified forwarding table (sometimes
+referred to as a routing table) via
+.Xr setfib 1 .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _fstab
+.Pq Vt str
+Set to
+.Pa /etc/fstab. Ns Aq Ar jname
+by default.
+This is the file system information file to use for jail
+.Va jname .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _mount_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+mount all file systems from
+.Va jail_ Ns Ao Ar jname Ac Ns Va _fstab
+at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _devfs_ruleset
+.Pq Vt str
+Unset by default.
+When set, defines the device file system ruleset file to use for jail
+.Va jname .
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _devfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+mount the device file system inside jail
+.Ar jname
+at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _fdescfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+mount the file-descriptor file system inside jail
+.Ar jname
+at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _procfs_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+When set to
+.Dq Li YES ,
+mount the process file system inside jail
+.Ar jname
+at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start
+.Pq Vt str
+Set to
+.Dq Li /bin/sh /etc/rc
+by default.
+This is the command executed in a jail at jail startup.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+in a jail
+after jail startup, where
+.Ar N
+is 1, 2, and so on.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail startup, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+before jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
+.Pq Vt str
+Set to
+.Dq Li /bin/sh /etc/rc.shutdown
+by default.
+This is the command executed in a jail at jail shutdown.
+.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
+.Pq Vt str
+Unset by default.
+This is the command run as
+.Ar N Ns
+th command
+after jail shutdown, where
+.Ar N
+is 0, 1, and so on.
+It is run outside the jail.
+.It Va jail_set_hostname_allow
+.Pq Vt bool
+If set to
+.Dq Li NO ,
+do not allow the root user in a jail to set its hostname.
+.It Va jail_socket_unixiproute_only
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+do not allow any sockets,
+besides UNIX/IP/route sockets,
+to be used within a jail.
+.It Va jail_sysvipc_allow
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+allow applications within a jail to use System V IPC.
+.\" -----------------------------------------------------
+.It Va harvest_interrupt
+.Pq Vt bool
+Set to
+.Dq Li YES
+to use hardware interrupts as an entropy source.
+Refer to
+.Xr random 4
+for more information.
+.It Va harvest_ethernet
+.Pq Vt bool
+Set to
+.Dq Li YES
+to use LAN traffic as an entropy source.
+Refer to
+.Xr random 4
+for more information.
+.It Va harvest_p_to_p
+.Pq Vt bool
+Set to
+.Dq Li YES
+to use serial line traffic as an entropy source.
+Refer to
+.Xr random 4
+for more information.
+.It Va entropy_dir
+.Pq Vt str
+Set to
+.Dq Li NO
+to disable caching entropy via
+.Xr cron 8 .
+Otherwise set to the directory used to store entropy files in.
+.It Va entropy_file
+.Pq Vt str
+Set to
+.Dq Li NO
+to disable caching entropy through reboots.
+Otherwise set to the filename used to store cached entropy through
+reboots.
+This file should be located on the root file system to seed the
+.Xr random 4
+device as early as possible in the boot process.
+.It Va entropy_save_sz
+.Pq Vt int
+Size of the entropy cache files saved by
+.Nm save-entropy
+periodically.
+.It Va entropy_save_num
+.Pq Vt int
+Number of entropy cache files to save by
+.Nm save-entropy
+periodically.
+.It Va ipsec_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to run
+.Xr setkey 8
+on
+.Va ipsec_file
+at boot time.
+.It Va ipsec_file
+.Pq Vt str
+Configuration file for
+.Xr setkey 8 .
+.It Va dmesg_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to save
+.Xr dmesg 8
+to
+.Pa /var/run/dmesg.boot
+on boot.
+.It Va rcshutdown_timeout
+.Pq Vt int
+If set, start a watchdog timer in the background which will terminate
+.Pa rc.shutdown
+if
+.Xr shutdown 8
+has not completed within the specified time (in seconds).
+Notice that in addition to this soft timeout,
+.Xr init 8
+also applies a hard timeout for the execution of
+.Pa rc.shutdown .
+This is configured via
+.Xr sysctl 8
+variable
+.Va kern.init_shutdown_timeout
+and defaults to 120 seconds.
+Setting the value of
+.Va rcshutdown_timeout
+to more than 120 seconds will have no effect until the
+.Xr sysctl 8
+variable
+.Va kern.init_shutdown_timeout
+is also increased.
+.It Va virecover_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+to prevent the system from trying to
+recover pre-maturely terminated
+.Xr vi 1
+sessions.
+.It Va ugidfw_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to load the
+.Xr mac_bsdextended 4
+module upon system initialization and load a default
+ruleset file.
+.It Va bsdextended_script
+.Pq Vt str
+The default
+.Xr mac_bsdextended 4
+ruleset file to load.
+The default value of this variable is
+.Pa /etc/rc.bsdextended .
+.It Va newsyslog_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run
+.Xr newsyslog 8
+command at startup.
+.It Va newsyslog_flags
+.Pq Vt str
+If
+.Va newsyslog_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr newsyslog 8
+program.
+The default is
+.Dq Li -CN ,
+which causes log files flagged with a
+.Cm C
+to be created.
+.It Va mdconfig_md Ns Aq Ar X
+.Pq Vt str
+Arguments to
+.Xr mdconfig 8
+for
+.Xr md 4
+device
+.Ar X .
+At minimum a
+.Fl t Ar type
+must be specified and either a
+.Fl s Ar size
+for malloc or swap backed
+.Xr md 4
+devices or a
+.Fl f Ar file
+for vnode backed
+.Xr md 4
+devices.
+Note that
+.Va mdconfig_md Ns Aq Ar X
+variables are evaluated until one variable is unset or null.
+.It Va mdconfig_md Ns Ao Ar X Ac Ns Va _newfs
+.Pq Vt str
+Optional arguments passed to
+.Xr newfs 8
+to initialize
+.Xr md 4
+device
+.Ar X .
+.It Va mdconfig_md Ns Ao Ar X Ac Ns Va _owner
+.Pq Vt str
+An ownership specification passed to
+.Xr chown 8
+after the specified
+.Xr md 4
+device
+.Ar X
+has been mounted.
+Both the
+.Xr md 4
+device and the mount point will be changed.
+.It Va mdconfig_md Ns Ao Ar X Ac Ns Va _perms
+.Pq Vt str
+A mode string passed to
+.Xr chmod 1
+after the specified
+.Xr md 4
+device
+.Ar X
+has been mounted.
+Both the
+.Xr md 4
+device and the mount point will be changed.
+.It Va mdconfig_md Ns Ao Ar X Ac Ns Va _files
+.Pq Vt str
+Files to be copied to the mount point of the
+.Xr md 4
+device
+.Ar X
+after it has been mounted.
+.It Va mdconfig_md Ns Ao Ar X Ac Ns Va _cmd
+.Pq Vt str
+Command to execute after the specified
+.Xr md 4
+device
+.Ar X
+has been mounted.
+Note that the command is passed to
+.Ic eval
+and that both
+.Va _dev
+and
+.Va _mp
+variables can be used to reference respectively the
+.Xr md 4
+device and the mount point.
+Assuming that the
+.Xr md 4
+device is
+.Li md0 ,
+one could set the following:
+.Bd -literal
+mdconfig_md0_cmd="tar xfzC /var/file.tgz \e${_mp}"
+.Ed
+.It Va autobridge_interfaces
+.Pq Vt str
+Set to the list of bridge interfaces that will have newly arriving interfaces
+checked against to be automatically added.
+If not set to
+.Dq Li NO
+then for each whitespace separated
+.Ar element
+in the value, a
+.Va autobridge_ Ns Aq Ar element
+variable is assumed to exist which has a whitespace separated list of interface
+names to match, these names can use wildcards.
+For example:
+.Bd -literal
+autobridge_interfaces="bridge0"
+autobridge_bridge0="tap* dc0 vlan[345]"
+.Ed
+.It Va mixer_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable support for sound mixer.
+.It Va hcsecd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable Bluetooth security daemon.
+.It Va hcsecd_config
+.Pq Vt str
+Configuration file for
+.Xr hcsecd 8 .
+Default
+.Pa /etc/bluetooth/hcsecd.conf .
+.It Va sdpd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable Bluetooth Service Discovery Protocol daemon.
+.It Va sdpd_control
+.Pq Vt str
+Path to
+.Xr sdpd 8
+control socket.
+Default
+.Pa /var/run/sdp .
+.It Va sdpd_groupname
+.Pq Vt str
+Sets
+.Xr sdpd 8
+group to run as after it initializes.
+Default
+.Dq Li nobody .
+.It Va sdpd_username
+.Pq Vt str
+Sets
+.Xr sdpd 8
+user to run as after it initializes.
+Default
+.Dq Li nobody .
+.It Va bthidd_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable Bluetooth Human Interface Device daemon.
+.It Va bthidd_config
+.Pq Vt str
+Configuration file for
+.Xr bthidd 8 .
+Default
+.Pa /etc/bluetooth/bthidd.conf .
+.It Va bthidd_hids
+.Pq Vt str
+Path to a file, where
+.Xr bthidd 8
+will store information about known HID devices.
+Default
+.Pa /var/db/bthidd.hids .
+.It Va rfcomm_pppd_server_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+enable Bluetooth RFCOMM PPP wrapper daemon.
+.It Va rfcomm_pppd_server_profile
+.Pq Vt str
+The name of the profile to use from
+.Pa /etc/ppp/ppp.conf .
+Multiple profiles can be specified here.
+Also used to specify per-profile overrides.
+When the profile name contains any of the characters
+.Dq Li .-/+
+they are translated to
+.Dq Li _
+for the proposes of the override variable names.
+.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _bdaddr
+.Pq Vt str
+Overrides local address to listen on.
+By default
+.Xr rfcomm_pppd 8
+will listen on
+.Dq Li ANY
+address.
+The address can be specified as BD_ADDR or name.
+.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _channel
+.Pq Vt str
+Overrides local RFCOMM channel to listen on.
+By default
+.Xr rfcomm_pppd 8
+will listen on RFCOMM channel 1.
+Must set properly if multiple profiles used in the same time.
+.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_sp
+.Pq Vt bool
+Tells
+.Xr rfcomm_pppd 8
+if it should register Serial Port service on the specified RFCOMM channel.
+Default
+.Dq Li NO .
+.It Va rfcomm_pppd_server_ Ns Ao Ar profile Ac Ns _register_dun
+.Pq Vt bool
+Tells
+.Xr rfcomm_pppd 8
+if it should register Dial-Up Networking service on the specified
+RFCOMM channel.
+Default
+.Dq Li NO .
+.It Va ubthidhci_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+change the USB Bluetooth controller from HID mode to HCI mode.
+You also need to specify the location of USB Bluetooth controller with the
+.Va ubthidhci_busnum
+and
+.Va ubthidhci_addr
+variables.
+.It Va ubthidhci_busnum
+Bus number where the USB Bluetooth controller is located.
+Check the output of
+.Xr usbconfig 8
+on your system to find this information.
+.It Va ubthidhci_addr
+Bus address of the USB Bluetooth controller.
+Check the output of
+.Xr usbconfig 8
+on your system to find this information.
+.It Va netwait_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+delays the start of network-reliant services until
+.Va netwait_if
+is up and ICMP packets to a destination defined in
+.Va netwait_ip
+are flowing.
+Link state is examined first, followed by
+.Dq Li pinging
+an IP address to verify network usability.
+If no destination can be reached or timeouts are exceeded,
+network services are started anyway with no guarantee that
+the network is usable.
+Use of this variable requires both
+.Va netwait_ip
+and
+.Va netwait_if
+to be set.
+.It Va netwait_ip
+.Pq Vt str
+Empty by default.
+This variable contains a space-delimited list of IP addresses to
+.Xr ping 8 .
+DNS hostnames should not be used as resolution is not guaranteed
+to be functional at this point.
+If multiple IP addresses are specified,
+each will be tried until one is successful or the list is exhausted.
+.It Va netwait_timeout
+.Pq Vt int
+Indicates the total number of seconds to perform a
+.Dq Li ping
+against each IP address in
+.Va netwait_ip ,
+at a rate of one ping per second.
+If any of the pings are successful,
+full network connectivity is considered reliable.
+The default is 60.
+.It Va netwait_if
+.Pq Vt str
+Empty by default.
+Defines the name of the network interface on which watch for link.
+.Xr ifconfig 8
+is used to monitor the interface, looking for
+.Dq Li status: no carrier .
+Once gone, the link is considered up.
+This can be a
+.Xr vlan 4
+interface if desired.
+.It Va netwait_if_timeout
+.Pq Vt int
+Defines the total number of seconds to wait for link to become usable,
+polled at a 1-second interval.
+The default is 30.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
+.It Pa /etc/defaults/rc.conf
+.It Pa /etc/rc.conf
+.It Pa /etc/rc.conf.local
+.El
+.Sh SEE ALSO
+.Xr catman 1 ,
+.Xr chmod 1 ,
+.Xr gdb 1 ,
+.Xr info 1 ,
+.Xr kbdcontrol 1 ,
+.Xr makewhatis 1 ,
+.Xr sh 1 ,
+.Xr vi 1 ,
+.Xr vidcontrol 1 ,
+.Xr bridge 4 ,
+.Xr dummynet 4 ,
+.Xr ip 4 ,
+.Xr ipf 4 ,
+.Xr ipfw 4 ,
+.Xr ipnat 4 ,
+.Xr kld 4 ,
+.Xr pf 4 ,
+.Xr pflog 4 ,
+.Xr pfsync 4 ,
+.Xr tcp 4 ,
+.Xr udp 4 ,
+.Xr exports 5 ,
+.Xr fstab 5 ,
+.Xr ipf 5 ,
+.Xr ipnat 5 ,
+.Xr motd 5 ,
+.Xr newsyslog.conf 5 ,
+.Xr pf.conf 5 ,
+.Xr security 7 ,
+.Xr accton 8 ,
+.Xr amd 8 ,
+.Xr apm 8 ,
+.Xr atm 8 ,
+.Xr bthidd 8 ,
+.Xr chkprintcap 8 ,
+.Xr chown 8 ,
+.Xr cron 8 ,
+.Xr devfs 8 ,
+.Xr dhclient 8 ,
+.Xr ftpd 8 ,
+.Xr geli 8 ,
+.Xr hcsecd 8 ,
+.Xr ifconfig 8 ,
+.Xr inetd 8 ,
+.Xr ipf 8 ,
+.Xr ipfw 8 ,
+.Xr ipnat 8 ,
+.Xr jail 8 ,
+.Xr kldxref 8 ,
+.Xr lpd 8 ,
+.Xr mdconfig 8 ,
+.Xr mdmfs 8 ,
+.Xr mixer 8 ,
+.Xr mountd 8 ,
+.Xr moused 8 ,
+.Xr mrouted 8 ,
+.Xr named 8 ,
+.Xr newfs 8 ,
+.Xr newsyslog 8 ,
+.Xr nfsd 8 ,
+.Xr ntpd 8 ,
+.Xr ntpdate 8 ,
+.Xr pfctl 8 ,
+.Xr pflogd 8 ,
+.Xr ping 8 ,
+.Xr powerd 8 ,
+.Xr quotacheck 8 ,
+.Xr quotaon 8 ,
+.Xr rc 8 ,
+.Xr rc.sendmail 8 ,
+.Xr rfcomm_pppd 8 ,
+.Xr route 8 ,
+.Xr routed 8 ,
+.Xr rpcbind 8 ,
+.Xr rpc.lockd 8 ,
+.Xr rpc.statd 8 ,
+.Xr rwhod 8 ,
+.Xr savecore 8 ,
+.Xr sdpd 8 ,
+.Xr sshd 8 ,
+.Xr swapon 8 ,
+.Xr sysctl 8 ,
+.Xr syslogd 8 ,
+.Xr timed 8 ,
+.Xr usbconfig 8 ,
+.Xr wlandebug 8 ,
+.Xr yp 8 ,
+.Xr ypbind 8 ,
+.Xr ypserv 8 ,
+.Xr ypset 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 2.2.2 .
+.Sh AUTHORS
+.An Jordan K. Hubbard .
diff --git a/share/man/man5/rctl.conf.5 b/share/man/man5/rctl.conf.5
new file mode 100644
index 000000000000..3bcc6141575d
--- /dev/null
+++ b/share/man/man5/rctl.conf.5
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2011 Edward Tomasz Napierala
+.\" Copyright (c) 1999 Chris Costello <chris@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 14, 2011
+.Dt RCTL.CONF 5
+.Os
+.Sh NAME
+.Nm rctl.conf
+.Nd resource limits database defaults
+.Sh DESCRIPTION
+The
+.Pa /etc/rctl.conf
+file is read in when the system goes into multi-user mode to set default
+contents of the RCTL database.
+The
+.Pa /etc/rctl.conf
+is in the format of the
+.Xr rctl 8
+command, i.e.\&
+.Bd -literal -offset indent
+subject:subject-id:resource:action=amount/per
+.Ed
+.Pp
+Comments are denoted by a
+.Dq #
+at the beginning of a line.
+Comments can also exist at the end of a line,
+as seen in the
+.Sx EXAMPLES
+section, below.
+.Sh FILES
+.Bl -tag -width /etc/rctl.conf -compact
+.It Pa /etc/rctl.conf
+Initial settings for
+.Xr rctl 8 .
+.El
+.Sh EXAMPLES
+To limit the number of processes for users in login class "testing",
+use a rule like
+.Bd -literal -offset indent
+# Resource limits for the "testing" class.
+loginclass:testing:nproc:deny=100/user # At most 100 processes per user
+.Ed
+.Sh SEE ALSO
+.Xr rctl 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 9.0 .
diff --git a/share/man/man5/regdomain.5 b/share/man/man5/regdomain.5
new file mode 100644
index 000000000000..495f4b70f1f7
--- /dev/null
+++ b/share/man/man5/regdomain.5
@@ -0,0 +1,48 @@
+.\" Copyright (c) 2008 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd April 13, 2008
+.Dt REGDOMAIN 5
+.Os
+.Sh NAME
+.Nm regdomain.xml
+.Nd "802.11 wireless regulatory definitions"
+.Sh DESCRIPTION
+The
+.Nm
+file describes regulations for the operation of IEEE 802.11 wireless radios.
+.Pp
+This information is used by the
+.Xr ifconfig 8
+program to construct regulatory state for download to the system.
+This file should be changed only to reflect changes in regulations.
+.Sh FILES
+.Bl -tag -width /etc/regdomain.xml -compact
+.It Pa /etc/regdomain.xml
+XML database of 802.11 regulatory constraints
+.El
+.Sh SEE ALSO
+.Xr wlan 4 ,
+.Xr ifconfig 8
diff --git a/share/man/man5/reiserfs.5 b/share/man/man5/reiserfs.5
new file mode 100644
index 000000000000..2f3eaeefbf09
--- /dev/null
+++ b/share/man/man5/reiserfs.5
@@ -0,0 +1,83 @@
+.\"
+.\" Copyright (c) 2005 Jean-Sébastien Pédron
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2011
+.Dt REISERFS 5
+.Os
+.Sh NAME
+.Nm reiserfs
+.Nd "Reiser file system"
+.Sh SYNOPSIS
+To link into the kernel:
+.Bd -ragged -offset indent
+.Cd "options REISERFS"
+.Ed
+.Pp
+To load as a kernel loadable module:
+.Pp
+.Dl "kldload reiserfs"
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to access
+.Tn ReiserFS
+file systems.
+.Sh EXAMPLES
+To mount a
+.Nm
+volume located on
+.Pa /dev/ad1s1 :
+.Pp
+.Dl "mount -t reiserfs /dev/ad1s1 /mnt"
+.Sh SEE ALSO
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5 ,
+.Xr mount 8
+.Sh HISTORY
+The
+.Nm
+file system support
+first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The ReiserFS kernel implementation was written by
+.An Hans Reiser
+and ported to
+.Fx
+by
+.An Jean-S\['e]bastien P\['e]dron Aq dumbbell@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Craig Rodrigues Aq rodrigc@FreeBSD.org .
+.Sh CAVEATS
+Currently, only read-only access is supported for ReiserFS volumes,
+writing to a volume is not supported.
diff --git a/share/man/man5/remote.5 b/share/man/man5/remote.5
new file mode 100644
index 000000000000..666608d1d6c0
--- /dev/null
+++ b/share/man/man5/remote.5
@@ -0,0 +1,214 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)remote.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd October 20, 2003
+.Dt REMOTE 5
+.Os
+.Sh NAME
+.Nm remote
+.Nd remote host description file
+.Sh DESCRIPTION
+The systems known by
+.Xr tip 1
+and their attributes are stored in an
+.Tn ASCII
+file which
+is structured somewhat like the
+.Xr termcap 5
+file.
+Each line in the file provides a description for a single
+.Em system .
+Fields are separated by a colon (``:'').
+Lines ending in a \e character with an immediately following newline are
+continued on the next line.
+.Pp
+The first entry is the name(s) of the host system.
+If there is more
+than one name for a system, the names are separated by vertical bars.
+After the name of the system comes the fields of the description.
+A field name followed by an `=' sign indicates a string value.
+A field name followed by a `#' sign indicates a numeric value.
+.Pp
+Entries named ``tip*'' and ``cu*'' are used as default entries by
+.Xr tip 1 ,
+and the
+.Xr cu 1
+interface to
+.Nm tip ,
+as follows.
+When
+.Nm tip
+is invoked with only a phone number, it looks for an entry
+of the form ``tip300'', where 300 is the data rate with
+which the connection is to be made.
+When the
+.Nm cu
+interface is used, entries of the form ``cu300'' are used.
+.Sh CAPABILITIES
+Capabilities are either strings (str), numbers (num), or boolean
+flags (bool).
+A string capability is specified by
+.Em capability Ns Ar = Ns Em value ;
+for example, ``dv=/dev/harris''.
+A numeric capability is specified by
+.Em capability Ns Ar # Ns Em value ;
+for example, ``xa#99''.
+A boolean capability is specified by simply listing the capability.
+.Bl -tag -width indent
+.It Cm \&at
+(str)
+Auto call unit type.
+.It Cm \&br
+(num)
+The data rate (bits per second) used for communications on the
+serial port.
+When a modem is used, the data rate used to communicate
+with the remote modem may be different than this rate.
+This is a decimal number.
+The default rate is 9600 bits per second.
+.It Cm \&cm
+(str)
+An initial connection message to be sent to the remote host.
+For example, if a host is reached through a port selector, this
+might be set to the appropriate sequence required to switch to the host.
+.It Cm \&cu
+(str)
+Call unit if making a phone call.
+Default is the same as the `dv' field.
+.It Cm \&di
+(str)
+Disconnect message sent to the host when a disconnect is requested by
+the user.
+.It Cm \&du
+(bool)
+This host is on a dial-up line.
+.It Cm \&dv
+(str)
+.Ux
+device(s) to open to establish a connection.
+If this file refers to a terminal line,
+.Xr tip 1
+attempts to perform an exclusive open on the device to ensure only
+one user at a time has access to the port.
+.It Cm \&el
+(str)
+Characters marking an end-of-line.
+The default is
+.Dv NULL .
+`~' escapes are only
+recognized by
+.Nm tip
+after one of the characters in `el', or after a carriage-return.
+.It Cm \&fs
+(str)
+Frame size for transfers.
+The default frame size is equal to
+.Dv BUFSIZ .
+.It Cm \&hd
+(bool)
+The host uses half-duplex communication, local echo should be performed.
+.It Cm \&ie
+(str)
+Input end-of-file marks.
+The default is
+.Dv NULL .
+.It Cm \&oe
+(str)
+Output end-of-file string.
+The default is
+.Dv NULL .
+When
+.Nm tip
+is transferring a file, this
+string is sent at end-of-file.
+.It Cm \&pa
+(str)
+The type of parity to use when sending data
+to the host.
+This may be one of ``even'',
+``odd'', ``none'', ``zero'' (always set bit 8 to zero),
+``one'' (always set bit 8 to 1).
+The default is even parity.
+.It Cm \&pn
+(str)
+Telephone number(s) for this host.
+If the telephone number field contains an @ sign,
+.Nm tip
+searches the file
+.Pa /etc/phones
+file for a list of telephone numbers (see
+.Xr phones 5 ) .
+.It Cm \&tc
+(str)
+Indicates that the list of capabilities is continued in the named
+description.
+This is used primarily to share common capability information.
+.El
+.Sh FILES
+.Bl -tag -width /etc/remote -compact
+.It Pa /etc/remote
+The
+.Nm
+host description file resides in
+.Pa /etc .
+.El
+.Sh EXAMPLES
+Here is a short example showing the use of the capability continuation
+feature.
+It defines a 56k modem connection on the first serial port at 115200
+bits per second, no parity using the Hayes command set with standard
+line editing and end of file characters.
+The arpavax entry includes everything in the UNIX-57600 entry plus
+the phone number for arpavax (in this case an @ character so that it
+is retrieved from the environment).
+.Bd -literal
+UNIX-57600:\e
+:dv=/dev/cuad0:el=^D^U^C^S^Q^O@:oe=^D:du:at=hayes:br#115200:pa=none:
+arpavax|ax:\e
+:pn=\e@:tc=UNIX-57600
+.Ed
+.Sh SEE ALSO
+.Xr cu 1 ,
+.Xr tip 1 ,
+.Xr phones 5
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
+.Sh BUGS
+The
+.Xr tip 1
+utility uses its own notion of the serial ports data rate rather than the
+system default for a serial port.
diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5
new file mode 100644
index 000000000000..cbbd34c2ab16
--- /dev/null
+++ b/share/man/man5/resolver.5
@@ -0,0 +1,222 @@
+.\" Copyright (c) 1986, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)resolver.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd September 9, 2004
+.Dt RESOLVER 5
+.Os
+.Sh NAME
+.Nm resolver
+.Nd resolver configuration file
+.Sh SYNOPSIS
+.Nm resolv.conf
+.Sh DESCRIPTION
+The
+.Xr resolver 3
+is a set of routines in the C library
+which provide access to the Internet Domain Name System.
+The resolver configuration file contains information that is read
+by the resolver routines the first time they are invoked by a process.
+The file is designed to be human readable and contains a list of
+keywords with values that provide various types of resolver information.
+.Pp
+On a normally configured system this file should not be necessary.
+The only name server to be queried will be on the local machine,
+the domain name is determined from the host name,
+and the domain search path is constructed from the domain name.
+.Pp
+The different configuration options are:
+.Bl -tag -width nameserver
+.It Sy nameserver
+Internet address (in dot notation) of a name server
+that the resolver should query.
+Up to
+.Dv MAXNS
+(currently 3) name servers may be listed,
+one per keyword.
+If there are multiple servers,
+the resolver library queries them in the order listed.
+If no
+.Sy nameserver
+entries are present,
+the default is to use the name server on the local machine.
+(The algorithm used is to try a name server, and if the query times out,
+try the next, until out of name servers,
+then repeat trying all the name servers
+until a maximum number of retries are made).
+.It Sy domain
+Local domain name.
+Most queries for names within this domain can use short names
+relative to the local domain.
+If no
+.Sy domain
+entry is present, the domain is determined
+from the local host name returned by
+.Xr gethostname 3 ;
+the domain part is taken to be everything after the first
+.Ql \&. .
+Finally, if the host name does not contain a domain part, the root
+domain is assumed.
+.It Sy search
+Search list for host-name lookup.
+The search list is normally determined from the local domain name;
+by default, it contains only the local domain name.
+This may be changed by listing the desired domain search path
+following the
+.Sy search
+keyword with spaces or tabs separating
+the names.
+Most resolver queries will be attempted using each component
+of the search path in turn until a match is found.
+Note that this process may be slow and will generate a lot of network
+traffic if the servers for the listed domains are not local,
+and that queries will time out if no server is available
+for one of the domains.
+.Pp
+The search list is currently limited to six domains
+with a total of 256 characters.
+.It Sy sortlist
+Sortlist allows addresses returned by gethostbyname to be sorted.
+A sortlist is specified by IP address netmask pairs.
+The netmask is
+optional and defaults to the natural netmask of the net.
+The IP address
+and optional network pairs are separated by slashes.
+Up to 10 pairs may
+be specified.
+E.g.,
+.Pp
+.Dl "sortlist 130.155.160.0/255.255.240.0 130.155.0.0"
+.It Sy options
+Options allows certain internal resolver variables to be modified.
+The syntax is
+.Pp
+\fBoptions\fP \fIoption\fP \fI...\fP
+.Pp
+where
+.Sy option
+is one of the following:
+.Bl -tag -width no_tld_query
+.It Sy debug
+sets
+.Dv RES_DEBUG
+in _res.options.
+.It Sy ndots: Ns Ar n
+sets a threshold for the number of dots which must appear in a name given to
+.Fn res_query
+(see
+.Xr resolver 3 )
+before an
+.Em initial absolute query
+will be made.
+The default for
+.Em n
+is
+.Dq 1 ,
+meaning that if there are any dots in a name, the name
+will be tried first as an absolute name before any
+.Em search list
+elements are appended to it.
+.It Sy timeout: Ns Ar n
+sets the initial amount of time the resolver will wait
+for a response from a remote
+name server before retrying the query via a different name server.
+The resolver may wait longer during subsequent retries
+of the current query since an exponential back-off is applied to
+the timeout value.
+Measured in seconds, the default is
+.Dv RES_TIMEOUT ,
+the allowed maximum is
+.Dv RES_MAXRETRANS
+(see
+.In resolv.h ) .
+.It Sy attempts: Ns Ar n
+sets the number of times the resolver will send a query to each of
+its name servers
+before giving up and returning an error to the calling application.
+The default is
+.Dv RES_DFLRETRY ,
+the allowed maximum is
+.Dv RES_MAXRETRY
+(see
+.In resolv.h ) .
+.It Sy no_tld_query
+tells the resolver not to attempt to resolve a top level domain name, that
+is, a name that contains no dots.
+Use of this option does not prevent
+the resolver from obeying the standard
+.Sy domain
+and
+.Sy search
+rules with the given name.
+.El
+.Pp
+Options may also be specified as a space or tab separated list using the
+.Dv RES_OPTIONS
+environment variable.
+.El
+.Pp
+The
+.Sy domain
+and
+.Sy search
+keywords are mutually exclusive.
+If more than one instance of these keywords is present,
+the last instance will override.
+.Pp
+The keyword and value must appear on a single line, and the keyword
+(e.g.\&
+.Sy nameserver )
+must start the line.
+The value follows the keyword, separated by white space.
+.Sh FILES
+.Bl -tag -width /etc/resolv.conf -compact
+.It Pa /etc/resolv.conf
+The file
+.Nm resolv.conf
+resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr resolver 3 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Rs
+.%T "Name Server Operations Guide for BIND"
+.Re
+.Sh HISTORY
+The
+.Nm resolv.conf
+file format appeared in
+.Bx 4.3 .
diff --git a/share/man/man5/services.5 b/share/man/man5/services.5
new file mode 100644
index 000000000000..d1153d9d525e
--- /dev/null
+++ b/share/man/man5/services.5
@@ -0,0 +1,107 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)services.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd April 4, 2010
+.Dt SERVICES 5
+.Os
+.Sh NAME
+.Nm services
+.Nd service name data base
+.Sh DESCRIPTION
+The
+.Nm
+file contains information regarding
+the known services available in the
+Internet.
+For each service a single line should be present
+with the following information:
+.Bd -unfilled -offset indent
+official service name
+port number
+protocol name
+aliases
+.Ed
+.Pp
+Items are separated by any number of blanks and/or tab characters.
+The port number and protocol name are considered a single
+.Em item ;
+a ``/'' is used to
+separate the port and protocol (e.g.\& ``512/tcp'').
+A ``#'' indicates the beginning of
+a comment; subsequent characters up to the end of the line are
+not interpreted by the routines which search the file.
+.Pp
+Service names may contain any printable
+character other than a field delimiter, newline,
+or comment character.
+.Pp
+If
+.Dq db
+is specified as source in the
+.Xr nsswitch.conf 5 ,
+.Pa /var/db/services.db
+is searched.
+The database in
+.Pa /var/db/services.db
+needs to be updated with
+.Xr services_mkdb 8
+after changes to the services file have been applied.
+.Sh NIS INTERACTION
+Access to the NIS
+.Pa services.byname
+map can be enabled by adding a single ``+'' on a line by itself
+in the
+.Pa /etc/services
+file.
+This causes the contents of the NIS services map to be inserted
+at the location where the ``+'' appears.
+.Sh FILES
+.Bl -tag -width /etc/services -compact
+.It Pa /etc/services
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr getservent 3
+.Xr nsswitch.conf 5
+.Xr services_mkdb 8
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
+.Sh BUGS
+A name server should be used instead of a static file.
diff --git a/share/man/man5/shells.5 b/share/man/man5/shells.5
new file mode 100644
index 000000000000..585cc8385dd7
--- /dev/null
+++ b/share/man/man5/shells.5
@@ -0,0 +1,66 @@
+.\" Copyright (c) 1986, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)shells.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt SHELLS 5
+.Os
+.Sh NAME
+.Nm shells
+.Nd shell database
+.Sh DESCRIPTION
+The
+.Nm
+file contains a list of the shells on the system.
+For each shell a single line should be present, consisting of the
+shell's path, relative to root.
+.Pp
+A hash mark (``#'') indicates the beginning of a comment; subsequent
+characters up to the end of the line are not interpreted by the
+routines which search the file.
+Blank lines are also ignored.
+.Sh FILES
+.Bl -tag -width /etc/shells -compact
+.It Pa /etc/shells
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr getusershell 3
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.3 tahoe .
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
new file mode 100644
index 000000000000..e209a2646d56
--- /dev/null
+++ b/share/man/man5/src.conf.5
@@ -0,0 +1,1029 @@
+.\" DO NOT EDIT-- this file is automatically generated.
+.\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru
+.\" $FreeBSD$
+.Dd March 25, 2012
+.Dt SRC.CONF 5
+.Os
+.Sh NAME
+.Nm src.conf
+.Nd "source build options"
+.Sh DESCRIPTION
+The
+.Nm
+file contains settings that will apply to every build involving the
+.Fx
+source tree; see
+.Xr build 7 .
+.Pp
+The
+.Nm
+file uses the standard makefile syntax.
+However,
+.Nm
+should not specify any dependencies to
+.Xr make 1 .
+Instead,
+.Nm
+is to set
+.Xr make 1
+variables that control the aspects of how the system builds.
+.Pp
+The default location of
+.Nm
+is
+.Pa /etc/src.conf ,
+though an alternative location can be specified in the
+.Xr make 1
+variable
+.Va SRCCONF .
+Overriding the location of
+.Nm
+may be necessary if the system-wide settings are not suitable
+for a particular build.
+For instance, setting
+.Va SRCCONF
+to
+.Pa /dev/null
+effectively resets all build controls to their defaults.
+.Pp
+The only purpose of
+.Nm
+is to control the compilation of the
+.Fx
+source code, which is usually located in
+.Pa /usr/src .
+As a rule, the system administrator creates
+.Nm
+when the values of certain control variables need to be changed
+from their defaults.
+.Pp
+In addition, control variables can be specified
+for a particular build via the
+.Fl D
+option of
+.Xr make 1
+or in its environment; see
+.Xr environ 7 .
+.Pp
+The values of variables are ignored regardless of their setting;
+even if they would be set to
+.Dq Li FALSE
+or
+.Dq Li NO .
+Just the existence of an option will cause
+it to be honoured by
+.Xr make 1 .
+.Pp
+The following list provides a name and short description for variables
+that can be used for source builds.
+.Bl -tag -width indent
+.It Va WITHOUT_ACCT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ACCT 223201 2011-06-17 20:47:44Z ed
+Set to not build process accounting tools such as
+.Xr accton 8
+and
+.Xr sa 8 .
+.It Va WITHOUT_ACPI
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ACPI 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr acpiconf 8 ,
+.Xr acpidump 8
+and related programs.
+.It Va WITHOUT_AMD
+.\" from FreeBSD: head/tools/build/options/WITHOUT_AMD 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr amd 8 ,
+and related programs.
+.It Va WITHOUT_APM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_APM 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr apm 8 ,
+.Xr apmd 8
+and related programs.
+.It Va WITHOUT_ASSERT_DEBUG
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ASSERT_DEBUG 162215 2006-09-11 13:55:27Z ru
+Set to compile programs and libraries without the
+.Xr assert 3
+checks.
+.It Va WITHOUT_AT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_AT 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr at 1
+and related utilities.
+.It Va WITHOUT_ATM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ATM 156932 2006-03-21 07:50:50Z ru
+Set to not build
+programs and libraries related to ATM networking.
+.It Va WITHOUT_AUDIT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_AUDIT 156932 2006-03-21 07:50:50Z ru
+Set to not build audit support into system programs.
+.It Va WITHOUT_AUTHPF
+.\" from FreeBSD: head/tools/build/options/WITHOUT_AUTHPF 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr authpf 8 .
+.It Va WITHOUT_BIND
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND 156932 2006-03-21 07:50:50Z ru
+Setting this variable will prevent any part of BIND from being built.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BIND_DNSSEC
+.It
+.Va WITHOUT_BIND_ETC
+.It
+.Va WITHOUT_BIND_LIBS
+.It
+.Va WITHOUT_BIND_LIBS_LWRES
+.It
+.Va WITHOUT_BIND_MTREE
+.It
+.Va WITHOUT_BIND_NAMED
+.It
+.Va WITHOUT_BIND_UTILS
+.El
+.It Va WITHOUT_BIND_DNSSEC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_DNSSEC 156932 2006-03-21 07:50:50Z ru
+Set to avoid building or installing the DNSSEC related binaries,
+.Xr dnssec-keygen 8
+and
+.Xr dnssec-signzone 8 .
+.It Va WITHOUT_BIND_ETC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_ETC 156932 2006-03-21 07:50:50Z ru
+Set to avoid installing the default files to
+.Pa /var/named/etc/namedb .
+.It Va WITH_BIND_IDN
+.\" from FreeBSD: head/tools/build/options/WITH_BIND_IDN 193280 2009-06-01 21:58:59Z dougb
+Set to enable IDN support for dig, host, and nslookup.
+This requires ports/dns/idnkit to be installed in /usr/local.
+.It Va WITH_BIND_LARGE_FILE
+.\" from FreeBSD: head/tools/build/options/WITH_BIND_LARGE_FILE 193280 2009-06-01 21:58:59Z dougb
+Set to enable 64-bit file support.
+.It Va WITH_BIND_LIBS
+.\" from FreeBSD: head/tools/build/options/WITH_BIND_LIBS 193280 2009-06-01 21:58:59Z dougb
+Set to install BIND libraries and include files.
+.It Va WITHOUT_BIND_LIBS_LWRES
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_LIBS_LWRES 156932 2006-03-21 07:50:50Z ru
+Set to avoid installing the lightweight resolver library in
+.Pa /usr/lib .
+.It Va WITHOUT_BIND_MTREE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_MTREE 157717 2006-04-13 10:37:29Z ru
+Set to avoid running
+.Xr mtree 8
+to create the chroot directory structure under
+.Pa /var/named ,
+and avoid creating an
+.Pa /etc/namedb
+symlink to the chroot directory.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BIND_ETC
+.El
+.It Va WITHOUT_BIND_NAMED
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_NAMED 156932 2006-03-21 07:50:50Z ru
+Set to avoid building or installing
+.Xr named 8 ,
+.Xr named.reload 8 ,
+.Xr named-checkconf 8 ,
+.Xr named-checkzone 8 ,
+.Xr rndc 8 ,
+and
+.Xr rndc-confgen 8 .
+.It Va WITH_BIND_SIGCHASE
+.\" from FreeBSD: head/tools/build/options/WITH_BIND_SIGCHASE 193280 2009-06-01 21:58:59Z dougb
+Set to enable DNSSEC validation support for dig, host, and nslookup.
+.It Va WITHOUT_BIND_UTILS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BIND_UTILS 156932 2006-03-21 07:50:50Z ru
+Set to avoid building or installing the BIND userland utilities,
+.Xr dig 1 ,
+.Xr host 1 ,
+.Xr nslookup 1 ,
+and
+.Xr nsupdate 8 .
+.It Va WITH_BIND_XML
+.\" from FreeBSD: head/tools/build/options/WITH_BIND_XML 193280 2009-06-01 21:58:59Z dougb
+Set to enable the http statistics interface for named.
+This requires ports/textproc/libxml2 to be installed in /usr/local.
+.It Va WITHOUT_BINUTILS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS 222090 2011-05-19 05:13:25Z imp
+Set to not install binutils (as, c++-filt, gconv, gnu-ar, gnu-randlib,
+ld, nm, objcopy, objdump, readelf, size and strip)
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
+.It Va WITHOUT_BLUETOOTH
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 07:50:50Z ru
+Set to not build Bluetooth related kernel modules, programs and libraries.
+.It Va WITHOUT_BOOT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BOOT 156932 2006-03-21 07:50:50Z ru
+Set to not build the boot blocks and loader.
+.It Va WITHOUT_BSD_CPIO
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BSD_CPIO 179813 2008-06-16 05:48:15Z dougb
+Set to not build the BSD licensed version of cpio based on
+.Xr libarchive 3 .
+.It Va WITH_BSD_GREP
+.\" from FreeBSD: head/tools/build/options/WITH_BSD_GREP 222273 2011-05-25 01:04:12Z obrien
+Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
+.It Va WITHOUT_BSNMP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BSNMP 183306 2008-09-23 16:15:42Z sam
+Set to not build or install
+.Xr bsnmpd 1
+and related libraries and data files.
+.It Va WITHOUT_BZIP2
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BZIP2 174550 2007-12-12 16:43:17Z ru
+Set to not build contributed bzip2 software as a part of the base system.
+.Bf -symbolic
+The option has no effect yet.
+.Ef
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BZIP2_SUPPORT
+.El
+.It Va WITHOUT_BZIP2_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_BZIP2_SUPPORT 166255 2007-01-26 10:19:08Z delphij
+Set to build some programs without optional bzip2 support.
+.It Va WITHOUT_CALENDAR
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CALENDAR 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr calendar 1 .
+.It Va WITHOUT_CAPSICUM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CAPSICUM 229319 2012-01-02 21:57:58Z rwatson
+Set to not build Capsicum support into system programs.
+.It Va WITHOUT_CDDL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CDDL 163861 2006-11-01 09:02:11Z jb
+Set to not build code licensed under Sun's CDDL.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_CTF
+.It
+.Va WITHOUT_ZFS
+.El
+.It Va WITHOUT_CLANG
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 208971 2010-06-10 06:20:26Z ed
+Set to not build the Clang C/C++ compiler.
+.Pp
+It is a default setting on
+arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and sparc64/sparc64.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_CLANG_EXTRAS
+.It
+.Va WITHOUT_CLANG_IS_CC
+.El
+.It Va WITH_CLANG
+.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru
+Set to build the Clang C/C++ compiler.
+.Pp
+It is a default setting on
+amd64/amd64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64.
+.It Va WITH_CLANG_EXTRAS
+.\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim
+Set to build additional clang and llvm tools, such as bugpoint.
+.It Va WITH_CLANG_IS_CC
+.\" from FreeBSD: head/tools/build/options/WITH_CLANG_IS_CC 232322 2012-02-29 22:58:51Z dim
+Set to install the Clang C/C++ compiler as
+.Pa /usr/bin/cc
+,
+.Pa /usr/bin/c++
+and
+.Pa /usr/bin/cpp
+.
+.It Va WITHOUT_CPP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr cpp 1 .
+.It Va WITHOUT_CRYPT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CRYPT 156932 2006-03-21 07:50:50Z ru
+Set to not build any crypto code.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_KERBEROS
+.It
+.Va WITHOUT_KERBEROS_SUPPORT
+.It
+.Va WITHOUT_OPENSSH
+.It
+.Va WITHOUT_OPENSSL
+.El
+.Pp
+When set, the following options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_GSSAPI
+(unless
+.Va WITH_GSSAPI
+is set explicitly)
+.El
+.It Va WITH_CTF
+.\" from FreeBSD: head/tools/build/options/WITH_CTF 228159 2011-11-30 18:22:44Z fjoe
+Set to compile with CTF (Compact C Type Format) data.
+CTF data encapsulates a reduced form of debugging information
+similar to DWARF and the venerable stabs and is required for DTrace.
+.It Va WITHOUT_CTM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CTM 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr ctm 1
+and related utilities.
+.It Va WITHOUT_CVS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CVS 156932 2006-03-21 07:50:50Z ru
+Set to not build CVS.
+.It Va WITHOUT_CXX
+.\" from FreeBSD: head/tools/build/options/WITHOUT_CXX 220402 2011-04-06 20:19:07Z uqs
+Set to not build
+.Xr g++ 1
+and related libraries.
+It will also prevent building of
+.Xr gperf 1
+and
+.Xr devd 8 .
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_CLANG
+.It
+.Va WITHOUT_CLANG_IS_CC
+.It
+.Va WITHOUT_GROFF
+.El
+.It Va WITHOUT_DICT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_DICT 156932 2006-03-21 07:50:50Z ru
+Set to not build the Webster dictionary files.
+.It Va WITHOUT_DYNAMICROOT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_DYNAMICROOT 156932 2006-03-21 07:50:50Z ru
+Set this if you do not want to link
+.Pa /bin
+and
+.Pa /sbin
+dynamically.
+.It Va WITHOUT_EXAMPLES
+.\" from FreeBSD: head/tools/build/options/WITHOUT_EXAMPLES 156938 2006-03-21 09:06:24Z ru
+Set to avoid installing examples to
+.Pa /usr/share/examples/ .
+.It Va WITHOUT_FDT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_FDT 221539 2011-05-06 19:10:27Z ru
+Set to not build Flattened Device Tree support as part of the base system.
+This includes the device tree compiler (dtc) and libfdt support library.
+.Pp
+It is a default setting on
+amd64/amd64, i386/i386, ia64/ia64, pc98/i386 and sparc64/sparc64.
+.It Va WITH_FDT
+.\" from FreeBSD: head/tools/build/options/WITH_FDT 221730 2011-05-10 11:14:40Z ru
+Set to build Flattened Device Tree support as part of the base system.
+This includes the device tree compiler (dtc) and libfdt support library.
+.Pp
+It is a default setting on
+arm/arm, arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64.
+.It Va WITHOUT_FLOPPY
+.\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru
+Set to not build or install programs
+for operating floppy disk driver.
+.It Va WITHOUT_FORTH
+.\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru
+Set to build bootloaders without Forth support.
+.It Va WITHOUT_FP_LIBC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_FP_LIBC 156932 2006-03-21 07:50:50Z ru
+Set to build
+.Nm libc
+without floating-point support.
+.It Va WITHOUT_FREEBSD_UPDATE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_FREEBSD_UPDATE 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr freebsd-update 8 .
+.It Va WITHOUT_GAMES
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GAMES 156932 2006-03-21 07:50:50Z ru
+Set to not build games.
+.It Va WITHOUT_GCC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC 222090 2011-05-19 05:13:25Z imp
+Set to not install gcc and g++.
+.Bf -symbolic
+The option does not generally work for build targets, unless some alternative
+toolchain is enabled.
+.Ef
+.It Va WITHOUT_GCOV
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GCOV 156932 2006-03-21 07:50:50Z ru
+Set to not build the
+.Xr gcov 1
+tool.
+.It Va WITHOUT_GDB
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GDB 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr gdb 1 .
+.It Va WITHOUT_GNU
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GNU 174550 2007-12-12 16:43:17Z ru
+Set to not build contributed GNU software as a part of the base system.
+This option can be useful if the system built must not contain any code
+covered by the GNU Public License due to legal reasons.
+.Bf -symbolic
+The option has no effect yet.
+.Ef
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_GNU_SUPPORT
+.El
+.It Va WITHOUT_GNU_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GNU_SUPPORT 156932 2006-03-21 07:50:50Z ru
+Set to build some programs without optional GNU support.
+.It Va WITHOUT_GPIB
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GPIB 156932 2006-03-21 07:50:50Z ru
+Set to not build GPIB bus support.
+.It Va WITHOUT_GPIO
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GPIO 228081 2011-11-28 17:54:34Z dim
+Set to not build
+.Xr gpioctl 8
+as part of the base system.
+.It Va WITHOUT_GROFF
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 218941 2011-02-22 08:13:49Z uqs
+Set to not build
+.Xr groff 1
+and
+.Xr vgrind 1 .
+You should consider installing the textproc/groff port to not break
+.Xr man 1 .
+.It Va WITHOUT_GSSAPI
+.\" from FreeBSD: head/tools/build/options/WITHOUT_GSSAPI 174548 2007-12-12 16:39:32Z ru
+Set to not build libgssapi.
+.It Va WITH_HESIOD
+.\" from FreeBSD: head/tools/build/options/WITH_HESIOD 156932 2006-03-21 07:50:50Z ru
+Set to build Hesiod support.
+.It Va WITHOUT_HTML
+.\" from FreeBSD: head/tools/build/options/WITHOUT_HTML 156932 2006-03-21 07:50:50Z ru
+Set to not build HTML docs.
+.It Va WITH_ICONV
+.\" from FreeBSD: head/tools/build/options/WITH_ICONV 219020 2011-02-25 00:10:26Z gabor
+Set to build iconv as part of libc.
+.It Va WITH_IDEA
+.\" from FreeBSD: head/tools/build/options/WITH_IDEA 156932 2006-03-21 07:50:50Z ru
+Set to build the IDEA encryption code.
+This code is patented in the USA and many European countries.
+It is
+.Em "YOUR RESPONSIBILITY"
+to determine if you can legally use IDEA.
+.It Va WITHOUT_INET
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INET 221266 2011-04-30 17:58:28Z bz
+Set to not build programs and libraries related to IPv4 networking.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_INET_SUPPORT
+.El
+.It Va WITHOUT_INET6
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INET6 156932 2006-03-21 07:50:50Z ru
+Set to not build
+programs and libraries related to IPv6 networking.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_INET6_SUPPORT
+.El
+.It Va WITHOUT_INET6_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru
+Set to build libraries, programs, and kernel modules without IPv6 support.
+.It Va WITHOUT_INET_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INET_SUPPORT 221266 2011-04-30 17:58:28Z bz
+Set to build libraries, programs, and kernel modules without IPv4 support.
+.It Va WITHOUT_INFO
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru
+Set to not make or install
+.Xr info 5
+files.
+.It Va WITHOUT_INSTALLLIB
+.\" from FreeBSD: head/tools/build/options/WITHOUT_INSTALLLIB 174497 2007-12-09 21:56:21Z dougb
+Set this if you do not want to install optional libraries.
+For example when creating a
+.Xr nanobsd 8
+image.
+.It Va WITHOUT_IPFILTER
+.\" from FreeBSD: head/tools/build/options/WITHOUT_IPFILTER 156932 2006-03-21 07:50:50Z ru
+Set to not build IP Filter package.
+.It Va WITHOUT_IPFW
+.\" from FreeBSD: head/tools/build/options/WITHOUT_IPFW 183242 2008-09-21 22:02:26Z sam
+Set to not build IPFW tools.
+.It Va WITHOUT_IPX
+.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX 156932 2006-03-21 07:50:50Z ru
+Set to not build programs and libraries related to IPX networking.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_IPX_SUPPORT
+.It
+.Va WITHOUT_NCP
+.El
+.It Va WITHOUT_IPX_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX_SUPPORT 156932 2006-03-21 07:50:50Z ru
+Set to build some programs without IPX support.
+.It Va WITHOUT_JAIL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_JAIL 183242 2008-09-21 22:02:26Z sam
+Set to not build tools for the support of jails; e.g.
+.Xr jail 8 .
+.It Va WITHOUT_KERBEROS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KERBEROS 174549 2007-12-12 16:42:03Z ru
+Set this if you do not want to build Kerberos 5 (KTH Heimdal).
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_KERBEROS_SUPPORT
+.El
+.Pp
+When set, the following options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_GSSAPI
+(unless
+.Va WITH_GSSAPI
+is set explicitly)
+.El
+.It Va WITHOUT_KERBEROS_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KERBEROS_SUPPORT 156932 2006-03-21 07:50:50Z ru
+Set to build some programs without Kerberos support, like
+.Xr cvs 1 ,
+.Xr ssh 1 ,
+.Xr telnet 1 ,
+.Xr sshd 8 ,
+and
+.Xr telnetd 8 .
+.It Va WITHOUT_KERNEL_SYMBOLS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KERNEL_SYMBOLS 222189 2011-05-22 18:23:17Z imp
+Set to not install kernel symbol files.
+.Bf -symbolic
+This option is recommended for those people who have small root partitions.
+.Ef
+.It Va WITHOUT_KVM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru
+Set to not build the
+.Nm libkvm
+library as a part of the base system.
+.Bf -symbolic
+The option has no effect yet.
+.Ef
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_KVM_SUPPORT
+.El
+.It Va WITHOUT_KVM_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_KVM_SUPPORT 170644 2007-06-13 02:08:04Z sepotvin
+Set to build some programs without optional
+.Nm libkvm
+support.
+.It Va WITHOUT_LEGACY_CONSOLE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LEGACY_CONSOLE 183242 2008-09-21 22:02:26Z sam
+Set to not build programs that support a legacy PC console; e.g.
+.Xr kbdcontrol 8
+and
+.Xr vidcontrol 8 .
+.It Va WITHOUT_LIB32
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LIB32 156932 2006-03-21 07:50:50Z ru
+On amd64, set to not build 32-bit library set and a
+.Nm ld-elf32.so.1
+runtime linker.
+.It Va WITH_LIBCPLUSPLUS
+.\" from FreeBSD: head/tools/build/options/WITH_LIBCPLUSPLUS 228082 2011-11-28 17:56:46Z dim
+Set to build libcxxrt and libc++.
+.It Va WITHOUT_LIBPTHREAD
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBPTHREAD 188848 2009-02-20 11:09:55Z mtm
+Set to not build the
+.Nm libpthread
+providing library,
+.Nm libthr .
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BIND
+.It
+.Va WITHOUT_BIND_DNSSEC
+.It
+.Va WITHOUT_BIND_ETC
+.It
+.Va WITHOUT_BIND_LIBS
+.It
+.Va WITHOUT_BIND_LIBS_LWRES
+.It
+.Va WITHOUT_BIND_MTREE
+.It
+.Va WITHOUT_BIND_NAMED
+.It
+.Va WITHOUT_BIND_UTILS
+.It
+.Va WITHOUT_LIBTHR
+.El
+.It Va WITHOUT_LIBTHR
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LIBTHR 156932 2006-03-21 07:50:50Z ru
+Set to not build the
+.Nm libthr
+(1:1 threading)
+library.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BIND
+.It
+.Va WITHOUT_BIND_DNSSEC
+.It
+.Va WITHOUT_BIND_ETC
+.It
+.Va WITHOUT_BIND_LIBS
+.It
+.Va WITHOUT_BIND_LIBS_LWRES
+.It
+.Va WITHOUT_BIND_MTREE
+.It
+.Va WITHOUT_BIND_NAMED
+.It
+.Va WITHOUT_BIND_UTILS
+.El
+.It Va WITHOUT_LOCALES
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LOCALES 156932 2006-03-21 07:50:50Z ru
+Set to not build localization files; see
+.Xr locale 1 .
+.It Va WITHOUT_LOCATE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LOCATE 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr locate 1
+and related programs.
+.It Va WITHOUT_LPR
+.\" from FreeBSD: head/tools/build/options/WITHOUT_LPR 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr lpr 1
+and related programs.
+.It Va WITHOUT_MAIL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_MAIL 183242 2008-09-21 22:02:26Z sam
+Set to not build any mail support (MUA or MTA).
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_MAILWRAPPER
+.It
+.Va WITHOUT_SENDMAIL
+.El
+.It Va WITHOUT_MAILWRAPPER
+.\" from FreeBSD: head/tools/build/options/WITHOUT_MAILWRAPPER 156932 2006-03-21 07:50:50Z ru
+Set to not build the
+.Xr mailwrapper 8
+MTA selector.
+.It Va WITHOUT_MAKE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_MAKE 183242 2008-09-21 22:02:26Z sam
+Set to not install
+.Xr make 1
+and related support files.
+.It Va WITHOUT_MAN
+.\" from FreeBSD: head/tools/build/options/WITHOUT_MAN 156932 2006-03-21 07:50:50Z ru
+Set to not build manual pages.
+When set, the following options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_MAN_UTILS
+(unless
+.Va WITH_MAN_UTILS
+is set explicitly)
+.El
+.It Va WITHOUT_MAN_UTILS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_MAN_UTILS 208322 2010-05-20 00:07:21Z jkim
+Set to not build utilities for manual pages,
+.Xr apropos 1 ,
+.Xr catman 1 ,
+.Xr makewhatis 1 ,
+.Xr man 1 ,
+.Xr whatis 1 ,
+.Xr manctl 8 ,
+and related support files.
+.It Va WITHOUT_NCP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NCP 156932 2006-03-21 07:50:50Z ru
+Set to not build programs, libraries, and kernel modules
+related to NetWare Core protocol.
+.It Va WITHOUT_NDIS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NDIS 183242 2008-09-21 22:02:26Z sam
+Set to not build programs and libraries
+related to NDIS emulation support.
+.It Va WITHOUT_NETCAT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NETCAT 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr nc 1
+utility.
+.It Va WITHOUT_NETGRAPH
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NETGRAPH 183242 2008-09-21 22:02:26Z sam
+Set to not build applications to support
+.Xr netgraph 4 .
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_ATM
+.It
+.Va WITHOUT_BLUETOOTH
+.It
+.Va WITHOUT_NETGRAPH_SUPPORT
+.El
+.It Va WITHOUT_NETGRAPH_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NETGRAPH_SUPPORT 183305 2008-09-23 16:11:15Z sam
+Set to build libraries, programs, and kernel modules without netgraph support.
+.It Va WITHOUT_NIS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NIS 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr NIS 8
+support and related programs.
+If set, you might need to adopt your
+.Xr nsswitch.conf 5
+and remove
+.Sq nis
+entries.
+.It Va WITHOUT_NLS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NLS 156932 2006-03-21 07:50:50Z ru
+Set to not build NLS catalogs.
+.It Va WITHOUT_NLS_CATALOGS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NLS_CATALOGS 156932 2006-03-21 07:50:50Z ru
+Set to not build NLS catalog support for
+.Xr csh 1 .
+.It Va WITHOUT_NS_CACHING
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NS_CACHING 172803 2007-10-19 14:01:25Z ru
+Set to disable name caching in the
+.Pa nsswitch
+subsystem.
+The generic caching daemon,
+.Xr nscd 8 ,
+will not be built either if this option is set.
+.It Va WITHOUT_NTP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_NTP 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr ntpd 8
+and related programs.
+.It Va WITH_OFED
+.\" from FreeBSD: head/tools/build/options/WITH_OFED 228081 2011-11-28 17:54:34Z dim
+Set to build the
+.Dq "OpenFabrics Enterprise Distribution"
+Infiniband software stack.
+.It Va WITHOUT_OPENSSH
+.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru
+Set to not build OpenSSH.
+.It Va WITHOUT_OPENSSL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSL 156932 2006-03-21 07:50:50Z ru
+Set to not build OpenSSL.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_KERBEROS
+.It
+.Va WITHOUT_KERBEROS_SUPPORT
+.It
+.Va WITHOUT_OPENSSH
+.El
+.Pp
+When set, the following options are also in effect:
+.Pp
+.Bl -inset -compact
+.It Va WITHOUT_GSSAPI
+(unless
+.Va WITH_GSSAPI
+is set explicitly)
+.El
+.It Va WITHOUT_PAM
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PAM 174550 2007-12-12 16:43:17Z ru
+Set to not build PAM library and modules.
+.Bf -symbolic
+This option is deprecated and does nothing.
+.Ef
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_PAM_SUPPORT
+.El
+.It Va WITHOUT_PAM_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PAM_SUPPORT 156932 2006-03-21 07:50:50Z ru
+Set to build some programs without PAM support, particularly
+.Xr ftpd 8
+and
+.Xr ppp 8 .
+.It Va WITHOUT_PF
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PF 156932 2006-03-21 07:50:50Z ru
+Set to not build PF firewall package.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_AUTHPF
+.El
+.It Va WITHOUT_PKGTOOLS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PKGTOOLS 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr pkg_add 8
+and related programs.
+.It Va WITHOUT_PMC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PMC 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr pmccontrol 8
+and related programs.
+.It Va WITHOUT_PORTSNAP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PORTSNAP 183242 2008-09-21 22:02:26Z sam
+Set to not build or install
+.Xr portsnap 8
+and related files.
+.It Va WITHOUT_PPP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PPP 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr ppp 8
+and related programs.
+.It Va WITHOUT_PROFILE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_PROFILE 228196 2011-12-02 09:09:54Z fjoe
+Set to avoid compiling profiled libraries.
+.It Va WITHOUT_QUOTAS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_QUOTAS 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr quota 8
+and related programs.
+.It Va WITHOUT_RCMDS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_RCMDS 156932 2006-03-21 07:50:50Z ru
+Disable building of the
+.Bx
+r-commands.
+This includes
+.Xr rlogin 1 ,
+.Xr rsh 1 ,
+etc.
+.It Va WITHOUT_RCS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr rcs 1
+and related utilities.
+.It Va WITHOUT_RESCUE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr rescue 8 .
+.It Va WITHOUT_ROUTED
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ROUTED 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr routed 8
+utility.
+.It Va WITHOUT_SENDMAIL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SENDMAIL 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr sendmail 8
+and related programs.
+.It Va WITHOUT_SETUID_LOGIN
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SETUID_LOGIN 156932 2006-03-21 07:50:50Z ru
+Set this to disable the installation of
+.Xr login 1
+as a set-user-ID root program.
+.It Va WITHOUT_SHAREDOCS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SHAREDOCS 156932 2006-03-21 07:50:50Z ru
+Set to not build the
+.Bx 4.4
+legacy docs.
+.It Va WITHOUT_SOURCELESS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS 230972 2012-02-04 00:54:43Z rmh
+Set to not build kernel modules that include sourceless code (either microcode or native code for host CPU).
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_SOURCELESS_HOST
+.It
+.Va WITHOUT_SOURCELESS_UCODE
+.El
+.It Va WITHOUT_SOURCELESS_HOST
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS_HOST 230972 2012-02-04 00:54:43Z rmh
+Set to not build kernel modules that include sourceless native code for host CPU.
+.It Va WITHOUT_SOURCELESS_UCODE
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS_UCODE 230972 2012-02-04 00:54:43Z rmh
+Set to not build kernel modules that include sourceless microcode.
+.It Va WITHOUT_SSP
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru
+Set to not build world with propolice stack smashing protection.
+.It Va WITHOUT_SYMVER
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SYMVER 169649 2007-05-17 05:03:24Z deischen
+Set to disable symbol versioning when building shared libraries.
+.It Va WITHOUT_SYSCONS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSCONS 156932 2006-03-21 07:50:50Z ru
+Set to not build
+.Xr syscons 4
+support files such as keyboard maps, fonts, and screen output maps.
+.It Va WITHOUT_SYSINSTALL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_SYSINSTALL 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr sysinstall 8
+and related programs.
+.It Va WITHOUT_TCSH
+.\" from FreeBSD: head/tools/build/options/WITHOUT_TCSH 156932 2006-03-21 07:50:50Z ru
+Set to not build and install
+.Pa /bin/csh
+(which is
+.Xr tcsh 1 ) .
+.It Va WITHOUT_TELNET
+.\" from FreeBSD: head/tools/build/options/WITHOUT_TELNET 183242 2008-09-21 22:02:26Z sam
+Set to not build
+.Xr telnet 8
+and related programs.
+.It Va WITHOUT_TEXTPROC
+.\" from FreeBSD: head/tools/build/options/WITHOUT_TEXTPROC 183242 2008-09-21 22:02:26Z sam
+Set to not build
+programs used for text processing.
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_GROFF
+.El
+.It Va WITHOUT_TOOLCHAIN
+.\" from FreeBSD: head/tools/build/options/WITHOUT_TOOLCHAIN 174550 2007-12-12 16:43:17Z ru
+Set to not install
+programs used for program development,
+compilers, debuggers etc.
+.Bf -symbolic
+The option does not work for build targets.
+.Ef
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_BINUTILS
+.It
+.Va WITHOUT_CLANG
+.It
+.Va WITHOUT_CLANG_IS_CC
+.It
+.Va WITHOUT_GCC
+.It
+.Va WITHOUT_GDB
+.El
+.It Va WITHOUT_USB
+.\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru
+Set to not build USB-related programs and libraries.
+.It Va WITHOUT_UTMPX
+.\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed
+Set to not build user accounting tools such as
+.Xr last 1 ,
+.Xr users 1 ,
+.Xr who 1 ,
+.Xr ac 8 ,
+.Xr lastlogin 8
+and
+.Xr utx 8 .
+.It Va WITHOUT_WIRELESS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS 183242 2008-09-21 22:02:26Z sam
+Set to not build programs used for 802.11 wireless networks; especially
+.Xr wpa_supplicant 8
+and
+.Xr hostapd 8 .
+When set, it also enforces the following options:
+.Pp
+.Bl -item -compact
+.It
+.Va WITHOUT_WIRELESS_SUPPORT
+.El
+.It Va WITHOUT_WIRELESS_SUPPORT
+.\" from FreeBSD: head/tools/build/options/WITHOUT_WIRELESS_SUPPORT 183305 2008-09-23 16:11:15Z sam
+Set to build libraries, programs, and kernel modules without
+802.11 wireless support.
+.It Va WITHOUT_WPA_SUPPLICANT_EAPOL
+.\" from FreeBSD: head/tools/build/options/WITHOUT_WPA_SUPPLICANT_EAPOL 156932 2006-03-21 07:50:50Z ru
+Build
+.Xr wpa_supplicant 8
+without support for the IEEE 802.1X protocol and without
+support for EAP-PEAP, EAP-TLS, EAP-LEAP, and EAP-TTLS
+protocols (usable only via 802.1X).
+.It Va WITHOUT_ZFS
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ZFS 168409 2007-04-06 02:13:30Z pjd
+Set to not build ZFS file system.
+.It Va WITHOUT_ZONEINFO
+.\" from FreeBSD: head/tools/build/options/WITHOUT_ZONEINFO 171994 2007-08-27 20:01:08Z remko
+Set to not build the timezone database
+.El
+.Sh FILES
+.Bl -tag -compact
+.It Pa /etc/src.conf
+.It Pa /usr/share/mk/bsd.own.mk
+.El
+.Sh SEE ALSO
+.Xr make 1 ,
+.Xr make.conf 5 ,
+.Xr build 7 ,
+.Xr ports 7
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was autogenerated.
diff --git a/share/man/man5/stab.5 b/share/man/man5/stab.5
new file mode 100644
index 000000000000..bc4e680a87b9
--- /dev/null
+++ b/share/man/man5/stab.5
@@ -0,0 +1,221 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)stab.5 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 10, 2010
+.Dt STAB 5
+.Os
+.Sh NAME
+.Nm stab
+.Nd symbol table types
+.Sh SYNOPSIS
+.In stab.h
+.Sh DESCRIPTION
+The file
+.In stab.h
+defines some of the symbol table
+.Fa n_type
+field values for a.out files.
+These are the types for permanent symbols (i.e., not local labels, etc.)
+used by the old debugger
+.Em sdb
+and the Berkeley Pascal compiler
+.Xr pc 1 .
+Symbol table entries can be produced by the
+.Pa .stabs
+assembler directive.
+This allows one to specify a double-quote delimited name, a symbol type,
+one char and one short of information about the symbol, and an unsigned
+long (usually an address).
+To avoid having to produce an explicit label for the address field,
+the
+.Pa .stabd
+directive can be used to implicitly address the current location.
+If no name is needed, symbol table entries can be generated using the
+.Pa .stabn
+directive.
+The loader promises to preserve the order of symbol table entries produced
+by
+.Pa .stab
+directives.
+As described in
+.Xr a.out 5 ,
+an element of the symbol table
+consists of the following structure:
+.Bd -literal
+/*
+* Format of a symbol table entry.
+*/
+
+struct nlist {
+ union {
+ const char *n_name; /* for use when in-core */
+ long n_strx; /* index into file string table */
+ } n_un;
+ unsigned char n_type; /* type flag */
+ char n_other; /* unused */
+ short n_desc; /* see struct desc, below */
+ unsigned n_value; /* address or offset or line */
+};
+.Ed
+.Pp
+The low bits of the
+.Fa n_type
+field are used to place a symbol into
+at most one segment, according to
+the following masks, defined in
+.In a.out.h .
+A symbol can be in none of these segments by having none of these segment
+bits set.
+.Bd -literal
+/*
+* Simple values for n_type.
+*/
+
+#define N_UNDF 0x0 /* undefined */
+#define N_ABS 0x2 /* absolute */
+#define N_TEXT 0x4 /* text */
+#define N_DATA 0x6 /* data */
+#define N_BSS 0x8 /* bss */
+
+#define N_EXT 01 /* external bit, or'ed in */
+.Ed
+.Pp
+The
+.Fa n_value
+field of a symbol is relocated by the linker,
+.Xr ld 1
+as an address within the appropriate segment.
+.Fa N_value
+fields of symbols not in any segment are unchanged by the linker.
+In addition, the linker will discard certain symbols, according to rules
+of its own, unless the
+.Fa n_type
+field has one of the following bits set:
+.Bd -literal
+/*
+* Other permanent symbol table entries have some of the N_STAB bits set.
+* These are given in <stab.h>
+*/
+
+#define N_STAB 0xe0 /* if any of these bits set, don't discard */
+.Ed
+.Pp
+This allows up to 112 (7 \(** 16) symbol types, split between the various
+segments.
+Some of these have already been claimed.
+The old symbolic debugger,
+.Em sdb ,
+uses the following n_type values:
+.Bd -literal
+#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
+#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
+#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
+#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
+#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
+#define N_RSYM 0x40 /* register sym: name,,0,type,register */
+#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
+#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
+#define N_SO 0x64 /* source file name: name,,0,0,address */
+#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
+#define N_SOL 0x84 /* #included file name: name,,0,0,address */
+#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
+#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
+#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
+#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
+#define N_BCOMM 0xe2 /* begin common: name,, */
+#define N_ECOMM 0xe4 /* end common: name,, */
+#define N_ECOML 0xe8 /* end common (local name): ,,address */
+#define N_LENG 0xfe /* second stab entry with length information */
+.Ed
+.Pp
+where the comments give
+.Em sdb
+conventional use for
+.Pa .stab
+.Fa s
+and the
+.Fa n_name ,
+.Fa n_other ,
+.Fa n_desc ,
+and
+.Fa n_value
+fields
+of the given
+.Fa n_type .
+.Em Sdb
+uses the
+.Fa n_desc
+field to hold a type specifier in the form used
+by the Portable C Compiler,
+.Xr cc 1 ;
+see the header file
+.Pa pcc.h
+for details on the format of these type values.
+.Pp
+The Berkeley Pascal compiler,
+.Xr pc 1 ,
+uses the following
+.Fa n_type
+value:
+.Bd -literal
+#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */
+.Ed
+.Pp
+and uses the following subtypes to do type checking across separately
+compiled files:
+.Bd -unfilled -offset indent
+1 source file name
+2 included file name
+3 global label
+4 global constant
+5 global type
+6 global variable
+7 global function
+8 global procedure
+9 external function
+10 external procedure
+11 library variable
+12 library routine
+.Ed
+.Sh SEE ALSO
+.Xr as 1 ,
+.Xr ld 1 ,
+.Xr a.out 5
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Bx 4.0 .
+.Sh BUGS
+More basic types are needed.
diff --git a/share/man/man5/style.Makefile.5 b/share/man/man5/style.Makefile.5
new file mode 100644
index 000000000000..c3a3288ddf86
--- /dev/null
+++ b/share/man/man5/style.Makefile.5
@@ -0,0 +1,276 @@
+.\" Copyright (c) 2002-2003 David O'Brien <obrien@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL DAVID O'BRIEN OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2005
+.Dt STYLE.MAKEFILE 5
+.Os
+.Sh NAME
+.Nm style.Makefile
+.Nd
+.Fx
+.Pa Makefile
+file style guide
+.Sh DESCRIPTION
+This file specifies the preferred style for makefiles in the
+.Fx
+source tree.
+.Bl -bullet
+.It
+All makefiles should have an SCM ID at the start of the file,
+followed by a blank line.
+.Bd -literal
+# $FreeBSD\&$
+
+.Ed
+.It
+.Cm .PATH :
+comes next if needed, and is spelled
+.Dq Li ".PATH: " ,
+with a single
+.Tn ASCII
+space after a colon.
+Do not use the
+.Va VPATH
+variable.
+.It
+Special variables (i.e.,
+.Va LIB , SRCS , MLINKS ,
+etc.) are listed in order of
+.Dq product ,
+then building and installing a binary.
+Special variables may also be listed in
+.Dq build
+order: i.e., ones for the primary program (or library) first.
+The general
+.Dq product
+order is:
+.Va PROG Ns / Ns Oo Va SH Oc Ns Va LIB Ns / Ns Va SCRIPTS
+.Va FILES
+.Va LINKS
+.Oo Va NO_ Oc Ns Va MAN
+.Va MLINKS
+.Va INCS
+.Va SRCS
+.Va WARNS
+.Va CFLAGS
+.Va DPADD
+.Va LDADD .
+The general
+.Dq build
+order is:
+.Va PROG Ns / Ns Oo Va SH Oc Ns Va LIB Ns / Ns Va SCRIPTS
+.Va SRCS
+.Va WARNS
+.Va CFLAGS
+.Va DPADD
+.Va LDADD
+.Va INCS
+.Va FILES
+.Va LINKS
+.Oo Va NO_ Oc Ns Va MAN
+.Va MLINKS .
+.It
+Omit
+.Va SRCS
+when using
+.In bsd.prog.mk
+and there is a single source file named the same as the
+.Va PROG .
+.It
+Omit
+.Va MAN
+when using
+.In bsd.prog.mk
+and the manual page is named the same as the
+.Va PROG ,
+and is in section 1.
+.It
+All variable assignments are spelled
+.Dq Va VAR Ns Ic = ,
+i.e., no space between the variable name and the
+.Ic = .
+Keep values sorted alphabetically, if possible.
+.It
+Do not use
+.Ic +=
+to set variables that are only set once
+(or to set variables for the first time).
+.It
+Do not use vertical whitespace in simple makefiles,
+but do use it to group locally related things in more complex/longer ones.
+.It
+.Va WARNS
+comes before
+.Va CFLAGS ,
+as it is basically a
+.Va CFLAGS
+modifier.
+It comes before
+.Va CFLAGS
+rather than after
+.Va CFLAGS
+so it does not get lost in a sea of
+.Va CFLAGS
+statements as
+.Va WARNS
+is an important thing.
+The usage of
+.Va WARNS
+is spelled
+.Dq Li "WARNS?= " ,
+so that it may be overridden on the command line or in
+.Xr make.conf 5 .
+.It
+.Dq Li "NO_WERROR= yes"
+should not be used,
+it defeats the purpose of
+.Va WARNS .
+It should only be used on the command line and in special circumstances.
+.It
+.Va CFLAGS
+is spelled
+.Dq Li "CFLAGS+= " .
+.It
+Listing
+.Fl D Ns 's
+before
+.Fl I Ns 's
+in
+.Va CFLAGS
+is preferred for alphabetical ordering and to make
+.Fl D Ns 's
+easier to see.
+The
+.Fl D Ns 's
+often affect conditional compilation,
+and
+.Fl I Ns 's
+tend to be quite long.
+Split long
+.Va CFLAGS
+settings between the
+.Fl D Ns 's
+and
+.Fl I Ns 's.
+.It
+Do not use GCCisms (such as
+.Fl g
+and
+.Fl Wall )
+in
+.Va CFLAGS .
+.It
+Typically, there is one
+.Tn ASCII
+tab between
+.Va VAR Ns Ic =
+and the value in order to start the value in column 9.
+An
+.Tn ASCII
+space is allowed for variable names that extend beyond column 9.
+A lack of whitespace is also allowed for very long variable names.
+.It
+.Ic .include In bsd.*.mk
+goes last.
+.It
+Do not use anachronisms like
+.Va $<
+and
+.Va $@ .
+Instead use
+.Va ${.IMPSRC}
+or
+.Va ${.ALLSRC}
+and
+.Va ${.TARGET} .
+.It
+To not build the
+.Dq foo
+part of the base system,
+use
+.Va NO_FOO ,
+not
+.Va NOFOO .
+.It
+To optionally build something in the base system,
+spell the knob
+.Va WITH_FOO
+not
+.Va WANT_FOO
+or
+.Va USE_FOO .
+The latter are reserved for the
+.Fx
+Ports Collection.
+.It
+For variables that are only checked with
+.Fn defined ,
+do not provide any fake value.
+.El
+.Pp
+The desire to express a logical grouping often means not obeying some of the
+above.
+.Sh EXAMPLES
+The simplest program
+.Pa Makefile
+is:
+.Bd -literal -offset indent
+# $FreeBSD\&$
+
+PROG= foo
+
+\&.include <bsd.prog.mk>
+.Ed
+.Pp
+The simplest library
+.Pa Makefile
+is:
+.Bd -literal -offset indent
+# $FreeBSD\&$
+
+LIB= foo
+SHLIB_MAJOR= 1
+MAN= libfoo.3
+SRCS= foo.c
+
+\&.include <bsd.lib.mk>
+.Ed
+.Sh SEE ALSO
+.Xr make 1 ,
+.Xr make.conf 5 ,
+.Xr style 9
+.Sh HISTORY
+This manual page is inspired from the same source as
+.Xr style 9
+manual page in
+.Fx .
+.Sh BUGS
+There are few hard and fast style rules here.
+The style of many things is too dependent on the context of the whole makefile,
+or the lines surrounding it.
diff --git a/share/man/man5/sysctl.conf.5 b/share/man/man5/sysctl.conf.5
new file mode 100644
index 000000000000..0e69bcc13859
--- /dev/null
+++ b/share/man/man5/sysctl.conf.5
@@ -0,0 +1,84 @@
+.\" Copyright (c) 1999 Chris Costello <chris@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 30, 1999
+.Dt SYSCTL.CONF 5
+.Os
+.Sh NAME
+.Nm sysctl.conf
+.Nd kernel state defaults
+.Sh DESCRIPTION
+The
+.Pa /etc/sysctl.conf
+file is read in when the system goes into multi-user mode to set default
+settings for the kernel.
+The
+.Pa /etc/sysctl.conf
+is in the format of the
+.Xr sysctl 8
+command, i.e.\&
+.Bd -literal -offset indent
+sysctl_mib=value
+.Ed
+.Pp
+Comments are denoted by a
+.Dq #
+at the beginning of a line.
+Comments can also exist at the end of a line,
+as seen in the
+.Sx EXAMPLES
+section, below.
+.Sh FILES
+.Bl -tag -width /etc/sysctl.conf -compact
+.It Pa /etc/sysctl.conf
+Initial settings for
+.Xr sysctl 8 .
+.El
+.Sh EXAMPLES
+To turn off logging of programs that exit due to fatal signals you may use
+a configuration like
+.Bd -literal -offset indent
+# Configure logging.
+kern.logsigexit=0 # Do not log fatal signal exits (e.g. sig 11)
+.Ed
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr rc 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 4.0 .
+.Sh BUGS
+If loadable kernel modules are used to introduce additional kernel
+functionality and sysctls to manage that functionality,
+.Nm
+may be processed too early in the boot process to set those sysctls.
+For example, sysctls to manage the linux emulator cannot be set in
+.Nm
+if the linux emulator is loaded as a module rather than
+compiled into the kernel.
diff --git a/share/man/man5/tmpfs.5 b/share/man/man5/tmpfs.5
new file mode 100644
index 000000000000..4d66f5db87b8
--- /dev/null
+++ b/share/man/man5/tmpfs.5
@@ -0,0 +1,149 @@
+.\"-
+.\" Copyright (c) 2007 Xin LI
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"-
+.\" Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 2010
+.Dt TMPFS 5
+.Os
+.Sh NAME
+.Nm tmpfs
+.Nd "efficient memory file system"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "options TMPFS"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+tmpfs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to access
+.Tn tmpfs
+file systems.
+.Sh OPTIONS
+The following options are available when
+mounting
+.Nm
+file systems:
+.Bl -tag -width indent
+.It Cm gid
+Specifies the group ID of the root inode of the file system.
+Defaults to the mount point's GID.
+.It Cm uid
+Specifies the user ID of the root inode of the file system.
+Defaults to the mount point's UID.
+.It Cm mode
+Specifies the mode (in octal notation) of the root inode of the file system.
+Defaults to the mount point's mode.
+.It Cm inodes
+Specifies the maximum number of nodes available to the file system.
+If not specified, the file system chooses a reasonable maximum based on
+the file system size, which can be limited with the
+.Cm size
+option.
+.It Cm size
+Specifies the total file system size in bytes.
+If zero (the default) or a value larger than SIZE_MAX - PAGE_SIZE
+is given, the available amount of memory (including
+main memory and swap space) will be used.
+.It Cm maxfilesize
+Specifies the maximum file size in bytes.
+Defaults to the maximum possible value.
+.El
+.Sh EXAMPLES
+To mount a
+.Nm
+memory file system:
+.Pp
+.Dl "mount -t tmpfs tmpfs /tmp"
+.Sh SEE ALSO
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5 ,
+.Xr mdmfs 8 ,
+.Xr mount 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+kernel implementation was written by
+.An Julio M. Merino Vidal Aq jmmv@NetBSD.org
+as a Google SoC project.
+.Pp
+.An Rohit Jalan
+and others ported it from
+.Nx
+to
+.Fx .
+.Pp
+This manual page was written by
+.An Xin LI Aq delphij@FreeBSD.org .
+.Sh BUGS
+The
+.Nm
+kernel implementation is currently considered as
+an experimental feature.
+Some file system mount
+time options are not well supported.
diff --git a/share/man/man5/xfs.5 b/share/man/man5/xfs.5
new file mode 100644
index 000000000000..67504aa676ab
--- /dev/null
+++ b/share/man/man5/xfs.5
@@ -0,0 +1,108 @@
+.\"
+.\" Copyright (c) 2007 Craig Rodrigues
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2011
+.Dt XFS 5
+.Os
+.Sh NAME
+.Nm xfs
+.Nd "XFS file system"
+.Sh SYNOPSIS
+To link into the kernel:
+.Bd -ragged -offset indent
+.Cd "options XFS"
+.Ed
+.Pp
+To load as a kernel loadable module:
+.Pp
+.Dl "kldload xfs"
+.Sh DESCRIPTION
+The
+.Nm
+driver will permit the
+.Fx
+kernel to access
+.Tn XFS
+file systems.
+.Sh EXAMPLES
+To mount a
+.Nm
+volume located on
+.Pa /dev/ad1s1 :
+.Pp
+.Dl "mount -t xfs -o ro /dev/ad1s1 /mnt"
+.Sh SEE ALSO
+.Xr nmount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5 ,
+.Xr mount 8
+.Sh NOTES
+The
+.Pa sysutils/xfsprogs
+port contains the
+.Cm mkfs.xfs
+utility for
+creating XFS file systems, and also other utilities for analyzing,
+and repairing XFS file systems.
+.Sh HISTORY
+XFS was originally written by SGI for the IRIX operating system.
+SGI ported XFS to Linux, and released the source code under the GNU
+Public License. For more details, see:
+.Pa http://oss.sgi.com/projects/xfs
+.Pp
+The port to
+.Fx
+was based on the Linux port, and started by
+.An -nosplit
+.An Russell Cattelan Aq cattelan@xfs.org ,
+.An Alexander Kabaev Aq kan@FreeBSD.org ,
+and
+.An Craig Rodrigues Aq rodrigc@FreeBSD.org .
+.Pp
+The
+.Nm
+file system support
+first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Craig Rodrigues Aq rodrigc@FreeBSD.org .
+.Sh CAVEATS
+The port of XFS to
+.Fx
+is currently incomplete.
+Only read-only access is supported for XFS volumes.
+Writing to a volume is not supported.
+.Pp
+The
+.Fl p
+flag to
+.Cm mkfs.xfs
+can be used to create an XFS file system which is populated with files
+and other metadata.
+This can be used to quickly create a read-only file system which
+can be tested on
+.Fx .
diff --git a/share/man/man6/Makefile b/share/man/man6/Makefile
new file mode 100644
index 000000000000..be6547e592b5
--- /dev/null
+++ b/share/man/man6/Makefile
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+MAN= intro.6
+
+.include <bsd.prog.mk>
diff --git a/share/man/man6/intro.6 b/share/man/man6/intro.6
new file mode 100644
index 000000000000..a7d08c5e9aa5
--- /dev/null
+++ b/share/man/man6/intro.6
@@ -0,0 +1,62 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 1997
+.Dt INTRO 6
+.Os
+.Sh NAME
+.Nm intro
+.Nd "introduction to games"
+.Sh DESCRIPTION
+This section contains information about games.
+The games
+are located in
+.Pa /usr/games
+if installed.
+You can get a short overview about all the games with the
+command:
+.Bd -literal -offset indent
+$ apropos '\\(6\\)'
+.Ed
+.Sh FILES
+.Bl -tag -width /usr/games -compact
+.It Pa /usr/games
+location of games
+.El
+.Sh SEE ALSO
+.Xr intro 1
+.Sh HISTORY
+The
+.Nm
+section manual page appeared in
+.Fx 2.2 .
diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile
new file mode 100644
index 000000000000..011fbaf07139
--- /dev/null
+++ b/share/man/man7/Makefile
@@ -0,0 +1,37 @@
+# @(#)Makefile 8.1 (Berkeley) 6/5/93
+# $FreeBSD$
+
+#MISSING: eqnchar.7 ms.7 term.7
+MAN= adding_user.7 \
+ ascii.7 \
+ bsd.snmpmod.mk.7 \
+ build.7 \
+ clocks.7 \
+ c99.7 \
+ development.7 \
+ environ.7 \
+ ffs.7 \
+ firewall.7 \
+ hier.7 \
+ hostname.7 \
+ intro.7 \
+ maclabel.7 \
+ mailaddr.7 \
+ operator.7 \
+ ports.7 \
+ release.7 \
+ sdoc.7 \
+ security.7 \
+ sprog.7 \
+ stdint.7 \
+ sticky.7 \
+ tuning.7
+
+MLINKS= intro.7 miscellaneous.7
+MLINKS+= security.7 securelevel.7
+MLINKS+= c99.7 c.7
+MLINKS+= c99.7 c78.7
+MLINKS+= c99.7 c89.7
+MLINKS+= c99.7 c90.7
+
+.include <bsd.prog.mk>
diff --git a/share/man/man7/adding_user.7 b/share/man/man7/adding_user.7
new file mode 100644
index 000000000000..499bd481615e
--- /dev/null
+++ b/share/man/man7/adding_user.7
@@ -0,0 +1,110 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)adduser.8 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd January 30, 2009
+.Dt ADDING_USER 8
+.Os
+.Sh NAME
+.Nm adding_user
+.Nd procedure for adding new users
+.Sh DESCRIPTION
+A new user must choose a login name, which must not already appear in
+.Pa /etc/passwd
+or
+.Pa /etc/mail/aliases .
+It must also not begin with the hyphen
+.Sq Fl
+character.
+It is strongly recommended that it be all lower-case, and not contain
+the dot
+.Ql .\&
+character, as that tends to confuse mailers.
+An account can be added by editing a line into the passwd file; this
+must be done with the password file locked e.g.\& by using
+.Xr chpass 1
+or
+.Xr vipw 8 .
+.Pp
+A new user is given a group and user id.
+Login and user id's should be unique across the system, and often across
+a group of systems, since they are used to control file access.
+Typically, users working on similar projects will be put in the same groups.
+At the University of California, Berkeley, we have groups for system staff,
+faculty, graduate students, and special groups for large projects.
+.Pp
+A skeletal account for a new user
+.Dq ernie
+might look like:
+.Bd -literal
+ernie::25:30::0:0:Ernie Kovacs,508 Evans Hall,x7925,
+ 642-8202:/a/users/ernie:/bin/csh
+.Ed
+.Pp
+For a description of each of these fields, see
+.Xr passwd 5 .
+.Pp
+It is useful to give new users some help in getting started, supplying
+them with a few skeletal files such as
+.Pa \&.profile
+if they use
+.Pa /bin/sh ,
+or
+.Pa \&.cshrc
+and
+.Pa \&.login
+if they use
+.Pa /bin/csh .
+The directory
+.Pa /usr/share/skel
+contains skeletal definitions of such files.
+New users should be given copies of these files which, for instance,
+use
+.Xr tset 1
+automatically at each login.
+.Sh FILES
+.Bl -tag -width /etc/master.passwdxx -compact
+.It Pa /etc/master.passwd
+user database
+.It Pa /usr/share/skel
+skeletal login directory
+.El
+.Sh SEE ALSO
+.Xr chpass 1 ,
+.Xr finger 1 ,
+.Xr passwd 1 ,
+.Xr aliases 5 ,
+.Xr passwd 5 ,
+.Xr adduser 8 ,
+.Xr pwd_mkdb 8 ,
+.Xr vipw 8
diff --git a/share/man/man7/ascii.7 b/share/man/man7/ascii.7
new file mode 100644
index 000000000000..feba23385c21
--- /dev/null
+++ b/share/man/man7/ascii.7
@@ -0,0 +1,117 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)ascii.7 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt ASCII 7
+.Os
+.Sh NAME
+.Nm ascii
+.Nd octal, hexadecimal and decimal
+.Tn ASCII
+character sets
+.Sh DESCRIPTION
+The
+.Nm octal
+set:
+.Bd -literal -offset left
+000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ 006 ACK 007 BEL
+010 BS 011 HT 012 NL 013 VT 014 NP 015 CR 016 SO 017 SI
+020 DLE 021 DC1 022 DC2 023 DC3 024 DC4 025 NAK 026 SYN 027 ETB
+030 CAN 031 EM 032 SUB 033 ESC 034 FS 035 GS 036 RS 037 US
+040 SP 041 ! 042 " 043 # 044 $ 045 % 046 & 047 '
+050 ( 051 ) 052 * 053 + 054 , 055 - 056 . 057 /
+060 0 061 1 062 2 063 3 064 4 065 5 066 6 067 7
+070 8 071 9 072 : 073 ; 074 < 075 = 076 > 077 ?
+100 @ 101 A 102 B 103 C 104 D 105 E 106 F 107 G
+110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O
+120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W
+130 X 131 Y 132 Z 133 [ 134 \e\ 135 ] 136 ^ 137 _
+140 ` 141 a 142 b 143 c 144 d 145 e 146 f 147 g
+150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o
+160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w
+170 x 171 y 172 z 173 { 174 | 175 } 176 ~ 177 DEL
+.Ed
+.Pp
+The
+.Nm hexadecimal
+set:
+.Bd -literal -offset left
+00 NUL 01 SOH 02 STX 03 ETX 04 EOT 05 ENQ 06 ACK 07 BEL
+08 BS 09 HT 0A NL 0B VT 0C NP 0D CR 0E SO 0F SI
+10 DLE 11 DC1 12 DC2 13 DC3 14 DC4 15 NAK 16 SYN 17 ETB
+18 CAN 19 EM 1A SUB 1B ESC 1C FS 1D GS 1E RS 1F US
+20 SP 21 ! 22 " 23 # 24 $ 25 % 26 & 27 '
+28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f /
+30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7
+38 8 39 9 3a : 3b ; 3c < 3d = 3e > 3f ?
+40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G
+48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O
+50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W
+58 X 59 Y 5a Z 5b [ 5c \e\ 5d ] 5e ^ 5f _
+60 \` 61 a 62 b 63 c 64 d 65 e 66 f 67 g
+68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o
+70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w
+78 x 79 y 7a z 7b { 7c | 7d } 7e ~ 7f DEL
+.Ed
+.Pp
+The
+.Nm decimal
+set:
+.Bd -literal -offset left
+ 0 NUL 1 SOH 2 STX 3 ETX 4 EOT 5 ENQ 6 ACK 7 BEL
+ 8 BS 9 HT 10 NL 11 VT 12 NP 13 CR 14 SO 15 SI
+ 16 DLE 17 DC1 18 DC2 19 DC3 20 DC4 21 NAK 22 SYN 23 ETB
+ 24 CAN 25 EM 26 SUB 27 ESC 28 FS 29 GS 30 RS 31 US
+ 32 SP 33 ! 34 " 35 # 36 $ 37 % 38 & 39 '
+ 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 /
+ 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7
+ 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ?
+ 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G
+ 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O
+ 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W
+ 88 X 89 Y 90 Z 91 [ 92 \e\ 93 ] 94 ^ 95 _
+ 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g
+104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o
+112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w
+120 x 121 y 122 z 123 { 124 | 125 } 126 ~ 127 DEL
+.Ed
+.Sh FILES
+.Bl -tag -width /usr/share/misc/ascii -compact
+.It Pa /usr/share/misc/ascii
+.El
+.Sh HISTORY
+An
+.Nm
+manual page appeared in
+.At v7 .
diff --git a/share/man/man7/bsd.snmpmod.mk.7 b/share/man/man7/bsd.snmpmod.mk.7
new file mode 100644
index 000000000000..299daf227e18
--- /dev/null
+++ b/share/man/man7/bsd.snmpmod.mk.7
@@ -0,0 +1,117 @@
+.\"
+.\" Copyright (c) 2005,2008
+.\" Hartmut Brandt.
+.\" All rights reserved.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2008
+.Dt BSD.SNMPMOD.MK 7
+.Os
+.Sh NAME
+.Nm bsd.snmpmod.mk
+.Nd building modules for
+.Xr bsnmpd 1
+.Sh SYNOPSIS
+.Fd ".include <bsd.snmpmod.mk>"
+.Sh DESCRIPTION
+The file
+.In bsd.snmpmod.mk
+simplifies the building of modules for the Begemot SNMP daemon,
+.Xr bsnmpd 1 .
+It provides some common functions for building a module and
+relies on
+.In bsd.lib.mk ,
+which is included by
+.In bsd.snmpmod.mk
+to actually build the shared library.
+.Pp
+The following
+.Xr make 1
+variables control the special functions:
+.Bl -tag -width ".Va EXTRAMIBDEFS"
+.It Va MOD
+The short name of the module.
+The name of the shared library will be
+.Pa snmp_${MOD}.so .
+There must exist a file
+.Pa ${MOD}_tree.def
+for compilation with
+.Xr gensnmptree 1
+which contains the definition of the MIB tree implemented by the module.
+.It Va EXTRAMIBDEFS
+A list of extra MIB definition files for
+.Xr gensnmptree 1 .
+This is optional.
+This file list is given to both calls to
+.Xr gensnmptree 1 No \(em
+the one that extracts the symbols in
+.Va XSYM
+from the MIB definitions and the one that
+generates the table with OIDs served by this module.
+.It Va EXTRAMIBSYMS
+A list of extra MIB definition files for
+.Xr gensnmptree 1 .
+This is optional.
+This file list is given only to the call to
+.Xr gensnmptree 1
+that extracts symbols from MIB definition files.
+It is useful if there are dependencies on other MIBs or for extracting global
+definitions for enumeration constants.
+.It Va XSYM
+A list of symbols to be extracted from the MIB definition files by
+.Xr gensnmptree 1 .
+This is optional.
+.It Va DEFS
+A list of MIB definition files to be installed.
+This is optional.
+.It Va BMIBS
+A list of textual MIBs to be installed.
+This is optional.
+.El
+.Pp
+Three files are automatically created from the MIB definition files and
+the
+.Va XSYM
+variable:
+.Bl -tag -width ".Va EXTRAMIBDEFS"
+.It Pa ${MOD}_tree.c
+This contains a table with the tree implemented by the module.
+It is automatically included into the
+.Va SRCS
+variable.
+.It Pa ${MOD}_tree.h
+This contains preprocessor defines for all the OIDs defined by the module
+and can be included in the module's source code.
+.It Pa ${MOD}_oid.h
+OID preprocessor definitions for all the symbols listed in
+.Va XSYMS .
+This is to be included into the module's source code.
+.El
+.Sh SEE ALSO
+.Xr bsnmpd 1 ,
+.Xr gensnmptree 1 ,
+.Xr snmpmod 3
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
new file mode 100644
index 000000000000..f16895875fee
--- /dev/null
+++ b/share/man/man7/build.7
@@ -0,0 +1,608 @@
+.\" Copyright (c) 2000
+.\" Mike W. Meyer
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 29, 2011
+.Dt BUILD 7
+.Os
+.Sh NAME
+.Nm build
+.Nd information on how to build the system
+.Sh DESCRIPTION
+The sources for the
+.Fx
+system and its applications are contained in three different directories,
+normally
+.Pa /usr/src ,
+.Pa /usr/doc ,
+and
+.Pa /usr/ports .
+Directory
+.Pa /usr/src
+contains the
+.Dq "base system"
+sources, which is loosely defined as the things required to rebuild
+the system to a useful state.
+Directory
+.Pa /usr/doc
+contains the source for the system documentation, excluding the manual
+pages.
+Directory
+.Pa /usr/ports
+contains a tree that provides a consistent interface for building and
+installing third party applications.
+For more information about the ports build process, see
+.Xr ports 7 .
+.Pp
+The
+.Xr make 1
+command is used in each of these directories to build and install the
+things in that directory.
+Issuing the
+.Xr make 1
+command in any directory or
+subdirectory of those directories has the same effect as issuing the
+same command in all subdirectories of that directory.
+With no target specified, the things in that directory are just built.
+.Pp
+A source tree is allowed to be read-only.
+As described in
+.Xr make 1 ,
+objects are usually built in a separate object directory hierarchy
+specified by the environment variable
+.Va MAKEOBJDIRPREFIX ,
+or under
+.Pa /usr/obj
+if variable
+.Va MAKEOBJDIRPREFIX
+is not set.
+For a given source directory, its canonical object directory
+would be
+.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
+if
+.Xr make 1
+variable
+.Va MAKEOBJDIRPREFIX
+is set, or
+.Pa /usr/obj${.CURDIR}
+if this variable is not set.
+Cross-builds set the object directory as described in the
+documentation for the
+.Cm buildworld
+target below.
+.Pp
+The build may be controlled by defining
+.Xr make 1
+variables described in the
+.Sx ENVIRONMENT
+section below, and by the variables documented in
+.Xr make.conf 5 .
+.Pp
+The following list provides the names and actions for the targets
+supported by the build system:
+.Bl -tag -width ".Cm cleandepend"
+.It Cm clean
+Remove any files created during the build process.
+.It Cm cleandepend
+Remove the file
+.Pa ${.OBJDIR}/${DEPENDFILE}
+generated by a prior
+.Dq Li "make depend"
+step.
+.It Cm cleandir
+Remove the canonical object directory if it exists, or perform
+actions equivalent to
+.Dq Li "make clean cleandepend"
+if it does not.
+This target will also remove an
+.Pa obj
+link in
+.Pa ${.CURDIR}
+if that exists.
+.Pp
+It is advisable to run
+.Dq Li "make cleandir"
+twice: the first invocation will remove the canonical object directory
+and the second one will clean up
+.Pa ${.CURDIR} .
+.It Cm depend
+Generate a list of build dependencies in file
+.Pa ${.OBJDIR}/${DEPENDFILE} .
+.It Cm install
+Install the results of the build to the appropriate location in the
+installation directory hierarchy specified in variable
+.Va DESTDIR .
+.It Cm obj
+Create the canonical object directory associated with the current
+directory.
+.It Cm objlink
+Create a symbolic link to the canonical object directory in
+.Pa ${.CURDIR} .
+.It Cm tags
+Generate a tags file using the program specified in the
+.Xr make 1
+variable
+.Va CTAGS .
+The build system supports
+.Xr ctags 1
+and
+.Nm "GNU Global" .
+.El
+.Pp
+The other supported targets under directory
+.Pa /usr/src
+are:
+.Bl -tag -width ".Cm distributeworld"
+.It Cm buildenv
+Spawn an interactive shell with environment variables set up for
+cross-building the system.
+The target architecture needs to be specified with
+.Xr make 1
+variables
+.Va TARGET_ARCH
+and
+.Va TARGET .
+.Pp
+This target is only useful after a complete cross-toolchain including
+the compiler, linker, assembler, headers and libraries has been
+built; see the
+.Cm toolchain
+target below.
+.It Cm buildworld
+Build everything but the kernel, configure files in
+.Pa etc ,
+and
+.Pa release .
+The actual build location prefix used is
+.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
+for native builds, and
+.Pa ${MAKEOBJDIRPREFIX}/${TARGET}${.CURDIR}
+for cross builds and native builds with variable
+.Va CROSS_BUILD_TESTING
+set.
+.It Cm cleanworld
+Attempt to clean up targets built by a preceding
+.Cm buildworld
+step.
+.It Cm distributeworld
+Distribute everything compiled by a preceding
+.Cm buildworld
+step.
+Files are placed in the directory hierarchy specified by
+.Xr make 1
+variable
+.Va DISTDIR .
+This target is used while building a release; see
+.Xr release 7 .
+.It Cm packageworld
+Archive the results of
+.Cm distributeworld ,
+placing the results in
+.Va DISTDIR .
+This target is used while building a release; see
+.Xr release 7 .
+.It Cm installworld
+Install everything built by a preceding
+.Cm buildworld
+step into the directory hierarchy pointed to by
+.Xr make 1
+variable
+.Va DESTDIR .
+.Pp
+If installing onto an NFS file system and running
+.Xr make 1
+with the
+.Fl j
+option, make sure that
+.Xr rpc.lockd 8
+is running on both client and server.
+See
+.Xr rc.conf 5
+on how to make it start at boot time.
+.It Cm toolchain
+Create the build toolchain needed to build the rest of the system.
+For cross-architecture builds, this step creates a cross-toolchain.
+.It Cm universe
+For each architecture,
+execute a
+.Cm buildworld
+followed by a
+.Cm buildkernel
+for all kernels for that architecture,
+including
+.Pa LINT .
+This command takes a long time.
+.It Cm update
+Get updated sources as configured in
+.Xr make.conf 5 .
+.It Cm targets
+Print a list of supported
+.Va TARGET
+/
+.Va TARGET_ARCH
+pairs for world and kernel targets.
+.It Cm tinderbox
+Execute the same targets as
+.Cm universe .
+In addition print a summary of all failed targets at the end and
+exit with an error if there were any.
+.It Cm toolchains
+Create a build toolchain for each architecture supported by the build system.
+.El
+.Pp
+Kernel specific build targets in
+.Pa /usr/src
+are:
+.Bl -tag -width ".Cm distributekernel"
+.It Cm buildkernel
+Rebuild the kernel and the kernel modules.
+.It Cm installkernel
+Install the kernel and the kernel modules to directory
+.Pa ${DESTDIR}/boot/kernel ,
+renaming any pre-existing directory with this name to
+.Pa kernel.old
+if it contained the currently running kernel.
+The target directory under
+.Pa ${DESTDIR}
+may be modified using the
+.Va INSTKERNNAME
+and
+.Va KODIR
+.Xr make 1
+variables.
+.It Cm distributekernel
+Install the kernel to the directory
+.Pa ${DISTDIR}/kernel/boot/kernel .
+This target is used while building a release; see
+.Xr release 7 .
+.It Cm packagekernel
+Archive the results of
+.Cm distributekernel ,
+placing the results in
+.Va DISTDIR .
+This target is used while building a release; see
+.Xr release 7 .
+.It Cm kernel
+Equivalent to
+.Cm buildkernel
+followed by
+.Cm installkernel
+.It Cm kernel-toolchain
+Rebuild the tools needed for kernel compilation.
+Use this if you did not do a
+.Cm buildworld
+first.
+.It Cm reinstallkernel
+Reinstall the kernel and the kernel modules, overwriting the contents
+of the target directory.
+As with the
+.Cm installkernel
+target, the target directory can be specified using the
+.Xr make 1
+variable
+.Va INSTKERNNAME .
+.El
+.Pp
+Convenience targets for cleaning up the install destination directory
+denoted by variable
+.Va DESTDIR
+include:
+.Bl -tag -width ".Cm delete-old-libs"
+.It Cm check-old
+Print a list of old files and directories in the system.
+.It Cm delete-old
+Delete obsolete base system files and directories interactively.
+When
+.Li -DBATCH_DELETE_OLD_FILES
+is specified at the command line, the delete operation will be
+non-interactive.
+The variables
+.Va DESTDIR ,
+.Va TARGET_ARCH
+and
+.Va TARGET
+should be set as with
+.Dq Li "make installworld" .
+.It Cm delete-old-libs
+Delete obsolete base system libraries interactively.
+This target should only be used if no 3rd party software uses these
+libraries.
+When
+.Li -DBATCH_DELETE_OLD_FILES
+is specified at the command line, the delete operation will be
+non-interactive.
+The variables
+.Va DESTDIR ,
+.Va TARGET_ARCH
+and
+.Va TARGET
+should be set as with
+.Dq Li "make installworld" .
+.El
+.Sh ENVIRONMENT
+Variables that influence all builds include:
+.Bl -tag -width ".Va MAKEOBJDIRPREFIX"
+.It Va DEBUG_FLAGS
+Defines a set of debugging flags that will be used to build all userland
+binaries under
+.Pa /usr/src .
+When
+.Va DEBUG_FLAGS
+is defined, the
+.Cm install
+and
+.Cm installworld
+targets install binaries from the current
+.Va MAKEOBJDIRPREFIX
+without stripping,
+so that debugging information is retained in the installed binaries.
+.It Va DESTDIR
+The directory hierarchy prefix where built objects will be installed.
+If not set,
+.Va DESTDIR
+defaults to the empty string.
+.It Va MAKEOBJDIRPREFIX
+Defines the prefix for directory names in the tree of built objects.
+Defaults to
+.Pa /usr/obj
+if not defined.
+This variable should only be set in the environment and not via
+.Pa /etc/make.conf
+or the command line.
+.It Va NO_WERROR
+If defined, compiler warnings will not cause the build to halt,
+even if the makefile says otherwise.
+.It Va WITH_CTF
+If defined, the build process will run the DTrace CTF conversion
+tools on built objects.
+Please note that this WITH_ option is handled differently than all
+other WITH_ options (there is no
+.Va WITHOUT_CTF ,
+or corresponding
+.Va MK_CTF
+in the build system).
+.El
+.Pp
+Additionally, builds in
+.Pa /usr/src
+are influenced by the following
+.Xr make 1
+variables:
+.Bl -tag -width ".Va SUBDIR_OVERRIDE"
+.It Va KERNCONF
+Overrides which kernel to build and install for the various kernel
+make targets.
+It defaults to
+.Cm GENERIC .
+.It Va KERNFAST
+If set, the build target
+.Cm buildkernel
+defaults to setting
+.Va NO_KERNELCLEAN ,
+.Va NO_KERNELCONFIG ,
+.Va NO_KERNELDEPEND
+and
+.Va NO_KERNELOBJ .
+When set to a value other than
+.Cm 1
+then
+.Va KERNCONF
+is set to the value of
+.Va KERNFAST .
+.It Va LOCAL_DIRS
+If set, this variable supplies a list of additional directories to
+build, relative to the root of the source tree.
+.It Va PORTS_MODULES
+A list of ports with kernel modules that should be built and installed
+as part of the
+.Cm buildkernel
+and
+.Cm installkernel
+process.
+.Bd -literal -offset indent
+make PORTS_MODULES=emulators/kqemu-kmod kernel
+.Ed
+.It Va SUBDIR_OVERRIDE
+Override the default list of sub-directories and only build the
+sub-directory named in this variable.
+This variable is useful when debugging failed builds.
+.Bd -literal -offset indent
+make some-target SUBDIR_OVERRIDE=foo/bar
+.Ed
+.It Va TARGET
+The target hardware platform.
+This is analogous to the
+.Dq Nm uname Fl m
+output.
+This is necessary to cross-build some target architectures.
+For example, cross-building for PC98 machines requires
+.Va TARGET_ARCH Ns = Ns Li i386
+and
+.Va TARGET Ns = Ns Li pc98 .
+If not set,
+.Va TARGET
+defaults to the current hardware platform.
+.It Va TARGET_ARCH
+The target machine processor architecture.
+This is analogous to the
+.Dq Nm uname Fl p
+output.
+Set this to cross-build for a different architecture.
+If not set,
+.Va TARGET_ARCH
+defaults to the current machine architecture, unless
+.Va TARGET
+is also set, in which case it defaults to the appropriate
+value for that platform.
+Typically, one only needs to set
+.Va TARGET .
+.El
+.Pp
+Builds under directory
+.Pa /usr/src
+are also influenced by defining one or more of the following symbols,
+using the
+.Fl D
+option of
+.Xr make 1 :
+.Bl -tag -width ".Va -DNO_KERNELDEPEND"
+.It Va NO_CLEANDIR
+If set, the build targets that clean parts of the object tree use the
+equivalent of
+.Dq make clean
+instead of
+.Dq make cleandir .
+.It Va NO_CLEAN
+If set, no object tree files are cleaned at all.
+Setting
+.Va NO_CLEAN
+implies
+.Va NO_KERNELCLEAN ,
+so when
+.Va NO_CLEAN
+is set no kernel objects are cleaned either.
+.It Va NO_CTF
+If set, the build process does not run the DTrace CTF conversion tools
+on built objects.
+.It Va NO_SHARE
+If set, the build does not descend into the
+.Pa /usr/src/share
+subdirectory (i.e. manpages, locale data files, timezone data files and
+other
+.Pa /usr/src/share
+files will not be rebuild from their sources).
+.It Va NO_KERNELCLEAN
+If set, the build process does not run
+.Dq make clean
+as part of the
+.Cm buildkernel
+target.
+.It Va NO_KERNELCONFIG
+If set, the build process does not run
+.Xr config 8
+as part of the
+.Cm buildkernel
+target.
+.It Va NO_KERNELDEPEND
+If set, the build process does not run
+.Dq make depend
+as part of the
+.Cm buildkernel
+target.
+.It Va NO_KERNELOBJ
+If set, the build process does not run
+.Dq make obj
+as part of the
+.Cm buildkernel
+target.
+.It Va NO_DOCUPDATE
+If set, the update process does not update the source of the
+.Fx
+documentation as part of the
+.Dq make update
+target.
+.It Va NO_PORTSUPDATE
+If set, the update process does not update the Ports tree as part of the
+.Dq make update
+target.
+.It Va NO_WWWUPDATE
+If set, the update process does not update the www tree as part of the
+.Dq make update
+target.
+.El
+.Pp
+Builds under directory
+.Pa /usr/doc
+are influenced by the following
+.Xr make 1
+variables:
+.Bl -tag -width ".Va DOC_LANG"
+.It Va DOC_LANG
+If set, restricts the documentation build to the language subdirectories
+specified as its content.
+The default action is to build documentation for all languages.
+.El
+.Pp
+Builds using the
+.Cm universe
+target are influenced by the following
+.Xr make 1
+variables:
+.Bl -tag -width ".Va MAKE_JUST_KERNELS"
+.It Va JFLAG
+Pass the value of this variable to each
+.Xr make 1
+invocation used to build worlds and kernels.
+This can be used to enable multiple jobs within a single architecture's build
+while still building each architecture serially.
+.It Va MAKE_JUST_KERNELS
+Only build kernels for each supported architecture.
+.It Va MAKE_JUST_WORLDS
+Only build worlds for each supported architecture.
+.It Va UNIVERSE_TARGET
+Execute the specified
+.Xr make 1
+target for each supported architecture instead of the default action of
+building a world and one or more kernels.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/share/examples/etc/make.conf" -compact
+.It Pa /usr/doc/Makefile
+.It Pa /usr/doc/share/mk/doc.project.mk
+.It Pa /usr/ports/Mk/bsd.port.mk
+.It Pa /usr/ports/Mk/bsd.sites.mk
+.It Pa /usr/share/examples/etc/make.conf
+.It Pa /usr/src/Makefile
+.It Pa /usr/src/Makefile.inc1
+.El
+.Sh EXAMPLES
+For an
+.Dq approved
+method of updating your system from the latest sources, please see the
+.Sx COMMON ITEMS
+section in
+.Pa src/UPDATING .
+.Pp
+The following sequence of commands can be used to cross-build the
+system for the sparc64 architecture on an i386 host:
+.Bd -literal -offset indent
+cd /usr/src
+make TARGET=sparc64 buildworld
+make TARGET=sparc64 DESTDIR=/clients/sparc64 installworld
+.Ed
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr install 1 ,
+.Xr make 1 ,
+.Xr make.conf 5 ,
+.Xr src.conf 5 ,
+.Xr ports 7 ,
+.Xr release 7 ,
+.Xr config 8 ,
+.Xr mergemaster 8 ,
+.Xr reboot 8 ,
+.Xr shutdown 8
+.Sh AUTHORS
+.An Mike W. Meyer Aq mwm@mired.org .
diff --git a/share/man/man7/c99.7 b/share/man/man7/c99.7
new file mode 100644
index 000000000000..8c7d5e270d9e
--- /dev/null
+++ b/share/man/man7/c99.7
@@ -0,0 +1,183 @@
+.\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 30, 2011
+.Dt C 7
+.Os
+.Sh NAME
+.Nm c, c78, c89, c90, c99
+.Nd The C programming language
+.Sh DESCRIPTION
+C is a general purpose programming language, which has a strong connection
+with the UNIX operating system and its derivatives, since the vast
+majority of those systems were written in the C language.
+The C language contains some basic ideas from the BCPL language through
+the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines.
+The development of the UNIX operating system was started on a PDP-7
+machine in assembly language, but it made very difficult to port the existing
+code to other systems.
+.Pp
+In 1972 Dennis M. Ritchie worked out the C programming language for
+further development of the UNIX operating system.
+The idea was to implement only the C compiler for different
+platforms, and implement most part of the operating system
+in the new programming language to simplify the portability between
+different architectures.
+It follows that C is very eligible for (but not limited to) writing
+operating systems and low-level applications.
+.Pp
+The C language did not have a specification or standardized version for
+a long time.
+It went through a lot of changes and improvements for ages.
+In 1978, Brian W. Kernighan and Dennis M. Ritchie published the
+first book about C under the title "The C Programming Language".
+We can think of this book as the first specification of the language.
+This version is often referred as K&R C after the names of the authors.
+Sometimes it is referred as C78, as well, after the publishing year of
+the first edition of the book.
+.Pp
+It is important to notice, that the instruction set of the language is
+limited to the most fundamental elements for simplicity.
+Handling of the standard I/O and such common functions are implemented in
+the libraries shipped with the compiler.
+As these functions are also widely used, it was demanded to include into
+the description what requisites the library should conform to, not just
+strictly the language itself.
+Accordingly, the aforementioned standards cover the library elements, as well.
+The elements of this standard library is still not enough for more
+complicated tasks.
+In this case the provided system calls of the given operating system can be
+used.
+To not loose the portability by using these system calls, the POSIX
+(Portable Operating System Interface) standard evolved.
+It describes what functions should be available to keep portability.
+Note, that POSIX is not a C standard, but an operating system standard
+and thus is beyond the scope of this manual.
+The standards discussed below are all C standards and only cover
+the C programming language and the accompanying library.
+.Pp
+After the publication of the book mentioned before,
+the American National Standards Institute (ANSI) started to work on
+standardizing the language, and they announced ANSI X3.159-1989
+in 1989.
+It is usually referred as ANSI C or C89.
+The main difference in this standard were the function prototypes,
+which is a new way of declaring functions.
+With the old-style function declarations, the compiler was unable to
+check the sanity of the actual parameters at a function call.
+The old syntax was highly error-prone because incompatible parameters
+were hard to detect in the program code and the problem only showed up
+at run-time.
+.Pp
+In 1990, the International Organization for Standardization (ISO) adopted
+the ANSI standard as ISO/IEC 9899:1990 in 1990.
+This is also referred as ISO C or C90.
+It only contains negligible minor modifications against ANSI C,
+so the two standards often considered to be fully equivalent.
+This was a very important milestone in the history of the C language, but the
+development of the language did not stop.
+.Pp
+The ISO C standard was later extended with an amendment as
+ISO/IEC 9899 AM1 in 1995.
+This contained, for example, the wide-character support in wchar.h and
+wctype.h.
+Two corregenda were also published: Technical Corrigendum 1 as
+ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR1
+in 1996.
+The continuous development and growth made it necessary to work out a new
+standard, which contains the new features and fixes the known defects and
+deficiencies of the language.
+As a result, ISO/IEC 9899:1999 was born in 1999.
+Similarly to the other standards, this is referred after the
+publication year as C99.
+The improvements include the following:
+.Bl -bullet -offset indent
+.It
+Inline functions
+.It
+Support for variable length arrays
+.It
+New high-precision integer type named long long int, and other integer types
+defined in stdint.h
+.It
+New boolean data type implemented in stdbool.h
+.It
+One line comments taken from the C++ language
+.It
+Some new preprocessor features
+.It
+New variables can be declared anywhere, not just in the beginning of the
+program or program blocks
+.It
+No implicit int type
+.El
+.Pp
+Since then new standards have not been published, but the C language is still
+evolving.
+New and useful features have been showed up in the most famous
+C compiler: GNU C.
+Most of the UNIX-like operating systems use GNU C as a system compiler,
+but those addition in GNU C should not be considered as
+standard features.
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr c89 1 ,
+.Xr c99 1
+.Sh STANDARDS
+.Rs
+.%A ANSI
+.%T X3.159-1989
+.Re
+.Pp
+.Rs
+.%A ISO/IEC
+.%T 9899:1990, Programming languages -- C
+.Re
+.Pp
+.Rs
+.%A ISO/IEC
+.%T 9899 AM1
+.Re
+.Pp
+.Rs
+.%A ISO/IEC
+.%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1
+.Re
+.Pp
+.Rs
+.%A ISO/IEC
+.%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2
+.Re
+.Pp
+.Rs
+.%A ISO/IEC
+.%T 9899:1999, Programming languages -- C
+.Re
+.Sh HISTORY
+This manual page first appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+This manual page was originally written by
+.An Gabor Kovesdan Aq gabor@FreeBSD.org .
diff --git a/share/man/man7/clocks.7 b/share/man/man7/clocks.7
new file mode 100644
index 000000000000..692796842ed4
--- /dev/null
+++ b/share/man/man7/clocks.7
@@ -0,0 +1,178 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd January 18, 2008
+.Dt CLOCKS 7
+.Os
+.Sh NAME
+.Nm clocks
+.Nd various system timers
+.Sh SYNOPSIS
+.In time.h
+.Sh DESCRIPTION
+.Dv HZ
+is not part of the application interface in
+.Bx .
+.Pp
+There are many different real and virtual (timekeeping) clocks with
+different frequencies:
+.Bl -bullet
+.It
+The scheduling clock.
+This is a real clock with frequency that happens to be 100.
+It is not available to applications.
+.It
+The statistics clock.
+This is a real clock with frequency that happens to be 128.
+It is not directly available to applications.
+.It
+The clock reported by
+.Xr clock 3 .
+This is a virtual clock with a frequency that happens to be 128.
+Its actual frequency is given by the macro
+.Dv CLOCKS_PER_SEC .
+Note that
+.Dv CLOCKS_PER_SEC
+may be floating point.
+Do not use
+.Xr clock 3
+in new programs under
+.Fx .
+It is feeble compared with
+.Xr getrusage 2 .
+It is provided for
+.Tn ANSI
+conformance.
+It is implemented by calling
+.Xr getrusage 2
+and throwing away information and resolution.
+.It
+The clock reported by
+.Xr times 3 .
+This is a virtual clock with a frequency that happens to be 128.
+Its actual frequency is given by the macro
+.Dv CLK_TCK
+(deprecated; do not use) and by
+.Fn sysconf _SC_CLK_TCK
+and by
+.Xr sysctl 3 .
+Note that its frequency may be different from
+.Dv CLOCKS_PER_SEC .
+Do not use
+.Xr times 3
+in new programs under
+.Fx .
+It is feeble compared with
+.Xr gettimeofday 2
+together with
+.Xr getrusage 2 .
+It is provided for
+.Tn POSIX
+conformance.
+It is implemented by calling
+.Xr gettimeofday 2
+and
+.Xr getrusage 2
+and throwing away information and resolution.
+.It
+The profiling clock.
+This is a real clock with frequency 1024.
+It is used mainly by
+.Xr moncontrol 3 ,
+.Xr kgmon 8
+and
+.Xr gprof 1 .
+Applications should determine its actual frequency using
+.Xr sysctl 3
+or by reading it from the header in the profiling data file.
+.It
+The mc146818a clock.
+This is a real clock with a nominal frequency of 32768.
+It is divided down to give the statistic clock and the profiling clock.
+It is not available to applications.
+.It
+The microseconds clock.
+This is a virtual clock with frequency 1000000.
+It is used for most timekeeping in
+.Bx
+and is exported to applications in
+.Xr getrusage 2 ,
+.Xr gettimeofday 2 ,
+.Xr select 2 ,
+.Xr getitimer 2 ,
+etc.
+This is the clock that should normally be used by
+.Bx
+applications.
+.It
+The i8254 clock.
+This is a real clock/timer with a nominal frequency of 1193182.
+It has three independent time counters to be used.
+It is divided down to give the scheduling clock.
+It is not available to applications.
+.It
+The TSC clock (64-bit register) on fifth-generation or later x86 systems.
+This is a real clock with a frequency that is equivalent to the number of
+cycles per second of the CPU(s).
+Its frequency can be found using the
+.Va machdep.tsc_freq
+sysctl, if it is available.
+It is used to interpolate between values of the scheduling clock.
+It can be accessed using the
+.Dv PMIOTSTAMP
+request of
+.Xr perfmon 4 .
+.It
+The ACPI clock.
+This is a real clock/timer with a nominal frequency of 3579545.
+It is accessed via a 24 or 32 bit register.
+Unlike the TSC clock, it maintains a constant tick rate even when the CPU
+sleeps or its clock rate changes.
+It is not available to applications.
+.El
+.Pp
+Summary: if
+.Dv HZ
+is not 1000000 then the application is probably using the wrong clock.
+.Sh SEE ALSO
+.Xr gprof 1 ,
+.Xr clock_gettime 2 ,
+.Xr getitimer 2 ,
+.Xr getrusage 2 ,
+.Xr gettimeofday 2 ,
+.Xr select 2 ,
+.Xr clock 3 ,
+.Xr moncontrol 3 ,
+.Xr times 3
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An J\(:org Wunsch
+after a description posted by
+.An Bruce Evans .
diff --git a/share/man/man7/development.7 b/share/man/man7/development.7
new file mode 100644
index 000000000000..af8db3a75d21
--- /dev/null
+++ b/share/man/man7/development.7
@@ -0,0 +1,698 @@
+.\" Copyright (C) 1998 Matthew Dillon. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 21, 2002
+.Dt DEVELOPMENT 7
+.Os
+.Sh NAME
+.Nm development
+.Nd "introduction to development with the FreeBSD codebase"
+.Sh DESCRIPTION
+This manual page describes how an ordinary system operator,
+.Ux
+administrator, or developer
+can, without any special permission, obtain, maintain, and modify the
+.Fx
+codebase as well as how to maintain a master build which can
+then be exported to other machines in your network.
+This manual page
+is targeted to system operators, programmers, and developers.
+.Pp
+Please note that what is being described here is based on a complete
+.Fx
+environment, not just the
+.Fx
+kernel.
+The methods described
+here are as applicable to production installations as it is to development
+environments.
+You need a good 12-17GB of disk space on one machine to make this work
+conveniently.
+.Sh SETTING UP THE ENVIRONMENT ON THE MASTER SERVER
+Your master server should always run a stable, production version of the
+.Fx
+operating system.
+This does not prevent you from doing -CURRENT
+builds or development.
+The last thing you want to do is to run an
+unstable environment on your master server which could lead to a situation
+where you lose the environment and/or cannot recover from a mistake.
+.Pp
+Create a huge partition called
+.Pa /FreeBSD .
+8-12GB is recommended.
+This partition will contain nearly all the development environment,
+including the CVS tree, broken-out source, and possibly even object files.
+You are going to export this partition to your other machines via a
+READ-ONLY NFS export so do not mix it with other more security-sensitive
+partitions.
+.Pp
+You have to make a choice in regards to
+.Pa /usr/obj .
+You can put
+.Pa /usr/obj
+in
+.Pa /FreeBSD
+or you can make
+.Pa /usr/obj
+its own partition.
+I recommend making it a separate partition for several reasons.
+First,
+as a safety measure since this partition is written to a great deal.
+Second, because you typically do not have to back it up.
+Third, because it makes it far easier to mix and match the development
+environments which are described later in this document.
+I recommend a
+.Pa /usr/obj
+partition of at least 5GB.
+.Pp
+On the master server, use
+.Xr cvsup 1 Pq Pa ports/net/cvsup
+to automatically pull down and maintain
+the
+.Fx
+CVS archive once a day.
+The first pull will take a long time,
+it is several gigabytes, but once you have it,
+the daily synchronizations will be quite small.
+.Bd -literal -offset 4n
+mkdir /FreeBSD/FreeBSD-CVS
+rm -rf /home/ncvs
+ln -s /FreeBSD/FreeBSD-CVS /home/ncvs
+.Ed
+.Pp
+The
+.Xr cron 8
+job should look something like this (please randomize the time of
+day!).
+Note that you can use the
+.Xr cvsup 1
+configuration file example directly from
+.Pa /usr/share/examples
+without modification by supplying appropriate arguments
+to
+.Xr cvsup 1 .
+.Bd -literal -offset 4n
+33 6 * * * /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile
+.Ed
+.Pp
+Run the
+.Xr cvsup 1
+manually the first time to pull down the archive.
+It could take
+all day depending on how fast your connection is!
+You will run all
+.Xr cvsup 1
+and
+.Xr cvs 1
+operations as
+.Dq Li root
+and you need to set up a
+.Pa ~/.cvsrc
+.Pq Pa /root/.cvsrc
+file, as shown below, for proper
+.Xr cvs 1
+operation.
+Using
+.Pa ~/.cvsrc
+to specify
+.Xr cvs 1
+defaults is an excellent way to
+.Dq "file and forget" ,
+but you should never forget that you put them in there.
+.Bd -literal -offset 4n
+# cvs -q
+diff -u
+update -Pd
+checkout -P
+.Ed
+.Pp
+Now use
+.Xr cvs 1
+to check out a -STABLE source tree and a -CURRENT source tree,
+as well as ports and docs, to create your initial source environment.
+Keeping the broken-out source and ports in
+.Pa /FreeBSD
+allows you to export
+it to other machines via read-only NFS.
+This also means you only need to edit/maintain files in one place and all
+your clients automatically pick up the changes.
+.Bd -literal -offset 4n
+mkdir /FreeBSD/FreeBSD-4.x
+mkdir /FreeBSD/FreeBSD-current
+
+cd /FreeBSD/FreeBSD-4.x
+cvs -d /home/ncvs checkout -rRELENG_4 src
+
+cd /FreeBSD/FreeBSD-current
+cvs -d /home/ncvs checkout src
+cvs -d /home/ncvs checkout ports
+cvs -d /home/ncvs checkout doc
+.Ed
+.Pp
+Now create a softlink for
+.Pa /usr/src
+and
+.Pa /usr/src2 .
+On the main server I always point
+.Pa /usr/src
+at -STABLE and
+.Pa /usr/src2
+at -CURRENT.
+On client machines I usually do not have a
+.Pa /usr/src2
+and I make
+.Pa /usr/src
+point at whatever version of
+.Fx
+the client box is intended to
+run.
+.Bd -literal -offset 4n
+cd /usr
+rm -rf src src2
+ln -s /FreeBSD/FreeBSD-4.x/src src (could be -CURRENT on a client)
+ln -s /FreeBSD/FreeBSD-current/src src2 (MASTER SERVER ONLY)
+.Ed
+.Pp
+Now you have to make a choice for
+.Pa /usr/obj .
+Well, hopefully you made it already and chose the partition method.
+If you
+chose poorly you probably intend to put it in
+.Pa /FreeBSD
+and, if so, this is
+what you want to do:
+.Bd -literal -offset 4n
+(ONLY IF YOU MADE A POOR CHOICE AND PUT /usr/obj in /FreeBSD!)
+mkdir /FreeBSD/obj
+cd /usr
+rm -rf obj
+ln -s /FreeBSD/obj obj
+.Ed
+.Pp
+Alternatively you may chose simply to leave
+.Pa /usr/obj
+in
+.Pa /usr .
+If your
+.Pa /usr
+is large enough this will work, but I do not recommend it for
+safety reasons
+.Pa ( /usr/obj
+is constantly being modified,
+.Pa /usr
+is not).
+.Pp
+Note that exporting
+.Pa /usr/obj
+via read-only NFS to your other boxes will
+allow you to build on your main server and install from your other boxes.
+If you also want to do builds on some or all of the clients you can simply
+have
+.Pa /usr/obj
+be a local directory on those clients.
+You should never export
+.Pa /usr/obj
+read-write, it will lead to all sorts of
+problems and issues down the line and presents a security problem as well.
+It is far easier to do builds on the master server and then only do installs
+on the clients.
+.Pp
+I usually maintain my ports tree via CVS.
+It is sitting right there in the master CVS archive and I have even told you
+to check it out (see above).
+With some fancy softlinks you can make the ports tree available both on your
+master server and on all of your other machines.
+Note that the ports tree exists only on the HEAD CVS branch, so its always
+-CURRENT even on a -STABLE box.
+This is what you do:
+.Bd -literal -offset 4n
+(THESE COMMANDS ON THE MASTER SERVER AND ON ALL CLIENTS)
+cd /usr
+rm -rf ports
+ln -s /FreeBSD/FreeBSD-current/ports ports
+
+cd /usr/ports (this pushes into the softlink)
+rm -rf distfiles (ON MASTER SERVER ONLY)
+ln -s /usr/ports.distfiles distfiles (ON MASTER SERVER ONLY)
+
+mkdir /usr/ports.distfiles
+mkdir /usr/ports.workdir
+.Ed
+.Pp
+Since
+.Pa /usr/ports
+is softlinked into what will be read-only on all of your
+clients, you have to tell the ports system to use a different working
+directory to hold ports builds.
+You want to add a line to your
+.Xr make.conf 5
+file on the master server
+and on all your clients:
+.Bd -literal -offset 4n
+WRKDIRPREFIX=/usr/ports.workdir
+.Ed
+.Pp
+You should try to make the directory you use for the ports working directory
+as well as the directory used to hold distfiles consistent across all of your
+machines.
+If there is not enough room in
+.Pa /usr/ports.distfiles
+and
+.Pa /usr/ports.workdir
+I usually make those softlinks (since this is on
+.Pa /usr
+these are per-machine) to
+where the distfiles and working space really are.
+.Sh EXPORTING VIA NFS FROM THE MASTER SERVER
+The master server needs to export
+.Pa /FreeBSD
+and
+.Pa /usr/obj
+via NFS so all the
+rest of your machines can get at them.
+I strongly recommend using a read-only export for both security and safety.
+The environment I am describing in this manual page is designed primarily
+around read-only NFS exports.
+Your exports file on the master server should contain the following lines:
+.Bd -literal -offset 4n
+/FreeBSD -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
+/usr/obj -ro -alldirs -maproot=root: -network YOURLAN -mask YOURLANMASK
+.Ed
+.Pp
+Of course, NFS server operations must also be configured on that machine.
+This is typically done via your
+.Pa /etc/rc.conf :
+.Bd -literal -offset 4n
+nfs_server_enable="YES"
+nfs_server_flags="-u -t -n 4"
+.Ed
+.Sh THE CLIENT ENVIRONMENT
+All of your client machines can import the development/build environment
+directory simply by NFS mounting
+.Pa /FreeBSD
+and
+.Pa /usr/obj
+from the master server.
+A typical
+.Pa /etc/fstab
+entry on your client machines will be something like this:
+.Bd -literal -offset 4n
+masterserver:/FreeBSD /FreeBSD nfs ro,bg 0 0
+masterserver:/usr/obj /usr/obj nfs ro,bg 0 0
+.Ed
+.Pp
+And, of course, you should configure the client for NFS client operations
+via
+.Pa /etc/rc.conf .
+In particular, this will turn on
+.Xr nfsiod 8
+which will improve client-side NFS
+performance:
+.Bd -literal -offset 4n
+nfs_client_enable="YES"
+.Ed
+.Pp
+Each client should create softlinks for
+.Pa /usr/ports
+and
+.Pa /usr/src
+that point
+into the NFS-mounted environment.
+If a particular client is running -CURRENT,
+.Pa /usr/src
+should be a softlink to
+.Pa /FreeBSD/FreeBSD-current/src .
+If it is running -STABLE,
+.Pa /usr/src
+should be a softlink to
+.Pa /FreeBSD/FreeBSD-4.x/src .
+I do not usually create a
+.Pa /usr/src2
+softlink on
+clients, that is used as a convenient shortcut when working on the source
+code on the master server only and could create massive confusion (of the
+human variety) on a client.
+.Bd -literal -offset 4n
+(ON EACH CLIENT)
+cd /usr
+rm -rf ports src
+ln -s /FreeBSD/FreeBSD-current/ports ports
+ln -s /FreeBSD/FreeBSD-XXX/src src
+.Ed
+.Pp
+Do not forget to create the working directories so you can build ports, as
+previously described.
+If these are not good locations, make them softlinks to the correct location.
+Remember that
+.Pa /usr/ports/distfiles
+is exported by
+the master server and is therefore going to point to the same place
+(typically
+.Pa /usr/ports.distfiles )
+on every machine.
+.Bd -literal -offset 4n
+mkdir /usr/ports.distfiles
+mkdir /usr/ports.workdir
+.Ed
+.Sh BUILDING KERNELS
+Here is how you build a -STABLE kernel (on your main development box).
+If you want to create a custom kernel, copy
+.Pa GENERIC
+to
+.Pa KERNELNAME
+and then edit it before configuring and building.
+The kernel configuration file lives in
+.Pa /usr/src/sys/i386/conf/KERNELNAME .
+.Bd -literal -offset 4n
+cd /usr/src
+make buildkernel KERNCONF=KERNELNAME
+.Ed
+.Pp
+.Sy WARNING!
+If you are familiar with the old config/cd/make method of building
+a -STABLE kernel, note that the
+.Xr config 8
+method will put the build environment in
+.Pa /usr/src/sys/i386/compile/KERNELNAME
+instead of in
+.Pa /usr/obj .
+.Pp
+Building a -CURRENT kernel
+.Bd -literal -offset 4n
+cd /usr/src2 (on the master server)
+make buildkernel KERNCONF=KERNELNAME
+.Ed
+.Sh INSTALLING KERNELS
+Installing a -STABLE kernel (typically done on a client,
+only do this on your main development server if you want to install a new
+kernel for your main development server):
+.Bd -literal -offset 4n
+cd /usr/src
+make installkernel KERNCONF=KERNELNAME
+.Ed
+.Pp
+If you are using the older config/cd/make build mechanism for -STABLE, you
+would install using:
+.Bd -literal -offset 4n
+cd /usr/src/sys/i386/compile/KERNELNAME
+make install
+.Ed
+.Pp
+Installing a -CURRENT kernel (typically done only on a client)
+.Bd -literal -offset 4n
+(remember /usr/src is pointing to the client's specific environment)
+cd /usr/src
+make installkernel KERNCONF=KERNELNAME
+.Ed
+.Sh BUILDING THE WORLD
+This environment is designed such that you do all builds on the master server,
+and then install from each client.
+You can do builds on a client only if
+.Pa /usr/obj
+is local to that client.
+Building the world is easy:
+.Bd -literal -offset 4n
+cd /usr/src
+make buildworld
+.Ed
+.Pp
+If you are on the master server you are running in a -STABLE environment, but
+that does not prevent you from building the -CURRENT world.
+Just
+.Xr cd 1
+into the appropriate source directory and you are set.
+Do not
+accidentally install it on your master server though!
+.Bd -literal -offset 4n
+cd /usr/src2
+make buildworld
+.Ed
+.Sh INSTALLING THE WORLD
+You can build on your main development server and install on clients.
+The main development server must export
+.Pa /FreeBSD
+and
+.Pa /usr/obj
+via read-only NFS to the clients.
+.Pp
+.Em NOTE!!!
+If
+.Pa /usr/obj
+is a softlink on the master server, it must also be the EXACT
+SAME softlink on each client.
+If
+.Pa /usr/obj
+is a directory in
+.Pa /usr
+or a mount point on the master server,
+then it must be (interchangeably) a directory in
+.Pa /usr
+or a mount point on
+each client.
+This is because the
+absolute paths are expected to be the same when building the world as when
+installing it, and you generally build it on your main development box
+and install it from a client.
+If you do not set up
+.Pa /usr/obj
+properly you will not be able to build on
+machine and install on another.
+.Bd -literal -offset 4n
+(ON THE CLIENT)
+(remember /usr/src is pointing to the client's specific environment)
+cd /usr/src
+make installworld
+.Ed
+.Pp
+.Sy WARNING!
+If builds work on the master server but installs do not work from the
+clients, for example you try to install and the client complains that
+the install tried to write into the read-only
+.Pa /usr/obj ,
+then it is likely
+that the
+.Xr make.conf 5
+file on the client does not match the one on the
+master server closely enough and the install is trying to install something
+that was not built.
+.Sh DOING DEVELOPMENT ON A CLIENT (NOT JUST INSTALLING)
+Developers often want to run buildkernel's or buildworld's on client
+boxes simply to life-test the box.
+You do this in the same manner that you buildkernel and buildworld on your
+master server.
+All you have to do is make sure that
+.Pa /usr/obj
+is pointing to local storage.
+If you followed my advise and made
+.Pa /usr/obj
+its own partition on the master
+server,
+then it is typically going to be an NFS mount on the client.
+Simply unmounting
+.Pa /usr/obj
+will leave you with a
+.Pa /usr/obj
+that is a
+subdirectory in
+.Pa /usr
+which is typically local to the client.
+You can then do builds to your heart's content!
+.Sh MAINTAINING A LOCAL BRANCH
+I have described how to maintain two versions of the source tree, a stable
+version in
+.Pa /FreeBSD/FreeBSD-4.x
+and a current version in
+.Pa /FreeBSD/FreeBSD-current .
+There is absolutely nothing preventing you
+from breaking out other versions of the source tree
+into
+.Pa /FreeBSD/XXX .
+In fact, my
+.Pa /FreeBSD
+partition also contains
+.Ox ,
+.Nx ,
+and various flavors of
+.Tn Linux .
+You may not necessarily be able to build
+.Pf non- Fx
+operating systems on
+your master server, but being able
+to collect and manage source distributions from a central server is a very
+useful thing to be able to do and you can certainly export to machines
+which can build those other operating systems.
+.Pp
+Many developers choose to maintain a local branch of
+.Fx
+to test patches or build a custom distribution.
+This can be done with CVS or another source code management system
+(SubVersion, Perforce, BitKeeper) with its own repository.
+Since the main
+.Fx
+tree is based on CVS, the former is convenient.
+.Pp
+First, you need to modify your
+.Xr cvsup 1
+environment to avoid it modifying
+the local changes you have committed to the repository.
+It is important to remove the
+.Ic delete
+keyword from your
+.Pa supfile
+and to add the
+.Pa CVSROOT
+subdirectory to your
+.Pa refuse
+file.
+For more information, see
+.Xr cvsup 1 .
+.Pp
+The
+.Fx
+version of
+.Xr cvs 1
+examines a custom environmental variable,
+.Ev CVS_LOCAL_BRANCH_NUM ,
+which specifies an integer to use when doing a
+.Xr cvs 1
+.Cm tag Ns / Ns Cm rtag .
+Set this number to something high (say 1000) to avoid colliding
+with potential future branches of the main repository.
+For example,
+branching a file with version 1.4 produces 1.4.1000.
+Future commits to this branch will produce revisions 1.4.1000.1,
+1.4.1000.2, etc.
+.Pp
+To fork your local branch, do:
+.Bd -literal -offset 4n
+cvs rtag -r RELENG_4 -b LOCAL_RELENG_4 src
+.Ed
+.Pp
+After this, you can check out a copy from your local repository using the
+new tag and begin making changes and committing them.
+For more information on using CVS, see
+.Xr cvs 1 .
+.Pp
+.Sy WARNING!
+The
+.Xr cvsup 1
+utility may blow away changes made on a local branch in
+some situations.
+This has been reported to occur when the master CVS repository is
+directly manipulated or an RCS file is changed.
+At this point,
+.Xr cvsup 1
+notices that the client and server have entirely
+different RCS files, so it does a full replace instead of trying to
+send just deltas.
+Ideally this situation should never arise, but in the real world it
+happens all the time.
+.Pp
+While this is the only scenario where the problem should crop up,
+there have been some suspicious-sounding reports of
+.Ev CVS_LOCAL_BRANCH_NUM
+lossage that cannot be explained by this alone.
+Bottom line is, if you value your local branch then you
+should back it up before every update.
+.Sh UPDATING VIA CVS
+The advantage of using
+.Xr cvsup 1
+to maintain an updated copy of the CVS
+repository instead of using it to maintain source trees directly is that you
+can then pick and choose when you bring your source tree (or pieces of your
+source tree) up to date.
+By using a
+.Xr cron 8
+job to maintain an updated CVS repository, you can update
+your source tree at any time without any network cost as follows:
+.Bd -literal -offset 4n
+(on the main development server)
+cd /usr/src
+cvs -d /home/ncvs update
+cd /usr/src2
+cvs -d /home/ncvs update
+cd /usr/ports
+cvs -d /home/ncvs update
+.Ed
+.Pp
+It is that simple, and since you are exporting the whole lot to your
+clients, your clients have immediate visibility into the updated
+source.
+This is a good time to also remind you that most of the
+.Xr cvs 1
+operations you do will be done as
+.Dq Li root ,
+and that certain options are
+required for CVS to operate properly on the
+.Fx
+repository.
+For example,
+.Fl Pd
+is necessary when running
+.Nm cvs Cm update .
+These options are typically placed in your
+.Pa ~/.cvsrc
+(as already described)
+so you do not have to re-specify them every time you run a
+.Xr cvs 1
+command.
+Maintaining the CVS repository also gives you far more flexibility
+in regards to breaking out multiple versions of the source tree.
+It is a good idea to give your
+.Pa /FreeBSD
+partition a lot of space (I recommend
+8-12GB) precisely for that reason.
+If you can make it 15GB I would do it.
+.Pp
+I generally do not
+.Nm cvs Cm update
+via a
+.Xr cron 8
+job.
+This is because I generally want the source to not change out from under me
+when I am developing code.
+Instead I manually update the source every so often...\& when I feel it is
+a good time.
+My recommendation is to only keep the CVS repository synchronized via
+.Xr cron 8 .
+.Sh SEE ALSO
+.Xr crontab 1 ,
+.Xr crontab 5 ,
+.Xr make.conf 5 ,
+.Xr build 7 ,
+.Xr firewall 7 ,
+.Xr release 7 ,
+.Xr tuning 7 ,
+.Xr diskless 8
+.Sh HISTORY
+The
+.Nm
+manual page was originally written by
+.An Matthew Dillon Aq dillon@FreeBSD.org
+and first appeared
+in
+.Fx 5.0 ,
+December 2002.
diff --git a/share/man/man7/environ.7 b/share/man/man7/environ.7
new file mode 100644
index 000000000000..51f9a4e18e06
--- /dev/null
+++ b/share/man/man7/environ.7
@@ -0,0 +1,271 @@
+.\" Copyright (c) 1983, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)environ.7 8.3 (Berkeley) 4/19/94
+.\" $FreeBSD$
+.\"
+.Dd April 12, 2003
+.Dt ENVIRON 7
+.Os
+.Sh NAME
+.Nm environ
+.Nd user environment
+.Sh SYNOPSIS
+.Ar extern char **environ ;
+.Sh DESCRIPTION
+An array of strings called the
+.Ar environment
+is made available by
+.Xr execve 2
+when a process begins.
+By convention these strings have the form
+.Dq Ar name=value .
+The following names are used by various commands:
+.Bl -tag -width LC_MONETARY
+.It Ev BLOCKSIZE
+The size of the block units used by several commands, most notably
+.Xr df 1 ,
+.Xr du 1
+and
+.Xr ls 1 .
+.Ev BLOCKSIZE
+may be specified in units of a byte by specifying a number,
+in units of a kilobyte by specifying a number followed by ``K'' or
+``k'', in units of a megabyte by specifying a number followed by ``M''
+or ``m'' and in units of a gigabyte by specifying a number followed
+by ``G'' or ``g''.
+Sizes less than 512 bytes or greater than a gigabyte are ignored.
+.It Ev COLUMNS
+The user's preferred width in column positions for the terminal.
+Utilities such as
+.Xr ls 1
+and
+.Xr who 1
+use this to format output into columns.
+If unset or empty, utilities will use an
+.Xr ioctl 2
+call to ask the terminal driver for the width.
+.It Ev EDITOR
+Default editor name.
+.It Ev EXINIT
+A startup list of commands read by
+.Xr ex 1
+and
+.Xr vi 1 .
+.It Ev HOME
+A user's login directory, set by
+.Xr login 1
+from the password file
+.Xr passwd 5 .
+.It Ev LANG
+This variable configures all programs which use
+.Xr setlocale 3
+to use the specified locale unless the
+.Ev LC_*
+variables are set.
+.It Ev LC_ALL
+Overrides the values of
+.Ev LC_COLLATE ,
+.Ev LC_CTYPE ,
+.Ev LC_MESSAGES ,
+.Ev LC_MONETARY ,
+.Ev LC_NUMERIC ,
+.Ev LC_TIME
+and
+.Ev LANG .
+.It Ev LC_COLLATE
+Locale to be used for ordering of strings.
+.It Ev LC_CTYPE
+Locale to be used for character classification
+(letter, space, digit, etc.) and for interpreting byte sequences as
+multibyte characters.
+.It Ev LC_MESSAGES
+Locale to be used for diagnostic messages.
+.It Ev LC_MONETARY
+Locale to be used for interpreting monetary input
+and formatting output.
+.It Ev LC_NUMERIC
+Locale to be used for interpreting numeric input and
+formatting output.
+.It Ev LC_TIME
+Locale to be used for interpreting dates input and
+for formatting output.
+.It Ev MAIL
+The location of the user's
+mailbox instead of the default in /var/mail,
+used by
+.Xr mail 1 ,
+.Xr sh 1 ,
+and many other mail clients.
+.It Ev NLSPATH
+List of directories to be searched for the message catalog referred to by
+.Ev LC_MESSAGES .
+See
+.Xr catopen 3 .
+.It Ev PAGER
+Default paginator program.
+The program specified by this variable is used by
+.Xr mail 1 ,
+.Xr man 1 ,
+.Xr ftp 1 ,
+etc, to display information which is longer than the current display.
+.It Ev PATH
+The sequence of directories, separated by colons, searched by
+.Xr csh 1 ,
+.Xr sh 1 ,
+.Xr system 3 ,
+.Xr execvp 3 ,
+etc, when looking for an executable file.
+.Ev PATH
+is set to ``/usr/bin:/bin'' initially by
+.Xr login 1 .
+.It Ev PRINTER
+The name of the default printer to be used by
+.Xr lpr 1 ,
+.Xr lpq 1 ,
+and
+.Xr lprm 1 .
+.It Ev PWD
+The current directory pathname.
+.It Ev SHELL
+The full pathname of the user's login shell.
+.It Ev TERM
+The kind of terminal for which output is to be prepared.
+This information is used by commands, such as
+.Xr nroff 1
+or
+.Xr plot 1
+which may exploit special terminal capabilities.
+See
+.Pa /usr/share/misc/termcap
+.Pq Xr termcap 5
+for a list of terminal types.
+.It Ev TERMCAP
+The string describing the terminal in
+.Ev TERM ,
+or, if
+it begins with a '/', the name of the termcap file.
+See
+.Ev TERMPATH
+below, and
+.Xr termcap 5 .
+.It Ev TERMPATH
+A sequence of pathnames of termcap files, separated by colons or spaces,
+which are searched for terminal descriptions in the order listed.
+Having
+no
+.Ev TERMPATH
+is equivalent to a
+.Ev TERMPATH
+of
+.Dq Pa $HOME/.termcap:/etc/termcap .
+.Ev TERMPATH
+is ignored if
+.Ev TERMCAP
+contains a full pathname.
+.It Ev TMPDIR
+The directory in which to store temporary files.
+Most applications use either
+.Dq /tmp
+or
+.Dq /var/tmp .
+Setting this variable will make them use another directory.
+.It Ev TZ
+The timezone to use when displaying dates.
+The normal format is a pathname relative to
+.Dq Pa /usr/share/zoneinfo .
+For example, the command
+.Dq env TZ=America/Los_Angeles date
+displays the current time in California.
+See
+.Xr tzset 3
+for more information.
+.It Ev USER
+The login name of the user.
+.El
+.Pp
+Further names may be placed in the environment by the
+.Ic export
+command and
+.Ar name=value
+arguments in
+.Xr sh 1 ,
+or by the
+.Ic setenv
+command if you use
+.Xr csh 1 .
+It is unwise to change certain
+.Xr sh 1
+variables that are frequently exported by
+.Pa .profile
+files, such as
+.Ev MAIL ,
+.Ev PS1 ,
+.Ev PS2 ,
+and
+.Ev IFS ,
+unless you know what you are doing.
+.Pp
+The current environment variables can be printed with
+.Xr env 1 ,
+.Xr set 1
+or
+.Xr printenv 1
+in
+.Xr sh 1
+and
+.Xr env 1 ,
+.Xr printenv 1
+or the
+.Cm printenv
+built-in command in
+.Xr csh 1 .
+.Sh SEE ALSO
+.Xr cd 1 ,
+.Xr csh 1 ,
+.Xr env 1 ,
+.Xr ex 1 ,
+.Xr login 1 ,
+.Xr printenv 1 ,
+.Xr sh 1 ,
+.Xr execve 2 ,
+.Xr execle 3 ,
+.Xr getenv 3 ,
+.Xr setenv 3 ,
+.Xr setlocale 3 ,
+.Xr system 3 ,
+.Xr termcap 3 ,
+.Xr termcap 5
+.Sh HISTORY
+The
+.Nm
+manual page appeared in
+.Bx 4.2 .
diff --git a/share/man/man7/ffs.7 b/share/man/man7/ffs.7
new file mode 100644
index 000000000000..fc8c61a3ad24
--- /dev/null
+++ b/share/man/man7/ffs.7
@@ -0,0 +1,226 @@
+.\" Copyright (c) 2001 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris
+.\" Costello at Safeport Network Services and NAI Labs, the Security
+.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR
+.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+.\" research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 26, 2001
+.Dt FFS 7
+.Os
+.Sh NAME
+.Nm ffs
+.Nd Berkeley fast file system
+.Sh SYNOPSIS
+In the kernel configuration file:
+.Cd "options FFS"
+.Cd "options QUOTA"
+.Cd "options SOFTUPDATES"
+.Cd "options SUIDDIR"
+.Cd "options UFS_ACL"
+.Cd "options UFS_DIRHASH"
+.Cd "options UFS_EXTATTR"
+.Cd "options UFS_EXTATTR_AUTOSTART"
+.Pp
+In
+.Xr fstab 5 :
+.Bd -literal -compact
+/dev/disk0a /mnt ufs rw 1 1
+.Ed
+.Sh DESCRIPTION
+The Berkeley fast file system
+provides facilities to store file system data onto a disk device.
+.Nm
+has been optimized over the years
+for speed and reliability
+and is the default
+.Fx
+file system.
+.Ss Quotas
+.Bl -tag -width 2n
+.It Cd "options QUOTA"
+This option allows system administrators
+to set limits on disk usage
+on a per-user basis.
+Quotas can be used only on file systems
+mounted with the
+.Cm quota
+option;
+see
+.Xr quota 1
+and
+.Xr edquota 8 .
+.El
+.Ss Soft Updates
+.Bl -tag -width 2n
+.It Cd "options SOFTUPDATES"
+The soft updates feature tracks writes to the disk
+and enforces metadata update dependencies
+(e.g., updating free block maps)
+to ensure that the file system remains consistent.
+.Pp
+To enable soft updates on an
+.Em unmounted
+file system, use the following command:
+.Pp
+.D1 Nm tunefs Fl n Cm enable Ar fs
+.Pp
+.Ar fs
+can be either a mount point listed in
+.Xr fstab 5
+(e.g.,
+.Pa /usr ) ,
+or a disk device
+(e.g.,
+.Pa /dev/da0a ) .
+.El
+.Ss File Ownership Inheritance
+.Bl -tag -width 2n
+.It Cd "options SUIDDIR"
+For use in file sharing environments
+on networks including
+.Tn "Microsoft Windows"
+and
+.Tn "Apple Macintosh"
+computers,
+this option allows files on file systems
+mounted with the
+.Cm suiddir
+option
+to inherit the ownership of its directory,
+i.e.,
+.Dq "if it's my directory, it must be my file."
+.El
+.Ss Access Control Lists
+.Bl -tag -width 2n
+.It Cd "options UFS_ACL"
+Access control lists allow the association of
+fine-grained discretionary access control information
+with files and directories.
+This option requires the presence of the
+.Dv UFS_EXTATTR
+option, and it is recommended that
+.Dv UFS_EXTATTR_AUTOSTART
+is included as well,
+so that ACLs are enabled atomically upon mounting the file system.
+.El
+.Pp
+In order to enable support for ACLs,
+two extended attributes must be available in the
+.Dv EXTATTR_NAMESPACE_SYSTEM
+namespace:
+.Pa posix1e.acl_access ,
+which holds the access ACL,
+and
+.Pa posix1e.acl_default ,
+which holds the default ACL for directories.
+If you are using file system extended attributes,
+the following commands may be used to
+allocate space for and create the necessary EA backing files
+for ACLs in the root of each file system.
+In these examples, the root file system is used;
+see
+.Sx "Extended Attributes"
+for more details.
+.Bd -literal -offset indent
+mkdir -p /.attribute/system
+cd /.attribute/system
+extattrctl initattr -p / 388 posix1e.acl_access
+extattrctl initattr -p / 388 posix1e.acl_default
+.Ed
+.Pp
+On the next mount of the root file system,
+the attributes will be automatically started
+(if
+.Dv UFS_EXTATTR_AUTOSTART
+is included in the kernel configuration),
+and ACLs will be enabled.
+.Ss Directory Hashing
+.Bl -tag -width 2n
+.It Cd "options UFS_DIRHASH"
+Implements a hash-based lookup scheme for directories
+in order to speed up accesses to very large directories.
+.El
+.Ss Extended Attributes
+.Bl -tag -width 2n
+.It Cd "options UFS_EXTATTR"
+Extended attributes allow the association of
+additional arbitrary metadata with files and directories,
+which can be assigned and retrieved from userland
+as well as from within the kernel; see
+.Xr extattrctl 8 .
+.It Cd "options UFS_EXTATTR_AUTOSTART"
+If this option is defined,
+.Nm
+will search for a
+.Pa .attribute
+subdirectory of the file system root during the mount operation.
+If found, extended attribute support will be
+automatically started for that file system.
+.El
+.Pp
+The following
+.Xr sysctl 8
+MIBs are defined for use with
+.Nm :
+.Bl -hang -width ".Va vfs.ffs.doreallocblk"
+.It Va vfs.ffs.doasyncfree
+Asynchronously write out modified i-node and indirect blocks
+upon reallocating file system blocks to be contiguous.
+(Default: 1.)
+.It Va vfs.ffs.doreallocblks
+Enable support for the rearrangement of blocks
+to be contiguous.
+(Default: 1.)
+.El
+.Sh SEE ALSO
+.Xr quota 1 ,
+.Xr acl 3 ,
+.Xr extattr 3 ,
+.Xr edquota 8 ,
+.Xr extattrctl 8 ,
+.Xr sysctl 8
+.Rs
+.%A M. McKusick
+.%A W. Joy
+.%A S. Leffler
+.%A R. Fabry
+.%D August 1984
+.%T "A Fast File System for UNIX"
+.%J "ACM Transactions on Computer Systems"
+.%N 2
+.%V 3
+.%P 181-197
+.Re
+.Rs
+.%A M. McKusick
+.%D June 2000
+.%T "Soft Updates: A Technique for Eliminating Most Synchronous Writes in the Fast Filesystem"
+.%J "Proceedings of the Freenix Track at the 1999 Usenix Annual Technical Conference"
+.%P 71-84
+.Re
diff --git a/share/man/man7/firewall.7 b/share/man/man7/firewall.7
new file mode 100644
index 000000000000..20108d22e96d
--- /dev/null
+++ b/share/man/man7/firewall.7
@@ -0,0 +1,442 @@
+.\" Copyright (C) 2001 Matthew Dillon. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 26, 2001
+.Dt FIREWALL 7
+.Os
+.Sh NAME
+.Nm firewall
+.Nd simple firewalls under FreeBSD
+.Sh FIREWALL BASICS
+A Firewall is most commonly used to protect an internal network
+from an outside network by preventing the outside network from
+making arbitrary connections into the internal network.
+Firewalls
+are also used to prevent outside entities from spoofing internal
+IP addresses and to isolate services such as NFS or SMBFS (Windows
+file sharing) within LAN segments.
+.Pp
+The
+.Fx
+firewalling system also has the capability to limit bandwidth using
+.Xr dummynet 4 .
+This feature can be useful when you need to guarantee a certain
+amount of bandwidth for a critical purpose.
+For example, if you
+are doing video conferencing over the Internet via your
+office T1 (1.5 MBits/s), you may wish to bandwidth-limit all other
+T1 traffic to 1 MBit/s in order to reserve at least 0.5 MBits
+for your video conferencing connections.
+Similarly if you are
+running a popular web or ftp site from a colocation facility
+you might want to limit bandwidth to prevent excessive bandwidth
+charges from your provider.
+.Pp
+Finally,
+.Fx
+firewalls may be used to divert packets or change the next-hop
+address for packets to help route them to the correct destination.
+Packet diversion is most often used to support NAT (network
+address translation), which allows an internal network using
+a private IP space to make connections to the outside for browsing
+or other purposes.
+.Pp
+Constructing a firewall may appear to be trivial, but most people
+get them wrong.
+The most common mistake is to create an exclusive
+firewall rather than an inclusive firewall.
+An exclusive firewall
+allows all packets through except for those matching a set of rules.
+An inclusive firewall allows only packets matching the ruleset
+through.
+Inclusive firewalls are much, much safer than exclusive
+firewalls but a tad more difficult to build properly.
+The
+second most common mistake is to blackhole everything except the
+particular port you want to let through.
+TCP/IP needs to be able
+to get certain types of ICMP errors to function properly - for
+example, to implement MTU discovery.
+Also, a number of common
+system daemons make reverse connections to the
+.Sy auth
+service in an attempt to authenticate the user making a connection.
+Auth is rather dangerous but the proper implementation is to return
+a TCP reset for the connection attempt rather than simply blackholing
+the packet.
+We cover these and other quirks involved with constructing
+a firewall in the sample firewall section below.
+.Sh IPFW KERNEL CONFIGURATION
+You do not need to create a custom kernel to use the IP firewalling features.
+If you enable firewalling in your
+.Em /etc/rc.conf
+(see below), the ipfw kernel module will be loaded automatically
+when necessary.
+However,
+if you are paranoid you can compile IPFW directly into the
+.Fx
+kernel by using the
+.Sy IPFIREWALL
+option set.
+If compiled in the kernel, ipfw denies all
+packets by default, which means that, if you do not load in
+a permissive ruleset via
+.Em /etc/rc.conf ,
+rebooting into your new kernel will take the network offline.
+This can prevent you from being able to access your system if you
+are not sitting at the console.
+It is also quite common to
+update a kernel to a new release and reboot before updating
+the binaries.
+This can result in an incompatibility between
+the
+.Xr ipfw 8
+program and the kernel which prevents it from running in the
+boot sequence, also resulting in an inaccessible machine.
+Because of these problems the
+.Sy IPFIREWALL_DEFAULT_TO_ACCEPT
+kernel option is also available which changes the default firewall
+to pass through all packets.
+Note, however, that using this option
+may open a small window of opportunity during booting where your
+firewall passes all packets.
+Still, it is a good option to use
+while getting up to speed with
+.Fx
+firewalling.
+Get rid of it once you understand how it all works
+to close the loophole, though.
+There is a third option called
+.Sy IPDIVERT
+which allows you to use the firewall to divert packets to a user program
+and is necessary if you wish to use
+.Xr natd 8
+to give private internal networks access to the outside world.
+If you want to be able to limit the bandwidth used by certain types of
+traffic, the
+.Sy DUMMYNET
+option must be used to enable
+.Em ipfw pipe
+rules.
+.Sh SAMPLE IPFW-BASED FIREWALL
+Here is an example ipfw-based firewall taken from a machine with three
+interface cards.
+fxp0 is connected to the 'exposed' LAN.
+Machines
+on this LAN are dual-homed with both internal 10.\& IP addresses and
+Internet-routed IP addresses.
+In our example, 192.100.5.x represents
+the Internet-routed IP block while 10.x.x.x represents the internal
+networks.
+While it is not relevant to the example, 10.0.1.x is
+assigned as the internal address block for the LAN on fxp0, 10.0.2.x
+for the LAN on fxp1, and 10.0.3.x for the LAN on fxp2.
+.Pp
+In this example we want to isolate all three LANs from the Internet
+as well as isolate them from each other, and we want to give all
+internal addresses access to the Internet through a NAT gateway running
+on this machine.
+To make the NAT gateway work, the firewall machine
+is given two Internet-exposed addresses on fxp0 in addition to an
+internal 10.\& address on fxp0: one exposed address (not shown)
+represents the machine's official address, and the second exposed
+address (192.100.5.5 in our example) represents the NAT gateway
+rendezvous IP.
+We make the example more complex by giving the machines
+on the exposed LAN internal 10.0.0.x addresses as well as exposed
+addresses.
+The idea here is that you can bind internal services
+to internal addresses even on exposed machines and still protect
+those services from the Internet.
+The only services you run on
+exposed IP addresses would be the ones you wish to expose to the
+Internet.
+.Pp
+It is important to note that the 10.0.0.x network in our example
+is not protected by our firewall.
+You must make sure that your
+Internet router protects this network from outside spoofing.
+Also, in our example, we pretty much give the exposed hosts free
+reign on our internal network when operating services through
+internal IP addresses (10.0.0.x).
+This is somewhat of security
+risk: what if an exposed host is compromised?
+To remove the
+risk and force everything coming in via LAN0 to go through
+the firewall, remove rules 01010 and 01011.
+.Pp
+Finally, note that the use of internal addresses represents a
+big piece of our firewall protection mechanism.
+With proper
+spoofing safeguards in place, nothing outside can directly
+access an internal (LAN1 or LAN2) host.
+.Bd -literal
+# /etc/rc.conf
+#
+firewall_enable="YES"
+firewall_type="/etc/ipfw.conf"
+
+# temporary port binding range let
+# through the firewall.
+#
+# NOTE: heavily loaded services running through the firewall may require
+# a larger port range for local-size binding. 4000-10000 or 4000-30000
+# might be a better choice.
+ip_portrange_first=4000
+ip_portrange_last=5000
+\&...
+.Ed
+.Bd -literal
+# /etc/ipfw.conf
+#
+# FIREWALL: the firewall machine / nat gateway
+# LAN0 10.0.0.X and 192.100.5.X (dual homed)
+# LAN1 10.0.1.X
+# LAN2 10.0.2.X
+# sw: ethernet switch (unmanaged)
+#
+# 192.100.5.x represents IP addresses exposed to the Internet
+# (i.e. Internet routeable). 10.x.x.x represent internal IPs
+# (not exposed)
+#
+# [LAN1]
+# ^
+# |
+# FIREWALL -->[LAN2]
+# |
+# [LAN0]
+# |
+# +--> exposed host A
+# +--> exposed host B
+# +--> exposed host C
+# |
+# INTERNET (secondary firewall)
+# ROUTER
+# |
+# [Internet]
+#
+# NOT SHOWN: The INTERNET ROUTER must contain rules to disallow
+# all packets with source IP addresses in the 10. block in order
+# to protect the dual-homed 10.0.0.x block. Exposed hosts are
+# not otherwise protected in this example - they should only bind
+# exposed services to exposed IPs but can safely bind internal
+# services to internal IPs.
+#
+# The NAT gateway works by taking packets sent from internal
+# IP addresses to external IP addresses and routing them to natd, which
+# is listening on port 8668. This is handled by rule 00300. Data coming
+# back to natd from the outside world must also be routed to natd using
+# rule 00301. To make the example interesting, we note that we do
+# NOT have to run internal requests to exposed hosts through natd
+# (rule 00290) because those exposed hosts know about our
+# 10. network. This can reduce the load on natd. Also note that we
+# of course do not have to route internal<->internal traffic through
+# natd since those hosts know how to route our 10. internal network.
+# The natd command we run from /etc/rc.local is shown below. See
+# also the in-kernel version of natd, ipnat.
+#
+# natd -s -u -a 208.161.114.67
+#
+#
+add 00290 skipto 1000 ip from 10.0.0.0/8 to 192.100.5.0/24
+add 00300 divert 8668 ip from 10.0.0.0/8 to not 10.0.0.0/8
+add 00301 divert 8668 ip from not 10.0.0.0/8 to 192.100.5.5
+
+# Short cut the rules to avoid running high bandwidths through
+# the entire rule set. Allow established tcp connections through,
+# and shortcut all outgoing packets under the assumption that
+# we need only firewall incoming packets.
+#
+# Allowing established tcp connections through creates a small
+# hole but may be necessary to avoid overloading your firewall.
+# If you are worried, you can move the rule to after the spoof
+# checks.
+#
+add 01000 allow tcp from any to any established
+add 01001 allow all from any to any out via fxp0
+add 01001 allow all from any to any out via fxp1
+add 01001 allow all from any to any out via fxp2
+
+# Spoof protection. This depends on how well you trust your
+# internal networks. Packets received via fxp1 MUST come from
+# 10.0.1.x. Packets received via fxp2 MUST come from 10.0.2.x.
+# Packets received via fxp0 cannot come from the LAN1 or LAN2
+# blocks. We cannot protect 10.0.0.x here, the Internet router
+# must do that for us.
+#
+add 01500 deny all from not 10.0.1.0/24 in via fxp1
+add 01500 deny all from not 10.0.2.0/24 in via fxp2
+add 01501 deny all from 10.0.1.0/24 in via fxp0
+add 01501 deny all from 10.0.2.0/24 in via fxp0
+
+# In this example rule set there are no restrictions between
+# internal hosts, even those on the exposed LAN (as long as
+# they use an internal IP address). This represents a
+# potential security hole (what if an exposed host is
+# compromised?). If you want full restrictions to apply
+# between the three LANs, firewalling them off from each
+# other for added security, remove these two rules.
+#
+# If you want to isolate LAN1 and LAN2, but still want
+# to give exposed hosts free reign with each other, get
+# rid of rule 01010 and keep rule 01011.
+#
+# (commented out, uncomment for less restrictive firewall)
+#add 01010 allow all from 10.0.0.0/8 to 10.0.0.0/8
+#add 01011 allow all from 192.100.5.0/24 to 192.100.5.0/24
+#
+
+# SPECIFIC SERVICES ALLOWED FROM SPECIFIC LANS
+#
+# If using a more restrictive firewall, allow specific LANs
+# access to specific services running on the firewall itself.
+# In this case we assume LAN1 needs access to filesharing running
+# on the firewall. If using a less restrictive firewall
+# (allowing rule 01010), you do not need these rules.
+#
+add 01012 allow tcp from 10.0.1.0/8 to 10.0.1.1 139
+add 01012 allow udp from 10.0.1.0/8 to 10.0.1.1 137,138
+
+# GENERAL SERVICES ALLOWED TO CROSS INTERNAL AND EXPOSED LANS
+#
+# We allow specific UDP services through: DNS lookups, ntalk, and ntp.
+# Note that internal services are protected by virtue of having
+# spoof-proof internal IP addresses (10. net), so these rules
+# really only apply to services bound to exposed IPs. We have
+# to allow UDP fragments or larger fragmented UDP packets will
+# not survive the firewall.
+#
+# If we want to expose high-numbered temporary service ports
+# for things like DNS lookup responses we can use a port range,
+# in this example 4000-65535, and we set to /etc/rc.conf variables
+# on all exposed machines to make sure they bind temporary ports
+# to the exposed port range (see rc.conf example above)
+#
+add 02000 allow udp from any to any 4000-65535,domain,ntalk,ntp
+add 02500 allow udp from any to any frag
+
+# Allow similar services for TCP. Again, these only apply to
+# services bound to exposed addresses. NOTE: we allow 'auth'
+# through but do not actually run an identd server on any exposed
+# port. This allows the machine being authed to respond with a
+# TCP RESET. Throwing the packet away would result in delays
+# when connecting to remote services that do reverse ident lookups.
+#
+# Note that we do not allow tcp fragments through, and that we do
+# not allow fragments in general (except for UDP fragments). We
+# expect the TCP mtu discovery protocol to work properly so there
+# should be no TCP fragments.
+#
+add 03000 allow tcp from any to any http,https
+add 03000 allow tcp from any to any 4000-65535,ssh,smtp,domain,ntalk
+add 03000 allow tcp from any to any auth,pop3,ftp,ftp-data
+
+# It is important to allow certain ICMP types through, here is a list
+# of general ICMP types. Note that it is important to let ICMP type 3
+# through.
+#
+# 0 Echo Reply
+# 3 Destination Unreachable (used by TCP MTU discovery, aka
+# packet-too-big)
+# 4 Source Quench (typically not allowed)
+# 5 Redirect (typically not allowed - can be dangerous!)
+# 8 Echo
+# 11 Time Exceeded
+# 12 Parameter Problem
+# 13 Timestamp
+# 14 Timestamp Reply
+#
+# Sometimes people need to allow ICMP REDIRECT packets, which is
+# type 5, but if you allow it make sure that your Internet router
+# disallows it.
+
+add 04000 allow icmp from any to any icmptypes 0,3,8,11,12,13,14
+
+# log any remaining fragments that get through. Might be useful,
+# otherwise do not bother. Have a final deny rule as a safety to
+# guarantee that your firewall is inclusive no matter how the kernel
+# is configured.
+#
+add 05000 deny log ip from any to any frag
+add 06000 deny all from any to any
+.Ed
+.Sh PORT BINDING INTERNAL AND EXTERNAL SERVICES
+We have mentioned multi-homing hosts and binding services to internal or
+external addresses but we have not really explained it.
+When you have a
+host with multiple IP addresses assigned to it, you can bind services run
+on that host to specific IPs or interfaces rather than all IPs.
+Take
+the firewall machine for example: with three interfaces
+and two exposed IP addresses
+on one of those interfaces, the firewall machine is known by 5 different
+IP addresses (10.0.0.1, 10.0.1.1, 10.0.2.1, 192.100.5.5, and say
+192.100.5.1).
+If the firewall is providing file sharing services to the
+windows LAN segment (say it is LAN1), you can use samba's 'bind interfaces'
+directive to specifically bind it to just the LAN1 IP address.
+That
+way the file sharing services will not be made available to other LAN
+segments.
+The same goes for NFS.
+If LAN2 has your UNIX engineering
+workstations, you can tell nfsd to bind specifically to 10.0.2.1.
+You
+can specify how to bind virtually every service on the machine and you
+can use a light
+.Xr jail 8
+to indirectly bind services that do not otherwise give you the option.
+.Sh SEE ALSO
+.Xr dummynet 4 ,
+.Xr ipnat 5 ,
+.Xr rc.conf 5 ,
+.Xr smb.conf 5 Pq Pa ports/net/samba ,
+.Xr samba 7 Pq Pa ports/net/samba ,
+.Xr config 8 ,
+.Xr ipfw 8 ,
+.Xr ipnat 8 ,
+.Xr jail 8 ,
+.Xr natd 8 ,
+.Xr nfsd 8
+.Sh ADDITIONAL READING
+.Bl -tag -width indent
+.It Nm Ipfilter
+.Xr ipf 5 ,
+.Xr ipf 8 ,
+.Xr ipfstat 8
+.It Nm Packet Filter
+.Xr pf.conf 5 ,
+.Xr pfctl 8 ,
+.Xr pflogd 8
+.El
+.Sh HISTORY
+The
+.Nm
+manual page was originally written by
+.An Matthew Dillon
+and first appeared
+in
+.Fx 4.3 ,
+May 2001.
diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7
new file mode 100644
index 000000000000..df76f46df55a
--- /dev/null
+++ b/share/man/man7/hier.7
@@ -0,0 +1,845 @@
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)hier.7 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd May 25, 2008
+.Dt HIER 7
+.Os
+.Sh NAME
+.Nm hier
+.Nd layout of file systems
+.Sh DESCRIPTION
+A sketch of the file system hierarchy.
+.Bl -tag -width ".Pa /libexec/"
+.It Pa /
+root directory of the file system
+.It Pa /bin/
+user utilities fundamental to both single-user and multi-user environments
+.It Pa /boot/
+programs and configuration files used during operating system bootstrap
+.Pp
+.Bl -tag -width ".Pa defaults/" -compact
+.It Pa defaults/
+default bootstrapping configuration files; see
+.Xr loader.conf 5
+.It Pa kernel/
+pure kernel executable (the operating system loaded into memory
+at boot time).
+.It Pa modules/
+third-party loadable kernel modules;
+see
+.Xr kldstat 8
+.El
+.It Pa /cdrom/
+default mount point for CD-ROM drives
+(created by
+.Xr sysinstall 8 )
+.It Pa /compat/
+normally a link to
+.Pa /usr/compat .
+If not, then the
+.Pa /usr/compat
+comments apply
+(created by
+.Xr sysinstall 8 )
+.It Pa /dev/
+device special files managed by
+.Xr devfs 5
+.Pp
+.Bl -tag -width ".Pa net/" -compact
+.It Pa fd/
+file descriptor files;
+see
+.Xr \&fd 4
+.It Pa net/
+network devices
+.El
+.It Pa /dist/
+mount point used by
+.Xr sysinstall 8
+.It Pa /etc/
+system configuration files and scripts
+.Pp
+.Bl -tag -width ".Pa bluetooth/" -compact
+.It Pa defaults/
+default system configuration files;
+see
+.Xr rc 8
+.It Pa bluetooth/
+bluetooth configuration files
+.It Pa gnats/
+gnats configuration files;
+see
+.Xr send-pr 1
+.It Pa localtime
+local timezone information;
+see
+.Xr ctime 3
+.It Pa mail/
+Sendmail control files
+.It Pa mtree/
+mtree configuration files;
+see
+.Xr mtree 8
+.It Pa namedb/
+named configuration files;
+see
+.Xr named 8
+.It Pa pam.d/
+configuration files for the Pluggable Authentication Modules (PAM)
+library
+.It Pa periodic/
+scripts that are run daily, weekly, and monthly, via
+.Xr cron 8 ;
+see
+.Xr periodic 8
+.It Pa rc.d/
+System and daemon startup/control scripts;
+see
+.Xr rc 8
+.It Pa security/
+OpenBSM audit configuration files;
+see
+.Xr audit 8
+.It Pa ppp/
+ppp configuration files;
+see
+.Xr ppp 8
+.It Pa ssh/
+OpenSSH configuration files;
+see
+.Xr ssh 1
+.It Pa ssl/
+OpenSSL configuration files
+.El
+.It Pa /lib/
+critical system libraries needed for binaries in
+.Pa /bin
+and
+.Pa /sbin
+.Pp
+.Bl -tag -width ".Pa geom/" -compact
+.It Pa geom/
+class-specific libraries for the
+.Xr geom 8
+utility
+.El
+.It Pa /libexec/
+critical system utilities needed for binaries in
+.Pa /bin
+and
+.Pa /sbin
+.It Pa /media/
+contains subdirectories to be used as mount points
+for removable media such as CDs, USB drives, and
+floppy disks
+.It Pa /mnt/
+empty directory commonly used by
+system administrators as a temporary mount point
+.It Pa /proc/
+process file system;
+see
+.Xr procfs 5
+.It Pa /rescue/
+statically linked programs for emergency recovery;
+see
+.Xr rescue 8
+.It Pa /root/
+root's HOME directory
+.It Pa /sbin/
+system programs and administration utilities
+fundamental to both single-user and multi-user environments
+.It Pa /tmp/
+temporary files that are not guaranteed to persist across system reboots
+.It Pa /usr/
+contains the majority of user utilities and applications
+.Pp
+.Bl -tag -width ".Pa libdata/" -compact
+.It Pa bin/
+common utilities, programming tools, and applications
+.It Pa compat/
+files needed to support binary compatibility with other operating systems,
+such as Linux
+(created by
+.Xr sysinstall 8 )
+.It Pa games/
+useful and semi-frivolous programs
+.It Pa include/
+standard C include files
+.Pp
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa altq/
+C include files for alternate queueing
+.It Pa arpa/
+C include files for Internet service protocols
+.It Pa bsnmp/
+C include files for the SNMP daemon
+.It Pa c++/
+C++ include files
+.It Pa cam/
+C include files for the Common Access Methods Layer
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa scsi/
+The SCSI device on top of CAM
+.El
+.It Pa dev/
+C include files for programming various
+.Fx
+devices
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa ic/
+Various header files describing driver- and bus-independent
+hardware circuits
+.It Pa ofw/
+Open Firmware support
+.It Pa pbio/
+8255 PPI cards;
+see
+.Xr pbio 4
+.It Pa ppbus/
+The parallel port bus;
+see
+.Xr ppbus 4
+.It Pa usb/
+The USB subsystem
+.It Pa utopia/
+Physical chip driver for ATM interfaces;
+see
+.Xr utopia 4
+.It Pa wi/
+The
+.Xr wi 4
+WaveLAN driver
+.El
+.It Pa fs/
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa fdescfs/
+per-process file descriptors file system
+.It Pa fifofs/
+.St -p1003.1
+FIFOs file system
+.It Pa msdosfs/
+MS-DOS file system
+.It Pa nfs/
+C include files for NFS (Network File System) version 2, 3 and 4
+.It Pa ntfs/
+NTFS file system
+.It Pa nullfs/
+loopback file system
+.It Pa nwfs/
+NetWare file system
+.It Pa portalfs/
+portal file system
+.It Pa procfs/
+process file system
+.It Pa smbfs/
+SMB/CIFS file system
+.It Pa udf/
+UDF file system
+.It Pa unionfs
+union file system
+.El
+.It Pa geom/
+GEOM framework
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa concat/
+CONCAT GEOM class
+.It Pa gate/
+GATE GEOM class
+.It Pa mirror/
+MIRROR GEOM class
+.It Pa nop/
+NOP GEOM class
+.It Pa raid3/
+RAID3 GEOM class
+.It Pa stripe/
+STRIPE GEOM class
+.El
+.Pp
+.It Pa isc/
+ISC utility library libisc include files
+.It Pa isofs/
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa cd9660/
+iso9660 file system
+.El
+.It Pa libmilter/
+C include files for libmilter,
+the
+.Xr sendmail 8
+mail filter API
+.It Pa machine/
+machine-specific C include files
+.It Pa net/
+miscellaneous network C include files
+.It Pa netatalk/
+Appletalk protocol
+.It Pa netinet/
+C include files for Internet standard protocols;
+see
+.Xr inet 4
+.It Pa netinet6/
+C include files for Internet protocol version 6;
+see
+.Xr inet6 4
+.It Pa netipsec/
+kernel key-management service;
+see
+.Xr ipsec 4
+.It Pa netipx/
+IPX/SPX protocol stacks
+.It Pa netnatm/
+NATM include files;
+see
+.Xr natm 4
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa api/
+include files for the signalling API
+.It Pa msg/
+include files that describe signalling messages and
+declare associated functions
+.It Pa saal/
+include files for the signalling AAL layer
+.It Pa sig/
+include files for the UNI signalling protocol
+.El
+.It Pa netsmb/
+SMB/CIFS requester
+.It Pa nfs/
+C include files for NFS (Network File System) version 2 and 3 (legacy)
+.It Pa objc/
+Objective C include files
+.It Pa openssl/
+OpenSSL (Cryptography/SSL toolkit) headers
+.It Pa pccard/
+PC-CARD controllers
+.It Pa protocols/
+C include files for Berkeley service protocols
+.It Pa readline/
+get a line from a user, with editing;
+see
+.Xr readline 3
+.It Pa rpc/
+remote procedure calls;
+see
+.Xr rpc 3
+.It Pa rpcsvc/
+definition of RPC service structures; see
+.Xr rpc 3
+.It Pa security/
+PAM; see
+.Xr pam 8
+.It Pa sys/
+system C include files (kernel data structures)
+.\" .It Pa tcl/
+.\" Tcl language;
+.\" see
+.\" .Xr Tcl n
+.\" .Bl -tag -width ".Pa kerberos5/" -compact
+.\" .It Pa generic/
+.\" ???
+.\" .It Pa unix/
+.\" ???
+.\" .El
+.It Pa ufs/
+C include files for UFS (The U-word File System)
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa ffs/
+Fast file system
+.It Pa ufs/
+UFS file system
+.El
+.It Pa vm/
+virtual memory;
+see
+.Xr vmstat 8
+.El
+.Pp
+.It Pa lib/
+shared and archive
+.Xr ar 1 Ns -type
+libraries
+.Bl -tag -width Fl -compact
+.It Pa aout/
+a.out archive libraries
+.It Pa compat/
+shared libraries for compatibility
+.Bl -tag -width Fl -compact
+.It Pa aout/
+a.out backward compatibility libraries
+.El
+.It Pa dtrace/
+DTrace library scripts
+.It Pa engines/
+OpenSSL (Cryptography/SSL toolkit) dynamically loadable engines
+.El
+.Pp
+.It Pa libdata/
+miscellaneous utility data files
+.Bl -tag -width Fl -compact
+.It Pa gcc/
+.Xr gcc 1
+configuration data
+.It Pa ldscripts/
+linker scripts;
+see
+.Xr ld 1
+.It Pa lint/
+various prebuilt lint libraries;
+see
+.Xr lint 1
+.El
+.Pp
+.It Pa libexec/
+system daemons & system utilities (executed by other programs)
+.Bl -tag -width Fl -compact
+.It Pa aout/
+utilities to manipulate a.out executables
+.It Pa elf/
+utilities to manipulate ELF executables
+.It Pa lpr/
+utilities and filters for LP print system;
+see
+.Xr lpr 1
+.It Pa sendmail/
+the
+.Xr sendmail 8
+binary;
+see
+.Xr mailwrapper 8
+.It Pa sm.bin/
+restricted shell for
+.Xr sendmail 8 ;
+see
+.Xr smrsh 8
+.El
+.Pp
+.It Pa local/
+local executables, libraries, etc.
+Also used as the default destination for the
+.Fx
+ports framework.
+Within local/, the general layout sketched out by
+.Nm
+for /usr
+should be used.
+Exceptions are the man directory (directly under local/
+rather than under local/share/), ports documentation (in share/doc/<port>/),
+and /usr/local/etc (mimics /etc).
+.It Pa obj/
+architecture-specific target tree produced by building the /usr/src tree
+.It Pa ports/
+The
+.Fx
+ports collection (optional).
+.It Pa sbin/
+system daemons & system utilities (executed by users)
+.It Pa share/
+architecture-independent files
+.Pp
+.Bl -tag -width ".Pa calendar/" -compact
+.It Pa calendar/
+a variety of pre-fab calendar files;
+see
+.Xr calendar 1
+.It Pa dict/
+word lists;
+see
+.Xr look 1
+.Pp
+.Bl -tag -width Fl -compact
+.It Pa freebsd
+.Fx Ns -specific
+terms, proper names, and jargon
+.It Pa words
+common words
+.It Pa web2
+words from Webster's 2nd International
+.It Pa papers/
+reference databases;
+see
+.Xr refer 1
+.El
+.Pp
+.It Pa doc/
+miscellaneous documentation;
+source for most of the printed
+.Bx
+manuals (available
+from the
+.Tn USENIX
+association)
+.Bl -tag -width Fl -compact
+.It Pa FAQ/
+Frequently Asked Questions
+.It Pa IPv6/
+implementation notes for IPv6
+.It Pa bind/
+documents pertaining to BIND (the Berkeley Internet Name Domain)
+.It Pa es/
+Spanish translations of documents in /usr/share/doc
+.It Pa handbook/
+.Fx
+Handbook
+.It Pa ja/
+Japanese translations of documents in /usr/share/doc
+.It Pa legal/
+License files for vendor supplied firmwares
+.It Pa ncurses/
+HTML documents pertaining to ncurses;
+see
+.Xr ncurses 3
+.It Pa ntp/
+HTML documents pertaining to the Network Time Protocol
+.It Pa papers/
+UNIX Papers
+.It Pa psd/
+UNIX Programmer's Supplementary Documents
+.It Pa ru/
+Russian translations of documents in /usr/share/doc
+.It Pa smm/
+UNIX System Manager's Manual
+.It Pa tutorials/
+.Fx
+tutorials
+.It Pa usd/
+UNIX User's Supplementary Documents
+.It Pa zh/
+Chinese translations of documents in /usr/share/doc
+.El
+.Pp
+.It Pa examples/
+various examples for users and programmers
+.It Pa games/
+ASCII text files used by various games
+.It Pa groff_font/
+device description file for device name
+.It Pa info/
+GNU Info hypertext system
+.It Pa locale/
+localization files;
+see
+.Xr setlocale 3
+.It Pa man/
+manual pages
+.It Pa me/
+macros for use with the me macro package;
+see
+.Xr me 7
+.It Pa misc/
+miscellaneous system-wide ASCII text files
+.Bl -tag -width Fl -compact
+.It Pa fonts/
+???
+.It Pa termcap
+terminal characteristics database;
+see
+.Xr termcap 5
+.El
+.It Pa mk/
+templates for make;
+see
+.Xr make 1
+.It Pa nls/
+national language support files;
+see
+.Xr mklocale 1
+.It Pa security/
+data files for security policies such as
+.Xr mac_lomac 4
+.It Pa sendmail/
+.Xr sendmail 8
+configuration files
+.It Pa skel/
+example
+.Pa .\&
+(dot) files for new accounts
+.It Pa snmp/
+MIBs, example files and tree definitions for the SNMP daemon.
+.Bl -tag -width Fl -compact
+.It Pa defs/
+Tree definition files for use with
+.Xr gensnmptree 1
+.It Pa mibs/
+MIB files
+.El
+.It Pa syscons/
+files used by syscons;
+see
+.Xr syscons 4
+.Bl -tag -width ".Pa scrnmaps/" -compact
+.It Pa fonts/
+console fonts;
+see
+.Xr vidcontrol 1
+and
+.Xr vidfont 1
+.It Pa keymaps/
+console keyboard maps;
+see
+.Xr kbdcontrol 1
+and
+.Xr kbdmap 1
+.It Pa scrnmaps/
+console screen maps
+.El
+.It Pa tabset/
+tab description files for a variety of terminals; used in
+the termcap file;
+see
+.Xr termcap 5
+.It Pa tmac/
+text processing macros;
+see
+.Xr nroff 1
+and
+.Xr troff 1
+.It Pa vi/
+localization support and utilities for
+.Xr vi 1
+.It Pa zoneinfo/
+timezone configuration information;
+see
+.Xr tzfile 5
+.El
+.It Pa src/
+.Bx ,
+third-party, and/or local source files
+.Pp
+.Bl -tag -width ".Pa kerberos5/" -compact
+.It Pa bin/
+source code for files in /bin
+.It Pa cddl/
+Utilities covered by the Common Development and Distribution License
+.It Pa contrib/
+source code for contributed software
+.It Pa crypto/
+source code for contributed cryptography software
+.It Pa etc/
+source code for files in /etc
+.It Pa games/
+source code for files in /usr/games
+.It Pa gnu/
+Utilities covered by the GNU General Public License
+.It Pa include/
+source code for files in /usr/include
+.It Pa kerberos5/
+build infrastructure for kerberos version 5
+.It Pa lib/
+source code for files in /usr/lib
+.It Pa libexec/
+source code for files in /usr/libexec
+.It Pa release/
+files required to produce a
+.Fx
+release
+.It Pa sbin/
+source code for files in /sbin
+.It Pa secure/
+build directory for files in /usr/src/crypto
+.It Pa share/
+source for files in /usr/share
+.It Pa sys/
+kernel source code
+.It Pa tools/
+tools used for maintenance and testing of
+.Fx
+.It Pa usr.bin/
+source code for files in /usr/bin
+.It Pa usr.sbin/
+source code for files in /usr/sbin
+.El
+.El
+.It Pa /var/
+multi-purpose log, temporary, transient, and spool files
+.Pp
+.Bl -tag -width ".Pa preserve/" -compact
+.It Pa account/
+system accounting files
+.Pp
+.Bl -tag -width Fl -compact
+.It Pa acct
+execution accounting file;
+see
+.Xr acct 5
+.El
+.Pp
+.It Pa at/
+timed command scheduling files;
+see
+.Xr \&at 1
+.Bl -tag -width ".Pa preserve/" -compact
+.It Pa jobs/
+directory containing job files
+.It Pa spool/
+directory containing output spool files
+.El
+.Pp
+.It Pa backups/
+miscellaneous backup files
+.It Pa crash/
+default directory to store kernel crash dumps; see
+.Xr crash 8
+and
+.Xr savecore 8
+.It Pa cron/
+files used by cron;
+see
+.Xr cron 8
+.Bl -tag -width ".Pa preserve/" -compact
+.It Pa tabs/
+crontab files;
+see
+.Xr crontab 5
+.El
+.Pp
+.It Pa db/
+miscellaneous automatically generated system-specific database files
+.It Pa empty/
+empty directory for use by programs that need a specifically empty directory.
+Used for instance by
+.Xr sshd 8
+for privilege separation.
+.It Pa games/
+miscellaneous game status and score files
+.It Pa heimdal/
+kerberos server databases; see
+.Xr kdc 8
+.It Pa log/
+miscellaneous system log files
+.Pp
+.Bl -tag -width Fl -compact
+.It Pa utx.lastlogin
+last login log;
+see
+.Xr getutxent 3
+.It Pa utx.log
+login/logout log;
+see
+.Xr getutxent 3
+.El
+.Pp
+.It Pa mail/
+user mailbox files
+.It Pa msgs/
+system messages database;
+see
+.Xr msgs 1
+.It Pa preserve/
+temporary home of files preserved after an accidental death
+of an editor;
+see
+.Xr \&ex 1
+.It Pa quotas/
+file system quota information files
+.It Pa run/
+system information files describing various info about
+system since it was booted
+.Pp
+.Bl -tag -width Fl -compact
+.It Pa named/
+writable by the
+.Dq bind
+user; see
+.Xr named 8
+.It Pa ppp/
+writable by the
+.Dq network
+group for command connection sockets; see
+.Xr ppp 8
+.It Pa utx.active
+database of current users;
+see
+.Xr getutxent 3
+.El
+.Pp
+.It Pa rwho/
+rwho data files;
+see
+.Xr rwhod 8 ,
+.Xr rwho 1 ,
+and
+.Xr ruptime 1
+.It Pa spool/
+miscellaneous printer and mail system spooling directories
+.Pp
+.Bl -tag -width Fl -compact
+.It Pa clientmqueue/
+undelivered submission mail queue;
+see
+.Xr sendmail 8
+.It Pa ftp/
+commonly ~ftp; the anonymous ftp root directory
+.It Pa mqueue/
+undelivered mail queue;
+see
+.Xr sendmail 8
+.It Pa output/
+line printer spooling directories
+.El
+.Pp
+.It Pa tmp/
+temporary files that are kept between system reboots
+.Bl -tag -width Fl -compact
+.It Pa vi.recover/
+the directory where recovery files are stored
+.El
+.It Pa yp/
+the NIS maps
+.El
+.El
+.Sh NOTES
+This manual page documents the default
+.Fx
+file system layout, but
+the actual hierarchy on a given system is defined at the system
+administrator's discretion.
+A well-maintained installation will include a customized version of
+this document.
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr find 1 ,
+.Xr finger 1 ,
+.Xr grep 1 ,
+.Xr ls 1 ,
+.Xr whatis 1 ,
+.Xr whereis 1 ,
+.Xr which 1 ,
+.Xr fd 4 ,
+.Xr devfs 5 ,
+.Xr fsck 8
+.Sh HISTORY
+A
+.Nm
+manual page appeared in
+.At v7 .
diff --git a/share/man/man7/hostname.7 b/share/man/man7/hostname.7
new file mode 100644
index 000000000000..713a8b155525
--- /dev/null
+++ b/share/man/man7/hostname.7
@@ -0,0 +1,94 @@
+.\" Copyright (c) 1987, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)hostname.7 8.2 (Berkeley) 12/30/93
+.\" $FreeBSD$
+.\"
+.Dd December 30, 1993
+.Dt HOSTNAME 7
+.Os
+.Sh NAME
+.Nm hostname
+.Nd host name resolution description
+.Sh DESCRIPTION
+Hostnames are domains, where a domain is a hierarchical, dot-separated
+list of subdomains; for example, the machine monet, in the Berkeley
+subdomain of the EDU subdomain of the Internet would be represented as
+.Pp
+.Dl monet.Berkeley.EDU
+.Pp
+(with no trailing dot).
+.Pp
+Hostnames are often used with network client and server programs,
+which must generally translate the name to an address for use.
+(This function is generally performed by the library routine
+.Xr gethostbyname 3 . )
+Hostnames are resolved by the Internet name resolver in the following
+fashion.
+.Pp
+If the name consists of a single component, i.e., contains no dot,
+and if the environment variable
+.Dq Ev HOSTALIASES
+is set to the name of a file,
+that file is searched for any string matching the input hostname.
+The file should consist of lines made up of two white-space separated strings,
+the first of which is the hostname alias,
+and the second of which is the complete hostname
+to be substituted for that alias.
+If a case-insensitive match is found between the hostname to be resolved
+and the first field of a line in the file, the substituted name is looked
+up with no further processing.
+.Pp
+If the input name ends with a trailing dot,
+the trailing dot is removed,
+and the remaining name is looked up with no further processing.
+.Pp
+If the input name does not end with a trailing dot, it is looked up
+by searching through a list of domains until a match is found.
+The default search list includes first the local domain,
+then its parent domains with at least 2 name components (longest first).
+For example,
+in the domain CS.Berkeley.EDU, the name lithium.CChem will be checked first
+as lithium.CChem.CS.Berkeley.EDU and then as lithium.CChem.Berkeley.EDU.
+Lithium.CChem.EDU will not be tried, as there is only one component
+remaining from the local domain.
+The search path can be changed from the default
+by a system-wide configuration file (see
+.Xr resolver 5 ) .
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr resolver 5 ,
+.Xr mailaddr 7 ,
+.Xr named 8
+.Sh HISTORY
+.Nm Hostname
+appeared in
+.Bx 4.2 .
diff --git a/share/man/man7/intro.7 b/share/man/man7/intro.7
new file mode 100644
index 000000000000..1d9968c215df
--- /dev/null
+++ b/share/man/man7/intro.7
@@ -0,0 +1,47 @@
+.\" Copyright (c) 1983, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)intro.7 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt INTRO 7
+.Os
+.Sh NAME
+.Nm intro
+.Nd miscellaneous information pages
+.Sh DESCRIPTION
+This section contains miscellaneous documentation.
+.Sh HISTORY
+The
+.Nm
+section manual page appeared in
+.Bx 4.2 .
diff --git a/share/man/man7/maclabel.7 b/share/man/man7/maclabel.7
new file mode 100644
index 000000000000..0648fb565c9a
--- /dev/null
+++ b/share/man/man7/maclabel.7
@@ -0,0 +1,98 @@
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by Chris Costello
+.\" at Safeport Network Services and Network Associates Labs, the Security
+.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR
+.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS research
+.\" program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The names of the authors may not be used to endorse or promote
+.\" products derived from this software without specific prior written
+.\" permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 25, 2002
+.Dt MACLABEL 7
+.Os
+.Sh NAME
+.Nm maclabel
+.Nd Mandatory Access Control label format
+.Sh DESCRIPTION
+If Mandatory Access Control, or MAC, is enabled in the kernel,
+then in addition to the traditional credentials,
+each subject
+(typically a user or a socket)
+and object
+(file system object, socket, etc.\&)
+is given a
+.Em "MAC label" .
+The MAC label specifies the necessary subject-specific or
+object-specific information necessary for a MAC security policy
+.\" .Pq Xr mac 9
+to enforce access control on the subject/object.
+.Pp
+The format for a MAC label is defined as follows:
+.Pp
+.Sm off
+.D1 Ar policy1 No / Ar qualifier1 , policy2 No / Ar qualifier2 , No ...
+.Sm on
+.Pp
+A MAC label consists of a policy name,
+followed by a forward slash,
+followed by the subject or object's qualifier,
+optionally followed by a comma and one or more additional policy labels.
+For example:
+.Bd -literal -offset indent
+biba/low(low-low)
+biba/high(low-high),mls/equal(equal-equal),partition/0
+.Ed
+.Sh SEE ALSO
+.Xr mac 3 ,
+.Xr posix1e 3 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr login.conf 5 ,
+.Xr getfmac 8 ,
+.Xr getpmac 8 ,
+.Xr ifconfig 8 ,
+.Xr setfmac 8 ,
+.Xr setpmac 8 ,
+.Xr mac 9
+.Sh HISTORY
+MAC first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+This software was contributed to the
+.Fx
+Project by NAI Labs, the Security Research Division of Network Associates
+Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
diff --git a/share/man/man7/mailaddr.7 b/share/man/man7/mailaddr.7
new file mode 100644
index 000000000000..772600621c89
--- /dev/null
+++ b/share/man/man7/mailaddr.7
@@ -0,0 +1,162 @@
+.\" Copyright (c) 1983, 1987, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)mailaddr.7 8.1 (Berkeley) 6/16/93
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1993
+.Dt MAILADDR 7
+.Os
+.Sh NAME
+.Nm mailaddr
+.Nd mail addressing description
+.Sh DESCRIPTION
+Mail addresses are based on the Internet protocol listed at the end of this
+manual page.
+These addresses are in the general format
+.Pp
+.Dl user@domain
+.Pp
+where a domain is a hierarchical dot separated list of subdomains.
+For
+example, a valid address is:
+.Pp
+.Dl eric@CS.Berkeley.EDU
+.Pp
+Unlike some other forms of addressing, domains do not imply any routing.
+Thus, although this address is specified as an Internet address, it might
+travel by an alternate route if that were more convenient or efficient.
+For example, at Berkeley, the associated message would probably go directly
+to CS over the Ethernet rather than going via the Berkeley Internet
+gateway.
+.Ss Abbreviation.
+Under certain circumstances it may not be necessary to type the entire
+domain name.
+In general, anything following the first dot may be omitted
+if it is the same as the domain from which you are sending the message.
+For example, a user on ``calder.berkeley.edu'' could send to ``eric@CS''
+without adding the ``berkeley.edu'' since it is the same on both sending
+and receiving hosts.
+.Ss Compatibility.
+Certain old address formats are converted to the new format to provide
+compatibility with the previous mail system.
+In particular,
+.Pp
+.Dl user@host
+.Pp
+and
+.Dl user@host.domain
+.Pp
+are allowed;
+.Pp
+.Dl host.domain!user
+.Pp
+is converted to
+.Pp
+.Dl user@host.domain
+.Pp
+and
+.Pp
+.Dl host!user
+.Pp
+is converted to
+.Pp
+.Dl user@host.UUCP
+.Pp
+This is normally converted back to the ``host!user'' form before being sent
+on for compatibility with older UUCP hosts.
+.Ss Case Distinctions.
+Domain names (i.e., anything after the ``@'' sign) may be given in any mixture
+of upper and lower case with the exception of UUCP hostnames.
+Most hosts
+accept any combination of case in user names, with the notable exception of
+MULTICS sites.
+.Ss Route-addrs.
+Under some circumstances it may be necessary to route a message through
+several hosts to get it to the final destination.
+Normally this routing
+is done automatically, but sometimes it is desirable to route the message
+manually.
+Addresses which show these relays are termed ``route-addrs.''
+These use the syntax:
+.Pp
+.Dl <@hosta,@hostb:user@hostc>
+.Pp
+This specifies that the message should be sent to hosta, from there to hostb,
+and finally to hostc.
+This path is forced even if there is a more efficient
+path to hostc.
+.Pp
+Route-addrs occur frequently on return addresses, since these are generally
+augmented by the software at each host.
+It is generally possible to ignore
+all but the ``user@hostc'' part of the address to determine the actual
+sender.
+.Pp
+[Note: the route-addr syntax is officially deprecated
+in RFC 1123 and should not be used.]
+.Pp
+Many sites also support the ``percent hack'' for simplistic routing:
+.Pp
+.Dl user%hostc%hostb@hosta
+.Pp
+is routed as indicated in the previous example.
+.Ss Postmaster.
+Every site is required to have a user or user alias designated ``postmaster''
+to which problems with the mail system may be addressed.
+.Ss Other Networks.
+Some other networks can be reached by giving the name of the network as the
+last component of the domain.
+.Em This is not a standard feature
+and may
+not be supported at all sites.
+For example, messages to CSNET or BITNET sites
+can often be sent to ``user@host.CSNET'' or ``user@host.BITNET'' respectively.
+.Sh SEE ALSO
+.Xr mail 1 ,
+.Xr sendmail 8
+.Rs
+.%A Crocker, D. H.
+.%T Standard for the Format of Arpa Internet Text Messages
+.%O RFC822
+.Re
+.Sh HISTORY
+.Nm Mailaddr
+appeared in
+.Bx 4.2 .
+.Sh BUGS
+The RFC822 group syntax (``group:user1,user2,user3;'') is not supported
+except in the special case of ``group:;'' because of a conflict with old
+berknet-style addresses.
+.Pp
+Route-Address syntax is grotty.
+.Pp
+UUCP- and Internet-style addresses do not coexist politely.
diff --git a/share/man/man7/operator.7 b/share/man/man7/operator.7
new file mode 100644
index 000000000000..0ca8abdcbe2b
--- /dev/null
+++ b/share/man/man7/operator.7
@@ -0,0 +1,68 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)operator.7 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd April 8, 2009
+.Dt OPERATOR 7
+.Os
+.Sh NAME
+.Nm operator
+.Nd C and C++ operator precedence and order of evaluation
+.Sh DESCRIPTION
+.Bd -ragged -offset indent -compact
+.Bl -column "! ~ ++ -- - (type) * & sizeof new delete"
+.It Sy "Operator Associativity"
+.It "-------- -------------"
+.It "() [] -> . left to right"
+.It "! ~ ++ -- - (type) * & sizeof new delete right to left"
+.It "->* .* left to right"
+.It "* / % left to right"
+.It "+ - left to right"
+.It "<< >> left to right"
+.It "< <= > >= left to right"
+.It "== != left to right"
+.It "& left to right"
+.It "^ left to right"
+.It "| left to right"
+.It "&& left to right"
+.It "|| left to right"
+.It "?: right to left"
+.It "= += -= *= /= %= <<= >>= &= ^= |= throw right to left"
+.It "?: (C++, third operand) right to left"
+.It ", left to right"
+.El
+.Ed
+.Sh FILES
+.Bl -tag -width /usr/share/misc/operator -compact
+.It Pa /usr/share/misc/operator
+.El
diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7
new file mode 100644
index 000000000000..29312da4f800
--- /dev/null
+++ b/share/man/man7/ports.7
@@ -0,0 +1,555 @@
+.\"
+.\" Copyright (c) 1997 David E. O'Brien
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 9, 2012
+.Dt PORTS 7
+.Os
+.Sh NAME
+.Nm ports
+.Nd contributed applications
+.Sh DESCRIPTION
+The
+.Fx
+Ports Collection
+offers a simple way for users and
+administrators to install applications.
+Each
+.Em port
+contains any patches necessary to make the original
+application source code compile and run on
+.Bx .
+Compiling an
+application is as simple as typing
+.Nm make Cm build
+in the port directory!
+The
+.Pa Makefile
+automatically fetches the
+application source code, either from a local disk or via FTP, unpacks it
+on your system, applies the patches, and compiles it.
+If all goes well,
+simply type
+.Nm make Cm install
+to install the application.
+.Pp
+It is possible to download and use ports from the
+.Fx
+repository
+that are newer than the installed system; however it is important to
+install the appropriate
+.Dq "Upgrade Kit"
+from
+.Pa http://www.FreeBSD.org/ports/
+first!
+The
+.Xr portcheckout 1 Pq Pa ports/ports-mgmt/portcheckout
+script (also a port, of course!) will help to download new ports.
+.Pp
+For more information about using ports, see
+.Dq "Packages and Ports"
+in
+.%B "The FreeBSD Handbook" ,
+.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/handbook/ports.html
+or
+.Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/ports.html ) .
+For information about creating new ports, see
+.%B "The Porter's Handbook"
+.Pa ( file:/usr/share/doc/en_US.ISO8859-1/books/porters-handbook/index.html
+or
+.Pa http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/porters-handbook/ ) .
+.Sh TARGETS
+Some of the targets work recursively through subdirectories.
+This lets you, for example, install all of the
+.Dq Li biology
+ports.
+The targets that do this are
+.Cm build , checksum , clean , configure ,
+.Cm depends , extract , fetch , install ,
+and
+.Cm package .
+.Pp
+The following targets will be run automatically by each proceeding
+target in order.
+That is,
+.Cm build
+will be run
+(if necessary)
+by
+.Cm install ,
+and so on all the way to
+.Cm fetch .
+Usually, you will only use the
+.Cm install
+target.
+.Bl -tag -width ".Cm configure"
+.It Cm config
+Configure
+.Va OPTIONS
+for this port using
+.Xr dialog 1 .
+.It Cm fetch
+Fetch all of the files needed to build this port from the sites
+listed in
+.Va MASTER_SITES
+and
+.Va PATCH_SITES .
+See
+.Va FETCH_CMD , MASTER_SITE_OVERRIDE
+and
+.Va MASTER_SITE_BACKUP .
+.It Cm checksum
+Verify that the fetched distfile's checksum matches the one the port was
+tested against.
+If the distfile's checksum does not match, it also fetches the distfiles
+which are missing or failed the checksum calculation.
+Defining
+.Va NO_CHECKSUM
+will skip this step.
+.It Cm depends
+Install
+(or compile if only compilation is necessary)
+any dependencies of the current port.
+When called by the
+.Cm extract
+or
+.Cm fetch
+targets, this is run in piecemeal as
+.Cm fetch-depends , build-depends ,
+etc.
+Defining
+.Va NO_DEPENDS
+will skip this step.
+.It Cm extract
+Expand the distfile into a work directory.
+.It Cm patch
+Apply any patches that are necessary for the port.
+.It Cm configure
+Configure the port.
+Some ports will ask you questions during this stage.
+See
+.Va INTERACTIVE
+and
+.Va BATCH .
+.It Cm build
+Build the port.
+This is the same as calling the
+.Cm all
+target.
+.It Cm install
+Install the port and register it with the package system.
+This is all you really need to do.
+.El
+.Pp
+The following targets are not run during the normal install process.
+.Bl -tag -width ".Cm fetch-recursive"
+.It Cm showconfig
+Display
+.Va OPTIONS
+config for this port.
+.It Cm showconfig-recursive
+Display
+.Va OPTIONS
+config for this port and all its dependencies.
+.It Cm rmconfig
+Remove
+.Va OPTIONS
+config for this port.
+.It Cm rmconfig-recursive
+Remove
+.Va OPTIONS
+config for this port and all its dependencies.
+.It Cm config-conditional
+Skip the ports which have already had their
+.Va OPTIONS
+configured.
+.It Cm config-recursive
+Configure
+.Va OPTIONS
+for this port and all its dependencies using
+.Xr dialog 1 .
+.It Cm fetch-list
+Show list of files to be fetched in order to build the port.
+.It Cm fetch-recursive
+Fetch the distfiles of the port and all its dependencies.
+.It Cm fetch-recursive-list
+Show list of files that would be retrieved by
+.Cm fetch-recursive .
+.It Cm run-depends-list , build-depends-list
+Print a list of all the compile and run dependencies, and dependencies
+of those dependencies, by port directory.
+.It Cm all-depends-list
+Print a list of all dependencies for the port.
+.It Cm pretty-print-run-depends-list , pretty-print-build-depends-list
+Print a list of all the compile and run dependencies, and dependencies
+of those dependencies, by port name and version.
+.It Cm missing
+Print a list of missing dependencies to be installed for the port.
+.It Cm clean
+Remove the expanded source code.
+This recurses to dependencies unless
+.Va NOCLEANDEPENDS
+is defined.
+.It Cm distclean
+Remove the port's distfiles and perform the
+.Cm clean
+target.
+The
+.Cm clean
+portion recurses to dependencies unless
+.Va NOCLEANDEPENDS
+is defined, but the
+.Cm distclean
+portion never recurses
+(this is perhaps a bug).
+.It Cm reinstall
+Use this to restore a port after using
+.Xr pkg_delete 1
+when you should have used
+.Cm deinstall .
+.It Cm deinstall
+Remove an installed port from the system, similar to
+.Xr pkg_delete 1 .
+.It Cm deinstall-all
+Remove all installed ports with the same
+.Va PKGORIGIN
+from the system.
+.It Cm package
+Make a binary package for the port.
+The port will be installed if it has not already been.
+The package is a
+.Pa .tbz
+file that you can use to
+install the port on other machines with
+.Xr pkg_add 1 .
+If the directory specified by
+.Va PACKAGES
+does not exist, the package will be put into the current directory.
+See
+.Va PKGREPOSITORY
+and
+.Va PKGFILE .
+.It Cm package-recursive
+Like
+.Cm package ,
+but makes a package for each depending port as well.
+.It Cm package-name
+Prints the name with version of the port.
+.It Cm readmes
+Create a port's
+.Pa README.html .
+This can be used from
+.Pa /usr/ports
+to create a browsable web of all ports on your system!
+.It Cm search
+Search the
+.Pa INDEX
+file for the pattern specified by the
+.Va key
+(searches the port name, comment, and dependencies),
+.Va name
+(searches the port name only),
+.Va path
+(searches the port path),
+.Va info
+(searches the port info),
+.Va maint
+(searches the port maintainer),
+.Va cat
+(searches the port category),
+.Va bdeps
+(searches the port build-time dependency),
+.Va rdeps
+(searches the port run-time dependency),
+.Va www
+(searches the port web site)
+.Xr make 1
+variables, and their exclusion counterparts:
+.Va xname , xkey
+etc.
+For example, one would type:
+.Pp
+.Dl "cd /usr/ports && make search name=query"
+.Pp
+to find all ports whose
+name matches
+.Dq Li query .
+Results include the matching ports' path, comment, maintainer,
+build dependencies, and run dependencies.
+.Bd -literal -offset indent
+cd /usr/ports && make search name=pear- \e
+ xbdeps=apache
+.Ed
+.Pp
+To find all ports whose
+names contain
+.Dq Li pear-
+and which do not have apache
+listed in build-time dependencies.
+.Bd -literal -offset indent
+cd /usr/ports && make search name=pear- \e
+ xname='ht(tp|ml)'
+.Ed
+.Pp
+To find all ports whose names contain
+.Dq Li pear- ,
+but not
+.Dq Li html
+or
+.Dq Li http .
+.Bd -literal -offset indent
+make search key=apache display=name,path,info keylim=1
+.Ed
+.Pp
+To find ports that contain
+.Dq Li apache
+in either of the name, path, info
+fields, ignore the rest of the record.
+.Pp
+By default the search is not case-sensitive.
+In order to make it case-sensitive you can use the
+.Va icase
+variable:
+.Bd -literal -offset indent
+make search name=p5-R icase=0
+.Ed
+.It Cm quicksearch
+Reduced
+.Cm search
+output.
+Only display name, path and info.
+.It Cm describe
+Generate a one-line description of each port for use in the
+.Pa INDEX
+file.
+.It Cm maintainer
+Display the port maintainer's email address.
+.It Cm index
+Create
+.Pa /usr/ports/INDEX ,
+which is used by the
+.Cm pretty-print-*
+and
+.Cm search
+targets.
+Running the
+.Cm index
+target will ensure your
+.Pa INDEX
+file is up to date with your ports tree.
+.It Cm fetchindex
+Fetch the
+.Pa INDEX
+file from the
+.Fx
+cluster.
+.El
+.Sh ENVIRONMENT
+You can change all of these.
+.Bl -tag -width ".Va MASTER_SITES"
+.It Va PORTSDIR
+Location of the ports tree.
+This is
+.Pa /usr/ports
+on
+.Fx
+and
+.Ox ,
+and
+.Pa /usr/pkgsrc
+on
+.Nx .
+.It Va WRKDIRPREFIX
+Where to create any temporary files.
+Useful if
+.Va PORTSDIR
+is read-only (perhaps mounted from a CD-ROM).
+.It Va DISTDIR
+Where to find/put distfiles, normally
+.Pa distfiles/
+in
+.Va PORTSDIR .
+.It Va PACKAGES
+Used only for the
+.Cm package
+target; the base directory for the packages tree, normally
+.Pa packages/
+in
+.Va PORTSDIR .
+If this directory exists, the package tree will be (partially) constructed.
+This directory does not have to exist; if it does not, packages will be
+placed into the current directory, or you can define one of
+.Bl -tag -width ".Va PKGREPOSITORY"
+.It Va PKGREPOSITORY
+Directory to put the package in.
+.It Va PKGFILE
+The full path to the package.
+.El
+.It Va LOCALBASE
+Where existing things are installed and where to search for files when
+resolving dependencies (usually
+.Pa /usr/local ) .
+.It Va PREFIX
+Where to install this port (usually set to the same as
+.Va LOCALBASE ) .
+.It Va MASTER_SITES
+Primary sites for distribution files if not found locally.
+.It Va PATCH_SITES
+Primary locations for distribution patch files if not found
+locally.
+.It Va MASTER_SITE_FREEBSD
+If set, go to the master
+.Fx
+site for all files.
+.It Va MASTER_SITE_OVERRIDE
+Try going to these sites for all files and patches, first.
+.It Va MASTER_SITE_BACKUP
+Try going to these sites for all files and patches, last.
+.It Va RANDOMIZE_MASTER_SITES
+Try the download locations in a random order.
+.It Va MASTER_SORT
+Sort the download locations according to user supplied pattern.
+Example:
+.Dl .dk .sunet.se .se dk.php.net .no .de heanet.dl.sourceforge.net
+.It Va MASTER_SITE_INDEX
+Where to get
+.Pa INDEX
+source built on
+.Fx
+cluster (for
+.Cm fetchindex
+target).
+Defaults to
+.Pa http://www.FreeBSD.org/ports/ .
+.It Va FETCHINDEX
+Command to get
+.Pa INDEX
+(for
+.Cm fetchindex
+target).
+Defaults to
+.Dq Nm fetch Fl am .
+.It Va NOCLEANDEPENDS
+If defined, do not let
+.Cm clean
+recurse to dependencies.
+.It Va FETCH_CMD
+Command to use to fetch files.
+Normally
+.Xr fetch 1 .
+.It Va FORCE_PKG_REGISTER
+If set, overwrite any existing package registration on the system.
+.It Va MOTIFLIB
+Location of
+.Pa libXm. Ns Brq Pa a , Ns Pa so .
+.It Va INTERACTIVE
+If defined, only operate on a port if it requires interaction.
+.It Va BATCH
+If defined, only operate on a port if it can be installed 100% automatically.
+.It Va DISABLE_VULNERABILITIES
+If defined, disable check for security vulnerabilities using
+.Xr portaudit 1 Pq Pa ports/ports-mgmt/portaudit
+when installing new ports.
+.It Va NO_IGNORE
+If defined, allow installation of ports marked as
+.Aq Va FORBIDDEN .
+The default behavior of the Ports framework is to abort when the
+installation of a forbidden port is attempted.
+Of course, these ports may not work as expected, but if you really know
+what you are doing and are sure about installing a forbidden port, then
+.Va NO_IGNORE
+lets you do it.
+.It Va NO_CHECKSUM
+If defined, skip verifying the port's checksum.
+.It Va TRYBROKEN
+If defined, attempt to build a port even if it is marked as
+.Aq Va BROKEN .
+.It Va PORT_DBDIR
+Directory where the results of configuring
+.Va OPTIONS
+are stored.
+Defaults to
+.Pa /var/db/ports .
+Each port where
+.Va OPTIONS
+have been configured will have a uniquely named sub-directory, containing a
+single file
+.Pa options .
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /usr/ports/Mk/bsd.port.mk" -compact
+.It Pa /usr/ports
+The default ports directory
+.No ( Fx
+and
+.Ox ) .
+.It Pa /usr/pkgsrc
+The default ports directory
+.Pq Nx .
+.It Pa /usr/ports/Mk/bsd.port.mk
+The big Kahuna.
+.El
+.Sh SEE ALSO
+.Xr make 1 ,
+.Xr pkg_add 1 ,
+.Xr pkg_create 1 ,
+.Xr pkg_delete 1 ,
+.Xr pkg_info 1 ,
+.Xr pkg_version 1
+.Pp
+The following are part of the ports collection:
+.Pp
+.Xr portaudit 1 ,
+.Xr portcheckout 1 ,
+.Xr portlint 1
+.Rs
+.%B "The FreeBSD Handbook"
+.Re
+.Pp
+.Pa http://www.FreeBSD.org/ports
+(searchable index of all ports)
+.Sh HISTORY
+The Ports Collection
+appeared in
+.Fx 1.0 .
+It has since spread to
+.Nx
+and
+.Ox .
+.Sh AUTHORS
+.An -nosplit
+This manual page was originated by
+.An David O'Brien .
+.Sh BUGS
+Ports documentation is split over four places \(em
+.Pa /usr/ports/Mk/bsd.port.mk ,
+.%B "The Porter's Handbook" ,
+the
+.Dq "Packages and Ports"
+chapter of
+.%B "The FreeBSD Handbook" ,
+and
+this manual page.
diff --git a/share/man/man7/release.7 b/share/man/man7/release.7
new file mode 100644
index 000000000000..a725fc627e44
--- /dev/null
+++ b/share/man/man7/release.7
@@ -0,0 +1,393 @@
+.\" Copyright (c) 2002 Murray Stokely <murray@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2012
+.Dt RELEASE 7
+.Os
+.Sh NAME
+.Nm release
+.Nd "release building infrastructure"
+.Sh DESCRIPTION
+.Fx
+provides a complete build environment suitable for users to make
+full releases of the
+.Fx
+operating system.
+All of the tools necessary to build a release are available from the
+.Fx
+source code repository in
+.Pa src/release .
+A complete release can actually be built with only a single command,
+including the creation of ISO images suitable for burning to CD-ROM,
+memory stick images, and an FTP install directory.
+This command is aptly named
+.Dq Li "make release" .
+.Pp
+For some users, it may be desirable to provide an absolutely clean
+build environment, with no local modifications to the source tree or to
+.Xr make.conf 5 ,
+and with clean checkouts of specific versions of the doc, src, and ports
+trees. For this purpose, a script
+.Pq Pa src/release/generate-release.sh
+is provided to automate these checkouts and then execute
+.Dq Li "make release"
+in a clean
+.Xr chroot 8 .
+.Pp
+Before attempting to build a release, the user is expected to be
+familiar with the contents of
+.Xr build 7 ,
+and should have experience upgrading systems from source.
+.Pp
+The release build process requires that
+.Pa /usr/obj
+be populated with the output of
+.Dq Li "make buildworld"
+and
+.Dq Li "make buildkernel" .
+This is necessary to provide the object files for the release or, when
+using
+.Pa generate-release.sh ,
+so that the object files for a complete system can be installed into a clean
+.Xr chroot 8
+environment. In this second case, the built world must be capable of running
+on the build system (i.e. it must be for the same architecture and be
+compatible with the installed kernel).
+The release procedure on some architectures may also require that the
+.Xr md 4
+(memory disk) device driver be present in the kernel
+(either by being compiled in or available as a module).
+.Pp
+This document does not cover source code management, quality
+assurance, or other aspects of the release engineering process.
+.Sh CLEAN RELEASE GENERATION
+Official releases of FreeBSD are produced in a totally clean environment to
+ensure consistency between the versions of the src, ports, and doc trees
+and to avoid contamination from the host system (e.g. local patches, changes
+to
+.Xr make.conf 5 ,
+etc.). This is accomplished using the wrapper script
+.Pa src/release/generate-release.sh .
+.Pp
+.Ic generate-release.sh
+svn-branch scratch-dir
+.Pp
+.Ic generate-release.sh
+calls
+.Dq Li "make installworld"
+to generate a
+.Xr chroot 8
+environment in
+.Ar scratch-dir .
+It then checks out the src tree specified by
+.Ar svn-branch
+using
+.Xr svn 1
+and (optionally) the ports and documentation trees using
+.Xr csup 1
+or
+.Xr cvs 1 .
+Once the various source trees have been obtained, it executes
+.Dq Li "make release"
+within the
+.Xr chroot 8
+environment and places the result in
+.Pa $scratch-dir/R .
+Note that because this uses a chroot, it cannot be used to cross-build
+.Fx
+release media.
+.Pp
+Environment variables:
+.Bl -tag -width ".Cm MAKE_FLAGS"
+.It Ev CVSUP_HOST
+The CVSUP server to use for the doc and ports trees. One of
+.Ev CVSUP_HOST
+or
+.Ev CVSROOT
+must be specified for ports and documentation to be included in the release.
+.It Ev CVSROOT
+The location of the
+.Fx
+CVS repository to use for the doc and ports trees. One of
+.Ev CVSUP_HOST
+or
+.Ev CVSROOT
+must be specified for ports and documentation to be included in the release.
+.It Ev CVS_TAG
+If the variable
+.Ev CVS_TAG
+is set, that tag will be used for CVS checkouts (doc and ports), otherwise
+.Ic generate-release.sh
+will use HEAD.
+.It Ev MAKE_FLAGS
+This environment variable can be set to pass flags (e.g. -j) to
+.Xr make 1
+when invoked by the script.
+.It Ev SVNROOT
+The location of the FreeBSD SVN source repository. Defaults to
+.Pa svn://svn.freebsd.org/base .
+.It Ev RELSTRING
+Optional base name for generated media images (e.g. FreeBSD-9.0-RC2-amd64).
+Defaults to the output of
+.Ic `uname -s`-`uname -r`-`uname -p`
+within the chroot.
+.El
+.Sh MAKEFILE TARGETS
+The release makefile
+.Pq Pa src/release/Makefile
+is fairly abstruse.
+Most developers will only be concerned with the
+.Cm release
+and
+.Cm install
+targets.
+.\" XXX: Some sort of introduction to this list? All the others have one.
+.Bl -tag -width ".Cm packagesystem"
+.It Cm release
+Meta-target to build all release media and distributions applicable to this
+platform.
+.It Cm install
+Copy all produced release media to
+.Pa ${DESTDIR} .
+.It Cm cdrom
+Builds installation CD-ROM images. On some systems, this may require that
+.Xr mkisofs 8
+be installed
+.Pq Pa sysutils/cdrtools
+and possibly that the
+.Xr md 4
+(memory disk) device driver be present in the kernel
+(either by being compiled in or available as a module). This target
+produces files called
+.Pa release.iso
+and
+.Pa bootonly.iso
+as its output.
+.It Cm memstick
+Builds an installation memory stick image named
+.Pa memstick .
+Not applicable on all platforms. Requires that the
+.Xr md 4
+(memory disk) device driver be present in the kernel
+(either by being compiled in or available as a module).
+.It Cm ftp
+Creates a directory named
+.Pa ftp
+containing the distribution files used in network installations
+and suitable for upload to an FTP mirror.
+.El
+.Pp
+Major subtargets called by targets above:
+.Bl -tag -width ".Cm packagesystem"
+.It Cm packagesystem
+Generates all the distribution archives (e.g. base, kernel, ports, doc)
+applicable on this platform.
+.It Cm system
+Builds a bootable installation system containing all the distribution files
+packaged by the
+.Cm packagesystem
+target, and suitable for imaging by the
+.Cm cdrom
+and
+.Cm memstick
+targets.
+.It Cm reldoc
+Builds the release documentation.
+This includes the release notes,
+hardware guide, and installation instructions. Other documentation (e.g.
+the Handbook) is built during the
+.Cm base.txz
+target invoked by
+.Cm packagesystem.
+.El
+.Sh ENVIRONMENT
+Optional variables:
+.Bl -tag -width ".Va TARGET_ARCH"
+.It Va WORLDDIR
+Location of a directory containing the src tree. By default, the directory
+above the one containing the makefile
+.Pq Pa src .
+.It Va PORTSDIR
+Location of a directory containing the ports tree. By default,
+.Pa /usr/ports .
+If it is unset or cannot be found, ports will not be included in the release.
+.It Va DOCDIR
+Location of a directory containing the doc tree. By default,
+.Pa /usr/doc .
+If it is unset or cannot be found, most documentation will not be included in
+the release; see
+.Ev NODOC
+below.
+.It Va NOPORTS
+If defined, the Ports Collection will be omitted from the release.
+.It Va NOSRC
+If set, do not include system source code in the release.
+.It Va NODOC
+If defined, the SGML-based documentation from the
+.Fx
+Documentation Project will not be built.
+However, the
+.Dq doc
+distribution will still be created with the minimal documentation set
+provided in
+.Pa src/share/doc .
+.It Va TARGET
+The target hardware platform.
+This is analogous to the
+.Dq Nm uname Fl m
+output.
+This is necessary to cross-build some target architectures.
+For example, cross-building for PC98 machines requires
+.Va TARGET_ARCH Ns = Ns Li i386
+and
+.Va TARGET Ns = Ns Li pc98 .
+If not set,
+.Va TARGET
+defaults to the current hardware platform.
+.It Va TARGET_ARCH
+The target machine processor architecture.
+This is analogous to the
+.Dq Nm uname Fl p
+output.
+Set this to cross-build for a different architecture.
+If not set,
+.Va TARGET_ARCH
+defaults to the current machine architecture, unless
+.Va TARGET
+is also set, in which case it defaults to the appropriate
+value for that platform.
+Typically, one only needs to set
+.Va TARGET .
+.El
+.Sh FILES
+.Bl -tag -compact
+.It Pa /usr/doc/Makefile
+.It Pa /usr/doc/share/mk/doc.project.mk
+.It Pa /usr/ports/Mk/bsd.port.mk
+.It Pa /usr/ports/Mk/bsd.sites.mk
+.It Pa /usr/share/examples/etc/make.conf
+.It Pa /usr/src/Makefile
+.It Pa /usr/src/Makefile.inc1
+.It Pa /usr/src/release/Makefile
+.It Pa /usr/src/release/generate-release.sh
+.El
+.Sh EXAMPLES
+The following sequence of commands can be used to build a
+.Dq "-CURRENT snapshot":
+.Bd -literal -offset indent
+cd /usr
+svn co svn://svn.freebsd.org/base/head src
+cd src
+make buildworld buildkernel
+cd release
+make release
+make install DESTDIR=/var/freebsd-snapshot
+.Ed
+.Pp
+After running these commands, all produced distribution files (tarballs
+for FTP, CD-ROM images, etc.) are available in the
+.Pa /var/freebsd-snapshot
+directory.
+.Pp
+The following sequence of commands can be used to build a
+.Dq "-CURRENT snapshot"
+in a clean environment, including ports and documentation:
+.Bd -literal -offset indent
+cd /usr/src/release
+export CVSUP_HOST=cvsupN.freebsd.org
+sh generate-release.sh head /local3/release
+.Ed
+.Pp
+After running these commands, all prepared release files are available in the
+.Pa /local3/release/R
+directory.
+.Sh SEE ALSO
+.Xr cc 1 ,
+.Xr cvs 1 ,
+.Xr install 1 ,
+.Xr make 1 ,
+.Xr svn 1 Pq Pa ports/devel/subversion-freebsd ,
+.Xr uname 1 ,
+.Xr md 4 ,
+.Xr make.conf 5 ,
+.Xr build 7 ,
+.Xr ports 7 ,
+.Xr chroot 8 ,
+.Xr mtree 8 ,
+.Xr sysctl 8
+.Rs
+.%T "FreeBSD Release Engineering"
+.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng/
+.Re
+.Rs
+.%T "FreeBSD Release Engineering of Third Party Packages"
+.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng-packages/
+.Re
+.Rs
+.%T "FreeBSD Developers' Handbook"
+.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
+.Re
+.Sh HISTORY
+.Fx
+1.x
+used a manual checklist, compiled by
+.An Rod Grimes ,
+to produce a release.
+Apart from being incomplete, the list put a lot of specific demands on
+available file systems and was quite torturous to execute.
+.Pp
+As part of the
+.Fx 2.0
+release engineering effort, significant
+effort was spent getting
+.Pa src/release/Makefile
+into a shape where it could at least automate most of the tediousness
+of building a release in a sterile environment.
+.Pp
+For the
+.Fx 9.0
+release,
+.Pa src/release/Makefile
+was overhauled and the wrapper script
+.Pa src/release/generate-release.sh
+introduced to support the introduction of a new installer.
+.Pp
+At near 1000 revisions spread over multiple branches, the
+.Xr cvs 1
+log of
+.Pa src/release/Makefile
+contains a vivid historical record of some
+of the hardships release engineers go through.
+.Sh AUTHORS
+.Pa src/release/Makefile
+was originally written by
+.An -nosplit
+.An Rod Grimes ,
+.An Jordan Hubbard ,
+and
+.An Poul-Henning Kamp .
+This manual page was written by
+.An Murray Stokely Aq murray@FreeBSD.org .
diff --git a/share/man/man7/sdoc.7 b/share/man/man7/sdoc.7
new file mode 100644
index 000000000000..a3c000dff3cb
--- /dev/null
+++ b/share/man/man7/sdoc.7
@@ -0,0 +1,241 @@
+.\" Copyright (c) 2001, 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The names of the authors may not be used to endorse or promote
+.\" products derived from this software without specific prior written
+.\" permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $Id: sec-doc.7,v 1.7 2001/12/22 00:14:12 rwatson Exp$
+.\" $FreeBSD$
+.\"
+.Dd September 5, 2005
+.Dt SDOC 7
+.Os
+.Sh NAME
+.Nm sdoc
+.Nd guide to adding security considerations sections to manual pages
+.Sh DESCRIPTION
+This document presents guidelines for
+adding security considerations sections to manual pages.
+It provides two typical examples.
+.Pp
+The guidelines for writing
+.Fx
+manual pages in
+.Xr groff_mdoc 7
+mandate that each manual page describing a feature of the
+.Fx
+system should contain a security considerations section
+describing what security requirements can be broken
+through the misuse of that feature.
+When writing these sections, authors should attempt to
+achieve a happy medium between two conflicting goals:
+brevity and completeness.
+On one hand, security consideration sections must not be too verbose,
+or busy readers might be dissuaded from reading them.
+On the other hand, security consideration sections must not be incomplete,
+or they will fail in their purpose of
+instructing the reader on how to avoid all insecure uses.
+This document provides guidelines for balancing brevity and completeness
+in the security consideration section for a given feature of the
+.Fx
+system.
+.Ss Where to Start
+Begin by listing
+those general security requirements that can be violated
+through the misuse of the feature.
+There are four classes of security requirements:
+.Bl -hang -offset indent
+.It Em integrity
+(example: non-administrators should not modify system binaries),
+.It Em confidentiality
+(example: non-administrators should not view the shadow password file),
+.It Em availability
+(example: the web server should respond to client requests in a timely
+fashion), and
+.It Em correctness
+(example: the ps program should provide exactly the process table
+information listing functionality described in its documentation - no more,
+no less.)
+.El
+.Pp
+A good security considerations section
+should explain how the feature can be misused
+to violate each general security requirement in the list.
+Each explanation should be accompanied by instructions
+the reader should follow in order to avoid a violation.
+When referencing potential vulnerabilities
+described in the Secure Programming Practices manual page,
+.Xr sprog 7 ,
+likewise cross-reference that document
+rather than replicating information.
+Whenever possible, refer to this document
+rather than reproducing the material it contains.
+.Ss Where to Stop
+Security problems are often interrelated;
+individual problems often have far-reaching implications.
+For example, the correctness of virtually any dynamically-linked program
+is dependent on the correct implementation and configuration
+of the run-time linker.
+The correctness of this program, in turn,
+depends on the correctness of its libraries,
+the compiler used to build it,
+the correctness of the preceding compiler that was used to build that compiler,
+and so on,
+as described by Thompson (see
+.Sx SEE ALSO ,
+below).
+.Pp
+Due to the need for brevity, security consideration sections
+should describe only those issues directly related to the feature
+that is the subject of the manual page.
+Refer to other manual pages
+rather than duplicating the material found there.
+.Sh EXAMPLES
+Security considerations sections for most individual functions can follow
+this simple formula:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+Provide one or two sentences describing each potential security
+problem.
+.It
+Provide one or two sentences describing how to avoid each potential
+security problem.
+.It
+Provide a short example in code.
+.El
+.Pp
+This is an example security considerations section for the
+.Xr strcpy 3
+manual page:
+.Pp
+The
+.Fn strcpy
+function is easily misused in a manner which enables malicious users
+to arbitrarily change a running program's functionality
+through a buffer overflow attack.
+.Pp
+Avoid using
+.Fn strcpy .
+Instead, use
+.Fn strncpy
+and ensure that no more characters are copied to the destination buffer
+than it can hold.
+Do not forget to NUL-terminate the destination buffer,
+as
+.Fn strncpy
+will not terminate the destination string if it is truncated.
+.Pp
+Note that
+.Fn strncpy
+can also be problematic.
+It may be a security concern for a string to be truncated at all.
+Since the truncated string will not be as long as the original,
+it may refer to a completely different resource
+and usage of the truncated resource
+could result in very incorrect behavior.
+Example:
+.Bd -literal
+void
+foo(const char *arbitrary_string)
+{
+ char onstack[8];
+
+#if defined(BAD)
+ /*
+ * This first strcpy is bad behavior. Do not use strcpy()!
+ */
+ (void)strcpy(onstack, arbitrary_string); /* BAD! */
+#elif defined(BETTER)
+ /*
+ * The following two lines demonstrate better use of
+ * strncpy().
+ */
+ (void)strncpy(onstack, arbitrary_string, sizeof(onstack) - 1);
+ onstack[sizeof(onstack - 1)] = '\\0';
+#elif defined(BEST)
+ /*
+ * These lines are even more robust due to testing for
+ * truncation.
+ */
+ if (strlen(arbitrary_string) + 1 > sizeof(onstack))
+ err(1, "onstack would be truncated");
+ (void)strncpy(onstack, arbitrary_string, sizeof(onstack));
+#endif
+}
+.Ed
+.Pp
+Security considerations sections for tools and commands
+are apt to be less formulaic.
+Let your list of potentially-violated security requirements
+be your guide;
+explain each one and list a solution in as concise a manner as possible.
+.Pp
+This is an example security considerations section for the
+.Xr rtld 1
+manual page:
+.Pp
+Using the LD_LIBRARY_PATH and LD_PRELOAD environment variables,
+malicious users can cause the dynamic linker
+to link shared libraries of their own devising
+into the address space of processes running non-set-user-ID/group-ID programs.
+These shared libraries can arbitrarily change the functionality
+of the program by replacing calls to standard library functions
+with calls to their own.
+Although this feature is disabled for set-user-ID and set-group-ID programs,
+it can still be used to create Trojan horses in other programs.
+.Pp
+All users should be aware that the correct operation of non
+set-user-ID/group-ID dynamically-linked programs depends on the proper
+configuration of these environment variables,
+and take care to avoid actions that might set them to values
+which would cause the run-time linker
+to link in shared libraries of unknown pedigree.
+.Sh SEE ALSO
+.Xr groff_mdoc 7 ,
+.Xr security 7 ,
+.Xr sprog 7
+.Rs
+.%A "Edward Amoroso, AT&T Bell Laboratories"
+.%B "Fundamentals of Computer Security Technology"
+.%I "P T R Prentice Hall"
+.%D "1994"
+.Re
+.Rs
+.%A "Ken Thompson"
+.%T "Reflections on Trusting Trust"
+.%J "Communications of the ACM"
+.%I "Association for Computing Machinery, Inc."
+.%P "761-763"
+.%N "Vol. 27, No. 8"
+.%D "August, 1984"
+.Re
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An "Tim Fraser, NAI Labs CBOSS project." Aq tfraser@tislabs.com
+.An "Brian Feldman, NAI Labs CBOSS project." Aq bfeldman@tislabs.com
diff --git a/share/man/man7/security.7 b/share/man/man7/security.7
new file mode 100644
index 000000000000..a3882d65bd0d
--- /dev/null
+++ b/share/man/man7/security.7
@@ -0,0 +1,1012 @@
+.\" Copyright (C) 1998 Matthew Dillon. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt SECURITY 7
+.Os
+.Sh NAME
+.Nm security
+.Nd introduction to security under FreeBSD
+.Sh DESCRIPTION
+Security is a function that begins and ends with the system administrator.
+While all
+.Bx
+multi-user systems have some inherent security, the job of building and
+maintaining additional security mechanisms to keep users
+.Dq honest
+is probably
+one of the single largest undertakings of the sysadmin.
+Machines are
+only as secure as you make them, and security concerns are ever competing
+with the human necessity for convenience.
+.Ux
+systems,
+in general, are capable of running a huge number of simultaneous processes
+and many of these processes operate as servers \(em meaning that external
+entities can connect and talk to them.
+As yesterday's mini-computers and mainframes
+become today's desktops, and as computers become networked and internetworked,
+security becomes an ever bigger issue.
+.Pp
+Security is best implemented through a layered onion approach.
+In a nutshell,
+what you want to do is to create as many layers of security as are convenient
+and then carefully monitor the system for intrusions.
+.Pp
+System security also pertains to dealing with various forms of attacks,
+including attacks that attempt to crash or otherwise make a system unusable
+but do not attempt to break root.
+Security concerns can be split up into
+several categories:
+.Bl -enum -offset indent
+.It
+Denial of Service attacks (DoS)
+.It
+User account compromises
+.It
+Root compromise through accessible servers
+.It
+Root compromise via user accounts
+.It
+Backdoor creation
+.El
+.Pp
+A denial of service attack is an action that deprives the machine of needed
+resources.
+Typically, DoS attacks are brute-force mechanisms that attempt
+to crash or otherwise make a machine unusable by overwhelming its servers or
+network stack.
+Some DoS attacks try to take advantages of bugs in the
+networking stack to crash a machine with a single packet.
+The latter can
+only be fixed by applying a bug fix to the kernel.
+Attacks on servers can
+often be fixed by properly specifying options to limit the load the servers
+incur on the system under adverse conditions.
+Brute-force network attacks are harder to deal with.
+A spoofed-packet attack, for example, is
+nearly impossible to stop short of cutting your system off from the Internet.
+It may not be able to take your machine down, but it can fill up your Internet
+pipe.
+.Pp
+A user account compromise is even more common than a DoS attack.
+Many
+sysadmins still run standard
+.Xr telnetd 8 ,
+.Xr rlogind 8 ,
+.Xr rshd 8 ,
+and
+.Xr ftpd 8
+servers on their machines.
+These servers, by default, do not operate over encrypted
+connections.
+The result is that if you have any moderate-sized user base,
+one or more of your users logging into your system from a remote location
+(which is the most common and convenient way to log in to a system)
+will have his or her password sniffed.
+The attentive system administrator will analyze
+his remote access logs looking for suspicious source addresses
+even for successful logins.
+.Pp
+One must always assume that once an attacker has access to a user account,
+the attacker can break root.
+However, the reality is that in a well secured
+and maintained system, access to a user account does not necessarily give the
+attacker access to root.
+The distinction is important because without access
+to root the attacker cannot generally hide his tracks and may, at best, be
+able to do nothing more than mess with the user's files or crash the machine.
+User account compromises are very common because users tend not to take the
+precautions that sysadmins take.
+.Pp
+System administrators must keep in mind that there are potentially many ways
+to break root on a machine.
+The attacker may know the root password,
+the attacker
+may find a bug in a root-run server and be able to break root over a network
+connection to that server, or the attacker may know of a bug in an SUID-root
+program that allows the attacker to break root once he has broken into a
+user's account.
+If an attacker has found a way to break root on a machine,
+the attacker may not have a need to install a backdoor.
+Many of the root holes found and closed to date involve a considerable amount
+of work by the attacker to clean up after himself, so most attackers do install
+backdoors.
+This gives you a convenient way to detect the attacker.
+Making
+it impossible for an attacker to install a backdoor may actually be detrimental
+to your security because it will not close off the hole the attacker used to
+break in originally.
+.Pp
+Security remedies should always be implemented with a multi-layered
+.Dq onion peel
+approach and can be categorized as follows:
+.Bl -enum -offset indent
+.It
+Securing root and staff accounts
+.It
+Securing root \(em root-run servers and SUID/SGID binaries
+.It
+Securing user accounts
+.It
+Securing the password file
+.It
+Securing the kernel core, raw devices, and file systems
+.It
+Quick detection of inappropriate changes made to the system
+.It
+Paranoia
+.El
+.Sh SECURING THE ROOT ACCOUNT AND SECURING STAFF ACCOUNTS
+Do not bother securing staff accounts if you have not secured the root
+account.
+Most systems have a password assigned to the root account.
+The
+first thing you do is assume that the password is
+.Em always
+compromised.
+This does not mean that you should remove the password.
+The
+password is almost always necessary for console access to the machine.
+What it does mean is that you should not make it possible to use the password
+outside of the console or possibly even with a
+.Xr su 1
+utility.
+For example, make sure that your PTYs are specified as being
+.Dq Li insecure
+in the
+.Pa /etc/ttys
+file
+so that direct root logins via
+.Xr telnet 1
+or
+.Xr rlogin 1
+are disallowed.
+If using
+other login services such as
+.Xr sshd 8 ,
+make sure that direct root logins are
+disabled there as well.
+Consider every access method \(em services such as
+.Xr ftp 1
+often fall through the cracks.
+Direct root logins should only be allowed
+via the system console.
+.Pp
+Of course, as a sysadmin you have to be able to get to root, so we open up
+a few holes.
+But we make sure these holes require additional password
+verification to operate.
+One way to make root accessible is to add appropriate
+staff accounts to the
+.Dq Li wheel
+group (in
+.Pa /etc/group ) .
+The staff members placed in the
+.Li wheel
+group are allowed to
+.Xr su 1
+to root.
+You should never give staff
+members native
+.Li wheel
+access by putting them in the
+.Li wheel
+group in their password entry.
+Staff accounts should be placed in a
+.Dq Li staff
+group, and then added to the
+.Li wheel
+group via the
+.Pa /etc/group
+file.
+Only those staff members who actually need to have root access
+should be placed in the
+.Li wheel
+group.
+It is also possible, when using an
+authentication method such as Kerberos, to use Kerberos's
+.Pa .k5login
+file in the root account to allow a
+.Xr ksu 1
+to root without having to place anyone at all in the
+.Li wheel
+group.
+This
+may be the better solution since the
+.Li wheel
+mechanism still allows an
+intruder to break root if the intruder has gotten hold of your password
+file and can break into a staff account.
+While having the
+.Li wheel
+mechanism
+is better than having nothing at all, it is not necessarily the safest
+option.
+.Pp
+An indirect way to secure the root account is to secure your staff accounts
+by using an alternative login access method and *'ing out the crypted password
+for the staff accounts.
+This way an intruder may be able to steal the password
+file but will not be able to break into any staff accounts or root, even if
+root has a crypted password associated with it (assuming, of course, that
+you have limited root access to the console).
+Staff members
+get into their staff accounts through a secure login mechanism such as
+.Xr kerberos 8
+or
+.Xr ssh 1
+using a private/public
+key pair.
+When you use something like Kerberos you generally must secure
+the machines which run the Kerberos servers and your desktop workstation.
+When you use a public/private key pair with SSH, you must generally secure
+the machine you are logging in
+.Em from
+(typically your workstation),
+but you can
+also add an additional layer of protection to the key pair by password
+protecting the keypair when you create it with
+.Xr ssh-keygen 1 .
+Being able
+to *-out the passwords for staff accounts also guarantees that staff members
+can only log in through secure access methods that you have set up.
+You can
+thus force all staff members to use secure, encrypted connections for
+all their sessions which closes an important hole used by many intruders: that
+of sniffing the network from an unrelated, less secure machine.
+.Pp
+The more indirect security mechanisms also assume that you are logging in
+from a more restrictive server to a less restrictive server.
+For example,
+if your main box is running all sorts of servers, your workstation should not
+be running any.
+In order for your workstation to be reasonably secure
+you should run as few servers as possible, up to and including no servers
+at all, and you should run a password-protected screen blanker.
+Of course, given physical access to
+a workstation, an attacker can break any sort of security you put on it.
+This is definitely a problem that you should consider but you should also
+consider the fact that the vast majority of break-ins occur remotely, over
+a network, from people who do not have physical access to your workstation or
+servers.
+.Pp
+Using something like Kerberos also gives you the ability to disable or
+change the password for a staff account in one place and have it immediately
+affect all the machines the staff member may have an account on.
+If a staff
+member's account gets compromised, the ability to instantly change his
+password on all machines should not be underrated.
+With discrete passwords, changing a password on N machines can be a mess.
+You can also impose
+re-passwording restrictions with Kerberos: not only can a Kerberos ticket
+be made to timeout after a while, but the Kerberos system can require that
+the user choose a new password after a certain period of time
+(say, once a month).
+.Sh SECURING ROOT \(em ROOT-RUN SERVERS AND SUID/SGID BINARIES
+The prudent sysadmin only runs the servers he needs to, no more, no less.
+Be aware that third party servers are often the most bug-prone.
+For example,
+running an old version of
+.Xr imapd 8
+or
+.Xr popper 8 Pq Pa ports/mail/popper
+is like giving a universal root
+ticket out to the entire world.
+Never run a server that you have not checked
+out carefully.
+Many servers do not need to be run as root.
+For example,
+the
+.Xr talkd 8 ,
+.Xr comsat 8 ,
+and
+.Xr fingerd 8
+daemons can be run in special user
+.Dq sandboxes .
+A sandbox is not perfect unless you go to a large amount of trouble, but the
+onion approach to security still stands: if someone is able to break in
+through a server running in a sandbox, they still have to break out of the
+sandbox.
+The more layers the attacker must break through, the lower the
+likelihood of his success.
+Root holes have historically been found in
+virtually every server ever run as root, including basic system servers.
+If you are running a machine through which people only log in via
+.Xr sshd 8
+and never log in via
+.Xr telnetd 8 ,
+.Xr rshd 8 ,
+or
+.Xr rlogind 8 ,
+then turn off those services!
+.Pp
+.Fx
+now defaults to running
+.Xr talkd 8 ,
+.Xr comsat 8 ,
+and
+.Xr fingerd 8
+in a sandbox.
+Another program which may be a candidate for running in a sandbox is
+.Xr named 8 .
+The default
+.Pa rc.conf
+includes the arguments necessary to run
+.Xr named 8
+in a sandbox in a commented-out form.
+Depending on whether you
+are installing a new system or upgrading an existing system, the special
+user accounts used by these sandboxes may not be installed.
+The prudent
+sysadmin would research and implement sandboxes for servers whenever possible.
+.Pp
+There are a number of other servers that typically do not run in sandboxes:
+.Xr sendmail 8 ,
+.Xr popper 8 ,
+.Xr imapd 8 ,
+.Xr ftpd 8 ,
+and others.
+There are alternatives to
+some of these, but installing them may require more work than you are willing
+to put
+(the convenience factor strikes again).
+You may have to run these
+servers as root and rely on other mechanisms to detect break-ins that might
+occur through them.
+.Pp
+The other big potential root hole in a system are the SUID-root and SGID
+binaries installed on the system.
+Most of these binaries, such as
+.Xr rlogin 1 ,
+reside in
+.Pa /bin , /sbin , /usr/bin ,
+or
+.Pa /usr/sbin .
+While nothing is 100% safe,
+the system-default SUID and SGID binaries can be considered reasonably safe.
+Still, root holes are occasionally found in these binaries.
+A root hole
+was found in Xlib in 1998 that made
+.Xr xterm 1 Pq Pa ports/x11/xterm
+(which is typically SUID)
+vulnerable.
+It is better to be safe than sorry and the prudent sysadmin will restrict SUID
+binaries that only staff should run to a special group that only staff can
+access, and get rid of
+.Pq Dq Li "chmod 000"
+any SUID binaries that nobody uses.
+A server with no display generally does not need an
+.Xr xterm 1
+binary.
+SGID binaries can be almost as dangerous.
+If an intruder can break an SGID-kmem binary the
+intruder might be able to read
+.Pa /dev/kmem
+and thus read the crypted password
+file, potentially compromising any passworded account.
+Alternatively an
+intruder who breaks group
+.Dq Li kmem
+can monitor keystrokes sent through PTYs,
+including PTYs used by users who log in through secure methods.
+An intruder
+that breaks the
+.Dq Li tty
+group can write to almost any user's TTY.
+If a user
+is running a terminal
+program or emulator with a keyboard-simulation feature, the intruder can
+potentially
+generate a data stream that causes the user's terminal to echo a command, which
+is then run as that user.
+.Sh SECURING USER ACCOUNTS
+User accounts are usually the most difficult to secure.
+While you can impose
+draconian access restrictions on your staff and *-out their passwords, you
+may not be able to do so with any general user accounts you might have.
+If
+you do have sufficient control then you may win out and be able to secure the
+user accounts properly.
+If not, you simply have to be more vigilant in your
+monitoring of those accounts.
+Use of SSH and Kerberos for user accounts is
+more problematic due to the extra administration and technical support
+required, but still a very good solution compared to a crypted password
+file.
+.Sh SECURING THE PASSWORD FILE
+The only sure fire way is to *-out as many passwords as you can and
+use SSH or Kerberos for access to those accounts.
+Even though the
+crypted password file
+.Pq Pa /etc/spwd.db
+can only be read by root, it may
+be possible for an intruder to obtain read access to that file even if the
+attacker cannot obtain root-write access.
+.Pp
+Your security scripts should always check for and report changes to
+the password file
+(see
+.Sx CHECKING FILE INTEGRITY
+below).
+.Sh SECURING THE KERNEL CORE, RAW DEVICES, AND FILE SYSTEMS
+If an attacker breaks root he can do just about anything, but there
+are certain conveniences.
+For example, most modern kernels have a packet sniffing device driver built in.
+Under
+.Fx
+it is called
+the
+.Xr bpf 4
+device.
+An intruder will commonly attempt to run a packet sniffer
+on a compromised machine.
+You do not need to give the intruder the
+capability and most systems should not have the
+.Xr bpf 4
+device compiled in.
+.Pp
+But even if you turn off the
+.Xr bpf 4
+device, you still have
+.Pa /dev/mem
+and
+.Pa /dev/kmem
+to worry about.
+For that matter,
+the intruder can still write to raw disk devices.
+Also, there is another kernel feature called the module loader,
+.Xr kldload 8 .
+An enterprising intruder can use a KLD module to install
+his own
+.Xr bpf 4
+device or other sniffing device on a running kernel.
+To avoid these problems you have to run
+the kernel at a higher security level, at least level 1.
+The security level can be set with a
+.Xr sysctl 8
+on the
+.Va kern.securelevel
+variable.
+Once you have
+set the security level to 1, write access to raw devices will be denied and
+special
+.Xr chflags 1
+flags, such as
+.Cm schg ,
+will be enforced.
+You must also ensure
+that the
+.Cm schg
+flag is set on critical startup binaries, directories, and
+script files \(em everything that gets run
+up to the point where the security level is set.
+This might be overdoing it, and upgrading the system is much more
+difficult when you operate at a higher security level.
+You may compromise and
+run the system at a higher security level but not set the
+.Cm schg
+flag for every
+system file and directory under the sun.
+Another possibility is to simply
+mount
+.Pa /
+and
+.Pa /usr
+read-only.
+It should be noted that being too draconian in
+what you attempt to protect may prevent the all-important detection of an
+intrusion.
+.Pp
+The kernel runs with five different security levels.
+Any super-user process can raise the level, but no process
+can lower it.
+The security levels are:
+.Bl -tag -width flag
+.It Ic -1
+Permanently insecure mode \- always run the system in insecure mode.
+This is the default initial value.
+.It Ic 0
+Insecure mode \- immutable and append-only flags may be turned off.
+All devices may be read or written subject to their permissions.
+.It Ic 1
+Secure mode \- the system immutable and system append-only flags may not
+be turned off;
+disks for mounted file systems,
+.Pa /dev/mem
+and
+.Pa /dev/kmem
+may not be opened for writing;
+.Pa /dev/io
+(if your platform has it) may not be opened at all;
+kernel modules (see
+.Xr kld 4 )
+may not be loaded or unloaded.
+The kernel debugger may not be entered using the
+.Va debug.kdb.enter
+sysctl.
+A panic or trap cannot be forced using the
+.Va debug.kdb.panic
+and other sysctl's.
+.It Ic 2
+Highly secure mode \- same as secure mode, plus disks may not be
+opened for writing (except by
+.Xr mount 2 )
+whether mounted or not.
+This level precludes tampering with file systems by unmounting them,
+but also inhibits running
+.Xr newfs 8
+while the system is multi-user.
+.Pp
+In addition, kernel time changes are restricted to less than or equal to one
+second.
+Attempts to change the time by more than this will log the message
+.Dq Time adjustment clamped to +1 second .
+.It Ic 3
+Network secure mode \- same as highly secure mode, plus
+IP packet filter rules (see
+.Xr ipfw 8 ,
+.Xr ipfirewall 4
+and
+.Xr pfctl 8 )
+cannot be changed and
+.Xr dummynet 4
+or
+.Xr pf 4
+configuration cannot be adjusted.
+.El
+.Pp
+The security level can be configured with variables documented in
+.Xr rc.conf 5 .
+.Sh CHECKING FILE INTEGRITY: BINARIES, CONFIG FILES, ETC
+When it comes right down to it, you can only protect your core system
+configuration and control files so much before the convenience factor
+rears its ugly head.
+For example, using
+.Xr chflags 1
+to set the
+.Cm schg
+bit on most of the files in
+.Pa /
+and
+.Pa /usr
+is probably counterproductive because
+while it may protect the files, it also closes a detection window.
+The
+last layer of your security onion is perhaps the most important \(em detection.
+The rest of your security is pretty much useless (or, worse, presents you with
+a false sense of safety) if you cannot detect potential incursions.
+Half
+the job of the onion is to slow down the attacker rather than stop him
+in order to give the detection layer a chance to catch him in
+the act.
+.Pp
+The best way to detect an incursion is to look for modified, missing, or
+unexpected files.
+The best
+way to look for modified files is from another (often centralized)
+limited-access system.
+Writing your security scripts on the extra-secure limited-access system
+makes them mostly invisible to potential attackers, and this is important.
+In order to take maximum advantage you generally have to give the
+limited-access box significant access to the other machines in the business,
+usually either by doing a read-only NFS export of the other machines to the
+limited-access box, or by setting up SSH keypairs to allow the limit-access
+box to SSH to the other machines.
+Except for its network traffic, NFS is
+the least visible method \(em allowing you to monitor the file systems on each
+client box virtually undetected.
+If your
+limited-access server is connected to the client boxes through a switch,
+the NFS method is often the better choice.
+If your limited-access server
+is connected to the client boxes through a hub or through several layers
+of routing, the NFS method may be too insecure (network-wise) and using SSH
+may be the better choice even with the audit-trail tracks that SSH lays.
+.Pp
+Once you give a limit-access box at least read access to the client systems
+it is supposed to monitor, you must write scripts to do the actual
+monitoring.
+Given an NFS mount, you can write scripts out of simple system
+utilities such as
+.Xr find 1
+and
+.Xr md5 1 .
+It is best to physically
+.Xr md5 1
+the client-box files boxes at least once a
+day, and to test control files such as those found in
+.Pa /etc
+and
+.Pa /usr/local/etc
+even more often.
+When mismatches are found relative to the base MD5
+information the limited-access machine knows is valid, it should scream at
+a sysadmin to go check it out.
+A good security script will also check for
+inappropriate SUID binaries and for new or deleted files on system partitions
+such as
+.Pa /
+and
+.Pa /usr .
+.Pp
+When using SSH rather than NFS, writing the security script is much more
+difficult.
+You essentially have to
+.Xr scp 1
+the scripts to the client box in order to run them, making them visible, and
+for safety you also need to
+.Xr scp 1
+the binaries (such as
+.Xr find 1 )
+that those scripts use.
+The
+.Xr sshd 8
+daemon on the client box may already be compromised.
+All in all,
+using SSH may be necessary when running over unsecure links, but it is also a
+lot harder to deal with.
+.Pp
+A good security script will also check for changes to user and staff members
+access configuration files:
+.Pa .rhosts , .shosts , .ssh/authorized_keys
+and so forth, files that might fall outside the purview of the MD5 check.
+.Pp
+If you have a huge amount of user disk space it may take too long to run
+through every file on those partitions.
+In this case, setting mount
+flags to disallow SUID binaries on those partitions is a good
+idea.
+The
+.Cm nosuid
+option
+(see
+.Xr mount 8 )
+is what you want to look into.
+I would scan them anyway at least once a
+week, since the object of this layer is to detect a break-in whether or
+not the break-in is effective.
+.Pp
+Process accounting
+(see
+.Xr accton 8 )
+is a relatively low-overhead feature of
+the operating system which I recommend using as a post-break-in evaluation
+mechanism.
+It is especially useful in tracking down how an intruder has
+actually broken into a system, assuming the file is still intact after
+the break-in occurs.
+.Pp
+Finally, security scripts should process the log files and the logs themselves
+should be generated in as secure a manner as possible \(em remote syslog can be
+very useful.
+An intruder tries to cover his tracks, and log files are critical
+to the sysadmin trying to track down the time and method of the initial
+break-in.
+One way to keep a permanent record of the log files is to run
+the system console to a serial port and collect the information on a
+continuing basis through a secure machine monitoring the consoles.
+.Sh PARANOIA
+A little paranoia never hurts.
+As a rule, a sysadmin can add any number
+of security features as long as they do not affect convenience, and
+can add security features that do affect convenience with some added
+thought.
+Even more importantly, a security administrator should mix it up
+a bit \(em if you use recommendations such as those given by this manual
+page verbatim, you give away your methodologies to the prospective
+attacker who also has access to this manual page.
+.Sh SPECIAL SECTION ON DoS ATTACKS
+This section covers Denial of Service attacks.
+A DoS attack is typically a packet attack.
+While there is not much you can do about modern spoofed
+packet attacks that saturate your network, you can generally limit the damage
+by ensuring that the attacks cannot take down your servers.
+.Bl -enum -offset indent
+.It
+Limiting server forks
+.It
+Limiting springboard attacks (ICMP response attacks, ping broadcast, etc.)
+.It
+Kernel Route Cache
+.El
+.Pp
+A common DoS attack is against a forking server that attempts to cause the
+server to eat processes, file descriptors, and memory until the machine
+dies.
+The
+.Xr inetd 8
+server
+has several options to limit this sort of attack.
+It should be noted that while it is possible to prevent a machine from going
+down it is not generally possible to prevent a service from being disrupted
+by the attack.
+Read the
+.Xr inetd 8
+manual page carefully and pay specific attention
+to the
+.Fl c , C ,
+and
+.Fl R
+options.
+Note that spoofed-IP attacks will circumvent
+the
+.Fl C
+option to
+.Xr inetd 8 ,
+so typically a combination of options must be used.
+Some standalone servers have self-fork-limitation parameters.
+.Pp
+The
+.Xr sendmail 8
+daemon has its
+.Fl OMaxDaemonChildren
+option which tends to work much
+better than trying to use
+.Xr sendmail 8 Ns 's
+load limiting options due to the
+load lag.
+You should specify a
+.Va MaxDaemonChildren
+parameter when you start
+.Xr sendmail 8
+high enough to handle your expected load but not so high that the
+computer cannot handle that number of
+.Nm sendmail Ns 's
+without falling on its face.
+It is also prudent to run
+.Xr sendmail 8
+in
+.Dq queued
+mode
+.Pq Fl ODeliveryMode=queued
+and to run the daemon
+.Pq Dq Nm sendmail Fl bd
+separate from the queue-runs
+.Pq Dq Nm sendmail Fl q15m .
+If you still want real-time delivery you can run the queue
+at a much lower interval, such as
+.Fl q1m ,
+but be sure to specify a reasonable
+.Va MaxDaemonChildren
+option for that
+.Xr sendmail 8
+to prevent cascade failures.
+.Pp
+The
+.Xr syslogd 8
+daemon can be attacked directly and it is strongly recommended that you use
+the
+.Fl s
+option whenever possible, and the
+.Fl a
+option otherwise.
+.Pp
+You should also be fairly careful
+with connect-back services such as tcpwrapper's reverse-identd, which can
+be attacked directly.
+You generally do not want to use the reverse-ident
+feature of tcpwrappers for this reason.
+.Pp
+It is a very good idea to protect internal services from external access
+by firewalling them off at your border routers.
+The idea here is to prevent
+saturation attacks from outside your LAN, not so much to protect internal
+services from network-based root compromise.
+Always configure an exclusive
+firewall, i.e.,
+.So
+firewall everything
+.Em except
+ports A, B, C, D, and M-Z
+.Sc .
+This
+way you can firewall off all of your low ports except for certain specific
+services such as
+.Xr named 8
+(if you are primary for a zone),
+.Xr talkd 8 ,
+.Xr sendmail 8 ,
+and other internet-accessible services.
+If you try to configure the firewall the other
+way \(em as an inclusive or permissive firewall, there is a good chance that you
+will forget to
+.Dq close
+a couple of services or that you will add a new internal
+service and forget to update the firewall.
+You can still open up the
+high-numbered port range on the firewall to allow permissive-like operation
+without compromising your low ports.
+Also take note that
+.Fx
+allows you to
+control the range of port numbers used for dynamic binding via the various
+.Va net.inet.ip.portrange
+sysctl's
+.Pq Dq Li "sysctl net.inet.ip.portrange" ,
+which can also
+ease the complexity of your firewall's configuration.
+I usually use a normal
+first/last range of 4000 to 5000, and a hiport range of 49152 to 65535, then
+block everything under 4000 off in my firewall
+(except for certain specific
+internet-accessible ports, of course).
+.Pp
+Another common DoS attack is called a springboard attack \(em to attack a server
+in a manner that causes the server to generate responses which then overload
+the server, the local network, or some other machine.
+The most common attack
+of this nature is the ICMP PING BROADCAST attack.
+The attacker spoofs ping
+packets sent to your LAN's broadcast address with the source IP address set
+to the actual machine they wish to attack.
+If your border routers are not
+configured to stomp on ping's to broadcast addresses, your LAN winds up
+generating sufficient responses to the spoofed source address to saturate the
+victim, especially when the attacker uses the same trick on several dozen
+broadcast addresses over several dozen different networks at once.
+Broadcast attacks of over a hundred and twenty megabits have been measured.
+A second common springboard attack is against the ICMP error reporting system.
+By
+constructing packets that generate ICMP error responses, an attacker can
+saturate a server's incoming network and cause the server to saturate its
+outgoing network with ICMP responses.
+This type of attack can also crash the
+server by running it out of
+.Vt mbuf Ns 's ,
+especially if the server cannot drain the
+ICMP responses it generates fast enough.
+The
+.Fx
+kernel has a new kernel
+compile option called
+.Dv ICMP_BANDLIM
+which limits the effectiveness of these
+sorts of attacks.
+The last major class of springboard attacks is related to
+certain internal
+.Xr inetd 8
+services such as the UDP echo service.
+An attacker
+simply spoofs a UDP packet with the source address being server A's echo port,
+and the destination address being server B's echo port, where server A and B
+are both on your LAN.
+The two servers then bounce this one packet back and
+forth between each other.
+The attacker can overload both servers and their
+LANs simply by injecting a few packets in this manner.
+Similar problems
+exist with the internal chargen port.
+A competent sysadmin will turn off all
+of these
+.Xr inetd 8 Ns -internal
+test services.
+.Pp
+Spoofed packet attacks may also be used to overload the kernel route cache.
+Refer to the
+.Va net.inet.ip.rtexpire , net.inet.ip.rtminexpire ,
+and
+.Va net.inet.ip.rtmaxcache
+.Xr sysctl 8
+variables.
+A spoofed packet attack that uses a random source IP will cause
+the kernel to generate a temporary cached route in the route table, viewable
+with
+.Dq Li "netstat -rna | fgrep W3" .
+These routes typically timeout in 1600
+seconds or so.
+If the kernel detects that the cached route table has gotten
+too big it will dynamically reduce the
+.Va rtexpire
+but will never decrease it to
+less than
+.Va rtminexpire .
+There are two problems: (1) The kernel does not react
+quickly enough when a lightly loaded server is suddenly attacked, and (2) The
+.Va rtminexpire
+is not low enough for the kernel to survive a sustained attack.
+If your servers are connected to the internet via a T3 or better it may be
+prudent to manually override both
+.Va rtexpire
+and
+.Va rtminexpire
+via
+.Xr sysctl 8 .
+Never set either parameter to zero
+(unless you want to crash the machine :-)).
+Setting both parameters to 2 seconds should be sufficient to protect the route
+table from attack.
+.Sh ACCESS ISSUES WITH KERBEROS AND SSH
+There are a few issues with both Kerberos and SSH that need to be addressed
+if you intend to use them.
+Kerberos5 is an excellent authentication
+protocol but the kerberized
+.Xr telnet 1
+and
+.Xr rlogin 1
+suck rocks.
+There are bugs that make them unsuitable for dealing with binary streams.
+Also, by default
+Kerberos does not encrypt a session unless you use the
+.Fl x
+option.
+SSH encrypts everything by default.
+.Pp
+SSH works quite well in every respect except when it is set up to
+forward encryption keys.
+What this means is that if you have a secure workstation holding
+keys that give you access to the rest of the system, and you
+.Xr ssh 1
+to an
+unsecure machine, your keys become exposed.
+The actual keys themselves are
+not exposed, but
+.Xr ssh 1
+installs a forwarding port for the duration of your
+login and if an attacker has broken root on the unsecure machine he can utilize
+that port to use your keys to gain access to any other machine that your
+keys unlock.
+.Pp
+We recommend that you use SSH in combination with Kerberos whenever possible
+for staff logins.
+SSH can be compiled with Kerberos support.
+This reduces
+your reliance on potentially exposable SSH keys while at the same time
+protecting passwords via Kerberos.
+SSH keys
+should only be used for automated tasks from secure machines (something
+that Kerberos is unsuited to).
+We also recommend that you either turn off
+key-forwarding in the SSH configuration, or that you make use of the
+.Va from Ns = Ns Ar IP/DOMAIN
+option that SSH allows in its
+.Pa authorized_keys
+file to make the key only usable to entities logging in from specific
+machines.
+.Sh SEE ALSO
+.Xr chflags 1 ,
+.Xr find 1 ,
+.Xr md5 1 ,
+.Xr netstat 1 ,
+.Xr openssl 1 ,
+.Xr ssh 1 ,
+.Xr xdm 1 Pq Pa ports/x11/xorg-clients ,
+.Xr group 5 ,
+.Xr ttys 5 ,
+.Xr accton 8 ,
+.Xr init 8 ,
+.Xr sshd 8 ,
+.Xr sysctl 8 ,
+.Xr syslogd 8 ,
+.Xr vipw 8
+.Sh HISTORY
+The
+.Nm
+manual page was originally written by
+.An Matthew Dillon
+and first appeared
+in
+.Fx 3.1 ,
+December 1998.
diff --git a/share/man/man7/sprog.7 b/share/man/man7/sprog.7
new file mode 100644
index 000000000000..cde04b2f7cbb
--- /dev/null
+++ b/share/man/man7/sprog.7
@@ -0,0 +1,180 @@
+.\"
+.\" Copyright (c) 2001 Eric Melville <eric@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 3, 2001
+.Dt SPROG 7
+.Os
+.Sh NAME
+.Nm sprog
+.Nd secure programming practices
+.Sh DESCRIPTION
+Security issues have crept into many systems over the years.
+This document is a guide for programming practices that prevent these problems.
+.Ss Overview
+Writing secure applications takes a very scrutinous and pessimistic outlook.
+Applications should be run with the principle of
+.Dq Li least privilege
+so that no process is ever running with more than the bare minimum access it
+needs to accomplish its function.
+Previously tested code should be reused whenever possible.
+Generally, anything beyond the control of a program should never be trusted.
+This includes all forms of user input, system resources, interprocess
+communication, and the timing of events.
+.Ss Buffer Overflows
+One of the most common types of security problems is the buffer overflow.
+In short, if a program is not careful with the data it receives, it may be
+possible for this data to be written across memory, overwriting the return
+address for a function call, and the program will be forced to run code that
+does unfriendly things.
+.Pp
+A good number of functions in the standard C library make it difficult or
+even impossible to prevent buffer overflows when used.
+These include
+.Xr fscanf 3 ,
+.Xr gets 3 ,
+.Xr getwd 3 ,
+.Xr realpath 3 ,
+.Xr scanf 3 ,
+.Xr sprintf 3 ,
+.Xr strcat 3 ,
+.Xr strcpy 3 ,
+.Xr vscanf 3 ,
+and
+.Xr vsprintf 3 .
+.Pp
+Many other functions that deal with strings can also open up a potential
+buffer overflow when not used carefully.
+For example,
+.Xr strncat 3
+does not go out of its way to provide
+.Tn NUL
+character termination.
+Of course, the proper length must always be specified.
+Usage of
+.Xr strlcat 3
+and
+.Xr strlcpy 3
+ensure that strings are null terminated and of the specified length.
+.Pp
+Functions that receive a string format must also be used carefully.
+It is possible for a string to contain additional format specifiers, which
+open up another possibility for a buffer overflow.
+Never pass a string with untrusted data without using
+.Ql %s .
+Always use the proper secure idiom:
+.Pp
+.Dl function("%s", string);
+.Pp
+There are mechanisms that provide a backstop for these problems at the
+library and compiler levels, however, there is no substitute for simply
+writing good code.
+.Ss Set-user-ID Issues
+In many cases, it may be necessary for a program to operate with an increased
+set of permissions.
+Reasons for this include binding to protected sockets, reading and writing
+certain files and directories, and access to various resources.
+Using a setuid program is frequently the solution.
+However, it is important that programs give up these privileges as soon as
+possible.
+For example, if a program is binding to a protected socket, it should give
+up its privileges as soon as it has finished binding to that socket.
+This is accomplished with the
+.Xr setuid 2
+family of system calls.
+.Ss Limited Environments
+The traditional method of restricting a process is with the
+.Xr chroot 2
+system call.
+This system call changes the root directory from which all other paths are
+referenced for a process and any child processes.
+Of course, the process must have access to this path to begin with.
+The new environment does not actually take effect until
+.Xr chdir 2
+is called to place the process into the new environment.
+Unfortunately, a process can break out of this environment if root access is
+obtained.
+.Pp
+Often,
+.Xr jail 2
+can be used to create a more complete and enclosed environment than
+.Xr chroot 2
+can provide.
+A jail limits all processes inside that environment, including processes with
+superuser privileges.
+.Pp
+Fine grained privileges, as described by
+.Tn POSIX Ns .1e
+extensions, are currently a work in progress, and the focus of the
+.Tn TrustedBSD
+Project.
+More information can be found at
+.Pa http://www.TrustedBSD.org/ .
+.Ss Trust
+Programs should not make assumptions about the environment in which they are
+running.
+This includes user input, signals, environment variables, system resources,
+interprocess communications, and shared memory, amongst other things that are
+beyond the control of the program.
+They should not assume that all forms of invalid data can be detected either.
+Instead, they should use positive filtering, and only allow a specific subset
+of inputs that are known to be safe.
+This is the same logic that an administrator should apply to a firewall, that
+is, deny by default and specify what is to be accepted.
+.Ss Race Conditions
+A race condition is anomalous behavior caused by the relative timing of
+events.
+Programs should not assume that a particular event will occur before another.
+The most common causes of race conditions are signals, access checks, and
+file reads.
+Signals are asynchronous by nature, so special care must be taken
+while dealing with them.
+Attempting to check access with sequential non-atomic operations is a very
+bad idea, as files can be moved and changed at any given time.
+Instead of using a sequence of
+.Xr access 2
+and
+.Xr open 2 ,
+use
+.Xr seteuid 2
+and then call
+.Xr open 2
+directly.
+Set
+.Xr umask 2
+properly beforehand.
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr setuid 2 ,
+.Xr strlcat 3 ,
+.Xr strlcpy 3
+.Sh AUTHORS
+.An -nosplit
+.An Eric Melville Aq eric@FreeBSD.org
+originally wrote this document based on a chapter of the
+.%B "FreeBSD Developer's Handbook"
+written by
+.An Murray Stokely Aq murray@FreeBSD.org .
diff --git a/share/man/man7/stdint.7 b/share/man/man7/stdint.7
new file mode 100644
index 000000000000..2f36953d9a16
--- /dev/null
+++ b/share/man/man7/stdint.7
@@ -0,0 +1,136 @@
+.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2002
+.Dt STDINT 7
+.Os
+.Sh NAME
+.Nm stdint
+.Nd "standard integer types"
+.Sh SYNOPSIS
+.In stdint.h
+.Sh DESCRIPTION
+The
+.In stdint.h
+header provides source-portable integer types of a specific
+size, smallest memory footprint with a minimum size, fastest
+access speed with a minimum size, largest integer size, and
+those capable of storing pointers.
+.Pp
+The types
+.Vt int8_t ,
+.Vt int16_t ,
+.Vt int32_t ,
+and
+.Vt int64_t
+provide a signed integer type of width 8, 16, 32, or 64 bits, respectively.
+The types
+.Vt uint8_t ,
+.Vt uint16_t ,
+.Vt uint32_t ,
+and
+.Vt uint64_t
+provide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.
+These integer types should be used when a specific size is required.
+.Pp
+The types
+.Vt int_fast8_t ,
+.Vt int_fast16_t ,
+.Vt int_fast32_t ,
+and
+.Vt int_fast64_t
+provide the fastest signed integer type with a width
+of at least 8, 16, 32, or 64 bits, respectively.
+The types
+.Vt uint_fast8_t ,
+.Vt uint_fast16_t ,
+.Vt uint_fast32_t ,
+and
+.Vt uint_fast64_t
+provide the fastest unsigned integer type with a width
+of at least 8, 16, 32, or 64 bits, respectively.
+These types should be used when access speed is
+paramount, and when a specific size is not required.
+.Pp
+The types
+.Vt int_least8_t ,
+.Vt int_least16_t ,
+.Vt int_least32_t ,
+and
+.Vt int_least64_t
+provide the smallest memory footprint signed integer type with
+a width of at least 8, 16, 32, or 64 bits, respectively.
+The types
+.Vt uint_least8_t ,
+.Vt uint_least16_t ,
+.Vt uint_least32_t ,
+and
+.Vt uint_least64_t
+provide the smallest memory footprint unsigned integer type with
+a width of at least 8, 16, 32, or 64 bits, respectively.
+These types should be used when memory storage is of
+concern, and when a specific size is not required.
+.Pp
+The type
+.Vt intmax_t
+provides a signed integer type large
+enough to hold any other signed integer.
+The type
+.Vt uintmax_t
+provides an unsigned integer type large
+enough to hold any other unsigned integer.
+These types are generally the largest signed and unsigned
+integer types available on a specific architecture.
+.Pp
+The type
+.Vt intptr_t
+provides a signed integer type with the ability to hold a pointer to
+.Vt void ,
+that can later be converted back to a pointer to
+.Vt void .
+.Pp
+The type
+.Vt uintptr_t
+provides an unsigned integer type with the ability to hold a pointer to
+.Vt void ,
+that can later be converted back to a pointer to
+.Vt void .
+.Pp
+Additionally, the
+.In stdint.h
+header defines some macros, but none of them are documented here.
+.Sh STANDARDS
+The
+.In stdint.h
+header conforms to
+.St -isoC-99
+and
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.In stdint.h
+header was first introduced in
+.Fx 5.0 .
diff --git a/share/man/man7/sticky.7 b/share/man/man7/sticky.7
new file mode 100644
index 000000000000..0f066036c47e
--- /dev/null
+++ b/share/man/man7/sticky.7
@@ -0,0 +1,82 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)sticky.8 8.1 (Berkeley) 6/5/93
+.\" $FreeBSD$
+.\"
+.Dd June 5, 1993
+.Dt STICKY 7
+.Os
+.Sh NAME
+.Nm sticky
+.Nd sticky text and append-only directories
+.Sh DESCRIPTION
+A special file mode, called the
+.Em sticky bit
+(mode S_ISTXT),
+is used to indicate special treatment
+for directories.
+It is ignored for regular files.
+See
+.Xr chmod 2
+or
+the file
+.In sys/stat.h
+for an explanation of file modes.
+.Sh STICKY DIRECTORIES
+A directory whose `sticky bit' is set
+becomes an append-only directory, or, more accurately,
+a directory in which the deletion of files is restricted.
+A file in a sticky directory may only be removed or renamed
+by a user if the user has write permission for the directory and
+the user is the owner of the file, the owner of the directory,
+or the super-user.
+This feature is usefully applied to directories such as
+.Pa /tmp
+which must be publicly writable but
+should deny users the license to arbitrarily
+delete or rename each others' files.
+.Pp
+Any user may create a sticky directory.
+See
+.Xr chmod 1
+for details about modifying file modes.
+.Sh HISTORY
+A
+.Nm
+command appeared in
+.At 32v .
+.Sh BUGS
+Neither
+.Xr open 2
+nor
+.Xr mkdir 2
+will create a file with the sticky bit set.
diff --git a/share/man/man7/tuning.7 b/share/man/man7/tuning.7
new file mode 100644
index 000000000000..76b3439241b0
--- /dev/null
+++ b/share/man/man7/tuning.7
@@ -0,0 +1,1068 @@
+.\" Copyright (C) 2001 Matthew Dillon. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 16, 2010
+.Dt TUNING 7
+.Os
+.Sh NAME
+.Nm tuning
+.Nd performance tuning under FreeBSD
+.Sh SYSTEM SETUP - DISKLABEL, NEWFS, TUNEFS, SWAP
+When using
+.Xr bsdlabel 8
+or
+.Xr sysinstall 8
+to lay out your file systems on a hard disk it is important to remember
+that hard drives can transfer data much more quickly from outer tracks
+than they can from inner tracks.
+To take advantage of this you should
+try to pack your smaller file systems and swap closer to the outer tracks,
+follow with the larger file systems, and end with the largest file systems.
+It is also important to size system standard file systems such that you
+will not be forced to resize them later as you scale the machine up.
+I usually create, in order, a 128M root, 1G swap, 128M
+.Pa /var ,
+128M
+.Pa /var/tmp ,
+3G
+.Pa /usr ,
+and use any remaining space for
+.Pa /home .
+.Pp
+You should typically size your swap space to approximately 2x main memory
+for systems with less than 2GB of RAM, or approximately 1x main memory
+if you have more.
+If you do not have a lot of RAM, though, you will generally want a lot
+more swap.
+It is not recommended that you configure any less than
+256M of swap on a system and you should keep in mind future memory
+expansion when sizing the swap partition.
+The kernel's VM paging algorithms are tuned to perform best when there is
+at least 2x swap versus main memory.
+Configuring too little swap can lead
+to inefficiencies in the VM page scanning code as well as create issues
+later on if you add more memory to your machine.
+Finally, on larger systems
+with multiple SCSI disks (or multiple IDE disks operating on different
+controllers), we strongly recommend that you configure swap on each drive.
+The swap partitions on the drives should be approximately the same size.
+The kernel can handle arbitrary sizes but
+internal data structures scale to 4 times the largest swap partition.
+Keeping
+the swap partitions near the same size will allow the kernel to optimally
+stripe swap space across the N disks.
+Do not worry about overdoing it a
+little, swap space is the saving grace of
+.Ux
+and even if you do not normally use much swap, it can give you more time to
+recover from a runaway program before being forced to reboot.
+.Pp
+How you size your
+.Pa /var
+partition depends heavily on what you intend to use the machine for.
+This
+partition is primarily used to hold mailboxes, the print spool, and log
+files.
+Some people even make
+.Pa /var/log
+its own partition (but except for extreme cases it is not worth the waste
+of a partition ID).
+If your machine is intended to act as a mail
+or print server,
+or you are running a heavily visited web server, you should consider
+creating a much larger partition \(en perhaps a gig or more.
+It is very easy
+to underestimate log file storage requirements.
+.Pp
+Sizing
+.Pa /var/tmp
+depends on the kind of temporary file usage you think you will need.
+128M is
+the minimum we recommend.
+Also note that sysinstall will create a
+.Pa /tmp
+directory.
+Dedicating a partition for temporary file storage is important for
+two reasons: first, it reduces the possibility of file system corruption
+in a crash, and second it reduces the chance of a runaway process that
+fills up
+.Oo Pa /var Oc Ns Pa /tmp
+from blowing up more critical subsystems (mail,
+logging, etc).
+Filling up
+.Oo Pa /var Oc Ns Pa /tmp
+is a very common problem to have.
+.Pp
+In the old days there were differences between
+.Pa /tmp
+and
+.Pa /var/tmp ,
+but the introduction of
+.Pa /var
+(and
+.Pa /var/tmp )
+led to massive confusion
+by program writers so today programs haphazardly use one or the
+other and thus no real distinction can be made between the two.
+So it makes sense to have just one temporary directory and
+softlink to it from the other
+.Pa tmp
+directory locations.
+However you handle
+.Pa /tmp ,
+the one thing you do not want to do is leave it sitting
+on the root partition where it might cause root to fill up or possibly
+corrupt root in a crash/reboot situation.
+.Pp
+The
+.Pa /usr
+partition holds the bulk of the files required to support the system and
+a subdirectory within it called
+.Pa /usr/local
+holds the bulk of the files installed from the
+.Xr ports 7
+hierarchy.
+If you do not use ports all that much and do not intend to keep
+system source
+.Pq Pa /usr/src
+on the machine, you can get away with
+a 1 gigabyte
+.Pa /usr
+partition.
+However, if you install a lot of ports
+(especially window managers and Linux-emulated binaries), we recommend
+at least a 2 gigabyte
+.Pa /usr
+and if you also intend to keep system source
+on the machine, we recommend a 3 gigabyte
+.Pa /usr .
+Do not underestimate the
+amount of space you will need in this partition, it can creep up and
+surprise you!
+.Pp
+The
+.Pa /home
+partition is typically used to hold user-specific data.
+I usually size it to the remainder of the disk.
+.Pp
+Why partition at all?
+Why not create one big
+.Pa /
+partition and be done with it?
+Then I do not have to worry about undersizing things!
+Well, there are several reasons this is not a good idea.
+First,
+each partition has different operational characteristics and separating them
+allows the file system to tune itself to those characteristics.
+For example,
+the root and
+.Pa /usr
+partitions are read-mostly, with very little writing, while
+a lot of reading and writing could occur in
+.Pa /var
+and
+.Pa /var/tmp .
+By properly
+partitioning your system fragmentation introduced in the smaller more
+heavily write-loaded partitions will not bleed over into the mostly-read
+partitions.
+Additionally, keeping the write-loaded partitions closer to
+the edge of the disk (i.e., before the really big partitions instead of after
+in the partition table) will increase I/O performance in the partitions
+where you need it the most.
+Now it is true that you might also need I/O
+performance in the larger partitions, but they are so large that shifting
+them more towards the edge of the disk will not lead to a significant
+performance improvement whereas moving
+.Pa /var
+to the edge can have a huge impact.
+Finally, there are safety concerns.
+Having a small neat root partition that
+is essentially read-only gives it a greater chance of surviving a bad crash
+intact.
+.Pp
+Properly partitioning your system also allows you to tune
+.Xr newfs 8 ,
+and
+.Xr tunefs 8
+parameters.
+Tuning
+.Xr newfs 8
+requires more experience but can lead to significant improvements in
+performance.
+There are three parameters that are relatively safe to tune:
+.Em blocksize , bytes/i-node ,
+and
+.Em cylinders/group .
+.Pp
+.Fx
+performs best when using 8K or 16K file system block sizes.
+The default file system block size is 16K,
+which provides best performance for most applications,
+with the exception of those that perform random access on large files
+(such as database server software).
+Such applications tend to perform better with a smaller block size,
+although modern disk characteristics are such that the performance
+gain from using a smaller block size may not be worth consideration.
+Using a block size larger than 16K
+can cause fragmentation of the buffer cache and
+lead to lower performance.
+.Pp
+The defaults may be unsuitable
+for a file system that requires a very large number of i-nodes
+or is intended to hold a large number of very small files.
+Such a file system should be created with an 8K or 4K block size.
+This also requires you to specify a smaller
+fragment size.
+We recommend always using a fragment size that is 1/8
+the block size (less testing has been done on other fragment size factors).
+The
+.Xr newfs 8
+options for this would be
+.Dq Li "newfs -f 1024 -b 8192 ..." .
+.Pp
+If a large partition is intended to be used to hold fewer, larger files, such
+as database files, you can increase the
+.Em bytes/i-node
+ratio which reduces the number of i-nodes (maximum number of files and
+directories that can be created) for that partition.
+Decreasing the number
+of i-nodes in a file system can greatly reduce
+.Xr fsck 8
+recovery times after a crash.
+Do not use this option
+unless you are actually storing large files on the partition, because if you
+overcompensate you can wind up with a file system that has lots of free
+space remaining but cannot accommodate any more files.
+Using 32768, 65536, or 262144 bytes/i-node is recommended.
+You can go higher but
+it will have only incremental effects on
+.Xr fsck 8
+recovery times.
+For example,
+.Dq Li "newfs -i 32768 ..." .
+.Pp
+.Xr tunefs 8
+may be used to further tune a file system.
+This command can be run in
+single-user mode without having to reformat the file system.
+However, this is possibly the most abused program in the system.
+Many people attempt to
+increase available file system space by setting the min-free percentage to 0.
+This can lead to severe file system fragmentation and we do not recommend
+that you do this.
+Really the only
+.Xr tunefs 8
+option worthwhile here is turning on
+.Em softupdates
+with
+.Dq Li "tunefs -n enable /filesystem" .
+(Note: in
+.Fx 4.5
+and later, softupdates can be turned on using the
+.Fl U
+option to
+.Xr newfs 8 ,
+and
+.Xr sysinstall 8
+will typically enable softupdates automatically for non-root file systems).
+Softupdates drastically improves meta-data performance, mainly file
+creation and deletion.
+We recommend enabling softupdates on most file systems; however, there
+are two limitations to softupdates that you should be aware of when
+determining whether to use it on a file system.
+First, softupdates guarantees file system consistency in the
+case of a crash but could very easily be several seconds (even a minute!\&)
+behind on pending write to the physical disk.
+If you crash you may lose more work
+than otherwise.
+Secondly, softupdates delays the freeing of file system
+blocks.
+If you have a file system (such as the root file system) which is
+close to full, doing a major update of it, e.g.\&
+.Dq Li "make installworld" ,
+can run it out of space and cause the update to fail.
+For this reason, softupdates will not be enabled on the root file system
+during a typical install.
+There is no loss of performance since the root
+file system is rarely written to.
+.Pp
+A number of run-time
+.Xr mount 8
+options exist that can help you tune the system.
+The most obvious and most dangerous one is
+.Cm async .
+Only use this option in conjunction with
+.Xr gjournal 8 ,
+as it is far too dangerous on a normal file system.
+A less dangerous and more
+useful
+.Xr mount 8
+option is called
+.Cm noatime .
+.Ux
+file systems normally update the last-accessed time of a file or
+directory whenever it is accessed.
+This operation is handled in
+.Fx
+with a delayed write and normally does not create a burden on the system.
+However, if your system is accessing a huge number of files on a continuing
+basis the buffer cache can wind up getting polluted with atime updates,
+creating a burden on the system.
+For example, if you are running a heavily
+loaded web site, or a news server with lots of readers, you might want to
+consider turning off atime updates on your larger partitions with this
+.Xr mount 8
+option.
+However, you should not gratuitously turn off atime
+updates everywhere.
+For example, the
+.Pa /var
+file system customarily
+holds mailboxes, and atime (in combination with mtime) is used to
+determine whether a mailbox has new mail.
+You might as well leave
+atime turned on for mostly read-only partitions such as
+.Pa /
+and
+.Pa /usr
+as well.
+This is especially useful for
+.Pa /
+since some system utilities
+use the atime field for reporting.
+.Sh STRIPING DISKS
+In larger systems you can stripe partitions from several drives together
+to create a much larger overall partition.
+Striping can also improve
+the performance of a file system by splitting I/O operations across two
+or more disks.
+The
+.Xr gstripe 8 ,
+.Xr gvinum 8 ,
+and
+.Xr ccdconfig 8
+utilities may be used to create simple striped file systems.
+Generally
+speaking, striping smaller partitions such as the root and
+.Pa /var/tmp ,
+or essentially read-only partitions such as
+.Pa /usr
+is a complete waste of time.
+You should only stripe partitions that require serious I/O performance,
+typically
+.Pa /var , /home ,
+or custom partitions used to hold databases and web pages.
+Choosing the proper stripe size is also
+important.
+File systems tend to store meta-data on power-of-2 boundaries
+and you usually want to reduce seeking rather than increase seeking.
+This
+means you want to use a large off-center stripe size such as 1152 sectors
+so sequential I/O does not seek both disks and so meta-data is distributed
+across both disks rather than concentrated on a single disk.
+If
+you really need to get sophisticated, we recommend using a real hardware
+RAID controller from the list of
+.Fx
+supported controllers.
+.Sh SYSCTL TUNING
+.Xr sysctl 8
+variables permit system behavior to be monitored and controlled at
+run-time.
+Some sysctls simply report on the behavior of the system; others allow
+the system behavior to be modified;
+some may be set at boot time using
+.Xr rc.conf 5 ,
+but most will be set via
+.Xr sysctl.conf 5 .
+There are several hundred sysctls in the system, including many that appear
+to be candidates for tuning but actually are not.
+In this document we will only cover the ones that have the greatest effect
+on the system.
+.Pp
+The
+.Va vm.overcommit
+sysctl defines the overcommit behaviour of the vm subsystem.
+The virtual memory system always does accounting of the swap space
+reservation, both total for system and per-user.
+Corresponding values
+are available through sysctl
+.Va vm.swap_total ,
+that gives the total bytes available for swapping, and
+.Va vm.swap_reserved ,
+that gives number of bytes that may be needed to back all currently
+allocated anonymous memory.
+.Pp
+Setting bit 0 of the
+.Va vm.overcommit
+sysctl causes the virtual memory system to return failure
+to the process when allocation of memory causes
+.Va vm.swap_reserved
+to exceed
+.Va vm.swap_total .
+Bit 1 of the sysctl enforces
+.Dv RLIMIT_SWAP
+limit
+(see
+.Xr getrlimit 2 ) .
+Root is exempt from this limit.
+Bit 2 allows to count most of the physical
+memory as allocatable, except wired and free reserved pages
+(accounted by
+.Va vm.stats.vm.v_free_target
+and
+.Va vm.stats.vm.v_wire_count
+sysctls, respectively).
+.Pp
+The
+.Va kern.ipc.maxpipekva
+loader tunable is used to set a hard limit on the
+amount of kernel address space allocated to mapping of pipe buffers.
+Use of the mapping allows the kernel to eliminate a copy of the
+data from writer address space into the kernel, directly copying
+the content of mapped buffer to the reader.
+Increasing this value to a higher setting, such as `25165824' might
+improve performance on systems where space for mapping pipe buffers
+is quickly exhausted.
+This exhaustion is not fatal; however, and it will only cause pipes to
+to fall back to using double-copy.
+.Pp
+The
+.Va kern.ipc.shm_use_phys
+sysctl defaults to 0 (off) and may be set to 0 (off) or 1 (on).
+Setting
+this parameter to 1 will cause all System V shared memory segments to be
+mapped to unpageable physical RAM.
+This feature only has an effect if you
+are either (A) mapping small amounts of shared memory across many (hundreds)
+of processes, or (B) mapping large amounts of shared memory across any
+number of processes.
+This feature allows the kernel to remove a great deal
+of internal memory management page-tracking overhead at the cost of wiring
+the shared memory into core, making it unswappable.
+.Pp
+The
+.Va vfs.vmiodirenable
+sysctl defaults to 1 (on).
+This parameter controls how directories are cached
+by the system.
+Most directories are small and use but a single fragment
+(typically 2K) in the file system and even less (typically 512 bytes) in
+the buffer cache.
+However, when operating in the default mode the buffer
+cache will only cache a fixed number of directories even if you have a huge
+amount of memory.
+Turning on this sysctl allows the buffer cache to use
+the VM Page Cache to cache the directories.
+The advantage is that all of
+memory is now available for caching directories.
+The disadvantage is that
+the minimum in-core memory used to cache a directory is the physical page
+size (typically 4K) rather than 512 bytes.
+We recommend turning this option off in memory-constrained environments;
+however, when on, it will substantially improve the performance of services
+that manipulate a large number of files.
+Such services can include web caches, large mail systems, and news systems.
+Turning on this option will generally not reduce performance even with the
+wasted memory but you should experiment to find out.
+.Pp
+The
+.Va vfs.write_behind
+sysctl defaults to 1 (on).
+This tells the file system to issue media
+writes as full clusters are collected, which typically occurs when writing
+large sequential files.
+The idea is to avoid saturating the buffer
+cache with dirty buffers when it would not benefit I/O performance.
+However,
+this may stall processes and under certain circumstances you may wish to turn
+it off.
+.Pp
+The
+.Va vfs.hirunningspace
+sysctl determines how much outstanding write I/O may be queued to
+disk controllers system-wide at any given time.
+It is used by the UFS file system.
+The default is self-tuned and
+usually sufficient but on machines with advanced controllers and lots
+of disks this may be tuned up to match what the controllers buffer.
+Configuring this setting to match tagged queuing capabilities of
+controllers or drives with average IO size used in production works
+best (for example: 16 MiB will use 128 tags with IO requests of 128 KiB).
+Note that setting too high a value
+(exceeding the buffer cache's write threshold) can lead to extremely
+bad clustering performance.
+Do not set this value arbitrarily high!
+Higher write queueing values may also add latency to reads occurring at
+the same time.
+.Pp
+The
+.Va vfs.read_max
+sysctl governs VFS read-ahead and is expressed as the number of blocks
+to pre-read if the heuristics algorithm decides that the reads are
+issued sequentially.
+It is used by the UFS, ext2fs and msdosfs file systems.
+With the default UFS block size of 16 KiB, a setting of 32 will allow
+speculatively reading up to 512 KiB.
+This setting may be increased to get around disk I/O latencies, especially
+where these latencies are large such as in virtual machine emulated
+environments.
+It may be tuned down in specific cases where the I/O load is such that
+read-ahead adversely affects performance or where system memory is really
+low.
+.Pp
+The
+.Va vfs.ncsizefactor
+sysctl defines how large VFS namecache may grow.
+The number of currently allocated entries in namecache is provided by
+.Va debug.numcache
+sysctl and the condition
+debug.numcache < kern.maxvnodes * vfs.ncsizefactor
+is adhered to.
+.Pp
+The
+.Va vfs.ncnegfactor
+sysctl defines how many negative entries VFS namecache is allowed to create.
+The number of currently allocated negative entries is provided by
+.Va debug.numneg
+sysctl and the condition
+vfs.ncnegfactor * debug.numneg < debug.numcache
+is adhered to.
+.Pp
+There are various other buffer-cache and VM page cache related sysctls.
+We do not recommend modifying these values.
+As of
+.Fx 4.3 ,
+the VM system does an extremely good job tuning itself.
+.Pp
+The
+.Va net.inet.tcp.sendspace
+and
+.Va net.inet.tcp.recvspace
+sysctls are of particular interest if you are running network intensive
+applications.
+They control the amount of send and receive buffer space
+allowed for any given TCP connection.
+The default sending buffer is 32K; the default receiving buffer
+is 64K.
+You can often
+improve bandwidth utilization by increasing the default at the cost of
+eating up more kernel memory for each connection.
+We do not recommend
+increasing the defaults if you are serving hundreds or thousands of
+simultaneous connections because it is possible to quickly run the system
+out of memory due to stalled connections building up.
+But if you need
+high bandwidth over a fewer number of connections, especially if you have
+gigabit Ethernet, increasing these defaults can make a huge difference.
+You can adjust the buffer size for incoming and outgoing data separately.
+For example, if your machine is primarily doing web serving you may want
+to decrease the recvspace in order to be able to increase the
+sendspace without eating too much kernel memory.
+Note that the routing table (see
+.Xr route 8 )
+can be used to introduce route-specific send and receive buffer size
+defaults.
+.Pp
+As an additional management tool you can use pipes in your
+firewall rules (see
+.Xr ipfw 8 )
+to limit the bandwidth going to or from particular IP blocks or ports.
+For example, if you have a T1 you might want to limit your web traffic
+to 70% of the T1's bandwidth in order to leave the remainder available
+for mail and interactive use.
+Normally a heavily loaded web server
+will not introduce significant latencies into other services even if
+the network link is maxed out, but enforcing a limit can smooth things
+out and lead to longer term stability.
+Many people also enforce artificial
+bandwidth limitations in order to ensure that they are not charged for
+using too much bandwidth.
+.Pp
+Setting the send or receive TCP buffer to values larger than 65535 will result
+in a marginal performance improvement unless both hosts support the window
+scaling extension of the TCP protocol, which is controlled by the
+.Va net.inet.tcp.rfc1323
+sysctl.
+These extensions should be enabled and the TCP buffer size should be set
+to a value larger than 65536 in order to obtain good performance from
+certain types of network links; specifically, gigabit WAN links and
+high-latency satellite links.
+RFC1323 support is enabled by default.
+.Pp
+The
+.Va net.inet.tcp.always_keepalive
+sysctl determines whether or not the TCP implementation should attempt
+to detect dead TCP connections by intermittently delivering
+.Dq keepalives
+on the connection.
+By default, this is enabled for all applications; by setting this
+sysctl to 0, only applications that specifically request keepalives
+will use them.
+In most environments, TCP keepalives will improve the management of
+system state by expiring dead TCP connections, particularly for
+systems serving dialup users who may not always terminate individual
+TCP connections before disconnecting from the network.
+However, in some environments, temporary network outages may be
+incorrectly identified as dead sessions, resulting in unexpectedly
+terminated TCP connections.
+In such environments, setting the sysctl to 0 may reduce the occurrence of
+TCP session disconnections.
+.Pp
+The
+.Va net.inet.tcp.delayed_ack
+TCP feature is largely misunderstood.
+Historically speaking, this feature
+was designed to allow the acknowledgement to transmitted data to be returned
+along with the response.
+For example, when you type over a remote shell,
+the acknowledgement to the character you send can be returned along with the
+data representing the echo of the character.
+With delayed acks turned off,
+the acknowledgement may be sent in its own packet, before the remote service
+has a chance to echo the data it just received.
+This same concept also
+applies to any interactive protocol (e.g.\& SMTP, WWW, POP3), and can cut the
+number of tiny packets flowing across the network in half.
+The
+.Fx
+delayed ACK implementation also follows the TCP protocol rule that
+at least every other packet be acknowledged even if the standard 100ms
+timeout has not yet passed.
+Normally the worst a delayed ACK can do is
+slightly delay the teardown of a connection, or slightly delay the ramp-up
+of a slow-start TCP connection.
+While we are not sure we believe that
+the several FAQs related to packages such as SAMBA and SQUID which advise
+turning off delayed acks may be referring to the slow-start issue.
+In
+.Fx ,
+it would be more beneficial to increase the slow-start flightsize via
+the
+.Va net.inet.tcp.slowstart_flightsize
+sysctl rather than disable delayed acks.
+.Pp
+The
+.Va net.inet.tcp.inflight.enable
+sysctl turns on bandwidth delay product limiting for all TCP connections.
+The system will attempt to calculate the bandwidth delay product for each
+connection and limit the amount of data queued to the network to just the
+amount required to maintain optimum throughput.
+This feature is useful
+if you are serving data over modems, GigE, or high speed WAN links (or
+any other link with a high bandwidth*delay product), especially if you are
+also using window scaling or have configured a large send window.
+If you enable this option, you should also be sure to set
+.Va net.inet.tcp.inflight.debug
+to 0 (disable debugging), and for production use setting
+.Va net.inet.tcp.inflight.min
+to at least 6144 may be beneficial.
+Note however, that setting high
+minimums may effectively disable bandwidth limiting depending on the link.
+The limiting feature reduces the amount of data built up in intermediate
+router and switch packet queues as well as reduces the amount of data built
+up in the local host's interface queue.
+With fewer packets queued up,
+interactive connections, especially over slow modems, will also be able
+to operate with lower round trip times.
+However, note that this feature
+only affects data transmission (uploading / server-side).
+It does not
+affect data reception (downloading).
+.Pp
+Adjusting
+.Va net.inet.tcp.inflight.stab
+is not recommended.
+This parameter defaults to 20, representing 2 maximal packets added
+to the bandwidth delay product window calculation.
+The additional
+window is required to stabilize the algorithm and improve responsiveness
+to changing conditions, but it can also result in higher ping times
+over slow links (though still much lower than you would get without
+the inflight algorithm).
+In such cases you may
+wish to try reducing this parameter to 15, 10, or 5, and you may also
+have to reduce
+.Va net.inet.tcp.inflight.min
+(for example, to 3500) to get the desired effect.
+Reducing these parameters
+should be done as a last resort only.
+.Pp
+The
+.Va net.inet.ip.portrange.*
+sysctls control the port number ranges automatically bound to TCP and UDP
+sockets.
+There are three ranges: a low range, a default range, and a
+high range, selectable via the
+.Dv IP_PORTRANGE
+.Xr setsockopt 2
+call.
+Most
+network programs use the default range which is controlled by
+.Va net.inet.ip.portrange.first
+and
+.Va net.inet.ip.portrange.last ,
+which default to 49152 and 65535, respectively.
+Bound port ranges are
+used for outgoing connections, and it is possible to run the system out
+of ports under certain circumstances.
+This most commonly occurs when you are
+running a heavily loaded web proxy.
+The port range is not an issue
+when running a server which handles mainly incoming connections, such as a
+normal web server, or has a limited number of outgoing connections, such
+as a mail relay.
+For situations where you may run out of ports,
+we recommend decreasing
+.Va net.inet.ip.portrange.first
+modestly.
+A range of 10000 to 30000 ports may be reasonable.
+You should also consider firewall effects when changing the port range.
+Some firewalls
+may block large ranges of ports (usually low-numbered ports) and expect systems
+to use higher ranges of ports for outgoing connections.
+By default
+.Va net.inet.ip.portrange.last
+is set at the maximum allowable port number.
+.Pp
+The
+.Va kern.ipc.somaxconn
+sysctl limits the size of the listen queue for accepting new TCP connections.
+The default value of 128 is typically too low for robust handling of new
+connections in a heavily loaded web server environment.
+For such environments,
+we recommend increasing this value to 1024 or higher.
+The service daemon
+may itself limit the listen queue size (e.g.\&
+.Xr sendmail 8 ,
+apache) but will
+often have a directive in its configuration file to adjust the queue size up.
+Larger listen queues also do a better job of fending off denial of service
+attacks.
+.Pp
+The
+.Va kern.maxfiles
+sysctl determines how many open files the system supports.
+The default is
+typically a few thousand but you may need to bump this up to ten or twenty
+thousand if you are running databases or large descriptor-heavy daemons.
+The read-only
+.Va kern.openfiles
+sysctl may be interrogated to determine the current number of open files
+on the system.
+.Pp
+The
+.Va vm.swap_idle_enabled
+sysctl is useful in large multi-user systems where you have lots of users
+entering and leaving the system and lots of idle processes.
+Such systems
+tend to generate a great deal of continuous pressure on free memory reserves.
+Turning this feature on and adjusting the swapout hysteresis (in idle
+seconds) via
+.Va vm.swap_idle_threshold1
+and
+.Va vm.swap_idle_threshold2
+allows you to depress the priority of pages associated with idle processes
+more quickly then the normal pageout algorithm.
+This gives a helping hand
+to the pageout daemon.
+Do not turn this option on unless you need it,
+because the tradeoff you are making is to essentially pre-page memory sooner
+rather than later, eating more swap and disk bandwidth.
+In a small system
+this option will have a detrimental effect but in a large system that is
+already doing moderate paging this option allows the VM system to stage
+whole processes into and out of memory more easily.
+.Sh LOADER TUNABLES
+Some aspects of the system behavior may not be tunable at runtime because
+memory allocations they perform must occur early in the boot process.
+To change loader tunables, you must set their values in
+.Xr loader.conf 5
+and reboot the system.
+.Pp
+.Va kern.maxusers
+controls the scaling of a number of static system tables, including defaults
+for the maximum number of open files, sizing of network memory resources, etc.
+As of
+.Fx 4.5 ,
+.Va kern.maxusers
+is automatically sized at boot based on the amount of memory available in
+the system, and may be determined at run-time by inspecting the value of the
+read-only
+.Va kern.maxusers
+sysctl.
+Some sites will require larger or smaller values of
+.Va kern.maxusers
+and may set it as a loader tunable; values of 64, 128, and 256 are not
+uncommon.
+We do not recommend going above 256 unless you need a huge number
+of file descriptors; many of the tunable values set to their defaults by
+.Va kern.maxusers
+may be individually overridden at boot-time or run-time as described
+elsewhere in this document.
+Systems older than
+.Fx 4.4
+must set this value via the kernel
+.Xr config 8
+option
+.Cd maxusers
+instead.
+.Pp
+The
+.Va kern.dfldsiz
+and
+.Va kern.dflssiz
+tunables set the default soft limits for process data and stack size
+respectively.
+Processes may increase these up to the hard limits by calling
+.Xr setrlimit 2 .
+The
+.Va kern.maxdsiz ,
+.Va kern.maxssiz ,
+and
+.Va kern.maxtsiz
+tunables set the hard limits for process data, stack, and text size
+respectively; processes may not exceed these limits.
+The
+.Va kern.sgrowsiz
+tunable controls how much the stack segment will grow when a process
+needs to allocate more stack.
+.Pp
+.Va kern.ipc.nmbclusters
+may be adjusted to increase the number of network mbufs the system is
+willing to allocate.
+Each cluster represents approximately 2K of memory,
+so a value of 1024 represents 2M of kernel memory reserved for network
+buffers.
+You can do a simple calculation to figure out how many you need.
+If you have a web server which maxes out at 1000 simultaneous connections,
+and each connection eats a 16K receive and 16K send buffer, you need
+approximately 32MB worth of network buffers to deal with it.
+A good rule of
+thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768.
+So for this case
+you would want to set
+.Va kern.ipc.nmbclusters
+to 32768.
+We recommend values between
+1024 and 4096 for machines with moderates amount of memory, and between 4096
+and 32768 for machines with greater amounts of memory.
+Under no circumstances
+should you specify an arbitrarily high value for this parameter, it could
+lead to a boot-time crash.
+The
+.Fl m
+option to
+.Xr netstat 1
+may be used to observe network cluster use.
+Older versions of
+.Fx
+do not have this tunable and require that the
+kernel
+.Xr config 8
+option
+.Dv NMBCLUSTERS
+be set instead.
+.Pp
+More and more programs are using the
+.Xr sendfile 2
+system call to transmit files over the network.
+The
+.Va kern.ipc.nsfbufs
+sysctl controls the number of file system buffers
+.Xr sendfile 2
+is allowed to use to perform its work.
+This parameter nominally scales
+with
+.Va kern.maxusers
+so you should not need to modify this parameter except under extreme
+circumstances.
+See the
+.Sx TUNING
+section in the
+.Xr sendfile 2
+manual page for details.
+.Sh KERNEL CONFIG TUNING
+There are a number of kernel options that you may have to fiddle with in
+a large-scale system.
+In order to change these options you need to be
+able to compile a new kernel from source.
+The
+.Xr config 8
+manual page and the handbook are good starting points for learning how to
+do this.
+Generally the first thing you do when creating your own custom
+kernel is to strip out all the drivers and services you do not use.
+Removing things like
+.Dv INET6
+and drivers you do not have will reduce the size of your kernel, sometimes
+by a megabyte or more, leaving more memory available for applications.
+.Pp
+.Dv SCSI_DELAY
+may be used to reduce system boot times.
+The defaults are fairly high and
+can be responsible for 5+ seconds of delay in the boot process.
+Reducing
+.Dv SCSI_DELAY
+to something below 5 seconds could work (especially with modern drives).
+.Pp
+There are a number of
+.Dv *_CPU
+options that can be commented out.
+If you only want the kernel to run
+on a Pentium class CPU, you can easily remove
+.Dv I486_CPU ,
+but only remove
+.Dv I586_CPU
+if you are sure your CPU is being recognized as a Pentium II or better.
+Some clones may be recognized as a Pentium or even a 486 and not be able
+to boot without those options.
+If it works, great!
+The operating system
+will be able to better use higher-end CPU features for MMU, task switching,
+timebase, and even device operations.
+Additionally, higher-end CPUs support
+4MB MMU pages, which the kernel uses to map the kernel itself into memory,
+increasing its efficiency under heavy syscall loads.
+.Sh IDE WRITE CACHING
+.Fx 4.3
+flirted with turning off IDE write caching.
+This reduced write bandwidth
+to IDE disks but was considered necessary due to serious data consistency
+issues introduced by hard drive vendors.
+Basically the problem is that
+IDE drives lie about when a write completes.
+With IDE write caching turned
+on, IDE hard drives will not only write data to disk out of order, they
+will sometimes delay some of the blocks indefinitely under heavy disk
+load.
+A crash or power failure can result in serious file system
+corruption.
+So our default was changed to be safe.
+Unfortunately, the
+result was such a huge loss in performance that we caved in and changed the
+default back to on after the release.
+You should check the default on
+your system by observing the
+.Va hw.ata.wc
+sysctl variable.
+If IDE write caching is turned off, you can turn it back
+on by setting the
+.Va hw.ata.wc
+loader tunable to 1.
+More information on tuning the ATA driver system may be found in the
+.Xr ata 4
+manual page.
+If you need performance, go with SCSI.
+.Sh CPU, MEMORY, DISK, NETWORK
+The type of tuning you do depends heavily on where your system begins to
+bottleneck as load increases.
+If your system runs out of CPU (idle times
+are perpetually 0%) then you need to consider upgrading the CPU or moving to
+an SMP motherboard (multiple CPU's), or perhaps you need to revisit the
+programs that are causing the load and try to optimize them.
+If your system
+is paging to swap a lot you need to consider adding more memory.
+If your
+system is saturating the disk you typically see high CPU idle times and
+total disk saturation.
+.Xr systat 1
+can be used to monitor this.
+There are many solutions to saturated disks:
+increasing memory for caching, mirroring disks, distributing operations across
+several machines, and so forth.
+If disk performance is an issue and you
+are using IDE drives, switching to SCSI can help a great deal.
+While modern
+IDE drives compare with SCSI in raw sequential bandwidth, the moment you
+start seeking around the disk SCSI drives usually win.
+.Pp
+Finally, you might run out of network suds.
+The first line of defense for
+improving network performance is to make sure you are using switches instead
+of hubs, especially these days where switches are almost as cheap.
+Hubs
+have severe problems under heavy loads due to collision back-off and one bad
+host can severely degrade the entire LAN.
+Second, optimize the network path
+as much as possible.
+For example, in
+.Xr firewall 7
+we describe a firewall protecting internal hosts with a topology where
+the externally visible hosts are not routed through it.
+Use 100BaseT rather
+than 10BaseT, or use 1000BaseT rather than 100BaseT, depending on your needs.
+Most bottlenecks occur at the WAN link (e.g.\&
+modem, T1, DSL, whatever).
+If expanding the link is not an option it may be possible to use the
+.Xr dummynet 4
+feature to implement peak shaving or other forms of traffic shaping to
+prevent the overloaded service (such as web services) from affecting other
+services (such as email), or vice versa.
+In home installations this could
+be used to give interactive traffic (your browser,
+.Xr ssh 1
+logins) priority
+over services you export from your box (web services, email).
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr systat 1 ,
+.Xr sendfile 2 ,
+.Xr ata 4 ,
+.Xr dummynet 4 ,
+.Xr login.conf 5 ,
+.Xr rc.conf 5 ,
+.Xr sysctl.conf 5 ,
+.Xr firewall 7 ,
+.Xr eventtimers 7 ,
+.Xr hier 7 ,
+.Xr ports 7 ,
+.Xr boot 8 ,
+.Xr bsdlabel 8 ,
+.Xr ccdconfig 8 ,
+.Xr config 8 ,
+.Xr fsck 8 ,
+.Xr gjournal 8 ,
+.Xr gstripe 8 ,
+.Xr gvinum 8 ,
+.Xr ifconfig 8 ,
+.Xr ipfw 8 ,
+.Xr loader 8 ,
+.Xr mount 8 ,
+.Xr newfs 8 ,
+.Xr route 8 ,
+.Xr sysctl 8 ,
+.Xr sysinstall 8 ,
+.Xr tunefs 8
+.Sh HISTORY
+The
+.Nm
+manual page was originally written by
+.An Matthew Dillon
+and first appeared
+in
+.Fx 4.3 ,
+May 2001.
diff --git a/share/man/man8/Makefile b/share/man/man8/Makefile
new file mode 100644
index 000000000000..f3de79da4aac
--- /dev/null
+++ b/share/man/man8/Makefile
@@ -0,0 +1,27 @@
+# @(#)Makefile 8.1 (Berkeley) 6/5/93
+# $FreeBSD$
+
+MAN= crash.8 \
+ diskless.8 \
+ intro.8 \
+ nanobsd.8 \
+ picobsd.8 \
+ rc.8 \
+ rc.sendmail.8 \
+ rc.subr.8 \
+ rescue.8 \
+ yp.8
+
+MLINKS= rc.8 rc.atm.8 \
+ rc.8 rc.d.8 \
+ rc.8 rc.firewall.8 \
+ rc.8 rc.local.8 \
+ rc.8 rc.network.8 \
+ rc.8 rc.pccard.8 \
+ rc.8 rc.serial.8 \
+ rc.8 rc.shutdown.8
+MLINKS+=yp.8 NIS.8 \
+ yp.8 nis.8 \
+ yp.8 YP.8
+
+.include <bsd.prog.mk>
diff --git a/share/man/man8/crash.8 b/share/man/man8/crash.8
new file mode 100644
index 000000000000..d2904435e08b
--- /dev/null
+++ b/share/man/man8/crash.8
@@ -0,0 +1,220 @@
+.\" FreeBSD version Copyright (c) 1996
+.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Adapted from share/man/man8/man8.hp300/crash.8
+.\"
+.\" Copyright (c) 1990, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2011
+.Dt CRASH 8
+.Os
+.Sh NAME
+.Nm crash
+.Nd FreeBSD system failures
+.Sh DESCRIPTION
+This section explains a bit about system crashes
+and (very briefly) how to analyze crash dumps.
+.Pp
+When the system crashes voluntarily it prints a message of the form
+.Bl -diag -offset indent
+.It "panic: why i gave up the ghost"
+.El
+.Pp
+on the console, and if dumps have been enabled (see
+.Xr dumpon 8 ) ,
+takes a dump on a mass storage peripheral,
+and then invokes an automatic reboot procedure as
+described in
+.Xr reboot 8 .
+Unless some unexpected inconsistency is encountered in the state
+of the file systems due to hardware or software failure, the system
+will then resume multi-user operations.
+.Pp
+The system has a large number of internal consistency checks; if one
+of these fails, then it will panic with a very short message indicating
+which one failed.
+In many instances, this will be the name of the routine which detected
+the error, or a two-word description of the inconsistency.
+A full understanding of most panic messages requires perusal of the
+source code for the system.
+.Pp
+The most common cause of system failures is hardware failure, which
+can reflect itself in different ways.
+Here are the messages which
+are most likely, with some hints as to causes.
+Left unstated in all cases is the possibility that hardware or software
+error produced the message in some unexpected way.
+.Pp
+.Bl -diag -compact
+.It "cannot mount root"
+This panic message results from a failure to mount the root file system
+during the bootstrap process.
+Either the root file system has been corrupted,
+or the system is attempting to use the wrong device as root file system.
+Usually, an alternate copy of the system binary or an alternate root
+file system can be used to bring up the system to investigate.
+Most often
+this is done by the use of the boot floppy you used to install the system,
+and then using the
+.Dq fixit
+floppy.
+.Pp
+.It "init: not found"
+This is not a panic message, as reboots are likely to be futile.
+Late in the bootstrap procedure, the system was unable to locate
+and execute the initialization process,
+.Xr init 8 .
+The root file system is incorrect or has been corrupted, or the mode
+or type of
+.Pa /sbin/init
+forbids execution or is totally missing.
+.Pp
+.It "ffs_realloccg: bad optim"
+.It "ffs_valloc: dup alloc"
+.It "ffs_alloccgblk: cyl groups corrupted"
+.It "ffs_alloccg: map corrupted"
+.It "blkfree: freeing free block"
+.It "blkfree: freeing free frag"
+.It "ifree: freeing free inode"
+These panic messages are among those that may be produced
+when file system inconsistencies are detected.
+The problem generally results from a failure to repair damaged file systems
+after a crash, hardware failures, or other condition that should not
+normally occur.
+A file system check will normally correct the problem.
+.Pp
+.It "timeout table full"
+This really should not be a panic, but until the data structure
+involved is made to be extensible, running out of entries causes a crash.
+If this happens, make the timeout table bigger.
+.Pp
+.\" .It "trap type %d, code = %x, v = %x"
+.\" An unexpected trap has occurred within the system; the trap types are:
+.\" .Bl -column xxxx -offset indent
+.\" 0 bus error
+.\" 1 address error
+.\" 2 illegal instruction
+.\" 3 divide by zero
+.\" .No 4\t Em chk No instruction
+.\" .No 5\t Em trapv No instruction
+.\" 6 privileged instruction
+.\" 7 trace trap
+.\" 8 MMU fault
+.\" 9 simulated software interrupt
+.\" 10 format error
+.\" 11 FP coprocessor fault
+.\" 12 coprocessor fault
+.\" 13 simulated AST
+.\" .El
+.\" .Pp
+.\" The favorite trap type in system crashes is trap type 8,
+.\" indicating a wild reference.
+.\" ``code'' (hex) is the concatenation of the
+.\" MMU
+.\" status register
+.\" (see <hp300/cpu.h>)
+.\" in the high 16 bits and the 68020 special status word
+.\" (see the 68020 manual, page 6-17)
+.\" in the low 16.
+.\" ``v'' (hex) is the virtual address which caused the fault.
+.\" Additionally, the kernel will dump about a screenful of semi-useful
+.\" information.
+.\" ``pid'' (decimal) is the process id of the process running at the
+.\" time of the exception.
+.\" Note that if we panic in an interrupt routine,
+.\" this process may not be related to the panic.
+.\" ``ps'' (hex) is the 68020 processor status register ``ps''.
+.\" ``pc'' (hex) is the value of the program counter saved
+.\" on the hardware exception frame.
+.\" It may
+.\" .Em not
+.\" be the PC of the instruction causing the fault.
+.\" ``sfc'' and ``dfc'' (hex) are the 68020 source/destination function codes.
+.\" They should always be one.
+.\" ``p0'' and ``p1'' are the
+.\" VAX-like
+.\" region registers.
+.\" They are of the form:
+.\" .Pp
+.\" .Bd -ragged -offset indent
+.\" <length> '@' <kernel VA>
+.\" .Ed
+.\" .Pp
+.\" where both are in hex.
+.\" Following these values are a dump of the processor registers (hex).
+.\" Finally, is a dump of the stack (user/kernel) at the time of the offense.
+.\" .Pp
+.It "init died (signal #, exit #)"
+The system initialization process has exited with the specified
+signal number and exit code.
+This is bad news, as no new users will then be able to log in.
+Rebooting is the only fix, so the
+system just does it right away.
+.El
+.Pp
+That completes the list of panic types you are likely to see.
+.Pp
+If the system has been configured to take crash dumps (see
+.Xr dumpon 8 ) ,
+then when it crashes it will write (or at least attempt to write)
+an image of memory into the back end of the dump device,
+usually the same as the primary swap
+area.
+After the system is rebooted, the program
+.Xr savecore 8
+runs and preserves a copy of this core image and the current
+system in a specified directory for later perusal.
+See
+.Xr savecore 8
+for details.
+.Pp
+To analyze a dump you should begin by running
+.Xr kgdb 1
+on the system load image and core dump.
+If the core image is the result of a panic,
+the panic message is printed.
+For more details consult the chapter on kernel debugging in
+the
+.%B "FreeBSD Developers' Handbook"
+.Pq Pa http://www.freebsd.org/doc/en/books/developers-handbook/ .
+.Sh SEE ALSO
+.Xr kgdb 1 ,
+.Xr dumpon 8 ,
+.Xr reboot 8 ,
+.Xr savecore 8
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 2.2 .
diff --git a/share/man/man8/diskless.8 b/share/man/man8/diskless.8
new file mode 100644
index 000000000000..3fcbc25c727f
--- /dev/null
+++ b/share/man/man8/diskless.8
@@ -0,0 +1,480 @@
+.\" Copyright (c) 1994 Gordon W. Ross, Theo de Raadt
+.\" Updated by Luigi Rizzo, Robert Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 7, 2011
+.Dt DISKLESS 8
+.Os
+.Sh NAME
+.Nm diskless
+.Nd booting a system over the network
+.Sh DESCRIPTION
+The ability to boot a machine over the network is useful for
+.Em diskless
+or
+.Em dataless
+machines, or as a temporary measure while repairing or
+re-installing file systems on a local disk.
+This file provides a general description of the interactions between
+a client and its server when a client is booting over the network.
+.Sh OPERATION
+When booting a system over the network, there are three
+phases of interaction between client and server:
+.Bl -enum
+.It
+The stage-1 bootstrap, typically PXE built into your Ethernet
+card, loads a second-stage boot program.
+.It
+The second-stage boot program, typically
+.Xr pxeboot 8 ,
+loads modules and
+the kernel, and boots the kernel.
+.It
+The kernel
+.Tn NFS
+mounts the root directory and continues from there.
+.El
+.Pp
+Each of these phases are described in further detail below.
+.Pp
+First, the stage-1 bootstrap loads the stage-2 boot program over
+the network.
+The stage-1 bootstrap typically uses
+.Tn BOOTP
+or
+.Tn DHCP
+to obtain the filename to load, then uses
+.Tn TFTP
+to load the file.
+This file is typically called
+.Pa pxeboot ,
+and should be copied from
+.Pa /boot/pxeboot
+into the
+.Tn TFTP
+directory on the server, which is typically
+.Pa /tftpdir .
+.Pp
+The stage-2 boot program then loads additional modules and the kernel.
+These files may not exist on the
+.Tn DHCP
+or
+.Tn BOOTP
+server.
+You can use the
+.Ic next-server
+option available in
+.Tn DHCP
+configurations to specify the server holding
+the second stage boot files and kernel.
+The stage-2 program uses
+.Tn NFS
+or
+.Tn TFTP
+to obtain these files.
+By default,
+.Tn NFS
+is used.
+If you are using
+.Xr pxeboot 8 ,
+you can install a version that uses
+.Tn TFTP
+by setting
+.Li LOADER_TFTP_SUPPORT=YES
+in your
+.Xr make.conf 5 ,
+then recompiling and reinstalling
+.Xr pxeboot 8
+via the command listed below.
+It is often necessary to use
+.Tn TFTP
+here so you can place a custom kernel
+in
+.Pa /tftpdir/ .
+If you use
+.Tn NFS
+and do not have a custom root file system for the
+.Nm
+client, the stage-2 boot will load your server's kernel as the kernel for
+the
+.Nm
+machine, which may not be what you want to have happen.
+.Bd -literal -offset indent
+cd /usr/src/sys/boot/i386
+make clean; make; make install
+cp /boot/pxeboot /tftpdir/
+.Ed
+.Pp
+In phase 3, the kernel acquires IP networking configuration in one
+of two ways, and then proceeds to mount the root file system and start
+operation.
+If the phase 2 loader supports passing network configuration to the
+kernel using the kernel environment, then the kernel will configure
+the network interface using that information.
+Otherwise, it must use
+.Tn DHCP
+or
+.Tn BOOTP
+to acquire
+configuration information.
+The boot
+scripts recognize a
+.Nm
+startup and perform
+the actions found in
+.Pa /etc/rc.d/resolv ,
+.Pa /etc/rc.d/tmp ,
+.Pa /etc/rc.d/var ,
+and
+.Pa /etc/rc.initdiskless .
+.Sh CONFIGURATION
+In order to run a
+.Nm
+client, you need the following:
+.Bl -bullet
+.It
+An
+.Tn NFS
+server which exports a root and
+.Pa /usr
+partitions with appropriate permissions.
+The
+.Nm
+scripts work with read-only partitions, as long as root is exported with
+.Fl maproot Ns =0
+so that some system files can be accessed.
+As an example,
+.Pa /etc/exports
+can contain the following lines:
+.Bd -literal -offset indent
+<ROOT> -ro -maproot=0 -alldirs <list of diskless clients>
+/usr -ro -alldirs <list of diskless clients>
+.Ed
+.Pp
+where
+.Aq ROOT
+is the mount point on the server of the root partition.
+The script
+.Pa /usr/share/examples/diskless/clone_root
+can be used to create a shared read-only root partition,
+but in many cases you may decide to export
+(again as read-only) the root directory used by
+the server itself.
+.It
+A
+.Tn BOOTP
+or
+.Tn DHCP
+server.
+.Xr bootpd 8
+can be enabled by
+uncommenting the
+.Dq Li bootps
+line in
+.Pa /etc/inetd.conf .
+A sample
+.Pa /etc/bootptab
+can be the following:
+.Bd -literal -offset indent
+ .default:\\
+ hn:ht=1:vm=rfc1048:\\
+ :sm=255.255.255.0:\\
+ :sa=<SERVER>:\\
+ :gw=<GATEWAY>:\\
+ :rp="<SERVER>:<ROOT>":
+
+<CLIENT>:ha=0123456789ab:tc=.default
+.Ed
+.Pp
+where
+.Aq SERVER ,
+.Aq GATEWAY
+and
+.Aq ROOT
+have the obvious meanings.
+.It
+A properly initialized root partition.
+The script
+.Pa /usr/share/examples/diskless/clone_root
+can help in creating it, using the server's root partition
+as a reference.
+If you are just starting out, you should
+simply use the server's own root directory,
+.Pa / ,
+and not try to clone it.
+.Pp
+You often do not want to use the same
+.Pa rc.conf
+or
+.Pa rc.local
+files for the
+.Nm
+boot as you do on the server.
+The
+.Nm
+boot
+scripts provide a mechanism through which you can override various files
+in
+.Pa /etc
+(as well as other subdirectories of root).
+.Pp
+One difference that you should pay particular attention to is
+the value of
+.Va local_startup
+in
+.Pa /etc/defaults/rc.conf .
+A typical value for a
+.Nm
+boot is
+.Va mountcritremote ,
+however your needs may be different.
+.Pp
+The scripts provide four
+overriding directories situated in
+.Pa /conf/base ,
+.Pa /conf/default ,
+.Pa /conf/<broadcast-ip> ,
+and
+.Pa /conf/<machine-ip> .
+You should always create
+.Pa /conf/base/etc ,
+which will entirely replace the server's
+.Pa /etc
+on the
+.Nm
+machine.
+You can clone the server's
+.Pa /etc
+here or you can create a special file which tells the
+.Nm
+boot scripts
+to remount the server's
+.Pa /etc
+onto
+.Pa /conf/base/etc .
+You do this by creating the file
+.Pa /conf/base/etc/diskless_remount
+containing the mount point to use as a basis of the
+.Nm
+machine's
+.Pa /etc .
+For example, the file might contain:
+.Pp
+.Dl 10.0.0.1:/etc
+.Pp
+Alternatively, if the server contains several independent roots, the file
+might contain:
+.Pp
+.Dl 10.0.0.1:/usr/diskless/4.7-RELEASE/etc
+.Pp
+This would work, but if you copied
+.Pa /usr/diskless/4.7-RELEASE
+to
+.Pa /usr/diskless/4.8-RELEASE
+and upgraded the installation, you would need to modify the
+.Pa diskless_remount
+files to reflect that move.
+To avoid that, paths in
+.Pa diskless_remount
+files beginning with
+.Pa /
+have the actual path of the client's root prepended to them so the file
+could instead contain:
+.Pp
+.Dl /etc
+.Pp
+The
+.Nm
+scripts create memory file systems to hold the overridden
+directories.
+Only a 2MB partition is created by default, which may not
+be sufficient for your purposes.
+To override this, you can create the
+file
+.Pa /conf/base/etc/md_size
+containing the size, in 512 byte sectors, of the memory disk to create
+for that directory.
+.Pp
+You then typically provide file-by-file overrides in the
+.Pa /conf/default/etc
+directory.
+At a minimum, you must provide overrides for
+.Pa /etc/fstab , /etc/rc.conf ,
+and
+.Pa /etc/rc.local
+via
+.Pa /conf/default/etc/fstab , /conf/default/etc/rc.conf ,
+and
+.Pa /conf/default/etc/rc.local .
+.Pp
+Overrides are hierarchical.
+You can supply network-specific defaults
+in the
+.Pa /conf/ Ns Ao Ar BROADCASTIP Ac Ns Pa /etc
+directory, where
+.Aq Ar BROADCASTIP
+represents the broadcast IP address of
+the
+.Nm
+system as given to it via
+.Tn BOOTP .
+The
+.Pa diskless_remount
+and
+.Pa md_size
+features work in any of these directories.
+The configuration feature works on directories other then
+.Pa /etc ,
+you simply create the directory you wish to replace or override in
+.Pa /conf/{base,default,<broadcast>,<ip>}/*
+and work it in the same way that you work
+.Pa /etc .
+.Pp
+Since you normally clone the server's
+.Pa /etc
+using the
+.Pa /conf/base/etc/diskless_remount ,
+you might wish to remove unneeded files from the memory file system.
+For example,
+if the server has a firewall but you do not, you might wish
+to remove
+.Pa /etc/ipfw.conf .
+You can do this by creating a
+.Pa /conf/base/ Ns Ao Ar DIRECTORY Ac Ns Pa .remove
+file.
+For example,
+.Pa /conf/base/etc.remove ,
+which contains a list of relative paths that the boot scripts should remove
+from the memory file systems.
+.Pp
+As a minimum, you normally need to have the following in
+.Pa /conf/default/etc/fstab
+.Bd -literal -offset indent
+<SERVER>:<ROOT> / nfs ro 0 0
+<SERVER>:/usr /usr nfs ro 0 0
+.Ed
+.Pp
+You also need to create a customized version of
+.Pa /conf/default/etc/rc.conf
+which should contain
+the startup options for the
+.Nm
+client, and
+.Pa /conf/default/etc/rc.local
+which could be empty but prevents the server's own
+.Pa /etc/rc.local
+from leaking onto the
+.Nm
+system.
+.Pp
+In
+.Pa rc.conf ,
+most likely
+you will not need to set
+.Va hostname
+and
+.Va ifconfig_*
+because these will be already set by the startup code.
+Finally, it might be convenient to use a
+.Ic case
+statement using
+.Li `hostname`
+as the switch variable to do machine-specific configuration
+in case a number of
+.Nm
+clients share the same configuration
+files.
+.It
+The kernel for the
+.Nm
+clients, which will be loaded using
+.Tn NFS
+or
+.Tn TFTP ,
+must include support for the NFS client:
+.Pp
+.D1 Cd "options NFSCL"
+.D1 Cd "options NFS_ROOT"
+.Pp
+If you are using a boot mechanism that does not pass network configuration
+to the kernel using the kernel environment, you will also need to include
+the following options:
+.Pp
+.D1 Cd "options BOOTP"
+.D1 Cd "options BOOTP_NFSROOT"
+.D1 Cd "options BOOTP_COMPAT"
+.Pp
+.Em Note :
+the PXE environment does not require these options.
+.Pp
+The
+.Nm
+booting environment relies on memory-backed file systems to
+support temporary local storage in the event that the root file system
+is mounted read-only; as such, it is necessary to add the following
+to the device section of the kernel configuration:
+.Pp
+.D1 Cd "device md"
+.Pp
+If you use the firewall, remember to default to
+.Dq open ,
+or your kernel
+will not be able to send/receive the
+.Tn BOOTP
+packets.
+.El
+.Sh SECURITY ISSUES
+Be warned that using unencrypted
+.Tn NFS
+to mount root and user
+partitions may expose information such as
+encryption keys.
+.Sh SEE ALSO
+.Xr ethers 5 ,
+.Xr exports 5 ,
+.Xr make.conf 5 ,
+.Xr bootpd 8 ,
+.Xr mountd 8 ,
+.Xr nfsd 8 ,
+.Xr pxeboot 8 ,
+.Xr reboot 8 ,
+.Xr tftpd 8
+.Pp
+.Pa ports/net/etherboot
+.Sh BUGS
+This manpage is probably incomplete.
+.Pp
+.Fx
+sometimes requires to write onto
+the root partition, so the startup scripts mount MFS
+file systems on some locations (e.g.\&
+.Pa /etc
+and
+.Pa /var ) ,
+while
+trying to preserve the original content.
+The process might not handle all cases.
diff --git a/share/man/man8/intro.8 b/share/man/man8/intro.8
new file mode 100644
index 000000000000..96406937da91
--- /dev/null
+++ b/share/man/man8/intro.8
@@ -0,0 +1,95 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)intro.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd October 22, 2006
+.Dt INTRO 8
+.Os
+.Sh NAME
+.Nm intro
+.Nd "introduction to system maintenance procedures and commands"
+.Sh DESCRIPTION
+This section contains information related to system operation
+and maintenance.
+.Pp
+It describes commands used to create new file systems
+.Pq Xr newfs 8 ,
+verify the integrity of the file systems
+.Pq Xr fsck 8 ,
+control disk usage
+.Pq Xr edquota 8 ,
+maintain system backups
+.Pq Xr dump 8 ,
+and recover files when disks die an untimely death
+.Pq Xr restore 8 .
+.\" The
+.\" .Xr format 8
+.\" manual
+.\" for the specific architecture the system is running on should be
+.\" consulted when formatting disks and tapes.
+Network related services like
+.Xr inetd 8
+and
+.Xr ftpd 8
+are also described.
+.Pp
+All commands set an exit status.
+Its value may be tested
+to see if the command completed normally.
+Unless otherwise noted (rare), the value 0 signifies successful
+completion of the command, while a value >0 indicates an error.
+Some commands attempt to describe the nature of the failure by using
+error codes defined in
+.Xr sysexits 3 ,
+or set the status to arbitrary values >0 (typically 1), but many
+such values are not described in the manual.
+.Pp
+A number of pages in this section describe general system
+management topics.
+.Pp
+For example, the
+.Xr boot 8
+manual page describes the system bootstrapping procedures,
+and the
+.Xr diskless 8
+manual page describes how to boot a system over a network.
+The
+.Xr crash 8
+manual page
+should be consulted to understand how to interpret system
+crash dumps.
+.Sh HISTORY
+The
+.Nm
+section manual page appeared in
+.Bx 4.2 .
diff --git a/share/man/man8/nanobsd.8 b/share/man/man8/nanobsd.8
new file mode 100644
index 000000000000..0309c4e424c8
--- /dev/null
+++ b/share/man/man8/nanobsd.8
@@ -0,0 +1,337 @@
+.\" Copyright (c) 2006 Daniel Gerzo <danger@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 20, 2010
+.Dt NANOBSD 8
+.Os
+.Sh NAME
+.Nm nanobsd.sh
+.Nd utility used to create a FreeBSD system image suitable for embedded
+applications
+.Sh SYNOPSIS
+.Nm
+.Op Fl bhknw
+.Op Fl c Ar config-file
+.Sh DESCRIPTION
+The
+.Nm
+utility is a script which produces a minimal implementation of
+.Fx
+(called
+.Nm NanoBSD ) ,
+which typically fits on a small media such as a Compact Flash card,
+or other mass storage medium.
+It can be used to build specialized install images, designed for easy
+installation and maintenance.
+.Pp
+The following options are available:
+.Bl -tag -width ".Fl c Ar config-file" -offset indent
+.It Fl b
+Skip the build stages (both for kernel and world).
+.It Fl c Ar config-file
+Specify the configuration file to use.
+.It Fl h
+Display usage information.
+.It Fl k
+Skip the
+.Cm buildkernel
+stage of the build.
+.It Fl n
+Do not cleanup before each build stage.
+This suppresses the normal cleanup work done before the
+.Cm buildworld
+stage and adds -DNO_CLEAN to the make command line
+used for each build stage (world and kernel).
+.It Fl w
+Skip the
+.Cm buildworld
+stage of the build.
+.El
+.Pp
+The features of
+.Nm NanoBSD
+include:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+Ports and packages work as in
+.Fx .
+Every single application can be installed and used in a
+.Nm NanoBSD
+image, the same way as in
+.Fx .
+.It
+No missing functionality.
+If it is possible to do something with
+.Fx ,
+it is possible to do the same thing with
+.Nm NanoBSD ,
+unless the specific feature or features were explicitly removed from the
+.Nm NanoBSD
+image when it was created.
+.It
+Everything is read-only at run-time.
+It is safe to pull the power-plug.
+There is no necessity to run
+.Xr fsck 8
+after a non-graceful shutdown of the system.
+.It
+Easy to build and customize.
+Making use of just one shell script and one configuration file it is
+possible to build reduced and customized images satisfying any arbitrary
+set of requirements.
+.El
+.Ss Nm NanoBSD Ss Media Layout
+The mass storage medium is divided into three parts by default (which
+are normally mounted read-only):
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+Two image partitions:
+.Li code#1
+and
+.Li code#2 .
+.It
+The configuration file partition, which can be mounted under the
+.Pa /cfg
+directory at run time.
+.El
+.Pp
+The
+.Pa /etc
+and
+.Pa /var
+directories are
+.Xr md 4
+(malloc backed) disks.
+.Pp
+The configuration file partition persists under the
+.Pa /cfg
+directory.
+It contains files for
+.Pa /etc
+directory and is briefly mounted read-only right after the system boot,
+therefore it is required to copy modified files from
+.Pa /etc
+back to the
+.Pa /cfg
+directory if changes are expected to persist after the system restarts.
+.Sh BUILDING Nm NanoBSD
+A
+.Nm NanoBSD
+image is built using a simple
+.Nm
+shell script, which can be
+found in the
+.Pa src/tools/tools/nanobsd
+directory.
+This script creates a bootable image, which can be copied on the storage
+medium using the
+.Xr dd 1
+utility.
+.Pp
+The necessary commands to build and install a
+.Nm NanoBSD
+image are:
+.Bd -literal -offset indent
+cd /usr/src/tools/tools/nanobsd
+sh nanobsd.sh
+cd /usr/obj/nanobsd.full
+dd if=_.disk.full of=/dev/da0 bs=64k
+.Ed
+.Sh CUSTOMIZING Nm NanoBSD
+This is probably the most important and most interesting feature of
+.Nm NanoBSD .
+This is also where you will be spending most of the time when developing with
+.Nm NanoBSD .
+.Pp
+Customization is done in two ways:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+Configuration options.
+.It
+Custom functions.
+.El
+.Pp
+With configuration settings, it is possible to configure options passed
+to both the
+.Cm buildworld
+and
+.Cm installworld
+stages of the
+.Nm NanoBSD
+build process, as well as internal options passed to the main build
+process of
+.Nm NanoBSD .
+Through these options it is possible to cut the system down, so it will
+fit on as little as 64MB.
+You can use the configuration options to trim down the system
+even more, until it will consist of just the kernel and two or three
+files in the userland.
+.Pp
+The configuration file consists of configuration options, which override
+the default values.
+The most important directives are:
+.Bl -tag -width ".Va CONF_INSTALL" -offset indent
+.It Va NANO_NAME
+Build name (used to construct the working directory names).
+.It Va NANO_SRC
+Path to the source tree used to build the image.
+.It Va NANO_KERNEL
+Name of the kernel configuration file used to build the kernel.
+.It Va NANO_ARCH
+Machine processor architecture to build. Defaults to output of
+.Cm uname -p .
+.It Va NANO_BOOT0CFG
+Controls the options passed to
+.Xr boot0cfg 8 ;
+these dictate
+.Nm boot0 Ns 's
+behaviour.
+.It Va NANO_BOOTLOADER
+The
+.Nm boot0
+loader to use relative to the
+.Va NANO_WORLDDIR
+variable.
+This defaults to
+.Pa boot/boot0sio
+and should be overridden to
+.Pa boot/boot0
+to provide a VGA
+console.
+.It Va CONF_BUILD
+Options passed to the
+.Cm buildworld
+stage of the build.
+.It Va CONF_INSTALL
+Options passed to the
+.Cm installworld
+stage of the build.
+.It Va CONF_WORLD
+Options passed to both the
+.Cm buildworld
+and
+.Cm installworld
+stages of the build.
+.It Va FlashDevice
+Defines the type of media to use.
+Check the
+.Pa FlashDevice.sub
+file for more details.
+.El
+.Pp
+For more configuration options, please check the
+.Nm
+script.
+.Pp
+To build
+.Nm NanoBSD
+image using the
+.Pa nanobsd.conf
+configuration file, use the following command:
+.Bd -literal -offset indent
+sh nanobsd.sh -c nanobsd.conf
+.Ed
+.Pp
+It is possible to fine-tune
+.Nm NanoBSD
+using shell functions in the configuration file.
+The following example illustrates the basic model of custom functions:
+.Bd -literal -offset indent
+cust_foo () (
+ echo "bar=topless" > \\
+ ${NANO_WORLDDIR}/etc/foo
+)
+customize_cmd cust_foo
+.Ed
+.Pp
+There are a few pre-defined customization functions ready for use:
+.Bl -tag -width ".Cm cust_allow_ssh_root" -offset indent
+.It Cm cust_comconsole
+Disables
+.Xr getty 8
+on the virtual
+.Xr syscons 4
+terminals
+.Pq Pa /dev/ttyv*
+and enables the use of the first serial port as the system
+console.
+.It Cm cust_allow_ssh_root
+Allow root to log in via
+.Xr sshd 8 .
+.It Cm cust_install_files
+Installs files from the
+.Pa nanobsd/Files
+directory, which contains some useful scripts for system administration.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa src/tools/tools/nanobsd" -compact
+.It Pa src/tools/tools/nanobsd
+Base directory of the
+.Nm NanoBSD
+build script.
+.El
+.Sh EXAMPLES
+Making persistent changes to
+.Pa /etc/resolv.conf :
+.Bd -literal -offset indent
+vi /etc/resolv.conf
+\&...
+mount /cfg
+cp /etc/resolv.conf /cfg
+umount /cfg
+.Ed
+.Pp
+A more useful example of a customization function is the following,
+which changes the default size of the
+.Pa /etc
+directory from 5MB to 30MB:
+.Bd -literal -offset indent
+cust_etc_size () (
+ cd ${NANO_WORLDDIR}/conf
+ echo 30000 > default/etc/md_size
+)
+customize_cmd cust_etc_size
+.Ed
+.Sh SEE ALSO
+.Xr make.conf 5 ,
+.Xr boot 8 ,
+.Xr boot0cfg 8 ,
+.Xr picobsd 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+.Nm NanoBSD
+was developed by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+This manual page was written by
+.An Daniel Gerzo Aq danger@FreeBSD.org .
diff --git a/share/man/man8/picobsd.8 b/share/man/man8/picobsd.8
new file mode 100644
index 000000000000..07373f67b5b1
--- /dev/null
+++ b/share/man/man8/picobsd.8
@@ -0,0 +1,663 @@
+.\" -*- nroff-fill -*-
+.\" $FreeBSD$
+.Dd June 25, 2009
+.Dt PICOBSD 8
+.Os
+.Sh NAME
+.Nm picobsd
+.Nd building small FreeBSD disk images
+.Sh SYNOPSIS
+.Nm
+.Op Ar options
+.Op Ar config-name Op Ar site-name
+.Sh DESCRIPTION
+The
+.Nm
+utility is a script which produces a minimal implementation of
+.Fx
+(historically called
+.Nm PicoBSD )
+which typically fits on a small media such as a floppy disk,
+or can be downloaded as a
+single image file from some media such as CDROM, flash memory, or through
+.Xr etherboot .
+.Pp
+The
+.Nm
+utility was originally created to build simple standalone systems
+such as firewalls or bridges, but because of the ability to
+cross-build images with different source trees than the one
+in the server, it can be extremely useful to developers to
+test their code without having to reinstall the system.
+.Pp
+The boot media (historically a floppy disk, but also small
+CDROM or USB keys) contains a boot loader and a
+compressed kernel which includes a memory file system.
+Depending on the media, it might also contain a number of
+additional files, which can be updated at run time, and are
+used to override/update those in the memory file system.
+.Pp
+The system loads the kernel in the normal way, uncompresses
+the memory file system and mounts it as root.
+It then updates the memory
+file system with files from the boot media (if present),
+and executes a specialized version of
+.Pa /etc/rc .
+The boot media (floppy, etc.) is
+required for loading only, and typically used read-only.
+After the boot phase, the system runs entirely from RAM.
+.Pp
+The following options are available (but also check the
+.Nm
+script for more details).
+The most important options for common operations are
+.Fl src ,
+.Fl init ,
+.Fl n and
+.Fl v.
+.Bl -tag -width indent
+.\"
+.It Fl -all_in_mfs
+Put the entire contents of the file system in the
+memory file system image which is contained in the
+kernel.
+This is the default behaviour, and is
+extremely useful as the kernel itself can be loaded,
+using
+.Xr etherboot
+or
+.Xr pxeboot 8 ,
+.\"
+.It Fl c , Fl clean
+Clean the product of previous builds.
+.\"
+.It Fl -cfg Ar file
+Specify a file that contains additional config commands.
+.\"
+.It Fl -floppy_size Ar size
+Set the size of the disk image.
+Typical values for a floppy disk are 1440 or 2880,
+but other values can be used for other media (flash memories,
+CDROM, network booted kernels).
+Note that this option is overridden by the content of the
+config files (config in the image tree, or the one
+specified with
+.Fl Fl cfg )
+.\"
+.It Fl -init
+When used together with the
+.Fl -src
+option, this initializes the
+.Ao Ar SRC_PATH Ac Ns Pa /../usr
+subtree as necessary to subsequently build
+.Nm
+images.
+.\"
+.It Fl -iso
+Generate an ISO image, picobsd.iso, in addition to the disk image picobsd.bin
+.\"
+.It Fl -modules
+Also build kernel modules.
+These are not stored on the
+.Nm
+image but are left available in the build directory.
+.\"
+.It Fl n
+Make the script non-interactive, skipping the initial menu
+and proceeding with the build process without requiring user input.
+.\"
+.It Fl -no_all_in_mfs
+Leaves files contained in the
+.Pa floppy.tree
+on the
+.Nm
+image, so they can be loaded separately
+from the kernel (and updated individually to
+customize the image).
+.\"
+.It Fl -no_loader
+Omit /boot/loader, just rely on boot2 to load the kernel.
+This saves some space but may have problems with kernels > 4MB.
+.\"
+.It Fl -objdir Ar directory
+Specify a directory with the result of a previous buildworld.
+This saves the need for an
+.Fl Fl init
+call before creating an image.
+.\"
+.It Fl -src Ar SRC_PATH
+Use the source tree at
+.Ar SRC_PATH
+instead the one at
+.Pa /usr/src .
+This can be useful for cross-building
+.Nm
+images.
+When using this option, you must also create and initialize the subtree at
+.Ao Ar SRC_PATH Ac Ns Pa /../usr
+with the correct header files, libraries, and tools (such as the
+.Xr config 8
+program) that are necessary for the cross-build (see the
+.Fl -init
+option).
+The source files are unmodified by the
+.Nm
+script.
+However the source tree is not completely read-only,
+because
+.Xr config 8
+expects the kernel configuration file to be in one of
+its subdirectories, and also the process of initializing the
+.Pa usr
+subtree touches some parts of the source tree (this is a bug
+in the release build scripts which might go away with time).
+.\"
+.It Fl v
+Make the script verbose, showing
+commands to be executed and waiting for user
+input before executing each of them.
+Useful for debugging.
+as a fully functional system.
+.El
+.Sh ENVIRONMENT
+As a result of extreme size limitations, the
+.Nm
+environment differs from the normal
+.Fx
+in a number of ways:
+.Bl -bullet
+.It
+There are no dynamic libraries, and there is no directory
+.Pa /usr/lib .
+As a result, only static executables may be executed.
+.It
+In order to reduce the size of the executables, all executables on a specific
+floppy are joined together as a single executable built with
+.Xr crunchgen 1 .
+.It
+Some programs are supplied in minimalistic versions, specifically
+.Nm ns ,
+a cut-down version of
+.Xr netstat 1 ,
+and
+.Nm vm ,
+a cut-down version of
+.Xr vmstat 8 .
+.El
+.Sh BUILDING PicoBSD
+The
+.Nm
+sources reside in the hierarchy
+.Pa /usr/src/release/picobsd .
+In the following discussion, all relative path names are relative to this
+directory.
+.Pp
+The supported build script is
+.Pa /usr/src/release/picobsd/build/picobsd
+which can be run from anywhere, and relies on the
+.Xr sysutils/makefs
+port to build a filesystem without requiring
+.Xr mdconfig
+or root privileges to mount a filesystem.
+When run in interactive mode (the default without the
+.Fl n
+option), the script will let you configure the various parameters
+used to build the PicoBSD image.
+An image is configured
+using the files and directories described below.
+The base system contains a template, called
+.Pa bridge
+for historical reasons,
+that can be used as a base for building various kinds
+of network appliances.
+.Pp
+You can define your own PicoBSD configuration, by creating a directory
+with a name of your choice (e.g.\&
+.Pa FOO )
+which contains
+some of the following files and directories.
+For more
+information on how to construct these files, look at one
+of the standard
+.Nm
+configurations as a reference.
+.Bl -tag -width indent
+.It Pa PICOBSD
+The kernel configuration file (required).
+This is a mostly standard
+kernel configuration file, possibly stripped down by removing
+unnecessary drivers and options to reduce the kernel's size.
+.Pp
+To be recognised as a
+.Nm
+kernel config file, the file must also contain the line
+beginning with
+.Dq Li #PicoBSD
+below, and a matching
+.Dv MD_ROOT_SIZE
+option:
+.Bd -literal -offset indent
+#marker def_sz init MFS_inodes floppy_inodes
+#PicoBSD 4200 init 8192 32768
+options MD_ROOT_SIZE=4200 # same as def_sz
+.Ed
+.Pp
+This informs the script of the size of the memory file system and
+provides a few other details on how to build the image.
+.It Pa crunch.conf
+.Xr crunchgen 1
+configuration (required).
+It contains the list of directories containing program sources,
+the list of binaries to be built, and the list of libraries that
+these programs use.
+See the
+.Xr crunchgen 1
+manpage for the exact details on the syntax of this file.
+.Pp
+The following issues are particularly important when dealing
+with
+.Nm
+configurations:
+.Bl -bullet
+.It
+We can pass build options to those makefiles which understand
+that, in order to reduce the size of the programs.
+This is achieved with a line of the form
+.Pp
+.Dl "buildopts -DNO_PAM -DRELEASE_CRUNCH ..."
+.It
+When providing the list of directories where source files are, it
+is convenient to list the following entry first:
+.Pp
+.Dl "srcdirs /usr/src/release/picobsd/tinyware"
+.Pp
+so that
+.Nm Ns -specific
+versions of the programs will be found there.
+.It
+The string
+.Dq Li @__CWD__@
+is replaced with the full pathname of the directory where the
+.Nm
+configuration resides (i.e., the one where we find
+.Pa PICOBSD , crunch.conf ,
+and so on).
+This can be useful to refer source code that resides within a
+configuration, e.g.\&
+.Pp
+.Dl "srcdirs @__CWD__@/src"
+.El
+.It Pa config
+Shell variables, sourced by the
+.Nm
+script (optional).
+The most important variables here are:
+.Bl -tag -width ".Va MY_DEVS"
+.It Va MY_DEVS
+(Not used in
+.Fx 5.0
+where we have
+.Xr devfs 5 ) .
+Should be set to the list of devices to be created in the
+.Pa /dev
+directory of the image (it is really the argument passed to
+.Xr MAKEDEV 8 ,
+so refer to that manpage for the names).
+.It Va fd_size
+Size (in kilobytes) of the
+.Nm
+image.
+By default,
+.Va fd_size
+is set to 1440
+which produces an image suitable for a standard floppy.
+.Pp
+If you plan to store the image on a CDROM (e.g.\& using
+the
+.Dq "El Torito"
+floppy emulation), you can set
+.Va fd_size
+equal to 2880.
+If you are planning to dump the image onto a hard disk
+(either in a partition or on the whole disk), you
+are not restricted to one of the standard floppy sizes.
+Using a large image size per se does not waste RAM at runtime,
+because only the files that are actually loaded from the image
+contribute to the memory usage.
+.It Va import_files
+Contains a list of files to be imported in the floppy tree.
+Absolute names refer to the standard file system, relative
+names refer to the root of the source tree being used
+(i.e.\&
+.Va SRC_PATH/.. ) .
+You can normally use this option if you want to import
+files such as shared libraries, or databases, without
+having to replicate them first in your configuration
+under the
+.Pa floppy.tree/
+directory.
+.El
+.It Pa floppy.tree.exclude
+List of files from the standard floppy tree which
+we do not want to be copied (optional).
+.It Pa floppy.tree/
+Local additions to the standard floppy tree (optional).
+The content of this subtree will be copied as-is into the
+floppy image.
+.It Pa floppy.tree. Ns Aq Ar site-name
+Same as above, but site-specific (optional).
+.El
+.Pp
+More information on the build process can be found in the
+comments in the
+.Nm
+script.
+.Sh USING ALTERNATE SOURCE TREES
+The build script can be instructed to use an alternate source tree
+using the
+.Fl -src Ar SRC_PATH
+option.
+The tree that you specify must contain full sources for the kernel
+and for all programs that you want to include in your image.
+As an example, to cross-build the
+.Pa bridge
+floppy
+using RELENG_4 sources, you can do the following:
+.Bd -literal -offset indent
+cd <some_empty_directory>
+mkdir FOO
+(cd FOO; cvs -d<my_repository> co -rRELENG_4 src)
+picobsd --src FOO/src --init # this is needed only once
+picobsd --src FOO/src -n -v bridge
+.Ed
+.Pp
+If the build is successful, the directory
+.Pa build_dir-bridge/
+will contain a
+.Pa kernel
+that can be downloaded with
+.Xr etherboot ,
+a floppy image called
+.Pa picobsd.bin ,
+plus the products of the compilation in other directories.
+If you want to modify the source tree in
+.Pa FOO/src ,
+a new image can be produced by simply running
+.Pp
+.Dl "picobsd --src FOO/src -n -v bridge"
+.Pp
+whereas if the change affects include files or libraries
+you first need to update them, e.g.\& by re-running
+.Pp
+.Dl "picobsd --src FOO/src --init # this is needed only once"
+.Pp
+as you would normally do for any change of this kind.
+.Sh INSTALLING PicoBSD
+.Ss Floppy Install
+Historically,
+.Nm
+is run from a floppy disk, where it can be installed with a simple
+.Pp
+.Dl "dd if=picobsd.bin of=/dev/rfd0"
+.Pp
+and the floppy is ready to boot.
+.Ss Hard Disk Install
+The same process can be used to store the image on a hard disk
+(entire volume or one of the slices):
+.Bd -literal -offset indent
+dd if=picobsd.bin of=/dev/ad2
+dd if=picobsd.bin of=/dev/ad2s3
+dd if=picobsd.bin of=/dev/ad2 oseek=NN
+.Ed
+.Pp
+The first form will install the image on the entire disk, and it
+should work in the same way as for a floppy.
+.Pp
+The second form will install the image
+on slice number 3 (which should be large enough to store the
+contents of the image).
+However, the process will only have success if the
+partition does not contain a valid disklabel, otherwise the kernel will
+likely prevent overwriting the label.
+In this case you can use the
+third form, replacing
+.Ar NN
+with the actual start of the partition
+(which you can determine using
+.Xr fdisk 8 ) .
+Note that after saving the image to the slice, it will not yet be
+recognised.
+You have to use the
+.Xr disklabel 8
+command to properly initialize the label (do not ask why!).
+One way to do this is
+.Bd -literal -offset indent
+disklabel -w ad0s2 auto
+disklabel -e ad0s2
+.Ed
+.Pp
+and from the editor enter a line corresponding to the actual partition, e.g.\&
+if the image has 2.88MB (5760 sectors) you need to enter the following
+line for the partition:
+.Pp
+.Dl "a: 5760 0 4.2BSD 512 4096"
+.Pp
+At this point the partition is bootable.
+Note that the image size can be smaller than the slice size
+(indicated as partition
+.Dq Li c: ) .
+.Ss CDROM Install
+.Nm
+can produce an ISO image named picobsd.iso,
+which does not use
+.Dq "El Torito"
+emulation, so it has no size restrictions.
+Installing means just burning a media with the file.
+.Ss Booting From The Network
+Yet another way to use
+.Nm
+is to boot the image off the network.
+For this purpose you should use the uncompressed kernel which is
+available as a byproduct of the compilation.
+Refer to the documentation
+for network booting for more details, the
+.Nm
+kernel is bootable as a standard
+.Fx
+kernel.
+.Sh BOOTING PicoBSD
+To boot
+.Nm ,
+insert the floppy and reset the machine.
+The boot procedure is similar to the
+standard
+.Fx
+boot.
+Booting from a floppy is normally rather slow (in the order of 1-2
+minutes), things are much faster if you store your image on
+a hard disk, Compact Flash, or CDROM.
+.Pp
+You can also use
+.Xr etherboot
+to load the preloaded, uncompressed kernel image
+which is a byproduct of the
+.Nm
+build.
+In this case
+the load time is a matter of a few seconds, even on a 10Mbit/s
+ethernet.
+.Pp
+After booting,
+.Nm
+loads the root file system from the memory file system, starts
+.Pa /sbin/init ,
+and passes control to a first startup script,
+.Pa /etc/rc .
+The latter populates the
+.Pa /etc
+and
+.Pa /root
+directories with the default files, then tries to identify the boot
+device (floppy, hard disk partition) and possibly override the contents
+of the root file system with files read from the boot device.
+This allows you to store local configuration on the same media.
+After this phase the boot device is no longer used, unless the
+user specifically does it.
+.Pp
+After this, control is transferred to a second script,
+.Pa /etc/rc1
+(which can be overridden from the boot device).
+This script tries to associate a hostname to the system by using
+the MAC address of the first ethernet interface as a key, and
+.Pa /etc/hosts
+as a lookup table.
+Then control is passed to the main user configuration script,
+.Pa /etc/rc.conf ,
+which is supposed to override the value of a number of configuration
+variables which have been pre-set in
+.Pa /etc/rc.conf.defaults .
+You can use the
+.Va hostname
+variable to create different configurations from the same file.
+After taking control back,
+.Pa /etc/rc1
+completes the initializations, and as part of this
+it configures network interfaces and optionally calls the
+firewall configuration script,
+.Pa /etc/rc.firewall ,
+where the user can store his own firewall configuration.
+.Pp
+Note that by default
+.Nm
+runs entirely from main memory, and has no swap space, unless you
+explicitly request it.
+The boot device is also not used anymore after
+.Pa /etc/rc1
+takes control, again, unless you explicitly request it.
+.Sh CONFIGURING a PicoBSD system
+The operation of a
+.Nm
+system can be configured through a few files which are read at boot
+time, very much like a standard
+.Fx
+system.
+There are, however, some minor differences to reduce the
+number of files to store and/or customize, thus saving space.
+Among the files to configure we have the following:
+.Bl -tag -width indent
+.It Pa /etc/hosts
+Traditionally, this file contains the IP-to-hostname mappings.
+In addition to this, the
+.Nm
+version of this file also contains
+a mapping between Ethernet (MAC) addresses and hostnames, as follows:
+.Bd -literal -offset indent
+#ethertable start of the ethernet->hostname mapping
+# mac_address hostname
+# 00:12:34:56:78:9a pinco
+# 12:34:56:* pallino
+# * this-matches-all
+.Ed
+.Pp
+where the line containing
+.Dq Li #ethertable
+marks the start of the table.
+.Pp
+If the MAC address is not found, the script will prompt you to
+enter a hostname and IP address for the system, and this
+information will be stored in the
+.Pa /etc/hosts
+file (in memory) so you can simply store them on disk later.
+.Pp
+Note that you can use wildcards in the address part, so a line
+like the last one in the example will match any MAC address and
+avoid the request.
+.It Pa /etc/rc.conf
+This file contains a number of variables which control the
+operation of the system, such as interface configuration,
+router setup, network service startup, etc.
+For the exact list and meaning of these variables see
+.Pa /etc/rc.conf.defaults .
+.Pp
+It is worth mentioning that some of the variables let you
+overwrite the contents of some files in
+.Pa /etc .
+This option is available at the moment for
+.Pa /etc/host.conf
+and
+.Pa /etc/resolv.conf ,
+whose contents are generally very short and suitable for this
+type of updating.
+In case you use these variables, remember to use newlines
+as appropriate, e.g.\&
+.Bd -literal -offset indent
+host_conf="# this goes into /etc/host.conf
+hosts
+bind"
+.Ed
+.Pp
+Although not mandatory, in this file you should only set the
+variables indicated in
+.Pa /etc/rc.conf.defaults ,
+and avoid starting services which depend on having the network running.
+This can be done at a later time: if you set
+.Va firewall_enable Ns = Ns Qq Li YES ,
+the
+.Pa /etc/rc.firewall
+script will be run after configuring the network interfaces,
+so you can set up your firewall and safely start network services or enable
+things such as routing and bridging.
+.It Pa /etc/rc.firewall
+This script can be used to configure the
+.Xr ipfw 4
+firewall.
+On entry, the
+.Va fwcmd
+variable is set to the pathname of the firewall command,
+.Va firewall_type
+contains the value set in
+.Pa /etc/rc.conf ,
+and
+.Va hostname
+contains the name assigned to the host.
+.El
+.Pp
+There is a small script called
+.Nm update
+which can be used to edit and/or save to disk a copy of the files
+you have modified after booting.
+The script takes one or more absolute pathnames, runs the
+editor on the files passed as arguments, and then saves a
+compressed copy of the files on the disk (mounting and
+unmounting the latter around the operation).
+.Pp
+If invoked without arguments,
+.Nm update
+edits and saves
+.Pa rc.conf , rc.firewall ,
+and
+.Pa master.passwd .
+.Pp
+If one of the arguments is
+.Pa /etc
+(the directory name alone),
+then the command saves to disk (without editing)
+all the files in the directory for which a copy
+already exists on disk (e.g.\& as a result of a previous update).
+.Sh SEE ALSO
+.Xr crunchgen 1 ,
+.Xr mdconfig 8 ,
+.Xr nanobsd 8 ,
+.Xr swapon 8
+.Sh AUTHORS
+.An -nosplit
+.An Andrzej Bialecki Aq abial@FreeBSD.org ,
+with subsequent work on the scripts by
+.An Luigi Rizzo Aq luigi@iet.unipi.it
+and others.
+Man page and
+.Pa Makefiles
+created by
+.An Greg Lehey Aq grog@lemis.com .
+.Sh BUGS
+Documentation is still incomplete.
diff --git a/share/man/man8/rc.8 b/share/man/man8/rc.8
new file mode 100644
index 000000000000..56a33ce5b8fa
--- /dev/null
+++ b/share/man/man8/rc.8
@@ -0,0 +1,541 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Portions of this manual page are Copyrighted by
+.\" The NetBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)rc.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2012
+.Dt RC 8
+.Os
+.Sh NAME
+.Nm rc
+.Nd command scripts for auto-reboot and daemon startup
+.Sh SYNOPSIS
+.Nm
+.Nm rc.conf
+.Nm rc.conf.local
+.Nm rc.d/
+.Nm rc.firewall
+.Nm rc.local
+.Nm rc.shutdown
+.Nm rc.subr
+.Sh DESCRIPTION
+The
+.Nm
+utility is the command script which controls the automatic boot process
+after being called by
+.Xr init 8 .
+The
+.Nm rc.local
+script contains commands which are pertinent only
+to a specific site.
+Typically, the
+.Pa /usr/local/etc/rc.d/
+mechanism is used instead of
+.Nm rc.local
+these days but if
+you want to use
+.Nm rc.local ,
+it is still supported.
+In this case, it should source
+.Pa /etc/rc.conf
+and contain additional custom startup code for your system.
+The best way to handle
+.Nm rc.local ,
+however, is to separate it out into
+.Nm rc.d/
+style scripts and place them under
+.Pa /usr/local/etc/rc.d/ .
+The
+.Nm rc.conf
+file contains the global system configuration information referenced
+by the startup scripts, while
+.Nm rc.conf.local
+contains the local system configuration.
+See
+.Xr rc.conf 5
+for more information.
+.Pp
+The
+.Nm rc.d/
+directories contain scripts which will be automatically
+executed at boot time and shutdown time.
+.Ss Operation of Nm
+.Bl -enum
+.It
+If autobooting, set
+.Va autoboot Ns = Ns Li yes
+and enable a flag
+.Pq Va rc_fast Ns = Ns Li yes ,
+which prevents the
+.Nm rc.d/
+scripts from performing the check for already running processes
+(thus speeding up the boot process).
+This
+.Va rc_fast Ns = Ns Li yes
+speedup will not occur when
+.Nm
+is started up after exiting the single-user shell.
+.It
+Determine whether the system is booting diskless,
+and if so run the
+.Pa /etc/rc.initdiskless
+script.
+.It
+Source
+.Pa /etc/rc.subr
+to load various
+.Xr rc.subr 8
+shell functions to use.
+.It
+Load the configuration files.
+.It
+Determine if booting in a jail,
+and add
+.Dq Li nojail
+to the list of KEYWORDS to skip in
+.Xr rcorder 8 .
+.It
+Invoke
+.Xr rcorder 8
+to order the files in
+.Pa /etc/rc.d/
+that do not have a
+.Dq Li nostart
+KEYWORD (refer to
+.Xr rcorder 8 Ns 's
+.Fl s
+flag).
+.It
+Call each script in turn using
+.Fn run_rc_script
+(from
+.Xr rc.subr 8 ) ,
+which sets
+.Va $1
+to
+.Dq Li start ,
+and sources the script in a subshell.
+If the script has a
+.Pa .sh
+suffix then it is sourced directly into the current shell.
+Stop processing when the script that is the value of the
+.Va $early_late_divider
+has been run.
+.It
+Re-run
+.Xr rcorder 8 ,
+this time including the scripts in the
+.Va $local_startup
+directories.
+Ignore everything up to the
+.Va $early_late_divider ,
+then start executing the scripts as described above.
+.El
+.Ss Operation of Nm rc.shutdown
+.Bl -enum
+.It
+Source
+.Pa /etc/rc.subr
+to load various
+.Xr rc.subr 8
+shell functions to use.
+.It
+Load the configuration files.
+.It
+Invoke
+.Xr rcorder 8
+to order the files in
+.Pa /etc/rc.d/
+and the
+.Va $local_startup
+directories
+that have a
+.Dq Li shutdown
+KEYWORD (refer to
+.Xr rcorder 8 Ns 's
+.Fl k
+flag),
+reverse that order, and assign the result to a variable.
+.It
+Call each script in turn using
+.Fn run_rc_script
+(from
+.Xr rc.subr 8 ) ,
+which sets
+.Va $1
+to
+.Dq Li stop ,
+and sources the script in a subshell.
+If the script has a
+.Pa .sh
+suffix then it is sourced directly into the current shell.
+.El
+.Ss Contents of Nm rc.d/
+.Nm rc.d/
+is located in
+.Pa /etc/rc.d/ .
+The following file naming conventions are currently used in
+.Nm rc.d/ :
+.Bl -tag -width ".Pa ALLUPPERCASE" -offset indent
+.It Pa ALLUPPERCASE
+Scripts that are
+.Dq placeholders
+to ensure that certain operations are performed before others.
+In order of startup, these are:
+.Bl -tag -width ".Pa NETWORKING"
+.It Pa NETWORKING
+Ensure basic network services are running, including general
+network configuration.
+.It Pa SERVERS
+Ensure basic services
+exist for services that start early (such as
+.Pa named ) ,
+because they are required by
+.Pa DAEMON
+below.
+.It Pa DAEMON
+Check-point before all general purpose daemons such as
+.Pa lpd
+and
+.Pa ntpd .
+.It Pa LOGIN
+Check-point before user login services
+.Pa ( inetd
+and
+.Pa sshd ) ,
+as well as services which might run commands as users
+.Pa ( cron
+and
+.Pa sendmail ) .
+.El
+.It Pa foo.sh
+Scripts that are to be sourced into the current shell rather than a subshell
+have a
+.Pa .sh
+suffix.
+Extreme care must be taken in using this, as the startup sequence will
+terminate if the script does.
+.It Pa bar
+Scripts that are sourced in a subshell.
+The boot does not stop if such a script terminates with a non-zero status,
+but a script can stop the boot if necessary by invoking the
+.Fn stop_boot
+function (from
+.Xr rc.subr 8 ).
+.El
+.Pp
+Each script should contain
+.Xr rcorder 8
+keywords, especially an appropriate
+.Dq Li PROVIDE
+entry, and if necessary
+.Dq Li REQUIRE
+and
+.Dq Li BEFORE
+keywords.
+.Pp
+Each script is expected to support at least the following arguments, which
+are automatically supported if it uses the
+.Fn run_rc_command
+function:
+.Bl -tag -width ".Cm restart" -offset indent
+.It Cm start
+Start the service.
+This should check that the service is to be started as specified by
+.Xr rc.conf 5 .
+Also checks if the service is already running and refuses to start if
+it is.
+This latter check is not performed by standard
+.Fx
+scripts if the system is starting directly to multi-user mode, to
+speed up the boot process.
+If
+.Cm forcestart
+is given, ignore the
+.Xr rc.conf 5
+check and start anyway.
+.It Cm stop
+If the service is to be started as specified by
+.Xr rc.conf 5 ,
+stop the service.
+This should check that the service is running and complain if it is not.
+If
+.Cm forcestop
+is given, ignore the
+.Xr rc.conf 5
+check and attempt to stop.
+.It Cm restart
+Perform a
+.Cm stop
+then a
+.Cm start .
+.It Cm status
+If the script starts a process (rather than performing a one-off
+operation), show the status of the process.
+Otherwise it is not necessary to support this argument.
+Defaults to displaying the process ID of the program (if running).
+.It Cm poll
+If the script starts a process (rather than performing a one-off
+operation), wait for the command to exit.
+Otherwise it is not necessary to support this argument.
+.It Cm rcvar
+Display which
+.Xr rc.conf 5
+variables are used to control the startup of the service (if any).
+.El
+.Pp
+If a script must implement additional commands it can list them in
+the
+.Va extra_commands
+variable, and define their actions in a variable constructed from
+the command name (see the
+.Sx EXAMPLES
+section).
+.Pp
+The following key points apply to old-style scripts in
+.Pa /usr/local/etc/rc.d/ :
+.Bl -bullet
+.It
+Scripts are only executed if their
+.Xr basename 1
+matches the shell globbing pattern
+.Pa *.sh ,
+and they are executable.
+Any other files or directories present within the directory are silently
+ignored.
+.It
+When a script is executed at boot time, it is passed the string
+.Dq Li start
+as its first and only argument.
+At shutdown time, it is passed the string
+.Dq Li stop
+as its first and only argument.
+All
+.Nm rc.d/
+scripts are expected to handle these arguments appropriately.
+If no action needs to be taken at a given time
+(either boot time or shutdown time),
+the script should exit successfully and without producing an error message.
+.It
+The scripts within each directory are executed in lexicographical order.
+If a specific order is required,
+numbers may be used as a prefix to the existing filenames,
+so for example
+.Pa 100.foo
+would be executed before
+.Pa 200.bar ;
+without the numeric prefixes the opposite would be true.
+.It
+The output from each script is traditionally a space character,
+followed by the name of the software package being started or shut down,
+.Em without
+a trailing newline character (see the
+.Sx EXAMPLES
+section).
+.El
+.Sh SCRIPTS OF INTEREST
+When an automatic reboot is in progress,
+.Nm
+is invoked with the argument
+.Cm autoboot .
+One of the scripts run from
+.Pa /etc/rc.d/
+is
+.Pa /etc/rc.d/fsck .
+This script runs
+.Xr fsck 8
+with option
+.Fl p
+and
+.Fl F
+to
+.Dq preen
+all the disks of minor inconsistencies resulting
+from the last system shutdown.
+If this fails, then checks/repairs of serious inconsistencies
+caused by hardware or software failure will be performed
+in the background at the end of the booting process.
+If
+.Cm autoboot
+is not set, when going from single-user to multi-user mode for example,
+the script does not do anything.
+.Pp
+The
+.Pa /etc/rc.d/local
+script can execute scripts from multiple
+.Nm rc.d/
+directories.
+The default location includes
+.Pa /usr/local/etc/rc.d/ ,
+but these may be overridden with the
+.Va local_startup
+.Xr rc.conf 5
+variable.
+.Pp
+The
+.Pa /etc/rc.d/serial
+script is used to set any special configurations for serial devices.
+.Pp
+The
+.Nm rc.firewall
+script is used to configure rules for the kernel based firewall
+service.
+It has several possible options:
+.Pp
+.Bl -tag -width ".Ar filename" -compact -offset indent
+.It Cm open
+will allow anyone in
+.It Cm client
+will try to protect just this machine
+.It Cm simple
+will try to protect a whole network
+.It Cm closed
+totally disables IP services except via
+.Pa lo0
+interface
+.It Cm UNKNOWN
+disables the loading of firewall rules
+.It Ar filename
+will load the rules in the given filename (full path required).
+.El
+.Pp
+The
+.Pa /etc/rc.d/atm*
+scripts are used to configure ATM network interfaces.
+The interfaces are configured in three passes.
+The first pass performs the initial interface configuration.
+The second pass completes the interface configuration and defines PVCs and
+permanent ATMARP entries.
+The third pass starts any ATM daemons.
+.Pp
+Most daemons, including network related daemons, have their own script in
+.Pa /etc/rc.d/ ,
+which can be used to start, stop, and check the status of the service.
+.Pp
+Any architecture specific scripts, such as
+.Pa /etc/rc.d/apm
+for example, specifically check that they are on that architecture
+before starting the daemon.
+.Pp
+Following tradition, all startup files reside in
+.Pa /etc .
+.Sh FILES
+.Bl -tag -compact
+.It Pa /etc/rc
+.It Pa /etc/rc.conf
+.It Pa /etc/rc.conf.local
+.It Pa /etc/rc.d/
+.It Pa /etc/rc.firewall
+.It Pa /etc/rc.local
+.It Pa /etc/rc.shutdown
+.It Pa /etc/rc.subr
+.It Pa /var/run/dmesg.boot
+.Xr dmesg 8
+results soon after the
+.Nm
+process begins.
+Useful when
+.Xr dmesg 8
+buffer in the kernel no longer has this information.
+.El
+.Sh EXAMPLES
+The following is a minimal
+.Nm rc.d/
+style script.
+Most scripts require little more than the following.
+.Bd -literal -offset indent
+#!/bin/sh
+#
+
+# PROVIDE: foo
+# REQUIRE: bar_service_required_to_precede_foo
+
+\&. /etc/rc.subr
+
+name="foo"
+rcvar=foo_enable
+command="/usr/local/bin/foo"
+
+load_rc_config $name
+run_rc_command "$1"
+.Ed
+.Pp
+Certain scripts may want to provide enhanced functionality.
+The user may access this functionality through additional commands.
+The script may list and define as many commands at it needs.
+.Bd -literal -offset indent
+#!/bin/sh
+#
+
+# PROVIDE: foo
+# REQUIRE: bar_service_required_to_precede_foo
+# BEFORE: baz_service_requiring_foo_to_precede_it
+
+\&. /etc/rc.subr
+
+name="foo"
+rcvar=foo_enable
+command="/usr/local/bin/foo"
+extra_commands="nop hello"
+hello_cmd="echo Hello World."
+nop_cmd="do_nop"
+
+do_nop()
+{
+ echo "I do nothing."
+}
+
+load_rc_config $name
+run_rc_command "$1"
+.Ed
+.Pp
+As all processes are killed by
+.Xr init 8
+at shutdown, the explicit
+.Xr kill 1
+is unnecessary, but is often included.
+.Sh SEE ALSO
+.Xr kill 1 ,
+.Xr rc.conf 5 ,
+.Xr init 8 ,
+.Xr rcorder 8 ,
+.Xr rc.subr 8 ,
+.Xr reboot 8 ,
+.Xr savecore 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.0 .
diff --git a/share/man/man8/rc.sendmail.8 b/share/man/man8/rc.sendmail.8
new file mode 100644
index 000000000000..14a30e4a7371
--- /dev/null
+++ b/share/man/man8/rc.sendmail.8
@@ -0,0 +1,262 @@
+.\" Copyright (c) 1995
+.\" Jordan K. Hubbard
+.\" Copyright (c) 2002 The FreeBSD Project
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 30, 2002
+.Dt RC.SENDMAIL 8
+.Os
+.Sh NAME
+.Nm rc.sendmail
+.Nd
+.Xr sendmail 8
+startup script
+.Sh DESCRIPTION
+The
+.Nm
+script is used by
+.Pa /etc/rc
+at boot time to start
+.Xr sendmail 8 .
+It is meant to be
+.Xr sendmail 8
+specific and not a generic script for all MTAs.
+It is only called by
+.Pa /etc/rc
+if the
+.Xr rc.conf 5
+.Va mta_start_script
+variable is set to
+.Pa /etc/rc.sendmail .
+.Pp
+The
+.Nm
+script can take an optional argument specifying the action to
+perform.
+The available actions are:
+.Bl -tag -width ".Cm restart-mspq"
+.It Cm start
+Starts both the MTA and the MSP queue runner.
+.It Cm stop
+Stops both the MTA and the MSP queue runner.
+.It Cm restart
+Restarts both the MTA and the MSP queue runner.
+.It Cm start-mta
+Starts just the MTA.
+.It Cm stop-mta
+Stops just the MTA.
+.It Cm restart-mta
+Restarts just the MTA.
+.It Cm start-mspq
+Starts just the MSP queue runner.
+.It Cm stop-mspq
+Stops just the MSP queue runner.
+.It Cm restart-mspq
+Restarts just the MSP queue runner.
+.El
+.Pp
+If no action is specified,
+.Cm start
+is assumed.
+.Pp
+The
+.Nm
+script is also used by
+.Pa /etc/mail/Makefile
+to enable the
+.Pa Makefile Ns 's
+.Cm start , stop ,
+and
+.Cm restart
+targets.
+.Sh RC.CONF VARIABLES
+The following variables affect the behavior of
+.Nm .
+They are defined in
+.Pa /etc/defaults/rc.conf
+and can be changed in
+.Pa /etc/rc.conf .
+.Bl -tag -width indent
+.It Va sendmail_enable
+.Pq Vt str
+If set to
+.Dq Li YES ,
+run the
+.Xr sendmail 8
+daemon at system boot time.
+If set to
+.Dq Li NO ,
+do not run a
+.Xr sendmail 8
+daemon to listen for incoming network mail.
+This does not preclude a
+.Xr sendmail 8
+daemon listening on the SMTP port of the loopback interface.
+The
+.Dq Li NONE
+option is deprecated and should not be used.
+It will be removed in a future release.
+.It Va sendmail_flags
+.Pq Vt str
+If
+.Va sendmail_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_submit_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and
+.Va sendmail_enable
+is set to
+.Dq Li NO ,
+run
+.Xr sendmail 8
+using
+.Va sendmail_submit_flags
+instead of
+.Va sendmail_flags .
+This is intended to allow local mail submission via
+a localhost-only listening SMTP service required for running
+.Xr sendmail 8
+as a non-set-user-ID binary.
+Note that this does not work inside
+.Xr jail 2
+systems, as jails do not allow binding to just the localhost interface.
+.It Va sendmail_submit_flags
+.Pq Vt str
+If
+.Va sendmail_enable
+is set to
+.Dq Li NO
+and
+.Va sendmail_submit_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_outbound_enable
+.Pq Vt bool
+If set to
+.Dq Li YES
+and both
+.Va sendmail_enable
+and
+.Va sendmail_submit_enable
+are set to
+.Dq Li NO ,
+run
+.Xr sendmail 8
+using
+.Va sendmail_outbound_flags
+instead of
+.Va sendmail_flags .
+This is intended to allow local mail queue management
+for systems that do not offer a listening SMTP service.
+.It Va sendmail_outbound_flags
+.Pq Vt str
+If both
+.Va sendmail_enable
+and
+.Va sendmail_submit_enable
+are set to
+.Dq Li NO
+and
+.Va sendmail_outbound_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.It Va sendmail_msp_queue_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+start a client (MSP) queue runner
+.Xr sendmail 8
+daemon at system boot time.
+As of sendmail 8.12, a separate queue is used for command line
+submissions.
+The client queue runner ensures that nothing is
+left behind in the submission queue.
+.It Va sendmail_msp_queue_flags
+.Pq Vt str
+If
+.Va sendmail_msp_queue_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr sendmail 8
+daemon.
+.El
+.Pp
+These variables are used to determine how the
+.Xr sendmail 8
+daemons are started:
+.Bd -literal -offset indent
+# MTA
+if (${sendmail_enable} == NONE)
+ # Do nothing
+else if (${sendmail_enable} == YES)
+ start sendmail with ${sendmail_flags}
+else if (${sendmail_submit_enable} == YES)
+ start sendmail with ${sendmail_submit_flags}
+else if (${sendmail_outbound_enable} == YES)
+ start sendmail with ${sendmail_outbound_flags}
+endif
+
+# MSP Queue Runner
+if (${sendmail_enable} != NONE &&
+ [ -r /etc/mail/submit.cf] &&
+ ${sendmail_msp_queue_enable} == YES)
+ start sendmail with ${sendmail_msp_queue_flags}
+endif
+.Ed
+.Pp
+To completely prevent any
+.Xr sendmail 8
+daemons from starting, you must
+set the following variables in
+.Pa /etc/rc.conf :
+.Bd -literal -offset indent
+sendmail_enable="NO"
+sendmail_submit_enable="NO"
+sendmail_outbound_enable="NO"
+sendmail_msp_queue_enable="NO"
+.Ed
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr rc 8 ,
+.Xr sendmail 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 4.6 .
diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8
new file mode 100644
index 000000000000..8ed2470ba365
--- /dev/null
+++ b/share/man/man8/rc.subr.8
@@ -0,0 +1,878 @@
+.\" $NetBSD: rc.subr.8,v 1.12 2004/01/06 00:52:24 lukem Exp $
+.\"
+.\" Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2012
+.Dt RC.SUBR 8
+.Os
+.Sh NAME
+.Nm rc.subr
+.Nd functions used by system shell scripts
+.Sh SYNOPSIS
+.Bl -item -compact
+.It
+.Ic .\& Pa /etc/rc.subr
+.Pp
+.It
+.Ic backup_file Ar action Ar file Ar current Ar backup
+.It
+.Ic checkyesno Ar var
+.It
+.Ic check_pidfile Ar pidfile Ar procname Op Ar interpreter
+.It
+.Ic check_process Ar procname Op Ar interpreter
+.It
+.Ic debug Ar message
+.It
+.Ic err Ar exitval Ar message
+.It
+.Ic force_depend Ar name
+.It
+.Ic info Ar message
+.It
+.Ic load_kld Oo Fl e Ar regex Oc Oo Fl m Ar module Oc Ar file
+.It
+.Ic load_rc_config Ar name
+.It
+.Ic load_rc_config_var Ar name Ar var
+.It
+.Ic mount_critical_filesystems Ar type
+.It
+.Ic rc_usage Ar command ...
+.It
+.Ic reverse_list Ar item ...
+.It
+.Ic run_rc_command Ar argument
+.It
+.Ic run_rc_script Ar file Ar argument
+.It
+.Ic wait_for_pids Op Ar pid ...
+.It
+.Ic warn Ar message
+.El
+.Sh DESCRIPTION
+The
+.Nm
+script
+contains commonly used shell script functions and variable
+definitions which are used by various scripts such as
+.Xr rc 8 .
+Scripts required by ports in
+.Pa /usr/local/etc/rc.d
+will also eventually
+be rewritten to make use of it.
+.Pp
+The
+.Nm
+functions were mostly imported from
+.Nx .
+.Pp
+They are accessed by sourcing
+.Pa /etc/rc.subr
+into the current shell.
+.Pp
+The following shell functions are available:
+.Bl -tag -width 4n
+.It Ic backup_file Ar action file current backup
+Make a backup copy of
+.Ar file
+into
+.Ar current .
+If the
+.Xr rc.conf 5
+variable
+.Va backup_uses_rcs
+is
+.Dq Li YES ,
+use
+.Xr rcs 1
+to archive the previous version of
+.Ar current ,
+otherwise save the previous version of
+.Ar current
+as
+.Ar backup .
+.Pp
+The
+.Ar action
+argument
+may be one of the following:
+.Bl -tag -width ".Cm remove"
+.It Cm add
+.Ar file
+is now being backed up by or possibly re-entered into this backup mechanism.
+.Ar current
+is created, and if necessary, the
+.Xr rcs 1
+files are created as well.
+.It Cm update
+.Ar file
+has changed and needs to be backed up.
+If
+.Ar current
+exists, it is copied to
+.Ar backup
+or checked into
+.Xr rcs 1
+(if the repository file is old),
+and then
+.Ar file
+is copied to
+.Ar current .
+.It Cm remove
+.Ar file
+is no longer being tracked by this backup mechanism.
+If
+.Xr rcs 1
+is being used, an empty file is checked in and
+.Ar current
+is removed,
+otherwise
+.Ar current
+is moved to
+.Ar backup .
+.El
+.It Ic checkyesno Ar var
+Return 0 if
+.Ar var
+is defined to
+.Dq Li YES ,
+.Dq Li TRUE ,
+.Dq Li ON ,
+or
+.Ql 1 .
+Return 1 if
+.Ar var
+is defined to
+.Dq Li NO ,
+.Dq Li FALSE ,
+.Dq Li OFF ,
+or
+.Ql 0 .
+Otherwise, warn that
+.Ar var
+is not set correctly.
+The values are case insensitive.
+.Sy Note :
+.Ar var
+should be a variable name, not its value;
+.Ic checkyesno
+will expand the variable by itself.
+.It Ic check_pidfile Ar pidfile procname Op Ar interpreter
+Parses the first word of the first line of
+.Ar pidfile
+for a PID, and ensures that the process with that PID
+is running and its first argument matches
+.Ar procname .
+Prints the matching PID if successful, otherwise nothing.
+If
+.Ar interpreter
+is provided, parse the first line of
+.Ar procname ,
+ensure that the line is of the form:
+.Pp
+.Dl "#! interpreter [...]"
+.Pp
+and use
+.Ar interpreter
+with its optional arguments and
+.Ar procname
+appended as the process string to search for.
+.It Ic check_process Ar procname Op Ar interpreter
+Prints the PIDs of any processes that are running with a first
+argument that matches
+.Ar procname .
+.Ar interpreter
+is handled as per
+.Ic check_pidfile .
+.It Ic debug Ar message
+Display a debugging message to
+.Va stderr ,
+log it to the system log using
+.Xr logger 1 ,
+and
+return to the caller.
+The error message consists of the script name
+(from
+.Va $0 ) ,
+followed by
+.Dq Li ": DEBUG: " ,
+and then
+.Ar message .
+This function is intended to be used by developers
+as an aid to debugging scripts.
+It can be turned on or off
+by the
+.Xr rc.conf 5
+variable
+.Va rc_debug .
+.It Ic err Ar exitval message
+Display an error message to
+.Va stderr ,
+log it to the system log
+using
+.Xr logger 1 ,
+and
+.Ic exit
+with an exit value of
+.Ar exitval .
+The error message consists of the script name
+(from
+.Va $0 ) ,
+followed by
+.Dq Li ": ERROR: " ,
+and then
+.Ar message .
+.It Ic force_depend Ar name
+Output an advisory message and force the
+.Ar name
+service to start.
+The
+.Ar name
+argument is the
+.Xr basename 1
+component of the path to the script, usually
+.Pa /etc/rc.d/name .
+If the script fails for any reason it will output a warning
+and return with a return value of 1.
+If it was successful
+it will return 0.
+.It Ic info Ar message
+Display an informational message to
+.Va stdout ,
+and log it to the system log using
+.Xr logger 1 .
+The message consists of the script name
+(from
+.Va $0 ) ,
+followed by
+.Dq Li ": INFO: " ,
+and then
+.Ar message .
+The display of this informational output can be
+turned on or off by the
+.Xr rc.conf 5
+variable
+.Va rc_info .
+.It Ic load_kld Oo Fl e Ar regex Oc Oo Fl m Ar module Oc Ar file
+Load
+.Ar file
+as a kernel module unless it is already loaded.
+For the purpose of checking the module status,
+either the exact module name can be specified using
+.Fl m ,
+or an
+.Xr egrep 1
+regular expression matching the module name can be supplied via
+.Fl e .
+By default, the module is assumed to have the same name as
+.Ar file ,
+which is not always the case.
+.It Ic load_rc_config Ar name
+Source in the configuration files for
+.Ar name .
+First,
+.Pa /etc/rc.conf
+is sourced if it has not yet been read in.
+Then,
+.Pa /etc/rc.conf.d/ Ns Ar name
+is sourced if it is an existing file.
+The latter may also contain other variable assignments to override
+.Ic run_rc_command
+arguments defined by the calling script, to provide an easy
+mechanism for an administrator to override the behaviour of a given
+.Xr rc.d 8
+script without requiring the editing of that script.
+.It Ic load_rc_config_var Ar name Ar var
+Read the
+.Xr rc.conf 5
+variable
+.Ar var
+for
+.Ar name
+and set in the current shell, using
+.Ic load_rc_config
+in a sub-shell to prevent unwanted side effects from other variable
+assignments.
+.It Ic mount_critical_filesystems Ar type
+Go through a list of critical file systems,
+as found in the
+.Xr rc.conf 5
+variable
+.Va critical_filesystems_ Ns Ar type ,
+mounting each one that
+is not currently mounted.
+.It Ic rc_usage Ar command ...
+Print a usage message for
+.Va $0 ,
+with
+.Ar commands
+being the list of valid arguments
+prefixed by
+.Sm off
+.Dq Bq Li fast | force | one | quiet .
+.Sm on
+.It Ic reverse_list Ar item ...
+Print the list of
+.Ar items
+in reverse order.
+.It Ic run_rc_command Ar argument
+Run the
+.Ar argument
+method for the current
+.Xr rc.d 8
+script, based on the settings of various shell variables.
+.Ic run_rc_command
+is extremely flexible, and allows fully functional
+.Xr rc.d 8
+scripts to be implemented in a small amount of shell code.
+.Pp
+.Ar argument
+is searched for in the list of supported commands, which may be one
+of:
+.Bl -tag -width ".Cm restart" -offset indent
+.It Cm start
+Start the service.
+This should check that the service is to be started as specified by
+.Xr rc.conf 5 .
+Also checks if the service is already running and refuses to start if
+it is.
+This latter check is not performed by standard
+.Fx
+scripts if the system is starting directly to multi-user mode, to
+speed up the boot process.
+.It Cm stop
+If the service is to be started as specified by
+.Xr rc.conf 5 ,
+stop the service.
+This should check that the service is running and complain if it is not.
+.It Cm restart
+Perform a
+.Cm stop
+then a
+.Cm start .
+Defaults to displaying the process ID of the program (if running).
+.It Cm rcvar
+Display which
+.Xr rc.conf 5
+variables are used to control the startup of the service (if any).
+.El
+.Pp
+If
+.Va pidfile
+or
+.Va procname
+is set, also support:
+.Bl -tag -width ".Cm restart" -offset indent
+.It Cm poll
+Wait for the command to exit.
+.It Cm status
+Show the status of the process.
+.El
+.Pp
+Other supported commands are listed in the optional variable
+.Va extra_commands .
+.Pp
+.Ar argument
+may have one of the following prefixes which alters its operation:
+.Bl -tag -width ".Li force" -offset indent
+.It Li fast
+Skip the check for an existing running process,
+and sets
+.Va rc_fast Ns = Ns Li YES .
+.It Li force
+Skip the checks for
+.Va rcvar
+being set to
+.Dq Li YES ,
+and sets
+.Va rc_force Ns = Ns Li YES .
+This ignores
+.Ar argument Ns Va _precmd
+returning non-zero, and ignores any of the
+.Va required_*
+tests failing, and always returns a zero exit status.
+.It Li one
+Skip the checks for
+.Va rcvar
+being set to
+.Dq Li YES ,
+but performs all the other prerequisite tests.
+.It Li quiet
+Inhibits some verbose diagnostics.
+Currently, this includes messages
+.Qq Starting ${name}
+(as checked by
+.Ic check_startmsgs
+inside
+.Nm )
+and errors about usage of services that are not enabled in
+.Xr rc.conf 5 .
+This prefix also sets
+.Va rc_quiet Ns = Ns Li YES .
+.Em Please, note:
+.Va rc_quiet
+is not intended to completely mask all debug and warning messages,
+but only certain small classes of them.
+.El
+.Pp
+.Ic run_rc_command
+uses the following shell variables to control its behaviour.
+Unless otherwise stated, these are optional.
+.Bl -tag -width ".Va procname" -offset indent
+.It Va name
+The name of this script.
+This is not optional.
+.It Va rcvar
+The value of
+.Va rcvar
+is checked with
+.Ic checkyesno
+to determine if this method should be run.
+.It Va command
+Full path to the command.
+Not required if
+.Ar argument Ns Va _cmd
+is defined for each supported keyword.
+Can be overridden by
+.Va ${name}_program .
+.It Va command_args
+Optional arguments and/or shell directives for
+.Va command .
+.It Va command_interpreter
+.Va command
+is started with:
+.Pp
+.Dl "#! command_interpreter [...]"
+.Pp
+which results in its
+.Xr ps 1
+command being:
+.Pp
+.Dl "command_interpreter [...] command"
+.Pp
+so use that string to find the PID(s) of the running command
+rather than
+.Va command .
+.It Va extra_commands
+Extra commands/keywords/arguments supported.
+.It Va pidfile
+Path to PID file.
+Used to determine the PID(s) of the running command.
+If
+.Va pidfile
+is set, use:
+.Pp
+.Dl "check_pidfile $pidfile $procname"
+.Pp
+to find the PID.
+Otherwise, if
+.Va command
+is set, use:
+.Pp
+.Dl "check_process $procname"
+.Pp
+to find the PID.
+.It Va procname
+Process name to check for.
+Defaults to the value of
+.Va command .
+.It Va required_dirs
+Check for the existence of the listed directories
+before running the
+.Cm start
+method.
+.It Va required_files
+Check for the readability of the listed files
+before running the
+.Cm start
+method.
+.It Va required_modules
+Ensure that the listed kernel modules are loaded
+before running the
+.Cm start
+method.
+This is done after invoking the commands from
+.Va start_precmd
+so that the missing modules are not loaded in vain
+if the preliminary commands indicate a error condition.
+A word in the list can have an optional
+.Dq Li : Ns Ar modname
+or
+.Dq Li ~ Ns Ar pattern
+suffix.
+The
+.Ar modname
+or
+.Ar pattern
+parameter is passed to
+.Ic load_kld
+through a
+.Fl m
+or
+.Fl e
+option, respectively.
+See the description of
+.Ic load_kld
+in this document for details.
+.It Va required_vars
+Perform
+.Ic checkyesno
+on each of the list variables
+before running the
+.Cm start
+method.
+.It Va ${name}_chdir
+Directory to
+.Ic cd
+to before running
+.Va command ,
+if
+.Va ${name}_chroot
+is not provided.
+.It Va ${name}_chroot
+Directory to
+.Xr chroot 8
+to before running
+.Va command .
+Only supported after
+.Pa /usr
+is mounted.
+.It Va ${name}_flags
+Arguments to call
+.Va command
+with.
+This is usually set in
+.Xr rc.conf 5 ,
+and not in the
+.Xr rc.d 8
+script.
+The environment variable
+.Sq Ev flags
+can be used to override this.
+.It Va ${name}_nice
+.Xr nice 1
+level to run
+.Va command
+as.
+Only supported after
+.Pa /usr
+is mounted.
+.It Va ${name}_program
+Full path to the command.
+Overrides
+.Va command
+if both are set, but has no effect if
+.Va command
+is unset.
+As a rule,
+.Va command
+should be set in the script while
+.Va ${name}_program
+should be set in
+.Xr rc.conf 5 .
+.It Va ${name}_user
+User to run
+.Va command
+as, using
+.Xr chroot 8
+if
+.Va ${name}_chroot
+is set, otherwise
+uses
+.Xr su 1 .
+Only supported after
+.Pa /usr
+is mounted.
+.It Va ${name}_group
+Group to run the chrooted
+.Va command
+as.
+.It Va ${name}_groups
+Comma separated list of supplementary groups to run the chrooted
+.Va command
+with.
+.It Ar argument Ns Va _cmd
+Shell commands which override the default method for
+.Ar argument .
+.It Ar argument Ns Va _precmd
+Shell commands to run just before running
+.Ar argument Ns Va _cmd
+or the default method for
+.Ar argument .
+If this returns a non-zero exit code, the main method is not performed.
+If the default method is being executed, this check is performed after
+the
+.Va required_*
+checks and process (non-)existence checks.
+.It Ar argument Ns Va _postcmd
+Shell commands to run if running
+.Ar argument Ns Va _cmd
+or the default method for
+.Ar argument
+returned a zero exit code.
+.It Va sig_stop
+Signal to send the processes to stop in the default
+.Cm stop
+method.
+Defaults to
+.Dv SIGTERM .
+.It Va sig_reload
+Signal to send the processes to reload in the default
+.Cm reload
+method.
+Defaults to
+.Dv SIGHUP .
+.El
+.Pp
+For a given method
+.Ar argument ,
+if
+.Ar argument Ns Va _cmd
+is not defined, then a default method is provided by
+.Ic run_rc_command :
+.Bl -tag -width ".Sy Argument" -offset indent
+.It Sy Argument
+.Sy Default method
+.It Cm start
+If
+.Va command
+is not running and
+.Ic checkyesno Va rcvar
+succeeds, start
+.Va command .
+.It Cm stop
+Determine the PIDs of
+.Va command
+with
+.Ic check_pidfile
+or
+.Ic check_process
+(as appropriate),
+.Ic kill Va sig_stop
+those PIDs, and run
+.Ic wait_for_pids
+on those PIDs.
+.It Cm reload
+Similar to
+.Cm stop ,
+except that it uses
+.Va sig_reload
+instead, and does not run
+.Ic wait_for_pids .
+Another difference from
+.Cm stop
+is that
+.Cm reload
+is not provided by default.
+It can be enabled via
+.Va extra_commands
+if appropriate:
+.Pp
+.Dl "extra_commands=reload"
+.It Cm restart
+Runs the
+.Cm stop
+method, then the
+.Cm start
+method.
+.It Cm status
+Show the PID of
+.Va command ,
+or some other script specific status operation.
+.It Cm poll
+Wait for
+.Va command
+to exit.
+.It Cm rcvar
+Display which
+.Xr rc.conf 5
+variable is used (if any).
+This method always works, even if the appropriate
+.Xr rc.conf 5
+variable is set to
+.Dq Li NO .
+.El
+.Pp
+The following variables are available to the methods
+(such as
+.Ar argument Ns Va _cmd )
+as well as after
+.Ic run_rc_command
+has completed:
+.Bl -tag -width ".Va rc_flags" -offset indent
+.It Va rc_arg
+Argument provided to
+.Ic run_rc_command ,
+after fast and force processing has been performed.
+.It Va rc_flags
+Flags to start the default command with.
+Defaults to
+.Va ${name}_flags ,
+unless overridden by the environment variable
+.Sq Ev flags .
+This variable may be changed by the
+.Ar argument Ns Va _precmd
+method.
+.It Va rc_pid
+PID of
+.Va command
+(if appropriate).
+.It Va rc_fast
+Not empty if
+.Dq Li fast
+prefix was used.
+.It Va rc_force
+Not empty if
+.Dq Li force
+prefix was used.
+.El
+.It Ic run_rc_script Ar file argument
+Start the script
+.Ar file
+with an argument of
+.Ar argument ,
+and handle the return value from the script.
+.Pp
+Various shell variables are unset before
+.Ar file
+is started:
+.Bd -ragged -offset indent
+.Va name ,
+.Va command ,
+.Va command_args ,
+.Va command_interpreter ,
+.Va extra_commands ,
+.Va pidfile ,
+.Va rcvar ,
+.Va required_dirs ,
+.Va required_files ,
+.Va required_vars ,
+.Ar argument Ns Va _cmd ,
+.Ar argument Ns Va _precmd .
+.Ar argument Ns Va _postcmd .
+.Ed
+.Pp
+The startup behaviour of
+.Ar file
+depends upon the following checks:
+.Bl -enum
+.It
+If
+.Ar file
+ends in
+.Pa .sh ,
+it is sourced into the current shell.
+.It
+If
+.Ar file
+appears to be a backup or scratch file
+(e.g., with a suffix of
+.Pa ~ , # , .OLD ,
+or
+.Pa .orig ) ,
+ignore it.
+.It
+If
+.Ar file
+is not executable, ignore it.
+.It
+If the
+.Xr rc.conf 5
+variable
+.Va rc_fast_and_loose
+is empty,
+source
+.Ar file
+in a sub shell,
+otherwise source
+.Ar file
+into the current shell.
+.El
+.It Ic stop_boot Op Ar always
+Prevent booting to multiuser mode.
+If the
+.Va autoboot
+variable is set to
+.Ql yes ,
+or
+.Ic checkyesno Ar always
+indicates a truth value, then a
+.Dv SIGTERM
+signal is sent to the parent
+process, which is assumed to be
+.Xr rc 8 .
+Otherwise, the shell exits with a non-zero status.
+.It Ic wait_for_pids Op Ar pid ...
+Wait until all of the provided
+.Ar pids
+do not exist any more, printing the list of outstanding
+.Ar pids
+every two seconds.
+.It Ic warn Ar message
+Display a warning message to
+.Va stderr
+and log it to the system log
+using
+.Xr logger 1 .
+The warning message consists of the script name
+(from
+.Va $0 ) ,
+followed by
+.Dq Li ": WARNING: " ,
+and then
+.Ar message .
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /etc/rc.subr" -compact
+.It Pa /etc/rc.subr
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr rc 8
+.Sh HISTORY
+The
+.Nm
+script
+appeared in
+.Nx 1.3 .
+The
+.Xr rc.d 8
+support functions appeared in
+.Nx 1.5 .
+The
+.Nm
+script
+first appeared in
+.Fx 5.0 .
diff --git a/share/man/man8/rescue.8 b/share/man/man8/rescue.8
new file mode 100644
index 000000000000..29218874d676
--- /dev/null
+++ b/share/man/man8/rescue.8
@@ -0,0 +1,184 @@
+.\" Copyright (c) 2003 Tim Kientzle <kientzle@acm.org>
+.\" Copyright (c) 2003 Simon L. Nielsen <simon@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 23, 2003
+.Dt RESCUE 8
+.Os
+.Sh NAME
+.Nm rescue
+.Nd rescue utilities in
+.Pa /rescue
+.Sh DESCRIPTION
+The
+.Pa /rescue
+directory contains a collection of common utilities intended for use
+in recovering a badly damaged system.
+With the transition to a dynamically-linked root beginning with
+.Fx 5.2 ,
+there is a real possibility that the standard tools in
+.Pa /bin
+and
+.Pa /sbin
+may become non-functional due to a failed upgrade or a disk error.
+The tools in
+.Pa /rescue
+are statically linked and should therefore be more resistant to
+damage.
+However, being statically linked, the tools in
+.Pa /rescue
+are also less functional than the standard utilities.
+In particular, they do not have full use of the locale,
+.Xr pam 3 ,
+and nsswitch libraries.
+.Pp
+If your system fails to boot, and it shows a prompt similar to:
+.Pp
+.Dl "Enter full pathname of shell or RETURN for /bin/sh: "
+.Pp
+the first thing to try running is the standard shell,
+.Pa /bin/sh .
+If that fails, try running
+.Pa /rescue/sh ,
+which is the
+.Nm
+shell.
+To repair the system, the root partition must first be remounted
+read-write.
+This can be done with the following
+.Xr mount 8
+command:
+.Pp
+.Dl "/rescue/mount -uw /"
+.Pp
+The next step is to double-check the contents of
+.Pa /bin , /sbin ,
+and
+.Pa /usr/lib ,
+possibly mounting a
+.Fx
+rescue or
+.Dq "live file system"
+CD-ROM (e.g.,
+.Li disc2
+of the officially released
+.Fx
+ISO images) and copying files from there.
+Once it is possible to successfully run
+.Pa /bin/sh , /bin/ls ,
+and other standard utilities, try rebooting back into the standard
+system.
+.Pp
+The
+.Pa /rescue
+tools are compiled using
+.Xr crunchgen 1 ,
+which makes them considerably more compact than the standard
+utilities.
+To build a
+.Fx
+system where space is critical,
+.Pa /rescue
+can be used as a replacement for the standard
+.Pa /bin
+and
+.Pa /sbin
+directories; simply change
+.Pa /bin
+and
+.Pa /sbin
+to be symbolic links pointing to
+.Pa /rescue .
+Since
+.Pa /rescue
+is statically linked, it should also be possible to dispense with much
+of
+.Pa /usr/lib
+in such an environment.
+.Pp
+In contrast to its predecessor
+.Pa /stand ,
+.Pa /rescue
+is updated during normal
+.Fx
+source and binary upgrades.
+.Sh FILES
+.Bl -tag -width ".Pa /rescue" -compact
+.It Pa /rescue
+Root of the
+.Nm
+hierarchy.
+.El
+.Sh SEE ALSO
+.Xr crunchgen 1 ,
+.Xr crash 8
+.Sh HISTORY
+The
+.Nm
+utilities first appeared in
+.Fx 5.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+system was written by
+.An Tim Kientzle Aq kientzle@FreeBSD.org ,
+based on ideas taken from
+.Nx .
+This manual page was written by
+.An Simon L. Nielsen Aq simon@FreeBSD.org ,
+based on text by
+.An Tim Kientzle Aq kientzle@FreeBSD.org .
+.Sh BUGS
+Most of the
+.Nm
+tools work even in a fairly crippled system.
+The most egregious exception is the
+.Nm
+version of
+.Xr vi 1 ,
+which currently requires that
+.Pa /usr
+be mounted so that it can access the
+.Xr termcap 5
+files.
+Hopefully, a failsafe
+.Xr termcap 3
+entry will eventually be added into the
+.Xr ncurses 3
+library, so that
+.Pa /rescue/vi
+can be used even in a system where
+.Pa /usr
+cannot immediately be mounted.
+In the meantime, the
+.Nm
+version of the
+.Xr ed 1
+editor can be used from
+.Pa /rescue/ed
+if you need to edit files, but cannot mount
+.Pa /usr .
diff --git a/share/man/man8/yp.8 b/share/man/man8/yp.8
new file mode 100644
index 000000000000..db5610bff208
--- /dev/null
+++ b/share/man/man8/yp.8
@@ -0,0 +1,588 @@
+.\" Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote
+.\" products derived from this software without specific prior written
+.\" permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from: @(#)yp.8 1.0 (deraadt) 4/26/93
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2011
+.Dt YP 8
+.Os
+.Sh NAME
+.Nm yp
+.Nd description of the YP/NIS system
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm YP
+subsystem allows network management of passwd, group, netgroup, hosts,
+services, rpc, bootparams and ethers file
+entries through the functions
+.Xr getpwent 3 ,
+.Xr getgrent 3 ,
+.Xr getnetgrent 3 ,
+.Xr gethostent 3 ,
+.Xr getnetent 3 ,
+.Xr getrpcent 3 ,
+and
+.Xr ethers 3 .
+The
+.Xr bootparamd 8
+daemon makes direct
+.Tn NIS
+library calls since there are no
+functions in the standard C library for reading bootparams.
+.Tn NIS
+support is enabled in
+.Xr nsswitch.conf 5 .
+.Pp
+The
+.Nm YP
+subsystem is started automatically in
+.Pa /etc/rc
+if it has been initialized in
+.Pa /etc/rc.conf
+and if the directory
+.Pa /var/yp
+exists (which it does in the default distribution).
+The default
+.Tn NIS
+domain must also be set with the
+.Xr domainname 1
+command, which will happen automatically at system startup if it is
+specified in
+.Pa /etc/rc.conf .
+.Pp
+.Tn NIS
+is an
+.Tn RPC Ns -based
+client/server system that allows a group of
+machines within an
+.Tn NIS
+domain to share a common set of configuration files.
+This permits a system
+administrator to set up
+.Tn NIS
+client systems with only minimal configuration
+data and add, remove or modify configuration data from a single location.
+.Pp
+The canonical copies of all
+.Tn NIS
+information are stored on a single machine
+called the
+.Tn NIS
+.Em "master server" .
+The databases used to store the information are called
+.Tn NIS
+.Em maps .
+In
+.Fx ,
+these maps are stored in
+.Pa /var/yp/ Ns Aq Ar domainname
+where
+.Aq Ar domainname
+is the name of the
+.Tn NIS
+domain being served.
+A single
+.Tn NIS
+server can
+support several domains at once, therefore it is possible to have several
+such directories, one for each supported domain.
+Each domain will have
+its own independent set of maps.
+.Pp
+In
+.Fx ,
+the
+.Tn NIS
+maps are Berkeley DB hashed database files (the
+same format used for the
+.Xr passwd 5
+database files).
+Other operating systems that support
+.Tn NIS
+use old-style
+.Nm ndbm
+databases instead (largely because Sun Microsystems originally based
+their
+.Tn NIS
+implementation on
+.Nm ndbm ,
+and other vendors have simply licensed
+Sun's code rather than design their own implementation with a different
+database format).
+On these systems, the databases are generally split
+into
+.Pa .dir
+and
+.Pa .pag
+files which the
+.Nm ndbm
+code uses to hold separate parts of the hash
+database.
+The Berkeley DB hash method instead uses a single file for
+both pieces of information.
+This means that while you may have
+.Pa passwd.byname.dir
+and
+.Pa passwd.byname.pag
+files on other operating systems (both of which are really parts of the
+same map),
+.Fx
+will have only one file called
+.Pa passwd.byname .
+The difference in format is not significant: only the
+.Tn NIS
+server,
+.Xr ypserv 8 ,
+and related tools need to know the database format of the
+.Tn NIS
+maps.
+Client
+.Tn NIS
+systems receive all
+.Tn NIS
+data in
+.Tn ASCII
+form.
+.Pp
+There are three main types of
+.Tn NIS
+systems:
+.Bl -enum
+.It
+.Tn NIS
+clients,
+which query
+.Tn NIS
+servers for information.
+.It
+.Tn NIS
+master servers,
+which maintain the canonical copies of all
+.Tn NIS
+maps.
+.It
+.Tn NIS
+slave servers,
+which maintain backup copies of
+.Tn NIS
+maps that are periodically
+updated by the master.
+.El
+.Pp
+A
+.Tn NIS
+client establishes what is called a
+.Em binding
+to a particular
+.Tn NIS
+server using the
+.Xr ypbind 8
+daemon.
+The
+.Xr ypbind 8
+utility checks the system's default domain (as set by the
+.Xr domainname 1
+command) and begins broadcasting
+.Tn RPC
+requests on the local network.
+These requests specify the name of the domain for which
+.Xr ypbind 8
+is attempting to establish a binding.
+If a server that has been
+configured to serve the requested domain receives one of the broadcasts,
+it will respond to
+.Xr ypbind 8 ,
+which will record the server's address.
+If there are several servers
+available (a master and several slaves, for example),
+.Xr ypbind 8
+will use the address of the first one to respond.
+From that point
+on, the client system will direct all of its
+.Tn NIS
+requests to that server.
+The
+.Xr ypbind 8
+utility will occasionally
+.Dq ping
+the server to make sure it is still up
+and running.
+If it fails to receive a reply to one of its pings
+within a reasonable amount of time,
+.Xr ypbind 8
+will mark the domain as unbound and begin broadcasting again in the
+hopes of locating another server.
+.Pp
+.Tn NIS
+master and slave servers handle all
+.Tn NIS
+requests with the
+.Xr ypserv 8
+daemon.
+The
+.Xr ypserv 8
+utility is responsible for receiving incoming requests from
+.Tn NIS
+clients,
+translating the requested domain and map name to a path to the
+corresponding database file and transmitting data from the database
+back to the client.
+There is a specific set of requests that
+.Xr ypserv 8
+is designed to handle, most of which are implemented as functions
+within the standard C library:
+.Bl -tag -width ".Fn yp_master"
+.It Fn yp_order
+check the creation date of a particular map
+.It Fn yp_master
+obtain the name of the
+.Tn NIS
+master server for a given
+map/domain
+.It Fn yp_match
+lookup the data corresponding to a given in key in a particular
+map/domain
+.It Fn yp_first
+obtain the first key/data pair in a particular map/domain
+.It Fn yp_next
+pass
+.Xr ypserv 8
+a key in a particular map/domain and have it return the
+key/data pair immediately following it (the functions
+.Fn yp_first
+and
+.Fn yp_next
+can be used to do a sequential search of an
+.Tn NIS
+map)
+.It Fn yp_all
+retrieve the entire contents of a map
+.El
+.Pp
+There are a few other requests which
+.Xr ypserv 8
+is capable of handling (i.e., acknowledge whether or not you can handle
+a particular domain
+.Pq Dv YPPROC_DOMAIN ,
+or acknowledge only if you can handle the domain and be silent otherwise
+.Pq Dv YPPROC_DOMAIN_NONACK )
+but
+these requests are usually generated only by
+.Xr ypbind 8
+and are not meant to be used by standard utilities.
+.Pp
+On networks with a large number of hosts, it is often a good idea to
+use a master server and several slaves rather than just a single master
+server.
+A slave server provides the exact same information as a master
+server: whenever the maps on the master server are updated, the new
+data should be propagated to the slave systems using the
+.Xr yppush 8
+command.
+The
+.Tn NIS
+.Pa Makefile
+.Pq Pa /var/yp/Makefile
+will do this automatically if the administrator creates
+.Pa /var/yp/Makefile.local
+and empties the
+.Va NOPUSH
+variable:
+.Bd -literal -offset four
+.Li NOPUSH=
+.Ed
+.Pp
+.Va ( NOPUSH
+is set to true by default because the default configuration is
+for a small network with only one
+.Tn NIS
+server).
+The
+.Xr yppush 8
+command will initiate a transaction between the master and slave
+during which the slave will transfer the specified maps from the
+master server using
+.Xr ypxfr 8 .
+(The slave server calls
+.Xr ypxfr 8
+automatically from within
+.Xr ypserv 8 ;
+therefore it is not usually necessary for the administrator
+to use it directly.
+It can be run manually if
+desired, however.)
+Maintaining
+slave servers helps improve
+.Tn NIS
+performance on large
+networks by:
+.Bl -bullet
+.It
+Providing backup services in the event that the
+.Tn NIS
+master crashes
+or becomes unreachable
+.It
+Spreading the client load out over several machines instead of
+causing the master to become overloaded
+.It
+Allowing a single
+.Tn NIS
+domain to extend beyond
+a local network (the
+.Xr ypbind 8
+daemon might not be able to locate a server automatically if it resides on
+a network outside the reach of its broadcasts.
+It is possible to force
+.Xr ypbind 8
+to bind to a particular server with
+.Xr ypset 8
+but this is sometimes inconvenient.
+This problem can be avoided simply by
+placing a slave server on the local network.)
+.El
+.Pp
+The
+.Fx
+.Xr ypserv 8
+is specially designed to provide enhanced security (compared to
+other
+.Tn NIS
+implementations) when used exclusively with
+.Fx
+client
+systems.
+The
+.Fx
+password database system (which is derived directly
+from
+.Bx 4.4 )
+includes support for
+.Em "shadow passwords" .
+The standard password database does not contain users' encrypted
+passwords: these are instead stored (along with other information)
+in a separate database which is accessible only by the super-user.
+If the encrypted password database were made available as an
+.Tn NIS
+map, this security feature would be totally disabled, since any user
+is allowed to retrieve
+.Tn NIS
+data.
+.Pp
+To help prevent this,
+.Fx Ns 's
+.Tn NIS
+server handles the shadow password maps
+.Pa ( master.passwd.byname ,
+.Pa master.passwd.byuid ,
+.Pa shadow.byname
+and
+.Pa shadow.byuid )
+in a special way: the server will only provide access to these
+maps in response to requests that originate on privileged ports.
+Since only the super-user is allowed to bind to a privileged port,
+the server assumes that all such requests come from privileged
+users.
+All other requests are denied: requests from non-privileged
+ports will receive only an error code from the server.
+Additionally,
+.Fx Ns 's
+.Xr ypserv 8
+includes support for
+.An Wietse Venema Ns 's
+tcp wrapper package; with tcp
+wrapper support enabled, the administrator can configure
+.Xr ypserv 8
+to respond only to selected client machines.
+.Pp
+While these enhancements provide better security than stock
+.Tn NIS ,
+they are by no means 100% effective.
+It is still possible for
+someone with access to your network to spoof the server into disclosing
+the shadow password maps.
+.Pp
+On the client side,
+.Fx Ns 's
+.Xr getpwent 3
+functions will automatically search for the
+.Pa master.passwd
+maps and use them if they exist.
+If they do, they will be used, and
+all fields in these special maps (class, password age and account
+expiration) will be decoded.
+If they are not found, the standard
+.Pa passwd
+maps will be used instead.
+.Sh COMPATIBILITY
+When using a
+.No non- Ns Fx
+.Tn NIS
+server for
+.Xr passwd 5
+files, it is unlikely that the default MD5-based format that
+.Fx
+uses for passwords will be accepted by it.
+If this is the case, the value of the
+.Va passwd_format
+setting in
+.Xr login.conf 5
+should be changed to
+.Qq Li des
+for compatibility.
+.Pp
+Some systems, such as
+.Tn SunOS
+4.x, need
+.Tn NIS
+to be running in order
+for their hostname resolution functions
+.Fn ( gethostbyname ,
+.Fn gethostbyaddr ,
+etc.) to work properly.
+On these systems,
+.Xr ypserv 8
+performs
+.Tn DNS
+lookups when asked to return information about
+a host that does not exist in its
+.Pa hosts.byname
+or
+.Pa hosts.byaddr
+maps.
+.Fx Ns 's
+resolver uses
+.Tn DNS
+by default (it can be made to use
+.Tn NIS ,
+if desired), therefore its
+.Tn NIS
+server does not do
+.Tn DNS
+lookups
+by default.
+However,
+.Xr ypserv 8
+can be made to perform
+.Tn DNS
+lookups if it is started with a special
+flag.
+It can also be made to register itself as an
+.Tn NIS
+v1 server
+in order to placate certain systems that insist on the presence of
+a v1 server
+.No ( Fx
+uses only
+.Tn NIS
+v2, but many other systems,
+including
+.Tn SunOS
+4.x, search for both a v1 and v2 server when binding).
+.Fx Ns 's
+.Xr ypserv 8
+does not actually handle
+.Tn NIS
+v1 requests, but this
+.Dq "kludge mode"
+is useful for silencing stubborn systems that search for both
+a v1 and v2 server.
+.Pp
+(Please see the
+.Xr ypserv 8
+manual page for a detailed description of these special features
+and flags.)
+.Sh SEE ALSO
+.Xr domainname 1 ,
+.Xr ypcat 1 ,
+.Xr ypmatch 1 ,
+.Xr ypwhich 1 ,
+.Xr nsswitch.conf 5 ,
+.Xr yp_mkdb 8 ,
+.Xr ypbind 8 ,
+.Xr ypinit 8 ,
+.Xr yppoll 8 ,
+.Xr yppush 8 ,
+.Xr ypserv 8 ,
+.Xr ypset 8 ,
+.Xr ypxfr 8
+.Sh HISTORY
+The
+.Nm YP
+subsystem was written from the ground up by
+.An Theo de Raadt
+to be compatible to Sun's implementation.
+Bug fixes, improvements
+and
+.Tn NIS
+server support were later added by
+.An Bill Paul .
+The server-side code was originally written by
+.An Peter Eriksson
+and
+.An Tobias Reber
+and is subject to the GNU Public License.
+No Sun code was
+referenced.
+.Sh BUGS
+While
+.Fx
+now has both
+.Tn NIS
+client and server capabilities, it does not yet have support for
+.Xr ypupdated 8
+or the
+.Fn yp_update
+function.
+Both of these require secure
+.Tn RPC ,
+which
+.Fx
+does not
+support yet either.
+.Pp
+The
+.Xr getservent 3
+and
+.Xr getprotoent 3
+functions do not yet have
+.Tn NIS
+support.
+Fortunately, these files
+do not need to be updated that often.
+.Pp
+Many more manual pages should be written, especially
+.Xr ypclnt 3 .
+For the time being, seek out a local Sun machine and read the
+manuals for there.
+.Pp
+Neither Sun nor this author have found a clean way to handle
+the problems that occur when ypbind cannot find its server
+upon bootup.
diff --git a/share/man/man9/BUF_ISLOCKED.9 b/share/man/man9/BUF_ISLOCKED.9
new file mode 100644
index 000000000000..d55f2f5d0056
--- /dev/null
+++ b/share/man/man9/BUF_ISLOCKED.9
@@ -0,0 +1,69 @@
+.\"
+.\" Copyright (C) 2008 Attilio Rao <attilio@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2008
+.Dt BUF_ISLOCKED 9
+.Os
+.Sh NAME
+.Nm BUF_ISLOCKED
+.Nd "returns the state of the lock linked to the buffer"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft int
+.Fn BUF_ISLOCKED "struct buf *bp"
+.Sh DESCRIPTION
+The
+.Fn BUF_ISLOCKED
+function returns the status of the lock linked to the buffer in relation to
+curthread.
+.Pp
+It can return:
+.Bl -tag -width ".Dv LK_EXCLUSIVE"
+.It Dv LK_EXCLUSIVE
+An exclusive lock is held by curthread.
+.It Dv LK_EXCLOTHER
+An exclusive lock is held by someone other than curthread
+.It Dv LK_SHARED
+A shared lock is held.
+.It Li 0
+The lock is not held by anyone.
+.El
+.Sh SEE ALSO
+.Xr lockstatus 9 ,
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Attilio Rao Aq attilio@FreeBSD.org .
diff --git a/share/man/man9/BUF_LOCK.9 b/share/man/man9/BUF_LOCK.9
new file mode 100644
index 000000000000..ca414ecdbaa0
--- /dev/null
+++ b/share/man/man9/BUF_LOCK.9
@@ -0,0 +1,75 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt BUF_LOCK 9
+.Os
+.Sh NAME
+.Nm BUF_LOCK
+.Nd "locks a buffer"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft int
+.Fn BUF_LOCK "struct buf *bp" "int locktype"
+.Sh DESCRIPTION
+The
+.Fn BUF_LOCK
+function locks the given buffer.
+If the lock is already held this
+call will block until it can acquire the lock unless
+.Dv LK_NOWAIT
+is set.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa locktype"
+.It Fa bp
+The buffer to lock.
+.It Fa locktype
+Flags controlling the type of lock.
+See
+.Xr lockmgr 9
+for details.
+.El
+.Sh RETURN VALUES
+A value of 0 is returned upon success.
+See
+.Xr lockmgr 9
+for
+information on non-zero return values.
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_TIMELOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/BUF_LOCKFREE.9 b/share/man/man9/BUF_LOCKFREE.9
new file mode 100644
index 000000000000..d356f0d8be46
--- /dev/null
+++ b/share/man/man9/BUF_LOCKFREE.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt BUF_LOCKFREE 9
+.Os
+.Sh NAME
+.Nm BUF_LOCKFREE
+.Nd "destroys a buffer's lock"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft void
+.Fn BUF_LOCKFREE "struct buf *bp"
+.Sh DESCRIPTION
+The
+.Fn BUF_LOCKFREE
+macro destroys the buffer lock.
+The lock must not be held when
+this macro is called or a panic will result.
+.Pp
+Its argument is:
+.Bl -tag -width ".Fa bp"
+.It Fa bp
+The buffer whose lock is to be destroyed.
+.El
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_TIMELOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockdestroy 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/BUF_LOCKINIT.9 b/share/man/man9/BUF_LOCKINIT.9
new file mode 100644
index 000000000000..286e7f8db2a0
--- /dev/null
+++ b/share/man/man9/BUF_LOCKINIT.9
@@ -0,0 +1,62 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt BUF_LOCKINIT 9
+.Os
+.Sh NAME
+.Nm BUF_LOCKINIT
+.Nd "initializes a buffer lock"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft void
+.Fn BUF_LOCKINIT "struct buf *bp"
+.Sh DESCRIPTION
+The
+.Fn BUF_LOCKINIT
+macro initializes a buffer lock.
+.Pp
+Its argument is:
+.Bl -tag -width ".Fa bp"
+.It Fa bp
+The buffer whose lock it to be initialized.
+.El
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_TIMELOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockinit 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/BUF_RECURSED.9 b/share/man/man9/BUF_RECURSED.9
new file mode 100644
index 000000000000..2e369ea69e0b
--- /dev/null
+++ b/share/man/man9/BUF_RECURSED.9
@@ -0,0 +1,65 @@
+.\"
+.\" Copyright (C) 2008 Attilio Rao <attilio@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 22, 2008
+.Dt BUF_RECURSED 9
+.Os
+.Sh NAME
+.Nm BUF_RECURSED
+.Nd "checks if the lock linked to the buffer is recursed"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft int
+.Fn BUF_RECURSED "struct buf *bp"
+.Sh DESCRIPTION
+The
+.Fn BUF_RECURSED
+function checks if the lock linked to the given buffer is recursed and
+returns 1 if the condition is true, 0 otherwise.
+.Pp
+Its argument is:
+.Bl -tag -width ".Fa bp"
+.It Fa bp
+The buffer linked to the lock.
+See
+.Xr lockmgr_recursed 9
+for details.
+.El
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Attilio Rao Aq attilio@FreeBSD.org .
diff --git a/share/man/man9/BUF_TIMELOCK.9 b/share/man/man9/BUF_TIMELOCK.9
new file mode 100644
index 000000000000..31ca2007c9dd
--- /dev/null
+++ b/share/man/man9/BUF_TIMELOCK.9
@@ -0,0 +1,83 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt BUF_TIMELOCK 9
+.Os
+.Sh NAME
+.Nm BUF_TIMELOCK
+.Nd "locks a buffer"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft int
+.Fn BUF_TIMELOCK "struct buf *bp" "int locktype" "char *wmesg" "int catch" "int timo"
+.Sh DESCRIPTION
+The
+.Fn BUF_TIMELOCK
+function locks the given buffer, and limits the amount of time it
+will sleep to
+.Fa timo
+and OR's
+.Fa catch
+into the sleep's priority.
+.Fa wmesg
+is the wmesg used in the sleep.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa locktype"
+.It Fa bp
+The buffer to lock.
+.It Fa locktype
+Flags controlling the type of lock.
+See
+.Xr lockmgr 9
+for details.
+.It Fa wmesg
+The wmesg used in any sleeps while acquiring the lock.
+.It Fa catch
+Priority OR'd into the sleep's priority.
+.It Fa timo
+The timeout for any sleeps encountered during the lock.
+.El
+.Sh RETURN VALUES
+A value of 0 is returned on success.
+See
+.Xr lockmgr 9
+for details on non-zero return values.
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_UNLOCK 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/BUF_UNLOCK.9 b/share/man/man9/BUF_UNLOCK.9
new file mode 100644
index 000000000000..0b6b0b35080f
--- /dev/null
+++ b/share/man/man9/BUF_UNLOCK.9
@@ -0,0 +1,64 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt BUF_UNLOCK 9
+.Os
+.Sh NAME
+.Nm BUF_UNLOCK
+.Nd "unlocks a locked buffer"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/uio.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft void
+.Fn BUF_UNLOCK "struct buf *bp"
+.Sh DESCRIPTION
+The
+.Fn BUF_UNLOCK
+function unlocks a buffer that was previously locked with
+.Fn BUF_LOCK
+or
+.Fn BUF_TIMELOCK .
+.Pp
+Its argument is:
+.Bl -tag -width ".Fa bp"
+.It Fa bp
+The buffer to unlock.
+The buffer must already be locked.
+.El
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr BUF_LOCK 9 ,
+.Xr BUF_TIMELOCK 9 ,
+.Xr lockmgr 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/BUS_ADD_CHILD.9 b/share/man/man9/BUS_ADD_CHILD.9
new file mode 100644
index 000000000000..8b69d5a7834e
--- /dev/null
+++ b/share/man/man9/BUS_ADD_CHILD.9
@@ -0,0 +1,74 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2004 M. Warner Losh.
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2004
+.Dt BUS_ADD_CHILD 9
+.Os
+.Sh NAME
+.Nm BUS_ADD_CHILD
+.Nd "add a device node to the tree with a given priority"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn BUS_ADD_CHILD "device_t dev" "int order" "const char *name" "int unit"
+.Sh DESCRIPTION
+The
+.Fn BUS_ADD_CHILD
+method
+is used by the driver identify routine to add devices to the tree.
+Please see
+.Xr device_add_child 9
+for more details.
+The interface is the same as
+.Xr device_add_child 9
+however, the bus'
+.Fn BUS_ADD_CHILD
+is called.
+.Pp
+Busses implementing
+.Fn BUS_ADD_CHILD
+should insert the device into the tree using
+.Xr device_add_child 9
+before adding things such as their own ivars and resource lists to the device.
+.Sh RETURN VALUES
+The
+.Fn BUS_ADD_CHILD
+method returns
+.Vt device_t
+added to the tree, or
+.Dv NULL .
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr device_add_child 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An M. Warner Losh .
diff --git a/share/man/man9/BUS_BIND_INTR.9 b/share/man/man9/BUS_BIND_INTR.9
new file mode 100644
index 000000000000..2e22dea9ae10
--- /dev/null
+++ b/share/man/man9/BUS_BIND_INTR.9
@@ -0,0 +1,98 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 14, 2009
+.Dt BUS_BIND_INTR 9
+.Os
+.Sh NAME
+.Nm BUS_BIND_INTR ,
+.Nm bus_bind_intr
+.Nd "bind an interrupt resource to a specific CPU"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_BIND_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "int cpu"
+.Fc
+.Ft int
+.Fn bus_bind_intr "device_t dev" "struct resource *irq" "int cpu"
+.Sh DESCRIPTION
+The
+.Fn BUS_BIND_INTR
+method allows an interrupt resource to be pinned to a specific CPU.
+The interrupt resource must have an interrupt handler attached via
+.Xr BUS_SETUP_INTR 9 .
+The
+.Fa cpu
+parameter corresponds to the ID of a valid CPU in the system.
+Binding an interrupt restricts the
+.Xr cpuset 2
+of any associated interrupt threads to only include the specified CPU.
+It may also direct the low-level interrupt handling of the interrupt to the
+specified CPU as well,
+but this behavior is platform-dependent.
+If the value
+.Dv NOCPU
+is used for
+.Fa cpu ,
+then the interrupt will be
+.Dq unbound
+which restores any associated interrupt threads back to the default cpuset.
+.Pp
+Non-sleepable locks such as mutexes should not be held across calls to these
+functions.
+.Pp
+The
+.Fn bus_bind_intr
+function is a simple wrapper around
+.Fn BUS_BIND_INTR .
+.Pp
+Note that currently there is no attempt made to arbitrate between
+multiple bind requests for the same interrupt from either the same
+device or multiple devices.
+There is also no arbitration between interrupt binding requests submitted
+by userland via
+.Xr cpuset 2
+and
+.Fn BUS_BIND_INTR .
+The most recent binding request is the one that will be in effect.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr BUS_SETUP_INTR 9 ,
+.Xr cpuset 2 ,
+.Xr device 9
+.Sh HISTORY
+The
+.Fn BUS_BIND_INTR
+method and
+.Fn bus_bind_intr
+functions first appeared in
+.Fx 7.2 .
diff --git a/share/man/man9/BUS_CONFIG_INTR.9 b/share/man/man9/BUS_CONFIG_INTR.9
new file mode 100644
index 000000000000..a3b4c543c917
--- /dev/null
+++ b/share/man/man9/BUS_CONFIG_INTR.9
@@ -0,0 +1,106 @@
+.\" Copyright (c) 2003 Marcel Moolenaar
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt BUS_CONFIG_INTR 9
+.Os
+.\"
+.Sh NAME
+.Nm BUS_CONFIG_INTR
+.Nd "configure interrupt polarity and trigger mode"
+.\"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_CONFIG_INTR
+.Fa "device_t dev" "int irq" "enum intr_trigger trig" "enum intr_polarity pol"
+.Fc
+.\"
+.Sh DESCRIPTION
+The
+.Fn BUS_CONFIG_INTR
+method allows bus or device drivers to provide interrupt polarity and trigger
+mode to parent busses.
+This typically bubbles all the way up to the root bus (e.g.\& nexus) where the
+necessary actions are taken to actually program the hardware.
+Since the
+.Fn BUS_CONFIG_INTR
+method takes an interrupt number, it is assumed but not necessarily required
+that it is called prior to
+.Xr BUS_SETUP_INTR 9 .
+.Pp
+The
+.Fa trig
+argument can be one of:
+.Bl -tag -width ".Dv INTR_TRIGGER_CONFORM"
+.It Dv INTR_TRIGGER_CONFORM
+The interrupt trigger mode is standard for the bus to which the device is
+attached.
+.It Dv INTR_TRIGGER_EDGE
+The interrupt is edge triggered.
+This means that the interrupt is raised by the rising edge of the signal on
+the interrupt line.
+The signal typically reverts to the original state so as to cause a spike.
+.It Dv INTR_TRIGGER_LEVEL
+The interrupt is level triggered.
+This means that the interrupt is raised when the signal on the interrupt line
+transitions and remains unchanged after that until the interrupt has been
+serviced, after which the signal transitions back.
+.El
+.Pp
+The
+.Fa pol
+argument can be any one of:
+.Bl -tag -width ".Dv INTR_POLARITY_CONFORM"
+.It Dv INTR_POLARITY_CONFORM
+The interrupt polarity is standard for the bus to which the device is attached.
+.It Dv INTR_POLARITY_HIGH
+The interrupt is activated by a high voltage on the interrupt line.
+.It Dv INTR_POLARITY_LOW
+The interrupt is activated by a low voltage on the interrupt line.
+.El
+.\"
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.\"
+.Sh SEE ALSO
+.Xr BUS_SETUP_INTR 9 ,
+.Xr BUS_TEARDOWN_INTR 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.\"
+.Sh HISTORY
+The
+.Fn BUS_CONFIG_INTR
+method first appeared in
+.Fx 5.2 .
+.\"
+.Sh AUTHORS
+This manual page was written by
+.An Marcel Moolenaar
+.Aq marcel@xcllnt.net .
diff --git a/share/man/man9/BUS_DESCRIBE_INTR.9 b/share/man/man9/BUS_DESCRIBE_INTR.9
new file mode 100644
index 000000000000..b7f137b5b20e
--- /dev/null
+++ b/share/man/man9/BUS_DESCRIBE_INTR.9
@@ -0,0 +1,104 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 14, 2009
+.Dt BUS_DESCRIBE_INTR 9
+.Os
+.Sh NAME
+.Nm BUS_DESCRIBE_INTR ,
+.Nm bus_describe_intr
+.Nd "associate a description with an active interrupt handler"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_BIND_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "void *cookie"
+.Fa "const char *descr"
+.Fc
+.Ft int
+.Fo bus_describe_intr
+.Fa "device_t dev" "struct resource *irq" "void *cookie" "const char *fmt"
+.Fa ...
+.Fc
+.Sh DESCRIPTION
+The
+.Fn BUS_DESCRIBE_INTR
+method associates a description with an active interrupt handler.
+The
+.Fa cookie
+parameter must be the value returned by a successful call to
+.Xr BUS_SETUP_INTR 9
+for the interrupt
+.Fa irq .
+.Pp
+The
+.Fn bus_describe_intr
+function is a simple wrapper around
+.Fn BUS_DESCRIBE_INTR .
+As a convenience,
+.Fn bus_describe_intr
+allows the caller to use
+.Xr printf 9
+style formatting to build the description string using
+.Fa fmt .
+.Pp
+When an interrupt handler is established by
+.Xr BUS_SETUP_INTR 9 ,
+the handler is named after the device the handler is established for.
+This name is then used in various places such as interrupt statistics
+displayed by
+.Xr systat 1
+and
+.Xr vmstat 8 .
+For devices that use a single interrupt,
+the device name is sufficiently unique to identify the interrupt handler.
+However, for devices that use multiple interrupts it can be useful to
+distinguish the interrupt handlers.
+When a description is set for an active interrupt handler,
+a colon followed by the description is appended to the device name to form
+the interrupt handler name.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr BUS_SETUP_INTR 9 ,
+.Xr systat 1 ,
+.Xr vmstat 8 ,
+.Xr device 9 ,
+.Xr printf 9
+.Sh HISTORY
+The
+.Fn BUS_DESCRIBE_INTR
+method and
+.Fn bus_describe_intr
+functions first appeared in
+.Fx 8.1 .
+.Sh BUGS
+It is not currently possible to remove a description from an active interrupt
+handler.
diff --git a/share/man/man9/BUS_NEW_PASS.9 b/share/man/man9/BUS_NEW_PASS.9
new file mode 100644
index 000000000000..4861ffd0d659
--- /dev/null
+++ b/share/man/man9/BUS_NEW_PASS.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 8, 2009
+.Dt BUS_NEW_PASS 9
+.Os
+.Sh NAME
+.Nm BUS_NEW_PASS
+.Nd "notify a bus that the pass level has been changed"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn BUS_NEW_PASS "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn BUS_NEW_PASS
+method is called on each bus device to rescan the device tree when the pass
+level has been changed.
+This method is responsible for invoking
+.Xr BUS_NEW_PASS 9
+on child bus devices to propagate the rescan to child devices.
+It is also responsible for reprobing any unattached child devices and
+allowing drivers for the current pass to identify new children.
+A default implementation is provided by
+.Xr bus_generic_new_pass 9 .
+.Sh SEE ALSO
+.Xr bus_generic_new_pass 9 ,
+.Xr bus_set_pass 9 ,
+.Xr device 9
diff --git a/share/man/man9/BUS_PRINT_CHILD.9 b/share/man/man9/BUS_PRINT_CHILD.9
new file mode 100644
index 000000000000..a3709d94866b
--- /dev/null
+++ b/share/man/man9/BUS_PRINT_CHILD.9
@@ -0,0 +1,64 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt BUS_PRINT_CHILD 9
+.Os
+.Sh NAME
+.Nm BUS_PRINT_CHILD
+.Nd print information about a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn BUS_PRINT_CHILD "device_t dev" "device_t child"
+.Sh DESCRIPTION
+The
+.Fn BUS_PRINT_CHILD
+method
+is called from system code which prints out a description of a
+device.
+It should describe the attachment that the child has with
+the parent.
+For instance the TurboLaser bus prints which node the
+device is attached to.
+Please see
+.Xr bus_generic_print_child 9
+for more information regarding the proper formatting of the messages
+printed by
+.Fn BUS_PRINT_CHILD .
+.Sh RETURN VALUES
+The number of characters output.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/BUS_READ_IVAR.9 b/share/man/man9/BUS_READ_IVAR.9
new file mode 100644
index 000000000000..153b324b56a4
--- /dev/null
+++ b/share/man/man9/BUS_READ_IVAR.9
@@ -0,0 +1,63 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_READ_IVAR 9
+.Os
+.Sh NAME
+.Nm BUS_READ_IVAR ,
+.Nm BUS_WRITE_IVAR
+.Nd manipulate bus-specific device instance variables
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn BUS_READ_IVAR "device_t dev" "device_t child" "int index" "uintptr_t *result"
+.Ft int
+.Fn BUS_WRITE_IVAR "device_t dev" "device_t child" "int index" "uintptr_t value"
+.Sh DESCRIPTION
+These two methods manage a bus specific set of instance variables of
+a child device.
+The intention is that each different type of bus
+defines a set of appropriate instance variables (such as ports and
+irqs for ISA bus etc.)
+.Pp
+This information could be given to the child device as a struct but
+that makes it hard for a bus to add or remove variables without
+forcing an edit and recompile for all drivers which may not be
+possible for vendor supplied binary drivers.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/BUS_SETUP_INTR.9 b/share/man/man9/BUS_SETUP_INTR.9
new file mode 100644
index 000000000000..8264a999a5fb
--- /dev/null
+++ b/share/man/man9/BUS_SETUP_INTR.9
@@ -0,0 +1,216 @@
+.\" Copyright (c) 2000 Jeroen Ruigrok van der Werven
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 3, 2010
+.Dt BUS_SETUP_INTR 9
+.Os
+.Sh NAME
+.Nm BUS_SETUP_INTR ,
+.Nm bus_setup_intr ,
+.Nm BUS_TEARDOWN_INTR ,
+.Nm bus_teardown_intr
+.Nd create, attach and teardown an interrupt handler
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_SETUP_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "int flags"
+.Fa "driver_filter_t *filter" "driver_intr_t *ithread" "void *arg"
+.Fa "void **cookiep"
+.Fc
+.Ft int
+.Fo bus_setup_intr
+.Fa "device_t dev" "struct resource *r" "int flags"
+.Fa "driver_filter_t filter" "driver_intr_t ithread" "void *arg"
+.Fa "void **cookiep"
+.Fc
+.Ft int
+.Fo BUS_TEARDOWN_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "void *cookiep"
+.Fc
+.Ft int
+.Fn bus_teardown_intr "device_t dev" "struct resource *r" "void *cookiep"
+.Sh DESCRIPTION
+The
+.Fn BUS_SETUP_INTR
+method
+will create and attach an interrupt handler to an interrupt
+previously allocated by the resource manager's
+.Xr BUS_ALLOC_RESOURCE 9
+method.
+The
+.Fa flags
+are found in
+.In sys/bus.h ,
+and give the broad category of interrupt.
+The
+.Fa flags
+also tell the interrupt handlers about certain
+device driver characteristics.
+.Dv INTR_EXCL
+marks the handler as being
+an exclusive handler for this interrupt.
+.Dv INTR_MPSAFE
+tells the scheduler that the interrupt handler
+is well behaved in a preemptive environment
+(``SMP safe''),
+and does not need
+to be protected by the ``Giant Lock'' mutex.
+.Dv INTR_ENTROPY
+marks the interrupt as being a good source of entropy -
+this may be used by the entropy device
+.Pa /dev/random .
+.Pp
+To define a time-critical handler that will not execute any potentially
+blocking operation, use the
+.Fa filter
+argument.
+See the
+.Sx "Filter Routines"
+section below for information on writing a filter.
+Otherwise, use the
+.Fa ithread
+argument.
+The defined handler
+will be called with the value
+.Fa arg
+as its only argument.
+See the
+.Sx "ithread Routines"
+section below for more information on writing an interrupt handler.
+.Pp
+The
+.Fa cookiep
+argument is a pointer to a
+.Vt "void *"
+that
+.Fn BUS_SETUP_INTR
+will write a cookie for the parent bus' use to if it is successful in
+establishing an interrupt.
+Driver writers may assume that this cookie will be non-zero.
+The nexus driver will write 0 on failure to
+.Fa cookiep .
+.Pp
+The interrupt handler will be detached by
+.Fn BUS_TEARDOWN_INTR .
+The cookie needs to be passed to
+.Fn BUS_TEARDOWN_INTR
+in order to tear down the correct interrupt handler.
+Once
+.Fn BUS_TEARDOWN_INTR
+returns, it is guaranteed that the interrupt function is not active and
+will no longer be called.
+.Pp
+Mutexes are not allowed to be held across calls to these functions.
+.Ss "Filter Routines"
+A filter runs in primary interrupt context.
+In this context, normal mutexes cannot be used.
+Only the spin lock version of these can be used (specified by passing
+.Dv MTX_SPIN
+to
+.Fn mtx_init
+when initializing the mutex).
+.Xr wakeup 9
+and similar routines can be called.
+Atomic operations from
+.Pa machine/atomic
+may be used.
+Reads and writes to hardware through
+.Xr bus_space 9
+may be used.
+PCI configuration registers may be read and written.
+All other kernel interfaces cannot be used.
+.Pp
+In this restricted environment, care must be taken to account for all
+races.
+A careful analysis of races should be done as well.
+It is generally cheaper to take an extra interrupt, for example, than
+to protect variables with spinlocks.
+Read, modify, write cycles of hardware registers need to be carefully
+analyzed if other threads are accessing the same registers.
+.Pp
+Generally, a filter routine will use one of two strategies.
+The first strategy is to simply mask the interrupt in hardware and
+allow the
+.Dv ithread
+routine to read the state from the hardware and then reenable
+interrupts.
+The
+.Dv ithread
+also acknowledges the interrupt before re-enabling the interrupt
+source in hardware.
+Most PCI hardware can mask its interrupt source.
+.Pp
+The second common approach is to use a filter with multiple
+.Xr taskqueue 9
+tasks.
+In this case, the filter acknowledges the interrupts and queues the
+work to the appropriate taskqueue.
+Where one has to multiplex different kinds of interrupt sources, like
+a network card's transmit and receive paths, this can reduce lock
+contention and increase performance.
+.Pp
+You should not
+.Xr malloc 9
+from inside a filter.
+You may not call anything that uses a normal mutex.
+Witness may complain about these.
+.Ss "ithread Routines"
+You can do whatever you want in an ithread routine, except sleep.
+Care must be taken not to sleep in an ithread.
+In addition, one should minimize lock contention in an ithread routine
+because contested locks ripple over to all other ithread routines on
+that interrupt.
+.Ss "Sleeping"
+Sleeping is voluntarily giving up control of your thread.
+All the sleep routine found in
+.Xr msleep 9
+sleep.
+Waiting for a condition variable described in
+.Xr condvar 9
+is sleeping.
+Calling any function that does any of these things is sleeping.
+.Sh RETURN VALUES
+Zero is returned on success,
+otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr random 4 ,
+.Xr device 9 ,
+.Xr driver 9 ,
+.Xr locking 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Jeroen Ruigrok van der Werven
+.Aq asmodai@FreeBSD.org
+based on the manual pages for
+.Fn BUS_CREATE_INTR
+and
+.Fn BUS_CONNECT_INTR
+written by
+.An Doug Rabson
+.Aq dfr@FreeBSD.org .
diff --git a/share/man/man9/CTASSERT.9 b/share/man/man9/CTASSERT.9
new file mode 100644
index 000000000000..4885d4248b8e
--- /dev/null
+++ b/share/man/man9/CTASSERT.9
@@ -0,0 +1,70 @@
+.\" Copyright (c) 2003 Hiten M. Pandya
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 5, 2008
+.Dt CTASSERT 9
+.Os
+.Sh NAME
+.Nm CTASSERT
+.Nd compile time assertion macro
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.Fn CTASSERT expression
+.Sh DESCRIPTION
+The
+.Fn CTASSERT
+macro evaluates
+.Fa expression
+at compile time and causes a compiler error if it is false.
+.Pp
+The
+.Fn CTASSERT
+macro is useful for asserting the size or alignment of important
+data structures and variables during compilation, which would
+otherwise cause the code to fail at run time.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn CTASSERT
+macro should not be used in a header file.
+It is implemented using a dummy typedef, with a name (based on line number)
+that may conflict with a
+.Fn CTASSERT
+in a source file including that header.
+.Sh EXAMPLES
+Assert that the size of the
+.Vt uuid
+structure is 16 bytes.
+.Pp
+.Dl "CTASSERT(sizeof(struct uuid) == 16);"
+.Sh SEE ALSO
+.Xr KASSERT 9
+.Sh AUTHORS
+This manual page was written by
+.An Hiten M. Pandya
+.Aq hmp@FreeBSD.org .
diff --git a/share/man/man9/DB_COMMAND.9 b/share/man/man9/DB_COMMAND.9
new file mode 100644
index 000000000000..d45205757d9e
--- /dev/null
+++ b/share/man/man9/DB_COMMAND.9
@@ -0,0 +1,110 @@
+.\"-
+.\" Copyright (c) 2008 Guillaume Ballet
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 27, 2008
+.Dt DB_COMMAND 9
+.Os
+.Sh NAME
+.Nm DB_COMMAND ,
+.Nm DB_SHOW_COMMAND ,
+.Nm DB_SHOW_ALL_COMMAND
+.Nd Extends the ddb command set.
+.Sh SYNOPSIS
+.In ddb/ddb.h
+.Fo DB_COMMAND
+.Fa command_name
+.Fa command_function
+.Fc
+.Fn DB_SHOW_COMMAND "command_name" "command_function"
+.Fn DB_SHOW_ALL_COMMAND "command_name" "command_function"
+.Sh DESCRIPTION
+The
+.Fn DB_COMMAND
+macro adds
+.Fa command_name
+to the list of top-level commands.
+Invoking
+.Fa command_name
+from ddb will call
+.Fa command_function .
+.Pp
+The
+.Fn DB_SHOW_COMMAND
+and
+.Fn DB_SHOW_ALL_COMMAND
+are roughly equivalent to
+.Fn DB_COMMAND
+but in these cases,
+.Fa command_name
+is a sub-command of the ddb
+.Sy show
+command and
+.Sy show all
+command, respectively.
+.Pp
+The general command syntax:
+.Cm command Ns Op Li \&/ Ns Ar modifier
+.Ar address Ns Op Li , Ns Ar count ,
+translates into the following parameters for
+.Fa command_function :
+.Bl -tag
+.It Fa addr
+The address passed to the command as an argument.
+.It Fa have_addr
+A boolean value that is true if the addr field is valid.
+.It Fa count
+The number of quad words starting at offset
+.Fa addr
+that the command must process.
+.It Fa modif
+A pointer to the string of modifiers. That is, a series of symbols used to pass some options to the command. For example, the
+.Sy examine
+command will display words in decimal form if it is passed the modifier "d".
+.El
+.Sh EXAMPLE
+In your module, the command is declared as:
+.Bd -literal
+DB_COMMAND(mycmd, my_cmd_func)
+{
+ if (have_addr)
+ db_printf("Calling my command with address %p\\n", addr);
+}
+.Ed
+.Pp
+Then, when in ddb:
+.Bd -literal
+.Bf Sy
+db> mycmd 0x1000
+Calling my command with address 0x1000
+db>
+.Ef
+.Ed
+.Sh "SEE ALSO"
+.Xr ddb 4
+.Sh AUTHOR
+This manual page was written by
+.An Guillaume Ballet Aq gballet@gmail.com .
diff --git a/share/man/man9/DECLARE_GEOM_CLASS.9 b/share/man/man9/DECLARE_GEOM_CLASS.9
new file mode 100644
index 000000000000..a47ea8e89e8c
--- /dev/null
+++ b/share/man/man9/DECLARE_GEOM_CLASS.9
@@ -0,0 +1,179 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 13, 2007
+.Dt DECLARE_GEOM_CLASS 9
+.Os
+.Sh NAME
+.Nm DECLARE_GEOM_CLASS
+.Nd "GEOM class declaration macro"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Fn DECLARE_GEOM_CLASS "class" "mod_name"
+.Sh DESCRIPTION
+The
+.Fn DECLARE_GEOM_CLASS
+macro registers a GEOM class in GEOM.
+A GEOM class itself implements one particular kind of transformation.
+Typical examples are: MBR disk partition,
+.Bx
+disklabel and RAID5 classes.
+.Fn DECLARE_GEOM_CLASS
+can be used both for compiled in and loaded as
+.Xr kld 4
+modules GEOM classes and it is the only official way for class registration.
+.Pp
+The arguments to
+.Fn DECLARE_GEOM_CLASS
+are:
+.Bl -tag -offset indent
+.It Fa class
+The
+.Vt g_class
+structure which describes a GEOM class.
+.It Fa mod_name
+A kernel module name (not a class name!).
+.El
+.Pp
+Structure
+.Vt g_class
+contains data describing the class.
+They are:
+.Bl -tag -offset indent -width indent
+.It Vt "const char *" Va name
+Class name.
+.It Vt "g_taste_t *" Va taste
+Pointer to function used for taste event handling.
+If it is
+.Pf non- Dv NULL
+it is called in three situations:
+.Pp
+.Bl -dash -compact
+.It
+On class activation, all existing providers are offered for tasting.
+.It
+When new provider is created it is offered for tasting.
+.It
+After last write access to a provider is closed it is offered for retasting
+(on first write open event
+.Dq spoil
+was sent).
+.El
+.It Vt "g_config_t *" Va config
+This field is not used anymore, its functionality was replaced by the
+.Va ctlreq
+field.
+.It Vt "g_ctl_req_t *" Va ctlreq
+Pointer to function used for handling events from userland applications.
+.It Vt "g_init_t *" Va init
+Pointer to function which is called right after class registration.
+.It Vt "g_fini_t *" Va fini
+Pointer to function which is called right before class deregistration.
+.It Vt "g_ctl_destroy_geom_t *" Va destroy_geom
+Pointer to a function which is called for every geom on class unload.
+If this field is not set, the class can not be unloaded.
+.El
+.Pp
+Only a
+.Fa name
+field is required; the rest are optional.
+.Sh RESTRICTIONS/CONDITIONS
+The fields of
+.Vt g_class
+should always be initialized using C99-style field naming
+(see the initialization of
+.Va example_class
+below).
+.Sh EXAMPLES
+Example class declaration.
+.Bd -literal -offset indent
+static struct g_geom *
+g_example_taste(struct g_class *mp, struct g_provider *pp,
+ int flags __unused)
+{
+ g_topology_assert();
+
+ [...]
+}
+
+static void
+g_example_ctlreq(struct gctl_req *req, struct g_class *cp,
+ char const *verb)
+{
+
+ [...]
+}
+
+static int
+g_example_destroy_geom(struct gctl_req *req, struct g_class *cp,
+ struct g_geom *gp)
+{
+
+ g_topology_assert();
+
+ [...]
+}
+
+static void
+g_example_init(struct g_class *mp)
+{
+
+ [...]
+}
+
+static void
+g_example_fini(struct g_class *mp)
+{
+
+ [...]
+}
+
+struct g_class example_class = {
+ .name = "EXAMPLE",
+ .taste = g_example_taste,
+ .ctlreq = g_example_ctlreq,
+ .init = g_example_init,
+ .fini = g_example_fini,
+ .destroy_geom = g_example_destroy_geom
+};
+
+DECLARE_GEOM_CLASS(example_class, g_example);
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/DECLARE_MODULE.9 b/share/man/man9/DECLARE_MODULE.9
new file mode 100644
index 000000000000..d33c18ed6081
--- /dev/null
+++ b/share/man/man9/DECLARE_MODULE.9
@@ -0,0 +1,112 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt DECLARE_MODULE 9
+.Os
+.Sh NAME
+.Nm DECLARE_MODULE
+.Nd kernel module declaration macro
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/module.h
+.Fn DECLARE_MODULE "name" "moduledata_t data" "sub" "order"
+.Sh DESCRIPTION
+The
+.Fn DECLARE_MODULE
+macro declares a generic kernel module.
+It is used to register the module with the system, using the
+.Fn SYSINIT
+macro.
+.Fn DECLARE_MODULE
+is usually used within other macros, such as
+.Xr DRIVER_MODULE 9 ,
+.Xr DEV_MODULE 9
+and
+.Xr SYSCALL_MODULE 9 .
+Of course, it can also be called directly, for example in
+order to implement dynamic sysctls.
+.Pp
+The arguments it expects are:
+.Bl -tag -width indent
+.It Fa name
+The module name, which will be used in the
+.Fn SYSINIT
+call to identify the module.
+.It Fa data
+A
+.Vt moduledata_t
+structure, which contains two main items, the official name of the
+module name, which will be used in the
+.Vt module_t
+structure and a pointer to the event handler function of type
+.Vt modeventhand_t .
+.It Fa sub
+An argument directed to the
+.Fn SYSINIT
+macro.
+Valid values for this are contained in the
+.Vt sysinit_sub_id
+enumeration
+(see
+.In sys/kernel.h )
+and specify the type of system startup interfaces.
+The
+.Xr DRIVER_MODULE 9
+macro uses a value of
+.Dv SI_SUB_DRIVERS
+here for example, since these modules contain a driver for a device.
+For kernel modules that are loaded at runtime, a value of
+.Dv SI_SUB_EXEC
+is common.
+.It Fa order
+An argument for
+.Fn SYSINIT .
+It represents the KLDs order of initialization within the subsystem.
+Valid values are defined in the
+.Vt sysinit_elem_order
+enumeration
+.Pq In sys/kernel.h .
+.El
+.Sh SEE ALSO
+.Xr DEV_MODULE 9 ,
+.Xr DRIVER_MODULE 9 ,
+.Xr module 9 ,
+.Xr SYSCALL_MODULE 9
+.Pp
+.Pa /usr/include/sys/kernel.h ,
+.Pa /usr/share/examples/kld
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org ,
+inspired by the KLD Facility Programming Tutorial by
+.An Andrew Reiter Aq arr@watson.org .
diff --git a/share/man/man9/DELAY.9 b/share/man/man9/DELAY.9
new file mode 100644
index 000000000000..58b2a07e8b61
--- /dev/null
+++ b/share/man/man9/DELAY.9
@@ -0,0 +1,47 @@
+.\"
+.\" Copyright (c) 2000 Alfred Perlstein
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2000
+.Dt DELAY 9
+.Os
+.Sh NAME
+.Nm DELAY
+.Nd busy loop for an interval
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft void
+.Fn DELAY "int delay"
+.Sh DESCRIPTION
+Delay for
+.Fa delay
+microseconds (1/1000000th of a second).
+.Sh AUTHORS
+This manual page was written by
+.An Alfred Perlstein .
diff --git a/share/man/man9/DEVICE_ATTACH.9 b/share/man/man9/DEVICE_ATTACH.9
new file mode 100644
index 000000000000..ccb9f27b6930
--- /dev/null
+++ b/share/man/man9/DEVICE_ATTACH.9
@@ -0,0 +1,71 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt DEVICE_ATTACH 9
+.Os
+.Sh NAME
+.Nm DEVICE_ATTACH
+.Nd attach a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn DEVICE_ATTACH "device_t dev"
+.Sh DESCRIPTION
+Attach a device to the system after the
+.Fn DEVICE_PROBE
+method has been called and has indicated that
+the device exists.
+The
+.Fn DEVICE_ATTACH
+method should initialize the hardware and allocate other
+system resources (such as
+.Xr devfs 5
+entries).
+.Pp
+Devices which implement busses should use this method to probe for
+the existence of devices attached to the bus and add them as
+children.
+If this is combined with the use of
+.Xr bus_generic_attach 9
+the child devices will be automatically probed and attached.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr devfs 5 ,
+.Xr device 9 ,
+.Xr DEVICE_DETACH 9 ,
+.Xr DEVICE_IDENTIFY 9 ,
+.Xr DEVICE_PROBE 9 ,
+.Xr DEVICE_SHUTDOWN 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson Aq dfr@FreeBSD.org .
diff --git a/share/man/man9/DEVICE_DETACH.9 b/share/man/man9/DEVICE_DETACH.9
new file mode 100644
index 000000000000..8b4c43c2f2d0
--- /dev/null
+++ b/share/man/man9/DEVICE_DETACH.9
@@ -0,0 +1,65 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_DETACH 9
+.Os
+.Sh NAME
+.Nm DEVICE_DETACH
+.Nd detach a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn DEVICE_DETACH "device_t dev"
+.Sh DESCRIPTION
+Detach a device.
+This can be called if the user is replacing the
+driver software or if a device is about to be physically removed from
+the system (e.g.\& for
+.Xr pccard 4
+devices).
+.Pp
+The method should deallocate any system resources allocated during the
+.Xr DEVICE_ATTACH 9
+method and reset the hardware to a sane state (i.e., disable interrupts
+etc.)
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr pccard 4 ,
+.Xr device 9 ,
+.Xr DEVICE_ATTACH 9 ,
+.Xr DEVICE_IDENTIFY 9 ,
+.Xr DEVICE_PROBE 9 ,
+.Xr DEVICE_SHUTDOWN 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/DEVICE_IDENTIFY.9 b/share/man/man9/DEVICE_IDENTIFY.9
new file mode 100644
index 000000000000..4257407eac8b
--- /dev/null
+++ b/share/man/man9/DEVICE_IDENTIFY.9
@@ -0,0 +1,94 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 13, 2004
+.Dt DEVICE_IDENTIFY 9
+.Os
+.Sh NAME
+.Nm DEVICE_IDENTIFY
+.Nd identify a device, register it
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn DEVICE_IDENTIFY "driver_t *driver" "device_t parent"
+.Sh DESCRIPTION
+The identify function for a device is only needed for devices on busses
+that cannot identify their children independently, e.g.\& the ISA bus.
+It is used to recognize the device (usually done by accessing non-ambiguous
+registers in the hardware) and to tell the kernel about it and thus
+creating a new device instance.
+.Pp
+.Xr BUS_ADD_CHILD 9
+is used to register the device as a child of the bus.
+The device's resources (such as IRQ and I/O ports) are registered
+with the kernel by calling
+.Fn bus_set_resource
+for each resource (refer to
+.Xr bus_set_resource 9
+for more information).
+.Pp
+Since the device tree and the device driver tree are disjoint, the
+.Fn DEVICE_IDENTIFY
+routine needs to take this into account.
+If you load and unload your device driver that has the identify
+routine, the child node has the potential for adding the same node
+multiple times unless specific measure are taken to preclude that
+possibility.
+.Sh EXAMPLES
+The following pseudo-code shows an example of a function that
+probes for a piece of hardware and registers it and its resource
+(an I/O port) with the kernel.
+.Bd -literal
+void
+foo_identify(driver_t *driver, device_t parent)
+{
+ device_t child;
+
+ retrieve_device_information;
+ if (devices matches one of your supported devices &&
+ not already in device tree) {
+ child = BUS_ADD_CHILD(parent, 0, "foo", -1);
+ bus_set_resource(child, SYS_RES_IOPORT, 0, FOO_IOADDR, 1);
+ }
+}
+.Ed
+.Sh SEE ALSO
+.Xr BUS_ADD_CHILD 9 ,
+.Xr bus_set_resource 9 ,
+.Xr device 9 ,
+.Xr device_add_child 9 ,
+.Xr DEVICE_ATTACH 9 ,
+.Xr DEVICE_DETACH 9 ,
+.Xr DEVICE_PROBE 9 ,
+.Xr DEVICE_SHUTDOWN 9
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/DEVICE_PROBE.9 b/share/man/man9/DEVICE_PROBE.9
new file mode 100644
index 000000000000..86b8339288cb
--- /dev/null
+++ b/share/man/man9/DEVICE_PROBE.9
@@ -0,0 +1,139 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2012
+.Dt DEVICE_PROBE 9
+.Os
+.Sh NAME
+.Nm DEVICE_PROBE
+.Nd probe for device existence
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn DEVICE_PROBE "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn DEVICE_PROBE
+method should probe to see if the device is present.
+It should return 0 if the device exists,
+.Er ENXIO
+if it cannot be found.
+If some other error happens during the probe (such as a memory
+allocation failure), an appropriate error code should be returned.
+For
+cases where more than one driver matches a device, a priority value can
+be returned.
+In this case, success codes are values less than or equal
+to zero with the highest value representing the best match.
+Failure
+codes are represented by positive values and the regular
+.Ux
+error
+codes should be used for the purpose.
+.Pp
+If a driver returns a success code which is less than zero, it must
+not assume that it will be the same driver which is attached to the
+device.
+In particular, it must not assume that any values stored in
+the softc structure will be available for its attach method and any
+resources allocated during probe must be released and re-allocated
+if the attach method is called.
+In addition it is an absolute requirement that the probe routine have
+no side effects whatsoever.
+The probe routine may be called more than once before the attach
+routine is called.
+.Pp
+If a success code of zero is
+returned, the driver can assume that it will be the one attached, but
+must not hold any resources when the probe routine returns.
+A driver may assume that the softc is preserved when it returns
+a success code of zero.
+.Sh RETURN VALUES
+A value equal to or less than zero indicates success, greater than
+zero indicates an error (errno).
+For values equal to or less than
+zero: zero indicates highest priority, no further probing is done;
+for a value less than zero, the lower the value the lower the
+priority, e.g.\& -100 indicates a lower priority than -50.
+.Pp
+The following values are used by convention to indicate different
+strengths of matching in a probe routine.
+Except as noted, these are just suggested values, and there's nothing
+magical about them.
+.Bl -tag -width BUS_PROBE_NOWILDCARD
+.It BUS_PROBE_SPECIFIC
+The device that cannot be reprobed, and that no
+possible other driver may exist (typically legacy drivers who don't follow
+all the rules, or special needs drivers).
+.It BUS_PROBE_VENDOR
+The device is supported by a vendor driver.
+This is for source or binary drivers that are not yet integrated into the
+.Fx
+tree.
+Its use in the base OS is prohibited.
+.It BUS_PROBE_DEFAULT
+The device is a normal device matching some plug and play ID. This is
+the normal return value for drivers to use.
+It is intended that nearly all of the drivers in the tree should return
+this value.
+.It BUS_PROBE_LOW_PRIORITY
+The driver is a legacy driver, or an otherwise less desirable driver
+for a given plug and play ID.
+The driver has special requirements like when there are two drivers
+that support overlapping series of hardware devices.
+In this case the one that supports the older part of the line would
+return this value, while the one that supports the newer ones would
+return BUS_PROBE_DEFAULT.
+.It BUS_PROBE_GENERIC
+The driver matches the type of device generally.
+This allows drivers to match all serial ports generally, with specialized
+drivers matching particular types of serial ports that need special
+treatment for some reason.
+.It BUS_PROBE_HOOVER
+The driver matches all unclaimed devices on a bus.
+The
+.Xr ugen 4
+device is one example.
+.It BUS_PROBE_NOWILDCARD
+The driver expects its parent to tell it which children to manage
+and no probing is really done.
+The device only matches if its parent bus specifically said to use
+this driver.
+.El
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr DEVICE_ATTACH 9 ,
+.Xr DEVICE_DETACH 9 ,
+.Xr DEVICE_IDENTIFY 9 ,
+.Xr DEVICE_SHUTDOWN 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/DEVICE_SHUTDOWN.9 b/share/man/man9/DEVICE_SHUTDOWN.9
new file mode 100644
index 000000000000..0bf6a8bc8671
--- /dev/null
+++ b/share/man/man9/DEVICE_SHUTDOWN.9
@@ -0,0 +1,57 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 6, 2005
+.Dt DEVICE_SHUTDOWN 9
+.Os
+.Sh NAME
+.Nm DEVICE_SHUTDOWN
+.Nd called during system shutdown
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn DEVICE_SHUTDOWN "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn DEVICE_SHUTDOWN
+method is called during system shutdown to allow the driver to put the
+hardware into a consistent state for rebooting the computer.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr DEVICE_ATTACH 9 ,
+.Xr DEVICE_DETACH 9 ,
+.Xr DEVICE_IDENTIFY 9 ,
+.Xr DEVICE_PROBE 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/DEV_MODULE.9 b/share/man/man9/DEV_MODULE.9
new file mode 100644
index 000000000000..28465b3f8dac
--- /dev/null
+++ b/share/man/man9/DEV_MODULE.9
@@ -0,0 +1,105 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 19, 2012
+.Dt DEV_MODULE 9
+.Os
+.Sh NAME
+.Nm DEV_MODULE
+.Nd device driver module declaration macro
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/module.h
+.In sys/conf.h
+.Fn DEV_MODULE "name" "modeventhand_t evh" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn DEV_MODULE
+macro declares a device driver kernel module.
+It fills in a
+.Vt moduledata_t
+structure and then calls
+.Fn DECLARE_MODULE
+with the correct args, where
+.Fa name
+is the name of the module and
+.Fa evh
+(with its argument
+.Fa arg )
+is the event handler for the module (refer to
+.Xr DECLARE_MODULE 9
+for more information).
+The event handler is supposed to create the device with
+.Fn make_dev
+on load and to destroy it when it is unloaded using
+.Fn destroy_dev .
+.Sh EXAMPLES
+.Bd -literal
+#include <sys/module.h>
+#include <sys/conf.h>
+
+static struct cdevsw foo_devsw = { ... };
+
+static struct cdev *sdev;
+
+static int
+foo_load(module_t mod, int cmd, void *arg)
+{
+ int err = 0;
+
+ switch (cmd) {
+ case MOD_LOAD:
+ sdev = make_dev(&foo_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "foo");
+ break; /* Success*/
+
+ case MOD_UNLOAD:
+ case MOD_SHUTDOWN:
+ destroy_dev(sdev);
+ break; /* Success*/
+
+ default:
+ err = EINVAL;
+ break;
+ }
+
+ return(err);
+}
+
+DEV_MODULE(foo, foo_load, NULL);
+.Ed
+.Sh SEE ALSO
+.Xr DECLARE_MODULE 9 ,
+.Xr destroy_dev 9 ,
+.Xr make_dev 9 ,
+.Xr module 9
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/DRIVER_MODULE.9 b/share/man/man9/DRIVER_MODULE.9
new file mode 100644
index 000000000000..ca739452b366
--- /dev/null
+++ b/share/man/man9/DRIVER_MODULE.9
@@ -0,0 +1,104 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 27, 2011
+.Dt DRIVER_MODULE 9
+.Os
+.Sh NAME
+.Nm DRIVER_MODULE
+.Nd kernel driver declaration macro
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/bus.h
+.In sys/module.h
+.Fn DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn DRIVER_MODULE
+macro declares a kernel driver.
+.Fn DRIVER_MODULE
+expands to the real driver declaration, where the phrase
+.Fa name
+is used as the naming prefix for the driver and its functions.
+Note that it is supplied as plain text, and not a
+.Li char
+or
+.Li char * .
+.Pp
+.Fa busname
+is the parent bus of the driver (PCI, ISA, PPBUS and others), e.g.\&
+.Ql pci ,
+.Ql isa ,
+or
+.Ql ppbus .
+.Pp
+The identifier used in
+.Fn DRIVER_MODULE
+can be different from the driver name.
+Also, the same driver identifier can exist on different busses,
+which is a pretty clean way of making front ends for different cards
+using the same driver on the same or different busses.
+For example, the following is allowed:
+.Pp
+.Fn DRIVER_MODULE foo isa foo_driver foo_devclass NULL NULL ;
+.Pp
+.Fn DRIVER_MODULE foo pci foo_driver foo_devclass NULL NULL ;
+.Pp
+.Fa driver
+is the driver of type
+.Li driver_t ,
+which contains the information about the driver and is therefore one of the
+two most important parts of the call to
+.Fn DRIVER_MODULE .
+.Pp
+The
+.Fa devclass
+argument contains the kernel-internal information about the device,
+which will be used within the kernel driver module.
+.Pp
+The
+.Fa evh
+argument is the event handler which is called when the driver (or module)
+is loaded or unloaded (see
+.Xr module 9 ) .
+.Pp
+The
+.Fa arg
+is unused at this time and should be a
+.Dv NULL
+pointer.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9 ,
+.Xr module 9
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/EVENTHANDLER.9 b/share/man/man9/EVENTHANDLER.9
new file mode 100644
index 000000000000..ed83018d763c
--- /dev/null
+++ b/share/man/man9/EVENTHANDLER.9
@@ -0,0 +1,248 @@
+.\" Copyright (c) 2004 Joseph Koshy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\" $FreeBSD$
+.\"
+.Dd January 7, 2005
+.Dt EVENTHANDLER 9
+.Os
+.Sh NAME
+.Nm EVENTHANDLER
+.Nd kernel event handling functions
+.Sh SYNOPSIS
+.In sys/eventhandler.h
+.Fn EVENTHANDLER_DECLARE name type
+.Fn EVENTHANDLER_INVOKE name ...
+.Ft eventhandler_tag
+.Fn EVENTHANDLER_REGISTER name func arg priority
+.Fn EVENTHANDLER_DEREGISTER name tag
+.Ft eventhandler_tag
+.Fo eventhandler_register
+.Fa "struct eventhandler_list *list"
+.Fa "const char *name"
+.Fa "void *func"
+.Fa "void *arg"
+.Fa "int priority"
+.Fc
+.Ft void
+.Fo eventhandler_deregister
+.Fa "struct eventhandler_list *list"
+.Fa "eventhandler_tag tag"
+.Fc
+.Ft "struct eventhandler_list *"
+.Fn eventhandler_find_list "const char *name"
+.Ft void
+.Fn eventhandler_prune_list "struct eventhandler_list *list"
+.Sh DESCRIPTION
+The
+.Nm
+mechanism provides a way for kernel subsystems to register interest in
+kernel events and have their callback functions invoked when these
+events occur.
+.Pp
+The normal way to use this subsystem is via the macro interface.
+The macros that can be used for working with event handlers and callback
+function lists are:
+.Bl -tag -width indent
+.It Fn EVENTHANDLER_DECLARE
+This macro declares an event handler named by argument
+.Fa name
+with callback functions of type
+.Fa type .
+.It Fn EVENTHANDLER_REGISTER
+This macro registers a callback function
+.Fa func
+with event handler
+.Fa name .
+When invoked, function
+.Fa func
+will be invoked with argument
+.Fa arg
+as its first parameter along with any additional parameters passed in
+via macro
+.Fn EVENTHANDLER_INVOKE
+(see below).
+Callback functions are invoked in order of priority.
+The relative priority of each callback among other callbacks
+associated with an event is given by argument
+.Fa priority ,
+which is an integer ranging from
+.Dv EVENTHANDLER_PRI_FIRST
+(highest priority), to
+.Dv EVENTHANDLER_PRI_LAST
+(lowest priority).
+The symbol
+.Dv EVENTHANDLER_PRI_ANY
+may be used if the handler does not have a specific priority
+associated with it.
+If registration is successful,
+.Fn EVENTHANDLER_REGISTER
+returns a cookie of type
+.Vt eventhandler_tag .
+.It Fn EVENTHANDLER_DEREGISTER
+This macro removes a previously registered callback associated with tag
+.Fa tag
+from the event handler named by argument
+.Fa name .
+.It Fn EVENTHANDLER_INVOKE
+This macro is used to invoke all the callbacks associated with event
+handler
+.Fa name .
+This macro is a variadic one.
+Additional arguments to the macro after the
+.Fa name
+parameter are passed as the second and subsequent arguments to each
+registered callback function.
+.El
+.Pp
+The macros are implemented using the following functions:
+.Bl -tag -width indent
+.It Fn eventhandler_register
+The
+.Fn eventhandler_register
+function is used to register a callback with a given event.
+The arguments expected by this function are:
+.Bl -tag -width ".Fa priority"
+.It Fa list
+A pointer to an existing event handler list, or
+.Dv NULL .
+If
+.Fa list
+is
+.Dv NULL ,
+the event handler list corresponding to argument
+.Fa name
+is used.
+.It Fa name
+The name of the event handler list.
+.It Fa func
+A pointer to a callback function.
+Argument
+.Fa arg
+is passed to the callback function
+.Fa func
+as its first argument when it is invoked.
+.It Fa priority
+The relative priority of this callback among all the callbacks
+registered for this event.
+Valid values are those in the range
+.Dv EVENTHANDLER_PRI_FIRST
+to
+.Dv EVENTHANDLER_PRI_LAST .
+.El
+.Pp
+The
+.Fn eventhandler_register
+function returns a
+.Fa tag
+that can later be used with
+.Fn eventhandler_deregister
+to remove the particular callback function.
+.It Fn eventhandler_deregister
+The
+.Fn eventhandler_deregister
+function removes the callback associated with tag
+.Fa tag
+from the event handler list pointed to by
+.Fa list .
+This function is safe to call from inside an event handler
+callback.
+.It Fn eventhandler_find_list
+The
+.Fn eventhandler_find_list
+function returns a pointer to event handler list structure corresponding
+to event
+.Fa name .
+.It Fn eventhandler_prune_list
+The
+.Fn eventhandler_prune_list
+function removes all deregistered callbacks from the event list
+.Fa list .
+.El
+.Ss Kernel Event Handlers
+The following event handlers are present in the kernel:
+.Bl -tag -width indent
+.It Vt acpi_sleep_event
+Callbacks invoked when the system is being sent to sleep.
+.It Vt acpi_wakeup_event
+Callbacks invoked when the system is being woken up.
+.It Vt dev_clone
+Callbacks invoked when a new entry is created under
+.Pa /dev .
+.It Vt ifaddr_event
+Callbacks invoked when an address is set up on a network interface.
+.It Vt if_clone_event
+Callbacks invoked when an interface is cloned.
+.It Vt ifnet_arrival_event
+Callbacks invoked when a new network interface appears.
+.It Vt ifnet_departure_event
+Callbacks invoked when a network interface is taken down.
+.It Vt power_profile_change
+Callbacks invoked when the power profile of the system changes.
+.It Vt process_exec
+Callbacks invoked when a process performs an
+.Fn exec
+operation.
+.It Vt process_exit
+Callbacks invoked when a process exits.
+.It Vt process_fork
+Callbacks invoked when a process forks a child.
+.It Vt shutdown_pre_sync
+Callbacks invoked at shutdown time, before file systems are synchronized.
+.It Vt shutdown_post_sync
+Callbacks invoked at shutdown time, after all file systems are synchronized.
+.It Vt shutdown_final
+Callbacks invoked just before halting the system.
+.It Vt vm_lowmem
+Callbacks invoked when virtual memory is low.
+.It Vt watchdog_list
+Callbacks invoked when the system watchdog timer is reinitialized.
+.El
+.Sh RETURN VALUES
+The macro
+.Fn EVENTHANDLER_REGISTER
+and function
+.Fn eventhandler_register
+return a cookie of type
+.Vt eventhandler_tag ,
+which may be used in a subsequent call to
+.Fn EVENTHANDLER_DEREGISTER
+or
+.Fn eventhandler_deregister .
+.Pp
+The
+.Fn eventhandler_find_list
+function
+returns a pointer to an event handler list corresponding to parameter
+.Fa name ,
+or
+.Dv NULL
+if no such list was found.
+.Sh HISTORY
+The
+.Nm
+facility first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Joseph Koshy Aq jkoshy@FreeBSD.org .
diff --git a/share/man/man9/KASSERT.9 b/share/man/man9/KASSERT.9
new file mode 100644
index 000000000000..62c97c44bd55
--- /dev/null
+++ b/share/man/man9/KASSERT.9
@@ -0,0 +1,87 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Jonathan M. Bresler
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 14, 2000
+.Dt KASSERT 9
+.Os
+.Sh NAME
+.Nm KASSERT
+.Nd kernel expression verification macro
+.Sh SYNOPSIS
+.Cd "options INVARIANTS"
+.Pp
+.In sys/param.h
+.In sys/systm.h
+.Fn KASSERT expression msg
+.Sh DESCRIPTION
+In a kernel compiled with
+.Cd "options INVARIANTS" ,
+the
+.Fn KASSERT
+macro tests the given
+.Fa expression
+and if it is false,
+calls the
+.Xr panic 9
+function, terminating the running system.
+.Pp
+In a kernel that does not have
+.Cd "options INVARIANTS" ,
+the
+.Fn KASSERT
+macro is defined to be a no-op.
+The
+second argument is a
+.Xr printf 9
+format string and its arguments,
+enclosed in parentheses.
+.Sh EXAMPLES
+The kernel function
+.Fn vput
+must not be called with a
+.Dv NULL
+pointer.
+.Bd -literal -offset indent
+void
+vput(vp)
+ struct vnode *vp;
+{
+ struct proc *p = curproc;
+ KASSERT(vp != NULL, ("vput: null vp"));
+ ...
+}
+.Ed
+.Sh SEE ALSO
+.Xr config 8 ,
+.Xr panic 9
+.Sh AUTHORS
+This manual page was written by
+.An Jonathan M. Bresler
+.Aq jmb@FreeBSD.org .
diff --git a/share/man/man9/LOCK_PROFILING.9 b/share/man/man9/LOCK_PROFILING.9
new file mode 100644
index 000000000000..d64b3286e7a3
--- /dev/null
+++ b/share/man/man9/LOCK_PROFILING.9
@@ -0,0 +1,187 @@
+.\"-
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\" Copyright (c) 2006 Kip Macy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 7, 2012
+.Dt LOCK_PROFILING 9
+.Os
+.Sh NAME
+.Nm LOCK_PROFILING
+.Nd kernel lock profiling support
+.Sh SYNOPSIS
+.Cd "options LOCK_PROFILING"
+.Sh DESCRIPTION
+The
+.Dv LOCK_PROFILING
+kernel option adds support for measuring and reporting lock use and
+contention statistics.
+These statistics are collated by
+.Dq acquisition point .
+Acquisition points are
+distinct places in the kernel source code (identified by source file
+name and line number) where a lock is acquired.
+.Pp
+For each acquisition point, the following statistics are accumulated:
+.Bl -bullet
+.It
+The longest time the lock was ever continuously held after being
+acquired at this point.
+.It
+The total time the lock was held after being acquired at this point.
+.It
+The total time that threads have spent waiting to acquire the lock.
+.It
+The total number of non-recursive acquisitions.
+.It
+The total number of times the lock was already held by another thread
+when this point was reached, requiring a spin or a sleep.
+.It
+The total number of times another thread tried to acquire the lock
+while it was held after having been acquired at this point.
+.El
+.Pp
+In addition, the average hold time and average wait time are derived
+from the total hold time
+and total wait time respectively and the number of acquisitions.
+.Pp
+The
+.Dv LOCK_PROFILING
+kernel option also adds the following
+.Xr sysctl 8
+variables to control and monitor the profiling code:
+.Bl -tag -width indent
+.It Va debug.lock.prof.enable
+Enable or disable the lock profiling code.
+This defaults to 0 (off).
+.It Va debug.lock.prof.reset
+Reset the current lock profiling buffers.
+.It Va debug.lock.prof.stats
+The actual profiling statistics in plain text.
+The columns are as follows, from left to right:
+.Bl -tag -width ".Va cnt_hold"
+.It Va max
+The longest continuous hold time in microseconds.
+.It Va wait_max
+The longest continuous wait time in microseconds.
+.It Va total
+The total (accumulated) hold time in microseconds.
+.It Va wait_total
+The total (accumulated) wait time in microseconds.
+.It Va count
+The total number of acquisitions.
+.It Va avg
+The average hold time in microseconds, derived from the total hold time
+and the number of acquisitions.
+.It Va wait_avg
+The average wait time in microseconds, derived from the total wait time
+and the number of acquisitions.
+.It Va cnt_hold
+The number of times the lock was held and another thread attempted to
+acquire the lock.
+.It Va cnt_lock
+The number of times the lock was already held when this point was
+reached.
+.It Va name
+The name of the acquisition point, derived from the source file name
+and line number, followed by the name of the lock in parentheses.
+.El
+.It Va debug.lock.prof.rejected
+The number of acquisition points that were ignored after the table
+filled up.
+.It Va debug.lock.prof.skipspin
+Disable or enable the lock profiling code for the spin locks.
+This defaults to 0 (do profiling for the spin locks).
+.It Va debug.lock.prof.skipcount
+Do sampling approximately every N lock acquisitions.
+.El
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr mutex 9
+.Sh HISTORY
+Mutex profiling support appeared in
+.Fx 5.0 .
+Generalized lock profiling support appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm MUTEX_PROFILING
+code was written by
+.An Eivind Eklund Aq eivind@FreeBSD.org ,
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org
+and
+.An Robert Watson Aq rwatson@FreeBSD.org .
+The
+.Nm
+code was written by
+.An Kip Macy Aq kmacy@FreeBSD.org .
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+.Sh NOTES
+The
+.Dv LOCK_PROFILING
+option increases the size of
+.Vt "struct lock_object" ,
+so a kernel built with that option will not work with modules built
+without it.
+.Pp
+The
+.Dv LOCK_PROFILING
+option also prevents inlining of the mutex code, which can result in a
+fairly severe performance penalty.
+This is, however, not always the case.
+.Dv LOCK_PROFILING
+can introduce a substantial performance overhead that is easily
+monitorable using other profiling tools, so combining profiling tools
+with
+.Dv LOCK_PROFILING
+is not recommended.
+.Pp
+Measurements are made and stored in nanoseconds using
+.Xr nanotime 9 ,
+(on architectures without a synchronized TSC) but are presented in microseconds.
+This should still be sufficient for the locks one would be most
+interested in profiling (those that are held long and/or acquired
+often).
+.Pp
+.Dv LOCK_PROFILING
+should generally not be used in combination with other debugging options, as
+the results may be strongly affected by interactions between the features.
+In particular,
+.Dv LOCK_PROFILING
+will report higher than normal
+.Xr uma 9
+lock contention when run with
+.Dv INVARIANTS
+due to extra locking that occurs when
+.Dv INVARIANTS
+is present; likewise, using it in combination with
+.Dv WITNESS
+will lead to much higher lock hold times and contention in profiling output.
diff --git a/share/man/man9/MD5.9 b/share/man/man9/MD5.9
new file mode 100644
index 000000000000..1b9fcd2fb6e9
--- /dev/null
+++ b/share/man/man9/MD5.9
@@ -0,0 +1,78 @@
+.\" $OpenBSD: md5.9,v 1.1 1996/04/17 21:40:14 mickey Exp $
+.\"
+.\" Copyright (c) 1996 Michael Shalayeff
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Michael Shalayeff
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 17, 1996
+.Dt MD5 9
+.Os
+.Sh NAME
+.Nm MD5 ,
+.Nm MD5Init ,
+.Nm MD5Transform
+.Nd message digest routines
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/md5.h
+.Ft void
+.Fn MD5Init "MD5_CTX *buf"
+.Ft void
+.Fn MD5Transform "uint32_t buf[4]" "const unsigned char block[64]"
+.Sh DESCRIPTION
+The
+.Nm
+module implements the RSA Data Security, Inc.\& MD5 Message-Digest Algorithm
+(MD5).
+It produces 128-bit MD5 Digest of data.
+.Bl -hang -width MD5Transformxxx
+.It Pa MD5Init
+must be called just before
+.Fn MD5Transform
+will be used to produce a digest.
+The
+.Fa buf
+argument is the storage for the digest being produced on subsequent
+calls to the
+.Fn MD5Transform
+routine.
+.It Pa MD5Transform
+is the core of the MD5 algorithm, this alters an existing MD5 hash
+kept in
+.Fa buf
+to reflect the addition of 64 characters
+of new data passed in
+.Fa block
+argument.
+.El
+.Sh COPYRIGHTS
+The code for MD5 transform was taken from Colin Plumb's
+implementation, which has been placed in the public domain.
+The MD5 cryptographic checksum was devised by Ronald Rivest, and is
+documented in RFC 1321, "The MD5 Message Digest Algorithm".
diff --git a/share/man/man9/MODULE_DEPEND.9 b/share/man/man9/MODULE_DEPEND.9
new file mode 100644
index 000000000000..c0a8fdd44c94
--- /dev/null
+++ b/share/man/man9/MODULE_DEPEND.9
@@ -0,0 +1,80 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 11, 2005
+.Dt MODULE_DEPEND 9
+.Os
+.Sh NAME
+.Nm MODULE_DEPEND
+.Nd set kernel module dependencies
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/module.h
+.Fn MODULE_DEPEND "name" "moddepend" "int minversion" "int prefversion" "int maxversion"
+.Sh DESCRIPTION
+The
+.Fn MODULE_DEPEND
+macro sets a dependency on another kernel module with name
+.Fa moddepend ,
+which has registered
+its version with
+.Fn MODULE_VERSION .
+.Pp
+The
+.Fn MODULE_DEPEND
+macro provides hints to the kernel
+.Xr loader 8
+and to the kernel linker to ensure that the named dependency is loaded
+prior to the existing module.
+It does not change or dictate the order in which modules are
+initialized at runtime.
+.Pp
+Three versions must be specified for
+.Fa moddepend :
+.Bl -tag -width ".Fa prefversion"
+.It Fa minversion
+The minimum version on which the current module can depend.
+.It Fa maxversion
+The maximum version on which the current module can depend.
+.It Fa prefversion
+The preferred version on which the current module can depend.
+.El
+.Sh EXAMPLES
+.Bd -literal
+MODULE_DEPEND(foo, bar, 1, 3, 4);
+.Ed
+.Sh SEE ALSO
+.Xr DECLARE_MODULE 9 ,
+.Xr module 9 ,
+.Xr MODULE_VERSION 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/MODULE_VERSION.9 b/share/man/man9/MODULE_VERSION.9
new file mode 100644
index 000000000000..2f284b874b91
--- /dev/null
+++ b/share/man/man9/MODULE_VERSION.9
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 11, 2001
+.Dt MODULE_VERSION 9
+.Os
+.Sh NAME
+.Nm MODULE_VERSION
+.Nd set kernel module version
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/module.h
+.Fn MODULE_VERSION "name" "int version"
+.Sh DESCRIPTION
+The
+.Fn MODULE_VERSION
+macro sets the version of the module called
+.Fa name .
+Other kernel modules can then depend on this module (see
+.Xr MODULE_DEPEND 9 ) .
+.Sh EXAMPLES
+.Bd -literal
+MODULE_VERSION(foo, 1);
+.Ed
+.Sh SEE ALSO
+.Xr DECLARE_MODULE 9 ,
+.Xr module 9 ,
+.Xr MODULE_DEPEND 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
new file mode 100644
index 000000000000..e5778a1f8fff
--- /dev/null
+++ b/share/man/man9/Makefile
@@ -0,0 +1,1477 @@
+# $FreeBSD$
+
+MAN= accept_filter.9 \
+ accf_data.9 \
+ accf_dns.9 \
+ accf_http.9 \
+ acl.9 \
+ alq.9 \
+ altq.9 \
+ atomic.9 \
+ bios.9 \
+ boot.9 \
+ bpf.9 \
+ buf.9 \
+ buf_ring.9 \
+ BUF_ISLOCKED.9 \
+ BUF_LOCK.9 \
+ BUF_LOCKFREE.9 \
+ BUF_LOCKINIT.9 \
+ BUF_RECURSED.9 \
+ BUF_TIMELOCK.9 \
+ BUF_UNLOCK.9 \
+ bus_activate_resource.9 \
+ BUS_ADD_CHILD.9 \
+ bus_adjust_resource.9 \
+ bus_alloc_resource.9 \
+ BUS_BIND_INTR.9 \
+ bus_child_present.9 \
+ BUS_CONFIG_INTR.9 \
+ BUS_DESCRIBE_INTR.9 \
+ bus_dma.9 \
+ bus_generic_attach.9 \
+ bus_generic_detach.9 \
+ bus_generic_new_pass.9 \
+ bus_generic_print_child.9 \
+ bus_generic_read_ivar.9 \
+ bus_generic_shutdown.9 \
+ BUS_NEW_PASS.9 \
+ BUS_PRINT_CHILD.9 \
+ BUS_READ_IVAR.9 \
+ bus_release_resource.9 \
+ bus_set_pass.9 \
+ bus_set_resource.9 \
+ BUS_SETUP_INTR.9 \
+ bus_space.9 \
+ byteorder.9 \
+ cd.9 \
+ condvar.9 \
+ config_intrhook.9 \
+ contigmalloc.9 \
+ copy.9 \
+ cr_cansee.9 \
+ critical_enter.9 \
+ cr_seeothergids.9 \
+ cr_seeotheruids.9 \
+ crypto.9 \
+ CTASSERT.9 \
+ DB_COMMAND.9 \
+ DECLARE_GEOM_CLASS.9 \
+ DECLARE_MODULE.9 \
+ DELAY.9 \
+ devclass.9 \
+ devclass_find.9 \
+ devclass_get_device.9 \
+ devclass_get_devices.9 \
+ devclass_get_drivers.9 \
+ devclass_get_maxunit.9 \
+ devclass_get_name.9 \
+ devclass_get_softc.9 \
+ dev_clone.9 \
+ devfs_set_cdevpriv.9 \
+ device.9 \
+ device_add_child.9 \
+ DEVICE_ATTACH.9 \
+ device_delete_child.9 \
+ DEVICE_DETACH.9 \
+ device_enable.9 \
+ device_find_child.9 \
+ device_get_children.9 \
+ device_get_devclass.9 \
+ device_get_driver.9 \
+ device_get_ivars.9 \
+ device_get_name.9 \
+ device_get_parent.9 \
+ device_get_softc.9 \
+ device_get_state.9 \
+ device_get_sysctl.9 \
+ device_get_unit.9 \
+ DEVICE_IDENTIFY.9 \
+ device_printf.9 \
+ DEVICE_PROBE.9 \
+ device_probe_and_attach.9 \
+ device_quiet.9 \
+ device_set_desc.9 \
+ device_set_driver.9 \
+ device_set_flags.9 \
+ DEVICE_SHUTDOWN.9 \
+ DEV_MODULE.9 \
+ devstat.9 \
+ devtoname.9 \
+ disk.9 \
+ domain.9 \
+ drbr.9 \
+ driver.9 \
+ DRIVER_MODULE.9 \
+ EVENTHANDLER.9 \
+ eventtimers.9 \
+ extattr.9 \
+ fail.9 \
+ fetch.9 \
+ firmware.9 \
+ g_access.9 \
+ g_attach.9 \
+ g_bio.9 \
+ g_consumer.9 \
+ g_data.9 \
+ get_cyclecount.9 \
+ getnewvnode.9 \
+ g_event.9 \
+ g_geom.9 \
+ g_provider.9 \
+ g_provider_by_name.9 \
+ groupmember.9 \
+ g_wither_geom.9 \
+ hash.9 \
+ hashinit.9 \
+ hexdump.9 \
+ hhook.9 \
+ ieee80211.9 \
+ ieee80211_amrr.9 \
+ ieee80211_beacon.9 \
+ ieee80211_bmiss.9 \
+ ieee80211_crypto.9 \
+ ieee80211_ddb.9 \
+ ieee80211_input.9 \
+ ieee80211_node.9 \
+ ieee80211_output.9 \
+ ieee80211_proto.9 \
+ ieee80211_radiotap.9 \
+ ieee80211_regdomain.9 \
+ ieee80211_scan.9 \
+ ieee80211_vap.9 \
+ ifnet.9 \
+ inittodr.9 \
+ insmntque.9 \
+ intro.9 \
+ ithread.9 \
+ KASSERT.9 \
+ kernacc.9 \
+ kernel_mount.9 \
+ khelp.9 \
+ kobj.9 \
+ kproc.9 \
+ kqueue.9 \
+ kthread.9 \
+ ktr.9 \
+ lock.9 \
+ locking.9 \
+ LOCK_PROFILING.9 \
+ mac.9 \
+ make_dev.9 \
+ malloc.9 \
+ mbchain.9 \
+ mbpool.9 \
+ mbuf.9 \
+ mbuf_tags.9 \
+ MD5.9 \
+ mdchain.9 \
+ memcchr.9 \
+ memguard.9 \
+ microseq.9 \
+ microtime.9 \
+ microuptime.9 \
+ mi_switch.9 \
+ mod_cc.9 \
+ module.9 \
+ MODULE_DEPEND.9 \
+ MODULE_VERSION.9 \
+ mtx_pool.9 \
+ mutex.9 \
+ namei.9 \
+ netisr.9 \
+ osd.9 \
+ panic.9 \
+ pbuf.9 \
+ p_candebug.9 \
+ p_cansee.9 \
+ pci.9 \
+ pfil.9 \
+ pfind.9 \
+ pgfind.9 \
+ physio.9 \
+ pmap.9 \
+ pmap_activate.9 \
+ pmap_change_wiring.9 \
+ pmap_clear_modify.9 \
+ pmap_copy.9 \
+ pmap_enter.9 \
+ pmap_extract.9 \
+ pmap_growkernel.9 \
+ pmap_init.9 \
+ pmap_is_modified.9 \
+ pmap_is_prefaultable.9 \
+ pmap_map.9 \
+ pmap_mincore.9 \
+ pmap_object_init_pt.9 \
+ pmap_page_exists_quick.9 \
+ pmap_page_init.9 \
+ pmap_page_protect.9 \
+ pmap_pinit.9 \
+ pmap_qenter.9 \
+ pmap_release.9 \
+ pmap_remove.9 \
+ pmap_resident_count.9 \
+ pmap_zero_page.9 \
+ printf.9 \
+ prison_check.9 \
+ priv.9 \
+ pseudofs.9 \
+ psignal.9 \
+ random.9 \
+ random_harvest.9 \
+ redzone.9 \
+ refcount.9 \
+ resettodr.9 \
+ resource_int_value.9 \
+ rijndael.9 \
+ rman.9 \
+ rmlock.9 \
+ rtalloc.9 \
+ rtentry.9 \
+ runqueue.9 \
+ rwlock.9 \
+ sbuf.9 \
+ scheduler.9 \
+ securelevel_gt.9 \
+ selrecord.9 \
+ sema.9 \
+ sf_buf.9 \
+ sglist.9 \
+ shm_map.9 \
+ signal.9 \
+ sleep.9 \
+ sleepqueue.9 \
+ socket.9 \
+ spl.9 \
+ stack.9 \
+ store.9 \
+ style.9 \
+ swi.9 \
+ sx.9 \
+ SYSCALL_MODULE.9 \
+ sysctl.9 \
+ sysctl_add_oid.9 \
+ sysctl_ctx_init.9 \
+ SYSINIT.9 \
+ taskqueue.9 \
+ thread_exit.9 \
+ time.9 \
+ timeout.9 \
+ tvtohz.9 \
+ ucred.9 \
+ uidinfo.9 \
+ uio.9 \
+ unr.9 \
+ usbdi.9 \
+ utopia.9 \
+ vaccess.9 \
+ vaccess_acl_nfs4.9 \
+ vaccess_acl_posix1e.9 \
+ vcount.9 \
+ vflush.9 \
+ VFS.9 \
+ vfs_busy.9 \
+ VFS_CHECKEXP.9 \
+ vfsconf.9 \
+ VFS_FHTOVP.9 \
+ vfs_getnewfsid.9 \
+ vfs_getopt.9 \
+ vfs_getvfs.9 \
+ VFS_LOCK_GIANT.9 \
+ VFS_MOUNT.9 \
+ vfs_mount.9 \
+ vfs_mountedfrom.9 \
+ VFS_QUOTACTL.9 \
+ VFS_ROOT.9 \
+ vfs_rootmountalloc.9 \
+ VFS_SET.9 \
+ VFS_STATFS.9 \
+ vfs_suser.9 \
+ VFS_SYNC.9 \
+ vfs_timestamp.9 \
+ vfs_unbusy.9 \
+ VFS_UNMOUNT.9 \
+ vfs_unmountall.9 \
+ VFS_VGET.9 \
+ vget.9 \
+ vgone.9 \
+ vhold.9 \
+ vinvalbuf.9 \
+ vm_fault_prefault.9 \
+ vm_map.9 \
+ vm_map_check_protection.9 \
+ vm_map_create.9 \
+ vm_map_delete.9 \
+ vm_map_entry_resize_free.9 \
+ vm_map_find.9 \
+ vm_map_findspace.9 \
+ vm_map_inherit.9 \
+ vm_map_init.9 \
+ vm_map_insert.9 \
+ vm_map_lock.9 \
+ vm_map_lookup.9 \
+ vm_map_madvise.9 \
+ vm_map_max.9 \
+ vm_map_protect.9 \
+ vm_map_remove.9 \
+ vm_map_simplify_entry.9 \
+ vm_map_stack.9 \
+ vm_map_submap.9 \
+ vm_map_sync.9 \
+ vm_map_wire.9 \
+ vm_page_alloc.9 \
+ vm_page_bits.9 \
+ vm_page_cache.9 \
+ vm_page_deactivate.9 \
+ vm_page_dontneed.9 \
+ vm_page_aflag.9 \
+ vm_page_free.9 \
+ vm_page_grab.9 \
+ vm_page_hold.9 \
+ vm_page_insert.9 \
+ vm_page_io.9 \
+ vm_page_lookup.9 \
+ vm_page_rename.9 \
+ vm_page_sleep_if_busy.9 \
+ vm_page_wakeup.9 \
+ vm_page_wire.9 \
+ vm_set_page_size.9 \
+ vn_fullpath.9 \
+ vn_isdisk.9 \
+ vnode.9 \
+ VOP_ACCESS.9 \
+ VOP_ACLCHECK.9 \
+ VOP_ADVLOCK.9 \
+ VOP_ATTRIB.9 \
+ VOP_BWRITE.9 \
+ VOP_CREATE.9 \
+ VOP_FSYNC.9 \
+ VOP_GETACL.9 \
+ VOP_GETEXTATTR.9 \
+ VOP_GETPAGES.9 \
+ VOP_GETVOBJECT.9 \
+ VOP_INACTIVE.9 \
+ VOP_IOCTL.9 \
+ VOP_LINK.9 \
+ VOP_LISTEXTATTR.9 \
+ VOP_LOCK.9 \
+ VOP_LOOKUP.9 \
+ VOP_OPENCLOSE.9 \
+ VOP_PATHCONF.9 \
+ VOP_PRINT.9 \
+ VOP_RDWR.9 \
+ VOP_READDIR.9 \
+ VOP_READLINK.9 \
+ VOP_REALLOCBLKS.9 \
+ VOP_REMOVE.9 \
+ VOP_RENAME.9 \
+ VOP_REVOKE.9 \
+ VOP_SETACL.9 \
+ VOP_SETEXTATTR.9 \
+ VOP_STRATEGY.9 \
+ VOP_VPTOCNP.9 \
+ VOP_VPTOFH.9 \
+ vref.9 \
+ vrefcnt.9 \
+ vrele.9 \
+ vslock.9 \
+ watchdog.9 \
+ zero_copy.9 \
+ zone.9
+
+MLINKS= unr.9 alloc_unr.9 \
+ unr.9 alloc_unrl.9 \
+ unr.9 alloc_unr_specific.9 \
+ unr.9 delete_unrhdr.9 \
+ unr.9 free_unr.9 \
+ unr.9 new_unrhdr.9
+MLINKS+=alq.9 ALQ.9 \
+ alq.9 alq_close.9 \
+ alq.9 alq_flush.9 \
+ alq.9 alq_get.9 \
+ alq.9 alq_open.9 \
+ alq.9 alq_post.9 \
+ alq.9 alq_write.9
+MLINKS+=altq.9 ALTQ.9
+MLINKS+=atomic.9 atomic_add.9 \
+ atomic.9 atomic_clear.9 \
+ atomic.9 atomic_cmpset.9 \
+ atomic.9 atomic_fetchadd.9 \
+ atomic.9 atomic_load.9 \
+ atomic.9 atomic_readandclear.9 \
+ atomic.9 atomic_set.9 \
+ atomic.9 atomic_store.9 \
+ atomic.9 atomic_subtract.9
+MLINKS+=bpf.9 bpfattach.9 \
+ bpf.9 bpfattach2.9 \
+ bpf.9 bpfdetach.9 \
+ bpf.9 bpf_filter.9 \
+ bpf.9 bpf_mtap.9 \
+ bpf.9 bpf_mtap2.9 \
+ bpf.9 bpf_tap.9 \
+ bpf.9 bpf_validate.9
+MLINKS+=buf.9 bp.9
+MLINKS+=buf_ring.9 buf_ring_alloc.9 \
+ buf_ring.9 buf_ring_free.9 \
+ buf_ring.9 buf_ring_enqueue.9 \
+ buf_ring.9 buf_ring_enqueue_bytes.9 \
+ buf_ring.9 buf_ring_dequeue_mc.9 \
+ buf_ring.9 buf_ring_dequeue_sc.9 \
+ buf_ring.9 buf_ring_count.9 \
+ buf_ring.9 buf_ring_empty.9 \
+ buf_ring.9 buf_ring_full.9 \
+ buf_ring.9 buf_ring_peek.9
+MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9
+MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9
+MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9
+MLINKS+=BUS_DESCRIBE_INTR.9 bus_describe_intr.9
+MLINKS+=bus_dma.9 busdma.9 \
+ bus_dma.9 bus_dmamap_create.9 \
+ bus_dma.9 bus_dmamap_destroy.9 \
+ bus_dma.9 bus_dmamap_load.9 \
+ bus_dma.9 bus_dmamap_load_mbuf.9 \
+ bus_dma.9 bus_dmamap_load_mbuf_sg.9 \
+ bus_dma.9 bus_dmamap_load_uio.9 \
+ bus_dma.9 bus_dmamap_sync.9 \
+ bus_dma.9 bus_dmamap_unload.9 \
+ bus_dma.9 bus_dmamem_alloc.9 \
+ bus_dma.9 bus_dmamem_free.9 \
+ bus_dma.9 bus_dma_tag_create.9 \
+ bus_dma.9 bus_dma_tag_destroy.9
+MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9
+MLINKS+=BUS_READ_IVAR.9 BUS_WRITE_IVAR.9
+MLINKS+=BUS_SETUP_INTR.9 bus_setup_intr.9 \
+ BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9 \
+ BUS_SETUP_INTR.9 bus_teardown_intr.9
+MLINKS+=bus_space.9 bus_space_barrier.9 \
+ bus_space.9 bus_space_copy_region_1.9 \
+ bus_space.9 bus_space_copy_region_2.9 \
+ bus_space.9 bus_space_copy_region_4.9 \
+ bus_space.9 bus_space_copy_region_8.9 \
+ bus_space.9 bus_space_copy_region_stream_1.9 \
+ bus_space.9 bus_space_copy_region_stream_2.9 \
+ bus_space.9 bus_space_copy_region_stream_4.9 \
+ bus_space.9 bus_space_copy_region_stream_8.9 \
+ bus_space.9 bus_space_free.9 \
+ bus_space.9 bus_space_map.9 \
+ bus_space.9 bus_space_read_1.9 \
+ bus_space.9 bus_space_read_2.9 \
+ bus_space.9 bus_space_read_4.9 \
+ bus_space.9 bus_space_read_8.9 \
+ bus_space.9 bus_space_read_multi_1.9 \
+ bus_space.9 bus_space_read_multi_2.9 \
+ bus_space.9 bus_space_read_multi_4.9 \
+ bus_space.9 bus_space_read_multi_8.9 \
+ bus_space.9 bus_space_read_multi_stream_1.9 \
+ bus_space.9 bus_space_read_multi_stream_2.9 \
+ bus_space.9 bus_space_read_multi_stream_4.9 \
+ bus_space.9 bus_space_read_multi_stream_8.9 \
+ bus_space.9 bus_space_read_region_1.9 \
+ bus_space.9 bus_space_read_region_2.9 \
+ bus_space.9 bus_space_read_region_4.9 \
+ bus_space.9 bus_space_read_region_8.9 \
+ bus_space.9 bus_space_read_region_stream_1.9 \
+ bus_space.9 bus_space_read_region_stream_2.9 \
+ bus_space.9 bus_space_read_region_stream_4.9 \
+ bus_space.9 bus_space_read_region_stream_8.9 \
+ bus_space.9 bus_space_read_stream_1.9 \
+ bus_space.9 bus_space_read_stream_2.9 \
+ bus_space.9 bus_space_read_stream_4.9 \
+ bus_space.9 bus_space_read_stream_8.9 \
+ bus_space.9 bus_space_set_multi_1.9 \
+ bus_space.9 bus_space_set_multi_2.9 \
+ bus_space.9 bus_space_set_multi_4.9 \
+ bus_space.9 bus_space_set_multi_8.9 \
+ bus_space.9 bus_space_set_multi_stream_1.9 \
+ bus_space.9 bus_space_set_multi_stream_2.9 \
+ bus_space.9 bus_space_set_multi_stream_4.9 \
+ bus_space.9 bus_space_set_multi_stream_8.9 \
+ bus_space.9 bus_space_set_region_1.9 \
+ bus_space.9 bus_space_set_region_2.9 \
+ bus_space.9 bus_space_set_region_4.9 \
+ bus_space.9 bus_space_set_region_8.9 \
+ bus_space.9 bus_space_set_region_stream_1.9 \
+ bus_space.9 bus_space_set_region_stream_2.9 \
+ bus_space.9 bus_space_set_region_stream_4.9 \
+ bus_space.9 bus_space_set_region_stream_8.9 \
+ bus_space.9 bus_space_subregion.9 \
+ bus_space.9 bus_space_unmap.9 \
+ bus_space.9 bus_space_write_1.9 \
+ bus_space.9 bus_space_write_2.9 \
+ bus_space.9 bus_space_write_4.9 \
+ bus_space.9 bus_space_write_8.9 \
+ bus_space.9 bus_space_write_multi_1.9 \
+ bus_space.9 bus_space_write_multi_2.9 \
+ bus_space.9 bus_space_write_multi_4.9 \
+ bus_space.9 bus_space_write_multi_8.9 \
+ bus_space.9 bus_space_write_multi_stream_1.9 \
+ bus_space.9 bus_space_write_multi_stream_2.9 \
+ bus_space.9 bus_space_write_multi_stream_4.9 \
+ bus_space.9 bus_space_write_multi_stream_8.9 \
+ bus_space.9 bus_space_write_region_1.9 \
+ bus_space.9 bus_space_write_region_2.9 \
+ bus_space.9 bus_space_write_region_4.9 \
+ bus_space.9 bus_space_write_region_8.9 \
+ bus_space.9 bus_space_write_region_stream_1.9 \
+ bus_space.9 bus_space_write_region_stream_2.9 \
+ bus_space.9 bus_space_write_region_stream_4.9 \
+ bus_space.9 bus_space_write_region_stream_8.9 \
+ bus_space.9 bus_space_write_stream_1.9 \
+ bus_space.9 bus_space_write_stream_2.9 \
+ bus_space.9 bus_space_write_stream_4.9 \
+ bus_space.9 bus_space_write_stream_8.9
+MLINKS+=byteorder.9 be16dec.9 \
+ byteorder.9 be16enc.9 \
+ byteorder.9 be16toh.9 \
+ byteorder.9 be32dec.9 \
+ byteorder.9 be32enc.9 \
+ byteorder.9 be32toh.9 \
+ byteorder.9 be64dec.9 \
+ byteorder.9 be64enc.9 \
+ byteorder.9 be64toh.9 \
+ byteorder.9 bswap16.9 \
+ byteorder.9 bswap32.9 \
+ byteorder.9 bswap64.9 \
+ byteorder.9 htobe16.9 \
+ byteorder.9 htobe32.9 \
+ byteorder.9 htobe64.9 \
+ byteorder.9 htole16.9 \
+ byteorder.9 htole32.9 \
+ byteorder.9 htole64.9 \
+ byteorder.9 le16dec.9 \
+ byteorder.9 le16enc.9 \
+ byteorder.9 le16toh.9 \
+ byteorder.9 le32dec.9 \
+ byteorder.9 le32enc.9 \
+ byteorder.9 le32toh.9 \
+ byteorder.9 le64dec.9 \
+ byteorder.9 le64enc.9 \
+ byteorder.9 le64toh.9
+MLINKS+=condvar.9 cv_broadcast.9 \
+ condvar.9 cv_broadcastpri.9 \
+ condvar.9 cv_destroy.9 \
+ condvar.9 cv_init.9 \
+ condvar.9 cv_signal.9 \
+ condvar.9 cv_timedwait.9 \
+ condvar.9 cv_timedwait_sig.9 \
+ condvar.9 cv_wait.9 \
+ condvar.9 cv_wait_sig.9 \
+ condvar.9 cv_wait_unlock.9 \
+ condvar.9 cv_wmesg.9
+MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \
+ config_intrhook.9 config_intrhook_establish.9
+MLINKS+=contigmalloc.9 contigfree.9
+MLINKS+=copy.9 copyin.9 \
+ copy.9 copyin_nofault.9 \
+ copy.9 copyinstr.9 \
+ copy.9 copyout.9 \
+ copy.9 copyout_nofault.9 \
+ copy.9 copystr.9
+MLINKS+=critical_enter.9 critical.9 \
+ critical_enter.9 critical_exit.9
+MLINKS+=crypto.9 crypto_dispatch.9 \
+ crypto.9 crypto_done.9 \
+ crypto.9 crypto_freereq.9 \
+ crypto.9 crypto_freesession.9 \
+ crypto.9 crypto_get_driverid.9 \
+ crypto.9 crypto_getreq.9 \
+ crypto.9 crypto_kdispatch.9 \
+ crypto.9 crypto_kdone.9 \
+ crypto.9 crypto_kregister.9 \
+ crypto.9 crypto_newsession.9 \
+ crypto.9 crypto_register.9 \
+ crypto.9 crypto_unblock.9 \
+ crypto.9 crypto_unregister.9 \
+ crypto.9 crypto_unregister_all.9
+MLINKS+=DB_COMMAND.9 DB_SHOW_ALL_COMMAND.9 \
+ DB_COMMAND.9 DB_SHOW_COMMAND.9
+MLINKS+=dev_clone.9 drain_dev_clone_events.9
+MLINKS+=devfs_set_cdevpriv.9 devfs_clear_cdevpriv.9 \
+ devfs_set_cdevpriv.9 devfs_get_cdevpriv.9
+MLINKS+=device_add_child.9 device_add_child_ordered.9
+MLINKS+=device_enable.9 device_disable.9 \
+ device_enable.9 device_is_enabled.9
+MLINKS+=device_get_ivars.9 device_set_ivars.9
+MLINKS+=device_get_name.9 device_get_nameunit.9
+MLINKS+=device_get_state.9 device_busy.9 \
+ device_get_state.9 device_is_alive.9 \
+ device_get_state.9 device_is_attached.9 \
+ device_get_state.9 device_unbusy.9
+MLINKS+=device_get_sysctl.9 device_get_sysctl_ctx.9 \
+ device_get_sysctl.9 device_get_sysctl_tree.9
+MLINKS+=device_quiet.9 device_is_quiet.9 \
+ device_quiet.9 device_verbose.9
+MLINKS+=device_set_desc.9 device_get_desc.9 \
+ device_set_desc.9 device_set_desc_copy.9
+MLINKS+=device_set_flags.9 device_get_flags.9
+MLINKS+=devstat.9 devicestat.9 \
+ devstat.9 devstat_add_entry.9 \
+ devstat.9 devstat_end_transaction.9 \
+ devstat.9 devstat_remove_entry.9 \
+ devstat.9 devstat_start_transaction.9
+MLINKS+=disk.9 disk_alloc.9 \
+ disk.9 disk_create.9 \
+ disk.9 disk_destroy.9 \
+ disk.9 disk_gone.9
+MLINKS+=domain.9 DOMAIN_SET.9 \
+ domain.9 domain_add.9 \
+ domain.9 pfctlinput.9 \
+ domain.9 pfctlinput2.9 \
+ domain.9 pffindproto.9 \
+ domain.9 pffindtype.9
+MLINKS+=drbr.9 drbr_free.9 \
+ drbr.9 drbr_enqueue.9 \
+ drbr.9 drbr_dequeue.9 \
+ drbr.9 drbr_dequeue_cond.9 \
+ drbr.9 drbr_flush.9 \
+ drbr.9 drbr_empty.9 \
+ drbr.9 drbr_inuse.9 \
+ drbr.9 drbr_stats_update.9
+MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \
+ EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \
+ EVENTHANDLER.9 eventhandler_deregister.9 \
+ EVENTHANDLER.9 eventhandler_find_list.9 \
+ EVENTHANDLER.9 EVENTHANDLER_INVOKE.9 \
+ EVENTHANDLER.9 eventhandler_prune_list.9 \
+ EVENTHANDLER.9 EVENTHANDLER_REGISTER.9 \
+ EVENTHANDLER.9 eventhandler_register.9
+MLINKS+=eventtimers.9 et_register.9 \
+ eventtimers.9 et_deregister.9 \
+ eventtimers.9 et_ban.9 \
+ eventtimers.9 et_find.9 \
+ eventtimers.9 et_free.9 \
+ eventtimers.9 et_init.9 \
+ eventtimers.9 ET_LOCK.9 \
+ eventtimers.9 ET_UNLOCK.9 \
+ eventtimers.9 et_start.9 \
+ eventtimers.9 et_stop.9
+MLINKS+=fetch.9 fubyte.9 \
+ fetch.9 fuswintr.9 \
+ fetch.9 fuword.9 \
+ fetch.9 fuword16.9 \
+ fetch.9 fuword32.9 \
+ fetch.9 fuword64.9
+MLINKS+=g_attach.9 g_detach.9
+MLINKS+=g_bio.9 g_clone_bio.9 \
+ g_bio.9 g_destroy_bio.9 \
+ g_bio.9 g_new_bio.9 \
+ g_bio.9 g_print_bio.9
+MLINKS+=g_consumer.9 g_destroy_consumer.9 \
+ g_consumer.9 g_new_consumer.9
+MLINKS+=g_data.9 g_read_data.9 \
+ g_data.9 g_write_data.9
+MLINKS+=g_event.9 g_cancel_event.9 \
+ g_event.9 g_post_event.9 \
+ g_event.9 g_waitfor_event.9
+MLINKS+=g_geom.9 g_destroy_geom.9 \
+ g_geom.9 g_new_geomf.9
+MLINKS+=g_provider.9 g_destroy_provider.9 \
+ g_provider.9 g_error_provider.9 \
+ g_provider.9 g_new_providerf.9
+MLINKS+=hash.9 hash32.9 \
+ hash.9 hash32_buf.9 \
+ hash.9 hash32_str.9 \
+ hash.9 hash32_stre.9 \
+ hash.9 hash32_strn.9 \
+ hash.9 hash32_strne.9
+MLINKS+=hashinit.9 hashdestroy.9 \
+ hashinit.9 hashinit_flags.9 \
+ hashinit.9 phashinit.9
+MLINKS+=ieee80211.9 ieee80211_ifattach.9 \
+ ieee80211.9 ieee80211_ifdetach.9
+MLINKS+=ieee80211_amrr.9 ieee80211_amrr_cleanup.9 \
+ ieee80211_amrr.9 ieee80211_amrr_init.9 \
+ ieee80211_amrr.9 ieee80211_amrr_node_init.9 \
+ ieee80211_amrr.9 ieee80211_amrr_setinterval.9 \
+ ieee80211_amrr.9 ieee80211_amrr_tx_complete.9 \
+ ieee80211_amrr.9 ieee80211_amrr_tx_update.9
+MLINKS+=ieee80211_beacon.9 ieee80211_beacon_alloc.9 \
+ ieee80211_beacon.9 ieee80211_beacon_notify.9 \
+ ieee80211_beacon.9 ieee80211_beacon_update.9
+MLINKS+=ieee80211_bmiss.9 ieee80211_beacon_miss.9
+MLINKS+=ieee80211_crypto.9 ieee80211_crypto_available.9 \
+ ieee80211_crypto.9 ieee80211_crypto_decap.9 \
+ ieee80211_crypto.9 ieee80211_crypto_delglobalkeys.9 \
+ ieee80211_crypto.9 ieee80211_crypto_demic.9 \
+ ieee80211_crypto.9 ieee80211_crypto_encap.9 \
+ ieee80211_crypto.9 ieee80211_crypto_enmic.9 \
+ ieee80211_crypto.9 ieee80211_crypto_newkey.9 \
+ ieee80211_crypto.9 ieee80211_crypto_register.9 \
+ ieee80211_crypto.9 ieee80211_crypto_reload_keys.9 \
+ ieee80211_crypto.9 ieee80211_crypto_setkey.9 \
+ ieee80211_crypto.9 ieee80211_crypto_unregister.9 \
+ ieee80211_crypto.9 ieee80211_key_update_begin.9 \
+ ieee80211_crypto.9 ieee80211_key_update_end.9 \
+ ieee80211_crypto.9 ieee80211_notify_michael_failure.9 \
+ ieee80211_crypto.9 ieee80211_notify_replay_failure.9
+MLINKS+=ieee80211_input.9 ieee80211_input_all.9
+MLINKS+=ieee80211_node.9 ieee80211_dump_node.9 \
+ ieee80211_node.9 ieee80211_dump_nodes.9 \
+ ieee80211_node.9 ieee80211_find_rxnode.9 \
+ ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \
+ ieee80211_node.9 ieee80211_free_node.9 \
+ ieee80211_node.9 ieee80211_iterate_nodes.9 \
+ ieee80211_node.9 ieee80211_ref_node.9 \
+ ieee80211_node.9 ieee80211_unref_node.9
+MLINKS+=ieee80211_output.9 ieee80211_process_callback.9 \
+ ieee80211_output.9 M_SEQNO_GET.9 \
+ ieee80211_output.9 M_WME_GETAC.9
+MLINKS+=ieee80211_proto.9 ieee80211_new_state.9 \
+ ieee80211_proto.9 ieee80211_resume_all.9 \
+ ieee80211_proto.9 ieee80211_start_all.9 \
+ ieee80211_proto.9 ieee80211_stop_all.9 \
+ ieee80211_proto.9 ieee80211_suspend_all.9 \
+ ieee80211_proto.9 ieee80211_waitfor_parent.9
+MLINKS+=ieee80211_radiotap.9 ieee80211_radiotap_active.9 \
+ ieee80211_radiotap.9 ieee80211_radiotap_active_vap.9 \
+ ieee80211_radiotap.9 ieee80211_radiotap_attach.9 \
+ ieee80211_radiotap.9 ieee80211_radiotap_tx.9 \
+ ieee80211_radiotap.9 radiotap.9
+MLINKS+=ieee80211_regdomain.9 ieee80211_alloc_countryie.9 \
+ ieee80211_regdomain.9 ieee80211_init_channels.9 \
+ ieee80211_regdomain.9 ieee80211_sort_channels.9
+MLINKS+=ieee80211_vap.9 ieee80211_vap_attach.9 \
+ ieee80211_vap.9 ieee80211_vap_detach.9 \
+ ieee80211_vap.9 ieee80211_vap_setup.9
+MLINKS+=ifnet.9 ifaddr.9 \
+ ifnet.9 if_data.9 \
+ ifnet.9 ifqueue.9
+MLINKS+=insmntque.9 insmntque1.9
+MLINKS+=ithread.9 ithread_add_handler.9 \
+ ithread.9 ithread_create.9 \
+ ithread.9 ithread_destroy.9 \
+ ithread.9 ithread_priority.9 \
+ ithread.9 ithread_remove_handler.9 \
+ ithread.9 ithread_schedule.9
+MLINKS+=kernacc.9 useracc.9
+MLINKS+=kernel_mount.9 free_mntarg.9 \
+ kernel_mount.9 kernel_vmount.9 \
+ kernel_mount.9 mount_arg.9 \
+ kernel_mount.9 mount_argb.9 \
+ kernel_mount.9 mount_argf.9 \
+ kernel_mount.9 mount_argsu.9
+MLINKS+=kobj.9 DEFINE_CLASS.9 \
+ kobj.9 kobj_class_compile.9 \
+ kobj.9 kobj_class_compile_static.9 \
+ kobj.9 kobj_class_free.9 \
+ kobj.9 kobj_create.9 \
+ kobj.9 kobj_delete.9 \
+ kobj.9 kobj_init.9 \
+ kobj.9 kobj_init_static.9
+MLINKS+=kproc.9 kproc_create.9 \
+ kproc.9 kproc_exit.9 \
+ kproc.9 kproc_resume.9 \
+ kproc.9 kproc_shutdown.9 \
+ kproc.9 kproc_start.9 \
+ kproc.9 kproc_suspend.9 \
+ kproc.9 kproc_suspend_check.9 \
+ kproc.9 kthread_create.9
+MLINKS+=kqueue.9 knlist_add.9 \
+ kqueue.9 knlist_clear.9 \
+ kqueue.9 knlist_delete.9 \
+ kqueue.9 knlist_destroy.9 \
+ kqueue.9 knlist_empty.9 \
+ kqueue.9 knlist_init.9 \
+ kqueue.9 knlist_init_mtx.9 \
+ kqueue.9 knlist_init_rw_reader.9 \
+ kqueue.9 knlist_remove.9 \
+ kqueue.9 knlist_remove_inevent.9 \
+ kqueue.9 knote_fdclose.9 \
+ kqueue.9 KNOTE_LOCKED.9 \
+ kqueue.9 KNOTE_UNLOCKED.9 \
+ kqueue.9 kqfd_register.9 \
+ kqueue.9 kqueue_add_filteropts.9 \
+ kqueue.9 kqueue_del_filteropts.9
+MLINKS+=kthread.9 kthread_add.9 \
+ kthread.9 kthread_exit.9 \
+ kthread.9 kthread_resume.9 \
+ kthread.9 kthread_shutdown.9 \
+ kthread.9 kthread_start.9 \
+ kthread.9 kthread_suspend.9 \
+ kthread.9 kthread_suspend_check.9
+MLINKS+=ktr.9 CTR0.9 \
+ ktr.9 CTR1.9 \
+ ktr.9 CTR2.9 \
+ ktr.9 CTR3.9 \
+ ktr.9 CTR4.9 \
+ ktr.9 CTR5.9
+MLINKS+=lock.9 lockdestroy.9 \
+ lock.9 lockinit.9 \
+ lock.9 lockmgr.9 \
+ lock.9 lockmgr_args.9 \
+ lock.9 lockmgr_args_rw.9 \
+ lock.9 lockmgr_assert.9 \
+ lock.9 lockmgr_disown.9 \
+ lock.9 lockmgr_printinfo.9 \
+ lock.9 lockmgr_recursed.9 \
+ lock.9 lockmgr_rw.9 \
+ lock.9 lockmgr_waiters.9 \
+ lock.9 lockstatus.9
+MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
+MLINKS+=make_dev.9 destroy_dev.9 \
+ make_dev.9 destroy_dev_drain.9 \
+ make_dev.9 destroy_dev_sched.9 \
+ make_dev.9 destroy_dev_sched_cb.9 \
+ make_dev.9 dev_depends.9 \
+ make_dev.9 make_dev_alias.9 \
+ make_dev.9 make_dev_alias_p.9 \
+ make_dev.9 make_dev_cred.9 \
+ make_dev.9 make_dev_credf.9 \
+ make_dev.9 make_dev_p.9
+MLINKS+=malloc.9 free.9 \
+ malloc.9 MALLOC_DECLARE.9 \
+ malloc.9 MALLOC_DEFINE.9 \
+ malloc.9 realloc.9 \
+ malloc.9 reallocf.9
+MLINKS+=mbchain.9 mb_detach.9 \
+ mbchain.9 mb_done.9 \
+ mbchain.9 mb_fixhdr.9 \
+ mbchain.9 mb_init.9 \
+ mbchain.9 mb_initm.9 \
+ mbchain.9 mb_put_int64be.9 \
+ mbchain.9 mb_put_int64le.9 \
+ mbchain.9 mb_put_mbuf.9 \
+ mbchain.9 mb_put_mem.9 \
+ mbchain.9 mb_put_uint16be.9 \
+ mbchain.9 mb_put_uint16le.9 \
+ mbchain.9 mb_put_uint32be.9 \
+ mbchain.9 mb_put_uint32le.9 \
+ mbchain.9 mb_put_uint8.9 \
+ mbchain.9 mb_put_uio.9 \
+ mbchain.9 mb_reserve.9
+MLINKS+=mbpool.9 mbp_alloc.9 \
+ mbpool.9 mbp_card_free.9 \
+ mbpool.9 mbp_count.9 \
+ mbpool.9 mbp_create.9 \
+ mbpool.9 mbp_destroy.9 \
+ mbpool.9 mbp_ext_free.9 \
+ mbpool.9 mbp_free.9 \
+ mbpool.9 mbp_get.9 \
+ mbpool.9 mbp_get_keep.9 \
+ mbpool.9 mbp_sync.9
+MLINKS+=\
+ mbuf.9 m_adj.9 \
+ mbuf.9 M_ALIGN.9 \
+ mbuf.9 m_apply.9 \
+ mbuf.9 m_cat.9 \
+ mbuf.9 MCHTYPE.9 \
+ mbuf.9 MCLGET.9 \
+ mbuf.9 m_copyback.9 \
+ mbuf.9 m_copydata.9 \
+ mbuf.9 m_copym.9 \
+ mbuf.9 m_copypacket.9 \
+ mbuf.9 m_defrag.9 \
+ mbuf.9 m_devget.9 \
+ mbuf.9 m_dup.9 \
+ mbuf.9 m_dup_pkthdr.9 \
+ mbuf.9 MEXTADD.9 \
+ mbuf.9 MEXT_ADD_REF.9 \
+ mbuf.9 MEXTFREE.9 \
+ mbuf.9 MEXT_IS_REF.9 \
+ mbuf.9 MEXT_REM_REF.9 \
+ mbuf.9 m_fixhdr.9 \
+ mbuf.9 MFREE.9 \
+ mbuf.9 m_free.9 \
+ mbuf.9 m_freem.9 \
+ mbuf.9 MGET.9 \
+ mbuf.9 m_get.9 \
+ mbuf.9 m_getcl.9 \
+ mbuf.9 m_getclr.9 \
+ mbuf.9 MGETHDR.9 \
+ mbuf.9 m_gethdr.9 \
+ mbuf.9 m_getm.9 \
+ mbuf.9 m_getptr.9 \
+ mbuf.9 MH_ALIGN.9 \
+ mbuf.9 M_LEADINGSPACE.9 \
+ mbuf.9 m_length.9 \
+ mbuf.9 M_MOVE_PKTHDR.9 \
+ mbuf.9 m_move_pkthdr.9 \
+ mbuf.9 M_PREPEND.9 \
+ mbuf.9 m_prepend.9 \
+ mbuf.9 m_pullup.9 \
+ mbuf.9 m_split.9 \
+ mbuf.9 mtod.9 \
+ mbuf.9 M_TRAILINGSPACE.9 \
+ mbuf.9 M_WRITABLE.9
+MLINKS+=\
+ mbuf_tags.9 m_tag_alloc.9 \
+ mbuf_tags.9 m_tag_copy.9 \
+ mbuf_tags.9 m_tag_copy_chain.9 \
+ mbuf_tags.9 m_tag_delete.9 \
+ mbuf_tags.9 m_tag_delete_chain.9 \
+ mbuf_tags.9 m_tag_delete_nonpersistent.9 \
+ mbuf_tags.9 m_tag_find.9 \
+ mbuf_tags.9 m_tag_first.9 \
+ mbuf_tags.9 m_tag_free.9 \
+ mbuf_tags.9 m_tag_get.9 \
+ mbuf_tags.9 m_tag_init.9 \
+ mbuf_tags.9 m_tag_locate.9 \
+ mbuf_tags.9 m_tag_next.9 \
+ mbuf_tags.9 m_tag_prepend.9 \
+ mbuf_tags.9 m_tag_unlink.9
+MLINKS+=MD5.9 MD5Init.9 \
+ MD5.9 MD5Transform.9
+MLINKS+=mdchain.9 md_append_record.9 \
+ mdchain.9 md_done.9 \
+ mdchain.9 md_get_int64.9 \
+ mdchain.9 md_get_int64be.9 \
+ mdchain.9 md_get_int64le.9 \
+ mdchain.9 md_get_mbuf.9 \
+ mdchain.9 md_get_mem.9 \
+ mdchain.9 md_get_uint16.9 \
+ mdchain.9 md_get_uint16be.9 \
+ mdchain.9 md_get_uint16le.9 \
+ mdchain.9 md_get_uint32.9 \
+ mdchain.9 md_get_uint32be.9 \
+ mdchain.9 md_get_uint32le.9 \
+ mdchain.9 md_get_uint8.9 \
+ mdchain.9 md_get_uio.9 \
+ mdchain.9 md_initm.9 \
+ mdchain.9 md_next_record.9
+MLINKS+=microtime.9 bintime.9 \
+ microtime.9 getbintime.9 \
+ microtime.9 getmicrotime.9 \
+ microtime.9 getnanotime.9 \
+ microtime.9 nanotime.9
+MLINKS+=microuptime.9 binuptime.9 \
+ microuptime.9 getbinuptime.9 \
+ microuptime.9 getmicrouptime.9 \
+ microuptime.9 getnanouptime.9 \
+ microuptime.9 nanouptime.9
+MLINKS+=mi_switch.9 cpu_switch.9 \
+ mi_switch.9 cpu_throw.9
+MLINKS+=mtx_pool.9 mtx_pool_alloc.9 \
+ mtx_pool.9 mtx_pool_create.9 \
+ mtx_pool.9 mtx_pool_destroy.9 \
+ mtx_pool.9 mtx_pool_find.9 \
+ mtx_pool.9 mtx_pool_lock.9 \
+ mtx_pool.9 mtx_pool_lock_spin.9 \
+ mtx_pool.9 mtx_pool_unlock.9 \
+ mtx_pool.9 mtx_pool_unlock_spin.9
+MLINKS+=mutex.9 mtx_assert.9 \
+ mutex.9 mtx_destroy.9 \
+ mutex.9 mtx_init.9 \
+ mutex.9 mtx_initialized.9 \
+ mutex.9 mtx_lock.9 \
+ mutex.9 mtx_lock_flags.9 \
+ mutex.9 mtx_lock_spin.9 \
+ mutex.9 mtx_lock_spin_flags.9 \
+ mutex.9 mtx_owned.9 \
+ mutex.9 mtx_recursed.9 \
+ mutex.9 mtx_sleep.9 \
+ mutex.9 MTX_SYSINIT.9 \
+ mutex.9 mtx_trylock.9 \
+ mutex.9 mtx_trylock_flags.9 \
+ mutex.9 mtx_unlock.9 \
+ mutex.9 mtx_unlock_flags.9 \
+ mutex.9 mtx_unlock_spin.9 \
+ mutex.9 mtx_unlock_spin_flags.9
+MLINKS+=namei.9 NDFREE.9 \
+ namei.9 NDHASGIANT.9 \
+ namei.9 NDINIT.9
+MLINKS+=pbuf.9 getpbuf.9 \
+ pbuf.9 relpbuf.9 \
+ pbuf.9 trypbuf.9
+MLINKS+=pci.9 pci_alloc_msi.9 \
+ pci.9 pci_alloc_msix.9 \
+ pci.9 pci_disable_busmaster.9 \
+ pci.9 pci_disable_io.9 \
+ pci.9 pci_enable_busmaster.9 \
+ pci.9 pci_enable_io.9 \
+ pci.9 pci_find_bsf.9 \
+ pci.9 pci_find_cap.9 \
+ pci.9 pci_find_dbsf.9 \
+ pci.9 pci_find_device.9 \
+ pci.9 pci_find_extcap.9 \
+ pci.9 pci_find_htcap.9 \
+ pci.9 pci_get_max_read_req.9 \
+ pci.9 pci_get_powerstate.9 \
+ pci.9 pci_get_vpd_ident.9 \
+ pci.9 pci_get_vpd_readonly.9 \
+ pci.9 pci_msi_count.9 \
+ pci.9 pci_msix_count.9 \
+ pci.9 pci_pending_msix.9 \
+ pci.9 pci_read_config.9 \
+ pci.9 pci_release_msi.9 \
+ pci.9 pci_remap_msix.9 \
+ pci.9 pci_restore_state.9 \
+ pci.9 pci_save_state.9 \
+ pci.9 pci_set_powerstate.9 \
+ pci.9 pci_set_max_read_req.9 \
+ pci.9 pci_write_config.9
+MLINKS+=pfil.9 pfil_add_hook.9 \
+ pfil.9 pfil_hook_get.9 \
+ pfil.9 pfil_remove_hook.9
+MLINKS+=pfind.9 zpfind.9
+MLINKS+=pmap_clear_modify.9 pmap_clear_reference.9
+MLINKS+=pmap_copy.9 pmap_copy_page.9
+MLINKS+=pmap_extract.9 pmap_extract_and_hold.9
+MLINKS+=pmap_init.9 pmap_init2.9
+MLINKS+=pmap_is_modified.9 pmap_ts_modified.9
+MLINKS+=pmap_page_protect.9 pmap_protect.9
+MLINKS+=pmap_pinit.9 pmap_pinit0.9 \
+ pmap_pinit.9 pmap_pinit2.9
+MLINKS+=pmap_qenter.9 pmap_qremove.9
+MLINKS+=pmap_remove.9 pmap_remove_all.9 \
+ pmap_remove.9 pmap_remove_pages.9
+MLINKS+=pmap_resident_count.9 pmap_wired_count.9
+MLINKS+=pmap_zero_page.9 pmap_zero_area.9 \
+ pmap_zero_page.9 pmap_zero_idle.9
+MLINKS+=printf.9 log.9 \
+ printf.9 tprintf.9 \
+ printf.9 uprintf.9
+MLINKS+=priv.9 priv_check.9 \
+ priv.9 priv_check_cred.9
+MLINKS+=psignal.9 gsignal.9 \
+ psignal.9 pgsignal.9 \
+ psignal.9 tdsignal.9
+MLINKS+=random.9 arc4rand.9 \
+ random.9 arc4random.9 \
+ random.9 read_random.9 \
+ random.9 srandom.9
+MLINKS+=refcount.9 refcount_acquire.9 \
+ refcount.9 refcount_init.9 \
+ refcount.9 refcount_release.9
+MLINKS+=resource_int_value.9 resource_long_value.9 \
+ resource_int_value.9 resource_string_value.9
+MLINKS+=rman.9 rman_activate_resource.9 \
+ rman.9 rman_adjust_resource.9 \
+ rman.9 rman_await_resource.9 \
+ rman.9 rman_deactivate_resource.9 \
+ rman.9 rman_fini.9 \
+ rman.9 rman_first_free_region.9 \
+ rman.9 rman_get_bushandle.9 \
+ rman.9 rman_get_bustag.9 \
+ rman.9 rman_get_device.9 \
+ rman.9 rman_get_end.9 \
+ rman.9 rman_get_flags.9 \
+ rman.9 rman_get_rid.9 \
+ rman.9 rman_get_size.9 \
+ rman.9 rman_get_start.9 \
+ rman.9 rman_get_virtual.9 \
+ rman.9 rman_init.9 \
+ rman.9 rman_init_from_resource.9 \
+ rman.9 rman_is_region_manager.9 \
+ rman.9 rman_last_free_region.9 \
+ rman.9 rman_make_alignment_flags.9 \
+ rman.9 rman_manage_region.9 \
+ rman.9 rman_release_resource.9 \
+ rman.9 rman_reserve_resource.9 \
+ rman.9 rman_reserve_resource_bound.9 \
+ rman.9 rman_set_bushandle.9 \
+ rman.9 rman_set_bustag.9 \
+ rman.9 rman_set_rid.9 \
+ rman.9 rman_set_virtual.9
+MLINKS+=rmlock.9 rm_destroy.9 \
+ rmlock.9 rm_init.9 \
+ rmlock.9 rm_rlock.9 \
+ rmlock.9 rm_try_rlock.9 \
+ rmlock.9 rm_runlock.9 \
+ rmlock.9 RM_SYSINIT.9 \
+ rmlock.9 rm_wlock.9 \
+ rmlock.9 rm_wowned.9 \
+ rmlock.9 rm_wunlock.9
+MLINKS+=rtalloc.9 rtalloc1.9 \
+ rtalloc.9 rtalloc_ign.9 \
+ rtalloc.9 RTFREE_LOCKED.9 \
+ rtalloc.9 RTFREE.9 \
+ rtalloc.9 rtfree.9 \
+ rtalloc.9 rtalloc1_fib.9 \
+ rtalloc.9 rtalloc_ign_fib.9 \
+ rtalloc.9 rtalloc_fib.9
+MLINKS+=runqueue.9 choosethread.9 \
+ runqueue.9 procrunnable.9 \
+ runqueue.9 remrunqueue.9 \
+ runqueue.9 setrunqueue.9
+MLINKS+=rwlock.9 rw_assert.9 \
+ rwlock.9 rw_destroy.9 \
+ rwlock.9 rw_downgrade.9 \
+ rwlock.9 rw_init.9 \
+ rwlock.9 rw_initialized.9 \
+ rwlock.9 rw_rlock.9 \
+ rwlock.9 rw_runlock.9 \
+ rwlock.9 rw_sleep.9 \
+ rwlock.9 RW_SYSINIT.9 \
+ rwlock.9 rw_try_rlock.9 \
+ rwlock.9 rw_try_upgrade.9 \
+ rwlock.9 rw_try_wlock.9 \
+ rwlock.9 rw_wlock.9 \
+ rwlock.9 rw_wowned.9 \
+ rwlock.9 rw_wunlock.9
+MLINKS+=sbuf.9 sbuf_bcat.9 \
+ sbuf.9 sbuf_bcopyin.9 \
+ sbuf.9 sbuf_bcpy.9 \
+ sbuf.9 sbuf_cat.9 \
+ sbuf.9 sbuf_clear.9 \
+ sbuf.9 sbuf_copyin.9 \
+ sbuf.9 sbuf_cpy.9 \
+ sbuf.9 sbuf_data.9 \
+ sbuf.9 sbuf_delete.9 \
+ sbuf.9 sbuf_done.9 \
+ sbuf.9 sbuf_error.9 \
+ sbuf.9 sbuf_finish.9 \
+ sbuf.9 sbuf_len.9 \
+ sbuf.9 sbuf_new.9 \
+ sbuf.9 sbuf_new_for_sysctl.9 \
+ sbuf.9 sbuf_printf.9 \
+ sbuf.9 sbuf_putc.9 \
+ sbuf.9 sbuf_set_drain.9 \
+ sbuf.9 sbuf_setpos.9 \
+ sbuf.9 sbuf_trim.9 \
+ sbuf.9 sbuf_vprintf.9
+MLINKS+=scheduler.9 curpriority_cmp.9 \
+ scheduler.9 maybe_resched.9 \
+ scheduler.9 resetpriority.9 \
+ scheduler.9 roundrobin.9 \
+ scheduler.9 roundrobin_interval.9 \
+ scheduler.9 schedclock.9 \
+ scheduler.9 schedcpu.9 \
+ scheduler.9 sched_setup.9 \
+ scheduler.9 setrunnable.9 \
+ scheduler.9 updatepri.9
+MLINKS+=securelevel_gt.9 securelevel_ge.9
+MLINKS+=selrecord.9 seldrain.9 \
+ selrecord.9 selwakeup.9
+MLINKS+=sema.9 sema_destroy.9 \
+ sema.9 sema_init.9 \
+ sema.9 sema_post.9 \
+ sema.9 sema_timedwait.9 \
+ sema.9 sema_trywait.9 \
+ sema.9 sema_value.9 \
+ sema.9 sema_wait.9
+MLINKS+=sf_buf.9 sf_buf_alloc.9 \
+ sf_buf.9 sf_buf_free.9 \
+ sf_buf.9 sf_buf_kva.9 \
+ sf_buf.9 sf_buf_page.9
+MLINKS+=sglist.9 sglist_alloc.9 \
+ sglist.9 sglist_append.9 \
+ sglist.9 sglist_append_mbuf.9 \
+ sglist.9 sglist_append_phys.9 \
+ sglist.9 sglist_append_uio.9 \
+ sglist.9 sglist_append_user.9 \
+ sglist.9 sglist_build.9 \
+ sglist.9 sglist_clone.9 \
+ sglist.9 sglist_consume_uio.9 \
+ sglist.9 sglist_count.9 \
+ sglist.9 sglist_free.9 \
+ sglist.9 sglist_hold.9 \
+ sglist.9 sglist_init.9 \
+ sglist.9 sglist_join.9 \
+ sglist.9 sglist_length.9 \
+ sglist.9 sglist_reset.9 \
+ sglist.9 sglist_slice.9 \
+ sglist.9 sglist_split.9
+MLINKS+=shm_map.9 shm_unmap.9
+MLINKS+=signal.9 cursig.9 \
+ signal.9 execsigs.9 \
+ signal.9 issignal.9 \
+ signal.9 killproc.9 \
+ signal.9 pgsigio.9 \
+ signal.9 postsig.9 \
+ signal.9 SETSETNEQ.9 \
+ signal.9 SETSETOR.9 \
+ signal.9 SIGADDSET.9 \
+ signal.9 SIG_CONTSIGMASK.9 \
+ signal.9 SIGDELSET.9 \
+ signal.9 SIGEMPTYSET.9 \
+ signal.9 sigexit.9 \
+ signal.9 SIGFILLSET.9 \
+ signal.9 siginit.9 \
+ signal.9 SIGISEMPTY.9 \
+ signal.9 SIGISMEMBER.9 \
+ signal.9 SIGNOTEMPTY.9 \
+ signal.9 signotify.9 \
+ signal.9 SIGPENDING.9 \
+ signal.9 SIGSETAND.9 \
+ signal.9 SIGSETCANTMASK.9 \
+ signal.9 SIGSETEQ.9 \
+ signal.9 SIGSETNAND.9 \
+ signal.9 SIG_STOPSIGMASK.9 \
+ signal.9 trapsignal.9
+MLINKS+=sleep.9 msleep.9 \
+ sleep.9 msleep_spin.9 \
+ sleep.9 pause.9 \
+ sleep.9 tsleep.9 \
+ sleep.9 wakeup.9 \
+ sleep.9 wakeup_one.9
+MLINKS+=sleepqueue.9 init_sleepqueues.9 \
+ sleepqueue.9 sleepq_abort.9 \
+ sleepqueue.9 sleepq_add.9 \
+ sleepqueue.9 sleepq_alloc.9 \
+ sleepqueue.9 sleepq_broadcast.9 \
+ sleepqueue.9 sleepq_calc_signal_retval.9 \
+ sleepqueue.9 sleepq_catch_signals.9 \
+ sleepqueue.9 sleepq_free.9 \
+ sleepqueue.9 sleepq_lookup.9 \
+ sleepqueue.9 sleepq_release.9 \
+ sleepqueue.9 sleepq_remove.9 \
+ sleepqueue.9 sleepq_set_timeout.9 \
+ sleepqueue.9 sleepq_signal.9 \
+ sleepqueue.9 sleepq_timedwait.9 \
+ sleepqueue.9 sleepq_timedwait_sig.9 \
+ sleepqueue.9 sleepq_wait.9 \
+ sleepqueue.9 sleepq_wait_sig.9
+MLINKS+=socket.9 sobind.9 \
+ socket.9 soclose.9 \
+ socket.9 soconnect.9 \
+ socket.9 socreate.9 \
+ socket.9 sogetopt.9 \
+ socket.9 soreceive.9 \
+ socket.9 sosend.9 \
+ socket.9 sosetopt.9 \
+ socket.9 soshutdown.9
+MLINKS+=spl.9 spl0.9 \
+ spl.9 splbio.9 \
+ spl.9 splclock.9 \
+ spl.9 splhigh.9 \
+ spl.9 splimp.9 \
+ spl.9 splnet.9 \
+ spl.9 splsoftclock.9 \
+ spl.9 splsofttty.9 \
+ spl.9 splstatclock.9 \
+ spl.9 spltty.9 \
+ spl.9 splvm.9 \
+ spl.9 splx.9
+MLINKS+=stack.9 stack_copy.9 \
+ stack.9 stack_create.9 \
+ stack.9 stack_destroy.9 \
+ stack.9 stack_print.9 \
+ stack.9 stack_print_ddb.9 \
+ stack.9 stack_put.9 \
+ stack.9 stack_save.9 \
+ stack.9 stack_sbuf_print.9 \
+ stack.9 stack_sbuf_print_ddb.9 \
+ stack.9 stack_zero.9
+MLINKS+=store.9 subyte.9 \
+ store.9 suswintr.9 \
+ store.9 suword.9 \
+ store.9 suword16.9 \
+ store.9 suword32.9 \
+ store.9 suword64.9
+MLINKS+=swi.9 swi_add.9 \
+ swi.9 swi_sched.9
+MLINKS+=sx.9 sx_assert.9 \
+ sx.9 sx_destroy.9 \
+ sx.9 sx_downgrade.9 \
+ sx.9 sx_init.9 \
+ sx.9 sx_init_flags.9 \
+ sx.9 sx_sleep.9 \
+ sx.9 sx_slock.9 \
+ sx.9 sx_sunlock.9 \
+ sx.9 SX_SYSINIT.9 \
+ sx.9 sx_try_slock.9 \
+ sx.9 sx_try_upgrade.9 \
+ sx.9 sx_try_xlock.9 \
+ sx.9 sx_unlock.9 \
+ sx.9 sx_xholder.9 \
+ sx.9 sx_xlock.9 \
+ sx.9 sx_xlocked.9 \
+ sx.9 sx_xunlock.9
+MLINKS+=sysctl.9 SYSCTL_DECL.9 \
+ sysctl.9 SYSCTL_INT.9 \
+ sysctl.9 SYSCTL_LONG.9 \
+ sysctl.9 SYSCTL_NODE.9 \
+ sysctl.9 SYSCTL_OPAQUE.9 \
+ sysctl.9 SYSCTL_PROC.9 \
+ sysctl.9 SYSCTL_STRING.9 \
+ sysctl.9 SYSCTL_STRUCT.9 \
+ sysctl.9 SYSCTL_UINT.9 \
+ sysctl.9 SYSCTL_ULONG.9 \
+ sysctl.9 SYSCTL_QUAD.9
+MLINKS+=sysctl_add_oid.9 SYSCTL_ADD_INT.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_LONG.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_NODE.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_OID.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_OPAQUE.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_PROC.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_STRING.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_STRUCT.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_UINT.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_ULONG.9 \
+ sysctl_add_oid.9 SYSCTL_ADD_QUAD.9 \
+ sysctl_add_oid.9 SYSCTL_CHILDREN.9 \
+ sysctl_add_oid.9 sysctl_move_oid.9 \
+ sysctl_add_oid.9 sysctl_remove_oid.9 \
+ sysctl_add_oid.9 SYSCTL_STATIC_CHILDREN.9
+MLINKS+=sysctl_ctx_init.9 sysctl_ctx_entry_add.9 \
+ sysctl_ctx_init.9 sysctl_ctx_entry_del.9 \
+ sysctl_ctx_init.9 sysctl_ctx_entry_find.9 \
+ sysctl_ctx_init.9 sysctl_ctx_free.9
+MLINKS+=SYSINIT.9 SYSUNINIT.9
+MLINKS+=taskqueue.9 TASK_INIT.9 \
+ taskqueue.9 TASK_INITIALIZER.9 \
+ taskqueue.9 taskqueue_cancel.9 \
+ taskqueue.9 taskqueue_create.9 \
+ taskqueue.9 taskqueue_create_fast.9 \
+ taskqueue.9 TASKQUEUE_DECLARE.9 \
+ taskqueue.9 TASKQUEUE_DEFINE.9 \
+ taskqueue.9 TASKQUEUE_DEFINE_THREAD.9 \
+ taskqueue.9 taskqueue_drain.9 \
+ taskqueue.9 taskqueue_enqueue.9 \
+ taskqueue.9 taskqueue_enqueue_fast.9 \
+ taskqueue.9 TASKQUEUE_FAST_DEFINE.9 \
+ taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \
+ taskqueue.9 taskqueue_free.9 \
+ taskqueue.9 taskqueue_member.9 \
+ taskqueue.9 taskqueue_run.9
+MLINKS+=time.9 boottime.9 \
+ time.9 time_second.9 \
+ time.9 time_uptime.9
+MLINKS+=timeout.9 callout.9 \
+ timeout.9 callout_active.9 \
+ timeout.9 callout_deactivate.9 \
+ timeout.9 callout_drain.9 \
+ timeout.9 callout_handle_init.9 \
+ timeout.9 callout_init.9 \
+ timeout.9 callout_init_mtx.9 \
+ timeout.9 callout_init_rw.9 \
+ timeout.9 callout_pending.9 \
+ timeout.9 callout_reset.9 \
+ timeout.9 callout_schedule.9 \
+ timeout.9 callout_stop.9 \
+ timeout.9 untimeout.9
+MLINKS+=ucred.9 crcopy.9 \
+ ucred.9 crdup.9 \
+ ucred.9 crfree.9 \
+ ucred.9 crget.9 \
+ ucred.9 crhold.9 \
+ ucred.9 crshared.9 \
+ ucred.9 cru2x.9
+MLINKS+=uidinfo.9 uifind.9 \
+ uidinfo.9 uifree.9 \
+ uidinfo.9 uihashinit.9 \
+ uidinfo.9 uihold.9
+MLINKS+=uio.9 uiomove.9 \
+ uio.9 uiomove_nofault.9
+MLINKS+=usbdi.9 usbd_do_request.9 \
+ usbdi.9 usbd_do_request_flags.9 \
+ usbdi.9 usbd_errstr.9 \
+ usbdi.9 usbd_lookup_id_by_info.9 \
+ usbdi.9 usbd_lookup_id_by_uaa.9 \
+ usbdi.9 usbd_transfer_clear_stall.9 \
+ usbdi.9 usbd_transfer_drain.9 \
+ usbdi.9 usbd_transfer_pending.9 \
+ usbdi.9 usbd_transfer_poll.9 \
+ usbdi.9 usbd_transfer_setup.9 \
+ usbdi.9 usbd_transfer_start.9 \
+ usbdi.9 usbd_transfer_stop.9 \
+ usbdi.9 usbd_transfer_submit.9 \
+ usbdi.9 usbd_transfer_unsetup.9 \
+ usbdi.9 usbd_xfer_clr_flag.9 \
+ usbdi.9 usbd_xfer_frame_data.9 \
+ usbdi.9 usbd_xfer_frame_len.9 \
+ usbdi.9 usbd_xfer_get_frame.9 \
+ usbdi.9 usbd_xfer_get_priv.9 \
+ usbdi.9 usbd_xfer_is_stalled.9 \
+ usbdi.9 usbd_xfer_max_framelen.9 \
+ usbdi.9 usbd_xfer_max_frames.9 \
+ usbdi.9 usbd_xfer_max_len.9 \
+ usbdi.9 usbd_xfer_set_flag.9 \
+ usbdi.9 usbd_xfer_set_frame_data.9 \
+ usbdi.9 usbd_xfer_set_frame_len.9 \
+ usbdi.9 usbd_xfer_set_frame_offset.9 \
+ usbdi.9 usbd_xfer_set_frames.9 \
+ usbdi.9 usbd_xfer_set_interval.9 \
+ usbdi.9 usbd_xfer_set_priv.9 \
+ usbdi.9 usbd_xfer_set_stall.9 \
+ usbdi.9 usbd_xfer_set_timeout.9 \
+ usbdi.9 usbd_xfer_softc.9 \
+ usbdi.9 usbd_xfer_state.9 \
+ usbdi.9 usbd_xfer_status.9 \
+ usbdi.9 usb_fifo_alloc_buffer.9 \
+ usbdi.9 usb_fifo_attach.9 \
+ usbdi.9 usb_fifo_detach.9 \
+ usbdi.9 usb_fifo_free_buffer.9 \
+ usbdi.9 usb_fifo_get_data.9 \
+ usbdi.9 usb_fifo_get_data_buffer.9 \
+ usbdi.9 usb_fifo_get_data_error.9 \
+ usbdi.9 usb_fifo_get_data_linear.9 \
+ usbdi.9 usb_fifo_put_bytes_max.9 \
+ usbdi.9 usb_fifo_put_data.9 \
+ usbdi.9 usb_fifo_put_data_buffer.9 \
+ usbdi.9 usb_fifo_put_data_error.9 \
+ usbdi.9 usb_fifo_put_data_linear.9 \
+ usbdi.9 usb_fifo_reset.9 \
+ usbdi.9 usb_fifo_softc.9 \
+ usbdi.9 usb_fifo_wakeup.9
+MLINKS+=vcount.9 count_dev.9
+MLINKS+=vfsconf.9 vfs_modevent.9 \
+ vfsconf.9 vfs_register.9 \
+ vfsconf.9 vfs_unregister.9
+MLINKS+=vfs_getopt.9 vfs_copyopt.9 \
+ vfs_getopt.9 vfs_filteropt.9 \
+ vfs_getopt.9 vfs_flagopt.9 \
+ vfs_getopt.9 vfs_getopts.9 \
+ vfs_getopt.9 vfs_scanopt.9 \
+ vfs_getopt.9 vfs_setopt.9 \
+ vfs_getopt.9 vfs_setopt_part.9 \
+ vfs_getopt.9 vfs_setopts.9
+MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9
+MLINKS+=vhold.9 vdrop.9 \
+ vhold.9 vdropl.9 \
+ vhold.9 vholdl.9
+MLINKS+=vm_map_lock.9 vm_map_lock_downgrade.9 \
+ vm_map_lock.9 vm_map_lock_read.9 \
+ vm_map_lock.9 vm_map_lock_upgrade.9 \
+ vm_map_lock.9 vm_map_trylock.9 \
+ vm_map_lock.9 vm_map_trylock_read.9 \
+ vm_map_lock.9 vm_map_unlock.9 \
+ vm_map_lock.9 vm_map_unlock_read.9
+MLINKS+=vm_map_lookup.9 vm_map_lookup_done.9
+MLINKS+=vm_map_max.9 vm_map_min.9 \
+ vm_map_max.9 vm_map_pmap.9
+MLINKS+=vm_map_stack.9 vm_map_growstack.9
+MLINKS+=vm_map_wire.9 vm_map_unwire.9
+MLINKS+=vm_page_bits.9 vm_page_clear_dirty.9 \
+ vm_page_bits.9 vm_page_dirty.9 \
+ vm_page_bits.9 vm_page_is_valid.9 \
+ vm_page_bits.9 vm_page_set_invalid.9 \
+ vm_page_bits.9 vm_page_set_validclean.9 \
+ vm_page_bits.9 vm_page_test_dirty.9 \
+ vm_page_bits.9 vm_page_undirty.9 \
+ vm_page_bits.9 vm_page_zero_invalid.9
+MLINKS+=vm_page_aflag.9 vm_page_aflag_clear.9 \
+ vm_page_aflag.9 vm_page_aflag_set.9 \
+ vm_page_aflag.9 vm_page_reference.9
+MLINKS+=vm_page_free.9 vm_page_free_toq.9 \
+ vm_page_free.9 vm_page_free_zero.9 \
+ vm_page_free.9 vm_page_try_to_free.9
+MLINKS+=vm_page_hold.9 vm_page_unhold.9
+MLINKS+=vm_page_insert.9 vm_page_remove.9
+MLINKS+=vm_page_io.9 vm_page_io_finish.9 \
+ vm_page_io.9 vm_page_io_start.9
+MLINKS+=vm_page_wakeup.9 vm_page_busy.9 \
+ vm_page_wakeup.9 vm_page_flash.9
+MLINKS+=vm_page_wire.9 vm_page_unwire.9
+MLINKS+=VOP_ACCESS.9 VOP_ACCESSX.9
+MLINKS+=VOP_ATTRIB.9 VOP_GETATTR.9 \
+ VOP_ATTRIB.9 VOP_SETATTR.9
+MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \
+ VOP_CREATE.9 VOP_MKNOD.9 \
+ VOP_CREATE.9 VOP_SYMLINK.9
+MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9
+MLINKS+=VOP_GETVOBJECT.9 VOP_CREATEVOBJECT.9 \
+ VOP_GETVOBJECT.9 VOP_DESTROYVOBJECT.9
+MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9
+MLINKS+=VOP_LOCK.9 vn_lock.9 \
+ VOP_LOCK.9 VOP_ISLOCKED.9 \
+ VOP_LOCK.9 VOP_UNLOCK.9
+MLINKS+=VOP_OPENCLOSE.9 VOP_CLOSE.9 \
+ VOP_OPENCLOSE.9 VOP_OPEN.9
+MLINKS+=VOP_RDWR.9 VOP_READ.9 \
+ VOP_RDWR.9 VOP_WRITE.9
+MLINKS+=VOP_REMOVE.9 VOP_RMDIR.9
+MLINKS+=vref.9 VREF.9
+MLINKS+=vrele.9 vput.9 \
+ vrele.9 vunref.9
+MLINKS+=vslock.9 vsunlock.9
+MLINKS+=zero_copy.9 zero_copy_sockets.9
+MLINKS+=zone.9 uma.9 \
+ zone.9 uma_zalloc.9 \
+ zone.9 uma_zcreate.9 \
+ zone.9 uma_zdestroy.9 \
+ zone.9 uma_zfree.9 \
+ zone.9 uma_zone_set_max.9
+
+.include <bsd.prog.mk>
diff --git a/share/man/man9/SYSCALL_MODULE.9 b/share/man/man9/SYSCALL_MODULE.9
new file mode 100644
index 000000000000..973adebf2cfb
--- /dev/null
+++ b/share/man/man9/SYSCALL_MODULE.9
@@ -0,0 +1,84 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 7, 2005
+.Dt SYSCALL_MODULE 9
+.Os
+.Sh NAME
+.Nm SYSCALL_MODULE
+.Nd syscall kernel module declaration macro
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/proc.h
+.In sys/module.h
+.In sys/sysent.h
+.Fn SYSCALL_MODULE name "int *offset" "struct sysent *new_sysent" "modeventhand_t evh" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn SYSCALL_MODULE
+macro declares a new syscall.
+.Fn SYSCALL_MODULE
+expands into a kernel module declaration named as
+.Fa name .
+.Pp
+The rest of the arguments expected by this macro are:
+.Bl -tag -width ".Fa new_sysent"
+.It Fa offset
+A pointer to an
+.Vt int
+which saves the offset in
+.Vt "struct sysent"
+where the syscall is allocated.
+.It Fa new_sysent
+is a pointer to a structure that specifies the function implementing
+the syscall and the number of arguments this function needs (see
+.In sys/sysent.h ) .
+.It Fa evh
+A pointer to the kernel module event handler function with the argument
+.Fa arg .
+Please refer to
+.Xr module 9
+for more information.
+.It Fa arg
+The argument passed to the callback functions of the
+.Fa evh
+event handler when it is called.
+.El
+.Sh EXAMPLES
+A minimal example for a syscall module can be found in
+.Pa /usr/share/examples/kld/syscall/module/syscall.c .
+.Sh SEE ALSO
+.Xr module 9
+.Pp
+.Pa /usr/share/examples/kld/syscall/module/syscall.c
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/SYSINIT.9 b/share/man/man9/SYSINIT.9
new file mode 100644
index 000000000000..1837d25d4849
--- /dev/null
+++ b/share/man/man9/SYSINIT.9
@@ -0,0 +1,163 @@
+.\" Copyright (c) 2003 Hiten M. Pandya
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2010
+.Dt SYSINIT 9
+.Os
+.Sh NAME
+.Nm SYSINIT ,
+.Nm SYSUNINIT
+.Nd a framework for dynamic kernel initialization
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.Fn SYSINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "sysinit_cfunc_t func" "const void *ident"
+.Fn SYSUNINIT "uniquifier" "enum sysinit_sub_id subsystem" "enum sysinit_elem_order order" "sysinit_cfunc_t func" "const void *ident"
+.Sh DESCRIPTION
+.Nm
+is a mechanism for scheduling the execution of initialization and teardown
+routines.
+This is similar to init and fini routines with the addition of explicit
+ordering metadata.
+It allows runtime ordering of subsystem initialization in the kernel as well
+as kernel modules (KLDs).
+.Pp
+The
+.Fn SYSINIT
+macro creates a
+.Vt struct sysinit
+and stores it in a startup linker set.
+The
+.Vt struct sysinit
+type as well as the subsystem identifier constants
+.Pq Dv SI_SUB_*
+and initialization ordering constants
+.Pq Dv SI_ORDER_*
+are defined in
+.In sys/kernel.h :
+.Bd -literal
+struct sysinit {
+ enum sysinit_sub_id subsystem; /* subsystem identifier*/
+ enum sysinit_elem_order order; /* init order within subsystem*/
+ sysinit_cfunc_t func; /* function */
+ const void *udata; /* multiplexer/argument */
+};
+.Ed
+.Pp
+The
+.Fn SYSINIT
+macro takes a
+.Fa uniquifier
+argument to identify the particular function dispatch data,
+the
+.Fa subsystem
+type of startup interface, the subsystem element
+.Fa order
+of initialization within the subsystem, the
+.Fa func
+function to call,
+and the data specified in
+.Fa ident
+argument to pass the function.
+.Pp
+The
+.Fn SYSUNINIT
+macro behaves similarly to the
+.Fn SYSINIT
+macro except that it adds the data to a shutdown linker set.
+.Pp
+The startup linker set for the kernel is scanned during boot to build a
+sorted list of initialization routines.
+The initialization routines are then executed in the sorted order.
+The
+.Fa subsystem
+is used as the primary key and is sorted in ascending order.
+The
+.Fa order
+is used as the secondary key and is sorted in ascending order.
+The relative order of two routines that have the same
+.Fa subsystem
+and
+.Fa order
+is undefined.
+.Pp
+The startup linker sets for modules that are loaded together with the kernel
+by the boot loader are scanned during the
+.Dv SI_SUB_KLD
+subsystem initialization.
+These modules' initialization routines are sorted and merged into the kernel's
+list of startup routines and are executed during boot along with the kernel's
+initialization routines.
+Note that this has the effect that any initialization routines in a kernel
+module that are scheduled earlier than
+.Dv SI_SUB_KLD
+are not executed until after
+.Dv SI_SUB_KLD
+during boot.
+.Pp
+The startup linker set for a kernel module loaded at runtime via
+.Xr kldload 2
+is scanned, sorted, and executed when the module is loaded.
+.Pp
+The shutdown linker set for a kernel module is scanned, sorted, and executed
+when a kernel module is unloaded.
+The teardown routines are sorted in the reverse order of the initialization
+routines.
+The teardown routines of the kernel and any loaded modules are
+.Sy not
+executed during shutdown.
+.Sh EXAMPLES
+This example shows the SYSINIT which displays the copyright notice during boot:
+.Bd -literal -offset indent
+static void
+print_caddr_t(void *data)
+{
+ printf("%s", (char *)data);
+}
+SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t,
+ copyright);
+.Ed
+.Sh SEE ALSO
+.Xr kld 4 ,
+.Xr DECLARE_MODULE 9 ,
+.Xr DEV_MODULE 9 ,
+.Xr DRIVER_MODULE 9 ,
+.Xr MTX_SYSINIT 9 ,
+.Xr SYSCALL_MODULE 9
+.Sh HISTORY
+The
+.Nm
+framework first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+framework was written by
+.An Terrence Lambert Aq terry@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Hiten Pandya Aq hmp@FreeBSD.org .
diff --git a/share/man/man9/VFS.9 b/share/man/man9/VFS.9
new file mode 100644
index 000000000000..ca3109b5b48e
--- /dev/null
+++ b/share/man/man9/VFS.9
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 9, 2010
+.Dt VFS 9
+.Os
+.Sh NAME
+.Nm VFS
+.Nd kernel interface to file systems
+.Sh DESCRIPTION
+Calls used to set or query file systems for settings or information.
+.Pp
+File systems that do not implement a VFS operation should use the appropriate
+.Fa vfs_std
+function from
+.Pa src/sys/kern/vfs_default.c
+rather than implementing empty functions or casting to
+.Fa eopnotsupp .
+.Sh SEE ALSO
+.Xr VFS_CHECKEXP 9 ,
+.Xr VFS_FHTOVP 9 ,
+.Xr VFS_INIT 9 ,
+.Xr VFS_MOUNT 9 ,
+.Xr VFS_QUOTACTL 9 ,
+.Xr VFS_STATFS 9 ,
+.Xr VFS_SYNC 9 ,
+.Xr VFS_UNMOUNT 9 ,
+.Xr VFS_VGET 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_CHECKEXP.9 b/share/man/man9/VFS_CHECKEXP.9
new file mode 100644
index 000000000000..62d545c753ee
--- /dev/null
+++ b/share/man/man9/VFS_CHECKEXP.9
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright (c) 1999 Alfred Perlstein
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following condition
+.\" is met:
+.\" Redistributions of source code must retain the above copyright
+.\" notice, this condition and the following disclaimer.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 4, 2010
+.Dt VFS_CHECKEXP 9
+.Os
+.Sh NAME
+.Nm VFS_CHECKEXP
+.Nd check if a file system is exported to a client
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fn VFS_CHECKEXP "struct mount *mp" "struct sockaddr *nam" "int *exflagsp" "struct ucred **credanonp"
+.Sh DESCRIPTION
+The
+.Fn VFS_CHECKEXP
+macro is used by the NFS server to check if a mount point is exported
+to a client.
+.Pp
+The arguments it expects are:
+.Bl -tag -width credanonp
+.It Fa mp
+The mount point to be checked.
+.It Fa nam
+An mbuf containing the network address of the client.
+.It Fa exflagsp
+Return parameter for the export flags for this client.
+.It Fa credanonp
+Return parameter for the anonymous credentials for this client.
+.El
+.Pp
+The
+.Fn VFS_CHECKEXP
+macro should be called on a file system's mount structure to determine if it
+is exported to a client whose address is contained in
+.Fa nam .
+.Pp
+It is generally called before
+.Xr VFS_FHTOVP 9
+to validate that a client has access to the file system.
+.Pp
+The file system should call
+.Xr vfs_export_lookup 9
+with the address of an appropriate
+.Vt netexport
+structure and the address of the client,
+.Fa nam ,
+to verify that the client can access this file system.
+.Sh RETURN VALUES
+The export flags and anonymous credentials specific to the client (returned
+by
+.Xr vfs_export_lookup 9 )
+will be returned in
+.Fa *exflagsp
+and
+.Fa *credanonp .
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_FHTOVP 9 ,
+.Xr VOP_VPTOFH 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Alfred Perlstein .
diff --git a/share/man/man9/VFS_FHTOVP.9 b/share/man/man9/VFS_FHTOVP.9
new file mode 100644
index 000000000000..39a6168f51b5
--- /dev/null
+++ b/share/man/man9/VFS_FHTOVP.9
@@ -0,0 +1,83 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 4, 2010
+.Dt VFS_FHTOVP 9
+.Os
+.Sh NAME
+.Nm VFS_FHTOVP
+.Nd turn an NFS filehandle into a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_FHTOVP "struct mount *mp" "struct fid *fhp" "struct vnode **vpp"
+.Sh DESCRIPTION
+The
+.Fn VFS_FHTOVP
+macro is used by the NFS server to turn an NFS filehandle into a vnode.
+.Pp
+The arguments it expects are:
+.Bl -tag -width vpp
+.It Fa mp
+The file system.
+.It Fa fhp
+The filehandle to convert.
+.It Fa vpp
+Return parameter for the new locked vnode.
+.El
+.Pp
+The contents of the filehandle are defined by the file system and are
+not examined by any other part of the system.
+It should contain
+enough information to uniquely identify a file within the file system
+as well as noticing when a file has been removed and the file system
+resources have been reused for a new file.
+For instance, UFS
+file system stores the inode number and inode generation counter in its
+filehandle.
+.Pp
+A call to
+.Fn VFS_FHTOVP
+should generally be preceded by a call to
+.Xr VFS_CHECKEXP 9
+to check if the file is accessible to the client.
+.Sh RETURN VALUES
+The locked vnode for the file will be returned in
+.Fa *vpp .
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_CHECKEXP 9 ,
+.Xr VOP_VPTOFH 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_LOCK_GIANT.9 b/share/man/man9/VFS_LOCK_GIANT.9
new file mode 100644
index 000000000000..9249e6c76157
--- /dev/null
+++ b/share/man/man9/VFS_LOCK_GIANT.9
@@ -0,0 +1,93 @@
+.\"
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 21, 2005
+.Dt VFS_LOCK_GIANT 9
+.Os
+.Sh NAME
+.Nm VFS_LOCK_GIANT ,
+.Nm VFS_UNLOCK_GIANT
+.Nd "conditionally lock and unlock Giant around entry into VFS"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_LOCK_GIANT "struct mount *mp"
+.Ft void
+.Fn VFS_UNLOCK_GIANT "int vfslocked"
+.Sh DESCRIPTION
+.Fn VFS_LOCK_GIANT
+will conditionally acquire the
+.Va Giant
+lock if the file system referenced by
+.Fa mp
+is marked as MPSAFE or not, returning a flag indicating whether
+.Va Giant
+was
+set, which may later be passed to
+.Fn VFS_UNLOCK_GIANT .
+The value of
+.Fa mp
+will typically be derived from the mount pointer in a
+.Vt vnode
+on which a VFS operation will be performed.
+.Pp
+.Fn VFS_UNLOCK_GIANT
+conditionally releases the
+.Va Giant
+lock if the passed
+.Fa vfslocked
+argument is non-zero.
+It is expected that the argument will be derived from the return values of
+.Fn VFS_LOCK_GIANT
+or
+.Xr NDHASGIANT 9 .
+.Sh RETURN VALUES
+.Fn VFS_LOCK_GIANT
+returns a boolean indicating whether or not
+.Va Giant
+was acquired.
+.Sh SEE ALSO
+.Xr mutex 9 ,
+.Xr NDHASGIANT 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+.An -nosplit
+MPSAFE VFS support for
+.Fx
+was implemented by
+.An Jeff Roberson .
+.Pp
+This manual page was written by
+.An Robert Watson .
+.Sh BUGS
+Non-MPSAFE file systems exist, requiring callers conditional locking and
+unlocking of
+.Va Giant .
diff --git a/share/man/man9/VFS_MOUNT.9 b/share/man/man9/VFS_MOUNT.9
new file mode 100644
index 000000000000..e46c71a5825a
--- /dev/null
+++ b/share/man/man9/VFS_MOUNT.9
@@ -0,0 +1,84 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_MOUNT 9
+.Os
+.Sh NAME
+.Nm VFS_MOUNT
+.Nd mount a file system
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_MOUNT "struct mount *mp"
+.Sh DESCRIPTION
+The
+.Fn VFS_MOUNT
+macro mounts a file system into the system's namespace or updates the
+attributes of an already mounted file system.
+.Pp
+The arguments it expects are:
+.Bl -tag -width data
+.It Fa mp
+Structure representing the file system.
+.El
+.Pp
+The
+.Fn VFS_MOUNT
+macro is called both to mount new file systems and to change the
+attributes of an existing file system.
+If the
+.Dv MNT_UPDATE
+flag is set in
+.Fa mp->mnt_flag
+then the file system should update its internal state from the value of
+.Fa mp->mnt_flag .
+This can be used, for instance, to convert a read-only file system to
+read-write.
+It is also used by
+.Xr mountd 8
+to update the NFS export information for the file system.
+.Pp
+If the
+.Dv MNT_UPDATE
+flag is not specified, then this is a newly mounted file system.
+The file system code should allocate and initialize
+any private data needed to represent
+the file system (it can use the
+.Fa mp->mnt_data
+field to store this information).
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_QUOTACTL.9 b/share/man/man9/VFS_QUOTACTL.9
new file mode 100644
index 000000000000..fded4d6b883c
--- /dev/null
+++ b/share/man/man9/VFS_QUOTACTL.9
@@ -0,0 +1,53 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_QUOTACTL 9
+.Os
+.Sh NAME
+.Nm VFS_QUOTACTL
+.Nd manipulate file system quotas
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "caddr_t arg"
+.Sh DESCRIPTION
+Implement file system quotas.
+See
+.Xr quotactl 2
+for a description of the arguments.
+.Sh SEE ALSO
+.Xr quotactl 2 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_ROOT.9 b/share/man/man9/VFS_ROOT.9
new file mode 100644
index 000000000000..f81a500b3ab2
--- /dev/null
+++ b/share/man/man9/VFS_ROOT.9
@@ -0,0 +1,67 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_ROOT 9
+.Os
+.Sh NAME
+.Nm VFS_ROOT
+.Nd return the root vnode of a file system
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_ROOT "struct mount *mp" "int flags" "struct vnode **vpp"
+.Sh DESCRIPTION
+Return a locked vnode for the root directory of the file system.
+.Pp
+Its arguments are:
+.Bl -tag -width flags
+.It Fa mp
+The file system.
+.It Fa flags
+The lock type.
+Could be
+.Dv LK_EXCLUSIVE
+or
+.Dv LK_SHARED .
+File system is free to ignore the
+.Fa flags
+argument and instead acquire an exclusive lock.
+.It Fa vpp
+Return parameter for the root vnode.
+.El
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_SET.9 b/share/man/man9/VFS_SET.9
new file mode 100644
index 000000000000..f30f4312459e
--- /dev/null
+++ b/share/man/man9/VFS_SET.9
@@ -0,0 +1,116 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 5, 2007
+.Dt VFS_SET 9
+.Os
+.Sh NAME
+.Nm VFS_SET
+.Nd set up loadable file system
+.Vt vfsconf
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/module.h
+.In sys/mount.h
+.Ft void
+.Fn VFS_SET "struct vfsops *vfsops" "fsname" "int flags"
+.Sh DESCRIPTION
+.Fn VFS_SET
+creates a
+.Vt vfsconf
+structure for the loadable module with the given
+.Fa vfsops , fsname
+and
+.Fa flags ,
+and declares it by calling
+.Xr DECLARE_MODULE 9
+using
+.Fn vfs_modevent
+as the event handler.
+.Pp
+Possible values for the
+.Fa flags
+argument are:
+.Bl -hang -width ".Dv VFCF_DELEGADMIN"
+.It Dv VFCF_STATIC
+File system should be statically available in the kernel.
+.It Dv VFCF_NETWORK
+Network exportable file system.
+.It Dv VFCF_READONLY
+Does not support write operations.
+.It Dv VFCF_SYNTHETIC
+Pseudo file system, data does not represent on-disk files.
+.It Dv VFCF_LOOPBACK
+Loopback file system layer.
+.It Dv VFCF_UNICODE
+File names are stored as Unicode.
+.It Dv VFCF_JAIL
+Can be mounted from within a jail if
+.Va security.jail.mount_allowed
+sysctl is set to
+.Dv 1 .
+.It Dv VFCF_DELEGADMIN
+Supports delegated administration if
+.Va vfs.usermount
+sysctl is set to
+.Dv 1 .
+.El
+.Sh PSEUDOCODE
+.Bd -literal
+/*
+ * fill in the ones we use, and use the vfs_std for the rest.
+ */
+static struct vfsops myfs_vfsops = {
+ myfs_mount,
+ vfs_stdstart,
+ myfs_unmount,
+ myfs_root,
+ vfs_stdquotactl,
+ myfs_statfs,
+ vfs_stdsync,
+ vfs_stdvget,
+ vfs_stdfhtovp,
+ vfs_stdcheckexp,
+ vfs_stdvptofh,
+ vfs_stdinit,
+ vfs_stduninit,
+ vfs_stdextattrctl,
+};
+
+VFS_SET(myfs_vfsops, skelfs, 0);
+.Ed
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr jail 8 ,
+.Xr DECLARE_MODULE 9 ,
+.Xr vfsconf 9 ,
+.Xr vfs_modevent 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/VFS_STATFS.9 b/share/man/man9/VFS_STATFS.9
new file mode 100644
index 000000000000..7a7e37141120
--- /dev/null
+++ b/share/man/man9/VFS_STATFS.9
@@ -0,0 +1,116 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_STATFS 9
+.Os
+.Sh NAME
+.Nm VFS_STATFS
+.Nd return file system status
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_STATFS "struct mount *mp" "struct statfs *sbp"
+.Sh DESCRIPTION
+The
+.Fn VFS_STATFS
+macro returns various pieces of information about the file system,
+including recommended I/O sizes, free space, free inodes, etc.
+.Pp
+The arguments it expects are:
+.Bl -tag -width sbp
+.It Fa mp
+The file system.
+.It Fa sbp
+A
+.Vt statfs
+structure, as defined by
+.In sys/mount.h ,
+into which information is placed about the file system.
+.El
+.Pp
+The fields of
+.Vt "struct statfs"
+related to the file system are as follows:
+.Bl -tag -width ".Va f_mntfromname"
+.It Va f_type
+Type of file system.
+.It Va f_flags
+A copy of mount exported flags.
+.It Va f_bsize
+Fragment size.
+.It Va f_iosize
+Optimal transfer block size.
+.It Va f_blocks
+The total number of data blocks in the file system.
+.It Va f_bfree
+The number of free blocks in the file system.
+.It Va f_bavail
+The number of free blocks available to non-superuser processes.
+.It Va f_files
+The total number of file nodes in the file system.
+.It Va f_ffree
+The number of free nodes available to non-superuser processes.
+.It Va f_syncwrites
+The number of synchronous writes since the file system was mounted.
+.It Va f_asyncwrites
+The number of asynchronous writes since the file system was mounted.
+.It Va f_syncreads
+The number of synchronous reads since the file system was mounted.
+.It Va f_asyncreads
+The number of asynchronous reads since the file system was mounted.
+.It Va f_namemax
+The maximum file name length for this file system.
+.It Va f_owner
+The user ID of the user that mounted the file system.
+.It Va f_fsid
+Unique file system ID.
+.It Va f_fstypename
+The file system type name; a string of at most
+.Dv MFSNAMELEN
+bytes.
+.It Va f_mntfromname
+The device name the file system was mounted from; a string of at most
+.Dv MNAMELEN
+bytes.
+.It Va f_mntonname
+The name of the directory on which the file system is mounted;
+a string of at most
+.Dv MNAMELEN
+bytes.
+.El
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_SYNC.9 b/share/man/man9/VFS_SYNC.9
new file mode 100644
index 000000000000..ed510dd7b664
--- /dev/null
+++ b/share/man/man9/VFS_SYNC.9
@@ -0,0 +1,81 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_SYNC 9
+.Os
+.Sh NAME
+.Nm VFS_SYNC
+.Nd flush unwritten data
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_SYNC "struct mount *mp" "int waitfor"
+.Sh DESCRIPTION
+The
+.Fn VFS_SYNC
+macro writes out all unwritten data in the file system mounted as
+.Fa mp .
+.Pp
+The arguments it expects are:
+.Bl -tag -width ".Fa waitfor"
+.It Fa mp
+The file system.
+.It Fa waitfor
+Whether the function should wait for I/O to complete.
+Possible values are:
+.Bl -tag -width MNT_NOWAIT
+.It Dv MNT_WAIT
+synchronously wait for I/O to complete
+.It Dv MNT_NOWAIT
+start all I/O, but do not wait for it
+.It Dv MNT_LAZY
+push data not written by file system syncer
+.El
+.El
+.Pp
+The
+.Fn VFS_SYNC
+macro calls the
+.Va vfs_sync
+method of the file system, which normally calls
+.Xr VOP_FSYNC 9
+for all the vnodes in the file system.
+.Sh SEE ALSO
+.Xr fsync 2 ,
+.Xr sync 2 ,
+.Xr VFS 9 ,
+.Xr vnode 9 ,
+.Xr VOP_FSYNC 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_UNMOUNT.9 b/share/man/man9/VFS_UNMOUNT.9
new file mode 100644
index 000000000000..59113ee174db
--- /dev/null
+++ b/share/man/man9/VFS_UNMOUNT.9
@@ -0,0 +1,68 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 23, 2009
+.Dt VFS_UNMOUNT 9
+.Os
+.Sh NAME
+.Nm VFS_UNMOUNT
+.Nd unmount a file system
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_UNMOUNT "struct mount *mp" "int mntflags"
+.Sh DESCRIPTION
+The
+.Fn VFS_UNMOUNT
+macro unmounts a file system.
+.Pp
+The arguments it expects are:
+.Bl -tag -width mntflags
+.It Fa mp
+The file system.
+.It Fa mntflags
+Bit-mask of flags for the unmount operation.
+The flags currently supported by
+.Fn VFS_UNMOUNT
+are:
+.Bl -tag -width ".Dv MNT_FORCE"
+.It Dv MNT_FORCE
+Open files are forcibly closed before the file system is unmounted.
+.El
+.El
+.Sh SEE ALSO
+.Xr vflush 9 ,
+.Xr VFS 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VFS_VGET.9 b/share/man/man9/VFS_VGET.9
new file mode 100644
index 000000000000..f762b8981acc
--- /dev/null
+++ b/share/man/man9/VFS_VGET.9
@@ -0,0 +1,83 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 7, 2005
+.Dt VFS_VGET 9
+.Os
+.Sh NAME
+.Nm VFS_VGET
+.Nd convert an inode number to a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.In sys/vnode.h
+.Ft int
+.Fn VFS_VGET "struct mount *mp" "ino_t ino" "int flags" "struct vnode **vpp"
+.Sh DESCRIPTION
+The
+.Fn VFS_VGET
+looks up or creates a vnode from a (mount, inode#) tuple.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa flags"
+.It Fa mp
+The mount point.
+.It Fa ino
+The inode representing the file.
+This is a unique number assigned by the file system when vnodes are first
+created.
+.It Fa flags
+Additional locking flags to pass through to
+.Xr vget 9 .
+.It Fa vpp
+Return parameter for the vnode.
+.El
+.Pp
+This is an optional file system entry-point for file systems mainly
+intended for NFS server use, but many file systems
+use it internally in
+.Xr VOP_LOOKUP 9
+and similar.
+.Pp
+If the file system does not support this call, then it should return
+.Er EOPNOTSUPP .
+.Pp
+Please see
+.Fn ffs_vget
+in
+.Pa sys/ufs/ffs/ffs_vfsops.c
+for the canonical example.
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vget 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_ACCESS.9 b/share/man/man9/VOP_ACCESS.9
new file mode 100644
index 000000000000..005f2e20e578
--- /dev/null
+++ b/share/man/man9/VOP_ACCESS.9
@@ -0,0 +1,103 @@
+.\" -*- nroff -*-
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2009
+.Dt VOP_ACCESS 9
+.Os
+.Sh NAME
+.Nm VOP_ACCESS ,
+.Nm VOP_ACCESSX
+.Nd "check access permissions of a file or Unix domain socket"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
+.Ft int
+.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+This entry point checks the access permissions of the file against the
+given credentials.
+.Pp
+Its arguments are:
+.Bl -tag -width accmode
+.It Fa vp
+The vnode of the file to check.
+.It Fa accmode
+The type of access required.
+.It Fa cred
+The user credentials to check.
+.It Fa td
+The thread which is checking.
+.El
+.Pp
+The
+.Fa accmode
+is a mask which can contain flags described in <sys/vnode.h>, e.g.
+.Dv VREAD ,
+.Dv VWRITE
+or
+.Dv VEXEC .
+For
+.Fn VOP_ACCESS ,
+the only flags that may be set in
+.Fa accmode
+are
+.Dv VEXEC ,
+.Dv VWRITE ,
+.Dv VREAD ,
+.Dv VADMIN
+and
+.Dv VAPPEND .
+To check for other flags, one has to use
+.Fn VOP_ACCESSX
+instead.
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+If the file is accessible in the specified way, then zero is returned,
+otherwise an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EPERM
+An attempt was made to change an immutable file.
+.It Bq Er EACCES
+The permission bits the file mode or the ACL do not permit the
+requested access.
+.El
+.Sh SEE ALSO
+.Xr vaccess 9 ,
+.Xr vaccess_acl_nfs4 9 ,
+.Xr vaccess_acl_posix1e 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_ACLCHECK.9 b/share/man/man9/VOP_ACLCHECK.9
new file mode 100644
index 000000000000..363811213374
--- /dev/null
+++ b/share/man/man9/VOP_ACLCHECK.9
@@ -0,0 +1,102 @@
+.\"-
+.\" Copyright (c) 1999 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt VOP_ACLCHECK 9
+.Os
+.Sh NAME
+.Nm VOP_ACLCHECK
+.Nd check an access control list for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fn VOP_ACLCHECK "struct vnode *vp" "acl_type_t type" "struct acl *aclp" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+This vnode call may be used to determine the validity of a particular access
+control list (ACL) for a particular file or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width type
+.It Fa vp
+The vnode of the file or directory.
+.It Fa type
+The type of ACL to check.
+.It Fa aclp
+A pointer to an ACL structure from which to retrieve the ACL data.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread checking the ACL.
+.El
+.Pp
+The
+.Fa cred
+pointer may be NULL to indicate that access control checks are not to be
+performed, if possible.
+This cred setting might be used to allow the
+kernel to authorize ACL verification that the active process might not be
+permitted to do.
+.Pp
+The vnode ACL interface defines the syntax, and not semantics, of file and
+directory ACL interfaces.
+More information about ACL management in kernel
+may be found in
+.Xr acl 9 .
+.Sh LOCKS
+No locks are required to call this vnode method, and any locks held on
+entry will be held on exit.
+.Sh RETURN VALUES
+If the
+.Fa aclp
+pointer points to a valid ACL of type
+.Fa type
+for the object
+.Fa vp ,
+then zero is returned.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The ACL type passed is invalid for this vnode, or the ACL data is invalid.
+.It Bq Er EACCES
+The file or directory ACL does not permit access.
+.It Bq Er ENOMEM
+Sufficient memory is not available to fulfill the request.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_ACLCHECK .
+.El
+.Sh SEE ALSO
+.Xr acl 9 ,
+.Xr vnode 9 ,
+.Xr VOP_GETACL 9 ,
+.Xr VOP_SETACL 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/VOP_ADVLOCK.9 b/share/man/man9/VOP_ADVLOCK.9
new file mode 100644
index 000000000000..3dabc59ea496
--- /dev/null
+++ b/share/man/man9/VOP_ADVLOCK.9
@@ -0,0 +1,88 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 30, 1999
+.Dt VOP_ADVLOCK 9
+.Os
+.Sh NAME
+.Nm VOP_ADVLOCK
+.Nd advisory record locking
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/fcntl.h
+.In sys/lockf.h
+.Ft int
+.Fn VOP_ADVLOCK "struct vnode *vp" "caddr_t id" "int op" "struct flock *fl" "int flags"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width flags
+.It Fa vp
+The vnode being manipulated.
+.It Fa id
+The id token which is changing the lock.
+.It Fa op
+The operation to perform (see
+.Xr fcntl 2 ) .
+.It Fa fl
+Description of the lock.
+.It Fa flags
+One of more of the following:
+.Pp
+.Bl -tag -width ".Dv F_UNLCK" -offset indent -compact
+.It Dv F_RDLCK
+Shared or read lock.
+.It Dv F_UNLCK
+Unlock.
+.It Dv F_WRLCK
+Exclusive or write lock.
+.It Dv F_WAIT
+Wait until lock is granted.
+.It Dv F_FLOCK
+Use
+.Xr flock 2
+semantics for lock.
+.It Dv F_POSIX
+Use POSIX semantics for lock.
+.El
+.El
+.Pp
+This entry point manipulates advisory record locks on the file.
+Most file systems delegate the work for this call to
+.Fn lf_advlock .
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr fcntl 2 ,
+.Xr flock 2 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_ATTRIB.9 b/share/man/man9/VOP_ATTRIB.9
new file mode 100644
index 000000000000..e48e4eb9a254
--- /dev/null
+++ b/share/man/man9/VOP_ATTRIB.9
@@ -0,0 +1,102 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 29, 2008
+.Dt VOP_ATTRIB 9
+.Os
+.Sh NAME
+.Nm VOP_GETATTR ,
+.Nm VOP_SETATTR
+.Nd get and set attributes on a file or directory
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
+.Ft int
+.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred"
+.Sh DESCRIPTION
+These entry points manipulate various attributes of a file or directory,
+including file permissions, owner, group, size,
+access time and modification time.
+.Pp
+The arguments are:
+.Bl -tag -width cred
+.It Fa vp
+The vnode of the file.
+.It Fa vap
+The attributes of the file.
+.It Fa cred
+The user credentials of the calling process.
+.El
+.Pp
+Attributes which are not being modified by
+.Fn VOP_SETATTR
+should be set to the value
+.Dv VNOVAL ;
+.Fn VATTR_NULL
+may be used to clear all the values, and should generally be used to reset
+the contents of
+.Fa *vap
+prior to setting specific values.
+.Sh LOCKS
+.Fn VOP_GETATTR
+expects the vnode to be locked on entry and will leave the vnode locked on
+return.
+The lock type can be either shared or exclusive.
+.Pp
+.Fn VOP_SETATTR
+expects the vnode to be locked on entry and will leave the vnode locked on
+return.
+The lock type must be exclusive.
+.Sh RETURN VALUES
+.Fn VOP_GETATTR
+returns 0 if it was able to retrieve the attribute data via
+.Fa *vap ,
+otherwise an appropriate error is returned.
+.Fn VOP_SETATTR
+returns zero if the attributes were changed successfully, otherwise an
+appropriate error is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EPERM
+The file is immutable.
+.It Bq Er EACCES
+The caller does not have permission to modify the file or directory attributes.
+.It Bq Er EROFS
+The file system is read-only.
+.El
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_BWRITE.9 b/share/man/man9/VOP_BWRITE.9
new file mode 100644
index 000000000000..d2ee5105166a
--- /dev/null
+++ b/share/man/man9/VOP_BWRITE.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_BWRITE 9
+.Os
+.Sh NAME
+.Nm VOP_BWRITE
+.Nd write a file system buffer
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_BWRITE "struct vnode *vp" "struct buf *bp"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width 2n
+.It Fa vp
+The vnode of the file being written to.
+.It Fa bp
+The buffer to be written.
+.El
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_CREATE.9 b/share/man/man9/VOP_CREATE.9
new file mode 100644
index 000000000000..b86a88dce119
--- /dev/null
+++ b/share/man/man9/VOP_CREATE.9
@@ -0,0 +1,100 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_CREATE 9
+.Os
+.Sh NAME
+.Nm VOP_CREATE ,
+.Nm VOP_MKNOD ,
+.Nm VOP_MKDIR ,
+.Nm VOP_SYMLINK
+.Nd create a file, socket, fifo, device, directory or symlink
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/namei.h
+.Ft int
+.Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
+.Ft int
+.Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
+.Ft int
+.Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap"
+.Ft int
+.Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target"
+.Sh DESCRIPTION
+These entry points create a new file, socket, fifo, device, directory or symlink
+in a given directory.
+.Pp
+The arguments are:
+.Bl -tag -width target
+.It Fa dvp
+The locked vnode of the directory.
+.It Fa vpp
+The address of a variable where the resulting locked vnode should be stored.
+.It Fa cnp
+The pathname component created.
+.It Fa vap
+The attributes that the new object should be created with.
+.It Fa target
+The pathname of the target of the symlink.
+.El
+.Pp
+These entry points are called after
+.Xr VOP_LOOKUP 9
+when an object is being created.
+.Sh LOCKS
+The directory,
+.Fa dvp
+will be locked on entry and must remain locked on return.
+If the call is successful, the new object will be returned locked.
+.Sh RETURN VALUES
+If successful, the vnode for the new object is placed in
+.Fa *vpp
+and zero is returned.
+Otherwise, an appropriate error is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOSPC
+The file system is full.
+.It Bq Er EDQUOT
+The user's file system space or inode quota would be exceeded.
+.El
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr VOP_LOOKUP 9
+.Sh HISTORY
+The function
+.Nm
+appeared in
+.Bx 4.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_FSYNC.9 b/share/man/man9/VOP_FSYNC.9
new file mode 100644
index 000000000000..e457f846640f
--- /dev/null
+++ b/share/man/man9/VOP_FSYNC.9
@@ -0,0 +1,93 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_FSYNC 9
+.Os
+.Sh NAME
+.Nm VOP_FSYNC
+.Nd flush file system buffers for a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_FSYNC "struct vnode *vp" "int waitfor" "struct thread *td"
+.Sh DESCRIPTION
+This call flushes any dirty file system buffers for the file.
+It is used to implement the
+.Xr sync 2
+and
+.Xr fsync 2
+system calls.
+.Pp
+Its arguments are:
+.Bl -tag -width waitfor
+.It Fa vp
+The vnode of the file.
+.It Fa waitfor
+Whether the function should wait for I/O to complete.
+Possible values are:
+.Bl -tag -width MNT_NOWAIT
+.It Dv MNT_WAIT
+Synchronously wait for I/O to complete.
+.It Dv MNT_NOWAIT
+Start all I/O, but do not wait for it.
+.It Dv MNT_LAZY
+Push data not written by file system syncer.
+.El
+.It Fa td
+The calling thread.
+.El
+.Pp
+The argument
+.Fa waitfor
+is either
+.Dv MNT_WAIT
+or
+.Dv MNT_NOWAIT
+and specifies whether or not the function should wait for the writes
+to finish before returning.
+.Sh LOCKS
+The file should be locked on entry.
+.Sh RETURN VALUES
+Zero is returned if the call is successful, otherwise an appropriate
+error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOSPC
+The file system is full.
+.It Bq Er EDQUOT
+Quota exceeded.
+.El
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_GETACL.9 b/share/man/man9/VOP_GETACL.9
new file mode 100644
index 000000000000..d23034081017
--- /dev/null
+++ b/share/man/man9/VOP_GETACL.9
@@ -0,0 +1,96 @@
+.\"-
+.\" Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt VOP_GETACL 9
+.Os
+.Sh NAME
+.Nm VOP_GETACL
+.Nd retrieve access control list for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fn VOP_GETACL "struct vnode *vp" "acl_type_t type" "struct acl *aclp" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+This vnode call may be used to retrieve the access control list (ACL) from a
+file or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width type
+.It Fa vp
+The vnode of the file or directory.
+.It Fa type
+The type of ACL to retrieve.
+.It Fa aclp
+A pointer to an ACL structure to receive the ACL data.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread requesting the ACL.
+.El
+.Pp
+The
+.Fa cred
+pointer may be
+.Dv NULL
+to indicate that access control checks are not to be performed, if possible.
+This cred setting might be used to allow the kernel to authorize ACL
+retrieval that the active process might not be permitted to do.
+.Pp
+The vnode ACL interface defines the syntax, and not semantics, of file and
+directory ACL interfaces.
+More information about ACL management in kernel may be found in
+.Xr acl 9 .
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+If the
+.Fa aclp
+pointer will point to a valid ACL, then zero is returned.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The ACL type passed is invalid for this vnode.
+.It Bq Er EACCES
+The the caller does not have the appropriate privilege.
+.It Bq Er ENOMEM
+Sufficient memory is not available to fulfill the request.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_GETACL .
+.El
+.Sh SEE ALSO
+.Xr acl 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACLCHECK 9 ,
+.Xr VOP_SETACL 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/VOP_GETEXTATTR.9 b/share/man/man9/VOP_GETEXTATTR.9
new file mode 100644
index 000000000000..cf00d26f48f6
--- /dev/null
+++ b/share/man/man9/VOP_GETEXTATTR.9
@@ -0,0 +1,133 @@
+.\"-
+.\" Copyright (c) 1999, 2000, 2001, 2003 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt VOP_GETEXTATTR 9
+.Os
+.Sh NAME
+.Nm VOP_GETEXTATTR
+.Nd retrieve named extended attribute from a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/extattr.h
+.Ft int
+.Fo VOP_GETEXTATTR
+.Fa "struct vnode *vp"
+.Fa "int attrnamespace"
+.Fa "const char *name"
+.Fa "struct uio *uio"
+.Fa "size_t *size"
+.Fa "struct ucred *cred"
+.Fa "struct thread *td"
+.Fc
+.Sh DESCRIPTION
+This vnode call may be used to retrieve a specific named extended attribute
+from a file or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa attrnamespace"
+.It Fa vp
+The vnode of the file or directory.
+.It Fa attrnamespace
+Integer constant indicating which extended attribute namespace the attribute
+name is present in.
+.It Fa name
+Pointer to a null-terminated character string containing the attribute name.
+.It Fa uio
+The location of the data to be read.
+.It Fa size
+If not
+.Dv NULL ,
+on return it will contain the number of bytes required to read all of the
+attribute data.
+In most cases
+.Fa uio
+will be
+.Dv NULL
+when
+.Fa size
+is not, and vise versa.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread requesting the extended attribute.
+.El
+.Pp
+The
+.Fa cred
+pointer may be
+.Dv NULL
+to indicate that access control checks are not to be performed, if possible.
+This
+.Fa cred
+setting might be used to allow the kernel to authorize extended attribute
+retrieval that the active process might not be permitted to do.
+.Pp
+Extended attribute semantics may vary by file system implementing the call.
+More information on extended attributes may be found in
+.Xr extattr 9 .
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+On success, zero will be returned, and the uio structure will be updated to
+reflect data read.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOATTR
+The requested attribute was not defined for this vnode.
+.It Bq Er EACCES
+The the caller does not have the appropriate privilege.
+.It Bq Er ENXIO
+The request was not valid in this file system for the specified vnode and
+attribute name.
+.It Bq Er ENOMEM
+Sufficient memory is not available to fulfill the request.
+.It Bq Er EFAULT
+The uio structure refers to an invalid userspace address.
+.It Bq Er EINVAL
+The
+.Fa name ,
+.Fa namespace,
+or
+.Fa uio
+argument is invalid.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_GETEXTATTR .
+.El
+.Sh SEE ALSO
+.Xr extattr 9 ,
+.Xr vnode 9 ,
+.Xr VOP_LISTEXTATTR 9 ,
+.Xr VOP_SETEXTATTR 9
+.Sh BUGS
+By passing in the empty string as the attribute name, some file systems
+will return a list of defined names on the target vnode for the
+requested namespace.
+This is a bad API, and will be replaced by an explicit VOP.
diff --git a/share/man/man9/VOP_GETPAGES.9 b/share/man/man9/VOP_GETPAGES.9
new file mode 100644
index 000000000000..e490862045f6
--- /dev/null
+++ b/share/man/man9/VOP_GETPAGES.9
@@ -0,0 +1,167 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\" Copyright 2003, Garrett A. Wollman
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 27, 2003
+.Dt VOP_GETPAGES 9
+.Os
+.Sh NAME
+.Nm VOP_GETPAGES ,
+.Nm VOP_PUTPAGES
+.Nd read or write VM pages from a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In vm/vm.h
+.Ft int
+.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int reqpage" "vm_ooffset_t offset"
+.Ft int
+.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset"
+.Sh DESCRIPTION
+The
+.Fn VOP_GETPAGES
+method is called to read in pages of virtual memory which are backed by
+ordinary files.
+If other adjacent pages are backed by adjacent regions of the same file,
+.Fn VOP_GETPAGES
+is requested to read those pages as well, although it is not required to
+do so.
+The
+.Fn VOP_PUTPAGES
+method does the converse; that is to say, it writes out adjacent dirty
+pages of virtual memory.
+.Pp
+On entry, the vnode lock is held but neither the page queue nor VM object
+locks are held.
+Both methods return in the same state on both success and error returns.
+.Pp
+The arguments are:
+.Bl -tag -width reqpage
+.It Fa vp
+The file to access.
+.It Fa ma
+Pointer to the first element of an array of pages representing a
+contiguous region of the file to be read or written.
+.It Fa count
+The number of bytes that should be read into the pages of the array.
+.It Fa sync
+.Dv VM_PAGER_PUT_SYNC
+if the write should be synchronous.
+.It Fa rtvals
+An array of VM system result codes indicating the status of each
+page written by
+.Fn VOP_PUTPAGES .
+.It Fa reqpage
+The index in the page array of the requested page; i.e., the one page which
+the implementation of this method must handle.
+.It Fa offset
+Offset in the file at which the mapped pages begin.
+.El
+.Pp
+The status of the
+.Fn VOP_PUTPAGES
+method is returned on a page-by-page basis in the array
+.Fa rtvals[] .
+The possible status values are as follows:
+.Bl -tag -width VM_PAGER_ERROR
+.It Dv VM_PAGER_OK
+The page was successfully written.
+The implementation must call
+.Xr vm_page_undirty 9
+to mark the page as clean.
+.It Dv VM_PAGER_PEND
+The page was scheduled to be written asynchronously.
+When the write completes, the completion callback should
+call
+.Xr vm_object_pip_wakeup 9
+and
+.Xr vm_page_io_finish 9
+to clear the busy flag and awaken any other threads waiting for this page,
+in addition to calling
+.Xr vm_page_undirty 9 .
+.It Dv VM_PAGER_BAD
+The page was entirely beyond the end of the backing file.
+This condition should not be possible if the vnode's file system
+is correctly implemented.
+.It Dv VM_PAGER_ERROR
+The page could not be written because of an error on the underlying storage
+medium or protocol.
+.It Dv VM_PAGER_FAIL
+Treated identically to
+.Dv VM_PAGER_ERROR
+.It Dv VM_PAGER_AGAIN
+The page was not handled by this request.
+.El
+.Pp
+The
+.Fn VOP_GETPAGES
+method is expected to release any pages in
+.Fa ma
+that it does not successfully handle, by calling
+.Xr vm_page_free 9 .
+When it succeeds,
+.Fn VOP_GETPAGES
+must set the valid bits appropriately.
+.Fn VOP_GETPAGES
+must keep
+.Fa reqpage
+busy.
+It must unbusy all other successfully handled pages and put them
+on appropriate page queue(s).
+For example,
+.Fn VOP_GETPAGES
+may either activate a page (if its wanted bit is set)
+or deactivate it (otherwise), and finally call
+.Xr vm_page_wakeup 9
+to arouse any threads currently waiting for the page to be faulted in.
+.Sh RETURN VALUES
+If it successfully reads
+.Fa ma[reqpage] ,
+.Fn VOP_GETPAGES
+returns
+.Dv VM_PAGER_OK ;
+otherwise,
+.Dv VM_PAGER_ERROR .
+By convention, the return value of
+.Fn VOP_PUTPAGES
+is
+.Fa rtvals[0] .
+.Sh SEE ALSO
+.Xr vm_object_pip_wakeup 9 ,
+.Xr vm_page_free 9 ,
+.Xr vm_page_io_finish 9 ,
+.Xr vm_page_undirty 9 ,
+.Xr vm_page_wakeup 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson
+and then substantially rewritten by
+.An Garrett Wollman .
diff --git a/share/man/man9/VOP_GETVOBJECT.9 b/share/man/man9/VOP_GETVOBJECT.9
new file mode 100644
index 000000000000..2490da710b57
--- /dev/null
+++ b/share/man/man9/VOP_GETVOBJECT.9
@@ -0,0 +1,113 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Boris Popov
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 10, 2000
+.Dt VOP_CREATEVOBJECT 9
+.Os
+.Sh NAME
+.Nm VOP_CREATEVOBJECT ,
+.Nm VOP_DESTROYVOBJECT ,
+.Nm VOP_GETVOBJECT
+.Nd VM object interaction
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_CREATEVOBJECT "struct vnode *vp" "struct ucred *cred" "struct thread *td"
+.Ft int
+.Fn VOP_DESTROYVOBJECT "struct vnode *vp"
+.Ft int
+.Fn VOP_GETVOBJECT "struct vnode *vp" "struct vm_object **objpp"
+.Sh DESCRIPTION
+These calls are used to control the association of a VM object
+with a particular vnode.
+.Pp
+The arguments specific to these functions are:
+.Bl -tag -width objpp
+.It Fa vp
+The vnode of the file.
+.It Fa objpp
+The VM object being returned, or
+.Dv NULL
+if the caller wants to test for the existence
+of the VM object).
+.El
+.Pp
+.Xr VFS 9
+invokes
+.Fn VOP_CREATEVOBJECT
+when it needs to create a VM object for the given
+.Xr vnode 9 .
+File system code may pass this call down to the underlying file system.
+This VOP can be called multiple times,
+and file system code should ignore any additional calls,
+exiting with a zero return code.
+.Pp
+.Fn VOP_DESTROYVOBJECT
+is called when a
+.Xr vnode 9
+is recycled.
+.Pp
+.Fn VOP_GETVOBJECT
+should be used by all kernel code to get a VM object.
+.\" XXX What is the next sentence trying to tell people?
+The returned VM object may belong to a different file system in the case
+of stacked mounts.
+.Pp
+.Xr VFS 9
+has three functions which perform standard operations by creating
+and destroying VM objects.
+These functions are:
+.Fn vop_stdcreatevobject ,
+.Fn vop_stddestroyvobject
+and
+.Fn vop_stdgetvobject .
+.Pp
+.Em Note :
+a
+.Xr vnode 9
+should be locked on entry and must be left locked on exit.
+.Sh RETURN VALUES
+The
+.Fn VOP_CREATEVOBJECT ,
+.Fn VOP_DESTROYVOBJECT
+and
+.Fn VOP_GETVOBJECT
+functions return zero on success, or a non-zero value on failure.
+Zero is returned on success, otherwise an error is returned.
+.Sh EXAMPLES
+.\" XXX Why is this code here when it does not use the functions
+.\" described in this manual page?
+By default, file systems leave VM object handling to the
+.Fn vop_std*
+functions.
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr VOP_GETPAGES 9 ,
+.Xr VOP_PUTPAGES 9
+.Sh AUTHORS
+This manual page was written by
+.An Boris Popov .
diff --git a/share/man/man9/VOP_INACTIVE.9 b/share/man/man9/VOP_INACTIVE.9
new file mode 100644
index 000000000000..2f1e4ed60bd6
--- /dev/null
+++ b/share/man/man9/VOP_INACTIVE.9
@@ -0,0 +1,81 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_INACTIVE 9
+.Os
+.Sh NAME
+.Nm VOP_INACTIVE ,
+.Nm VOP_RECLAIM
+.Nd reclaim file system resources for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_INACTIVE "struct vnode *vp" "struct thread *td"
+.Ft int
+.Fn VOP_RECLAIM "struct vnode *vp" "struct thread *td"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width 2n
+.It Fa vp
+The vnode being reclaimed.
+.El
+.Pp
+.Fn VOP_INACTIVE
+is called when the kernel is no longer using the vnode.
+This may be
+because the reference count reaches zero or it may be that the
+file system is being forcibly unmounted while there are open files.
+It can be used to reclaim space for
+.Sq open but deleted
+files.
+.Pp
+.Fn VOP_RECLAIM
+is called when a vnode is being reused for a different file system.
+Any file system specific resources associated with the vnode should be
+freed.
+.Sh LOCKS
+For VOP_INACTIVE, the
+.Fa vp
+will be locked on entry.
+Your VOP_INACTIVE code
+must unlock the
+.Fa vp
+prior to returning.
+.Pp
+For VOP_RECLAIM, the
+.Fa vp
+will not be locked on entry and should be left unlocked on return.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_IOCTL.9 b/share/man/man9/VOP_IOCTL.9
new file mode 100644
index 000000000000..ba1208179fc3
--- /dev/null
+++ b/share/man/man9/VOP_IOCTL.9
@@ -0,0 +1,74 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_IOCTL 9
+.Os
+.Sh NAME
+.Nm VOP_IOCTL
+.Nd device specific control
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_IOCTL "struct vnode *vp" "u_long command" "caddr_t data" "int fflag" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+Manipulate a file in device dependent ways.
+.Pp
+Its arguments are:
+.Bl -tag -width command
+.It Fa vp
+The vnode of the file (normally representing a device).
+.It Fa command
+The device specific operation to perform.
+.It Fa data
+Extra data for the specified operation.
+.It Fa fflag
+Some flags ???
+.It Fa cred
+The caller's credentials.
+.It Fa td
+The calling thread.
+.El
+.Pp
+Most file systems do not implement this entry point.
+.Sh LOCKS
+The file should not be locked on entry.
+.Sh RETURN VALUES
+If successful, zero is returned, otherwise an appropriate error code.
+.Pp
+If the ioctl is not recognized or not handled,
+.Er ENOTTY
+should be returned.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_LINK.9 b/share/man/man9/VOP_LINK.9
new file mode 100644
index 000000000000..f5b7c68e7042
--- /dev/null
+++ b/share/man/man9/VOP_LINK.9
@@ -0,0 +1,83 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_LINK 9
+.Os
+.Sh NAME
+.Nm VOP_LINK
+.Nd create a new name for a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_LINK "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp"
+.Sh DESCRIPTION
+This links a new name in the specified directory to an existing file.
+.Pp
+Its arguments are:
+.Bl -tag -width 8n
+.It Fa dvp
+The vnode of the directory.
+.It Fa vp
+The vnode of the file to be linked.
+.It Fa cnp
+Pathname information about the file.
+.El
+.Pp
+The pathname info should
+.Em not
+be released on exit because it is done
+by the caller.
+The directory and file vnodes should
+.Em not
+be released on exit.
+.Sh LOCKS
+.Fn VOP_LINK
+expects the directory and file vnodes to be locked on entry and will leave
+the vnodes locked on return.
+.Sh RETURN VALUES
+Zero is returned if the file was linked successfully, otherwise an
+error is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EMLINK
+The file has too many links.
+.It Bq Er EPERM
+The file is immutable.
+.It Bq Er EXDEV
+A hard link is not possible between different file systems.
+.El
+.Sh SEE ALSO
+.Xr vn_lock 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was originally written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_LISTEXTATTR.9 b/share/man/man9/VOP_LISTEXTATTR.9
new file mode 100644
index 000000000000..0900099b1d6c
--- /dev/null
+++ b/share/man/man9/VOP_LISTEXTATTR.9
@@ -0,0 +1,136 @@
+.\"-
+.\" Copyright (c) 2003 Network Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project in part by Network
+.\" Associates Laboratories, the Security Research Division of Network
+.\" Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
+.\" as part of the DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 19, 2005
+.Dt VOP_LISTEXTATTR 9
+.Os
+.Sh NAME
+.Nm VOP_LISTEXTATTR
+.Nd retrieve a list of named extended attribute from a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/extattr.h
+.Ft int
+.Fo VOP_LISTEXTATTR
+.Fa "struct vnode *vp"
+.Fa "int attrnamespace"
+.Fa "struct uio *uio"
+.Fa "size_t *size"
+.Fa "struct ucred *cred"
+.Fa "struct thread *td"
+.Fc
+.Sh DESCRIPTION
+This vnode call may be used to retrieve a list of named extended attributes
+from a specified namespace on a file or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa attrnamespace"
+.It Fa vp
+The vnode of the file or directory.
+.It Fa attrnamespace
+Integer constant indicating which extended attribute namespace the attribute
+name is present in.
+.It Fa uio
+The location of the data to be read.
+The resulting data will be a list of attribute names.
+Each list entry consists of a single byte containing the length of
+the attribute name, followed by the attribute name.
+The attribute name is not terminated by
+.Tn ASCII
+.Dv NUL .
+.It Fa size
+If not
+.Dv NULL ,
+on return it will contain the number of bytes required to read the list.
+In most cases
+.Fa uio
+will be
+.Dv NULL
+when
+.Fa size
+is not, and vice versa.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread requesting the extended attribute.
+.El
+.Pp
+The
+.Fa cred
+pointer may be
+.Dv NULL
+to indicate that access control checks are not to be performed, if possible.
+This
+.Fa cred
+setting might be used to allow the kernel to authorize extended attribute
+retrieval that the active process might not be permitted to do.
+.Pp
+Extended attribute semantics may vary by file system implementing the call.
+More information on extended attributes may be found in
+.Xr extattr 9 .
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+On success, zero will be returned, and the
+.Fa uio
+structure will be updated to
+reflect the list read.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+The caller does not have the appropriate privilege.
+.It Bq Er ENXIO
+The request was not valid in this file system for the specified vnode and
+attribute name.
+.It Bq Er ENOMEM
+Sufficient memory is not available to fulfill the request.
+.It Bq Er EFAULT
+The
+.Fa uio
+structure refers to an invalid userspace address.
+.It Bq Er EINVAL
+The
+.Fa namespace
+or
+.Fa uio
+argument is invalid.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_LISTEXTATTR .
+.El
+.Sh SEE ALSO
+.Xr extattr 9 ,
+.Xr vnode 9 ,
+.Xr VOP_GETEXTATTR 9 ,
+.Xr VOP_SETEXTATTR 9
diff --git a/share/man/man9/VOP_LOCK.9 b/share/man/man9/VOP_LOCK.9
new file mode 100644
index 000000000000..b4fdc7ac72b9
--- /dev/null
+++ b/share/man/man9/VOP_LOCK.9
@@ -0,0 +1,124 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2008
+.Dt VOP_LOCK 9
+.Os
+.Sh NAME
+.Nm VOP_LOCK ,
+.Nm VOP_UNLOCK ,
+.Nm VOP_ISLOCKED ,
+.Nm vn_lock
+.Nd serialize access to a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_LOCK "struct vnode *vp" "int flags"
+.Ft int
+.Fn VOP_UNLOCK "struct vnode *vp" "int flags"
+.Ft int
+.Fn VOP_ISLOCKED "struct vnode *vp"
+.Ft int
+.Fn vn_lock "struct vnode *vp" "int flags"
+.Sh DESCRIPTION
+These calls are used to serialize access to the file system, such as
+to prevent two writes to the same file from happening at the
+same time.
+.Pp
+The arguments are:
+.Bl -tag -width flags
+.It Fa vp
+The vnode being locked or unlocked.
+.It Fa flags
+One of the lock request types:
+.Pp
+.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact
+.It Dv LK_SHARED
+Shared lock.
+.It Dv LK_EXCLUSIVE
+Exclusive lock.
+.It Dv LK_UPGRADE
+Shared-to-exclusive upgrade.
+.It Dv LK_DOWNGRADE
+Exclusive-to-shared downgrade.
+.It Dv LK_RELEASE
+Release any type of lock.
+.It Dv LK_DRAIN
+Wait for all lock activity to end.
+.El
+.Pp
+The lock type may be
+.Em or Ns 'ed
+with these lock flags:
+.Pp
+.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact
+.It Dv LK_NOWAIT
+Do not sleep to wait for lock.
+.It Dv LK_SLEEPFAIL
+Sleep, then return failure.
+.It Dv LK_CANRECURSE
+Allow recursive exclusive lock.
+.It Dv LK_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this instance.
+.El
+.Pp
+The lock type may be
+.Em or Ns 'ed
+with these control flags:
+.Pp
+.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact
+.It Dv LK_INTERLOCK
+Specify when the caller already has a simple lock
+.Fn ( VOP_LOCK
+will unlock the simple lock after getting the lock).
+.It Dv LK_RETRY
+Retry until locked.
+.El
+.Pp
+Kernel code should use
+.Fn vn_lock
+to lock a vnode rather than calling
+.Fn VOP_LOCK
+directly.
+.Fn vn_lock
+also does not want a thread specified as argument but it
+assumes curthread to be used.
+.El
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_LOOKUP.9 b/share/man/man9/VOP_LOOKUP.9
new file mode 100644
index 000000000000..64023f4a9e61
--- /dev/null
+++ b/share/man/man9/VOP_LOOKUP.9
@@ -0,0 +1,195 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 24, 1997
+.Dt VOP_LOOKUP 9
+.Os
+.Sh NAME
+.Nm VOP_LOOKUP
+.Nd lookup a component of a pathname
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/namei.h
+.Ft int
+.Fn VOP_LOOKUP "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp"
+.Sh DESCRIPTION
+This entry point looks up a single pathname component in a given directory.
+.Pp
+Its arguments are:
+.Bl -tag -width vpp
+.It Fa dvp
+The locked vnode of the directory to search.
+.It Fa vpp
+The address of a variable where the resulting locked vnode should be stored.
+.It Fa cnp
+The pathname component to be searched for.
+.El
+.Pp
+.Fa Cnp
+is a pointer to a componentname structure defined as follows:
+.Bd -literal
+struct componentname {
+ /*
+ * Arguments to lookup.
+ */
+ u_long cn_nameiop; /* namei operation */
+ u_long cn_flags; /* flags to namei */
+ struct thread *cn_thread; /* thread requesting lookup */
+ struct ucred *cn_cred; /* credentials */
+ /*
+ * Shared between lookup and commit routines.
+ */
+ char *cn_pnbuf; /* pathname buffer */
+ char *cn_nameptr; /* pointer to looked up name */
+ long cn_namelen; /* length of looked up component */
+ u_long cn_hash; /* hash value of looked up name */
+ long cn_consume; /* chars to consume in lookup() */
+};
+.Ed
+.Pp
+Convert a component of a pathname into a pointer to a locked vnode.
+This is a very central and rather complicated routine.
+If the file system is not maintained in a strict tree hierarchy,
+this can result in a deadlock situation.
+.Pp
+The
+.Fa cnp->cn_nameiop
+argument is
+.Dv LOOKUP ,
+.Dv CREATE ,
+.Dv RENAME ,
+or
+.Dv DELETE
+depending on the intended use of the object.
+When
+.Dv CREATE ,
+.Dv RENAME ,
+or
+.Dv DELETE
+is specified, information usable in
+creating, renaming, or deleting a directory entry may be calculated.
+.Pp
+Overall outline of VOP_LOOKUP:
+.Bd -ragged -offset indent
+Check accessibility of directory.
+Look for name in cache, if found, then return name.
+Search for name in directory, goto to found or notfound as appropriate.
+.Ed
+.Pp
+notfound:
+.Bd -ragged -offset indent
+If creating or renaming and at end of pathname,
+return
+.Er EJUSTRETURN ,
+leaving info on available slots else return
+.Er ENOENT .
+.Ed
+.Pp
+found:
+.Bd -ragged -offset indent
+If at end of path and deleting, return information to allow delete.
+If at end of path and renaming, lock target
+inode and return info to allow rename.
+If not at end, add name to cache; if at end and neither creating
+nor deleting, add name to cache.
+.Ed
+.Sh LOCKS
+The directory,
+.Fa dvp
+should be locked on entry.
+If an error (note: the return value
+.Er EJUSTRETURN
+is not considered an error)
+is detected, it will be returned locked.
+Otherwise, it will be unlocked unless both
+.Dv LOCKPARENT
+and
+.Dv ISLASTCN
+are specified in
+.Fa cnp->cn_flags .
+If an entry is found in the directory, it will be returned locked.
+.Sh RETURN VALUES
+Zero is returned with
+.Fa *vpp
+set to the locked vnode of the file if the component is found.
+If the component being searched for is ".", then the vnode just has
+an extra reference added to it with
+.Xr vref 9 .
+The caller must take care to release the locks appropriately in this
+case.
+.Pp
+If the component is not found and the operation is
+.Dv CREATE
+or
+.Dv RENAME ,
+the flag
+.Dv ISLASTCN
+is specified and the operation would succeed, the special return value
+.Er EJUSTRETURN
+is returned.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOTDIR
+The vnode
+.Fa dvp
+does not represent a directory.
+.It Bq Er ENOENT
+The component
+.Fa dvp
+was not found in this directory.
+.It Bq Er EACCES
+Access for the specified operation is denied.
+.It Bq Er EJUSTRETURN
+A
+.Dv CREATE
+or
+.Dv RENAME
+operation would be successful.
+.El
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9 ,
+.Xr VOP_CREATE 9 ,
+.Xr VOP_MKDIR 9 ,
+.Xr VOP_MKNOD 9 ,
+.Xr VOP_RENAME 9 ,
+.Xr VOP_SYMLINK 9
+.Sh HISTORY
+The function
+.Nm
+appeared in
+.Bx 4.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson ,
+with some text from comments in
+.Pa ufs_lookup.c .
diff --git a/share/man/man9/VOP_OPENCLOSE.9 b/share/man/man9/VOP_OPENCLOSE.9
new file mode 100644
index 000000000000..5442e3277f46
--- /dev/null
+++ b/share/man/man9/VOP_OPENCLOSE.9
@@ -0,0 +1,104 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 2, 2009
+.Dt VOP_OPEN 9
+.Os
+.Sh NAME
+.Nm VOP_OPEN ,
+.Nm VOP_CLOSE
+.Nd open or close a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_OPEN "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td" "struct file *fp"
+.Ft int
+.Fn VOP_CLOSE "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+The
+.Fn VOP_OPEN
+entry point is called before a file is accessed by a process and the
+.Fn VOP_CLOSE
+entry point is called after a file is finished with by the process.
+.Pp
+The arguments are:
+.Bl -tag -width mode
+.It Fa vp
+The vnode of the file.
+.It Fa mode
+The access mode required by the calling process.
+.It Fa cred
+The caller's credentials.
+.It Fa td
+The thread which is accessing the file.
+.It Fa fp
+The file being opened.
+.El
+.Pp
+Pointer to the file
+.Fa fp
+is useful for file systems which require such information, e.g.,
+.Xr fdescfs 5 .
+Use
+.Ql NULL
+as
+.Fa fp
+argument to
+.Fn VOP_OPEN
+for in-kernel opens.
+.Pp
+The access mode is a set of flags, including
+.Dv FREAD ,
+.Dv FWRITE ,
+.Dv O_NONBLOCK ,
+.Dv O_APPEND .
+.Sh LOCKS
+.Fn VOP_OPEN
+expects
+.Fa vp
+to be locked on entry and will leave it locked on return.
+.Pp
+.Fn VOP_CLOSE
+expects at least a reference to be associated with the vnode and does not
+care whether the vnode is locked or not.
+The lock and reference state is left unchanged on return.
+Note that
+.Fa vn_close
+expects an unlocked, referenced vnode and will dereference the vnode prior
+to returning.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr VOP_LOOKUP 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_PATHCONF.9 b/share/man/man9/VOP_PATHCONF.9
new file mode 100644
index 000000000000..38fed835002e
--- /dev/null
+++ b/share/man/man9/VOP_PATHCONF.9
@@ -0,0 +1,88 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_PATHCONF 9
+.Os
+.Sh NAME
+.Nm VOP_PATHCONF
+.Nd return POSIX pathconf information
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/unistd.h
+.Ft int
+.Fn VOP_PATHCONF "struct vnode *vp" "int name" "int *retval"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width retval
+.It Fa vp
+The vnode to get information about.
+.It Fa name
+The type of information to return.
+.It Fa retval
+The place to return the information.
+.El
+.Pp
+The value of
+.Fa name
+specifies what should be returned:
+.Bl -tag -width _PC_CHOWN_RESTRICTED
+.It Dv _PC_LINK_MAX
+The maximum number of links to a file.
+.It Dv _PC_NAME_MAX
+The maximum number of bytes in a file name.
+.It Dv _PC_PATH_MAX
+The maximum number of bytes in a pathname.
+.It Dv _PC_PIPE_BUF
+The maximum number of bytes which will be written atomically to a pipe.
+.It Dv _PC_CHOWN_RESTRICTED
+Return 1 if appropriate privileges are required for the
+.Xr chown 2
+system call, otherwise 0.
+.It Dv _PC_NO_TRUNC
+Return 1 if file names longer than
+.Dv KERN_NAME_MAX
+are truncated.
+.El
+.Sh RETURN VALUES
+If
+.Fa name
+is recognized,
+.Fa *retval
+is set to the specified value and zero is returned, otherwise
+.Er EINVAL
+is returned.
+.Sh SEE ALSO
+.Xr pathconf 2 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_PRINT.9 b/share/man/man9/VOP_PRINT.9
new file mode 100644
index 000000000000..c8188fc0263f
--- /dev/null
+++ b/share/man/man9/VOP_PRINT.9
@@ -0,0 +1,54 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_PRINT 9
+.Os
+.Sh NAME
+.Nm VOP_PRINT
+.Nd print debugging information
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_PRINT "struct vnode *vp"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width 2n
+.It Fa vp
+The vnode to print.
+.El
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9
new file mode 100644
index 000000000000..eb1af7842073
--- /dev/null
+++ b/share/man/man9/VOP_RDWR.9
@@ -0,0 +1,104 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_RDWR 9
+.Os
+.Sh NAME
+.Nm VOP_READ ,
+.Nm VOP_WRITE
+.Nd read or write a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/uio.h
+.Ft int
+.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
+.Ft int
+.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
+.Sh DESCRIPTION
+These entry points read or write the contents of a file
+.Pp
+The arguments are:
+.Bl -tag -width ioflag
+.It Fa vp
+The vnode of the file.
+.It Fa uio
+The location of the data to be read or written.
+.It Fa ioflag
+Various flags.
+.It Fa cnp
+The credentials of the caller.
+.El
+.Pp
+The
+.Fa ioflag
+argument is used to give directives and hints to the file system.
+When attempting a read, the high 16 bits are used to provide a
+read-ahead hint (in units of file system blocks) that the file system
+should attempt.
+The low 16 bits are a bit mask which can contain
+the following flags:
+.Bl -tag -width ".Dv IO_NODELOCKED"
+.It Dv IO_UNIT
+Do I/O as atomic unit.
+.It Dv IO_APPEND
+Append write to end.
+.It Dv IO_SYNC
+Do I/O synchronously.
+.It Dv IO_NODELOCKED
+Underlying node already locked.
+.It Dv IO_NDELAY
+.Dv FNDELAY
+flag set in file table.
+.It Dv IO_VMIO
+Data already in VMIO space.
+.El
+.Sh LOCKS
+The file should be locked on entry and will still be locked on exit.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EFBIG
+An attempt was made to write a file that exceeds the process's file size
+limit or the maximum file size.
+.It Bq Er ENOSPC
+The file system is full.
+.It Bq Er EPERM
+An append-only flag is set on the file, but the caller is attempting to
+write before the current end of file.
+.El
+.Sh SEE ALSO
+.Xr uiomove 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_READDIR.9 b/share/man/man9/VOP_READDIR.9
new file mode 100644
index 000000000000..bac1f3f5fa6a
--- /dev/null
+++ b/share/man/man9/VOP_READDIR.9
@@ -0,0 +1,108 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_READDIR 9
+.Os
+.Sh NAME
+.Nm VOP_READDIR
+.Nd read contents of a directory
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/dirent.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" "struct ucred *cred" "int *eofflag" "int *ncookies" "u_long **cookies"
+.Sh DESCRIPTION
+Read directory entries.
+.Bl -tag -width ncookies
+.It Fa vp
+The vnode of the directory.
+.It Fa uio
+Where to read the directory contents.
+.It Fa cred
+The caller's credentials.
+.It Fa eofflag
+Return end of file status
+.Dv ( NULL
+if not wanted).
+.It Fa ncookies
+Number of directory cookies generated for NFS
+.Dv ( NULL
+if not wanted).
+.It Fa cookies
+Directory seek cookies generated for NFS
+.Dv ( NULL
+if not wanted).
+.El
+The directory contents are read into
+.Vt struct dirent
+structures.
+If the on-disc data structures differ from this then they
+should be translated.
+.Sh LOCKS
+The directory should be locked on entry and will still be locked on exit.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Pp
+If this is called from the NFS server, the extra arguments
+.Fa eofflag ,
+.Fa ncookies
+and
+.Fa cookies
+are given.
+The value of
+.Fa *eofflag
+should be set to TRUE if the end of the directory is reached while
+reading.
+The directory seek cookies are returned to the NFS client and may be used
+later to restart a directory read part way through the directory.
+There should be one cookie returned per directory entry.
+The value of
+the cookie should be the offset within the directory where the on-disc
+version of the appropriate directory entry starts.
+Memory for the cookies should be allocated using:
+.Bd -literal
+ ...;
+ *ncookies = number of entries read;
+ *cookies = malloc(*ncookies * sizeof(u_long), M_TEMP, M_WAITOK);
+.Ed
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINVAL
+An attempt was made to read from an illegal offset in the directory.
+.It Bq Er EIO
+A read error occurred while reading the directory.
+.El
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_READLINK.9 b/share/man/man9/VOP_READLINK.9
new file mode 100644
index 000000000000..c1883c1e99cd
--- /dev/null
+++ b/share/man/man9/VOP_READLINK.9
@@ -0,0 +1,67 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_READLINK 9
+.Os
+.Sh NAME
+.Nm VOP_READLINK
+.Nd read the target of a symbolic link
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/uio.h
+.Ft int
+.Fn VOP_READLINK "struct vnode *vp" "struct uio *uio" "struct ucred *cred"
+.Sh DESCRIPTION
+This reads the target pathname of a symbolic link
+.Bl -tag -width uio
+.It Fa vp
+The vnode of the symlink.
+.It Fa uio
+The location of the data to be read or written.
+.It Fa cred
+The credentials of the caller.
+.El
+.Sh LOCKS
+The vnode should be locked on entry and will still be locked on exit.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EIO
+A read error occurred while reading the contents of the symlink.
+.El
+.Sh SEE ALSO
+.Xr uiomove 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_REALLOCBLKS.9 b/share/man/man9/VOP_REALLOCBLKS.9
new file mode 100644
index 000000000000..d38caf16d72e
--- /dev/null
+++ b/share/man/man9/VOP_REALLOCBLKS.9
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_REALLOCBLKS 9
+.Os
+.Sh NAME
+.Nm VOP_REALLOCBLKS
+.Nd rearrange blocks in a file to be contiguous
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_REALLOCBLKS "struct vnode *vp" "struct cluster_save *buflist"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width buflist
+.It Fa vp
+The file to manipulate.
+.It Fa buflist
+A list of buffers to rearrange.
+.El
+.Pp
+This seems to be part of a work in progress.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr buf 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_REMOVE.9 b/share/man/man9/VOP_REMOVE.9
new file mode 100644
index 000000000000..38e3b060bc53
--- /dev/null
+++ b/share/man/man9/VOP_REMOVE.9
@@ -0,0 +1,77 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_REMOVE 9
+.Os
+.Sh NAME
+.Nm VOP_REMOVE ,
+.Nm VOP_RMDIR
+.Nd remove a file or directory
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_REMOVE "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp"
+.Ft int
+.Fn VOP_RMDIR "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp"
+.Sh DESCRIPTION
+These entry points remove files and directories respectively.
+.Pp
+The arguments are:
+.Bl -tag -width dvp
+.It Fa dvp
+The vnode of the directory.
+.It Fa vp
+The vnode of the file to be removed.
+.It Fa cnp
+Pathname information about the file.
+.El
+.Sh LOCKS
+Both
+.Fa dvp
+and
+.Fa vp
+should be locked on entry and remain locked on return.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EPERM
+The file is immutable.
+.It Bq Er ENOTEMPTY
+An attempt was made to remove a directory which is not empty.
+.El
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr VOP_LOOKUP 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_RENAME.9 b/share/man/man9/VOP_RENAME.9
new file mode 100644
index 000000000000..76bb0dc1a1c3
--- /dev/null
+++ b/share/man/man9/VOP_RENAME.9
@@ -0,0 +1,96 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_RENAME 9
+.Os
+.Sh NAME
+.Nm VOP_RENAME
+.Nd rename a file
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" "struct componentname *fcnp" "struct vnode *tdvp" "struct vnode *tvp" "struct componentname *tcnp"
+.Sh DESCRIPTION
+This renames a file and possibly changes its parent directory.
+If the destination object exists, it will be removed first.
+.Pp
+Its arguments are:
+.Bl -tag -width fdvp
+.It Fa fdvp
+The vnode of the old parent directory.
+.It Fa fvp
+The vnode of the file to be renamed.
+.It Fa fcnp
+Pathname information about the file's current name.
+.It Fa tdvp
+The vnode of the new parent directory.
+.It Fa tvp
+The vnode of the target file (if it exists).
+.It Fa tcnp
+Pathname information about the file's new name.
+.El
+.Sh LOCKS
+The source directory and file are unlocked but are expected to have their
+ref count bumped on entry.
+The VOP routine is expected to
+.Xr vrele 9
+both prior
+to returning.
+.Pp
+The destination directory and file are locked as well as having their ref
+count bumped.
+The VOP routine is expected to
+.Xr vput 9
+both prior to
+returning.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EPERM
+The file is immutable.
+.It Bq Er EXDEV
+It is not possible to rename a file between different file systems.
+.It Bq Er EINVAL
+An attempt was made to rename
+.Pa \&.
+or
+.Pa .. ,
+or to perform an operation which would break the directory tree structure.
+.It Bq Er ENOTDIR
+An attempt was made to rename a directory to a file or vice versa.
+.It Bq Er ENOTEMPTY
+An attempt was made to remove a directory which is not empty.
+.El
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_REVOKE.9 b/share/man/man9/VOP_REVOKE.9
new file mode 100644
index 000000000000..3557ce1109e8
--- /dev/null
+++ b/share/man/man9/VOP_REVOKE.9
@@ -0,0 +1,70 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2002 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed for the FreeBSD Project by NAI Labs, the
+.\" Security Research Division of Network Associates, Inc. under
+.\" DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA
+.\" CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The names of the authors may not be used to endorse or promote
+.\" products derived from this software without specific prior written
+.\" permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 5, 2002
+.Dt VOP_REVOKE 9
+.Os
+.Sh NAME
+.Nm VOP_REVOKE
+.Nd "revoke access to a device and its aliases"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_REVOKE "struct vnode *vp" "int flags"
+.Sh DESCRIPTION
+.Fn VOP_REVOKE
+will administratively revoke access to the device specified by
+.Fa vp ,
+as well as any aliases created via
+.Xr make_dev_alias 9 .
+Further file operations on any of these devices by processes
+which have them open will nominally fail.
+The
+.Fa flags
+must be set to
+.Dv REVOKEALL
+to signify that all access will be revoked; any other value is invalid.
+.Sh LOCKS
+The
+.Fa vp
+must be unlocked on entry, and will remain unlocked upon return.
+.Sh SEE ALSO
+.Xr make_dev_alias 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Brian Fundakowski Feldman .
diff --git a/share/man/man9/VOP_SETACL.9 b/share/man/man9/VOP_SETACL.9
new file mode 100644
index 000000000000..482d28980349
--- /dev/null
+++ b/share/man/man9/VOP_SETACL.9
@@ -0,0 +1,105 @@
+.\"-
+.\" Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt VOP_SETACL 9
+.Os
+.Sh NAME
+.Nm VOP_SETACL
+.Nd set the access control list for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fn VOP_SETACL "struct vnode *vp" "acl_type_t type" "struct acl *aclp" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+This vnode call may be used to set the access control list (ACL) for a file
+or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width type
+.It Fa vp
+The vnode of the file or directory.
+.It Fa type
+The type of ACL to set.
+.It Fa aclp
+A pointer to an ACL structure from which to retrieve the ACL data.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread setting the ACL.
+.El
+.Pp
+The
+.Fa aclp
+pointer may be
+.Dv NULL
+to indicate that the specified ACL should be deleted.
+.Pp
+The
+.Fa cred
+pointer may be
+.Dv NULL
+to indicate that access control checks are not to be performed, if possible.
+This cred setting might be used to allow the kernel to authorize ACL
+changes that the active process might not be permitted to make.
+.Pp
+The vnode ACL interface defines the syntax, and not semantics, of file and
+directory ACL interfaces.
+More information about ACL management in kernel
+may be found in
+.Xr acl 9 .
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+If the ACL is successfully set, then zero is returned.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The ACL type passed is invalid for this vnode, or the ACL data is invalid.
+.It Bq Er EACCES
+The the caller does not have the appropriate privilege.
+.It Bq Er ENOMEM
+Sufficient memory is not available to fulfill the request.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_SETACL .
+.It Bq Er ENOSPC
+The file system is out of space.
+.It Bq Er EROFS
+The file system is read-only.
+.El
+.Sh SEE ALSO
+.Xr acl 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACLCHECK 9 ,
+.Xr VOP_GETACL 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/VOP_SETEXTATTR.9 b/share/man/man9/VOP_SETEXTATTR.9
new file mode 100644
index 000000000000..4bc53877b5a6
--- /dev/null
+++ b/share/man/man9/VOP_SETEXTATTR.9
@@ -0,0 +1,119 @@
+.\"-
+.\" Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt VOP_SETEXTATTR 9
+.Os
+.Sh NAME
+.Nm VOP_SETEXTATTR
+.Nd set named extended attribute for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/extattr.h
+.Ft int
+.Fn VOP_SETEXTATTR "struct vnode *vp" "int attrnamespace" "const char *name" "struct uio *uio" "struct ucred *cred" "struct thread *td"
+.Sh DESCRIPTION
+This vnode call may be used to set specific named extended attribute for a
+file or directory.
+.Pp
+Its arguments are:
+.Bl -tag -width type
+.It Fa vp
+The vnode of the file or directory.
+.It Fa attrnamespace
+Integer constant indicating which extended attribute namespace the attribute
+name is present in.
+.It Fa name
+Pointer to a null-terminated character string containing the attribute name.
+.It Fa uio
+The location of the data to be read or written.
+.It Fa cred
+The user credentials to use in authorizing the request.
+.It Fa td
+The thread setting the extended attribute.
+.El
+.Pp
+The uio structure is used in a manner similar to the argument of the same
+name in
+.Xr VOP_WRITE 9 .
+However, as extended attributes provide a strict "name=value" semantic,
+non-zero offsets will be rejected.
+.Pp
+The
+.Fa uio
+pointer may be
+.Dv NULL
+to indicate that the specified extended attribute should be deleted.
+.Pp
+The
+.Fa cred
+pointer may be
+.Dv NULL
+to indicate that access control checks are not to be performed, if possible.
+This
+.Fa cred
+setting might be used to allow the kernel to authorize extended attribute
+changes that the active process might not be permitted to make.
+.Pp
+Extended attribute semantics may vary by file system implementing the call.
+More information on extended attributes may be found in
+.Xr extattr 9 .
+.Sh LOCKS
+The vnode will be locked on entry and should remain locked on return.
+.Sh RETURN VALUES
+If the extended attribute is successfully set, then zero is returned.
+Otherwise, an appropriate error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+The the caller does not have the appropriate privilege.
+.It Bq Er ENXIO
+The request was not valid in this file system for the specified vnode and
+attribute name.
+.It Bq Er ENOMEM
+Insufficient memory available to fulfill request
+.It Bq Er EFAULT
+The uio structure refers to an invalid userspace address.
+.It Bq Er EINVAL
+The name, namespace, or uio argument is invalid.
+.It Bq Er EOPNOTSUPP
+The file system does not support
+.Fn VOP_SETEXTATTR .
+.It Bq Er ENOSPC
+The file system is out of space.
+.It Bq Er EROFS
+The file system is read-only.
+.El
+.Sh SEE ALSO
+.Xr extattr 9 ,
+.Xr vnode 9 ,
+.Xr VOP_GETEXTATTR 9 ,
+.Xr VOP_LISTEXTATTR 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/VOP_STRATEGY.9 b/share/man/man9/VOP_STRATEGY.9
new file mode 100644
index 000000000000..33d9fb8c1468
--- /dev/null
+++ b/share/man/man9/VOP_STRATEGY.9
@@ -0,0 +1,64 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VOP_STRATEGY 9
+.Os
+.Sh NAME
+.Nm VOP_STRATEGY
+.Nd read or write a file system buffer
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_STRATEGY "struct vnode *vp" "struct buf *bp"
+.Sh DESCRIPTION
+The arguments are:
+.Bl -tag -width 2n
+.It Fa vp
+The vnode that the buffer is for.
+.It Fa bp
+The buffer to be read or written.
+.El
+.Pp
+This call either reads or writes data from a file, depending on the value of
+.Fa bp->b_io.bio_cmd .
+.Pp
+The call may block.
+.Sh RETURN VALUES
+Always zero.
+Errors should be signalled by setting BIO_ERROR on b_ioflags field in struct buf,
+and setting b_error to the appropriate errno value.
+.Sh SEE ALSO
+.\" .Xr buf 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/VOP_VPTOCNP.9 b/share/man/man9/VOP_VPTOCNP.9
new file mode 100644
index 000000000000..f2d5ddc7755e
--- /dev/null
+++ b/share/man/man9/VOP_VPTOCNP.9
@@ -0,0 +1,92 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2008 Joe Marcus Clarke
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 19, 2011
+.Dt VOP_VPTOCNP 9
+.Os
+.Sh NAME
+.Nm VOP_VPTOCNP
+.Nd translate a vnode to its component name
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_VPTOCNP "struct vnode *vp" "struct vnode **dvp" "char *buf" "int *buflen"
+.Sh DESCRIPTION
+This translates a vnode into its component name, and writes that name to
+the head of the buffer specified by
+.Fa buf .
+.Bl -tag -width buflen
+.It Fa vp
+The vnode to translate.
+.It Fa dvp
+The vnode of the parent directory of
+.Fa vp .
+.It Fa buf
+The buffer into which to prepend the component name.
+.It Fa buflen
+The remaining size of the buffer.
+.El
+.Pp
+The default implementation of
+.Nm
+scans through
+.Fa vp Ns 's
+parent directory looking for a dirent with a matching file number. If
+.Fa vp
+is not a directory, then
+.Nm
+returns ENOENT.
+.Sh LOCKS
+The vnode should be locked on entry and will still be locked on exit.
+The parent directory vnode will be unlocked on a successful exit.
+However, it will have its use count incremented.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error code is returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+The buffer was not large enough to hold the vnode's component name.
+.It Bq Er ENOENT
+The vnode was not found on the file system.
+.El
+.Sh SEE ALSO
+.Xr VOP_LOOKUP 9 ,
+.Xr vnode 9
+.Sh NOTES
+This interface is a work in progress.
+.Sh HISTORY
+The function
+.Nm
+appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Joe Marcus Clarke .
diff --git a/share/man/man9/VOP_VPTOFH.9 b/share/man/man9/VOP_VPTOFH.9
new file mode 100644
index 000000000000..3619a7b065a3
--- /dev/null
+++ b/share/man/man9/VOP_VPTOFH.9
@@ -0,0 +1,60 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 16, 2007
+.Dt VOP_VPTOFH 9
+.Os
+.Sh NAME
+.Nm VOP_VPTOFH
+.Nd turn a vnode into an NFS filehandle
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_VPTOFH "struct vnode *vp" "struct fid *fhp"
+.Sh DESCRIPTION
+This is used by the NFS server to create an opaque filehandle which
+uniquely identifies the file and which can be used by an NFS client
+to access the file in the future.
+.Pp
+Its arguments are:
+.Bl -tag -width fhp
+.It Fa vp
+The vnode to make a filehandle for.
+.It Fa fhp
+Return parameter for the filehandle.
+.El
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_FHTOVP 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/accept_filter.9 b/share/man/man9/accept_filter.9
new file mode 100644
index 000000000000..3f89a0cdf7d6
--- /dev/null
+++ b/share/man/man9/accept_filter.9
@@ -0,0 +1,152 @@
+.\"
+.\" Copyright (c) 2000 Alfred Perlstein
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd June 25, 2000
+.Dt ACCEPT_FILTER 9
+.Os
+.Sh NAME
+.Nm accept_filter ,
+.Nm accept_filt_add ,
+.Nm accept_filt_del ,
+.Nm accept_filt_generic_mod_event ,
+.Nm accept_filt_get
+.Nd filter incoming connections
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/module.h
+.In sys/socket.h
+.Fd #define ACCEPT_FILTER_MOD
+.In sys/socketvar.h
+.Ft int
+.Fn accept_filt_add "struct accept_filter *filt"
+.Ft int
+.Fn accept_filt_del "char *name"
+.Ft int
+.Fn accept_filt_generic_mod_event "module_t mod" "int event" "void *data"
+.Ft struct accept_filter *
+.Fn accept_filt_get "char *name"
+.Sh DESCRIPTION
+Accept filters allow an application to request
+that the kernel pre-process incoming connections.
+An accept filter is requested via the
+.Xr setsockopt 2
+system call, passing in an
+.Fa optname
+of
+.Dv SO_ACCEPTFILTER .
+.Sh IMPLEMENTATION NOTES
+A module that wants to be an accept filter
+must provide a
+.Vt "struct accept_filter"
+to the system:
+.Bd -literal
+struct accept_filter {
+ char accf_name[16];
+ void (*accf_callback)(struct socket *so, void *arg, int waitflag);
+ void * (*accf_create)(struct socket *so, char *arg);
+ void (*accf_destroy)(struct socket *so);
+ SLIST_ENTRY(accept_filter) accf_next; /* next on the list */
+};
+.Ed
+.Pp
+The module should register it with the function
+.Fn accept_filt_add ,
+passing a pointer to a
+.Vt "struct accept_filter" ,
+allocated with
+.Xr malloc 9 .
+.Pp
+The fields of
+.Vt "struct accept_filter"
+are as follows:
+.Bl -tag -width ".Va accf_callback"
+.It Va accf_name
+Name of the filter;
+this is how it will be accessed from userland.
+.It Va accf_callback
+The callback that the kernel will do
+once the connection is established.
+It is the same as a socket upcall
+and will be called when the connection is established
+and whenever new data arrives on the socket,
+unless the callback modifies the socket's flags.
+.It Va accf_create
+Called whenever a
+.Xr setsockopt 2
+installs the filter onto
+a listening socket.
+.It Va accf_destroy
+Called whenever the user removes the accept filter on the socket.
+.El
+.Pp
+The
+.Fn accept_filt_del
+function
+passed the same string used in
+.Va accept_filter.accf_name
+during registration with
+.Fn accept_filt_add ,
+the kernel will then disallow and further userland use of the filter.
+.Pp
+The
+.Fn accept_filt_get
+function is used internally to locate which accept filter to use via the
+.Xr setsockopt 2
+system call.
+.Pp
+The
+.Fn accept_filt_generic_mod_event
+function provides a simple way to avoid duplication of code
+for accept filters which do not use the argument field to load
+and unload themselves.
+This function can be used in the
+.Vt moduledata_t
+struct for the
+.Xr DECLARE_MODULE 9
+macro.
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr accf_data 9 ,
+.Xr accf_dns 9 ,
+.Xr accf_http 9 ,
+.Xr malloc 9
+.Sh HISTORY
+The accept filter mechanism was introduced in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page was written by
+.An -nosplit
+.An Alfred Perlstein ,
+.An Sheldon Hearn
+and
+.An Jeroen Ruigrok van der Werven.
+.Pp
+The accept filter concept was pioneered by
+.An David Filo
+at Yahoo!\&
+and refined to be a loadable module system by
+.An Alfred Perlstein .
diff --git a/share/man/man9/accf_data.9 b/share/man/man9/accf_data.9
new file mode 100644
index 000000000000..2d3b7a24d693
--- /dev/null
+++ b/share/man/man9/accf_data.9
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright (c) 2000 Alfred Perlstein
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd November 15, 2000
+.Dt ACCF_DATA 9
+.Os
+.Sh NAME
+.Nm accf_data
+.Nd buffer incoming connections until data arrives
+.Sh SYNOPSIS
+.Nm options INET
+.Nm options ACCEPT_FILTER_DATA
+.Nm kldload accf_data
+.Sh DESCRIPTION
+This is a filter to be placed on a socket that will be using
+.Fn accept
+to receive incoming connections.
+.Pp
+It prevents the application from receiving the connected descriptor via
+.Fn accept
+until data arrives on the connection.
+.Pp
+The
+.Fa ACCEPT_FILTER_DATA
+kernel option is also a module that can be enabled at runtime via
+.Xr kldload 8
+if the INET option has been compiled into the kernel.
+.Sh EXAMPLES
+Assuming ACCEPT_FILTER_DATA has been included in the kernel config
+file or the
+.Nm
+module
+has been loaded, this will enable the data accept filter
+on the socket
+.Fa sok .
+.Bd -literal -offset 0i
+ struct accept_filter_arg afa;
+
+ bzero(&afa, sizeof(afa));
+ strcpy(afa.af_name, "dataready");
+ setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
+.Ed
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr accept_filter 9 ,
+.Xr accf_dns 9
+.Xr accf_http 9
+.Sh HISTORY
+The accept filter mechanism and the
+accf_data filter were introduced in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page and the filter were written by
+.An Alfred Perlstein .
diff --git a/share/man/man9/accf_dns.9 b/share/man/man9/accf_dns.9
new file mode 100644
index 000000000000..4a2dad250666
--- /dev/null
+++ b/share/man/man9/accf_dns.9
@@ -0,0 +1,79 @@
+.\"
+.\" Copyright (c) 2008 David Malone
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd July 16, 2008
+.Dt ACCF_DNS 9
+.Os
+.Sh NAME
+.Nm accf_dns
+.Nd buffer incoming DNS requests until the whole first request is present
+.Sh SYNOPSIS
+.Nm options INET
+.Nm options ACCEPT_FILTER_DNS
+.Nm kldload accf_dns
+.Sh DESCRIPTION
+This is a filter to be placed on a socket that will be using
+.Fn accept
+to receive incoming connections.
+.Pp
+It prevents the application from receiving the connected descriptor via
+.Fn accept
+until a whole DNS request is available on the socket.
+It does this by reading the first two bytes of the request,
+to determine its size,
+and waiting until the required amount of data is available to be read.
+.Pp
+The
+.Fa ACCEPT_FILTER_DNS
+kernel option is also a module that can be enabled at runtime via
+.Xr kldload 8
+if the INET option has been compiled into the kernel.
+.Sh EXAMPLES
+If the
+.Nm
+module is available in the kernel,
+the following code will enable the DNS accept filter
+on a socket
+.Fa sok .
+.Bd -literal -offset 0i
+ struct accept_filter_arg afa;
+
+ bzero(&afa, sizeof(afa));
+ strcpy(afa.af_name, "dnsready");
+ setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
+.Ed
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr accept_filter 9 ,
+.Xr accf_http 9
+.Xr accf_data 9
+.Sh HISTORY
+The accept filter mechanism was introduced in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page and the filter were written by
+.An David Malone .
diff --git a/share/man/man9/accf_http.9 b/share/man/man9/accf_http.9
new file mode 100644
index 000000000000..2a340605ecf5
--- /dev/null
+++ b/share/man/man9/accf_http.9
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright (c) 2000 Alfred Perlstein
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd November 15, 2000
+.Dt ACCF_HTTP 9
+.Os
+.Sh NAME
+.Nm accf_http
+.Nd "buffer incoming connections until a certain complete HTTP requests arrive"
+.Sh SYNOPSIS
+.Nm options INET
+.Nm options ACCEPT_FILTER_HTTP
+.Nm kldload accf_http
+.Sh DESCRIPTION
+This is a filter to be placed on a socket that will be using
+.Fn accept
+to receive incoming HTTP connections.
+.Pp
+It prevents the application from receiving the connected descriptor via
+.Fn accept
+until either a full HTTP/1.0 or HTTP/1.1 HEAD or GET request has
+been buffered by the kernel.
+.Pp
+If something other than a HTTP/1.0 or
+HTTP/1.1 HEAD or GET request is received the kernel will
+allow the application to receive the connection descriptor
+via
+.Fn accept .
+.Pp
+The utility of
+.Nm
+is such that a server will not have to context switch several times
+before performing the initial parsing of the request.
+This effectively reduces the amount of required CPU utilization
+to handle incoming requests by keeping active
+processes in preforking servers such as Apache low
+and reducing the size of the file descriptor set that needs
+to be managed by interfaces such as
+.Fn select ,
+.Fn poll
+or
+.Fn kevent
+based servers.
+.Pp
+The
+.Nm
+kernel option is also a module that can be enabled at runtime via
+.Xr kldload 8
+if the INET option has been compiled into the kernel.
+.Sh EXAMPLES
+Assuming ACCEPT_FILTER_HTTP has been included in the kernel config
+file or the
+.Nm
+module
+has been loaded, this will enable the http accept filter
+on the socket
+.Fa sok .
+.Bd -literal -offset 0i
+ struct accept_filter_arg afa;
+
+ bzero(&afa, sizeof(afa));
+ strcpy(afa.af_name, "httpready");
+ setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
+.Ed
+.Sh SEE ALSO
+.Xr setsockopt 2 ,
+.Xr accept_filter 9
+.Sh HISTORY
+The accept filter mechanism and the
+accf_http filter were introduced in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page and the filter were written by
+.An Alfred Perlstein .
diff --git a/share/man/man9/acl.9 b/share/man/man9/acl.9
new file mode 100644
index 000000000000..21640bd7b86f
--- /dev/null
+++ b/share/man/man9/acl.9
@@ -0,0 +1,219 @@
+.\"-
+.\" Copyright (c) 1999-2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2009
+.Dt ACL 9
+.Os
+.Sh NAME
+.Nm acl
+.Nd virtual file system access control lists
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Pp
+In the kernel configuration file:
+.Cd "options UFS_ACL"
+.Sh DESCRIPTION
+Access control lists, or ACLs,
+allow fine-grained specification of rights
+for vnodes representing files and directories.
+However, as there are a plethora of file systems with differing ACL semantics,
+the vnode interface is aware only of the syntax of ACLs,
+relying on the underlying file system to implement the details.
+Depending on the underlying file system, each file or directory
+may have zero or more ACLs associated with it, named using the
+.Fa type
+field of the appropriate vnode ACL calls:
+.Xr VOP_ACLCHECK 9 ,
+.Xr VOP_GETACL 9 ,
+and
+.Xr VOP_SETACL 9 .
+.Pp
+Currently, each ACL is represented in-kernel by a fixed-size
+.Vt acl
+structure, defined as follows:
+.Bd -literal -offset indent
+struct acl {
+ unsigned int acl_maxcnt;
+ unsigned int acl_cnt;
+ int acl_spare[4];
+ struct acl_entry acl_entry[ACL_MAX_ENTRIES];
+};
+.Ed
+.Pp
+An ACL is constructed from a fixed size array of ACL entries,
+each of which consists of a set of permissions, principal namespace,
+and principal identifier.
+In this implementation, the
+.Vt acl_maxcnt
+field is always set to
+.Dv ACL_MAX_ENTRIES .
+.Pp
+Each individual ACL entry is of the type
+.Vt acl_entry_t ,
+which is a structure with the following members:
+.Bl -tag -width 2n
+.It Vt acl_tag_t Va ae_tag
+The following is a list of definitions of ACL types
+to be set in
+.Va ae_tag :
+.Pp
+.Bl -tag -width ".Dv ACL_UNDEFINED_FIELD" -offset indent -compact
+.It Dv ACL_UNDEFINED_FIELD
+Undefined ACL type.
+.It Dv ACL_USER_OBJ
+Discretionary access rights for processes whose effective user ID
+matches the user ID of the file's owner.
+.It Dv ACL_USER
+Discretionary access rights for processes whose effective user ID
+matches the ACL entry qualifier.
+.It Dv ACL_GROUP_OBJ
+Discretionary access rights for processes whose effective group ID
+or any supplemental groups
+match the group ID of the file's owner.
+.It Dv ACL_GROUP
+Discretionary access rights for processes whose effective group ID
+or any supplemental groups
+match the ACL entry qualifier.
+.It Dv ACL_MASK
+The maximum discretionary access rights that can be granted
+to a process in the file group class.
+This is only valid for POSIX.1e ACLs.
+.It Dv ACL_OTHER
+Discretionary access rights for processes not covered by any other ACL
+entry.
+This is only valid for POSIX.1e ACLs.
+.It Dv ACL_OTHER_OBJ
+Same as
+.Dv ACL_OTHER .
+.It Dv ACL_EVERYONE
+Discretionary access rights for all users.
+This is only valid for NFSv4 ACLs.
+.El
+.Pp
+Each POSIX.1e ACL must contain exactly one
+.Dv ACL_USER_OBJ ,
+one
+.Dv ACL_GROUP_OBJ ,
+and one
+.Dv ACL_OTHER .
+If any of
+.Dv ACL_USER ,
+.Dv ACL_GROUP ,
+or
+.Dv ACL_OTHER
+are present, then exactly one
+.Dv ACL_MASK
+entry should be present.
+.It Vt uid_t Va ae_id
+The ID of user for whom this ACL describes access permissions.
+For entries other than
+.Dv ACL_USER
+and
+.Dv ACL_GROUP ,
+this field should be set to
+.Dv ACL_UNDEFINED_ID .
+.It Vt acl_perm_t Va ae_perm
+This field defines what kind of access the process matching this ACL has
+for accessing the associated file.
+For POSIX.1e ACLs, the following are valid:
+.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
+.It Dv ACL_EXECUTE
+The process may execute the associated file.
+.It Dv ACL_WRITE
+The process may write to the associated file.
+.It Dv ACL_READ
+The process may read from the associated file.
+.It Dv ACL_PERM_NONE
+The process has no read, write or execute permissions
+to the associated file.
+.El
+.Pp
+For NFSv4 ACLs, the following are valid:
+.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
+.It Dv ACL_READ_DATA
+The process may read from the associated file.
+.It Dv ACL_LIST_DIRECTORY
+Same as
+.Dv ACL_READ_DATA .
+.It Dv ACL_WRITE_DATA
+The process may write to the associated file.
+.It Dv ACL_ADD_FILE
+Same as
+.Dv ACL_ACL_WRITE_DATA .
+.It Dv ACL_APPEND_DATA
+.It Dv ACL_ADD_SUBDIRECTORY
+Same as
+.Dv ACL_APPEND_DATA .
+.It Dv ACL_READ_NAMED_ATTRS
+Ignored.
+.It Dv ACL_WRITE_NAMED_ATTRS
+Ignored.
+.It Dv ACL_EXECUTE
+The process may execute the associated file.
+.It Dv ACL_DELETE_CHILD
+.It Dv ACL_READ_ATTRIBUTES
+.It Dv ACL_WRITE_ATTRIBUTES
+.It Dv ACL_DELETE
+.It Dv ACL_READ_ACL
+.It Dv ACL_WRITE_ACL
+.It Dv ACL_WRITE_OWNER
+.It Dv ACL_SYNCHRONIZE
+Ignored.
+.El
+.It Vt acl_entry_type_t Va ae_entry_type
+This field defines the type of NFSv4 ACL entry.
+It is not used with POSIX.1e ACLs.
+The following values are valid:
+.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS"
+.It Dv ACL_ENTRY_TYPE_ALLOW
+.It Dv ACL_ENTRY_TYPE_DENY
+.El
+.It Vt acl_flag_t Va ae_flags
+This field defines the inheritance flags of NFSv4 ACL entry.
+It is not used with POSIX.1e ACLs.
+The following values are valid:
+.Bl -tag -width ".Dv ACL_ENTRY_DIRECTORY_INHERIT"
+.It Dv ACL_ENTRY_FILE_INHERIT
+.It Dv ACL_ENTRY_DIRECTORY_INHERIT
+.It Dv ACL_ENTRY_NO_PROPAGATE_INHERIT
+.It Dv ACL_ENTRY_INHERIT_ONLY
+.El
+.El
+.Sh SEE ALSO
+.Xr acl 3 ,
+.Xr vaccess_acl_nfs4 9 ,
+.Xr vaccess_acl_posix1e 9 ,
+.Xr VFS 9 ,
+.Xr vnaccess 9 ,
+.Xr VOP_ACLCHECK 9 ,
+.Xr VOP_GETACL 9 ,
+.Xr VOP_SETACL 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/alq.9 b/share/man/man9/alq.9
new file mode 100644
index 000000000000..65c2d07d93e8
--- /dev/null
+++ b/share/man/man9/alq.9
@@ -0,0 +1,441 @@
+.\"
+.\" Copyright (c) 2003 Hiten Pandya <hmp@FreeBSD.org>
+.\" Copyright (c) 2009-2010 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this software were developed at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 26, 2010
+.Dt ALQ 9
+.Os
+.Sh NAME
+.Nm alq ,
+.Nm alq_open_flags ,
+.Nm alq_open ,
+.Nm alq_writen ,
+.Nm alq_write ,
+.Nm alq_flush ,
+.Nm alq_close ,
+.Nm alq_getn ,
+.Nm alq_get ,
+.Nm alq_post_flags ,
+.Nm alq_post
+.Nd Asynchronous Logging Queues
+.Sh SYNOPSIS
+.In sys/alq.h
+.Ft int
+.Fo alq_open_flags
+.Fa "struct alq **app"
+.Fa "const char *file"
+.Fa "struct ucred *cred"
+.Fa "int cmode"
+.Fa "int size"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo alq_open
+.Fa "struct alq **app"
+.Fa "const char *file"
+.Fa "struct ucred *cred"
+.Fa "int cmode"
+.Fa "int size"
+.Fa "int count"
+.Fc
+.Ft int
+.Fn alq_writen "struct alq *alq" "void *data" "int len" "int flags"
+.Ft int
+.Fn alq_write "struct alq *alq" "void *data" "int flags"
+.Ft void
+.Fn alq_flush "struct alq *alq"
+.Ft void
+.Fn alq_close "struct alq *alq"
+.Ft struct ale *
+.Fn alq_getn "struct alq *alq" "int len" "int flags"
+.Ft struct ale *
+.Fn alq_get "struct alq *alq" "int flags"
+.Ft void
+.Fn alq_post_flags "struct alq *alq" "struct ale *ale" "int flags"
+.Ft void
+.Fn alq_post "struct alq *alq" "struct ale *ale"
+.Sh DESCRIPTION
+The
+.Nm
+facility provides an asynchronous fixed or variable length recording
+mechanism, known as Asynchronous Logging Queues.
+It can record to any
+.Xr vnode 9 ,
+thus providing the ability to journal logs to character
+devices as well as regular files.
+All functions accept a
+.Vt "struct alq"
+argument, which is an opaque type that maintains state information
+for an Asynchronous Logging Queue.
+The logging facility runs in a separate kernel thread, which services
+all log entry requests.
+.Pp
+An
+.Dq asynchronous log entry
+is defined as
+.Vt "struct ale" ,
+which has the following members:
+.Bd -literal -offset indent
+struct ale {
+ intptr_t ae_bytesused; /* # bytes written to ALE. */
+ char *ae_data; /* Write ptr. */
+ int ae_pad; /* Unused, compat. */
+};
+.Ed
+.Pp
+An
+.Nm
+can be created in either fixed or variable length mode.
+A variable length
+.Nm
+accommodates writes of varying length using
+.Fn alq_writen
+and
+.Fn alq_getn .
+A fixed length
+.Nm
+accommodates a fixed number of writes using
+.Fn alq_write
+and
+.Fn alq_get ,
+each of fixed size (set at queue creation time).
+Fixed length mode is deprecated in favour of variable length mode.
+.Sh FUNCTIONS
+The
+.Fn alq_open_flags
+function creates a new variable length asynchronous logging queue.
+The
+.Fa file
+argument is the name of the file to open for logging.
+If the file does not yet exist,
+.Fn alq_open
+will attempt to create it.
+The
+.Fa cmode
+argument will be passed to
+.Fn vn_open
+as the requested creation mode, to be used if the file will be created by
+.Fn alq_open .
+Consumers of this API may wish to pass
+.Dv ALQ_DEFAULT_CMODE ,
+a default creation mode suitable for most applications.
+The
+.Fa cred
+argument specifies the credentials to use when opening and performing I/O on the file.
+The
+.Fa size
+argument sets the size (in bytes) of the underlying queue.
+The ALQ_ORDERED flag may be passed in via
+.Fa flags
+to indicate that the ordering of writer threads waiting for a busy
+.Nm
+to free up resources should be preserved.
+.Pp
+The deprecated
+.Fn alq_open
+function is implemented as a wrapper around
+.Fn alq_open_flags
+to provide backwards compatibility to consumers that have not been updated to
+utilise the newer
+.Fn alq_open_flags
+function.
+It passes all arguments through to
+.Fn alq_open_flags
+untouched except for
+.Fa size
+and
+.Fa count ,
+and sets
+.Fa flags
+to 0.
+To create a variable length mode
+.Nm ,
+the
+.Fa size
+argument should be set to the size (in bytes) of the underlying queue and the
+.Fa count
+argument should be set to 0.
+To create a fixed length mode
+.Nm ,
+the
+.Fa size
+argument should be set to the size (in bytes) of each write and the
+.Fa count
+argument should be set to the number of
+.Fa size
+byte chunks to reserve capacity for.
+.Pp
+The
+.Fn alq_writen
+function writes
+.Fa len
+bytes from
+.Fa data
+to the designated variable length mode queue
+.Fa alq .
+If
+.Fn alq_writen
+could not write the entry immediately and
+.Dv ALQ_WAITOK
+is set in
+.Fa flags ,
+the function will be allowed to
+.Xr msleep_spin 9
+with the
+.Dq Li alqwnord
+or
+.Dq Li alqwnres
+wait message.
+A write will automatically schedule the queue
+.Fa alq
+to be flushed to disk.
+This behaviour can be controlled by passing ALQ_NOACTIVATE via
+.Fa flags
+to indicate that the write should not schedule
+.Fa alq
+to be flushed to disk.
+.Pp
+The deprecated
+.Fn alq_write
+function is implemented as a wrapper around
+.Fn alq_writen
+to provide backwards compatibility to consumers that have not been updated to
+utilise variable length mode queues.
+The function will write
+.Fa size
+bytes of data (where
+.Fa size
+was specified at queue creation time) from the
+.Fa data
+buffer to the
+.Fa alq .
+Note that it is an error to call
+.Fn alq_write
+on a variable length mode queue.
+.Pp
+The
+.Fn alq_flush
+function is used for flushing
+.Fa alq
+to the log medium that was passed to
+.Fn alq_open .
+If
+.Fa alq
+has data to flush and is not already in the process of being flushed, the
+function will block doing IO.
+Otherwise, the function will return immediately.
+.Pp
+The
+.Fn alq_close
+function will close the asynchronous logging queue
+.Fa alq
+and flush all pending write requests to the log medium.
+It will free all resources that were previously allocated.
+.Pp
+The
+.Fn alq_getn
+function returns an asynchronous log entry from
+.Fa alq ,
+initialised to point at a buffer capable of receiving
+.Fa len
+bytes of data.
+This function leaves
+.Fa alq
+in a locked state, until a subsequent
+.Fn alq_post
+or
+.Fn alq_post_flags
+call is made.
+If
+.Fn alq_getn
+could not obtain
+.Fa len
+bytes of buffer immediately and
+.Dv ALQ_WAITOK
+is set in
+.Fa flags ,
+the function will be allowed to
+.Xr msleep_spin 9
+with the
+.Dq Li alqgnord
+or
+.Dq Li alqgnres
+wait message.
+The caller can choose to write less than
+.Fa len
+bytes of data to the returned asynchronous log entry by setting the entry's
+ae_bytesused field to the number of bytes actually written.
+This must be done prior to calling
+.Fn alq_post .
+.Pp
+The deprecated
+.Fn alq_get
+function is implemented as a wrapper around
+.Fn alq_getn
+to provide backwards compatibility to consumers that have not been updated to
+utilise variable length mode queues.
+The asynchronous log entry returned will be initialised to point at a buffer
+capable of receiving
+.Fa size
+bytes of data (where
+.Fa size
+was specified at queue creation time).
+Note that it is an error to call
+.Fn alq_get
+on a variable length mode queue.
+.Pp
+The
+.Fn alq_post_flags
+function schedules the asynchronous log entry
+.Fa ale
+(obtained from
+.Fn alq_getn
+or
+.Fn alq_get )
+for writing to
+.Fa alq .
+The ALQ_NOACTIVATE flag may be passed in via
+.Fa flags
+to indicate that the queue should not be immediately scheduled to be flushed to
+disk.
+This function leaves
+.Fa alq
+in an unlocked state.
+.Pp
+The
+.Fn alq_post
+function is implemented as a wrapper around
+.Fn alq_post_flags
+to provide backwards compatibility to consumers that have not been updated to
+utilise the newer
+.Fn alq_post_flags
+function.
+It simply passes all arguments through to
+.Fn alq_post_flags
+untouched, and sets
+.Fa flags
+to 0.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn alq_writen
+and
+.Fn alq_write
+functions both perform a
+.Xr bcopy 3
+from the supplied
+.Fa data
+buffer into the underlying
+.Nm
+buffer.
+Performance critical code paths may wish to consider using
+.Fn alq_getn
+(variable length queues) or
+.Fn alq_get
+(fixed length queues) to avoid the extra memory copy. Note that a queue
+remains locked between calls to
+.Fn alq_getn
+or
+.Fn alq_get
+and
+.Fn alq_post
+or
+.Fn alq_post_flags ,
+so this method of writing to a queue is unsuitable for situations where the
+time between calls may be substantial.
+.Sh LOCKING
+Each asynchronous logging queue is protected by a spin mutex.
+.Pp
+Functions
+.Fn alq_flush
+and
+.Fn alq_open
+may attempt to acquire an internal sleep mutex, and should
+consequently not be used in contexts where sleeping is
+not allowed.
+.Sh RETURN VALUES
+The
+.Fn alq_open
+function returns one of the error codes listed in
+.Xr open 2 ,
+if it fails to open
+.Fa file ,
+or else it returns 0.
+.Pp
+The
+.Fn alq_writen
+and
+.Fn alq_write
+functions return
+.Er EWOULDBLOCK
+if
+.Dv ALQ_NOWAIT
+was set in
+.Fa flags
+and either the queue is full or the system is shutting down.
+.Pp
+The
+.Fn alq_getn
+and
+.Fn alq_get
+functions return
+.Dv NULL
+if
+.Dv ALQ_NOWAIT
+was set in
+.Fa flags
+and either the queue is full or the system is shutting down.
+.Pp
+NOTE: invalid arguments to non-void functions will result in
+undefined behaviour.
+.Sh SEE ALSO
+.Xr kproc 9 ,
+.Xr ktr 9 ,
+.Xr msleep_spin 9 ,
+.Xr syslog 3 ,
+.Xr vnode 9
+.Sh HISTORY
+The
+Asynchronous Logging Queues (ALQ) facility first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An Jeffrey Roberson Aq jeff@FreeBSD.org
+and extended by
+.An Lawrence Stewart Aq lstewart@freebsd.org .
+.Pp
+This manual page was written by
+.An Hiten Pandya Aq hmp@FreeBSD.org
+and revised by
+.An Lawrence Stewart Aq lstewart@freebsd.org .
diff --git a/share/man/man9/altq.9 b/share/man/man9/altq.9
new file mode 100644
index 000000000000..fd9440420a98
--- /dev/null
+++ b/share/man/man9/altq.9
@@ -0,0 +1,599 @@
+.\" $NetBSD: altq.9,v 1.8 2002/05/28 11:41:45 wiz Exp $
+.\" $OpenBSD: altq.9,v 1.4 2001/07/12 12:41:42 itojun Exp $
+.\"
+.\" Copyright (C) 2004 Max Laier. All rights reserved.
+.\" Copyright (C) 2001
+.\" Sony Computer Science Laboratories Inc. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 25, 2004
+.Dt ALTQ 9
+.Os
+.\"
+.Sh NAME
+.Nm ALTQ
+.Nd kernel interfaces for manipulating output queues on network interfaces
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/if.h
+.In net/if_var.h
+.\"
+.Ss Enqueue macros
+.Fn IFQ_ENQUEUE "struct ifaltq *ifq" "struct mbuf *m" "int error"
+.Fn IFQ_HANDOFF "struct ifnet *ifp" "struct mbuf *m" "int error"
+.Fo IFQ_HANDOFF_ADJ
+.Fa "struct ifnet *ifp" "struct mbuf *m" "int adjust" "int error"
+.Fc
+.\"
+.Ss Dequeue macros
+.Fn IFQ_DEQUEUE "struct ifaltq *ifq" "struct mbuf *m"
+.Fn IFQ_POLL_NOLOCK "struct ifaltq *ifq" "struct mbuf *m"
+.Fn IFQ_PURGE "struct ifaltq *ifq"
+.Fn IFQ_IS_EMPTY "struct ifaltq *ifq"
+.\"
+.Ss Driver managed dequeue macros
+.Fn IFQ_DRV_DEQUEUE "struct ifaltq *ifq" "struct mbuf *m"
+.Fn IFQ_DRV_PREPEND "struct ifaltq *ifq" "struct mbuf *m"
+.Fn IFQ_DRV_PURGE "struct ifaltq *ifq"
+.Fn IFQ_DRV_IS_EMPTY "struct ifaltq *ifq"
+.\"
+.Ss General setup macros
+.Fn IFQ_SET_MAXLEN "struct ifaltq *ifq" "int len"
+.Fn IFQ_INC_LEN "struct ifaltq *ifq"
+.Fn IFQ_DEC_LEN "struct ifaltq *ifq"
+.Fn IFQ_INC_DROPS "struct ifaltq *ifq"
+.Fn IFQ_SET_READY "struct ifaltq *ifq"
+.Sh DESCRIPTION
+The
+.Nm
+system is a framework to manage queuing disciplines on network
+interfaces.
+.Nm
+introduces new macros to manipulate output queues.
+The output queue macros are used to abstract queue operations and not to
+touch the internal fields of the output queue structure.
+The macros are independent from the
+.Nm
+implementation, and compatible with the traditional
+.Vt ifqueue
+macros for ease of transition.
+.Pp
+.Fn IFQ_ENQUEUE ,
+.Fn IFQ_HANDOFF
+and
+.Fn IFQ_HANDOFF_ADJ
+enqueue a packet
+.Fa m
+to the queue
+.Fa ifq .
+The underlying queuing discipline may discard the packet.
+The
+.Fa error
+argument is set to 0 on success, or
+.Er ENOBUFS
+if the packet is discarded.
+The packet pointed to by
+.Fa m
+will be freed by the device driver on success, or by the queuing discipline on
+failure, so the caller should not touch
+.Fa m
+after enqueuing.
+.Fn IFQ_HANDOFF
+and
+.Fn IFQ_HANDOFF_ADJ
+combine the enqueue operation with statistic generation and call
+.Fn if_start
+upon successful enqueue to initiate the actual send.
+.Pp
+.Fn IFQ_DEQUEUE
+dequeues a packet from the queue.
+The dequeued packet is returned in
+.Fa m ,
+or
+.Fa m
+is set to
+.Dv NULL
+if no packet is dequeued.
+The caller must always check
+.Fa m
+since a non-empty queue could return
+.Dv NULL
+under rate-limiting.
+.Pp
+.Fn IFQ_POLL_NOLOCK
+returns the next packet without removing it from the queue.
+The caller must hold the queue mutex when calling
+.Fn IFQ_POLL_NOLOCK
+in order to guarantee that a subsequent call to
+.Fn IFQ_DEQUEUE_NOLOCK
+dequeues the same packet.
+.Pp
+.Fn IFQ_*_NOLOCK
+variants (if available) always assume that the caller holds the queue mutex.
+They can be grabbed with
+.Fn IFQ_LOCK
+and released with
+.Fn IFQ_UNLOCK .
+.Pp
+.Fn IFQ_PURGE
+discards all the packets in the queue.
+The purge operation is needed since a non-work conserving queue cannot be
+emptied by a dequeue loop.
+.Pp
+.Fn IFQ_IS_EMPTY
+can be used to check if the queue is empty.
+Note that
+.Fn IFQ_DEQUEUE
+could still return
+.Dv NULL
+if the queuing discipline is non-work conserving.
+.Pp
+.Fn IFQ_DRV_DEQUEUE
+moves up to
+.Fa ifq->ifq_drv_maxlen
+packets from the queue to the
+.Dq "driver managed"
+queue and returns the first one via
+.Fa m .
+As for
+.Fn IFQ_DEQUEUE ,
+.Fa m
+can be
+.Dv NULL
+even for a non-empty queue.
+Subsequent calls to
+.Fn IFQ_DRV_DEQUEUE
+pass the packets from the
+.Dq "driver managed"
+queue without obtaining the queue mutex.
+It is the responsibility of the caller to protect against concurrent access.
+Enabling
+.Nm
+for a given queue sets
+.Va ifq_drv_maxlen
+to 0 as the
+.Dq "bulk dequeue"
+performed by
+.Fn IFQ_DRV_DEQUEUE
+for higher values of
+.Va ifq_drv_maxlen
+is adverse to
+.Nm ALTQ Ns 's
+internal timing.
+Note that a driver must not mix
+.Fn IFQ_DRV_*
+macros with the default dequeue macros as the default macros do not look at the
+.Dq "driver managed"
+queue which might lead to an mbuf leak.
+.Pp
+.Fn IFQ_DRV_PREPEND
+prepends
+.Fa m
+to the
+.Dq "driver managed"
+queue from where it will be obtained with the next call to
+.Fn IFQ_DRV_DEQUEUE .
+.Pp
+.Fn IFQ_DRV_PURGE
+flushes all packets in the
+.Dq "driver managed"
+queue and calls to
+.Fn IFQ_PURGE
+afterwards.
+.Pp
+.Fn IFQ_DRV_IS_EMPTY
+checks for packets in the
+.Dq "driver managed"
+part of the queue.
+If it is empty, it forwards to
+.Fn IFQ_IS_EMPTY .
+.Pp
+.Fn IFQ_SET_MAXLEN
+sets the queue length limit to the default FIFO queue.
+The
+.Va ifq_drv_maxlen
+member of the
+.Vt ifaltq
+structure controls the length limit of the
+.Dq "driver managed"
+queue.
+.Pp
+.Fn IFQ_INC_LEN
+and
+.Fn IFQ_DEC_LEN
+increment or decrement the current queue length in packets.
+This is mostly for internal purposes.
+.Pp
+.Fn IFQ_INC_DROPS
+increments the drop counter and is identical to
+.Fn IF_DROP .
+It is defined for naming consistency only.
+.Pp
+.Fn IFQ_SET_READY
+sets a flag to indicate that a driver was converted to use the new macros.
+.Nm
+can be enabled only on interfaces with this flag.
+.Sh COMPATIBILITY
+.Ss Vt ifaltq Ss structure
+In order to keep compatibility with the existing code, the new
+output queue structure
+.Vt ifaltq
+has the same fields.
+The traditional
+.Fn IF_*
+macros and the code directly referencing the fields within
+.Va if_snd
+still work with
+.Vt ifaltq .
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ struct ifqueue { | struct ifaltq {
+ struct mbuf *ifq_head; | struct mbuf *ifq_head;
+ struct mbuf *ifq_tail; | struct mbuf *ifq_tail;
+ int ifq_len; | int ifq_len;
+ int ifq_maxlen; | int ifq_maxlen;
+ int ifq_drops; | int ifq_drops;
+ }; | /* driver queue fields */
+ | ......
+ | /* altq related fields */
+ | ......
+ | };
+ |
+.Ed
+The new structure replaces
+.Vt "struct ifqueue"
+in
+.Vt "struct ifnet" .
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ struct ifnet { | struct ifnet {
+ .... | ....
+ |
+ struct ifqueue if_snd; | struct ifaltq if_snd;
+ |
+ .... | ....
+ }; | };
+ |
+.Ed
+The (simplified) new
+.Fn IFQ_*
+macros look like:
+.Bd -literal
+ #define IFQ_DEQUEUE(ifq, m) \e
+ if (ALTQ_IS_ENABLED((ifq)) \e
+ ALTQ_DEQUEUE((ifq), (m)); \e
+ else \e
+ IF_DEQUEUE((ifq), (m));
+.Ed
+.Ss Enqueue operation
+The semantics of the enqueue operation is changed.
+In the new style,
+enqueue and packet drop are combined since they cannot be easily
+separated in many queuing disciplines.
+The new enqueue operation corresponds to the following macro that is
+written with the old macros.
+.Bd -literal
+#define IFQ_ENQUEUE(ifq, m, error) \e
+do { \e
+ if (IF_QFULL((ifq))) { \e
+ m_freem((m)); \e
+ (error) = ENOBUFS; \e
+ IF_DROP(ifq); \e
+ } else { \e
+ IF_ENQUEUE((ifq), (m)); \e
+ (error) = 0; \e
+ } \e
+} while (0)
+.Ed
+.Pp
+.Fn IFQ_ENQUEUE
+does the following:
+.Pp
+.Bl -hyphen -compact
+.It
+queue a packet,
+.It
+drop (and free) a packet if the enqueue operation fails.
+.El
+.Pp
+If the enqueue operation fails,
+.Fa error
+is set to
+.Er ENOBUFS .
+The
+.Fa m
+mbuf is freed by the queuing discipline.
+The caller should not touch mbuf after calling
+.Fn IFQ_ENQUEUE
+so that the caller may need to copy
+.Va m_pkthdr.len
+or
+.Va m_flags
+field beforehand for statistics.
+.Fn IFQ_HANDOFF
+and
+.Fn IFQ_HANDOFF_ADJ
+can be used if only default interface statistics and an immediate call to
+.Fn if_start
+are desired.
+The caller should not use
+.Fn senderr
+since mbuf was already freed.
+.Pp
+The new style
+.Fn if_output
+looks as follows:
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ int | int
+ ether_output(ifp, m0, dst, rt0) | ether_output(ifp, m0, dst, rt0)
+ { | {
+ ...... | ......
+ |
+ | mflags = m->m_flags;
+ | len = m->m_pkthdr.len;
+ s = splimp(); | s = splimp();
+ if (IF_QFULL(&ifp->if_snd)) { | IFQ_ENQUEUE(&ifp->if_snd, m,
+ | error);
+ IF_DROP(&ifp->if_snd); | if (error != 0) {
+ splx(s); | splx(s);
+ senderr(ENOBUFS); | return (error);
+ } | }
+ IF_ENQUEUE(&ifp->if_snd, m); |
+ ifp->if_obytes += | ifp->if_obytes += len;
+ m->m_pkthdr.len; |
+ if (m->m_flags & M_MCAST) | if (mflags & M_MCAST)
+ ifp->if_omcasts++; | ifp->if_omcasts++;
+ |
+ if ((ifp->if_flags & IFF_OACTIVE) | if ((ifp->if_flags & IFF_OACTIVE)
+ == 0) | == 0)
+ (*ifp->if_start)(ifp); | (*ifp->if_start)(ifp);
+ splx(s); | splx(s);
+ return (error); | return (error);
+ |
+ bad: | bad:
+ if (m) | if (m)
+ m_freem(m); | m_freem(m);
+ return (error); | return (error);
+ } | }
+ |
+.Ed
+.Sh HOW TO CONVERT THE EXISTING DRIVERS
+First, make sure the corresponding
+.Fn if_output
+is already converted to the new style.
+.Pp
+Look for
+.Va if_snd
+in the driver.
+Probably, you need to make changes to the lines that include
+.Va if_snd .
+.Ss Empty check operation
+If the code checks
+.Va ifq_head
+to see whether the queue is empty or not, use
+.Fn IFQ_IS_EMPTY .
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ if (ifp->if_snd.ifq_head != NULL) | if (!IFQ_IS_EMPTY(&ifp->if_snd))
+ |
+.Ed
+.Fn IFQ_IS_EMPTY
+only checks if there is any packet stored in the queue.
+Note that even when
+.Fn IFQ_IS_EMPTY
+is
+.Dv FALSE ,
+.Fn IFQ_DEQUEUE
+could still return
+.Dv NULL
+if the queue is under rate-limiting.
+.Ss Dequeue operation
+Replace
+.Fn IF_DEQUEUE
+by
+.Fn IFQ_DEQUEUE .
+Always check whether the dequeued mbuf is
+.Dv NULL
+or not.
+Note that even when
+.Fn IFQ_IS_EMPTY
+is
+.Dv FALSE ,
+.Fn IFQ_DEQUEUE
+could return
+.Dv NULL
+due to rate-limiting.
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ IF_DEQUEUE(&ifp->if_snd, m); | IFQ_DEQUEUE(&ifp->if_snd, m);
+ | if (m == NULL)
+ | return;
+ |
+.Ed
+A driver is supposed to call
+.Fn if_start
+from transmission complete interrupts in order to trigger the next dequeue.
+.Ss Poll-and-dequeue operation
+If the code polls the packet at the head of the queue and actually uses
+the packet before dequeuing it, use
+.Fn IFQ_POLL_NOLOCK
+and
+.Fn IFQ_DEQUEUE_NOLOCK .
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ | IFQ_LOCK(&ifp->if_snd);
+ m = ifp->if_snd.ifq_head; | IFQ_POLL_NOLOCK(&ifp->if_snd, m);
+ if (m != NULL) { | if (m != NULL) {
+ |
+ /* use m to get resources */ | /* use m to get resources */
+ if (something goes wrong) | if (something goes wrong)
+ | IFQ_UNLOCK(&ifp->if_snd);
+ return; | return;
+ |
+ IF_DEQUEUE(&ifp->if_snd, m); | IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m);
+ | IFQ_UNLOCK(&ifp->if_snd);
+ |
+ /* kick the hardware */ | /* kick the hardware */
+ } | }
+ |
+.Ed
+It is guaranteed that
+.Fn IFQ_DEQUEUE_NOLOCK
+under the same lock as a previous
+.Fn IFQ_POLL_NOLOCK
+returns the same packet.
+Note that they need to be guarded by
+.Fn IFQ_LOCK .
+.Ss Eliminating Fn IF_PREPEND
+If the code uses
+.Fn IF_PREPEND ,
+you have to eliminate it unless you can use a
+.Dq "driver managed"
+queue which allows the use of
+.Fn IFQ_DRV_PREPEND
+as a substitute.
+A common usage of
+.Fn IF_PREPEND
+is to cancel the previous dequeue operation.
+You have to convert the logic into poll-and-dequeue.
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ | IFQ_LOCK(&ifp->if_snd);
+ IF_DEQUEUE(&ifp->if_snd, m); | IFQ_POLL_NOLOCK(&ifp->if_snd, m);
+ if (m != NULL) { | if (m != NULL) {
+ |
+ if (something_goes_wrong) { | if (something_goes_wrong) {
+ IF_PREPEND(&ifp->if_snd, m); | IFQ_UNLOCK(&ifp->if_snd);
+ return; | return;
+ } | }
+ |
+ | /* at this point, the driver
+ | * is committed to send this
+ | * packet.
+ | */
+ | IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m);
+ | IFQ_UNLOCK(&ifp->if_snd);
+ |
+ /* kick the hardware */ | /* kick the hardware */
+ } | }
+ |
+.Ed
+.Ss Purge operation
+Use
+.Fn IFQ_PURGE
+to empty the queue.
+Note that a non-work conserving queue cannot be emptied by a dequeue loop.
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ while (ifp->if_snd.ifq_head != NULL) {| IFQ_PURGE(&ifp->if_snd);
+ IF_DEQUEUE(&ifp->if_snd, m); |
+ m_freem(m); |
+ } |
+ |
+.Ed
+.Ss Conversion using a driver managed queue
+Convert
+.Fn IF_*
+macros to their equivalent
+.Fn IFQ_DRV_*
+and employ
+.Fn IFQ_DRV_IS_EMPTY
+where appropriate.
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ if (ifp->if_snd.ifq_head != NULL) | if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+ |
+.Ed
+Make sure that calls to
+.Fn IFQ_DRV_DEQUEUE ,
+.Fn IFQ_DRV_PREPEND
+and
+.Fn IFQ_DRV_PURGE
+are protected with a mutex of some kind.
+.Ss Attach routine
+Use
+.Fn IFQ_SET_MAXLEN
+to set
+.Va ifq_maxlen
+to
+.Fa len .
+Initialize
+.Va ifq_drv_maxlen
+with a sensible value if you plan to use the
+.Fn IFQ_DRV_*
+macros.
+Add
+.Fn IFQ_SET_READY
+to show this driver is converted to the new style.
+(This is used to distinguish new-style drivers.)
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ ifp->if_snd.ifq_maxlen = qsize; | IFQ_SET_MAXLEN(&ifp->if_snd, qsize);
+ | ifp->if_snd.ifq_drv_maxlen = qsize;
+ | IFQ_SET_READY(&ifp->if_snd);
+ if_attach(ifp); | if_attach(ifp);
+ |
+.Ed
+.Ss Other issues
+The new macros for statistics:
+.Bd -literal
+ ##old-style## ##new-style##
+ |
+ IF_DROP(&ifp->if_snd); | IFQ_INC_DROPS(&ifp->if_snd);
+ |
+ ifp->if_snd.ifq_len++; | IFQ_INC_LEN(&ifp->if_snd);
+ |
+ ifp->if_snd.ifq_len--; | IFQ_DEC_LEN(&ifp->if_snd);
+ |
+.Ed
+.Sh QUEUING DISCIPLINES
+Queuing disciplines need to maintain
+.Fa ifq_len
+(used by
+.Fn IFQ_IS_EMPTY ) .
+Queuing disciplines also need to guarantee that the same mbuf is returned if
+.Fn IFQ_DEQUEUE
+is called immediately after
+.Fn IFQ_POLL .
+.Sh SEE ALSO
+.Xr pf 4 ,
+.Xr pf.conf 5 ,
+.Xr pfctl 8
+.Sh HISTORY
+The
+.Nm
+system first appeared in March 1997.
diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9
new file mode 100644
index 000000000000..0baac4557002
--- /dev/null
+++ b/share/man/man9/atomic.9
@@ -0,0 +1,356 @@
+.\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 27, 2005
+.Dt ATOMIC 9
+.Os
+.Sh NAME
+.Nm atomic_add ,
+.Nm atomic_clear ,
+.Nm atomic_cmpset ,
+.Nm atomic_fetchadd ,
+.Nm atomic_load ,
+.Nm atomic_readandclear ,
+.Nm atomic_set ,
+.Nm atomic_subtract ,
+.Nm atomic_store
+.Nd atomic operations
+.Sh SYNOPSIS
+.In sys/types.h
+.In machine/atomic.h
+.Ft void
+.Fn atomic_add_[acq_|rel_]<type> "volatile <type> *p" "<type> v"
+.Ft void
+.Fn atomic_clear_[acq_|rel_]<type> "volatile <type> *p" "<type> v"
+.Ft int
+.Fo atomic_cmpset_[acq_|rel_]<type>
+.Fa "volatile <type> *dst"
+.Fa "<type> old"
+.Fa "<type> new"
+.Fc
+.Ft <type>
+.Fn atomic_fetchadd_<type> "volatile <type> *p" "<type> v"
+.Ft <type>
+.Fn atomic_load_acq_<type> "volatile <type> *p"
+.Ft <type>
+.Fn atomic_readandclear_<type> "volatile <type> *p"
+.Ft void
+.Fn atomic_set_[acq_|rel_]<type> "volatile <type> *p" "<type> v"
+.Ft void
+.Fn atomic_subtract_[acq_|rel_]<type> "volatile <type> *p" "<type> v"
+.Ft void
+.Fn atomic_store_rel_<type> "volatile <type> *p" "<type> v"
+.Sh DESCRIPTION
+Each of the atomic operations is guaranteed to be atomic in the presence of
+interrupts.
+They can be used to implement reference counts or as building blocks for more
+advanced synchronization primitives such as mutexes.
+.Ss Types
+Each atomic operation operates on a specific
+.Fa type .
+The type to use is indicated in the function name.
+The available types that can be used are:
+.Pp
+.Bl -tag -offset indent -width short -compact
+.It Li int
+unsigned integer
+.It Li long
+unsigned long integer
+.It Li ptr
+unsigned integer the size of a pointer
+.It Li 32
+unsigned 32-bit integer
+.It Li 64
+unsigned 64-bit integer
+.El
+.Pp
+For example, the function to atomically add two integers is called
+.Fn atomic_add_int .
+.Pp
+Certain architectures also provide operations for types smaller than
+.Dq Li int .
+.Pp
+.Bl -tag -offset indent -width short -compact
+.It Li char
+unsigned character
+.It Li short
+unsigned short integer
+.It Li 8
+unsigned 8-bit integer
+.It Li 16
+unsigned 16-bit integer
+.El
+.Pp
+These must not be used in MI code because the instructions to implement them
+efficiently may not be available.
+.Ss Memory Barriers
+Memory barriers are used to guarantee the order of data accesses in
+two ways.
+First, they specify hints to the compiler to not re-order or optimize the
+operations.
+Second, on architectures that do not guarantee ordered data accesses,
+special instructions or special variants of instructions are used to indicate
+to the processor that data accesses need to occur in a certain order.
+As a result, most of the atomic operations have three variants in order to
+include optional memory barriers.
+The first form just performs the operation without any explicit barriers.
+The second form uses a read memory barrier, and the third variant uses a write
+memory barrier.
+.Pp
+The second variant of each operation includes a read memory barrier.
+This barrier ensures that the effects of this operation are completed before the
+effects of any later data accesses.
+As a result, the operation is said to have acquire semantics as it acquires a
+pseudo-lock requiring further operations to wait until it has completed.
+To denote this, the suffix
+.Dq Li _acq
+is inserted into the function name immediately prior to the
+.Dq Li _ Ns Aq Fa type
+suffix.
+For example, to subtract two integers ensuring that any later writes will
+happen after the subtraction is performed, use
+.Fn atomic_subtract_acq_int .
+.Pp
+The third variant of each operation includes a write memory barrier.
+This ensures that all effects of all previous data accesses are completed
+before this operation takes place.
+As a result, the operation is said to have release semantics as it releases
+any pending data accesses to be completed before its operation is performed.
+To denote this, the suffix
+.Dq Li _rel
+is inserted into the function name immediately prior to the
+.Dq Li _ Ns Aq Fa type
+suffix.
+For example, to add two long integers ensuring that all previous
+writes will happen first, use
+.Fn atomic_add_rel_long .
+.Pp
+A practical example of using memory barriers is to ensure that data accesses
+that are protected by a lock are all performed while the lock is held.
+To achieve this, one would use a read barrier when acquiring the lock to
+guarantee that the lock is held before any protected operations are performed.
+Finally, one would use a write barrier when releasing the lock to ensure that
+all of the protected operations are completed before the lock is released.
+.Ss Multiple Processors
+The current set of atomic operations do not necessarily guarantee atomicity
+across multiple processors.
+To guarantee atomicity across processors, not only does the individual
+operation need to be atomic on the processor performing the operation, but
+the result of the operation needs to be pushed out to stable storage and the
+caches of all other processors on the system need to invalidate any cache
+lines that include the affected memory region.
+On the
+.Tn i386
+architecture, the cache coherency model requires that the hardware perform
+this task, thus the atomic operations are atomic across multiple processors.
+On the
+.Tn ia64
+architecture, coherency is only guaranteed for pages that are configured to
+using a caching policy of either uncached or write back.
+.Ss Semantics
+This section describes the semantics of each operation using a C like notation.
+.Bl -hang
+.It Fn atomic_add p v
+.Bd -literal -compact
+*p += v;
+.Ed
+.It Fn atomic_clear p v
+.Bd -literal -compact
+*p &= ~v;
+.Ed
+.It Fn atomic_cmpset dst old new
+.Bd -literal -compact
+if (*dst == old) {
+ *dst = new;
+ return 1;
+} else
+ return 0;
+.Ed
+.El
+.Pp
+The
+.Fn atomic_cmpset
+functions are not implemented for the types
+.Dq Li char ,
+.Dq Li short ,
+.Dq Li 8 ,
+and
+.Dq Li 16 .
+.Bl -hang
+.It Fn atomic_fetchadd p v
+.Bd -literal -compact
+tmp = *p;
+*p += v;
+return tmp;
+.Ed
+.El
+.Pp
+The
+.Fn atomic_fetchadd
+functions are only implemented for the types
+.Dq Li int ,
+.Dq Li long
+and
+.Dq Li 32
+and do not have any variants with memory barriers at this time.
+.Bl -hang
+.It Fn atomic_load addr
+.Bd -literal -compact
+return (*addr)
+.Ed
+.El
+.Pp
+The
+.Fn atomic_load
+functions are only provided with acquire memory barriers.
+.Bl -hang
+.It Fn atomic_readandclear addr
+.Bd -literal -compact
+temp = *addr;
+*addr = 0;
+return (temp);
+.Ed
+.El
+.Pp
+The
+.Fn atomic_readandclear
+functions are not implemented for the types
+.Dq Li char ,
+.Dq Li short ,
+.Dq Li ptr ,
+.Dq Li 8 ,
+and
+.Dq Li 16
+and do
+not have any variants with memory barriers at this time.
+.Bl -hang
+.It Fn atomic_set p v
+.Bd -literal -compact
+*p |= v;
+.Ed
+.It Fn atomic_subtract p v
+.Bd -literal -compact
+*p -= v;
+.Ed
+.It Fn atomic_store p v
+.Bd -literal -compact
+*p = v;
+.Ed
+.El
+.Pp
+The
+.Fn atomic_store
+functions are only provided with release memory barriers.
+.Pp
+The type
+.Dq Li 64
+is currently not implemented for any of the atomic operations on the
+.Tn arm ,
+.Tn i386 ,
+and
+.Tn powerpc
+architectures.
+.Sh RETURN VALUES
+The
+.Fn atomic_cmpset
+function
+returns the result of the compare operation.
+The
+.Fn atomic_fetchadd ,
+.Fn atomic_load ,
+and
+.Fn atomic_readandclear
+functions
+return the value at the specified address.
+.Sh EXAMPLES
+This example uses the
+.Fn atomic_cmpset_acq_ptr
+and
+.Fn atomic_set_ptr
+functions to obtain a sleep mutex and handle recursion.
+Since the
+.Va mtx_lock
+member of a
+.Vt "struct mtx"
+is a pointer, the
+.Dq Li ptr
+type is used.
+.Bd -literal
+/* Try to obtain mtx_lock once. */
+#define _obtain_lock(mp, tid) \\
+ atomic_cmpset_acq_ptr(&(mp)->mtx_lock, MTX_UNOWNED, (tid))
+
+/* Get a sleep lock, deal with recursion inline. */
+#define _get_sleep_lock(mp, tid, opts, file, line) do { \\
+ uintptr_t _tid = (uintptr_t)(tid); \\
+ \\
+ if (!_obtain_lock(mp, tid)) { \\
+ if (((mp)->mtx_lock & MTX_FLAGMASK) != _tid) \\
+ _mtx_lock_sleep((mp), _tid, (opts), (file), (line));\\
+ else { \\
+ atomic_set_ptr(&(mp)->mtx_lock, MTX_RECURSE); \\
+ (mp)->mtx_recurse++; \\
+ } \\
+ } \\
+} while (0)
+.Ed
+.Sh HISTORY
+The
+.Fn atomic_add ,
+.Fn atomic_clear ,
+.Fn atomic_set ,
+and
+.Fn atomic_subtract
+operations were first introduced in
+.Fx 3.0 .
+This first set only supported the types
+.Dq Li char ,
+.Dq Li short ,
+.Dq Li int ,
+and
+.Dq Li long .
+The
+.Fn atomic_cmpset ,
+.Fn atomic_load ,
+.Fn atomic_readandclear ,
+and
+.Fn atomic_store
+operations were added in
+.Fx 5.0 .
+The types
+.Dq Li 8 ,
+.Dq Li 16 ,
+.Dq Li 32 ,
+.Dq Li 64 ,
+and
+.Dq Li ptr
+and all of the acquire and release variants
+were added in
+.Fx 5.0
+as well.
+The
+.Fn atomic_fetchadd
+operations were added in
+.Fx 6.0 .
diff --git a/share/man/man9/bios.9 b/share/man/man9/bios.9
new file mode 100644
index 000000000000..48bbe16c0fcf
--- /dev/null
+++ b/share/man/man9/bios.9
@@ -0,0 +1,182 @@
+.\" $FreeBSD$
+.\"
+.\" Copyright (c) 1997 Michael Smith
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd August 9, 2005
+.Dt BIOS 9
+.Os
+.Sh NAME
+.Nm bios_sigsearch ,
+.Nm bios32_SDlookup ,
+.Nm bios32 ,
+.Nm bios_oem_strings
+.Nd interact with PC BIOS
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.In machine/param.h
+.In machine/pmap.h
+.In machine/pc/bios.h
+.Ft uint32_t
+.Fn bios_sigsearch "uint32_t start" "u_char *sig" "int siglen" "int paralen" "int sigofs"
+.Ft int
+.Fn bios32_SDlookup "struct bios32_SDentry *ent"
+.Ft int
+.Fn bios32 "struct bios_regs *br" "u_int offset" "u_short segment"
+.Fn BIOS_PADDRTOVADDR "addr"
+.Fn BIOS_VADDRTOPADDR "addr"
+.Vt extern struct bios32_SDentry PCIbios ;
+.Vt extern struct SMBIOS_table SMBIOStable ;
+.Vt extern struct DMI_table DMItable ;
+.Ft int
+.Fn bios_oem_strings "struct bios_oem *oem" "u_char *buffer" "size_t maxlen"
+.Bd -literal
+struct bios_oem_signature {
+ char * anchor; /* search anchor string in BIOS memory */
+ size_t offset; /* offset from anchor (may be negative) */
+ size_t totlen; /* total length of BIOS string to copy */
+};
+struct bios_oem_range {
+ u_int from; /* shouldn't be below 0xe0000 */
+ u_int to; /* shouldn't be above 0xfffff */
+};
+struct bios_oem {
+ struct bios_oem_range range;
+ struct bios_oem_signature signature[];
+};
+.Ed
+.Sh DESCRIPTION
+These functions provide a general-purpose interface for dealing with
+the BIOS functions and data encountered on x86 PC-architecture systems.
+.Bl -tag -width 20n
+.It Fn bios_sigsearch
+Searches the BIOS address space for a service signature, usually an
+uppercase ASCII sequence surrounded by underscores.
+The search begins at
+.Fa start ,
+or at the beginning of the BIOS if
+.Fa start
+is zero.
+.Fa siglen
+bytes of the BIOS image and
+.Fa sig
+are compared at
+.Fa sigofs
+bytes offset from the current location.
+If no match is found, the
+current location is incremented by
+.Fa paralen
+bytes and the search repeated.
+If the signature is found, its effective
+physical address is returned.
+If no signature is found, zero is returned.
+.It Fn bios_oem_strings
+Searches a given BIOS memory range for one or more strings,
+and composes a printable concatenation of those found.
+The routine expects a structure describing the BIOS address
+.Fa range
+(within
+.Li 0xe0000
+-
+.Li 0xfffff ) ,
+and a {
+.Dv NULL , Li 0 , 0
+} -terminated array of
+.Vt bios_oem_signature
+structures which define the
+.Va anchor
+string, an
+.Va offset
+from the beginning of the match (which may be negative), and
+.Va totlen
+number of bytes to be collected from BIOS memory starting at that offset.
+Unmatched anchors are ignored, whereas matches are copied from BIOS memory
+starting at their corresponding
+.Vt offset
+with unprintable characters being replaced with space, and consecutive spaces
+being suppressed.
+This composed string is stored in
+.Fa buffer
+up to the given
+.Fa maxlen
+bytes (including trailing
+.Ql \e0 ,
+and any trailing space suppressed).
+If an error is encountered, i.e.\& trying to read out of said BIOS range,
+other invalid input, or
+.Fa buffer
+overflow, a negative integer is returned, otherwise the
+length of the composed string is returned.
+In particular, a return
+value of 0 means that none of the given anchor strings were found in
+the specified BIOS memory range.
+.It Fn BIOS_VADDRTOPADDR
+Returns the effective physical address which corresponds to the kernel
+virtual address
+.Fa addr .
+.It Fn BIOS_PADDRTOVADDR
+Returns the kernel virtual address which corresponds to the effective
+physical address
+.Fa addr .
+.It SMBIOStable
+If not NULL, points to a
+.Ft struct SMBIOS_table
+structure containing information read from the System Management BIOS table
+during system startup.
+.It DMItable
+If not NULL, points to a
+.Ft struct DMI_table
+structure containing information read from the Desktop Management Interface
+parameter table during system startup.
+.El
+.Sh BIOS32
+At system startup, the BIOS is scanned for the BIOS32 Service Directory
+(part of the PCI specification), and the existence of the directory is
+recorded.
+This can then be used to locate other services.
+.Bl -tag -width 20n
+.It Fn bios32_SDlookup
+Attempts to locate the BIOS32 service matching the 4-byte identifier
+passed in the
+.Fa ident
+field of the
+.Fa ent
+argument.
+.It Fn bios32
+Calls a bios32 function.
+This presumes that the function is capable of
+working within the kernel segment (normally the case).
+The virtual address
+of the entrypoint is supplied in
+.Fa entry
+and the register arguments to the function are supplied in
+.Fa args .
+.It PCIbios
+If not NULL, points to a
+.Ft struct bios32_SDentry
+structure describing the PCI BIOS entrypoint which was found during system
+startup.
+.El
diff --git a/share/man/man9/boot.9 b/share/man/man9/boot.9
new file mode 100644
index 000000000000..cbd0099e4e18
--- /dev/null
+++ b/share/man/man9/boot.9
@@ -0,0 +1,100 @@
+.\" $NetBSD: boot.9,v 1.2 1996/09/24 07:01:26 ghudson Exp $
+.\"
+.\" Copyright (c) 1997
+.\" Mike Pritchard. All rights reserved.
+.\"
+.\" Copyright (c) 1994 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christopher G. Demetriou
+.\" for the NetBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 14, 1997
+.Dt BOOT 9
+.Os
+.Sh NAME
+.Nm boot
+.Nd halt or reboot the system
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.In sys/reboot.h
+.Ft void
+.Fn boot "int howto"
+.Sh DESCRIPTION
+The
+.Fn boot
+function handles final system shutdown, and either halts or reboots
+the system.
+The exact action to be taken is determined by the flags passed in
+.Fa howto
+and by whether or not the system has finished autoconfiguration.
+.Pp
+If the system has finished autoconfiguration,
+.Fn boot
+does the following:
+.Bl -enum -offset indent
+.It
+If this is the first invocation of
+.Fn boot
+and the
+.Dv RB_NOSYNC
+flag is not set in
+.Fa howto ,
+syncs and unmounts the system disks by calling
+.Xr vfs_unmountall 9 .
+.It
+Disables interrupts.
+.It
+If rebooting after a crash (i.e., if
+.Dv RB_DUMP
+is set in
+.Fa howto ,
+but
+.Dv RB_HALT
+is not), saves a system crash dump.
+.It
+Runs any shutdown hooks previously registered.
+.It
+Prints a message indicating that the system is about to be halted
+or rebooted.
+.It
+If
+.Dv RB_HALT
+is set in
+.Fa howto ,
+halts the system.
+Otherwise, reboots the system.
+.El
+.Pp
+If the system has not finished autoconfiguration,
+.Fn boot
+runs any shutdown hooks previously registered,
+prints a message, and halts the system.
+.Sh SEE ALSO
+.Xr vfs_unmountall 9
diff --git a/share/man/man9/bpf.9 b/share/man/man9/bpf.9
new file mode 100644
index 000000000000..5a3ac07ad270
--- /dev/null
+++ b/share/man/man9/bpf.9
@@ -0,0 +1,279 @@
+.\" Copyright (c) 2004 FreeBSD Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 13, 2006
+.Dt BPF 9
+.Os
+.\"
+.Sh NAME
+.Nm bpf
+.Nd "Berkeley Packet Filter"
+.\"
+.Sh SYNOPSIS
+.In net/bpf.h
+.\"
+.Ft void
+.Fn bpfattach "struct ifnet *ifp" "u_int dlt" "u_int hdrlen"
+.Ft void
+.Fo bpfattach2
+.Fa "struct ifnet *ifp" "u_int dlt" "u_int hdrlen" "struct bpf_if **driverp"
+.Fc
+.Ft void
+.Fn bpfdetach "struct ifnet *ifp"
+.Ft void
+.Fn bpf_tap "struct ifnet *ifp" "u_char *pkt" "u_int *pktlen"
+.Ft void
+.Fn bpf_mtap "struct ifnet *ifp" "struct mbuf *m"
+.Ft void
+.Fn bpf_mtap2 "struct bpf_if *bp" "void *data" "u_int dlen" "struct mbuf *m"
+.Ft u_int
+.Fo bpf_filter
+.Fa "const struct bpf_insn *pc " "u_char *pkt" "u_int wirelen" "u_int buflen"
+.Fc
+.Ft int
+.Fn bpf_validate "const struct bpf_insn *fcode" "int flen"
+.\"
+.Sh DESCRIPTION
+The Berkeley Packet Filter provides a raw interface,
+that is protocol independent,
+to data link layers.
+It allows all packets on the network,
+even those destined for other hosts,
+to be passed from a network interface to user programs.
+Each program may specify a filter,
+in the form of a
+.Nm
+filter machine program.
+The
+.Xr bpf 4
+manual page
+describes the interface used by user programs.
+This manual page describes the functions used by interfaces to pass packets to
+.Nm
+and the functions for testing and running
+.Nm
+filter machine programs.
+.Pp
+The
+.Fn bpfattach
+function
+attaches a network interface to
+.Nm .
+The
+.Fa ifp
+argument
+is a pointer to the structure that defines the interface to be
+attached to an interface.
+The
+.Fa dlt
+argument
+is the data link-layer type:
+.Dv DLT_NULL
+(no link-layer encapsulation),
+.Dv DLT_EN10MB
+(Ethernet),
+.Dv DLT_IEEE802_11
+(802.11 wireless networks),
+etc.
+The rest of the link layer types can be found in
+.In net/bpf.h .
+The
+.Fa hdrlen
+argument
+is the fixed size of the link header;
+variable length headers are not yet supported.
+The
+.Nm
+system will hold a pointer to
+.Fa ifp->if_bpf .
+This variable will set to a
+.Pf non- Dv NULL
+value when
+.Nm
+requires packets from this interface to be tapped using the functions below.
+.Pp
+The
+.Fn bpfattach2
+function
+allows multiple
+.Nm
+instances to be attached to a single interface,
+by registering an explicit
+.Fa if_bpf
+rather than using
+.Fa ifp->if_bpf .
+It is then possible to run
+.Xr tcpdump 1
+on the interface for any data link-layer types attached.
+.Pp
+The
+.Fn bpfdetach
+function detaches a
+.Nm
+instance from an interface,
+specified by
+.Fa ifp .
+The
+.Fn bpfdetach
+function
+should be called once for each
+.Nm
+instance attached.
+.Pp
+The
+.Fn bpf_tap
+function
+is used by an interface to pass the packet to
+.Nm .
+The packet data (including link-header),
+pointed to by
+.Fa pkt ,
+is of length
+.Fa pktlen ,
+which must be a contiguous buffer.
+The
+.Fa ifp
+argument
+is a pointer to the structure that defines the interface to be tapped.
+The packet is parsed by each processes filter,
+and if accepted,
+it is buffered for the process to read.
+.Pp
+The
+.Fn bpf_mtap
+function is like
+.Fn bpf_tap
+except that it is used to tap packets that are in an
+.Vt mbuf
+chain,
+.Fa m .
+The
+.Fa ifp
+argument
+is a pointer to the structure that defines the interface to be tapped.
+Like
+.Fn bpf_tap ,
+.Fn bpf_mtap
+requires a link-header for whatever data link layer type is specified.
+Note that
+.Nm
+only reads from the
+.Vt mbuf
+chain,
+it does not free it or keep a pointer to it.
+This means that an
+.Vt mbuf
+containing the link-header
+can be prepended to the chain if necessary.
+A cleaner interface to achieve this is provided by
+.Fn bpf_mtap2 .
+.Pp
+The
+.Fn bpf_mtap2
+function
+allows the user to pass a link-header
+.Fa data ,
+of length
+.Fa dlen ,
+independent of the
+.Vt mbuf
+.Fa m ,
+containing the packet.
+This simplifies the passing of some link-headers.
+.Pp
+The
+.Fn bpf_filter
+function
+executes the filter program starting at
+.Fa pc
+on the packet
+.Fa pkt .
+The
+.Fa wirelen
+argument
+is the length of the original packet and
+.Fa buflen
+is the amount of data present.
+The
+.Fa buflen
+value of 0 is special; it indicates that the
+.Fa pkt
+is actually a pointer to an mbuf chain
+.Pq Vt "struct mbuf *" .
+.Pp
+The
+.Fn bpf_validate
+function
+checks that the filter code
+.Fa fcode ,
+of length
+.Fa flen ,
+is valid.
+.\"
+.Sh RETURN VALUES
+The
+.Fn bpf_filter
+function returns \-1
+(cast to an unsigned integer)
+if there is no filter.
+Otherwise, it returns the result of the filter program.
+.Pp
+The
+.Fn bpf_validate
+function
+returns 0 when the program is not a valid filter program.
+.\"
+.Sh SEE ALSO
+.Xr tcpdump 1 ,
+.Xr bpf 4
+.\"
+.Sh HISTORY
+The Enet packet filter was created in 1980 by Mike Accetta and
+Rick Rashid at Carnegie-Mellon University.
+Jeffrey Mogul,
+at Stanford,
+ported the code to
+.Bx
+and continued its development from 1983 on.
+Since then,
+it has evolved into the Ultrix Packet Filter at
+.Tn DEC ,
+a
+.Tn STREAMS
+.Tn NIT
+module under
+.Tn SunOS
+4.1, and
+.Tn BPF .
+.\"
+.Sh AUTHORS
+.An -nosplit
+.An Steven McCanne ,
+of Lawrence Berkeley Laboratory, implemented BPF in Summer 1990.
+Much of the design is due to
+.An Van Jacobson .
+This manpage was written by
+.An Orla McGann .
diff --git a/share/man/man9/buf.9 b/share/man/man9/buf.9
new file mode 100644
index 000000000000..cba34998b76f
--- /dev/null
+++ b/share/man/man9/buf.9
@@ -0,0 +1,150 @@
+.\" Copyright (c) 1998
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 22, 1998
+.Dt BUF 9
+.Os
+.Sh NAME
+.Nm buf
+.Nd "kernel buffer I/O scheme used in FreeBSD VM system"
+.Sh DESCRIPTION
+The kernel implements a KVM abstraction of the buffer cache which allows it
+to map potentially disparate vm_page's into contiguous KVM for use by
+(mainly file system) devices and device I/O.
+This abstraction supports
+block sizes from DEV_BSIZE (usually 512) to upwards of several pages or more.
+It also supports a relatively primitive byte-granular valid range and dirty
+range currently hardcoded for use by NFS.
+The code implementing the
+VM Buffer abstraction is mostly concentrated in
+.Pa /usr/src/sys/kern/vfs_bio.c .
+.Pp
+One of the most important things to remember when dealing with buffer pointers
+(struct buf) is that the underlying pages are mapped directly from the buffer
+cache.
+No data copying occurs in the scheme proper, though some file systems
+such as UFS do have to copy a little when dealing with file fragments.
+The second most important thing to remember is that due to the underlying page
+mapping, the b_data base pointer in a buf is always *page* aligned, not
+*block* aligned.
+When you have a VM buffer representing some b_offset and
+b_size, the actual start of the buffer is (b_data + (b_offset & PAGE_MASK))
+and not just b_data.
+Finally, the VM system's core buffer cache supports
+valid and dirty bits (m->valid, m->dirty) for pages in DEV_BSIZE chunks.
+Thus
+a platform with a hardware page size of 4096 bytes has 8 valid and 8 dirty
+bits.
+These bits are generally set and cleared in groups based on the device
+block size of the device backing the page.
+Complete page's worth are often
+referred to using the VM_PAGE_BITS_ALL bitmask (i.e., 0xFF if the hardware page
+size is 4096).
+.Pp
+VM buffers also keep track of a byte-granular dirty range and valid range.
+This feature is normally only used by the NFS subsystem.
+I am not sure why it
+is used at all, actually, since we have DEV_BSIZE valid/dirty granularity
+within the VM buffer.
+If a buffer dirty operation creates a 'hole',
+the dirty range will extend to cover the hole.
+If a buffer validation
+operation creates a 'hole' the byte-granular valid range is left alone and
+will not take into account the new extension.
+Thus the whole byte-granular
+abstraction is considered a bad hack and it would be nice if we could get rid
+of it completely.
+.Pp
+A VM buffer is capable of mapping the underlying VM cache pages into KVM in
+order to allow the kernel to directly manipulate the data associated with
+the (vnode,b_offset,b_size).
+The kernel typically unmaps VM buffers the moment
+they are no longer needed but often keeps the 'struct buf' structure
+instantiated and even bp->b_pages array instantiated despite having unmapped
+them from KVM.
+If a page making up a VM buffer is about to undergo I/O, the
+system typically unmaps it from KVM and replaces the page in the b_pages[]
+array with a place-marker called bogus_page.
+The place-marker forces any kernel
+subsystems referencing the associated struct buf to re-lookup the associated
+page.
+I believe the place-marker hack is used to allow sophisticated devices
+such as file system devices to remap underlying pages in order to deal with,
+for example, re-mapping a file fragment into a file block.
+.Pp
+VM buffers are used to track I/O operations within the kernel.
+Unfortunately,
+the I/O implementation is also somewhat of a hack because the kernel wants
+to clear the dirty bit on the underlying pages the moment it queues the I/O
+to the VFS device, not when the physical I/O is actually initiated.
+This
+can create confusion within file system devices that use delayed-writes because
+you wind up with pages marked clean that are actually still dirty.
+If not
+treated carefully, these pages could be thrown away!
+Indeed, a number of
+serious bugs related to this hack were not fixed until the 2.2.8/3.0 release.
+The kernel uses an instantiated VM buffer (i.e., struct buf) to place-mark pages
+in this special state.
+The buffer is typically flagged B_DELWRI.
+When a
+device no longer needs a buffer it typically flags it as B_RELBUF.
+Due to
+the underlying pages being marked clean, the B_DELWRI|B_RELBUF combination must
+be interpreted to mean that the buffer is still actually dirty and must be
+written to its backing store before it can actually be released.
+In the case
+where B_DELWRI is not set, the underlying dirty pages are still properly
+marked as dirty and the buffer can be completely freed without losing that
+clean/dirty state information.
+(XXX do we have to check other flags in
+regards to this situation ???)
+.Pp
+The kernel reserves a portion of its KVM space to hold VM Buffer's data
+maps.
+Even though this is virtual space (since the buffers are mapped
+from the buffer cache), we cannot make it arbitrarily large because
+instantiated VM Buffers (struct buf's) prevent their underlying pages in the
+buffer cache from being freed.
+This can complicate the life of the paging
+system.
+.\" .Sh SEE ALSO
+.\" .Xr <fillmein> 9
+.Sh HISTORY
+The
+.Nm
+manual page was originally written by
+.An Matthew Dillon
+and first appeared in
+.Fx 3.1 ,
+December 1998.
diff --git a/share/man/man9/buf_ring.9 b/share/man/man9/buf_ring.9
new file mode 100644
index 000000000000..ffade9444d8a
--- /dev/null
+++ b/share/man/man9/buf_ring.9
@@ -0,0 +1,144 @@
+.\" Copyright (c) 2009 Bitgravity Inc
+.\" Written by: Kip Macy <kmacy@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 30, 2012
+.Dt BUF_RING 9
+.Os
+.Sh NAME
+.Nm buf_ring ,
+.Nm buf_ring_alloc ,
+.Nm buf_ring_free ,
+.Nm buf_ring_enqueue ,
+.Nm buf_ring_enqueue_bytes ,
+.Nm buf_ring_dequeue_mc ,
+.Nm buf_ring_dequeue_sc ,
+.Nm buf_ring_count ,
+.Nm buf_ring_empty ,
+.Nm buf_ring_full ,
+.Nm buf_ring_peek ,
+.Nd multi-producer, {single, multi}-consumer lock-less ring buffer
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/buf_ring.h
+.Ft struct buf_ring *
+.Fn buf_ring_alloc "int count" "struct malloc_type *type" "int flags" "struct mtx *sc_lock"
+.Ft void
+.Fn buf_ring_free "struct buf_ring *br" "struct malloc_type *type"
+.Ft int
+.Fn buf_ring_enqueue "struct buf_ring *br" "void *buf"
+.Ft int
+.Fn buf_ring_enqueue_bytes "struct buf_ring *br" "void *buf" "int bytes"
+.Ft void *
+.Fn buf_ring_dequeue_mc "struct buf_ring *br"
+.Ft void *
+.Fn buf_ring_dequeue_sc "struct buf_ring *br"
+.Ft int
+.Fn buf_ring_count "struct buf_ring *br"
+.Ft int
+.Fn buf_ring_empty "struct buf_ring *br"
+.Ft int
+.Fn buf_ring_full "struct buf_ring *br"
+.Ft void *
+.Fn buf_ring_peek "struct buf_ring *br"
+.Sh DESCRIPTION
+The
+.Nm
+functions provide a lock-less multi-producer and lock-less multi-consumer as
+well as single-consumer ring buffer.
+.Pp
+The
+.Fn buf_ring_alloc
+function is used to allocate a buf_ring ring buffer with
+.Fa count
+slots using malloc_type
+.Fa type
+and memory flags
+.Fa flags .
+The single consumer interface is protected by
+.Fa sc_lock .
+.Pp
+The
+.Fn buf_ring_free
+function is used to free a buf_ring.
+The user is responsible for freeing any enqueued items.
+.Pp
+The
+.Fn buf_ring_enqueue
+function is used to enqueue a buffer to a buf_ring.
+.Pp
+The
+.Fn buf_ring_enqueue_bytes
+function is used to enqueue a buffer to a buf_ring and increment the
+number of bytes enqueued by
+.Fa bytes .
+.Pp
+The
+.Fn buf_ring_dequeue_mc
+function is a multi-consumer safe way of dequeueing elements from a buf_ring.
+.Pp
+The
+.Fn buf_ring_dequeue_sc
+function is a single-consumer interface to dequeue elements - requiring
+the user to serialize accesses with a lock.
+.Pp
+The
+.Fn buf_ring_count
+function returns the number of elements in a buf_ring.
+.Pp
+The
+.Fn buf_ring_empty
+function returns
+.Dv TRUE
+if the buf_ring is empty,
+.Dv FALSE
+otherwise.
+.Pp
+The
+.Fn buf_ring_full
+function returns
+.Dv TRUE
+if no more items can be enqueued,
+.Dv FALSE
+otherwise.
+.Pp
+The
+.Fn buf_ring_peek
+function returns a pointer to the last element in the buf_ring if the
+buf_ring is not empty,
+.Dv NULL
+otherwise.
+.Sh RETURN VALUES
+The
+.Fn buf_ring_enqueue
+and
+.Fn buf_ring_enqueue_bytes
+functions return
+.Er ENOBUFS
+if there are no available slots in the buf_ring.
+.Sh HISTORY
+These functions were introduced in
+.Fx 8.0 .
diff --git a/share/man/man9/bus_activate_resource.9 b/share/man/man9/bus_activate_resource.9
new file mode 100644
index 000000000000..eb5b3e824e79
--- /dev/null
+++ b/share/man/man9/bus_activate_resource.9
@@ -0,0 +1,93 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 28, 2003
+.Dt BUS_ACTIVATE_RESOURCE 9
+.Os
+.Sh NAME
+.Nm bus_activate_resource , bus_deactivate_resource
+.Nd activate or deactivate a resource
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft int
+.Fo bus_activate_resource
+.Fa "device_t dev" "int type" "int rid" "struct resource *r"
+.Fc
+.Ft int
+.Fo bus_deactivate_resource
+.Fa "device_t dev" "int type" "int rid" "struct resource *r"
+.Fc
+.Sh DESCRIPTION
+These functions activate or deactivate a previously allocated resource.
+In general, resources must be activated before they can be accessed by
+the driver so that the bus driver can map the resource into the
+devices space.
+.Pp
+The arguments are as follows:
+.Bl -tag -width indent
+.It Fa dev
+The device that requests ownership of the resource.
+Before allocation, the resource is owned by the parent bus.
+.It Fa type
+The type of resource you want to allocate.
+It is one of:
+.Pp
+.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
+.It Dv SYS_RES_IRQ
+for IRQs
+.It Dv SYS_RES_DRQ
+for ISA DMA lines
+.It Dv SYS_RES_IOPORT
+for I/O ports
+.It Dv SYS_RES_MEMORY
+for I/O memory
+.El
+.It Fa rid
+A pointer to a bus specific handle that identifies the resource being allocated.
+.It Fa r
+A pointer to the
+.Vt "struct resource"
+returned by
+.Xr bus_alloc_resource 9 .
+.El
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr bus_alloc_resource 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/bus_adjust_resource.9 b/share/man/man9/bus_adjust_resource.9
new file mode 100644
index 000000000000..be4adaef3397
--- /dev/null
+++ b/share/man/man9/bus_adjust_resource.9
@@ -0,0 +1,101 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2011 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 29, 2011
+.Dt BUS_ADJUST_RESOURCE 9
+.Os
+.Sh NAME
+.Nm bus_adjust_resource
+.Nd adjust resource allocated from a parent bus
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft int
+.Fn bus_adjust_resource "device_t dev" "int type" "struct resource *r" "u_long start" "u_long end"
+.Sh DESCRIPTION
+This function is used to ask the parent bus to adjust the resource range
+assigned to an allocated resource.
+The resource
+.Fa r
+should have been allocated by a previous call to
+.Xr bus_alloc_resource 9 .
+The new resource range must overlap the existing range of
+.Fa r .
+The
+.Fa type
+argument should match the
+.Fa type
+argument passed to
+.Xr bus_alloc_resource 9
+when the resource was initially allocated.
+.Pp
+Note that none of the constraints of the original allocation request such
+as alignment or boundary restrictions are checked by
+.Fn bus_adjust_resource .
+It is the caller's responsibility to enforce any such requirements.
+.Sh RETURN VALUES
+The
+.Fn bus_adjust_resource
+method returns zero on success or an error code on failure.
+.Sh EXAMPLES
+Grow an existing memory resource by 4096 bytes.
+.Bd -literal
+ struct resource *res;
+ int error;
+
+ error = bus_adjust_resource(dev, SYS_RES_MEMORY, res,
+ rman_get_start(res), rman_get_end(res) + 0x1000);
+.Ed
+.Sh ERRORS
+.Fn bus_adjust_resource
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa dev
+device does not have a parent device.
+.It Bq Er EINVAL
+The
+.Fa r
+resource is a shared resource.
+.It Bq Er EINVAL
+The new address range does not overlap with the existing address range of
+.Fa r .
+.It Bq Er EBUSY
+The new address range conflicts with another allocated resource.
+.El
+.Sh SEE ALSO
+.Xr bus_alloc_resource 9 ,
+.Xr bus_release_resource 9 ,
+.Xr device 9 ,
+.Xr driver 9
diff --git a/share/man/man9/bus_alloc_resource.9 b/share/man/man9/bus_alloc_resource.9
new file mode 100644
index 000000000000..388a7f3123a1
--- /dev/null
+++ b/share/man/man9/bus_alloc_resource.9
@@ -0,0 +1,183 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 18, 2000
+.Dt BUS_ALLOC_RESOURCE 9
+.Os
+.Sh NAME
+.Nm bus_alloc_resource ,
+.Nm bus_alloc_resource_any
+.Nd allocate resources from a parent bus
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft struct resource *
+.Fn bus_alloc_resource "device_t dev" "int type" "int *rid" "u_long start" "u_long end" "u_long count" "u_int flags"
+.Ft struct resource *
+.Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags"
+.Sh DESCRIPTION
+This is an easy interface to the resource-management functions.
+It hides the indirection through the parent's method table.
+This function generally should be called in attach, but (except in some
+rare cases) never earlier.
+.Pp
+The
+.Fn bus_alloc_resource_any
+function is a convenience wrapper for
+.Fn bus_alloc_resource .
+It sets the values for
+.Fa start ,
+.Fa end ,
+and
+.Fa count
+to the default resource (see description of
+.Fa start
+below).
+.Pp
+The arguments are as follows:
+.Bl -item
+.It
+.Fa dev
+is the device that requests ownership of the resource.
+Before allocation, the resource is owned by the parent bus.
+.It
+.Fa type
+is the type of resource you want to allocate.
+It is one of:
+.Bl -tag -width SYS_RES_MEMORY
+.It Dv SYS_RES_IRQ
+for IRQs
+.It Dv SYS_RES_DRQ
+for ISA DMA lines
+.It Dv SYS_RES_IOPORT
+for I/O ports
+.It Dv SYS_RES_MEMORY
+for I/O memory
+.El
+.It
+.Fa rid
+points to a bus specific handle that identifies the resource being allocated.
+For ISA this is an index into an array of resources that have been setup
+for this device by either the PnP mechanism, or via the hints mechanism.
+For PCCARD, this is an index into the array of resources described by the PC Card's
+CIS entry.
+For PCI, the offset into pci config space which has the BAR to use to access
+the resource.
+The bus methods are free to change the RIDs that they are given as a parameter.
+You must not depend on the value you gave it earlier.
+.It
+.Fa start
+and
+.Fa end
+are the start/end addresses of the resource.
+If you specify values of 0ul for
+.Fa start
+and ~0ul for
+.Fa end
+and 1 for
+.Fa count ,
+the default values for the bus are calculated.
+.It
+.Fa count
+is the size of the resource.
+For example, the size of an I/O port is usually 1 byte (but some devices
+override this).
+If you specified the default values for
+.Fa start
+and
+.Fa end ,
+then the default value of the bus is used if
+.Fa count
+is smaller than the default value and
+.Fa count
+is used, if it is bigger than the default value.
+.It
+.Fa flags
+sets the flags for the resource.
+You can set one or more of these flags:
+.Bl -tag -width RF_SHAREABLE
+.It Dv RF_ALLOCATED
+resource has been reserved.
+The resource still needs to be activated with
+.Xr bus_activate_resource 9 .
+.It Dv RF_ACTIVE
+activate resource atomically.
+.It Dv RF_SHAREABLE
+resource permits contemporaneous sharing.
+It should always be set unless you know that the resource cannot be shared.
+It is the bus driver's task to filter out the flag if the bus does not
+support sharing.
+For example,
+.Xr pccard 4
+cannot share IRQs while
+.Xr cardbus 4
+can.
+.It Dv RF_TIMESHARE
+resource permits time-division sharing.
+.El
+.El
+.Sh RETURN VALUES
+A pointer to
+.Va struct resource
+is returned on success, a null pointer otherwise.
+.Sh EXAMPLES
+This is some example code that allocates a 32 byte I/O port range and an IRQ.
+The values of
+.Va portid
+and
+.Va irqid
+should be saved in the softc of the device after these calls.
+.Bd -literal
+ struct resource *portres, *irqres;
+ int portid, irqid;
+
+ portid = 0;
+ irqid = 0;
+ portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &portid,
+ 0ul, ~0ul, 32, RF_ACTIVE);
+ irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irqid,
+ RF_ACTIVE | RF_SHAREABLE);
+.Ed
+.Sh SEE ALSO
+.Xr bus_activate_resource 9 ,
+.Xr bus_adjust_resource 9 ,
+.Xr bus_release_resource 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Alexander Langer Aq alex@big.endian.de
+with parts by
+.An Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/bus_child_present.9 b/share/man/man9/bus_child_present.9
new file mode 100644
index 000000000000..12577ad3d54b
--- /dev/null
+++ b/share/man/man9/bus_child_present.9
@@ -0,0 +1,87 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 27, 2003
+.Dt BUS_CHILD_PRESENT 9
+.Os
+.Sh NAME
+.Nm bus_child_present
+.Nd "ask the bus driver to see if this device is still really present"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft int
+.Fn bus_child_present "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn bus_child_present
+function requests that the parent device driver of
+.Fa dev
+check to see if the
+hardware represented by
+.Fa dev
+is still physically accessible at this time.
+While the notion of accessible varies from bus to bus, generally
+hardware that is not accessible cannot be accessed via the
+.Fn bus_space*
+methods that would otherwise be used to access the device.
+.Pp
+This does not ask the question
+.Dq does this device have children?
+which can better be answered by
+.Xr device_get_children 9 .
+.Sh RETURN VALUES
+A zero return value indicates that the device is not present in the
+system.
+A non-zero return value indicates that the device is present in the
+system, or that the state of the device cannot be determined.
+.Sh EXAMPLES
+This is some example code.
+It only calls stop when the
+.Xr dc 4
+device is actually present.
+.Bd -literal -offset indent
+device_t dev;
+dc_softc *sc;
+
+sc = device_get_softc(dev);
+if (bus_child_present(dev))
+ dc_stop(sc);
+.Ed
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/bus_dma.9 b/share/man/man9/bus_dma.9
new file mode 100644
index 000000000000..3b5ca78e46a1
--- /dev/null
+++ b/share/man/man9/bus_dma.9
@@ -0,0 +1,1001 @@
+.\" Copyright (c) 2002, 2003 Hiten M. Pandya.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, CONTRIBUTORS OR THE
+.\" VOICES IN HITEN PANDYA'S HEAD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+.\" NASA Ames Research Center.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgment:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $
+.\"
+.Dd May 12, 2009
+.Dt BUS_DMA 9
+.Os
+.Sh NAME
+.Nm bus_dma ,
+.Nm bus_dma_tag_create ,
+.Nm bus_dma_tag_destroy ,
+.Nm bus_dmamap_create ,
+.Nm bus_dmamap_destroy ,
+.Nm bus_dmamap_load ,
+.Nm bus_dmamap_load_mbuf ,
+.Nm bus_dmamap_load_mbuf_sg ,
+.Nm bus_dmamap_load_uio ,
+.Nm bus_dmamap_unload ,
+.Nm bus_dmamap_sync ,
+.Nm bus_dmamem_alloc ,
+.Nm bus_dmamem_free
+.Nd Bus and Machine Independent DMA Mapping Interface
+.Sh SYNOPSIS
+.In machine/bus.h
+.Ft int
+.Fn bus_dma_tag_create "bus_dma_tag_t parent" "bus_size_t alignment" \
+"bus_addr_t boundary" "bus_addr_t lowaddr" "bus_addr_t highaddr" \
+"bus_dma_filter_t *filtfunc" "void *filtfuncarg" "bus_size_t maxsize" \
+"int nsegments" "bus_size_t maxsegsz" "int flags" "bus_dma_lock_t *lockfunc" \
+"void *lockfuncarg" "bus_dma_tag_t *dmat"
+.Ft int
+.Fn bus_dma_tag_destroy "bus_dma_tag_t dmat"
+.Ft int
+.Fn bus_dmamap_create "bus_dma_tag_t dmat" "int flags" "bus_dmamap_t *mapp"
+.Ft int
+.Fn bus_dmamap_destroy "bus_dma_tag_t dmat" "bus_dmamap_t map"
+.Ft int
+.Fn bus_dmamap_load "bus_dma_tag_t dmat" "bus_dmamap_t map" "void *buf" \
+"bus_size_t buflen" "bus_dmamap_callback_t *callback" "void *callback_arg" \
+"int flags"
+.Ft int
+.Fn bus_dmamap_load_mbuf "bus_dma_tag_t dmat" "bus_dmamap_t map" \
+"struct mbuf *mbuf" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
+"int flags"
+.Ft int
+.Fn bus_dmamap_load_mbuf_sg "bus_dma_tag_t dmat" "bus_dmamap_t map" \
+"struct mbuf *mbuf" "bus_dma_segment_t *segs" "int *nsegs" "int flags"
+.Ft int
+.Fn bus_dmamap_load_uio "bus_dma_tag_t dmat" "bus_dmamap_t map" \
+"struct uio *uio" "bus_dmamap_callback2_t *callback" "void *callback_arg" \
+"int flags"
+.Ft void
+.Fn bus_dmamap_unload "bus_dma_tag_t dmat" "bus_dmamap_t map"
+.Ft void
+.Fn bus_dmamap_sync "bus_dma_tag_t dmat" "bus_dmamap_t map" \
+"op"
+.Ft int
+.Fn bus_dmamem_alloc "bus_dma_tag_t dmat" "void **vaddr" \
+"int flags" "bus_dmamap_t *mapp"
+.Ft void
+.Fn bus_dmamem_free "bus_dma_tag_t dmat" "void *vaddr" \
+"bus_dmamap_t map"
+.Sh DESCRIPTION
+Direct Memory Access (DMA) is a method of transferring data
+without involving the CPU, thus providing higher performance.
+A DMA transaction can be achieved between device to memory,
+device to device, or memory to memory.
+.Pp
+The
+.Nm
+API is a bus, device, and machine-independent (MI) interface to
+DMA mechanisms.
+It provides the client with flexibility and simplicity by
+abstracting machine dependent issues like setting up
+DMA mappings, handling cache issues, bus specific features
+and limitations.
+.Sh STRUCTURES AND TYPES
+.Bl -tag -width indent
+.It Vt bus_dma_tag_t
+A machine-dependent (MD) opaque type that describes the
+characteristics of DMA transactions.
+DMA tags are organized into a hierarchy, with each child
+tag inheriting the restrictions of its parent.
+This allows all devices along the path of DMA transactions
+to contribute to the constraints of those transactions.
+.It Vt bus_dma_filter_t
+Client specified address filter having the format:
+.Bl -tag -width indent
+.It Ft int
+.Fn "client_filter" "void *filtarg" "bus_addr_t testaddr"
+.El
+.Pp
+Address filters can be specified during tag creation to allow
+for devices whose DMA address restrictions cannot be specified
+by a single window.
+The
+.Fa filtarg
+argument is specified by the client during tag creation to be passed to all
+invocations of the callback.
+The
+.Fa testaddr
+argument contains a potential starting address of a DMA mapping.
+The filter function operates on the set of addresses from
+.Fa testaddr
+to
+.Ql trunc_page(testaddr) + PAGE_SIZE - 1 ,
+inclusive.
+The filter function should return zero if any mapping in this range
+can be accommodated by the device and non-zero otherwise.
+.It Vt bus_dma_segment_t
+A machine-dependent type that describes individual
+DMA segments.
+It contains the following fields:
+.Bd -literal
+ bus_addr_t ds_addr;
+ bus_size_t ds_len;
+.Ed
+.Pp
+The
+.Fa ds_addr
+field contains the device visible address of the DMA segment, and
+.Fa ds_len
+contains the length of the DMA segment.
+Although the DMA segments returned by a mapping call will adhere to
+all restrictions necessary for a successful DMA operation, some conversion
+(e.g.\& a conversion from host byte order to the device's byte order) is
+almost always required when presenting segment information to the device.
+.It Vt bus_dmamap_t
+A machine-dependent opaque type describing an individual mapping.
+One map is used for each memory allocation that will be loaded.
+Maps can be reused once they have been unloaded.
+Multiple maps can be associated with one DMA tag.
+While the value of the map may evaluate to
+.Dv NULL
+on some platforms under certain conditions,
+it should never be assumed that it will be
+.Dv NULL
+in all cases.
+.It Vt bus_dmamap_callback_t
+Client specified callback for receiving mapping information resulting from
+the load of a
+.Vt bus_dmamap_t
+via
+.Fn bus_dmamap_load .
+Callbacks are of the format:
+.Bl -tag -width indent
+.It Ft void
+.Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \
+"int nseg" "int error"
+.El
+.Pp
+The
+.Fa callback_arg
+is the callback argument passed to dmamap load functions.
+The
+.Fa segs
+and
+.Fa nseg
+arguments describe an array of
+.Vt bus_dma_segment_t
+structures that represent the mapping.
+This array is only valid within the scope of the callback function.
+The success or failure of the mapping is indicated by the
+.Fa error
+argument.
+More information on the use of callbacks can be found in the
+description of the individual dmamap load functions.
+.It Vt bus_dmamap_callback2_t
+Client specified callback for receiving mapping information resulting from
+the load of a
+.Vt bus_dmamap_t
+via
+.Fn bus_dmamap_load_uio
+or
+.Fn bus_dmamap_load_mbuf .
+.Pp
+Callback2s are of the format:
+.Bl -tag -width indent
+.It Ft void
+.Fn "client_callback2" "void *callback_arg" "bus_dma_segment_t *segs" \
+"int nseg" "bus_size_t mapsize" "int error"
+.El
+.Pp
+Callback2's behavior is the same as
+.Vt bus_dmamap_callback_t
+with the addition that the length of the data mapped is provided via
+.Fa mapsize .
+.It Vt bus_dmasync_op_t
+Memory synchronization operation specifier.
+Bus DMA requires explicit synchronization of memory with its device
+visible mapping in order to guarantee memory coherency.
+The
+.Vt bus_dmasync_op_t
+allows the type of DMA operation that will be or has been performed
+to be communicated to the system so that the correct coherency measures
+are taken.
+The operations are represented as bitfield flags that can be combined together,
+though it only makes sense to combine PRE flags or POST flags, not both.
+See the
+.Fn bus_dmamap_sync
+description below for more details on how to use these operations.
+.Pp
+All operations specified below are performed from the host memory point of view,
+where a read implies data coming from the device to the host memory, and a write
+implies data going from the host memory to the device.
+Alternatively, the operations can be thought of in terms of driver operations,
+where reading a network packet or storage sector corresponds to a read operation
+in
+.Nm .
+.Bl -tag -width ".Dv BUS_DMASYNC_POSTWRITE"
+.It Dv BUS_DMASYNC_PREREAD
+Perform any synchronization required prior to an update of host memory by the
+device.
+.It Dv BUS_DMASYNC_PREWRITE
+Perform any synchronization required after an update of host memory by the CPU
+and prior to device access to host memory.
+.It Dv BUS_DMASYNC_POSTREAD
+Perform any synchronization required after an update of host memory by the
+device and prior to CPU access to host memory.
+.It Dv BUS_DMASYNC_POSTWRITE
+Perform any synchronization required after device access to host memory.
+.El
+.It Vt bus_dma_lock_t
+Client specified lock/mutex manipulation method.
+This will be called from
+within busdma whenever a client lock needs to be manipulated.
+In its current form, the function will be called immediately before
+the callback for a DMA load operation that has been deferred with
+.Dv BUS_DMA_LOCK
+and immediately after with
+.Dv BUS_DMA_UNLOCK .
+If the load operation does not need to be deferred, then it
+will not be called since the function loading the map should
+be holding the appropriate locks.
+This method is of the format:
+.Bl -tag -width indent
+.It Ft void
+.Fn "lockfunc" "void *lockfunc_arg" "bus_dma_lock_op_t op"
+.El
+.Pp
+The
+.Fa lockfuncarg
+argument is specified by the client during tag creation to be passed to all
+invocations of the callback.
+The
+.Fa op
+argument specifies the lock operation to perform.
+.Pp
+Two
+.Vt lockfunc
+implementations are provided for convenience.
+.Fn busdma_lock_mutex
+performs standard mutex operations on the sleep mutex provided via
+.Fa lockfuncarg .
+.Fn dflt_lock
+will generate a system panic if it is called.
+It is substituted into the tag when
+.Fa lockfunc
+is passed as
+.Dv NULL
+to
+.Fn bus_dma_tag_create
+and is useful for tags that should not be used with deferred load operations.
+.It Vt bus_dma_lock_op_t
+Operations to be performed by the client-specified
+.Fn lockfunc .
+.Bl -tag -width ".Dv BUS_DMA_UNLOCK"
+.It Dv BUS_DMA_LOCK
+Acquires and/or locks the client locking primitive.
+.It Dv BUS_DMA_UNLOCK
+Releases and/or unlocks the client locking primitive.
+.El
+.El
+.Sh FUNCTIONS
+.Bl -tag -width indent
+.It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \
+"highaddr" "*filtfunc" "*filtfuncarg" "maxsize" "nsegments" "maxsegsz" \
+"flags" "lockfunc" "lockfuncarg" "*dmat"
+Allocates a device specific DMA tag, and initializes it according to
+the arguments provided:
+.Bl -tag -width ".Fa filtfuncarg"
+.It Fa parent
+Indicates restrictions between the parent bridge, CPU memory, and the
+device.
+Each device must use a master parent tag by calling
+.Fn bus_get_dma_tag .
+.It Fa alignment
+Alignment constraint, in bytes, of any mappings created using this tag.
+The alignment must be a power of 2.
+Hardware that can DMA starting at any address would specify
+.Em 1
+for byte alignment.
+Hardware requiring DMA transfers to start on a multiple of 4K
+would specify
+.Em 4096 .
+.It Fa boundary
+Boundary constraint, in bytes, of the target DMA memory region.
+The boundary indicates the set of addresses, all multiples of the
+boundary argument, that cannot be crossed by a single
+.Vt bus_dma_segment_t .
+The boundary must be a power of 2 and must be no smaller than the
+maximum segment size.
+.Ql 0
+indicates that there are no boundary restrictions.
+.It Fa lowaddr , highaddr
+Bounds of the window of bus address space that
+.Em cannot
+be directly accessed by the device.
+The window contains all addresses greater than
+.Fa lowaddr
+and less than or equal to
+.Fa highaddr .
+For example, a device incapable of DMA above 4GB, would specify a
+.Fa highaddr
+of
+.Dv BUS_SPACE_MAXADDR
+and a
+.Fa lowaddr
+of
+.Dv BUS_SPACE_MAXADDR_32BIT .
+Similarly a device that can only perform DMA to addresses below
+16MB would specify a
+.Fa highaddr
+of
+.Dv BUS_SPACE_MAXADDR
+and a
+.Fa lowaddr
+of
+.Dv BUS_SPACE_MAXADDR_24BIT .
+Some implementations requires that some region of device visible
+address space, overlapping available host memory, be outside the
+window.
+This area of
+.Ql safe memory
+is used to bounce requests that would otherwise conflict with
+the exclusion window.
+.It Fa filtfunc
+Optional filter function (may be
+.Dv NULL )
+to be called for any attempt to
+map memory into the window described by
+.Fa lowaddr
+and
+.Fa highaddr .
+A filter function is only required when the single window described
+by
+.Fa lowaddr
+and
+.Fa highaddr
+cannot adequately describe the constraints of the device.
+The filter function will be called for every machine page
+that overlaps the exclusion window.
+.It Fa filtfuncarg
+Argument passed to all calls to the filter function for this tag.
+May be
+.Dv NULL .
+.It Fa maxsize
+Maximum size, in bytes, of the sum of all segment lengths in a given
+DMA mapping associated with this tag.
+.It Fa nsegments
+Number of discontinuities (scatter/gather segments) allowed
+in a DMA mapped region.
+If there is no restriction,
+.Dv BUS_SPACE_UNRESTRICTED
+may be specified.
+.It Fa maxsegsz
+Maximum size, in bytes, of a segment in any DMA mapped region associated
+with
+.Fa dmat .
+.It Fa flags
+Are as follows:
+.Bl -tag -width ".Dv BUS_DMA_ALLOCNOW"
+.It Dv BUS_DMA_ALLOCNOW
+Pre-allocate enough resources to handle at least one map load operation on
+this tag.
+If sufficient resources are not available,
+.Er ENOMEM
+is returned.
+This should not be used for tags that only describe buffers that will be
+allocated with
+.Fn bus_dmamem_alloc .
+Also, due to resource sharing with other tags, this flag does not guarantee
+that resources will be allocated or reserved exclusively for this tag.
+It should be treated only as a minor optimization.
+.El
+.It Fa lockfunc
+Optional lock manipulation function (may be
+.Dv NULL )
+to be called when busdma
+needs to manipulate a lock on behalf of the client.
+If
+.Dv NULL
+is specified,
+.Fn dflt_lock
+is used.
+.It Fa lockfuncarg
+Optional argument to be passed to the function specified by
+.Fa lockfunc .
+.It Fa dmat
+Pointer to a bus_dma_tag_t where the resulting DMA tag will
+be stored.
+.El
+.Pp
+Returns
+.Er ENOMEM
+if sufficient memory is not available for tag creation
+or allocating mapping resources.
+.It Fn bus_dma_tag_destroy "dmat"
+Deallocate the DMA tag
+.Fa dmat
+that was created by
+.Fn bus_dma_tag_create .
+.Pp
+Returns
+.Er EBUSY
+if any DMA maps remain associated with
+.Fa dmat
+or
+.Ql 0
+on success.
+.It Fn bus_dmamap_create "dmat" "flags" "*mapp"
+Allocates and initializes a DMA map.
+Arguments are as follows:
+.Bl -tag -width ".Fa nsegments"
+.It Fa dmat
+DMA tag.
+.It Fa flags
+Are as follows:
+.Bl -tag -width ".Dv BUS_DMA_COHERENT"
+.It Dv BUS_DMA_COHERENT
+Attempt to map the memory loaded with this map such that cache sync
+operations are as cheap as possible.
+This flag is typically set on maps when the memory loaded with these will
+be accessed by both a CPU and a DMA engine, frequently such as control data
+and as opposed to streamable data such as receive and transmit buffers.
+Use of this flag does not remove the requirement of using
+.Fn bus_dmamap_sync ,
+but it may reduce the cost of performing these operations.
+For
+.Fn bus_dmamap_create ,
+the
+.Dv BUS_DMA_COHERENT
+flag is currently implemented on sparc64.
+.El
+.It Fa mapp
+Pointer to a
+.Vt bus_dmamap_t
+where the resulting DMA map will be stored.
+.El
+.Pp
+Returns
+.Er ENOMEM
+if sufficient memory is not available for creating the
+map or allocating mapping resources.
+.It Fn bus_dmamap_destroy "dmat" "map"
+Frees all resources associated with a given DMA map.
+Arguments are as follows:
+.Bl -tag -width ".Fa dmat"
+.It Fa dmat
+DMA tag used to allocate
+.Fa map .
+.It Fa map
+The DMA map to destroy.
+.El
+.Pp
+Returns
+.Er EBUSY
+if a mapping is still active for
+.Fa map .
+.It Fn bus_dmamap_load "dmat" "map" "buf" "buflen" "*callback" \
+"callback_arg" "flags"
+Creates a mapping in device visible address space of
+.Fa buflen
+bytes of
+.Fa buf ,
+associated with the DMA map
+.Fa map .
+This call will always return immediately and will not block for any reason.
+Arguments are as follows:
+.Bl -tag -width ".Fa buflen"
+.It Fa dmat
+DMA tag used to allocate
+.Fa map .
+.It Fa map
+A DMA map without a currently active mapping.
+.It Fa buf
+A kernel virtual address pointer to a contiguous (in KVA) buffer, to be
+mapped into device visible address space.
+.It Fa buflen
+The size of the buffer.
+.It Fa callback Fa callback_arg
+The callback function, and its argument.
+This function is called once sufficient mapping resources are available for
+the DMA operation.
+If resources are temporarily unavailable, this function will be deferred until
+later, but the load operation will still return immediately to the caller.
+Thus, callers should not assume that the callback will be called before the
+load returns, and code should be structured appropriately to handle this.
+See below for specific flags and error codes that control this behavior.
+.It Fa flags
+Are as follows:
+.Bl -tag -width ".Dv BUS_DMA_NOWAIT"
+.It Dv BUS_DMA_NOWAIT
+The load should not be deferred in case of insufficient mapping resources,
+and instead should return immediately with an appropriate error.
+.It Dv BUS_DMA_NOCACHE
+The generated transactions to and from the virtual page are non-cacheable.
+For
+.Fn bus_dmamap_load ,
+the
+.Dv BUS_DMA_NOCACHE
+flag is currently implemented on sparc64.
+.El
+.El
+.Pp
+Return values to the caller are as follows:
+.Bl -tag -width ".Er EINPROGRESS"
+.It 0
+The callback has been called and completed.
+The status of the mapping has been delivered to the callback.
+.It Er EINPROGRESS
+The mapping has been deferred for lack of resources.
+The callback will be called as soon as resources are available.
+Callbacks are serviced in FIFO order.
+To ensure that ordering is guaranteed, all subsequent load requests will also
+be deferred until all callbacks have been processed.
+.It Er ENOMEM
+The load request has failed due to insufficient resources, and the caller
+specifically used the
+.Dv BUS_DMA_NOWAIT
+flag.
+.It Er EINVAL
+The load request was invalid.
+The callback has been called and has been provided the same error.
+This error value may indicate that
+.Fa dmat ,
+.Fa map ,
+.Fa buf ,
+or
+.Fa callback
+were invalid, or
+.Fa buflen
+was larger than the
+.Fa maxsize
+argument used to create the dma tag
+.Fa dmat .
+.El
+.Pp
+When the callback is called, it is presented with an error value
+indicating the disposition of the mapping.
+Error may be one of the following:
+.Bl -tag -width ".Er EINPROGRESS"
+.It 0
+The mapping was successful and the
+.Fa dm_segs
+callback argument contains an array of
+.Vt bus_dma_segment_t
+elements describing the mapping.
+This array is only valid during the scope of the callback function.
+.It Er EFBIG
+A mapping could not be achieved within the segment constraints provided
+in the tag even though the requested allocation size was less than maxsize.
+.El
+.It Fn bus_dmamap_load_mbuf "dmat" "map" "mbuf" "callback2" "callback_arg" \
+"flags"
+This is a variation of
+.Fn bus_dmamap_load
+which maps mbuf chains
+for DMA transfers.
+A
+.Vt bus_size_t
+argument is also passed to the callback routine, which
+contains the mbuf chain's packet header length.
+The
+.Dv BUS_DMA_NOWAIT
+flag is implied, thus no callback deferral will happen.
+.Pp
+Mbuf chains are assumed to be in kernel virtual address space.
+.Pp
+Beside the error values listed for
+.Fn bus_dmamap_load ,
+.Er EINVAL
+will be returned if the size of the mbuf chain exceeds the maximum limit of the
+DMA tag.
+.It Fn bus_dmamap_load_mbuf_sg "dmat" "map" "mbuf" "segs" "nsegs" "flags"
+This is just like
+.Fn bus_dmamap_load_mbuf
+except that it returns immediately without calling a callback function.
+It is provided for efficiency.
+The scatter/gather segment array
+.Va segs
+is provided by the caller and filled in directly by the function.
+The
+.Va nsegs
+argument is returned with the number of segments filled in.
+Returns the same errors as
+.Fn bus_dmamap_load_mbuf .
+.It Fn bus_dmamap_load_uio "dmat" "map" "uio" "callback2" "callback_arg" "flags"
+This is a variation of
+.Fn bus_dmamap_load
+which maps buffers pointed to by
+.Fa uio
+for DMA transfers.
+A
+.Vt bus_size_t
+argument is also passed to the callback routine, which contains the size of
+.Fa uio ,
+i.e.
+.Fa uio->uio_resid .
+The
+.Dv BUS_DMA_NOWAIT
+flag is implied, thus no callback deferral will happen.
+Returns the same errors as
+.Fn bus_dmamap_load .
+.Pp
+If
+.Fa uio->uio_segflg
+is
+.Dv UIO_USERSPACE ,
+then it is assumed that the buffer,
+.Fa uio
+is in
+.Fa "uio->uio_td->td_proc" Ns 's
+address space.
+User space memory must be in-core and wired prior to attempting a map
+load operation.
+Pages may be locked using
+.Xr vslock 9 .
+.It Fn bus_dmamap_unload "dmat" "map"
+Unloads a DMA map.
+Arguments are as follows:
+.Bl -tag -width ".Fa dmam"
+.It Fa dmat
+DMA tag used to allocate
+.Fa map .
+.It Fa map
+The DMA map that is to be unloaded.
+.El
+.Pp
+.Fn bus_dmamap_unload
+will not perform any implicit synchronization of DMA buffers.
+This must be done explicitly by a call to
+.Fn bus_dmamap_sync
+prior to unloading the map.
+.It Fn bus_dmamap_sync "dmat" "map" "op"
+Performs synchronization of a device visible mapping with the CPU visible
+memory referenced by that mapping.
+Arguments are as follows:
+.Bl -tag -width ".Fa dmat"
+.It Fa dmat
+DMA tag used to allocate
+.Fa map .
+.It Fa map
+The DMA mapping to be synchronized.
+.It Fa op
+Type of synchronization operation to perform.
+See the definition of
+.Vt bus_dmasync_op_t
+for a description of the acceptable values for
+.Fa op .
+.El
+.Pp
+The
+.Fn bus_dmamap_sync
+function
+is the method used to ensure that CPU's and device's direct
+memory access (DMA) to shared
+memory is coherent.
+For example, the CPU might be used to set up the contents of a buffer
+that is to be made available to a device.
+To ensure that the data are visible via the device's mapping of that
+memory, the buffer must be loaded and a DMA sync operation of
+.Dv BUS_DMASYNC_PREWRITE
+must be performed after the CPU has updated the buffer and before the device
+access is initiated.
+If the CPU modifies this buffer again later, another
+.Dv BUS_DMASYNC_PREWRITE
+sync operation must be performed before an additional device
+access.
+Conversely, suppose a device updates memory that is to be read by a CPU.
+In this case, the buffer must be loaded, and a DMA sync operation of
+.Dv BUS_DMASYNC_PREREAD
+must be performed before the device access is initiated.
+The CPU will only be able to see the results of this memory update
+once the DMA operation has completed and a
+.Dv BUS_DMASYNC_POSTREAD
+sync operation has been performed.
+.Pp
+If read and write operations are not preceded and followed by the
+appropriate synchronization operations, behavior is undefined.
+.It Fn bus_dmamem_alloc "dmat" "**vaddr" "flags" "*mapp"
+Allocates memory that is mapped into KVA at the address returned
+in
+.Fa vaddr
+and that is permanently loaded into the newly created
+.Vt bus_dmamap_t
+returned via
+.Fa mapp .
+Arguments are as follows:
+.Bl -tag -width ".Fa alignment"
+.It Fa dmat
+DMA tag describing the constraints of the DMA mapping.
+.It Fa vaddr
+Pointer to a pointer that will hold the returned KVA mapping of
+the allocated region.
+.It Fa flags
+Flags are defined as follows:
+.Bl -tag -width ".Dv BUS_DMA_NOWAIT"
+.It Dv BUS_DMA_WAITOK
+The routine can safely wait (sleep) for resources.
+.It Dv BUS_DMA_NOWAIT
+The routine is not allowed to wait for resources.
+If resources are not available,
+.Dv ENOMEM
+is returned.
+.It Dv BUS_DMA_COHERENT
+Attempt to map this memory in a coherent fashion.
+See
+.Fn bus_dmamap_create
+above for a description of this flag.
+For
+.Fn bus_dmamem_alloc ,
+the
+.Dv BUS_DMA_COHERENT
+flag is currently implemented on arm and sparc64.
+.It Dv BUS_DMA_ZERO
+Causes the allocated memory to be set to all zeros.
+.It Dv BUS_DMA_NOCACHE
+The allocated memory will not be cached in the processor caches.
+All memory accesses appear on the bus and are executed
+without reordering.
+For
+.Fn bus_dmamem_alloc ,
+the
+.Dv BUS_DMA_NOCACHE
+flag is currently implemented on amd64 and i386 where it results in the
+Strong Uncacheable PAT to be set for the allocated virtual address range.
+.El
+.It Fa mapp
+Pointer to a
+.Vt bus_dmamap_t
+where the resulting DMA map will be stored.
+.El
+.Pp
+The size of memory to be allocated is
+.Fa maxsize
+as specified in the call to
+.Fn bus_dma_tag_create
+for
+.Fa dmat .
+.Pp
+The current implementation of
+.Fn bus_dmamem_alloc
+will allocate all requests as a single segment.
+.Pp
+An initial load operation is required to obtain the bus address of the allocated
+memory, and an unload operation is required before freeing the memory, as
+described below in
+.Fn bus_dmamem_free .
+Maps are automatically handled by this function and should not be explicitly
+allocated or destroyed.
+.Pp
+Although an explicit load is not required for each access to the memory
+referenced by the returned map, the synchronization requirements
+as described in the
+.Fn bus_dmamap_sync
+section still apply and should be used to achieve portability on architectures
+without coherent buses.
+.Pp
+Returns
+.Er ENOMEM
+if sufficient memory is not available for completing
+the operation.
+.It Fn bus_dmamem_free "dmat" "*vaddr" "map"
+Frees memory previously allocated by
+.Fn bus_dmamem_alloc .
+Any mappings
+will be invalidated.
+Arguments are as follows:
+.Bl -tag -width ".Fa vaddr"
+.It Fa dmat
+DMA tag.
+.It Fa vaddr
+Kernel virtual address of the memory.
+.It Fa map
+DMA map to be invalidated.
+.El
+.El
+.Sh RETURN VALUES
+Behavior is undefined if invalid arguments are passed to
+any of the above functions.
+If sufficient resources cannot be allocated for a given
+transaction,
+.Er ENOMEM
+is returned.
+All
+routines that are not of type
+.Vt void
+will return 0 on success or an error
+code on failure as discussed above.
+.Pp
+All
+.Vt void
+routines will succeed if provided with valid arguments.
+.Sh LOCKING
+Two locking protocols are used by
+.Nm .
+The first is a private global lock that is used to synchronize access to the
+bounce buffer pool on the architectures that make use of them.
+This lock is strictly a leaf lock that is only used internally to
+.Nm
+and is not exposed to clients of the API.
+.Pp
+The second protocol involves protecting various resources stored in the tag.
+Since almost all
+.Nm
+operations are done through requests from the driver that created the tag,
+the most efficient way to protect the tag resources is through the lock that
+the driver uses.
+In cases where
+.Nm
+acts on its own without being called by the driver, the lock primitive
+specified in the tag is acquired and released automatically.
+An example of this is when the
+.Fn bus_dmamap_load
+callback function is called from a deferred context instead of the driver
+context.
+This means that certain
+.Nm
+functions must always be called with the same lock held that is specified in the
+tag.
+These functions include:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Fn bus_dmamap_load
+.It
+.Fn bus_dmamap_load_uio
+.It
+.Fn bus_dmamap_load_mbuf
+.It
+.Fn bus_dmamap_load_mbuf_sg
+.It
+.Fn bus_dmamap_unload
+.It
+.Fn bus_dmamap_sync
+.El
+.Pp
+There is one exception to this rule.
+It is common practice to call some of these functions during driver start-up
+without any locks held.
+So long as there is a guarantee of no possible concurrent use of the tag by
+different threads during this operation, it is safe to not hold a lock for
+these functions.
+.Pp
+Certain
+.Nm
+operations should not be called with the driver lock held, either because
+they are already protected by an internal lock, or because they might sleep
+due to memory or resource allocation.
+The following functions must not be
+called with any non-sleepable locks held:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Fn bus_dma_tag_create
+.It
+.Fn bus_dmamap_create
+.It
+.Fn bus_dmamem_alloc
+.El
+.Pp
+All other functions do not have a locking protocol and can thus be
+called with or without any system or driver locks held.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9 ,
+.Xr driver 9 ,
+.Xr rman 9 ,
+.Xr vslock 9
+.Pp
+.Rs
+.%A "Jason R. Thorpe"
+.%T "A Machine-Independent DMA Framework for NetBSD"
+.%J "Proceedings of the Summer 1998 USENIX Technical Conference"
+.%Q "USENIX Association"
+.%D "June 1998"
+.Re
+.Sh HISTORY
+The
+.Nm
+interface first appeared in
+.Nx 1.3 .
+.Pp
+The
+.Nm
+API was adopted from
+.Nx
+for use in the CAM SCSI subsystem.
+The alterations to the original API were aimed to remove the need for
+a
+.Vt bus_dma_segment_t
+array stored in each
+.Vt bus_dmamap_t
+while allowing callers to queue up on scarce resources.
+.Sh AUTHORS
+The
+.Nm
+interface was designed and implemented by
+.An Jason R. Thorpe
+of the Numerical Aerospace Simulation Facility, NASA Ames Research Center.
+Additional input on the
+.Nm
+design was provided by
+.An -nosplit
+.An Chris Demetriou ,
+.An Charles Hannum ,
+.An Ross Harvey ,
+.An Matthew Jacob ,
+.An Jonathan Stone ,
+and
+.An Matt Thomas .
+.Pp
+The
+.Nm
+interface in
+.Fx
+benefits from the contributions of
+.An Justin T. Gibbs ,
+.An Peter Wemm ,
+.An Doug Rabson ,
+.An Matthew N. Dodd ,
+.An Sam Leffler ,
+.An Maxime Henrion ,
+.An Jake Burkholder ,
+.An Takahashi Yoshihiro ,
+.An Scott Long
+and many others.
+.Pp
+This manual page was written by
+.An Hiten M. Pandya
+and
+.An Justin T. Gibbs .
diff --git a/share/man/man9/bus_generic_attach.9 b/share/man/man9/bus_generic_attach.9
new file mode 100644
index 000000000000..e53bd5d080f3
--- /dev/null
+++ b/share/man/man9/bus_generic_attach.9
@@ -0,0 +1,58 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_GENERIC_ATTACH 9
+.Os
+.Sh NAME
+.Nm bus_generic_attach
+.Nd generic implementation of
+.Dv DEVICE_ATTACH
+for busses
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn bus_generic_attach "device_t dev"
+.Sh DESCRIPTION
+This function provides an implementation of the
+.Xr DEVICE_ATTACH 9
+method which can be used by most bus code.
+It simply calls
+.Xr device_probe_and_attach 9
+for each child device attached to the bus.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/bus_generic_detach.9 b/share/man/man9/bus_generic_detach.9
new file mode 100644
index 000000000000..9a2a6f8bb8ae
--- /dev/null
+++ b/share/man/man9/bus_generic_detach.9
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_GENERIC_DETACH 9
+.Os
+.Sh NAME
+.Nm bus_generic_detach
+.Nd generic implementation of
+.Dv DEVICE_DETACH
+for busses
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn bus_generic_detach "device_t dev"
+.Sh DESCRIPTION
+This function provides an implementation of the
+.Xr DEVICE_DETACH 9
+method
+which can be used by most bus code.
+It simply calls the
+.Xr DEVICE_DETACH 9
+method of each child device attached to the bus.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/bus_generic_new_pass.9 b/share/man/man9/bus_generic_new_pass.9
new file mode 100644
index 000000000000..de6422029c4f
--- /dev/null
+++ b/share/man/man9/bus_generic_new_pass.9
@@ -0,0 +1,57 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 8, 2009
+.Dt BUS_GENERIC_NEW_PASS 9
+.Os
+.Sh NAME
+.Nm bus_generic_new_pass
+.Nd "generic implementation of BUS_NEW_PASS for bus devices"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn bus_generic_new_pass "device_t dev"
+.Sh DESCRIPTION
+This function provides an implementation of the
+.Xr BUS_NEW_PASS 9
+method which can be used by bus drivers.
+It first invokes the
+.Xr DEVICE_IDENTIFY 9
+method for any drivers whose pass level is equal to the new pass level.
+Then, for each attached child device it calls
+.Xr BUS_NEW_PASS 9
+to rescan child busses,
+and for each unattached child device it calls
+.Xr device_probe_and_attach 9 .
+.Sh SEE ALSO
+.Xr BUS_NEW_PASS 9 ,
+.Xr bus_set_pass 9 ,
+.Xr device 9 ,
+.Xr DEVICE_IDENTIFY 9
diff --git a/share/man/man9/bus_generic_print_child.9 b/share/man/man9/bus_generic_print_child.9
new file mode 100644
index 000000000000..80a04ff3d506
--- /dev/null
+++ b/share/man/man9/bus_generic_print_child.9
@@ -0,0 +1,65 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_GENERIC_PRINT_CHILD 9
+.Os
+.Sh NAME
+.Nm bus_generic_print_child
+.Nd generic implementation of
+.Dv DEVICE_PRINT_CHILD
+for busses
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn bus_generic_print_child "device_t dev" "device_t child"
+.Sh DESCRIPTION
+This implementation prints out the default device announcement message.
+Given device 'foo0' on bus 'bar0' where foo0 has the name "FooCard 1234" the
+following would be printed:
+.Pp
+foo0: <FooCard 1234> on bar0
+.Pp
+bus_generic_print_child itself calls two functions
+.Fn bus_print_child_header
+and
+.Fn bus_print_child_footer
+The former prints "foo0: <FooCard 1234>" and the latter "on bar0".
+These routines should be used if possible in your own code if
+.Fn bus_generic_print_child
+does not completely suit your needs.
+.Sh RETURN VALUES
+The number of characters output.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/bus_generic_read_ivar.9 b/share/man/man9/bus_generic_read_ivar.9
new file mode 100644
index 000000000000..5474b436901c
--- /dev/null
+++ b/share/man/man9/bus_generic_read_ivar.9
@@ -0,0 +1,57 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_GENERIC_READ_IVAR 9
+.Os
+.Sh NAME
+.Nm bus_generic_read_ivar ,
+.Nm bus_generic_write_ivar
+.Nd generic implementation of
+.Dv BUS_READ_IVAR
+and
+.Dv BUS_WRITE_IVAR
+for busses
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn bus_generic_read_ivar "device_t dev" "device_t child" "int index" "uintptr_t *result"
+.Ft int
+.Fn bus_generic_write_ivar "device_t dev" "device_t child" "int index" "uintptr_t value"
+.Sh DESCRIPTION
+These functions simply return
+.Er ENOENT .
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/bus_generic_shutdown.9 b/share/man/man9/bus_generic_shutdown.9
new file mode 100644
index 000000000000..215d8594275e
--- /dev/null
+++ b/share/man/man9/bus_generic_shutdown.9
@@ -0,0 +1,59 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt BUS_GENERIC_SHUTDOWN 9
+.Os
+.Sh NAME
+.Nm bus_generic_shutdown
+.Nd generic implementation of
+.Dv DEVICE_SHUTDOWN
+for busses
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn bus_generic_shutdown "device_t dev"
+.Sh DESCRIPTION
+This function provides an implementation of the
+.Xr DEVICE_SHUTDOWN 9
+method
+which can be used by most bus code.
+It simply calls the
+.Xr DEVICE_SHUTDOWN 9
+method of each child device attached to the bus.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/bus_release_resource.9 b/share/man/man9/bus_release_resource.9
new file mode 100644
index 000000000000..68187ccc7872
--- /dev/null
+++ b/share/man/man9/bus_release_resource.9
@@ -0,0 +1,106 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 18, 2000
+.Dt BUS_RELEASE_RESOURCE 9
+.Os
+.Sh NAME
+.Nm bus_release_resource
+.Nd release resources on a bus
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft int
+.Fn bus_release_resource "device_t dev" "int type" "int rid" "struct resource *r"
+.Sh DESCRIPTION
+Free a resource allocated by
+.Xr bus_alloc_resource 9 .
+The resource must not be in use on release, i.e., call an appropriate function
+before (e.g.\&
+.Xr bus_teardown_intr 9
+for IRQs).
+.Bl -item
+.It
+.Fa dev
+is the device that owns the resource.
+.It
+.Fa type
+is the type of resource that is released.
+It must be of the same type you allocated it as before.
+See
+.Xr bus_alloc_resource 9
+for valid types.
+.It
+.Fa rid
+is the resource ID of the resource.
+The
+.Fa rid
+value must be the same as the one returned by
+.Xr bus_alloc_resource 9 .
+.It
+.Fa r
+is the pointer to
+.Va struct res ,
+i.e., the resource itself,
+returned by
+.Xr bus_alloc_resource 9 .
+.El
+.Sh RETURN VALUES
+.Er EINVAL
+is returned, if the device
+.Fa dev
+has no parent,
+.Dv 0
+otherwise.
+The kernel will panic, if it cannot release the resource.
+.Sh EXAMPLES
+.Bd -literal
+ /* deactivate IRQ */
+ bus_teardown_intr(dev, foosoftc->irqres, foosoftc->irqid);
+
+ /* release IRQ resource */
+ bus_release_resource(dev, SYS_RES_IRQ, foosoftc->irqid,
+ foosoftc->irqres);
+
+ /* release I/O port resource */
+ bus_release_resource(dev, SYS_RES_IOPORT, foosoftc->portid,
+ foosoftc->portres);
+.Ed
+.Sh SEE ALSO
+.Xr bus_alloc_resource 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@big.endian.de .
diff --git a/share/man/man9/bus_set_pass.9 b/share/man/man9/bus_set_pass.9
new file mode 100644
index 000000000000..a28d833c04db
--- /dev/null
+++ b/share/man/man9/bus_set_pass.9
@@ -0,0 +1,54 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 8, 2009
+.Dt BUS_SET_PASS 9
+.Os
+.Sh NAME
+.Nm bus_set_pass
+.Nd "raise the bus pass level"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn bus_set_pass "int pass"
+.Sh DESCRIPTION
+The
+.Nm
+function is called during boot to raise the bus pass level to
+.Fa pass .
+The function will rescan the device tree for each pass level between the
+current pass level and the new level that has at least one associated
+driver.
+The device tree rescans are implemented by invoking the
+.Xr BUS_NEW_PASS 9
+method on the root bus device.
+.Sh SEE ALSO
+.Xr BUS_NEW_PASS 9 ,
+.Xr device 9
diff --git a/share/man/man9/bus_set_resource.9 b/share/man/man9/bus_set_resource.9
new file mode 100644
index 000000000000..cda47b62b682
--- /dev/null
+++ b/share/man/man9/bus_set_resource.9
@@ -0,0 +1,96 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2003
+.Dt BUS_SET_RESOURCE 9
+.Os
+.Sh NAME
+.Nm bus_set_resource
+.Nd "associate a definite resource with a given resource ID"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Pp
+.In machine/bus.h
+.In sys/rman.h
+.In machine/resource.h
+.Ft int
+.Fo bus_set_resource
+.Fa "device_t dev" "int type" "int rid" "u_long start" "u_long count"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn bus_set_resource
+function
+sets the start address of the resource
+.Fa type , rid
+pair to be
+.Fa count
+long.
+Typically, client drivers do not use this interface.
+Bus drivers, however, often use it to set up the resources a client
+driver uses.
+.Pp
+The arguments are as follows:
+.Bl -tag -width indent
+.It Fa dev
+The device to set the resource on.
+.It Fa type
+The type of resource you want to allocate.
+It is one of:
+.Pp
+.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
+.It Dv SYS_RES_IRQ
+for IRQs
+.It Dv SYS_RES_DRQ
+for ISA DMA lines
+.It Dv SYS_RES_IOPORT
+for I/O ports
+.It Dv SYS_RES_MEMORY
+for I/O memory
+.El
+.It Fa rid
+A bus-specific handle that identifies the resource being allocated.
+.It Fa start
+The start address of this resource.
+.It Fa count
+The length of the resource.
+For example, the size of the memory in bytes.
+.El
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr bus_alloc_resource 9 ,
+.Xr bus_get_resource 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/bus_space.9 b/share/man/man9/bus_space.9
new file mode 100644
index 000000000000..59c360724ce9
--- /dev/null
+++ b/share/man/man9/bus_space.9
@@ -0,0 +1,1721 @@
+.\" $NetBSD: bus_space.9,v 1.9 1999/03/06 22:09:29 mycroft Exp $
+.\"
+.\" Copyright (c) 2005 M. Warner Losh. All Rights Reserved.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Christopher G. Demetriou.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgment:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 13, 2005
+.Dt BUS_SPACE 9
+.Os
+.Sh NAME
+.Nm bus_space ,
+.Nm bus_space_barrier ,
+.Nm bus_space_copy_region_1 ,
+.Nm bus_space_copy_region_2 ,
+.Nm bus_space_copy_region_4 ,
+.Nm bus_space_copy_region_8 ,
+.Nm bus_space_copy_region_stream_1 ,
+.Nm bus_space_copy_region_stream_2 ,
+.Nm bus_space_copy_region_stream_4 ,
+.Nm bus_space_copy_region_stream_8 ,
+.Nm bus_space_free ,
+.Nm bus_space_map ,
+.Nm bus_space_read_1 ,
+.Nm bus_space_read_2 ,
+.Nm bus_space_read_4 ,
+.Nm bus_space_read_8 ,
+.Nm bus_space_read_multi_1 ,
+.Nm bus_space_read_multi_2 ,
+.Nm bus_space_read_multi_4 ,
+.Nm bus_space_read_multi_8 ,
+.Nm bus_space_read_multi_stream_1 ,
+.Nm bus_space_read_multi_stream_2 ,
+.Nm bus_space_read_multi_stream_4 ,
+.Nm bus_space_read_multi_stream_8 ,
+.Nm bus_space_read_region_1 ,
+.Nm bus_space_read_region_2 ,
+.Nm bus_space_read_region_4 ,
+.Nm bus_space_read_region_8 ,
+.Nm bus_space_read_region_stream_1 ,
+.Nm bus_space_read_region_stream_2 ,
+.Nm bus_space_read_region_stream_4 ,
+.Nm bus_space_read_region_stream_8 ,
+.Nm bus_space_read_stream_1 ,
+.Nm bus_space_read_stream_2 ,
+.Nm bus_space_read_stream_4 ,
+.Nm bus_space_read_stream_8 ,
+.Nm bus_space_set_multi_1 ,
+.Nm bus_space_set_multi_2 ,
+.Nm bus_space_set_multi_4 ,
+.Nm bus_space_set_multi_8 ,
+.Nm bus_space_set_multi_stream_1 ,
+.Nm bus_space_set_multi_stream_2 ,
+.Nm bus_space_set_multi_stream_4 ,
+.Nm bus_space_set_multi_stream_8 ,
+.Nm bus_space_set_region_1 ,
+.Nm bus_space_set_region_2 ,
+.Nm bus_space_set_region_4 ,
+.Nm bus_space_set_region_8 ,
+.Nm bus_space_set_region_stream_1 ,
+.Nm bus_space_set_region_stream_2 ,
+.Nm bus_space_set_region_stream_4 ,
+.Nm bus_space_set_region_stream_8 ,
+.Nm bus_space_subregion ,
+.Nm bus_space_unmap ,
+.Nm bus_space_write_1 ,
+.Nm bus_space_write_2 ,
+.Nm bus_space_write_4 ,
+.Nm bus_space_write_8 ,
+.Nm bus_space_write_multi_1 ,
+.Nm bus_space_write_multi_2 ,
+.Nm bus_space_write_multi_4 ,
+.Nm bus_space_write_multi_8 ,
+.Nm bus_space_write_multi_stream_1 ,
+.Nm bus_space_write_multi_stream_2 ,
+.Nm bus_space_write_multi_stream_4 ,
+.Nm bus_space_write_multi_stream_8 ,
+.Nm bus_space_write_region_1 ,
+.Nm bus_space_write_region_2 ,
+.Nm bus_space_write_region_4 ,
+.Nm bus_space_write_region_8 ,
+.Nm bus_space_write_region_stream_1 ,
+.Nm bus_space_write_region_stream_2 ,
+.Nm bus_space_write_region_stream_4 ,
+.Nm bus_space_write_region_stream_8 ,
+.Nm bus_space_write_stream_1 ,
+.Nm bus_space_write_stream_2 ,
+.Nm bus_space_write_stream_4 ,
+.Nm bus_space_write_stream_8
+.Nd "bus space manipulation functions"
+.Sh SYNOPSIS
+.In machine/bus.h
+.Ft int
+.Fo bus_space_map
+.Fa "bus_space_tag_t space" "bus_addr_t address"
+.Fa "bus_size_t size" "int flags" "bus_space_handle_t *handlep"
+.Fc
+.Ft void
+.Fo bus_space_unmap
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t size"
+.Fc
+.Ft int
+.Fo bus_space_subregion
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "bus_size_t size" "bus_space_handle_t *nhandlep"
+.Fc
+.Ft int
+.Fo bus_space_alloc
+.Fa "bus_space_tag_t space" "bus_addr_t reg_start" "bus_addr_t reg_end"
+.Fa "bus_size_t size" "bus_size_t alignment" "bus_size_t boundary"
+.Fa "int flags" "bus_addr_t *addrp" "bus_space_handle_t *handlep"
+.Fc
+.Ft void
+.Fo bus_space_free
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t size"
+.Fc
+.Ft uint8_t
+.Fo bus_space_read_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint16_t
+.Fo bus_space_read_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint32_t
+.Fo bus_space_read_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint64_t
+.Fo bus_space_read_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint8_t
+.Fo bus_space_read_stream_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint16_t
+.Fo bus_space_read_stream_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint32_t
+.Fo bus_space_read_stream_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft uint64_t
+.Fo bus_space_read_stream_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft void
+.Fo bus_space_write_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint8_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint16_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint32_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint64_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint8_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint16_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint32_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "uint64_t value"
+.Fc
+.Ft void
+.Fo bus_space_barrier
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "bus_size_t length" "int flags"
+.Fc
+.Ft void
+.Fo bus_space_read_region_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "uint64_t value"
+.Fa "bus_size_t count"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm
+functions exist to allow device drivers
+machine-independent access to bus memory and register areas.
+All of the
+functions and types described in this document can be used by including
+the
+.In machine/bus.h
+header file.
+.Pp
+Many common devices are used on multiple architectures, but are accessed
+differently on each because of architectural constraints.
+For instance, a device which is mapped in one system's I/O space may be
+mapped in memory space on a second system.
+On a third system, architectural
+limitations might change the way registers need to be accessed (e.g.\&
+creating a non-linear register space).
+In some cases, a single
+driver may need to access the same type of device in multiple ways in a
+single system or architecture.
+The goal of the
+.Nm
+functions is to allow a single driver source file to manipulate a set
+of devices on different system architectures, and to allow a single driver
+object file to manipulate a set of devices on multiple bus types on a
+single architecture.
+.Pp
+Not all busses have to implement all functions described in this
+document, though that is encouraged if the operations are logically
+supported by the bus.
+Unimplemented functions should cause
+compile-time errors if possible.
+.Pp
+All of the interface definitions described in this document are shown as
+function prototypes and discussed as if they were required to be
+functions.
+Implementations are encouraged to implement prototyped
+(type-checked) versions of these interfaces, but may implement them as
+macros if appropriate.
+Machine-dependent types, variables, and functions
+should be marked clearly in
+.In machine/bus.h
+to avoid confusion with the
+machine-independent types and functions, and, if possible, should be
+given names which make the machine-dependence clear.
+.Sh CONCEPTS AND GUIDELINES
+Bus spaces are described by bus space tags, which can be created only by
+machine-dependent code.
+A given machine may have several different types
+of bus space (e.g.\& memory space and I/O space), and thus may provide
+multiple different bus space tags.
+Individual busses or devices on a machine may use more than one bus space
+tag.
+For instance, ISA devices are
+given an ISA memory space tag and an ISA I/O space tag.
+Architectures
+may have several different tags which represent the same type of
+space, for instance because of multiple different host bus interface
+chipsets.
+.Pp
+A range in bus space is described by a bus address and a bus size.
+The
+bus address describes the start of the range in bus space.
+The bus
+size describes the size of the range in bytes.
+Busses which are not byte
+addressable may require use of bus space ranges with appropriately
+aligned addresses and properly rounded sizes.
+.Pp
+Access to regions of bus space is facilitated by use of bus space handles,
+which are usually created by mapping a specific range of a bus space.
+Handles may also be created by allocating
+and mapping a range of bus space, the actual location of which is picked
+by the implementation within bounds specified by the caller of the
+allocation function.
+.Pp
+All of the bus space access functions require one bus space tag
+argument, at least one handle argument, and at least one offset argument
+(a bus size).
+The bus space tag specifies the space, each handle specifies a region in
+the space, and each offset specifies the offset into the region of the
+actual location(s) to be accessed.
+Offsets are given in bytes, though busses
+may impose alignment constraints.
+The offset used to access data
+relative to a given handle must be such that all of the data being
+accessed is in the mapped region that the handle describes.
+Trying to
+access data outside that region is an error.
+.Pp
+Because some architectures' memory systems use buffering to improve
+memory and device access performance, there is a mechanism which can be
+used to create
+.Dq barriers
+in the bus space read and write stream.
+There
+are three types of barriers: read, write, and read/write.
+All reads
+started to the region before a read barrier must complete before any reads
+after the read barrier are started.
+(The analogous requirement is true for
+write barriers.)
+Read/write barriers force all reads and writes started
+before the barrier to complete before any reads or writes after the
+barrier are started.
+Correctly-written drivers will include all
+appropriate barriers, and assume only the read/write ordering imposed by
+the barrier operations.
+.Pp
+People trying to write portable drivers with the
+.Nm
+functions should
+try to make minimal assumptions about what the system allows.
+In particular,
+they should expect that the system requires bus space addresses being
+accessed to be naturally aligned (i.e., base address of handle added to
+offset is a multiple of the access size), and that the system does
+alignment checking on pointers (i.e., pointer to objects being read and
+written must point to properly-aligned data).
+.Pp
+The descriptions of the
+.Nm
+functions given below all assume that
+they are called with proper arguments.
+If called with invalid arguments
+or arguments that are out of range (e.g.\& trying to access data outside of
+the region mapped when a given handle was created), undefined behaviour
+results.
+In that case, they may cause the
+system to halt, either intentionally (via panic) or unintentionally (by
+causing a fatal trap of by some other means) or may cause improper
+operation which is not immediately fatal.
+Functions which return
+.Ft void
+or which return data read from bus space (i.e., functions which
+do not obviously return an error code) do not fail.
+They could only fail
+if given invalid arguments, and in that case their behaviour is undefined.
+Functions which take a count of bytes have undefined results if the specified
+.Fa count
+is zero.
+.Sh TYPES
+Several types are defined in
+.In machine/bus.h
+to facilitate use of the
+.Nm
+functions by drivers.
+.Ss Vt bus_addr_t
+The
+.Vt bus_addr_t
+type is used to describe bus addresses.
+It must be an
+unsigned integral type
+capable of holding the largest bus address usable by the architecture.
+This
+type is primarily used when mapping and unmapping bus space.
+.Ss Vt bus_size_t
+The
+.Vt bus_size_t
+type is used to describe sizes of ranges in bus space.
+It must be an
+unsigned integral type capable of holding the size of the largest bus
+address range usable on the architecture.
+This type is used by virtually all
+of the
+.Nm
+functions, describing sizes when mapping regions and
+offsets into regions when performing space access operations.
+.Ss Vt bus_space_tag_t
+The
+.Vt bus_space_tag_t
+type is used to describe a particular bus space on a machine.
+Its
+contents are machine-dependent and should be considered opaque by
+machine-independent code.
+This type is used by all
+.Nm
+functions to name the space on which they are operating.
+.Ss Vt bus_space_handle_t
+The
+.Vt bus_space_handle_t
+type is used to describe a mapping of a range of bus space.
+Its
+contents are machine-dependent and should be considered opaque by
+machine-independent code.
+This type is used when performing bus space
+access operations.
+.Sh MAPPING AND UNMAPPING BUS SPACE
+This section is specific to the
+.Nx
+version of these functions and may or may not apply to the
+.Fx
+version.
+.Pp
+Bus space must be mapped before it can be used, and should be
+unmapped when it is no longer needed.
+The
+.Fn bus_space_map
+and
+.Fn bus_space_unmap
+functions provide these capabilities.
+.Pp
+Some drivers need to be able to pass a subregion of already-mapped bus
+space to another driver or module within a driver.
+The
+.Fn bus_space_subregion
+function allows such subregions to be created.
+.Ss Fn bus_space_map space address size flags handlep
+The
+.Fn bus_space_map
+function maps the region of bus space named by the
+.Fa space , address ,
+and
+.Fa size
+arguments.
+If successful, it returns zero
+and fills in the bus space handle pointed to by
+.Fa handlep
+with the handle
+that can be used to access the mapped region.
+If unsuccessful,
+it will return non-zero and leave the bus space handle pointed
+to by
+.Fa handlep
+in an undefined state.
+.Pp
+The
+.Fa flags
+argument controls how the space is to be mapped.
+Supported flags include:
+.Bl -tag -width ".Dv BUS_SPACE_MAP_CACHEABLE"
+.It Dv BUS_SPACE_MAP_CACHEABLE
+Try to map the space so that accesses can be cached and/or
+prefetched by the system.
+If this flag is not specified, the
+implementation should map the space so that it will not be cached or
+prefetched.
+.Pp
+This flag must have a value of 1 on all implementations for backward
+compatibility.
+.It Dv BUS_SPACE_MAP_LINEAR
+Try to map the space so that its contents can be accessed linearly via
+normal memory access methods (e.g.\& pointer dereferencing and structure
+accesses).
+This is useful when software wants to do direct access to a memory
+device, e.g.\& a frame buffer.
+If this flag is specified and linear
+mapping is not possible, the
+.Fn bus_space_map
+call should fail.
+If this
+flag is not specified, the system may map the space in whatever way is
+most convenient.
+.El
+.Pp
+Not all combinations of flags make sense or are supported with all
+spaces.
+For instance,
+.Dv BUS_SPACE_MAP_CACHEABLE
+may be meaningless when
+used on many systems' I/O port spaces, and on some systems
+.Dv BUS_SPACE_MAP_LINEAR
+without
+.Dv BUS_SPACE_MAP_CACHEABLE
+may never work.
+When the system hardware or firmware provides hints as to how spaces should be
+mapped (e.g.\& the PCI memory mapping registers'
+.Dq prefetchable
+bit), those
+hints should be followed for maximum compatibility.
+On some systems,
+requesting a mapping that cannot be satisfied (e.g.\& requesting a
+non-cacheable mapping when the system can only provide a cacheable one)
+will cause the request to fail.
+.Pp
+Some implementations may keep track of use of bus space for some or all
+bus spaces and refuse to allow duplicate allocations.
+This is encouraged
+for bus spaces which have no notion of slot-specific space addressing,
+such as ISA and VME, and for spaces which coexist with those spaces
+(e.g.\& EISA and PCI memory and I/O spaces co-existing with ISA memory and
+I/O spaces).
+.Pp
+Mapped regions may contain areas for which there is no device on the
+bus.
+If space in those areas is accessed, the results are
+bus-dependent.
+.Ss Fn bus_space_unmap space handle size
+The
+.Fn bus_space_unmap
+function unmaps a region of bus space mapped with
+.Fn bus_space_map .
+When unmapping a region, the
+.Fa size
+specified should be
+the same as the size given to
+.Fn bus_space_map
+when mapping that region.
+.Pp
+After
+.Fn bus_space_unmap
+is called on a handle, that handle is no longer
+valid.
+(If copies were made of the handle they are no longer valid,
+either.)
+.Pp
+This function will never fail.
+If it would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case,
+.Fn bus_space_unmap
+will never return.
+.Ss Fn bus_space_subregion space handle offset size nhandlep
+The
+.Fn bus_space_subregion
+function is a convenience function which makes a
+new handle to some subregion of an already-mapped region of bus space.
+The subregion described by the new handle starts at byte offset
+.Fa offset
+into the region described by
+.Fa handle ,
+with the size give by
+.Fa size ,
+and must be wholly contained within the original region.
+.Pp
+If successful,
+.Fn bus_space_subregion
+returns zero and fills in the bus
+space handle pointed to by
+.Fa nhandlep .
+If unsuccessful, it returns non-zero and leaves the bus space handle
+pointed to by
+.Fa nhandlep
+in an
+undefined state.
+In either case, the handle described by
+.Fa handle
+remains valid and is unmodified.
+.Pp
+When done with a handle created by
+.Fn bus_space_subregion ,
+the handle should
+be thrown away.
+Under no circumstances should
+.Fn bus_space_unmap
+be used on the handle.
+Doing so may confuse any resource management
+being done on the space, and will result in undefined behaviour.
+When
+.Fn bus_space_unmap
+or
+.Fn bus_space_free
+is called on a handle, all subregions of that handle become invalid.
+.Sh ALLOCATING AND FREEING BUS SPACE
+This section is specific to the
+.Nx
+version of these functions and may or may not apply to the
+.Fx
+version.
+.Pp
+Some devices require or allow bus space to be allocated by the operating
+system for device use.
+When the devices no longer need the space, the
+operating system should free it for use by other devices.
+The
+.Fn bus_space_alloc
+and
+.Fn bus_space_free
+functions provide these capabilities.
+.Ss Fn bus_space_alloc space reg_start reg_end size alignment boundary \
+flags addrp handlep
+The
+.Fn bus_space_alloc
+function allocates and maps a region of bus space with the size given by
+.Fa size ,
+corresponding to the given constraints.
+If successful, it returns
+zero, fills in the bus address pointed to by
+.Fa addrp
+with the bus space address of the allocated region, and fills in
+the bus space handle pointed to by
+.Fa handlep
+with the handle that can be used to access that region.
+If unsuccessful, it returns non-zero and leaves the bus address pointed to by
+.Fa addrp
+and the bus space handle pointed to by
+.Fa handlep
+in an undefined state.
+.Pp
+Constraints on the allocation are given by the
+.Fa reg_start , reg_end , alignment ,
+and
+.Fa boundary
+parameters.
+The allocated region will start at or after
+.Fa reg_start
+and end before or at
+.Fa reg_end .
+The
+.Fa alignment
+constraint must be a power of two, and the allocated region will start at
+an address that is an even multiple of that power of two.
+The
+.Fa boundary
+constraint, if non-zero, ensures that the region is allocated so that
+.Fa "first address in region"
+/
+.Fa boundary
+has the same value as
+.Fa "last address in region"
+/
+.Fa boundary .
+If the constraints cannot be met,
+.Fn bus_space_alloc
+will fail.
+It is an error to specify a set of
+constraints that can never be met
+(for example,
+.Fa size
+greater than
+.Fa boundary ) .
+.Pp
+The
+.Fa flags
+parameter is the same as the like-named parameter to
+.Fn bus_space_map ,
+the same flag values should be used, and they have the
+same meanings.
+.Pp
+Handles created by
+.Fn bus_space_alloc
+should only be freed with
+.Fn bus_space_free .
+Trying to use
+.Fn bus_space_unmap
+on them causes undefined behaviour.
+The
+.Fn bus_space_subregion
+function can be used on
+handles created by
+.Fn bus_space_alloc .
+.Ss Fn bus_space_free space handle size
+The
+.Fn bus_space_free
+function unmaps and frees a region of bus space mapped
+and allocated with
+.Fn bus_space_alloc .
+When unmapping a region, the
+.Fa size
+specified should be the same as the size given to
+.Fn bus_space_alloc
+when allocating the region.
+.Pp
+After
+.Fn bus_space_free
+is called on a handle, that handle is no longer valid.
+(If copies were
+made of the handle, they are no longer valid, either.)
+.Pp
+This function will never fail.
+If it would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case,
+.Fn bus_space_free
+will never return.
+.Sh READING AND WRITING SINGLE DATA ITEMS
+The simplest way to access bus space is to read or write a single data
+item.
+The
+.Fn bus_space_read_N
+and
+.Fn bus_space_write_N
+families of functions provide
+the ability to read and write 1, 2, 4, and 8 byte data items on busses
+which support those access sizes.
+.Ss Fn bus_space_read_1 space handle offset
+.Ss Fn bus_space_read_2 space handle offset
+.Ss Fn bus_space_read_4 space handle offset
+.Ss Fn bus_space_read_8 space handle offset
+The
+.Fn bus_space_read_N
+family of functions reads a 1, 2, 4, or 8 byte data item from
+the offset specified by
+.Fa offset
+into the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space .
+The location being read must lie within the bus space region specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data item being read.
+On some systems, not obeying this requirement may cause incorrect data to
+be read, on others it may cause a system crash.
+.Pp
+Read operations done by the
+.Fn bus_space_read_N
+functions may be executed out
+of order with respect to other pending read and write operations unless
+order is enforced by use of the
+.Fn bus_space_barrier
+function.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_write_1 space handle offset value
+.Ss Fn bus_space_write_2 space handle offset value
+.Ss Fn bus_space_write_4 space handle offset value
+.Ss Fn bus_space_write_8 space handle offset value
+The
+.Fn bus_space_write_N
+family of functions writes a 1, 2, 4, or 8 byte data item to the offset
+specified by
+.Fa offset
+into the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space .
+The location being written must lie within
+the bus space region specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data item being
+written.
+On some systems, not obeying this requirement may cause
+incorrect data to be written, on others it may cause a system crash.
+.Pp
+Write operations done by the
+.Fn bus_space_write_N
+functions may be executed
+out of order with respect to other pending read and write operations
+unless order is enforced by use of the
+.Fn bus_space_barrier
+function.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Sh BARRIERS
+In order to allow high-performance buffering implementations to avoid bus
+activity on every operation, read and write ordering should be specified
+explicitly by drivers when necessary.
+The
+.Fn bus_space_barrier
+function provides that ability.
+.Ss Fn bus_space_barrier space handle offset length flags
+The
+.Fn bus_space_barrier
+function enforces ordering of bus space read and write operations
+for the specified subregion (described by the
+.Fa offset
+and
+.Fa length
+parameters) of the region named by
+.Fa handle
+in the space named by
+.Fa space .
+.Pp
+The
+.Fa flags
+argument controls what types of operations are to be ordered.
+Supported flags are:
+.Bl -tag -width ".Dv BUS_SPACE_BARRIER_WRITE"
+.It Dv BUS_SPACE_BARRIER_READ
+Synchronize read operations.
+.It Dv BUS_SPACE_BARRIER_WRITE
+Synchronize write operations.
+.El
+.Pp
+Those flags can be combined (or-ed together) to enforce ordering on both
+read and write operations.
+.Pp
+All of the specified type(s) of operation which are done to the region
+before the barrier operation are guaranteed to complete before any of the
+specified type(s) of operation done after the barrier.
+.Pp
+Example: Consider a hypothetical device with two single-byte ports, one
+write-only input port (at offset 0) and a read-only output port (at
+offset 1).
+Operation of the device is as follows: data bytes are written
+to the input port, and are placed by the device on a stack, the top of
+which is read by reading from the output port.
+The sequence to correctly
+write two data bytes to the device then read those two data bytes back
+would be:
+.Bd -literal
+/*
+ * t and h are the tag and handle for the mapped device's
+ * space.
+ */
+bus_space_write_1(t, h, 0, data0);
+bus_space_barrier(t, h, 0, 1, BUS_SPACE_BARRIER_WRITE); /* 1 */
+bus_space_write_1(t, h, 0, data1);
+bus_space_barrier(t, h, 0, 2,
+ BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); /* 2 */
+ndata1 = bus_space_read_1(t, h, 1);
+bus_space_barrier(t, h, 1, 1, BUS_SPACE_BARRIER_READ); /* 3 */
+ndata0 = bus_space_read_1(t, h, 1);
+/* data0 == ndata0, data1 == ndata1 */
+.Ed
+.Pp
+The first barrier makes sure that the first write finishes before the
+second write is issued, so that two writes to the input port are done
+in order and are not collapsed into a single write.
+This ensures that
+the data bytes are written to the device correctly and in order.
+.Pp
+The second barrier makes sure that the writes to the output port finish
+before any of the reads to the input port are issued, thereby making sure
+that all of the writes are finished before data is read.
+This ensures
+that the first byte read from the device really is the last one that was
+written.
+.Pp
+The third barrier makes sure that the first read finishes before the
+second read is issued, ensuring that data is read correctly and in order.
+.Pp
+The barriers in the example above are specified to cover the absolute
+minimum number of bus space locations.
+It is correct (and often
+easier) to make barrier operations cover the device's whole range of bus
+space, that is, to specify an offset of zero and the size of the
+whole region.
+.Sh REGION OPERATIONS
+Some devices use buffers which are mapped as regions in bus space.
+Often, drivers want to copy the contents of those buffers to or from
+memory, e.g.\& into mbufs which can be passed to higher levels of the
+system or from mbufs to be output to a network.
+In order to allow
+drivers to do this as efficiently as possible, the
+.Fn bus_space_read_region_N
+and
+.Fn bus_space_write_region_N
+families of functions are provided.
+.Pp
+Drivers occasionally need to copy one region of a bus space to another,
+or to set all locations in a region of bus space to contain a single
+value.
+The
+.Fn bus_space_copy_region_N
+family of functions and the
+.Fn bus_space_set_region_N
+family of functions allow drivers to perform these operations.
+.Ss Fn bus_space_read_region_1 space handle offset datap count
+.Ss Fn bus_space_read_region_2 space handle offset datap count
+.Ss Fn bus_space_read_region_4 space handle offset datap count
+.Ss Fn bus_space_read_region_8 space handle offset datap count
+The
+.Fn bus_space_read_region_N
+family of functions reads
+.Fa count
+1, 2, 4, or 8 byte data items from bus space
+starting at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space
+and writes them into the array specified by
+.Fa datap .
+Each successive data item is read from an offset
+1, 2, 4, or 8 bytes after the previous data item (depending on which
+function is used).
+All locations being read must lie within the bus
+space region specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+read and the data array pointer should be properly aligned.
+On some
+systems, not obeying these requirements may cause incorrect data to be
+read, on others it may cause a system crash.
+.Pp
+Read operations done by the
+.Fn bus_space_read_region_N
+functions may be executed in any order.
+They may also be executed out
+of order with respect to other pending read and write operations unless
+order is enforced by use of the
+.Fn bus_space_barrier
+function.
+There is no way to insert barriers between reads of
+individual bus space locations executed by the
+.Fn bus_space_read_region_N
+functions.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_write_region_1 space handle offset datap count
+.Ss Fn bus_space_write_region_2 space handle offset datap count
+.Ss Fn bus_space_write_region_4 space handle offset datap count
+.Ss Fn bus_space_write_region_8 space handle offset datap count
+The
+.Fn bus_space_write_region_N
+family of functions reads
+.Fa count
+1, 2, 4, or 8 byte data items from the array
+specified by
+.Fa datap
+and writes them to bus space starting at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified
+by
+.Fa space .
+Each successive data item is written to an offset 1, 2, 4,
+or 8 bytes after the previous data item (depending on which function is
+used).
+All locations being written must lie within the bus space region
+specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+written and the data array pointer should be properly aligned.
+On some
+systems, not obeying these requirements may cause incorrect data to be
+written, on others it may cause a system crash.
+.Pp
+Write operations done by the
+.Fn bus_space_write_region_N
+functions may be
+executed in any order.
+They may also be executed out of order with
+respect to other pending read and write operations unless order is
+enforced by use of the
+.Fn bus_space_barrier
+function.
+There is no way to insert barriers between writes of
+individual bus space locations executed by the
+.Fn bus_space_write_region_N
+functions.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_copy_region_1 space srchandle srcoffset dsthandle \
+dstoffset count
+.Ss Fn bus_space_copy_region_2 space srchandle srcoffset dsthandle \
+dstoffset count
+.Ss Fn bus_space_copy_region_4 space srchandle srcoffset dsthandle \
+dstoffset count
+.Ss Fn bus_space_copy_region_8 space srchandle srcoffset dsthandle \
+dstoffset count
+The
+.Fn bus_space_copy_region_N
+family of functions copies
+.Fa count
+1, 2, 4, or 8 byte data items in bus space
+from the area starting at byte offset
+.Fa srcoffset
+in the region specified by
+.Fa srchandle
+of the bus space specified by
+.Fa space
+to the area starting at byte offset
+.Fa dstoffset
+in the region specified by
+.Fa dsthandle
+in the same bus space.
+Each successive data item read or written has
+an offset 1, 2, 4, or 8 bytes after the previous data item (depending
+on which function is used).
+All locations being read and written must
+lie within the bus space region specified by their respective handles.
+.Pp
+For portability, the starting addresses of the regions specified by the
+each handle plus its respective offset should be a multiple of the size
+of data items being copied.
+On some systems, not obeying this
+requirement may cause incorrect data to be copied, on others it may cause
+a system crash.
+.Pp
+Read and write operations done by the
+.Fn bus_space_copy_region_N
+functions may be executed in any order.
+They may also be executed out
+of order with respect to other pending read and write operations unless
+order is enforced by use of the
+.Fn bus_space_barrier function .
+There is no way to insert barriers between reads or writes of
+individual bus space locations executed by the
+.Fn bus_space_copy_region_N
+functions.
+.Pp
+Overlapping copies between different subregions of a single region
+of bus space are handled correctly by the
+.Fn bus_space_copy_region_N
+functions.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_set_region_1 space handle offset value count
+.Ss Fn bus_space_set_region_2 space handle offset value count
+.Ss Fn bus_space_set_region_4 space handle offset value count
+.Ss Fn bus_space_set_region_8 space handle offset value count
+The
+.Fn bus_space_set_region_N
+family of functions writes the given
+.Fa value
+to
+.Fa count
+1, 2, 4, or 8 byte
+data items in bus space starting at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space .
+Each successive data item has an offset 1, 2, 4, or 8 bytes after the
+previous data item (depending on which function is used).
+All
+locations being written must lie within the bus space region specified
+by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+written.
+On some systems, not obeying this requirement may cause
+incorrect data to be written, on others it may cause a system crash.
+.Pp
+Write operations done by the
+.Fn bus_space_set_region_N
+functions may be
+executed in any order.
+They may also be executed out of order with
+respect to other pending read and write operations unless order is
+enforced by use of the
+.Fn bus_space_barrier
+function.
+There is no way to insert barriers between writes of
+individual bus space locations executed by the
+.Fn bus_space_set_region_N
+functions.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Sh READING AND WRITING A SINGLE LOCATION MULTIPLE TIMES
+Some devices implement single locations in bus space which are to be read
+or written multiple times to communicate data, e.g.\& some ethernet
+devices' packet buffer FIFOs.
+In order to allow drivers to manipulate
+these types of devices as efficiently as possible, the
+.Fn bus_space_read_multi_N ,
+.Fn bus_space_set_multi_N ,
+and
+.Fn bus_space_write_multi_N
+families of functions are provided.
+.Ss Fn bus_space_read_multi_1 space handle offset datap count
+.Ss Fn bus_space_read_multi_2 space handle offset datap count
+.Ss Fn bus_space_read_multi_4 space handle offset datap count
+.Ss Fn bus_space_read_multi_8 space handle offset datap count
+The
+.Fn bus_space_read_multi_N
+family of functions reads
+.Fa count
+1, 2, 4, or 8 byte data items from bus space
+at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space
+and writes them into the array specified by
+.Fa datap .
+Each successive data item is read from the same location in bus
+space.
+The location being read must lie within the bus space region
+specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+read and the data array pointer should be properly aligned.
+On some
+systems, not obeying these requirements may cause incorrect data to be
+read, on others it may cause a system crash.
+.Pp
+Read operations done by the
+.Fn bus_space_read_multi_N
+functions may be
+executed out of order with respect to other pending read and write
+operations unless order is enforced by use of the
+.Fn bus_space_barrier
+function.
+Because the
+.Fn bus_space_read_multi_N
+functions read the same bus space location multiple times, they
+place an implicit read barrier between each successive read of that bus
+space location.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_write_multi_1 space handle offset datap count
+.Ss Fn bus_space_write_multi_2 space handle offset datap count
+.Ss Fn bus_space_write_multi_4 space handle offset datap count
+.Ss Fn bus_space_write_multi_8 space handle offset datap count
+The
+.Fn bus_space_write_multi_N
+family of functions reads
+.Fa count
+1, 2, 4, or 8 byte data items from the array
+specified by
+.Fa datap
+and writes them into bus space at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space .
+Each successive data item is written to the same location in
+bus space.
+The location being written must lie within the bus space
+region specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+written and the data array pointer should be properly aligned.
+On some
+systems, not obeying these requirements may cause incorrect data to be
+written, on others it may cause a system crash.
+.Pp
+Write operations done by the
+.Fn bus_space_write_multi_N
+functions may be executed out of order with respect to other pending
+read and write operations unless order is enforced by use of the
+.Fn bus_space_barrier
+function.
+Because the
+.Fn bus_space_write_multi_N
+functions write the same bus space location multiple times, they
+place an implicit write barrier between each successive write of that
+bus space location.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Ss Fn bus_space_set_multi_1 space handle offset value count
+.Ss Fn bus_space_set_multi_2 space handle offset value count
+.Ss Fn bus_space_set_multi_4 space handle offset value count
+.Ss Fn bus_space_set_multi_8 space handle offset value count
+The
+.Fn bus_space_set_multi_N
+writes
+.Fa value
+into bus space at byte offset
+.Fa offset
+in the region specified by
+.Fa handle
+of the bus space specified by
+.Fa space ,
+.Fa count
+times.
+The location being written must lie within the bus space
+region specified by
+.Fa handle .
+.Pp
+For portability, the starting address of the region specified by
+.Fa handle
+plus the offset should be a multiple of the size of data items being
+written and the data array pointer should be properly aligned.
+On some
+systems, not obeying these requirements may cause incorrect data to be
+written, on others it may cause a system crash.
+.Pp
+Write operations done by the
+.Fn bus_space_set_multi_N
+functions may be executed out of order with respect to other pending
+read and write operations unless order is enforced by use of the
+.Fn bus_space_barrier
+function.
+Because the
+.Fn bus_space_set_multi_N
+functions write the same bus space location multiple times, they
+place an implicit write barrier between each successive write of that
+bus space location.
+.Pp
+These functions will never fail.
+If they would fail (e.g.\& because of an
+argument error), that indicates a software bug which should cause a
+panic.
+In that case, they will never return.
+.Sh STREAM FUNCTIONS
+Most of the
+.Nm
+functions imply a host byte-order and a bus byte-order and take care of
+any translation for the caller.
+In some cases, however, hardware may map a FIFO or some other memory region
+for which the caller may want to use multi-word, yet untranslated access.
+Access to these types of memory regions should be with the
+.Fn bus_space_*_stream_N
+functions.
+.Pp
+.Bl -tag -compact
+.It Fn bus_space_read_stream_1
+.It Fn bus_space_read_stream_2
+.It Fn bus_space_read_stream_4
+.It Fn bus_space_read_stream_8
+.It Fn bus_space_read_multi_stream_1
+.It Fn bus_space_read_multi_stream_2
+.It Fn bus_space_read_multi_stream_4
+.It Fn bus_space_read_multi_stream_8
+.It Fn bus_space_read_region_stream_1
+.It Fn bus_space_read_region_stream_2
+.It Fn bus_space_read_region_stream_4
+.It Fn bus_space_read_region_stream_8
+.It Fn bus_space_write_stream_1
+.It Fn bus_space_write_stream_2
+.It Fn bus_space_write_stream_4
+.It Fn bus_space_write_stream_8
+.It Fn bus_space_write_multi_stream_1
+.It Fn bus_space_write_multi_stream_2
+.It Fn bus_space_write_multi_stream_4
+.It Fn bus_space_write_multi_stream_8
+.It Fn bus_space_write_region_stream_1
+.It Fn bus_space_write_region_stream_2
+.It Fn bus_space_write_region_stream_4
+.It Fn bus_space_write_region_stream_8
+.It Fn bus_space_copy_region_stream_1
+.It Fn bus_space_copy_region_stream_2
+.It Fn bus_space_copy_region_stream_4
+.It Fn bus_space_copy_region_stream_8
+.It Fn bus_space_set_multi_stream_1
+.It Fn bus_space_set_multi_stream_2
+.It Fn bus_space_set_multi_stream_4
+.It Fn bus_space_set_multi_stream_8
+.It Fn bus_space_set_region_stream_1
+.It Fn bus_space_set_region_stream_2
+.It Fn bus_space_set_region_stream_4
+.It Fn bus_space_set_region_stream_8
+.El
+.Pp
+These functions are defined just as their non-stream counterparts,
+except that they provide no byte-order translation.
+.Sh COMPATIBILITY
+The current
+.Nx
+version of the
+.Nm
+interface specification differs slightly from the original
+specification that came into wide use and
+.Fx
+adopted.
+A few of the function names and arguments have changed
+for consistency and increased functionality.
+.Sh SEE ALSO
+.Xr bus_dma 9
+.Sh HISTORY
+The
+.Nm
+functions were introduced in a different form (memory and I/O spaces
+were accessed via different sets of functions) in
+.Nx 1.2 .
+The functions were merged to work on generic
+.Dq spaces
+early in the
+.Nx 1.3
+development cycle, and many drivers were converted to use them.
+This document was written later during the
+.Nx 1.3
+development cycle, and the specification was updated to fix some
+consistency problems and to add some missing functionality.
+.Pp
+The manual page was then adapted to the version of the interface that
+.Fx
+imported for the CAM SCSI drivers, plus subsequent evolution.
+The
+.Fx
+.Nm
+version was imported in
+.Fx 3.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+interfaces were designed and implemented by the
+.Nx
+developer
+community.
+Primary contributors and implementors were
+.An Chris Demetriou ,
+.An Jason Thorpe ,
+and
+.An Charles Hannum ,
+but the rest of the
+.Nx
+developers and the user community played a significant role in development.
+.Pp
+.An Justin Gibbs
+ported these interfaces to
+.Fx .
+.Pp
+.An Chris Demetriou
+wrote this manual page.
+.Pp
+.An Warner Losh
+modified it for the
+.Fx
+implementation.
+.Sh BUGS
+This manual may not completely and accurately document the interface,
+and many parts of the interface are unspecified.
diff --git a/share/man/man9/byteorder.9 b/share/man/man9/byteorder.9
new file mode 100644
index 000000000000..20e31362a36c
--- /dev/null
+++ b/share/man/man9/byteorder.9
@@ -0,0 +1,169 @@
+.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 29, 2002
+.Dt BYTEORDER 9
+.Os
+.Sh NAME
+.Nm bswap16 , bswap32 , bswap64 ,
+.Nm be16toh , be32toh , be64toh , htobe16 , htobe32 , htobe64 ,
+.Nm htole16 , htole32 , htole64 , le16toh , le32toh , le64toh ,
+.Nm be16enc , be16dec , be32enc , be32dec , be64enc , be64dec ,
+.Nm le16enc , le16dec , le32enc , le32dec , le64enc , le64dec
+.Nd byte order operations
+.Sh SYNOPSIS
+.In sys/endian.h
+.Ft uint16_t
+.Fn bswap16 "uint16_t int16"
+.Ft uint32_t
+.Fn bswap32 "uint32_t int32"
+.Ft uint64_t
+.Fn bswap64 "uint64_t int64"
+.Ft uint16_t
+.Fn be16toh "uint16_t big16"
+.Ft uint32_t
+.Fn be32toh "uint32_t big32"
+.Ft uint64_t
+.Fn be64toh "uint64_t big64"
+.Ft uint16_t
+.Fn htobe16 "uint16_t host16"
+.Ft uint32_t
+.Fn htobe32 "uint32_t host32"
+.Ft uint64_t
+.Fn htobe64 "uint64_t host64"
+.Ft uint16_t
+.Fn htole16 "uint16_t host16"
+.Ft uint32_t
+.Fn htole32 "uint32_t host32"
+.Ft uint64_t
+.Fn htole64 "uint64_t host64"
+.Ft uint16_t
+.Fn le16toh "uint16_t little16"
+.Ft uint32_t
+.Fn le32toh "uint32_t little32"
+.Ft uint64_t
+.Fn le64toh "uint64_t little64"
+.Ft uint16_t
+.Fn be16dec "const void *"
+.Ft uint32_t
+.Fn be32dec "const void *"
+.Ft uint64_t
+.Fn be64dec "const void *"
+.Ft uint16_t
+.Fn le16dec "const void *"
+.Ft uint32_t
+.Fn le32dec "const void *"
+.Ft uint64_t
+.Fn le64dec "const void *"
+.Ft void
+.Fn be16enc "void *" uint16_t
+.Ft void
+.Fn be32enc "void *" uint32_t
+.Ft void
+.Fn be64enc "void *" uint64_t
+.Ft void
+.Fn le16enc "void *" uint16_t
+.Ft void
+.Fn le32enc "void *" uint32_t
+.Ft void
+.Fn le64enc "void *" uint64_t
+.Sh DESCRIPTION
+The
+.Fn bswap16 ,
+.Fn bswap32 ,
+and
+.Fn bswap64
+functions return a byte order swapped integer.
+On big endian systems, the number is converted to little endian byte order.
+On little endian systems, the number is converted to big endian byte order.
+.Pp
+The
+.Fn be16toh ,
+.Fn be32toh ,
+and
+.Fn be64toh
+functions return a big endian byte ordered integer
+converted to the system's native byte order.
+The return value will be the same as the argument on big endian systems.
+.Pp
+The
+.Fn le16toh ,
+.Fn le32toh ,
+and
+.Fn le64toh
+functions return a little endian byte ordered integer
+converted to the system's native byte order.
+The return value will be the same as the argument on little endian systems.
+.Pp
+The
+.Fn htobe16 ,
+.Fn htobe32 ,
+and
+.Fn htobe64
+functions return an integer in the system's native
+byte order converted to big endian byte order.
+The return value will be the same as the argument on big endian systems.
+.Pp
+The
+.Fn htole16 ,
+.Fn htole32 ,
+and
+.Fn htole64
+functions return a integer in the system's native
+byte order converted to little endian byte order.
+The return value will be the same as the argument on little endian systems.
+.Pp
+The
+.Fn be16enc ,
+.Fn be16dec ,
+.Fn be32enc ,
+.Fn be32dec ,
+.Fn be64enc ,
+.Fn be64dec ,
+.Fn le16enc ,
+.Fn le16dec ,
+.Fn le32enc ,
+.Fn le32dec ,
+.Fn le64enc ,
+and
+.Fn le64dec
+functions encode and decode integers to/from byte strings on any alignment
+in big/little endian format.
+.Sh SEE ALSO
+.Xr byteorder 3
+.Sh HISTORY
+The
+.Fn hto*
+and
+.Fn toh*
+functions first appeared in
+.Fx 5.0 ,
+and were originally developed by the
+.Nx
+project.
+.Pp
+The encode/decode functions first appeared in
+.Fx 5.1 .
diff --git a/share/man/man9/cd.9 b/share/man/man9/cd.9
new file mode 100644
index 000000000000..59f796dc3d24
--- /dev/null
+++ b/share/man/man9/cd.9
@@ -0,0 +1,126 @@
+.\" Copyright (c) 1997
+.\" John-Mark Gurney. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 2, 2003
+.Dt CD 9
+.Os
+.Sh NAME
+.Nm cd
+.Nd CDROM driver for the CAM SCSI subsystem
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides a read only interface for CDROM drives
+.Tn ( SCSI
+type 5)
+and WORM drives
+.Tn ( SCSI
+type 4)
+that support CDROM type commands.
+Some drives do not behave as the driver expects.
+See the
+.Sx QUIRKS
+section for information on possible flags.
+.Sh QUIRKS
+Each
+.Tn CD-ROM
+device can have different interpretations of the
+.Tn SCSI
+spec.
+This can lead to drives requiring special handling in the driver.
+The following is a list of quirks that the driver recognize.
+.Bl -tag -width CD_Q_BCD_TRACKS
+.It Dv CD_Q_NO_TOUCH
+This flag tell the driver not to probe the drive at attach time to see if
+there is a disk in the drive and find out what size it is.
+This flag is currently unimplemented in the CAM
+.Nm
+driver.
+.It Dv CD_Q_BCD_TRACKS
+This flag is for broken drives that return the track numbers in packed BCD
+instead of straight decimal.
+If the drive seems to skip tracks
+(tracks 10-15 are skipped)
+then you have a drive that is in need of this flag.
+.It Dv CD_Q_NO_CHANGER
+This flag tells the driver that the device in question is not a changer.
+This is only necessary for a CDROM device with multiple luns that are not a
+part of a changer.
+.It Dv CD_Q_CHANGER
+This flag tells the driver that the given device is a multi-lun changer.
+In general, the driver will figure this out automatically when it sees a
+LUN greater than 0.
+Setting this flag only has the effect of telling the
+driver to run the initial read capacity command for LUN 0 of the changer
+through the changer scheduling code.
+.It Dv CD_Q_10_BYTE_ONLY
+This flag tells the driver that the given device only accepts 10 byte MODE
+SENSE/MODE SELECT commands.
+In general these types of quirks should not be
+added to the
+.Xr cd 4
+driver.
+The reason is that the driver does several things to attempt to
+determine whether the drive in question needs 10 byte commands.
+First, it
+issues a CAM Path Inquiry command to determine whether the protocol that
+the drive speaks typically only allows 10 byte commands.
+(ATAPI and USB
+are two prominent examples of protocols where you generally only want to
+send 10 byte commands.)
+Then, if it gets an ILLEGAL REQUEST error back
+from a 6 byte MODE SENSE or MODE SELECT command, it attempts to send the 10
+byte version of the command instead.
+The only reason you would need a
+quirk is if your drive uses a protocol (e.g.,
+.Tn SCSI )
+that typically does not have a problem with 6 byte commands.
+.El
+.Sh FILES
+.Bl -tag -width /sys/cam/scsi/scsi_cd.c -compact
+.It Pa /sys/cam/scsi/scsi_cd.c
+is the driver source file.
+.El
+.Sh SEE ALSO
+.Xr cd 4 ,
+.Xr scsi 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 2.2 .
+.Sh AUTHORS
+.An -nosplit
+This
+manual page was written by
+.An John-Mark Gurney Aq gurney_j@efn.org .
+It was updated for CAM and
+.Fx 3.0
+by
+.An Kenneth Merry Aq ken@FreeBSD.org .
diff --git a/share/man/man9/condvar.9 b/share/man/man9/condvar.9
new file mode 100644
index 000000000000..7b89d46d628b
--- /dev/null
+++ b/share/man/man9/condvar.9
@@ -0,0 +1,233 @@
+.\"
+.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 5, 2007
+.Dt CONDVAR 9
+.Os
+.Sh NAME
+.Nm condvar ,
+.Nm cv_init ,
+.Nm cv_destroy ,
+.Nm cv_wait ,
+.Nm cv_wait_sig ,
+.Nm cv_wait_unlock ,
+.Nm cv_timedwait ,
+.Nm cv_timedwait_sig ,
+.Nm cv_signal ,
+.Nm cv_broadcast ,
+.Nm cv_broadcastpri ,
+.Nm cv_wmesg
+.Nd kernel condition variable
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.In sys/condvar.h
+.Ft void
+.Fn cv_init "struct cv *cvp" "const char *desc"
+.Ft void
+.Fn cv_destroy "struct cv *cvp"
+.Ft void
+.Fn cv_wait "struct cv *cvp" "lock"
+.Ft int
+.Fn cv_wait_sig "struct cv *cvp" "lock"
+.Ft void
+.Fn cv_wait_unlock "struct cv *cvp" "lock"
+.Ft int
+.Fn cv_timedwait "struct cv *cvp" "lock" "int timo"
+.Ft int
+.Fn cv_timedwait_sig "struct cv *cvp" "lock" "int timo"
+.Ft void
+.Fn cv_signal "struct cv *cvp"
+.Ft void
+.Fn cv_broadcast "struct cv *cvp"
+.Ft void
+.Fn cv_broadcastpri "struct cv *cvp" "int pri"
+.Ft const char *
+.Fn cv_wmesg "struct cv *cvp"
+.Sh DESCRIPTION
+Condition variables are used in conjunction with mutexes to wait for conditions
+to occur.
+Condition variables are created with
+.Fn cv_init ,
+where
+.Fa cvp
+is a pointer to space for a
+.Vt struct cv ,
+and
+.Fa desc
+is a pointer to a null-terminated character string that describes the condition
+variable.
+Condition variables are destroyed with
+.Fn cv_destroy .
+Threads wait on condition variables by calling
+.Fn cv_wait ,
+.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
+.Fn cv_timedwait ,
+or
+.Fn cv_timedwait_sig .
+Threads unblock waiters by calling
+.Fn cv_signal
+to unblock one waiter, or
+.Fn cv_broadcast
+or
+.Fn cv_broadcastpri
+to unblock all waiters.
+In addition to waking waiters,
+.Fn cv_broadcastpri
+ensures that all of the waiters have a priority of at least
+.Fa pri
+by raising the priority of any threads that do not.
+.Fn cv_wmesg
+returns the description string of
+.Fa cvp ,
+as set by the initial call to
+.Fn cv_init .
+.Pp
+The
+.Fa lock
+argument is a pointer to either a
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+or
+.Xr sx 9
+lock.
+A
+.Xr mutex 9
+argument must be initialized with
+.Dv MTX_DEF
+and not
+.Dv MTX_SPIN .
+A thread must hold
+.Fa lock
+before calling
+.Fn cv_wait ,
+.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
+.Fn cv_timedwait ,
+or
+.Fn cv_timedwait_sig .
+When a thread waits on a condition,
+.Fa lock
+is atomically released before the thread is blocked, then reacquired
+before the function call returns.
+In addition, the thread will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the it is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
+The
+.Fn cv_wait_unlock
+function does not reacquire the lock before returning.
+Note that the
+.Va Giant
+mutex may be specified as
+.Fa lock .
+However,
+.Va Giant
+may not be used as
+.Fa lock
+for the
+.Fn cv_wait_unlock
+function.
+All waiters must pass the same
+.Fa lock
+in conjunction with
+.Fa cvp .
+.Pp
+When
+.Fn cv_wait ,
+.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
+.Fn cv_timedwait ,
+and
+.Fn cv_timedwait_sig
+unblock, their calling threads are made runnable.
+.Fn cv_timedwait
+and
+.Fn cv_timedwait_sig
+wait for at most
+.Fa timo
+/
+.Dv HZ
+seconds before being unblocked and returning
+.Er EWOULDBLOCK ;
+otherwise, they return 0.
+.Fn cv_wait_sig
+and
+.Fn cv_timedwait_sig
+return prematurely with a value of
+.Er EINTR
+or
+.Er ERESTART
+if a signal is caught, or 0 if signaled via
+.Fn cv_signal
+or
+.Fn cv_broadcast .
+.Sh RETURN VALUES
+If successful,
+.Fn cv_wait_sig ,
+.Fn cv_timedwait ,
+and
+.Fn cv_timedwait_sig
+return 0.
+Otherwise, a non-zero error code is returned.
+.Pp
+.Fn cv_wmesg
+returns the description string that was passed to
+.Fn cv_init .
+.Sh ERRORS
+.Fn cv_wait_sig
+and
+.Fn cv_timedwait_sig
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINTR
+A signal was caught and the system call should be interrupted.
+.It Bq Er ERESTART
+A signal was caught and the system call should be restarted.
+.El
+.Pp
+.Fn cv_timedwait
+and
+.Fn cv_timedwait_sig
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EWOULDBLOCK
+Timeout expired.
+.El
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr mtx_pool 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sleep 9 ,
+.Xr sx 9
diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9
new file mode 100644
index 000000000000..083a2a2a375c
--- /dev/null
+++ b/share/man/man9/config_intrhook.9
@@ -0,0 +1,105 @@
+.\"
+.\" Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 24, 2006
+.Dt CONFIG_INTRHOOK 9
+.Os
+.Sh NAME
+.Nm config_intrhook
+.Nd schedule a function to be run after interrupts have been enabled,
+but before root is mounted
+.Sh SYNOPSIS
+.In sys/kernel.h
+.Ft int
+.Fn config_intrhook_establish "struct intr_config_hook *hook"
+.Ft void
+.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
+.Sh DESCRIPTION
+The
+.Fn config_intrhook_establish
+function schedules a function to be run after interrupts have been
+enabled, but before root is mounted.
+If the system has already passed this point in its initialization,
+the function is called immediately.
+.Pp
+The
+.Fn config_intrhook_disestablish
+function removes the entry from the hook queue.
+.Pp
+Before root is mounted, all the previously established hooks are
+run.
+The boot process is then stalled until all handlers remove their hook
+from the hook queue with
+.Fn config_intrhook_disestablish .
+The boot process then proceeds to attempt to mount the root file
+system.
+Any driver that can potentially provide devices they wish to be
+mounted as root must use either this hook, or probe all these devices
+in the initial probe.
+Since interrupts are disabled during the probe process, many drivers
+need a method to probe for devices with interrupts enabled.
+.Pp
+The requests are made with the
+.Vt intr_config_hook
+structure.
+This structure is defined as follows:
+.Bd -literal
+struct intr_config_hook {
+ TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
+ void (*ich_func)(void *arg); /* function to call */
+ void *ich_arg; /* Argument to call */
+};
+.Ed
+.Pp
+Storage for the
+.Vt intr_config_hook
+structure must be provided by the driver.
+It must be stable from just before the hook is established until
+after the hook is disestablished.
+.Pp
+Specifically, hooks are run at
+.Fn SI_SUB_INT_CONFIG_HOOKS ,
+which is immediately after the scheduler is started,
+and just before the root file system device is discovered.
+.Sh RETURN VALUES
+A zero return value means the hook was successfully added to the queue
+(with either deferred or immediate execution).
+A non-zero return value means the hook could not be added to the queue
+because it was already on the queue.
+.Sh SEE ALSO
+.Xr DEVICE_ATTACH 9
+.Sh HISTORY
+These functions were introduced in
+.Fx 3.0
+with the CAM subsystem, but are available for any driver to use.
+.Sh AUTHORS
+.An -nosplit
+The functions were written by
+.An Justin Gibbs Aq gibbs@FreeBSD.org .
+This manual page was written by
+.An M. Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/contigmalloc.9 b/share/man/man9/contigmalloc.9
new file mode 100644
index 000000000000..ba1f42860484
--- /dev/null
+++ b/share/man/man9/contigmalloc.9
@@ -0,0 +1,132 @@
+.\"
+.\" Copyright (c) 2004 Joseph Koshy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2007
+.Dt CONTIGMALLOC 9
+.Os
+.Sh NAME
+.Nm contigmalloc , contigfree
+.Nd manage contiguous kernel physical memory
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/malloc.h
+.Ft "void *"
+.Fo contigmalloc
+.Fa "unsigned long size"
+.Fa "struct malloc_type *type"
+.Fa "int flags"
+.Fa "vm_paddr_t low"
+.Fa "vm_paddr_t high"
+.Fa "unsigned long alignment"
+.Fa "vm_paddr_t boundary"
+.Fc
+.Ft void
+.Fo contigfree
+.Fa "void *addr"
+.Fa "unsigned long size"
+.Fa "struct malloc_type *type"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn contigmalloc
+function allocates
+.Fa size
+bytes of contiguous physical memory that is aligned to
+.Fa alignment
+bytes, and which does not cross a boundary of
+.Fa boundary
+bytes.
+If successful, the allocation will reside between physical addresses
+.Fa low
+and
+.Fa high .
+The returned pointer points to a wired kernel virtual
+address range of
+.Fa size
+bytes allocated from the kernel virtual address (KVA) map.
+.Pp
+The
+.Fa flags
+parameter modifies
+.Fn contigmalloc Ns 's
+behaviour as follows:
+.Bl -tag -width indent
+.It Dv M_ZERO
+Causes the allocated physical memory to be zero filled.
+.It Dv M_NOWAIT
+Causes
+.Fn contigmalloc
+to return
+.Dv NULL
+if the request cannot be immediately fulfilled due to resource shortage.
+.El
+.Pp
+Other flags (if present) are ignored.
+.Pp
+The
+.Fn contigfree
+function deallocates memory allocated by a previous call to
+.Fn contigmalloc .
+.Sh IMPLEMENTATION NOTES
+The
+.Fn contigmalloc
+function does not sleep waiting for memory resources to be freed up,
+but instead actively reclaims pages before giving up.
+However, unless
+.Dv M_NOWAIT
+is specified, it may select a page for reclamation that must first be
+written to backing storage, causing it to sleep.
+.Sh RETURN VALUES
+The
+.Fn contigmalloc
+function returns a kernel virtual address if allocation succeeds,
+or
+.Dv NULL
+otherwise.
+.Sh EXAMPLES
+.Bd -literal
+void *p;
+p = contigmalloc(8192, M_DEVBUF, M_ZERO, 0, (1L << 22),
+ 32 * 1024, 1024 * 1024);
+.Ed
+.Pp
+Ask for 8192 bytes of zero-filled memory residing between physical
+address 0 and 4194303 inclusive, aligned to a 32K boundary and not
+crossing a 1M address boundary.
+.Sh DIAGNOSTICS
+The
+.Fn contigmalloc
+function will panic if
+.Fa size
+is zero, or if
+.Fa alignment
+or
+.Fa boundary
+is not a power of two.
+.Sh SEE ALSO
+.Xr malloc 9 ,
+.Xr memguard 9
diff --git a/share/man/man9/copy.9 b/share/man/man9/copy.9
new file mode 100644
index 000000000000..37c7a0c47d9a
--- /dev/null
+++ b/share/man/man9/copy.9
@@ -0,0 +1,173 @@
+.\" $NetBSD: copy.9,v 1.2 1996/01/09 03:23:04 thorpej Exp $
+.\"
+.\" Copyright (c) 1996 Jason R. Thorpe.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed by Kenneth Stailey.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Jason R. Thorpe.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2011
+.Dt COPY 9
+.Os
+.Sh NAME
+.Nm copy ,
+.Nm copyin ,
+.Nm copyin_nofault ,
+.Nm copyout ,
+.Nm copyout_nofault ,
+.Nm copystr ,
+.Nm copyinstr
+.Nd kernel copy functions
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft int
+.Fn copyin "const void *uaddr" "void *kaddr" "size_t len"
+.Ft int
+.Fn copyin_nofault "const void *uaddr" "void *kaddr" "size_t len"
+.Ft int
+.Fn copyout "const void *kaddr" "void *uaddr" "size_t len"
+.Ft int
+.Fn copyout_nofault "const void *kaddr" "void *uaddr" "size_t len"
+.Ft int
+.Fn copystr "const void *kfaddr" "void *kdaddr" "size_t len" "size_t *done"
+.Ft int
+.Fn copyinstr "const void *uaddr" "void *kaddr" "size_t len" "size_t *done"
+.\" .Ft int
+.\" .Fn copyoutstr "const void *kaddr" "void *uaddr" "size_t len" "size_t *done"
+.Sh DESCRIPTION
+The
+.Nm
+functions are designed to copy contiguous data from one address
+to another.
+All but
+.Fn copystr
+copy data from user-space to kernel-space or vice-versa.
+.Pp
+The
+.Fn copyin
+and
+.Fn copyin_nofault
+functions copy
+.Fa len
+bytes of data from the user-space address
+.Fa uaddr
+to the kernel-space address
+.Fa kaddr .
+.Pp
+The
+.Fn copyout
+and
+.Fn copyout_nofault
+functions copy
+.Fa len
+bytes of data from the kernel-space address
+.Fa kaddr
+to the user-space address
+.Fa uaddr .
+.Pp
+The
+.Fn copyin_nofault
+and
+.Fn copyout_nofault
+functions require that the kernel-space and user-space data be
+accessible without incurring a page fault.
+The source and destination addresses must be physically mapped for
+read and write access, respectively, and neither the source nor
+destination addresses may be pageable.
+.Pp
+The
+.Fn copystr
+function copies a NUL-terminated string, at most
+.Fa len
+bytes long, from kernel-space address
+.Fa kfaddr
+to kernel-space address
+.Fa kdaddr .
+The number of bytes actually copied, including the terminating
+NUL, is returned in
+.Fa *done
+(if
+.Fa done
+is
+.No non- Ns Dv NULL ) .
+.Pp
+The
+.Fn copyinstr
+function copies a NUL-terminated string, at most
+.Fa len
+bytes long, from user-space address
+.Fa uaddr
+to kernel-space address
+.Fa kaddr .
+The number of bytes actually copied, including the terminating
+NUL, is returned in
+.Fa *done
+(if
+.Fa done
+is
+.No non- Ns Dv NULL ) .
+.\" .It Fn copyoutstr
+.\" Copies a NUL-terminated string, at most
+.\" bytes long, from kernel-space address
+.\" .Fa kaddr
+.\" to user-space address
+.\" .Fa uaddr .
+.\" The number of bytes actually copied, including the terminating
+.\" NUL, is returned in
+.\" .Fa *done .
+.Sh RETURN VALUES
+The
+.Nm
+functions return 0 on success or
+.Er EFAULT
+if a bad address is encountered.
+In addition, the
+.Fn copyin_nofault
+and
+.Fn copyout_nofault
+functions return
+.Er EFAULT
+if a page fault occurs, and the
+.Fn copystr
+and
+.Fn copyinstr
+.\" .Fn copyinstr ,
+.\" and
+.\" .Fn copyoutstr
+functions return
+.Er ENAMETOOLONG
+if the string is longer than
+.Fa len
+bytes.
+.Sh SEE ALSO
+.Xr fetch 9 ,
+.Xr store 9
diff --git a/share/man/man9/cr_cansee.9 b/share/man/man9/cr_cansee.9
new file mode 100644
index 000000000000..c4cc2d4a861e
--- /dev/null
+++ b/share/man/man9/cr_cansee.9
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright (c) 2006 Ceri Davies <ceri@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 19, 2006
+.Dt CR_CANSEE 9
+.Os
+.Sh NAME
+.Nm cr_cansee
+.Nd "determine visibility of objects given their user credentials"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/ucred.h
+.Ft int
+.Fn cr_cansee "struct ucred *u1" "struct ucred *u2"
+.Sh DESCRIPTION
+This function determines the visibility of objects in the
+kernel based on the real user IDs and group IDs in the credentials
+.Fa u1
+and
+.Fa u2
+associated with them.
+.Pp
+The visibility of objects is influenced by the
+.Xr sysctl 8
+variables
+.Va security.bsd.see_other_gids
+and
+.Va security.bsd.see_other_uids ,
+as per the description in
+.Xr cr_seeothergids 9
+and
+.Xr cr_seeotheruids 9
+respectively.
+.Sh RETURN VALUES
+This function returns zero if the object with credential
+.Fa u1
+can
+.Dq see
+the object with credential
+.Fa u2 ,
+or
+.Er ESRCH
+otherwise.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ESRCH
+The object with credential
+.Fa u1
+cannot
+.Dq see
+the object with credential
+.Fa u2 .
+.It Bq Er ESRCH
+The object with credential
+.Fa u1
+has been jailed and the object with credential
+.Fa u2
+does not belong to the same jail as
+.Fa u1 .
+.It Bq Er ESRCH
+The MAC subsystem denied visibility.
+.El
+.Sh SEE ALSO
+.Xr cr_seeothergids 9 ,
+.Xr cr_seeotheruids 9 ,
+.Xr mac 9 ,
+.Xr p_cansee 9
diff --git a/share/man/man9/cr_seeothergids.9 b/share/man/man9/cr_seeothergids.9
new file mode 100644
index 000000000000..ea8f43667f19
--- /dev/null
+++ b/share/man/man9/cr_seeothergids.9
@@ -0,0 +1,82 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 11, 2003
+.Dt CR_SEEOTHERGIDS 9
+.Os
+.Sh NAME
+.Nm cr_seeothergids
+.Nd determine visibility of objects given their group memberships
+.Sh SYNOPSIS
+.Ft int
+.Fn cr_seeothergids "struct ucred *u1" "struct ucred *u2"
+.Sh DESCRIPTION
+This function determines the visibility of objects in the
+kernel based on the group IDs in the credentials
+.Fa u1
+and
+.Fa u2
+associated with them.
+.Pp
+The visibility of objects is influenced by the
+.Xr sysctl 8
+variable
+.Va security.bsd.see_other_gids .
+If this variable is non-zero then all objects in the kernel
+are visible to each other irrespective of their group membership.
+If this variable is zero then the object with credentials
+.Fa u2
+is visible to the object with credentials
+.Fa u1
+if either
+.Fa u1
+is the super-user credential, or if at least one of
+.Fa u1 Ns 's
+group IDs is present in
+.Fa u2 Ns 's
+group set.
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.It Va security.bsd.see_other_gids
+Must be non-zero if objects with unprivileged credentials are to be
+able to see each other.
+.El
+.Sh RETURN VALUES
+This function returns zero if the object with credential
+.Fa u1
+can
+.Dq see
+the object with credential
+.Fa u2 ,
+or
+.Er ESRCH
+otherwise.
+.Sh SEE ALSO
+.Xr cr_seeotheruids 9 ,
+.Xr p_candebug 9
diff --git a/share/man/man9/cr_seeotheruids.9 b/share/man/man9/cr_seeotheruids.9
new file mode 100644
index 000000000000..b7b7000b3608
--- /dev/null
+++ b/share/man/man9/cr_seeotheruids.9
@@ -0,0 +1,82 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 11, 2003
+.Dt CR_SEEOTHERUIDS 9
+.Os
+.Sh NAME
+.Nm cr_seeotheruids
+.Nd determine visibility of objects given their user credentials
+.Sh SYNOPSIS
+.Ft int
+.Fn cr_seeotheruids "struct ucred *u1" "struct ucred *u2"
+.Sh DESCRIPTION
+This function determines the visibility of objects in the
+kernel based on the real user IDs in the credentials
+.Fa u1
+and
+.Fa u2
+associated with them.
+.Pp
+The visibility of objects is influenced by the
+.Xr sysctl 8
+variable
+.Va security.bsd.see_other_uids .
+If this variable is non-zero then all objects in the kernel
+are visible to each other irrespective of their user IDs.
+If this variable is zero then the object with credentials
+.Fa u2
+is visible to the object with credentials
+.Fa u1
+if either
+.Fa u1
+is the super-user credential, or if
+.Fa u1
+and
+.Fa u2
+have the same real user ID.
+.Sh SYSCTL VARIABLES
+.Bl -tag -width indent
+.It Va security.bsd.see_other_uids
+Must be non-zero if objects with unprivileged credentials are to be
+able to see each other.
+.El
+.Sh RETURN VALUES
+This function returns zero if the object with credential
+.Fa u1
+can
+.Dq see
+the object with credential
+.Fa u2 ,
+or
+.Er ESRCH
+otherwise.
+.Sh SEE ALSO
+.Xr cr_seeothergids 9 ,
+.Xr p_candebug 9
diff --git a/share/man/man9/critical_enter.9 b/share/man/man9/critical_enter.9
new file mode 100644
index 000000000000..a1d63fccd1bb
--- /dev/null
+++ b/share/man/man9/critical_enter.9
@@ -0,0 +1,74 @@
+.\" Copyright (c) 2001,2002 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2005
+.Dt CRITICAL_ENTER 9
+.Os
+.Sh NAME
+.Nm critical_enter ,
+.Nm critical_exit
+.Nd enter and exit a critical region
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.Ft void
+.Fn critical_enter "void"
+.Ft void
+.Fn critical_exit "void"
+.Sh DESCRIPTION
+These functions are used to prevent preemption in a critical region of code.
+All that is guaranteed is that the thread currently executing on a CPU will
+not be preempted.
+Specifically, a thread in a critical region will not migrate to another
+CPU while it is in a critical region.
+The current CPU may still trigger faults and exceptions during a critical
+section; however, these faults are usually fatal.
+.Pp
+The
+.Fn critical_enter
+and
+.Fn critical_exit
+functions manage a per-thread counter to handle nested critical sections.
+If a thread is made runnable that would normally preempt the current thread
+while the current thread is in a critical section,
+then the preemption will be deferred until the current thread exits the
+outermost critical section.
+.Pp
+Note that these functions are not required to provide any inter-CPU
+synchronization, data protection, or memory ordering guarantees and thus
+should
+.Em not
+be used to protect shared data structures.
+.Pp
+These functions should be used with care as an infinite loop within a
+critical region will deadlock the CPU.
+Also, they should not be interlocked with operations on mutexes, sx locks,
+semaphores, or other synchronization primitives.
+One exception to this is that spin mutexes include a critical section,
+so in certain cases critical sections may be interlocked with spin mutexes.
+.Sh HISTORY
+These functions were introduced in
+.Fx 5.0 .
diff --git a/share/man/man9/crypto.9 b/share/man/man9/crypto.9
new file mode 100644
index 000000000000..c2682afbf66d
--- /dev/null
+++ b/share/man/man9/crypto.9
@@ -0,0 +1,665 @@
+.\" $OpenBSD: crypto.9,v 1.19 2002/07/16 06:31:57 angelos Exp $
+.\"
+.\" The author of this manual page is Angelos D. Keromytis (angelos@cis.upenn.edu)
+.\"
+.\" Copyright (c) 2000, 2001 Angelos D. Keromytis
+.\"
+.\" Permission to use, copy, and modify this software with or without fee
+.\" is hereby granted, provided that this entire notice is included in
+.\" all source code copies of any software which is or includes a copy or
+.\" modification of this software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+.\" IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+.\" PURPOSE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 19, 2007
+.Dt CRYPTO 9
+.Os
+.Sh NAME
+.Nm crypto
+.Nd API for cryptographic services in the kernel
+.Sh SYNOPSIS
+.In opencrypto/cryptodev.h
+.Ft int32_t
+.Fn crypto_get_driverid uint8_t
+.Ft int
+.Fn crypto_register uint32_t int uint16_t uint32_t "int \*[lp]*\*[rp]\*[lp]void *, uint32_t *, struct cryptoini *\*[rp]" "int \*[lp]*\*[rp]\*[lp]void *, uint64_t\*[rp]" "int \*[lp]*\*[rp]\*[lp]void *, struct cryptop *\*[rp]" "void *"
+.Ft int
+.Fn crypto_kregister uint32_t int uint32_t "int \*[lp]*\*[rp]\*[lp]void *, struct cryptkop *\*[rp]" "void *"
+.Ft int
+.Fn crypto_unregister uint32_t int
+.Ft int
+.Fn crypto_unregister_all uint32_t
+.Ft void
+.Fn crypto_done "struct cryptop *"
+.Ft void
+.Fn crypto_kdone "struct cryptkop *"
+.Ft int
+.Fn crypto_newsession "uint64_t *" "struct cryptoini *" int
+.Ft int
+.Fn crypto_freesession uint64_t
+.Ft int
+.Fn crypto_dispatch "struct cryptop *"
+.Ft int
+.Fn crypto_kdispatch "struct cryptkop *"
+.Ft int
+.Fn crypto_unblock uint32_t int
+.Ft "struct cryptop *"
+.Fn crypto_getreq int
+.Ft void
+.Fn crypto_freereq void
+.Bd -literal
+#define CRYPTO_SYMQ 0x1
+#define CRYPTO_ASYMQ 0x2
+
+#define EALG_MAX_BLOCK_LEN 16
+
+struct cryptoini {
+ int cri_alg;
+ int cri_klen;
+ int cri_mlen;
+ caddr_t cri_key;
+ uint8_t cri_iv[EALG_MAX_BLOCK_LEN];
+ struct cryptoini *cri_next;
+};
+
+struct cryptodesc {
+ int crd_skip;
+ int crd_len;
+ int crd_inject;
+ int crd_flags;
+ struct cryptoini CRD_INI;
+#define crd_iv CRD_INI.cri_iv
+#define crd_key CRD_INI.cri_key
+#define crd_alg CRD_INI.cri_alg
+#define crd_klen CRD_INI.cri_klen
+ struct cryptodesc *crd_next;
+};
+
+struct cryptop {
+ TAILQ_ENTRY(cryptop) crp_next;
+ uint64_t crp_sid;
+ int crp_ilen;
+ int crp_olen;
+ int crp_etype;
+ int crp_flags;
+ caddr_t crp_buf;
+ caddr_t crp_opaque;
+ struct cryptodesc *crp_desc;
+ int (*crp_callback) (struct cryptop *);
+ caddr_t crp_mac;
+};
+
+struct crparam {
+ caddr_t crp_p;
+ u_int crp_nbits;
+};
+
+#define CRK_MAXPARAM 8
+
+struct cryptkop {
+ TAILQ_ENTRY(cryptkop) krp_next;
+ u_int krp_op; /* ie. CRK_MOD_EXP or other */
+ u_int krp_status; /* return status */
+ u_short krp_iparams; /* # of input parameters */
+ u_short krp_oparams; /* # of output parameters */
+ uint32_t krp_hid;
+ struct crparam krp_param[CRK_MAXPARAM];
+ int (*krp_callback)(struct cryptkop *);
+};
+.Ed
+.Sh DESCRIPTION
+.Nm
+is a framework for drivers of cryptographic hardware to register with
+the kernel so
+.Dq consumers
+(other kernel subsystems, and
+users through the
+.Pa /dev/crypto
+device) are able to make use of it.
+Drivers register with the framework the algorithms they support,
+and provide entry points (functions) the framework may call to
+establish, use, and tear down sessions.
+Sessions are used to cache cryptographic information in a particular driver
+(or associated hardware), so initialization is not needed with every request.
+Consumers of cryptographic services pass a set of
+descriptors that instruct the framework (and the drivers registered
+with it) of the operations that should be applied on the data (more
+than one cryptographic operation can be requested).
+.Pp
+Keying operations are supported as well.
+Unlike the symmetric operators described above,
+these sessionless commands perform mathematical operations using
+input and output parameters.
+.Pp
+Since the consumers may not be associated with a process, drivers may
+not
+.Xr sleep 9 .
+The same holds for the framework.
+Thus, a callback mechanism is used
+to notify a consumer that a request has been completed (the
+callback is specified by the consumer on a per-request basis).
+The callback is invoked by the framework whether the request was
+successfully completed or not.
+An error indication is provided in the latter case.
+A specific error code,
+.Er EAGAIN ,
+is used to indicate that a session number has changed and that the
+request may be re-submitted immediately with the new session number.
+Errors are only returned to the invoking function if not
+enough information to call the callback is available (meaning, there
+was a fatal error in verifying the arguments).
+For session initialization and teardown there is no callback mechanism used.
+.Pp
+The
+.Fn crypto_newsession
+routine is called by consumers of cryptographic services (such as the
+.Xr ipsec 4
+stack) that wish to establish a new session with the framework.
+On success, the first argument will contain the Session Identifier (SID).
+The second argument contains all the necessary information for
+the driver to establish the session.
+The third argument indicates whether a
+hardware driver (1) should be used or not (0).
+The various fields in the
+.Vt cryptoini
+structure are:
+.Bl -tag -width ".Va cri_next"
+.It Va cri_alg
+Contains an algorithm identifier.
+Currently supported algorithms are:
+.Pp
+.Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -compact
+.It Dv CRYPTO_AES_CBC
+.It Dv CRYPTO_ARC4
+.It Dv CRYPTO_BLF_CBC
+.It Dv CRYPTO_CAMELLIA_CBC
+.It Dv CRYPTO_CAST_CBC
+.It Dv CRYPTO_DES_CBC
+.It Dv CRYPTO_3DES_CBC
+.It Dv CRYPTO_SKIPJACK_CBC
+.It Dv CRYPTO_MD5
+.It Dv CRYPTO_MD5_HMAC
+.It Dv CRYPTO_MD5_KPDK
+.It Dv CRYPTO_RIPEMD160_HMAC
+.It Dv CRYPTO_SHA1
+.It Dv CRYPTO_SHA1_HMAC
+.It Dv CRYPTO_SHA1_KPDK
+.It Dv CRYPTO_SHA2_256_HMAC
+.It Dv CRYPTO_SHA2_384_HMAC
+.It Dv CRYPTO_SHA2_512_HMAC
+.It Dv CRYPTO_NULL_HMAC
+.It Dv CRYPTO_NULL_CBC
+.El
+.It Va cri_klen
+Specifies the length of the key in bits, for variable-size key
+algorithms.
+.It Va cri_mlen
+Specifies how many bytes from the calculated hash should be copied back.
+0 means entire hash.
+.It Va cri_key
+Contains the key to be used with the algorithm.
+.It Va cri_iv
+Contains an explicit initialization vector (IV), if it does not prefix
+the data.
+This field is ignored during initialization.
+If no IV is explicitly passed (see below on details), a random IV is used
+by the device driver processing the request.
+.It Va cri_next
+Contains a pointer to another
+.Vt cryptoini
+structure.
+Multiple such structures may be linked to establish multi-algorithm sessions
+.Xr ( ipsec 4
+is an example consumer of such a feature).
+.El
+.Pp
+The
+.Vt cryptoini
+structure and its contents will not be modified by the framework (or
+the drivers used).
+Subsequent requests for processing that use the
+SID returned will avoid the cost of re-initializing the hardware (in
+essence, SID acts as an index in the session cache of the driver).
+.Pp
+.Fn crypto_freesession
+is called with the SID returned by
+.Fn crypto_newsession
+to disestablish the session.
+.Pp
+.Fn crypto_dispatch
+is called to process a request.
+The various fields in the
+.Vt cryptop
+structure are:
+.Bl -tag -width ".Va crp_callback"
+.It Va crp_sid
+Contains the SID.
+.It Va crp_ilen
+Indicates the total length in bytes of the buffer to be processed.
+.It Va crp_olen
+On return, contains the total length of the result.
+For symmetric crypto operations, this will be the same as the input length.
+This will be used if the framework needs to allocate a new
+buffer for the result (or for re-formatting the input).
+.It Va crp_callback
+This routine is invoked upon completion of the request, whether
+successful or not.
+It is invoked through the
+.Fn crypto_done
+routine.
+If the request was not successful, an error code is set in the
+.Va crp_etype
+field.
+It is the responsibility of the callback routine to set the appropriate
+.Xr spl 9
+level.
+.It Va crp_etype
+Contains the error type, if any errors were encountered, or zero if
+the request was successfully processed.
+If the
+.Er EAGAIN
+error code is returned, the SID has changed (and has been recorded in the
+.Va crp_sid
+field).
+The consumer should record the new SID and use it in all subsequent requests.
+In this case, the request may be re-submitted immediately.
+This mechanism is used by the framework to perform
+session migration (move a session from one driver to another, because
+of availability, performance, or other considerations).
+.Pp
+Note that this field only makes sense when examined by
+the callback routine specified in
+.Va crp_callback .
+Errors are returned to the invoker of
+.Fn crypto_process
+only when enough information is not present to call the callback
+routine (i.e., if the pointer passed is
+.Dv NULL
+or if no callback routine was specified).
+.It Va crp_flags
+Is a bitmask of flags associated with this request.
+Currently defined flags are:
+.Bl -tag -width ".Dv CRYPTO_F_CBIFSYNC"
+.It Dv CRYPTO_F_IMBUF
+The buffer pointed to by
+.Va crp_buf
+is an mbuf chain.
+.It Dv CRYPTO_F_IOV
+The buffer pointed to by
+.Va crp_buf
+is an
+.Vt uio
+structure.
+.It Dv CRYPTO_F_REL
+Must return data in the same place.
+.It Dv CRYPTO_F_BATCH
+Batch operation if possible.
+.It Dv CRYPTO_F_CBIMM
+Do callback immediately instead of doing it from a dedicated kernel thread.
+.It Dv CRYPTO_F_DONE
+Operation completed.
+.It Dv CRYPTO_F_CBIFSYNC
+Do callback immediately if operation is synchronous.
+.El
+.It Va crp_buf
+Points to the input buffer.
+On return (when the callback is invoked),
+it contains the result of the request.
+The input buffer may be an mbuf
+chain or a contiguous buffer,
+depending on
+.Va crp_flags .
+.It Va crp_opaque
+This is passed through the crypto framework untouched and is
+intended for the invoking application's use.
+.It Va crp_desc
+This is a linked list of descriptors.
+Each descriptor provides
+information about what type of cryptographic operation should be done
+on the input buffer.
+The various fields are:
+.Bl -tag -width ".Va crd_inject"
+.It Va crd_iv
+The field where IV should be provided when the
+.Dv CRD_F_IV_EXPLICIT
+flag is given.
+.It Va crd_key
+When the
+.Dv CRD_F_KEY_EXPLICIT
+flag is given, the
+.Va crd_key
+points to a buffer with encryption or authentication key.
+.It Va crd_alg
+An algorithm to use.
+Must be the same as the one given at newsession time.
+.It Va crd_klen
+The
+.Va crd_key
+key length.
+.It Va crd_skip
+The offset in the input buffer where processing should start.
+.It Va crd_len
+How many bytes, after
+.Va crd_skip ,
+should be processed.
+.It Va crd_inject
+Offset from the beginning of the buffer to insert any results.
+For encryption algorithms, this is where the initialization vector
+(IV) will be inserted when encrypting or where it can be found when
+decrypting (subject to
+.Va crd_flags ) .
+For MAC algorithms, this is where the result of the keyed hash will be
+inserted.
+.It Va crd_flags
+The following flags are defined:
+.Bl -tag -width 3n
+.It Dv CRD_F_ENCRYPT
+For encryption algorithms, this bit is set when encryption is required
+(when not set, decryption is performed).
+.It Dv CRD_F_IV_PRESENT
+For encryption algorithms, this bit is set when the IV already
+precedes the data, so the
+.Va crd_inject
+value will be ignored and no IV will be written in the buffer.
+Otherwise, the IV used to encrypt the packet will be written
+at the location pointed to by
+.Va crd_inject .
+The IV length is assumed to be equal to the blocksize of the
+encryption algorithm.
+Some applications that do special
+.Dq "IV cooking" ,
+such as the half-IV mode in
+.Xr ipsec 4 ,
+can use this flag to indicate that the IV should not be written on the packet.
+This flag is typically used in conjunction with the
+.Dv CRD_F_IV_EXPLICIT
+flag.
+.It Dv CRD_F_IV_EXPLICIT
+For encryption algorithms, this bit is set when the IV is explicitly
+provided by the consumer in the
+.Va crd_iv
+field.
+Otherwise, for encryption operations the IV is provided for by
+the driver used to perform the operation, whereas for decryption
+operations it is pointed to by the
+.Va crd_inject
+field.
+This flag is typically used when the IV is calculated
+.Dq "on the fly"
+by the consumer, and does not precede the data (some
+.Xr ipsec 4
+configurations, and the encrypted swap are two such examples).
+.It Dv CRD_F_KEY_EXPLICIT
+For encryption and authentication (MAC) algorithms, this bit is set when the key
+is explicitly provided by the consumer in the
+.Va crd_key
+field for the given operation.
+Otherwise, the key is taken at newsession time from the
+.Va cri_key
+field.
+.It Dv CRD_F_COMP
+For compression algorithms, this bit is set when compression is required (when
+not set, decompression is performed).
+.El
+.It Va CRD_INI
+This
+.Vt cryptoini
+structure will not be modified by the framework or the device drivers.
+Since this information accompanies every cryptographic
+operation request, drivers may re-initialize state on-demand
+(typically an expensive operation).
+Furthermore, the cryptographic
+framework may re-route requests as a result of full queues or hardware
+failure, as described above.
+.It Va crd_next
+Point to the next descriptor.
+Linked operations are useful in protocols such as
+.Xr ipsec 4 ,
+where multiple cryptographic transforms may be applied on the same
+block of data.
+.El
+.El
+.Pp
+.Fn crypto_getreq
+allocates a
+.Vt cryptop
+structure with a linked list of as many
+.Vt cryptodesc
+structures as were specified in the argument passed to it.
+.Pp
+.Fn crypto_freereq
+deallocates a structure
+.Vt cryptop
+and any
+.Vt cryptodesc
+structures linked to it.
+Note that it is the responsibility of the
+callback routine to do the necessary cleanups associated with the
+opaque field in the
+.Vt cryptop
+structure.
+.Pp
+.Fn crypto_kdispatch
+is called to perform a keying operation.
+The various fields in the
+.Vt cryptkop
+structure are:
+.Bl -tag -width ".Va krp_callback"
+.It Va krp_op
+Operation code, such as
+.Dv CRK_MOD_EXP .
+.It Va krp_status
+Return code.
+This
+.Va errno Ns -style
+variable indicates whether lower level reasons
+for operation failure.
+.It Va krp_iparams
+Number if input parameters to the specified operation.
+Note that each operation has a (typically hardwired) number of such parameters.
+.It Va krp_oparams
+Number if output parameters from the specified operation.
+Note that each operation has a (typically hardwired) number of such parameters.
+.It Va krp_kvp
+An array of kernel memory blocks containing the parameters.
+.It Va krp_hid
+Identifier specifying which low-level driver is being used.
+.It Va krp_callback
+Callback called on completion of a keying operation.
+.El
+.Sh DRIVER-SIDE API
+The
+.Fn crypto_get_driverid ,
+.Fn crypto_register ,
+.Fn crypto_kregister ,
+.Fn crypto_unregister ,
+.Fn crypto_unblock ,
+and
+.Fn crypto_done
+routines are used by drivers that provide support for cryptographic
+primitives to register and unregister with the kernel crypto services
+framework.
+Drivers must first use the
+.Fn crypto_get_driverid
+function to acquire a driver identifier, specifying the
+.Fa cc_flags
+as an argument (normally 0, but software-only drivers should specify
+.Dv CRYPTOCAP_F_SOFTWARE ) .
+For each algorithm the driver supports, it must then call
+.Fn crypto_register .
+The first two arguments are the driver and algorithm identifiers.
+The next two arguments specify the largest possible operator length (in bits,
+important for public key operations) and flags for this algorithm.
+The last four arguments must be provided in the first call to
+.Fn crypto_register
+and are ignored in all subsequent calls.
+They are pointers to three
+driver-provided functions that the framework may call to establish new
+cryptographic context with the driver, free already established
+context, and ask for a request to be processed (encrypt, decrypt,
+etc.); and an opaque parameter to pass when calling each of these routines.
+.Fn crypto_unregister
+is called by drivers that wish to withdraw support for an algorithm.
+The two arguments are the driver and algorithm identifiers, respectively.
+Typically, drivers for
+PCMCIA
+crypto cards that are being ejected will invoke this routine for all
+algorithms supported by the card.
+.Fn crypto_unregister_all
+will unregister all algorithms registered by a driver
+and the driver will be disabled (no new sessions will be allocated on
+that driver, and any existing sessions will be migrated to other
+drivers).
+The same will be done if all algorithms associated with a driver are
+unregistered one by one.
+.Pp
+The calling convention for the three driver-supplied routines is:
+.Pp
+.Bl -item -compact
+.It
+.Ft int
+.Fn \*[lp]*newsession\*[rp] "void *" "uint32_t *" "struct cryptoini *" ;
+.It
+.Ft int
+.Fn \*[lp]*freesession\*[rp] "void *" "uint64_t" ;
+.It
+.Ft int
+.Fn \*[lp]*process\*[rp] "void *" "struct cryptop *" ;
+.It
+.Ft int
+.Fn \*[lp]*kprocess\*[rp] "void *" "struct cryptkop *" ;
+.El
+.Pp
+On invocation, the first argument to
+all routines is an opaque data value supplied when the algorithm
+is registered with
+.Fn crypto_register .
+The second argument to
+.Fn newsession
+contains the driver identifier obtained via
+.Fn crypto_get_driverid .
+On successful return, it should contain a driver-specific session
+identifier.
+The third argument is identical to that of
+.Fn crypto_newsession .
+.Pp
+The
+.Fn freesession
+routine takes as arguments the opaque data value and the SID
+(which is the concatenation of the
+driver identifier and the driver-specific session identifier).
+It should clear any context associated with the session (clear hardware
+registers, memory, etc.).
+.Pp
+The
+.Fn process
+routine is invoked with a request to perform crypto processing.
+This routine must not block, but should queue the request and return
+immediately.
+Upon processing the request, the callback routine should be invoked.
+In case of an unrecoverable error, the error indication must be placed in the
+.Va crp_etype
+field of the
+.Vt cryptop
+structure.
+When the request is completed, or an error is detected, the
+.Fn process
+routine should invoke
+.Fn crypto_done .
+Session migration may be performed, as mentioned previously.
+.Pp
+In case of a temporary resource exhaustion, the
+.Fn process
+routine may return
+.Er ERESTART
+in which case the crypto services will requeue the request, mark the driver
+as
+.Dq blocked ,
+and stop submitting requests for processing.
+The driver is then responsible for notifying the crypto services
+when it is again able to process requests through the
+.Fn crypto_unblock
+routine.
+This simple flow control mechanism should only be used for short-lived
+resource exhaustion as it causes operations to be queued in the crypto
+layer.
+Doing so is preferable to returning an error in such cases as
+it can cause network protocols to degrade performance by treating the
+failure much like a lost packet.
+.Pp
+The
+.Fn kprocess
+routine is invoked with a request to perform crypto key processing.
+This routine must not block, but should queue the request and return
+immediately.
+Upon processing the request, the callback routine should be invoked.
+In case of an unrecoverable error, the error indication must be placed in the
+.Va krp_status
+field of the
+.Vt cryptkop
+structure.
+When the request is completed, or an error is detected, the
+.Fn kprocess
+routine should invoked
+.Fn crypto_kdone .
+.Sh RETURN VALUES
+.Fn crypto_register ,
+.Fn crypto_kregister ,
+.Fn crypto_unregister ,
+.Fn crypto_newsession ,
+.Fn crypto_freesession ,
+and
+.Fn crypto_unblock
+return 0 on success, or an error code on failure.
+.Fn crypto_get_driverid
+returns a non-negative value on error, and \-1 on failure.
+.Fn crypto_getreq
+returns a pointer to a
+.Vt cryptop
+structure and
+.Dv NULL
+on failure.
+.Fn crypto_dispatch
+returns
+.Er EINVAL
+if its argument or the callback function was
+.Dv NULL ,
+and 0 otherwise.
+The callback is provided with an error code in case of failure, in the
+.Va crp_etype
+field.
+.Sh FILES
+.Bl -tag -width ".Pa sys/opencrypto/crypto.c"
+.It Pa sys/opencrypto/crypto.c
+most of the framework code
+.El
+.Sh SEE ALSO
+.Xr ipsec 4 ,
+.Xr malloc 9 ,
+.Xr sleep 9
+.Sh HISTORY
+The cryptographic framework first appeared in
+.Ox 2.7
+and was written by
+.An "Angelos D. Keromytis" Aq angelos@openbsd.org .
+.Sh BUGS
+The framework currently assumes that all the algorithms in a
+.Fn crypto_newsession
+operation must be available by the same driver.
+If that is not the case, session initialization will fail.
+.Pp
+The framework also needs a mechanism for determining which driver is
+best for a specific set of algorithms associated with a session.
+Some type of benchmarking is in order here.
+.Pp
+Multiple instances of the same algorithm in the same session are not
+supported.
+Note that 3DES is considered one algorithm (and not three
+instances of DES).
+Thus, 3DES and DES could be mixed in the same request.
diff --git a/share/man/man9/dev_clone.9 b/share/man/man9/dev_clone.9
new file mode 100644
index 000000000000..4fa93679ea9e
--- /dev/null
+++ b/share/man/man9/dev_clone.9
@@ -0,0 +1,78 @@
+.\" Copyright (c) 2008 Konstantin Belousov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 3, 2009
+.Dt DEV_CLONE 9
+.Os
+.Sh NAME
+.Nm dev_clone ,
+.Nm drain_dev_clone_events
+.Nd eventhandler for name-based device cloning in devfs
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/conf.h
+.Ft void
+.Fn clone_handler "void *arg" "struct ucred *cr" "char *name" "int namelen" "struct cdev **dev"
+.Bd -literal
+EVENTHANDLER_REGISTER(dev_clone, clone_handler, arg, priority);
+.Ed
+.Ft void
+.Fn drain_dev_clone_events
+.Sh DESCRIPTION
+A device driver may register a listener that will be notified each time
+a name lookup on the
+.Xr devfs 5
+mount point fails to find the vnode.
+A listener shall be registered for the
+.Va dev_clone
+event.
+When called, it is supplied with the first argument
+.Va arg
+that was specified at handler registration time,
+appropriate credentials
+.Va cr ,
+and a name
+.Va name
+of length
+.Va namelen
+that we look for.
+If the handler decides that the name is appropriate and wants to create the device
+that will be associated with the name, it should return it to devfs
+in the
+.Va dev
+argument.
+.Pp
+The
+.Fn drain_dev_clone_events
+function is a barrier.
+It is guaranteed that all calls to eventhandlers for
+.Nm dev_clone
+that were started before
+.Fn drain_dev_clone_events
+call, are finished before it returns control.
+.Sh SEE ALSO
+.Xr devfs 5 ,
+.Xr namei 9
diff --git a/share/man/man9/devclass.9 b/share/man/man9/devclass.9
new file mode 100644
index 000000000000..d3e848e8d904
--- /dev/null
+++ b/share/man/man9/devclass.9
@@ -0,0 +1,69 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVCLASS 9
+.Os
+.Sh NAME
+.Nm devclass
+.Nd object representing a class of devices
+.Sh SYNOPSIS
+.Vt typedef struct devclass *devclass_t ;
+.Sh DESCRIPTION
+The
+.Vt devclass
+object has two main functions in the system.
+The first is to manage
+the allocation of unit numbers for device instances and the second is
+to hold the list of device drivers for a particular bus type.
+Each
+.Vt devclass
+has a name and there cannot be two devclasses with the same name.
+This ensures that unique unit numbers are allocated to device
+instances.
+.Pp
+Beware that this means
+.Vt devclass
+must be the same for different bus attachments of the same device driver.
+.Sh SEE ALSO
+.Xr devclass_add_driver 9 ,
+.Xr devclass_delete_driver 9 ,
+.Xr devclass_find 9 ,
+.Xr devclass_find_driver 9 ,
+.Xr devclass_get_device 9 ,
+.Xr devclass_get_devices 9 ,
+.Xr devclass_get_maxunit 9 ,
+.Xr devclass_get_name 9 ,
+.Xr devclass_get_softc 9 ,
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devclass_find.9 b/share/man/man9/devclass_find.9
new file mode 100644
index 000000000000..2a2c88d45e20
--- /dev/null
+++ b/share/man/man9/devclass_find.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVCLASS_FIND 9
+.Os
+.Sh NAME
+.Nm devclass_find
+.Nd search for a devclass
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft devclass_t
+.Fn devclass_find "const char *classname"
+.Sh DESCRIPTION
+Search for the
+.Vt devclass
+with the specified name.
+.Sh RETURN VALUES
+If the
+.Vt devclass
+exists, it is returned, otherwise
+.Dv NULL
+is returned.
+.Sh SEE ALSO
+.Xr devclass 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devclass_get_count.9 b/share/man/man9/devclass_get_count.9
new file mode 100644
index 000000000000..f645a49454f2
--- /dev/null
+++ b/share/man/man9/devclass_get_count.9
@@ -0,0 +1,47 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2004 Nate Lawson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 5, 2004
+.Dt DEVCLASS_GET_COUNT 9
+.Os
+.Sh NAME
+.Nm devclass_get_count
+.Nd get the number of devices in a devclass
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn devclass_get_count "devclass_t dc"
+.Sh DESCRIPTION
+Returns the number of device instances in the specified
+.Vt devclass .
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Nate Lawson .
diff --git a/share/man/man9/devclass_get_device.9 b/share/man/man9/devclass_get_device.9
new file mode 100644
index 000000000000..242785e1931a
--- /dev/null
+++ b/share/man/man9/devclass_get_device.9
@@ -0,0 +1,52 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVCLASS_GET_DEVICE 9
+.Os
+.Sh NAME
+.Nm devclass_get_device
+.Nd translate unit number to device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft device_t
+.Fn devclass_get_device "devclass_t dc" "int unit"
+.Sh DESCRIPTION
+This function retrieves the device instance with the given unit number
+and returns it.
+.Sh RETURN VALUES
+If the device exists, it is returned, otherwise NULL is returned.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devclass_get_devices.9 b/share/man/man9/devclass_get_devices.9
new file mode 100644
index 000000000000..e6f8a15b6978
--- /dev/null
+++ b/share/man/man9/devclass_get_devices.9
@@ -0,0 +1,60 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 19, 2005
+.Dt DEVCLASS_GET_DEVICES 9
+.Os
+.Sh NAME
+.Nm devclass_get_devices
+.Nd get a list of devices in a devclass
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn devclass_get_devices "devclass_t dc" "device_t **devlistp" "int *devcountp"
+.Sh DESCRIPTION
+Retrieve a list of all device instances currently in the devclass and
+return the list in
+.Fa *devlistp
+and the count in
+.Fa *devcountp .
+The memory allocated for the list should be freed using
+.Fn free "*devlistp" "M_TEMP" ,
+even if
+.Fa *devcountp
+is 0.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devclass_get_drivers.9 b/share/man/man9/devclass_get_drivers.9
new file mode 100644
index 000000000000..f2ba1481436c
--- /dev/null
+++ b/share/man/man9/devclass_get_drivers.9
@@ -0,0 +1,60 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2005 Nate Lawson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 19, 2005
+.Dt DEVCLASS_GET_DRIVERS 9
+.Os
+.Sh NAME
+.Nm devclass_get_drivers
+.Nd "get a list of drivers in a devclass"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn devclass_get_drivers "devclass_t dc" "driver_t ***listp" "int *countp"
+.Sh DESCRIPTION
+Retrieve a list of pointers to all driver instances currently in the
+devclass and return the list in
+.Fa *listp
+and the number of drivers in the list in
+.Fa *countp .
+The memory allocated for the list should be freed using
+.Fn free *listp M_TEMP ,
+even if
+.Fa *countp
+is 0.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Nate Lawson .
diff --git a/share/man/man9/devclass_get_maxunit.9 b/share/man/man9/devclass_get_maxunit.9
new file mode 100644
index 000000000000..c3be62785c29
--- /dev/null
+++ b/share/man/man9/devclass_get_maxunit.9
@@ -0,0 +1,66 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 10, 2010
+.Dt DEVCLASS_GET_MAXUNIT 9
+.Os
+.Sh NAME
+.Nm devclass_get_maxunit
+.Nd find the maximum unit number in the class
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn devclass_get_maxunit "devclass_t dc"
+.Sh DESCRIPTION
+Returns the next unit number to be allocated to device instances in the
+.Dv devclass .
+This is one greater than the highest currently allocated unit.
+.Sh RETURN VALUES
+The
+.Fn devclass_get_maxunit
+function returns -1 if
+.Fa dc
+is
+.Dv NULL;
+otherwise it returns the next unit
+number in
+.Fa dc's
+devclass.
+.Sh ERRORS
+None.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
+.Sh BUGS
+The name is confusing since it is one greater than the maximum unit.
diff --git a/share/man/man9/devclass_get_name.9 b/share/man/man9/devclass_get_name.9
new file mode 100644
index 000000000000..5978dc16d944
--- /dev/null
+++ b/share/man/man9/devclass_get_name.9
@@ -0,0 +1,49 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVCLASS_GET_NAME 9
+.Os
+.Sh NAME
+.Nm devclass_get_name
+.Nd access the name of a devclass
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft const char *
+.Fn devclass_get_name "devclass_t dc"
+.Sh DESCRIPTION
+Return the name of a devclass.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devclass_get_softc.9 b/share/man/man9/devclass_get_softc.9
new file mode 100644
index 000000000000..e4c55334fad4
--- /dev/null
+++ b/share/man/man9/devclass_get_softc.9
@@ -0,0 +1,52 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVCLASS_GET_SOFTC 9
+.Os
+.Sh NAME
+.Nm devclass_get_softc
+.Nd translate unit number to driver private structure
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void *
+.Fn devclass_get_softc "devclass_t dc" "int unit"
+.Sh DESCRIPTION
+This function retrieves the driver private instance variables for the
+device with the given unit number and returns it.
+.Sh RETURN VALUES
+If the device exists, its driver-private variables are returned,
+otherwise NULL is returned.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devfs_set_cdevpriv.9 b/share/man/man9/devfs_set_cdevpriv.9
new file mode 100644
index 000000000000..a2b027903d80
--- /dev/null
+++ b/share/man/man9/devfs_set_cdevpriv.9
@@ -0,0 +1,121 @@
+.\" Copyright (c) 2008 Konstantin Belousov
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 8, 2008
+.Dt DEVFS_CDEVPRIV 9
+.Os
+.Sh NAME
+.Nm devfs_set_cdevpriv ,
+.Nm devfs_get_cdevpriv ,
+.Nm devfs_clear_cdevpriv
+.Nd manage per-open filedescriptor data for devices
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/conf.h
+.Bd -literal
+typedef void (*cdevpriv_dtr_t)(void *data);
+.Ed
+.Ft int
+.Fn devfs_get_cdevpriv "void **datap"
+.Ft int
+.Fn devfs_set_cdevpriv "void *priv" "cdevpriv_dtr_t dtr"
+.Ft void
+.Fn devfs_clear_cdevpriv "void"
+.Sh DESCRIPTION
+The
+.Fn devfs_xxx_cdevpriv
+family of functions allows the
+.Fa cdev
+driver methods to associate some driver-specific data with each
+user process
+.Xr open 2
+of the device special file.
+Currently, functioning of these functions is restricted to the context
+of the
+.Fa cdevsw
+switch method calls performed as
+.Xr devfs 5
+operations in response to system calls that use filedescriptors.
+.Pp
+The
+.Fn devfs_set_cdevpriv
+function associates a data pointed by
+.Va priv
+with current calling context (filedescriptor).
+The data may be retrieved later, possibly from another call
+performed on this filedescriptor, by the
+.Fn devfs_get_cdevpriv
+function.
+The
+.Fn devfs_clear_cdevpriv
+disassociates previously attached data from context.
+Immediately after
+.Fn devfs_clear_cdevpriv
+finished operating, the
+.Va dtr
+callback is called, with private data supplied
+.Va data
+argument.
+.Pp
+On the last filedescriptor close, system automatically arranges
+.Fn devfs_clear_cdevpriv
+call.
+.Pp
+If successful, the functions return 0.
+.Pp
+The function
+.Fn devfs_set_cdevpriv
+returns the following values on error:
+.Bl -tag -width Er
+.It Bq Er ENOENT
+The current call is not associated with some filedescriptor.
+.It Bq Er EBUSY
+The private driver data is already associated with current
+filedescriptor.
+.El
+.Pp
+The function
+.Fn devfs_get_cdevpriv
+returns the following values on error:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The current call is not associated with some filedescriptor.
+.It Bq Er ENOENT
+The private driver data was not associated with current
+filedescriptor, or
+.Fn devfs_clear_cdevpriv
+was called.
+.El
+.Sh SEE ALSO
+.Xr open 2 ,
+.Xr close 2 ,
+.Xr devfs 5 ,
+.Xr kern_openat 9
+.Sh HISTORY
+The
+.Fn devfs_cdevpriv
+family of functions first appeared in
+.Fx 7.1 .
diff --git a/share/man/man9/device.9 b/share/man/man9/device.9
new file mode 100644
index 000000000000..3cc3462c8977
--- /dev/null
+++ b/share/man/man9/device.9
@@ -0,0 +1,104 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE 9
+.Os
+.Sh NAME
+.Nm device
+.Nd an abstract representation of a device
+.Sh SYNOPSIS
+.Vt typedef struct device *device_t ;
+.Sh DESCRIPTION
+The device object represents a piece of hardware attached to the
+system such as an expansion card, the bus which that card is plugged
+into, disk drives attached to the expansion card etc.
+The system defines one device,
+.Va root_bus
+and all other devices are created dynamically during
+autoconfiguration.
+Normally devices representing top-level busses in
+the system (ISA, PCI etc.) will be attached directly to
+.Va root_bus
+and other devices will be added as children of their relevant bus.
+.Pp
+The devices in a system form a tree.
+All devices except
+.Va root_bus
+have a parent (see
+.Xr device_get_parent 9 ) .
+In addition, any device can have children attached to it (see
+.Xr device_add_child 9 ,
+.Xr device_add_child_ordered 9 ,
+.Xr device_find_child 9 ,
+.Xr device_get_children 9 ,
+and
+.Xr device_delete_child 9 ) .
+.Pp
+A device which has been successfully probed and attached to the
+system will also have a driver (see
+.Xr device_get_driver 9
+and
+.Xr driver 9 )
+and a devclass (see
+.Xr device_get_devclass 9
+and
+.Xr devclass 9 ) .
+Various other attributes of the device include a unit number (see
+.Xr device_get_unit 9 ) ,
+verbose description (normally supplied by the driver, see
+.Xr device_set_desc 9
+and
+.Xr device_get_desc 9 ) ,
+a set of bus-specific variables (see
+.Xr device_get_ivars 9 )
+and a set of driver-specific variables (see
+.Xr device_get_softc 9 ) .
+.Pp
+Devices can be in one of several states:
+.Bl -tag -width DS_NOTPRESENT
+.It Dv DS_NOTPRESENT
+the device has not been probed for existence or the probe failed
+.It Dv DS_ALIVE
+the device probe succeeded but not yet attached
+.It Dv DS_ATTACHED
+the device has been successfully attached
+.It Dv DS_BUSY
+the device is currently open
+.El
+.Pp
+The current state of the device can be determined by calling
+.Xr device_get_state 9 .
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_add_child.9 b/share/man/man9/device_add_child.9
new file mode 100644
index 000000000000..7ddd19a1564b
--- /dev/null
+++ b/share/man/man9/device_add_child.9
@@ -0,0 +1,125 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 12, 2006
+.Dt DEVICE_ADD_CHILD 9
+.Os
+.Sh NAME
+.Nm device_add_child ,
+.Nm device_add_child_ordered
+.Nd "add a new device as a child of an existing device"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft device_t
+.Fn device_add_child "device_t dev" "const char *name" "int unit"
+.Ft device_t
+.Fn device_add_child_ordered "device_t dev" "int order" "const char *name" "int unit"
+.Sh DESCRIPTION
+Create a new child device of
+.Fa dev .
+The
+.Fa name
+and
+.Fa unit
+arguments specify the name and unit number of the device.
+If the name is unknown then the caller should pass
+.Dv NULL .
+If the unit is unknown then the caller should pass
+.Dv -1
+and the system will choose the next available unit number.
+.Pp
+The name of the device is used to determine which drivers might be
+appropriate for the device.
+If a name is specified then only drivers of that name are probed.
+If no name is given then all drivers for the owning bus are probed.
+In any event, only the name of the device is stored so that one may
+safely unload/load a driver bound to that name.
+.Pp
+This allows busses which can uniquely identify device instances (such
+as PCI) to allow each driver to check each device instance for a
+match.
+For busses which rely on supplied probe hints where only one
+driver can have a chance of probing the device, the driver name should
+be specified as the device name.
+.Pp
+Normally unit numbers will be chosen automatically by the system and a
+unit number of
+.Dv -1
+should be given.
+When a specific unit number is desired (e.g.\& for wiring a particular
+piece of hardware to a pre-configured unit number), that unit should
+be passed.
+If the specified unit number is already allocated, a new
+unit will be allocated and a diagnostic message printed.
+.Pp
+If the devices attached to a bus must be probed in a specific order
+(e.g.\& for the ISA bus some devices are sensitive to failed probe attempts
+of unrelated drivers and therefore must be probed first),
+the
+.Fa order
+argument of
+.Fn device_add_child_ordered
+should be used to specify a partial ordering.
+The new device will be added before any existing device with a greater
+order.
+If
+.Fn device_add_child
+is used, then the new child will be added as if its order was zero.
+.Pp
+When adding a device in the context of
+.Xr DEVICE_IDENTIFY 9
+routine, the
+.Xr device_find_child 9
+routine should be used to ensure that the device has not already been
+added to the tree.
+Because the device name and
+.Vt devclass_t
+are associated at probe time (not child addition time), previous
+instances of the driver (say in a module that was later unloaded) may
+have already added the instance.
+Authors of bus drivers must likewise be careful when adding children
+when they are loaded and unloaded to avoid duplication of children
+devices.
+.Pp
+Identify routines should use
+.Xr BUS_ADD_CHILD 9
+instead of
+.Xr device_add_child 9 .
+.Sh RETURN VALUES
+The new device if successful, NULL otherwise.
+.Sh SEE ALSO
+.Xr BUS_ADD_CHILD 9 ,
+.Xr device 9 ,
+.Xr device_find_child 9 ,
+.Xr DEVICE_IDENTIFY 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_delete_child.9 b/share/man/man9/device_delete_child.9
new file mode 100644
index 000000000000..df56c599e9b9
--- /dev/null
+++ b/share/man/man9/device_delete_child.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_DELETE_CHILD 9
+.Os
+.Sh NAME
+.Nm device_delete_child
+.Nd delete a child from a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn device_delete_child "device_t dev" "device_t child"
+.Sh DESCRIPTION
+The specified device is removed from
+.Fa dev
+and deleted.
+If the device is currently attached, it is first detached (see
+.Xr DEVICE_ATTACH 9
+and
+.Xr DEVICE_DETACH 9 ) .
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an error is returned.
+.Sh SEE ALSO
+.Xr device_add_child 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_enable.9 b/share/man/man9/device_enable.9
new file mode 100644
index 000000000000..85b4f6ea5e6c
--- /dev/null
+++ b/share/man/man9/device_enable.9
@@ -0,0 +1,63 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_ENABLE 9
+.Os
+.Sh NAME
+.Nm device_enable ,
+.Nm device_disable ,
+.Nm device_is_enabled
+.Nd manipulate device enabled flag
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn device_enable "device_t dev"
+.Ft void
+.Fn device_disable "device_t dev"
+.Ft int
+.Fn device_is_enabled "device_t dev"
+.Sh DESCRIPTION
+Each device has an enabled flag associated with it.
+A device is
+enabled by default when it is created but may be disabled (for
+instance to prevent a destructive or time consuming probe attempt).
+To disable a device, call
+.Fn device_disable ,
+to re-enable it, call
+.Fn device_enable
+and to test to see if a device is enabled, call
+.Fn device_is_enabled .
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_find_child.9 b/share/man/man9/device_find_child.9
new file mode 100644
index 000000000000..a23b2b2a145a
--- /dev/null
+++ b/share/man/man9/device_find_child.9
@@ -0,0 +1,62 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 8, 2005
+.Dt DEVICE_FIND_CHILD 9
+.Os
+.Sh NAME
+.Nm device_find_child
+.Nd search for a child of a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft device_t
+.Fn device_find_child "device_t dev" "const char *classname" "int unit"
+.Sh DESCRIPTION
+This function looks for a specific child of
+.Dv dev .
+with the given
+.Fa classname
+and
+.Fa unit .
+If
+.Fa unit
+is \-1, it returns the first child of
+.Fa dev
+with a matching
+.Fa classname
+(that is, the one with the lowest unit).
+.Sh RETURN VALUES
+If it exists, the child device is returned, otherwise NULL.
+.Sh SEE ALSO
+.Xr device_add_child 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_children.9 b/share/man/man9/device_get_children.9
new file mode 100644
index 000000000000..cbc1124a20a4
--- /dev/null
+++ b/share/man/man9/device_get_children.9
@@ -0,0 +1,62 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 23, 2008
+.Dt DEVICE_GET_CHILDREN 9
+.Os
+.Sh NAME
+.Nm device_get_children
+.Nd get a list of devices connected to a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn device_get_children "device_t dev" "device_t **devlistp" "int *devcountp"
+.Sh DESCRIPTION
+Retrieve a list of all device instances currently connected to
+.Pa dev
+and return the list in
+.Fa *devlistp
+and the count in
+.Fa *devcountp .
+The memory allocated for the list should be freed using
+.Fn free "*devlistp" "M_TEMP" .
+.Fa devlistp
+and
+.Fa devcountp
+are not changed when an error is returned.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_devclass.9 b/share/man/man9/device_get_devclass.9
new file mode 100644
index 000000000000..fcf869565aeb
--- /dev/null
+++ b/share/man/man9/device_get_devclass.9
@@ -0,0 +1,52 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_GET_DEVCLASS 9
+.Os
+.Sh NAME
+.Nm device_get_devclass
+.Nd access the devclass of a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft devclass_t
+.Fn device_get_devclass "device_t dev"
+.Sh DESCRIPTION
+The current devclass associated with the device is returned.
+If the device has no devclass,
+.Dv NULL
+is returned.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_driver.9 b/share/man/man9/device_get_driver.9
new file mode 100644
index 000000000000..d764768b11f6
--- /dev/null
+++ b/share/man/man9/device_get_driver.9
@@ -0,0 +1,52 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_GET_DRIVER 9
+.Os
+.Sh NAME
+.Nm device_get_driver
+.Nd access the current driver of a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft driver_t *
+.Fn device_get_driver "device_t dev"
+.Sh DESCRIPTION
+The current driver associated with the device is returned.
+If the device has no driver,
+.Dv NULL
+is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_ivars.9 b/share/man/man9/device_get_ivars.9
new file mode 100644
index 000000000000..dd1450c32f93
--- /dev/null
+++ b/share/man/man9/device_get_ivars.9
@@ -0,0 +1,64 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_GET_IVARS 9
+.Os
+.Sh NAME
+.Nm device_get_ivars ,
+.Nm device_set_ivars
+.Nd access bus private variables
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft "void *"
+.Fn device_get_ivars "device_t dev"
+.Ft void
+.Fn device_set_ivars "device_t dev" "void *ivar"
+.Sh DESCRIPTION
+The
+.Fn device_get_ivars
+function returns the bus-specific instance variables of a device.
+.Pp
+The
+.Fn device_set_ivars
+function sets the bus-specific instance variables of a device.
+.Pp
+Typically, only bus drivers will use these functions.
+The kernel assumes that the bus driver will manage this memory, and no
+automatic memory allocation or deallocation happens.
+Client drivers should access ivars through the
+.Xr BUS_READ_IVAR 9
+interface instead.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_name.9 b/share/man/man9/device_get_name.9
new file mode 100644
index 000000000000..3149f8c6c9cf
--- /dev/null
+++ b/share/man/man9/device_get_name.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2003
+.Dt DEVICE_GET_NAME 9
+.Os
+.Sh NAME
+.Nm device_get_name , device_get_nameunit
+.Nd access the name of a device's device class or instance
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft const char *
+.Fn device_get_name "device_t dev"
+.Ft const char *
+.Fn device_get_nameunit "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn device_get_name
+function returns the name of the device's device class.
+.Pp
+The
+.Fn device_get_nameunit
+function returns the name of the device's instance.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh .
diff --git a/share/man/man9/device_get_parent.9 b/share/man/man9/device_get_parent.9
new file mode 100644
index 000000000000..63669d33a16e
--- /dev/null
+++ b/share/man/man9/device_get_parent.9
@@ -0,0 +1,50 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2003
+.Dt DEVICE_GET_PARENT 9
+.Os
+.Sh NAME
+.Nm device_get_parent
+.Nd return the device's parent
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft device_t
+.Fn device_get_parent "device_t dev"
+.Sh DESCRIPTION
+The
+.Fn device_get_parent
+function returns the name of the device's parent device.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh .
diff --git a/share/man/man9/device_get_softc.9 b/share/man/man9/device_get_softc.9
new file mode 100644
index 000000000000..76f94d448aff
--- /dev/null
+++ b/share/man/man9/device_get_softc.9
@@ -0,0 +1,69 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 2, 2005
+.Dt DEVICE_GET_SOFTC 9
+.Os
+.Sh NAME
+.Nm device_get_softc
+.Nd access driver private instance variables
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void *
+.Fn device_get_softc "device_t dev"
+.Sh DESCRIPTION
+Return the driver-specific state of
+.Fa dev .
+The softc is automatically allocated and zeroed when the device is
+attached.
+The softc is also initialized and present when a device is probed,
+but is subject to caveats as described in
+.Xr DEVICE_PROBE 9 .
+The size of the allocation is determined by the device's
+.Vt driver_t
+information used to define the driver.
+The softc typically encapsulates the state of this instance of the
+device.
+.Pp
+Driver writers are discouraged from using their own softc management
+mechanisms.
+Driver writers should not copy such mechanisms found in drivers in the
+tree that predate this function.
+.Sh RETURN VALUES
+The pointer to the driver-specific instance variable is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr DEVICE_PROBE 9 ,
+.Xr device_set_softc 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_state.9 b/share/man/man9/device_get_state.9
new file mode 100644
index 000000000000..384395a30288
--- /dev/null
+++ b/share/man/man9/device_get_state.9
@@ -0,0 +1,99 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_GET_STATE 9
+.Os
+.Sh NAME
+.Nm device_get_state ,
+.Nm device_busy ,
+.Nm device_unbusy ,
+.Nm device_is_alive ,
+.Nm device_is_attached
+.Nd manipulate device state
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft device_state_t
+.Fn device_get_state "device_t dev"
+.Ft void
+.Fn device_busy "device_t dev"
+.Ft void
+.Fn device_unbusy "device_t dev"
+.Ft int
+.Fn device_is_alive "device_t dev"
+.Ft int
+.Fn device_is_attached "device_t dev"
+.Sh DESCRIPTION
+The current state of a device is accessed by calling
+.Fn device_get_state
+which returns
+.Dv DS_NOTPRESENT ,
+.Dv DS_ALIVE ,
+.Dv DS_ATTACHED
+or
+.Dv DS_BUSY
+(described in
+.Xr device 9 ) .
+To test see if a device was successfully probed, call
+.Fn device_is_alive
+which simply returns if the state is greater or equal to
+.Dv DS_ALIVE .
+To test see if a device was successfully attached, call
+.Fn device_is_attached
+which simply returns if the state is greater or equal to
+.Dv DS_ATTACHED .
+.Pp
+Each device has a busy count which is incremented when
+.Fn device_busy
+is called and decremented when
+.Fn device_unbusy
+is called.
+Both routines return an error if the device state is less than
+.Dv DS_ATTACHED .
+.Pp
+When
+.Fn device_busy
+is called on a device in the
+.Dv DS_ATTACHED
+state, the device changes to the
+.Dv DS_BUSY
+state.
+When
+.Fn device_unbusy
+is called and after decrementing, the busy count for the device is
+zero, the device changes to the
+.Dv DS_ATTACHED
+state.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_get_sysctl.9 b/share/man/man9/device_get_sysctl.9
new file mode 100644
index 000000000000..d838ac7861a6
--- /dev/null
+++ b/share/man/man9/device_get_sysctl.9
@@ -0,0 +1,58 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2006 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 18, 2011
+.Dt DEVICE_GET_SYSCTL 9
+.Os
+.Sh NAME
+.Nm device_get_sysctl_ctx ,
+.Nm device_get_sysctl_tree
+.Nd manipulate the sysctl oid tree for driver specific sysctl nodes
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft "struct sysctl_ctx_list *"
+.Fn device_get_sysctl_ctx "device_t dev"
+.Ft "struct sysctl_oid *"
+.Fn device_get_sysctl_tree "device_t dev"
+.Sh DESCRIPTION
+The newbus system automatically adds a sysctl node for each device
+in the system.
+This node can be accessed with the
+.Fn device_get_sysctl_tree
+function.
+The context for the node can be obtained with the
+.Fn device_get_sysctl_ctx
+function.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh .
diff --git a/share/man/man9/device_get_unit.9 b/share/man/man9/device_get_unit.9
new file mode 100644
index 000000000000..0b222e96dd6d
--- /dev/null
+++ b/share/man/man9/device_get_unit.9
@@ -0,0 +1,48 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_GET_UNIT 9
+.Os
+.Sh NAME
+.Nm device_get_unit
+.Nd access the unit number of a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn device_get_unit "device_t dev"
+.Sh DESCRIPTION
+Return the unit number of the device.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_printf.9 b/share/man/man9/device_printf.9
new file mode 100644
index 000000000000..297cce731a15
--- /dev/null
+++ b/share/man/man9/device_printf.9
@@ -0,0 +1,58 @@
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2003
+.Dt DEVICE_PRINTF 9
+.Os
+.Sh NAME
+.Nm device_printf
+.Nd formatted output conversion
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn device_printf "device_t dev" "const char *fmt" ...
+.Sh DESCRIPTION
+The
+.Fn device_printf
+function is a convenience interface to the
+.Xr printf 9
+function.
+It outputs the name of the
+.Fa dev
+device, followed by a colon and a space, and then what
+.Xr printf 9
+would print if you passed
+.Fa fmt
+and the remaining arguments to it.
+.Sh RETURN VALUES
+The
+.Fn device_printf
+function returns the number of characters displayed.
+.Sh SEE ALSO
+.Xr printf 3 ,
+.Xr printf 9
diff --git a/share/man/man9/device_probe_and_attach.9 b/share/man/man9/device_probe_and_attach.9
new file mode 100644
index 000000000000..8f8c4af18d22
--- /dev/null
+++ b/share/man/man9/device_probe_and_attach.9
@@ -0,0 +1,61 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_PROBE_AND_ATTACH 9
+.Os
+.Sh NAME
+.Nm device_probe_and_attach
+.Nd initialise a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn device_probe_and_attach "device_t dev"
+.Sh DESCRIPTION
+This function is called during autoconfiguration to initialise the
+devices in the system.
+For each device, the
+.Xr DEVICE_PROBE 9
+method of each suitable driver is called and if a probe succeeds, a
+description of the device is printed and the
+.Xr DEVICE_ATTACH 9
+method is called.
+If the device is disabled using
+.Xr device_disable 9
+then it will not be probed.
+.Sh RETURN VALUES
+Zero is returned on success, otherwise an appropriate error is returned.
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_quiet.9 b/share/man/man9/device_quiet.9
new file mode 100644
index 000000000000..0e5526d689aa
--- /dev/null
+++ b/share/man/man9/device_quiet.9
@@ -0,0 +1,66 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 21, 1999
+.Dt DEVICE_QUIET 9
+.Os
+.Sh NAME
+.Nm device_quiet ,
+.Nm device_verbose ,
+.Nm device_is_quiet
+.Nd manipulate device quiet flag
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn device_quiet "device_t dev"
+.Ft void
+.Fn device_verbose "device_t dev"
+.Ft int
+.Fn device_is_quiet "device_t dev"
+.Sh DESCRIPTION
+Each device has a quiet flag associated with it.
+A device is
+verbose by default when it is created but may be quieted to prevent
+the device identification string to be printed during probe.
+To quiet a device, call
+.Fn device_quiet ,
+to re-enable to probe message (to make the message appear again, for
+example after a
+.Xr device_detach 9 )
+call
+.Fn device_verbose .
+To test to see if a device is quieted, call
+.Fn device_is_quiet .
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_set_desc.9 b/share/man/man9/device_set_desc.9
new file mode 100644
index 000000000000..ae29010450b1
--- /dev/null
+++ b/share/man/man9/device_set_desc.9
@@ -0,0 +1,63 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1998
+.Dt DEVICE_SET_DESC 9
+.Os
+.Sh NAME
+.Nm device_set_desc ,
+.Nm device_set_desc_copy ,
+.Nm device_get_desc
+.Nd access the description of a device
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn device_set_desc "device_t dev" "const char *desc"
+.Ft void
+.Fn device_set_desc_copy "device_t dev" "const char *desc"
+.Ft const char *
+.Fn device_get_desc "device_t dev"
+.Sh DESCRIPTION
+Manipulate the verbose description of a device.
+This description (if
+present) is printed as part of the message when it is attached during
+autoconfiguration.
+The variation
+.Fn device_set_desc_copy
+is used to set the description if the string passed is a temporary
+buffer which will be overwritten.
+In this case, the system will copy
+the string, otherwise the pointer passed will be used directly.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/device_set_driver.9 b/share/man/man9/device_set_driver.9
new file mode 100644
index 000000000000..7f8ceb21e2ae
--- /dev/null
+++ b/share/man/man9/device_set_driver.9
@@ -0,0 +1,53 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 21, 2003
+.Dt DEVICE_SET_DRIVER 9
+.Os
+.Sh NAME
+.Nm device_set_driver
+.Nd "associate a specific driver with a device node in the tree"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn device_set_driver "device_t dev" "driver_t *driver"
+.Sh DESCRIPTION
+This function associates a specific driver with a given device node
+in the tree.
+It is typically used in
+.Xr DEVICE_IDENTIFY 9
+functions to add devices to a bus that does not support doing so
+automatically, such as the ISA bus.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An M. Warner Losh .
diff --git a/share/man/man9/device_set_flags.9 b/share/man/man9/device_set_flags.9
new file mode 100644
index 000000000000..3a836ffddfae
--- /dev/null
+++ b/share/man/man9/device_set_flags.9
@@ -0,0 +1,56 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1999 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 6, 1999
+.Dt DEVICE_GET_FLAGS 9
+.Os
+.Sh NAME
+.Nm device_set_flags ,
+.Nm device_get_flags
+.Nd manipulate driver flags
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft void
+.Fn device_set_flags "device_t dev" "uint32_t flags"
+.Ft uint32_t
+.Fn device_get_flags "device_t dev"
+.Sh DESCRIPTION
+Each device supports a set of driver-dependent flags which are often
+used to control device behaviour.
+These flags are read by calling
+.Fn device_get_flags
+and written by calling
+.Fn device_set_flags .
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/devstat.9 b/share/man/man9/devstat.9
new file mode 100644
index 000000000000..7ed7ec13975d
--- /dev/null
+++ b/share/man/man9/devstat.9
@@ -0,0 +1,455 @@
+.\"
+.\" Copyright (c) 1998, 1999 Kenneth D. Merry.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 22, 1998
+.Dt DEVSTAT 9
+.Os
+.Sh NAME
+.Nm devstat ,
+.Nm devstat_add_entry ,
+.Nm devstat_end_transaction ,
+.Nm devstat_end_transaction_bio ,
+.Nm devstat_remove_entry ,
+.Nm devstat_start_transaction
+.Nd kernel interface for keeping device statistics
+.Sh SYNOPSIS
+.In sys/devicestat.h
+.Ft void
+.Fo devstat_add_entry
+.Fa "struct devstat *ds"
+.Fa "const char *dev_name"
+.Fa "int unit_number"
+.Fa "uint32_t block_size"
+.Fa "devstat_support_flags flags"
+.Fa "devstat_type_flags device_type"
+.Fa "devstat_priority priority"
+.Fc
+.Ft void
+.Fn devstat_remove_entry "struct devstat *ds"
+.Ft void
+.Fn devstat_start_transaction "struct devstat *ds"
+.Ft void
+.Fo devstat_end_transaction
+.Fa "struct devstat *ds"
+.Fa "uint32_t bytes"
+.Fa "devstat_tag_type tag_type"
+.Fa "devstat_trans_flags flags"
+.Fc
+.Ft void
+.Fo devstat_end_transaction_bio
+.Fa "struct devstat *ds"
+.Fa "struct bio *bp"
+.Fc
+.Sh DESCRIPTION
+The devstat subsystem is an interface for recording device
+statistics, as its name implies.
+The idea is to keep reasonably detailed
+statistics while utilizing a minimum amount of CPU time to record them.
+Thus, no statistical calculations are actually performed in the kernel
+portion of the
+.Nm
+code.
+Instead, that is left for user programs to handle.
+.Pp
+.Fn devstat_add_entry
+registers a device with the
+.Nm
+subsystem.
+The caller is expected to have already allocated \fBand zeroed\fR
+the devstat structure before calling this function.
+.Fn devstat_add_entry
+takes several arguments:
+.Bl -tag -width device_type
+.It ds
+The
+.Va devstat
+structure, allocated and zeroed by the client.
+.It dev_name
+The device name, e.g.\& da, cd, sa.
+.It unit_number
+Device unit number.
+.It block_size
+Block size of the device, if supported.
+If the device does not support a
+block size, or if the blocksize is unknown at the time the device is added
+to the
+.Nm
+list, it should be set to 0.
+.It flags
+Flags indicating operations supported or not supported by the device.
+See below for details.
+.It device_type
+The device type.
+This is broken into three sections: base device type
+(e.g.\& direct access, CDROM, sequential access), interface type (IDE, SCSI
+or other) and a pass-through flag to indicate pas-through devices.
+See below for a complete list of types.
+.It priority
+The device priority.
+The priority is used to determine how devices are
+sorted within
+.Nm devstat Ns 's
+list of devices.
+Devices are sorted first by priority (highest to lowest),
+and then by attach order.
+See below for a complete list of available
+priorities.
+.El
+.Pp
+.Fn devstat_remove_entry
+removes a device from the
+.Nm
+subsystem.
+It takes the devstat structure for the device in question as
+an argument.
+The
+.Nm
+generation number is incremented and the number of devices is decremented.
+.Pp
+.Fn devstat_start_transaction
+registers the start of a transaction with the
+.Nm
+subsystem.
+The busy count is incremented with each transaction start.
+When a device goes from idle to busy, the system uptime is recorded in the
+.Va start_time
+field of the
+.Va devstat
+structure.
+.Pp
+.Fn devstat_end_transaction
+registers the end of a transaction with the
+.Nm
+subsystem.
+It takes four arguments:
+.Bl -tag -width tag_type
+.It ds
+The
+.Va devstat
+structure for the device in question.
+.It bytes
+The number of bytes transferred in this transaction.
+.It tag_type
+Transaction tag type.
+See below for tag types.
+.It flags
+Transaction flags indicating whether the transaction was a read, write, or
+whether no data was transferred.
+.El
+.Pp
+.Fn devstat_end_transaction_bio
+is a wrapper for
+.Fn devstat_end_transaction
+which pulls all the information from a
+.Va "struct bio"
+which is ready for biodone().
+.Pp
+The
+.Va devstat
+structure is composed of the following fields:
+.Bl -tag -width dev_creation_time
+.It dev_links
+Each
+.Va devstat
+structure is placed in a linked list when it is registered.
+The
+.Va dev_links
+field contains a pointer to the next entry in the list of
+.Va devstat
+structures.
+.It device_number
+The device number is a unique identifier for each device.
+The device
+number is incremented for each new device that is registered.
+The device
+number is currently only a 32-bit integer, but it could be enlarged if
+someone has a system with more than four billion device arrival events.
+.It device_name
+The device name is a text string given by the registering driver to
+identify itself.
+(e.g.\&
+.Dq da ,
+.Dq cd ,
+.Dq sa ,
+etc.)
+.It unit_number
+The unit number identifies the particular instance of the peripheral driver
+in question.
+.It bytes_written
+This is the number of bytes that have been written to the device.
+This number is currently an unsigned 64 bit integer.
+This will hopefully
+eliminate the counter wrap that would come very quickly on some systems if
+32 bit integers were used.
+.It bytes_read
+This is the number of bytes that have been read from the device.
+.It bytes_freed
+This is the number of bytes that have been freed/erased on the device.
+.It num_reads
+This is the number of reads from the device.
+.It num_writes
+This is the number of writes to the device.
+.It num_frees
+This is the number of free/erase operations on the device.
+.It num_other
+This is the number of transactions to the device which are neither reads or
+writes.
+For instance,
+.Tn SCSI
+drivers often send a test unit ready command to
+.Tn SCSI
+devices.
+The test unit ready command does not read or write any data.
+It merely causes the device to return its status.
+.It busy_count
+This is the current number of outstanding transactions for the device.
+This should never go below zero, and on an idle device it should be zero.
+If either one of these conditions is not true, it indicates a problem in
+the way
+.Fn devstat_start_transaction
+and
+.Fn devstat_end_transaction
+are being called in client code.
+There should be one and only one
+transaction start event and one transaction end event for each transaction.
+.It block_size
+This is the block size of the device, if the device has a block size.
+.It tag_types
+This is an array of counters to record the number of various tag types that
+are sent to a device.
+See below for a list of tag types.
+.It dev_creation_time
+This is the time, as reported by
+.Fn getmicrotime
+that the device was registered.
+.It busy_time
+This is the amount of time that the device busy count has been greater than
+zero.
+This is only updated when the busy count returns to zero.
+.It start_time
+This is the time, as reported by
+.Fn getmicrouptime
+that the device busy count went from zero to one.
+.It last_comp_time
+This is the time as reported by
+.Fn getmicrouptime
+that a transaction last completed.
+It is used along with
+.Va start_time
+to calculate the device busy time.
+.It flags
+These flags indicate which statistics measurements are supported by a
+particular device.
+These flags are primarily intended to serve as an aid
+to userland programs that decipher the statistics.
+.It device_type
+This is the device type.
+It consists of three parts: the device type
+(e.g.\& direct access, CDROM, sequential access, etc.), the interface (IDE,
+SCSI or other) and whether or not the device in question is a pass-through
+driver.
+See below for a complete list of device types.
+.It priority
+This is the priority.
+This is the first parameter used to determine where
+to insert a device in the
+.Nm
+list.
+The second parameter is attach order.
+See below for a list of
+available priorities.
+.El
+.Pp
+Each device is given a device type.
+Pass-through devices have the same
+underlying device type and interface as the device they provide an
+interface for, but they also have the pass-through flag set.
+The base
+device types are identical to the
+.Tn SCSI
+device type numbers, so with
+.Tn SCSI
+peripherals, the device type returned from an inquiry is usually ORed with
+the
+.Tn SCSI
+interface type and the pass-through flag if appropriate.
+The device type
+flags are as follows:
+.Bd -literal -offset indent
+typedef enum {
+ DEVSTAT_TYPE_DIRECT = 0x000,
+ DEVSTAT_TYPE_SEQUENTIAL = 0x001,
+ DEVSTAT_TYPE_PRINTER = 0x002,
+ DEVSTAT_TYPE_PROCESSOR = 0x003,
+ DEVSTAT_TYPE_WORM = 0x004,
+ DEVSTAT_TYPE_CDROM = 0x005,
+ DEVSTAT_TYPE_SCANNER = 0x006,
+ DEVSTAT_TYPE_OPTICAL = 0x007,
+ DEVSTAT_TYPE_CHANGER = 0x008,
+ DEVSTAT_TYPE_COMM = 0x009,
+ DEVSTAT_TYPE_ASC0 = 0x00a,
+ DEVSTAT_TYPE_ASC1 = 0x00b,
+ DEVSTAT_TYPE_STORARRAY = 0x00c,
+ DEVSTAT_TYPE_ENCLOSURE = 0x00d,
+ DEVSTAT_TYPE_FLOPPY = 0x00e,
+ DEVSTAT_TYPE_MASK = 0x00f,
+ DEVSTAT_TYPE_IF_SCSI = 0x010,
+ DEVSTAT_TYPE_IF_IDE = 0x020,
+ DEVSTAT_TYPE_IF_OTHER = 0x030,
+ DEVSTAT_TYPE_IF_MASK = 0x0f0,
+ DEVSTAT_TYPE_PASS = 0x100
+} devstat_type_flags;
+.Ed
+.Pp
+Devices have a priority associated with them, which controls roughly where
+they are placed in the
+.Nm
+list.
+The priorities are as follows:
+.Bd -literal -offset indent
+typedef enum {
+ DEVSTAT_PRIORITY_MIN = 0x000,
+ DEVSTAT_PRIORITY_OTHER = 0x020,
+ DEVSTAT_PRIORITY_PASS = 0x030,
+ DEVSTAT_PRIORITY_FD = 0x040,
+ DEVSTAT_PRIORITY_WFD = 0x050,
+ DEVSTAT_PRIORITY_TAPE = 0x060,
+ DEVSTAT_PRIORITY_CD = 0x090,
+ DEVSTAT_PRIORITY_DISK = 0x110,
+ DEVSTAT_PRIORITY_ARRAY = 0x120,
+ DEVSTAT_PRIORITY_MAX = 0xfff
+} devstat_priority;
+.Ed
+.Pp
+Each device has associated with it flags to indicate what operations are
+supported or not supported.
+The
+.Va devstat_support_flags
+values are as follows:
+.Bl -tag -width DEVSTAT_NO_ORDERED_TAGS
+.It DEVSTAT_ALL_SUPPORTED
+Every statistic type is supported by the device.
+.It DEVSTAT_NO_BLOCKSIZE
+This device does not have a blocksize.
+.It DEVSTAT_NO_ORDERED_TAGS
+This device does not support ordered tags.
+.It DEVSTAT_BS_UNAVAILABLE
+This device supports a blocksize, but it is currently unavailable.
+This
+flag is most often used with removable media drives.
+.El
+.Pp
+Transactions to a device fall into one of three categories, which are
+represented in the
+.Va flags
+passed into
+.Fn devstat_end_transaction .
+The transaction types are as follows:
+.Bd -literal -offset indent
+typedef enum {
+ DEVSTAT_NO_DATA = 0x00,
+ DEVSTAT_READ = 0x01,
+ DEVSTAT_WRITE = 0x02,
+ DEVSTAT_FREE = 0x03
+} devstat_trans_flags;
+.Ed
+.Pp
+There are four possible values for the
+.Va tag_type
+argument to
+.Fn devstat_end_transaction :
+.Bl -tag -width DEVSTAT_TAG_ORDERED
+.It DEVSTAT_TAG_SIMPLE
+The transaction had a simple tag.
+.It DEVSTAT_TAG_HEAD
+The transaction had a head of queue tag.
+.It DEVSTAT_TAG_ORDERED
+The transaction had an ordered tag.
+.It DEVSTAT_TAG_NONE
+The device does not support tags.
+.El
+.Pp
+The tag type values correspond to the lower four bits of the
+.Tn SCSI
+tag definitions.
+In CAM, for instance, the
+.Va tag_action
+from the CCB is ORed with 0xf to determine the tag type to pass in to
+.Fn devstat_end_transaction .
+.Pp
+There is a macro,
+.Dv DEVSTAT_VERSION
+that is defined in
+.In sys/devicestat.h .
+This is the current version of the
+.Nm
+subsystem, and it should be incremented each time a change is made that
+would require recompilation of userland programs that access
+.Nm
+statistics.
+Userland programs use this version, via the
+.Va kern.devstat.version
+.Nm sysctl
+variable to determine whether they are in sync with the kernel
+.Nm
+structures.
+.Sh SEE ALSO
+.Xr systat 1 ,
+.Xr devstat 3 ,
+.Xr iostat 8 ,
+.Xr rpc.rstatd 8 ,
+.Xr vmstat 8
+.Sh HISTORY
+The
+.Nm
+statistics system appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+.An Kenneth Merry Aq ken@FreeBSD.org
+.Sh BUGS
+There may be a need for
+.Fn spl
+protection around some of the
+.Nm
+list manipulation code to ensure, for example, that the list of devices
+is not changed while someone is fetching the
+.Va kern.devstat.all
+.Nm sysctl
+variable.
+.Pp
+It is impossible with the current
+.Nm
+architecture to accurately measure time per transaction.
+The only feasible
+way to accurately measure time per transaction would be to record a
+timestamp for every transaction.
+This measurement is probably not
+worthwhile for most people as it would adversely affect the performance of
+the system and cost space to store the timestamps for individual
+transactions.
diff --git a/share/man/man9/devtoname.9 b/share/man/man9/devtoname.9
new file mode 100644
index 000000000000..07ec04fb852f
--- /dev/null
+++ b/share/man/man9/devtoname.9
@@ -0,0 +1,48 @@
+.\" Copyright (c) 1999 Chris Costello
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 10, 2012
+.Dt DEVTONAME 9
+.Os
+.Sh NAME
+.Nm devtoname
+.Nd "converts character device into a string indicating the device name"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/conf.h
+.Ft const char *
+.Fn devtoname "struct cdev *dev"
+.Sh DESCRIPTION
+The
+.Fn devtoname
+function returns a pointer to the name of the device passed to it.
+The name is whatever was set to it in
+.Fn make_dev .
+.Sh HISTORY
+The
+.Fn devtoname
+interface first appeared in
+.Fx 4.0
diff --git a/share/man/man9/disk.9 b/share/man/man9/disk.9
new file mode 100644
index 000000000000..46435122506d
--- /dev/null
+++ b/share/man/man9/disk.9
@@ -0,0 +1,200 @@
+.\"
+.\" Copyright (c) 2003 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 18, 2004
+.Dt DISK 9
+.Os
+.Sh NAME
+.Nm disk
+.Nd kernel disk storage API
+.Sh SYNOPSIS
+.In geom/geom_disk.h
+.Ft struct disk *
+.Fn disk_alloc void
+.Ft void
+.Fn disk_create "struct disk *disk" "int version"
+.Ft void
+.Fn disk_gone "struct disk *disk"
+.Ft void
+.Fn disk_destroy "struct disk *disk"
+.Sh DESCRIPTION
+The disk storage API permits kernel device drivers providing access to
+disk-like storage devices to advertise the device to other kernel
+components, including
+.Xr GEOM 4
+and
+.Xr devfs 5 .
+.Pp
+Each disk device is described by a
+.Vt "struct disk"
+structure, which contains a variety of parameters for the disk device,
+function pointers for various methods that may be performed on the device,
+as well as private data storage for the device driver.
+In addition, some fields are reserved for use by GEOM in managing access
+to the device and its statistics.
+.Pp
+GEOM has the ownership of
+.Vt "struct disk" ,
+and drivers must allocate storage for it with the
+.Fn disk_alloc
+function,
+fill in the fields and call
+.Fn disk_create
+when the device is ready to service requests.
+.Fn disk_gone
+orphans all of the providers associated with the drive, setting an error
+condition of ENXIO in each one.
+In addition, it prevents a re-taste on last close for writing if an error
+condition has been set in the provider.
+After calling
+.Fn disk_destroy ,
+the device driver is not allowed to access the contents of
+.Vt "struct disk"
+anymore.
+.Pp
+The
+.Fn disk_create
+function
+takes a second parameter,
+.Fa version ,
+which must always be passed
+.Dv DISK_VERSION .
+If GEOM detects that the driver is compiled against an unsupported version,
+it will ignore the device and print a warning on the console.
+.Ss Descriptive Fields
+The following fields identify the disk device described by the structure
+instance, and must be filled in prior to submitting the structure to
+.Fn disk_create
+and may not be subsequently changed:
+.Bl -tag -width indent
+.It Vt u_int Va d_flags
+Optional flags indicating to the storage framework what optional features
+or descriptions the storage device driver supports.
+Currently supported flags are
+.Dv DISKFLAG_NEEDSGIANT
+(maintained by device driver),
+.Dv DISKFLAG_OPEN
+(maintained by storage framework),
+.Dv DISKFLAG_CANDELETE
+(maintained by device driver),
+and
+.Dv DISKFLAG_CANFLUSHCACHE
+(maintained by device driver).
+.It Vt "const char *" Va d_name
+Holds the name of the storage device class, e.g.,
+.Dq Li ahd .
+This value typically uniquely identifies a particular driver device,
+and must not conflict with devices serviced by other device drivers.
+.It Vt u_int Va d_unit
+Holds the instance of the storage device class, e.g.,
+.Dq Li 4 .
+This namespace is managed by the device driver, and assignment of unit
+numbers might be a property of probe order, or in some cases topology.
+Together, the
+.Va d_name
+and
+.Va d_unit
+values will uniquely identify a disk storage device.
+.El
+.Ss Disk Device Methods
+The following fields identify various disk device methods, if implemented:
+.Bl -tag -width indent
+.It Vt "disk_open_t *" Va d_open
+Optional: invoked when the disk device is opened.
+If no method is provided, open will always succeed.
+.It Vt "disk_close_t *" Va d_close
+Optional: invoked when the disk device is closed.
+Although an error code may be returned, the call should always terminate
+any state setup by the corresponding open method call.
+.It Vt "disk_strategy_t *" Va d_strategy
+Mandatory: invoked when a new
+.Vt "struct bio"
+is to be initiated on the disk device.
+.It Vt "disk_ioctl_t *" Va d_ioctl
+Optional: invoked when an I/O control operation is initiated on the disk device.
+Please note that for security reasons these operations should not
+be able to affect other devices than the one on which they are performed.
+.It Vt "dumper_t *" Va d_dump
+Optional: if configured with
+.Xr dumpon 8 ,
+this function is invoked from a very restricted system state after a
+kernel panic to record a copy of the system RAM to the disk.
+.El
+.Ss Mandatory Media Properties
+The following fields identify the size and granularity of the disk device.
+These fields must stay stable from return of the drivers open method until
+the close method is called, but it is perfectly legal to modify them in
+the open method before returning.
+.Bl -tag -width indent
+.It Vt u_int Va d_sectorsize
+The sector size of the disk device in bytes.
+.It Vt off_t Va d_mediasize
+The size of the disk device in bytes.
+.It Vt u_int Va d_maxsize
+The maximum supported size in bytes of an I/O request.
+Requests larger than this size will be chopped up by GEOM.
+.El
+.Ss Optional Media Properties
+These optional fields can provide extra information about the disk
+device.
+Do not initialize these fields if the field/concept does not apply.
+These fields must stay stable from return of the drivers open method until
+the close method is called, but it is perfectly legal to modify them in
+the open method before returning.
+.Bl -tag -width indent
+.It Vt u_int Va d_fwsectors , Vt u_int Va d_fwheads
+The number of sectors and heads advertised on the disk device by the
+firmware or BIOS.
+These values are almost universally bogus, but on some architectures
+necessary for the correct calculation of disk partitioning.
+.It Vt u_int Va d_stripeoffset , Vt u_int Va d_stripesize
+These two fields can be used to describe the width and location of
+natural performance boundaries for most disk technologies.
+Please see
+.Pa src/sys/geom/notes
+for details.
+.It Vt char Va d_ident[DISK_IDENT_SIZE]
+This field can and should be used to store disk's serial number.
+.El
+.Ss Driver Private Data
+This field may be used by the device driver to store a pointer to
+private data to implement the disk service.
+.Bl -tag -width indent
+.It Vt "void *" Va d_drv1
+Private data pointer.
+Typically used to store a pointer to the drivers
+.Vt softc
+structure for this disk device.
+.El
+.Sh SEE ALSO
+.Xr GEOM 4 ,
+.Xr devfs 5
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
diff --git a/share/man/man9/domain.9 b/share/man/man9/domain.9
new file mode 100644
index 000000000000..7d665b3231d4
--- /dev/null
+++ b/share/man/man9/domain.9
@@ -0,0 +1,226 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 23, 2012
+.Dt DOMAIN 9
+.Os
+.Sh NAME
+.Nm domain_add ,
+.Nm pfctlinput ,
+.Nm pfctlinput2 ,
+.Nm pffindproto ,
+.Nm pffindtype ,
+.Nm DOMAIN_SET
+.Nd "network domain management"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/protosw.h
+.In sys/domain.h
+.Ft void
+.Fn domain_add "void *data"
+.Ft void
+.Fn pfctlinput "int cmd" "struct sockaddr *sa"
+.Ft void
+.Fn pfctlinput2 "int cmd" "struct sockaddr *sa" "void *ctlparam"
+.Ft struct protosw *
+.Fn pffindproto "int family" "int protocol" "int type"
+.Ft struct protosw *
+.Fn pffindtype "int family" "int type"
+.Ft void
+.Fn DOMAIN_SET "name"
+.Sh DESCRIPTION
+Network protocols installed in the system are maintained within what
+are called domains
+(for example the
+.Va inetdomain
+and
+.Va localdomain ) .
+.Bd -literal
+struct domain {
+ int dom_family; /* AF_xxx */
+ char *dom_name;
+ void (*dom_init) /* initialize domain data structures */
+ (void);
+ int (*dom_externalize) /* externalize access rights */
+ (struct mbuf *, struct mbuf **);
+ void (*dom_dispose) /* dispose of internalized rights */
+ (struct mbuf *);
+ struct protosw *dom_protosw, *dom_protoswNPROTOSW;
+ struct domain *dom_next;
+ int (*dom_rtattach) /* initialize routing table */
+ (void **, int);
+ int dom_rtoffset; /* an arg to rtattach, in bits */
+ int dom_maxrtkey; /* for routing layer */
+};
+.Ed
+.Pp
+Each domain contains an array of protocol switch structures
+.Pq Vt "struct protosw *" ,
+one for each socket type supported.
+.Bd -literal
+struct protosw {
+ short pr_type; /* socket type used for */
+ struct domain *pr_domain; /* domain protocol a member of */
+ short pr_protocol; /* protocol number */
+ short pr_flags; /* see below */
+/* protocol-protocol hooks */
+ pr_input_t *pr_input; /* input to protocol (from below) */
+ pr_output_t *pr_output; /* output to protocol (from above) */
+ pr_ctlinput_t *pr_ctlinput; /* control input (from below) */
+ pr_ctloutput_t *pr_ctloutput; /* control output (from above) */
+/* utility hooks */
+ pr_init_t *pr_init;
+ pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */
+ pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
+ pr_drain_t *pr_drain; /* flush any excess space possible */
+
+ struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
+};
+.Ed
+.Pp
+The following functions handle the registration of a new domain,
+lookups of specific protocols and protocol types within those domains,
+and handle control messages from the system.
+.Pp
+.Fn pfctlinput
+is called by the system whenever an event occurs that could affect every
+domain.
+Examples of those types of events are routing table changes, interface
+shutdowns or certain
+.Tn ICMP
+message types.
+When called,
+.Fn pfctlinput
+calls the protocol specific
+.Fn pr_ctlinput
+function for each protocol in that has defined one, in every domain.
+.Pp
+.Fn pfctlinput2
+provides that same functionality of
+.Fn pfctlinput ,
+but with a few additional checks and a new
+.Vt "void *"
+argument that is passed directly to the protocol's
+.Fn pr_ctlinput
+function.
+Unlike
+.Fn pfctlinput ,
+.Fn pfctlinput2
+verifies that
+.Fa sa
+is not
+.Dv NULL ,
+and that only the protocol families that are the same as
+.Fa sa
+have their
+.Fn pr_ctlinput
+function called.
+.Pp
+.Fn domain_add
+adds a new protocol domain to the system.
+The argument
+.Fa data
+is cast directly to
+.Vt "struct domain *"
+within the function, but is declared
+.Vt "void *"
+in order to prevent compiler warnings when new domains are registered with
+.Fn SYSINIT .
+In most cases
+.Fn domain_add
+is not called directly, instead
+.Fn DOMAIN_SET
+is used.
+.Pp
+If the new domain has defined an initialization routine, it is called by
+.Fn domain_add ;
+as well, each of the protocols within the domain that have defined an
+initialization routine will have theirs called.
+.Pp
+Once a domain is added it cannot be unloaded.
+This is because there is
+no reference counting system in place to determine if there are any
+active references from sockets within that domain.
+.Pp
+.Fn pffindtype
+and
+.Fn pffindproto
+look up a protocol by its number or by its type.
+In most cases, if the protocol or type cannot be found,
+.Dv NULL
+is returned, but
+.Fn pffindproto
+may return the default if the requested type is
+.Dv SOCK_RAW ,
+a protocol switch type of
+.Dv SOCK_RAW
+is found, and the domain has a default raw protocol.
+.Pp
+Both functions are called by
+.Fn socreate
+in order to resolve the protocol for the socket currently being created.
+.Pp
+.Fn DOMAIN_SET
+is a macro that simplifies the registration of a domain via
+.Fn SYSINIT .
+The code resulting from the macro expects there to be a domain structure
+named
+.Dq Fa name Ns Li domain
+where
+.Fa name
+is the argument to
+.Fn DOMAIN_SET :
+.Bd -literal
+struct domain localdomain =
+{ AF_LOCAL, "local", unp_init, unp_externalize, unp_dispose,
+ localsw, &localsw[sizeof(localsw)/sizeof(localsw[0])] };
+
+DOMAIN_SET(local);
+.Ed
+.Sh RETURN VALUES
+Both
+.Fn pffindtype
+and
+.Fn pffindproto
+return a
+.Vt "struct protosw *"
+for the protocol requested.
+If the protocol or socket type is not found,
+.Dv NULL
+is returned.
+In the case of
+.Fn pffindproto ,
+the default protocol may be returned for
+.Dv SOCK_RAW
+types if the domain has a default raw protocol.
+.Sh SEE ALSO
+.Xr socket 2
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/drbr.9 b/share/man/man9/drbr.9
new file mode 100644
index 000000000000..168ce1047a96
--- /dev/null
+++ b/share/man/man9/drbr.9
@@ -0,0 +1,147 @@
+.\" Copyright (c) 2009 Bitgravity Inc
+.\" Written by: Kip Macy <kmacy@@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 30, 2012
+.Dt DRBR 9
+.Os
+.Sh NAME
+.Nm drbr ,
+.Nm drbr_free ,
+.Nm drbr_enqueue ,
+.Nm drbr_dequeue ,
+.Nm drbr_dequeue_cond ,
+.Nm drbr_flush ,
+.Nm drbr_empty ,
+.Nm drbr_inuse ,
+.Nm drbr_stats_update ,
+.Nd network driver interface to buf_ring
+.Sh SYNOPSIS
+.In sys/param.h
+.In net/if.h
+.In net/if_var.h
+.Ft void
+.Fn drbr_free "struct buf_ring *br" "struct malloc_type *type"
+.Ft int
+.Fn drbr_enqueue "struct ifnet *ifp" "struct buf_ring *br" "struct mbuf *m"
+.Ft struct mbuf *
+.Fn drbr_dequeue "struct ifnet *ifp" "struct buf_ring *br"
+.Ft struct mbuf *
+.Fn drbr_dequeue_cond "struct ifnet *ifp" "struct buf_ring *br" "int (*func) (struct mbuf *, void *)" "void *arg"
+.Ft void
+.Fn drbr_flush "struct ifnet *ifp" "struct buf_ring *br"
+.Ft int
+.Fn drbr_empty "struct ifnet *ifp" "struct buf_ring *br"
+.Ft int
+.Fn drbr_inuse "struct ifnet *ifp" "struct buf_ring *br"
+.Ft void
+.Fn drbr_stats_update "struct ifnet *ifp" "int len" "int mflags"
+.Sh DESCRIPTION
+The
+.Nm
+functions provide an API to network drivers for using
+.Xr buf_ring 9
+for enqueueing and dequeueing packets.
+This is meant as a replacement for the IFQ interface for packet queuing.
+It allows a packet to be enqueued with a single atomic and packet
+dequeue to be done without any per-packet atomics as it is protected
+by the driver's tx queue lock.
+If
+.Dv INVARIANTS
+is enabled,
+.Fn drbr_dequeue
+will assert that the tx queue lock is held when it is called.
+.Pp
+The
+.Fn drbr_free
+function frees all the enqueued mbufs and then frees the buf_ring.
+.Pp
+The
+.Fn drbr_enqueue
+function is used to enqueue an mbuf to a buf_ring, falling back to the
+ifnet's IFQ if
+.Xr ALTQ 4
+is enabled.
+.Pp
+The
+.Fn drbr_dequeue
+function is used to dequeue an mbuf from a buf_ring or, if
+.Xr ALTQ 4
+is enabled, from the ifnet's IFQ.
+.Pp
+The
+.Fn drbr_dequeue_cond
+function is used to conditionally dequeue an mbuf from a buf_ring based
+on whether
+.Fa func
+returns
+.Dv TRUE
+or
+.Dv FALSE .
+.Pp
+The
+.Fn drbr_flush
+function frees all mbufs enqueued in the buf_ring and the ifnet's IFQ.
+.Pp
+The
+.Fn drbr_empty
+function returns
+.Dv TRUE
+if there are no mbufs enqueued,
+.Dv FALSE
+otherwise.
+.Pp
+The
+.Fn drbr_inuse
+function returns the number of mbufs enqueued.
+Note to users that this is intrinsically racy as there is no guarantee that
+there will not be more mbufs when
+.Fn drbr_dequeue
+is actually called.
+Provided the tx queue lock is held there will not be less.
+.Pp
+The
+.Fn drbr_stats_update
+function updates the number of bytes and the number of multicast packets sent.
+.Sh RETURN VALUES
+The
+.Fn drbr_enqueue
+function returns
+.Er ENOBUFS
+if there are no slots available in the buf_ring and
+.Dv 0
+on success.
+.Pp
+The
+.Fn drbr_dequeue
+and
+.Fn drbr_dequeue_cond
+functions return an mbuf on success and
+.Dv NULL
+if the buf_ring is empty.
+.Sh HISTORY
+These functions were introduced in
+.Fx 8.0 .
diff --git a/share/man/man9/driver.9 b/share/man/man9/driver.9
new file mode 100644
index 000000000000..93ab992ce741
--- /dev/null
+++ b/share/man/man9/driver.9
@@ -0,0 +1,116 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1998 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 22, 2011
+.Dt DRIVER 9
+.Os
+.Sh NAME
+.Nm driver
+.Nd structure describing a device driver
+.Sh SYNOPSIS
+.Bd -literal
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/module.h>
+
+static int foo_probe(device_t);
+static int foo_attach(device_t);
+static int foo_detach(device_t);
+static int foo_frob(device_t, int, int);
+static int foo_twiddle(device_t, char *);
+
+static device_method_t foo_methods[] = {
+ /* Methods from the device interface */
+ DEVMETHOD(device_probe, foo_probe),
+ DEVMETHOD(device_attach, foo_attach),
+ DEVMETHOD(device_detach, foo_detach),
+
+ /* Methods from the bogo interface */
+ DEVMETHOD(bogo_frob, foo_frob),
+ DEVMETHOD(bogo_twiddle, foo_twiddle),
+
+ /* Terminate method list */
+ DEVMETHOD_END
+};
+
+static driver_t foo_driver = {
+ "foo",
+ foo_methods,
+ sizeof(struct foo_softc)
+};
+
+static devclass_t foo_devclass;
+
+DRIVER_MODULE(foo, bogo, foo_driver, foo_devclass, NULL, NULL);
+.Ed
+.Sh DESCRIPTION
+Each driver in the kernel is described by a
+.Dv driver_t
+structure.
+The structure contains the name of the device, a pointer
+to a list of methods, an indication of the kind of device which the
+driver implements and the size of the private data which the driver
+needs to associate with a device instance.
+Each driver will implement
+one or more sets of methods (called interfaces).
+The example driver
+implements the standard "driver" interface and the fictitious "bogo"
+interface.
+.Pp
+When a driver is registered with the system (by the
+.Dv DRIVER_MODULE
+macro, see
+.Xr DRIVER_MODULE 9 ) ,
+it is added to the list of drivers contained in the devclass
+of its parent bus type.
+For instance all PCI drivers would be
+contained in the devclass named "pci" and all ISA drivers would be
+in the devclass named "isa".
+The reason the drivers are not held in the device object of the parent
+bus is to handle multiple instances of a given type of bus.
+The
+.Dv DRIVER_MODULE
+macro will also create the devclass with the name of the driver and
+can optionally call extra initialisation code in the driver by
+specifying an extra module event handler and argument as the last two
+arguments.
+.Sh SEE ALSO
+.Xr devclass 9 ,
+.Xr device 9 ,
+.Xr DEVICE_ATTACH 9 ,
+.Xr DEVICE_DETACH 9 ,
+.Xr DEVICE_IDENTIFY 9 ,
+.Xr DEVICE_PROBE 9 ,
+.Xr DEVICE_SHUTDOWN 9 ,
+.Xr DRIVER_MODULE 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/eventtimers.9 b/share/man/man9/eventtimers.9
new file mode 100644
index 000000000000..2ed15d0f8051
--- /dev/null
+++ b/share/man/man9/eventtimers.9
@@ -0,0 +1,236 @@
+.\"
+.\" Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2011
+.Dt EVENTTIMERS 9
+.Os
+.Sh NAME
+.Nm eventtimers
+.Nd kernel event timers subsystem
+.Sh SYNOPSIS
+.In sys/timeet.h
+.Bd -literal
+struct eventtimer;
+
+typedef int et_start_t(struct eventtimer *et,
+ struct bintime *first, struct bintime *period);
+typedef int et_stop_t(struct eventtimer *et);
+typedef void et_event_cb_t(struct eventtimer *et, void *arg);
+typedef int et_deregister_cb_t(struct eventtimer *et, void *arg);
+
+struct eventtimer {
+ SLIST_ENTRY(eventtimer) et_all;
+ char *et_name;
+ int et_flags;
+#define ET_FLAGS_PERIODIC 1
+#define ET_FLAGS_ONESHOT 2
+#define ET_FLAGS_PERCPU 4
+#define ET_FLAGS_C3STOP 8
+#define ET_FLAGS_POW2DIV 16
+ int et_quality;
+ int et_active;
+ uint64_t et_frequency;
+ struct bintime et_min_period;
+ struct bintime et_max_period;
+ et_start_t *et_start;
+ et_stop_t *et_stop;
+ et_event_cb_t *et_event_cb;
+ et_deregister_cb_t *et_deregister_cb;
+ void *et_arg;
+ void *et_priv;
+ struct sysctl_oid *et_sysctl;
+};
+.Ed
+.Ft int
+.Fn et_register "struct eventtimer *et"
+.Ft int
+.Fn et_deregister "struct eventtimer *et"
+.Fn ET_LOCK
+.Fn ET_UNLOCK
+.Ft struct eventtimer *
+.Fn et_find "const char *name" "int check" "int want"
+.Ft int
+.Fn et_init "struct eventtimer *et" "et_event_cb_t *event" "et_deregister_cb_t *deregister" "void *arg"
+.Ft int
+.Fn et_start "struct eventtimer *et" "struct bintime *first" "struct bintime *period"
+.Ft int
+.Fn et_stop "struct eventtimer *et"
+.Ft int
+.Fn et_ban "struct eventtimer *et"
+.Ft int
+.Fn et_free "struct eventtimer *et"
+.Sh DESCRIPTION
+Event timers are responsible for generating interrupts at specified time
+or periodically, to run different time-based events.
+Subsystem consists of three main parts:
+.Bl -tag
+.It Drivers
+Manage hardware to generate requested time events.
+.It Consumers
+.Pa sys/kern/kern_clocksource.c
+uses event timers to supply kernel with
+.Fn hardclock ,
+.Fn statclock
+and
+.Fn profclock
+time events.
+.It Glue code
+.Pa sys/sys/timeet.h ,
+.Pa sys/kern/kern_et.c
+provide APIs for event timer drivers and consumers.
+.El
+.Sh DRIVER API
+Driver API is built around eventtimer structure.
+To register its functionality driver allocates that structure and calls
+.Fn et_register .
+Driver should fill following fields there:
+.Bl -tag
+.It Va et_name
+Unique name of the event timer for management purposes.
+.It Va et_flags
+Set of flags, describing timer capabilities:
+.Bl -tag -width "ET_FLAGS_PERIODIC" -compact
+.It ET_FLAGS_PERIODIC
+Periodic mode supported.
+.It ET_FLAGS_ONESHOT
+One-shot mode supported.
+.It ET_FLAGS_PERCPU
+Timer is per-CPU.
+.It ET_FLAGS_C3STOP
+Timer may stop in CPU sleep state.
+.It ET_FLAGS_POW2DIV
+Timer supports only 2^n divisors.
+.El
+.It Va et_quality
+Abstract value to certify whether this timecounter is better than the others.
+Higher value means better.
+.It Va et_frequency
+Timer oscillator's base frequency, if applicable and known.
+Used by consumers to predict set of possible frequencies that could be
+obtained by dividing it.
+Should be zero if not applicable or unknown.
+.It Va et_min_period , et_max_period
+Minimal and maximal reliably programmable time periods.
+.It Va et_start
+Driver's timer start function pointer.
+.It Va et_stop
+Driver's timer stop function pointer.
+.It Va et_priv
+Driver's private data storage.
+.El
+.Pp
+After the event timer functionality is registered, it is controlled via
+.Va et_start
+and
+.Va et_stop
+methods.
+.Va et_start
+method is called to start the specified event timer.
+The last two arguments are used to specify time when events should be
+generated.
+.Va first
+argument specifies time period before the first event generated.
+In periodic mode NULL value specifies that first period is equal to the
+.Va period
+argument value.
+.Va period
+argument specifies the time period between following events for the
+periodic mode.
+The NULL value there specifies the one-shot mode.
+At least one of these two arguments should be not NULL.
+When event time arrive, driver should call
+.Va et_event_cb
+callback function, passing
+.Va et_arg
+as the second argument.
+.Va et_stop
+method is called to stop the specified event timer.
+For the per-CPU event timers
+.Va et_start
+and
+.Va et_stop
+methods control timers associated with the current CPU.
+.Pp
+Driver may deregister its functionality by calling
+.Fn et_deregister .
+.Sh CONSUMER API
+.Fn et_find
+allows consumer to find available event timer, optionally matching specific
+name and/or capability flags.
+Consumer may read returned eventtimer structure, but should not modify it.
+When wanted event timer is found,
+.Fn et_init
+should be called for it, submitting
+.Va event
+and optionally
+.Va deregister
+callbacks functions, and the opaque argument
+.Va arg .
+That argument will be passed as argument to the callbacks.
+Event callback function will be called on scheduled time events.
+It is called from the hardware interrupt context, so no sleep is permitted
+there.
+Deregister callback function may be called to report consumer that the event
+timer functionality is no longer available.
+On this call, consumer should stop using event timer before the return.
+.Pp
+After the timer is found and initialized, it can be controlled via
+.Fn et_start
+and
+.Fn et_stop .
+The arguments are the same as described in driver API.
+Per-CPU event timers can be controlled only from specific CPUs.
+.Pp
+.Fn et_ban
+allows consumer to mark event timer as broken via clearing both one-shot and
+periodic capability flags, if it was somehow detected.
+.Fn et_free
+is the opposite to
+.Fn et_init .
+It releases the event timer for other consumers use.
+.Pp
+.Fn ET_LOCK
+and
+.Fn ET_UNLOCK
+macros should be used to manage
+.Xr mutex 9
+lock around
+.Fn et_find ,
+.Fn et_init
+and
+.Fn et_free
+calls to serialize access to the list of the registered event timers and the
+pointers returned by
+.Fn et_find .
+.Fn et_start
+and
+.Fn et_stop
+calls should be serialized in consumer's internal way to avoid concurrent
+timer hardware access.
+.Sh SEE ALSO
+.Xr eventtimers 4
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org
diff --git a/share/man/man9/extattr.9 b/share/man/man9/extattr.9
new file mode 100644
index 000000000000..bf79487f8bf4
--- /dev/null
+++ b/share/man/man9/extattr.9
@@ -0,0 +1,96 @@
+.\"-
+.\" Copyright (c) 1999, 2000, 2001, 2003 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 1999
+.Dt EXTATTR 9
+.Os
+.Sh NAME
+.Nm extattr
+.Nd virtual file system named extended attributes
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/extattr.h
+.Sh DESCRIPTION
+Named extended attributes allow additional meta-data to be associated
+with vnodes representing files and directories.
+The semantics of this additional data is that of a "name=value" pair, where
+a name may be defined or undefined, and if defined, associated with zero or
+more bytes of arbitrary binary data.
+Extended attribute names exist within a set of namespaces; each operation
+on an extended attribute is required to provide the namespace to which to
+operation refers.
+If the same name is present in multiple namespaces, the extended attributes
+associated with the names are stored and manipulated independently.
+The following two namespaces are defined universally, although individual
+file systems may implement additional namespaces, or not implement
+these namespaces:
+.Dv EXTATTR_NAMESPACE_USER ,
+.Dv EXTATTR_NAMESPACE_SYSTEM .
+The semantics of these attributes are intended to be as follows: user
+attribute data is protected according the normal discretionary
+and mandatory protections associated with the data in the file or
+directory; system attribute data is protected such that appropriate
+privilege is required to directly access or manipulate these attributes.
+.Pp
+Reads of extended attribute data may return specific contiguous regions of
+the meta-data, in the style of
+.Xr VOP_READ 9 ,
+but writes will replace the entire current "value" associated with
+a given name.
+As there are a plethora of file systems with differing extended attributes,
+availability and functionality of these functions may be limited, and they
+should be used with awareness of the underlying semantics of the supporting
+file system.
+Authorization schemes for extended attribute data may also vary by file
+system, as well as maximum attribute size, and whether or not any or
+specific new attributes may be defined.
+.Pp
+Extended attributes are named using a null-terminated character string.
+Depending on underlying file system semantics, this name may or may not be
+case-sensitive.
+Appropriate vnode extended attribute calls are:
+.Xr VOP_GETEXTATTR 9 ,
+.Xr VOP_LISTEXTATTR 9 ,
+and
+.Xr VOP_SETEXTATTR 9 .
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_EXTATTRCTL 9 ,
+.Xr VOP_GETEXTATTR 9 ,
+.Xr VOP_LISTEXTATTR 9 ,
+.Xr VOP_SETEXTATTR 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
+.Sh BUGS
+In addition, the interface does not provide a mechanism to retrieve
+the current set of available attributes; it has been suggested that
+providing a
+.Dv NULL
+attribute name should cause a list of defined attributes for the passed file
+or directory, but this is not currently implemented.
diff --git a/share/man/man9/fail.9 b/share/man/man9/fail.9
new file mode 100644
index 000000000000..5505d1370484
--- /dev/null
+++ b/share/man/man9/fail.9
@@ -0,0 +1,208 @@
+.\"
+.\" Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 10, 2009
+.Dt FAIL 9
+.Os
+.Sh NAME
+.Nm KFAIL_POINT_CODE ,
+.Nm KFAIL_POINT_RETURN ,
+.Nm KFAIL_POINT_RETURN_VOID ,
+.Nm KFAIL_POINT_ERROR ,
+.Nm KFAIL_POINT_GOTO ,
+.Nm fail_point ,
+.Nm DEBUG_FP
+.Nd fail points
+.Sh SYNOPSIS
+.In sys/fail.h
+.Fn KFAIL_POINT_CODE "parent" "name" "code"
+.Fn KFAIL_POINT_RETURN "parent" "name"
+.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
+.Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
+.Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
+.Sh DESCRIPTION
+Fail points are used to add code points where errors may be injected
+in a user controlled fashion.
+Fail points provide a convenient wrapper around user-provided error
+injection code, providing a
+.Xr sysctl 9
+MIB, and a parser for that MIB that describes how the error
+injection code should fire.
+.Pp
+The base fail point macro is
+.Fn KFAIL_POINT_CODE
+where
+.Fa parent
+is a sysctl tree (frequently
+.Sy DEBUG_FP
+for kernel fail points, but various subsystems may wish to provide
+their own fail point trees), and
+.Fa name
+is the name of the MIB in that tree, and
+.Fa code
+is the error injection code.
+The
+.Fa code
+argument does not require braces, but it is considered good style to
+use braces for any multi-line code arguments.
+Inside the
+.Fa code
+argument, the evaluation of
+.Sy RETURN_VALUE
+is derived from the
+.Fn return
+value set in the sysctl MIB.
+See
+.Sx SYSCTL VARIABLES
+below.
+.Pp
+The remaining
+.Fn KFAIL_POINT_*
+macros are wrappers around common error injection paths:
+.Bl -inset
+.It Fn KFAIL_POINT_RETURN parent name
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., return RETURN_VALUE)
+.It Fn KFAIL_POINT_RETURN_VOID parent name
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., return)
+.It Fn KFAIL_POINT_ERROR parent name error_var
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., error_var = RETURN_VALUE)
+.It Fn KFAIL_POINT_GOTO parent name error_var label
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., { error_var = RETURN_VALUE; goto label;})
+.El
+.Sh SYSCTL VARIABLES
+The
+.Fn KFAIL_POINT_*
+macros add sysctl MIBs where specified.
+Many base kernel MIBs can be found in the
+.Sy debug.fail_point
+tree (referenced in code by
+.Sy DEBUG_FP ) .
+.Pp
+The sysctl variable may be set using the following grammar:
+.Bd -literal
+ <fail_point> ::
+ <term> ( "->" <term> )*
+
+ <term> ::
+ ( (<float> "%") | (<integer> "*" ) )*
+ <type>
+ [ "(" <integer> ")" ]
+ [ "[pid " <integer> "]" ]
+
+ <float> ::
+ <integer> [ "." <integer> ] |
+ "." <integer>
+
+ <type> ::
+ "off" | "return" | "sleep" | "panic" | "break" | "print"
+.Ed
+.Pp
+The <type> argument specifies which action to take:
+.Bl -tag -width ".Dv return"
+.It Sy off
+Take no action (does not trigger fail point code)
+.It Sy return
+Trigger fail point code with specified argument
+.It Sy sleep
+Sleep the specified number of milliseconds
+.It Sy panic
+Panic
+.It Sy break
+Break into the debugger, or trap if there is no debugger support
+.It Sy print
+Print that the fail point executed
+.El
+.Pp
+The <float>% and <integer>* modifiers prior to <type> control when
+<type> is executed.
+The <float>% form (e.g. "1.2%") can be used to specify a
+probability that <type> will execute.
+The <integer>* form (e.g. "5*") can be used to specify the number of
+times <type> should be executed before this <term> is disabled.
+Only the last probability and the last count are used if multiple
+are specified, i.e. "1.2%2%" is the same as "2%".
+When both a probability and a count are specified, the probability
+is evaluated before the count, i.e. "2%5*" means "2% of the time,
+but only 5 times total".
+.Pp
+The operator -> can be used to express cascading terms.
+If you specify <term1>-><term2>, it means that if <term1> does not
+.Ql execute ,
+<term2> is evaluated.
+For the purpose of this operator, the return() and print() operators
+are the only types that cascade.
+A return() term only cascades if the code executes, and a print()
+term only cascades when passed a non-zero argument.
+A pid can optionally be specified.
+The fail point term is only executed when invoked by a process with a
+matching p_pid.
+.Sh EXAMPLES
+.Bl -tag
+.It Sy sysctl debug.fail_point.foobar="2.1%return(5)"
+21/1000ths of the time, execute
+.Fa code
+with RETURN_VALUE set to 5.
+.It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
+2/100ths of the time, execute
+.Fa code
+with RETURN_VALUE set to 5.
+If that does not happen, 5% of the time execute
+.Fa code
+with RETURN_VALUE set to 22.
+.It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
+For 5 times, return 5.
+After that, 1/1000th of the time, return 22.
+.It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)"
+Return 5 for 1 in 1000 executions, but only 5 times total.
+.It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
+1/100th of the time, sleep 50ms.
+.It Sy sysctl debug.fail_point.foobar="1*return(5)[pid 1234]"
+Return 5 once, when pid 1234 executes the fail point.
+.El
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Zach Loafman Aq zml@FreeBSD.org .
+.Sh CAVEATS
+It is easy to shoot yourself in the foot by setting fail points too
+aggressively or setting too many in combination.
+For example, forcing
+.Fn malloc
+to fail consistently is potentially harmful to uptime.
+.Pp
+The
+.Fn sleep
+sysctl setting may not be appropriate in all situations.
+Currently,
+.Fn fail_point_eval
+does not verify whether the context is appropriate for calling
+.Fn msleep .
diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9
new file mode 100644
index 000000000000..ccf68668d3d8
--- /dev/null
+++ b/share/man/man9/fetch.9
@@ -0,0 +1,101 @@
+.\" $NetBSD: fetch.9,v 1.2 1996/01/09 21:59:24 perry Exp $
+.\"
+.\" Copyright (c) 1996 Jason R. Thorpe.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed by Kenneth Stailey.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Jason R. Thorpe.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2009
+.Dt FETCH 9
+.Os
+.Sh NAME
+.Nm fetch ,
+.Nm fubyte ,
+.Nm fuswintr ,
+.Nm fuword ,
+.Nm fuword16 ,
+.Nm fuword32 ,
+.Nm fuword64
+.Nd fetch data from user-space
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/time.h
+.In sys/systm.h
+.Ft int
+.Fn fubyte "const void *base"
+.Ft long
+.Fn fuword "const void *base"
+.Ft int
+.Fn fuword16 "void *base"
+.Ft int32_t
+.Fn fuword32 "const void *base"
+.Ft int64_t
+.Fn fuword64 "const void *base"
+.In sys/resourcevar.h
+.Ft int
+.Fn fuswintr "void *base"
+.Sh DESCRIPTION
+The
+.Nm
+functions are designed to copy small amounts of data from user-space.
+.Pp
+The
+.Nm
+routines provide the following functionality:
+.Bl -tag -width "fuswintr()"
+.It Fn fubyte
+Fetches a byte of data from the user-space address
+.Pa base .
+.It Fn fuword
+Fetches a word of data from the user-space address
+.Pa base .
+.It Fn fuword16
+Fetches 16 bits of data from the user-space address
+.Pa base .
+.It Fn fuword32
+Fetches 32 bits of data from the user-space address
+.Pa base .
+.It Fn fuword64
+Fetches 64 bits of data from the user-space address
+.Pa base .
+.It Fn fuswintr
+Fetches a short word of data from the user-space address
+.Pa base .
+This function is safe to call during an interrupt context.
+.El
+.Sh RETURN VALUES
+The
+.Nm
+functions return the data fetched or -1 on failure.
+.Sh SEE ALSO
+.Xr copy 9 ,
+.Xr store 9
diff --git a/share/man/man9/firmware.9 b/share/man/man9/firmware.9
new file mode 100644
index 000000000000..9987e09c2ac1
--- /dev/null
+++ b/share/man/man9/firmware.9
@@ -0,0 +1,270 @@
+.\" Copyright (c) 2006 Max Laier <mlaier@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 2, 2008
+.Dt FIRMWARE 9
+.Os
+.Sh NAME
+.Nm firmware_register ,
+.Nm firmware_unregister ,
+.Nm firmware_get ,
+.Nm firmware_put
+.Nd firmware image loading and management
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/linker.h
+.In sys/firmware.h
+.Bd -literal
+struct firmware {
+ const char *name; /* system-wide name */
+ const void *data; /* location of image */
+ size_t datasize; /* size of image in bytes */
+ unsigned int version; /* version of the image */
+};
+.Ed
+.Ft "const struct firmware *"
+.Fo firmware_register
+.Fa "const char *imagename"
+.Fa "const void *data"
+.Fa "size_t datasize"
+.Fa "unsigned int version"
+.Fa "const struct firmware *parent"
+.Fc
+.Ft int
+.Fn firmware_unregister "const char *imagename"
+.Ft "const struct firmware *"
+.Fn firmware_get "const char *imagename"
+.Ft void
+.Fn firmware_put "const struct firmware *fp" "int flags"
+.Sh DESCRIPTION
+The
+.Nm firmware
+abstraction provides a convenient interface for loading
+.Nm firmware images
+into the kernel, and for accessing such images from kernel components.
+.Pp
+A
+.Nm firmware image
+(or
+.Nm image
+for brevity)
+is an opaque block of data residing in kernel memory.
+It is associated to a unique
+.Nm imagename
+which constitutes a search key, and to an integer
+.Nm version
+number, which is also an opaque piece of information for the
+firmware subsystem.
+.Pp
+An image is registered with the
+.Nm firmware
+subsystem by calling the function
+.Fn firmware_register ,
+and unregistered by calling
+.Fn firmware_unregister .
+These functions are usually (but not exclusively) called by
+specially crafted kernel modules that contain the firmware image.
+The modules can be statically compiled in the kernel, or loaded by
+.Nm /boot/loader ,
+manually at runtime, or on demand by the firmware subsystem.
+.Pp
+.Nm Clients
+of the firmware subsystem can request access to a given image
+by calling the function
+.Fn firmware_get
+with the
+.Nm imagename
+they want as an argument. If a matching image is not already registered,
+the firmware subsystem will try to load it using the
+mechanisms specified below (typically, a kernel module
+with
+.Nm the same name
+as the image).
+.Sh API DESCRIPTION
+The kernel
+.Nm firmware API
+is made of the following functions:
+.Pp
+.Fn firmware_register
+registers with the kernel an image of size
+.Nm datasize
+located at address
+.Nm data ,
+under the name
+.Nm imagename .
+.Pp
+The function returns NULL on error (e.g. because an
+image with the same name already exists, or the image
+table is full), or a
+.Ft const struct firmware *
+pointer to the image requested.
+.Pp
+.Fn firmware_unregister
+tries to unregister the firmware image
+.Nm imagename
+from the system. The function is successful and returns 0
+if there are no pending references to the image, otherwise
+it does not unregister the image and returns EBUSY.
+.Pp
+.Fn firmware_get
+returns the requested firmware image.
+If the image is not yet registered with the system,
+the function tries to load it.
+This involves the linker subsystem and disk access, so
+.Fn firmware_get
+must not be called with any locks (except for
+.Va Giant ) .
+Note also that if the firmware image is loaded from a filesystem
+it must already be mounted.
+In particular this means that it may be necessary to defer requests
+from a driver attach method unless it is known the root filesystem is
+already mounted.
+.Pp
+On success,
+.Fn firmware_get
+returns a pointer to the image description and increases the reference count
+for this image. On failure, the function returns NULL.
+.Pp
+.Fn firmware_put
+drops a reference to a firmware image.
+The
+.Fa flags
+argument may be set to
+.Dv FIRMWARE_UNLOAD
+to indicate that
+firmware_put is free to reclaim resources associated with
+the firmware image if this is the last reference.
+By default a firmware image will be deferred to a
+.Xr taskqueue 9
+thread so the call may be done while holding a lock.
+In certain cases, such as on driver detach, this cannot be allowed.
+.Sh FIRMWARE LOADING MECHANISMS
+As mentioned before, any component of the system can register
+firmware images at any time by simply calling
+.Fn firmware_register .
+.Pp
+This is typically done when a module containing
+a firmware image is given control,
+whether compiled in, or preloaded by
+.Nm /boot/loader ,
+or manually loaded with
+.Xr kldload 8 .
+However, a system can implement additional mechanisms to bring
+these images in memory before calling
+.Fn firmware_register .
+.Pp
+When
+.Fn firmware_get
+does not find the requested image, it tries to load it using
+one of the available loading mechanisms.
+At the moment, there is only one, namely
+.Nm Loadable kernel modules :
+.Pp
+A firmware image named
+.Nm foo
+is looked up by trying to load the module named
+.Nm foo.ko ,
+using the facilities described in
+.Xr kld 4 .
+In particular, images are looked up in the directories specified
+by the sysctl variable
+.Nm kern.module_path
+which on most systems defaults to
+.Nm /boot/kernel;/boot/modules .
+.Pp
+Note that in case a module contains multiple images,
+the caller should first request a
+.Fn firmware_get
+for the first image contained in the module, followed by requests
+for the other images.
+.Sh BUILDING FIRMWARE LOADABLE MODULES
+A firmware module is built by embedding the
+.Nm firmware image
+into a suitable loadable kernel module that calls
+.Fn firmware_register
+on loading, and
+.Fn firmware_unregister
+on unloading.
+.Pp
+Various system scripts and makefiles let you build a module
+by simply writing a Makefile with the following entries:
+.Bd -literal
+
+ KMOD= imagename
+ FIRMWS= image_file:imagename[:version]
+ .include <bsd.kmod.mk>
+
+.Ed
+where KMOD is the basename of the module; FIRMWS is a list of
+colon-separated tuples indicating the image_file's to be embedded
+in the module, the imagename and version of each firmware image.
+.Pp
+If you need to embed firmware images into a system, you should write
+appropriate entries in the <files.arch> file, e.g. this example is
+from
+.Nm sys/arm/xscale/ixp425/files.ixp425:
+.Bd -literal
+ixp425_npe_fw.c optional npe_fw \\
+ compile-with "${AWK} -f $S/tools/fw_stub.awk \\
+ IxNpeMicrocode.dat:npe_fw -mnpe -c${.TARGET}" \\
+ no-implicit-rule before-depend local \\
+ clean "ixp425_npe_fw.c"
+#
+# NB: ld encodes the path in the binary symbols generated for the
+# firmware image so link the file to the object directory to
+# get known values for reference in the _fw.c file.
+#
+IxNpeMicrocode.fwo optional npe_fw \\
+ dependency "IxNpeMicrocode.dat" \\
+ compile-with "${LD} -b binary -d -warn-common \\
+ -r -d -o ${.TARGET} IxNpeMicrocode.dat" \\
+ no-implicit-rule \\
+ clean "IxNpeMicrocode.fwo"
+IxNpeMicrocode.dat optional npe_fw \\
+ dependency ".PHONY" \\
+ compile-with "uudecode < $S/contrib/dev/npe/IxNpeMicrocode.dat.uu" \\
+ no-obj no-implicit-rule \\
+ clean "IxNpeMicrocode.dat"
+.Ed
+.Pp
+Note that generating the firmware modules in this way requires
+the availability of the following tools:
+.Xr awk ,
+.Xr Make ,
+the compiler and the linker.
+.Sh SEE ALSO
+.Xr module 9 ,
+.Xr kld 4
+.Pp
+.Pa /usr/share/examples/kld/firmware
+.Sh HISTORY
+The
+.Nm firmware
+system was introduced in
+.Fx 6.1 .
+.Sh AUTHORS
+This manual page was written by
+.An Max Laier Aq mlaier@FreeBSD.org .
diff --git a/share/man/man9/g_access.9 b/share/man/man9/g_access.9
new file mode 100644
index 000000000000..95ad1da91a32
--- /dev/null
+++ b/share/man/man9/g_access.9
@@ -0,0 +1,165 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_ACCESS 9
+.Os
+.Sh NAME
+.Nm g_access
+.Nd "control access to GEOM consumers and their providers"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft int
+.Fn g_access "struct g_consumer *cp" "int dcr" "int dcw" "int dce"
+.Sh DESCRIPTION
+The
+.Fn g_access
+function allows to open, close, and generally change access to the provider
+which is attached to the given consumer
+.Fa cp .
+The arguments
+.Fa dcr ,
+.Fa dcw ,
+and
+.Fa dce
+represent relative read, write, and exclusive access count changes.
+Read and write access counts are self explanatory, and
+exclusive access counts deny write access to other interested parties.
+A provider's access count is the sum of the access counts of all
+attached consumers.
+.Pp
+After attaching a consumer to a provider with
+.Xr g_attach 9 ,
+the
+.Fn g_access
+function has to be called on the consumer before starting I/O requests.
+.Sh RESTRICTIONS/CONDITIONS
+The consumer has to be attached to a provider.
+.Pp
+The intended change must not result in a negative access count.
+.Pp
+No-operation is not permitted
+.Fa ( dcr
+=
+.Fa dcw
+=
+.Fa dce
+=
+.Li 0 ) .
+.Pp
+The provider's geom must have an access method defined (e.g.,
+.Va gp->access ) .
+.Pp
+The topology lock has to be held.
+.Sh RETURN VALUES
+The
+.Fn g_access
+function returns 0 if successful; otherwise an error code is returned.
+Note that
+.Fn g_access
+cannot fail when the arguments
+.Fa dcr ,
+.Fa dcw ,
+and
+.Fa dce
+are less than or equal to 0.
+.Sh EXAMPLES
+Create a consumer, attach it to a given provider, gain read access and
+read first sector.
+.Bd -literal -offset indent
+void
+some_function(struct g_geom *mygeom, struct g_provider *pp)
+{
+ struct g_consumer *cp;
+ void *ptr;
+ int error;
+
+ g_topology_assert();
+
+ /* Create new consumer on 'mygeom' geom. */
+ cp = g_new_consumer(mygeom);
+ /* Attach newly created consumer to given provider. */
+ if (g_attach(cp, pp) != 0) {
+ g_destroy_consumer(cp);
+ return;
+ }
+ /* Open provider for reading through our consumer. */
+ error = g_access(cp, 1, 0, 0);
+ if (error != 0) {
+ printf("Cannot access provider: %s\\n", error);
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ return;
+ }
+
+ /*
+ * Don't hold topology lock while reading.
+ */
+ g_topology_unlock();
+ ptr = g_read_data(cp, 0, pp->sectorsize, &error);
+ if (ptr == NULL)
+ printf("Error while reading: %d\\n", error);
+ /*
+ * Do something useful with data.
+ */
+ g_topology_lock();
+
+ /* Disconnect from provider (release access count). */
+ g_access(cp, -1, 0, 0);
+ /* Detach from provider. */
+ g_detach(cp);
+ /* Destroy consumer. */
+ g_destroy_consumer(cp);
+}
+.Ed
+.Sh ERRORS
+Possible errors:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The function is trying to open a provider with an exclusive access count, but
+it is already open for writing.
+.It Bq Er EPERM
+The function is trying to open a provider for writing, but it is already
+exclusively open.
+.El
+.Pp
+Any other error that can be returned by the provider's access method.
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_attach.9 b/share/man/man9/g_attach.9
new file mode 100644
index 000000000000..4bf7d9c51493
--- /dev/null
+++ b/share/man/man9/g_attach.9
@@ -0,0 +1,141 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_ATTACH 9
+.Os
+.Sh NAME
+.Nm g_attach ,
+.Nm g_detach
+.Nd "attach/detach GEOM consumers to/from providers"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft int
+.Fn g_attach "struct g_consumer *cp" "struct g_provider *pp"
+.Ft void
+.Fn g_detach "struct g_consumer *cp"
+.Sh DESCRIPTION
+The
+.Fn g_attach
+function attaches given consumer
+.Fa cp
+to given provider
+.Fa pp ,
+thus establishing a communication channel between the consumer and the
+provider that allows to change access counts and perform I/O operations.
+.Pp
+The
+.Fn g_detach
+function detaches given consumer
+.Fa cp
+from its corresponding provider, tearing down the communication channel
+between them.
+.Sh RESTRICTIONS/CONDITIONS
+.Fn g_attach :
+.Bl -item -offset indent
+.It
+The consumer must not be attached to a provider.
+.It
+The operation must not create a topology loop.
+.It
+The topology lock has to be held.
+.El
+.Pp
+.Fn g_detach :
+.Bl -item -offset indent
+.It
+The consumer has to be attached.
+.It
+The access count has to be 0.
+.It
+There must be no active requests.
+.It
+The topology lock has to be held.
+.El
+.Sh RETURN VALUES
+The
+.Fn g_attach
+function returns 0 if successful; otherwise an error code is returned.
+.Sh EXAMPLES
+Create a consumer, attach it to a given provider, gain read access and clean up.
+.Bd -literal -offset indent
+void
+some_function(struct g_geom *mygeom, struct g_provider *pp)
+{
+ struct g_consumer *cp;
+
+ g_topology_assert();
+
+ /* Create new consumer on 'mygeom' geom. */
+ cp = g_new_consumer(mygeom);
+ /* Attach newly created consumer to given provider. */
+ if (g_attach(cp, pp) != 0) {
+ g_destroy_consumer(cp);
+ return;
+ }
+ /* Open provider for reading through our consumer. */
+ if (g_access(cp, 1, 0, 0) != 0) {
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ return;
+ }
+
+ g_topology_unlock();
+ /*
+ * Read data from provider.
+ */
+ g_topology_lock();
+
+ /* Disconnect from provider (release access count). */
+ g_access(cp, -1, 0, 0);
+ /* Detach from provider. */
+ g_detach(cp);
+ /* Destroy consumer. */
+ g_destroy_consumer(cp);
+}
+.Ed
+.Sh ERRORS
+Possible errors:
+.Bl -tag -width Er
+.It Bq Er ELOOP
+The operation creates a topology loop.
+.El
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_bio.9 b/share/man/man9/g_bio.9
new file mode 100644
index 000000000000..e7351b8054e4
--- /dev/null
+++ b/share/man/man9/g_bio.9
@@ -0,0 +1,277 @@
+.\"
+.\" Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 1, 2006
+.Dt G_BIO 9
+.Os
+.Sh NAME
+.Nm g_new_bio ,
+.Nm g_clone_bio ,
+.Nm g_destroy_bio ,
+.Nm g_print_bio
+.Nd "GEOM bio controlling functions"
+.Sh SYNOPSIS
+.In sys/bio.h
+.In geom/geom.h
+.Ft "struct bio *"
+.Fn g_new_bio void
+.Ft "struct bio *"
+.Fn g_alloc_bio void
+.Ft "struct bio *"
+.Fn g_clone_bio "struct bio *bp"
+.Ft "struct bio *"
+.Fn g_duplicate_bio "struct bio *bp"
+.Ft void
+.Fn g_destroy_bio "struct bio *bp"
+.Ft void
+.Fn g_print_bio "struct bio *bp"
+.Sh DESCRIPTION
+A
+.Vt "struct bio"
+is used by GEOM to describe I/O requests, its
+most important fields are described below:
+.Bl -tag -width ".Va bio_attribute"
+.It Va bio_cmd
+I/O request command.
+There are four I/O requests available in GEOM:
+.Bl -tag -width ".Dv BIO_GETATTR"
+.It Dv BIO_READ
+A read request.
+.It Dv BIO_WRITE
+A write request.
+.It Dv BIO_DELETE
+Indicates that a certain range of data is no longer used and that
+it can be erased or freed as the underlying technology supports.
+Technologies like flash adaptation layers can arrange to erase the relevant
+blocks before they will become reassigned and cryptographic devices may
+want to fill random bits into the range to reduce the amount of data
+available for attack.
+.It Dv BIO_GETATTR
+Inspect and manipulate out-of-band
+attributes on a particular provider or path.
+Attributes are named by ascii strings and are stored in the
+.Va bio_attribute
+field.
+.It Dv BIO_FLUSH
+Tells underlying providers to flush their write caches.
+.El
+.It Va bio_flags
+Available flags:
+.Bl -tag -width ".Dv BIO_ERROR"
+.It Dv BIO_ERROR
+Request failed (error value is stored in
+.Va bio_error
+field).
+.It Dv BIO_DONE
+Request finished.
+.El
+.It Va bio_cflags
+Private use by the consumer.
+.It Va bio_pflags
+Private use by the provider.
+.It Va bio_offset
+Offset into provider.
+.It Va bio_data
+Pointer to data buffer.
+.It Va bio_error
+Error value when
+.Dv BIO_ERROR
+is set.
+.It Va bio_done
+Pointer to function which will be called when the request is finished.
+.It Va bio_driver1
+Private use by the provider.
+.It Va bio_driver2
+Private use by the provider.
+.It Va bio_caller1
+Private use by the consumer.
+.It Va bio_caller2
+Private use by the consumer.
+.It Va bio_attribute
+Attribute string for
+.Dv BIO_GETATTR
+request.
+.It Va bio_from
+Consumer to use for request (attached to provider stored in
+.Va bio_to
+field) (typically read-only for a class).
+.It Va bio_to
+Destination provider (typically read-only for a class).
+.It Va bio_length
+Request length in bytes.
+.It Va bio_completed
+Number of bytes completed, but they may not be completed from
+the front of the request.
+.It Va bio_children
+Number of
+.Vt bio
+clones (typically read-only for a class).
+.It Va bio_inbed
+Number of finished
+.Vt bio
+clones.
+.It Va bio_parent
+Pointer to parent
+.Vt bio .
+.El
+.Pp
+The
+.Fn g_new_bio
+function allocates a new, empty
+.Vt bio
+structure.
+.Pp
+.Fn g_alloc_bio
+- same as
+.Fn g_new_bio ,
+but always succeeds (allocates bio with the
+.Dv M_WAITOK
+malloc flag).
+.Pp
+The
+.Fn g_clone_bio
+function allocates a new
+.Vt bio
+structure and copies the following fields from the
+.Vt bio
+given as an argument to clone:
+.Va bio_cmd ,
+.Va bio_length ,
+.Va bio_offset ,
+.Va bio_data ,
+.Va bio_attribute .
+The field
+.Va bio_parent
+in the clone points to the passed
+.Vt bio
+and the field
+.Va bio_children
+in the passed
+.Vt bio
+is incremented.
+.Pp
+This function should be used for every request which enters through
+the provider of a particular geom and needs to be scheduled down.
+Proper order is:
+.Pp
+.Bl -enum -compact
+.It
+Clone the received
+.Vt "struct bio" .
+.It
+Modify the clone.
+.It
+Schedule the clone on its own consumer.
+.El
+.Pp
+.Fn g_duplicate_bio
+- same as
+.Fn g_clone_bio ,
+but always succeeds (allocates bio with the
+.Dv M_WAITOK
+malloc flag).
+.Pp
+The
+.Fn g_destroy_bio
+function deallocates and destroys the given
+.Vt bio
+structure.
+.Pp
+The
+.Fn g_print_bio
+function prints information about the given
+.Vt bio
+structure (for debugging purposes).
+.Sh RETURN VALUES
+The
+.Fn g_new_bio
+and
+.Fn g_clone_bio
+functions return a pointer to the allocated
+.Vt bio ,
+or
+.Dv NULL
+if an error occurred.
+.Sh EXAMPLES
+Implementation of
+.Dq Dv NULL Ns -transformation ,
+meaning that an I/O request is cloned and scheduled down without any
+modifications.
+Let us assume that field
+.Va ex_consumer
+in structure
+.Vt example_softc
+contains a consumer attached to the provider we want to operate on.
+.Bd -literal -offset indent
+void
+example_start(struct bio *bp)
+{
+ struct example_softc *sc;
+ struct bio *cbp;
+
+ printf("Request received: ");
+ g_print_bio(bp);
+ printf("\\n");
+
+ sc = bp->bio_to->geom->softc;
+ if (sc == NULL) {
+ g_io_deliver(bp, ENXIO);
+ return;
+ }
+
+ /* Let's clone our bio request. */
+ cbp = g_clone_bio(bp);
+ if (cbp == NULL) {
+ g_io_deliver(bp, ENOMEM);
+ return;
+ }
+ cbp->bio_done = g_std_done; /* Standard 'done' function. */
+
+ /* Ok, schedule it down. */
+ /*
+ * The consumer can be obtained from
+ * LIST_FIRST(&bp->bio_to->geom->consumers) as well,
+ * if there is only one in our geom.
+ */
+ g_io_request(cbp, sc->ex_consumer);
+}
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_consumer.9 b/share/man/man9/g_consumer.9
new file mode 100644
index 000000000000..e30fb80280b5
--- /dev/null
+++ b/share/man/man9/g_consumer.9
@@ -0,0 +1,137 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_CONSUMER 9
+.Os
+.Sh NAME
+.Nm g_new_consumer ,
+.Nm g_destroy_consumer
+.Nd "GEOM consumers management"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft "struct g_consumer *"
+.Fn g_new_consumer "struct g_geom *gp"
+.Ft void
+.Fn g_destroy_consumer "struct g_consumer *cp"
+.Sh DESCRIPTION
+A GEOM consumer is the backdoor through which a geom connects to
+another GEOM provider and through which I/O requests are sent.
+.Pp
+The
+.Fn g_new_consumer
+function creates a new consumer on geom
+.Fa gp .
+Before using the new consumer, it has to be attached to a provider with
+.Xr g_attach 9
+and opened with
+.Xr g_access 9 .
+.Pp
+The
+.Fn g_destroy_consumer
+function destroys the given consumer and cancels all related pending events.
+This function is the last stage of killing an unwanted consumer.
+.Sh RESTRICTIONS/CONDITIONS
+.Fn g_new_consumer :
+.Bl -item -offset indent
+.It
+The geom
+.Fa gp
+has to have an
+.Va orphan
+method defined.
+.It
+The topology lock has to be held.
+.El
+.Pp
+.Fn g_destroy_consumer :
+.Bl -item -offset indent
+.It
+The consumer must not be attached to a provider.
+.It
+The access count has to be 0.
+.It
+The topology lock has to be held.
+.El
+.Sh RETURN VALUES
+The
+.Fn g_new_consumer
+function
+returns a pointer to the newly created consumer.
+.Sh EXAMPLES
+Create consumer, attach it to given provider, gain read access and clean up.
+.Bd -literal -offset indent
+void
+some_function(struct g_geom *mygeom, struct g_provider *pp)
+{
+ struct g_consumer *cp;
+
+ g_topology_assert();
+
+ /* Create new consumer on 'mygeom' geom. */
+ cp = g_new_consumer(mygeom);
+ /* Attach newly created consumer to given provider. */
+ if (g_attach(cp, pp) != 0) {
+ g_destroy_consumer(cp);
+ return;
+ }
+ /* Open provider for reading through our consumer. */
+ if (g_access(cp, 1, 0, 0) != 0) {
+ g_detach(cp);
+ g_destroy_consumer(cp);
+ return;
+ }
+
+ g_topology_unlock();
+ /*
+ * Read data from provider.
+ */
+ g_topology_lock();
+
+ /* Disconnect from provider (release access count). */
+ g_access(cp, -1, 0, 0);
+ /* Detach from provider. */
+ g_detach(cp);
+ /* Destroy consumer. */
+ g_destroy_consumer(cp);
+}
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_data.9 b/share/man/man9/g_data.9
new file mode 100644
index 000000000000..f5cd6961a04a
--- /dev/null
+++ b/share/man/man9/g_data.9
@@ -0,0 +1,122 @@
+.\"
+.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_DATA 9
+.Os
+.Sh NAME
+.Nm g_read_data ,
+.Nm g_write_data
+.Nd "read/write data from/to GEOM consumer"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft "void *"
+.Fo g_read_data
+.Fa "struct g_consumer *cp" "off_t offset" "off_t length" "int *error"
+.Fc
+.Ft int
+.Fo g_write_data
+.Fa "struct g_consumer *cp" "off_t offset" "void *ptr" "off_t length"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn g_read_data
+function reads
+.Fa length
+bytes of data from the provider attached to consumer
+.Fa cp ,
+starting at offset
+.Fa offset .
+The buffer returned from
+.Fn g_read_data
+is allocated with
+.Fn g_malloc ,
+so it should be freed by the caller with
+.Fn g_free
+after use.
+If the operation fails, an error value will be stored in the
+.Fa error
+argument if it is not
+.Dv NULL .
+.Pp
+The
+.Fn g_write_data
+function writes
+.Fa length
+bytes of data from the buffer pointed to by
+.Fa ptr
+to the provider attached to consumer
+.Fa cp ,
+starting at offset
+.Fa offset .
+.Sh RESTRICTIONS/CONDITIONS
+The
+.Fa length
+argument
+should be a multiple of the provider's sectorsize
+and less than or equal to
+.Dv DFLTPHYS
+.Dv ( DFLTPHYS
+is defined in
+.In sys/param.h ) .
+.Pp
+The topology lock must not be held.
+.Sh RETURN VALUES
+The
+.Fn g_read_data
+function returns a pointer to a data buffer or
+.Dv NULL
+if an error occurred.
+In that case an error value is stored in the
+.Fa error
+argument unless it is
+.Dv NULL .
+.Pp
+The
+.Fn g_write_data
+function returns 0 if successful; otherwise an error code is returned.
+.Sh ERRORS
+Possible errors:
+.Bl -tag -width Er
+.It Bq Er EIO
+An I/O error occurred while reading from or writing to the consumer.
+.El
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_event.9 b/share/man/man9/g_event.9
new file mode 100644
index 000000000000..380caa82a0b8
--- /dev/null
+++ b/share/man/man9/g_event.9
@@ -0,0 +1,189 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_EVENT 9
+.Os
+.Sh NAME
+.Nm g_post_event ,
+.Nm g_waitfor_event ,
+.Nm g_cancel_event
+.Nd "GEOM events management"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft int
+.Fn g_post_event "g_event_t *func" "void *arg" "int flag" ...
+.Ft int
+.Fn g_waitfor_event "g_event_t *func" "void *arg" "int flag" ...
+.Ft void
+.Fn g_cancel_event "void *ref"
+.Sh DESCRIPTION
+The GEOM framework has its own event queue to inform classes about important
+events.
+The event queue can be also used by GEOM classes themselves, for example
+to work around some restrictions in the I/O path, where sleeping, heavy weight
+tasks, etc.\& are not permitted.
+.Pp
+The
+.Fn g_post_event
+function tells the GEOM framework to call function
+.Fa func
+with argument
+.Fa arg
+from the event queue.
+The
+.Fa flag
+argument is passed to
+.Xr malloc 9
+for memory allocations inside of
+.Fn g_post_event .
+The only allowed flags are
+.Dv M_WAITOK
+and
+.Dv M_NOWAIT .
+The rest of the arguments are used as references to identify the event.
+An event can be canceled by using any of the given references as an
+argument to
+.Fn g_cancel_event .
+The list of references has to end with a
+.Dv NULL
+value.
+.Pp
+The
+.Fn g_waitfor_event
+function is a blocking version of the
+.Fn g_post_event
+function.
+It waits until the event is finished or canceled and then returns.
+.Pp
+The
+.Fn g_cancel_event
+function cancels all event(s) identified by
+.Fa ref .
+Cancellation is equivalent to calling the requested function
+with requested arguments and argument
+.Fa flag
+set to
+.Dv EV_CANCEL .
+.Sh RESTRICTIONS/CONDITIONS
+.Fn g_post_event :
+.Bl -item -offset indent
+.It
+The argument
+.Fa flag
+has to be
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT .
+.It
+The list of references has to end with a
+.Dv NULL
+value.
+.El
+.Pp
+.Fn g_waitfor_event :
+.Bl -item -offset indent
+.It
+The argument
+.Fa flag
+has to be
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT .
+.It
+The list of references has to end with a
+.Dv NULL
+value.
+.It
+The
+.Fn g_waitfor_event
+function cannot be called from an event, since doing so would result
+in a deadlock.
+.El
+.Sh RETURN VALUES
+The
+.Fn g_post_event
+and
+.Fn g_waitfor_event
+functions
+return 0 if successful; otherwise an error code is returned.
+.Sh EXAMPLES
+Example of a function called from the event queue.
+.Bd -literal -offset indent
+void
+example_event(void *arg, int flag)
+{
+
+ if (flag == EV_CANCEL) {
+ printf("Event with argument %p canceled.\\n", arg);
+ return;
+ }
+
+ printf("Event with argument %p called.\\n", arg);
+}
+.Ed
+.Sh ERRORS
+Possible errors for the
+.Fn g_post_event
+function:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+The
+.Fa flag
+argument was set to
+.Dv M_NOWAIT
+and there was insufficient memory.
+.El
+.Pp
+Possible errors for the
+.Fn g_waitfor_event
+function:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The event was canceled.
+.It Bq Er ENOMEM
+The
+.Fa flag
+argument was set to
+.Dv M_NOWAIT
+and there was insufficient memory.
+.El
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_geom.9 b/share/man/man9/g_geom.9
new file mode 100644
index 000000000000..2f4599d60ba6
--- /dev/null
+++ b/share/man/man9/g_geom.9
@@ -0,0 +1,206 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_GEOM 9
+.Os
+.Sh NAME
+.Nm g_new_geomf ,
+.Nm g_destroy_geom
+.Nd "geom management"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft "struct g_geom *"
+.Fn g_new_geomf "struct g_class *mp" "const char *fmt" ...
+.Ft void
+.Fn g_destroy_geom "struct g_geom *gp"
+.Sh DESCRIPTION
+The geom (do not confuse
+.Dq geom
+with
+.Dq GEOM )
+is an instance of a GEOM class.
+For example: in a typical i386
+.Fx
+system, there will be one geom
+of class MBR for each disk.
+The geom's name is not really important, it is only used in the XML
+dump and for debugging purposes.
+There can be many geoms with the same name.
+.Pp
+The
+.Fn g_new_geomf
+function creates a new geom, which will be an instance of the class
+.Fa mp .
+The geom's name is created in a
+.Xr printf 3 Ns
+-like way from the rest of the arguments.
+.Pp
+The
+.Fn g_destroy_geom
+function destroys the given geom immediately and cancels all related pending
+events.
+.Pp
+The
+.Vt g_geom
+structure
+contains fields that should be set by the caller after geom creation, but before
+creating any providers or consumers related to this geom (not all are required):
+.Bl -tag -offset indent -width indent
+.It Vt "g_start_t *" Va start
+Pointer to a function used for I/O processing.
+.It Vt "g_spoiled_t *" Va spoiled
+Pointer to a function used for consumers spoiling.
+.It Vt "g_dumpconf_t *" Va dumpconf
+Pointer to a function used for configuration in XML format dumping.
+.It Vt "g_access_t *" Va access
+Pointer to a function used for access control.
+.It Vt "g_orphan_t *" Va orphan
+Pointer to a function used to inform about orphaned consumer.
+.It Vt "g_ioctl_t *" Va ioctl
+Pointer to a function used for handling ioctl requests.
+.It Vt "void *" Va softc
+Field for private use.
+.El
+.Sh RESTRICTIONS/CONDITIONS
+If you intend to use providers in this geom you must set field
+.Va start
+of your geom.
+.Pp
+If you are planning to use consumers in your geom you must set fields
+.Va orphan
+and
+.Va access
+for it.
+.Pp
+.Fn g_new_geomf :
+.Bl -item -offset indent
+.It
+Class
+.Fa mp
+must be valid (registered in GEOM).
+.It
+The topology lock has to be held.
+.El
+.Pp
+.Fn g_destroy_geom :
+.Bl -item -offset indent
+.It
+The geom cannot possess any providers.
+.It
+The geom cannot possess any consumers.
+.It
+The topology lock has to be held.
+.El
+.Sh RETURN VALUES
+The
+.Fn g_new_geomf
+function
+returns a pointer to the newly created geom.
+.Sh EXAMPLES
+Create an example geom.
+.Bd -literal -offset indent
+static struct geom *
+g_example_start(struct bio *bp)
+{
+
+ [...]
+}
+
+static void
+g_example_orphan(struct g_consumer *cp)
+{
+
+ g_topology_assert();
+
+ [...]
+}
+
+static void
+g_example_spoiled(struct g_consumer *cp)
+{
+
+ g_topology_assert();
+
+ [...]
+}
+
+static void
+g_example_access(struct g_provider *pp, int dr, int dw, int de)
+{
+
+ [...]
+}
+
+static struct g_geom *
+create_example_geom(struct g_class *myclass)
+{
+ struct g_geom *gp;
+
+ g_topology_lock();
+ gp = g_new_geomf(myclass, "example_geom");
+ g_topology_unlock();
+ gp->start = g_example_start;
+ gp->orphan = g_example_orphan;
+ gp->spoiled = g_example_spoiled;
+ gp->access = g_example_access;
+ gp->softc = NULL;
+
+ return (gp);
+}
+
+static int
+destroy_example_geom(struct g_geom *gp)
+{
+
+ g_topology_lock();
+ if (!LIST_EMPTY(&gp->provider) ||
+ !LIST_EMPTY(&gp->consumer)) {
+ g_topology_unlock();
+ return (EBUSY);
+ }
+ g_destroy_geom(gp);
+ g_topology_unlock();
+
+ return (0);
+}
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_provider.9 b/share/man/man9/g_provider.9
new file mode 100644
index 000000000000..05e4addabf36
--- /dev/null
+++ b/share/man/man9/g_provider.9
@@ -0,0 +1,145 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_PROVIDER 9
+.Os
+.Sh NAME
+.Nm g_new_providerf ,
+.Nm g_destroy_provider ,
+.Nm g_error_provider
+.Nd "GEOM providers management"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft "struct g_provider *"
+.Fn g_new_providerf "struct g_geom *gp" "const char *fmt" ...
+.Ft void
+.Fn g_destroy_provider "struct g_provider *pp"
+.Ft void
+.Fn g_error_provider "struct g_provider *pp" "int error"
+.Sh DESCRIPTION
+A GEOM provider is the front gate at which a geom offers service.
+A provider is
+.Dq a disk-like thing which appears in Pa /dev
+\[en] a logical disk in other words.
+All providers have three main properties: name, sectorsize and size.
+.Pp
+The
+.Fn g_new_providerf
+function creates a new provider on given geom
+.Fa gp .
+The name of the provider, which will appear as device in
+.Xr devfs 5 ,
+is created
+in a
+.Xr printf 3 Ns
+-like way from the rest of
+the arguments.
+After creation, the caller has to set the provider's
+.Va mediasize
+and
+.Va sectorsize ,
+as well as other desired initializations, and then call
+.Fn g_error_provider
+to reset the provider's error, which is initially set to
+.Er ENXIO .
+.Pp
+The
+.Fn g_destroy_provider
+function destroys the given provider, cancels all related pending events and
+removes the corresponding devfs entry.
+.Pp
+The
+.Fn g_error_provider
+function is used to set the provider's error value.
+If set to a nonzero, all I/O requests will be denied,
+as well as increasing its access count will not be possible (error
+.Fa error
+will be returned).
+.Sh RESTRICTIONS/CONDITIONS
+.Fn g_new_provider :
+.Bl -item -offset indent
+.It
+The provider name should be unique, but this is not enforced by GEOM.
+If the name is not unique, one will end up with two (or more) files
+with the same name, which is a programmer error.
+.It
+The geom
+.Fa gp
+has to have a
+.Fa start
+method defined.
+.It
+The topology lock has to be held.
+.El
+.Pp
+.Fn g_destroy_provider :
+.Bl -item -offset indent
+.It
+The provider must not have consumers attached.
+.It
+The access count has to be 0.
+.It
+The topology lock has to be held.
+.El
+.Sh RETURN VALUES
+The
+.Fn g_new_providerf
+function returns a pointer to the newly created provider.
+.Sh EXAMPLES
+Create an example provider, set its parameters and make it usable.
+.Bd -literal -offset indent
+struct g_provider *
+create_example_provider(struct g_geom *gp)
+{
+ struct g_provider *pp;
+
+ g_topology_lock();
+ pp = g_new_providerf(gp, "example_provider");
+ g_topology_unlock();
+ pp->mediasize = 65536;
+ pp->sectorsize = 512;
+ g_error_provider(pp, 0);
+
+ return (pp);
+}
+.Ed
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider_by_name 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_provider_by_name.9 b/share/man/man9/g_provider_by_name.9
new file mode 100644
index 000000000000..58da421a243d
--- /dev/null
+++ b/share/man/man9/g_provider_by_name.9
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_PROVIDER_BY_NAME 9
+.Os
+.Sh NAME
+.Nm g_provider_by_name
+.Nd "find GEOM provider with given name"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft "struct g_provider *"
+.Fn g_provider_by_name "const char *name"
+.Sh DESCRIPTION
+The
+.Fn g_provider_by_name
+function searches for a provider called
+.Fa name
+and returns the structure
+.Vt g_provider
+bound to it.
+Argument
+.Fa name
+should be a name, not a full path (i.e.,
+.Dq Pa da0 ,
+instead of
+.Dq Pa /dev/da0 ) .
+.Sh RESTRICTIONS/CONDITIONS
+The topology lock has to be held.
+.Sh RETURN VALUES
+The
+.Fn g_provider_by_name
+function
+returns a pointer to the provider called
+.Fa name
+or
+.Dv NULL
+if there is no such provider.
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_wither_geom 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/g_wither_geom.9 b/share/man/man9/g_wither_geom.9
new file mode 100644
index 000000000000..8ced94948dda
--- /dev/null
+++ b/share/man/man9/g_wither_geom.9
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2004
+.Dt G_WITHER_GEOM 9
+.Os
+.Sh NAME
+.Nm g_wither_geom
+.Nd "destroy geom and related providers and consumers when you get a chance"
+.Sh SYNOPSIS
+.In geom/geom.h
+.Ft void
+.Fn g_wither_geom "struct g_geom *gp" "int error"
+.Sh DESCRIPTION
+The
+.Fn g_wither_geom
+function tells GEOM that geom
+.Fa gp
+is to be destroyed.
+GEOM sets an error on each provider of the given geom (in the
+orphaning process) and waits for a chance to destroy the geom.
+If the access count of any possessed consumer goes to 0, the consumer will be
+detached and destroyed automatically.
+If the last consumer attached to any possessed provider will be detached,
+the provider will be destroyed.
+If there are no more providers nor consumers, the geom will be
+destroyed.
+.Pp
+This is an automatic
+.Dq garbage collect
+to avoid duplicated code in all classes.
+Before it is called, field
+.Va softc
+should be disposed of and set to
+.Dv NULL .
+Note that the
+.Fn g_wither_geom
+function gives no guarantee that the geom will be immediately destroyed, mostly
+because the access counts of the geom's consumers and providers may not be 0.
+That is why calling this function for every geom from a given class is not enough
+to be sure that the class can be unloaded.
+.Sh RESTRICTIONS/CONDITIONS
+The argument
+.Fa error
+must be nonzero.
+.Pp
+The topology lock has to be held.
+.Sh SEE ALSO
+.Xr geom 4 ,
+.Xr DECLARE_GEOM_CLASS 9 ,
+.Xr g_access 9 ,
+.Xr g_attach 9 ,
+.Xr g_bio 9 ,
+.Xr g_consumer 9 ,
+.Xr g_data 9 ,
+.Xr g_event 9 ,
+.Xr g_geom 9 ,
+.Xr g_provider 9 ,
+.Xr g_provider_by_name 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
diff --git a/share/man/man9/get_cyclecount.9 b/share/man/man9/get_cyclecount.9
new file mode 100644
index 000000000000..eabaeb1fa806
--- /dev/null
+++ b/share/man/man9/get_cyclecount.9
@@ -0,0 +1,95 @@
+.\" Copyright (c) 2000 Mark R V Murray
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 15, 2011
+.Dt GET_CYCLECOUNT 9
+.Os
+.Sh NAME
+.Nm get_cyclecount
+.Nd get the CPU's fast counter register contents
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In machine/cpu.h
+.Ft uint64_t
+.Fn get_cyclecount "void"
+.Sh DESCRIPTION
+The
+.Fn get_cyclecount
+function uses a register
+available in most modern CPUs
+to return a value
+that is monotonically increasing
+inside each CPU.
+.Pp
+On SMP systems,
+there will be a number of
+separate monotonic sequences,
+one for each CPU running.
+The value in the SMP case is
+selected from one of these sequences,
+dependent on which CPU
+was scheduled to service the request.
+.Pp
+The speed and the maximum value
+of each counter
+is CPU-dependent.
+Some CPUs
+(such as the
+.Tn Intel
+80486)
+do not have such a register,
+so
+.Fn get_cyclecount
+on these platforms
+returns a (monotonic) combination of numbers
+represented by the
+structure returned by
+.Xr binuptime 9 .
+.Pp
+The
+.Tn AMD64
+and
+.Tn Intel 64
+processors use the
+.Li TSC
+register.
+.Pp
+The
+.Tn IA64
+processors use the
+.Li AR.ITC
+register.
+.Sh SEE ALSO
+.Xr binuptime 9
+.Sh HISTORY
+The
+.Fn get_cyclecount
+function first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Mark Murray Aq markm@FreeBSD.org .
diff --git a/share/man/man9/getnewvnode.9 b/share/man/man9/getnewvnode.9
new file mode 100644
index 000000000000..2e81212630fd
--- /dev/null
+++ b/share/man/man9/getnewvnode.9
@@ -0,0 +1,69 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt GETNEWVNODE 9
+.Os
+.Sh NAME
+.Nm getnewvnode
+.Nd "get a new vnode"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/mount.h
+.Ft int
+.Fn getnewvnode "const char *tag" "struct mount *mp" "vop_t **vops" "struct vnode **vpp"
+.Sh DESCRIPTION
+The
+.Fn getnewvnode
+function initializes a new vnode, assigning it the vnode operations passed in
+.Fa vops .
+The vnode is either freshly allocated, or taken from the head of the
+free list depending on the number of vnodes already in the system.
+.Pp
+The arguments to
+.Fn getnewvnode
+are:
+.Bl -tag -width ".Fa vops"
+.It Fa tag
+The file system type string.
+This field should only be referenced for debugging or for userland utilities.
+.It Fa mp
+The mount point to add the new vnode to.
+.It Fa vops
+The vnode operations to assign to the new vnode.
+.It Fa vpp
+Points to the new vnode upon successful completion.
+.El
+.Sh RETURN VALUES
+.Fn getnewvnode
+returns 0 on success.
+There are currently no failure conditions - that do not result in a panic.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/groupmember.9 b/share/man/man9/groupmember.9
new file mode 100644
index 000000000000..0d3629a1ad45
--- /dev/null
+++ b/share/man/man9/groupmember.9
@@ -0,0 +1,60 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt GROUPMEMBER 9
+.Os
+.Sh NAME
+.Nm groupmember
+.Nd checks group set for a group ID
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/ucred.h
+.Ft int
+.Fn groupmember "gid_t gid" "struct ucred *cred"
+.Sh DESCRIPTION
+The
+.Fn groupmember
+function checks to see if the given
+.Fa gid
+is in the group set of the credentials.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa cred"
+.It Fa gid
+The group ID to check for.
+.It Fa cred
+The credentials to search for the group in.
+.El
+.Sh RETURN VALUES
+If the
+.Fa gid
+is found, 1 is returned; otherwise, 0 is returned.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/hash.9 b/share/man/man9/hash.9
new file mode 100644
index 000000000000..d977ac30bef3
--- /dev/null
+++ b/share/man/man9/hash.9
@@ -0,0 +1,161 @@
+.\" Copyright (c) 2001 Tobias Weingartner
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $OpenBSD: hash.9,v 1.5 2003/04/17 05:08:39 jmc Exp $
+.\" $FreeBSD$
+.\"
+.Dd April 3, 2007
+.Dt HASH 9
+.Os
+.Sh NAME
+.Nm hash ,
+.Nm hash32 ,
+.Nm hash32_buf ,
+.Nm hash32_str ,
+.Nm hash32_strn ,
+.Nm hash32_stre ,
+.Nm hash32_strne
+.Nd general kernel hashing functions
+.Sh SYNOPSIS
+.In sys/hash.h
+.Ft uint32_t
+.Fn hash32_buf "const void *buf" "size_t len" "uint32_t hash"
+.Ft uint32_t
+.Fn hash32_str "const void *buf" "uint32_t hash"
+.Ft uint32_t
+.Fn hash32_strn "const void *buf" "size_t len" "uint32_t hash"
+.Ft uint32_t
+.Fn hash32_stre "const void *buf" "int end" "const char **ep" "uint32_t hash"
+.Ft uint32_t
+.Fn hash32_strne "const void *buf" "size_t len" "int end" "const char **ep" "uint32_t hash"
+.Sh DESCRIPTION
+The
+.Fn hash32
+functions are used to give a consistent and general interface to
+a decent hashing algorithm within the kernel.
+These functions can be used to hash
+.Tn ASCII
+.Dv NUL
+terminated strings, as well as blocks of memory.
+.Pp
+The
+.Fn hash32_buf
+function is used as a general buffer hashing function.
+The argument
+.Fa buf
+is used to pass in the location, and
+.Fa len
+is the length of the buffer.
+The argument
+.Fa hash
+is used to extend an existing hash, or is passed the initial value
+.Dv HASHINIT
+to start a new hash.
+.Pp
+The
+.Fn hash32_str
+function is used to hash a
+.Dv NUL
+terminated string passed in
+.Fa buf
+with initial hash value given in
+.Fa hash .
+.Pp
+The
+.Fn hash32_strn
+function is like the
+.Fn hash32_str
+function, except it also takes a
+.Fa len
+argument, which is the maximal length of the expected string.
+.Pp
+The
+.Fn hash32_stre
+and
+.Fn hash32_strne
+functions are helper functions used by the kernel to hash pathname
+components.
+These functions have the additional termination condition
+of terminating when they find a character given by
+.Fa end
+in the string to be hashed.
+If the argument
+.Fa ep
+is not
+.Dv NULL ,
+it is set to the point in the buffer at which the hash function
+terminated hashing.
+.Sh RETURN VALUES
+The
+.Fn hash32
+functions return a 32 bit hash value of the buffer or string.
+.Sh EXAMPLES
+.Bd -literal -offset indent
+LIST_HEAD(head, cache) *hashtbl = NULL;
+u_long mask = 0;
+
+void
+sample_init(void)
+{
+
+ hashtbl = hashinit(numwanted, type, flags, &mask);
+}
+
+void
+sample_use(char *str, int len)
+{
+ uint32_t hash;
+
+ hash = hash32_str(str, HASHINIT);
+ hash = hash32_buf(&len, sizeof(len), hash);
+ hashtbl[hash & mask] = len;
+}
+.Ed
+.Sh SEE ALSO
+.Xr free 9 ,
+.Xr hashinit 9 ,
+.Xr malloc 9
+.Sh LIMITATIONS
+The
+.Fn hash32
+functions are only 32 bit functions.
+They will prove to give poor 64 bit performance, especially for the
+top 32 bits.
+At the current time, this is not seen as a great limitation, as these
+hash values are usually used to index into an array.
+Should these hash values be used for other means, this limitation should
+be revisited.
+.Sh HISTORY
+The
+.Nm
+functions were first committed to
+.Nx 1.6 .
+The
+.Ox
+versions were written and massaged for
+.Ox 2.3
+by Tobias Weingartner,
+and finally committed for
+.Ox 3.2 .
diff --git a/share/man/man9/hashinit.9 b/share/man/man9/hashinit.9
new file mode 100644
index 000000000000..d186dcfe18e2
--- /dev/null
+++ b/share/man/man9/hashinit.9
@@ -0,0 +1,176 @@
+.\"
+.\" Copyright (c) 2004 Joseph Koshy
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 10, 2004
+.Dt HASHINIT 9
+.Os
+.Sh NAME
+.Nm hashinit , hashinit_flags, hashdestroy , phashinit
+.Nd manage kernel hash tables
+.Sh SYNOPSIS
+.In sys/malloc.h
+.In sys/systm.h
+.In sys/queue.h
+.Ft "void *"
+.Fn hashinit "int nelements" "struct malloc_type *type" "u_long *hashmask"
+.Ft void
+.Fo hashinit_flags
+.Fa "int nelements" "struct malloc_type *type" "u_long *hashmask" "int flags"
+.Fc
+.Ft void
+.Fn hashdestroy "void *hashtbl" "struct malloc_type *type" "u_long hashmask"
+.Ft "void *"
+.Fn phashinit "int nelements" "struct malloc_type *type" "u_long *nentries"
+.Sh DESCRIPTION
+The
+.Fn hashinit ,
+.Fn hashinit_flags
+and
+.Fn phashinit
+functions allocate space for hash tables of size given by the argument
+.Fa nelements .
+.Pp
+The
+.Fn hashinit
+function allocates hash tables that are sized to largest power of two
+less than or equal to argument
+.Fa nelements .
+The
+.Fn phashinit
+function allocates hash tables that are sized to the largest prime
+number less than or equal to argument
+.Fa nelements .
+The
+.Fn hashinit_flags
+function operates like
+.Fn hashinit
+but also accepts an additional argument
+.Fa flags
+which control various options during allocation.
+Allocated hash tables are contiguous arrays of
+.Xr LIST_HEAD 3
+entries, allocated using
+.Xr malloc 9 ,
+and initialized using
+.Xr LIST_INIT 3 .
+The malloc arena to be used for allocation is pointed to by argument
+.Fa type .
+.Pp
+The
+.Fn hashdestroy
+function frees the space occupied by the hash table pointed to by argument
+.Fa hashtbl .
+Argument
+.Fa type
+determines the malloc arena to use when freeing space.
+The argument
+.Fa hashmask
+should be the bit mask returned by the call to
+.Fn hashinit
+that allocated the hash table.
+The argument
+.Fa flags
+must be used with one of the following values.
+.Pp
+.Bl -tag -width ".Dv HASH_NOWAIT" -offset indent -compact
+.It Dv HASH_NOWAIT
+Any malloc performed by the
+.Fn hashinit_flags
+function will not be allowed to wait, and therefore may fail.
+.It Dv HASH_WAITOK
+Any malloc performed by the
+.Fn hashinit_flags
+function is allowed to wait for memory.
+.El
+.Sh IMPLEMENTATION NOTES
+The largest prime hash value chosen by
+.Fn phashinit
+is 32749.
+.Sh RETURN VALUES
+The
+.Fn hashinit
+function returns a pointer to an allocated hash table and sets the
+location pointed to by
+.Fa hashmask
+to the bit mask to be used for computing the correct slot in the
+hash table.
+.Pp
+The
+.Fn phashinit
+function returns a pointer to an allocated hash table and sets the
+location pointed to by
+.Fa nentries
+to the number of rows in the hash table.
+.Sh EXAMPLES
+A typical example is shown below:
+.Bd -literal -offset indent
+\&...
+static LIST_HEAD(foo, foo) *footable;
+static u_long foomask;
+\&...
+footable = hashinit(32, M_FOO, &foomask);
+.Ed
+.Pp
+Here we allocate a hash table with 32 entries from the malloc arena
+pointed to by
+.Dv M_FOO .
+The mask for the allocated hash table is returned in
+.Va foomask .
+A subsequent call to
+.Fn hashdestroy
+uses the value in
+.Va foomask :
+.Bd -literal -offset indent
+\&...
+hashdestroy(footable, M_FOO, foomask);
+.Ed
+.Sh DIAGNOSTICS
+The
+.Fn hashinit
+and
+.Fn phashinit
+functions will panic if argument
+.Fa nelements
+is less than or equal to zero.
+.Pp
+The
+.Fn hashdestroy
+function will panic if the hash table
+pointed to by
+.Fa hashtbl
+is not empty.
+.Sh SEE ALSO
+.Xr LIST_HEAD 3 ,
+.Xr malloc 9
+.Sh BUGS
+There is no
+.Fn phashdestroy
+function, and using
+.Fn hashdestroy
+to free a hash table allocated by
+.Fn phashinit
+usually has grave consequences.
diff --git a/share/man/man9/hexdump.9 b/share/man/man9/hexdump.9
new file mode 100644
index 000000000000..a731ab51ab93
--- /dev/null
+++ b/share/man/man9/hexdump.9
@@ -0,0 +1,94 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2003 Scott Long
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 7, 2003
+.Dt HEXDUMP 9
+.Os
+.Sh NAME
+.Nm hexdump
+.Nd "dump a block of bytes to the console in hexadecimal form"
+.Sh SYNOPSIS
+.In sys/systm.h
+.Ft void
+.Fn hexdump "void *ptr" "int length" "const char *hdr" "int flags"
+.Sh DESCRIPTION
+The
+.Fn hexdump
+function prints an array of bytes to the console in hexadecimal form, along with
+the
+.Tn ASCII
+representation of the bytes, if possible.
+By default, each line of
+output will start with an offset count, followed by 16 hexadecimal values,
+followed by 16
+.Tn ASCII
+characters.
+.Bl -tag -width indent
+.It Fa ptr
+Pointer to the array of bytes to print.
+It does not need to be
+.Dv NUL Ns
+-terminated.
+.It Fa length
+Number of bytes to print.
+.It Fa hdr
+Pointer to a
+.Dv NUL Ns
+-terminated character string that will be prepended to each
+line of output.
+A value of
+.Dv NULL
+implies that no header will be printed.
+.It Fa flags
+Flags for controlling the formatting of the output.
+.Bl -tag -width ".Dv HD_OMIT_COUNT"
+.It Bits 0-7
+Integer value of the number of bytes to display on each line.
+A value of 0 implies that the default value of 16 will be used.
+.It Bits 8-15
+Character
+.Tn ASCII
+value to use as the separator for the hexadecimal output.
+A value of 0 implies that the default value of 32
+.Tn ( ASCII
+space) will be used.
+.It Dv HD_OMIT_COUNT
+Do not print the offset column at the beginning of each line.
+.It Dv HD_OMIT_HEX
+Do not print the hexadecimal values on each line.
+.It Dv HD_OMIT_CHARS
+Do not print the character values on each line.
+.El
+.El
+.Sh SEE ALSO
+.Xr ascii 7
+.Sh AUTHORS
+This manual page was written by
+.An Scott Long .
diff --git a/share/man/man9/hhook.9 b/share/man/man9/hhook.9
new file mode 100644
index 000000000000..df74543f5cce
--- /dev/null
+++ b/share/man/man9/hhook.9
@@ -0,0 +1,388 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 15, 2011
+.Dt HHOOK 9
+.Os
+.Sh NAME
+.Nm hhook ,
+.Nm hhook_head_register ,
+.Nm hhook_head_deregister ,
+.Nm hhook_head_deregister_lookup ,
+.Nm hhook_run_hooks ,
+.Nm HHOOKS_RUN_IF ,
+.Nm HHOOKS_RUN_LOOKUP_IF
+.Nd Helper Hook Framework
+.Sh SYNOPSIS
+.In sys/hhook.h
+.Ft typedef int
+.Fn "\*(lp*hhook_func_t\*(rp" "int32_t hhook_type" "int32_t hhook_id" \
+"void *udata" "void *ctx_data" "void *hdata" "struct osd *hosd"
+.Fn "int hhook_head_register" "int32_t hhook_type" "int32_t hhook_id" \
+"struct hhook_head **hhh" "uint32_t flags"
+.Fn "int hhook_head_deregister" "struct hhook_head *hhh"
+.Fn "int hhook_head_deregister_lookup" "int32_t hhook_type" "int32_t hhook_id"
+.Fn "void hhook_run_hooks" "struct hhook_head *hhh" "void *ctx_data" \
+"struct osd *hosd"
+.Fn HHOOKS_RUN_IF "hhh" "ctx_data" "hosd"
+.Fn HHOOKS_RUN_LOOKUP_IF "hhook_type" "hhook_id" "ctx_data" "hosd"
+.Sh DESCRIPTION
+.Nm
+provides a framework for managing and running arbitrary hook functions at
+defined hook points within the kernel.
+The KPI was inspired by
+.Xr pfil 9 ,
+and in many respects can be thought of as a more generic superset of pfil.
+.Pp
+The
+.Xr khelp 9
+and
+.Nm
+frameworks are tightly integrated.
+Khelp is responsible for registering and deregistering Khelp module hook
+functions with
+.Nm
+points.
+The KPI functions used by
+.Xr khelp 9
+to do this are not documented here as they are not relevant to consumers wishing
+to instantiate hook points.
+.Ss Information for Khelp Module Implementors
+Khelp modules indirectly interact with
+.Nm
+by defining appropriate hook functions for insertion into hook points.
+Hook functions must conform to the
+.Ft hhook_func_t
+function pointer declaration
+outlined in the
+.Sx SYNOPSIS .
+.Pp
+The
+.Fa hhook_type
+and
+.Fa hhook_id
+arguments identify the hook point which has called into the hook function.
+These are useful when a single hook function is registered for multiple hook
+points and wants to know which hook point has called into it.
+.In sys/hhook.h
+lists available
+.Fa hhook_type
+defines and subsystems which export hook points are responsible for defining
+the
+.Fa hhook_id
+value in appropriate header files.
+.Pp
+The
+.Fa udata
+argument will be passed to the hook function if it was specified in the
+.Vt struct hookinfo
+at hook registration time.
+.Pp
+The
+.Fa ctx_data
+argument contains context specific data from the hook point call site.
+The data type passed is subsystem dependent.
+.Pp
+The
+.Fa hdata
+argument is a pointer to the persistent per-object storage allocated for use by
+the module if required.
+The pointer will only ever be NULL if the module did not request per-object
+storage.
+.Pp
+The
+.Fa hosd
+argument can be used with the
+.Xr khelp 9
+framework's
+.Fn khelp_get_osd
+function to access data belonging to a different Khelp module.
+.Pp
+Khelp modules instruct the Khelp framework to register their hook functions with
+.Nm
+points by creating a
+.Vt "struct hookinfo"
+per hook point, which contains the following members:
+.Bd -literal -offset indent
+struct hookinfo {
+ hhook_func_t hook_func;
+ struct helper *hook_helper;
+ void *hook_udata;
+ int32_t hook_id;
+ int32_t hook_type;
+};
+.Ed
+.Pp
+Khelp modules are responsible for setting all members of the struct except
+.Va hook_helper
+which is handled by the Khelp framework.
+.Ss Creating and Managing Hook Points
+Kernel subsystems that wish to provide
+.Nm
+points typically need to make four and possibly five key changes to their
+implementation:
+.Bl -bullet
+.It
+Define a list of
+.Va hhook_id
+mappings in an appropriate subsystem header.
+.It
+Register each hook point with the
+.Fn hhook_head_register
+function during initialisation of the subsystem.
+.It
+Select or create a standardised data type to pass to hook functions as
+contextual data.
+.It
+Add a call to
+.Fn HHOOKS_RUN_IF
+or
+.Fn HHOOKS_RUN_IF_LOOKUP
+at the point in the subsystem's code where the hook point should be executed.
+.It
+If the subsystem can be dynamically added/removed at runtime, each hook
+point registered with the
+.Fn hhook_head_register
+function when the subsystem was initialised needs to be deregistered with the
+.Fn hhook_head_deregister
+or
+.Fn hhook_head_deregister_lookup
+functions when the subsystem is being deinitialised prior to removal.
+.El
+.Pp
+The
+.Fn hhook_head_register
+function registers a hook point with the
+.Nm
+framework.
+The
+.Fa hook_type
+argument defines the high level type for the hook point.
+Valid types are defined in
+.In sys/hhook.h
+and new types should be added as required.
+The
+.Fa hook_id
+argument specifies a unique, subsystem specific identifier for the hook point.
+The
+.Fa hhh
+argument will, if not NULL, be used to store a reference to the
+.Vt struct hhook_head
+created as part of the registration process.
+Subsystems will generally want to store a local copy of the
+.Vt struct hhook_head
+so that they can use the
+.Fn HHOOKS_RUN_IF
+macro to instantiate hook points.
+The HHOOK_WAITOK flag may be passed in via the
+.Fa flags
+argument if
+.Xr malloc 9
+is allowed to sleep waiting for memory to become available.
+If the hook point is within a virtualised subsystem (e.g. the network stack),
+the HHOOK_HEADISINVNET flag should be passed in via the
+.Fa flags
+argument so that the
+.Vt struct hhook_head
+created during the registration process will be added to a virtualised list.
+.Pp
+The
+.Fn hhook_head_deregister
+function deregisters a previously registered hook point from the
+.Nm
+framework.
+The
+.Fa hhh
+argument is the pointer to the
+.Vt struct hhook_head
+returned by
+.Fn hhoook_head_register
+when the hook point was registered.
+.Pp
+The
+.Fn hhook_head_deregister_lookup
+function can be used instead of
+.Fn hhook_head_deregister
+in situations where the caller does not have a cached copy of the
+.Vt struct hhook_head
+and wants to deregister a hook point using the appropriate
+.Fa hook_type
+and
+.Fa hook_id
+identifiers instead.
+.Pp
+The
+.Fn hhook_run_hooks
+function should normally not be called directly and should instead be called
+indirectly via the
+.Fn HHOOKS_RUN_IF
+macro.
+However, there may be circumstances where it is preferable to call the function
+directly, and so it is documented here for completeness.
+The
+.Fa hhh
+argument references the
+.Nm
+point to call all registered hook functions for.
+The
+.Fa ctx_data
+argument specifies a pointer to the contextual hook point data to pass into the
+hook functions.
+The
+.Fa hosd
+argument should be the pointer to the appropriate object's
+.Vt struct osd
+if the subsystem provides the ability for Khelp modules to associate per-object
+data.
+Subsystems which do not should pass NULL.
+.Pp
+The
+.Fn HHOOKS_RUN_IF
+macro is the preferred way to implement hook points.
+It only calls the
+.Fn hhook_run_hooks
+function if at least one hook function is registered for the hook point.
+By checking for registered hook functions, the macro minimises the cost
+associated with adding hook points to frequently used code paths by reducing to
+a simple if test in the common case where no hook functions are registered.
+The arguments are as described for the
+.Fn hhook_run_hooks
+function.
+.Pp
+The
+.Fn HHOOKS_RUN_IF_LOOKUP
+macro performs the same function as the
+.Fn HHOOKS_RUN_IF
+macro, but performs an additional step to look up the
+.Vt struct hhook_head
+for the specified
+.Fa hook_type
+and
+.Fa hook_id
+identifiers.
+It should not be used except in code paths which are infrequently executed
+because of the reference counting overhead associated with the look up.
+.Sh IMPLEMENTATION NOTES
+Each
+.Vt struct hhook_head
+protects its internal list of hook functions with a
+.Xr rmlock 9 .
+Therefore, anytime
+.Fn hhook_run_hooks
+is called directly or indirectly via the
+.Fn HHOOKS_RUN_IF
+or
+.Fn HHOOKS_RUN_IF_LOOKUP
+macros, a non-sleepable read lock will be acquired and held across the calls to
+all registered hook functions.
+.Sh RETURN VALUES
+.Fn hhook_head_register
+returns 0 if no errors occurred.
+It returns EEXIST if a hook point with the same
+.Fa hook_type
+and
+.Fa hook_id
+is already registered.
+It returns EINVAL if the HHOOK_HEADISINVNET flag is not set in
+.Fa flags
+because the implementation does not yet support hook points in non-virtualised
+subsystems (see the
+.Sx BUGS
+section for details).
+It returns ENOMEM if
+.Xr malloc 9
+failed to allocate memory for the new
+.Vt struct hhook_head .
+.Pp
+.Fn hhook_head_deregister
+and
+.Fn hhook_head_deregister_lookup
+return 0 if no errors occurred.
+They return ENOENT if
+.Fa hhh
+is NULL.
+They return EBUSY if the reference count of
+.Fa hhh
+is greater than one.
+.Sh EXAMPLES
+A well commented example Khelp module can be found at:
+.Pa /usr/share/examples/kld/khelp/h_example.c
+.Pp
+The
+.Xr tcp 4
+implementation provides two
+.Nm
+points which are called for packets sent/received when a connection is in the
+established phase.
+Search for HHOOK in the following files:
+.Pa sys/netinet/tcp_var.h ,
+.Pa sys/netinet/tcp_input.c ,
+.Pa sys/netinet/tcp_output.c
+and
+.Pa sys/netinet/tcp_subr.c .
+.Sh SEE ALSO
+.Xr khelp 9
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+framework first appeared in
+.Fx 9.0 .
+.Pp
+The
+.Nm
+framework was first released in 2010 by Lawrence Stewart whilst studying at
+Swinburne University of Technology's Centre for Advanced Internet Architectures,
+Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+framework was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
+.Pp
+This manual page was written by
+.An David Hayes Aq david.hayes@ieee.org
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
+.Sh BUGS
+The framework does not currently support registering hook points in subsystems
+which have not been virtualised with VIMAGE.
+Fairly minimal internal changes to the
+.Nm
+implementation are required to address this.
diff --git a/share/man/man9/ieee80211.9 b/share/man/man9/ieee80211.9
new file mode 100644
index 000000000000..1e53cf6b2645
--- /dev/null
+++ b/share/man/man9/ieee80211.9
@@ -0,0 +1,568 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 28, 2010
+.Dt IEEE80211 9
+.Os
+.Sh NAME
+.Nm IEEE80211
+.Nd 802.11 network layer
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Ft void
+.Fn ieee80211_ifattach "struct ieee80211com *ic" "const uint8_t macaddr[IEEE80211_ADDR_LEN]"
+.Ft void
+.Fn ieee80211_ifdetach "struct ieee80211com *ic"
+.Sh DESCRIPTION
+IEEE 802.11 device drivers are written to use the infrastructure provided
+by the
+.Nm
+software layer.
+This software provides a support framework for drivers that includes
+ifnet cloning, state management, and a user management API by which
+applications interact with 802.11 devices.
+Most drivers depend on the
+.Nm
+layer for protocol services but devices that off-load functionality
+may bypass the layer to connect directly to the device
+(e.g. the
+.Xr ndis 4
+emulation support does this).
+.Pp
+A
+.Nm
+device driver implements a virtual radio API that is exported to
+users through network interfaces (aka vaps) that are cloned from the
+underlying device.
+These interfaces have an operating mode
+(station, adhoc, hostap, wds, monitor, etc.)
+that is fixed for the lifetime of the interface.
+Devices that can support multiple concurrent interfaces allow
+multiple vaps to be cloned.
+This enables construction of interesting applications such as
+an AP vap and one or more WDS vaps
+or multiple AP vaps, each with a different security model.
+The
+.Nm
+layer virtualizes most 802.11 state
+and coordinates vap state changes including scheduling multiple vaps.
+State that is not virtualized includes the current channel and
+WME/WMM parameters.
+Protocol processing is typically handled entirely in the
+.Nm
+layer with drivers responsible purely for moving data between the host
+and device.
+Similarly,
+.Nm
+handles most
+.Xr ioctl 2
+requests without entering the driver;
+instead drivers are notified of state changes that
+require their involvement.
+.Pp
+The virtual radio interface defined by the
+.Nm
+layer means that drivers must be structured to follow specific rules.
+Drivers that support only a single interface at any time must still
+follow these rules.
+.Sh DATA STRUCTURES
+The virtual radio architecture splits state between a single per-device
+.Vt ieee80211com
+structure and one or more
+.Vt ieee80211vap
+structures.
+Drivers are expected to setup various shared state in these structures
+at device attach and during vap creation but otherwise should treat them
+as read-only.
+The
+.Vt ieee80211com
+structure is allocated by the
+.Nm
+layer as adjunct data to a device's
+.Vt ifnet ;
+it is accessed through the
+.Vt if_l2com
+structure member.
+The
+.Vt ieee80211vap
+structure is allocated by the driver in the
+.Dq vap create
+method
+and should be extended with any driver-private state.
+This technique of giving the driver control to allocate data structures
+is used for other
+.Nm
+data structures and should be exploited to maintain driver-private state
+together with public
+.Nm
+state.
+.Pp
+The other main data structures are the station, or node, table
+that tracks peers in the local BSS, and the channel table that defines
+the current set of available radio channels.
+Both tables are bound to the
+.Vt ieee80211com
+structure and shared by all vaps.
+Long-lasting references to a node are counted to guard against
+premature reclamation.
+In particular every packet sent/received holds a node reference
+(either explicitly for transmit or implicitly on receive).
+.Pp
+The
+.Vt ieee80211com
+and
+.Vt ieee80211vap
+structures also hold a collection of method pointers that drivers
+fill-in and/or override to take control of certain operations.
+These methods are the primary way drivers are bound to the
+.Nm
+layer and are described below.
+.Sh DRIVER ATTACH/DETACH
+Drivers attach to the
+.Nm
+layer with the
+.Fn ieee80211_ifattach
+function.
+The driver is expected to allocate and setup any device-private
+data structures before passing control.
+The
+.Vt ieee80211com
+structure must be pre-initialized with state required to setup the
+.Nm
+layer:
+.Bl -tag -width ic_channels
+.It Dv ic_ifp
+Backpointer to the physical device's ifnet.
+.It Dv ic_caps
+Device/driver capabilities; see below for a complete description.
+.It Dv ic_channels
+Table of channels the device is capable of operating on.
+This is initially provided by the driver but may be changed
+through calls that change the regulatory state.
+.It Dv ic_nchan
+Number of entries in
+.Dv ic_channels .
+.El
+.Pp
+On return from
+.Fn ieee80211_ifattach
+the driver is expected to override default callback functions in the
+.Vt ieee80211com
+structure to register it's private routines.
+Methods marked with a
+.Dq *
+must be provided by the driver.
+.Bl -tag -width ic_channels
+.It Dv ic_vap_create*
+Create a vap instance of the specified type (operating mode).
+Any fixed BSSID and/or MAC address is provided.
+Drivers that support multi-bssid operation may honor the requested BSSID
+or assign their own.
+.It Dv ic_vap_delete*
+Destroy a vap instance created with
+.Dv ic_vap_create .
+.It Dv ic_getradiocaps
+Return the list of calibrated channels for the radio.
+The default method returns the current list of channels
+(space permitting).
+.It Dv ic_setregdomain
+Process a request to change regulatory state.
+The routine may reject a request or constrain changes (e.g. reduce
+transmit power caps).
+The default method accepts all proposed changes.
+.It Dv ic_send_mgmt
+Send an 802.11 management frame.
+The default method fabricates the frame using
+.Nm
+state and passes it to the driver through the
+.Dv ic_raw_xmit
+method.
+.It Dv ic_raw_xmit
+Transmit a raw 802.11 frame.
+The default method drops the frame and generates a message on the console.
+.It Dv ic_updateslot
+Update hardware state after an 802.11 IFS slot time change.
+There is no default method; the pointer may be NULL in which case
+it will not be used.
+.It Dv ic_update_mcast
+Update hardware for a change in the multicast packet filter.
+The default method prints a console message.
+.It Dv ic_update_promisc
+Update hardware for a change in the promiscuous mode setting.
+The default method prints a console message.
+.It Dv ic_newassoc
+Update driver/device state for association to a new AP (in station mode)
+or when a new station associates (e.g. in AP mode).
+There is no default method; the pointer may be NULL in which case
+it will not be used.
+.It Dv ic_node_alloc
+Allocate and initialize a
+.Vt ieee80211_node
+structure.
+This method cannot sleep.
+The default method allocates zero'd memory using
+.Xr malloc 9 .
+Drivers should override this method to allocate extended storage
+for their own needs.
+Memory allocated by the driver must be tagged with
+.Dv M_80211_NODE
+to balance the memory allocation statistics.
+.It Dv ic_node_free
+Reclaim storage of a node allocated by
+.Dv ic_node_alloc .
+Drivers are expected to
+.Em interpose
+their own method to cleanup private state but must call through
+this method to allow
+.Nm
+to reclaim it's private state.
+.It Dv ic_node_cleanup
+Cleanup state in a
+.Vt ieee80211_node
+created by
+.Dv ic_node_alloc .
+This operation is distinguished from
+.Dv ic_node_free
+in that it may be called long before the node is actually reclaimed
+to cleanup adjunct state.
+This can happen, for example, when a node must not be reclaimed
+due to references held by packets in the transmit queue.
+Drivers typically interpose
+.Dv ic_node_cleanup
+instead of
+.Dv ic_node_free .
+.It Dv ic_node_age
+Age, and potentially reclaim, resources associated with a node.
+The default method ages frames on the power-save queue (in AP mode)
+and pending frames in the receive reorder queues (for stations using A-MPDU).
+.It Dv ic_node_drain
+Reclaim all optional resources associated with a node.
+This call is used to free up resources when they are in short supply.
+.It Dv ic_node_getrssi
+Return the Receive Signal Strength Indication (RSSI) in .5 dBm units for
+the specified node.
+This interface returns a subset of the information
+returned by
+.Dv ic_node_getsignal .
+The default method calculates a filtered average over the last ten
+samples passed in to
+.Xr ieee80211_input 9
+or
+.Xr ieee80211_input_all 9 .
+.It Dv ic_node_getsignal
+Return the RSSI and noise floor (in .5 dBm units) for a station.
+The default method calculates RSSI as described above;
+the noise floor returned is the last value supplied to
+.Xr ieee80211_input 9
+or
+.Xr ieee80211_input_all 9 .
+.It Dv ic_node_getmimoinfo
+Return MIMO radio state for a station in support of the
+.Dv IEEE80211_IOC_STA_INFO
+ioctl request.
+The default method returns nothing.
+.It Dv ic_scan_start*
+Prepare driver/hardware state for scanning.
+This callback is done in a sleepable context.
+.It Dv ic_scan_end*
+Restore driver/hardware state after scanning completes.
+This callback is done in a sleepable context.
+.It Dv ic_set_channel*
+Set the current radio channel using
+.Vt ic_curchan .
+This callback is done in a sleepable context.
+.It Dv ic_scan_curchan
+Start scanning on a channel.
+This method is called immediately after each channel change
+and must initiate the work to scan a channel and schedule a timer
+to advance to the next channel in the scan list.
+This callback is done in a sleepable context.
+The default method handles active scan work (e.g. sending ProbeRequest
+frames), and schedules a call to
+.Xr ieee80211_scan_next 9
+according to the maximum dwell time for the channel.
+Drivers that off-load scan work to firmware typically use this method
+to trigger per-channel scan activity.
+.It Dv ic_scan_mindwell
+Handle reaching the minimum dwell time on a channel when scanning.
+This event is triggered when one or more stations have been found on
+a channel and the minimum dwell time has been reached.
+This callback is done in a sleepable context.
+The default method signals the scan machinery to advance
+to the next channel as soon as possible.
+Drivers can use this method to preempt further work (e.g. if scanning
+is handled by firmware) or ignore the request to force maximum dwell time
+on a channel.
+.It Dv ic_recv_action
+Process a received Action frame.
+The default method points to
+.Xr ieee80211_recv_action 9
+which provides a mechanism for setting up handlers for each Action frame class.
+.It Dv ic_send_action
+Transmit an Action frame.
+The default method points to
+.Xr ieee80211_send_action 9
+which provides a mechanism for setting up handlers for each Action frame class.
+.It Dv ic_ampdu_enable
+Check if transmit A-MPDU should be enabled for the specified station and AC.
+The default method checks a per-AC traffic rate against a per-vap
+threshold to decide if A-MPDU should be enabled.
+This method also rate-limits ADDBA requests so that requests are not
+made too frequently when a receiver has limited resources.
+.It Dv ic_addba_request
+Request A-MPDU transmit aggregation.
+The default method sets up local state and issues an
+ADDBA Request Action frame.
+Drivers may interpose this method if they need to setup private state
+for handling transmit A-MPDU.
+.It Dv ic_addb_response
+Process a received ADDBA Response Action frame and setup resources as
+needed for doing transmit A-MPDU.
+.It Dv ic_addb_stop
+Shutdown an A-MPDU transmit stream for the specified station and AC.
+The default method reclaims local state after sending a DelBA Action frame.
+.It Dv ic_bar_response
+Process a response to a transmitted BAR control frame.
+.It Dv ic_ampdu_rx_start
+Prepare to receive A-MPDU data from the specified station for the TID.
+.It Dv ic_ampdu_rx_stop
+Terminate receipt of A-MPDU data from the specified station for the TID.
+.El
+.Pp
+Once the
+.Nm
+layer is attached to a driver there are two more steps typically done
+to complete the work:
+.Bl -enum
+.It
+Setup
+.Dq radiotap support
+for capturing raw 802.11 packets that pass through the device.
+This is done with a call to
+.Xr ieee80211_radiotap_attach 9 .
+.It
+Do any final device setup like enabling interrupts.
+.El
+.Pp
+State is torn down and reclaimed with a call to
+.Fn ieee80211_ifdetach .
+Note this call may result in multiple callbacks into the driver
+so it should be done before any critical driver state is reclaimed.
+On return from
+.Fn ieee80211_ifdetach
+all associated vaps and ifnet structures are reclaimed or inaccessible
+to user applications so it is safe to teardown driver state without
+worry about being re-entered.
+The driver is responsible for calling
+.Xr if_free 9
+on the ifnet it allocated for the physical device.
+.Sh DRIVER CAPABILITIES
+Driver/device capabilities are specified using several sets of flags
+in the
+.Vt ieee80211com
+structure.
+General capabilities are specified by
+.Vt ic_caps .
+Hardware cryptographic capabilities are specified by
+.Vt ic_cryptocaps .
+802.11n capabilities, if any, are specified by
+.Vt ic_htcaps .
+The
+.Nm
+layer propagates a subset of these capabilities to each vap through
+the equivalent fields:
+.Vt iv_caps ,
+.Vt iv_cryptocaps ,
+and
+.Vt iv_htcaps .
+The following general capabilities are defined:
+.Bl -tag -width IEEE80211_C_8023ENCAP
+.It Dv IEEE80211_C_STA
+Device is capable of operating in station (aka Infrastructure) mode.
+.It Dv IEEE80211_C_8023ENCAP
+Device requires 802.3-encapsulated frames be passed for transmit.
+By default
+.Nm
+will encapsulate all outbound frames as 802.11 frames (without a PLCP header).
+.It Dv IEEE80211_C_FF
+Device supports Atheros Fast-Frames.
+.It Dv IEEE80211_C_TURBOP
+Device supports Atheros Dynamic Turbo mode.
+.It Dv IEEE80211_C_IBSS
+Device is capable of operating in adhoc/IBSS mode.
+.It Dv IEEE80211_C_PMGT
+Device supports dynamic power-management (aka power save) in station mode.
+.It Dv IEEE80211_C_HOSTAP
+Device is capable of operating as an Access Point in Infrastructure mode.
+.It Dv IEEE80211_C_AHDEMO
+Device is capable of operating in Adhoc Demo mode.
+In this mode the device is used purely to send/receive raw 802.11 frames.
+.It Dv IEEE80211_C_SWRETRY
+Device supports software retry of transmitted frames.
+.It Dv IEEE80211_C_TXPMGT
+Device support dynamic transmit power changes on transmitted frames;
+also known as Transmit Power Control (TPC).
+.It Dv IEEE80211_C_SHSLOT
+Device supports short slot time operation (for 802.11g).
+.It Dv IEEE80211_C_SHPREAMBLE
+Device supports short preamble operation (for 802.11g).
+.It Dv IEEE80211_C_MONITOR
+Device is capable of operating in monitor mode.
+.It Dv IEEE80211_C_DFS
+Device supports radar detection and/or DFS.
+DFS protocol support can be handled by
+.Nm
+but the device must be capable of detecting radar events.
+.It Dv IEEE80211_C_MBSS
+Device is capable of operating in MeshBSS (MBSS) mode
+(as defined by 802.11s Draft 3.0).
+.It Dv IEEE80211_C_WPA1
+Device supports WPA1 operation.
+.It Dv IEEE80211_C_WPA2
+Device supports WPA2/802.11i operation.
+.It Dv IEEE80211_C_BURST
+Device supports frame bursting.
+.It Dv IEEE80211_C_WME
+Device supports WME/WMM operation
+(at the moment this is mostly support for sending and receiving
+QoS frames with EDCF).
+.It Dv IEEE80211_C_WDS
+Device supports transmit/receive of 4-address frames.
+.It Dv IEEE80211_C_BGSCAN
+Device supports background scanning.
+.It Dv IEEE80211_C_TXFRAG
+Device supports transmit of fragmented 802.11 frames.
+.It Dv IEEE80211_C_TDMA
+Device is capable of operating in TDMA mode.
+.El
+.Pp
+The follow general crypto capabilities are defined.
+In general
+.Nm
+will fall-back to software support when a device is not capable
+of hardware acceleration of a cipher.
+This can be done on a per-key basis.
+.Nm
+can also handle software
+.Dv Michael
+calculation combined with hardware
+.Dv AES
+acceleration.
+.Bl -tag -width IEEE80211_C_8023ENCAP
+.It Dv IEEE80211_CRYPTO_WEP
+Device supports hardware WEP cipher.
+.It Dv IEEE80211_CRYPTO_TKIP
+Device supports hardware TKIP cipher.
+.It Dv IEEE80211_CRYPTO_AES_OCB
+Device supports hardware AES-OCB cipher.
+.It Dv IEEE80211_CRYPTO_AES_CCM
+Device supports hardware AES-CCM cipher.
+.It Dv IEEE80211_CRYPTO_TKIPMIC
+Device supports hardware Michael for use with TKIP.
+.It Dv IEEE80211_CRYPTO_CKIP
+Devices supports hardware CKIP cipher.
+.El
+.Pp
+The follow general 802.11n capabilities are defined.
+The first capabilities are defined exactly as they appear in the
+802.11n specification.
+Capabilities beginning with IEEE80211_HTC_AMPDU are used solely by the
+.Nm
+layer.
+.Bl -tag -width IEEE80211_C_8023ENCAP
+.It Dv IEEE80211_HTCAP_CHWIDTH40
+Device supports 20/40 channel width operation.
+.It Dv IEEE80211_HTCAP_SMPS_DYNAMIC
+Device supports dynamic SM power save operation.
+.It Dv IEEE80211_HTCAP_SMPS_ENA
+Device supports static SM power save operation.
+.It Dv IEEE80211_HTCAP_GREENFIELD
+Device supports Greenfield preamble.
+.It Dv IEEE80211_HTCAP_SHORTGI20
+Device supports Short Guard Interval on 20MHz channels.
+.It Dv IEEE80211_HTCAP_SHORTGI40
+Device supports Short Guard Interval on 40MHz channels.
+.It Dv IEEE80211_HTCAP_TXSTBC
+Device supports Space Time Block Convolution (STBC) for transmit.
+.It Dv IEEE80211_HTCAP_RXSTBC_1STREAM
+Device supports 1 spatial stream for STBC receive.
+.It Dv IEEE80211_HTCAP_RXSTBC_2STREAM
+Device supports 1-2 spatial streams for STBC receive.
+.It Dv IEEE80211_HTCAP_RXSTBC_3STREAM
+Device supports 1-3 spatial streams for STBC receive.
+.It Dv IEEE80211_HTCAP_MAXAMSDU_7935
+Device supports A-MSDU frames up to 7935 octets.
+.It Dv IEEE80211_HTCAP_MAXAMSDU_3839
+Device supports A-MSDU frames up to 3839 octets.
+.It Dv IEEE80211_HTCAP_DSSSCCK40
+Device supports use of DSSS/CCK on 40MHz channels.
+.It Dv IEEE80211_HTCAP_PSMP
+Device supports PSMP.
+.It Dv IEEE80211_HTCAP_40INTOLERANT
+Device is intolerant of 40MHz wide channel use.
+.It Dv IEEE80211_HTCAP_LSIGTXOPPROT
+Device supports L-SIG TXOP protection.
+.It Dv IEEE80211_HTC_AMPDU
+Device supports A-MPDU aggregation.
+Note that any 802.11n compliant device must support A-MPDU receive
+so this implicitly means support for
+.Em transmit
+of A-MPDU frames.
+.It Dv IEEE80211_HTC_AMSDU
+Device supports A-MSDU aggregation.
+Note that any 802.11n compliant device must support A-MSDU receive
+so this implicitly means support for
+.Em transmit
+of A-MSDU frames.
+.It Dv IEEE80211_HTC_HT
+Device supports High Throughput (HT) operation.
+This capability must be set to enable 802.11n functionality
+in
+.Nm .
+.It Dv IEEE80211_HTC_SMPS
+Device supports MIMO Power Save operation.
+.It Dv IEEE80211_HTC_RIFS
+Device supports Reduced Inter Frame Spacing (RIFS).
+.El
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr ndis 4 ,
+.Xr ieee80211_amrr 9 ,
+.Xr ieee80211_beacon 9 ,
+.Xr ieee80211_bmiss 9 ,
+.Xr ieee80211_crypto 9 ,
+.Xr ieee80211_ddb 9 ,
+.Xr ieee80211_input 9 ,
+.Xr ieee80211_node 9 ,
+.Xr ieee80211_output 9 ,
+.Xr ieee80211_proto 9 ,
+.Xr ieee80211_radiotap 9 ,
+.Xr ieee80211_regdomain 9 ,
+.Xr ieee80211_scan 9 ,
+.Xr ieee80211_vap 9 ,
+.Xr ifnet 9 ,
+.Xr malloc 9
diff --git a/share/man/man9/ieee80211_amrr.9 b/share/man/man9/ieee80211_amrr.9
new file mode 100644
index 000000000000..a90de3dc257a
--- /dev/null
+++ b/share/man/man9/ieee80211_amrr.9
@@ -0,0 +1,194 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE8021_AMRR 9
+.Os
+.Sh NAME
+.Nm ieee80211_amrr
+.Nd 802.11 network driver transmit rate control support
+.Sh SYNOPSIS
+.In net80211/ieee80211_amrr.h
+.Ft void
+.Fo ieee80211_amrr_init
+.Fa "struct ieee80211_amrr *"
+.Fa "struct ieee80211vap *"
+.Fa "int amin"
+.Fa "int amax"
+.Fa "int interval"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_amrr_cleanup "struct ieee80211_amrr *"
+.\"
+.Ft void
+.Fn ieee80211_amrr_setinterval "struct ieee80211_amrr *" "int interval"
+.\"
+.Ft void
+.Fo ieee80211_amrr_node_init
+.Fa "struct ieee80211_amrr *"
+.Fa "struct ieee80211_amrr_node *"
+.Fa "struct ieee80211_node *"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_amrr_choose
+.Fa "struct ieee80211_node *"
+.Fa "struct ieee80211_amrr_node *"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_amrr_tx_complete
+.Fa "struct ieee80211_amrr_node *"
+.Fa "int ok"
+.Fa "int retries"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_amrr_tx_update
+.Fa "struct ieee80211_amrr_node *"
+.Fa "int txnct"
+.Fa "int success"
+.Fa "int retrycnt"
+.Fc
+.Sh DESCRIPTION
+.Nm
+is an implementation of the AMRR transmit rate control algorithm
+for drivers that use the
+.Nm net80211
+software layer.
+A rate control algorithm is responsible for choosing the transmit
+rate for each frame.
+To maximize throughput algorithms try to use the highest rate that
+is appropriate for the operating conditions.
+The rate will vary as conditions change; the distance between two stations
+may change, transient noise may be present that affects signal quality,
+etc.
+.Nm
+uses very simple information from a driver to do it's job:
+whether a frame was successfully delivered and how many transmit
+attempts were made.
+While this enables its use with virtually any wireless device it
+limits it's effectiveness--do not expect it to function well in
+difficult environments and/or respond quickly to changing conditions.
+.Pp
+.Nm
+requires per-vap state and per-node state for each station it is to
+select rates for.
+The API's are designed for drivers to pre-allocate state in the
+driver-private extension areas of each vap and node.
+For example the
+.Xr ral 4
+driver defines a vap as:
+.Bd -literal -offset indent
+struct rt2560_vap {
+ struct ieee80211vap ral_vap;
+ struct ieee80211_beacon_offsets ral_bo;
+ struct ieee80211_amrr amrr;
+
+ int (*ral_newstate)(struct ieee80211vap *,
+ enum ieee80211_state, int);
+};
+.Ed
+.Pp
+The
+.Vt amrr
+structure member holds the per-vap state for
+.Nm
+and
+.Xr ral 4
+initializes it in the vap create method with:
+.Bd -literal -offset indent
+ieee80211_amrr_init(&rvp->amrr, vap,
+ IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD,
+ IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD,
+ 500 /* ms */);
+.Ed
+.Pp
+The node is defined as:
+.Bd -literal -offset indent
+struct rt2560_node {
+ struct ieee80211_node ni;
+ struct ieee80211_amrr_node amrr;
+};
+.Ed
+.Pp
+with initialization done in the driver's
+.Vt iv_newassoc
+method:
+.Bd -literal -offset indent
+static void
+rt2560_newassoc(struct ieee80211_node *ni, int isnew)
+{
+ struct ieee80211vap *vap = ni->ni_vap;
+
+ ieee80211_amrr_node_init(&RT2560_VAP(vap)->amrr,
+ &RT2560_NODE(ni)->amrr, ni);
+}
+.Ed
+.Pp
+Once
+.Nm
+state is setup, transmit rates are requested by calling
+.Fn ieee80211_amrr_choose
+in the transmit path; e.g.:
+.Bd -literal -offset indent
+tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
+if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ rate = tp->mcastrate;
+} else if (m0->m_flags & M_EAPOL) {
+ rate = tp->mgmtrate;
+} else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
+ rate = tp->ucastrate;
+} else {
+ (void) ieee80211_amrr_choose(ni, &RT2560_NODE(ni)->amrr);
+ rate = ni->ni_txrate;
+}
+.Ed
+.Pp
+Note a rate is chosen only for unicast data frames when a fixed
+transmit rate is not configured; the other cases are handled with
+the
+.Nm net80211
+transmit parameters.
+Note also that
+.Fn ieee80211_amrr_choose
+writes the chosen rate in
+.Vt ni_txrate ;
+this eliminates copying the value as it is exported to user applications so
+they can display the current transmit rate in status.
+.Pp
+The remaining work a driver must do is feed status back to
+.Nm
+when a frame transmit completes using
+.Fn ieee80211_amrr_tx_complete .
+Drivers that poll a device to retrieve statistics can use
+.Fn ieee80211_amrr_tx_update
+(instead or in addition).
+.Sh SEE ALSO
+.Xr ieee80211 9 ,
+.Xr ieee80211_output 9
diff --git a/share/man/man9/ieee80211_beacon.9 b/share/man/man9/ieee80211_beacon.9
new file mode 100644
index 000000000000..87115fcbd601
--- /dev/null
+++ b/share/man/man9/ieee80211_beacon.9
@@ -0,0 +1,115 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_BEACON 9
+.Os
+.Sh NAME
+.Nm ieee80211_beacon
+.Nd 802.11 beacon support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Pp
+.Ft "struct mbuf *"
+.Fo ieee80211_beacon_alloc
+.Fa "struct ieee80211_node *"
+.Fa "struct ieee80211_beacon_offsets *"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_beacon_update
+.Fa "struct ieee80211_node *"
+.Fa "struct ieee80211_beacon_offsets *"
+.Fa "struct mbuf *"
+.Fa "int mcast"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_beacon_notify "struct ieee80211vap *" "int what"
+.Sh DESCRIPTION
+The
+.Nm net80211
+software layer provides a support framework for drivers that includes
+a template-based mechanism for dynamic update of beacon frames transmit
+in hostap, adhoc, and mesh operating modes.
+Drivers should use
+.Fn ieee80211_beacon_alloc
+to create an initial beacon frame.
+The
+.Vt ieee80211_beacon_offsets
+structure holds information about the beacon contents that is used
+to optimize updates done with
+.Fn ieee80211_beacon_update .
+.Pp
+Update calls should only be done when something changes that
+affects the contents of the beacon frame.
+When this happens the
+.Dv iv_update_beacon
+method is invoked and a driver-supplied routine must do the right thing.
+For devices that involve the host to transmit each
+beacon frame this work may be as simple as marking a bit in the
+.Vt ieee80211_beacon_offsets
+structure:
+.Bd -literal
+static void
+ath_beacon_update(struct ieee80211vap *vap, int item)
+{
+ struct ieee80211_beacon_offsets *bo = &ATH_VAP(vap)->av_boff;
+ setbit(bo->bo_flags, item);
+}
+.Ed
+.Pp
+with the
+.Fn ieee80211_beacon_update
+call done before the next beacon is to be sent.
+.Pp
+Devices that off-load beacon generation may instead choose to use
+this callback to push updates immediately to the device.
+Exactly how that is accomplished is unspecified.
+One possibility is to update the beacon frame contents and extract
+the appropriate information element, but other scenarios are possible.
+.Sh MULTI-VAP BEACON SCHEDULING
+Drivers that support multiple vaps that can each beacon need to consider
+how to schedule beacon frames.
+There are two possibilities at the moment:
+.Em burst
+all beacons at TBTT or
+.Em stagger beacons
+over the beacon interval.
+Bursting beacon frames may result in aperiodic delivery that can affect
+power save operation of associated stations.
+Applying some jitter (e.g. by randomly ordering burst frames) may be
+sufficient to combat this and typically this is not an issue unless
+stations are using aggressive power save techniques
+such as U-APSD (sometimes employed by VoIP phones).
+Staggering frames requires more interrupts and device support that
+may not be available.
+Staggering beacon frames is usually superior to bursting frames, up to
+about eight vaps, at which point the overhead becomes significant and
+the channel becomes noticeably busy anyway.
+.Sh SEE ALSO
+.Xr ieee80211 9
diff --git a/share/man/man9/ieee80211_bmiss.9 b/share/man/man9/ieee80211_bmiss.9
new file mode 100644
index 000000000000..63b8e9f4ad51
--- /dev/null
+++ b/share/man/man9/ieee80211_bmiss.9
@@ -0,0 +1,91 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_BMISS 9
+.Os
+.Sh NAME
+.Nm ieee80211_bmiss
+.Nd 802.11 beacon miss support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Pp
+.Ft void
+.Fn ieee80211_beacon_miss "struct ieee80211com *"
+.Sh DESCRIPTION
+The
+.Nm net80211
+software layer provides a support framework for drivers that includes
+handling beacon miss events in station mode.
+Drivers can dispatch beacon miss events that are recognized in hardware or
+.Nm net80211
+can detect beacon miss if the driver dispatches received beacon frames
+through the normal receive path.
+Software beacon miss support is especially useful when multiple vaps
+are operating and any hardware beacon miss support is not available
+(e.g. operating as an access point together with one or more station
+mode vaps).
+.Pp
+Drivers should dispatch beacon miss events recognized in the driver with
+.Fn ieee80211_beacon_miss .
+This causes some number of ProbeRequest frames to be sent to the
+access point to check if the association is still alive.
+If no response is received and roaming mode is set to
+.Dv IEEE80211_ROAMING_AUTO
+then
+.Nm net80211
+will try to re-associate and if that fails
+trigger a scan to look for the access point or another suitable AP.
+When the
+.Nm net80211
+state machine is being operated manually, e.g. by
+.Xr wpa_supplicant 8 ,
+then applications are notified of the state change and are responsible
+for handling the work of scanning for a new access point.
+The number of beacon miss events (without a ProbeResponse) is user
+settable with the
+.Dv IEEE80211_IOC_BMISSTHRESHOLD
+request.
+.Pp
+Software beacon miss detection is enabled per-vap by setting the
+.Dv IEEE80211_FEXT_SWBMISS
+flag.
+Typically this is done when a vap is setup
+when the
+.Dv IEEE80211_CLONE_NOBEACONS
+option is supplied to the clone operation.
+But drivers may also force this when they know they need help detecting
+beacon miss.
+When beacon miss is detected in software the event is dispatched without
+driver involvement.
+Note that software beacon miss handling is not limited to station mode;
+it can be used in any operating mode where beacons from a peer station
+are received.
+.Sh SEE ALSO
+.Xr wpa_supplicant 8 ,
+.Xr ieee80211 9 ,
+.Xr ieee80211_vap 9
diff --git a/share/man/man9/ieee80211_crypto.9 b/share/man/man9/ieee80211_crypto.9
new file mode 100644
index 000000000000..9f48f21fd605
--- /dev/null
+++ b/share/man/man9/ieee80211_crypto.9
@@ -0,0 +1,260 @@
+.\"
+.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
+.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" $Id: ieee80211_crypto.9,v 1.3 2004/03/04 10:42:56 bruce Exp $
+.\"
+.Dd March 29, 2010
+.Dt IEEE80211_CRYPTO 9
+.Os
+.Sh NAME
+.Nm ieee80211_crypto
+.Nd 802.11 cryptographic support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.\"
+.Pp
+.Ft void
+.Fn ieee80211_crypto_register "const struct ieee80211_cipher *"
+.\"
+.Ft void
+.Fn ieee80211_crypto_unregister "const struct ieee80211_cipher *"
+.\"
+.Ft int
+.Fn ieee80211_crypto_available "int cipher"
+.\"
+.Pp
+.Ft void
+.Fo ieee80211_notify_replay_failure
+.Fa "struct ieee80211vap *"
+.Fa "const struct ieee80211_frame *"
+.Fa "const struct ieee80211_key *"
+.Fa "uint64_t rsc"
+.Fa "int tid"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_notify_michael_failure
+.Fa "struct ieee80211vap *"
+.Fa "const struct ieee80211_frame *"
+.Fa "u_int keyix"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_crypto_newkey
+.Fa "struct ieee80211vap *"
+.Fa "int cipher"
+.Fa "int flags"
+.Fa "struct ieee80211_key *"
+.Fc
+.\"
+.Ft int
+.Fn ieee80211_crypto_setkey "struct ieee80211vap *" "struct ieee80211_key *"
+.\"
+.Ft int
+.Fn ieee80211_crypto_delkey "struct ieee80211vap *" "struct ieee80211_key *"
+.\"
+.Ft void
+.Fn ieee80211_key_update_begin "struct ieee80211vap *"
+.\"
+.Ft void
+.Fn ieee80211_key_update_end "struct ieee80211vap *"
+.\"
+.Ft void
+.Fn ieee80211_crypto_delglobalkeys "struct ieee80211vap *"
+.\"
+.Ft void
+.Fn ieee80211_crypto_reload_keys "struct ieee80211com *"
+.\"
+.Pp
+.Ft struct ieee80211_key *
+.Fn ieee80211_crypto_encap "struct ieee80211_node *" "struct mbuf *"
+.\"
+.Ft struct ieee80211_key *
+.Fn ieee80211_crypto_decap "struct ieee80211_node *" "struct mbuf *" "int flags"
+.\"
+.Ft int
+.Fo ieee80211_crypto_demic
+.Fa "struct ieee80211vap *"
+.Fa "struct ieee80211_key *"
+.Fa "struct mbuf *"
+.Fa "int force"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_crypto_enmic
+.Fa "struct ieee80211vap *"
+.Fa "struct ieee80211_key *"
+.Fa "struct mbuf *"
+.Fa "int force"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer includes comprehensive cryptographic support for 802.11 protocols.
+Software implementations of ciphers required by
+WPA and 802.11i are provided as well as encap/decap processing of 802.11 frames.
+Software ciphers are written as kernel modules and
+register with the core crypto support.
+The cryptographic framework supports hardware acceleration of ciphers
+by drivers with automatic fall-back to software implementations when a
+driver is unable to provide necessary hardware services.
+.Sh CRYPTO CIPHER MODULES
+.Nm net80211
+cipher modules register their services using
+.Fn ieee80211_crypto_register
+and supply a template that describes their operation.
+This
+.Vt ieee80211_cipher
+structure defines protocol-related state such as the number of bytes
+of space in the 802.11 header to reserve/remove during encap/decap
+and entry points for setting up keys and doing cryptographic operations.
+.Pp
+Cipher modules can associate private state to each key through the
+.Vt wk_private
+structure member.
+If state is setup by the module it will be called before a key is destroyed
+so it can reclaim resources.
+.Pp
+Crypto modules can notify the system of two events.
+When a packet replay event is recognized
+.Fn ieee80211_notify_replay_failure
+can be used to signal the event.
+When a
+.Dv TKIP
+Michael failure is detected
+.Fn ieee80211_notify_michael_failure
+can be invoked.
+Drivers may also use these routines to signal events detected by the
+hardware.
+.Sh CRYPTO KEY MANAGEMENT
+The
+.Nm net80211
+layer implements a per-vap 4-element
+.Dq global key table
+and a per-station
+.Dq unicast key
+for protocols such as WPA, 802.1x, and 802.11i.
+The global key table is designed to support legacy WEP operation
+and Multicast/Group keys,
+though some applications also use it to implement WPA in station mode.
+Keys in the global table are identified by a key index in the range 0-3.
+Per-station keys are identified by the MAC address of the station and
+are typically used for unicast PTK bindings.
+.Pp
+.Nm net80211
+provides
+.Xr ioctl 2
+operations for managing both global and per-station keys.
+Drivers typically do not participate in software key management;
+they are involved only when providing hardware acceleration of
+cryptographic operations.
+.Pp
+.Fn ieee80211_crypto_newkey
+is used to allocate a new
+.Nm net80211
+key or reconfigure an existing key.
+The cipher must be specified along with any fixed key index.
+The
+.Nm net80211
+layer will handle allocating cipher and driver resources to support the key.
+.Pp
+Once a key is allocated it's contents can be set using
+.Fn ieee80211_crypto_setkey
+and deleted with
+.Fn ieee80211_crypto_delkey
+(with any cipher and driver resources reclaimed).
+.Pp
+.Fn ieee80211_crypto_delglobalkeys
+is used to reclaim all keys in the global key table for a vap; it
+typically is used only within the
+.Nm net80211
+layer.
+.Pp
+.Fn ieee80211_crypto_reload_keys
+handles hardware key state reloading from software key state, such
+as required after a suspend/resume cycle.
+.Sh DRIVER CRYPTO SUPPORT
+Drivers identify ciphers they have hardware support for through the
+.Vt ic_cryptocaps
+field of the
+.Vt ieee80211com
+structure.
+If hardware support is available then a driver should also fill in the
+.Dv iv_key_alloc ,
+.Dv iv_key_set ,
+and
+.Dv iv_key_delete
+methods of each
+.Vt ieee80211vap
+created for use with the device.
+In addition the methods
+.Dv iv_key_update_begin
+and
+.Dv iv_key_update_end
+can be setup to handle synchronization requirements
+for updating hardware key state.
+.Pp
+When
+.Nm net80211
+allocates a software key and the driver can accelerate the
+cipher operations the
+.Dv iv_key_alloc
+method will be invoked.
+Drivers may return a token that is associated with outbound traffic
+(for use in encrypting frames).
+Otherwise, e.g. if hardware resources are not available, the driver will
+not return a token and
+.Nm net80211
+will arrange to do the work in software and pass frames
+to the driver that are already prepared for transmission.
+.Pp
+For receive, drivers mark frames with the
+.Dv M_WEP
+mbuf flag to indicate the hardware has decrypted the payload.
+If frames have the
+.Dv IEEE80211_FC1_WEP
+bit marked in their 802.11 header and are not tagged with
+.Dv M_WEP
+then decryption is done in software.
+For more complicated scenarios the software key state is consulted; e.g.
+to decide if Michael verification needs to be done in software after
+the hardware has handled TKIP decryption.
+.Pp
+Drivers that manage complicated key data structures, e.g. faulting
+software keys into a hardware key cache, can safely manipulate software
+key state by bracketing their work with calls to
+.Fn ieee80211_key_update_begin
+and
+.Fn ieee80211_key_update_end .
+These calls also synchronize hardware key state update
+when receive traffic is active.
+.Sh SEE ALSO
+.Xr ieee80211 9 ,
+.Xr ioctl 2 ,
+.Xr wlan_ccmp 4 ,
+.Xr wlan_tkip 4 ,
+.Xr wlan_wep 4
diff --git a/share/man/man9/ieee80211_ddb.9 b/share/man/man9/ieee80211_ddb.9
new file mode 100644
index 000000000000..8deaee73c815
--- /dev/null
+++ b/share/man/man9/ieee80211_ddb.9
@@ -0,0 +1,71 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_DDB 9
+.Os
+.Sh NAME
+.Nm ieee80211_ddb
+.Nd 802.11 ddb support
+.Sh SYNOPSIS
+.Bd -ragged
+.Cd options DDB
+.Ed
+.Bd -ragged
+.Cd show vap [addr]
+.Cd show all vaps
+.Cd show com [addr]
+.Cd show sta [addr]
+.Cd show statab [addr]
+.Cd show mesh [addr]
+.Ed
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer includes
+.Xr ddb 4
+support for displaying important data structures.
+This is especially important because wireless applications are often
+built for embedded environments where cross-machine or post-mortem
+debugging facilities like
+.Xr kgdb 1
+are infeasible.
+.Pp
+The most commonly used command is
+.Bd -literal -offset indent
+show all vaps/a
+.Ed
+.Pp
+which dumps the contents of all
+.Vt ieee80211vap ,
+.Vt ieee80211com ,
+and
+.Vt ieee80211_node
+data structures in the system.
+.Sh SEE ALSO
+.Xr ddb 4 ,
+.Xr ieee80211 9
diff --git a/share/man/man9/ieee80211_input.9 b/share/man/man9/ieee80211_input.9
new file mode 100644
index 000000000000..9422f0bc6330
--- /dev/null
+++ b/share/man/man9/ieee80211_input.9
@@ -0,0 +1,116 @@
+.\"
+.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
+.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_INPUT 9
+.Os
+.Sh NAME
+.Nm ieee80211_input
+.Nd software 802.11 stack input functions
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Ft void
+.Fo ieee80211_input
+.Fa "struct ieee80211_node *"
+.Fa "struct mbuf *"
+.Fa "int rssi"
+.Fa "int noise"
+.Fc
+.Ft void
+.Fo ieee80211_input_all
+.Fa "struct ieee80211com *"
+.Fa "struct mbuf *"
+.Fa "int rssi"
+.Fa "int noise"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer that supports 802.11 device drivers requires that
+receive processing be single-threaded.
+Typically this is done using a dedicated driver
+.Xr taskqueue 9
+thread.
+.Fn ieee80211_input
+and
+.Fn ieee80211_input_all
+process received 802.11 frames and are designed
+for use in that context; e.g. no driver locks may be held.
+.Pp
+The frame passed up in the
+.Vt mbuf
+must have the 802.11 protocol header at the front; all device-specific
+information and/or PLCP must be removed.
+Any CRC must be stripped from the end of the frame.
+The 802.11 protocol header should be 32-bit aligned for
+optimal performance but receive processing does not require it.
+If the frame holds a payload and that is not aligned to a 32-bit
+boundary then the payload will be re-aligned so that it is suitable
+for processing by protocols such as
+.Xr ip 4 .
+.Pp
+If a device (such as
+.Xr ath 4 )
+inserts padding after the 802.11 header to align
+the payload to a 32-bit boundary the
+.Dv IEEE80211_C_DATAPAD
+capability must be set.
+Otherwise header and payload are assumed contiguous in the mbuf chain.
+.Pp
+If a received frame must pass
+through the A-MPDU receive reorder buffer then the mbuf
+must be marked with the
+.Dv M_AMPDU
+flag.
+Note that for the moment this is required of all frames received from
+a station and TID where a Block ACK stream is active, not just A-MPDU
+aggregates.
+It is sufficient to check for
+.Dv IEEE80211_NODE_HT
+in the
+.Vt ni_flags
+of the station's node table entry, any frames that do not require reorder
+processing will be dispatched with only minimal overhead.
+.Pp
+The
+.Vt rssi
+parameter is the Receive Signal Strength Indication of the frame
+measured in 0.5dBm units relative to the noise floor.
+The
+.Vt noise
+parameter is the best approximation of the noise floor in
+dBm units at the time the frame was received.
+RSSI and noise are used by the
+.Nm net80211
+layer to make scanning and roaming decisions in station mode
+and to do auto channel selection for hostap and similar modes.
+Otherwise the values are made available to user applications
+(with the rssi presented as a filtered average over the last ten values
+and the noise floor the last reported value).
+.Sh SEE ALSO
+.Xr ieee80211 9
diff --git a/share/man/man9/ieee80211_node.9 b/share/man/man9/ieee80211_node.9
new file mode 100644
index 000000000000..452bbcc19306
--- /dev/null
+++ b/share/man/man9/ieee80211_node.9
@@ -0,0 +1,251 @@
+.\"
+.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
+.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 28, 2010
+.Dt IEEE80211_NODE 9
+.Os
+.Sh NAME
+.Nm ieee80211_node
+.Nd software 802.11 stack node management functions
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.\"
+.Ft struct ieee80211_node *
+.Fo ieee80211_find_rxnode
+.Fa "struct ieee80211com *"
+.Fa "const struct ieee80211_frame_min *"
+.Fc
+.\"
+.Ft struct ieee80211_node *
+.Fo ieee80211_find_rxnode_withkey
+.Fa "struct ieee80211com *"
+.Fa "const struct ieee80211_frame_min *"
+.Fa "ieee80211_keyix"
+.Fc
+.\"
+.Ft struct ieee80211_node *
+.Fn ieee80211_ref_node "struct ieee80211_node *"
+.\"
+.Ft void
+.Fn ieee80211_unref_node "struct ieee80211_node *"
+.\"
+.Ft void
+.Fn ieee80211_free_node "struct ieee80211_node *"
+.\"
+.Ft void
+.Fo ieee80211_iterate_nodes
+.Fa "struct ieee80211_node_table *"
+.Fa "ieee80211_iter_func *f"
+.Fa "void *arg"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_dump_nodes
+.Fa "struct ieee80211_node_table *"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_dump_node
+.Fa "struct ieee80211_node *"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer that supports 802.11 device drivers maintains a database of
+peer stations called the
+.Dq node table
+in the
+.Vt ic_sta
+entry of the
+.Vt ieee80211com
+structure.
+Station mode vaps create an entry for the access point
+the station is associated to.
+AP mode vaps create entries for associated stations.
+Adhoc and mesh mode vaps create entries for neighbor stations.
+WDS mode vaps create an entry for the peer station.
+Stations for all vaps reside in the same table; each node
+entry has a
+.Vt ni_vap
+field that identifies the vap that created it.
+In some instances an entry is used by multiple vaps (e.g. for
+dynamic WDS a station associated to an ap vap may also be the peer
+of a WDS vap).
+.Pp
+Node table entries are reference counted.
+That is, there is a count of all long term references that determines
+when an entry may be reclaimed.
+References are held by every in-flight frame sent to a station to
+ensure the entry is not reclaimed while the frame is queued or otherwise
+held by a driver.
+Routines that lookup a table entry return a
+.Dq held reference
+(i.e. a pointer to a table entry with the reference count incremented).
+The
+.Fn ieee80211_ref_node
+and
+.Fn ieee80211_unref_node
+calls explicitly increment/decrement the reference count of a node,
+but are rarely used.
+Instead most callers use
+.Fn ieee80211_free_node
+to release a reference and, if the count goes to zero, reclaim the
+table entry.
+.Pp
+The station table and its entries are exposed to drivers in several ways.
+Each frame transmitted to a station includes a reference to the
+associated node in the
+.Vt m_pkthdr.rcvif
+field.
+This reference must be reclaimed by the driver when transmit processing
+is done.
+For each frame received the driver must lookup the table entry to
+use in dispatching the frame
+.Dq up the stack .
+This lookup implicitly obtains a reference to the table entry and
+the driver must reclaim the reference when frame processing is completed.
+Otherwise drivers frequently inspect the contents of the
+.Vt iv_bss
+node when handling state machine changes as important information
+is maintained in the data structure.
+.Pp
+The node table is opaque to drivers.
+Entries may be looked up using one of the pre-defined API's or the
+.Fn ieee80211_iterate_nodes
+call may be used to iterate through all entries to do per-node
+processing or implement some non-standard search mechanism.
+Note that
+.Fn ieee80211_iterate_nodes
+is single-threaded per-device
+and the effort processing involved is fairly
+substantial so it should be used carefully.
+.Pp
+Two routines are provided to print the contents of nodes to the console
+for debugging:
+.Fn ieee80211_dump_node
+displays the contents of a single node while
+.Fn ieee80211_dump_nodes
+displays the contents of the specified node table.
+Nodes may also be displayed using
+.Xr ddb 4
+with the
+.Dq show node
+directive and the station node table can be displayed with
+.Dq show statab .
+.Sh DRIVER PRIVATE STATE
+Node data structures may be extended by the driver to include
+driver-private state.
+This is done by overriding the
+.Vt ic_node_alloc
+method used to allocate a node table entry.
+The driver method must allocate a structure that is an extension
+of the
+.Vt ieee80211_node
+structure.
+For example the
+.Xr iwi 4
+driver defines a private node structure as:
+.Bd -literal -offset indent
+struct iwi_node {
+ struct ieee80211_node in_node;
+ int in_station;
+};
+.Ed
+.Pp
+and then provides a private allocation routine that does this:
+.Bd -literal -offset indent
+static struct ieee80211_node *
+iwi_node_alloc(struct ieee80211vap *vap,
+ const uint8_t mac[IEEE80211_ADDR_LEN])
+{
+ struct iwi_node *in;
+
+ in = malloc(sizeof (struct iwi_node), M_80211_NODE,
+ M_NOWAIT | M_ZERO);
+ if (in == NULL)
+ return NULL;
+ in->in_station = -1;
+ return &in->in_node;
+}
+.Ed
+.Pp
+Note that when reclaiming a node allocated by the driver the
+.Dq parent method
+must be called to ensure
+.Nm net80211
+state is reclaimed; for example:
+.Bd -literal -offset indent
+static void
+iwi_node_free(struct ieee80211_node *ni)
+{
+ struct ieee80211com *ic = ni->ni_ic;
+ struct iwi_softc *sc = ic->ic_ifp->if_softc;
+ struct iwi_node *in = (struct iwi_node *)ni;
+
+ if (in->in_station != -1)
+ free_unr(sc->sc_unr, in->in_station);
+ sc->sc_node_free(ni); /* invoke net80211 free handler */
+}
+.Ed
+.Pp
+Beware that care must be taken to avoid holding references that
+might cause nodes from being reclaimed.
+.Nm net80211
+will reclaim a node when the last reference is reclaimed in
+its data structures.
+However if a driver holds additional references then
+.Nm net80211
+will not recognize this and table entries will not be reclaimed.
+Such references should not be needed if the driver overrides the
+.Vt ic_node_cleanup
+and/or
+.Vt ic_node_free
+methods.
+.Sh KEY TABLE SUPPORT
+Node table lookups are typically done using a hash of the stations'
+mac address.
+When receiving frames this is sufficient to find the node table entry
+for the transmitter.
+But some devices also identify the sending station in the device
+state received with each frame and this data can be used to optimize
+lookups on receive using a companion table called the
+.Dq keytab .
+This table records a separate node table reference that can be fetched
+without any locking using the table index.
+This logic is handled with the
+.Fn ieee80211_find_rxnode_withkey
+call: if a keytab entry is found using the specified index then it is
+returned directly; otherwise a normal lookup is done and the keytab
+entry is written using the specified index.
+If the specified index is
+.Dv IEEE80211_KEYIX_NONE
+then a normal lookup is done without a table update.
+.Sh SEE ALSO
+.Xr ddb 9 ,
+.Xr ieee80211 9 ,
+.Xr ieee80211_proto 9
diff --git a/share/man/man9/ieee80211_output.9 b/share/man/man9/ieee80211_output.9
new file mode 100644
index 000000000000..6a8d3a71e0d8
--- /dev/null
+++ b/share/man/man9/ieee80211_output.9
@@ -0,0 +1,194 @@
+.\"
+.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>
+.\" Copyright (c) 2004 Darron Broad <darron@kewl.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" $Id: ieee80211_output.9,v 1.5 2004/03/04 12:31:18 bruce Exp $
+.\"
+.Dd March 29, 2010
+.Dt IEEE80211_OUTPUT 9
+.Os
+.Sh NAME
+.Nm ieee80211_output
+.Nd software 802.11 stack output functions
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.\"
+.Ft int
+.Fn M_WME_GETAC "struct mbuf *"
+.\"
+.Ft int
+.Fn M_SEQNO_GET "struct mbuf *"
+.\"
+.Ft struct ieee80211_key *
+.Fn ieee80211_crypto_encap "struct ieee80211_node *" "struct mbuf *"
+.\"
+.Ft void
+.Fo ieee80211_process_callback
+.Fa "struct ieee80211_node *"
+.Fa "struct mbuf *"
+.Fa "int"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer that supports 802.11 device drivers handles most of the
+work required to transmit frames.
+Drivers usually receive fully-encapsulated 802.11 frames that
+have been classified and assigned a transmit priority;
+all that is left is to do
+crypto encapsulation,
+prepare any hardware-specific state,
+and
+push the packet out to the device.
+Outbound frames are either generated by the
+.Nm net80211
+layer (e.g. management frames) or are passed down
+from upper layers through the
+.Xr ifnet 9
+transmit queue.
+Data frames passed down for transmit flow through
+.Nm net80211
+which handles aggregation, 802.11 encapsulation, and then
+dispatches the frames to the driver through it's transmit queue.
+.Pp
+There are two control paths by which frames reach a driver for transmit.
+Data packets are queued to the device's
+.Vt if_snd
+queue and the driver's
+.Vt if_start
+method is called.
+Other frames are passed down using the
+.Vt ic_raw_xmit
+method without queueing (unless done by the driver).
+The raw transmit path may include data frames from user applications
+that inject them through
+.Xr bpf 4
+and NullData frames generated by
+.Nm net80211
+to probe for idle stations (when operating as an access point).
+.Pp
+.Nm net80211
+handles all state-related bookkeeping and management for the handling
+of data frames.
+Data frames are only transmit for a vap in the
+.Dv IEEE80211_S_RUN
+state; there is no need, for example, to check for frames sent down
+when CAC or CSA is active.
+Similarly,
+.Nm net80211
+handles activities such as background scanning and power save mode,
+frames will not be sent to a driver unless it is operating on the
+BSS channel with
+.Dq full power .
+.Pp
+All frames passed to a driver for transmit hold a reference to a
+node table entry in the
+.Vt m_pkthdr.rcvif
+field.
+The node is associated with the frame destination.
+Typically it is the receiver's entry but in some situations it may be
+a placeholder entry or the
+.Dq next hop station
+(such as in a mesh network).
+In all cases the reference must be reclaimed with
+.Fn ieee80211_free_node
+when the transmit work is completed.
+The rule to remember is:
+.Nm net80211
+passes responsibility for the
+.Vt mbuf
+and
+.Dq node reference
+to the driver with each frame it hands off for transmit.
+.Sh PACKET CLASSIFICATION
+All frames passed by
+.Nm net80211
+for transmit are assigned a priority based on any vlan tag
+assigned to the receiving station and/or any Diffserv setting
+in an IP or IPv6 header.
+If both vlan and Diffserv priority are present the higher of the
+two is used.
+If WME/WMM is being used then any ACM policy (in station mode) is
+also enforced.
+The resulting AC is attached to the mbuf and may be read back using the
+.Fn M_WME_GETAC
+macro.
+.Pp
+PAE/EAPOL frames are tagged with an
+.Dv M_EAPOL
+mbuf flag; drivers should transmit them with care, usually by
+using the transmit rate for management frames.
+Multicast/broadcast frames are marked with the
+.Dv M_MCAST
+mbuf flag.
+Frames coming out of a station's power save queue and that have
+more frames immediately following are marked with the
+.Dv M_MORE_DATA
+mbuf flag.
+Such frames will be queued consecutively in the driver's
+.Vt if_snd
+queue and drivers should preserve the ordering when passing
+them to the device.
+.Sh FRAGMENTED FRAMES
+The
+.Nm net80211
+layer will fragment data frames according to the setting of
+.Vt iv_fragthreshold
+if a driver marks the
+.Dv IEEE80211_C_TXFRAG
+capability.
+Fragmented frames are placed
+in the devices transmit queue with the fragments chained together with
+.Vt m_nextpkt .
+Each frame is marked with the
+.Dv M_FRAG
+mbuf flag, and the first and last are marked with
+.Dv M_FIRSTFRAG
+and
+.Dv M_LASTFRAG ,
+respectively.
+Drivers are expected to process all fragments or none.
+.Sh TRANSMIT CALLBACKS
+Frames sent by
+.Nm net80211
+may be tagged with the
+.Dv M_TXCB
+mbuf flag to indicate a callback should be done
+when their transmission completes.
+The callback is done using
+.Fn ieee80211_process_callback
+with the last parameter set to a non-zero value if an error occurred
+and zero otherwise.
+Note
+.Nm net80211
+understands that drivers may be incapable of determining status;
+a device may not report if an ACK frame is received and/or a device may queue
+transmit requests in its hardware and only report status on whether
+the frame was successfully queued.
+.Sh SEE ALSO
+.Xr bpf 4 ,
+.Xr ieee80211 9 ,
+.Xr ifnet 9
diff --git a/share/man/man9/ieee80211_proto.9 b/share/man/man9/ieee80211_proto.9
new file mode 100644
index 000000000000..88412eb35333
--- /dev/null
+++ b/share/man/man9/ieee80211_proto.9
@@ -0,0 +1,241 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_PROTO 9
+.Os
+.Sh NAME
+.Nm ieee80211_proto
+.Nd 802.11 state machine support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Pp
+.Ft void
+.Fn ieee80211_start_all "struct ieee80211com *"
+.Ft void
+.Fn ieee80211_stop_all "struct ieee80211com *"
+.Ft void
+.Fn ieee80211_suspend_all "struct ieee80211com *"
+.Ft void
+.Fn ieee80211_resume_all "struct ieee80211com *"
+.Pp
+.Dv enum ieee80211_state ;
+.Ft int
+.Fn ieee80211_new_state "struct ieee80211vap *" "enum ieee80211_state" "int"
+.Pp
+.Ft void
+.Fn ieee80211_wait_for_parent "struct ieee80211com *"
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer that supports 802.11 device drivers uses a state machine
+to control operation of vaps.
+These state machines vary according to the vap operating mode.
+Station mode state machines follow the 802.11 MLME states
+in the protocol specification.
+Other state machines are simpler and reflect operational work
+such as scanning for a BSS or automatically selecting a channel to
+operate on.
+When multiple vaps are operational the state machines are used to
+coordinate operation such as choosing a channel.
+The state machine mechanism also serves to bind the
+.Nm net80211
+layer to a driver; this is described more below.
+.Pp
+The following states are defined for state machines:
+.Bl -tag -width IEEE80211_S_ASSOC
+.It Dv IEEE80211_S_INIT
+Default/initial state.
+A vap in this state should not hold any dynamic state (e.g. entries
+for associated stations in the node table).
+The driver must quiesce the hardware; e.g. there should be no
+interrupts firing.
+.It Dv IEEE80211_S_SCAN
+Scanning for a BSS or choosing a channel to operate on.
+Note that scanning can also take place in other states (e.g. when
+background scanning is active); this state is entered when
+initially bringing a vap to an operational state or after an
+event such as a beacon miss (in station mode).
+.It Dv IEEE80211_S_AUTH
+Authenticating to an access point (in station mode).
+This state is normally reached from
+.Dv IEEE80211_S_SCAN
+after selecting a BSS, but may also be reached from
+.Dv IEEE80211_S_ASSOC
+or
+.Dv IEEE80211_S_RUN
+if the authentication handshake fails.
+.It Dv IEEE80211_S_ASSOC
+Associating to an access point (in station mode).
+This state is reached from
+.Dv IEEE80211_S_AUTH
+after successfully authenticating or from
+.Dv IEEE80211_S_RUN
+if a DisAssoc frame is received.
+.It Dv IEEE80211_S_CAC
+Doing Channel Availability Check (CAC).
+This state is entered only when DFS is enabled and the channel selected
+for operation requires CAC.
+.It Dv IEEE80211_S_RUN
+Operational.
+In this state a vap can transmit data frames, accept requests for
+stations associating, etc.
+Beware that data traffic is also gated by whether the associated
+.Dq port
+is authorized.
+When WPA/802.11i/802.1x is operational authorization may happen separately;
+e.g. in station mode
+.Xr wpa_supplicant 8
+must complete the handshakes and plumb the necessary keys before a port
+is authorized.
+In this state a BSS is operational and associated state is valid and may
+be used; e.g.
+.Vt ic_bss
+and
+.Vt ic_bsschan
+are guaranteed to be usable.
+.It Dv IEEE80211_S_CSA
+Channel Switch Announcement (CSA) is pending.
+This state is reached only from
+.Dv IEEE80211_S_RUN
+when either a CSA is received from an access point (in station mode)
+or the local station is preparing to change channel.
+In this state traffic may be muted depending on the Mute setting in the CSA.
+.It Dv IEEE80211_S_SLEEP
+Asleep to save power (in station mode).
+This state is reached only from
+.Dv IEEE80211_S_RUN
+when power save operation is enabled and the local station is deemed
+sufficiently idle to enter low power mode.
+.El
+.Pp
+Note that states are ordered (as shown above);
+e.g. a vap must be in the
+.Dv IEEE80211_S_RUN
+or
+.Dq greater
+before it can transmit frames.
+Certain
+.Nm net80211
+data are valid only in certain states; e.g. the
+.Vt iv_bsschan
+that specifies the channel for the operating BSS should never be used
+except in
+.Dv IEEE80211_S_RUN
+or greater.
+.Sh STATE CHANGES
+State machine changes are typically handled internal to the
+.Nm net80211
+layer in response to
+.Xr ioctl 2
+requests, received frames, or external events such as a beacon miss.
+The
+.Fn ieee80211_new_state
+function is used to initiate a state machine change on a vap.
+The new state and an optional argument are supplied.
+The request is initially processed to handle coordination of multiple vaps.
+For example, only one vap at a time can be scanning, if multiple vaps
+request a change to
+.Dv IEEE80211_S_SCAN
+the first will be permitted to run and the others will be
+.Em deferred
+until the scan operation completes at which time the selected channel
+will be adopted.
+Similarly
+.Nm net80211
+handles coordination of combinations of vaps such as an AP and station vap
+where the station may need to roam to follow the AP it is associated to
+(dragging along the AP vap to the new channel).
+Another important coordination is the handling of
+.Dv IEEE80211_S_CAC
+and
+.Dv IEEE80211_S_CSA .
+No more than one vap can ever be actively changing state at a time.
+In fact
+.Nm net80211
+single-threads the state machine logic in a dedicated
+.Xr taskqueue 9
+thread that is also used to synchronize work such as scanning and
+beacon miss handling.
+.Pp
+After multi-vap scheduling/coordination is done the per-vap
+.Vt iv_newstate
+method is called to carry out the state change work.
+Drivers use this entry to setup private state and then dispatch
+the call to the
+.Nm net80211
+layer using the previously defined method pointer (in OOP-parlance they
+call the
+.Dq super method
+).
+.Pp
+.Nm net80211
+handles two state changes specially.
+On transition to
+.Dv IEEE80211_S_RUN
+the
+.Dv IFF_DRV_OACTIVE
+bit on the vap's transmit queue is cleared so traffic can flow.
+On transition to
+.Dv IEEE80211_S_INIT
+any state in the scan cache associated with the vap is flushed
+and any frames pending on the transmit queue are flushed.
+.Sh DRIVER INTEGRATION
+Drivers are expected to override the
+.Vt iv_newstate
+method to interpose their own code and handle setup work required
+by state changes.
+Otherwise drivers must call
+.Fn ieee80211_start_all
+in response to being marked up through an
+.Dv SIOCSIFFLAGS
+ioctl request and they should use
+.Fn ieee80211_suspend_all
+and
+.Fn ieee80211_resume_all
+to implement suspend/resume support.
+.Pp
+There is also an
+.Fn ieee80211_stop_all
+call to force all vaps to an
+.Dv IEEE80211_S_INIT
+state but this should not be needed by a driver; control is usually
+handled by
+.Nm net80211
+or, in the case of card eject or vap destroy,
+work will be initiated outside the driver.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr wpa_supplicant 8 ,
+.Xr ieee80211 9 ,
+.Xr ifnet 9 ,
+.Xr taskqueue 9
+.Sh HISTORY
+The state machine concept was part of the original
+.Nm ieee80211
+code base that first appeared in
+.Nx 1.5 ,
diff --git a/share/man/man9/ieee80211_radiotap.9 b/share/man/man9/ieee80211_radiotap.9
new file mode 100644
index 000000000000..cea2eb4e7f1a
--- /dev/null
+++ b/share/man/man9/ieee80211_radiotap.9
@@ -0,0 +1,302 @@
+.\"
+.\" Copyright (c) 2004 Bruce M. Simpson <bms@spc.org>,
+.\" Darron Broad <darron@kewl.org>,
+.\" David Young <dyoung@pobox.com>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_RADIOTAP 9
+.Os
+.Sh NAME
+.Nm ieee80211_radiotap
+.Nd 802.11 device packet capture support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.\"
+.Pp
+.Ft void
+.Fo ieee80211_radiotap_attach
+.Fa "struct ieee80211com *"
+.Fa "struct ieee80211_radiotap_header *th"
+.Fa "int tlen"
+.Fa "uint32_t tx_radiotap"
+.Fa "struct ieee80211_radiotap_header *rh"
+.Fa "int rlen"
+.Fa "uint32_t rx_radiotap"
+.Fc
+.\"
+.Ft int
+.Fn ieee80211_radiotap_active_vap "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_radiotap_active "struct ieee80211com *"
+.\"
+.Ft void
+.Fn ieee80211_radiotap_tx "struct ieee80211vap *" "struct mbuf *"
+.Sh DESCRIPTION
+The
+.Nm net80211
+layer used by 802.11 drivers includes support for a device-independent
+packet capture format called
+.Nm radiotap
+that is understood by tools such as
+.Xr tcpdump 1 .
+This facility is designed for capturing 802.11 traffic,
+including information that is not part of the normal 802.11 frame structure.
+.Pp
+Radiotap was designed to balance the desire for a hardware-independent,
+extensible capture format against the need to
+conserve CPU and memory bandwidth on embedded systems.
+These considerations led to a format consisting of
+a standard preamble followed by an extensible bitmap indicating the
+presence of optional capture fields.
+A
+.Nm net80211
+device driver supporting
+.Vt radiotap
+defines two packed structures that it shares with
+.Nm net80211 .
+These structures embed an instance of a
+.Vt ieee80211_radiotap_header
+structure at the beginning,
+with subsequent fields in the appropriate order,
+and macros to set the bits of the
+.Va it_present
+bitmap to indicate which fields exist and are filled in by the driver.
+This information is then supplied through the
+.Fn ieee80211_radiotap_attach
+call after a successful
+.Fn ieee80211_ifattach
+request.
+.Pp
+With radiotap setup, drivers just need to fill in per-packet
+capture state for frames sent/received and dispatch capture state
+in the transmit path (since control is not returned to the
+.Nm net80211
+layer before the packet is handed to the device).
+To minimize overhead this work should be done only when one
+or more processes are actively capturing data;
+this is checked with one of
+.Fn ieee80211_radiotap_active_vap
+and
+.Fn ieee80211_radiotap_active .
+In the transmit path capture work looks like this:
+.Bd -literal -offset indent
+if (ieee80211_radiotap_active_vap(vap)) {
+ ... /* record transmit state */
+ ieee80211_radiotap_tx(vap, m); /* capture transmit event */
+}
+.Ed
+.Pp
+While in the receive path capture is handled in
+.Nm net80211
+but state must be captured before dispatching a frame:
+.Bd -literal -offset indent
+if (ieee80211_radiotap_active(ic)) {
+ ... /* record receive state */
+}
+\&...
+ieee80211_input(...); /* packet capture handled in net80211 */
+.Ed
+.Pp
+.\"
+The following fields are defined for
+.Vt radiotap ,
+in the order in which they should appear in the buffer supplied
+to
+.Nm net80211 .
+.Bl -tag -width indent
+.It Dv IEEE80211_RADIOTAP_TSFT
+This field contains the unsigned 64-bit value, in microseconds,
+of the MAC's 802.11 Time Synchronization Function (TSF).
+In theory, for each received frame, this value is recorded
+when the first bit of the MPDU arrived at the MAC.
+In practice, hardware snapshots the TSF otherwise and one cannot assume
+this data is accurate without driver adjustment.
+.It Dv IEEE80211_RADIOTAP_FLAGS
+This field contains a single unsigned 8-bit value, containing one or
+more of these bit flags:
+.Bl -tag -width indent
+.It Dv IEEE80211_RADIOTAP_F_CFP
+Frame was sent/received during the Contention Free Period (CFP).
+.It Dv IEEE80211_RADIOTAP_F_SHORTPRE
+Frame was sent/received with short preamble.
+.It Dv IEEE80211_RADIOTAP_F_WEP
+Frame was encrypted.
+.It Dv IEEE80211_RADIOTAP_F_FRAG
+Frame was an 802.11 fragment.
+.It Dv IEEE80211_RADIOTAP_F_FCS
+Frame contents includes the FCS.
+.It Dv IEEE80211_RADIOTAP_F_DATAPAD
+Frame contents potentially has padding between the 802.11 header and the
+data payload to align the payload to a 32-bit boundary.
+.It Dv IEEE80211_RADIOTAP_F_BADFCS
+Frame was received with an invalid FCS.
+.It Dv IEEE80211_RADIOTAP_F_SHORTGI
+Frame was sent/received with Short Guard Interval.
+.El
+.It Dv IEEE80211_RADIOTAP_RATE
+This field contains a single unsigned 8-bit value that is the data rate.
+Legacy rates are in units of 500Kbps.
+MCS rates (used on 802.11n/HT channels) have the high bit set and
+the MCS in the low 7 bits.
+.It Dv IEEE80211_RADIOTAP_CHANNEL
+This field contains two unsigned 16-bit values.
+The first value is the center frequency for the channel
+the frame was sent/received on.
+The second value is a bitmap containing flags that specify channel properties.
+.Pp
+This field is deprecated in favor of
+.Dv IEEE80211_RADIOTAP_XCHANNEL
+but may be used to save space in the capture file for legacy devices.
+.\".It Dv IEEE80211_RADIOTAP_FHSS
+.\"This field contains two 8-bit values.
+.\"This field should be present only for frequency-hopping radios.
+.\"The first byte is the hop set.
+.\"The second byte is the pattern in use.
+.It Dv IEEE80211_RADIOTAP_DBM_ANTSIGNAL
+This field contains a single signed 8-bit value that indicates the
+RF signal power at the antenna, in decibels difference from 1mW.
+.It Dv IEEE80211_RADIOTAP_DBM_ANTNOISE
+This field contains a single signed 8-bit value that indicates the
+RF noise power at the antenna, in decibels difference from 1mW.
+.\".It Dv IEEE80211_RADIOTAP_LOCK_QUALITY
+.\"This field contains a single unsigned 16-bit value, indicating the
+.\"quality of the Barker Code lock.
+.\"No unit is specified for this field.
+.\"There does not appear to be a standard way of measuring this at this time;
+.\"this quantity is often referred to as
+.\".Dq "Signal Quality"
+.\"in some datasheets.
+.\".It Dv IEEE80211_RADIOTAP_TX_ATTENUATION
+.\"This field contains a single unsigned 16-bit value, expressing transmit
+.\"power as unitless distance from maximum power set at factory calibration.
+.\"0 indicates maximum transmit power.
+.\"Monotonically nondecreasing with lower power levels.
+.\".It Dv IEEE80211_RADIOTAP_DB_TX_ATTENUATION
+.\"This field contains a single unsigned 16-bit value, expressing transmit
+.\"power as decibel distance from maximum power set at factory calibration.
+.\"0 indicates maximum transmit power.
+.\"Monotonically nondecreasing with lower power levels.
+.It Dv IEEE80211_RADIOTAP_DBM_TX_POWER
+Transmit power expressed as decibels from a 1mW reference.
+This field is a single signed 8-bit value.
+This is the absolute power level measured at the antenna port.
+.It Dv IEEE80211_RADIOTAP_ANTENNA
+This field contains a single unsigned 8-bit value that specifies
+which antenna was used to transmit or receive the frame.
+Antenna numbering is device-specific but typically the primary antenna has
+the lowest number.
+On transmit a value of zero may be seen which typically means
+antenna selection is left to the device.
+.It Dv IEEE80211_RADIOTAP_DB_ANTSIGNAL
+This field contains a single unsigned 8-bit value that indicates the
+RF signal power at the antenna, in decibels difference from an
+arbitrary, fixed reference.
+.It Dv IEEE80211_RADIOTAP_DB_ANTNOISE
+This field contains a single unsigned 8-bit value that indicates the
+RF noise power at the antenna, in decibels difference from an
+arbitrary, fixed reference.
+.It Dv IEEE80211_RADIOTAP_XCHANNEL
+This field contains four values: a 32-bit unsigned bitmap of
+flags that describe the channel attributes, a 16-bit unsigned
+frequency in MHz (typically the channel center), an 8-bit
+unsigned IEEE channel number, and a signed 8-bit value that
+holds the maximum regulatory transmit power cap in .5 dBm
+(8 bytes total).
+Channel flags are defined in:
+.In net80211/_ieee80211.h
+(only a subset are found in
+.In net80211/ieee80211_radiotap.h ).
+This property supersedes
+.Dv IEEE80211_RADIOTAP_CHANNEL
+and is the only way to completely express all
+channel attributes and the
+mapping between channel frequency and IEEE channel number.
+.El
+.Sh EXAMPLES
+Radiotap receive definitions for the Intersil Prism driver:
+.Bd -literal -offset indent
+#define WI_RX_RADIOTAP_PRESENT \\
+ ((1 << IEEE80211_RADIOTAP_TSFT) \\
+ (1 << IEEE80211_RADIOTAP_FLAGS) | \\
+ (1 << IEEE80211_RADIOTAP_RATE) | \\
+ (1 << IEEE80211_RADIOTAP_CHANNEL) | \\
+ (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \\
+ (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))
+
+struct wi_rx_radiotap_header {
+ struct ieee80211_radiotap_header wr_ihdr;
+ uint64_t wr_tsf;
+ uint8_t wr_flags;
+ uint8_t wr_rate;
+ uint16_t wr_chan_freq;
+ uint16_t wr_chan_flags;
+ uint8_t wr_antsignal;
+ uint8_t wr_antnoise;
+} __packed;
+.Ed
+.Pp
+and transmit definitions for the Atheros driver:
+.Bd -literal -offset indent
+#define ATH_TX_RADIOTAP_PRESENT ( \\
+ (1 << IEEE80211_RADIOTAP_TSFT) | \\
+ (1 << IEEE80211_RADIOTAP_FLAGS) | \\
+ (1 << IEEE80211_RADIOTAP_RATE) | \\
+ (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \\
+ (1 << IEEE80211_RADIOTAP_ANTENNA) | \\
+ (1 << IEEE80211_RADIOTAP_XCHANNEL) | \\
+ 0)
+
+struct ath_tx_radiotap_header {
+ struct ieee80211_radiotap_header wt_ihdr;
+ uint64_t wt_tsf;
+ uint8_t wt_flags;
+ uint8_t wt_rate;
+ uint8_t wt_txpower;
+ uint8_t wt_antenna;
+ uint32_t wt_chan_flags;
+ uint16_t wt_chan_freq;
+ uint8_t wt_chan_ieee;
+ int8_t wt_chan_maxpow;
+} __packed;
+.Ed
+.Sh SEE ALSO
+.Xr tcpdump 1 ,
+.Xr bpf 4 ,
+.Xr ieee80211 9
+.Sh HISTORY
+The
+.Nm
+definitions first appeared in
+.Nx 1.5 .
+.\"
+.Sh AUTHORS
+.An -nosplit
+The original version of this manual page was written by
+.An Bruce M. Simpson Aq bms@FreeBSD.org
+and
+.An Darron Broad Aq darron@kewl.org .
diff --git a/share/man/man9/ieee80211_regdomain.9 b/share/man/man9/ieee80211_regdomain.9
new file mode 100644
index 000000000000..da310ddc7232
--- /dev/null
+++ b/share/man/man9/ieee80211_regdomain.9
@@ -0,0 +1,143 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE80211_REGDOMAIN 9
+.Os
+.Sh NAME
+.Nm ieee80211_regdomain
+.Nd 802.11 regulatory support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.In net80211/ieee80211_regdomain.h
+.Pp
+.Ft int
+.Fo ieee80211_init_channels
+.Fa "struct ieee80211com *"
+.Fa "const struct ieee80211_regdomain *"
+.Fa "const uint8_t bands[]"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_sort_channels
+.Fa "struct ieee80211_channel *"
+.Fa "int nchans"
+.Fc
+.\"
+.Ft "struct ieee80211_appie *"
+.Fn ieee80211_alloc_countryie "struct ieee80211com *"
+.Sh DESCRIPTION
+The
+.Nm net80211
+software layer provides a support framework for drivers that includes
+comprehensive regulatory support.
+.Nm net80211
+provides mechanisms that enforce
+.Em "regulatory policy"
+by privileged user applications.
+.Pp
+Drivers define a device's capabilities and can
+intercept and control regulatory changes requested through
+.Nm net80211 .
+The initial regulatory state, including the channel list, must be
+filled in by the driver before calling
+.Fn ieee80211_ifattach .
+The channel list should reflect the set of channels the device is
+.Em calibrated
+for use on.
+This list may also be requested later through the
+.Vt ic_getradiocaps
+method in the
+.Vt ieee80211com
+structure.
+The
+.Fn ieee80211_init_channels
+function is provided as a rudimentary fallback for drivers that do not
+(or cannot) fill in a proper channel list.
+Default regulatory state is supplied such as the regulatory SKU,
+ISO country code, location (e.g. indoor, outdoor), and a set of
+frequency bands the device is capable of operating on.
+.Nm net80211
+populates the channel table in
+.Vt ic_channels
+with a default set of channels and capabilities.
+Note this mechanism should be used with care as any mismatch between
+the channel list created and the device's capabilities can result
+in runtime errors (e.g. a request to operate on a channel the device
+does not support).
+The SKU and country information are used for generating 802.11h protocol
+elements and related operation such as for 802.11d; mis-setup by a
+driver is not fatal, only potentially confusing.
+.Pp
+Devices that do not have a fixed/default regulatory state can set
+the regulatory SKU to
+.Dv SKU_DEBUG
+and country code to
+.Dv CTRY_DEFAULT
+and leave proper setup to user applications.
+If default settings are known they can be installed and/or an event
+can be dispatched to user space using
+.Fn ieee80211_notify_country
+so that
+.Xr devd 8
+will do the appropriate setup work at system boot (or device insertion).
+.Pp
+The channel table is sorted to optimize lookups using the
+.Fn ieee80211_sort_channels
+routine.
+This should be done whenever the channel table contents are modified.
+.Pp
+The
+.Fn ieee80211_alloc_countryie
+function allocates an information element as specified by 802.11h.
+Because this is expensive to generate it is cached in
+.Vt ic_countryie
+and generated only when regulatory state changes.
+Drivers that call
+.Fn ieee80211_alloc_countryie
+directly should not help with this caching; doing so may confuse the
+.Nm net80211
+layer.
+.Sh DRIVER REGULATORY CONTROL
+Drivers can control regulatory change requests by overriding the
+.Vt ic_setregdomain
+method that checks change requests.
+While drivers can reject any request that does not meet its requirements
+it is recommended that one be lenient in what is accepted and, whenever
+possible, instead of rejecting a request, alter it to be correct.
+For example, if the transmit power cap for a channel is too high the
+driver can either reject the request or (better) reduce the cap to be
+compliant.
+Requests that include unacceptable channels should cause the request
+to be rejected as otherwise a mismatch may be created between application
+state and the state managed by
+.Nm net80211 .
+The exact rules by which to operate are still being codified.
+.Sh SEE ALSO
+.Xr regdomain 5 ,
+.Xr ifconfig 8 ,
+.Xr ieee80211 9
diff --git a/share/man/man9/ieee80211_scan.9 b/share/man/man9/ieee80211_scan.9
new file mode 100644
index 000000000000..54cefa750645
--- /dev/null
+++ b/share/man/man9/ieee80211_scan.9
@@ -0,0 +1,350 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2010
+.Dt IEEE80211_SCAN 9
+.Os
+.Sh NAME
+.Nm ieee80211_scan
+.Nd 802.11 scanning support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Pp
+.Ft int
+.Fo ieee80211_start_scan
+.Fa "struct ieee80211vap *"
+.Fa "int flags"
+.Fa "u_int duration"
+.Fa "u_int mindwell"
+.Fa "u_int maxdwell"
+.Fa "u_int nssid"
+.Fa "const struct ieee80211_scan_ssid ssids[]"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_check_scan
+.Fa "struct ieee80211vap *"
+.Fa "int flags"
+.Fa "u_int duration"
+.Fa "u_int mindwell"
+.Fa "u_int maxdwell"
+.Fa "u_int nssid"
+.Fa "const struct ieee80211_scan_ssid ssids[]"
+.Fc
+.\"
+.Ft int
+.Fn ieee80211_check_scan_current "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_bg_scan "struct ieee80211vap *" "int"
+.\"
+.Ft int
+.Fn ieee80211_cancel_scan "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_cancel_scan_any "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_scan_next "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_scan_done "struct ieee80211vap *"
+.\"
+.Ft int
+.Fn ieee80211_probe_curchan "struct ieee80211vap *" "int"
+.\"
+.Ft void
+.Fo ieee80211_add_scan
+.Fa "struct ieee80211vap *"
+.Fa "const struct ieee80211_scanparams *"
+.Fa "const struct ieee80211_frame *"
+.Fa "int subtype"
+.Fa "int rssi"
+.Fa "int noise"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_scan_timeout "struct ieee80211com *"
+.\"
+.Ft void
+.Fo ieee80211_scan_assoc_fail
+.Fa "struct ieee80211vap *"
+.Fa "const uint8_t mac[IEEE80211_ADDR_LEN]"
+.Fa "int reason"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_scan_flush "struct ieee80211vap *"
+.\"
+.Ft void
+.Fo ieee80211_scan_iterate
+.Fa "struct ieee80211vap *"
+.Fa "ieee80211_scan_iter_func"
+.Fa "void *"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_scan_dump_channels "const struct ieee80211_scan_state *"
+.\"
+.Ft void
+.Fo ieee80211_scanner_register
+.Fa "enum ieee80211_opmode"
+.Fa "const struct ieee80211_scanner *"
+.Fc
+.\"
+.Ft void
+.Fo ieee80211_scanner_unregister
+.Fa "enum ieee80211_opmode"
+.Fa "const struct ieee80211_scanner *"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_scanner_unregister_all "const struct ieee80211_scanner *"
+.\"
+.Ft const struct ieee80211_scanner *
+.Fn ieee80211_scanner_get "enum ieee80211_opmode"
+.Sh DESCRIPTION
+The
+.Nm net80211
+software layer provides an extensible framework for scanning.
+Scanning is the procedure by which a station locates a BSS to join
+(in infrastructure and IBSS mode), or a channel to use (when operating
+as an AP or an IBSS master).
+Scans are either
+.Dq active
+or
+.Dq passive .
+An active scan causes one or more ProbeRequest frames to be sent on
+visiting each channel.
+A passive request causes each channel in the scan set to be visited but
+no frames to be transmitted; the station only listens for traffic.
+Note that active scanning may still need to listen for traffic before
+sending ProbeRequest frames depending on regulatory constraints.
+.Pp
+A scan operation involves constructing a set of channels to inspect
+(the scan set),
+visiting each channel and collecting information
+(e.g. what BSS are present),
+and then analyzing the results to make decisions such as which BSS to join.
+This process needs to be as fast as possible so
+.Nm net80211
+does things like intelligently construct scan sets and dwell on a channel
+only as long as necessary.
+Scan results are cached and the scan cache is used to avoid scanning when
+possible and to enable roaming between access points when operating
+in infrastructure mode.
+.Pp
+Scanning is handled by pluggable modules that implement
+.Em policy
+per-operating mode.
+The core scanning support provides an infrastructure to support these
+modules and exports a common API to the rest of the
+.Nm net80211
+layer.
+Policy modules decide what channels to visit, what state to record to
+make decisions, and selects the final station/channel to return as the
+result of a scan.
+.Pp
+Scanning is done synchronously when initially bringing a vap to
+an operational state and optionally in the background to maintain
+the scan cache for doing roaming and rogue AP monitoring.
+Scanning is not tied to the
+.Nm net80211
+state machine that governs vaps except for linkage to the
+.Dv IEEE80211_S_SCAN
+state.
+Only one vap at a time may be scanning; this scheduling policy
+is handled in
+.Fn ieee80211_new_state
+and is transparent to scanning code.
+.Pp
+Scanning is controlled by a set of parameters that (potentially)
+constrains the channel set and any desired SSID's and BSSID's.
+.Nm net80211
+comes with a standard scanner module that works with all available
+operating modes and supports
+.Dq background scanning
+and
+.Dq roaming
+operation.
+.Sh SCANNER MODULES
+Scanning modules use a registration mechanism to hook into the
+.Nm net80211
+layer.
+Use
+.Fn ieee80211_scanner_register
+to register a scan module for a particular operating mode and
+.Fn ieee80211_scanner_unregister
+or
+.Fn ieee80211_scanner_unregister_all
+to clear entries (typically on module unload).
+Only one scanner module can be registered at any time for an operating mode.
+.Sh DRIVER SUPPORT
+Scanning operations are usually managed by the
+.Nm net80211
+layer.
+Drivers must provide
+.Vt ic_scan_start
+and
+.Vt ic_scan_stop
+methods that are called at the start of a scan and when the
+work is done; these should handle work such as enabling receive
+of Beacon and ProbeResponse frames and disable any BSSID matching.
+The
+.Vt ic_set_channel
+method is used to change channels while scanning.
+.Nm net80211
+will generate ProbeRequest frames and transmit them using the
+.Nm ic_raw_xmit
+method.
+Frames received while scanning are dispatched to
+.Nm net80211
+using the normal receive path.
+Devices that off-load scan work to firmware most easily mesh with
+.Nm net80211
+by operating on a channel-at-a-time basis as this defers control to
+.Nm net80211's
+scan machine scheduler.
+But multi-channel scanning
+is supported if the driver manually dispatches results using
+.Fn ieee80211_add_scan
+routine to enter results into the scan cache.
+.Sh SCAN REQUESTS
+Scan requests occur by way of the
+.Dv IEEE80211_SCAN_REQUEST
+ioctl or through a change in a vap's state machine that requires
+scanning.
+In both cases the scan cache can be checked first and, if it is deemed
+suitably
+.Dq warm
+then it's contents are used without leaving the current channel.
+To start a scan without checking the cache
+.Fn ieee80211_start_scan
+can be called; otherwise
+.Fn ieee80211_check_scan
+can be used to first check the scan cache, kicking off a scan if
+the cache contents are out of date.
+There is also
+.Fn ieee80211_check_scan_current
+which is a shorthand for using previously set scan parameters for
+checking the scan cache and then scanning.
+.Pp
+Background scanning is done using
+.Fn ieee80211_bg_scan
+in a co-routine fashion.
+The first call to this routine will start a background scan that
+runs for a limited period of time before returning to the BSS channel.
+Subsequent calls advance through the scan set until all channels are
+visited.
+Typically these later calls are timed to allow receipt of
+frames buffered by an access point for the station.
+.Pp
+A scan operation can be canceled using
+.Fn ieee80211_cancel_scan
+if it was initiated by the specified vap, or
+.Fn ieee80211_cancel_scan_any
+to force termination regardless which vap started it.
+These requests are mostly used by
+.Nm net80211
+in the transmit path to cancel background scans when frames are to be sent.
+Drivers should not need to use these calls (or most of the calls described
+on this page).
+.Pp
+The
+.Fn ieee80211_scan_next
+and
+.Fn ieee80211_scan_done
+routines do explicit iteration through the scan set and should
+not normally be used by drivers.
+.Fn ieee80211_probe_curchan
+handles the work of transmitting ProbeRequest frames when visiting
+a channel during an active scan.
+When the channel attributes are marked with
+.Dv IEEE80211_CHAN_PASSIVE
+this function will arrange that before any frame is transmitted 802.11
+traffic is first received (in order to comply with regulatory constraints).
+.Pp
+Min/max dwell time parameters are used to constrain time spent visiting
+a channel.
+The maximum dwell time constrains the time spent listening for traffic.
+The minimum dwell time is used to reduce this time--when it is reached
+and one or more frames have been received then an immediate channel
+change will be done.
+Drivers can override this behaviour through the
+.Vt iv_scan_mindwell
+method.
+.Sh SCAN CACHE MANAGEMENT
+The scan cache contents are managed by the scan policy module and
+are opaque outside this module.
+The
+.Nm net80211
+scan framework defines API's for interacting.
+The validity of the scan cache contents are controlled by
+.Vt iv_scanvalid
+which is exported to user space through the
+.Dv IEEE80211_SCAN_VALID
+request.
+.Pp
+The cache contents can be explicitly flushed with
+.Fn ieee80211_scan_flush
+or by setting the
+.Dv IEEE80211_SCAN_FLUSH
+flag when starting a scan operation.
+.Pp
+Scan cache entries are created with the
+.Fn ieee80211_add_scan
+routine; usually on receipt of Beacon or ProbeResponse frames.
+Existing entries are typically updated based on the latest information
+though some information such as RSSI and noise floor readings may be
+combined to present an average.
+.Pp
+The cache contents is aged through
+.Fn ieee80211_scan_timeout
+calls.
+Typically these happen together with other station table activity; every
+.Dv IEEE80211_INACT_WAIT
+seconds (default 15).
+.Pp
+Individual cache entries are marked usable with
+.Fn ieee80211_scan_assoc_success
+and faulty with
+.Fn ieee80211_scan_assoc_fail
+with the latter taking an argument to identify if there was no response
+to Authentication/Association requests or if a negative response was
+received (which might hasten cache eviction or blacklist the entry).
+.Pp
+The cache contents can be viewed using the
+.Fn ieee80211_scan_iterate
+call.
+Cache entries are exported in a public format that is exported to user
+applications through the
+.Dv IEEE80211_SCAN_RESULTS
+request.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr ieee80211 9 ,
+.Xr ieee80211_proto 9
diff --git a/share/man/man9/ieee80211_vap.9 b/share/man/man9/ieee80211_vap.9
new file mode 100644
index 000000000000..0c68f6daefd2
--- /dev/null
+++ b/share/man/man9/ieee80211_vap.9
@@ -0,0 +1,154 @@
+.\"
+.\" Copyright (c) 2009 Sam Leffler, Errno Consulting
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 4, 2009
+.Dt IEEE8021_VAP 9
+.Os
+.Sh NAME
+.Nm net80211_vap
+.Nd 802.11 network layer virtual radio support
+.Sh SYNOPSIS
+.In net80211/ieee80211_var.h
+.Ft int
+.Fo ieee80211_vap_setup
+.Fa "struct ieee80211com *"
+.Fa "struct ieee80211vap *"
+.Fa "const char name[IFNAMSIZ]"
+.Fa "int unit"
+.Fa "int opmode"
+.Fa "int flags"
+.Fa "const uint8_t bssid[IEEE80211_ADDR_LEN]"
+.Fa "const uint8_t macaddr[IEEE80211_ADDR_LEN]"
+.Fc
+.\"
+.Ft int
+.Fo ieee80211_vap_attach
+.Fa "struct ieee80211vap *"
+.Fa "ifm_change_cb_t media_change"
+.Fa "ifm_stat_cb_t media_stat"
+.Fc
+.\"
+.Ft void
+.Fn ieee80211_vap_detach "struct ieee80211vap *"
+.Sh DESCRIPTION
+The
+.Nm net80211
+software layer provides a support framework for drivers that includes
+a virtual radio API that is exported to
+users through network interfaces (aka vaps) that are cloned from the
+underlying device.
+These interfaces have an operating mode
+(station, adhoc, hostap, wds, monitor, etc.)
+that is fixed for the lifetime of the interface.
+Devices that can support multiple concurrent interfaces allow
+multiple vaps to be cloned.
+.Pp
+The virtual radio interface defined by the
+.Nm net80211
+layer means that drivers must be structured to follow specific rules.
+Drivers that support only a single interface at any time must still
+follow these rules.
+.Pp
+The virtual radio architecture splits state between a single per-device
+.Vt ieee80211com
+structure and one or more
+.Vt ieee80211vap
+structures.
+Vaps are created with the
+.Dv SIOCIFCREATE2
+request.
+This results in a call into the driver's
+.Vt ic_vap_create
+method where the driver can decide if the request should be accepted.
+.Pp
+The vap creation process is done in three steps.
+First the driver allocates the data structure with
+.Xr malloc 9 .
+This data structure must have an
+.Vt ieee80211vap
+structure at the front but is usually extended with driver-private state.
+Next the vap is setup with a call to
+.Fn ieee80211_vap_setup .
+This request initializes
+.Nm net80211
+state but does not activate the interface.
+The driver can then override methods setup by
+.Nm net80211
+and setup driver resources before finally calling
+.Fn ieee80211_vap_attach
+to complete the process.
+Both these calls must be done without holding any driver locks as
+work may require the process block/sleep.
+.Pp
+A vap is deleted when an
+.Dv SIOCIFDESTROY
+ioctl request is made or when the device detaches (causing all
+associated vaps to automatically be deleted).
+Delete requests cause the
+.Vt ic_vap_delete
+method to be called.
+Drivers must quiesce the device before calling
+.Fn ieee80211_vap_detach
+to deactivate the vap and isolate it from activities such as requests
+from user applications.
+The driver can then reclaim resources held by the vap and re-enable
+device operation.
+The exact procedure for quiescing a device is unspecified but typically
+it involves blocking interrupts and stopping transmit and receive
+processing.
+.Sh MULTI-VAP OPERATION
+Drivers are responsible for deciding if multiple vaps can be created
+and how to manage them.
+Whether or not multiple concurrent vaps can be supported depends on a
+device's capabilities.
+For example, multiple hostap vaps can usually be supported but many
+devices do not support assigning each vap a unique BSSID.
+If a device supports hostap operation it can usually support concurrent
+station mode vaps but possibly with limitations such as losing support
+for hardware beacon miss support.
+Devices that are capable of hostap operation and can send and receive
+4-address frames should be able to support WDS vaps together with an
+ap vap.
+But in contrast some devices cannot support WDS vaps without at least one
+ap vap (this however can be finessed by forcing the ap vap to not transmit
+beacon frames).
+All devices should support the creation of any number of monitor mode vaps
+concurrent with other vaps but it is the responsibility of the driver to
+allow this.
+.Pp
+An important consequence of supporting multiple concurrent vaps is that
+a driver's
+.Vt iv_newstate
+method must be written to handle being called for each vap.
+Where necessary, drivers must track private state for all vaps
+and not just the one whose state is being changed (e.g. for
+handling beacon timers the driver may need to know if all vaps
+that beacon are stopped before stopping the hardware timers).
+.Sh SEE ALSO
+.Xr ieee80211 9 ,
+.Xr ifnet 9 ,
+.Xr malloc 9
diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9
new file mode 100644
index 000000000000..dd4fdf53e66c
--- /dev/null
+++ b/share/man/man9/ifnet.9
@@ -0,0 +1,1542 @@
+.\" -*- Nroff -*-
+.\" Copyright 1996, 1997 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 23, 2012
+.Dt IFNET 9
+.Os
+.Sh NAME
+.Nm ifnet ,
+.Nm ifaddr ,
+.Nm ifqueue ,
+.Nm if_data
+.Nd kernel interfaces for manipulating network interfaces
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/time.h
+.In sys/socket.h
+.In net/if.h
+.In net/if_var.h
+.In net/if_types.h
+.\"
+.Ss "Interface Manipulation Functions"
+.Ft "struct ifnet *"
+.Fn if_alloc "u_char type"
+.Ft void
+.Fn if_attach "struct ifnet *ifp"
+.Ft void
+.Fn if_detach "struct ifnet *ifp"
+.Ft void
+.Fn if_free "struct ifnet *ifp"
+.Ft void
+.Fn if_free_type "struct ifnet *ifp" "u_char type"
+.Ft void
+.Fn if_down "struct ifnet *ifp"
+.Ft int
+.Fn ifioctl "struct socket *so" "u_long cmd" "caddr_t data" "struct thread *td"
+.Ft int
+.Fn ifpromisc "struct ifnet *ifp" "int pswitch"
+.Ft int
+.Fn if_allmulti "struct ifnet *ifp" "int amswitch"
+.Ft "struct ifnet *"
+.Fn ifunit "const char *name"
+.Ft "struct ifnet *"
+.Fn ifunit_ref "const char *name"
+.Ft void
+.Fn if_up "struct ifnet *ifp"
+.\"
+.Ss "Interface Address Functions"
+.Ft "struct ifaddr *"
+.Fn ifaddr_byindex "u_short idx"
+.Ft "struct ifaddr *"
+.Fn ifa_ifwithaddr "struct sockaddr *addr"
+.Ft "struct ifaddr *"
+.Fn ifa_ifwithdstaddr "struct sockaddr *addr"
+.Ft "struct ifaddr *"
+.Fn ifa_ifwithnet "struct sockaddr *addr" "int ignore_ptp"
+.Ft "struct ifaddr *"
+.Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp"
+.Ft void
+.Fn ifa_ref "struct ifaddr *ifa"
+.Ft void
+.Fn ifa_free "struct ifaddr *ifa"
+.\"
+.Ss "Interface Multicast Address Functions"
+.Ft int
+.Fn if_addmulti "struct ifnet *ifp" "struct sockaddr *sa" "struct ifmultiaddr **ifmap"
+.Ft int
+.Fn if_delmulti "struct ifnet *ifp" "struct sockaddr *sa"
+.Ft "struct ifmultiaddr *"
+.Fn if_findmulti "struct ifnet *ifp" "struct sockaddr *sa"
+.Ss "Output queue macros"
+.Fn IF_DEQUEUE "struct ifqueue *ifq" "struct mbuf *m"
+.\"
+.Ss "struct ifnet Member Functions"
+.Ft void
+.Fn \*(lp*if_input\*(rp "struct ifnet *ifp" "struct mbuf *m"
+.Ft int
+.Fo \*(lp*if_output\*(rp
+.Fa "struct ifnet *ifp" "struct mbuf *m"
+.Fa "struct sockaddr *dst" "struct route *ro"
+.Fc
+.Ft void
+.Fn \*(lp*if_start\*(rp "struct ifnet *ifp"
+.Ft int
+.Fn \*(lp*if_transmit\*(rp "struct ifnet *ifp" "struct mbuf *m"
+.Ft void
+.Fn \*(lp*if_qflush\*(rp "struct ifnet *ifp"
+.Ft int
+.Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "u_long cmd" "caddr_t data"
+.Ft void
+.Fn \*(lp*if_init\*(rp "void *if_softc"
+.Ft int
+.Fo \*(lp*if_resolvemulti\*(rp
+.Fa "struct ifnet *ifp" "struct sockaddr **retsa" "struct sockaddr *addr"
+.Fc
+.Ss "struct ifaddr member function"
+.Ft void
+.Fo \*(lp*ifa_rtrequest\*(rp
+.Fa "int cmd" "struct rtentry *rt" "struct rt_addrinfo *info"
+.Fc
+.\"
+.Ss "Global Variables"
+.Vt extern struct ifnethead ifnet ;
+.\" extern struct ifindex_entry *ifindex_table ;
+.Vt extern int if_index ;
+.Vt extern int ifqmaxlen ;
+.Sh DATA STRUCTURES
+The kernel mechanisms for handling network interfaces reside primarily
+in the
+.Vt ifnet , if_data , ifaddr ,
+and
+.Vt ifmultiaddr
+structures in
+.In net/if.h
+and
+.In net/if_var.h
+and the functions named above and defined in
+.Pa /sys/net/if.c .
+Those interfaces which are intended to be used by user programs
+are defined in
+.In net/if.h ;
+these include the interface flags, the
+.Vt if_data
+structure, and the structures defining the appearance of
+interface-related messages on the
+.Xr route 4
+routing socket and in
+.Xr sysctl 3 .
+The header file
+.In net/if_var.h
+defines the kernel-internal interfaces, including the
+.Vt ifnet , ifaddr ,
+and
+.Vt ifmultiaddr
+structures and the functions which manipulate them.
+(A few user programs will need
+.In net/if_var.h
+because it is the prerequisite of some other header file like
+.In netinet/if_ether.h .
+Most references to those two files in particular can be replaced by
+.In net/ethernet.h . )
+.Pp
+The system keeps a linked list of interfaces using the
+.Li TAILQ
+macros defined in
+.Xr queue 3 ;
+this list is headed by a
+.Vt "struct ifnethead"
+called
+.Va ifnet .
+The elements of this list are of type
+.Vt "struct ifnet" ,
+and most kernel routines which manipulate interface as such accept or
+return pointers to these structures.
+Each interface structure
+contains an
+.Vt if_data
+structure used for statistics and information.
+Each interface also has a
+.Li TAILQ
+of interface addresses, described by
+.Vt ifaddr
+structures.
+An
+.Dv AF_LINK
+address
+(see
+.Xr link_addr 3 )
+describing the link layer implemented by the interface (if any)
+is accessed by the
+.Fn ifaddr_byindex
+function or
+.Va if_addr
+structure.
+(Some trivial interfaces do not provide any link layer addresses;
+this structure, while still present, serves only to identify the
+interface name and index.)
+.Pp
+Finally, those interfaces supporting reception of multicast datagrams
+have a
+.Li TAILQ
+of multicast group memberships, described by
+.Vt ifmultiaddr
+structures.
+These memberships are reference-counted.
+.Pp
+Interfaces are also associated with an output queue, defined as a
+.Vt "struct ifqueue" ;
+this structure is used to hold packets while the interface is in the
+process of sending another.
+.Pp
+.Ss The Vt ifnet Ss structure
+The fields of
+.Vt "struct ifnet"
+are as follows:
+.Bl -tag -width ".Va if_capabilities" -offset indent
+.It Va if_softc
+.Pq Vt "void *"
+A pointer to the driver's private state block.
+(Initialized by driver.)
+.It Va if_l2com
+.Pq Vt "void *"
+A pointer to the common data for the interface's layer 2 protocol.
+(Initialized by
+.Fn if_alloc . )
+.It Va if_vnet
+.Pq Vt "struct vnet *"
+A pointer to the virtual network stack instance.
+(Initialized by
+.Fn if_attach . )
+.It Va if_home_vnet
+.Pq Vt "struct vnet *"
+A pointer to the parent virtual network stack, where this
+.Vt "struct ifnet"
+originates from.
+(Initialized by
+.Fn if_attach . )
+.It Va if_link
+.Pq Fn TAILQ_ENTRY ifnet
+.Xr queue 3
+macro glue.
+.It Va if_xname
+.Pq Vt "char *"
+The name of the interface,
+(e.g.,
+.Dq Li fxp0
+or
+.Dq Li lo0 ) .
+(Initialized by driver
+(usually via
+.Fn if_initname ) . )
+.It Va if_dname
+.Pq Vt "const char *"
+The name of the driver.
+(Initialized by driver
+(usually via
+.Fn if_initname ) . )
+.It Va if_dunit
+.Pq Vt int
+A unique number assigned to each interface managed by a particular
+driver.
+Drivers may choose to set this to
+.Dv IF_DUNIT_NONE
+if a unit number is not associated with the device.
+(Initialized by driver
+(usually via
+.Fn if_initname ) . )
+.It Va if_refcount
+.Pq Vt u_int
+The reference count.
+(Initialized by
+.Fn if_alloc . )
+.It Va if_addrhead
+.Pq Vt "struct ifaddrhead"
+The head of the
+.Xr queue 3
+.Li TAILQ
+containing the list of addresses assigned to this interface.
+.It Va if_pcount
+.Pq Vt int
+A count of promiscuous listeners on this interface, used to
+reference-count the
+.Dv IFF_PROMISC
+flag.
+.It Va if_carp
+.Pq Vt "struct carp_if *"
+A pointer to the CARP interface structure,
+.Xr carp 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
+.It Va if_bpf
+.Pq Vt "struct bpf_if *"
+Opaque per-interface data for the packet filter,
+.Xr bpf 4 .
+(Initialized by
+.Fn bpf_attach . )
+.It Va if_index
+.Pq Vt u_short
+A unique number assigned to each interface in sequence as it is
+attached.
+This number can be used in a
+.Vt "struct sockaddr_dl"
+to refer to a particular interface by index
+(see
+.Xr link_addr 3 ) .
+(Initialized by
+.Fn if_alloc . )
+.It Va if_vlantrunk
+.Pq Vt struct ifvlantrunk *
+A pointer to 802.1Q trunk structure,
+.Xr vlan 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
+.It Va if_flags
+.Pq Vt int
+Flags describing operational parameters of this interface (see below).
+(Manipulated by generic code.)
+.It Va if_drv_flags
+.Pq Vt int
+Flags describing operational status of this interface (see below).
+(Manipulated by driver.)
+.It Va if_capabilities
+.Pq Vt int
+Flags describing the capabilities the interface supports (see below).
+.It Va if_capenable
+.Pq Vt int
+Flags describing the enabled capabilities of the interface (see below).
+.It Va if_linkmib
+.Pq Vt "void *"
+A pointer to an interface-specific MIB structure exported by
+.Xr ifmib 4 .
+(Initialized by driver.)
+.It Va if_linkmiblen
+.Pq Vt size_t
+The size of said structure.
+(Initialized by driver.)
+.It Va if_data
+.Pq Vt "struct if_data"
+More statistics and information; see
+.Sx "The if_data structure" ,
+below.
+(Initialized by driver, manipulated by both driver and generic
+code.)
+.It Va if_multiaddrs
+.Pq Vt struct ifmultihead
+The head of the
+.Xr queue 3
+.Li TAILQ
+containing the list of multicast addresses assigned to this interface.
+.It Va if_amcount
+.Pq Vt int
+A number of multicast requests on this interface, used to
+reference-count the
+.Dv IFF_ALLMULTI
+flag.
+.It Va if_addr
+.Pq Vt "struct ifaddr *"
+A pointer to the link-level interface address.
+(Initialized by
+.Fn if_alloc . )
+.\" .It Va if_llsoftc
+.\" .Pq Vt "void *"
+.\" The purpose of the field is unclear.
+.It Va if_snd
+.Pq Vt "struct ifaltq"
+The output queue.
+(Manipulated by driver.)
+.It Va if_broadcastaddr
+.Pq Vt "const u_int8_t *"
+A link-level broadcast bytestring for protocols with variable address
+length.
+.It Va if_bridge
+.Pq Vt "void *"
+A pointer to the bridge interface structure,
+.Xr if_bridge 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
+.It Va if_label
+.Pq Vt "struct label *"
+A pointer to the MAC Framework label structure,
+.Xr mac 4 .
+(Initialized by
+.Fn if_alloc . )
+.It Va if_afdata
+.Pq Vt "void *"
+An address family dependent data region.
+.It Va if_afdata_initialized
+.Pq Vt int
+Used to track the current state of address family initialization.
+.It Va if_afdata_lock
+.Pq Vt "struct rwlock"
+An
+.Xr rwlock 9
+lock used to protect
+.Va if_afdata
+internals.
+.It Va if_linktask
+.Pq Vt "struct task"
+A
+.Xr taskqueue 9
+task scheduled for link state change events of the interface.
+.It Va if_addr_lock
+.Pq Vt "struct rwlock"
+An
+.Xr rwlock 9
+lock used to protect interface-related address lists.
+.It Va if_clones
+.Pq Fn LIST_ENTRY ifnet
+.Xr queue 3
+macro glue for the list of clonable network interfaces.
+.It Va if_groups
+.Pq Fn TAILQ_HEAD ", ifg_list"
+The head of the
+.Xr queue 3
+.Li TAILQ
+containing the list of groups per interface.
+.It Va if_pf_kif
+.Pq Vt "void *"
+A pointer to the structure used for interface abstraction by
+.Xr pf 4 .
+.It Va if_lagg
+.Pq Vt "void *"
+A pointer to the
+.Xr lagg 4
+interface structure.
+.It Va if_alloctype
+.Pq Vt u_char
+The type of the interface as it was at the time of its allocation.
+It is used to cache the type passed to
+.Fn if_alloc ,
+but unlike
+.Va if_type ,
+it would not be changed by drivers.
+.El
+.Pp
+References to
+.Vt ifnet
+structures are gained by calling the
+.Fn if_ref
+function and released by calling the
+.Fn if_rele
+function.
+They are used to allow kernel code walking global interface lists
+to release the
+.Vt ifnet
+lock yet keep the
+.Vt ifnet
+structure stable.
+.Pp
+There are in addition a number of function pointers which the driver
+must initialize to complete its interface with the generic interface
+layer:
+.Bl -ohang -offset indent
+.It Fn if_input
+Pass a packet to an appropriate upper layer as determined
+from the link-layer header of the packet.
+This routine is to be called from an interrupt handler or
+used to emulate reception of a packet on this interface.
+A single function implementing
+.Fn if_input
+can be shared among multiple drivers utilizing the same link-layer
+framing, e.g., Ethernet.
+.It Fn if_output
+Output a packet on interface
+.Fa ifp ,
+or queue it on the output queue if the interface is already active.
+.It Fn if_transmit
+Transmit a packet on an interface or queue it if the interface is
+in use.
+This function will return
+.Dv ENOBUFS
+if the devices software and hardware queues are both full.
+This function must be installed after
+.Fn if_attach
+to override the default implementation.
+This function is exposed in order to allow drivers to manage their own queues
+and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
+pair to ifq.
+The suggested internal software queueing mechanism is buf_ring.
+.It Fn if_qflush
+Free mbufs in internally managed queues when the interface is marked down.
+This function must be installed after
+.Fn if_attach
+to override the default implementation.
+This function is exposed in order to allow drivers to manage their own queues
+and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
+pair to ifq.
+The suggested internal software queueing mechanism is buf_ring.
+.It Fn if_start
+Start queued output on an interface.
+This function is exposed in
+order to provide for some interface classes to share a
+.Fn if_output
+among all drivers.
+.Fn if_start
+may only be called when the
+.Dv IFF_DRV_OACTIVE
+flag is not set.
+(Thus,
+.Dv IFF_DRV_OACTIVE
+does not literally mean that output is active, but rather that the
+device's internal output queue is full.) Please note that this function
+will soon be deprecated.
+.It Fn if_ioctl
+Process interface-related
+.Xr ioctl 2
+requests
+(defined in
+.In sys/sockio.h ) .
+Preliminary processing is done by the generic routine
+.Fn ifioctl
+to check for appropriate privileges, locate the interface being
+manipulated, and perform certain generic operations like twiddling
+flags and flushing queues.
+See the description of
+.Fn ifioctl
+below for more information.
+.It Fn if_init
+Initialize and bring up the hardware,
+e.g., reset the chip and enable the receiver unit.
+Should mark the interface running,
+but not active
+.Dv ( IFF_DRV_RUNNING , ~IIF_DRV_OACTIVE ) .
+.It Fn if_resolvemulti
+Check the requested multicast group membership,
+.Fa addr ,
+for validity, and if necessary compute a link-layer group which
+corresponds to that address which is returned in
+.Fa *retsa .
+Returns zero on success, or an error code on failure.
+.El
+.Ss "Interface Flags"
+Interface flags are used for a number of different purposes.
+Some
+flags simply indicate information about the type of interface and its
+capabilities; others are dynamically manipulated to reflect the
+current state of the interface.
+Flags of the former kind are marked
+.Aq S
+in this table; the latter are marked
+.Aq D .
+Flags which begin with
+.Dq IFF_DRV_
+are stored in
+.Va if_drv_flags ;
+all other flags are stored in
+.Va if_flags .
+.Pp
+The macro
+.Dv IFF_CANTCHANGE
+defines the bits which cannot be set by a user program using the
+.Dv SIOCSIFFLAGS
+command to
+.Xr ioctl 2 ;
+these are indicated by an asterisk
+.Pq Ql *
+in the following listing.
+.Pp
+.Bl -tag -width ".Dv IFF_POINTOPOINT" -offset indent -compact
+.It Dv IFF_UP
+.Aq D
+The interface has been configured up by the user-level code.
+.It Dv IFF_BROADCAST
+.Aq S*
+The interface supports broadcast.
+.It Dv IFF_DEBUG
+.Aq D
+Used to enable/disable driver debugging code.
+.It Dv IFF_LOOPBACK
+.Aq S
+The interface is a loopback device.
+.It Dv IFF_POINTOPOINT
+.Aq S*
+The interface is point-to-point;
+.Dq broadcast
+address is actually the address of the other end.
+.It Dv IFF_SMART
+.Aq S*
+The interface manages its own routes, rather than using the generic
+code in
+.Fn if_up
+and
+.Fn if_down .
+This is probably useful for serial lines.
+.It Dv IFF_DRV_RUNNING
+.Aq D*
+The interface has been configured and dynamic resources were
+successfully allocated.
+Probably only useful internal to the
+interface.
+.It Dv IFF_NOARP
+.Aq D
+Disable network address resolution on this interface.
+.It Dv IFF_PROMISC
+.Aq D*
+This interface is in promiscuous mode.
+.It Dv IFF_PPROMISC
+.Aq D
+This interface is in the permanently promiscuous mode (implies
+.Dv IFF_PROMISC ) .
+.It Dv IFF_ALLMULTI
+.Aq D*
+This interface is in all-multicasts mode (used by multicast routers).
+.It Dv IFF_DRV_OACTIVE
+.Aq D*
+The interface's hardware output queue (if any) is full; output packets
+are to be queued.
+.It Dv IFF_SIMPLEX
+.Aq S*
+The interface cannot hear its own transmissions.
+.It Dv IFF_LINK0
+.It Dv IFF_LINK1
+.It Dv IFF_LINK2
+.Aq D
+Control flags for the link layer.
+(Currently abused to select among
+multiple physical layers on some devices.)
+.It Dv IFF_MULTICAST
+.Aq S*
+This interface supports multicast.
+.It Dv IFF_CANTCONFIG
+.Aq S*
+The interface is not configurable in a meaningful way.
+Primarily useful for
+.Dv IFT_USB
+interfaces registered at the interface list.
+.It Dv IFF_MONITOR
+.Aq D
+This interface blocks transmission of packets and discards incoming
+packets after BPF processing.
+Used to monitor network trafic but not interact
+with the network in question.
+.It Dv IFF_STATICARP
+.Aq D
+Used to enable/disable ARP requests on this interface.
+.It Dv IFF_DYING
+.Aq D*
+Set when the
+.Vt ifnet
+structure of this interface is being released and still has
+.Va if_refcount
+references.
+.It Dv IFF_RENAMING
+.Aq D*
+Set when this interface is being renamed.
+.El
+.Ss "Interface Capabilities Flags"
+Interface capabilities are specialized features an interface may
+or may not support.
+These capabilities are very hardware-specific
+and allow, when enabled,
+to offload specific network processing to the interface
+or to offer a particular feature for use by other kernel parts.
+.Pp
+It should be stressed that a capability can be completely
+uncontrolled (i.e., stay always enabled with no way to disable it)
+or allow limited control over itself (e.g., depend on another
+capability's state.)
+Such peculiarities are determined solely by the hardware and driver
+of a particular interface.
+Only the driver possesses
+the knowledge on whether and how the interface capabilities
+can be controlled.
+Consequently, capabilities flags in
+.Va if_capenable
+should never be modified directly by kernel code other than
+the interface driver.
+The command
+.Dv SIOCSIFCAP
+to
+.Fn ifioctl
+is the dedicated means to attempt altering
+.Va if_capenable
+on an interface.
+Userland code shall use
+.Xr ioctl 2 .
+.Pp
+The following capabilities are currently supported by the system:
+.Bl -tag -width ".Dv IFCAP_POLLING_NOCOUNT" -offset indent
+.It Dv IFCAP_RXCSUM
+This interface can do checksum validation on receiving data.
+Some interfaces do not have sufficient buffer storage to store frames
+above a certain MTU-size completely.
+The driver for the interface might disable hardware checksum validation
+if the MTU is set above the hardcoded limit.
+.It Dv IFCAP_TXCSUM
+This interface can do checksum calculation on transmitting data.
+.It Dv IFCAP_HWCSUM
+A shorthand for
+.Pq Dv IFCAP_RXCSUM | IFCAP_TXCSUM .
+.It Dv IFCAP_NETCONS
+This interface can be a network console.
+.It Dv IFCAP_VLAN_MTU
+The
+.Xr vlan 4
+driver can operate over this interface in software tagging mode
+without having to decrease MTU on
+.Xr vlan 4
+interfaces below 1500 bytes.
+This implies the ability of this interface to cope with frames somewhat
+longer than permitted by the Ethernet specification.
+.It Dv IFCAP_VLAN_HWTAGGING
+This interface can do VLAN tagging on output and
+demultiplex frames by their VLAN tag on input.
+.It Dv IFCAP_JUMBO_MTU
+This Ethernet interface can transmit and receive frames up to
+9000 bytes long.
+.It Dv IFCAP_POLLING
+This interface supports
+.Xr polling 4 .
+See below for details.
+.It Dv IFCAP_VLAN_HWCSUM
+This interface can do checksum calculation on both transmitting
+and receiving data on
+.Xr vlan 4
+interfaces (implies
+.Dv IFCAP_HWCSUM ) .
+.It Dv IFCAP_TSO4
+This Ethernet interface supports TCP4 Segmentation offloading.
+.It Dv IFCAP_TSO6
+This Ethernet interface supports TCP6 Segmentation offloading.
+.It Dv IFCAP_TSO
+A shorthand for
+.Pq Dv IFCAP_TSO4 | IFCAP_TSO6 .
+.It Dv IFCAP_TOE4
+This Ethernet interface supports TCP offloading.
+.It Dv IFCAP_TOE6
+This Ethernet interface supports TCP6 offloading.
+.It Dv IFCAP_TOE
+A shorthand for
+.Pq Dv IFCAP_TOE4 | IFCAP_TOE6 .
+.It Dv IFCAP_WOL_UCAST
+This Ethernet interface supports waking up on any Unicast packet.
+.It Dv IFCAP_WOL_MCAST
+This Ethernet interface supports waking up on any Multicast packet.
+.It Dv IFCAP_WOL_MAGIC
+This Ethernet interface supports waking up on any Magic packet such
+as those sent by
+.Xr wake 8 .
+.It Dv IFCAP_WOL
+A shorthand for
+.Pq Dv IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC .
+.It Dv IFCAP_TOE4
+This Ethernet interface supports TCP4 Offload Engine.
+.It Dv IFCAP_TOE6
+This Ethernet interface supports TCP6 Offload Engine.
+.It Dv IFCAP_TOE
+A shorthand for
+.Pq Dv IFCAP_TOE4 | IFCAP_TOE6 .
+.It Dv IFCAP_VLAN_HWFILTER
+This interface supports frame filtering in hardware on
+.Xr vlan 4
+interfaces.
+.It Dv IFCAP_POLLING_NOCOUNT
+The return value for the number of processed packets should be
+skipped for this interface.
+.It Dv IFCAP_VLAN_HWTSO
+This interface supports TCP Segmentation offloading on
+.Xr vlan 4
+interfaces (implies
+.Dv IFCAP_TSO ) .
+.It Dv IFCAP_LINKSTATE
+This Ethernet interface supports dynamic link state changes.
+.El
+.Pp
+The ability of advanced network interfaces to offload certain
+computational tasks from the host CPU to the board is limited
+mostly to TCP/IP.
+Therefore a separate field associated with an interface
+(see
+.Va ifnet.if_data.ifi_hwassist
+below)
+keeps a detailed description of its enabled capabilities
+specific to TCP/IP processing.
+The TCP/IP module consults the field to see which tasks
+can be done on an
+.Em outgoing
+packet by the interface.
+The flags defined for that field are a superset of those for
+.Va mbuf.m_pkthdr.csum_flags ,
+namely:
+.Bl -tag -width ".Dv CSUM_FRAGMENT" -offset indent
+.It Dv CSUM_IP
+The interface will compute IP checksums.
+.It Dv CSUM_TCP
+The interface will compute TCP checksums.
+.It Dv CSUM_UDP
+The interface will compute UDP checksums.
+.It Dv CSUM_IP_FRAGS
+The interface can compute a TCP or UDP checksum for a packet
+fragmented by the host CPU.
+Makes sense only along with
+.Dv CSUM_TCP
+or
+.Dv CSUM_UDP .
+.It Dv CSUM_FRAGMENT
+The interface will do the fragmentation of IP packets if necessary.
+The host CPU does not need to care about MTU on this interface
+as long as a packet to transmit through it is an IP one and it
+does not exceed the size of the hardware buffer.
+.El
+.Pp
+An interface notifies the TCP/IP module about the tasks
+the former has performed on an
+.Em incoming
+packet by setting the corresponding flags in the field
+.Va mbuf.m_pkthdr.csum_flags
+of the
+.Vt mbuf chain
+containing the packet.
+See
+.Xr mbuf 9
+for details.
+.Pp
+The capability of a network interface to operate in
+.Xr polling 4
+mode involves several flags in different
+global variables and per-interface fields.
+The capability flag
+.Dv IFCAP_POLLING
+set in interface's
+.Va if_capabilities
+indicates support for
+.Xr polling 4
+on the particular interface.
+If set in
+.Va if_capabilities ,
+the same flag can be marked or cleared in the interface's
+.Va if_capenable
+within
+.Fn ifioctl ,
+thus initiating switch of the interface to
+.Xr polling 4
+mode or interrupt
+mode, respectively.
+The actual mode change is managed by the driver-specific
+.Fn if_ioctl
+routine.
+The
+.Xr polling
+handler returns the number of packets processed.
+.Ss The Vt if_data Ss Structure
+The
+.Vt if_data
+structure contains statistics and identifying information used
+by management programs, and which is exported to user programs by way
+of the
+.Xr ifmib 4
+branch of the
+.Xr sysctl 3
+MIB.
+The following elements of the
+.Vt if_data
+structure are initialized by the interface and are not expected to change
+significantly over the course of normal operation:
+.Bl -tag -width ".Va ifi_lastchange" -offset indent
+.It Va ifi_type
+.Pq Vt u_char
+The type of the interface, as defined in
+.In net/if_types.h
+and described below in the
+.Sx "Interface Types"
+section.
+.It Va ifi_physical
+.Pq Vt u_char
+Intended to represent a selection of physical layers on devices which
+support more than one; never implemented.
+.It Va ifi_addrlen
+.Pq Vt u_char
+Length of a link-layer address on this device, or zero if there are
+none.
+Used to initialized the address length field in
+.Vt sockaddr_dl
+structures referring to this interface.
+.It Va ifi_hdrlen
+.Pq Vt u_char
+Maximum length of any link-layer header which might be prepended by
+the driver to a packet before transmission.
+The generic code computes
+the maximum over all interfaces and uses that value to influence the
+placement of data in
+.Vt mbuf Ns s
+to attempt to ensure that there is always
+sufficient space to prepend a link-layer header without allocating an
+additional
+.Vt mbuf .
+.It Va ifi_datalen
+.Pq Vt u_char
+Length of the
+.Vt if_data
+structure.
+Allows some stabilization of the routing socket ABI in the face of
+increases in the length of
+.Vt struct ifdata .
+.It Va ifi_mtu
+.Pq Vt u_long
+The maximum transmission unit of the medium, exclusive of any
+link-layer overhead.
+.It Va ifi_metric
+.Pq Vt u_long
+A dimensionless metric interpreted by a user-mode routing process.
+.It Va ifi_baudrate
+.Pq Vt u_long
+The line rate of the interface, in bits per second.
+.It Va ifi_hwassist
+.Pq Vt u_long
+A detailed interpretation of the capabilities
+to offload computational tasks for
+.Em outgoing
+packets.
+The interface driver must keep this field in accord with
+the current value of
+.Va if_capenable .
+.It Va ifi_epoch
+.Pq Vt time_t
+The system uptime when interface was attached or the statistics
+below were reset.
+This is intended to be used to set the SNMP variable
+.Va ifCounterDiscontinuityTime .
+It may also be used to determine if two successive queries for an
+interface of the same index have returned results for the same
+interface.
+.El
+.Pp
+The structure additionally contains generic statistics applicable to a
+variety of different interface types (except as noted, all members are
+of type
+.Vt u_long ) :
+.Bl -tag -width ".Va ifi_lastchange" -offset indent
+.It Va ifi_link_state
+.Pq Vt u_char
+The current link state of Ethernet interfaces.
+See the
+.Sx Interface Link States
+section for possible values.
+.It Va ifi_ipackets
+Number of packets received.
+.It Va ifi_ierrors
+Number of receive errors detected (e.g., FCS errors, DMA overruns,
+etc.).
+More detailed breakdowns can often be had by way of a
+link-specific MIB.
+.It Va ifi_opackets
+Number of packets transmitted.
+.It Va ifi_oerrors
+Number of output errors detected (e.g., late collisions, DMA overruns,
+etc.).
+More detailed breakdowns can often be had by way of a
+link-specific MIB.
+.It Va ifi_collisions
+Total number of collisions detected on output for CSMA interfaces.
+(This member is sometimes [ab]used by other types of interfaces for
+other output error counts.)
+.It Va ifi_ibytes
+Total traffic received, in bytes.
+.It Va ifi_obytes
+Total traffic transmitted, in bytes.
+.It Va ifi_imcasts
+Number of packets received which were sent by link-layer multicast.
+.It Va ifi_omcasts
+Number of packets sent by link-layer multicast.
+.It Va ifi_iqdrops
+Number of packets dropped on input.
+Rarely implemented.
+.It Va ifi_noproto
+Number of packets received for unknown network-layer protocol.
+.It Va ifi_lastchange
+.Pq Vt "struct timeval"
+The time of the last administrative change to the interface (as required
+for
+.Tn SNMP ) .
+.El
+.Ss Interface Types
+The header file
+.In net/if_types.h
+defines symbolic constants for a number of different types of
+interfaces.
+The most common are:
+.Pp
+.Bl -tag -offset indent -width ".Dv IFT_PROPVIRTUAL" -compact
+.It Dv IFT_OTHER
+none of the following
+.It Dv IFT_ETHER
+Ethernet
+.It Dv IFT_ISO88023
+ISO 8802-3 CSMA/CD
+.It Dv IFT_ISO88024
+ISO 8802-4 Token Bus
+.It Dv IFT_ISO88025
+ISO 8802-5 Token Ring
+.It Dv IFT_ISO88026
+ISO 8802-6 DQDB MAN
+.It Dv IFT_FDDI
+FDDI
+.It Dv IFT_PPP
+Internet Point-to-Point Protocol
+.Pq Xr ppp 8
+.It Dv IFT_LOOP
+The loopback
+.Pq Xr lo 4
+interface
+.It Dv IFT_SLIP
+Serial Line IP
+.It Dv IFT_PARA
+Parallel-port IP
+.Pq Dq Tn PLIP
+.It Dv IFT_ATM
+Asynchronous Transfer Mode
+.It Dv IFT_USB
+USB Interface
+.El
+.Ss Interface Link States
+The following link states are currently defined:
+.Pp
+.Bl -tag -offset indent -width ".Dv LINK_STATE_UNKNOWN" -compact
+.It Dv LINK_STATE_UNKNOWN
+The link is in an invalid or unknown state.
+.It Dv LINK_STATE_DOWN
+The link is down.
+.It Dv LINK_STATE_UP
+The link is up.
+.El
+.Ss The Vt ifaddr Ss Structure
+Every interface is associated with a list
+(or, rather, a
+.Li TAILQ )
+of addresses, rooted at the interface structure's
+.Va if_addrlist
+member.
+The first element in this list is always an
+.Dv AF_LINK
+address representing the interface itself; multi-access network
+drivers should complete this structure by filling in their link-layer
+addresses after calling
+.Fn if_attach .
+Other members of the structure represent network-layer addresses which
+have been configured by means of the
+.Dv SIOCAIFADDR
+command to
+.Xr ioctl 2 ,
+called on a socket of the appropriate protocol family.
+The elements of this list consist of
+.Vt ifaddr
+structures.
+Most protocols will declare their own protocol-specific
+interface address structures, but all begin with a
+.Vt "struct ifaddr"
+which provides the most-commonly-needed functionality across all
+protocols.
+Interface addresses are reference-counted.
+.Pp
+The members of
+.Vt "struct ifaddr"
+are as follows:
+.Bl -tag -width ".Va ifa_rtrequest" -offset indent
+.It Va ifa_addr
+.Pq Vt "struct sockaddr *"
+The local address of the interface.
+.It Va ifa_dstaddr
+.Pq Vt "struct sockaddr *"
+The remote address of point-to-point interfaces, and the broadcast
+address of broadcast interfaces.
+.Va ( ifa_broadaddr
+is a macro for
+.Va ifa_dstaddr . )
+.It Va ifa_netmask
+.Pq Vt "struct sockaddr *"
+The network mask for multi-access interfaces, and the confusion
+generator for point-to-point interfaces.
+.It Va ifa_ifp
+.Pq Vt "struct ifnet *"
+A link back to the interface structure.
+.It Va ifa_link
+.Pq Fn TAILQ_ENTRY ifaddr
+.Xr queue 3
+glue for list of addresses on each interface.
+.It Va ifa_rtrequest
+See below.
+.It Va ifa_flags
+.Pq Vt u_short
+Some of the flags which would be used for a route representing this
+address in the route table.
+.It Va ifa_refcnt
+.Pq Vt short
+The reference count.
+.It Va ifa_metric
+.Pq Vt int
+A metric associated with this interface address, for the use of some
+external routing protocol.
+.El
+.Pp
+References to
+.Vt ifaddr
+structures are gained by calling the
+.Fn ifa_ref
+function and released by calling the
+.Fn ifa_free
+function.
+.Pp
+.Fn ifa_rtrequest
+is a pointer to a function which receives callouts from the routing
+code
+.Pq Fn rtrequest
+to perform link-layer-specific actions upon requests to add,
+or delete routes.
+The
+.Fa cmd
+argument indicates the request in question:
+.Dv RTM_ADD ,
+or
+.Dv RTM_DELETE .
+The
+.Fa rt
+argument is the route in question; the
+.Fa info
+argument contains the specific destination being manipulated.
+.Sh FUNCTIONS
+The functions provided by the generic interface code can be divided
+into two groups: those which manipulate interfaces, and those which
+manipulate interface addresses.
+In addition to these functions, there
+may also be link-layer support routines which are used by a number of
+drivers implementing a specific link layer over different hardware;
+see the documentation for that link layer for more details.
+.Ss The Vt ifmultiaddr Ss Structure
+Every multicast-capable interface is associated with a list of
+multicast group memberships, which indicate at a low level which
+link-layer multicast addresses (if any) should be accepted, and at a
+high level, in which network-layer multicast groups a user process has
+expressed interest.
+.Pp
+The elements of the structure are as follows:
+.Bl -tag -width ".Va ifma_refcount" -offset indent
+.It Va ifma_link
+.Pq Fn LIST_ENTRY ifmultiaddr
+.Xr queue 3
+macro glue.
+.It Va ifma_addr
+.Pq Vt "struct sockaddr *"
+A pointer to the address which this record represents.
+The
+memberships for various address families are stored in arbitrary
+order.
+.It Va ifma_lladdr
+.Pq Vt "struct sockaddr *"
+A pointer to the link-layer multicast address, if any, to which the
+network-layer multicast address in
+.Va ifma_addr
+is mapped, else a null pointer.
+If this element is non-nil, this
+membership also holds an invisible reference to another membership for
+that link-layer address.
+.It Va ifma_refcount
+.Pq Vt u_int
+A reference count of requests for this particular membership.
+.El
+.Ss Interface Manipulation Functions
+.Bl -ohang -offset indent
+.It Fn if_alloc
+Allocate and initialize
+.Vt "struct ifnet" .
+Initialization includes the allocation of an interface index and may
+include the allocation of a
+.Fa type
+specific structure in
+.Va if_l2com .
+.It Fn if_attach
+Link the specified interface
+.Fa ifp
+into the list of network interfaces.
+Also initialize the list of
+addresses on that interface, and create a link-layer
+.Vt ifaddr
+structure to be the first element in that list.
+(A pointer to
+this address structure is saved in the
+.Vt ifnet
+structure and shall be accessed by the
+.Fn ifaddr_byindex
+function.)
+The
+.Fa ifp
+must have been allocated by
+.Fn if_alloc .
+.It Fn if_detach
+Shut down and unlink the specified
+.Fa ifp
+from the interface list.
+.It Fn if_free
+Free the given
+.Fa ifp
+back to the system.
+The interface must have been previously detached if it was ever attached.
+.It Fn if_free_type
+Identical to
+.Fn if_free
+except that the given
+.Fa type
+is used to free
+.Va if_l2com
+instead of the type in
+.Va if_type .
+This is intended for use with drivers that change their interface type.
+.It Fn if_down
+Mark the interface
+.Fa ifp
+as down (i.e.,
+.Dv IFF_UP
+is not set),
+flush its output queue, notify protocols of the transition,
+and generate a message from the
+.Xr route 4
+routing socket.
+.It Fn if_up
+Mark the interface
+.Fa ifp
+as up, notify protocols of the transition,
+and generate a message from the
+.Xr route 4
+routing socket.
+.It Fn ifpromisc
+Add or remove a promiscuous reference to
+.Fa ifp .
+If
+.Fa pswitch
+is true, add a reference;
+if it is false, remove a reference.
+On reference count transitions
+from zero to one and one to zero, set the
+.Dv IFF_PROMISC
+flag appropriately and call
+.Fn if_ioctl
+to set up the interface in the desired mode.
+.It Fn if_allmulti
+As
+.Fn ifpromisc ,
+but for the all-multicasts
+.Pq Dv IFF_ALLMULTI
+flag instead of the promiscuous flag.
+.It Fn ifunit
+Return an
+.Vt ifnet
+pointer for the interface named
+.Fa name .
+.It Fn ifunit_ref
+Return a reference-counted (via
+.Fn ifa_ref )
+.Vt ifnet
+pointer for the interface named
+.Fa name .
+This is the preferred function over
+.Fn ifunit .
+The caller is responsible for releasing the reference with
+.Fn if_rele
+when it is finished with the ifnet.
+.It Fn ifioctl
+Process the ioctl request
+.Fa cmd ,
+issued on socket
+.Fa so
+by thread
+.Fa td ,
+with data parameter
+.Fa data .
+This is the main routine for handling all interface configuration
+requests from user mode.
+It is ordinarily only called from the socket-layer
+.Xr ioctl 2
+handler, and only for commands with class
+.Sq Li i .
+Any unrecognized commands will be passed down to socket
+.Fa so Ns 's
+protocol for
+further interpretation.
+The following commands are handled by
+.Fn ifioctl :
+.Pp
+.Bl -tag -width ".Dv OSIOCGIFNETMASK" -offset indent -compact
+.It Dv SIOCGIFCONF
+.It Dv OSIOCGIFCONF
+Get interface configuration.
+(No call-down to driver.)
+.Pp
+.It Dv SIOCSIFNAME
+Set the interface name.
+.Dv RTM_IFANNOUNCE
+departure and arrival messages are sent so that
+routing code that relies on the interface name will update its interface
+list.
+Caller must have appropriate privilege.
+(No call-down to driver.)
+.It Dv SIOCGIFCAP
+.It Dv SIOCGIFFIB
+.It Dv SIOCGIFFLAGS
+.It Dv SIOCGIFMETRIC
+.It Dv SIOCGIFMTU
+.It Dv SIOCGIFPHYS
+Get interface capabilities, FIB, flags, metric, MTU, medium selection.
+(No call-down to driver.)
+.Pp
+.It Dv SIOCSIFCAP
+Enable or disable interface capabilities.
+Caller must have appropriate privilege.
+Before a call to the driver-specific
+.Fn if_ioctl
+routine, the requested mask for enabled capabilities is checked
+against the mask of capabilities supported by the interface,
+.Va if_capabilities .
+Requesting to enable an unsupported capability is invalid.
+The rest is supposed to be done by the driver,
+which includes updating
+.Va if_capenable
+and
+.Va if_data.ifi_hwassist
+appropriately.
+.Pp
+.It Dv SIOCSIFFIB
+Sets interface FIB.
+Caller must have appropriate privilege.
+FIB values start at 0 and values greater or equals than
+.Va net.fibs
+are considered invalid.
+.It Dv SIOCSIFFLAGS
+Change interface flags.
+Caller must have appropriate privilege.
+If a change to the
+.Dv IFF_UP
+flag is requested,
+.Fn if_up
+or
+.Fn if_down
+is called as appropriate.
+Flags listed in
+.Dv IFF_CANTCHANGE
+are masked off, and the field
+.Va if_flags
+in the interface structure is updated.
+Finally, the driver
+.Fn if_ioctl
+routine is called to perform any setup
+requested.
+.Pp
+.It Dv SIOCSIFMETRIC
+.It Dv SIOCSIFPHYS
+Change interface metric or medium.
+Caller must have appropriate privilege.
+.Pp
+.It Dv SIOCSIFMTU
+Change interface MTU.
+Caller must have appropriate privilege.
+MTU
+values less than 72 or greater than 65535 are considered invalid.
+The driver
+.Fn if_ioctl
+routine is called to implement the change; it is responsible for any
+additional sanity checking and for actually modifying the MTU in the
+interface structure.
+.Pp
+.It Dv SIOCADDMULTI
+.It Dv SIOCDELMULTI
+Add or delete permanent multicast group memberships on the interface.
+Caller must have appropriate privilege.
+The
+.Fn if_addmulti
+or
+.Fn if_delmulti
+function is called to perform the operation; qq.v.
+.Pp
+.It Dv SIOCAIFADDR
+.It Dv SIOCDIFADDR
+The socket's protocol control routine is called to implement the
+requested action.
+.Pp
+.It Dv OSIOCGIFADDR
+.It Dv OSIOCGIFDSTADDR
+.It Dv OSIOCGIFBRDADDR
+.It Dv OSIOCGIFNETMASK
+The socket's protocol control routine is called to implement the
+requested action.
+On return,
+.Vt sockaddr
+structures are converted into old-style (no
+.Va sa_len
+member).
+.El
+.El
+.Pp
+.Fn if_down ,
+.Fn ifioctl ,
+.Fn ifpromisc ,
+and
+.Fn if_up
+must be called at
+.Fn splnet
+or higher.
+.Ss "Interface Address Functions"
+Several functions exist to look up an interface address structure
+given an address.
+.Fn ifa_ifwithaddr
+returns an interface address with either a local address or a
+broadcast address precisely matching the parameter
+.Fa addr .
+.Fn ifa_ifwithdstaddr
+returns an interface address for a point-to-point interface whose
+remote
+.Pq Dq destination
+address is
+.Fa addr .
+.Pp
+.Fn ifa_ifwithnet
+returns the most specific interface address which matches the
+specified address,
+.Fa addr ,
+subject to its configured netmask, or a point-to-point interface
+address whose remote address is
+.Fa addr
+if one is found.
+If
+.Fa ignore_ptp
+is true, skip point-to-point interface addresses.
+.Pp
+.Fn ifaof_ifpforaddr
+returns the most specific address configured on interface
+.Fa ifp
+which matches address
+.Fa addr ,
+subject to its configured netmask.
+If the interface is
+point-to-point, only an interface address whose remote address is
+precisely
+.Fa addr
+will be returned.
+.Pp
+.Fn ifaddr_byindex
+returns the link-level address of the interface with the given index
+.Fa idx .
+.Pp
+All of these functions return a null pointer if no such address can be
+found.
+.Ss "Interface Multicast Address Functions"
+The
+.Fn if_addmulti ,
+.Fn if_delmulti ,
+and
+.Fn if_findmulti
+functions provide support for requesting and relinquishing multicast
+group memberships, and for querying an interface's membership list,
+respectively.
+The
+.Fn if_addmulti
+function takes a pointer to an interface,
+.Fa ifp ,
+and a generic address,
+.Fa sa .
+It also takes a pointer to a
+.Vt "struct ifmultiaddr *"
+which is filled in on successful return with the address of the
+group membership control block.
+The
+.Fn if_addmulti
+function performs the following four-step process:
+.Bl -enum -offset indent
+.It
+Call the interface's
+.Fn if_resolvemulti
+entry point to determine the link-layer address, if any, corresponding
+to this membership request, and also to give the link layer an
+opportunity to veto this membership request should it so desire.
+.It
+Check the interface's group membership list for a pre-existing
+membership for this group.
+If one is not found, allocate a new one;
+if one is, increment its reference count.
+.It
+If the
+.Fn if_resolvemulti
+routine returned a link-layer address corresponding to the group,
+repeat the previous step for that address as well.
+.It
+If the interface's multicast address filter needs to be changed
+because a new membership was added, call the interface's
+.Fn if_ioctl
+routine
+(with a
+.Fa cmd
+argument of
+.Dv SIOCADDMULTI )
+to request that it do so.
+.El
+.Pp
+The
+.Fn if_delmulti
+function, given an interface
+.Fa ifp
+and an address,
+.Fa sa ,
+reverses this process.
+Both functions return zero on success, or a
+standard error number on failure.
+.Pp
+The
+.Fn if_findmulti
+function examines the membership list of interface
+.Fa ifp
+for an address matching
+.Fa sa ,
+and returns a pointer to that
+.Vt "struct ifmultiaddr"
+if one is found, else it returns a null pointer.
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr link_addr 3 ,
+.Xr queue 3 ,
+.Xr sysctl 3 ,
+.Xr bpf 4 ,
+.Xr ifmib 4 ,
+.Xr lo 4 ,
+.Xr netintro 4 ,
+.Xr polling 4 ,
+.Xr config 8 ,
+.Xr ppp 8 ,
+.Xr mbuf 9 ,
+.Xr rtentry 9
+.Rs
+.%A Gary R. Wright
+.%A W. Richard Stevens
+.%B TCP/IP Illustrated
+.%V Vol. 2
+.%O Addison-Wesley, ISBN 0-201-63354-X
+.Re
+.Sh AUTHORS
+This manual page was written by
+.An Garrett A. Wollman .
diff --git a/share/man/man9/inittodr.9 b/share/man/man9/inittodr.9
new file mode 100644
index 000000000000..61524f206296
--- /dev/null
+++ b/share/man/man9/inittodr.9
@@ -0,0 +1,123 @@
+.\" $NetBSD: inittodr.9,v 1.2 1996/03/27 21:16:06 jtc Exp $
+.\"
+.\" Copyright (c) 1994 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christopher G. Demetriou
+.\" for the NetBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 22, 1997
+.Dt INITTODR 9
+.Os
+.Sh NAME
+.Nm inittodr
+.Nd initialize system time
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft void
+.Fn inittodr "time_t base"
+.Sh DESCRIPTION
+The
+.Fn inittodr
+function determines the time and sets the system clock.
+It tries to pick the correct time using a set of heuristics that examine
+the system's battery backed clock and the time obtained from the root
+file system, as given in
+.Fa base .
+How the
+.Fa base
+value is obtained will vary depending on the
+root file system type.
+The heuristics used include:
+.Bl -bullet
+.It
+If the battery-backed clock has a valid time, it is used.
+.\" .It
+.\" If the battery-backed clock does not have a valid time, and
+.\" the time provided in
+.\" .Fa base
+.\" is within reason,
+.\" .Fa base
+.\" is used as the current time.
+.\" .It
+.\" If the battery-backed clock appears invalid, and
+.\" .Fa base
+.\" appears non-sensical or was not provided (was given as zero),
+.\" a arbitrary base (typically some time in the late 1970s)
+.\" will be used.
+.It
+If the battery-backed clock does not have a valid time,
+the time provided in
+.Fa base
+will be used.
+.El
+.Pp
+Once a system time has been determined, it is stored in the
+.Va time
+variable.
+.Sh DIAGNOSTICS
+The
+.Fn inittodr
+function prints diagnostic messages if it has trouble figuring
+out the system time.
+Conditions that can cause diagnostic messages to be printed include:
+.Bl -bullet
+.It
+The battery-backed clock's time appears nonsensical.
+.\" .It
+.\" The
+.\" .Fa base
+.\" time appears nonsensical.
+.\" .It
+.\" The
+.\" .Fa base
+.\" time and the battery-backed clock's time differ by a large amount.
+.El
+.Sh SEE ALSO
+.Xr resettodr 9 ,
+.Xr time 9
+.Sh BUGS
+On many systems,
+.Fn inittodr
+has to convert from
+a time expressed in terms of year, month, day, hours, minutes,
+and seconds to
+.Va time ,
+expressed in seconds.
+Many of the implementations could share code, but do not.
+.Pp
+Each system's heuristics for picking the correct time are slightly
+different.
+.Pp
+The
+.Fx
+implementation should do a better job of validating the time provided in
+.Fa base
+when the battery-backed clock is unusable.
+Currently it unconditionally sets the system clock to this value.
diff --git a/share/man/man9/insmntque.9 b/share/man/man9/insmntque.9
new file mode 100644
index 000000000000..e2bf0d577b71
--- /dev/null
+++ b/share/man/man9/insmntque.9
@@ -0,0 +1,95 @@
+.\" Copyright (C) 2008 Chad David <davidc@acns.ab.ca>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 8, 2008
+.Dt INSMNTQUE 9
+.Os
+.Sh NAME
+.Nm insmntque ,
+.Nm insmntque1
+.Nd "associate a vnode with a mount"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn insmntque "struct vnode *vp" "struct mount *mp"
+.Ft int
+.Fn insmntque1 "struct vnode *vp" "struct mount *mp" "void (*dtr)(struct vnode *, void *)" "void *dtr_arg"
+.Sh DESCRIPTION
+The
+.Fn insmntque
+function associates a vnode with a mount.
+This includes updating
+.Va v_mount
+for the vnode, and inserting the vnode into the mount's vnode list.
+.Pp
+The mount reference count is incremented for each vnode added to the
+mount, and that reference is decremented by
+.Xr vgone 9 .
+.Pp
+The mount's interlock is held while the vnode is inserted.
+For MP-safe file systems, the vnode must be exclusively locked.
+.Pp
+On failure,
+.Fn insmntque
+calls
+.Xr vgone 9
+on the supplied vnode, and then drops the vnode lock and reference.
+If more elaborated cleanup after
+.Fn insmntque
+failure is needed, the
+.Fn insmntque1
+function may be used instead.
+The
+.Fa dtr
+argument is a pointer to a function that is called on failure.
+This function may perform any custom cleanup.
+The vnode pointer is supplied as the first argument to
+.Fa dtr .
+The
+.Fa dtr_arg
+argument is the second, supplying any additional context needed.
+.Sh RETURN VALUES
+The
+.Fn insmntque
+function will always return 0, unless the file system is currently being unmounted
+in which case it may return
+.Dv EBUSY .
+Also,
+.Fn insmntque
+may be forced to insert the vnode into the mount's vnode list
+by setting the
+.Va VV_FORCEINSMQ
+flag in the vnode
+.Va v_flag ,
+even if the file system is being unmounted.
+.Sh SEE ALSO
+.Xr vgone 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/intro.9 b/share/man/man9/intro.9
new file mode 100644
index 000000000000..0e0fe8188d7a
--- /dev/null
+++ b/share/man/man9/intro.9
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 13, 1995
+.Dt INTRO 9
+.Os
+.Sh NAME
+.Nm intro
+.Nd "introduction to system kernel interfaces"
+.Sh DESCRIPTION
+This section contains information about the interfaces and
+subroutines in the kernel.
+.Sh PROTOTYPES ANSI-C AND ALL THAT
+Yes please.
+.Pp
+We would like all code to be fully prototyped.
+.Pp
+If your code compiles cleanly with
+.Nm cc
+.Ar -Wall
+we would feel happy about it.
+It is important to understand that this is not a question of just shutting up
+.Nm cc ,
+it is a question about avoiding the things it complains about.
+To put it bluntly, do not hide the problem by casting and other
+obfuscating practices, solve the problem.
+.Sh INDENTATION AND STYLE
+Believe it or not, there actually exists a guide for indentation and style.
+It is not generally applied though.
+.Pp
+We would appreciate if people would pay attention to it, and at least not
+violate it blatantly.
+.Pp
+We do not mind it too badly if you have your own style, but please make
+sure we can read it too.
+.Pp
+Please take time to read
+.Xr style 9
+for more information.
+.Sh NAMING THINGS
+Some general rules exist:
+.Bl -enum
+.It
+If a function is meant as a debugging aid in DDB, it should be enclosed
+in
+.Bd -literal -offset indent
+#ifdef DDB
+
+#endif /* DDB */
+.Ed
+.Pp
+And the name of the procedure should start with the prefix
+.Li DDB_
+to clearly identify the procedure as a debugger routine.
+.El
+.Sh SCOPE OF SYMBOLS
+It is important to carefully consider the scope of symbols in the kernel.
+The default is to make everything static, unless some reason requires
+the opposite.
+.Pp
+There are several reasons for this policy,
+the main one is that the kernel is one monolithic name-space,
+and pollution is not a good idea here either.
+.Pp
+For device drivers and other modules that do not add new internal interfaces
+to the kernel, the entire source should be in one file if possible.
+That way all symbols can be made static.
+.Pp
+If for some reason a module is split over multiple source files, then try
+to split the module along some major fault-line and consider using the
+number of global symbols as your guide.
+The fewer the better.
+.Sh SEE ALSO
+.Xr style 9
+.Sh HISTORY
+The
+.Nm
+section manual page appeared in
+.Fx 2.2 .
diff --git a/share/man/man9/ithread.9 b/share/man/man9/ithread.9
new file mode 100644
index 000000000000..1f4bfb985cec
--- /dev/null
+++ b/share/man/man9/ithread.9
@@ -0,0 +1,351 @@
+.\" Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 25, 2006
+.Dt ITHREAD 9
+.Os
+.Sh NAME
+.Nm ithread_add_handler ,
+.Nm ithread_create ,
+.Nm ithread_destroy ,
+.Nm ithread_priority ,
+.Nm ithread_remove_handler ,
+.Nm ithread_schedule
+.Nd kernel interrupt threads
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.In sys/interrupt.h
+.Ft int
+.Fo ithread_add_handler
+.Fa "struct ithd *ithread"
+.Fa "const char *name"
+.Fa "driver_intr_t handler"
+.Fa "void *arg"
+.Fa "u_char pri"
+.Fa "enum intr_type flags"
+.Fa "void **cookiep"
+.Fc
+.Ft int
+.Fo ithread_create
+.Fa "struct ithd **ithread"
+.Fa "int vector"
+.Fa "int flags"
+.Fa "void (*disable)(int)"
+.Fa "void (*enable)(int)"
+.Fa "const char *fmt"
+.Fa "..."
+.Fc
+.Ft int
+.Fn ithread_destroy "struct ithd *ithread"
+.Ft u_char
+.Fn ithread_priority "enum intr_type flags"
+.Ft int
+.Fn ithread_remove_handler "void *cookie"
+.Ft int
+.Fn ithread_schedule "struct ithd *ithread" "int do_switch"
+.Sh DESCRIPTION
+Interrupt threads are kernel threads that run a list of handlers when
+triggered by either a hardware or software interrupt.
+Each interrupt handler has a name, handler function, handler argument,
+priority, and various flags.
+Each interrupt thread maintains a list of handlers sorted by priority.
+This results in higher priority handlers being executed prior to lower
+priority handlers.
+Each thread assumes the priority of its highest priority handler for its
+process priority, or
+.Dv PRIO_MAX
+if it has no handlers.
+Interrupt threads are also associated with a single interrupt source,
+represented as a vector number.
+.Pp
+The
+.Fn ithread_create
+function creates a new interrupt thread.
+The
+.Fa ithread
+argument points to an
+.Vt struct ithd
+pointer that will point to the newly created thread upon success.
+The
+.Fa vector
+argument specifies the interrupt source to associate this thread with.
+The
+.Fa flags
+argument is a mask of properties of this thread.
+The only valid flag currently for
+.Fn ithread_create
+is
+.Dv IT_SOFT
+to specify that this interrupt thread is a software interrupt.
+The
+.Fa enable
+and
+.Fa disable
+arguments specify optional functions used to enable and disable this
+interrupt thread's interrupt source.
+The functions receive the vector corresponding to the thread's interrupt
+source as their only argument.
+The remaining arguments form a
+.Xr printf 9
+argument list that is used to build the base name of the new ithread.
+The full name of an interrupt thread is formed by concatenating the base
+name of an interrupt thread with the names of all of its interrupt handlers.
+.Pp
+The
+.Fn ithread_destroy
+function destroys a previously created interrupt thread by releasing its
+resources and arranging for the backing kernel thread to terminate.
+An interrupt thread can only be destroyed if it has no handlers remaining.
+.Pp
+The
+.Fn ithread_add_handler
+function adds a new handler to an existing interrupt thread specified by
+.Fa ithread .
+The
+.Fa name
+argument specifies a name for this handler.
+The
+.Fa handler
+and
+.Fa arg
+arguments provide the function to execute for this handler and an argument
+to pass to it.
+The
+.Fa pri
+argument specifies the priority of this handler and is used both in sorting
+it in relation to the other handlers for this thread and to specify the
+priority of the backing kernel thread.
+The
+.Fa flags
+argument can be used to specify properties of this handler as defined in
+.In sys/bus.h .
+If
+.Fa cookiep
+is not
+.Dv NULL ,
+then it will be assigned a cookie that can be used later to remove this
+handler.
+.Pp
+The
+.Fn ithread_remove_handler
+removes a handler from an interrupt thread.
+The
+.Fa cookie
+argument specifies the handler to remove from its thread.
+.Pp
+The
+.Fn ithread_schedule
+function schedules an interrupt thread to run.
+If the
+.Fa do_switch
+argument is non-zero and the interrupt thread is idle, then a context switch
+will be forced after putting the interrupt thread on the run queue.
+.Pp
+The
+.Fn ithread_priority
+function translates the
+.Dv INTR_TYPE_*
+interrupt flags into interrupt handler priorities.
+.Pp
+The interrupt flags not related to the type of a particular interrupt
+.Pq Dv INTR_TYPE_*
+can be used to specify additional properties of both hardware and software
+interrupt handlers.
+The
+.Dv INTR_EXCL
+flag specifies that this handler cannot share an interrupt thread with
+another handler.
+The
+.Dv INTR_MPSAFE
+flag specifies that this handler is MP safe in that it does not need the
+Giant mutex to be held while it is executed.
+The
+.Dv INTR_ENTROPY
+flag specifies that the interrupt source this handler is tied to is a good
+source of entropy, and thus that entropy should be gathered when an interrupt
+from the handler's source triggers.
+Presently, the
+.Dv INTR_ENTROPY
+flag is not valid for software interrupt handlers.
+.Pp
+It is not permitted to sleep in an interrupt thread; hence, any memory
+or zone allocations in an interrupt thread should be specified with the
+.Dv M_NOWAIT
+flag set.
+Any allocation errors must be handled thereafter.
+.Sh RETURN VALUES
+The
+.Fn ithread_add_handler ,
+.Fn ithread_create ,
+.Fn ithread_destroy ,
+.Fn ithread_remove_handler ,
+and
+.Fn ithread_schedule
+functions return zero on success and non-zero on failure.
+The
+.Fn ithread_priority
+function returns a process priority corresponding to the passed in interrupt
+flags.
+.Sh EXAMPLES
+The
+.Fn swi_add
+function demonstrates the use of
+.Fn ithread_create
+and
+.Fn ithread_add_handler .
+.Bd -literal -offset indent
+int
+swi_add(struct ithd **ithdp, const char *name, driver_intr_t handler,
+ void *arg, int pri, enum intr_type flags, void **cookiep)
+{
+ struct proc *p;
+ struct ithd *ithd;
+ int error;
+
+ if (flags & INTR_ENTROPY)
+ return (EINVAL);
+
+ ithd = (ithdp != NULL) ? *ithdp : NULL;
+
+ if (ithd != NULL) {
+ if ((ithd->it_flags & IT_SOFT) == 0)
+ return(EINVAL);
+ } else {
+ error = ithread_create(&ithd, pri, IT_SOFT, NULL, NULL,
+ "swi%d:", pri);
+ if (error)
+ return (error);
+
+ if (ithdp != NULL)
+ *ithdp = ithd;
+ }
+ return (ithread_add_handler(ithd, name, handler, arg, pri + PI_SOFT,
+ flags, cookiep));
+}
+.Ed
+.Sh ERRORS
+The
+.Fn ithread_add_handler
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Any of the
+.Fa ithread ,
+.Fa handler ,
+or
+.Fa name
+arguments are
+.Dv NULL .
+.It Bq Er EINVAL
+The
+.Dv INTR_EXCL
+flag is specified and the interrupt thread
+.Fa ithread
+already has at least one handler, or the interrupt thread
+.Fa ithread
+already has an exclusive handler.
+.It Bq Er ENOMEM
+Could not allocate needed memory for this handler.
+.El
+.Pp
+The
+.Fn ithread_create
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system-imposed limit on the total
+number of processes under execution would be exceeded.
+The limit is given by the
+.Xr sysctl 3
+MIB variable
+.Dv KERN_MAXPROC .
+.It Bq Er EINVAL
+A flag other than
+.Dv IT_SOFT
+was specified in the
+.Fa flags
+parameter.
+.It Bq Er ENOMEM
+Could not allocate needed memory for this interrupt thread.
+.El
+.Pp
+The
+.Fn ithread_destroy
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa ithread
+argument is
+.Dv NULL .
+.It Bq Er EINVAL
+The interrupt thread pointed to by
+.Fa ithread
+has at least one handler.
+.El
+.Pp
+The
+.Fn ithread_remove_handler
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa cookie
+argument is
+.Dv NULL .
+.El
+.Pp
+The
+.Fn ithread_schedule
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa ithread
+argument is
+.Dv NULL .
+.It Bq Er EINVAL
+The interrupt thread pointed to by
+.Fa ithread
+has no interrupt handlers.
+.El
+.Sh SEE ALSO
+.Xr kthread 9 ,
+.Xr malloc 9 ,
+.Xr swi 9 ,
+.Xr uma 9
+.Sh HISTORY
+Interrupt threads and their corresponding API first appeared in
+.Fx 5.0 .
+.Sh BUGS
+Currently
+.Vt struct ithd
+represents both an interrupt source and an interrupt thread.
+There should be a separate
+.Vt struct isrc
+that contains a vector number, enable and disable functions, etc.\& that
+an ithread holds a reference to.
diff --git a/share/man/man9/kernacc.9 b/share/man/man9/kernacc.9
new file mode 100644
index 000000000000..f6d60dcf6463
--- /dev/null
+++ b/share/man/man9/kernacc.9
@@ -0,0 +1,83 @@
+.\" $NetBSD: access.9,v 1.1 1996/06/16 10:38:35 pk Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 16, 1996
+.Dt KERNACC 9
+.Os
+.Sh NAME
+.Nm kernacc ,
+.Nm useracc
+.Nd check memory regions for accessibility
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.In vm/vm.h
+.In vm/vm_extern.h
+.Ft int
+.Fn kernacc "void *addr" "int len" "int rw"
+.Ft int
+.Fn useracc "void *addr" "int len" "int rw"
+.Sh DESCRIPTION
+The
+.Fn kernacc
+and
+.Fn useracc
+functions check whether operations of the type specified in
+.Fa rw
+are permitted in the range of virtual addresses given by
+.Fa addr
+and
+.Fa len .
+The possible values of
+.Fa rw
+are any bitwise combination of
+.Dv VM_PROT_READ ,
+.Dv VM_PROT_WRITE
+and
+.Dv VM_PROT_EXECUTE .
+.Fn kernacc
+checks addresses in the kernel address space, while
+.Fn useracc
+considers
+.Fa addr
+to represent an user space address.
+The process context to use for this
+operation is taken from the global variable
+.Va curproc .
+.Sh RETURN VALUES
+Both functions return boolean true if the type of access specified
+by
+.Fa rw
+is permitted.
+Otherwise boolean false is returned.
+.Sh BUGS
+The process pointer should be passed in as an argument to
+.Fn useracc .
diff --git a/share/man/man9/kernel_mount.9 b/share/man/man9/kernel_mount.9
new file mode 100644
index 000000000000..f34e759016ad
--- /dev/null
+++ b/share/man/man9/kernel_mount.9
@@ -0,0 +1,212 @@
+.\"
+.\" Copyright (c) 2004 Tom Rhodes
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 13, 2004
+.Dt KERNEL_MOUNT 9
+.Os
+.Sh NAME
+.Nm free_mntarg ,
+.Nm kernel_mount ,
+.Nm kernel_vmount ,
+.Nm mount_arg ,
+.Nm mount_argb ,
+.Nm mount_argf ,
+.Nm mount_argsu
+.Nd "functions provided as part of the kernel mount interface"
+.Sh SYNOPSIS
+.Ft void
+.Fn free_mntarg "struct mntarg *ma"
+.Ft int
+.Fn kernel_mount "struct mntarg *ma" "int flags"
+.Ft int
+.Fn kernel_vmount "int flags" ...
+.Ft "struct mntarg *"
+.Fo mount_arg
+.Fa "struct mntarg *ma" "const char *name" "const void *val" "int len"
+.Fc
+.Ft "struct mntarg *"
+.Fn mount_argb "struct mntarg *ma" "int flag" "const char *name"
+.Ft "struct mntarg *"
+.Fn mount_argf "struct mntarg *ma" "const char *name" "const char *fmt" ...
+.Ft "struct mntarg *"
+.Fo mount_argsu
+.Fa "struct mntarg *ma" "const char *name" "const void *val" "int len"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn kernel_mount
+family of functions are provided as an API for building a list
+of mount arguments which will be used to mount file systems
+from inside the kernel.
+By accumulating a list of arguments, the API takes shape and
+provides the information necessary for the kernel to control
+the
+.Xr mount 8
+utility.
+When an error occurs, the process will stop.
+This will not cause a
+.Xr panic 9 .
+.Pp
+The header of the structure is stored in
+.Pa src/sys/kern/vfs_mount.c
+which permits automatic structure creation to
+ease the mount process.
+Memory allocation must always be freed when the entire
+process is complete, it is an error otherwise.
+.Pp
+The
+.Fn free_mntarg
+function is used to free or clear the
+.Vt mntarg
+structure.
+.Pp
+The
+.Fn kernel_mount
+function pulls information from the structure to perform
+the mount request on a given file system.
+Additionally, the
+.Fn kernel_mount
+function always calls the
+.Fn free_mntarg
+function.
+If
+.Fa ma
+contains any error code generated during the construction,
+that code will be called and the file system mount will
+not be attempted.
+.Pp
+The
+.Fn kernel_vmount
+is a function similar to
+.Xr printf 9
+which is used to mount a file system.
+.Pp
+The
+.Fn mount_arg
+function takes a plain argument and crafts parts of
+the structure with regards to various mount options.
+If the length is a value less than 0,
+.Xr strlen 3
+is used.
+This argument will be referenced until either
+.Fn free_mntarg
+or
+.Fn kernel_mount
+is called.
+.Pp
+The
+.Fn mount_argb
+function is used to add boolean arguments to
+the structure.
+The
+.Fa flag
+is the boolean value and
+.Fa name
+must start with
+.Qq Li no ,
+otherwise a panic will occur.
+.Pp
+The
+.Fn mount_argf
+function adds
+.Xr printf 9
+style arguments to the current structure.
+.Pp
+The
+.Fn mount_argsu
+function will add arguments to the structure from a
+userland string.
+.Sh EXAMPLES
+An example of the
+.Fn *_cmount
+function:
+.Bd -literal
+static int
+msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
+{
+ struct msdosfs_args args;
+ int error;
+
+ if (data == NULL)
+ return (EINVAL);
+ error = copyin(data, &args, sizeof args);
+ if (error)
+ return (error);
+
+ ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN);
+ ma = mount_arg(ma, "export", &args.export, sizeof args.export);
+ ma = mount_argf(ma, "uid", "%d", args.uid);
+ ma = mount_argf(ma, "gid", "%d", args.gid);
+ ma = mount_argf(ma, "mask", "%d", args.mask);
+ ma = mount_argf(ma, "dirmask", "%d", args.dirmask);
+
+ ma = mount_argb(ma, args.flags & MSDOSFSMNT_SHORTNAME, "noshortname");
+ ma = mount_argb(ma, args.flags & MSDOSFSMNT_LONGNAME, "nolongname");
+ ma = mount_argb(ma, !(args.flags & MSDOSFSMNT_NOWIN95), "nowin95");
+ ma = mount_argb(ma, args.flags & MSDOSFSMNT_KICONV, "nokiconv");
+
+ ma = mount_argsu(ma, "cs_win", args.cs_win, MAXCSLEN);
+ ma = mount_argsu(ma, "cs_dos", args.cs_dos, MAXCSLEN);
+ ma = mount_argsu(ma, "cs_local", args.cs_local, MAXCSLEN);
+
+ error = kernel_mount(ma, flags);
+
+ return (error);
+}
+.Ed
+.Pp
+When working with
+.Fn kernel_vmount ,
+.Fa varargs
+must come in pairs, e.g.,
+.Brq Va name , value .
+.Bd -literal
+ error = kernel_vmount(
+ MNT_RDONLY,
+ "fstype", vfsname,
+ "fspath", "/",
+ "from", path,
+ NULL);
+.Ed
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_MOUNT 9 ,
+.Xr vfs_mount 9
+.Sh HISTORY
+The
+.Fn kernel_mount
+family of functions and this manual page first
+appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Fn kernel_mount
+family of functions and API was developed by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/share/man/man9/khelp.9 b/share/man/man9/khelp.9
new file mode 100644
index 000000000000..2f3f0e1284d9
--- /dev/null
+++ b/share/man/man9/khelp.9
@@ -0,0 +1,438 @@
+.\"
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written at the Centre for Advanced Internet
+.\" Architectures, Swinburne University of Technology, Melbourne, Australia by
+.\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD
+.\" Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 15, 2011
+.Dt KHELP 9
+.Os
+.Sh NAME
+.Nm khelp ,
+.Nm khelp_init_osd ,
+.Nm khelp_destroy_osd ,
+.Nm khelp_get_id ,
+.Nm khelp_get_osd ,
+.Nm khelp_add_hhook ,
+.Nm khelp_remove_hhook ,
+.Nm KHELP_DECLARE_MOD ,
+.Nm KHELP_DECLARE_MOD_UMA
+.Nd Kernel Helper Framework
+.Sh SYNOPSIS
+.In sys/khelp.h
+.In sys/module_khelp.h
+.Fn "int khelp_init_osd" "uint32_t classes" "struct osd *hosd"
+.Fn "int khelp_destroy_osd" "struct osd *hosd"
+.Fn "int32_t khelp_get_id" "char *hname"
+.Fn "void * khelp_get_osd" "struct osd *hosd" "int32_t id"
+.Fn "int khelp_add_hhook" "struct hookinfo *hki" "uint32_t flags"
+.Fn "int khelp_remove_hhook" "struct hookinfo *hki"
+.Fn KHELP_DECLARE_MOD "hname" "hdata" "hhooks" "version"
+.Fn KHELP_DECLARE_MOD_UMA "hname" "hdata" "hhooks" "version" "ctor" "dtor"
+.Sh DESCRIPTION
+.Nm
+provides a framework for managing
+.Nm
+modules, which indirectly use the
+.Xr hhook 9
+KPI to register their hook functions with hook points of interest within the
+kernel.
+Khelp modules aim to provide a structured way to dynamically extend the kernel
+at runtime in an ABI preserving manner.
+Depending on the subsystem providing hook points, a
+.Nm
+module may be able to associate per-object data for maintaining relevant state
+between hook calls.
+The
+.Xr hhook 9
+and
+.Nm
+frameworks are tightly integrated and anyone interested in
+.Nm
+should also read the
+.Xr hhook 9
+manual page thoroughly.
+.Ss Information for Khelp Module Implementors
+.Nm
+modules are represented within the
+.Nm
+framework by a
+.Vt struct helper
+which has the following members:
+.Bd -literal -offset indent
+struct helper {
+ int (*mod_init) (void);
+ int (*mod_destroy) (void);
+#define HELPER_NAME_MAXLEN 16
+ char h_name[HELPER_NAME_MAXLEN];
+ uma_zone_t h_zone;
+ struct hookinfo *h_hooks;
+ uint32_t h_nhooks;
+ uint32_t h_classes;
+ int32_t h_id;
+ volatile uint32_t h_refcount;
+ uint16_t h_flags;
+ TAILQ_ENTRY(helper) h_next;
+};
+.Ed
+.Pp
+Modules must instantiate a
+.Vt struct helper ,
+but are only required to set the
+.Va h_classes
+field, and may optionally set the
+.Va h_flags ,
+.Va mod_init
+and
+.Va mod_destroy
+fields where required.
+The framework takes care of all other fields and modules should refrain from
+manipulating them.
+Using the C99 designated initialiser feature to set fields is encouraged.
+.Pp
+If specified, the
+.Va mod_init
+function will be run by the
+.Nm
+framework prior to completing the registration process.
+Returning a non-zero value from the
+.Va mod_init
+function will abort the registration process and fail to load the module.
+If specified, the
+.Va mod_destroy
+function will be run by the
+.Nm
+framework during the deregistration process, after the module has been
+deregistered by the
+.Nm
+framework.
+The return value is currently ignored.
+Valid
+.Nm
+classes are defined in
+.In sys/khelp.h .
+Valid flags are defined in
+.In sys/module_khelp.h .
+The HELPER_NEEDS_OSD flag should be set in the
+.Va h_flags
+field if the
+.Nm
+module requires persistent per-object data storage.
+There is no programmatic way (yet) to check if a
+.Nm
+class provides the ability for
+.Nm
+modules to associate persistent per-object data, so a manual check is required.
+.Pp
+The
+.Fn KHELP_DECLARE_MOD
+and
+.Fn KHELP_DECLARE_MOD_UMA
+macros provide convenient wrappers around the
+.Xr DECLARE_MODULE 9
+macro, and are used to register a
+.Nm
+module with the
+.Nm
+framework.
+.Fn KHELP_DECLARE_MOD_UMA
+should only be used by modules which require the use of persistent per-object
+storage i.e. modules which set the HELPER_NEEDS_OSD flag in their
+.Vt struct helper Ns 's
+.Va h_flags
+field.
+.Pp
+The first four arguments common to both macros are as follows.
+The
+.Fa hname
+argument specifies the unique
+.Xr ascii 7
+name for the
+.Nm
+module.
+It should be no longer than HELPER_NAME_MAXLEN-1 characters in length.
+The
+.Fa hdata
+argument is a pointer to the module's
+.Vt struct helper .
+The
+.Fa hhooks
+argument points to a static array of
+.Vt struct hookinfo
+structures.
+The array should contain a
+.Vt struct hookinfo
+for each
+.Xr hhook 9
+point the module wishes to hook, even when using the same hook function multiple
+times for different
+.Xr hhook 9
+points.
+The
+.Fa version
+argument specifies a version number for the module which will be passed to
+.Xr MODULE_VERSION 9 .
+The
+.Fn KHELP_DECLARE_MOD_UMA
+macro takes the additional
+.Fa ctor
+and
+.Fa dtor
+arguments, which specify optional
+.Xr uma 9
+constructor and destructor functions.
+NULL should be passed where the functionality is not required.
+.Pp
+The
+.Fn khelp_get_id
+function returns the numeric identifier for the
+.Nm
+module with name
+.Fa hname .
+.Pp
+The
+.Fn khelp_get_osd
+function is used to obtain the per-object data pointer for a specified
+.Nm
+module.
+The
+.Fa hosd
+argument is a pointer to the underlying subsystem object's
+.Vt struct osd .
+This is provided by the
+.Xr hhook 9
+framework when calling into a
+.Nm
+module's hook function.
+The
+.Fa id
+argument specifies the numeric identifier for the
+.Nm
+module to extract the data pointer from
+.Fa hosd
+for.
+The
+.Fa id
+is obtained using the
+.Fn khelp_get_id
+function.
+.Pp
+The
+.Fn khelp_add_hhook
+and
+.Fn khelp_remove_hhook
+functions allow a
+.Nm
+module to dynamically hook/unhook
+.Xr hhook 9
+points at run time.
+The
+.Fa hki
+argument specifies a pointer to a
+.Vt struct hookinfo
+which encapsulates the required information about the
+.Xr hhook 9
+point and hook function being manipulated.
+The HHOOK_WAITOK flag may be passed in via the
+.Fa flags
+argument of
+.Fn khelp_add_hhook
+if
+.Xr malloc 9
+is allowed to sleep waiting for memory to become available.
+.Ss Integrating Khelp Into a Kernel Subsystem
+Most of the work required to allow
+.Nm
+modules to do useful things relates to defining and instantiating suitable
+.Xr hhook 9
+points for
+.Nm
+modules to hook into.
+The only additional decision a subsystem needs to make is whether it wants to
+allow
+.Nm
+modules to associate persistent per-object data.
+Providing support for persistent data storage can allow
+.Nm
+modules to perform more complex functionality which may be desirable.
+Subsystems which want to allow Khelp modules to associate
+persistent per-object data with one of the subsystem's data structures need to
+make the following two key changes:
+.Bl -bullet
+.It
+Embed a
+.Vt struct osd
+pointer in the structure definition for the object.
+.It
+Add calls to
+.Fn khelp_init_osd
+and
+.Fn khelp_destroy_osd
+to the subsystem code paths which are responsible for respectively initialising
+and destroying the object.
+.El
+.Pp
+The
+.Fn khelp_init_osd
+function initialises the per-object data storage for all currently loaded
+.Nm
+modules of appropriate classes which have set the HELPER_NEEDS_OSD flag in their
+.Va h_flags
+field.
+The
+.Fa classes
+argument specifies a bitmask of
+.Nm
+classes which this subsystem associates with.
+If a
+.Nm
+module matches any of the classes in the bitmask, that module will be associated
+with the object.
+The
+.Fa hosd
+argument specifies the pointer to the object's
+.Vt struct osd
+which will be used to provide the persistent storage for use by
+.Nm
+modules.
+.Pp
+The
+.Fn khelp_destroy_osd
+function frees all memory that was associated with an object's
+.Vt struct osd
+by a previous call to
+.Fn khelp_init_osd .
+The
+.Fa hosd
+argument specifies the pointer to the object's
+.Vt struct osd
+which will be purged in preparation for destruction.
+.Sh IMPLEMENTATION NOTES
+.Nm
+modules are protected from being prematurely unloaded by a reference count.
+The count is incremented each time a subsystem calls
+.Fn khelp_init_osd
+causing persistent storage to be allocated for the module, and decremented for
+each corresponding call to
+.Fn khelp_destroy_osd .
+Only when a module's reference count has dropped to zero can the module be
+unloaded.
+.Sh RETURN VALUES
+The
+.Fn khelp_init_osd
+function returns zero if no errors occurred.
+It returns ENOMEM if a
+.Nm
+module which requires per-object storage fails to allocate the necessary memory.
+.Pp
+The
+.Fn khelp_destroy_osd
+function only returns zero to indicate that no errors occurred.
+.Pp
+The
+.Fn khelp_get_id
+function returns the unique numeric identifier for the registered
+.Nm
+module with name
+.Fa hname .
+It return -1 if no module with the specified name is currently registered.
+.Pp
+The
+.Fn khelp_get_osd
+function returns the pointer to the
+.Nm
+module's persistent object storage memory.
+If the module identified by
+.Fa id
+does not have persistent object storage registered with the object's
+.Fa hosd
+.Vt struct osd ,
+NULL is returned.
+.Pp
+The
+.Fn khelp_add_hhook
+function returns zero if no errors occurred.
+It returns ENOENT if it could not find the requested
+.Xr hhook 9
+point.
+It returns ENOMEM if
+.Xr malloc 9
+failed to allocate memory.
+It returns EEXIST if attempting to register the same hook function more than
+once for the same
+.Xr hhook 9
+point.
+.Pp
+The
+.Fn khelp_remove_hhook
+function returns zero if no errors occurred.
+It returns ENOENT if it could not find the requested
+.Xr hhook 9
+point.
+.Sh EXAMPLES
+A well commented example Khelp module can be found at:
+.Pa /usr/share/examples/kld/khelp/h_example.c
+.Pp
+The Enhanced Round Trip Time (ERTT)
+.Xr h_ertt 4
+.Nm
+module provides a more complex example of what is possible.
+.Sh SEE ALSO
+.Xr h_ertt 4 ,
+.Xr hhook 9 ,
+.Xr osd 9
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh HISTORY
+The
+.Nm
+kernel helper framework first appeared in
+.Fx 9.0 .
+.Pp
+The
+.Nm
+framework was first released in 2010 by Lawrence Stewart whilst studying at
+Swinburne University of Technology's Centre for Advanced Internet Architectures,
+Melbourne, Australia.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+framework was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
+.Pp
+This manual page was written by
+.An David Hayes Aq david.hayes@ieee.org
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man9/kobj.9 b/share/man/man9/kobj.9
new file mode 100644
index 000000000000..0e1745e6bd6b
--- /dev/null
+++ b/share/man/man9/kobj.9
@@ -0,0 +1,156 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 14, 2011
+.Dt KOBJ 9
+.Os
+.Sh NAME
+.Nm kobj
+.Nd a kernel object system for FreeBSD
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kobj.h
+.Ft void
+.Fn kobj_class_compile "kobj_class_t cls"
+.Ft void
+.Fn kobj_class_compile_static "kobj_class_t cls" "kobj_ops_t ops"
+.Ft void
+.Fn kobj_class_free "kobj_class_t cls"
+.Ft kobj_t
+.Fn kobj_create "kobj_class_t cls" "struct malloc_type *mtype" "int mflags"
+.Ft void
+.Fn kobj_init "kobj_t obj" "kobj_class_t cls"
+.Ft void
+.Fn kobj_init_static "kobj_t obj" "kobj_class_t cls"
+.Ft void
+.Fn kobj_delete "kobj_t obj" "struct malloc_type *mtype"
+.Fn DEFINE_CLASS name "kobj_method_t *methods" "size_t size"
+.Sh DESCRIPTION
+The kernel object system implements an object-oriented programming
+system in the
+.Fx
+kernel.
+The system is based around the concepts of interfaces, which are
+descriptions of sets of methods; classes, which are lists of functions
+implementing certain methods from those interfaces; and objects,
+which combine a class with a structure in memory.
+.Pp
+Methods are called using a dynamic method dispatching algorithm which
+is designed to allow new interfaces and classes to be introduced into
+the system at runtime.
+The method dispatch algorithm is designed to be both fast and robust
+and is only slightly more expensive than a direct function call,
+making kernel objects suitable for performance-critical algorithms.
+.Pp
+Suitable uses for kernel objects are any algorithms which need some
+kind of polymorphism (i.e., many different objects which can be treated
+in a uniform way).
+The common behaviour of the objects is described by a suitable
+interface and each different type of object is implemented by a
+suitable class.
+.Pp
+The simplest way to create a kernel object is to call
+.Fn kobj_create
+with a suitable class, malloc type and flags (see
+.Xr malloc 9
+for a description of the malloc type and flags).
+This will allocate memory for the object based on the object size
+specified by the class and initialise it by zeroing the memory and
+installing a pointer to the class' method dispatch table.
+Objects created in this way should be freed by calling
+.Fn kobj_delete .
+.Pp
+Clients which would like to manage the allocation of memory
+themselves should call
+.Fn kobj_init
+or
+.Fn kobj_init_static
+with a pointer to the memory for the object and the class which
+implements it.
+It is also possible to use
+.Fn kobj_init
+and
+.Fn kobj_init_static
+to change the class for an object.
+This should be done with care as the classes must agree on the layout
+of the object.
+The device framework uses this feature to associate drivers with
+devices.
+.Pp
+The functions
+.Fn kobj_class_compile ,
+.Fn kobj_class_compile_static
+and
+.Fn kobj_class_free
+are used to process a class description to make method dispatching
+efficient.
+A client should not normally need to call these since a class
+will automatically be compiled the first time it is used.
+If a class is to be used before
+.Xr malloc 9
+and
+.Xr mutex 9
+are initialised,
+then
+.Fn kobj_class_compile_static
+should be called with the class and a pointer to a statically
+allocated
+.Vt kobj_ops
+structure before the class is used to initialise any objects.
+In that case, also
+.Fn kobj_init_static
+should be used instead of
+.Fn kobj_init .
+.Pp
+To define a class, first define a simple array of
+.Vt kobj_method_t .
+Each method which the class implements should be entered into the
+table using the macro
+.Fn KOBJMETHOD
+which takes the name of the method (including its interface) and a
+pointer to a function which implements it.
+The table should be terminated with two zeros.
+The macro
+.Fn DEFINE_CLASS
+can then be used to initialise a
+.Vt kobj_class_t
+structure.
+The size argument to
+.Fn DEFINE_CLASS
+specifies how much memory should be allocated for each object.
+.Sh HISTORY
+Some of the concepts for this interface appeared in the device
+framework used for the alpha port of
+.Fx 3.0
+and more widely in
+.Fx 4.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/kproc.9 b/share/man/man9/kproc.9
new file mode 100644
index 000000000000..613ac31bc157
--- /dev/null
+++ b/share/man/man9/kproc.9
@@ -0,0 +1,395 @@
+.\" Copyright (c) 2000-2001
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 19, 2007
+.Dt KPROC 9
+.Os
+.Sh NAME
+.Nm kproc_start ,
+.Nm kproc_shutdown ,
+.Nm kproc_create ,
+.Nm kproc_exit ,
+.Nm kproc_resume ,
+.Nm kproc_suspend ,
+.Nm kproc_suspend_check
+.Nd "kernel processes"
+.Sh SYNOPSIS
+.In sys/kthread.h
+.Ft void
+.Fn kproc_start "const void *udata"
+.Ft void
+.Fn kproc_shutdown "void *arg" "int howto"
+.Ft int
+.Fo kproc_create
+.Fa "void (*func)(void *)" "void *arg" "struct proc **newpp"
+.Fa "int flags" "int pages"
+.Fa "const char *fmt" ...
+.Fc
+.Ft void
+.Fn kproc_exit "int ecode"
+.Ft int
+.Fn kproc_resume "struct proc *p"
+.Ft int
+.Fn kproc_suspend "struct proc *p" "int timo"
+.Ft void
+.Fn kproc_suspend_check "struct proc *p"
+.Ft int
+.Fo kproc_kthread_add
+.Fa "void (*func)(void *)" "void *arg"
+.Fa "struct proc **procptr" "struct thread **tdptr"
+.Fa "int flags" "int pages" "char * procname" "const char *fmt" "..."
+.Fc
+.Sh DESCRIPTION
+In
+.Fx 8.0 ,
+the
+.Fn kthread* 9
+family of functions was renamed to be the
+.Fn kproc* 9
+family of functions, as they were misnamed
+and actually produced kernel processes.
+A new family of
+.Em different
+.Fn kthread_* 9
+functions was added to produce
+.Em real
+kernel
+.Em threads .
+See the
+.Xr kthread 9
+man page for more information on those calls.
+Also note that the
+.Fn kproc_kthread_add 9
+function appears in both pages as its functionality is split.
+.Pp
+The function
+.Fn kproc_start
+is used to start
+.Dq internal
+daemons such as
+.Nm bufdaemon , pagedaemon , vmdaemon ,
+and the
+.Nm syncer
+and is intended
+to be called from
+.Xr SYSINIT 9 .
+The
+.Fa udata
+argument is actually a pointer to a
+.Vt "struct kproc_desc"
+which describes the kernel process that should be created:
+.Bd -literal -offset indent
+struct kproc_desc {
+ char *arg0;
+ void (*func)(void);
+ struct proc **global_procpp;
+};
+.Ed
+.Pp
+The structure members are used by
+.Fn kproc_start
+as follows:
+.Bl -tag -width ".Va global_procpp" -offset indent
+.It Va arg0
+String to be used for the name of the process.
+This string will be copied into the
+.Va p_comm
+member of the new process'
+.Vt "struct proc" .
+.It Va func
+The main function for this kernel process to run.
+.It Va global_procpp
+A pointer to a
+.Vt "struct proc"
+pointer that should be updated to point to the newly created process' process
+structure.
+If this variable is
+.Dv NULL ,
+then it is ignored.
+.El
+.Pp
+The
+.Fn kproc_create
+function is used to create a kernel process.
+The new process shares its address space with process 0, the
+.Nm swapper
+process,
+and runs in kernel mode only.
+The
+.Fa func
+argument specifies the function that the process should execute.
+The
+.Fa arg
+argument is an arbitrary pointer that is passed in as the only argument to
+.Fa func
+when it is called by the new process.
+The
+.Fa newpp
+pointer points to a
+.Vt "struct proc"
+pointer that is to be updated to point to the newly created process.
+If this argument is
+.Dv NULL ,
+then it is ignored.
+The
+.Fa flags
+argument specifies a set of flags as described in
+.Xr rfork 2 .
+The
+.Fa pages
+argument specifies the size of the new kernel process's stack in pages.
+If 0 is used, the default kernel stack size is allocated.
+The rest of the arguments form a
+.Xr printf 9
+argument list that is used to build the name of the new process and is stored
+in the
+.Va p_comm
+member of the new process's
+.Vt "struct proc" .
+.Pp
+The
+.Fn kproc_exit
+function is used to terminate kernel processes.
+It should be called by the main function of the kernel process rather than
+letting the main function return to its caller.
+The
+.Fa ecode
+argument specifies the exit status of the process.
+While exiting, the function
+.Xr exit1 9
+will initiate a call to
+.Xr wakeup 9
+on the process handle.
+.Pp
+The
+.Fn kproc_resume ,
+.Fn kproc_suspend ,
+and
+.Fn kproc_suspend_check
+functions are used to suspend and resume a kernel process.
+During the main loop of its execution, a kernel process that wishes to allow
+itself to be suspended should call
+.Fn kproc_suspend_check
+passing in
+.Va curproc
+as the only argument.
+This function checks to see if the kernel process has been asked to suspend.
+If it has, it will
+.Xr tsleep 9
+until it is told to resume.
+Once it has been told to resume it will return allowing execution of the
+kernel process to continue.
+The other two functions are used to notify a kernel process of a suspend or
+resume request.
+The
+.Fa p
+argument points to the
+.Vt "struct proc"
+of the kernel process to suspend or resume.
+For
+.Fn kproc_suspend ,
+the
+.Fa timo
+argument specifies a timeout to wait for the kernel process to acknowledge the
+suspend request and suspend itself.
+.Pp
+The
+.Fn kproc_shutdown
+function is meant to be registered as a shutdown event for kernel processes that
+need to be suspended voluntarily during system shutdown so as not to interfere
+with system shutdown activities.
+The actual suspension of the kernel process is done with
+.Fn kproc_suspend .
+.Pp
+The
+.Fn kproc_kthread_add
+function is much like the
+.Fn kproc_create
+function above except that if the kproc already exists,
+then only a new thread (see
+.Xr kthread 9 )
+is created on the existing process.
+The
+.Fa func
+argument specifies the function that the process should execute.
+The
+.Fa arg
+argument is an arbitrary pointer that is passed in as the only argument to
+.Fa func
+when it is called by the new process.
+The
+.Fa procptr
+pointer points to a
+.Vt "struct proc"
+pointer that is the location to be updated with the new proc pointer
+if a new process is created, or if not
+.Dv NULL ,
+must contain the process pointer for the already existing process.
+If this argument points to
+.Dv NULL ,
+then a new process is created and the field updated.
+If not NULL, the
+.Fa tdptr
+pointer points to a
+.Vt "struct thread"
+pointer that is the location to be updated with the new thread pointer.
+The
+.Fa flags
+argument specifies a set of flags as described in
+.Xr rfork 2 .
+The
+.Fa pages
+argument specifies the size of the new kernel thread's stack in pages.
+If 0 is used, the default kernel stack size is allocated.
+The procname argument is the name the new process should be given if it needs to be created.
+It is
+.Em NOT
+a printf style format specifier but a simple string.
+The rest of the arguments form a
+.Xr printf 9
+argument list that is used to build the name of the new thread and is stored
+in the
+.Va td_name
+member of the new thread's
+.Vt "struct thread" .
+.Sh RETURN VALUES
+The
+.Fn kproc_create ,
+.Fn kproc_resume ,
+and
+.Fn kproc_suspend
+functions return zero on success and non-zero on failure.
+.Sh EXAMPLES
+This example demonstrates the use of a
+.Vt "struct kproc_desc"
+and the functions
+.Fn kproc_start ,
+.Fn kproc_shutdown ,
+and
+.Fn kproc_suspend_check
+to run the
+.Nm bufdaemon
+process.
+.Bd -literal -offset indent
+static struct proc *bufdaemonproc;
+
+static struct kproc_desc buf_kp = {
+ "bufdaemon",
+ buf_daemon,
+ &bufdaemonproc
+};
+SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start,
+ &buf_kp)
+
+static void
+buf_daemon()
+{
+ ...
+ /*
+ * This process needs to be suspended prior to shutdown sync.
+ */
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown,
+ bufdaemonproc, SHUTDOWN_PRI_LAST);
+ ...
+ for (;;) {
+ kproc_suspend_check(bufdaemonproc);
+ ...
+ }
+}
+.Ed
+.Sh ERRORS
+The
+.Fn kproc_resume
+and
+.Fn kproc_suspend
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa p
+argument does not reference a kernel process.
+.El
+.Pp
+The
+.Fn kproc_create
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system-imposed limit on the total
+number of processes under execution would be exceeded.
+The limit is given by the
+.Xr sysctl 3
+MIB variable
+.Dv KERN_MAXPROC .
+.It Bq Er EINVAL
+The
+.Dv RFCFDG
+flag was specified in the
+.Fa flags
+parameter.
+.El
+.Sh SEE ALSO
+.Xr rfork 2 ,
+.Xr exit1 9 ,
+.Xr kthread 9 ,
+.Xr SYSINIT 9 ,
+.Xr wakeup 9
+.Sh HISTORY
+The
+.Fn kproc_start
+function first appeared in
+.Fx 2.2 .
+The
+.Fn kproc_shutdown ,
+.Fn kproc_create ,
+.Fn kproc_exit ,
+.Fn kproc_resume ,
+.Fn kproc_suspend ,
+and
+.Fn kproc_suspend_check
+functions were introduced in
+.Fx 4.0 .
+Prior to
+.Fx 5.0 ,
+the
+.Fn kproc_shutdown ,
+.Fn kproc_resume ,
+.Fn kproc_suspend ,
+and
+.Fn kproc_suspend_check
+functions were named
+.Fn shutdown_kproc ,
+.Fn resume_kproc ,
+.Fn shutdown_kproc ,
+and
+.Fn kproc_suspend_loop ,
+respectively.
+Originally they had the names
+.Fn kthread_*
+but were changed to
+.Fn kproc_*
+when real kthreads became available.
diff --git a/share/man/man9/kqueue.9 b/share/man/man9/kqueue.9
new file mode 100644
index 000000000000..555fe545e611
--- /dev/null
+++ b/share/man/man9/kqueue.9
@@ -0,0 +1,467 @@
+.\" Copyright 2006,2011 John-Mark Gurney
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 26, 2012
+.Dt KQUEUE 9
+.Os
+.Sh NAME
+.Nm kqueue_add_filteropts , kqueue_del_filteropts ,
+.Nm kqfd_register ,
+.Nm knote_fdclose ,
+.Nm knlist_init , knlist_init_mtx , knlist_init_rw_reader ,
+.Nm knlist_add , knlist_remove , knlist_remove_inevent , knlist_empty ,
+.Nm knlist_clear , knlist_delete , knlist_destroy ,
+.Nm KNOTE_LOCKED , KNOTE_UNLOCKED
+.Nd "event delivery subsystem"
+.Sh SYNOPSIS
+.In sys/event.h
+.Ft int
+.Fn kqueue_add_filteropts "int filt" "struct filterops *filtops"
+.Ft int
+.Fn kqueue_del_filteropts "int filt"
+.Ft int
+.Fn kqfd_register "int fd" "struct kevent *kev" "struct thread *td" "int waitok"
+.Ft void
+.Fn knote_fdclose "struct thread *td" "int fd"
+.Ft void
+.Fo knlist_init
+.Fa "struct knlist *knl"
+.Fa "void *lock"
+.Fa "void \*[lp]*kl_lock\*[rp]\*[lp]void *\*[rp]"
+.Fa "void \*[lp]*kl_unlock\*[rp]\*[lp]void *\*[rp]"
+.Fa "int \*[lp]*kl_locked\*[rp]\*[lp]void *\*[rp]"
+.Fc
+.Ft void
+.Fn knlist_init_mtx "struct knlist *knl" "struct mtx *lock"
+.Ft void
+.Fn knlist_init_rw_reader "struct knlist *knl" "struct rwlock *lock"
+.Ft void
+.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove_inevent "struct knlist *knl" "struct knote *kn"
+.Ft int
+.Fn knlist_empty "struct knlist *knl"
+.Ft void
+.Fn knlist_clear "struct knlist *knl" "int islocked"
+.Ft void
+.Fn knlist_delete "struct knlist *knl" "struct thread *td" "int islocked"
+.Ft void
+.Fn knlist_destroy "struct knlist *knl"
+.Ft void
+.Fn KNOTE_LOCKED "struct knlist *knl" "long hint"
+.Ft void
+.Fn KNOTE_UNLOCKED "struct knlist *knl" "long hint"
+.Sh DESCRIPTION
+The functions
+.Fn kqueue_add_filteropts
+and
+.Fn kqueue_del_filteropts
+allow for the addition and removal of a filter type.
+The filter is statically defined by the
+.Dv EVFILT_*
+macros.
+The function
+.Fn kqueue_add_filteropts
+will make
+.Fa filt
+available.
+The
+.Vt "struct filterops"
+has the following members:
+.Bl -tag -width ".Va f_attach"
+.It Va f_isfd
+If
+.Va f_isfd
+is set,
+.Va ident
+in
+.Vt "struct kevent"
+is taken to be a file descriptor.
+In this case, the
+.Vt knote
+passed into
+.Va f_attach
+will have the
+.Va kn_fp
+member initialized to the
+.Vt "struct file *"
+that represents the file descriptor.
+.It Va f_attach
+The
+.Va f_attach
+function will be called when attaching a
+.Vt knote
+to the object.
+The method should call
+.Fn knlist_add
+to add the
+.Vt knote
+to the list that was initialized with
+.Fn knlist_init .
+The call to
+.Fn knlist_add
+is only necessary if the object can have multiple
+.Vt knotes
+associated with it.
+If there is no
+.Vt knlist
+to call
+.Fn knlist_add
+with, the function
+.Va f_attach
+must clear the
+.Dv KN_DETACHED
+bit of
+.Va kn_status
+in the
+.Vt knote .
+The function shall return 0 on success, or appropriate error for the failure,
+such as when the object is being destroyed, or does not exist.
+During
+.Va f_attach ,
+it is valid to change the
+.Va kn_fops
+pointer to a different pointer.
+This will change the
+.Va f_event
+and
+.Va f_detach
+functions called when processing the
+.Vt knote .
+.It Va f_detach
+The
+.Va f_detach
+function will be called to detach the
+.Vt knote
+if the
+.Vt knote
+has not already been detached by a call to
+.Fn knlist_remove ,
+.Fn knlist_remove_inevent
+or
+.Fn knlist_delete .
+The list
+.Fa lock
+will not be held when this function is called.
+.It Va f_event
+The
+.Va f_event
+function will be called to update the status of the
+.Vt knote .
+If the function returns 0, it will be assumed that the object is not
+ready (or no longer ready) to be woken up.
+The
+.Fa hint
+argument will be 0 when scanning
+.Vt knotes
+to see which are triggered.
+Otherwise, the
+.Fa hint
+argument will be the value passed to either
+.Dv KNOTE_LOCKED
+or
+.Dv KNOTE_UNLOCKED .
+The
+.Va kn_data
+value should be updated as necessary to reflect the current value, such as
+number of bytes available for reading, or buffer space available for writing.
+If the note needs to be removed,
+.Fn knlist_remove_inevent
+must be called.
+The function
+.Fn knlist_remove_inevent
+will remove the note from the list, the
+.Va f_detach
+function will not be called and the
+.Vt knote
+will not be returned as an event.
+.Pp
+Locks
+.Em must not
+be acquired in
+.Va f_event .
+If a lock is required in
+.Va f_event ,
+it must be obtained in the
+.Fa kl_lock
+function of the
+.Vt knlist
+that the
+.Va knote
+was added to.
+.El
+.Pp
+The function
+.Fn kqfd_register
+will register the
+.Vt kevent
+on the kqueue file descriptor
+.Fa fd .
+If it is safe to sleep,
+.Fa waitok
+should be set.
+.Pp
+The function
+.Fn knote_fdclose
+is used to delete all
+.Vt knotes
+associated with
+.Fa fd .
+Once returned, there will no longer be any
+.Vt knotes
+associated with the
+.Fa fd .
+The
+.Vt knotes
+removed will never be returned from a
+.Xr kevent 2
+call, so if userland uses the
+.Vt knote
+to track resources, they will be leaked.
+The
+.Fn FILEDESC_LOCK
+lock must be held over the call to
+.Fn knote_fdclose
+so that file descriptors cannot be added or removed.
+.Pp
+The
+.Fn knlist_*
+family of functions are for managing
+.Vt knotes
+associated with an object.
+A
+.Vt knlist
+is not required, but is commonly used.
+If used, the
+.Vt knlist
+must be initialized with either
+.Fn knlist_init
+,
+.Fn knlist_init_mtx
+or
+.Fn knlist_init_rw_reader .
+The
+.Vt knlist
+structure may be embedded into the object structure.
+The
+.Fa lock
+will be held over
+.Va f_event
+calls.
+.Pp
+For the
+.Fn knlist_init
+function, if
+.Fa lock
+is
+.Dv NULL ,
+a shared global lock will be used and the remaining arguments must be
+.Dv NULL .
+The function pointers
+.Fa kl_lock , kl_unlock
+and
+.Fa kl_locked
+will be used to manipulate the argument
+.Fa lock .
+If any of the function pointers are
+.Dv NULL ,
+a function operating on
+.Dv MTX_DEF
+style
+.Xr mutex 9
+locks will be used instead.
+.Pp
+The function
+.Fn knlist_init_mtx
+may be used to initialize a
+.Vt knlist
+when
+.Fa lock
+is a
+.Dv MTX_DEF
+style
+.Xr mutex 9
+lock.
+.Pp
+The function
+.Fn knlist_init_rw_reader
+may be used to initialize a
+.Vt knlist
+when
+.Fa lock
+is a
+.Xr rwlock 9
+read lock.
+Lock is acquired via
+.Fn rw_rlock
+function.
+.Pp
+The function
+.Fn knlist_empty
+returns true when there are no
+.Vt knotes
+on the list.
+The function requires that the
+.Fa lock
+be held when called.
+.Pp
+The function
+.Fn knlist_clear
+removes all
+.Vt knotes
+from the list.
+The
+.Fa islocked
+argument declares if the
+.Fa lock
+has been acquired.
+All
+.Vt knotes
+will have
+.Dv EV_ONESHOT
+set so that the
+.Vt knote
+will be returned and removed durning the next scan.
+The
+.Va f_detach
+function will be called when the
+.Vt knote
+is deleted durning the next scan.
+This function must not be used when
+.Va f_isfd
+is set in
+.Vt "struct filterops" ,
+as the
+.Fa td
+argument of
+.Fn fdrop
+will be
+.Dv NULL .
+.Pp
+The function
+.Fn knlist_delete
+removes and deletes all
+.Vt knotes
+on the list.
+The function
+.Va f_detach
+will not be called, and the
+.Vt knote
+will not be returned on the next scan.
+Using this function could leak user land resources if a process uses the
+.Vt knote
+to track resources.
+.Pp
+Both the
+.Fn knlist_clear
+and
+.Fn knlist_delete
+functions may sleep.
+They also may release the
+.Fa lock
+to wait for other
+.Vt knotes
+to drain.
+.Pp
+The
+.Fn knlist_destroy
+function is used to destroy a
+.Vt knlist .
+There must be no
+.Vt knotes
+associated with the
+.Vt knlist
+.Fn ( knlist_empty
+returns true)
+and no more
+.Vt knotes
+may be attached to the object.
+A
+.Vt knlist
+may be emptied by calling
+.Fn knlist_clear
+or
+.Fn knlist_delete .
+.Pp
+The macros
+.Fn KNOTE_LOCKED
+and
+.Fn KNOTE_UNLOCKED
+are used to notify
+.Vt knotes
+about events associated with the object.
+It will iterate over all
+.Vt knotes
+on the list calling the
+.Va f_event
+function associated with the
+.Vt knote .
+The macro
+.Fn KNOTE_LOCKED
+must be used if the lock associated with the
+.Fa knl
+is held.
+The function
+.Fn KNOTE_UNLOCKED
+will acquire the lock before iterating over the list of
+.Vt knotes .
+.Sh RETURN VALUES
+The function
+.Fn kqueue_add_filteropts
+will return zero on success,
+.Er EINVAL
+in the case of an invalid
+.Fa filt ,
+or
+.Er EEXIST
+if the filter has already been installed.
+.Pp
+The function
+.Fn kqueue_del_filteropts
+will return zero on success,
+.Er EINVAL
+in the case of an invalid
+.Fa filt ,
+or
+.Er EBUSY
+if the filter is still in use.
+.Pp
+The function
+.Fn kqfd_register
+will return zero on success,
+.Er EBADF
+if the file descriptor is not a kqueue, or any of the possible values returned
+by
+.Xr kevent 2 .
+.Sh SEE ALSO
+.Xr kevent 2 ,
+.Xr kqueue 2
+.Sh AUTHORS
+This
+manual page was written by
+.An John-Mark Gurney Aq jmg@FreeBSD.org .
diff --git a/share/man/man9/kthread.9 b/share/man/man9/kthread.9
new file mode 100644
index 000000000000..25a20cecf9ed
--- /dev/null
+++ b/share/man/man9/kthread.9
@@ -0,0 +1,349 @@
+.\" Copyright (c) 2000-2001
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 24, 2010
+.Dt KTHREAD 9
+.Os
+.Sh NAME
+.Nm kthread_start ,
+.Nm kthread_shutdown ,
+.Nm kthread_add ,
+.Nm kthread_exit ,
+.Nm kthread_resume ,
+.Nm kthread_suspend ,
+.Nm kthread_suspend_check
+.Nd "kernel threads"
+.Sh SYNOPSIS
+.In sys/kthread.h
+.Ft void
+.Fn kthread_start "const void *udata"
+.Ft void
+.Fn kthread_shutdown "void *arg" "int howto"
+.Ft void
+.Fn kthread_exit "void"
+.Ft int
+.Fn kthread_resume "struct thread *td"
+.Ft int
+.Fn kthread_suspend "struct thread *td" "int timo"
+.Ft void
+.Fn kthread_suspend_check "void"
+.In sys/unistd.h
+.Ft int
+.Fo kthread_add
+.Fa "void (*func)(void *)" "void *arg" "struct proc *procp"
+.Fa "struct thread **newtdpp" "int flags" "int pages"
+.Fa "const char *fmt" ...
+.Fc
+.Ft int
+.Fo kproc_kthread_add
+.Fa "void (*func)(void *)" "void *arg"
+.Fa "struct proc **procptr" "struct thread **tdptr"
+.Fa "int flags" "int pages" "char * procname" "const char *fmt" "..."
+.Fc
+.Sh DESCRIPTION
+In
+.Fx 8.0 ,
+the older family of
+.Fn kthread_* 9
+functions was renamed to be the
+.Fn kproc_* 9
+family of functions,
+as they were previously misnamed
+and actually produced kernel processes.
+This new family of
+.Fn kthread_* 9
+functions was added to produce
+.Em real
+kernel threads.
+See the
+.Xr kproc 9
+man page for more information on the renamed calls.
+Also note that the
+.Fn kproc_kthread_add 9
+function appears in both pages as its functionality is split.
+.Pp
+The function
+.Fn kthread_start
+is used to start
+.Dq internal
+daemons such as
+.Nm bufdaemon , pagedaemon , vmdaemon ,
+and the
+.Nm syncer
+and is intended
+to be called from
+.Xr SYSINIT 9 .
+The
+.Fa udata
+argument is actually a pointer to a
+.Vt "struct kthread_desc"
+which describes the kernel thread that should be created:
+.Bd -literal -offset indent
+struct kthread_desc {
+ char *arg0;
+ void (*func)(void);
+ struct thread **global_threadpp;
+};
+.Ed
+.Pp
+The structure members are used by
+.Fn kthread_start
+as follows:
+.Bl -tag -width ".Va global_threadpp" -offset indent
+.It Va arg0
+String to be used for the name of the thread.
+This string will be copied into the
+.Va td_name
+member of the new threads'
+.Vt "struct thread" .
+.It Va func
+The main function for this kernel thread to run.
+.It Va global_threadpp
+A pointer to a
+.Vt "struct thread"
+pointer that should be updated to point to the newly created thread's
+.Vt thread
+structure.
+If this variable is
+.Dv NULL ,
+then it is ignored.
+The thread will be a subthread of
+.Va proc0
+(PID 0).
+.El
+.Pp
+The
+.Fn kthread_add
+function is used to create a kernel thread.
+The new thread runs in kernel mode only.
+It is added to the process specified by the
+.Fa procp
+argument, or if that is
+.Dv NULL ,
+to
+.Va proc0 .
+The
+.Fa func
+argument specifies the function that the thread should execute.
+The
+.Fa arg
+argument is an arbitrary pointer that is passed in as the only argument to
+.Fa func
+when it is called by the new thread.
+The
+.Fa newtdpp
+pointer points to a
+.Vt "struct thread"
+pointer that is to be updated to point to the newly created thread.
+If this argument is
+.Dv NULL ,
+then it is ignored.
+The
+.Fa flags
+argument may be set to
+.Dv RFSTOPPED
+to leave the thread in a stopped state.
+The caller must call
+.Fn sched_add
+to start the thread.
+The
+.Fa pages
+argument specifies the size of the new kernel thread's stack in pages.
+If 0 is used, the default kernel stack size is allocated.
+The rest of the arguments form a
+.Xr printf 9
+argument list that is used to build the name of the new thread and is stored
+in the
+.Va td_name
+member of the new thread's
+.Vt "struct thread" .
+.Pp
+The
+.Fn kproc_kthread_add
+function is much like the
+.Fn kthread_add
+function above except that if the kproc does not already
+exist, it is created.
+This function is better documented in the
+.Xr kproc 9
+manual page.
+.Pp
+The
+.Fn kthread_exit
+function is used to terminate kernel threads.
+It should be called by the main function of the kernel thread rather than
+letting the main function return to its caller.
+.\" XXX "int ecode" argument isn't documented.
+.Pp
+The
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
+and
+.Fn kthread_suspend_check
+functions are used to suspend and resume a kernel thread.
+During the main loop of its execution, a kernel thread that wishes to allow
+itself to be suspended should call
+.Fn kthread_suspend_check
+in order to check if the it has been asked to suspend.
+If it has, it will
+.Xr msleep 9
+until it is told to resume.
+Once it has been told to resume it will return allowing execution of the
+kernel thread to continue.
+The other two functions are used to notify a kernel thread of a suspend or
+resume request.
+The
+.Fa td
+argument points to the
+.Vt "struct thread"
+of the kernel thread to suspend or resume.
+For
+.Fn kthread_suspend ,
+the
+.Fa timo
+argument specifies a timeout to wait for the kernel thread to acknowledge the
+suspend request and suspend itself.
+.Pp
+The
+.Fn kthread_shutdown
+function is meant to be registered as a shutdown event for kernel threads that
+need to be suspended voluntarily during system shutdown so as not to interfere
+with system shutdown activities.
+The actual suspension of the kernel thread is done with
+.Fn kthread_suspend .
+.Sh RETURN VALUES
+The
+.Fn kthread_add ,
+.Fn kthread_resume ,
+and
+.Fn kthread_suspend
+functions return zero on success and non-zero on failure.
+.Sh EXAMPLES
+This example demonstrates the use of a
+.Vt "struct kthread_desc"
+and the functions
+.Fn kthread_start ,
+.Fn kthread_shutdown ,
+and
+.Fn kthread_suspend_check
+to run the
+.Nm bufdaemon
+process.
+.Bd -literal -offset indent
+static struct thread *bufdaemonthread;
+
+static struct kthread_desc buf_kp = {
+ "bufdaemon",
+ buf_daemon,
+ &bufdaemonthread
+};
+SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kthread_start,
+ &buf_kp)
+
+static void
+buf_daemon()
+{
+ ...
+ /*
+ * This process needs to be suspended prior to shutdown sync.
+ */
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, kthread_shutdown,
+ bufdaemonthread, SHUTDOWN_PRI_LAST);
+ ...
+ for (;;) {
+ kthread_suspend_check(bufdaemonthread);
+ ...
+ }
+}
+.Ed
+.Sh ERRORS
+The
+.Fn kthread_resume
+and
+.Fn kthread_suspend
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa td
+argument does not reference a kernel thread.
+.El
+.Pp
+The
+.Fn kthread_add
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Memory for a thread's stack could not be allocated.
+.El
+.Sh SEE ALSO
+.Xr kproc 9 ,
+.Xr SYSINIT 9 ,
+.Xr wakeup 9
+.Sh HISTORY
+The
+.Fn kthread_start
+function first appeared in
+.Fx 2.2
+where it created a whole process.
+It was converted to create threads in
+.Fx 8.0 .
+The
+.Fn kthread_shutdown ,
+.Fn kthread_exit ,
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
+and
+.Fn kthread_suspend_check
+functions were introduced in
+.Fx 4.0
+and were converted to threads in
+.Fx 8.0 .
+The
+.Fn kthread_create
+call was renamed to
+.Fn kthread_add
+in
+.Fx 8.0 .
+The old functionality of creating a kernel process was renamed
+to
+.Xr kproc_create 9 .
+Prior to
+.Fx 5.0 ,
+the
+.Fn kthread_shutdown ,
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
+and
+.Fn kthread_suspend_check
+functions were named
+.Fn shutdown_kproc ,
+.Fn resume_kproc ,
+.Fn shutdown_kproc ,
+and
+.Fn kproc_suspend_loop ,
+respectively.
diff --git a/share/man/man9/ktr.9 b/share/man/man9/ktr.9
new file mode 100644
index 000000000000..98b601d669cc
--- /dev/null
+++ b/share/man/man9/ktr.9
@@ -0,0 +1,162 @@
+.\" Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 30, 2008
+.Dt KTR 9
+.Os
+.Sh NAME
+.Nm CTR0 , CTR1 , CTR2 , CTR3 , CTR4 , CTR5
+.Nd kernel tracing facility
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/ktr.h
+.Vt "extern int ktr_cpumask" ;
+.Vt "extern int ktr_entries" ;
+.Vt "extern int ktr_extend" ;
+.Vt "extern int ktr_mask" ;
+.Vt "extern int ktr_verbose" ;
+.Vt "extern struct ktr_entry ktr_buf[]" ;
+.Ft void
+.Fn CTR0 "u_int mask" "char *format"
+.Ft void
+.Fn CTR1 "u_int mask" "char *format" "arg1"
+.Ft void
+.Fn CTR2 "u_int mask" "char *format" "arg1" "arg2"
+.Ft void
+.Fn CTR3 "u_int mask" "char *format" "arg1" "arg2" "arg3"
+.Ft void
+.Fn CTR4 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4"
+.Ft void
+.Fn CTR5 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4" "arg5"
+.Ft void
+.Fn CTR6 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4" "arg5" "arg6"
+.Sh DESCRIPTION
+KTR provides a circular buffer of events that can be logged in a
+.Xr printf 9
+style
+fashion.
+These events can then be dumped with
+.Xr ddb 4 ,
+.Xr gdb 1
+or
+.Xr ktrdump 8 .
+.Pp
+Events are created and logged in the kernel via the
+.Dv CTR Ns Ar x
+macros.
+The first parameter is a mask of event types
+.Pq Dv KTR_*
+defined in
+.In sys/ktr.h .
+The event will be logged only if any of the event types specified in
+.Fa mask
+are enabled in the global event mask stored in
+.Va ktr_mask .
+The
+.Fa format
+argument is a
+.Xr printf 9
+style format string used to build the text of the event log message.
+Following the
+.Fa format
+string are zero to five arguments referenced by
+.Fa format .
+Each event is logged with a file name and source line number of the
+originating CTR call, and a timestamp in addition to the log message.
+.Pp
+The event is stored in the circular buffer with supplied arguments as is,
+and formatting is done at the dump time.
+Do not use pointers to the objects with limited lifetime, for instance,
+strings, because the pointer may become invalid when buffer is printed.
+.Pp
+Note that the different macros differ only in the number of arguments each
+one takes, as indicated by its name.
+.Pp
+The
+.Va ktr_entries
+variable contains the number of entries in the
+.Va ktr_buf
+array.
+These variables are mostly useful for post-mortem crash dump tools to locate
+the base of the circular trace buffer and its length.
+.Pp
+The
+.Va ktr_mask
+variable contains the run time mask of events to log.
+.Pp
+The CPU event mask is stored in the
+.Va ktr_cpumask
+variable.
+.Pp
+The
+.Va ktr_verbose
+variable stores the verbose flag that controls whether events are logged to
+the console in addition to the event buffer.
+.Sh EXAMPLES
+This example demonstrates the use of tracepoints at the
+.Dv KTR_PROC
+logging level.
+.Bd -literal
+void
+mi_switch()
+{
+ ...
+ /*
+ * Pick a new current process and record its start time.
+ */
+ ...
+ CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d)", p, p->p_pid);
+ ...
+ cpu_switch();
+ ...
+ CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d)", p, p->p_pid);
+ ...
+}
+.Ed
+.Sh SEE ALSO
+.Xr ktr 4 ,
+.Xr ktrdump 8
+.Sh HISTORY
+The KTR kernel tracing facility first appeared in
+.Bsx 3.0
+and was imported into
+.Fx 5.0 .
+.Sh BUGS
+Currently there is one global buffer shared among all CPUs.
+It might be profitable at some point in time to use per-CPU buffers instead
+so that if one CPU halts or starts spinning, then the log messages it
+emitted just prior to halting or spinning will not be drowned out by events
+from the other CPUs.
+.Pp
+The arguments given in
+.Fn CTRx
+macros are stored as
+.Vt u_long ,
+so do not pass arguments larger than size of an
+.Vt u_long
+type.
+For example passing 64bit arguments on 32bit architectures will give incorrect
+results.
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9
new file mode 100644
index 000000000000..0e5cfb153731
--- /dev/null
+++ b/share/man/man9/lock.9
@@ -0,0 +1,389 @@
+.\"
+.\" Copyright (C) 2002 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 16, 2011
+.Dt LOCK 9
+.Os
+.Sh NAME
+.Nm lockinit ,
+.Nm lockdestroy ,
+.Nm lockmgr ,
+.Nm lockmgr_args ,
+.Nm lockmgr_args_rw ,
+.Nm lockmgr_disown ,
+.Nm lockmgr_printinfo ,
+.Nm lockmgr_recursed ,
+.Nm lockmgr_rw ,
+.Nm lockmgr_waiters ,
+.Nm lockstatus ,
+.Nm lockmgr_assert
+.Nd "lockmgr family of functions"
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/lock.h
+.In sys/lockmgr.h
+.Ft void
+.Fn lockinit "struct lock *lkp" "int prio" "const char *wmesg" "int timo" "int flags"
+.Ft void
+.Fn lockdestroy "struct lock *lkp"
+.Ft int
+.Fn lockmgr "struct lock *lkp" "u_int flags" "struct mtx *ilk"
+.Ft int
+.Fn lockmgr_args "struct lock *lkp" "u_int flags" "struct mtx *ilk" "const char *wmesg" "int prio" "int timo"
+.Ft int
+.Fn lockmgr_args_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" "const char *wmesg" "int prio" "int timo"
+.Ft void
+.Fn lockmgr_disown "struct lock *lkp"
+.Ft void
+.Fn lockmgr_printinfo "const struct lock *lkp"
+.Ft int
+.Fn lockmgr_recursed "const struct lock *lkp"
+.Ft int
+.Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk"
+.Ft int
+.Fn lockmgr_waiters "const struct lock *lkp"
+.Ft int
+.Fn lockstatus "const struct lock *lkp"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
+.Ft void
+.Fn lockmgr_assert "const struct lock *lkp" "int what"
+.Sh DESCRIPTION
+The
+.Fn lockinit
+function is used to initialize a lock.
+It must be called before any operation can be performed on a lock.
+Its arguments are:
+.Bl -tag -width ".Fa wmesg"
+.It Fa lkp
+A pointer to the lock to initialize.
+.It Fa prio
+The priority passed to
+.Xr sleep 9 .
+.It Fa wmesg
+The lock message.
+This is used for both debugging output and
+.Xr sleep 9 .
+.It Fa timo
+The timeout value passed to
+.Xr sleep 9 .
+.It Fa flags
+The flags the lock is to be initialized with:
+.Bl -tag -width ".Dv LK_CANRECURSE"
+.It Dv LK_ADAPTIVE
+Enable adaptive spinning for this lock if the kernel is compiled with the
+ADAPTIVE_LOCKMGRS option.
+.It Dv LK_CANRECURSE
+Allow recursive exclusive locks.
+.It Dv LK_NOPROFILE
+Disable lock profiling for this lock.
+.It Dv LK_NOSHARE
+Allow exclusive locks only.
+.It Dv LK_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv LK_NODUP
+.Xr witness 4
+should log messages about duplicate locks being acquired.
+.It Dv LK_QUIET
+Disable
+.Xr ktr 4
+logging for this lock.
+.It Dv LK_TIMELOCK
+Use
+.Fa timo
+during a sleep; otherwise, 0 is used.
+.El
+.El
+.Pp
+The
+.Fn lockdestroy
+function is used to destroy a lock, and while it is called in a number of
+places in the kernel, it currently does nothing.
+.Pp
+The
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+functions handle general locking functionality within the kernel, including
+support for shared and exclusive locks, and recursion.
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+are also able to upgrade and downgrade locks.
+.Pp
+Their arguments are:
+.Bl -tag -width ".Fa flags"
+.It Fa lkp
+A pointer to the lock to manipulate.
+.It Fa flags
+Flags indicating what action is to be taken.
+.Bl -tag -width ".Dv LK_CANRECURSE"
+.It Dv LK_SHARED
+Acquire a shared lock.
+If an exclusive lock is currently held, it will be downgraded.
+.It Dv LK_EXCLUSIVE
+Acquire an exclusive lock.
+If an exclusive lock is already held, and
+.Dv LK_CANRECURSE
+is not set, the system will
+.Xr panic 9 .
+.It Dv LK_DOWNGRADE
+Downgrade exclusive lock to a shared lock.
+Downgrading a shared lock is not permitted.
+If an exclusive lock has been recursed, all references will be downgraded.
+.It Dv LK_UPGRADE
+Upgrade a shared lock to an exclusive lock.
+If this call fails, the shared lock is lost.
+During the upgrade, the shared lock could
+be temporarily dropped.
+Attempts to upgrade an exclusive lock will cause a
+.Xr panic 9 .
+.It Dv LK_RELEASE
+Release the lock.
+Releasing a lock that is not held can cause a
+.Xr panic 9 .
+.It Dv LK_DRAIN
+Wait for all activity on the lock to end, then mark it decommissioned.
+This is used before freeing a lock that is part of a piece of memory that is
+about to be freed.
+(As documented in
+.In sys/lockmgr.h . )
+.It Dv LK_SLEEPFAIL
+Fail if operation has slept.
+.It Dv LK_NOWAIT
+Do not allow the call to sleep.
+This can be used to test the lock.
+.It Dv LK_NOWITNESS
+Skip the
+.Xr witness 4
+checks for this instance.
+.It Dv LK_CANRECURSE
+Allow recursion on an exclusive lock.
+For every lock there must be a release.
+.It Dv LK_INTERLOCK
+Unlock the interlock (which should be locked already).
+.El
+.It Fa ilk
+An interlock mutex for controlling group access to the lock.
+If
+.Dv LK_INTERLOCK
+is specified,
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+assume
+.Fa ilk
+is currently owned and not recursed, and will return it unlocked.
+See
+.Xr mtx_assert 9 .
+.El
+.Pp
+The
+.Fn lockmgr_args
+and
+.Fn lockmgr_args_rw
+function work like
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+but accepting a
+.Fa wmesg ,
+.Fa timo
+and
+.Fa prio
+on a per-instance basis.
+The specified values will override the default
+ones, but this can still be used passing, respectively,
+.Dv LK_WMESG_DEFAULT ,
+.Dv LK_PRIO_DEFAULT
+and
+.Dv LK_TIMO_DEFAULT .
+.Pp
+The
+.Fn lockmgr_disown
+function switches the owner from the current thread to be
+.Dv LK_KERNPROC,
+if the lock is already held.
+.Pp
+The
+.Fn lockmgr_printinfo
+function prints debugging information about the lock.
+It is used primarily by
+.Xr VOP_PRINT 9
+functions.
+.Pp
+The
+.Fn lockmgr_recursed
+function returns true if the lock is recursed, 0
+otherwise.
+.Pp
+The
+.Fn lockmgr_waiters
+function returns true if the lock has waiters, 0 otherwise.
+.Pp
+The
+.Fn lockstatus
+function returns the status of the lock in relation to the current thread.
+.Pp
+When compiled with
+.Cd "options INVARIANTS"
+and
+.Cd "options INVARIANT_SUPPORT" ,
+the
+.Fn lockmgr_assert
+function tests
+.Fa lkp
+for the assertions specified in
+.Fa what ,
+and panics if they are not met.
+One of the following assertions must be specified:
+.Bl -tag -width ".Dv KA_UNLOCKED"
+.It Dv KA_LOCKED
+Assert that the current thread has either a shared or an exclusive lock on the
+.Vt lkp
+lock pointed to by the first argument.
+.It Dv KA_SLOCKED
+Assert that the current thread has a shared lock on the
+.Vt lkp
+lock pointed to by the first argument.
+.It Dv KA_XLOCKED
+Assert that the current thread has an exclusive lock on the
+.Vt lkp
+lock pointed to by the first argument.
+.It Dv KA_UNLOCKED
+Assert that the current thread has no lock on the
+.Vt lkp
+lock pointed to by the first argument.
+.El
+.Pp
+In addition, one of the following optional assertions can be used with
+either an
+.Dv KA_LOCKED ,
+.Dv KA_SLOCKED ,
+or
+.Dv KA_XLOCKED
+assertion:
+.Bl -tag -width ".Dv KA_NOTRECURSED"
+.It Dv KA_RECURSED
+Assert that the current thread has a recursed lock on
+.Fa lkp .
+.It Dv KA_NOTRECURSED
+Assert that the current thread does not have a recursed lock on
+.Fa lkp .
+.El
+.Sh RETURN VALUES
+The
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+functions return 0 on success and non-zero on failure.
+.Pp
+The
+.Fn lockstatus
+function returns:
+.Bl -tag -width ".Dv LK_EXCLUSIVE"
+.It Dv LK_EXCLUSIVE
+An exclusive lock is held by the current thread.
+.It Dv LK_EXCLOTHER
+An exclusive lock is held by someone other than the current thread.
+.It Dv LK_SHARED
+A shared lock is held.
+.It Li 0
+The lock is not held by anyone.
+.El
+.Sh ERRORS
+.Fn lockmgr
+and
+.Fn lockmgr_rw
+fail if:
+.Bl -tag -width Er
+.It Bq Er EBUSY
+.Dv LK_FORCEUPGRADE
+was requested and another thread had already requested a lock upgrade.
+.It Bq Er EBUSY
+.Dv LK_NOWAIT
+was set, and a sleep would have been required.
+.It Bq Er ENOLCK
+.Dv LK_SLEEPFAIL
+was set and
+.Fn lockmgr
+or
+.Fn lockmgr_rw
+did sleep.
+.It Bq Er EINTR
+.Dv PCATCH
+was set in the lock priority, and a signal was delivered during a sleep.
+Note the
+.Er ERESTART
+error below.
+.It Bq Er ERESTART
+.Dv PCATCH
+was set in the lock priority, a signal was delivered during a sleep,
+and the system call is to be restarted.
+.It Bq Er EWOULDBLOCK
+a non-zero timeout was given, and the timeout expired.
+.El
+.Sh LOCKS
+If
+.Dv LK_INTERLOCK
+is passed in the
+.Fa flags
+argument to
+.Fn lockmgr
+or
+.Fn lockmgr_rw ,
+the
+.Fa ilk
+must be held prior to calling
+.Fn lockmgr
+or
+.Fn lockmgr_rw ,
+and will be returned unlocked.
+.Pp
+Upgrade attempts that fail result in the loss of the lock that
+is currently held.
+Also, it is invalid to upgrade an
+exclusive lock, and a
+.Xr panic 9
+will be the result of trying.
+.Sh SEE ALSO
+.Xr condvar 9 ,
+.Xr locking 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sleep 9 ,
+.Xr sx 9 ,
+.Xr mtx_assert 9 ,
+.Xr panic 9 ,
+.Xr VOP_PRINT 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/locking.9 b/share/man/man9/locking.9
new file mode 100644
index 000000000000..00478bf753f7
--- /dev/null
+++ b/share/man/man9/locking.9
@@ -0,0 +1,363 @@
+.\" Copyright (c) 2007 Julian Elischer (julian - freebsd org )
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 3, 2010
+.Dt LOCKING 9
+.Os
+.Sh NAME
+.Nm locking
+.Nd kernel synchronization primitives
+.Sh DESCRIPTION
+The
+.Em FreeBSD
+kernel is written to run across multiple CPUs and as such requires
+several different synchronization primitives to allow the developers
+to safely access and manipulate the many data types required.
+.Ss Mutexes
+Mutexes (also called "sleep mutexes") are the most commonly used
+synchronization primitive in the kernel.
+Thread acquires (locks) a mutex before accessing data shared with other
+threads (including interrupt threads), and releases (unlocks) it afterwards.
+If the mutex cannot be acquired, the thread requesting it will sleep.
+Mutexes fully support priority propagation.
+.Pp
+See
+.Xr mutex 9
+for details.
+.Ss Spin mutexes
+Spin mutexes are variation of basic mutexes; the main difference between
+the two is that spin mutexes never sleep - instead, they spin, waiting
+for the thread holding the lock, which runs on another CPU, to release it.
+Differently from ordinary mutex, spin mutexes disable interrupts when acquired.
+Since disabling interrupts is expensive, they are also generally slower.
+Spin mutexes should be used only when necessary, e.g. to protect data shared
+with interrupt filter code (see
+.Xr bus_setup_intr 9
+for details).
+.Ss Pool mutexes
+With most synchronization primitives, such as mutexes, programmer must
+provide a piece of allocated memory to hold the primitive.
+For example, a mutex may be embedded inside the structure it protects.
+Pool mutex is a variant of mutex without this requirement - to lock or unlock
+a pool mutex, one uses address of the structure being protected with it,
+not the mutex itself.
+Pool mutexes are seldom used.
+.Pp
+See
+.Xr mtx_pool 9
+for details.
+.Ss Reader/writer locks
+Reader/writer locks allow shared access to protected data by multiple threads,
+or exclusive access by a single thread.
+The threads with shared access are known as
+.Em readers
+since they should only read the protected data.
+A thread with exclusive access is known as a
+.Em writer
+since it may modify protected data.
+.Pp
+Reader/writer locks can be treated as mutexes (see above and
+.Xr mutex 9 )
+with shared/exclusive semantics.
+More specifically, regular mutexes can be
+considered to be equivalent to a write-lock on an
+.Em rw_lock.
+The
+.Em rw_lock
+locks have priority propagation like mutexes, but priority
+can be propagated only to an exclusive holder.
+This limitation comes from the fact that shared owners
+are anonymous.
+Another important property is that shared holders of
+.Em rw_lock
+can recurse, but exclusive locks are not allowed to recurse.
+This ability should not be used lightly and
+.Em may go away.
+.Pp
+See
+.Xr rwlock 9
+for details.
+.Ss Read-mostly locks
+Mostly reader locks are similar to
+.Em reader/writer
+locks but optimized for very infrequent write locking.
+.Em Read-mostly
+locks implement full priority propagation by tracking shared owners
+using a caller-supplied
+.Em tracker
+data structure.
+.Pp
+See
+.Xr rmlock 9
+for details.
+.Ss Shared/exclusive locks
+Shared/exclusive locks are similar to reader/writer locks; the main difference
+between them is that shared/exclusive locks may be held during unbounded sleep
+(and may thus perform an unbounded sleep).
+They are inherently less efficient than mutexes, reader/writer locks
+and read-mostly locks.
+They don't support priority propagation.
+They should be considered to be closely related to
+.Xr sleep 9 .
+In fact it could in some cases be
+considered a conditional sleep.
+.Pp
+See
+.Xr sx 9
+for details.
+.Ss Counting semaphores
+Counting semaphores provide a mechanism for synchronizing access
+to a pool of resources.
+Unlike mutexes, semaphores do not have the concept of an owner,
+so they can be useful in situations where one thread needs
+to acquire a resource, and another thread needs to release it.
+They are largely deprecated.
+.Pp
+See
+.Xr sema 9
+for details.
+.Ss Condition variables
+Condition variables are used in conjunction with mutexes to wait for
+conditions to occur.
+A thread must hold the mutex before calling the
+.Fn cv_wait* ,
+functions.
+When a thread waits on a condition, the mutex
+is atomically released before the thread is blocked, then reacquired
+before the function call returns.
+.Pp
+See
+.Xr condvar 9
+for details.
+.Ss Giant
+Giant is an instance of a mutex, with some special characteristics:
+.Bl -enum
+.It
+It is recursive.
+.It
+Drivers and filesystems can request that Giant be locked around them
+by not marking themselves MPSAFE.
+Note that infrastructure to do this is slowly going away as non-MPSAFE
+drivers either became properly locked or disappear.
+.It
+Giant must be locked first before other locks.
+.It
+It is OK to hold Giant while performing unbounded sleep; in such case,
+Giant will be dropped before sleeping and picked up after wakeup.
+.It
+There are places in the kernel that drop Giant and pick it back up
+again.
+Sleep locks will do this before sleeping.
+Parts of the network or VM code may do this as well, depending on the
+setting of a sysctl.
+This means that you cannot count on Giant keeping other code from
+running if your code sleeps, even if you want it to.
+.El
+.Ss Sleep/wakeup
+The functions
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn pause ,
+.Fn wakeup ,
+and
+.Fn wakeup_one
+handle event-based thread blocking.
+If a thread must wait for an external event, it is put to sleep by
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+or
+.Fn pause .
+Threads may also wait using one of the locking primitive sleep routines
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+or
+.Xr sx_sleep 9 .
+.Pp
+The parameter
+.Fa chan
+is an arbitrary address that uniquely identifies the event on which
+the thread is being put to sleep.
+All threads sleeping on a single
+.Fa chan
+are woken up later by
+.Fn wakeup ,
+often called from inside an interrupt routine, to indicate that the
+resource the thread was blocking on is available now.
+.Pp
+Several of the sleep functions including
+.Fn msleep ,
+.Fn msleep_spin ,
+and the locking primitive sleep routines specify an additional lock
+parameter.
+The lock will be released before sleeping and reacquired
+before the sleep routine returns.
+If
+.Fa priority
+includes the
+.Dv PDROP
+flag, then the lock will not be reacquired before returning.
+The lock is used to ensure that a condition can be checked atomically,
+and that the current thread can be suspended without missing a
+change to the condition, or an associated wakeup.
+In addition, all of the sleep routines will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the thread is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
+.Pp
+See
+.Xr sleep 9
+for details.
+.Ss Lockmanager locks
+Shared/exclusive locks, used mostly in
+.Xr VFS 9 ,
+in particular as a
+.Xr vnode 9
+lock.
+They have features other lock types don't have, such as sleep timeout,
+writer starvation avoidance, draining, and interlock mutex, but this makes them
+complicated to implement; for this reason, they are deprecated.
+.Pp
+See
+.Xr lock 9
+for details.
+.Sh INTERACTIONS
+The primitives interact and have a number of rules regarding how
+they can and can not be combined.
+Many of these rules are checked using the
+.Xr witness 4
+code.
+.Ss Bounded vs. unbounded sleep
+The following primitives perform bounded sleep: mutexes, pool mutexes,
+reader/writer locks and read-mostly locks.
+.Pp
+The following primitives block (perform unbounded sleep): shared/exclusive locks,
+counting semaphores, condition variables, sleep/wakeup and lockmanager locks.
+.Pp
+It is an error to do any operation that could result in any kind of sleep while
+holding spin mutex.
+.Pp
+As a general rule, it is an error to do any operation that could result
+in unbounded sleep while holding any primitive from the 'bounded sleep' group.
+For example, it is an error to try to acquire shared/exclusive lock while
+holding mutex, or to try to allocate memory with M_WAITOK while holding
+read-write lock.
+.Pp
+As a special case, it is possible to call
+.Fn sleep
+or
+.Fn mtx_sleep
+while holding a single mutex.
+It will atomically drop that mutex and reacquire it as part of waking up.
+This is often a bad idea because it generally relies on the programmer having
+good knowledge of all of the call graph above the place where
+.Fn mtx_sleep
+is being called and assumptions the calling code has made.
+Because the lock gets dropped during sleep, one one must re-test all
+the assumptions that were made before, all the way up the call graph to the
+place where the lock was acquired.
+.Pp
+It is an error to do any operation that could result in any kind of sleep when
+running inside an interrupt filter.
+.Pp
+It is an error to do any operation that could result in unbounded sleep when
+running inside an interrupt thread.
+.Ss Interaction table
+The following table shows what you can and can not do while holding
+one of the synchronization primitives discussed:
+.Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
+.It Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
+.It spin mtx Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
+.It mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
+.It sx Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
+.It rwlock Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
+.It rmlock Ta \&ok Ta \&ok Ta \&ok-5 Ta \&ok Ta \&ok-2 Ta \&ok-5
+.El
+.Pp
+.Em *1
+Recursion is defined per lock.
+Lock order is important.
+.Pp
+.Em *2
+Readers can recurse though writers can not.
+Lock order is important.
+.Pp
+.Em *3
+There are calls that atomically release this primitive when going to sleep
+and reacquire it on wakeup (e.g.
+.Fn mtx_sleep ,
+.Fn rw_sleep
+and
+.Fn msleep_spin
+).
+.Pp
+.Em *4
+Though one can sleep holding an sx lock, one can also use
+.Fn sx_sleep
+which will atomically release this primitive when going to sleep and
+reacquire it on wakeup.
+.Pp
+.Em *5
+.Em Read-mostly
+locks can be initialized to support sleeping while holding a write lock.
+See
+.Xr rmlock 9
+for details.
+.Ss Context mode table
+The next table shows what can be used in different contexts.
+At this time this is a rather easy to remember table.
+.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
+.It Em "Context:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
+.It interrupt filter: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no
+.It interrupt thread: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no
+.It callout: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no
+.It syscall: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok
+.El
+.Sh SEE ALSO
+.Xr witness 4 ,
+.Xr condvar 9 ,
+.Xr lock 9 ,
+.Xr mtx_pool 9 ,
+.Xr mutex 9 ,
+.Xr rmlock 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sleep 9 ,
+.Xr sx 9 ,
+.Xr BUS_SETUP_INTR 9 ,
+.Xr LOCK_PROFILING 9
+.Sh HISTORY
+These
+functions appeared in
+.Bsx 4.1
+through
+.Fx 7.0
+.Sh BUGS
+There are too many locking primitives to choose from.
diff --git a/share/man/man9/mac.9 b/share/man/man9/mac.9
new file mode 100644
index 000000000000..cc05c5a1f323
--- /dev/null
+++ b/share/man/man9/mac.9
@@ -0,0 +1,246 @@
+.\"-
+.\" Copyright (c) 1999-2002 Robert N. M. Watson
+.\" Copyright (c) 2002-2004 Networks Associates Technology, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed by Robert Watson for the TrustedBSD Project.
+.\"
+.\" This software was developed for the FreeBSD Project in part by Network
+.\" Associates Laboratories, the Security Research Division of Network
+.\" Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+.\" ("CBOSS"), as part of the DARPA CHATS research program.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2006
+.Dt MAC 9
+.Os
+.Sh NAME
+.Nm mac
+.Nd TrustedBSD Mandatory Access Control framework
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/mac.h
+.Pp
+In the kernel configuration file:
+.Cd "options MAC"
+.Cd "options MAC_DEBUG"
+.Sh DESCRIPTION
+.Ss Introduction
+The
+.Tn TrustedBSD
+mandatory access control framework permits dynamically
+introduced system security modules to modify system security functionality.
+This can be used to support a variety of new security services, including
+traditional labeled mandatory access control models.
+The framework provides a series of entry points which must be called by
+code supporting various kernel services, especially with respects to access
+control points and object creation.
+The framework then calls out to security modules to offer them the
+opportunity to modify security behavior at those MAC API entry points.
+Both consumers of the API (normal kernel services) and security modules
+must be aware of the semantics of the API calls, particularly with respect
+to synchronization primitives (such as locking).
+.Ss Note on Appropriateness for Production Use
+The
+.Tn TrustedBSD
+MAC Framework included in
+.Fx 5.0
+is considered experimental, and should not be deployed in production
+environments without careful consideration of the risks associated with
+the use of experimental operating system features.
+.Ss Kernel Objects Supported by the Framework
+The MAC framework manages labels on a variety of types of in-kernel
+objects, including process credentials, vnodes, devfs_dirents, mount
+points, sockets, mbufs, bpf descriptors, network interfaces, IP fragment
+queues, and pipes.
+Label data on kernel objects, represented by
+.Vt "struct label" ,
+is policy-unaware, and may be used in the manner seen fit by policy modules.
+.Ss API for Consumers
+The MAC API provides a large set of entry points, too broad to specifically
+document here.
+In general, these entry points represent an access control check or other
+MAC-relevant operations, accept one or more subjects (credentials)
+authorizing the activity, a set of objects on which the operation
+is to be performed, and a set of operation arguments providing information
+about the type of operation being requested.
+.Ss Locking for Consumers
+Consumers of the MAC API must be aware of the locking requirements for
+each API entry point: generally, appropriate locks must be held over each
+subject or object being passed into the call, so that MAC modules may
+make use of various aspects of the object for access control purposes.
+For example, vnode locks are frequently required in order that the MAC
+framework and modules may retrieve security labels and attributes from the
+vnodes for the purposes of access control.
+Similarly, the caller must be aware of the reference counting semantics
+of any subject or object passed into the MAC API: all calls require that
+a valid reference to the object be held for the duration of the
+(potentially lengthy) MAC API call.
+Under some circumstances, objects must be held in either a shared or
+exclusive manner.
+.Ss API for Module Writers
+Each module exports a structure describing the MAC API operations that
+the module chooses to implement, including initialization and destruction
+API entry points, a variety of object creation and destruction calls,
+and a large set of access control check points.
+In the future, additional audit entry points will also be present.
+Module authors may choose to only implement a subset of the entry points,
+setting API function pointers in the description structure to
+.Dv NULL ,
+permitting the framework to avoid calling into the module.
+.Ss Locking for Module Writers
+Module writers must be aware of the locking semantics of entry points
+that they implement: MAC API entry points will have specific locking
+or reference counting semantics for each argument, and modules must follow
+the locking and reference counting protocol or risk a variety of failure
+modes (including race conditions, inappropriate pointer dereferences,
+etc).
+.Pp
+MAC module writers must also be aware that MAC API entry points will
+frequently be invoked from deep in a kernel stack, and as such must be
+careful to avoid violating more global locking requirements, such as
+global lock order requirements.
+For example, it may be inappropriate to lock additional objects not
+specifically maintained and ordered by the policy module, or the
+policy module might violate a global ordering requirement relating
+to those additional objects.
+.Pp
+Finally, MAC API module implementors must be careful to avoid
+inappropriately calling back into the MAC framework: the framework
+makes use of locking to prevent inconsistencies during policy module
+attachment and detachment.
+MAC API modules should avoid producing scenarios in which deadlocks
+or inconsistencies might occur.
+.Ss Adding New MAC Entry Points
+The MAC API is intended to be easily expandable as new services are
+added to the kernel.
+In order that policies may be guaranteed the opportunity to ubiquitously
+protect system subjects and objects, it is important that kernel
+developers maintain awareness of when security checks or relevant
+subject or object operations occur in newly written or modified kernel
+code.
+New entry points must be carefully documented so as to prevent any
+confusion regarding lock orders and semantics.
+Introducing new entry points requires four distinct pieces of work:
+introducing new MAC API entries reflecting the operation arguments,
+scattering these MAC API entry points throughout the new or modified
+kernel service, extending the front-end implementation of the MAC API
+framework, and modifying appropriate modules to take advantage of
+the new entry points so that they may consistently enforce their
+policies.
+.Sh ENTRY POINTS
+System service and module authors should reference the
+.%T "FreeBSD Architecture Handbook"
+for information on the MAC Framework APIs.
+.Sh SEE ALSO
+.Xr acl 3 ,
+.Xr mac 3 ,
+.Xr posix1e 3 ,
+.Xr mac_biba 4 ,
+.Xr mac_bsdextended 4 ,
+.Xr mac_ifoff 4 ,
+.Xr mac_lomac 4 ,
+.Xr mac_mls 4 ,
+.Xr mac_none 4 ,
+.Xr mac_partition 4 ,
+.Xr mac_seeotheruids 4 ,
+.Xr mac_test 4 ,
+.Xr ucred 9 ,
+.Xr vaccess 9 ,
+.Xr vaccess_acl_posix1e 9 ,
+.Xr VFS 9
+.Rs
+.%T "The FreeBSD Architecture Handbook"
+.%U "http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/arch-handbook/"
+.Re
+.Sh HISTORY
+The
+.Tn TrustedBSD
+MAC Framework first appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
+This software was contributed to the
+.Fx
+Project by Network Associates Laboratories, the Security Research
+Division of Network Associates Inc.\& under DARPA/SPAWAR contract
+N66001-01-C-8035
+.Pq Dq CBOSS ,
+as part of the DARPA CHATS research program.
+.Pp
+.An -nosplit
+The
+.Tn TrustedBSD
+MAC Framework was designed by
+.An Robert Watson ,
+and implemented by the Network Associates Laboratories Network Security
+(NETSEC), Secure Execution Environment (SEE), and Adaptive
+Network Defense research groups.
+Network Associates Laboratory staff contributing to the CBOSS Project
+include (in alphabetical order):
+.An Lee Badger ,
+.An Brian Feldman ,
+.An Hrishikesh Dandekar ,
+.An Tim Fraser ,
+.An Doug Kilpatrick ,
+.An Suresh Krishnaswamy ,
+.An Adam Migus ,
+.An Wayne Morrison ,
+.An Andrew Reisse ,
+.An Chris Vance ,
+and
+.An Robert Watson .
+.Pp
+Sub-contracted staff include:
+.An Chris Costello ,
+.An Poul-Henning Kamp ,
+.An Jonathan Lemon ,
+.An Kirk McKusick ,
+.An Dag-Erling Sm\(/orgrav .
+.Pp
+Additional contributors include:
+.An Pawel Dawidek ,
+.An Chris Faulhaber ,
+.An Ilmar Habibulin ,
+.An Mike Halderman ,
+.An Bosko Milekic ,
+.An Thomas Moestl ,
+.An Andrew Reiter ,
+and
+.An Tim Robbins .
+.Sh BUGS
+See the earlier section in this document concerning appropriateness
+for production use.
+The
+.Tn TrustedBSD
+MAC Framework is considered experimental in
+.Fx .
+.Pp
+While the MAC Framework design is intended to support the containment of
+the root user, not all attack channels are currently protected by entry
+point checks.
+As such, MAC Framework policies should not be relied on, in isolation,
+to protect against a malicious privileged user.
diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9
new file mode 100644
index 000000000000..2827235258e2
--- /dev/null
+++ b/share/man/man9/make_dev.9
@@ -0,0 +1,401 @@
+.\" Copyright (c) 1999 Chris Costello
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 3, 2011
+.Dt MAKE_DEV 9
+.Os
+.Sh NAME
+.Nm make_dev ,
+.Nm make_dev_cred ,
+.Nm make_dev_credf ,
+.Nm make_dev_p ,
+.Nm make_dev_alias ,
+.Nm make_dev_alias_p ,
+.Nm destroy_dev ,
+.Nm destroy_dev_sched ,
+.Nm destroy_dev_sched_cb ,
+.Nm destroy_dev_drain ,
+.Nm dev_depends
+.Nd manage
+.Vt cdev Ns 's
+and DEVFS registration for devices
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/conf.h
+.Ft struct cdev *
+.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft int
+.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
+.Ft int
+.Fn make_dev_alias_p "int flags" "struct cdev **cdev" "struct cdev *pdev" "const char *fmt" ...
+.Ft void
+.Fn destroy_dev "struct cdev *dev"
+.Ft void
+.Fn destroy_dev_sched "struct cdev *dev"
+.Ft void
+.Fn destroy_dev_sched_cb "struct cdev *dev" "void (*cb)(void *)" "void *arg"
+.Ft void
+.Fn destroy_dev_drain "struct cdevsw *csw"
+.Ft void
+.Fn dev_depends "struct cdev *pdev" "struct cdev *cdev"
+.Sh DESCRIPTION
+The
+.Fn make_dev_credf
+function creates a
+.Fa cdev
+structure for a new device.
+It also notifies
+.Xr devfs 5
+of the presence of the new device, that causes corresponding nodes
+to be created.
+Besides this, a
+.Xr devctl 4
+notification is sent.
+The device will be owned by
+.Va uid ,
+with the group ownership as
+.Va gid .
+The name is the expansion of
+.Va fmt
+and following arguments as
+.Xr printf 9
+would print it.
+The name determines its path under
+.Pa /dev
+or other
+.Xr devfs 5
+mount point and may contain slash
+.Ql /
+characters to denote subdirectories.
+The permissions of the file specified in
+.Va perms
+are defined in
+.In sys/stat.h :
+.Pp
+.Bd -literal -offset indent -compact
+#define S_IRWXU 0000700 /* RWX mask for owner */
+#define S_IRUSR 0000400 /* R for owner */
+#define S_IWUSR 0000200 /* W for owner */
+#define S_IXUSR 0000100 /* X for owner */
+
+#define S_IRWXG 0000070 /* RWX mask for group */
+#define S_IRGRP 0000040 /* R for group */
+#define S_IWGRP 0000020 /* W for group */
+#define S_IXGRP 0000010 /* X for group */
+
+#define S_IRWXO 0000007 /* RWX mask for other */
+#define S_IROTH 0000004 /* R for other */
+#define S_IWOTH 0000002 /* W for other */
+#define S_IXOTH 0000001 /* X for other */
+
+#define S_ISUID 0004000 /* set user id on execution */
+#define S_ISGID 0002000 /* set group id on execution */
+#define S_ISVTX 0001000 /* sticky bit */
+#ifndef _POSIX_SOURCE
+#define S_ISTXT 0001000
+#endif
+.Ed
+.Pp
+The
+.Va cr
+argument specifies credentials that will be stored in the
+.Fa si_cred
+member of the initialized
+.Fa struct cdev .
+The
+.Va flags
+argument alters the operation of
+.Fn make_dev_credf
+or
+.Fn make_dev_p .
+The following values are currently accepted:
+.Pp
+.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent
+.It MAKEDEV_REF
+reference the created device
+.It MAKEDEV_NOWAIT
+do not sleep, the call may fail
+.It MAKEDEV_WAITOK
+allow the function to sleep to satisfy malloc
+.It MAKEDEV_ETERNAL
+created device will be never destroyed
+.It MAKEDEV_CHECKNAME
+return an error if the device name is invalid or already exists
+.El
+.Pp
+Only
+.Dv MAKEDEV_NOWAIT ,
+.Dv MAKEDEV_WAITOK
+and
+.Dv MAKEDEV_CHECKNAME
+values are accepted for the
+.Fn make_dev_alias_p
+function.
+.Pp
+The
+.Dv MAKEDEV_WAITOK
+flag is assumed if none of
+.Dv MAKEDEV_WAITOK ,
+.Dv MAKEDEV_NOWAIT
+is specified.
+.Pp
+The
+.Xr dev_clone 9
+event handler shall specify
+.Dv MAKEDEV_REF
+flag when creating a device in response to lookup, to avoid race where
+the device created is destroyed immediately after
+.Xr devfs_lookup 9
+drops his reference to cdev.
+.Pp
+The
+.Dv MAKEDEV_ETERNAL
+flag allows the kernel to not acquire some locks when translating system
+calls into the cdevsw methods calls.
+It is responsibility of the driver author to make sure that
+.Fn destroy_dev
+is never called on the returned cdev.
+For the convenience, use the
+.Dv MAKEDEV_ETERNAL_KLD
+flag for the code that can be compiled into kernel or loaded
+(and unloaded) as loadable module.
+.Pp
+A panic will occur if the MAKEDEV_CHECKNAME flag is not specified
+and the device name is invalid or already exists.
+.Pp
+The
+.Fn make_dev_cred
+function is equivalent to the call
+.Bd -literal -offset indent
+make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...);
+.Ed
+.Pp
+The
+.Fn make_dev
+function call is the same as
+.Bd -literal -offset indent
+make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...);
+.Ed
+.Pp
+The
+.Fn make_dev_p
+function is similar to
+.Fn make_dev_credf
+but it may return an error number and takes a pointer to the resulting
+.Ft *cdev
+as an argument.
+.Pp
+The
+.Fn make_dev_alias
+function takes the returned
+.Ft cdev
+from
+.Fn make_dev
+and makes another (aliased) name for this device.
+It is an error to call
+.Fn make_dev_alias
+prior to calling
+.Fn make_dev .
+.Pp
+.Fn make_dev_alias_p
+function is similar to
+.Fn make_dev_alias
+but it takes a pointer to the resulting
+.Ft *cdev
+as an argument and may return an error.
+.Pp
+The
+.Fa cdev
+returned by
+.Fn make_dev
+and
+.Fn make_dev_alias
+has two fields,
+.Fa si_drv1
+and
+.Fa si_drv2 ,
+that are available to store state.
+Both fields are of type
+.Ft void * .
+These are designed to replace the
+.Fa unit
+argument to
+.Fn make_dev ,
+which can be obtained with
+.Fn dev2unit .
+.Pp
+The
+.Fn destroy_dev
+function takes the returned
+.Fa cdev
+from
+.Fn make_dev
+and destroys the registration for that device.
+The notification is sent to
+.Xr devctl 4
+about the destruction event.
+Do not call
+.Fn destroy_dev
+on devices that were created with
+.Fn make_dev_alias .
+.Pp
+The
+.Fn dev_depends
+function establishes a parent-child relationship between two devices.
+The net effect is that a
+.Fn destroy_dev
+of the parent device will also result in the destruction of the
+child device(s),
+if any exist.
+A device may simultaneously be a parent and a child,
+so it is possible to build a complete hierarchy.
+.Pp
+The
+.Fn destroy_dev_sched_cb
+function schedules execution of the
+.Fn destroy_dev
+for the specified
+.Fa cdev
+in the safe context.
+After
+.Fn destroy_dev
+is finished, and if the supplied
+.Fa cb
+is not
+.Dv NULL ,
+the callback
+.Fa cb
+is called, with argument
+.Fa arg .
+The
+.Fn destroy_dev_sched
+function is the same as
+.Bd -literal -offset indent
+destroy_dev_sched_cb(cdev, NULL, NULL);
+.Ed
+.Pp
+The
+.Fn d_close
+driver method cannot call
+.Fn destroy_dev
+directly.
+Doing so causes deadlock when
+.Fn destroy_dev
+waits for all threads to leave the driver methods.
+Also, because
+.Fn destroy_dev
+sleeps, no non-sleepable locks may be held over the call.
+The
+.Fn destroy_dev_sched
+family of functions overcome these issues.
+.Pp
+The device driver may call the
+.Fn destroy_dev_drain
+function to wait until all devices that have supplied
+.Fa csw
+as cdevsw, are destroyed.
+This is useful when driver knows that
+.Fn destroy_dev_sched
+is called for all instantiated devices, but need to postpone module
+unload until
+.Fn destroy_dev
+is actually finished for all of them.
+.Sh RETURN VALUES
+If successful,
+.Fn make_dev_p
+will return 0, otherwise it will return an error.
+If successful,
+.Fn make_dev_credf
+will return a valid
+.Fa cdev
+pointer, otherwise it will return
+.Dv NULL .
+.Sh ERRORS
+The
+.Fn make_dev_p
+and
+.Fn make_dev_alias_p
+call will fail and the device will be not registered if:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+The
+.Dv MAKEDEV_NOWAIT
+flag was specified and a memory allocation request could not be satisfied.
+.It Bq Er ENAMETOOLONG
+The
+.Dv MAKEDEV_CHECKNAME
+flag was specified and the provided device name is longer than
+.Dv SPECNAMELEN .
+.It Bq Er EINVAL
+The
+.Dv MAKEDEV_CHECKNAME
+flag was specified and the provided device name is empty, contains a
+.Qq \&.
+or
+.Qq ..
+path component or ends with
+.Ql / .
+.It Bq Er EEXIST
+The
+.Dv MAKEDEV_CHECKNAME
+flag was specified and the provided device name already exists.
+.El
+.Sh SEE ALSO
+.Xr devctl 4 ,
+.Xr devfs 5 ,
+.Xr destroy_dev_drain 9 ,
+.Xr dev_clone 9
+.Sh HISTORY
+The
+.Fn make_dev
+and
+.Fn destroy_dev
+functions first appeared in
+.Fx 4.0 .
+The function
+.Fn make_dev_alias
+first appeared in
+.Fx 4.1 .
+The function
+.Fn dev_depends
+first appeared in
+.Fx 5.0 .
+The functions
+.Fn make_dev_credf ,
+.Fn destroy_dev_sched ,
+.Fn destroy_dev_sched_cb
+first appeared in
+.Fx 7.0 .
+The function
+.Fn make_dev_p
+first appeared in
+.Fx 8.2 .
diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9
new file mode 100644
index 000000000000..749093931f57
--- /dev/null
+++ b/share/man/man9/malloc.9
@@ -0,0 +1,286 @@
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
+.\" $FreeBSD$
+.\"
+.Dd January 28, 2012
+.Dt MALLOC 9
+.Os
+.Sh NAME
+.Nm malloc ,
+.Nm free ,
+.Nm realloc ,
+.Nm reallocf ,
+.Nm MALLOC_DEFINE ,
+.Nm MALLOC_DECLARE
+.Nd kernel memory management routines
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/malloc.h
+.Ft void *
+.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags"
+.Ft void
+.Fn free "void *addr" "struct malloc_type *type"
+.Ft void *
+.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
+.Ft void *
+.Fn reallocf "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
+.Fn MALLOC_DECLARE type
+.In sys/param.h
+.In sys/malloc.h
+.In sys/kernel.h
+.Fn MALLOC_DEFINE type shortdesc longdesc
+.Sh DESCRIPTION
+The
+.Fn malloc
+function allocates uninitialized memory in kernel address space for an
+object whose size is specified by
+.Fa size .
+.Pp
+The
+.Fn free
+function releases memory at address
+.Fa addr
+that was previously allocated by
+.Fn malloc
+for re-use.
+The memory is not zeroed.
+If
+.Fa addr
+is
+.Dv NULL ,
+then
+.Fn free
+does nothing.
+.Pp
+The
+.Fn realloc
+function changes the size of the previously allocated memory referenced by
+.Fa addr
+to
+.Fa size
+bytes.
+The contents of the memory are unchanged up to the lesser of the new and
+old sizes.
+Note that the returned value may differ from
+.Fa addr .
+If the requested memory cannot be allocated,
+.Dv NULL
+is returned and the memory referenced by
+.Fa addr
+is valid and unchanged.
+If
+.Fa addr
+is
+.Dv NULL ,
+the
+.Fn realloc
+function behaves identically to
+.Fn malloc
+for the specified size.
+.Pp
+The
+.Fn reallocf
+function is identical to
+.Fn realloc
+except that it
+will free the passed pointer when the requested memory cannot be allocated.
+.Pp
+Unlike its standard C library counterpart
+.Pq Xr malloc 3 ,
+the kernel version takes two more arguments.
+The
+.Fa flags
+argument further qualifies
+.Fn malloc Ns 's
+operational characteristics as follows:
+.Bl -tag -width indent
+.It Dv M_ZERO
+Causes the allocated memory to be set to all zeros.
+.It Dv M_NODUMP
+For allocations greater than page size, causes the allocated
+memory to be excluded from kernel core dumps.
+.It Dv M_NOWAIT
+Causes
+.Fn malloc ,
+.Fn realloc ,
+and
+.Fn reallocf
+to return
+.Dv NULL
+if the request cannot be immediately fulfilled due to resource shortage.
+Note that
+.Dv M_NOWAIT
+is required when running in an interrupt context.
+.It Dv M_WAITOK
+Indicates that it is OK to wait for resources.
+If the request cannot be immediately fulfilled, the current process is put
+to sleep to wait for resources to be released by other processes.
+The
+.Fn malloc ,
+.Fn realloc ,
+and
+.Fn reallocf
+functions cannot return
+.Dv NULL
+if
+.Dv M_WAITOK
+is specified.
+.It Dv M_USE_RESERVE
+Indicates that the system can dig into its reserve in order to obtain the
+requested memory.
+This option used to be called
+.Dv M_KERNEL
+but has been renamed to something more obvious.
+This option has been deprecated and is slowly being removed from the kernel,
+and so should not be used with any new programming.
+.El
+.Pp
+Exactly one of either
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT
+must be specified.
+.Pp
+The
+.Fa type
+argument is used to perform statistics on memory usage, and for
+basic sanity checks.
+It can be used to identify multiple allocations.
+The statistics can be examined by
+.Sq vmstat -m .
+.Pp
+A
+.Fa type
+is defined using
+.Vt "struct malloc_type"
+via the
+.Fn MALLOC_DECLARE
+and
+.Fn MALLOC_DEFINE
+macros.
+.Bd -literal -offset indent
+/* sys/something/foo_extern.h */
+
+MALLOC_DECLARE(M_FOOBUF);
+
+/* sys/something/foo_main.c */
+
+MALLOC_DEFINE(M_FOOBUF, "foobuffers", "Buffers to foo data into the ether");
+
+/* sys/something/foo_subr.c */
+
+\&...
+buf = malloc(sizeof *buf, M_FOOBUF, M_NOWAIT);
+
+.Ed
+.Pp
+In order to use
+.Fn MALLOC_DEFINE ,
+one must include
+.In sys/param.h
+(instead of
+.In sys/types.h )
+and
+.In sys/kernel.h .
+.Sh IMPLEMENTATION NOTES
+The memory allocator allocates memory in chunks that have size a power
+of two for requests up to the size of a page of memory.
+For larger requests, one or more pages is allocated.
+While it should not be relied upon, this information may be useful for
+optimizing the efficiency of memory use.
+.Pp
+Programmers should be careful not to confuse the malloc flags
+.Dv M_NOWAIT
+and
+.Dv M_WAITOK
+with the
+.Xr mbuf 9
+flags
+.Dv M_DONTWAIT
+and
+.Dv M_WAIT .
+.Sh CONTEXT
+.Fn malloc ,
+.Fn realloc
+and
+.Fn reallocf
+may not be called from fast interrupts handlers.
+When called from threaded interrupts,
+.Fa flags
+must contain
+.Dv M_NOWAIT .
+.Pp
+.Fn malloc ,
+.Fn realloc
+and
+.Fn reallocf
+may sleep when called with
+.Dv M_WAITOK .
+.Fn free
+never sleeps.
+.Pp
+Any calls to
+.Fn malloc
+(even with
+.Dv M_NOWAIT )
+or
+.Fn free
+when holding a
+.Xr vnode 9
+interlock, will cause a LOR (Lock Order Reversal) due to the
+intertwining of VM Objects and Vnodes.
+.Sh RETURN VALUES
+The
+.Fn malloc ,
+.Fn realloc ,
+and
+.Fn reallocf
+functions return a kernel virtual address that is suitably aligned for
+storage of any type of object, or
+.Dv NULL
+if the request could not be satisfied (implying that
+.Dv M_NOWAIT
+was set).
+.Sh DIAGNOSTICS
+A kernel compiled with the
+.Dv INVARIANTS
+configuration option attempts to detect memory corruption caused by
+such things as writing outside the allocated area and imbalanced calls to the
+.Fn malloc
+and
+.Fn free
+functions.
+Failing consistency checks will cause a panic or a system console
+message.
+.Sh SEE ALSO
+.Xr vmstat 8 ,
+.Xr contigmalloc 9 ,
+.Xr memguard 9 ,
+.Xr vnode 9
diff --git a/share/man/man9/mbchain.9 b/share/man/man9/mbchain.9
new file mode 100644
index 000000000000..4e05e7ad3ec9
--- /dev/null
+++ b/share/man/man9/mbchain.9
@@ -0,0 +1,222 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Boris Popov
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 20, 2001
+.Dt MBCHAIN 9
+.Os
+.Sh NAME
+.Nm mbchain ,
+.Nm mb_init ,
+.Nm mb_initm ,
+.Nm mb_done ,
+.Nm mb_detach ,
+.Nm mb_fixhdr ,
+.Nm mb_reserve ,
+.Nm mb_put_uint8 ,
+.Nm mb_put_uint16be ,
+.Nm mb_put_uint16le ,
+.Nm mb_put_uint32be ,
+.Nm mb_put_uint32le ,
+.Nm mb_put_int64be ,
+.Nm mb_put_int64le ,
+.Nm mb_put_mem ,
+.Nm mb_put_mbuf ,
+.Nm mb_put_uio
+.Nd "set of functions to build an mbuf chain from various data types"
+.Sh SYNOPSIS
+.Cd options LIBMCHAIN
+.Li kldload libmchain
+.Pp
+.In sys/param.h
+.In sys/uio.h
+.In sys/mchain.h
+.Ft int
+.Fn mb_init "struct mbchain *mbp"
+.Ft void
+.Fn mb_initm "struct mbchain *mbp" "struct mbuf *m"
+.Ft void
+.Fn mb_done "struct mbchain *mbp"
+.Ft struct mbuf *
+.Fn mb_detach "struct mbchain *mbp"
+.Ft int
+.Fn mb_fixhdr "struct mbchain *mbp"
+.Ft caddr_t
+.Fn mb_reserve "struct mbchain *mbp" "int size"
+.Ft int
+.Fn mb_put_uint8 "struct mbchain *mbp" "uint8_t x"
+.Ft int
+.Fn mb_put_uint16be "struct mbchain *mbp" "uint16_t x"
+.Ft int
+.Fn mb_put_uint16le "struct mbchain *mbp" "uint16_t x"
+.Ft int
+.Fn mb_put_uint32be "struct mbchain *mbp" "uint32_t x"
+.Ft int
+.Fn mb_put_uint32le "struct mbchain *mbp" "uint32_t x"
+.Ft int
+.Fn mb_put_int64be "struct mbchain *mbp" "int64_t x"
+.Ft int
+.Fn mb_put_int64le "struct mbchain *mbp" "int64_t x"
+.Ft int
+.Fn mb_put_mem "struct mbchain *mbp" "c_caddr_t source" "int size" "int type"
+.Ft int
+.Fn mb_put_mbuf "struct mbchain *mbp" "struct mbuf *m"
+.Ft int
+.Fn mb_put_uio "struct mbchain *mbp" "struct uio *uiop" "int size"
+.Sh DESCRIPTION
+These functions are used to compose mbuf chains from various data types.
+The
+.Vt mbchain
+structure is used as a working context and should be initialized with a call
+to either
+.Fn mb_init
+or
+.Fn mb_initm .
+It has the following fields:
+.Bl -tag -width ".Va mb_count"
+.It Va "mb_top"
+.Pq Vt "struct mbuf *"
+A pointer to the top of constructed mbuf chain.
+.It Va mb_cur
+.Pq Vt "struct mbuf *"
+A pointer to the currently filled mbuf.
+.It Va mb_mleft
+.Pq Vt int
+Number of bytes left in the current mbuf.
+.It Va mb_count
+.Pq Vt int
+Total number of bytes placed in the mbuf chain.
+.It Va mb_copy
+.Pq Vt "mb_copy_t *"
+User-defined function to perform a copy into mbuf;
+useful if any unusual
+data conversion is necessary.
+.It Va mb_udata
+.Pq Vt "void *"
+User-supplied data which can be used in the
+.Va mb_copy
+function.
+.El
+.Pp
+.Fn mb_done
+function disposes an mbuf chain pointed to by
+.Fa mbp->mb_top
+field and sets
+the field to
+.Dv NULL .
+.Pp
+.Fn mb_detach
+function returns the value of
+.Fa mbp->mb_top
+field and sets its value to
+.Dv NULL .
+.Pp
+.Fn mb_fixhdr
+recalculates the length of an mbuf chain and updates the
+.Va m_pkthdr.len
+field of the first mbuf in the chain.
+It returns the calculated length.
+.Pp
+.Fn mb_reserve
+ensures that the object of the length specified by the
+.Fa size
+argument will fit in the current mbuf (mbuf allocation is performed if
+necessary), and advances all pointers as if the real data was placed.
+Returned
+value will point to the beginning of the reserved space.
+Note that the size
+of the object should not exceed
+.Dv MLEN
+bytes.
+.Pp
+All
+.Fn mb_put_*
+functions perform an actual copy of the data into mbuf chain.
+Functions which have
+.Cm le
+or
+.Cm be
+suffixes will perform conversion to the little\- or big\-endian data formats.
+.Pp
+.Fn mb_put_mem
+function copies
+.Fa size
+bytes of data specified by the
+.Fa source
+argument to an mbuf chain.
+The
+.Fa type
+argument specifies the method used to perform a copy,
+and can be one of the following:
+.Bl -tag -width ".Dv MB_MINLINE"
+.It Dv MB_MSYSTEM
+Use
+.Fn bcopy
+function.
+.It Dv MB_MUSER
+Use
+.Xr copyin 9
+function.
+.It Dv MB_MINLINE
+Use an
+.Dq inline
+loop which does not call any function.
+.It Dv MB_MZERO
+Do not copy any data, but just fill the destination with zero bytes.
+.It Dv MB_MCUSTOM
+Call function specified by the
+.Fa mbp->mb_copy
+field.
+.El
+.Sh RETURN VALUES
+All
+.Ft int
+functions except
+.Fn mb_fixhdr
+return zero if successful and an error code otherwise.
+.Pp
+.Em Note :
+after failure of any function, an mbuf chain is left in the broken state,
+and only
+.Fn mb_done
+function can safely be called to destroy it.
+.Sh EXAMPLES
+.Bd -literal
+struct mbchain *mbp;
+struct mbuf *m;
+
+mb_init(mbp);
+mb_put_uint8(mbp, 33);
+mb_put_uint16le(mbp, length);
+m = m_copym(mbp->mb_top, 0, M_COPYALL, M_WAIT);
+send(m);
+mb_done(mbp);
+.Ed
+.Sh SEE ALSO
+.Xr mbuf 9 ,
+.Xr mdchain 9
+.Sh AUTHORS
+This manual page was written by
+.An Boris Popov Aq bp@FreeBSD.org .
diff --git a/share/man/man9/mbpool.9 b/share/man/man9/mbpool.9
new file mode 100644
index 000000000000..600c37179fb4
--- /dev/null
+++ b/share/man/man9/mbpool.9
@@ -0,0 +1,264 @@
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 15, 2003
+.Dt MBPOOL 9
+.Os
+.Sh NAME
+.Nm mbpool
+.Nd "buffer pools for network interfaces"
+.Sh SYNOPSIS
+.In sys/types.h
+.In machine/bus.h
+.In sys/mbpool.h
+.Vt struct mbpool ;
+.Ft int
+.Fo mbp_create
+.Fa "struct mbpool **mbp" "const char *name" "bus_dma_tag_t dmat"
+.Fa "u_int max_pages" "size_t page_size" "size_t chunk_size"
+.Fc
+.Ft void
+.Fn mbp_destroy "struct mbpool *mbp"
+.Ft "void *"
+.Fn mbp_alloc "struct mbpool *mbp" "bus_addr_t *pa" "uint32_t *hp"
+.Ft void
+.Fn mbp_free "struct mbpool *mbp" "void *p"
+.Ft void
+.Fn mbp_ext_free "void *" "void *"
+.Ft void
+.Fn mbp_card_free "struct mbpool *mbp"
+.Ft void
+.Fn mbp_count "struct mbpool *mbp" "u_int *used" "u_int *card" "u_int *free"
+.Ft "void *"
+.Fn mbp_get "struct mbpool *mbp" "uint32_t h"
+.Ft "void *"
+.Fn mbp_get_keep "struct mbpool *mbp" "uint32_t h"
+.Ft void
+.Fo mbp_sync
+.Fa "struct mbpool *mbp" "uint32_t h" "bus_addr_t off" "bus_size_t len"
+.Fa "u_int op"
+.Fc
+.Pp
+.Fn MODULE_DEPEND "your_module" "libmbpool" 1 1 1
+.Pp
+.Cd "options LIBMBPOOL"
+.Sh DESCRIPTION
+Mbuf pools are intended to help drivers for interface cards that need huge
+amounts of receive buffers, and additionally provides a mapping between these
+buffers and 32-bit handles.
+.Pp
+An example of these cards are the Fore/Marconi ForeRunnerHE cards.
+These
+employ up to 8 receive groups, each with two buffer pools, each of which
+can contain up to 8192.
+This gives a total maximum number of more than
+100000 buffers.
+Even with a more moderate configuration the card eats several
+thousand buffers.
+Each of these buffers must be mapped for DMA.
+While for
+machines without an IOMMU and with lesser than 4GByte memory this is not
+a problem, for other machines this may quickly eat up all available IOMMU
+address space and/or bounce buffers.
+On sparc64, the default I/O page size
+is 16k, so mapping a simple mbuf wastes 31/32 of the address space.
+.Pp
+Another problem with most of these cards is that they support putting a 32-bit
+handle into the buffer descriptor together with the physical address.
+This handle is reflected back to the driver when the buffer is filled, and
+assists the driver in finding the buffer in host memory.
+For 32-bit machines,
+the virtual address of the buffer is usually used as the handle.
+This does not
+work for 64-bit machines for obvious reasons, so a mapping is needed between
+these handles and the buffers.
+This mapping should be possible without
+searching lists and the like.
+.Pp
+An mbuf pool overcomes both problems by allocating DMA-able memory page wise
+with a per-pool configurable page size.
+Each page is divided into a number of
+equally-sized chunks, the last
+.Dv MBPOOL_TRAILER_SIZE
+of which are used by the pool code (4 bytes).
+The rest of each chunk is
+usable as a buffer.
+There is a per-pool limit on pages that will be allocated.
+.Pp
+Additionally, the code manages two flags for each buffer:
+.Dq on-card
+and
+.Dq used .
+A buffer may be in one of three states:
+.Bl -tag -width "on-card"
+.It free
+None of the flags is set.
+.It on-card
+Both flags are set.
+The buffer is assumed to be handed over to the card and
+waiting to be filled.
+.It used
+The buffer was returned by the card and is now travelling through the system.
+.El
+.Pp
+A pool is created with
+.Fn mbp_create .
+This call specifies a DMA tag
+.Fa dmat
+to be used to create and map the memory pages via
+.Xr bus_dmamem_alloc 9 .
+The
+.Fa chunk_size
+includes the pool overhead.
+It means that to get buffers for 5 ATM cells
+(240 bytes), a chunk size of 256 should be specified.
+This results in 12 unused
+bytes between the buffer, and the pool overhead of four byte.
+The total
+maximum number of buffers in a pool is
+.Fa max_pages
+*
+.Fa ( page_size
+/
+.Fa chunk_size ) .
+The maximum value for
+.Fa max_pages
+is 2^14-1 (16383) and the maximum of
+.Fa page_size
+/
+.Fa chunk_size
+is 2^9 (512).
+If the call is successful, a pointer to a newly allocated
+.Vt "struct mbpool"
+is set into the variable pointed to by
+.Fa mpb .
+.Pp
+A pool is destroyed with
+.Fn mbp_destroy .
+This frees all pages and the pool structure itself.
+If compiled with
+.Dv DIAGNOSTICS ,
+the code checks that all buffers are free.
+If not, a warning message is issued
+to the console.
+.Pp
+A buffer is allocated with
+.Fn mbp_alloc .
+This returns the virtual address of the buffer and stores the physical
+address into the variable pointed to by
+.Fa pa .
+The handle is stored into the variable pointed to by
+.Fa hp .
+The two most significant bits and the 7 least significant bits of the handle
+are unused by the pool code and may be used by the caller.
+These are
+automatically stripped when passing a handle to one of the other functions.
+If a buffer cannot be allocated (either because the maximum number of pages
+is reached, no memory is available or the memory cannot be mapped),
+.Dv NULL
+is returned.
+If a buffer could be allocated, it is in the
+.Dq on-card
+state.
+.Pp
+When the buffer is returned by the card, the driver calls
+.Fn mbp_get
+with the handle.
+This function returns the virtual address of the buffer
+and clears the
+.Dq on-card
+bit.
+The buffer is now in the
+.Dq used
+state.
+The function
+.Fn mbp_get_keep
+differs from
+.Fn mbp_get
+in that it does not clear the
+.Dq on-card
+bit.
+This can be used for buffers
+that are returned
+.Dq partially
+by the card.
+.Pp
+A buffer is freed by calling
+.Fn mbp_free
+with the virtual address of the buffer.
+This clears the
+.Dq used
+bit, and
+puts the buffer on the free list of the pool.
+Note that free buffers
+are NOT returned to the system.
+The function
+.Fn mbp_ext_free
+can be given to
+.Fn m_extadd
+as the free function.
+The user argument must be the pointer to
+the pool.
+.Pp
+Before using the contents of a buffer returned by the card, the driver
+must call
+.Fn mbp_sync
+with the appropriate parameters.
+This results in a call to
+.Xr bus_dmamap_sync 9
+for the buffer.
+.Pp
+All buffers in the pool that are currently in the
+.Dq on-card
+state can be freed
+with a call to
+.Fn mbp_card_free .
+This may be called by the driver when it stops the interface.
+Buffers in the
+.Dq used
+state are not freed by this call.
+.Pp
+For debugging it is possible to call
+.Fn mbp_count .
+This returns the number of buffers in the
+.Dq used
+and
+.Dq on-card
+states and
+the number of buffers on the free list.
+.Sh SEE ALSO
+.Xr mbuf 9
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
+.Sh CAVEATS
+The function
+.Fn mbp_sync
+is currently a no-op because
+.Xr bus_dmamap_sync 9
+is missing the offset and length parameters.
diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9
new file mode 100644
index 000000000000..b029c5219ce9
--- /dev/null
+++ b/share/man/man9/mbuf.9
@@ -0,0 +1,1238 @@
+.\" Copyright (c) 2000 FreeBSD Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 18, 2011
+.Dt MBUF 9
+.Os
+.\"
+.Sh NAME
+.Nm mbuf
+.Nd "memory management in the kernel IPC subsystem"
+.\"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/mbuf.h
+.\"
+.Ss Mbuf allocation macros
+.Fn MGET "struct mbuf *mbuf" "int how" "short type"
+.Fn MGETHDR "struct mbuf *mbuf" "int how" "short type"
+.Fn MCLGET "struct mbuf *mbuf" "int how"
+.Fo MEXTADD
+.Fa "struct mbuf *mbuf"
+.Fa "caddr_t buf"
+.Fa "u_int size"
+.Fa "void (*free)(void *opt_arg1, void *opt_arg2)"
+.Fa "void *opt_arg1"
+.Fa "void *opt_arg2"
+.Fa "short flags"
+.Fa "int type"
+.Fc
+.Fn MEXTFREE "struct mbuf *mbuf"
+.Fn MFREE "struct mbuf *mbuf" "struct mbuf *successor"
+.\"
+.Ss Mbuf utility macros
+.Fn mtod "struct mbuf *mbuf" "type"
+.Fn M_ALIGN "struct mbuf *mbuf" "u_int len"
+.Fn MH_ALIGN "struct mbuf *mbuf" "u_int len"
+.Ft int
+.Fn M_LEADINGSPACE "struct mbuf *mbuf"
+.Ft int
+.Fn M_TRAILINGSPACE "struct mbuf *mbuf"
+.Fn M_MOVE_PKTHDR "struct mbuf *to" "struct mbuf *from"
+.Fn M_PREPEND "struct mbuf *mbuf" "int len" "int how"
+.Fn MCHTYPE "struct mbuf *mbuf" "u_int type"
+.Ft int
+.Fn M_WRITABLE "struct mbuf *mbuf"
+.\"
+.Ss Mbuf allocation functions
+.Ft struct mbuf *
+.Fn m_get "int how" "int type"
+.Ft struct mbuf *
+.Fn m_getm "struct mbuf *orig" "int len" "int how" "int type"
+.Ft struct mbuf *
+.Fn m_getcl "int how" "short type" "int flags"
+.Ft struct mbuf *
+.Fn m_getclr "int how" "int type"
+.Ft struct mbuf *
+.Fn m_gethdr "int how" "int type"
+.Ft struct mbuf *
+.Fn m_free "struct mbuf *mbuf"
+.Ft void
+.Fn m_freem "struct mbuf *mbuf"
+.\"
+.Ss Mbuf utility functions
+.Ft void
+.Fn m_adj "struct mbuf *mbuf" "int len"
+.Ft void
+.Fn m_align "struct mbuf *mbuf" "int len"
+.Ft int
+.Fn m_append "struct mbuf *mbuf" "int len" "c_caddr_t cp"
+.Ft struct mbuf *
+.Fn m_prepend "struct mbuf *mbuf" "int len" "int how"
+.Ft struct mbuf *
+.Fn m_copyup "struct mbuf *mbuf" "int len" "int dstoff"
+.Ft struct mbuf *
+.Fn m_pullup "struct mbuf *mbuf" "int len"
+.Ft struct mbuf *
+.Fn m_pulldown "struct mbuf *mbuf" "int offset" "int len" "int *offsetp"
+.Ft struct mbuf *
+.Fn m_copym "struct mbuf *mbuf" "int offset" "int len" "int how"
+.Ft struct mbuf *
+.Fn m_copypacket "struct mbuf *mbuf" "int how"
+.Ft struct mbuf *
+.Fn m_dup "struct mbuf *mbuf" "int how"
+.Ft void
+.Fn m_copydata "const struct mbuf *mbuf" "int offset" "int len" "caddr_t buf"
+.Ft void
+.Fn m_copyback "struct mbuf *mbuf" "int offset" "int len" "caddr_t buf"
+.Ft struct mbuf *
+.Fo m_devget
+.Fa "char *buf"
+.Fa "int len"
+.Fa "int offset"
+.Fa "struct ifnet *ifp"
+.Fa "void (*copy)(char *from, caddr_t to, u_int len)"
+.Fc
+.Ft void
+.Fn m_cat "struct mbuf *m" "struct mbuf *n"
+.Ft u_int
+.Fn m_fixhdr "struct mbuf *mbuf"
+.Ft void
+.Fn m_dup_pkthdr "struct mbuf *to" "struct mbuf *from"
+.Ft void
+.Fn m_move_pkthdr "struct mbuf *to" "struct mbuf *from"
+.Ft u_int
+.Fn m_length "struct mbuf *mbuf" "struct mbuf **last"
+.Ft struct mbuf *
+.Fn m_split "struct mbuf *mbuf" "int len" "int how"
+.Ft int
+.Fn m_apply "struct mbuf *mbuf" "int off" "int len" "int (*f)(void *arg, void *data, u_int len)" "void *arg"
+.Ft struct mbuf *
+.Fn m_getptr "struct mbuf *mbuf" "int loc" "int *off"
+.Ft struct mbuf *
+.Fn m_defrag "struct mbuf *m0" "int how"
+.Ft struct mbuf *
+.Fn m_unshare "struct mbuf *m0" "int how"
+.\"
+.Sh DESCRIPTION
+An
+.Vt mbuf
+is a basic unit of memory management in the kernel IPC subsystem.
+Network packets and socket buffers are stored in
+.Vt mbufs .
+A network packet may span multiple
+.Vt mbufs
+arranged into a
+.Vt mbuf chain
+(linked list),
+which allows adding or trimming
+network headers with little overhead.
+.Pp
+While a developer should not bother with
+.Vt mbuf
+internals without serious
+reason in order to avoid incompatibilities with future changes, it
+is useful to understand the general structure of an
+.Vt mbuf .
+.Pp
+An
+.Vt mbuf
+consists of a variable-sized header and a small internal
+buffer for data.
+The total size of an
+.Vt mbuf ,
+.Dv MSIZE ,
+is a constant defined in
+.In sys/param.h .
+The
+.Vt mbuf
+header includes:
+.Bl -tag -width "m_nextpkt" -offset indent
+.It Va m_next
+.Pq Vt struct mbuf *
+A pointer to the next
+.Vt mbuf
+in the
+.Vt mbuf chain .
+.It Va m_nextpkt
+.Pq Vt struct mbuf *
+A pointer to the next
+.Vt mbuf chain
+in the queue.
+.It Va m_data
+.Pq Vt caddr_t
+A pointer to data attached to this
+.Vt mbuf .
+.It Va m_len
+.Pq Vt int
+The length of the data.
+.It Va m_type
+.Pq Vt short
+The type of the data.
+.It Va m_flags
+.Pq Vt int
+The
+.Vt mbuf
+flags.
+.El
+.Pp
+The
+.Vt mbuf
+flag bits are defined as follows:
+.Bd -literal
+/* mbuf flags */
+#define M_EXT 0x0001 /* has associated external storage */
+#define M_PKTHDR 0x0002 /* start of record */
+#define M_EOR 0x0004 /* end of record */
+#define M_RDONLY 0x0008 /* associated data marked read-only */
+#define M_PROTO1 0x0010 /* protocol-specific */
+#define M_PROTO2 0x0020 /* protocol-specific */
+#define M_PROTO3 0x0040 /* protocol-specific */
+#define M_PROTO4 0x0080 /* protocol-specific */
+#define M_PROTO5 0x0100 /* protocol-specific */
+#define M_PROTO6 0x4000 /* protocol-specific (avoid M_BCAST conflict) */
+#define M_FREELIST 0x8000 /* mbuf is on the free list */
+
+/* mbuf pkthdr flags (also stored in m_flags) */
+#define M_BCAST 0x0200 /* send/received as link-level broadcast */
+#define M_MCAST 0x0400 /* send/received as link-level multicast */
+#define M_FRAG 0x0800 /* packet is fragment of larger packet */
+#define M_FIRSTFRAG 0x1000 /* packet is first fragment */
+#define M_LASTFRAG 0x2000 /* packet is last fragment */
+.Ed
+.Pp
+The available
+.Vt mbuf
+types are defined as follows:
+.Bd -literal
+/* mbuf types */
+#define MT_DATA 1 /* dynamic (data) allocation */
+#define MT_HEADER MT_DATA /* packet header */
+#define MT_SONAME 8 /* socket name */
+#define MT_CONTROL 14 /* extra-data protocol message */
+#define MT_OOBDATA 15 /* expedited data */
+.Ed
+.Pp
+The available external buffer types are defined as follows:
+.Bd -literal
+/* external buffer types */
+#define EXT_CLUSTER 1 /* mbuf cluster */
+#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */
+#define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */
+#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */
+#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
+#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
+#define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */
+#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */
+#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */
+#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */
+#define EXT_EXTREF 400 /* has externally maintained ref_cnt ptr */
+.Ed
+.Pp
+If the
+.Dv M_PKTHDR
+flag is set, a
+.Vt struct pkthdr Va m_pkthdr
+is added to the
+.Vt mbuf
+header.
+It contains a pointer to the interface
+the packet has been received from
+.Pq Vt struct ifnet Va *rcvif ,
+and the total packet length
+.Pq Vt int Va len .
+Optionally, it may also contain an attached list of packet tags
+.Pq Vt "struct m_tag" .
+See
+.Xr mbuf_tags 9
+for details.
+Fields used in offloading checksum calculation to the hardware are kept in
+.Va m_pkthdr
+as well.
+See
+.Sx HARDWARE-ASSISTED CHECKSUM CALCULATION
+for details.
+.Pp
+If small enough, data is stored in the internal data buffer of an
+.Vt mbuf .
+If the data is sufficiently large, another
+.Vt mbuf
+may be added to the
+.Vt mbuf chain ,
+or external storage may be associated with the
+.Vt mbuf .
+.Dv MHLEN
+bytes of data can fit into an
+.Vt mbuf
+with the
+.Dv M_PKTHDR
+flag set,
+.Dv MLEN
+bytes can otherwise.
+.Pp
+If external storage is being associated with an
+.Vt mbuf ,
+the
+.Va m_ext
+header is added at the cost of losing the internal data buffer.
+It includes a pointer to external storage, the size of the storage,
+a pointer to a function used for freeing the storage,
+a pointer to an optional argument that can be passed to the function,
+and a pointer to a reference counter.
+An
+.Vt mbuf
+using external storage has the
+.Dv M_EXT
+flag set.
+.Pp
+The system supplies a macro for allocating the desired external storage
+buffer,
+.Dv MEXTADD .
+.Pp
+The allocation and management of the reference counter is handled by the
+subsystem.
+.Pp
+The system also supplies a default type of external storage buffer called an
+.Vt mbuf cluster .
+.Vt Mbuf clusters
+can be allocated and configured with the use of the
+.Dv MCLGET
+macro.
+Each
+.Vt mbuf cluster
+is
+.Dv MCLBYTES
+in size, where MCLBYTES is a machine-dependent constant.
+The system defines an advisory macro
+.Dv MINCLSIZE ,
+which is the smallest amount of data to put into an
+.Vt mbuf cluster .
+It is equal to the sum of
+.Dv MLEN
+and
+.Dv MHLEN .
+It is typically preferable to store data into the data region of an
+.Vt mbuf ,
+if size permits, as opposed to allocating a separate
+.Vt mbuf cluster
+to hold the same data.
+.\"
+.Ss Macros and Functions
+There are numerous predefined macros and functions that provide the
+developer with common utilities.
+.\"
+.Bl -ohang -offset indent
+.It Fn mtod mbuf type
+Convert an
+.Fa mbuf
+pointer to a data pointer.
+The macro expands to the data pointer cast to the pointer of the specified
+.Fa type .
+.Sy Note :
+It is advisable to ensure that there is enough contiguous data in
+.Fa mbuf .
+See
+.Fn m_pullup
+for details.
+.It Fn MGET mbuf how type
+Allocate an
+.Vt mbuf
+and initialize it to contain internal data.
+.Fa mbuf
+will point to the allocated
+.Vt mbuf
+on success, or be set to
+.Dv NULL
+on failure.
+The
+.Fa how
+argument is to be set to
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT .
+It specifies whether the caller is willing to block if necessary.
+A number of other functions and macros related to
+.Vt mbufs
+have the same argument because they may
+at some point need to allocate new
+.Vt mbufs .
+.Pp
+Historical
+.Vt mbuf
+allocator (See
+.Sx HISTORY
+section) used allocation flags
+.Dv M_WAIT
+and
+.Dv M_DONTWAIT .
+These constants are kept for compatibility
+and their use in new code is discouraged.
+.It Fn MGETHDR mbuf how type
+Allocate an
+.Vt mbuf
+and initialize it to contain a packet header
+and internal data.
+See
+.Fn MGET
+for details.
+.It Fn MEXTADD mbuf buf size free opt_arg1 opt_arg2 flags type
+Associate externally managed data with
+.Fa mbuf .
+Any internal data contained in the mbuf will be discarded, and the
+.Dv M_EXT flag will be set.
+The
+.Fa buf
+and
+.Fa size
+arguments are the address and length, respectively, of the data.
+The
+.Fa free
+argument points to a function which will be called to free the data
+when the mbuf is freed; it is only used if
+.Fa type
+is
+.Dv EXT_EXTREF .
+The
+.Fa opt_arg1
+and
+.Fa opt_arg2
+arguments will be passed unmodified to
+.Fa free .
+The
+.Fa flags
+argument specifies additional
+.Vt mbuf
+flags; it is not necessary to specify
+.Dv M_EXT .
+Finally, the
+.Fa type
+argument specifies the type of external data, which controls how it
+will be disposed of when the
+.Vt mbuf
+is freed.
+In most cases, the correct value is
+.Dv EXT_EXTREF .
+.It Fn MCLGET mbuf how
+Allocate and attach an
+.Vt mbuf cluster
+to
+.Fa mbuf .
+If the macro fails, the
+.Dv M_EXT
+flag will not be set in
+.Fa mbuf .
+.It Fn M_ALIGN mbuf len
+Set the pointer
+.Fa mbuf->m_data
+to place an object of the size
+.Fa len
+at the end of the internal data area of
+.Fa mbuf ,
+long word aligned.
+Applicable only if
+.Fa mbuf
+is newly allocated with
+.Fn MGET
+or
+.Fn m_get .
+.It Fn MH_ALIGN mbuf len
+Serves the same purpose as
+.Fn M_ALIGN
+does, but only for
+.Fa mbuf
+newly allocated with
+.Fn MGETHDR
+or
+.Fn m_gethdr ,
+or initialized by
+.Fn m_dup_pkthdr
+or
+.Fn m_move_pkthdr .
+.It Fn m_align mbuf len
+Services the same purpose as
+.Fn M_ALIGN
+but handles any type of mbuf.
+.It Fn M_LEADINGSPACE mbuf
+Returns the number of bytes available before the beginning
+of data in
+.Fa mbuf .
+.It Fn M_TRAILINGSPACE mbuf
+Returns the number of bytes available after the end of data in
+.Fa mbuf .
+.It Fn M_PREPEND mbuf len how
+This macro operates on an
+.Vt mbuf chain .
+It is an optimized wrapper for
+.Fn m_prepend
+that can make use of possible empty space before data
+(e.g.\& left after trimming of a link-layer header).
+The new
+.Vt mbuf chain
+pointer or
+.Dv NULL
+is in
+.Fa mbuf
+after the call.
+.It Fn M_MOVE_PKTHDR to from
+Using this macro is equivalent to calling
+.Fn m_move_pkthdr to from .
+.It Fn M_WRITABLE mbuf
+This macro will evaluate true if
+.Fa mbuf
+is not marked
+.Dv M_RDONLY
+and if either
+.Fa mbuf
+does not contain external storage or,
+if it does,
+then if the reference count of the storage is not greater than 1.
+The
+.Dv M_RDONLY
+flag can be set in
+.Fa mbuf->m_flags .
+This can be achieved during setup of the external storage,
+by passing the
+.Dv M_RDONLY
+bit as a
+.Fa flags
+argument to the
+.Fn MEXTADD
+macro, or can be directly set in individual
+.Vt mbufs .
+.It Fn MCHTYPE mbuf type
+Change the type of
+.Fa mbuf
+to
+.Fa type .
+This is a relatively expensive operation and should be avoided.
+.El
+.Pp
+The functions are:
+.Bl -ohang -offset indent
+.It Fn m_get how type
+A function version of
+.Fn MGET
+for non-critical paths.
+.It Fn m_getm orig len how type
+Allocate
+.Fa len
+bytes worth of
+.Vt mbufs
+and
+.Vt mbuf clusters
+if necessary and append the resulting allocated
+.Vt mbuf chain
+to the
+.Vt mbuf chain
+.Fa orig ,
+if it is
+.No non- Ns Dv NULL .
+If the allocation fails at any point,
+free whatever was allocated and return
+.Dv NULL .
+If
+.Fa orig
+is
+.No non- Ns Dv NULL ,
+it will not be freed.
+It is possible to use
+.Fn m_getm
+to either append
+.Fa len
+bytes to an existing
+.Vt mbuf
+or
+.Vt mbuf chain
+(for example, one which may be sitting in a pre-allocated ring)
+or to simply perform an all-or-nothing
+.Vt mbuf
+and
+.Vt mbuf cluster
+allocation.
+.It Fn m_gethdr how type
+A function version of
+.Fn MGETHDR
+for non-critical paths.
+.It Fn m_getcl how type flags
+Fetch an
+.Vt mbuf
+with a
+.Vt mbuf cluster
+attached to it.
+If one of the allocations fails, the entire allocation fails.
+This routine is the preferred way of fetching both the
+.Vt mbuf
+and
+.Vt mbuf cluster
+together, as it avoids having to unlock/relock between allocations.
+Returns
+.Dv NULL
+on failure.
+.It Fn m_getclr how type
+Allocate an
+.Vt mbuf
+and zero out the data region.
+.It Fn m_free mbuf
+Frees
+.Vt mbuf .
+Returns
+.Va m_next
+of the freed
+.Vt mbuf .
+.El
+.Pp
+The functions below operate on
+.Vt mbuf chains .
+.Bl -ohang -offset indent
+.It Fn m_freem mbuf
+Free an entire
+.Vt mbuf chain ,
+including any external storage.
+.\"
+.It Fn m_adj mbuf len
+Trim
+.Fa len
+bytes from the head of an
+.Vt mbuf chain
+if
+.Fa len
+is positive, from the tail otherwise.
+.\"
+.It Fn m_append mbuf len cp
+Append
+.Vt len
+bytes of data
+.Vt cp
+to the
+.Vt mbuf chain .
+Extend the mbuf chain if the new data does not fit in
+existing space.
+.\"
+.It Fn m_prepend mbuf len how
+Allocate a new
+.Vt mbuf
+and prepend it to the
+.Vt mbuf chain ,
+handle
+.Dv M_PKTHDR
+properly.
+.Sy Note :
+It does not allocate any
+.Vt mbuf clusters ,
+so
+.Fa len
+must be less than
+.Dv MLEN
+or
+.Dv MHLEN ,
+depending on the
+.Dv M_PKTHDR
+flag setting.
+.\"
+.It Fn m_copyup mbuf len dstoff
+Similar to
+.Fn m_pullup
+but copies
+.Fa len
+bytes of data into a new mbuf at
+.Fa dstoff
+bytes into the mbuf.
+The
+.Fa dstoff
+argument aligns the data and leaves room for a link layer header.
+Returns the new
+.Vt mbuf chain
+on success,
+and frees the
+.Vt mbuf chain
+and returns
+.Dv NULL
+on failure.
+.Sy Note :
+The function does not allocate
+.Vt mbuf clusters ,
+so
+.Fa len + dstoff
+must be less than
+.Dv MHLEN .
+.\"
+.It Fn m_pullup mbuf len
+Arrange that the first
+.Fa len
+bytes of an
+.Vt mbuf chain
+are contiguous and lay in the data area of
+.Fa mbuf ,
+so they are accessible with
+.Fn mtod mbuf type .
+It is important to remember that this may involve
+reallocating some mbufs and moving data so all pointers
+referencing data within the old mbuf chain
+must be recalculated or made invalid.
+Return the new
+.Vt mbuf chain
+on success,
+.Dv NULL
+on failure
+(the
+.Vt mbuf chain
+is freed in this case).
+.Sy Note :
+It does not allocate any
+.Vt mbuf clusters ,
+so
+.Fa len
+must be less than
+.Dv MHLEN .
+.\"
+.It Fn m_pulldown mbuf offset len offsetp
+Arrange that
+.Fa len
+bytes between
+.Fa offset
+and
+.Fa offset + len
+in the
+.Vt mbuf chain
+are contiguous and lay in the data area of
+.Fa mbuf ,
+so they are accessible with
+.Fn mtod mbuf type .
+.Fa len must be smaller than, or equal to, the size of an
+.Vt mbuf cluster .
+Return a pointer to an intermediate
+.Vt mbuf
+in the chain containing the requested region;
+the offset in the data region of the
+.Vt mbuf chain
+to the data contained in the returned mbuf is stored in
+.Fa *offsetp .
+If
+.Fa offp
+is NULL, the region may be accessed using
+.Fn mtod mbuf type .
+If
+.Fa offp
+is non-NULL, the region may be accessed using
+.Fn mtod mbuf uint8_t + *offsetp .
+The region of the mbuf chain between its beginning and
+.Fa off
+is not modified, therefore it is safe to hold pointers to data within
+this region before calling
+.Fn m_pulldown .
+.\"
+.It Fn m_copym mbuf offset len how
+Make a copy of an
+.Vt mbuf chain
+starting
+.Fa offset
+bytes from the beginning, continuing for
+.Fa len
+bytes.
+If
+.Fa len
+is
+.Dv M_COPYALL ,
+copy to the end of the
+.Vt mbuf chain .
+.Sy Note :
+The copy is read-only, because the
+.Vt mbuf clusters
+are not copied, only their reference counts are incremented.
+.\"
+.It Fn m_copypacket mbuf how
+Copy an entire packet including header, which must be present.
+This is an optimized version of the common case
+.Fn m_copym mbuf 0 M_COPYALL how .
+.Sy Note :
+the copy is read-only, because the
+.Vt mbuf clusters
+are not copied, only their reference counts are incremented.
+.\"
+.It Fn m_dup mbuf how
+Copy a packet header
+.Vt mbuf chain
+into a completely new
+.Vt mbuf chain ,
+including copying any
+.Vt mbuf clusters .
+Use this instead of
+.Fn m_copypacket
+when you need a writable copy of an
+.Vt mbuf chain .
+.\"
+.It Fn m_copydata mbuf offset len buf
+Copy data from an
+.Vt mbuf chain
+starting
+.Fa off
+bytes from the beginning, continuing for
+.Fa len
+bytes, into the indicated buffer
+.Fa buf .
+.\"
+.It Fn m_copyback mbuf offset len buf
+Copy
+.Fa len
+bytes from the buffer
+.Fa buf
+back into the indicated
+.Vt mbuf chain ,
+starting at
+.Fa offset
+bytes from the beginning of the
+.Vt mbuf chain ,
+extending the
+.Vt mbuf chain
+if necessary.
+.Sy Note :
+It does not allocate any
+.Vt mbuf clusters ,
+just adds
+.Vt mbufs
+to the
+.Vt mbuf chain .
+It is safe to set
+.Fa offset
+beyond the current
+.Vt mbuf chain
+end: zeroed
+.Vt mbufs
+will be allocated to fill the space.
+.\"
+.It Fn m_length mbuf last
+Return the length of the
+.Vt mbuf chain ,
+and optionally a pointer to the last
+.Vt mbuf .
+.\"
+.It Fn m_dup_pkthdr to from how
+Upon the function's completion, the
+.Vt mbuf
+.Fa to
+will contain an identical copy of
+.Fa from->m_pkthdr
+and the per-packet attributes found in the
+.Vt mbuf chain
+.Fa from .
+The
+.Vt mbuf
+.Fa from
+must have the flag
+.Dv M_PKTHDR
+initially set, and
+.Fa to
+must be empty on entry.
+.\"
+.It Fn m_move_pkthdr to from
+Move
+.Va m_pkthdr
+and the per-packet attributes from the
+.Vt mbuf chain
+.Fa from
+to the
+.Vt mbuf
+.Fa to .
+The
+.Vt mbuf
+.Fa from
+must have the flag
+.Dv M_PKTHDR
+initially set, and
+.Fa to
+must be empty on entry.
+Upon the function's completion,
+.Fa from
+will have the flag
+.Dv M_PKTHDR
+and the per-packet attributes cleared.
+.\"
+.It Fn m_fixhdr mbuf
+Set the packet-header length to the length of the
+.Vt mbuf chain .
+.\"
+.It Fn m_devget buf len offset ifp copy
+Copy data from a device local memory pointed to by
+.Fa buf
+to an
+.Vt mbuf chain .
+The copy is done using a specified copy routine
+.Fa copy ,
+or
+.Fn bcopy
+if
+.Fa copy
+is
+.Dv NULL .
+.\"
+.It Fn m_cat m n
+Concatenate
+.Fa n
+to
+.Fa m .
+Both
+.Vt mbuf chains
+must be of the same type.
+.Fa N
+is still valid after the function returned.
+.Sy Note :
+It does not handle
+.Dv M_PKTHDR
+and friends.
+.\"
+.It Fn m_split mbuf len how
+Partition an
+.Vt mbuf chain
+in two pieces, returning the tail:
+all but the first
+.Fa len
+bytes.
+In case of failure, it returns
+.Dv NULL
+and attempts to restore the
+.Vt mbuf chain
+to its original state.
+.\"
+.It Fn m_apply mbuf off len f arg
+Apply a function to an
+.Vt mbuf chain ,
+at offset
+.Fa off ,
+for length
+.Fa len
+bytes.
+Typically used to avoid calls to
+.Fn m_pullup
+which would otherwise be unnecessary or undesirable.
+.Fa arg
+is a convenience argument which is passed to the callback function
+.Fa f .
+.Pp
+Each time
+.Fn f
+is called, it will be passed
+.Fa arg ,
+a pointer to the
+.Fa data
+in the current mbuf, and the length
+.Fa len
+of the data in this mbuf to which the function should be applied.
+.Pp
+The function should return zero to indicate success;
+otherwise, if an error is indicated, then
+.Fn m_apply
+will return the error and stop iterating through the
+.Vt mbuf chain .
+.\"
+.It Fn m_getptr mbuf loc off
+Return a pointer to the mbuf containing the data located at
+.Fa loc
+bytes from the beginning of the
+.Vt mbuf chain .
+The corresponding offset into the mbuf will be stored in
+.Fa *off .
+.It Fn m_defrag m0 how
+Defragment an mbuf chain, returning the shortest possible
+chain of mbufs and clusters.
+If allocation fails and this can not be completed,
+.Dv NULL
+will be returned and the original chain will be unchanged.
+Upon success, the original chain will be freed and the new
+chain will be returned.
+.Fa how
+should be either
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT ,
+depending on the caller's preference.
+.Pp
+This function is especially useful in network drivers, where
+certain long mbuf chains must be shortened before being added
+to TX descriptor lists.
+.It Fn m_unshare m0 how
+Create a version of the specified mbuf chain whose
+contents can be safely modified without affecting other users.
+If allocation fails and this operation can not be completed,
+.Dv NULL
+will be returned.
+The original mbuf chain is always reclaimed and the reference
+count of any shared mbuf clusters is decremented.
+.Fa how
+should be either
+.Dv M_WAITOK
+or
+.Dv M_NOWAIT ,
+depending on the caller's preference.
+As a side-effect of this process the returned
+mbuf chain may be compacted.
+.Pp
+This function is especially useful in the transmit path of
+network code, when data must be encrypted or otherwise
+altered prior to transmission.
+.El
+.Sh HARDWARE-ASSISTED CHECKSUM CALCULATION
+This section currently applies to TCP/IP only.
+In order to save the host CPU resources, computing checksums is
+offloaded to the network interface hardware if possible.
+The
+.Va m_pkthdr
+member of the leading
+.Vt mbuf
+of a packet contains two fields used for that purpose,
+.Vt int Va csum_flags
+and
+.Vt int Va csum_data .
+The meaning of those fields depends on the direction a packet flows in,
+and on whether the packet is fragmented.
+Henceforth,
+.Va csum_flags
+or
+.Va csum_data
+of a packet
+will denote the corresponding field of the
+.Va m_pkthdr
+member of the leading
+.Vt mbuf
+in the
+.Vt mbuf chain
+containing the packet.
+.Pp
+On output, checksum offloading is attempted after the outgoing
+interface has been determined for a packet.
+The interface-specific field
+.Va ifnet.if_data.ifi_hwassist
+(see
+.Xr ifnet 9 )
+is consulted for the capabilities of the interface to assist in
+computing checksums.
+The
+.Va csum_flags
+field of the packet header is set to indicate which actions the interface
+is supposed to perform on it.
+The actions unsupported by the network interface are done in the
+software prior to passing the packet down to the interface driver;
+such actions will never be requested through
+.Va csum_flags .
+.Pp
+The flags demanding a particular action from an interface are as follows:
+.Bl -tag -width ".Dv CSUM_TCP" -offset indent
+.It Dv CSUM_IP
+The IP header checksum is to be computed and stored in the
+corresponding field of the packet.
+The hardware is expected to know the format of an IP header
+to determine the offset of the IP checksum field.
+.It Dv CSUM_TCP
+The TCP checksum is to be computed.
+(See below.)
+.It Dv CSUM_UDP
+The UDP checksum is to be computed.
+(See below.)
+.El
+.Pp
+Should a TCP or UDP checksum be offloaded to the hardware,
+the field
+.Va csum_data
+will contain the byte offset of the checksum field relative to the
+end of the IP header.
+In this case, the checksum field will be initially
+set by the TCP/IP module to the checksum of the pseudo header
+defined by the TCP and UDP specifications.
+.Pp
+For outbound packets which have been fragmented
+by the host CPU, the following will also be true,
+regardless of the checksum flag settings:
+.Bl -bullet -offset indent
+.It
+all fragments will have the flag
+.Dv M_FRAG
+set in their
+.Va m_flags
+field;
+.It
+the first and the last fragments in the chain will have
+.Dv M_FIRSTFRAG
+or
+.Dv M_LASTFRAG
+set in their
+.Va m_flags ,
+correspondingly;
+.It
+the first fragment in the chain will have the total number
+of fragments contained in its
+.Va csum_data
+field.
+.El
+.Pp
+The last rule for fragmented packets takes precedence over the one
+for a TCP or UDP checksum.
+Nevertheless, offloading a TCP or UDP checksum is possible for a
+fragmented packet if the flag
+.Dv CSUM_IP_FRAGS
+is set in the field
+.Va ifnet.if_data.ifi_hwassist
+associated with the network interface.
+However, in this case the interface is expected to figure out
+the location of the checksum field within the sequence of fragments
+by itself because
+.Va csum_data
+contains a fragment count instead of a checksum offset value.
+.Pp
+On input, an interface indicates the actions it has performed
+on a packet by setting one or more of the following flags in
+.Va csum_flags
+associated with the packet:
+.Bl -tag -width ".Dv CSUM_IP_CHECKED" -offset indent
+.It Dv CSUM_IP_CHECKED
+The IP header checksum has been computed.
+.It Dv CSUM_IP_VALID
+The IP header has a valid checksum.
+This flag can appear only in combination with
+.Dv CSUM_IP_CHECKED .
+.It Dv CSUM_DATA_VALID
+The checksum of the data portion of the IP packet has been computed
+and stored in the field
+.Va csum_data
+in network byte order.
+.It Dv CSUM_PSEUDO_HDR
+Can be set only along with
+.Dv CSUM_DATA_VALID
+to indicate that the IP data checksum found in
+.Va csum_data
+allows for the pseudo header defined by the TCP and UDP specifications.
+Otherwise the checksum of the pseudo header must be calculated by
+the host CPU and added to
+.Va csum_data
+to obtain the final checksum to be used for TCP or UDP validation purposes.
+.El
+.Pp
+If a particular network interface just indicates success or
+failure of TCP or UDP checksum validation without returning
+the exact value of the checksum to the host CPU, its driver can mark
+.Dv CSUM_DATA_VALID
+and
+.Dv CSUM_PSEUDO_HDR
+in
+.Va csum_flags ,
+and set
+.Va csum_data
+to
+.Li 0xFFFF
+hexadecimal to indicate a valid checksum.
+It is a peculiarity of the algorithm used that the Internet checksum
+calculated over any valid packet will be
+.Li 0xFFFF
+as long as the original checksum field is included.
+.Pp
+For inbound packets which are IP fragments, all
+.Va csum_data
+fields will be summed during reassembly to obtain the final checksum
+value passed to an upper layer in the
+.Va csum_data
+field of the reassembled packet.
+The
+.Va csum_flags
+fields of all fragments will be consolidated using logical AND
+to obtain the final value for
+.Va csum_flags .
+Thus, in order to successfully
+offload checksum computation for fragmented data,
+all fragments should have the same value of
+.Va csum_flags .
+.Sh STRESS TESTING
+When running a kernel compiled with the option
+.Dv MBUF_STRESS_TEST ,
+the following
+.Xr sysctl 8 Ns
+-controlled options may be used to create
+various failure/extreme cases for testing of network drivers
+and other parts of the kernel that rely on
+.Vt mbufs .
+.Bl -tag -width ident
+.It Va net.inet.ip.mbuf_frag_size
+Causes
+.Fn ip_output
+to fragment outgoing
+.Vt mbuf chains
+into fragments of the specified size.
+Setting this variable to 1 is an excellent way to
+test the long
+.Vt mbuf chain
+handling ability of network drivers.
+.It Va kern.ipc.m_defragrandomfailures
+Causes the function
+.Fn m_defrag
+to randomly fail, returning
+.Dv NULL .
+Any piece of code which uses
+.Fn m_defrag
+should be tested with this feature.
+.El
+.Sh RETURN VALUES
+See above.
+.Sh SEE ALSO
+.Xr ifnet 9 ,
+.Xr mbuf_tags 9
+.Sh HISTORY
+.\" Please correct me if I'm wrong
+.Vt Mbufs
+appeared in an early version of
+.Bx .
+Besides being used for network packets, they were used
+to store various dynamic structures, such as routing table
+entries, interface addresses, protocol control blocks, etc.
+In more recent
+.Fx
+use of
+.Vt mbufs
+is almost entirely limited to packet storage, with
+.Xr uma 9
+zones being used directly to store other network-related memory.
+.Pp
+Historically, the
+.Vt mbuf
+allocator has been a special-purpose memory allocator able to run in
+interrupt contexts and allocating from a special kernel address space map.
+As of
+.Fx 5.3 ,
+the
+.Vt mbuf
+allocator is a wrapper around
+.Xr uma 9 ,
+allowing caching of
+.Vt mbufs ,
+clusters, and
+.Vt mbuf
++ cluster pairs in per-CPU caches, as well as bringing other benefits of
+slab allocation.
+.Sh AUTHORS
+The original
+.Nm
+manual page was written by Yar Tikhiy.
+The
+.Xr uma 9
+.Vt mbuf
+allocator was written by Bosko Milekic.
diff --git a/share/man/man9/mbuf_tags.9 b/share/man/man9/mbuf_tags.9
new file mode 100644
index 000000000000..d9627e8bc6a7
--- /dev/null
+++ b/share/man/man9/mbuf_tags.9
@@ -0,0 +1,286 @@
+.\" $OpenBSD: mbuf_tags.9,v 1.18 2003/12/08 07:07:35 mcbride Exp $
+.\"
+.\" The authors of this manual page are Angelos D. Keromytis
+.\" (angelos@cis.upenn.edu), Gleb Smirnoff <glebius@cell.sick.ru>, and
+.\" Robert Watson <rwatson@FreeBSD.org>
+.\"
+.\" Copyright (c) 2004 Robert N. M. Watson
+.\" Copyright (c) 2001 Angelos D. Keromytis
+.\"
+.\" Permission to use, copy, and modify this software with or without
+.\" fee is hereby granted, provided that this entire notice is included
+.\" in all source code copies of any software which is or includes a copy
+.\" or modification of this software.
+.\"
+.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+.\" IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+.\" PURPOSE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 12, 2008
+.Dt MBUF_TAGS 9
+.Os
+.Sh NAME
+.Nm mbuf_tags
+.Nd a framework for generic packet attributes
+.Sh SYNOPSIS
+.In sys/mbuf.h
+.Ft "struct m_tag *"
+.Fn m_tag_alloc "uint32_t cookie" "int type" "int len" "int wait"
+.Ft "struct m_tag *"
+.Fn m_tag_copy "struct m_tag *t" "int how"
+.Ft int
+.Fn m_tag_copy_chain "struct mbuf *to" "struct mbuf *from" "int how"
+.Ft void
+.Fn m_tag_delete "struct mbuf *m" "struct m_tag *t"
+.Ft void
+.Fn m_tag_delete_chain "struct mbuf *m" "struct m_tag *t"
+.Ft void
+.Fn m_tag_delete_nonpersistent "struct mbuf *m"
+.Ft "struct m_tag *"
+.Fn m_tag_find "struct mbuf *m" "int type" "struct m_tag *start"
+.Ft "struct m_tag *"
+.Fn m_tag_first "struct mbuf *m"
+.Ft void
+.Fn m_tag_free "struct m_tag *t"
+.Ft "struct m_tag *"
+.Fn m_tag_get "int type" "int len" "int wait"
+.Ft void
+.Fn m_tag_init "struct mbuf *m"
+.Ft struct m_tag *
+.Fn m_tag_locate "struct mbuf *m" "uint32_t cookie" "int type" "struct m_tag *t"
+.Ft "struct m_tag *"
+.Fn m_tag_next "struct mbuf *m" "struct m_tag *t"
+.Ft void
+.Fn m_tag_prepend "struct mbuf *m" "struct m_tag *t"
+.Ft void
+.Fn m_tag_unlink "struct mbuf *m" "struct m_tag *t"
+.Sh DESCRIPTION
+Mbuf tags allow additional meta-data to be associated with in-flight packets
+by providing a mechanism for the tagging of additional kernel memory onto
+packet header mbufs.
+Tags are maintained in chains off of the
+.Xr mbuf 9
+header, and maintained using a series of API calls to allocate, search, and
+delete tags.
+Tags are identified using an ID and cookie that uniquely identify a class
+of data tagged onto the packet, and may contain an arbitrary amount of
+additional storage.
+Typical uses of mbuf tags include Mandatory Access Control (MAC) labels as
+described in
+.Xr mac 9 ,
+IPsec policy information as described in
+.Xr ipsec 4 ,
+and packet filter tags used by
+.Xr pf 4 .
+.Pp
+Tags will be maintained across a variety of operations, including the copying
+of packet headers using facilities such as
+.Fn M_COPY_PKTHDR
+and
+.Fn M_MOVE_PKTHDR .
+Any tags associated with an mbuf header will be automatically freed when the
+mbuf is freed, although some subsystems will wish to delete the tags prior
+to that time.
+.Pp
+Packet tags are used by different kernel APIs
+to keep track of operations done or
+scheduled to happen to packets.
+Each packet tag can be distinguished by its type and cookie.
+The cookie is used to identify a specific module or API.
+The packet tags are attached to mbuf packet headers.
+.Pp
+The first
+.Fn sizeof "struct m_tag"
+bytes of a tag contain a
+.Vt "struct m_tag" :
+.Bd -literal
+struct m_tag {
+ SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */
+ uint16_t m_tag_id; /* Tag ID */
+ uint16_t m_tag_len; /* Length of data */
+ uint32_t m_tag_cookie; /* ABI/Module ID */
+ void (*m_tag_free)(struct m_tag *);
+};
+.Ed
+.Pp
+The
+.Va m_tag_link
+field is used to link tags together (see
+.Xr queue 3
+for more details).
+The
+.Va m_tag_id , m_tag_len
+and
+.Va m_tag_cookie
+fields are set to type, length,
+and
+cookie, respectively.
+.Va m_tag_free
+points to
+.Fn m_tag_free_default .
+Following this structure are
+.Va m_tag_len
+bytes of space that can be used to store tag-specific information.
+Addressing this data region may be tricky.
+A safe way is embedding
+.Vt "struct m_tag"
+into a private data structure, as follows:
+.Bd -literal -offset indent
+struct foo {
+ struct m_tag tag;
+ ...
+};
+struct foo *p = (struct foo *)m_tag_alloc(...);
+struct m_tag *mtag = &p->tag;
+.Ed
+.Pp
+Note that
+.Ox
+does not support cookies, it needs
+.Va m_tag_id
+to be globally unique.
+To keep compatibility with
+.Ox ,
+a cookie
+.Dv MTAG_ABI_COMPAT
+is provided along with some compatibility functions.
+When writing an
+.Ox
+compatible code, one should be careful not to take already
+used tag type.
+Tag types are defined in
+.In sys/mbuf.h .
+.Ss Packet Tag Manipulation Functions
+.Bl -ohang -offset indent
+.It Fn m_tag_alloc cookie type len wait
+Allocate a new tag of type
+.Fa type
+and cookie
+.Fa cookie
+with
+.Va len
+bytes of space following the tag header itself.
+The
+.Fa wait
+argument is passed directly to
+.Xr malloc 9 .
+If successful,
+.Fn m_tag_alloc
+returns a memory buffer of
+.Pq Va len No + Fn sizeof "struct m_tag"
+bytes.
+Otherwise,
+.Dv NULL
+is returned.
+A compatibility function
+.Fn m_tag_get
+is also provided.
+.It Fn m_tag_copy tag how
+Allocate a copy of
+.Fa tag .
+The
+.Fa how
+argument is passed directly to
+.Fn m_tag_alloc .
+The return values are the same as in
+.Fn m_tag_alloc .
+.It Fn m_tag_copy_chain tombuf frommbuf how
+Allocate and copy all tags from mbuf
+.Fa frommbuf
+to mbuf
+.Fa tombuf .
+Returns 1 on success, and 0 on failure.
+In the latter case, mbuf
+.Fa tombuf
+loses all its tags, even previously present.
+.It Fn m_tag_delete mbuf tag
+Remove
+.Fa tag
+from
+.Fa mbuf Ns 's
+list and free it.
+.It Fn m_tag_delete_chain mbuf tag
+Remove and free a packet tag chain, starting from
+.Fa tag .
+If
+.Fa tag
+is
+.Dv NULL ,
+all tags are deleted.
+.It Fn m_tag_delete_nonpersistent mbuf
+Traverse
+.Fa mbuf Ns 's
+tags and delete those which do not have the
+.Dv MTAG_PERSISTENT
+flag set.
+.It Fn m_tag_first mbuf
+Return the first tag associated with
+.Fa mbuf .
+.It Fn m_tag_free tag
+Free
+.Fa tag
+using its
+.Va m_tag_free
+method.
+The
+.Fn m_tag_free_default
+function
+is used by default.
+.It Fn m_tag_init mbuf
+Initialize the tag storage for packet
+.Fa mbuf .
+.It Fn m_tag_locate mbuf cookie type tag
+Search for a tag defined by
+.Fa type
+and
+.Fa cookie
+in
+.Fa mbuf ,
+starting from position specified by
+.Fa tag .
+If the latter is
+.Dv NULL ,
+then search through the whole list.
+Upon success, a pointer to the first found tag is returned.
+In either case,
+.Dv NULL
+is returned.
+A compatibility function
+.Fn m_tag_find
+is also provided.
+.It Fn m_tag_next mbuf tag
+Return tag next to
+.Fa tag
+in
+.Fa mbuf .
+If absent,
+.Dv NULL
+is returned.
+.It Fn m_tag_prepend mbuf tag
+Add the new tag
+.Fa tag
+at the head of the tag list for packet
+.Fa mbuf .
+.It Fn m_tag_unlink mbuf tag
+Remove tag
+.Fa tag
+from the list of tags of packet
+.Fa mbuf .
+.El
+.Sh CODE REFERENCES
+The tag-manipulating code is contained in the file
+.Pa sys/kern/uipc_mbuf2.c .
+Inlined functions are defined in
+.In sys/mbuf.h .
+.Sh SEE ALSO
+.Xr queue 3 ,
+.Xr mbuf 9
+.Sh HISTORY
+The packet tags first appeared in
+.Ox 2.9
+and were written by
+.An Angelos D. Keromytis Aq angelos@openbsd.org .
diff --git a/share/man/man9/mdchain.9 b/share/man/man9/mdchain.9
new file mode 100644
index 000000000000..5b0bf4ace4ff
--- /dev/null
+++ b/share/man/man9/mdchain.9
@@ -0,0 +1,211 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 Boris Popov
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 28, 2001
+.Dt MDCHAIN 9
+.Os
+.Sh NAME
+.Nm mdchain ,
+.Nm md_initm ,
+.Nm md_done ,
+.Nm md_append_record ,
+.Nm md_next_record ,
+.Nm md_get_uint8 ,
+.Nm md_get_uint16 ,
+.Nm md_get_uint16be ,
+.Nm md_get_uint16le ,
+.Nm md_get_uint32 ,
+.Nm md_get_uint32be ,
+.Nm md_get_uint32le ,
+.Nm md_get_int64 ,
+.Nm md_get_int64be ,
+.Nm md_get_int64le ,
+.Nm md_get_mem ,
+.Nm md_get_mbuf ,
+.Nm md_get_uio
+.Nd "set of functions to dissect an mbuf chain to various data types"
+.Sh SYNOPSIS
+.Cd options LIBMCHAIN
+.Li kldload libmchain
+.Pp
+.In sys/param.h
+.In sys/uio.h
+.In sys/mchain.h
+.Ft void
+.Fn md_initm "struct mdchain *mdp" "struct mbuf *m"
+.Ft void
+.Fn md_done "struct mdchain *mdp"
+.Ft void
+.Fn md_append_record "struct mdchain *mdp" "struct mbuf *top"
+.Ft int
+.Fn md_next_record "struct mdchain *mdp"
+.Ft int
+.Fn md_get_uint8 "struct mdchain *mdp" "uint8_t *x"
+.Ft int
+.Fn md_get_uint16 "struct mdchain *mdp" "uint16_t *x"
+.Ft int
+.Fn md_get_uint16be "struct mdchain *mdp" "uint16_t *x"
+.Ft int
+.Fn md_get_uint16le "struct mdchain *mdp" "uint16_t *x"
+.Ft int
+.Fn md_get_uint32 "struct mdchain *mdp" "uint32_t *x"
+.Ft int
+.Fn md_get_uint32be "struct mdchain *mdp" "uint32_t *x"
+.Ft int
+.Fn md_get_uint32le "struct mdchain *mdp" "uint32_t *x"
+.Ft int
+.Fn md_get_int64 "struct mdchain *mdp" "int64_t *x"
+.Ft int
+.Fn md_get_int64be "struct mdchain *mdp" "int64_t *x"
+.Ft int
+.Fn md_get_int64le "struct mdchain *mdp" "int64_t *x"
+.Ft int
+.Fn md_get_mem "struct mdchain *mdp" "caddr_t target" "int size" "int type"
+.Ft int
+.Fn md_get_mbuf "struct mdchain *mdp" "int size" "struct mbuf **m"
+.Ft int
+.Fn md_get_uio "struct mdchain *mdp" "struct uio *uiop" "int size"
+.Sh DESCRIPTION
+These functions are used to decompose mbuf chains to various data types.
+The
+.Vt mdchain
+structure is used as a working context
+and should be initialized through a call of the
+.Fn mb_initm
+function.
+It has the following fields:
+.Bl -tag -width "md_top"
+.It Va "md_top"
+.Pq Vt "struct mbuf *"
+A pointer to the top of the parsed mbuf chain.
+.It Va md_cur
+.Pq Vt "struct mbuf *"
+A pointer to the currently parsed mbuf.
+.It Va md_pas
+.Pq Vt int
+Offset in the current mbuf.
+.El
+.Pp
+The
+.Fn md_done
+function disposes of an mbuf chain pointed to by the
+.Fa mdp->md_top
+field and sets the field to
+.Dv NULL .
+.Pp
+The
+.Fn md_append_record
+appends a new mbuf chain using
+.Va m_nextpkt
+field to form a single linked list of mbuf chains.
+If the
+.Fa mdp->md_top
+field is
+.Dv NULL ,
+then this function behaves exactly as the
+.Fn md_initm
+function.
+.Pp
+The
+.Fn md_next_record
+function extracts the next mbuf chain and disposes the current one, if any.
+For a new mbuf chain it calls the
+.Fn md_initm
+function.
+If there is no data left the function returns
+.Er ENOENT .
+.Pp
+All
+.Fn md_get_*
+functions perform an actual copy of the data from an mbuf chain.
+Functions which have
+.Cm le
+or
+.Cm be
+suffixes will perform conversion to the little\- or big\-endian data formats.
+.Pp
+.Fn md_get_mem
+function copies
+.Fa size
+bytes of data specified by the
+.Fa source
+argument from an mbuf chain.
+The
+.Fa type
+argument specifies the method used to perform a copy,
+and can be one of the following:
+.Bl -tag -width ".Dv MB_MINLINE"
+.It Dv MB_MSYSTEM
+Use the
+.Fn bcopy
+function.
+.It Dv MB_MUSER
+Use the
+.Xr copyin 9
+function.
+.It Dv MB_MINLINE
+Use an
+.Dq inline
+loop which does not call any function.
+.El
+.Pp
+If
+.Fa target
+is
+.Dv NULL ,
+an actual copy is not performed
+and the function just skips the given number of bytes.
+.Sh RETURN VALUES
+All
+.Ft int
+functions return zero if successful,
+otherwise an error code is returned.
+.Pp
+.Em Note :
+after failure of any function,
+an mbuf chain is left in the broken state and only the
+.Fn md_done
+function can safely be called to destroy it.
+.Sh EXAMPLES
+.Bd -literal
+struct mdchain *mdp;
+struct mbuf *m;
+uint16_t length;
+uint8_t byte;
+
+receive(so, &m);
+md_initm(mdp, m);
+if (md_get_uint8(mdp, &byte) != 0 ||
+ md_get_uint16le(mdp, &length) != 0)
+ error = EBADRPC;
+mb_done(mdp);
+.Ed
+.Sh SEE ALSO
+.Xr mbchain 9 ,
+.Xr mbuf 9
+.Sh AUTHORS
+This manual page was written by
+.An Boris Popov Aq bp@FreeBSD.org .
diff --git a/share/man/man9/memcchr.9 b/share/man/man9/memcchr.9
new file mode 100644
index 000000000000..0be3b79aa9a8
--- /dev/null
+++ b/share/man/man9/memcchr.9
@@ -0,0 +1,59 @@
+.\" Copyright (c) 2012 Ed Schouten <ed@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 1, 2012
+.Dt MEMCCHR 9
+.Os
+.Sh NAME
+.Nm memcchr
+.Nd locate the complement of a byte in byte string
+.Sh SYNOPSIS
+.In sys/libkern.h
+.Ft void *
+.Fn memcchr "const void *b" "int c" "size_t len"
+.Sh DESCRIPTION
+The
+.Fn memcchr
+function locates the first occurrence of a byte unequal to
+.Fa c
+(converted to an
+.Vt "unsigned char" )
+in string
+.Fa b .
+.Sh RETURN VALUES
+The
+.Fn memcchr
+function returns a pointer to the byte located, or NULL if no such byte
+exists within
+.Fa len
+bytes.
+.Sh SEE ALSO
+.Xr memchr 3
+.Sh HISTORY
+The
+.Fn memcchr
+function first appeared in
+.Fx 10.0 .
diff --git a/share/man/man9/memguard.9 b/share/man/man9/memguard.9
new file mode 100644
index 000000000000..072d30b0fd6d
--- /dev/null
+++ b/share/man/man9/memguard.9
@@ -0,0 +1,220 @@
+.\" Copyright (c) 2005 Christian Brueffer
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 21, 2011
+.Dt MEMGUARD 9
+.Os
+.Sh NAME
+.Nm MemGuard
+.Nd "memory allocator for debugging purposes"
+.Sh SYNOPSIS
+.Cd "options DEBUG_MEMGUARD"
+.Sh DESCRIPTION
+.Nm
+is a simple and small replacement memory allocator designed
+to help detect tamper-after-free scenarios.
+These problems are more and more common and likely with
+multithreaded kernels where race conditions are more prevalent.
+.Pp
+.Nm
+can take over
+.Fn malloc ,
+.Fn realloc
+and
+.Fn free
+for a single malloc type.
+Alternatively
+.Nm
+can take over
+.Fn uma_zalloc ,
+.Fn uma_zalloc_arg
+and
+.Fn uma_free
+for a single
+.Xr uma
+zone.
+Also
+.Nm
+can guard all allocations larger than
+.Dv PAGE_SIZE ,
+and can guard a random fraction of all allocations.
+There is also a knob to prevent allocations smaller than a specified
+size from being guarded, to limit memory waste.
+.Sh EXAMPLES
+To use
+.Nm
+for a memory type, either add an entry to
+.Pa /boot/loader.conf :
+.Bd -literal -offset indent
+vm.memguard.desc=<memory_type>
+.Ed
+.Pp
+Or set the
+.Va vm.memguard.desc
+.Xr sysctl 8
+variable at run-time:
+.Bd -literal -offset indent
+sysctl vm.memguard.desc=<memory_type>
+.Ed
+.Pp
+Where
+.Ar memory_type
+can be either a short description of the memory type to monitor,
+either name of
+.Xr uma 9
+zone.
+Only allocations from that
+.Ar memory_type
+made after
+.Va vm.memguard.desc
+is set will potentially be guarded.
+If
+.Va vm.memguard.desc
+is modified at run-time then only allocations of the new
+.Ar memory_type
+will potentially be guarded once the
+.Xr sysctl 8
+is set.
+Existing guarded allocations will still be properly released by
+either
+.Xr free 9
+or
+.Xr uma_zfree 9 ,
+depending on what kind of allocation was taken over.
+.Pp
+To determine short description of a
+.Xr malloc 9
+type one can either take it from the first column of
+.Xr vmstat 8 Fl m
+output, or to find it in the kernel source.
+It is the second argument to
+.Xr MALLOC_DEFINE 9
+macro.
+To determine name of
+.Xr uma 9
+zone one can either take it from the first column of
+.Xr vmstat 8 Fl z
+output, or to find it in the kernel source.
+It is the first argument to the
+.Xr uma_zcreate 9
+function.
+.Pp
+The
+.Va vm.memguard.divisor
+boot-time tunable is used to scale how much of the system's physical
+memory
+.Nm
+is allowed to consume.
+The default is 10, so up to
+.Va cnt.v_page_count Ns /10
+pages can be used.
+.Nm
+will reserve
+.Va vm_kmem_max
+/
+.Va vm.memguard.divisor
+bytes of virtual address space, limited by twice the physical memory
+size.
+The physical limit is reported as
+.Va vm.memguard.phys_limit
+and the virtual space reserved for
+.Nm
+is reported as
+.Va vm.memguard.mapsize .
+.Pp
+.Nm
+will not do page promotions for any allocation smaller than
+.Va vm.memguard.minsize
+bytes.
+The default is 0, meaning all allocations can potentially be guarded.
+.Nm
+can guard sufficiently large allocations randomly, with average
+frequency of every one in 100000 /
+.Va vm.memguard.frequency
+allocations.
+The default is 0, meaning no allocations are randomly guarded.
+.Pp
+.Nm
+can optionally add unmapped guard pages around each allocation to
+detect overflow and underflow, if
+.Va vm.memguard.options
+has the 1 bit set.
+This option is enabled by default.
+.Nm
+will optionally guard all allocations of
+.Dv PAGE_SIZE
+or larger if
+.Va vm.memguard.options
+has the 2 bit set.
+This option is off by default.
+By default
+.Nm
+doesn't guard those
+.Xr uma 9
+zones that have been initialized with the
+.Dv UMA_ZONE_NOFREE
+flag set, since it can produce false positives on them.
+However, this safety measure can be turned off by setting bit 3
+of the
+.Va vm.memguard.options
+tunable.
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr vmstat 8 ,
+.Xr contigmalloc 9 ,
+.Xr malloc 9 ,
+.Xr redzone 9 ,
+.Xr uma 9
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+.Nm
+was originally written by
+.An Bosko Milekic Aq bmilekic@FreeBSD.org .
+This manual page was originally written by
+.An Christian Brueffer Aq brueffer@FreeBSD.org .
+Additions have been made by
+.An Matthew Fleming Aq mdf@FreeBSD.org
+and
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
+to both the implementation and the documentation.
+.Sh BUGS
+It is not possible to guard allocations that really expect themselves to be
+allocated from
+.Xr uma 9 ,
+utilizing additional interfaces apart from
+.Fn uma_zalloc
+and
+.Fn uma_free ,
+for example
+.Fn uma_find_refcnt .
+For the moment of writing only
+.Xr mbuf 9
+cluster zones belong to that kind of allocations.
+Attempt to guard them would lead to kernel panic.
diff --git a/share/man/man9/mi_switch.9 b/share/man/man9/mi_switch.9
new file mode 100644
index 000000000000..46e7a8e9e4cd
--- /dev/null
+++ b/share/man/man9/mi_switch.9
@@ -0,0 +1,158 @@
+.\" $NetBSD: ctxsw.9,v 1.2 1996/12/02 00:11:31 tls Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 24, 1996
+.Dt MI_SWITCH 9
+.Os
+.Sh NAME
+.Nm mi_switch ,
+.Nm cpu_switch ,
+.Nm cpu_throw
+.Nd switch to another thread context
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft void
+.Fn mi_switch "void"
+.Ft void
+.Fn cpu_switch "void"
+.Ft void
+.Fn cpu_throw "void"
+.Sh DESCRIPTION
+The
+.Fn mi_switch
+function implements the machine independent prelude to a thread context
+switch.
+It is called from only a few distinguished places in the kernel
+code as a result of the principle of non-preemptable kernel mode execution.
+The various major uses of
+.Nm
+can be enumerated as follows:
+.Bl -enum -offset indent
+.It
+From within a function such as
+.Xr cv_wait 9 ,
+.Xr mtx_lock ,
+or
+.Xr tsleep 9
+when the current thread
+voluntarily relinquishes the CPU to wait for some resource or lock to become
+available.
+.It
+After handling a trap
+(e.g.\& a system call, device interrupt)
+when the kernel prepares a return to user-mode execution.
+This case is
+typically handled by machine dependent trap-handling code after detection
+of a change in the signal disposition of the current process, or when a
+higher priority thread might be available to run.
+The latter event is
+communicated by the machine independent scheduling routines by calling
+the machine defined
+.Fn need_resched .
+.It
+In the signal handling code
+(see
+.Xr issignal 9 )
+if a signal is delivered that causes a process to stop.
+.It
+When a thread dies in
+.Xr thread_exit 9
+and control of the processor can be passed to the next runnable thread.
+.It
+In
+.Xr thread_suspend_check 9
+where a thread needs to stop execution due to the suspension state of
+the process as a whole.
+.El
+.Pp
+.Fn mi_switch
+records the amount of time the current thread has been running in the
+process structures and checks this value against the CPU time limits
+allocated to the process
+(see
+.Xr getrlimit 2 ) .
+Exceeding the soft limit results in a
+.Dv SIGXCPU
+signal to be posted to the process, while exceeding the hard limit will
+cause a
+.Dv SIGKILL .
+.Pp
+If the thread is still in the
+.Dv TDS_RUNNING
+state,
+.Fn mi_switch
+will put it back onto the run queue, assuming that
+it will want to run again soon.
+If it is in one of the other
+states and KSE threading is enabled, the associated
+.Em KSE
+will be made available to any higher priority threads from the same
+group, to allow them to be scheduled next.
+.Pp
+After these administrative tasks are done,
+.Fn mi_switch
+hands over control to the machine dependent routine
+.Fn cpu_switch ,
+which will perform the actual thread context switch.
+.Pp
+.Fn cpu_switch
+first saves the context of the current thread.
+Next, it calls
+.Fn choosethread
+to determine which thread to run next.
+Finally, it reads in the saved context of the new thread and starts to
+execute the new thread.
+.Pp
+.Fn cpu_throw
+is similar to
+.Fn cpu_switch
+except that it does not save the context of the old thread.
+This function is useful when the kernel does not have an old thread
+context to save, such as when CPUs other than the boot CPU perform their
+first task switch, or when the kernel does not care about the state of the
+old thread, such as in
+.Fn thread_exit
+when the kernel terminates the current thread and switches into a new
+thread.
+.Pp
+To protect the
+.Xr runqueue 9 ,
+all of these functions must be called with the
+.Va sched_lock
+mutex held.
+.Sh SEE ALSO
+.Xr cv_wait 9 ,
+.Xr issignal 9 ,
+.Xr mutex 9 ,
+.Xr runqueue 9 ,
+.Xr tsleep 9 ,
+.Xr wakeup 9
diff --git a/share/man/man9/microseq.9 b/share/man/man9/microseq.9
new file mode 100644
index 000000000000..041e2be28fe9
--- /dev/null
+++ b/share/man/man9/microseq.9
@@ -0,0 +1,493 @@
+.\" Copyright (c) 1998, 1999, Nicolas Souchu
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 6, 1998
+.Dt MICROSEQ 9
+.Os
+.Sh NAME
+.Nm microseq
+.Nd ppbus microsequencer developer's guide
+.Sh SYNOPSIS
+.In sys/types.h
+.In dev/ppbus/ppbconf.h
+.In dev/ppbus/ppb_msq.h
+.Sh DESCRIPTION
+See
+.Xr ppbus 4
+for ppbus description and general info about the microsequencer.
+.Pp
+The purpose of this document is to encourage developers to use the
+microsequencer mechanism in order to have:
+.Bl -enum -offset indent
+.It
+a uniform programming model
+.It
+efficient code
+.El
+.Pp
+Before using microsequences, you are encouraged to look at
+.Xr ppc 4
+microsequencer implementation and an example of how using it in
+.Xr vpo 4 .
+.Sh PPBUS register model
+.Ss Background
+The parallel port model chosen for ppbus is the PC parallel port model.
+Thus, any register described later has the same semantic than its counterpart
+in a PC parallel port.
+For more info about ISA/ECP programming, get the
+Microsoft standard referenced as "Extended Capabilities Port Protocol and
+ISA interface Standard".
+Registers described later are standard parallel port
+registers.
+.Pp
+Mask macros are defined in the standard ppbus include files for each valid
+bit of parallel port registers.
+.Ss Data register
+In compatible or nibble mode, writing to this register will drive data to the
+parallel port data lines.
+In any other mode, drivers may be tri-stated by
+setting the direction bit (PCD) in the control register.
+Reads to this register
+return the value on the data lines.
+.Ss Device status register
+This read-only register reflects the inputs on the parallel port interface.
+.Pp
+.Bl -column "Bit" "Name" "Description" -compact
+.It Em Bit Ta Em Name Ta Em Description
+.It 7 Ta nBUSY Ta "inverted version of parallel port Busy signal"
+.It 6 Ta nACK Ta "version of parallel port nAck signal"
+.It 5 Ta PERROR Ta "version of parallel port PERROR signal"
+.It 4 Ta SELECT Ta "version of parallel port Select signal"
+.It 3 Ta nFAULT Ta "version of parallel port nFault signal"
+.El
+.Pp
+Others are reserved and return undefined result when read.
+.Ss Device control register
+This register directly controls several output signals as well as enabling
+some functions.
+.Pp
+.Bl -column "Bit" "Name " "Description" -compact
+.It Em Bit Ta Em Name Ta Em Description
+.It 5 Ta PCD Ta "direction bit in extended modes"
+.It 4 Ta IRQENABLE Ta "1 enables an interrupt on the rising edge of nAck"
+.It 3 Ta SELECTIN Ta "inverted and driven as parallel port nSelectin signal"
+.It 2 Ta nINIT Ta "driven as parallel port nInit signal"
+.It 1 Ta AUTOFEED Ta "inverted and driven as parallel port nAutoFd signal"
+.It 0 Ta STROBE Ta "inverted and driven as parallel port nStrobe signal"
+.El
+.Sh MICROINSTRUCTIONS
+.Ss Description
+.Em Microinstructions
+are either parallel port accesses, program iterations, submicrosequence or
+C calls.
+The parallel port must be considered as the logical model described in
+.Xr ppbus 4 .
+.Pp
+Available microinstructions are:
+.Bd -literal
+#define MS_OP_GET 0 /* get <ptr>, <len> */
+#define MS_OP_PUT 1 /* put <ptr>, <len> */
+#define MS_OP_RFETCH 2 /* rfetch <reg>, <mask>, <ptr> */
+#define MS_OP_RSET 3 /* rset <reg>, <mask>, <mask> */
+#define MS_OP_RASSERT 4 /* rassert <reg>, <mask> */
+#define MS_OP_DELAY 5 /* delay <val> */
+#define MS_OP_SET 6 /* set <val> */
+#define MS_OP_DBRA 7 /* dbra <offset> */
+#define MS_OP_BRSET 8 /* brset <mask>, <offset> */
+#define MS_OP_BRCLEAR 9 /* brclear <mask>, <offset> */
+#define MS_OP_RET 10 /* ret <retcode> */
+#define MS_OP_C_CALL 11 /* c_call <function>, <parameter> */
+#define MS_OP_PTR 12 /* ptr <pointer> */
+#define MS_OP_ADELAY 13 /* adelay <val> */
+#define MS_OP_BRSTAT 14 /* brstat <mask>, <mask>, <offset> */
+#define MS_OP_SUBRET 15 /* subret <code> */
+#define MS_OP_CALL 16 /* call <microsequence> */
+#define MS_OP_RASSERT_P 17 /* rassert_p <iter>, <reg> */
+#define MS_OP_RFETCH_P 18 /* rfetch_p <iter>, <reg>, <mask> */
+#define MS_OP_TRIG 19 /* trigger <reg>, <len>, <array> */
+.Ed
+.Ss Execution context
+The
+.Em execution context
+of microinstructions is:
+.Bl -bullet -offset indent
+.It
+the
+.Em program counter
+which points to the next microinstruction to execute either in the main
+microsequence or in a subcall
+.It
+the current value of
+.Em ptr
+which points to the next char to send/receive
+.It
+the current value of the internal
+.Em branch register
+.El
+.Pp
+This data is modified by some of the microinstructions, not all.
+.Ss MS_OP_GET and MS_OP_PUT
+are microinstructions used to do either predefined standard IEEE1284-1994
+transfers or programmed non-standard io.
+.Ss MS_OP_RFETCH - Register FETCH
+is used to retrieve the current value of a parallel port register, apply a
+mask and save it in a buffer.
+.Pp
+Parameters:
+.Bl -enum -offset indent
+.It
+register
+.It
+character mask
+.It
+pointer to the buffer
+.El
+.Pp
+Predefined macro: MS_RFETCH(reg,mask,ptr)
+.Ss MS_OP_RSET - Register SET
+is used to assert/clear some bits of a particular parallel port register,
+two masks are applied.
+.Pp
+Parameters:
+.Bl -enum -offset indent
+.It
+register
+.It
+mask of bits to assert
+.It
+mask of bits to clear
+.El
+.Pp
+Predefined macro: MS_RSET(reg,assert,clear)
+.Ss MS_OP_RASSERT - Register ASSERT
+is used to assert all bits of a particular parallel port register.
+.Pp
+Parameters:
+.Bl -enum -offset indent
+.It
+register
+.It
+byte to assert
+.El
+.Pp
+Predefined macro: MS_RASSERT(reg,byte)
+.Ss MS_OP_DELAY - microsecond DELAY
+is used to delay the execution of the microsequence.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+delay in microseconds
+.El
+.Pp
+Predefined macro: MS_DELAY(delay)
+.Ss MS_OP_SET - SET internal branch register
+is used to set the value of the internal branch register.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+integer value
+.El
+.Pp
+Predefined macro: MS_SET(accum)
+.Ss MS_OP_DBRA - \&Do BRAnch
+is used to branch if internal branch register decremented by one result value
+is positive.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+integer offset in the current executed (sub)microsequence.
+Offset is added to
+the index of the next microinstruction to execute.
+.El
+.Pp
+Predefined macro: MS_DBRA(offset)
+.Ss MS_OP_BRSET - BRanch on SET
+is used to branch if some of the status register bits of the parallel port
+are set.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+bits of the status register
+.It
+integer offset in the current executed (sub)microsequence.
+Offset is added to
+the index of the next microinstruction to execute.
+.El
+.Pp
+Predefined macro: MS_BRSET(mask,offset)
+.Ss MS_OP_BRCLEAR - BRanch on CLEAR
+is used to branch if some of the status register bits of the parallel port
+are cleared.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+bits of the status register
+.It
+integer offset in the current executed (sub)microsequence.
+Offset is added to
+the index of the next microinstruction to execute.
+.El
+.Pp
+Predefined macro: MS_BRCLEAR(mask,offset)
+.Ss MS_OP_RET - RETurn
+is used to return from a microsequence.
+This instruction is mandatory.
+This
+is the only way for the microsequencer to detect the end of the microsequence.
+The return code is returned in the integer pointed by the (int *) parameter
+of the ppb_MS_microseq().
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+integer return code
+.El
+.Pp
+Predefined macro: MS_RET(code)
+.Ss MS_OP_C_CALL - C function CALL
+is used to call C functions from microsequence execution.
+This may be useful
+when a non-standard i/o is performed to retrieve a data character from the
+parallel port.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+the C function to call
+.It
+the parameter to pass to the function call
+.El
+.Pp
+The C function shall be declared as a
+.Ft int(*)(void *p, char *ptr) .
+The ptr parameter is the current position in the buffer currently scanned.
+.Pp
+Predefined macro: MS_C_CALL(func,param)
+.Ss MS_OP_PTR - initialize internal PTR
+is used to initialize the internal pointer to the currently scanned buffer.
+This pointer is passed to any C call (see above).
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+pointer to the buffer that shall be accessed by xxx_P() microsequence calls.
+Note that this pointer is automatically incremented during xxx_P() calls
+.El
+.Pp
+Predefined macro: MS_PTR(ptr)
+.Ss MS_OP_ADELAY - do an Asynchronous DELAY
+is used to make a tsleep() during microsequence execution.
+The tsleep is
+executed at PPBPRI level.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+delay in ms
+.El
+.Pp
+Predefined macro: MS_ADELAY(delay)
+.Ss MS_OP_BRSTAT - BRanch on STATe
+is used to branch on status register state condition.
+.Pp
+Parameter:
+.Bl -enum -offset indent
+.It
+mask of asserted bits.
+Bits that shall be asserted in the status register
+are set in the mask
+.It
+mask of cleared bits.
+Bits that shall be cleared in the status register
+are set in the mask
+.It
+integer offset in the current executed (sub)microsequence.
+Offset is added
+to the index of the next microinstruction to execute.
+.El
+.Pp
+Predefined macro: MS_BRSTAT(asserted_bits,clear_bits,offset)
+.Ss MS_OP_SUBRET - SUBmicrosequence RETurn
+is used to return from the submicrosequence call.
+This action is mandatory
+before a RET call.
+Some microinstructions (PUT, GET) may not be callable
+within a submicrosequence.
+.Pp
+No parameter.
+.Pp
+Predefined macro: MS_SUBRET()
+.Ss MS_OP_CALL - submicrosequence CALL
+is used to call a submicrosequence.
+A submicrosequence is a microsequence with
+a SUBRET call.
+Parameter:
+.Bl -enum -offset indent
+.It
+the submicrosequence to execute
+.El
+.Pp
+Predefined macro: MS_CALL(microseq)
+.Ss MS_OP_RASSERT_P - Register ASSERT from internal PTR
+is used to assert a register with data currently pointed by the internal PTR
+pointer.
+Parameter:
+.Bl -enum -offset indent
+.It
+amount of data to write to the register
+.It
+register
+.El
+.Pp
+Predefined macro: MS_RASSERT_P(iter,reg)
+.Ss MS_OP_RFETCH_P - Register FETCH to internal PTR
+is used to fetch data from a register.
+Data is stored in the buffer currently
+pointed by the internal PTR pointer.
+Parameter:
+.Bl -enum -offset indent
+.It
+amount of data to read from the register
+.It
+register
+.It
+mask applied to fetched data
+.El
+.Pp
+Predefined macro: MS_RFETCH_P(iter,reg,mask)
+.Ss MS_OP_TRIG - TRIG register
+is used to trigger the parallel port.
+This microinstruction is intended to
+provide a very efficient control of the parallel port.
+Triggering a register
+is writing data, wait a while, write data, wait a while...
+This allows to
+write magic sequences to the port.
+Parameter:
+.Bl -enum -offset indent
+.It
+amount of data to read from the register
+.It
+register
+.It
+size of the array
+.It
+array of unsigned chars.
+Each couple of u_chars define the data to write to
+the register and the delay in us to wait.
+The delay is limited to 255 us to
+simplify and reduce the size of the array.
+.El
+.Pp
+Predefined macro: MS_TRIG(reg,len,array)
+.Sh MICROSEQUENCES
+.Ss C structures
+.Bd -literal
+union ppb_insarg {
+ int i;
+ char c;
+ void *p;
+ int (* f)(void *, char *);
+};
+
+struct ppb_microseq {
+ int opcode; /* microins. opcode */
+ union ppb_insarg arg[PPB_MS_MAXARGS]; /* arguments */
+};
+.Ed
+.Ss Using microsequences
+To instantiate a microsequence, just declare an array of ppb_microseq
+structures and initialize it as needed.
+You may either use predefined macros
+or code directly your microinstructions according to the ppb_microseq
+definition.
+For example,
+.Bd -literal
+ struct ppb_microseq select_microseq[] = {
+
+ /* parameter list
+ */
+ #define SELECT_TARGET MS_PARAM(0, 1, MS_TYP_INT)
+ #define SELECT_INITIATOR MS_PARAM(3, 1, MS_TYP_INT)
+
+ /* send the select command to the drive */
+ MS_DASS(MS_UNKNOWN),
+ MS_CASS(H_nAUTO | H_nSELIN | H_INIT | H_STROBE),
+ MS_CASS( H_AUTO | H_nSELIN | H_INIT | H_STROBE),
+ MS_DASS(MS_UNKNOWN),
+ MS_CASS( H_AUTO | H_nSELIN | H_nINIT | H_STROBE),
+
+ /* now, wait until the drive is ready */
+ MS_SET(VP0_SELTMO),
+/* loop: */ MS_BRSET(H_ACK, 2 /* ready */),
+ MS_DBRA(-2 /* loop */),
+/* error: */ MS_RET(1),
+/* ready: */ MS_RET(0)
+ };
+.Ed
+.Pp
+Here, some parameters are undefined and must be filled before executing
+the microsequence.
+In order to initialize each microsequence, one
+should use the ppb_MS_init_msq() function like this:
+.Bd -literal
+ ppb_MS_init_msq(select_microseq, 2,
+ SELECT_TARGET, 1 << target,
+ SELECT_INITIATOR, 1 << initiator);
+.Ed
+.Pp
+and then execute the microsequence.
+.Ss The microsequencer
+The microsequencer is executed either at ppbus or adapter level (see
+.Xr ppbus 4
+for info about ppbus system layers).
+Most of the microsequencer is executed
+at ppc level to avoid ppbus to adapter function call overhead.
+But some
+actions like deciding whereas the transfer is IEEE1284-1994 compliant are
+executed at ppbus layer.
+.Sh SEE ALSO
+.Xr ppbus 4 ,
+.Xr ppc 4 ,
+.Xr vpo 4
+.Sh HISTORY
+The
+.Nm
+manual page first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+This
+manual page was written by
+.An Nicolas Souchu .
+.Sh BUGS
+Only one level of submicrosequences is allowed.
+.Pp
+When triggering the port, maximum delay allowed is 255 us.
diff --git a/share/man/man9/microtime.9 b/share/man/man9/microtime.9
new file mode 100644
index 000000000000..3288578e1736
--- /dev/null
+++ b/share/man/man9/microtime.9
@@ -0,0 +1,121 @@
+.\" Copyright (c) 2000 Kelly Yancey
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 16, 2004
+.Dt MICROTIME 9
+.Os
+.Sh NAME
+.Nm bintime ,
+.Nm getbintime ,
+.Nm microtime ,
+.Nm getmicrotime ,
+.Nm nanotime ,
+.Nm getnanotime
+.Nd get the current time
+.Sh SYNOPSIS
+.In sys/time.h
+.Ft void
+.Fn bintime "struct bintime *bt"
+.Ft void
+.Fn getbintime "struct bintime *bt"
+.Ft void
+.Fn microtime "struct timeval *tv"
+.Ft void
+.Fn getmicrotime "struct timeval *tv"
+.Ft void
+.Fn nanotime "struct timespec *ts"
+.Ft void
+.Fn getnanotime "struct timespec *tsp"
+.Sh DESCRIPTION
+The
+.Fn bintime
+and
+.Fn getbintime
+functions store the system time as a
+.Vt "struct bintime"
+at the addresses specified by
+.Fa bt .
+The
+.Fn microtime
+and
+.Fn getmicrotime
+functions perform the same utility, but record the time as a
+.Vt "struct timeval"
+instead.
+Similarly the
+.Fn nanotime
+and
+.Fn getnanotime
+functions store the time as a
+.Vt "struct timespec" .
+.Pp
+The
+.Fn bintime ,
+.Fn microtime ,
+and
+.Fn nanotime
+functions
+always query the timecounter to return the current time as precisely as
+possible.
+Whereas
+.Fn getbintime ,
+.Fn getmicrotime ,
+and
+.Fn getnanotime
+functions are abstractions which return a less precise, but
+faster to obtain, time.
+.Pp
+The intent of the
+.Fn getbintime ,
+.Fn getmicrotime ,
+and
+.Fn getnanotime
+functions is to enforce the user's preference for timer accuracy versus
+execution time.
+.Sh SEE ALSO
+.Xr binuptime 9 ,
+.Xr getbinuptime 9 ,
+.Xr getmicrouptime 9 ,
+.Xr getnanouptime 9 ,
+.Xr microuptime 9 ,
+.Xr nanouptime 9 ,
+.Xr tvtohz 9
+.Sh HISTORY
+The
+.Nm bintime
+functions first appeared in
+.Fx 5.0 .
+The
+.Nm microtime
+and
+.Nm nanotime
+functions first appeared in
+.Fx 3.0
+but have existed in other incarnations since
+.Bx 4.4 .
+.Sh AUTHORS
+This manual page was written by
+.An Kelly Yancey Aq kbyanc@posi.net .
diff --git a/share/man/man9/microuptime.9 b/share/man/man9/microuptime.9
new file mode 100644
index 000000000000..8f9985f72aa9
--- /dev/null
+++ b/share/man/man9/microuptime.9
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2000 Kelly Yancey
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 16, 2004
+.Dt MICROUPTIME 9
+.Os
+.Sh NAME
+.Nm binuptime ,
+.Nm getbinuptime ,
+.Nm microuptime ,
+.Nm getmicrouptime ,
+.Nm nanouptime ,
+.Nm getnanouptime
+.Nd get the time elapsed since boot
+.Sh SYNOPSIS
+.In sys/time.h
+.Ft void
+.Fn binuptime "struct bintime *bt"
+.Ft void
+.Fn getbinuptime "struct bintime *bt"
+.Ft void
+.Fn microuptime "struct timeval *tv"
+.Ft void
+.Fn getmicrouptime "struct timeval *tv"
+.Ft void
+.Fn nanouptime "struct timespec *ts"
+.Ft void
+.Fn getnanouptime "struct timespec *tsp"
+.Sh DESCRIPTION
+The
+.Fn binuptime
+and
+.Fn getbinuptime
+functions store the time elapsed since boot as a
+.Vt "struct bintime"
+at the address specified by
+.Fa bt .
+The
+.Fn microuptime
+and
+.Fn getmicrouptime
+functions perform the same utility, but record the elapsed time as a
+.Vt "struct timeval"
+instead.
+Similarly the
+.Fn nanouptime
+and
+.Fn getnanouptime
+functions store the elapsed time as a
+.Vt "struct timespec" .
+.Pp
+The
+.Fn binuptime ,
+.Fn microuptime ,
+and
+.Fn nanouptime
+functions
+always query the timecounter to return the current time as precisely as
+possible.
+Whereas
+.Fn getbinuptime ,
+.Fn getmicrouptime ,
+and
+.Fn getnanouptime
+functions are abstractions which return a less precise, but
+faster to obtain, time.
+.Pp
+The intent of the
+.Fn getbinuptime ,
+.Fn getmicrouptime ,
+and
+.Fn getnanouptime
+functions is to enforce the user's preference for timer accuracy versus
+execution time.
+.Sh SEE ALSO
+.Xr bintime 9 ,
+.Xr getbintime 9 ,
+.Xr getmicrotime 9 ,
+.Xr getnanotime 9 ,
+.Xr microtime 9 ,
+.Xr nanotime 9 ,
+.Xr tvtohz 9
+.Sh AUTHORS
+This manual page was written by
+.An Kelly Yancey Aq kbyanc@posi.net .
diff --git a/share/man/man9/mod_cc.9 b/share/man/man9/mod_cc.9
new file mode 100644
index 000000000000..75e2db039b56
--- /dev/null
+++ b/share/man/man9/mod_cc.9
@@ -0,0 +1,333 @@
+.\"
+.\" Copyright (c) 2008-2009 Lawrence Stewart <lstewart@FreeBSD.org>
+.\" Copyright (c) 2010-2011 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" Portions of this documentation were written at the Centre for Advanced
+.\" Internet Architectures, Swinburne University of Technology, Melbourne,
+.\" Australia by David Hayes and Lawrence Stewart under sponsorship from the
+.\" FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 15, 2011
+.Dt MOD_CC 9
+.Os
+.Sh NAME
+.Nm mod_cc ,
+.Nm DECLARE_CC_MODULE ,
+.Nm CC_VAR
+.Nd Modular Congestion Control
+.Sh SYNOPSIS
+.In netinet/cc.h
+.In netinet/cc/cc_module.h
+.Fn DECLARE_CC_MODULE "ccname" "ccalgo"
+.Fn CC_VAR "ccv" "what"
+.Sh DESCRIPTION
+The
+.Nm
+framework allows congestion control algorithms to be implemented as dynamically
+loadable kernel modules via the
+.Xr kld 4
+facility.
+Transport protocols can select from the list of available algorithms on a
+connection-by-connection basis, or use the system default (see
+.Xr mod_cc 4
+for more details).
+.Pp
+.Nm
+modules are identified by an
+.Xr ascii 7
+name and set of hook functions encapsulated in a
+.Vt "struct cc_algo" ,
+which has the following members:
+.Bd -literal -offset indent
+struct cc_algo {
+ char name[TCP_CA_NAME_MAX];
+ int (*mod_init) (void);
+ int (*mod_destroy) (void);
+ int (*cb_init) (struct cc_var *ccv);
+ void (*cb_destroy) (struct cc_var *ccv);
+ void (*conn_init) (struct cc_var *ccv);
+ void (*ack_received) (struct cc_var *ccv, uint16_t type);
+ void (*cong_signal) (struct cc_var *ccv, uint32_t type);
+ void (*post_recovery) (struct cc_var *ccv);
+ void (*after_idle) (struct cc_var *ccv);
+};
+.Ed
+.Pp
+The
+.Va name
+field identifies the unique name of the algorithm, and should be no longer than
+TCP_CA_NAME_MAX-1 characters in length (the TCP_CA_NAME_MAX define lives in
+.In netinet/tcp.h
+for compatibility reasons).
+.Pp
+The
+.Va mod_init
+function is called when a new module is loaded into the system but before the
+registration process is complete.
+It should be implemented if a module needs to set up some global state prior to
+being available for use by new connections.
+Returning a non-zero value from
+.Va mod_init
+will cause the loading of the module to fail.
+.Pp
+The
+.Va mod_destroy
+function is called prior to unloading an existing module from the kernel.
+It should be implemented if a module needs to clean up any global state before
+being removed from the kernel.
+The return value is currently ignored.
+.Pp
+The
+.Va cb_init
+function is called when a TCP control block
+.Vt struct tcpcb
+is created.
+It should be implemented if a module needs to allocate memory for storing
+private per-connection state.
+Returning a non-zero value from
+.Va cb_init
+will cause the connection set up to be aborted, terminating the connection as a
+result.
+.Pp
+The
+.Va cb_destroy
+function is called when a TCP control block
+.Vt struct tcpcb
+is destroyed.
+It should be implemented if a module needs to free memory allocated in
+.Va cb_init .
+.Pp
+The
+.Va conn_init
+function is called when a new connection has been established and variables are
+being initialised.
+It should be implemented to initialise congestion control algorithm variables
+for the newly established connection.
+.Pp
+The
+.Va ack_received
+function is called when a TCP acknowledgement (ACK) packet is received.
+Modules use the
+.Fa type
+argument as an input to their congestion management algorithms.
+The ACK types currently reported by the stack are CC_ACK and CC_DUPACK.
+CC_ACK indicates the received ACK acknowledges previously unacknowledged data.
+CC_DUPACK indicates the received ACK acknowledges data we have already received
+an ACK for.
+.Pp
+The
+.Va cong_signal
+function is called when a congestion event is detected by the TCP stack.
+Modules use the
+.Fa type
+argument as an input to their congestion management algorithms.
+The congestion event types currently reported by the stack are CC_ECN, CC_RTO,
+CC_RTO_ERR and CC_NDUPACK.
+CC_ECN is reported when the TCP stack receives an explicit congestion notification
+(RFC3168).
+CC_RTO is reported when the retransmission time out timer fires.
+CC_RTO_ERR is reported if the retransmission time out timer fired in error.
+CC_NDUPACK is reported if N duplicate ACKs have been received back-to-back,
+where N is the fast retransmit duplicate ack threshold (N=3 currently as per
+RFC5681).
+.Pp
+The
+.Va post_recovery
+function is called after the TCP connection has recovered from a congestion event.
+It should be implemented to adjust state as required.
+.Pp
+The
+.Va after_idle
+function is called when data transfer resumes after an idle period.
+It should be implemented to adjust state as required.
+.Pp
+The
+.Fn DECLARE_CC_MODULE
+macro provides a convenient wrapper around the
+.Xr DECLARE_MODULE 9
+macro, and is used to register a
+.Nm
+module with the
+.Nm
+framework.
+The
+.Fa ccname
+argument specifies the module's name.
+The
+.Fa ccalgo
+argument points to the module's
+.Vt struct cc_algo .
+.Pp
+.Nm
+modules must instantiate a
+.Vt struct cc_algo ,
+but are only required to set the name field, and optionally any of the function
+pointers.
+The stack will skip calling any function pointer which is NULL, so there is no
+requirement to implement any of the function pointers.
+Using the C99 designated initialiser feature to set fields is encouraged.
+.Pp
+Each function pointer which deals with congestion control state is passed a
+pointer to a
+.Vt struct cc_var ,
+which has the following members:
+.Bd -literal -offset indent
+struct cc_var {
+ void *cc_data;
+ int bytes_this_ack;
+ tcp_seq curack;
+ uint32_t flags;
+ int type;
+ union ccv_container {
+ struct tcpcb *tcp;
+ struct sctp_nets *sctp;
+ } ccvc;
+};
+.Ed
+.Pp
+.Vt struct cc_var
+groups congestion control related variables into a single, embeddable structure
+and adds a layer of indirection to accessing transport protocol control blocks.
+The eventual goal is to allow a single set of
+.Nm
+modules to be shared between all congestion aware transport protocols, though
+currently only
+.Xr tcp 4
+is supported.
+.Pp
+To aid the eventual transition towards this goal, direct use of variables from
+the transport protocol's data structures is strongly discouraged.
+However, it is inevitable at the current time to require access to some of these
+variables, and so the
+.Fn CC_VAR
+macro exists as a convenience accessor.
+The
+.Fa ccv
+argument points to the
+.Vt struct cc_var
+passed into the function by the
+.Nm
+framework.
+The
+.Fa what
+argument specifies the name of the variable to access.
+.Pp
+Apart from the
+.Va type
+and
+.Va ccv_container
+fields, the remaining fields in
+.Vt struct cc_var
+are for use by
+.Nm
+modules.
+.Pp
+The
+.Va cc_data
+field is available for algorithms requiring additional per-connection state to
+attach a dynamic memory pointer to.
+The memory should be allocated and attached in the module's
+.Va cb_init
+hook function.
+.Pp
+The
+.Va bytes_this_ack
+field specifies the number of new bytes acknowledged by the most recently
+received ACK packet.
+It is only valid in the
+.Va ack_received
+hook function.
+.Pp
+The
+.Va curack
+field specifies the sequence number of the most recently received ACK packet.
+It is only valid in the
+.Va ack_received ,
+.Va cong_signal
+and
+.Va post_recovery
+hook functions.
+.Pp
+The
+.Va flags
+field is used to pass useful information from the stack to a
+.Nm
+module.
+The CCF_ABC_SENTAWND flag is relevant in
+.Va ack_received
+and is set when appropriate byte counting (RFC3465) has counted a window's worth
+of bytes has been sent.
+It is the module's responsibility to clear the flag after it has processed the
+signal.
+The CCF_CWND_LIMITED flag is relevant in
+.Va ack_received
+and is set when the connection's ability to send data is currently constrained
+by the value of the congestion window.
+Algorithms should use the abscence of this flag being set to avoid accumulating
+a large difference between the congestion window and send window.
+.Sh SEE ALSO
+.Xr cc_chd 4 ,
+.Xr cc_cubic 4 ,
+.Xr cc_hd 4 ,
+.Xr cc_htcp 4 ,
+.Xr cc_newreno 4 ,
+.Xr cc_vegas 4 ,
+.Xr mod_cc 4 ,
+.Xr tcp 4
+.Sh ACKNOWLEDGEMENTS
+Development and testing of this software were made possible in part by grants
+from the FreeBSD Foundation and Cisco University Research Program Fund at
+Community Foundation Silicon Valley.
+.Sh FUTURE WORK
+Integrate with
+.Xr sctp 4 .
+.Sh HISTORY
+The modular Congestion Control (CC) framework first appeared in
+.Fx 9.0 .
+.Pp
+The framework was first released in 2007 by James Healy and Lawrence Stewart
+whilst working on the NewTCP research project at Swinburne University of
+Technology's Centre for Advanced Internet Architectures, Melbourne, Australia,
+which was made possible in part by a grant from the Cisco University Research
+Program Fund at Community Foundation Silicon Valley.
+More details are available at:
+.Pp
+http://caia.swin.edu.au/urp/newtcp/
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+framework was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org ,
+.An James Healy Aq jimmy@deefa.com
+and
+.An David Hayes Aq david.hayes@ieee.org .
+.Pp
+This manual page was written by
+.An David Hayes Aq david.hayes@ieee.org
+and
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man9/module.9 b/share/man/man9/module.9
new file mode 100644
index 000000000000..055dab94d723
--- /dev/null
+++ b/share/man/man9/module.9
@@ -0,0 +1,121 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Alexander Langer
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2007
+.Dt MODULE 9
+.Os
+.Sh NAME
+.Nm module
+.Nd structure describing a kernel module
+.Sh DESCRIPTION
+Each module in the kernel is described by a
+.Vt module_t
+structure.
+The structure contains the name of the device, a unique ID number,
+a pointer to an event handler function and to an argument,
+which is given to the event handler,
+as well as some kernel internal data.
+.Pp
+The
+.Xr DECLARE_MODULE 9
+macro
+registers the module with the system.
+.Pp
+When the module is loaded, the event handler function is called with
+the
+.Fa what
+argument set to
+.Dv MOD_LOAD .
+.Pp
+On unload it is first called with
+.Fa what
+set to
+.Dv MOD_QUIESCE .
+If the unload was not forced, a non-zero return will prevent the
+unload from happening.
+.Pp
+If the unload continues
+.Fa what
+is set to
+.Dv MOD_UNLOAD .
+If the module returns non-zero to this, the unload will not happen.
+.Pp
+The difference between
+.Dv MOD_QUIESCE
+and
+.Dv MOD_UNLOAD
+is that the module should fail
+.Dv MOD_QUIESCE
+if it is currently in use, whereas
+.Dv MOD_UNLOAD
+should only fail if it is impossible to unload the module, for instance
+because there are memory references to the module which cannot be revoked.
+.Pp
+When the system is shutting down,
+.Fa what
+contains the value of
+.Dv MOD_SHUTDOWN .
+.Pp
+The module should return
+.Er EOPNOTSUPP
+for unsupported and unrecognized values of
+.Fa what .
+.Sh EXAMPLES
+.Bd -literal
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+static int foo_handler(module_t mod, int /*modeventtype_t*/ what,
+ void *arg);
+
+static moduledata_t mod_data= {
+ "foo",
+ foo_handler,
+ 0
+};
+
+MODULE_VERSION(foo, 1);
+MODULE_DEPEND(foo, bar, 1, 3, 4);
+
+DECLARE_MODULE(foo, mod_data, SI_SUB_EXEC, SI_ORDER_ANY);
+.Ed
+.Sh SEE ALSO
+.Xr DECLARE_MODULE 9 ,
+.Xr DEV_MODULE 9 ,
+.Xr DRIVER_MODULE 9 ,
+.Xr MODULE_DEPEND 9 ,
+.Xr MODULE_VERSION 9 ,
+.Xr SYSCALL_MODULE 9
+.Pp
+.Pa /usr/share/examples/kld
+.Sh AUTHORS
+This manual page was written by
+.An Alexander Langer Aq alex@FreeBSD.org .
diff --git a/share/man/man9/mtx_pool.9 b/share/man/man9/mtx_pool.9
new file mode 100644
index 000000000000..ab2cc8b31b11
--- /dev/null
+++ b/share/man/man9/mtx_pool.9
@@ -0,0 +1,184 @@
+.\"
+.\" Copyright (C) 2002 Garrett Rooney <rooneg@electricjellyfish.net>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 6, 2010
+.Dt MTX_POOL 9
+.Os
+.Sh NAME
+.Nm mtx_pool ,
+.Nm mtx_pool_alloc ,
+.Nm mtx_pool_find ,
+.Nm mtx_pool_lock ,
+.Nm mtx_pool_lock_spin ,
+.Nm mtx_pool_unlock ,
+.Nm mtx_pool_unlock_spin ,
+.Nm mtx_pool_create ,
+.Nm mtx_pool_destroy
+.Nd "mutex pool routines"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/mutex.h
+.Ft "struct mtx *"
+.Fn mtx_pool_alloc "struct mtx_pool *pool"
+.Ft "struct mtx *"
+.Fn mtx_pool_find "struct mtx_pool *pool" "void *ptr"
+.Ft void
+.Fn mtx_pool_lock "struct mtx_pool *pool" "void *ptr"
+.Ft void
+.Fn mtx_pool_lock_spin "struct mtx_pool *pool" "void *ptr"
+.Ft void
+.Fn mtx_pool_unlock "struct mtx_pool *pool" "void *ptr"
+.Ft void
+.Fn mtx_pool_unlock_spin "struct mtx_pool *pool" "void *ptr"
+.Ft "struct mtx_pool *"
+.Fn mtx_pool_create "const char *mtx_name" "int pool_size" "int opts"
+.Ft "void"
+.Fn mtx_pool_destroy "struct mtx_pool **poolp"
+.Sh DESCRIPTION
+Mutex pools are designed to be used as short term leaf mutexes;
+i.e., the last mutex one might acquire before calling
+.Xr mtx_sleep 9 .
+They operate using a shared pool of mutexes.
+A mutex may be chosen from the pool based on a supplied pointer,
+which may or may not point to anything valid,
+or the caller may allocate an arbitrary shared mutex from the pool
+and save the returned mutex pointer for later use.
+.Pp
+The shared mutexes in the
+.Va mtxpool_sleep
+mutex pool,
+which is created by default,
+are standard, non-recursive,
+blockable mutexes, and should only be used in appropriate situations.
+The mutexes in the
+.Va mtxpool_lockbuilder
+mutex pool are similar, except that they are initialized with the MTX_NOWITNESS
+flag so that they may be used to build higher-level locks.
+Other mutex pools may be created that contain mutexes with different
+properties, such as spin mutexes.
+.Pp
+The caller can lock and unlock mutexes returned by the pool routines, but
+since the mutexes are shared, the caller should not attempt to destroy them
+or modify their characteristics.
+While pool mutexes are normally leaf mutexes
+(meaning that one cannot depend on any ordering guarantees
+after obtaining one),
+one can still obtain other mutexes under carefully controlled circumstances.
+Specifically, if one has a private mutex
+(one that was allocated and initialized by the caller),
+one can obtain it after obtaining a pool mutex if ordering issues are
+carefully accounted for.
+In these cases the private mutex winds up being the true leaf mutex.
+.Pp
+Pool mutexes have the following advantages:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+No structural overhead;
+i.e., they can be associated with a structure without adding bloat to it.
+.It
+Mutexes can be obtained for invalid pointers, which is useful when one uses
+mutexes to interlock destructor operations.
+.It
+No initialization or destruction overhead.
+.It
+Can be used with
+.Xr mtx_sleep 9 .
+.El
+.Pp
+And the following disadvantages:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+Should generally only be used as leaf mutexes.
+.It
+Pool/pool dependency ordering cannot be guaranteed.
+.It
+Possible L1 cache mastership contention between CPUs.
+.El
+.Pp
+.Fn mtx_pool_alloc
+obtains a shared mutex from the specified pool.
+This routine uses a simple rover to choose one of the shared mutexes managed
+by the
+.Nm
+subsystem.
+.Pp
+.Fn mtx_pool_find
+returns the shared mutex associated with the specified address.
+This routine will create a hash out of the pointer passed into it
+and will choose a shared mutex from the specified pool based on that hash.
+The pointer does not need to point to anything real.
+.Pp
+.Fn mtx_pool_lock ,
+.Fn mtx_pool_lock_spin ,
+.Fn mtx_pool_unlock ,
+and
+.Fn mtx_pool_unlock_spin
+lock and unlock the shared mutex from the specified pool
+associated with the specified address;
+they are a combination of
+.Fn mtx_pool_find
+and
+.Xr mtx_lock 9 ,
+.Xr mtx_lock_spin 9 ,
+.Xr mtx_unlock 9 ,
+and
+.Xr mtx_unlock_spin 9 ,
+respectively.
+Since these routines must first find the mutex to operate on,
+they are not as fast as directly using the mutex pointer returned by
+a previous invocation of
+.Fn mtx_pool_find
+or
+.Fn mtx_pool_alloc .
+.Pp
+.Fn mtx_pool_create
+allocates and initializes a new mutex pool of the
+specified size.
+The pool size must be a power of two.
+The
+.Fa opts
+argument is passed to
+.Xr mtx_init 9
+to set the options for each mutex in the pool.
+.Pp
+.Fn mtx_pool_destroy
+calls
+.Xr mtx_destroy 9
+on each mutex in the specified pool,
+deallocates the memory associated with the pool,
+and assigns NULL to the pool pointer.
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr mutex 9
+.Sh HISTORY
+These routines first appeared in
+.Fx 5.0 .
diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9
new file mode 100644
index 000000000000..628939f3cb29
--- /dev/null
+++ b/share/man/man9/mutex.9
@@ -0,0 +1,523 @@
+.\"
+.\" Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. Berkeley Software Design Inc's name may not be used to endorse or
+.\" promote products derived from this software without specific prior
+.\" written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $
+.\" $FreeBSD$
+.\"
+.Dd November 16, 2011
+.Dt MUTEX 9
+.Os
+.Sh NAME
+.Nm mutex ,
+.Nm mtx_init ,
+.Nm mtx_destroy ,
+.Nm mtx_lock ,
+.Nm mtx_lock_spin ,
+.Nm mtx_lock_flags ,
+.Nm mtx_lock_spin_flags ,
+.Nm mtx_trylock ,
+.Nm mtx_trylock_flags ,
+.Nm mtx_unlock ,
+.Nm mtx_unlock_spin ,
+.Nm mtx_unlock_flags ,
+.Nm mtx_unlock_spin_flags ,
+.Nm mtx_sleep ,
+.Nm mtx_initialized ,
+.Nm mtx_owned ,
+.Nm mtx_recursed ,
+.Nm mtx_assert ,
+.Nm MTX_SYSINIT
+.Nd kernel synchronization primitives
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/mutex.h
+.Ft void
+.Fn mtx_init "struct mtx *mutex" "const char *name" "const char *type" "int opts"
+.Ft void
+.Fn mtx_destroy "struct mtx *mutex"
+.Ft void
+.Fn mtx_lock "struct mtx *mutex"
+.Ft void
+.Fn mtx_lock_spin "struct mtx *mutex"
+.Ft void
+.Fn mtx_lock_flags "struct mtx *mutex" "int flags"
+.Ft void
+.Fn mtx_lock_spin_flags "struct mtx *mutex" "int flags"
+.Ft int
+.Fn mtx_trylock "struct mtx *mutex"
+.Ft int
+.Fn mtx_trylock_flags "struct mtx *mutex" "int flags"
+.Ft void
+.Fn mtx_unlock "struct mtx *mutex"
+.Ft void
+.Fn mtx_unlock_spin "struct mtx *mutex"
+.Ft void
+.Fn mtx_unlock_flags "struct mtx *mutex" "int flags"
+.Ft void
+.Fn mtx_unlock_spin_flags "struct mtx *mutex" "int flags"
+.Ft int
+.Fn mtx_sleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn mtx_initialized "const struct mtx *mutex"
+.Ft int
+.Fn mtx_owned "const struct mtx *mutex"
+.Ft int
+.Fn mtx_recursed "const struct mtx *mutex"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
+.Ft void
+.Fn mtx_assert "const struct mtx *mutex" "int what"
+.In sys/kernel.h
+.Fn MTX_SYSINIT "name" "struct mtx *mtx" "const char *description" "int opts"
+.Sh DESCRIPTION
+Mutexes are the most basic and primary method of thread synchronization.
+The major design considerations for mutexes are:
+.Bl -enum
+.It
+Acquiring and releasing uncontested mutexes should be as cheap
+as possible.
+.It
+They must have the information and storage space to support
+priority propagation.
+.It
+A thread must be able to recursively acquire a mutex,
+provided that the mutex is initialized to support recursion.
+.El
+.Pp
+There are currently two flavors of mutexes, those that context switch
+when they block and those that do not.
+.Pp
+By default,
+.Dv MTX_DEF
+mutexes will context switch when they are already held.
+As an optimization,
+they may spin for some amount
+of time before context switching.
+It is important to remember that since a thread may be preempted at any time,
+the possible context switch introduced by acquiring a mutex is guaranteed
+to not break anything that is not already broken.
+.Pp
+Mutexes which do not context switch are
+.Dv MTX_SPIN
+mutexes.
+These should only be used to protect data shared with primary interrupt
+code.
+This includes interrupt filters and low level scheduling code.
+In all architectures both acquiring and releasing of a
+uncontested spin mutex is more expensive than the same operation
+on a non-spin mutex.
+In order to protect an interrupt service routine from blocking
+against itself all interrupts are either blocked or deferred on a processor
+while holding a spin lock.
+It is permissible to hold multiple spin mutexes.
+.Pp
+Once a spin mutex has been acquired it is not permissible to acquire a
+blocking mutex.
+.Pp
+The storage needed to implement a mutex is provided by a
+.Vt struct mtx .
+In general this should be treated as an opaque object and
+referenced only with the mutex primitives.
+.Pp
+The
+.Fn mtx_init
+function must be used to initialize a mutex
+before it can be passed to any of the other mutex functions.
+The
+.Fa name
+option is used to identify the lock in debugging output etc.
+The
+.Fa type
+option is used by the witness code to classify a mutex when doing checks
+of lock ordering.
+If
+.Fa type
+is
+.Dv NULL ,
+.Fa name
+is used in its place.
+The pointer passed in as
+.Fa name
+and
+.Fa type
+is saved rather than the data it points to.
+The data pointed to must remain stable
+until the mutex is destroyed.
+The
+.Fa opts
+argument is used to set the type of mutex.
+It may contain either
+.Dv MTX_DEF
+or
+.Dv MTX_SPIN
+but not both.
+See below for additional initialization options.
+It is not permissible to pass the same
+.Fa mutex
+to
+.Fn mtx_init
+multiple times without intervening calls to
+.Fn mtx_destroy .
+.Pp
+The
+.Fn mtx_lock
+function acquires a
+.Dv MTX_DEF
+mutual exclusion lock
+on behalf of the currently running kernel thread.
+If another kernel thread is holding the mutex,
+the caller will be disconnected from the CPU
+until the mutex is available
+(i.e., it will block).
+.Pp
+The
+.Fn mtx_lock_spin
+function acquires a
+.Dv MTX_SPIN
+mutual exclusion lock
+on behalf of the currently running kernel thread.
+If another kernel thread is holding the mutex,
+the caller will spin until the mutex becomes available.
+Interrupts are disabled during the spin and remain disabled
+following the acquiring of the lock.
+.Pp
+It is possible for the same thread to recursively acquire a mutex
+with no ill effects, provided that the
+.Dv MTX_RECURSE
+bit was passed to
+.Fn mtx_init
+during the initialization of the mutex.
+.Pp
+The
+.Fn mtx_lock_flags
+and
+.Fn mtx_lock_spin_flags
+functions acquire a
+.Dv MTX_DEF
+or
+.Dv MTX_SPIN
+lock, respectively, and also accept a
+.Fa flags
+argument.
+In both cases, the only flag presently available for lock acquires is
+.Dv MTX_QUIET .
+If the
+.Dv MTX_QUIET
+bit is turned on in the
+.Fa flags
+argument, then if
+.Dv KTR_LOCK
+tracing is being done,
+it will be silenced during the lock acquire.
+.Pp
+The
+.Fn mtx_trylock
+attempts to acquire the
+.Dv MTX_DEF
+mutex pointed to by
+.Fa mutex .
+If the mutex cannot be immediately acquired
+.Fn mtx_trylock
+will return 0,
+otherwise the mutex will be acquired
+and a non-zero value will be returned.
+.Pp
+The
+.Fn mtx_trylock_flags
+function has the same behavior as
+.Fn mtx_trylock
+but should be used when the caller desires to pass in a
+.Fa flags
+value.
+Presently, the only valid value in the
+.Fn mtx_trylock
+case is
+.Dv MTX_QUIET ,
+and its effects are identical to those described for
+.Fn mtx_lock
+above.
+.Pp
+The
+.Fn mtx_unlock
+function releases a
+.Dv MTX_DEF
+mutual exclusion lock.
+The current thread may be preempted if a higher priority thread is waiting
+for the mutex.
+.Pp
+The
+.Fn mtx_unlock_spin
+function releases a
+.Dv MTX_SPIN
+mutual exclusion lock.
+.Pp
+The
+.Fn mtx_unlock_flags
+and
+.Fn mtx_unlock_spin_flags
+functions behave in exactly the same way as do the standard mutex
+unlock routines above, while also allowing a
+.Fa flags
+argument which may specify
+.Dv MTX_QUIET .
+The behavior of
+.Dv MTX_QUIET
+is identical to its behavior in the mutex lock routines.
+.Pp
+The
+.Fn mtx_destroy
+function is used to destroy
+.Fa mutex
+so the data associated with it may be freed
+or otherwise overwritten.
+Any mutex which is destroyed
+must previously have been initialized with
+.Fn mtx_init .
+It is permissible to have a single hold count
+on a mutex when it is destroyed.
+It is not permissible to hold the mutex recursively,
+or have another thread blocked on the mutex
+when it is destroyed.
+.Pp
+The
+.Fn mtx_sleep
+function is used to atomically release
+.Fa mtx
+while waiting for an event.
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.Pp
+The
+.Fn mtx_initialized
+function returns non-zero if
+.Fa mutex
+has been initialized and zero otherwise.
+.Pp
+The
+.Fn mtx_owned
+function returns non-zero
+if the current thread holds
+.Fa mutex .
+If the current thread does not hold
+.Fa mutex
+zero is returned.
+.Pp
+The
+.Fn mtx_recursed
+function returns non-zero if the
+.Fa mutex
+is recursed.
+This check should only be made if the running thread already owns
+.Fa mutex .
+.Pp
+The
+.Fn mtx_assert
+function allows assertions specified in
+.Fa what
+to be made about
+.Fa mutex .
+If the assertions are not true and the kernel is compiled with
+.Cd "options INVARIANTS"
+and
+.Cd "options INVARIANT_SUPPORT" ,
+the kernel will panic.
+Currently the following assertions are supported:
+.Bl -tag -width MA_NOTRECURSED
+.It Dv MA_OWNED
+Assert that the current thread
+holds the mutex
+pointed to by the first argument.
+.It Dv MA_NOTOWNED
+Assert that the current thread
+does not hold the mutex
+pointed to by the first argument.
+.It Dv MA_RECURSED
+Assert that the current thread has recursed on the mutex
+pointed to by the first argument.
+This assertion is only valid in conjunction with
+.Dv MA_OWNED .
+.It Dv MA_NOTRECURSED
+Assert that the current thread has not recursed on the mutex
+pointed to by the first argument.
+This assertion is only valid in conjunction with
+.Dv MA_OWNED .
+.El
+.Pp
+The
+.Fn MTX_SYSINIT
+macro is used to generate a call to the
+.Fn mtx_sysinit
+routine at system startup in order to initialize a given mutex lock.
+The parameters are the same as
+.Fn mtx_init
+but with an additional argument,
+.Fa name ,
+that is used in generating unique variable names for the related structures associated with the lock and the sysinit routine.
+.Ss The Default Mutex Type
+Most kernel code should use the default lock type,
+.Dv MTX_DEF .
+The default lock type will allow the thread
+to be disconnected from the CPU
+if the lock is already held by another thread.
+The implementation
+may treat the lock as a short term spin lock
+under some circumstances.
+However, it is always safe to use these forms of locks
+in an interrupt thread
+without fear of deadlock
+against an interrupted thread on the same CPU.
+.Ss The Spin Mutex Type
+A
+.Dv MTX_SPIN
+mutex will not relinquish the CPU
+when it cannot immediately get the requested lock,
+but will loop, waiting for the mutex to be released by another CPU.
+This could result in deadlock
+if another thread interrupted the thread which held a mutex
+and then tried to acquire the mutex.
+For this reason spin locks disable all interrupts on the local CPU.
+.Pp
+Spin locks are fairly specialized locks
+that are intended to be held for very short periods of time.
+Their primary purpose is to protect portions of the code
+that implement other synchronization primitives such as default mutexes,
+thread scheduling, and interrupt threads.
+.Ss Initialization Options
+The options passed in the
+.Fa opts
+argument of
+.Fn mtx_init
+specify the mutex type.
+One of the
+.Dv MTX_DEF
+or
+.Dv MTX_SPIN
+options is required and only one of those two options may be specified.
+The possibilities are:
+.Bl -tag -width MTX_NOWITNESS
+.It Dv MTX_DEF
+Default mutexes
+will always allow the current thread to be suspended
+to avoid deadlock conditions against interrupt threads.
+The implementation of this lock type
+may spin for a while before suspending the current thread.
+.It Dv MTX_SPIN
+Spin mutexes
+will never relinquish the CPU.
+All interrupts are disabled on the local CPU
+while any spin lock is held.
+.It Dv MTX_RECURSE
+Specifies that the initialized mutex is allowed to recurse.
+This bit must be present if the mutex is permitted to recurse.
+.It Dv MTX_QUIET
+Do not log any mutex operations for this lock.
+.It Dv MTX_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv MTX_DUPOK
+Witness should not log messages about duplicate locks being acquired.
+.It Dv MTX_NOPROFILE
+Do not profile this lock.
+.El
+.Ss Lock and Unlock Flags
+The flags passed to the
+.Fn mtx_lock_flags ,
+.Fn mtx_lock_spin_flags ,
+.Fn mtx_unlock_flags ,
+and
+.Fn mtx_unlock_spin_flags
+functions provide some basic options to the caller,
+and are often used only under special circumstances to modify lock or
+unlock behavior.
+Standard locking and unlocking should be performed with the
+.Fn mtx_lock ,
+.Fn mtx_lock_spin ,
+.Fn mtx_unlock ,
+and
+.Fn mtx_unlock_spin
+functions.
+Only if a flag is required should the corresponding
+flags-accepting routines be used.
+.Pp
+Options that modify mutex behavior:
+.Bl -tag -width MTX_QUIET
+.It Dv MTX_QUIET
+This option is used to quiet logging messages during individual mutex
+operations.
+This can be used to trim superfluous logging messages for debugging purposes.
+.El
+.Ss Giant
+If
+.Va Giant
+must be acquired, it must be acquired prior to acquiring
+other mutexes.
+Put another way: it is impossible to acquire
+.Va Giant
+non-recursively while
+holding another mutex.
+It is possible to acquire other mutexes while holding
+.Va Giant ,
+and it is possible to acquire
+.Va Giant
+recursively while holding other mutexes.
+.Ss Sleeping
+Sleeping while holding a mutex (except for
+.Va Giant )
+is never safe
+and should be avoided.
+There are numerous assertions which will fail if this is attempted.
+.Ss Functions Which Access Memory in Userspace
+No mutexes should be held (except for
+.Va Giant )
+across functions which
+access memory in userspace, such as
+.Xr copyin 9 ,
+.Xr copyout 9 ,
+.Xr uiomove 9 ,
+.Xr fuword 9 ,
+etc.
+No locks are needed when calling these functions.
+.Sh SEE ALSO
+.Xr condvar 9 ,
+.Xr LOCK_PROFILING 9 ,
+.Xr locking 9 ,
+.Xr mtx_pool 9 ,
+.Xr panic 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sleep 9 ,
+.Xr sx 9
+.Sh HISTORY
+These
+functions appeared in
+.Bsx 4.1
+and
+.Fx 5.0 .
diff --git a/share/man/man9/namei.9 b/share/man/man9/namei.9
new file mode 100644
index 000000000000..1ba475a4fe25
--- /dev/null
+++ b/share/man/man9/namei.9
@@ -0,0 +1,381 @@
+.\"
+.\" Copyright (c) 1998, 1999 Eivind Eklund
+.\" Copyright (c) 2003 Hiten M. Pandya
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.\" If you integrate this manpage in another OS, I'd appreciate a note
+.\" - eivind@FreeBSD.org
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2012
+.Dt NAMEI 9
+.Os
+.Sh NAME
+.Nm namei ,
+.Nm NDINIT ,
+.Nm NDFREE ,
+.Nm NDHASGIANT
+.Nd pathname translation and lookup operations
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/fcntl.h
+.In sys/namei.h
+.Ft int
+.Fn namei "struct nameidata *ndp"
+.Ft void
+.Fo NDINIT
+.Fa "struct nameidata *ndp" "u_long op" "u_long flags"
+.Fa "enum uio_seg segflg" "const char *namep" "struct thread *td"
+.Fc
+.Ft void
+.Fn NDFREE "struct nameidata *ndp" "const uint flags"
+.Ft int
+.Fn NDHASGIANT "struct nameidata *ndp"
+.Sh DESCRIPTION
+The
+.Nm
+facility allows the client to perform pathname translation and lookup
+operations.
+The
+.Nm
+functions will increment the reference count for the vnode in question.
+The reference count has to be decremented after use of the vnode, by
+using either
+.Xr vrele 9
+or
+.Xr vput 9 ,
+depending on whether the
+.Dv LOCKLEAF
+flag was specified or not.
+If the
+.Va Giant
+lock is required,
+.Nm
+will acquire it if the caller indicates it is
+.Dv MPSAFE ,
+in which case the caller must later release
+.Va Giant
+based on the results of
+.Fn NDHASGIANT .
+.Pp
+The
+.Fn NDINIT
+function is used to initialize
+.Nm
+components.
+It takes the following arguments:
+.Bl -tag -width ".Fa segflg"
+.It Fa ndp
+The
+.Vt "struct nameidata"
+to initialize.
+.It Fa op
+The operation which
+.Fn namei
+will perform.
+The following operations are valid:
+.Dv LOOKUP , CREATE , DELETE ,
+and
+.Dv RENAME .
+The latter three are just setup for those
+effects; just calling
+.Fn namei
+will not result in
+.Fn VOP_RENAME
+being called.
+.It Fa flags
+Operation flags.
+Several of these can be effective at the same time.
+.It Fa segflg
+UIO segment indicator.
+This indicates if the name of the object is in userspace
+.Pq Dv UIO_USERSPACE
+or in the kernel address space
+.Pq Dv UIO_SYSSPACE .
+.It Fa namep
+Pointer to the component's pathname buffer
+(the file or directory name that will be looked up).
+.It Fa td
+The thread context to use for
+.Nm
+operations and locks.
+.El
+.Sh NAMEI OPERATION FLAGS
+The
+.Fn namei
+function takes the following set of
+.Dq "operation flags"
+that influence its operation:
+.Bl -tag -width ".Dv WANTPARENT"
+.It Dv LOCKLEAF
+Lock vnode on return.
+This is a full lock of the vnode; the
+.Xr VOP_UNLOCK 9
+should be used
+to release the lock (or
+.Xr vput 9
+which is equivalent to calling
+.Xr VOP_UNLOCK 9
+followed by
+.Xr vrele 9 ,
+all in one).
+.It Dv LOCKPARENT
+This flag lets the
+.Fn namei
+function return the parent (directory) vnode,
+.Va ni_dvp
+in locked state, unless it is identical to
+.Va ni_vp ,
+in which case
+.Va ni_dvp
+is not locked per se (but may be locked due to
+.Dv LOCKLEAF ) .
+If a lock is enforced, it should be released using
+.Xr vput 9
+or
+.Xr VOP_UNLOCK 9
+and
+.Xr vrele 9 .
+.It Dv WANTPARENT
+This flag allows the
+.Fn namei
+function to return the parent (directory) vnode in an unlocked state.
+The parent vnode must be released separately by using
+.Xr vrele 9 .
+.It Dv MPSAFE
+With this flag set,
+.Fn namei
+will conditionally acquire
+.Va Giant
+if it is required by a traversed file system.
+MPSAFE callers should pass the results of
+.Fn NDHASGIANT
+to
+.Xr VFS_UNLOCK_GIANT
+in order to conditionally release
+.Va Giant
+if necessary.
+.It Dv NOCACHE
+Avoid
+.Fn namei
+creating this entry in the namecache if it is not
+already present.
+Normally,
+.Fn namei
+will add entries to the name cache
+if they are not already there.
+.It Dv FOLLOW
+With this flag,
+.Fn namei
+will follow the symbolic link if the last part
+of the path supplied is a symbolic link (i.e., it will return a vnode
+for whatever the link points at, instead for the link itself).
+.It Dv NOFOLLOW
+Do not follow symbolic links (pseudo).
+This flag is not looked for by the actual code, which looks for
+.Dv FOLLOW .
+.Dv NOFOLLOW
+is used to indicate to the source code reader that symlinks
+are intentionally not followed.
+.It Dv SAVENAME
+Do not free the pathname buffer at the end of the
+.Fn namei
+invocation; instead, free it later in
+.Fn NDFREE
+so that the caller may access the pathname buffer.
+See below for details.
+.It Dv SAVESTART
+Retain an additional reference to the parent directory; do not free
+the pathname buffer.
+See below for details.
+.El
+.Sh ALLOCATED ELEMENTS
+The
+.Vt nameidata
+structure is composed of the following fields:
+.Bl -tag -width ".Va ni_cnd.cn_pnbuf"
+.It Va ni_startdir
+In the normal case, this is either the current directory or the root.
+It is the current directory if the name passed in does not start with
+.Ql /
+and we have not gone through any symlinks with an absolute path, and
+the root otherwise.
+.Pp
+In this case, it is only used by
+.Fn lookup ,
+and should not be
+considered valid after a call to
+.Fn namei .
+If
+.Dv SAVESTART
+is set, this is set to the same as
+.Va ni_dvp ,
+with an extra
+.Xr vref 9 .
+To block
+.Fn NDFREE
+from releasing
+.Va ni_startdir ,
+the
+.Dv NDF_NO_STARTDIR_RELE
+can be set.
+.It Va ni_dvp
+Vnode pointer to directory of the object on which lookup is performed.
+This is available on successful return if
+.Dv LOCKPARENT
+or
+.Dv WANTPARENT
+is set.
+It is locked if
+.Dv LOCKPARENT
+is set.
+Freeing this in
+.Fn NDFREE
+can be inhibited by
+.Dv NDF_NO_DVP_RELE , NDF_NO_DVP_PUT ,
+or
+.Dv NDF_NO_DVP_UNLOCK
+(with the obvious effects).
+.It Va ni_vp
+Vnode pointer to the resulting object,
+.Dv NULL
+otherwise.
+The
+.Va v_usecount
+field of this vnode is incremented.
+If
+.Dv LOCKLEAF
+is set, it is also locked.
+.Pp
+Freeing this in
+.Fn NDFREE
+can be inhibited by
+.Dv NDF_NO_VP_RELE , NDF_NO_VP_PUT ,
+or
+.Dv NDF_NO_VP_UNLOCK
+(with the obvious effects).
+.It Va ni_cnd.cn_pnbuf
+The pathname buffer contains the location of the file or directory
+that will be used by the
+.Nm
+operations.
+It is managed by the
+.Xr uma 9
+zone allocation interface.
+If the
+.Dv SAVESTART
+or
+.Dv SAVENAME
+flag is set, then the pathname buffer is available
+after calling the
+.Fn namei
+function.
+.Pp
+To only deallocate resources used by the pathname buffer,
+.Va ni_cnd.cn_pnbuf ,
+then
+.Dv NDF_ONLY_PNBUF
+flag can be passed to the
+.Fn NDFREE
+function.
+To keep the pathname buffer intact,
+the
+.Dv NDF_NO_FREE_PNBUF
+flag can be passed to the
+.Fn NDFREE
+function.
+.El
+.Sh RETURN VALUES
+If successful,
+.Fn namei
+will return 0, otherwise it will return an error.
+.Sh FILES
+.Bl -tag
+.It Pa src/sys/kern/vfs_lookup.c
+.El
+.Sh ERRORS
+Errors which
+.Fn namei
+may return:
+.Bl -tag -width Er
+.It Bq Er ENOTDIR
+A component of the specified pathname is not a directory when a directory is
+expected.
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeded 255 characters,
+or an entire pathname exceeded 1023 characters.
+.It Bq Er ENOENT
+A component of the specified pathname does not exist,
+or the pathname is an empty string.
+.It Bq Er EACCES
+An attempt is made to access a file in a way forbidden by its file access
+permissions.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname.
+.It Bq Er EISDIR
+An attempt is made to open a directory with write mode specified.
+.It Bq Er EINVAL
+The last component of the pathname specified for a
+.Dv DELETE
+or
+.Dv RENAME
+operation is
+.Ql \&. .
+.It Bq Er EROFS
+An attempt is made to modify a file or directory on a read-only file system.
+.El
+.Sh SEE ALSO
+.Xr uio 9 ,
+.Xr uma 9 ,
+.Xr VFS 9 ,
+.Xr VFS_UNLOCK_GIANT 9 ,
+.Xr vnode 9 ,
+.Xr vput 9 ,
+.Xr vref 9
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Eivind Eklund Aq eivind@FreeBSD.org
+and later significantly revised by
+.An Hiten M. Pandya Aq hmp@FreeBSD.org .
+.Sh BUGS
+The
+.Dv LOCKPARENT
+flag does not always result in the parent vnode being locked.
+This results in complications when the
+.Dv LOCKPARENT
+is used.
+In order to solve this for the cases where both
+.Dv LOCKPARENT
+and
+.Dv LOCKLEAF
+are used, it is necessary to resort to recursive locking.
+.Pp
+Non-MPSAFE file systems exist, requiring callers to conditionally unlock
+.Va Giant .
diff --git a/share/man/man9/netisr.9 b/share/man/man9/netisr.9
new file mode 100644
index 000000000000..bb64b0eb2c85
--- /dev/null
+++ b/share/man/man9/netisr.9
@@ -0,0 +1,221 @@
+.\"
+.\" Copyright (c) 2009 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 22, 2010
+.Dt NETISR 9
+.Os
+.Sh NAME
+.Nm netisr
+.Nd Kernel network dispatch service
+.Sh SYNOPSIS
+.In net/netisr.h
+.Ft void
+.Fn netisr_register "const struct netisr_handler *nhp"
+.Ft void
+.Fn netisr_unregister "const struct netisr_handler *nhp"
+.Ft int
+.Fn netisr_dispatch "u_int proto" "struct mbuf *m"
+.Ft int
+.Fn netisr_dispatch_src "u_int proto" "uintptr_t source" "struct mbuf *m"
+.Ft int
+.Fn netisr_queue "u_int proto" "struct mbuf *m"
+.Ft int
+.Fn netisr_queue_src "u_int proto" "uintptr_t source" "struct mbuf *m"
+.Ft void
+.Fn netisr_clearqdrops "const struct netisr_handler *nhp"
+.Ft void
+.Fn netisr_getqdrops "const struct netisr_handler *nhp" "uint64_t *qdropsp"
+.Ft void
+.Fn netisr_getqlimit "const struct netisr_handler *nhp" "u_int *qlimitp"
+.Ft int
+.Fn netisr_setqlimit "const struct netisr_handler *nhp" "u_int qlimit"
+.Ft u_int
+.Fn netisr_default_flow2cpu "u_int flowid"
+.Ft u_int
+.Fn netisr_get_cpucount "void"
+.Ft u_int
+.Fn netisr_get_cpuid "u_int cpunumber"
+.Sh DESCRIPTION
+The
+.Nm
+kernel interface suite allows device drivers (and other packet sources) to
+direct packets to protocols for directly dispatched or deferred processing.
+Protocol registration and work stream statistics may be monitored using
+.Xr netstat 1 .
+.Ss Protocol registration
+Protocols register and unregister handlers using
+.Fn netisr_register
+and
+.Fn netisr_unregister ,
+and may also manage queue limits and statistics using the
+.Fn netisr_clearqdrops ,
+.Fn netisr_getqdrops ,
+.Fn netisr_getqlimit ,
+and
+.Fn netisr_setqlimit.
+.Pp
+.Nm
+supports multi-processor execution of handlers, and relies on a combination
+of source ordering and protocol-specific ordering and work-placement
+policies to decide how do distribute work across one or more worker
+threads.
+Registering protocols will declare one of three policies:
+.Bl -tag -width NETISR_POLICY_SOURCE
+.It Dv NETISR_POLICY_SOURCE
+.Nm
+should maintain source ordering without advice from the protocol.
+.Nm
+will ignore any flow IDs present on
+.Vt mbuf
+headers for the purposes of work placement.
+.It Dv NETISR_POLICY_FLOW
+.Nm
+should maintain flow ordering as defined by the
+.Vt mbuf
+header flow ID field.
+If the protocol implements
+.Va nh_m2flow ,
+then
+.Nm
+will query the protocol in the event that the
+.Vt mbuf
+doesn't have a flow ID, falling back on source ordering.
+.It NETISR_POLICY_CPU
+.Nm
+will entirely delegate all work placement decisions to the protocol,
+querying
+.Va nh_m2cpuid
+for each packet.
+.El
+.Pp
+Registration is declared using
+.Vt "struct netisr_handler" ,
+whose fields are defined as follows:
+.Bl -tag -width "netisr_handler_t nh_handler"
+.It Vt "const char *" Va nh_name
+Unique character string name of the protocol, which may be included in
+.Xr sysctl 2
+MIB names, so should not contain whitespace.
+.It Vt netisr_handler_t Va nh_handler
+Protocol handler function that will be invoked on each packet received for
+the protocol.
+.It Vt netisr_m2flow_t Va nh_m2flow
+Optional protocol function to generate a flow ID and set
+.Dv M_FLOWID
+for packets that do not enter
+.Nm
+with
+.Dv M_FLOWID
+defined.
+Will be used only with
+.Dv NETISR_POLICY_FLOW .
+.It Vt netisr_m2cpuid_t Va nh_m2cpuid
+Protocol function to determine what CPU a packet should be processed on.
+Will be used only with
+.Dv NETISR_POLICY_CPU .
+.It Vt netisr_drainedcpu_t Va nh_drainedcpu
+Optional callback function that will be invoked when a per-CPU queue
+was drained.
+It will never fire for directly dispatched packets.
+Unless fully understood, this special-purpose function should not be used.
+.\" In case you intend to use this please send 50 chocolate bars to each
+.\" of rwatson and bz and wait for an answer.
+.It Vt u_int Va nh_proto
+Protocol number used by both protocols to identify themselves to
+.Nm ,
+and by packet sources to select what handler will be used to process
+packets.
+A table of supported protocol numbers appears below.
+For implementation reasons, protocol numbers great than 15 are currently
+unsupported.
+.It Vt u_int Va nh_qlimit
+The maximum per-CPU queue depth for the protocol; due to internal
+implementation details, the effective queue depth may be as much as twice
+this number.
+.It Vt u_int Va nh_policy
+The ordering and work placement policy for the protocol, as described
+earlier.
+.El
+.Ss Packet source interface
+Packet sources, such as network interfaces, may request protocol processing
+using the
+.Fn netisr_dispatch
+and
+.Fn netisr_queue
+interfaces.
+Both accept a protocol number and
+.Vt mbuf
+argument, but while
+.Fn netisr_queue
+will always execute the protocol handler asynchronously in a deferred
+context,
+.Fn netisr_dispatch
+will optionally direct dispatch if permitted by global and per-protocol
+policy.
+.Pp
+In order to provide additional load balancing and flow information,
+packet sources may also specify an opaque source identifier, which in
+practice might be a network interface number or socket pointer, using
+the
+.Fn netisr_dispatch_src
+and
+.Fn netisr_queue_src
+variants.
+.Ss Protocol number constants
+The follow protocol numbers are currently defined:
+.Bl -tag -width NETISR_ATALK1
+.It Dv NETISR_IP
+IPv4
+.It Dv NETISR_IGMP
+IGMPv3 loopback
+.It Dv NETISR_ROUTE
+Routing socket loopback
+.It Dv NETISR_AARP
+Appletalk AARP
+.It Dv NETISR_ATALK1
+Appletalk phase 1
+.It Dv NETISR_ATALK2
+Appletalk phase 2
+.It Dv NETISR_ARP
+ARP
+.It Dv NETISR_IPX
+IPX/SPX
+.It Dv NETISR_IPV6
+IPv6
+.It Dv NETISR_NATM
+ATM
+.It Dv NETISR_EPAIR
+.Xr netstat 1 ,
+.Xr epair 4
+.El
+.Sh AUTHORS
+This manual page and the
+.Nm
+implementation were written by
+.An Robert N. M. Watson .
diff --git a/share/man/man9/osd.9 b/share/man/man9/osd.9
new file mode 100644
index 000000000000..ba9c632e1d0c
--- /dev/null
+++ b/share/man/man9/osd.9
@@ -0,0 +1,390 @@
+.\"
+.\" Copyright (c) 2010 Lawrence Stewart <lstewart@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 5, 2011
+.Dt OSD 9
+.Os
+.Sh NAME
+.Nm osd ,
+.Nm osd_register ,
+.Nm osd_deregister ,
+.Nm osd_set ,
+.Nm osd_get ,
+.Nm osd_del ,
+.Nm osd_call ,
+.Nm osd_exit
+.Nd Object Specific Data
+.Sh SYNOPSIS
+.In sys/osd.h
+.Ft typedef void
+.Fn "\*(lp*osd_destructor_t\*(rp" "void *value"
+.Ft typedef int
+.Fn "\*(lp*osd_method_t\*(rp" "void *obj" "void *data"
+.Ft int
+.Fo osd_register
+.Fa "u_int type"
+.Fa "osd_destructor_t destructor"
+.Fa "osd_method_t *methods"
+.Fc
+.Ft void
+.Fo osd_deregister
+.Fa "u_int type"
+.Fa "u_int slot"
+.Fc
+.Ft int
+.Fo osd_set
+.Fa "u_int type"
+.Fa "struct osd *osd"
+.Fa "u_int slot"
+.Fa "void *value"
+.Fc
+.Ft void *
+.Fo osd_get
+.Fa "u_int type"
+.Fa "struct osd *osd"
+.Fa "u_int slot"
+.Fc
+.Ft void
+.Fo osd_del
+.Fa "u_int type"
+.Fa "struct osd *osd"
+.Fa "u_int slot"
+.Fc
+.Ft int
+.Fo osd_call
+.Fa "u_int type"
+.Fa "u_int method"
+.Fa "void *obj"
+.Fa "void *data"
+.Fc
+.Ft void
+.Fo osd_exit
+.Fa "u_int type"
+.Fa "struct osd *osd"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm
+framework provides a mechanism to dynamically associate arbitrary data at
+run-time with any kernel data structure which has been suitably modified for use
+with
+.Nm .
+The one-off modification required involves embedding a
+.Vt "struct osd"
+inside the kernel data structure.
+.Pp
+An additional benefit is that after the initial change to a structure is made,
+all subsequent use of
+.Nm
+with the structure involves no changes to the structure's layout.
+By extension, if the data structure is part of the ABI,
+.Nm
+provides a way of extending the structure in an ABI preserving manner.
+.Pp
+The details of the embedded
+.Vt "struct osd"
+are not relevant to consumers of the
+.Nm
+framework and should not be manipulated directly.
+.Pp
+Data associated with a structure is referenced by the
+.Nm
+framework using a type/slot identifier pair.
+Types are statically defined in
+.In sys/osd.h
+and provide a high-level grouping for slots to be registered under.
+Slot identifiers are dynamically assigned by the framework when a data type is
+registered using
+.Fn osd_register
+and remains valid until a corresponding call to
+.Fn osd_deregister .
+.Ss Functions
+The
+.Fn osd_register
+function registers a type/slot identifier pair with the
+.Nm
+framework for use with a new data type.
+The function may sleep and therefore cannot be called from a non-sleepable
+context.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+the slot identifier should be allocated under.
+The
+.Fa destructor
+argument specifies an optional osd_destructor_t function pointer that will be
+called for objects of the type being registered which are later destroyed by the
+.Fn osd_del
+function.
+NULL may be passed if no destructor is required.
+The
+.Fa methods
+argument specifies an optional array of osd_method_t function pointers which
+can be later invoked by the
+.Fn osd_call
+function.
+NULL may be passed if no methods are required.
+The
+.Fa methods
+argument is currently only useful with the OSD_JAIL type identifier.
+.Pp
+The
+.Fn osd_deregister
+function deregisters a previously registered type/slot identifier pair.
+The function may sleep and therefore cannot be called from a non-sleepable
+context.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+the slot identifier is allocated under.
+The
+.Fa slot
+argument specifies the slot identifier which is being deregistered and should be
+the value that was returned by
+.Fn osd_register
+when the data type was registered.
+.Pp
+The
+.Fn osd_set
+function associates a data object pointer with a kernel data structure's
+.Vt struct osd
+member.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+the slot identifier is allocated under.
+The
+.Fa osd
+argument is a pointer to the kernel data structure's
+.Vt struct osd
+which will have the
+.Fa value
+pointer associated with it.
+The
+.Fa slot
+argument specifies the slot identifier to assign the
+.Fa value
+pointer to.
+The
+.Fa value
+argument points to a data object to associate with
+.Fa osd .
+.Pp
+The
+.Fn osd_get
+function returns the data pointer associated with a kernel data structure's
+.Vt struct osd
+member from the specified type/slot identifier pair.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+the slot identifier is allocated under.
+The
+.Fa osd
+argument is a pointer to the kernel data structure's
+.Vt struct osd
+to retrieve the data pointer from.
+The
+.Fa slot
+argument specifies the slot identifier to retrieve the data pointer from.
+.Pp
+The
+.Fn osd_del
+function removes the data pointer associated with a kernel data structure's
+.Vt struct osd
+member from the specified type/slot identifier pair.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+the slot identifier is allocated under.
+The
+.Fa osd
+argument is a pointer to the kernel data structure's
+.Vt struct osd
+to remove the data pointer from.
+The
+.Fa slot
+argument specifies the slot identifier to remove the data pointer from.
+If an osd_destructor_t function pointer was specified at registration time, the
+destructor function will be called and passed the data pointer for the type/slot
+identifier pair which is being deleted.
+.Pp
+The
+.Fn osd_call
+function calls the specified osd_method_t function pointer for all
+currently registered slots of a given type on the specified
+.Fa obj
+and
+.Fa data
+pointers.
+The function may sleep and therefore cannot be called from a non-sleepable
+context.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+to call the method for.
+The
+.Fa method
+argument specifies the index into the osd_method_t array that was passed to
+.Fn osd_register .
+The
+.Fa obj
+and
+.Fa data
+arguments are passed to the method function pointer of each slot.
+.Pp
+The
+.Fn osd_exit
+function removes all data object pointers from all currently registered slots
+for a given type for the specified kernel data structure's
+.Vt struct osd
+member.
+The
+.Fa type
+argument specifies which high-level type grouping from
+.In sys/osd.h
+to remove data pointers from.
+The
+.Fa osd
+argument is a pointer to the kernel data structure's
+.Vt struct osd
+to remove all data object pointers for all currently registered slots from.
+.Sh IMPLEMENTATION NOTES
+.Nm
+uses a two dimensional matrix (array of arrays) as the data structure to manage
+the external data associated with a kernel data structure's
+.Vt struct osd
+member.
+The type identifier is used as the index into the outer array, and the slot
+identifier is used as the index into the inner array. To set or retrieve a data
+pointer for a given type/slot identifier pair,
+.Fn osd_set
+and
+.Fn osd_get
+perform the equivalent of array[type][slot], which is both constant time and
+fast.
+.Pp
+If
+.Fn osd_set
+is called on a
+.Vt struct osd
+for the first time, the array for storing data pointers is dynamically allocated
+using
+.Xr malloc 9
+with M_NOWAIT to a size appropriate for the slot identifier being set.
+If a subsequent call to
+.Fn osd_set
+attempts to set a slot identifier which is numerically larger than the slot used
+in the previous
+.Fn osd_set
+call,
+.Xr realloc 9
+is used to grow the array to the appropriate size such that the slot identifier
+can be used.
+To maximise the efficiency of any code which calls
+.Fn osd_set
+sequentially on a number of different slot identifiers (e.g. during an
+initialisation phase) one should loop through the slot identifiers in descending
+order from highest to lowest.
+This will result in only a single
+.Xr malloc 9
+call to create an array of the largest slot size and all subsequent calls to
+.Fn osd_set
+will proceed without any
+.Xr realloc 9
+calls.
+.Pp
+The
+.Nm
+API is geared towards slot identifiers storing pointers to the same underlying
+data structure type for a given
+.Nm
+type identifier.
+This is not a requirement, and
+.Xr khelp 9
+for example stores completely different data types in slots under the OSD_KHELP
+type identifier.
+.Ss Locking
+.Nm
+internally uses a mix of
+.Xr mutex 9 ,
+.Xr rmlock 9
+and
+.Xr sx 9
+locks to protect its internal data structures and state.
+.Pp
+Responsibility for synchronising access to a kernel data structure's
+.Vt struct osd
+member is left to the subsystem that uses the data structure and calls the
+.Nm
+API.
+.Pp
+.Fn osd_get
+only acquires an
+.Xr rmlock
+in read mode, therefore making it safe to use in the majority of contexts within
+the kernel including most fast paths.
+.Sh RETURN VALUES
+.Fn osd_register
+returns the slot identifier for the newly registered data type.
+.Pp
+.Fn osd_set
+returns zero on success or ENOMEM if the specified type/slot identifier pair
+triggered an internal
+.Xr realloc 9
+which failed.
+.Pp
+.Fn osd_get
+returns the data pointer for the specified type/slot identifier pair, or NULL if
+the slot has not been initialised yet.
+.Pp
+.Fn osd_call
+returns zero if no method is run or the method for each slot runs successfully.
+If a method for a slot returns non-zero,
+.Fn osd_call
+terminates prematurely and returns the method's error to the caller.
+.Sh SEE ALSO
+.Xr khelp 9
+.Sh HISTORY
+The
+Object Specific Data (OSD) facility first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Lawrence Stewart Aq lstewart@FreeBSD.org .
diff --git a/share/man/man9/p_candebug.9 b/share/man/man9/p_candebug.9
new file mode 100644
index 000000000000..722052a8c04d
--- /dev/null
+++ b/share/man/man9/p_candebug.9
@@ -0,0 +1,138 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 19, 2006
+.Dt P_CANDEBUG 9
+.Os
+.Sh NAME
+.Nm p_candebug
+.Nd determine debuggability of a process
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft int
+.Fn p_candebug "struct thread *td" "struct proc *p"
+.Sh DESCRIPTION
+This function can be used to determine if a given process
+.Fa p
+is debuggable by the thread
+.Fa td .
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variables directly influence the behaviour of
+.Fn p_candebug :
+.Bl -tag -width indent
+.It Va kern.securelevel
+Debugging of the init process is not allowed if this variable is
+.Li 1
+or greater.
+.It Va security.bsd.unprivileged_proc_debug
+Must be set to a non-zero value to allow unprivileged processes
+access to the kernel's debug facilities.
+.El
+.Sh RETURN VALUES
+The
+.Fn p_candebug
+function
+returns
+.Li 0
+if the process denoted by
+.Fa p
+is debuggable by thread
+.Fa td ,
+or a non-zero error return value otherwise.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCESS
+The MAC subsystem denied debuggability.
+.It Bq Er EAGAIN
+Process
+.Fa p
+is in the process of being
+.Fn exec Ns 'ed.
+.It Bq Er EPERM
+Thread
+.Fa td
+lacks super-user credentials and process
+.Fa p
+is executing a set-user-ID or set-group-ID executable.
+.It Bq Er EPERM
+Thread
+.Fa td
+lacks super-user credentials and process
+.Fa p Ns 's
+group set is not a subset of
+.Fa td Ns 's
+effective group set.
+.It Bq Er EPERM
+Thread
+.Fa td
+lacks super-user credentials and process
+.Fa p Ns 's
+user IDs do not match thread
+.Fa td Ns 's
+effective user ID.
+.It Bq Er EPERM
+Process
+.Fa p
+denotes the initial process
+.Fn initproc
+and the
+.Xr sysctl 8
+variable
+.Va kern.securelevel
+is greater than zero.
+.It Bq Er ESRCH
+Process
+.Fa p
+is not visible to thread
+.Fa td
+as determined by
+.Xr cr_seeotheruids 9
+or
+.Xr cr_seeothergids 9 .
+.It Bq Er ESRCH
+Thread
+.Fa td
+has been jailed and process
+.Fa p
+does not belong to the same jail as
+.Fa td .
+.It Bq Er ESRCH
+The MAC subsystem denied debuggability.
+.El
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr sysctl 8 ,
+.Xr cr_seeothergids 9 ,
+.Xr cr_seeotheruids 9 ,
+.Xr mac 9 ,
+.Xr p_cansee 9 ,
+.Xr prison_check 9
diff --git a/share/man/man9/p_cansee.9 b/share/man/man9/p_cansee.9
new file mode 100644
index 000000000000..b94ec30ac103
--- /dev/null
+++ b/share/man/man9/p_cansee.9
@@ -0,0 +1,93 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
+.\" Copyright (c) 2006 Ceri Davies <ceri@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 19, 2006
+.Dt P_CANSEE 9
+.Os
+.Sh NAME
+.Nm p_cansee
+.Nd determine visibility of a process
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft int
+.Fn p_cansee "struct thread *td" "struct proc *p"
+.Sh DESCRIPTION
+This function can be used to determine if a given process
+.Fa p
+is visible to the thread
+.Fa td ,
+where the notion of
+.Dq visibility
+may be read as
+.Dq "awareness of existence" .
+.Pp
+The function is implemented using
+.Xr cr_cansee 9 ,
+and the dependencies on
+.Xr sysctl 8
+variables documented in the
+.Xr cr_cansee 9
+manual page apply.
+.Sh RETURN VALUES
+The
+.Fn p_cansee
+function
+returns
+.Li 0
+if the process denoted by
+.Fa p
+is visible by thread
+.Fa td ,
+or a non-zero error return value otherwise.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ESRCH
+Process
+.Fa p
+is not visible to thread
+.Fa td
+as determined by
+.Xr cr_cansee 9 .
+.It Bq Er ESRCH
+Thread
+.Fa td
+has been jailed and process
+.Fa p
+does not belong to the same jail as
+.Fa td .
+.It Bq Er ESRCH
+The MAC subsystem denied visibility.
+.El
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr sysctl 8 ,
+.Xr cr_cansee 9 ,
+.Xr mac 9 ,
+.Xr p_candebug 9 ,
+.Xr prison_check 9
diff --git a/share/man/man9/panic.9 b/share/man/man9/panic.9
new file mode 100644
index 000000000000..44439dd913b0
--- /dev/null
+++ b/share/man/man9/panic.9
@@ -0,0 +1,70 @@
+.\" $NetBSD: panic.9,v 1.2 1996/10/09 17:20:04 explorer Exp $
+.\"
+.\" Copyright (c) 1996 Michael Graff.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Michael Graff
+.\" for the NetBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 11, 1995
+.Dt PANIC 9
+.Os
+.Sh NAME
+.Nm panic
+.Nd bring down system on fatal error
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft void
+.Fn panic "const char *fmt" ...
+.Sh DESCRIPTION
+The
+.Fn panic
+function terminates the running system.
+The message
+.Fa fmt
+is a
+.Xr printf 3
+style format string.
+The message is printed to the console and the location
+.Fa panicstr
+is set to the address of the message text for retrieval from the OS
+core dump.
+.Pp
+If the kernel debugger is installed control is passed to it, otherwise
+an attempt to save a core dump of the OS to a configured dump device
+is made.
+.Pp
+If
+.Fn panic
+is called twice (from the disk sync routines, for example) the system is
+rebooted without syncing the disks.
+.Sh RETURN VALUES
+The
+.Fn panic
+function does not return.
diff --git a/share/man/man9/pbuf.9 b/share/man/man9/pbuf.9
new file mode 100644
index 000000000000..4329ac9c84fe
--- /dev/null
+++ b/share/man/man9/pbuf.9
@@ -0,0 +1,132 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt PBUF 9
+.Os
+.Sh NAME
+.Nm pbuf ,
+.Nm getpbuf ,
+.Nm trypbuf ,
+.Nm relpbuf
+.Nd "functions for managing physical buffers"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft "struct buf *"
+.Fn getpbuf "int *pfreecnt"
+.Ft "struct buf *"
+.Fn trypbuf "int *pfreecnt"
+.Ft void
+.Fn relpbuf "struct buf *bp" "int *pfreecnt"
+.Sh DESCRIPTION
+These functions are used to allocate and release physical buffers.
+.Pp
+The physical buffers are allocated at system startup and are
+maintained in a separate pool from the main system buffers.
+They are intended for use by subsystems that cannot or should not be
+reliant on the main pool of buffers (for example the swap pager).
+The system allocates between 16 and 256 physical buffers depending
+on the amount of memory in the system.
+.Pp
+Each subsystem that allocates buffers via these calls is expected
+to manage its own percentage free counter.
+If the value is initialized to \-1 the number of buffers available
+to the subsystem is limited only by the number of physical buffers
+available.
+The number of buffers is stored in
+.Va nswbuf
+which is defined in
+.In sys/buf.h
+and initialized in
+.Fn cpu_startup .
+A recommended initialization value is 1/2
+.Va nswbuf .
+.Pp
+The
+.Fn getpbuf
+function returns the first available buffer to the user.
+If there are no buffers available,
+.Fn getpbuf
+will sleep waiting for one to become available.
+If
+.Fa pfreecnt
+is zero,
+.Fn getpbuf
+will sleep until it increases.
+.Fa pfreecnt
+is decremented prior to returning.
+.Pp
+The
+.Fn trypbuf
+function returns the first available buffer.
+If there are no buffers available,
+.Dv NULL
+is returned.
+As well, if
+.Fa pfreecnt
+is zero,
+.Dv NULL
+is returned.
+.Fa pfreecnt
+is decremented prior to returning a valid buffer.
+If
+.Dv NULL
+is returned,
+.Fa pfreecnt
+is not modified.
+.Pp
+The
+.Fn relpbuf
+function releases the buffer back to the free list.
+If the buffers
+.Va b_rcred
+or
+.Va b_wcred
+structures are not
+.Dv NULL ,
+they are freed.
+See
+.Xr crfree 9 .
+.Pp
+.Fa pfreecnt
+is incremented prior to returning.
+.Sh RETURN VALUES
+.Fn getpbuf
+and
+.Fn trypbuf
+return a pointer to the buffer.
+In the case of
+.Fn trypbuf ,
+.Dv NULL
+can also be returned indicating that there are no buffers available.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9
new file mode 100644
index 000000000000..4089ee8430ed
--- /dev/null
+++ b/share/man/man9/pci.9
@@ -0,0 +1,706 @@
+.\"
+.\" Copyright (c) 2005 Bruce M Simpson <bms@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 5, 2012
+.Dt PCI 9
+.Os
+.Sh NAME
+.Nm pci ,
+.Nm pci_alloc_msi ,
+.Nm pci_alloc_msix ,
+.Nm pci_disable_busmaster ,
+.Nm pci_disable_io ,
+.Nm pci_enable_busmaster ,
+.Nm pci_enable_io ,
+.Nm pci_find_bsf ,
+.Nm pci_find_cap ,
+.Nm pci_find_dbsf ,
+.Nm pci_find_device ,
+.Nm pci_find_extcap ,
+.Nm pci_find_htcap ,
+.Nm pci_get_max_read_req ,
+.Nm pci_get_powerstate ,
+.Nm pci_get_vpd_ident ,
+.Nm pci_get_vpd_readonly ,
+.Nm pci_msi_count ,
+.Nm pci_msix_count ,
+.Nm pci_pending_msix ,
+.Nm pci_read_config ,
+.Nm pci_release_msi ,
+.Nm pci_remap_msix ,
+.Nm pci_restore_state ,
+.Nm pci_save_state ,
+.Nm pci_set_max_read_req ,
+.Nm pci_set_powerstate ,
+.Nm pci_write_config
+.Nd PCI bus interface
+.Sh SYNOPSIS
+.In sys/bus.h
+.In dev/pci/pcireg.h
+.In dev/pci/pcivar.h
+.Ft int
+.Fn pci_alloc_msi "device_t dev" "int *count"
+.Ft int
+.Fn pci_alloc_msix "device_t dev" "int *count"
+.Ft int
+.Fn pci_disable_busmaster "device_t dev"
+.Ft int
+.Fn pci_disable_io "device_t dev" "int space"
+.Ft int
+.Fn pci_enable_busmaster "device_t dev"
+.Ft int
+.Fn pci_enable_io "device_t dev" "int space"
+.Ft device_t
+.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func"
+.Ft int
+.Fn pci_find_cap "device_t dev" "int capability" "int *capreg"
+.Ft device_t
+.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func"
+.Ft device_t
+.Fn pci_find_device "uint16_t vendor" "uint16_t device"
+.Ft int
+.Fn pci_find_extcap "device_t dev" "int capability" "int *capreg"
+.Ft int
+.Fn pci_find_htcap "device_t dev" "int capability" "int *capreg"
+.Ft int
+.Fn pci_get_max_read_req "device_t dev"
+.Ft int
+.Fn pci_get_powerstate "device_t dev"
+.Ft int
+.Fn pci_get_vpd_ident "device_t dev" "const char **identptr"
+.Ft int
+.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr"
+.Ft int
+.Fn pci_msi_count "device_t dev"
+.Ft int
+.Fn pci_msix_count "device_t dev"
+.Ft int
+.Fn pci_pending_msix "device_t dev" "u_int index"
+.Ft uint32_t
+.Fn pci_read_config "device_t dev" "int reg" "int width"
+.Ft int
+.Fn pci_release_msi "device_t dev"
+.Ft int
+.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors"
+.Ft void
+.Fn pci_restore_state "device_t dev"
+.Ft void
+.Fn pci_save_state "device_t dev"
+.Ft int
+.Fn pci_set_max_read_req "device_t dev" "int size"
+.Ft int
+.Fn pci_set_powerstate "device_t dev" "int state"
+.Ft void
+.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width"
+.Sh DESCRIPTION
+The
+.Nm
+set of functions are used for managing PCI devices.
+The functions are split into several groups:
+raw configuration access,
+locating devices,
+device information,
+device configuration,
+and
+message signaled interrupts.
+.Ss Raw Configuration Access
+The
+.Fn pci_read_config
+function is used to read data from the PCI configuration
+space of the device
+.Fa dev ,
+at offset
+.Fa reg ,
+with
+.Fa width
+specifying the size of the access.
+.Pp
+The
+.Fn pci_write_config
+function is used to write the value
+.Fa val
+to the PCI configuration
+space of the device
+.Fa dev ,
+at offset
+.Fa reg ,
+with
+.Fa width
+specifying the size of the access.
+.Pp
+.Em NOTE :
+Device drivers should only use these functions for functionality that
+is not available via another
+.Fn pci
+function.
+.Ss Locating Devices
+The
+.Fn pci_find_bsf
+function looks up the
+.Vt device_t
+of a PCI device, given its
+.Fa bus ,
+.Fa slot ,
+and
+.Fa func .
+The
+.Fa slot
+number actually refers to the number of the device on the bus,
+which does not necessarily indicate its geographic location
+in terms of a physical slot.
+Note that in case the system has multiple PCI domains,
+the
+.Fn pci_find_bsf
+function only searches the first one.
+Actually, it is equivalent to:
+.Bd -literal -offset indent
+pci_find_dbsf(0, bus, slot, func);
+.Ed
+.Pp
+The
+.Fn pci_find_dbsf
+function looks up the
+.Vt device_t
+of a PCI device, given its
+.Fa domain ,
+.Fa bus ,
+.Fa slot ,
+and
+.Fa func .
+The
+.Fa slot
+number actually refers to the number of the device on the bus,
+which does not necessarily indicate its geographic location
+in terms of a physical slot.
+.Pp
+The
+.Fn pci_find_device
+function looks up the
+.Vt device_t
+of a PCI device, given its
+.Fa vendor
+and
+.Fa device
+IDs.
+Note that there can be multiple matches for this search; this function
+only returns the first matching device.
+.Ss Device Information
+The
+.Fn pci_find_cap
+function is used to locate the first instance of a PCI capability
+register set for the device
+.Fa dev .
+The capability to locate is specified by ID via
+.Fa capability .
+Constant macros of the form
+.Dv PCIY_xxx
+for standard capability IDs are defined in
+.In dev/pci/pcireg.h .
+If the capability is found, then
+.Fa *capreg
+is set to the offset in configuration space of the capability register set,
+and
+.Fn pci_find_cap
+returns zero.
+If the capability is not found or the device does not support capabilities,
+.Fn pci_find_cap
+returns an error.
+.Pp
+The
+.Fn pci_find_extcap
+function is used to locate the first instance of a PCI-express
+extended capability register set for the device
+.Fa dev .
+The extended capability to locate is specified by ID via
+.Fa capability .
+Constant macros of the form
+.Dv PCIZ_xxx
+for standard extended capability IDs are defined in
+.In dev/pci/pcireg.h .
+If the extended capability is found, then
+.Fa *capreg
+is set to the offset in configuration space of the extended capability
+register set, and
+.Fn pci_find_extcap
+returns zero.
+If the extended capability is not found or the device is not a
+PCI-express device,
+.Fn pci_find_extcap
+returns an error.
+.Pp
+The
+.Fn pci_find_htcap
+function is used to locate the first instance of a HyperTransport capability
+register set for the device
+.Fa dev .
+The capability to locate is specified by type via
+.Fa capability .
+Constant macros of the form
+.Dv PCIM_HTCAP_xxx
+for standard HyperTransport capability types are defined in
+.In dev/pci/pcireg.h .
+If the capability is found, then
+.Fa *capreg
+is set to the offset in configuration space of the capability register set,
+and
+.Fn pci_find_htcap
+returns zero.
+If the capability is not found or the device is not a HyperTransport device,
+.Fn pci_find_htcap
+returns an error.
+.Pp
+The
+.Fn pci_get_vpd_ident
+function is used to fetch a device's Vital Product Data
+.Pq VPD
+identifier string.
+If the device
+.Fa dev
+supports VPD and provides an identifier string,
+then
+.Fa *identptr
+is set to point at a read-only, null-terminated copy of the identifier
+string,
+and
+.Fn pci_get_vpd_ident
+returns zero.
+If the device does not support VPD or does not provide an identifier
+string,
+then
+.Fn pci_get_vpd_ident
+returns an error.
+.Pp
+The
+.Fn pci_get_vpd_readonly
+function is used to fetch the value of a single VPD read-only keyword
+for the device
+.Fa dev .
+The keyword to fetch is identified by the two character string
+.Fa kw .
+If the device supports VPD and provides a read-only value for the
+requested keyword,
+then
+.Fa *vptr
+is set to point at a read-only, null-terminated copy of the value,
+and
+.Fn pci_get_vpd_readonly
+returns zero.
+If the device does not support VPD or does not provide the requested
+keyword,
+then
+.Fn pci_get_vpd_readonly
+returns an error.
+.Ss Device Configuration
+The
+.Fn pci_enable_busmaster
+function enables PCI bus mastering for the device
+.Fa dev ,
+by setting the
+.Dv PCIM_CMD_BUSMASTEREN
+bit in the
+.Dv PCIR_COMMAND
+register.
+The
+.Fn pci_disable_busmaster
+function clears this bit.
+.Pp
+The
+.Fn pci_enable_io
+function enables memory or I/O port address decoding for the device
+.Fa dev ,
+by setting the
+.Dv PCIM_CMD_MEMEN
+or
+.Dv PCIM_CMD_PORTEN
+bit in the
+.Dv PCIR_COMMAND
+register appropriately.
+The
+.Fn pci_disable_io
+function clears the appropriate bit.
+The
+.Fa space
+argument specifies which resource is affected; this can be either
+.Dv SYS_RES_MEMORY
+or
+.Dv SYS_RES_IOPORT
+as appropriate.
+Device drivers should generally not use these routines directly.
+The PCI bus will enable decoding automatically when a
+.Dv SYS_RES_MEMORY
+or
+.Dv SYS_RES_IOPORT
+resource is activated via
+.Xr bus_alloc_resource 9
+or
+.Xr bus_activate_resource 9 .
+.Pp
+The
+.Fn pci_get_max_read_req
+function returns the current maximum read request size in bytes for a
+PCI-express device.
+If the
+.Fa dev
+device is not a PCI-express device,
+.Fn pci_get_max_read_req
+returns zero.
+.Pp
+The
+.Fn pci_set_max_read_req
+sets the PCI-express maximum read request size for
+.Fa dev .
+The requested
+.Fa size
+may be adjusted,
+and
+.Fn pci_set_max_read_req
+returns the actual size set in bytes.
+If the
+.Fa dev
+device is not a PCI-express device,
+.Fn pci_set_max_read_req
+returns zero.
+.Pp
+The
+.Fn pci_get_powerstate
+function returns the current power state of the device
+.Fa dev .
+If the device does not support power management capabilities, then the default
+state of
+.Dv PCI_POWERSTATE_D0
+is returned.
+The following power states are defined by PCI:
+.Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN"
+.It Dv PCI_POWERSTATE_D0
+State in which device is on and running.
+It is receiving full power from the system and delivering
+full functionality to the user.
+.It Dv PCI_POWERSTATE_D1
+Class-specific low-power state in which device context may or
+may not be lost.
+Busses in this state cannot do anything to the bus, to
+force devices to lose context.
+.It Dv PCI_POWERSTATE_D2
+Class-specific low-power state in which device context may or
+may not be lost.
+Attains greater power savings than
+.Dv PCI_POWERSTATE_D1 .
+Busses in this state can cause devices to lose some context.
+Devices
+.Em must
+be prepared for the bus to be in this state or higher.
+.It Dv PCI_POWERSTATE_D3
+State in which the device is off and not running.
+Device context is lost, and power from the device can
+be removed.
+.It Dv PCI_POWERSTATE_UNKNOWN
+State of the device is unknown.
+.El
+.Pp
+The
+.Fn pci_set_powerstate
+function is used to transition the device
+.Fa dev
+to the PCI power state
+.Fa state .
+If the device does not support power management capabilities or
+it does not support the specific power state
+.Fa state ,
+then the function will fail with
+.Er EOPNOTSUPP .
+.Pp
+The
+.Fn pci_save_state
+and
+.Fn pci_restore_state
+functions can be used by a device driver to save and restore standard PCI
+config registers.
+The
+.Fn pci_save_state
+function must be invoked while the device has valid state before
+.Fn pci_restore_state
+can be used.
+If the device is not in the fully-powered state
+.Pq Dv PCI_POWERSTATE_D0
+when
+.Fn pci_restore_state
+is invoked,
+then the device will be transitioned to
+.Dv PCI_POWERSTATE_D0
+before any config registers are restored.
+.Ss Message Signaled Interrupts
+Message Signaled Interrupts
+.Pq MSI
+and
+Enhanced Message Signaled Interrupts
+.Pq MSI-X
+are PCI capabilities that provide an alternate method for PCI
+devices to signal interrupts.
+The legacy INTx interrupt is available to PCI devices as a
+.Dv SYS_RES_IRQ
+resource with a resource ID of zero.
+MSI and MSI-X interrupts are available to PCI devices as one or more
+.Dv SYS_RES_IRQ
+resources with resource IDs greater than zero.
+A driver must ask the PCI bus to allocate MSI or MSI-X interrupts
+using
+.Fn pci_alloc_msi
+or
+.Fn pci_alloc_msix
+before it can use MSI or MSI-X
+.Dv SYS_RES_IRQ
+resources.
+A driver is not allowed to use the legacy INTx
+.Dv SYS_RES_IRQ
+resource if MSI or MSI-X interrupts have been allocated,
+and attempts to allocate MSI or MSI-X interrupts will fail if the
+driver is currently using the legacy INTx
+.Dv SYS_RES_IRQ
+resource.
+A driver is only allowed to use either MSI or MSI-X,
+but not both.
+.Pp
+The
+.Fn pci_count_msi
+function returns the maximum number of MSI messages supported by the
+device
+.Fa dev.
+If the device does not support MSI,
+then
+.Fn pci_count_msi
+returns zero.
+.Pp
+The
+.Fn pci_alloc_msi
+function attempts to allocate
+.Fa *count
+MSI messages for the device
+.Fa dev .
+The
+.Fn pci_alloc_msi
+function may allocate fewer messages than requested for various
+reasons including requests for more messages than the device
+.Fa dev
+supports,
+or if the system has a shortage of available MSI messages.
+On success,
+.Fa *count
+is set to the number of messages allocated and
+.Fn pci_alloc_msi
+returns zero.
+The
+.Dv SYS_RES_IRQ
+resources for the allocated messages will be available at consecutive
+resource IDs beginning with one.
+If
+.Fn pci_alloc_msi
+is not able to allocate any messages,
+it returns an error.
+Note that MSI only supports message counts that are powers of two;
+requests to allocate a non-power of two count of messages will fail.
+.Pp
+The
+.Fn pci_release_msi
+function is used to release any allocated MSI or MSI-X messages back
+to the system.
+If any MSI or MSI-X
+.Dv SYS_RES_IRQ
+resources are allocated by the driver or have a configured interrupt
+handler,
+this function will fail with
+.Er EBUSY .
+The
+.Fn pci_release_msi
+function returns zero on success and an error on failure.
+.Pp
+The
+.Fn pci_count_msix
+function returns the maximum number of MSI-X messages supported by the
+device
+.Fa dev .
+If the device does not support MSI-X,
+then
+.Fn pci_count_msix
+returns zero.
+.Pp
+The
+.Fn pci_alloc_msix
+function attempts to allocate
+.Fa *count
+MSI-X messages for the device
+.Fa dev .
+The
+.Fn pci_alloc_msix
+function may allocate fewer messages than requested for various
+reasons including requests for more messages than the device
+.Fa dev
+supports,
+or if the system has a shortage of available MSI-X messages.
+On success,
+.Fa *count
+is set to the number of messages allocated and
+.Fn pci_alloc_msix
+returns zero.
+For MSI-X messages,
+the resource ID for each
+.Dv SYS_RES_IRQ resource identifies the index in the MSI-X table of the
+corresponding message.
+A resource ID of one maps to the first index of the MSI-X table;
+a resource ID two identifies the second index in the table, etc.
+The
+.Fn pci_alloc_msix
+function assigns the
+.Fa *count
+messages allocated to the first
+.Fa *count
+table indicies.
+If
+.Fn pci_alloc_msix
+is not able to allocate any messages,
+it returns an error.
+Unlike MSI,
+MSI-X does not require message counts that are powers of two.
+.Pp
+The
+.Fn pci_pending_msix
+function examines the
+.Fa dev
+device's Pending Bit Array
+.Pq PBA
+to determine the pending status of the MSI-X message at table index
+.Fa index .
+If the indicated message is pending,
+this function returns a non-zero value;
+otherwise,
+it returns zero.
+Passing an invalid
+.Fa index
+to this function will result in undefined behavior.
+.Pp
+As mentioned in the description of
+.Fn pci_alloc_msix ,
+MSI-X messages are initially assigned to the first N table entries.
+A driver may use a different distribution of available messages to
+table entries via the
+.Fn pci_remap_msix
+function.
+Note that this function must be called after a succesful call to
+.Fn pci_alloc_msix
+but before any of the
+.Dv SYS_RES_IRQ
+resources are allocated.
+The
+.Fn pci_remap_msix
+function returns zero on success,
+or an error on failure.
+.Pp
+The
+.Fa vectors
+array should contain
+.Fa count
+message vectors.
+The array maps directly to the MSI-X table in that the first entry in
+the array specifies the message used for the first entry in the MSI-X
+table,
+the second entry in the array corresponds to the second entry in the
+MSI-X table,
+etc.
+The vector value in each array index can either be zero to indicate
+that no message should be assigned to the corresponding MSI-X table entry,
+or it can be a number from one to N
+.Po
+where N is the count returned from the previous call to
+.Fn pci_alloc_msix
+.Pc
+to indicate which of the allocated messages should be assigned to the
+corresponding MSI-X table entry.
+.Pp
+If
+.Fn pci_remap_msix
+succeeds,
+each MSI-X table entry with a non-zero vector will have an associated
+.Dv SYS_RES_IRQ
+resource whose resource ID corresponds to the table index as described
+above for
+.Fn pci_alloc_msix .
+MSI-X table entries that with a vector of zero will not have an
+associated
+.Dv SYS_RES_IRQ resource.
+Additionally,
+if any of the original messages allocated by
+.Fn pci_alloc_msix
+are not used in the new distribution of messages in the MSI-X table,
+they will be released automatically.
+Note that if a driver wishes to use fewer messages than were allocated by
+.Fn pci_alloc_msix ,
+the driver must use a single, contiguous range of messages beginning
+with one in the new distribution.
+The
+.Fn pci_remap_msix
+function will fail if this condition is not met.
+.Sh IMPLEMENTATION NOTES
+The
+.Vt pci_addr_t
+type varies according to the size of the PCI bus address
+space on the target architecture.
+.Sh SEE ALSO
+.Xr pci 4 ,
+.Xr pciconf 8 ,
+.Xr bus_alloc_resource 9 ,
+.Xr bus_dma 9 ,
+.Xr bus_release_resource 9 ,
+.Xr bus_setup_intr 9 ,
+.Xr bus_teardown_intr 9 ,
+.Xr devclass 9 ,
+.Xr device 9 ,
+.Xr driver 9 ,
+.Xr rman 9
+.Rs
+.%B FreeBSD Developers' Handbook
+.%T NewBus
+.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/
+.Re
+.Rs
+.%A Shanley
+.%A Anderson
+.%B PCI System Architecture
+.%N 2nd Edition
+.%I Addison-Wesley
+.%O ISBN 0-201-30974-2
+.Re
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@FreeBSD.org
+and
+.An John Baldwin Aq jhb@FreeBSD.org .
+.Sh BUGS
+The kernel PCI code has a number of references to
+.Dq "slot numbers" .
+These do not refer to the geographic location of PCI devices,
+but to the device number assigned by the combination of the PCI IDSEL
+mechanism and the platform firmware.
+This should be taken note of when working with the kernel PCI code.
diff --git a/share/man/man9/pfil.9 b/share/man/man9/pfil.9
new file mode 100644
index 000000000000..e0df8c96d58d
--- /dev/null
+++ b/share/man/man9/pfil.9
@@ -0,0 +1,216 @@
+.\" $NetBSD: pfil.9,v 1.22 2003/07/01 13:04:06 wiz Exp $
+.\"
+.\" Copyright (c) 1996 Matthew R. Green
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 29, 2004
+.Dt PFIL 9
+.Os
+.Sh NAME
+.Nm pfil ,
+.Nm pfil_head_register ,
+.Nm pfil_head_unregister ,
+.Nm pfil_head_get ,
+.Nm pfil_hook_get ,
+.Nm pfil_add_hook ,
+.Nm pfil_remove_hook ,
+.Nm pfil_run_hooks
+.Nd packet filter interface
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mbuf.h
+.In net/if.h
+.In net/pfil.h
+.Ft int
+.Fn pfil_head_register "struct pfil_head *head"
+.Ft int
+.Fn pfil_head_unregister "struct pfil_head *head"
+.Ft "struct pfil_head *"
+.Fn pfil_head_get "int af" "u_long dlt"
+.Ft "struct packet_filter_hook *"
+.Fn pfil_hook_get "int dir" "struct pfil_head *head"
+.Ft void
+.Fn pfil_add_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *"
+.Ft void
+.Fn pfil_remove_hook "int (*func)()" "void *arg" "int flags" "struct pfil_head *"
+.Ft int
+.Fn (*func) "void *arg" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *"
+.Ft int
+.Fn pfil_run_hooks "struct pfil_head *head" "struct mbuf **mp" "struct ifnet *" "int dir" "struct inpcb *"
+.Sh DESCRIPTION
+The
+.Nm
+framework allows for a specified function to be invoked for every
+incoming or outgoing packet for a particular network I/O stream.
+These hooks may be used to implement a firewall or perform packet
+transformations.
+.Pp
+Packet filtering points are registered with
+.Fn pfil_head_register .
+Filtering points are identified by a key
+.Pq Vt "void *"
+and a data link type
+.Pq Vt int
+in the
+.Vt pfil_head
+structure.
+Packet filters use the key and data link type to look up the filtering
+point with which they register themselves.
+The key is unique to the filtering point.
+The data link type is a
+.Xr bpf 4
+DLT constant indicating what kind of header is present on the packet
+at the filtering point.
+Filtering points may be unregistered with the
+.Fn pfil_head_unregister
+function.
+.Pp
+Packet filters register/unregister themselves with a filtering point
+with the
+.Fn pfil_add_hook
+and
+.Fn pfil_remove_hook
+functions, respectively.
+The head is looked up using the
+.Fn pfil_head_get
+function, which takes the key and data link type that the packet filter
+expects.
+Filters may provide an argument to be passed to the filter when
+invoked on a packet.
+.Pp
+When a filter is invoked, the packet appears just as if it
+.Dq came off the wire .
+That is, all protocol fields are in network byte order.
+The filter is called with its specified argument, the pointer to the
+pointer to the
+.Vt mbuf
+containing the packet, the pointer to the network
+interface that the packet is traversing, and the direction
+.Dv ( PFIL_IN
+or
+.Dv PFIL_OUT )
+that the packet is traveling.
+The filter may change which mbuf the
+.Vt "mbuf\ **"
+argument references.
+The filter returns an error (errno) if the packet processing is to stop, or 0
+if the processing is to continue.
+If the packet processing is to stop, it is the responsibility of the
+filter to free the packet.
+.Sh RETURN VALUES
+If successful,
+.Fn pfil_head_get
+returns the
+.Vt pfil_head
+structure for the given key/dlt.
+The
+.Fn pfil_add_hook
+and
+.Fn pfil_remove_hook
+functions
+return 0 if successful.
+If called with flag
+.Dv PFIL_WAITOK ,
+.Fn pfil_remove_hook
+is expected to always succeed.
+.Pp
+The
+.Fn pfil_head_unregister
+function
+might sleep!
+.Sh SEE ALSO
+.Xr bpf 4 ,
+.Xr if_bridge 4
+.Sh HISTORY
+The
+.Nm
+interface first appeared in
+.Nx 1.3 .
+The
+.Nm
+input and output lists were originally implemented as
+.In sys/queue.h
+.Dv LIST
+structures;
+however this was changed in
+.Nx 1.4
+to
+.Dv TAILQ
+structures.
+This change was to allow the input and output filters to be processed in
+reverse order, to allow the same path to be taken, in or out of the kernel.
+.Pp
+The
+.Nm
+interface was changed in 1.4T to accept a 3rd parameter to both
+.Fn pfil_add_hook
+and
+.Fn pfil_remove_hook ,
+introducing the capability of per-protocol filtering.
+This was done primarily in order to support filtering of IPv6.
+.Pp
+In 1.5K, the
+.Nm
+framework was changed to work with an arbitrary number of filtering points,
+as well as be less IP-centric.
+.Pp
+Fine-grained locking was added in
+.Fx 5.2 .
+.Sh BUGS
+The
+.Fn pfil_hook_get
+function
+is only safe for internal use.
+.Pp
+.Fx
+implements only hooks for
+.Dv AF_INET
+and
+.Dv AF_INET6 .
+Packets diverted through these hooks have data in
+host byte order contrary to the above statements.
+.Pp
+The
+.Xr if_bridge 4
+diverts
+.Dv AF_INET
+and
+.Dv AF_INET6
+traffic according to its sysctl settings, but contrary to the above
+statements, the data is provided in host byte order.
+.Pp
+When a
+.Vt pfil_head
+is being modified, no traffic is diverted
+(to avoid deadlock).
+This means that traffic may be dropped unconditionally for a short period
+of time.
+.Fn pfil_run_hooks
+will return
+.Er ENOBUFS
+to indicate this.
diff --git a/share/man/man9/pfind.9 b/share/man/man9/pfind.9
new file mode 100644
index 000000000000..dfd15b8dcf74
--- /dev/null
+++ b/share/man/man9/pfind.9
@@ -0,0 +1,88 @@
+.\" Copyright (c) 2001 Evan Sarmiento.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 11, 2001
+.Dt PFIND 9
+.Os
+.Sh NAME
+.Nm pfind , zpfind
+.Nd locate a process by number
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft "struct proc *"
+.Fn pfind "pid_t pid"
+.Ft "struct proc *"
+.Fn zpfind "pid_t pid"
+.Sh DESCRIPTION
+.Fn pfind
+takes a
+.Fa pid
+as its argument and returns a pointer to the
+.Vt proc
+structure whose PID is specified in the argument only if the
+.Fa pid
+is on the
+.Va allproc
+list.
+.Pp
+.Fn zpfind
+takes a
+.Fa pid
+as its argument.
+If
+.Fn zpfind
+finds a process whose PID is equal to that of argument
+and is a zombie process, meaning that it must reside on the
+.Va zombproc
+list,
+.Fn zpfind
+returns a pointer to that
+.Vt proc
+structure.
+.Pp
+Both
+.Fn pfind
+and
+.Fn zpfind
+lock the
+.Vt proc
+structure that is returned using
+.Fn PROC_LOCK "p" .
+.Sh RETURN VALUES
+.Fn pfind
+and
+.Fn zpfind
+return a pointer to a
+.Vt proc
+structure on success and a
+.Dv NULL
+on failure.
+.Sh SEE ALSO
+.Xr pgfind 9
+.Sh AUTHORS
+This manual page was written by
+.An Evan Sarmiento Aq kaworu@sektor7.ath.cx .
diff --git a/share/man/man9/pgfind.9 b/share/man/man9/pgfind.9
new file mode 100644
index 000000000000..a3049876d729
--- /dev/null
+++ b/share/man/man9/pgfind.9
@@ -0,0 +1,65 @@
+.\" Copyright (c) 2001 Evan Sarmiento.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 8, 2001
+.Dt PGFIND 9
+.Os
+.Sh NAME
+.Nm pgfind
+.Nd "locate a process group by number"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft "struct pgrp *"
+.Fn pgfind "pid_t pgid"
+.Sh DESCRIPTION
+The
+.Fn pgfind
+function takes a
+.Fa pgid
+as its argument and returns a pointer to the
+.Vt pgrp
+structure whose
+.Va pg_id
+is specified in the argument.
+.Pp
+.Fn pgfind
+locks the
+.Vt pgrp
+structure that is returned.
+.Sh RETURN VALUES
+The
+.Fn pgfind
+function returns
+.Dv NULL
+on failure or a pointer to a
+.Vt pgrp
+structure on successful completion.
+.Sh SEE ALSO
+.Xr pfind 9
+.Sh AUTHORS
+This manual page was written by
+.An Evan Sarmiento Aq kaworu@sektor7.ath.cx .
diff --git a/share/man/man9/physio.9 b/share/man/man9/physio.9
new file mode 100644
index 000000000000..977c4677df84
--- /dev/null
+++ b/share/man/man9/physio.9
@@ -0,0 +1,131 @@
+.\" $NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 19, 2012
+.Dt PHYSIO 9
+.Os
+.Sh NAME
+.Nm physio
+.Nd initiate I/O on raw devices
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/bio.h
+.In sys/buf.h
+.Ft int
+.Fn physio "struct cdev *dev" "struct uio *uio" "int ioflag"
+.Sh DESCRIPTION
+The
+.Fn physio
+is a helper function typically called from character device
+.Fn read
+and
+.Fn write
+routines to start I/O on a user process buffer.
+The maximum amount of data to transfer with each call
+is determined by
+.Fa dev->si_iosize_max .
+The
+.Fn physio
+call converts the I/O request into a
+.Fn strategy
+request and passes the new request to the driver's
+.Fn strategy
+routine for processing.
+.Pp
+Since
+.Fa uio
+normally describes user space addresses,
+.Fn physio
+needs to lock those pages into memory.
+This is done by calling
+.Fn vmapbuf
+for the appropriate pages.
+.Fn physio
+always awaits the completion of the entire requested transfer before
+returning, unless an error condition is detected earlier.
+.Pp
+A break-down of the arguments follows:
+.Bl -tag -width indent
+.It Fa dev
+The device number identifying the device to interact with.
+.It Fa uio
+The description of the entire transfer as requested by the user process.
+Currently, the results of passing a
+.Fa uio
+structure with the
+.Va uio_segflg
+set to anything other than
+.Dv UIO_USERSPACE
+are undefined.
+.It Fa ioflag
+The ioflag argument from the
+.Fn read
+or
+.Fn write
+function calling
+.Fn physio .
+.El
+.Sh RETURN VALUES
+If successful
+.Fn physio
+returns 0.
+.Er EFAULT
+is returned if the address range described by
+.Fa uio
+is not accessible by the requesting process.
+.Fn physio
+will return any error resulting from calls to the device strategy routine,
+by examining the
+.Dv B_ERROR
+buffer flag and the
+.Va b_error
+field.
+Note that the actual transfer size may be less than requested by
+.Fa uio
+if the device signals an
+.Dq "end of file"
+condition.
+.Sh SEE ALSO
+.Xr read 2 ,
+.Xr write 2
+.Sh HISTORY
+The
+.Nm
+manual page is originally from
+.Nx
+with minor changes for applicability with
+.Fx .
+.Pp
+The
+.Nm
+call has been completely re-written for providing higher
+I/O and paging performance.
diff --git a/share/man/man9/pmap.9 b/share/man/man9/pmap.9
new file mode 100644
index 000000000000..aa6d4a3dd1cd
--- /dev/null
+++ b/share/man/man9/pmap.9
@@ -0,0 +1,130 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP 9
+.Os
+.Sh NAME
+.Nm pmap
+.Nd machine-dependent portion of virtual memory subsystem
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Sh DESCRIPTION
+The
+.Nm
+module is the machine-dependent portion of the
+.Fx
+VM (Virtual Memory) sub-system.
+Each function documented herein must have its own
+architecture-dependent implementation.
+.Pp
+The
+.Nm
+module
+is responsible for managing hardware-dependent objects such as page tables,
+address maps, TLBs, etc.
+.Pp
+Machine-dependent code must provide the header file
+.In machine/pmap.h .
+This file contains the definition of the
+.Vt pmap
+structure:
+.Bd -literal -offset indent
+struct pmap {
+ /* Contents defined by pmap implementation. */
+};
+typedef struct pmap *pmap_t;
+.Ed
+.Pp
+This header file may also define other data structures used by the
+.Nm
+implementation.
+.Pp
+The header file
+.In vm/pmap.h
+defines a structure for tracking
+.Nm
+statistics (see below).
+This structure is defined as:
+.Bd -literal -offset indent
+struct pmap_statistics {
+ long resident_count; /* number of mapped pages */
+ long wired_count; /* number of wired pages */
+};
+.Ed
+.Pp
+The implementation's
+.Vt "struct pmap"
+must contain an instance of this structure having the name
+.Va pm_stats ,
+and it must be updated by the implementation after each relevant
+.Nm
+operation.
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_activate 9 ,
+.Xr pmap_change_wiring 9 ,
+.Xr pmap_clear_modify 9 ,
+.Xr pmap_clear_reference 9 ,
+.Xr pmap_copy 9 ,
+.Xr pmap_copy_page 9 ,
+.Xr pmap_enter 9 ,
+.Xr pmap_extract 9 ,
+.Xr pmap_extract_and_hold 9 ,
+.Xr pmap_growkernel 9 ,
+.Xr pmap_init 9 ,
+.Xr pmap_init2 9 ,
+.Xr pmap_is_modified 9 ,
+.Xr pmap_is_prefaultable 9 ,
+.Xr pmap_map 9 ,
+.Xr pmap_mincore 9 ,
+.Xr pmap_object_init_pt 9 ,
+.Xr pmap_page_exists_quick 9 ,
+.Xr pmap_page_init 9 ,
+.Xr pmap_page_protect 9 ,
+.Xr pmap_pinit 9 ,
+.Xr pmap_pinit0 9 ,
+.Xr pmap_pinit2 9 ,
+.Xr pmap_protect 9 ,
+.Xr pmap_qenter 9 ,
+.Xr pmap_qremove 9 ,
+.Xr pmap_release 9 ,
+.Xr pmap_remove 9 ,
+.Xr pmap_remove_all 9 ,
+.Xr pmap_remove_pages 9 ,
+.Xr pmap_resident_count 9 ,
+.Xr pmap_ts_modified 9 ,
+.Xr pmap_wired_count 9 ,
+.Xr pmap_zero_area 9 ,
+.Xr pmap_zero_idle 9 ,
+.Xr pmap_zero_page 9 ,
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_activate.9 b/share/man/man9/pmap_activate.9
new file mode 100644
index 000000000000..840d8a19c270
--- /dev/null
+++ b/share/man/man9/pmap_activate.9
@@ -0,0 +1,51 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_ACTIVATE 9
+.Os
+.Sh NAME
+.Nm pmap_activate
+.Nd activate a physical map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_activate "struct thread *td"
+.Sh DESCRIPTION
+The
+.Fn pmap_activate
+function activates the physical map for a user thread
+.Fa td .
+This function must be called before the thread's address space may be
+accessed.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_change_wiring.9 b/share/man/man9/pmap_change_wiring.9
new file mode 100644
index 000000000000..f3952f89b6cf
--- /dev/null
+++ b/share/man/man9/pmap_change_wiring.9
@@ -0,0 +1,68 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_CHANGE_WIRING 9
+.Os
+.Sh NAME
+.Nm pmap_change_wiring
+.Nd change physical wiring for a map or virtual address pair
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_change_wiring "pmap_t pmap" "vm_offset_t va" "boolean_t wired"
+.Sh DESCRIPTION
+The
+.Fn pmap_change_wiring
+function changes the wiring attribute for the page at virtual address
+.Fa va
+in the physical map
+.Fa pmap .
+A wired page gets its name from being
+.Dq wired
+into the system page tables so that it will not be paged out.
+.Pp
+The mapping must already exist in the
+.Fa pmap .
+If
+.Fa wired
+is
+.Dv TRUE ,
+the map's wired page count will be incremented; if
+.Dv FALSE ,
+it will be decremented.
+.Pp
+It is typically called by the
+.Fn vm_fault_unwire
+function.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_clear_modify.9 b/share/man/man9/pmap_clear_modify.9
new file mode 100644
index 000000000000..002300b5625e
--- /dev/null
+++ b/share/man/man9/pmap_clear_modify.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_CLEAR_MODIFY 9
+.Os
+.Sh NAME
+.Nm pmap_clear_modify ,
+.Nm pmap_clear_reference
+.Nd set information about physical pages
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_clear_modify "vm_page_t m"
+.Ft void
+.Fn pmap_clear_reference "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn pmap_clear_modify
+function clears the
+.Dq modified
+bit on the physical page
+.Fa m .
+.Pp
+The
+.Fn pmap_clear_reference
+function clears the
+.Dq referenced
+bit on the physical page
+.Fa m .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_is_modified 9 ,
+.Xr pmap_ts_referenced 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_copy.9 b/share/man/man9/pmap_copy.9
new file mode 100644
index 000000000000..1541fa5e09b1
--- /dev/null
+++ b/share/man/man9/pmap_copy.9
@@ -0,0 +1,84 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_COPY 9
+.Os
+.Sh NAME
+.Nm pmap_copy ,
+.Nm pmap_copy_page
+.Nd copy physical memory pages
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fo pmap_copy
+.Fa "pmap_t dst_pmap" "pmap_t src_pmap" "vm_offset_t dst_addr"
+.Fa "vm_size_t len" "vm_offset_t src_addr"
+.Fc
+.Ft void
+.Fn pmap_copy_page "vm_page_t src" "vm_page_t dst"
+.Sh DESCRIPTION
+The
+.Fn pmap_copy
+function copies the range specified by
+.Fa src_addr
+and
+.Fa len
+from the source physical map
+.Fa src_pmap
+to the destination physical map
+.Fa dst_pmap
+at the address
+.Fa dst_addr .
+.Pp
+The
+.Fn pmap_copy_page
+function
+copies the physical page
+.Fa src
+to the physical page
+.Fa dst ,
+by mapping the page into kernel virtual address space (KVA), and using
+.Fn bcopy
+to copy the page.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn pmap_copy
+routine is only advisory and need not do anything.
+Actually implementing it may seriously reduce system performance.
+.Pp
+The
+.Fn pmap_copy_page
+routine only operates upon a single page.
+.Sh SEE ALSO
+.Xr bcopy 3 ,
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_enter.9 b/share/man/man9/pmap_enter.9
new file mode 100644
index 000000000000..2e524532b117
--- /dev/null
+++ b/share/man/man9/pmap_enter.9
@@ -0,0 +1,68 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_ENTER 9
+.Os
+.Sh NAME
+.Nm pmap_enter
+.Nd insert a virtual page into a physical map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fo pmap_enter
+.Fa "pmap_t pmap" "vm_offset_t va" "vm_page_t p" "vm_prot_t prot"
+.Fa "boolean_t wired"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pmap_enter
+function inserts the given physical page
+.Fa p ,
+into the physical map
+.Fa pmap ,
+at the virtual address
+.Fa va ,
+with the protection
+.Fa prot .
+If
+.Fa wired
+is
+.Dv TRUE ,
+then increment the wired count for the page as soon as the mapping
+is inserted into
+.Fa pmap .
+.Sh IMPLEMENTATION NOTES
+This routine MAY NOT lazy-evaluate the entry; it is required by
+specification to make the requested entry at the time it is called.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_extract.9 b/share/man/man9/pmap_extract.9
new file mode 100644
index 000000000000..0622b65ccd31
--- /dev/null
+++ b/share/man/man9/pmap_extract.9
@@ -0,0 +1,95 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_EXTRACT 9
+.Os
+.Sh NAME
+.Nm pmap_extract ,
+.Nm pmap_extract_and_hold
+.Nd map a virtual address to a physical page
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft vm_paddr_t
+.Fn pmap_extract "pmap_t pmap" "vm_offset_t va"
+.Ft vm_paddr_t
+.Fn pmap_extract_and_hold "pmap_t pmap" "vm_offset_t va" "vm_prot_t prot"
+.Sh DESCRIPTION
+The
+.Fn pmap_extract
+function maps a virtual address to a physical page.
+In certain situations, callers may use
+.Fn pmap_extract_and_hold
+instead, to ensure that the returned page is held.
+.Pp
+The
+.Fn pmap_extract_and_hold
+function maps a virtual address to a physical page, and atomically holds
+the returned page for use by the caller, only if the mapping permits
+the given page protection.
+.Sh IMPLEMENTATION NOTES
+Currently, the page protection requested by the caller is not verified.
+.Sh RETURN VALUES
+The
+.Fn pmap_extract
+function will return the physical page address associated with the
+virtual address
+.Fa va
+inside the physical map
+.Fa pmap .
+If the mapping does not exist, or if the
+.Fa pmap
+parameter is
+.Dv NULL ,
+then
+.Dv NULL
+will be returned.
+.Pp
+The
+.Fn pmap_extract_and_hold
+function will return the physical page address associated with the
+virtual address
+.Fa va
+inside the physical map
+.Fa pmap .
+If the mapping does not exist, the result is a no-op, and
+.Dv NULL
+will
+be returned.
+.Sh SEE ALSO
+.Xr mutex 9 ,
+.Xr pmap 9
+.Sh AUTHORS
+.An -nosplit
+The
+.Fn pmap_extract_and_hold
+function was implemented by
+.An Alan L. Cox Aq alc@imimic.com .
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_growkernel.9 b/share/man/man9/pmap_growkernel.9
new file mode 100644
index 000000000000..f038fb53d93b
--- /dev/null
+++ b/share/man/man9/pmap_growkernel.9
@@ -0,0 +1,51 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_GROWKERNEL 9
+.Os
+.Sh NAME
+.Nm pmap_growkernel
+.Nd grow the kernel virtual address (KVA) space
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_growkernel "vm_offset_t addr"
+.Sh DESCRIPTION
+The
+.Fn pmap_growkernel
+function grows the kernel virtual address space to the virtual address
+.Fa addr .
+.Pp
+It will allocate more page entries if required.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_init.9 b/share/man/man9/pmap_init.9
new file mode 100644
index 000000000000..1a8d74c94a03
--- /dev/null
+++ b/share/man/man9/pmap_init.9
@@ -0,0 +1,65 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 10, 2005
+.Dt PMAP_INIT 9
+.Os
+.Sh NAME
+.Nm pmap_init ,
+.Nm pmap_init2
+.Nd initialize the pmap subsystem
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_init "void"
+.Ft void
+.Fn pmap_init2 "void"
+.Sh DESCRIPTION
+The
+.Fn pmap_init
+function initializes the
+.Xr pmap 9
+sub-system.
+It is called during system initialization by
+.Fn vm_init ,
+to initialize any structures that the
+.Nm
+system needs in order to map between physical and virtual memory.
+.Pp
+The
+.Fn pmap_init2
+function initializes a zone for the PV entries.
+These are used to implement page sharing at the physical level.
+A high water mark is set so that the system can recover from
+excessive numbers of PV entries.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_is_modified.9 b/share/man/man9/pmap_is_modified.9
new file mode 100644
index 000000000000..591a98539400
--- /dev/null
+++ b/share/man/man9/pmap_is_modified.9
@@ -0,0 +1,71 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_IS_MODIFIED 9
+.Os
+.Sh NAME
+.Nm pmap_is_modified ,
+.Nm pmap_ts_modified
+.Nd return information about physical pages
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft boolean_t
+.Fn pmap_is_modified "vm_page_t m"
+.Ft int
+.Fn pmap_ts_referenced "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn pmap_is_modified
+and
+.Fn pmap_ts_referenced
+functions return information about physical pages.
+.Sh RETURN VALUES
+The
+.Fn pmap_is_modified
+function returns the status of the
+.Dq "page modified"
+bit for the physical page
+.Fa m .
+.Pp
+The
+.Fn pmap_ts_referenced
+function returns a count of reference bits for a page
+.Fa m ,
+clearing those bits.
+It is not necessary for every reference bit to be cleared, but it is
+necessary that 0 only be returned when there are no remaining reference
+bits set on the page.
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_clear_modify 9 ,
+.Xr pmap_clear_reference 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_is_prefaultable.9 b/share/man/man9/pmap_is_prefaultable.9
new file mode 100644
index 000000000000..c6f28709b666
--- /dev/null
+++ b/share/man/man9/pmap_is_prefaultable.9
@@ -0,0 +1,57 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_IS_PREFAULTABLE 9
+.Os
+.Sh NAME
+.Nm pmap_is_prefaultable
+.Nd determine if a page may be prefaulted
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft boolean_t
+.Fn pmap_is_prefaultable "pmap_t pmap" "vm_offset_t va"
+.Sh DESCRIPTION
+The
+.Fn pmap_is_prefaultable
+function provides a means of determining if the page residing at
+virtual address
+.Fa va
+in the physical map
+.Fa pmap
+may be pre-faulted into main memory.
+.Pp
+This is a helper function which is called by
+.Xr vm_fault_prefault 9 .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr vm_fault_prefault 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_map.9 b/share/man/man9/pmap_map.9
new file mode 100644
index 000000000000..2c472fe97b49
--- /dev/null
+++ b/share/man/man9/pmap_map.9
@@ -0,0 +1,80 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_MAP 9
+.Os
+.Sh NAME
+.Nm pmap_map
+.Nd map a physical memory range into kernel virtual address (KVA) space
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft vm_offset_t
+.Fo pmap_map
+.Fa "vm_offset_t *virt" "vm_paddr_t start" "vm_paddr_t end" "int prot"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pmap_map
+function maps a range of physical addresses into kernel virtual address (KVA)
+space, from
+.Fa start
+to
+.Fa end ,
+with protection bits
+.Fa prot .
+.Pp
+The value passed in
+.Fa *virt
+is treated as a hint for the virtual address of the beginning of the mapping.
+.Sh IMPLEMENTATION NOTES
+The
+.Fa prot
+argument is currently ignored by machine-dependent implementations.
+.Pp
+Architectures which can support a direct mapped physical to virtual
+region can return the appropriate address within that region, leaving
+.Fa *virt
+unchanged.
+.Sh RETURN VALUES
+The
+.Fn pmap_map
+function returns the virtual address of the beginning of the mapping, if
+the mapping was successfully made;
+.Fa *virt
+will also be updated with the first usable address after the mapped region.
+.Pp
+If the function is unsuccessful,
+.Dv NULL
+is returned.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_mincore.9 b/share/man/man9/pmap_mincore.9
new file mode 100644
index 000000000000..d0e45ea5db3a
--- /dev/null
+++ b/share/man/man9/pmap_mincore.9
@@ -0,0 +1,74 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_MINCORE 9
+.Os
+.Sh NAME
+.Nm pmap_mincore
+.Nd determine if a virtual address is resident in physical memory
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft int
+.Fn pmap_mincore "pmap_t pmap" "vm_offset_t addr"
+.Sh DESCRIPTION
+The
+.Fn pmap_mincore
+function determines if the page at the virtual address
+.Fa addr
+in the physical map
+.Fa pmap
+is resident in physical memory.
+It is the machine-dependent interface used by the
+.Xr mincore 2
+system call.
+.Sh RETURN VALUES
+If the page is resident in physical memory,
+a mask of flags is returned,
+whose meaning is documented in
+.Xr mincore 2 ;
+otherwise,
+0
+is returned.
+.Pp
+The
+.Fa pmap
+must exist and
+.Fa addr
+must be mapped into the
+.Fa pmap .
+If any error occurs, the machine-dependent implementation should
+return
+0.
+.Sh SEE ALSO
+.Xr mincore 2 ,
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_object_init_pt.9 b/share/man/man9/pmap_object_init_pt.9
new file mode 100644
index 000000000000..90ae75f44621
--- /dev/null
+++ b/share/man/man9/pmap_object_init_pt.9
@@ -0,0 +1,73 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_OBJECT_INIT_PT 9
+.Os
+.Sh NAME
+.Nm pmap_object_init_pt
+.Nd initialize page tables for a VM object
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fo pmap_object_init_pt
+.Fa "pmap_t pmap" "vm_offset_t addr" "vm_object_t object"
+.Fa "vm_pindex_t pindex" "vm_size_t size" "int limit"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pmap_object_init_pt
+function preloads the page table entries into the specified physical map
+.Fa pmap ,
+for the given
+.Fa object
+at the virtual address
+.Fa addr ,
+for
+.Fa size
+bytes, beginning at the page index
+.Fa pindex
+within the object.
+The map bits
+.Fa limit
+are heeded when creating the mapping.
+.Sh IMPLEMENTATION NOTES
+This function is not strictly required by an architecture's
+.Xr pmap 9
+implementation, but it does provide performance benefits if implemented.
+.Pp
+It is intended to eliminate the blast of soft faults on process
+startup, and immediately following a call to
+.Xr mmap 2 .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_page_exists_quick.9 b/share/man/man9/pmap_page_exists_quick.9
new file mode 100644
index 000000000000..8db258014405
--- /dev/null
+++ b/share/man/man9/pmap_page_exists_quick.9
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_PAGE_EXISTS_QUICK 9
+.Os
+.Sh NAME
+.Nm pmap_page_exists_quick
+.Nd determine if a page exists in a physical map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft boolean_t
+.Fn pmap_page_exists_quick "pmap_t pmap" "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn pmap_page_exists_quick
+function is used to quickly determine if the page
+.Fa m
+exists in the physical map
+.Fa pmap .
+It is typically called from the VM paging code.
+.Sh IMPLEMENTATION NOTES
+The PV count used above may be changed upwards or downwards in future;
+it is only necessary that
+.Dv TRUE
+be returned for a small subset of pmaps for proper page aging.
+.Sh RETURN VALUES
+The
+.Fn pmap_page_exists_quick
+returns
+.Dv TRUE
+only if the PV entry for the physical map
+.Fa pmap
+is one of the first 16 PVs linked from the page
+.Fa m .
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_page_init.9 b/share/man/man9/pmap_page_init.9
new file mode 100644
index 000000000000..65f72ec850e5
--- /dev/null
+++ b/share/man/man9/pmap_page_init.9
@@ -0,0 +1,51 @@
+.\"
+.\" Copyright (c) 2005 Hiten Pandya <hmp@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 10, 2005
+.Dt PMAP_PAGE_INIT 9
+.Os
+.Sh NAME
+.Nm pmap_page_init
+.Nd initialize machine-dependent fields of a VM page
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_page_init "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn pmap_page_init
+function initializes the machine-dependent fields of a VM page structure.
+This procedure is normally used when adding new pages to the VM page
+queue management lists.
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_pinit 9
+.Sh AUTHORS
+This manual page was written by
+.An Hiten Pandya Aq hmp@FreeBSD.org .
diff --git a/share/man/man9/pmap_page_protect.9 b/share/man/man9/pmap_page_protect.9
new file mode 100644
index 000000000000..f77d57def77e
--- /dev/null
+++ b/share/man/man9/pmap_page_protect.9
@@ -0,0 +1,67 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_PROTECT 9
+.Os
+.Sh NAME
+.Nm pmap_page_protect ,
+.Nm pmap_protect
+.Nd set physical page protection
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_page_protect "vm_page_t m" "vm_prot_t prot"
+.Ft void
+.Fo pmap_protect
+.Fa "pmap_t pmap" "vm_offset_t sva" "vm_offset_t eva" "vm_prot_t pr"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn pmap_page_protect
+function lowers the physical page permissions to
+.Fa prot
+for all mappings of a given page
+.Fa m .
+.Pp
+The
+.Fn pmap_protect
+function sets the physical page permissions to
+.Fa prot
+for all physical pages in the physical map
+.Fa pmap
+in the virtual address range between
+.Fa sva
+and
+.Fa eva .
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_pinit.9 b/share/man/man9/pmap_pinit.9
new file mode 100644
index 000000000000..d52172934c3a
--- /dev/null
+++ b/share/man/man9/pmap_pinit.9
@@ -0,0 +1,67 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_PINIT 9
+.Os
+.Sh NAME
+.Nm pmap_pinit ,
+.Nm pmap_pinit0
+.Nd initialize pmap structures
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_pinit "pmap_t pmap"
+.Ft void
+.Fn pmap_pinit0 "pmap_t pm"
+.Sh DESCRIPTION
+The
+.Fn pmap_pinit
+function initializes the preallocated and zeroed structure
+.Fa pmap ,
+such as one in a
+.Vt vmspace
+structure.
+.Pp
+The
+.Fn pmap_pinit0
+function initializes the physical map
+.Fa pm ,
+associated with process 0, the first process created in the system.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn pmap_pinit2
+function has been deprecated, and should be implemented as a stub
+until further notice.
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_growkernel 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_qenter.9 b/share/man/man9/pmap_qenter.9
new file mode 100644
index 000000000000..b148b69f694a
--- /dev/null
+++ b/share/man/man9/pmap_qenter.9
@@ -0,0 +1,79 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_QENTER 9
+.Os
+.Sh NAME
+.Nm pmap_qenter ,
+.Nm pmap_qremove
+.Nd manage temporary kernel space mappings
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_qenter "vm_offset_t sva" "vm_page_t *m" "int count"
+.Ft void
+.Fn pmap_qremove "vm_offset_t sva" "int count"
+.Sh DESCRIPTION
+The
+.Fn pmap_qenter
+function accepts a linear array of
+.Fa count
+pointers to wired pages
+.Fa *m ,
+and enters each of these pages into the kernel virtual address (KVA) space,
+beginning at the address
+.Fa sva .
+.Pp
+The
+.Fn pmap_qremove
+function tears out a mapping from the kernel virtual address space,
+beginning at
+.Fa sva
+and for
+.Fa count
+pages.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn pmap_qenter
+function is intended for temporary mappings that do not require page
+modification or reference counting.
+Old mappings are simply overwritten.
+The pages
+.Em must
+be wired into physical memory.
+.Pp
+The corresponding
+.Fn pmap_qremove
+function is intended to remove such temporary mappings.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_release.9 b/share/man/man9/pmap_release.9
new file mode 100644
index 000000000000..ef2964161802
--- /dev/null
+++ b/share/man/man9/pmap_release.9
@@ -0,0 +1,58 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_RELEASE 9
+.Os
+.Sh NAME
+.Nm pmap_release
+.Nd release resources held by a physical map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_release "pmap_t pmap"
+.Sh DESCRIPTION
+The
+.Fn pmap_release
+function releases any resources held by the physical map
+.Fa pmap .
+This function is
+called when a pmap initialized by the corresponding function,
+.Fn pmap_pinit
+is being released.
+.Sh IMPLEMENTATION NOTES
+This function should only be called if
+.Fa pmap
+no longer contains any valid mappings.
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr pmap_pinit 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_remove.9 b/share/man/man9/pmap_remove.9
new file mode 100644
index 000000000000..12664dce74a1
--- /dev/null
+++ b/share/man/man9/pmap_remove.9
@@ -0,0 +1,84 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_REMOVE 9
+.Os
+.Sh NAME
+.Nm pmap_remove ,
+.Nm pmap_remove_all ,
+.Nm pmap_remove_pages
+.Nd remove pages from a physical map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_remove "pmap_t pmap" "vm_offset_t sva" "vm_offset_t eva"
+.Ft void
+.Fn pmap_remove_all "vm_page_t m"
+.Ft void
+.Fn pmap_remove_pages "pmap_t pmap"
+.Sh DESCRIPTION
+The
+.Fn pmap_remove
+function removes the range of addresses between
+.Fa sva
+and
+.Fa eva
+from the physical map
+.Fa pmap .
+If
+.Fa eva
+is less than
+.Fa sva ,
+then the result is undefined.
+It is assumed that both
+.Fa sva
+and
+.Fa eva
+are page-aligned addresses.
+.Pp
+The
+.Fn pmap_remove_all
+removes the physical page
+.Fa m
+from all physical maps in which it resides, and reflects back the modify
+bits to the appropriate pager.
+.Pp
+The
+.Fn pmap_remove_pages
+function removes all user pages from the physical map
+.Fa pmap .
+This function is called when a process exits to run down its address space
+more quickly than would be the case for calling
+.Fn pmap_remove .
+.Sh SEE ALSO
+.Fn pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_resident_count.9 b/share/man/man9/pmap_resident_count.9
new file mode 100644
index 000000000000..bf39548cea09
--- /dev/null
+++ b/share/man/man9/pmap_resident_count.9
@@ -0,0 +1,74 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_RESIDENT_COUNT 9
+.Os
+.Sh NAME
+.Nm pmap_resident_count ,
+.Nm pmap_wired_count
+.Nd return page resident and wiring statistics
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft long
+.Fn pmap_resident_count "pmap_t pmap"
+.Ft long
+.Fn pmap_wired_count "pmap_t pmap"
+.Sh DESCRIPTION
+The
+.Fn pmap_resident_count
+and
+.Fn pmap_wired_count
+macros allow
+.Nm pmap
+consumers to retrieve statistics from the
+.Va pm_stats
+member of the machine-dependent structure
+.Vt struct pmap .
+.Sh IMPLEMENTATION NOTES
+Both functions are defined as in-line macros.
+The members which they access have type
+.Vt long .
+.Sh RETURN VALUES
+The
+.Fn pmap_resident_count
+returns the number of pages in the physical map
+.Va pmap
+which are currently resident in main memory.
+.Pp
+The
+.Fn pmap_wired_count
+returns the number of pages in the physical map
+.Va pmap
+which are currently wired into in main memory.
+.Sh SEE ALSO
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/pmap_zero_page.9 b/share/man/man9/pmap_zero_page.9
new file mode 100644
index 000000000000..541eef06104b
--- /dev/null
+++ b/share/man/man9/pmap_zero_page.9
@@ -0,0 +1,72 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt PMAP_ZERO 9
+.Os
+.Sh NAME
+.Nm pmap_zero_page ,
+.Nm pmap_zero_area ,
+.Nm pmap_zero_idle
+.Nd zero-fill a page using machine-dependent optimizations
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn pmap_zero_page "vm_page_t m"
+.Ft void
+.Fn pmap_zero_page_area "vm_page_t m" "int off" "int size"
+.Ft void
+.Fn pmap_zero_page_idle "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn pmap_zero_page
+function zero-fills an entire page using machine-dependent optimizations.
+The
+.Fn pmap_zero_page_area
+function is used to zero-fill an area of a page.
+The range specified must not cross a page boundary; it must be contained
+entirely within a single page.
+.Pp
+The
+.Fn pmap_zero_page_idle
+interface is used by the
+.Nm vm_pagezero
+process.
+The system-wide
+.Va Giant
+lock should not be required to be held in order to call this interface.
+.Sh IMPLEMENTATION NOTES
+This function is required to be implemented for each architecture supported by
+.Fx .
+.Sh SEE ALSO
+.Xr bzero 3 ,
+.Xr pmap 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/printf.9 b/share/man/man9/printf.9
new file mode 100644
index 000000000000..571e7e638c36
--- /dev/null
+++ b/share/man/man9/printf.9
@@ -0,0 +1,175 @@
+.\"
+.\" Copyright (c) 2001 Andrew R. Reiter
+.\" Copyright (c) 2004 Joerg Wunsch
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 8, 2006
+.Dt PRINTF 9
+.Os
+.Sh NAME
+.Nm printf , uprintf , tprintf, log
+.Nd formatted output conversion
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft int
+.Fn printf "const char *fmt" ...
+.Ft void
+.Fn tprintf "struct proc *p" "int pri" "const char *fmt" ...
+.Ft int
+.Fn uprintf "const char *fmt" ...
+.In sys/syslog.h
+.Ft void
+.Fn log "int pri" "const char *fmt" ...
+.Sh DESCRIPTION
+The
+.Xr printf 9
+family of functions are similar to the
+.Xr printf 3
+family of functions.
+The different functions each use a different output stream.
+The
+.Fn uprintf
+function outputs to the current process' controlling tty, while
+.Fn printf
+writes to the console as well as to the logging facility.
+The
+.Fn tprintf
+function outputs to the tty associated with the process
+.Fa p
+and the logging facility if
+.Fa pri
+is not \-1.
+The
+.Fn log
+function sends the message to the kernel logging facility, using
+the log level as indicated by
+.Fa pri .
+.Pp
+Each of these related functions use the
+.Fa fmt
+parameter in the same manner as
+.Xr printf 3 .
+However,
+.Xr printf 9
+adds two other conversion specifiers.
+.Pp
+The
+.Cm \&%b
+identifier expects two arguments: an
+.Vt int
+and a
+.Vt "char *" .
+These are used as a register value and a print mask for decoding bitmasks.
+The print mask is made up of two parts: the base and the
+arguments.
+The base value is the output base expressed as an integer value;
+for example, \e10 gives octal and \e20 gives hexadecimal.
+The arguments are made up of a sequence of bit identifiers.
+Each bit identifier begins with an integer value which is the number of the
+bit (starting from 1) this identifier describes.
+The rest of the identifier is a string of characters containing the name of
+the bit.
+The string is terminated by either the bit number at the start of the next
+bit identifier or
+.Dv NUL
+for the last bit identifier.
+.Pp
+The
+.Cm \&%D
+identifier is meant to assist in hexdumps.
+It requires two arguments: a
+.Vt "u_char *"
+pointer and a
+.Vt "char *"
+string.
+The memory pointed to be the pointer is output in hexadecimal one byte at
+a time.
+The string is used as a delimiter between individual bytes.
+If present, a width directive will specify the number of bytes to display.
+By default, 16 bytes of data are output.
+.Pp
+The
+.Fn log
+function uses
+.Xr syslog 3
+level values
+.Dv LOG_DEBUG
+through
+.Dv LOG_EMERG
+for its
+.Fa pri
+parameter (mistakenly called
+.Sq priority
+here).
+Alternatively, if a
+.Fa pri
+of \-1 is given, the message will be appended to the last log message
+started by a previous call to
+.Fn log .
+As these messages are generated by the kernel itself, the facility will
+always be
+.Dv LOG_KERN .
+.Sh RETURN VALUES
+The
+.Fn printf
+and the
+.Fn uprintf
+functions return the number of characters displayed.
+.Sh EXAMPLES
+This example demonstrates the use of the
+.Cm \&%b
+and
+.Cm \&%D
+conversion specifiers.
+The function
+.Bd -literal -offset indent
+void
+printf_test(void)
+{
+
+ printf("reg=%b\en", 3, "\e10\e2BITTWO\e1BITONE\en");
+ printf("out: %4D\en", "AAAA", ":");
+}
+.Ed
+.Pp
+will produce the following output:
+.Bd -literal -offset indent
+reg=3<BITTWO,BITONE>
+out: 41:41:41:41
+.Ed
+.Pp
+The call
+.Bd -literal -offset indent
+log(LOG_DEBUG, "%s%d: been there.\en", sc->sc_name, sc->sc_unit);
+.Ed
+.Pp
+will add the appropriate debug message at priority
+.Dq Li kern.debug
+to the system log.
+.Sh SEE ALSO
+.Xr printf 3 ,
+.Xr syslog 3
diff --git a/share/man/man9/prison_check.9 b/share/man/man9/prison_check.9
new file mode 100644
index 000000000000..4fe1f2f4eec4
--- /dev/null
+++ b/share/man/man9/prison_check.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 11, 2003
+.Dt PRISON_CHECK 9
+.Os
+.Sh NAME
+.Nm prison_check
+.Nd determine if two credentials belong to the same jail
+.Sh SYNOPSIS
+.In sys/jail.h
+.Ft int
+.Fn prison_check "struct ucred *cred1" "struct ucred *cred2"
+.Sh DESCRIPTION
+This function can be used to determine if the two credentials
+.Fa cred1
+and
+.Fa cred2
+belong to the same jail.
+.Sh RETURN VALUES
+The
+.Fn prison_check
+function
+returns
+.Er ESRCH
+if
+.Fa cred1
+has been jailed, and
+.Fa cred1
+and
+.Fa cred2
+do not belong to the same jail.
+In all other cases,
+.Fn prison_check
+returns zero.
+.Sh SEE ALSO
+.Xr jail 2
diff --git a/share/man/man9/priv.9 b/share/man/man9/priv.9
new file mode 100644
index 000000000000..def1ca3f3a5d
--- /dev/null
+++ b/share/man/man9/priv.9
@@ -0,0 +1,122 @@
+.\"-
+.\" Copyright (c) 2006 nCircle Network Security, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed by Robert N. M. Watson for the TrustedBSD
+.\" Project under contract to nCircle Network Security, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, NCIRCLE NETWORK SECURITY,
+.\" INC., OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+.\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 30, 2006
+.Dt PRIV 9
+.Os
+.Sh NAME
+.Nm priv
+.Nd kernel privilege checking API
+.Sh SYNOPSIS
+.In sys/priv.h
+.Ft int
+.Fn priv_check "struct thread *td" "int priv"
+.Ft int
+.Fn priv_check_cred "struct ucred *cred" "int priv" "int flags"
+.Sh DESCRIPTION
+The
+.Nm
+interfaces check to see if specific system privileges are granted to the
+passed thread,
+.Fa td ,
+or credential,
+.Fa cred .
+This interface replaces the now removed
+.Xr suser 9
+privilege checking interface.
+Privileges typically represent rights in one of two categories: the right to
+manage a particular component of the system, or an exemption to a specific
+policy or access control list.
+The caller identifies the desired privilege via the
+.Fa priv
+argument.
+The optional flags argument,
+.Fa flags ,
+is currently unused.
+.Ss Privilege Policies
+Privileges are typically granted based on one of two base system policies:
+the superuser policy, which grants privilege based on the effective (or
+sometimes real) UID having a value of 0, and the
+.Xr jail 2
+policy, which permits only certain privileges to be granted to processes in a
+jail.
+The set of available privileges may also be influenced by the TrustedBSD MAC
+Framework, described in
+.Xr mac 9 .
+.Sh IMPLEMENTATION NOTES
+When adding a new privilege check to a code path, first check the complete
+list of current privileges in
+.Pa sys/priv.h
+to see if one already exists for the class of privilege required.
+Only if there is not an exact match should a new privilege be added to the
+privilege list.
+As privilege numbers becomes encoded in the kernel module ABI, privilege
+constants must not be changed as any kernel modules depending on privileges
+will then need to be recompiled.
+When adding a new privilege, be certain to also determine whether it should
+be listed in
+.Fn prison_priv_check ,
+which includes a complete list of privileges granted to the root user in
+.Xr jail 2 .
+.Pp
+Certain catch-all privileges exist, such as
+.Dv PRIV_DRIVER ,
+intended to be used by device drivers, rather than adding a new
+driver-specific privilege.
+.Sh RETURN VALUES
+Typically, 0 will be returned for success, and
+.Er EPERM
+will be returned on failure.
+Most consumers of
+.Nm
+will wish to directly return the error code from a failed privilege check to
+user space; a small number will wish to translate it to another error code
+appropriate to a specific context.
+.Pp
+When designing new APIs, it is preferable to return explicit errors from a
+call if privilege is not granted rather than changing the semantics of the
+call but returning success.
+For example, the behavior exhibited by
+.Xr stat 2 ,
+in which the generation field is optionally zero'd out when there is
+insufficient privilege is highly undesirable, as it results in frequent
+privilege checks, and the caller is unable to tell if an access control
+failure occurred.
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr mac 9 ,
+.Xr ucred 9
+.Sh AUTHORS
+The
+.Nm
+API and implementation were created by
+.An Robert Watson
+under contract to
+nCircle Network Security, Inc.
diff --git a/share/man/man9/pseudofs.9 b/share/man/man9/pseudofs.9
new file mode 100644
index 000000000000..5d394961dc57
--- /dev/null
+++ b/share/man/man9/pseudofs.9
@@ -0,0 +1,70 @@
+.\"-
+.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 20, 2007
+.Dt PSEUDOFS 9
+.Os
+.Sh NAME
+.Nm pseudofs
+.Nd pseudo file system construction kit
+.Sh SYNOPSIS
+.In fs/pseudofs/pseudofs.h
+.\" Insert usage example here
+.Sh DESCRIPTION
+The
+.Nm
+module offers an abstract API for pseudo-file systems such as
+.Xr procfs 5
+and
+.Xr linprocfs 5 .
+It takes care of all the hairy bits like interfacing with the VFS
+system, enforcing access control, keeping track of file numbers, and
+cloning files and directories that are process-specific.
+The consumer module, i.e., the module that implements the actual guts
+of the file system, needs only provide the directory structure
+(represented by a collection of structures declared and initialized by
+macros provided by
+.Nm )
+and callbacks that report file attributes or write the actual file
+contents into sbufs.
+.\" Insert more info here
+.Sh SEE ALSO
+.Xr linprocfs 5 ,
+.Xr linsysfs 5 ,
+.Xr procfs 5 ,
+.Xr sbuf 9 ,
+.Xr vnode 9
+.Sh HISTORY
+The
+.Nm
+module appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+The
+.Nm
+module and this manual page were written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
diff --git a/share/man/man9/psignal.9 b/share/man/man9/psignal.9
new file mode 100644
index 000000000000..4193bcb50b88
--- /dev/null
+++ b/share/man/man9/psignal.9
@@ -0,0 +1,151 @@
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $NetBSD: psignal.9,v 1.1 1996/06/22 22:57:35 pk Exp $
+.\" $FreeBSD$
+.\"
+.Dd October 8, 2011
+.Dt PSIGNAL 9
+.Os
+.Sh NAME
+.Nm psignal ,
+.Nm pgsignal ,
+.Nm gsignal ,
+.Nm tdsignal
+.Nd post signal to a thread, process, or process group
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/signalvar.h
+.Ft void
+.Fn psignal "struct proc *p" "int signum"
+.Ft void
+.Fn pgsignal "struct pgrp *pgrp" "int signum" "int checkctty"
+.Ft void
+.Fn gsignal "int pgid" "int signum"
+.Ft void
+.Fn tdsignal "struct thread *td" "int signum"
+.Sh DESCRIPTION
+These functions post a signal to a thread or one or more processes.
+The argument
+.Fa signum
+common to all three functions should be in the range
+.Bq 1- Ns Dv NSIG .
+.Pp
+The
+.Fn psignal
+function posts signal number
+.Fa signum
+to the process represented by the process structure
+.Fa p .
+With a few exceptions noted below, the target process signal disposition is
+updated and is marked as runnable, so further handling of the signal is done
+in the context of the target process after a context switch.
+Note that
+.Fn psignal
+does not by itself cause a context switch to happen.
+.Pp
+The target process is not marked as runnable in the following cases:
+.Bl -bullet -offset indent
+.It
+The target process is sleeping uninterruptibly.
+The signal will be
+noticed when the process returns from the system call or trap.
+.It
+The target process is currently ignoring the signal.
+.It
+If a stop signal is sent to a sleeping process that takes the
+default action
+(see
+.Xr sigaction 2 ) ,
+the process is stopped without awakening it.
+.It
+.Dv SIGCONT
+restarts a stopped process
+(or puts them back to sleep)
+regardless of the signal action
+(e.g., blocked or ignored).
+.El
+.Pp
+If the target process is being traced
+.Fn psignal
+behaves as if the target process were taking the default action for
+.Fa signum .
+This allows the tracing process to be notified of the signal.
+.Pp
+The
+.Fn pgsignal
+function posts signal number
+.Fa signum
+to each member of the process group described by
+.Fa pgrp .
+If
+.Fa checkctty
+is non-zero, the signal will be posted only to processes that have
+a controlling terminal.
+.Fn pgsignal
+is implemented by walking along the process list headed by the field
+.Li pg_members
+of the process group structure
+pointed at by
+.Fa pgrp
+and calling
+.Fn psignal
+as appropriate.
+If
+.Fa pgrp
+is
+.Dv NULL
+no action is taken.
+.Pp
+The
+.Fn gsignal
+function posts signal number
+.Fa signum
+to each member of the process group identified by the group id
+.Fa pgid .
+.Fn gsignal
+first finds the group structure associated with
+.Fa pgid ,
+then invokes
+.Fn pgsignal
+with the argument
+.Fa checkctty
+set to zero.
+If
+.Fa pgid
+is zero no action is taken.
+.Pp
+The
+.Fn tdsignal
+function posts signal number
+.Fa signum
+to the thread represented by the thread structure
+.Fa td .
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr signal 9 ,
+.Xr tsleep 9
diff --git a/share/man/man9/random.9 b/share/man/man9/random.9
new file mode 100644
index 000000000000..a6bccda701b4
--- /dev/null
+++ b/share/man/man9/random.9
@@ -0,0 +1,156 @@
+.\"
+.\" Copyright (c) 2000
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd September 25, 2000
+.Dt RANDOM 9
+.Os
+.Sh NAME
+.Nm arc4rand ,
+.Nm arc4random ,
+.Nm random ,
+.Nm read_random ,
+.Nm srandom
+.Nd supply pseudo-random numbers
+.Sh SYNOPSIS
+.In sys/libkern.h
+.Ft void
+.Fn srandom "u_long seed"
+.Ft u_long
+.Fn random "void"
+.Ft void
+.Fn arc4rand "void *ptr" "u_int length" "int reseed"
+.Ft uint32_t
+.Fn arc4random "void"
+.Pp
+.In sys/random.h
+.Ft int
+.Fn read_random "void *buffer" "int count"
+.Sh DESCRIPTION
+The
+.Fn random
+function will by default produce a sequence of numbers that can be duplicated
+by calling
+.Fn srandom
+with
+.Ql 1
+as the
+.Fa seed .
+The
+.Fn srandom
+function may be called with any arbitrary
+.Fa seed
+value to get slightly more unpredictable numbers.
+It is important to remember that the
+.Fn random
+function is entirely predictable, and is therefore not of use where
+knowledge of the sequence of numbers may be of benefit to an attacker.
+.Pp
+The
+.Fn arc4rand
+function will return very good quality random numbers, slightly better
+suited for security-related purposes.
+The random numbers from
+.Fn arc4rand
+are seeded from the entropy device if it is available.
+Automatic reseeds happen after a certain timeinterval and after a
+certain number of bytes have been delivered.
+A forced reseed can be forced by passing a non-zero value in the
+.Fa reseed
+argument.
+.Pp
+The
+.Fn read_random
+function is used to return entropy directly from the entropy device
+if it has been loaded.
+If the entropy device is not loaded, then
+the
+.Fa buffer
+is filled with output generated by
+.Fn random .
+The
+.Fa buffer
+is filled with no more than
+.Fa count
+bytes.
+It is advised that
+.Fn read_random
+is not used; instead use
+.Fn arc4rand
+.Pp
+All the bits generated by
+.Fn random ,
+.Fn arc4rand
+and
+.Fn read_random
+are usable.
+For example,
+.Sq Li random()&01
+will produce a random binary value.
+.Pp
+The
+.Fn arc4random
+is a convenience function which calls
+.Fn arc4rand
+to return a 32 bit pseudo-random integer.
+.Sh RETURN VALUES
+The
+.Fn random
+function
+uses a non-linear additive feedback random number generator employing a
+default table of size 31 long integers to return successive pseudo-random
+numbers in the range from 0 to
+.if t 2\u\s731\s10\d\(mi1.
+.if n (2**31)\(mi1.
+The period of this random number generator is very large, approximately
+.if t 16\(mu(2\u\s731\s10\d\(mi1).
+.if n 16*((2**31)\(mi1).
+.Pp
+The
+.Fn arc4rand
+function uses the RC4 algorithm to generate successive pseudo-random
+bytes.
+The
+.Fn arc4random
+function
+uses
+.Fn arc4rand
+to generate pseudo-random numbers in the range from 0 to
+.if t 2\u\s732\s10\d\(mi1.
+.if n (2**32)\(mi1.
+.Pp
+The
+.Fn read_random
+function returns the number of bytes placed in
+.Fa buffer .
+.Sh AUTHORS
+.An Dan Moschuk
+wrote
+.Fn arc4random .
+.An Mark R V Murray
+wrote
+.Fn read_random .
diff --git a/share/man/man9/random_harvest.9 b/share/man/man9/random_harvest.9
new file mode 100644
index 000000000000..7b72f3e996da
--- /dev/null
+++ b/share/man/man9/random_harvest.9
@@ -0,0 +1,112 @@
+.\"
+.\" Copyright (c) 2002 Mark R V Murray
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 6, 2002
+.Dt RANDOM_HARVEST 9
+.Os
+.Sh NAME
+.Nm random_harvest
+.Nd gather entropy from the kernel for the entropy device
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/random.h
+.Ft void
+.Fo random_harvest
+.Fa "void *entropy"
+.Fa "u_int size"
+.Fa "u_int bits"
+.Fa "u_int frac"
+.Fa "enum esource source"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn random_harvest
+function is used by device drivers
+and other kernel processes to pass data
+that is considered (at least partially) stochastic
+to the entropy device.
+.Pp
+The caller should pass a pointer (to no more than 16 bytes) of
+the
+.Dq random
+data in
+.Fa entropy .
+The argument
+.Fa size
+contains the number of bytes pointed to.
+The caller should
+.Em "very conservatively"
+estimate the number of random bits
+in the sample,
+and pass this in
+.Fa bits
+or
+.Fa frac .
+If the estimated number of bits per sample is an integer, then
+.Fa bits
+is used, and
+.Fa frac
+is 0.
+Otherwise,
+for low-entropy samples,
+.Dq fractional
+entropy can be supplied in
+.Fa frac .
+(This is considered to be
+.Fa frac /
+1024 bits of entropy.)
+The
+.Fa source
+is chosen from
+.Dv RANDOM_WRITE , RANDOM_KEYBOARD , RANDOM_MOUSE , RANDOM_NET
+and
+.Dv RANDOM_INTERRUPT ,
+and is used to indicate the source of the entropy.
+.Pp
+Interrupt harvesting has been simplified
+for the kernel programmer.
+If a device driver registers an interrupt handler
+with
+.Xr BUS_SETUP_INTR 9
+or
+.Xr bus_setup_intr 9 ,
+then it is only necessary to
+include the
+.Dv INTR_ENTROPY
+bit in the
+.Fa flags
+argument to have that interrupt source
+be used for entropy harvesting.
+.Sh SEE ALSO
+.Xr random 4 ,
+.Xr BUS_SETUP_INTR 9
+.Sh AUTHORS
+The
+.Fx
+.Xr random 4
+entropy device and supporting documentation was written by
+.An Mark R V Murray .
diff --git a/share/man/man9/redzone.9 b/share/man/man9/redzone.9
new file mode 100644
index 000000000000..98723c7b7ac2
--- /dev/null
+++ b/share/man/man9/redzone.9
@@ -0,0 +1,125 @@
+.\" Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 9, 2009
+.Dt REDZONE 9
+.Os
+.Sh NAME
+.Nm RedZone
+.Nd "buffer corruptions detector"
+.Sh SYNOPSIS
+.Cd "options KDB"
+.Cd "options DDB"
+.Cd "options DEBUG_REDZONE"
+.Sh DESCRIPTION
+.Nm
+detects buffer underflow and buffer overflow bugs at runtime.
+Currently
+.Nm
+only detects buffer corruptions for memory allocated with
+.Xr malloc 9 .
+When such corruption is detected two backtraces are printed on the console.
+The first one shows from where memory was allocated, the second one shows from
+where memory was freed.
+By default the system will not panic when buffer corruption is detected.
+This can be changed by setting the
+.Va vm.redzone.panic
+.Xr sysctl 8
+variable to 1.
+The amount of extra memory allocated for
+.Nm Ns 's
+needs is stored in the
+.Va vm.redzone.extra_mem
+.Xr sysctl 8
+variable.
+.Sh EXAMPLE
+The example below shows the logs from the detection of a buffer underflow and a
+buffer overflow.
+.Bd -literal -offset indent
+REDZONE: Buffer underflow detected. 2 bytes corrupted before 0xc8688580 (16 bytes allocated).
+Allocation backtrace:
+#0 0xc0583e4e at redzone_setup+0x3c
+#1 0xc04a23fa at malloc+0x19e
+#2 0xcdeb69ca at redzone_modevent+0x60
+#3 0xc04a3f3c at module_register_init+0x82
+#4 0xc049d96a at linker_file_sysinit+0x8e
+#5 0xc049dc7c at linker_load_file+0xed
+#6 0xc04a041f at linker_load_module+0xc4
+#7 0xc049e883 at kldload+0x116
+#8 0xc05d9b3d at syscall+0x325
+#9 0xc05c944f at Xint0x80_syscall+0x1f
+Free backtrace:
+#0 0xc0583f92 at redzone_check+0xd4
+#1 0xc04a2422 at free+0x1c
+#2 0xcdeb69a6 at redzone_modevent+0x3c
+#3 0xc04a438d at module_unload+0x61
+#4 0xc049e0b3 at linker_file_unload+0x89
+#5 0xc049e979 at kern_kldunload+0x96
+#6 0xc049ea00 at kldunloadf+0x2c
+#7 0xc05d9b3d at syscall+0x325
+#8 0xc05c944f at Xint0x80_syscall+0x1f
+
+REDZONE: Buffer overflow detected. 4 bytes corrupted after 0xc8688590 (16 bytes allocated).
+Allocation backtrace:
+#0 0xc0583e4e at redzone_setup+0x3c
+#1 0xc04a23fa at malloc+0x19e
+#2 0xcdeb69ca at redzone_modevent+0x60
+#3 0xc04a3f3c at module_register_init+0x82
+#4 0xc049d96a at linker_file_sysinit+0x8e
+#5 0xc049dc7c at linker_load_file+0xed
+#6 0xc04a041f at linker_load_module+0xc4
+#7 0xc049e883 at kldload+0x116
+#8 0xc05d9b3d at syscall+0x325
+#9 0xc05c944f at Xint0x80_syscall+0x1f
+Free backtrace:
+#0 0xc0584020 at redzone_check+0x162
+#1 0xc04a2422 at free+0x1c
+#2 0xcdeb69a6 at redzone_modevent+0x3c
+#3 0xc04a438d at module_unload+0x61
+#4 0xc049e0b3 at linker_file_unload+0x89
+#5 0xc049e979 at kern_kldunload+0x96
+#6 0xc049ea00 at kldunloadf+0x2c
+#7 0xc05d9b3d at syscall+0x325
+#8 0xc05c944f at Xint0x80_syscall+0x1f
+.Ed
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr malloc 9 ,
+.Xr memguard 9
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org
+.Sh BUGS
+Currently,
+.Nm
+does not cooperate with
+.Xr memguard 9 .
+Allocations from a memory type controlled by
+.Xr memguard 9
+are simply skipped, so buffer corruptions will not be detected there.
diff --git a/share/man/man9/refcount.9 b/share/man/man9/refcount.9
new file mode 100644
index 000000000000..e7702a22661e
--- /dev/null
+++ b/share/man/man9/refcount.9
@@ -0,0 +1,96 @@
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 20, 2009
+.Dt REFCOUNT 9
+.Os
+.Sh NAME
+.Nm refcount ,
+.Nm refcount_init ,
+.Nm refcount_acquire ,
+.Nm refcount_release
+.Nd manage a simple reference counter
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/refcount.h
+.Ft void
+.Fn refcount_init "volatile u_int *count, u_int value"
+.Ft void
+.Fn refcount_acquire "volatile u_int *count"
+.Ft int
+.Fn refcount_release "volatile u_int *count"
+.Sh DESCRIPTION
+The
+.Nm
+functions provide an API to manage a simple reference counter.
+The caller provides the storage for the counter in an unsigned integer.
+A pointer to this integer is passed via
+.Fa count .
+Usually the counter is used to manage the lifetime of an object and is
+stored as a member of the object.
+.Pp
+The
+.Fn refcount_init
+function is used to set the initial value of the counter to
+.Fa value .
+It is normally used when creating a reference-counted object.
+.Pp
+The
+.Fn refcount_acquire
+function is used to acquire a new reference.
+The caller is responsible for ensuring that it holds a valid reference
+while obtaining a new reference.
+For example,
+if an object is stored on a list and the list holds a reference on the
+object, then holding a lock that protects the list provides sufficient
+protection for acquiring a new reference.
+.Pp
+The
+.Fn refcount_release
+function is used to release an existing reference.
+The function returns a non-zero value if the reference being released was
+the last reference;
+otherwise, it returns zero.
+.Pp
+Note that these routines do not provide any inter-CPU synchronization,
+data protection,
+or memory ordering guarantees except for managing the counter.
+The caller is responsible for any additional synchronization needed by
+consumers of any containing objects.
+In addition,
+the caller is also responsible for managing the life cycle of any containing
+objects including explicitly releasing any resources when the last reference
+is released.
+.Sh RETURN VALUES
+The
+.Nm refcount_release
+function returns non-zero when releasing the last reference and zero when
+releasing any other reference.
+.Sh HISTORY
+These functions were introduced in
+.Fx 6.0 .
diff --git a/share/man/man9/resettodr.9 b/share/man/man9/resettodr.9
new file mode 100644
index 000000000000..9818c8fd435b
--- /dev/null
+++ b/share/man/man9/resettodr.9
@@ -0,0 +1,62 @@
+.\" $NetBSD: resettodr.9,v 1.1 1995/11/25 21:24:51 perry Exp $
+.\"
+.\" Copyright (c) 1994 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christopher G. Demetriou
+.\" for the NetBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 13, 1995
+.Dt RESETTODR 9
+.Os
+.Sh NAME
+.Nm resettodr
+.Nd set battery-backed clock from system time
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft void
+.Fn resettodr "void"
+.Sh DESCRIPTION
+The
+.Fn resettodr
+function sets the system's battery-backed clock based on the contents
+of the system
+.Va time
+variable.
+.Sh SEE ALSO
+.Xr inittodr 9 ,
+.Xr time 9
+.Sh BUGS
+On many systems,
+.Fn resettodr
+has to convert from
+.Va time
+to a time expressed in terms of year, month, day, hours, minutes,
+and seconds.
+Many of the implementations could share code, but do not.
diff --git a/share/man/man9/resource_int_value.9 b/share/man/man9/resource_int_value.9
new file mode 100644
index 000000000000..e82853513c19
--- /dev/null
+++ b/share/man/man9/resource_int_value.9
@@ -0,0 +1,79 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2001 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 1, 2001
+.Dt RESOURCE_INT_VALUE 9
+.Os
+.Sh NAME
+.Nm resource_int_value , resource_long_value , resource_string_value
+.Nd get a value from the hints mechanism
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fn resource_int_value "const char *name" "int unit" "const char *resname" "int *result"
+.Ft int
+.Fn resource_long_value "const char *name" "int unit" "const char *resname" "long *result"
+.Ft int
+.Fn resource_string_value "const char *name" "int unit" "const char *resname" "const char **result"
+.Sh DESCRIPTION
+These functions fetch a value from the
+.Dq hints
+mechanism.
+.Pp
+The functions take the following arguments:
+.Bl -tag -width "resname"
+.It Fa name
+The name of the device to get the resource value from.
+.It Fa unit
+The unit number of the device.
+\-1 is special and is used for wildcard entries.
+.It Fa resname
+The resource name.
+.It Fa result
+A pointer to memory in which to store the resource value.
+.El
+.Sh RETURN VALUES
+If successful, the functions return 0.
+Otherwise, a non\-zero error code is returned.
+.Sh ERRORS
+The functions will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOENT
+The resource could not be found.
+.It Bq Er EFTYPE
+Inappropriate resource type.
+.El
+.Sh SEE ALSO
+.Xr device 9 ,
+.Xr driver 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh Aq imp@FreeBSD.org .
diff --git a/share/man/man9/rijndael.9 b/share/man/man9/rijndael.9
new file mode 100644
index 000000000000..1d8d90412b0e
--- /dev/null
+++ b/share/man/man9/rijndael.9
@@ -0,0 +1,135 @@
+.\"
+.\" Copyright (c) 2002
+.\" Mark R V Murray. All rights reserved.
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\" "
+.Dd February 6, 2002
+.Dt RIJNDAEL 9
+.Os
+.Sh NAME
+.Nm rijndael_makeKey ,
+.Nm rijndael_cipherInit ,
+.Nm rijndael_blockEncrypt ,
+.Nm rijndael_padEncrypt ,
+.Nm rijndael_blockDecrypt ,
+.Nm rijndael_padDecrypt
+.Nd AES encryption
+.Sh SYNOPSIS
+.In sys/types.h
+.In crypto/rijndael.h
+.Ft int
+.Fo rijndael_makeKey
+.Fa "keyInstance *key"
+.Fa "uint8_t direction"
+.Fa "int keyLen"
+.Fa "char *keyMaterial"
+.Fc
+.Ft int
+.Fo rijndael_cipherInit
+.Fa "cipherInstance *cipher"
+.Fa "uint8_t mode"
+.Fa "char *IV"
+.Fc
+.Ft int
+.Fo rijndael_blockEncrypt
+.Fa "cipherInstance *cipher"
+.Fa "keyInstance *key"
+.Fa "uint8_t *input"
+.Fa "int inputLen"
+.Fa "uint8_t *outBuffer"
+.Fc
+.Ft int
+.Fo rijndael_padEncrypt
+.Fa "cipherInstance *cipher"
+.Fa "keyInstance *key"
+.Fa "uint8_t *input"
+.Fa "int inputOctets"
+.Fa "uint8_t *outBuffer"
+.Fc
+.Ft int
+.Fo rijndael_blockDecrypt
+.Fa "cipherInstance *cipher"
+.Fa "keyInstance *key"
+.Fa "uint8_t *input"
+.Fa "int inputLen"
+.Fa "uint8_t *outBuffer"
+.Fc
+.Ft int
+.Fo rijndael_padDecrypt
+.Fa "cipherInstance *cipher"
+.Fa "keyInstance *key"
+.Fa "uint8_t *input"
+.Fa "int inputOctets"
+.Fa "uint8_t *outBuffer"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn rijndael_makeKey
+function is used to set up the key schedule in
+.Fa key .
+The
+.Fa direction
+(which may be
+.Dv DIR_ENCRYPT
+or
+.Dv DIR_DECRYPT )
+specifies the intended use of the key.
+The length of the key (in bits) is given in
+.Fa keyLen ,
+and must be 128, 192 or 256.
+The actual key is supplied in the buffer pointed to by
+.Fa keyMaterial .
+This material may be raw binary data,
+or an ASCII string containing a hexadecimal rendition
+of the raw binary data,
+dependent on a compile-time option in the
+.Nm
+sources,
+.Dv BINARY_KEY_MATERIAL .
+.Sh RETURN VALUES
+The
+.Fn rijndael_makeKey
+function will return
+.Dv BAD_KEY_INSTANCE
+if a
+.Dv NULL
+.Fa key
+is passed,
+.Dv BAD_KEY_DIR
+if
+.Fa direction
+is not
+.Dv DIR_ENCRYPT
+or
+.Dv DIR_DECRYPT ,
+.Dv BAD_KEY_MAT
+if the key materials are not a hexadecimal string
+(and binary keys are not set),
+and
+.Dv TRUE
+otherwise.
+.Sh AUTHORS
+.An Mark R V Murray
diff --git a/share/man/man9/rman.9 b/share/man/man9/rman.9
new file mode 100644
index 000000000000..d9a20920da35
--- /dev/null
+++ b/share/man/man9/rman.9
@@ -0,0 +1,472 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 29, 2011
+.Dt RMAN 9
+.Os
+.Sh NAME
+.Nm rman ,
+.Nm rman_activate_resource ,
+.Nm rman_adjust_resource ,
+.Nm rman_await_resource ,
+.Nm rman_deactivate_resource ,
+.Nm rman_fini ,
+.Nm rman_init ,
+.Nm rman_init_from_resource ,
+.Nm rman_is_region_manager ,
+.Nm rman_manage_region ,
+.Nm rman_first_free_region ,
+.Nm rman_last_free_region ,
+.Nm rman_release_resource ,
+.Nm rman_reserve_resource ,
+.Nm rman_reserve_resource_bound ,
+.Nm rman_make_alignment_flags ,
+.Nm rman_get_start ,
+.Nm rman_get_end ,
+.Nm rman_get_device ,
+.Nm rman_get_size ,
+.Nm rman_get_flags ,
+.Nm rman_set_virtual ,
+.Nm rman_get_virtual ,
+.Nm rman_set_bustag ,
+.Nm rman_get_bustag ,
+.Nm rman_set_bushandle ,
+.Nm rman_get_bushandle ,
+.Nm rman_set_rid ,
+.Nm rman_get_rid
+.Nd resource management functions
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/rman.h
+.Ft int
+.Fn rman_activate_resource "struct resource *r"
+.Ft int
+.Fn rman_adjust_resource "struct resource *r" "u_long start" "u_long end"
+.Ft int
+.Fn rman_await_resource "struct resource *r" "int pri2" "int timo"
+.Ft int
+.Fn rman_deactivate_resource "struct resource *r"
+.Ft int
+.Fn rman_fini "struct rman *rm"
+.Ft int
+.Fn rman_init "struct rman *rm"
+.Ft int
+.Fn rman_init_from_resource "struct rman *rm" "struct resource *r"
+.Ft int
+.Fn rman_is_region_manager "struct resource *r" "struct rman *rm"
+.Ft int
+.Fn rman_manage_region "struct rman *rm" "u_long start" "u_long end"
+.Ft int
+.Fn rman_first_free_region "struct rman *rm" "u_long *start" "u_long *end"
+.Ft int
+.Fn rman_last_free_region "struct rman *rm" "u_long *start" "u_long *end"
+.Ft int
+.Fn rman_release_resource "struct resource *r"
+.Ft "struct resource *"
+.Fo rman_reserve_resource
+.Fa "struct rman *rm" "u_long start" "u_long end" "u_long count"
+.Fa "u_int flags" "struct device *dev"
+.Fc
+.Ft "struct resource *"
+.Fo rman_reserve_resource_bound
+.Fa "struct rman *rm" "u_long start" "u_long end" "u_long count"
+.Fa "u_long bound" "u_int flags" "struct device *dev"
+.Fc
+.Ft uint32_t
+.Fn rman_make_alignment_flags "uint32_t size"
+.Ft u_long
+.Fn rman_get_start "struct resource *r"
+.Ft u_long
+.Fn rman_get_end "struct resource *r"
+.Ft "struct device *"
+.Fn rman_get_device "struct resource *r"
+.Ft u_long
+.Fn rman_get_size "struct resource *r"
+.Ft u_int
+.Fn rman_get_flags "struct resource *r"
+.Ft void
+.Fn rman_set_virtual "struct resource *r" "void *v"
+.Ft "void *"
+.Fn rman_get_virtual "struct resource *r"
+.Ft void
+.Fn rman_set_bustag "struct resource *r" "bus_space_tag_t t"
+.Ft bus_space_tag_t
+.Fn rman_get_bustag "struct resource *r"
+.Ft void
+.Fn rman_set_bushandle "struct resource *r" "bus_space_handle_t h"
+.Ft bus_space_handle_t
+.Fn rman_get_bushandle "struct resource *r"
+.Ft void
+.Fn rman_set_rid "struct resource *r" "int rid"
+.Ft int
+.Fn rman_get_rid "struct resource *r"
+.Sh DESCRIPTION
+The
+.Nm
+set of functions provides a flexible resource management abstraction.
+It is used extensively by the bus management code.
+It implements the abstractions of region and resource.
+A region descriptor is used to manage a region; this could be memory or
+some other form of bus space.
+.Pp
+Each region has a set of bounds.
+Within these bounds, allocated segments may reside.
+Each segment, termed a resource, has several properties which are
+represented by a 16-bit flag register, as follows.
+.Bd -literal
+#define RF_ALLOCATED 0x0001 /* resource has been reserved */
+#define RF_ACTIVE 0x0002 /* resource allocation has been activated */
+#define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */
+#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */
+#define RF_WANTED 0x0010 /* somebody is waiting for this resource */
+#define RF_FIRSTSHARE 0x0020 /* first in sharing list */
+#define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */
+.Ed
+.Pp
+The remainder of the flag bits are used to represent the desired alignment
+of the resource within the region.
+.Pp
+The
+.Fn rman_init
+function initializes the region descriptor, pointed to by the
+.Fa rm
+argument, for use with the resource management functions.
+It is required that the fields
+.Va rm_type
+and
+.Va rm_descr
+of
+.Vt "struct rman"
+be set before calling
+.Fn rman_init .
+The field
+.Va rm_type
+shall be set to
+.Dv RMAN_ARRAY .
+The field
+.Va rm_descr
+shall be set to a string that describes the resource to be managed.
+The
+.Va rm_start
+and
+.Va rm_end
+fields may be set to limit the range of acceptable resource addresses.
+If these fields are not set,
+.Fn rman_init
+will initialize them to allow the entire range of resource addresses.
+It also initializes any mutexes associated with the structure.
+If
+.Fn rman_init
+fails to initialize the mutex, it will return
+.Er ENOMEM ; otherwise it will return 0 and
+.Fa rm
+will be initialized.
+.Pp
+The
+.Fn rman_fini
+function frees any structures associated with the structure
+pointed to by the
+.Fa rm
+argument.
+If any of the resources within the managed region have the
+.Dv RF_ALLOCATED
+flag set, it will return
+.Er EBUSY ;
+otherwise, any mutexes associated with the structure will be released
+and destroyed, and the function will return 0.
+.Pp
+The
+.Fn rman_manage_region
+function establishes the concept of a region which is under
+.Nm
+control.
+The
+.Fa rman
+argument points to the region descriptor.
+The
+.Fa start
+and
+.Fa end
+arguments specify the bounds of the region.
+If successful,
+.Fn rman_manage_region
+will return 0.
+If the region overlaps with an existing region, it will return
+.Er EBUSY .
+If any part of the region falls outside of the valid address range for
+.Fa rm ,
+it will return
+.Er EINVAL .
+.Er ENOMEM
+will be returned when
+.Fn rman_manage_region
+failed to allocate memory for the region.
+.Pp
+The
+.Fn rman_init_from_resource
+function is a wrapper routine to create a resource manager backed by an
+existing resource.
+It initializes
+.Fa rm
+using
+.Fn rman_init
+and then adds a region to
+.Fa rm
+corresponding to the address range allocated to
+.Fa r
+via
+.Fn rman_manage_region .
+.Pp
+The
+.Fn rman_first_free_region
+and
+.Fn rman_last_free_region
+functions can be used to query a resource manager for its first
+.Pq or last
+unallocated region.
+If
+.Fa rm
+contains no free region,
+these functions will return
+.Er ENOENT .
+Otherwise,
+.Fa *start
+and
+.Fa *end
+are set to the bounds of the free region and zero is returned.
+.Pp
+The
+.Fn rman_reserve_resource_bound
+function is where the bulk of the
+.Nm
+logic is located.
+It attempts to reserve a contiguous range in the specified region
+.Fa rm
+for the use of the device
+.Fa dev .
+The caller can specify the
+.Fa start
+and
+.Fa end
+of an acceptable range,
+as well as a boundary restriction and required aligment,
+and the code will attempt to find a free segment which fits.
+The
+.Fa start
+argument is the lowest acceptable starting value of the resource.
+The
+.Fa end
+argument is the highest acceptable ending value of the resource.
+Therefore,
+.Fa start No + Fa count No \- 1
+must be \[<=]
+.Fa end
+for any allocation to happen.
+The aligment requirement
+.Pq if any
+is specified in
+.Fa flags .
+The
+.Fa bound
+argument may be set to specify a boundary restriction such that an
+allocated region may cross an address that is a multiple of the
+boundary.
+The
+.Fa bound
+argument must be a power of two.
+It may be set to zero to specify no boundary restriction.
+The default behavior is to allocate an exclusive segment, unless the
+.Dv RF_SHAREABLE
+or
+.Dv RF_TIMESHARE
+flags are set, in which case a shared
+segment will be allocated.
+If this shared segment already exists, the caller has its device
+added to the list of consumers.
+.Pp
+The
+.Fn rman_reserve_resource
+function is used to reserve resources within a previously established region.
+It is a simplified interface to
+.Fn rman_reserve_resource_bound
+which passes 0 for the
+.Fa bound
+argument.
+.Pp
+The
+.Fn rman_make_alignment_flags
+function returns the flag mask corresponding to the desired alignment
+.Fa size .
+This should be used when calling
+.Fn rman_reserve_resource_bound .
+.Pp
+The
+.Fn rman_is_region_manager
+function returns true if the allocated resource
+.Fa r
+was allocated from
+.Fa rm .
+Otherwise,
+it returns false.
+.Pp
+The
+.Fn rman_adjust_resource
+function is used to adjust the reserved address range of an allocated resource
+to reserve
+.Fa start
+through
+.Fa end .
+It can be used to grow or shrink one or both ends of the resource range.
+The current implementation does not support entirely relocating the resource
+and will fail with
+.Er EINVAL
+if the new resource range does not overlap the old resource range.
+If either end of the resource range grows and the new resource range would
+conflict with another allocated resource,
+the function will fail with
+.Er EBUSY .
+The
+.Fn rman_adjust_resource
+function does not support adjusting the resource range for shared resources
+and will fail such attempts with
+.Er EINVAL .
+Upon success,
+the resource
+.Fa r
+will have a start address of
+.Fa start
+and an end address of
+.Fa end
+and the function will return zero.
+Note that none of the constraints of the original allocation request such
+as alignment or boundary restrictions are checked by
+.Fn rman_adjust_resource .
+It is the caller's responsibility to enforce any such requirements.
+.Pp
+The
+.Fn rman_release_resource
+function releases the reserved resource
+.Fa r .
+It may attempt to merge adjacent free resources.
+.Pp
+The
+.Fn rman_activate_resource
+function marks a resource as active, by setting the
+.Dv RF_ACTIVE
+flag.
+If this is a time shared resource, and the caller has not yet acquired
+the resource, the function returns
+.Er EBUSY .
+.Pp
+The
+.Fn rman_deactivate_resource
+function marks a resource
+.Fa r
+as inactive, by clearing the
+.Dv RF_ACTIVE
+flag.
+If other consumers are waiting for this range, it will wakeup their threads.
+.Pp
+The
+.Fn rman_await_resource
+function performs an asynchronous wait for a resource
+.Fa r
+to become inactive, that is, for the
+.Dv RF_ACTIVE
+flag to be cleared.
+It is used to enable cooperative sharing of a resource
+which can only be safely used by one thread at a time.
+The arguments
+.Fa pri
+and
+.Fa timo
+are passed to the
+.Fn rman_await_resource
+function.
+.Pp
+The
+.Fn rman_get_start ,
+.Fn rman_get_end ,
+.Fn rman_get_size ,
+and
+.Fn rman_get_flags
+functions return the bounds, size and flags of the previously reserved
+resource
+.Fa r .
+.Pp
+The
+.Fn rman_set_bustag
+function associates a
+.Vt bus_space_tag_t
+.Fa t
+with the resource
+.Fa r .
+The
+.Fn rman_get_bustag
+function is used to retrieve this tag once set.
+.Pp
+The
+.Fn rman_set_bushandle
+function associates a
+.Vt bus_space_handle_t
+.Fa h
+with the resource
+.Fa r .
+The
+.Fn rman_get_bushandle
+function is used to retrieve this handle once set.
+.Pp
+The
+.Fn rman_set_virtual
+function is used to associate a kernel virtual address with a resource
+.Fa r .
+The
+.Fn rman_get_virtual
+function can be used to retrieve the KVA once set.
+.Pp
+The
+.Fn rman_set_rid
+function associates a resource identifier with a resource
+.Fa r .
+The
+.Fn rman_get_rid
+function retrieves this RID.
+.Pp
+The
+.Fn rman_get_device
+function returns a pointer to the device which reserved the resource
+.Fa r .
+.Sh SEE ALSO
+.Xr bus_activate_resource 9 ,
+.Xr bus_adjust_resource 9 ,
+.Xr bus_alloc_resource 9 ,
+.Xr bus_release_resource 9 ,
+.Xr bus_set_resource 9 ,
+.Xr mutex 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/rmlock.9 b/share/man/man9/rmlock.9
new file mode 100644
index 000000000000..893eb2534f05
--- /dev/null
+++ b/share/man/man9/rmlock.9
@@ -0,0 +1,256 @@
+.\" Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org>
+.\" Copyright (c) 2006 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.\" Based on rwlock.9 man page
+.Dd November 16, 2011
+.Dt RMLOCK 9
+.Os
+.Sh NAME
+.Nm rmlock ,
+.Nm rm_init ,
+.Nm rm_init_flags ,
+.Nm rm_destroy ,
+.Nm rm_rlock ,
+.Nm rm_try_rlock ,
+.Nm rm_wlock ,
+.Nm rm_runlock ,
+.Nm rm_wunlock ,
+.Nm rm_wowned ,
+.Nm RM_SYSINIT
+.Nd kernel reader/writer lock optimized for mostly read access patterns
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/rmlock.h
+.Ft void
+.Fn rm_init "struct rmlock *rm" "const char *name"
+.Ft void
+.Fn rm_init_flags "struct rmlock *rm" "const char *name" "int opts"
+.Ft void
+.Fn rm_destroy "struct rmlock *rm"
+.Ft void
+.Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+.Ft int
+.Fn rm_try_rlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+.Ft void
+.Fn rm_wlock "struct rmlock *rm"
+.Ft void
+.Fn rm_runlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+.Ft void
+.Fn rm_wunlock "struct rmlock *rm"
+.Ft int
+.Fn rm_wowned "const struct rmlock *rm"
+.In sys/kernel.h
+.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" "int opts"
+.Sh DESCRIPTION
+Mostly reader locks allow shared access to protected data by multiple threads,
+or exclusive access by a single thread.
+The threads with shared access are known as
+.Em readers
+since they only read the protected data.
+A thread with exclusive access is known as a
+.Em writer
+since it can modify protected data.
+.Pp
+Read mostly locks are designed to be efficient for locks almost exclusively
+used as reader locks and as such should be used for protecting data that
+rarely changes.
+Acquiring an exclusive lock after the lock had been locked for shared access
+is an expensive operation.
+.Pp
+Although reader/writer locks look very similar to
+.Xr sx 9
+locks, their usage pattern is different.
+Reader/writer locks can be treated as mutexes (see
+.Xr mutex 9 )
+with shared/exclusive semantics unless initialized with
+.Dv RM_SLEEPABLE .
+Unlike
+.Xr sx 9 ,
+an
+.Nm
+can be locked while holding a non-spin mutex, and an
+.Nm
+cannot be held while sleeping, again unless initialized with
+.Dv RM_SLEEPABLE .
+The
+.Nm
+locks have full priority propagation like mutexes.
+The
+.Va rm_priotracker
+structure argument supplied in
+.Fn rm_rlock
+and
+.Fn rm_runlock
+is used to keep track of the read owner(s).
+Another important property is that shared holders of
+.Nm
+can recurse if the lock has been initialized with the
+.Dv LO_RECURSABLE
+option, however exclusive locks are not allowed to recurse.
+.Ss Macros and Functions
+.Bl -tag -width indent
+.It Fn rm_init "struct rmlock *rm" "const char *name"
+Initialize structure located at
+.Fa rm
+as mostly reader lock, described by
+.Fa name .
+The name description is used solely for debugging purposes.
+This function must be called before any other operations
+on the lock.
+.It Fn rm_init_flags "struct rmlock *rm" "const char *name" "int opts"
+Initialize the rm lock just like the
+.Fn rm_init
+function, but specifying a set of optional flags to alter the
+behaviour of
+.Fa rm ,
+through the
+.Fa opts
+argument.
+It contains one or more of the following flags:
+.Bl -tag -width ".Dv RM_NOWITNESS"
+.It Dv RM_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv RM_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa rm .
+.It Dv RM_SLEEPABLE
+Allow writers to sleep while holding the lock.
+Readers must not sleep while holding the lock and can avoid to sleep on
+taking the lock by using
+.Fn rm_try_rlock
+instead of
+.Fn rm_rlock .
+.El
+.It Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+Lock
+.Fa rm
+as a reader.
+Using
+.Fa tracker
+to track read owners of a lock for priority propagation.
+This data structure is only used internally by
+.Nm
+and must persist until
+.Fn rm_runlock
+has been called.
+This data structure can be allocated on the stack since
+rmlocks cannot be held while sleeping.
+If any thread holds this lock exclusively, the current thread blocks,
+and its priority is propagated to the exclusive holder.
+If the lock was initialized with the
+.Dv LO_RECURSABLE
+option the
+.Fn rm_rlock
+function can be called when the thread has already acquired reader
+access on
+.Fa rm .
+This is called
+.Dq "recursing on a lock" .
+.It Fn rm_try_rlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+Try to lock
+.Fa rm
+as a reader.
+.Fn rm_try_rlock
+will return 0 if the lock cannot be acquired immediately;
+otherwise the lock will be acquired and a non-zero value will be returned.
+Note that
+.Fn rm_try_rlock
+may fail even while the lock is not currently held by a writer.
+.It Fn rm_wlock "struct rmlock *rm"
+Lock
+.Fa rm
+as a writer.
+If there are any shared owners of the lock, the current thread blocks.
+The
+.Fn rm_wlock
+function cannot be called recursively.
+.It Fn rm_runlock "struct rmlock *rm" "struct rm_priotracker* tracker"
+This function releases a shared lock previously acquired by
+.Fn rm_rlock .
+The
+.Fa tracker
+argument must match the
+.Fa tracker
+argument used for acquiring the shared lock
+.It Fn rm_wunlock "struct rmlock *rm"
+This function releases an exclusive lock previously acquired by
+.Fn rm_wlock .
+.It Fn rm_destroy "struct rmlock *rm"
+This functions destroys a lock previously initialized with
+.Fn rm_init .
+The
+.Fa rm
+lock must be unlocked.
+.It Fn rm_wowned "const struct rmlock *rm"
+This function returns a non-zero value if the current thread owns an
+exclusive lock on
+.Fa rm .
+.El
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr mutex 9 ,
+.Xr panic 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sx 9
+.Sh HISTORY
+These
+functions appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An "Stephan Uphoff" .
+This manual page was written by
+.An "Gleb Smirnoff"
+for rwlock and modified to reflect rmlock by
+.An "Stephan Uphoff" .
+.Sh BUGS
+The
+.Nm
+implementation is currently not optimized for single processor systems.
+.Pp
+.Fn rm_try_rlock
+can fail transiently even when there is no writer, while another reader
+updates the state on the local CPU.
+.Pp
+The
+.Nm
+implementation uses a single per CPU list shared by all
+rmlocks in the system.
+If rmlocks become popular, hashing to multiple per CPU queues may
+be needed to speed up the writer lock process.
+.Pp
+The
+.Nm
+can currently not be used as a lock argument for condition variable
+wait functions.
diff --git a/share/man/man9/rtalloc.9 b/share/man/man9/rtalloc.9
new file mode 100644
index 000000000000..ab5379a8803f
--- /dev/null
+++ b/share/man/man9/rtalloc.9
@@ -0,0 +1,273 @@
+.\"
+.\" Copyright 1996 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2011
+.Dt RTALLOC 9
+.Os
+.Sh NAME
+.Nm rtalloc1_fib ,
+.Nm rtalloc_ign_fib ,
+.Nm rtalloc_fib
+.Nd look up a route in the kernel routing table
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/route.h
+.Ft "struct rtentry *"
+.Fn rtalloc1_fib "struct sockaddr *dst" "int report" "u_long flags" "u_int fibnum"
+.Ft void
+.Fn rtalloc_fib "struct route *ro" "u_int fibnum"
+.Ft void
+.Fn rtalloc_ign_fib "struct route *ro" "u_long flags" "u_int fibnum"
+.Fn RTFREE_LOCKED "struct rt_entry *rt"
+.Fn RTFREE "struct rt_entry *rt"
+.Fn RT_LOCK "struct rt_entry *rt"
+.Fn RT_UNLOCK "struct rt_entry *rt"
+.Fn RT_ADDREF "struct rt_entry *rt"
+.Fn RT_REMREF "struct rt_entry *rt"
+.Ft void
+.Fn rtfree "struct rt_entry *rt"
+.Ft "struct rtentry *"
+.Fn rtalloc1 "struct sockaddr *dst" "int report" "u_long flags"
+.Ft void
+.Fn rtalloc "struct route *ro"
+.Ft void
+.Fn rtalloc_ign "struct route *ro" "u_long flags"
+.Pp
+.Cd options RADIX_MPATH
+.Sh DESCRIPTION
+The kernel uses a radix tree structure to manage routes for the
+networking subsystem.
+If compiled with
+.Cd options RADIX_MPATH
+kernel may maintain several independent forwarding information databases (FIBs).
+The
+.Fn rtalloc
+family of routines is used by protocols to query these structures for a
+route corresponding to a particular end-node address, and to cause
+certain protocol\- and interface-specific actions to take place.
+.Pp
+The
+.Fn rtalloc1_fib
+function is the most general form of
+.Fn rtalloc ,
+and all of the other forms are implemented as calls to it.
+It takes a
+.Fa "struct sockaddr *"
+directly as the
+.Fa dst
+argument.
+The second argument,
+.Fa report ,
+controls whether the routing sockets are notified when a lookup fails.
+The third argument,
+.Fa flags ,
+is a combination of
+the following values:
+.Bl -item -offset indent
+.It
+.Dv RTF_RNH_LOCKED
+indicates that the radix tree lock is already held
+.El
+.Pp
+The last argument
+.Fa fibnum
+specifies number of forwarding information database (FIB) on which
+the lookup should be performed.
+In case of success the
+.Fn rtalloc1_fib
+function returns a pointer to a locked
+.Vt "struct rtentry"
+with an additional reference.
+.Pp
+The
+.Fn rtalloc_fib
+is the most simple variant.
+Its main argument is
+.Fa ro ,
+a pointer to a
+.Fa "struct route" ,
+which is defined as follows:
+.Bd -literal -offset indent
+struct route {
+ struct rtentry *ro_rt;
+ struct llentry *ro_lle;
+ struct sockaddr ro_dst;
+};
+.Ed
+.Pp
+Thus, this function can only be used for address families which are
+smaller than the default
+.Ft "struct sockaddr" .
+Before calling
+.Fn rtalloc_fib
+for the first time, callers should ensure that unused bits of the
+structure are set to zero.
+The second argument
+.Fa fibnum
+is FIB number.
+In case of success of the
+.Fn rtalloc_fib
+the
+.Fa ro_rt
+points to a valid and unlocked
+.Xr rtentry 9 ,
+which has an additional reference put on it, freeing which is
+responsibility of the caller.
+On subsequent calls,
+.Fn rtalloc_fib
+returns without performing a lookup if
+.Fa ro->ro_rt
+is non-null and the
+.Dv RTF_UP
+flag is set in the rtentry's
+.Fa rt_flags
+field.
+.Pp
+The
+.Fn rtalloc_ign_fib
+function is the same as the
+.Fn rtalloc_fib ,
+but there is additional
+.Fa flags
+argument, which is same as in
+.Fn rtalloc1_fib .
+.Pp
+The
+.Fn RTFREE_LOCKED
+macro is used to unref and possibly free a locked routing entry
+with one our reference, for example previously allocated by
+.Fn rtalloc1_fib .
+.Pp
+The
+.Fn RTFREE
+macro is used to unref and possibly free an unlocked route entries with
+one our reference, for example previously allocated by
+.Fn rtalloc_fib
+or
+.Fn rtalloc_ign_fib .
+.Pp
+Both
+.Fn RTFREE_LOCKED
+and
+.Fn RTFREE
+macros decrement the reference count on the routing table entry,
+and proceed with actual freeing if the reference count has reached zero.
+.Pp
+The
+.Fn RT_LOCK
+macro is used to lock a routing table entry.
+.Pp
+The
+.Fn RT_UNLOCK
+macro is used to unlock a routing table entry.
+.Pp
+The
+.Fn RT_ADDREF
+macro increments the reference count on a previously locked route entry.
+It should be used whenever a reference to an
+.Xr rtentry 9
+is going to be stored outside the routing table.
+.Pp
+The
+.Fn RT_REMREF
+macro decrements the reference count on a previously locked route entry.
+Its usage is contrary to
+.Fn RT_ADDREF .
+.Pp
+The
+.Fn rtfree
+function does the actual free of the routing table entry, and shouldn't
+be called directly by facilities, that just perform routing table lookups.
+.Sh LEGACY INTERFACE
+Prior to introduction of multiple routing tables functions did not
+require the
+.Fa "u_int fibnum"
+argument.
+Legacy
+.Fn rtalloc1 ,
+.Fn rtalloc
+and
+.Fn rtalloc_ign
+functions are kept for compatibility, and are equivalent to
+calling new interface with
+.Fa fibnum
+argument equal to
+.Va 0 ,
+which implies default forwarding table.
+.Sh RETURN VALUES
+The
+.Fn rtalloc1_fib
+function returns a pointer to a locked routing-table entry if it succeeds,
+otherwise a null pointer.
+The
+.Fn rtalloc_fib
+and
+.Fn rtalloc_ign_fib
+functions do not return a value, but they fill in the
+.Fa *ro_rt
+member of the
+.Fa *ro
+argument with a pointer to an unlocked routing-table entry if they
+succeed, otherwise a null pointer.
+In a case of success all functions put a reference on the
+routing-table entry, freeing of which is responsibility of the caller.
+Lack of a route should in most cases be
+translated to the
+.Xr errno 2
+value
+.Er EHOSTUNREACH .
+.Sh SEE ALSO
+.Xr route 4 ,
+.Xr rtentry 9
+.Sh HISTORY
+The
+.Nm rtalloc
+facility first appeared in
+.Bx 4.2 ,
+although with much different internals.
+The
+.Fn rtalloc_ign
+function and the
+.Fa flags
+argument to
+.Fn rtalloc1
+first appeared in
+.Fx 2.0 .
+Routing table locking was introduced in
+.Fx 5.2 .
+Multiple routing tables were introduced in
+.Fx 8.0 .
+.Sh AUTHORS
+The original version of this manual page was written by
+.An -nosplit
+.An "Garrett Wollman" .
+It was significantly updated by
+.An "Gleb Smirnoff" .
diff --git a/share/man/man9/rtentry.9 b/share/man/man9/rtentry.9
new file mode 100644
index 000000000000..d7e6953f5f82
--- /dev/null
+++ b/share/man/man9/rtentry.9
@@ -0,0 +1,252 @@
+.\"
+.\" Copyright 1996 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 11, 2008
+.Dt RTENTRY 9
+.Os
+.Sh NAME
+.Nm rtentry
+.Nd structure of an entry in the kernel routing table
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/route.h
+.Sh DESCRIPTION
+The kernel provides a common mechanism by which all protocols can store
+and retrieve entries from a central table of routes.
+Parts of this
+mechanism are also used to interact with user-level processes by means
+of a socket in the
+.Xr route 4
+pseudo-protocol family.
+The
+.In net/route.h
+header file defines the structures and manifest constants used in this
+facility.
+.Pp
+The basic structure of a route is defined by
+.Vt "struct rtentry" ,
+which includes the following fields:
+.Bl -tag -offset indent -width 6n
+.It Vt "struct radix_node rt_nodes[2]" ;
+Glue used by the radix-tree routines.
+These members also include in
+their substructure the key (i.e., destination address) and mask used
+when the route was created.
+The
+.Fn rt_key rt
+and
+.Fn rt_mask rt
+macros can be used to extract this information (in the form of a
+.Vt "struct sockaddr *" )
+given a
+.Vt "struct rtentry *" .
+.It Vt "struct sockaddr *rt_gateway" ;
+The
+.Dq target
+of the route, which can either represent a destination in its own
+right (some protocols will put a link-layer address here), or some
+intermediate stop on the way to that destination (if the
+.Dv RTF_GATEWAY
+flag is set).
+.It Vt "int rt_flags" ;
+See below.
+.It Vt "int rt_refcnt" ;
+Route entries are reference-counted; this field indicates the number
+of external (to the radix tree) references.
+.It Vt "struct ifnet *rt_ifp" ;
+.It Vt "struct ifaddr *rt_ifa" ;
+These two fields represent the
+.Dq answer ,
+as it were, to the question posed by a route lookup; that is, they
+name the interface and interface address to be used in sending a
+packet to the destination or set of destinations which this route
+represents.
+.It Vt "struct rt_metrics_lite rt_rmx" ;
+See below.
+If the
+.Dv RTF_UP
+flag is not present, the
+.Fn rtfree
+function will delete the route from the radix tree when the last
+reference drops.
+.It Vt "struct rtentry *rt_gwroute" ;
+This member is a reference to a route whose destination is
+.Va rt_gateway .
+It is only used for
+.Dv RTF_GATEWAY
+routes.
+.It Vt "struct mtx rt_mtx" ;
+Mutex to lock this routing entry.
+.El
+.Pp
+The following flag bits are defined:
+.Bl -tag -offset indent -width ".Dv RTF_BLACKHOLE" -compact
+.It Dv RTF_UP
+The route is not deleted.
+.It Dv RTF_GATEWAY
+The route points to an intermediate destination and not the ultimate
+recipient; the
+.Va rt_gateway
+and
+.Va rt_gwroute
+fields name that destination.
+.It Dv RTF_HOST
+This is a host route.
+.It Dv RTF_REJECT
+The destination is presently unreachable.
+This should result in an
+.Er EHOSTUNREACH
+error from output routines.
+.It Dv RTF_DYNAMIC
+This route was created dynamically by
+.Fn rtredirect .
+.It Dv RTF_MODIFIED
+This route was modified by
+.Fn rtredirect .
+.It Dv RTF_DONE
+Used only in the
+.Xr route 4
+protocol, indicating that the request was executed.
+.It Dv RTF_XRESOLVE
+When this route is returned as a result of a lookup, send a report on
+the
+.Xr route 4
+interface requesting that an external process perform resolution for
+this route.
+.It Dv RTF_STATIC
+Indicates that this route was manually added by means of the
+.Xr route 8
+command.
+.It Dv RTF_BLACKHOLE
+Requests that output sent via this route be discarded.
+.It Dv RTF_PROTO1
+.It Dv RTF_PROTO2
+.It Dv RTF_PROTO3
+Protocol-specific.
+.It Dv RTF_PRCLONING
+This flag is obsolete and simply ignored by facility.
+.It Dv RTF_PINNED
+(Reserved for future use to indicate routes which are not to be
+modified by a routing protocol.)
+.It Dv RTF_LOCAL
+Indicates that the destination of this route is an address configured
+as belonging to this system.
+.It Dv RTF_BROADCAST
+Indicates that the destination is a broadcast address.
+.It Dv RTF_MULTICAST
+Indicates that the destination is a multicast address.
+.El
+.Pp
+Every route has associated with it a set of metrics, stored in
+.Vt "struct rt_metrics_lite" .
+Metrics are supplied in
+.Vt "struct rt_metrics"
+passed with routing control messages via
+.Xr route 4
+API.
+Currently only
+.Vt rmx_mtu , rmx_expire ,
+and
+.Vt rmx_pksent
+metrics are used in
+.Vt "struct rt_metrics_lite" .
+All others are ignored.
+.Pp
+The following metrics are defined by
+.Vt "struct rt_metrics" :
+.Bl -tag -offset indent -width 6n
+.It Vt "u_long rmx_locks" ;
+Flag bits indicating which metrics the kernel is not permitted to
+dynamically modify.
+.It Vt "u_long rmx_mtu" ;
+MTU for this path.
+.It Vt "u_long rmx_hopcount" ;
+Number of intermediate systems on the path to this destination.
+.It Vt "u_long rmx_expire" ;
+The time
+(a la
+.Xr time 3 )
+at which this route should expire, or zero if it should never expire.
+It is the responsibility of individual protocol suites to ensure that routes
+are actually deleted once they expire.
+.It Vt "u_long rmx_recvpipe" ;
+Nominally, the bandwidth-delay product for the path
+.Em from
+the destination
+.Em to
+this system.
+In practice, this value is used to set the size of the
+receive buffer (and thus the window in sliding-window protocols like
+.Tn TCP ) .
+.It Vt "u_long rmx_sendpipe" ;
+As before, but in the opposite direction.
+.It Vt "u_long rmx_ssthresh" ;
+The slow-start threshold used in
+.Tn TCP
+congestion-avoidance.
+.It Vt "u_long rmx_rtt" ;
+The round-trip time to this destination, in units of
+.Dv RMX_RTTUNIT
+per second.
+.It Vt "u_long rmx_rttvar" ;
+The average deviation of the round-trip time to this destination, in
+units of
+.Dv RMX_RTTUNIT
+per second.
+.It Vt "u_long rmx_pksent" ;
+A count of packets successfully sent via this route.
+.It Vt "u_long rmx_filler[4]" ;
+.\" XXX badly named
+Empty space available for protocol-specific information.
+.El
+.Sh SEE ALSO
+.Xr route 4 ,
+.Xr route 8 ,
+.Xr rtalloc 9
+.Sh HISTORY
+The
+.Vt rtentry
+structure first appeared in
+.Bx 4.2 .
+The radix-tree representation of the routing table and the
+.Vt rt_metrics
+structure first appeared in
+.Bx 4.3 reno .
+.Sh AUTHORS
+This manual page was written by
+.An Garrett Wollman .
+.Sh BUGS
+There are a number of historical relics remaining in this interface.
+The
+.Va rt_gateway
+and
+.Va rmx_filler
+fields could be named better.
diff --git a/share/man/man9/runqueue.9 b/share/man/man9/runqueue.9
new file mode 100644
index 000000000000..453ac9b95693
--- /dev/null
+++ b/share/man/man9/runqueue.9
@@ -0,0 +1,137 @@
+.\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 15, 2010
+.Dt RUNQUEUE 9
+.Os
+.Sh NAME
+.Nm choosethread ,
+.Nm procrunnable ,
+.Nm remrunqueue ,
+.Nm setrunqueue
+.Nd manage the queue of runnable processes
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Vt "extern struct rq itqueues[]" ;
+.Vt "extern struct rq rtqueues[]" ;
+.Vt "extern struct rq queues[]" ;
+.Vt "extern struct rq idqueues[]" ;
+.Ft struct thread *
+.Fn choosethread "void"
+.Ft int
+.Fn procrunnable "void"
+.Ft void
+.Fn remrunqueue "struct thread *td"
+.Ft void
+.Fn setrunqueue "struct thread *td"
+.Sh DESCRIPTION
+The run queue consists of four priority queues:
+.Va itqueues
+for interrupt threads,
+.Va rtqueues
+for realtime priority processes,
+.Va queues
+for time sharing processes, and
+.Va idqueues
+for idle priority processes.
+Each priority queue consists of an array of
+.Dv NQS
+queue header structures.
+Each queue header identifies a list of runnable processes of equal priority.
+Each queue also has a single word that contains a bit mask identifying
+non-empty queues to assist in selecting a process quickly.
+These are named
+.Va itqueuebits ,
+.Va rtqueuebits ,
+.Va queuebits ,
+and
+.Va idqueuebits .
+The run queues are protected by the
+.Va sched_lock
+mutex.
+.Pp
+.Fn procrunnable
+returns zero if there are no runnable processes other than the idle process.
+If there is at least one runnable process other than the idle process, it
+will return a non-zero value.
+Note that the
+.Va sched_lock
+mutex does
+.Em not
+need to be held when this function is called.
+There is a small race window where one CPU may place a process on the run queue
+when there are currently no other runnable processes while another CPU is
+calling this function.
+In that case the second CPU will simply travel through the idle loop one
+additional time before noticing that there is a runnable process.
+This works because idle CPUs are not halted in SMP systems.
+If idle CPUs are halted in SMP systems, then this race condition might have
+more serious repercussions in the losing case, and
+.Fn procrunnable
+may have to require that the
+.Va sched_lock
+mutex be acquired.
+.Pp
+.Fn choosethread
+returns the highest priority runnable thread.
+If there are no runnable threads, then the idle thread is returned.
+This function is called by
+.Fn cpu_switch
+and
+.Fn cpu_throw
+to determine which thread to switch to.
+.Fn choosethread
+must be called with the
+.Va sched_lock
+mutex held.
+.Pp
+.Fn setrunqueue
+adds the thread
+.Fa td
+to the tail of the appropriate queue in the proper priority queue.
+The thread must be runnable, i.e.\&
+.Va p_stat
+must be set to
+.Dv SRUN .
+This function must be called with the
+.Va sched_lock
+mutex held.
+.Pp
+.Fn remrunqueue
+removes thread
+.Fa td
+from its run queue.
+If
+.Fa td
+is not on a run queue, then the kernel will
+.Xr panic 9 .
+This function must be called with the
+.Va sched_lock
+mutex held.
+.Sh SEE ALSO
+.Xr cpu_switch 9 ,
+.Xr scheduler 9 ,
+.Xr sleepqueue 9
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
new file mode 100644
index 000000000000..f7da699a4583
--- /dev/null
+++ b/share/man/man9/rwlock.9
@@ -0,0 +1,313 @@
+.\" Copyright (c) 2006 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 16, 2011
+.Dt RWLOCK 9
+.Os
+.Sh NAME
+.Nm rwlock ,
+.Nm rw_init ,
+.Nm rw_init_flags,
+.Nm rw_destroy ,
+.Nm rw_rlock ,
+.Nm rw_wlock ,
+.Nm rw_runlock ,
+.Nm rw_wunlock ,
+.Nm rw_unlock ,
+.Nm rw_try_rlock ,
+.Nm rw_try_upgrade ,
+.Nm rw_try_wlock ,
+.Nm rw_downgrade ,
+.Nm rw_sleep ,
+.Nm rw_initialized ,
+.Nm rw_wowned ,
+.Nm rw_assert ,
+.Nm RW_SYSINIT
+.Nd kernel reader/writer lock
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/rwlock.h
+.Ft void
+.Fn rw_init "struct rwlock *rw" "const char *name"
+.Ft void
+.Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts"
+.Ft void
+.Fn rw_destroy "struct rwlock *rw"
+.Ft void
+.Fn rw_rlock "struct rwlock *rw"
+.Ft void
+.Fn rw_wlock "struct rwlock *rw"
+.Ft int
+.Fn rw_try_rlock "struct rwlock *rw"
+.Ft int
+.Fn rw_try_wlock "struct rwlock *rw"
+.Ft void
+.Fn rw_runlock "struct rwlock *rw"
+.Ft void
+.Fn rw_wunlock "struct rwlock *rw"
+.Ft void
+.Fn rw_unlock "struct rwlock *rw"
+.Ft int
+.Fn rw_try_upgrade "struct rwlock *rw"
+.Ft void
+.Fn rw_downgrade "struct rwlock *rw"
+.Ft int
+.Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn rw_initialized "const struct rwlock *rw"
+.Ft int
+.Fn rw_wowned "const struct rwlock *rw"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
+.Ft void
+.Fn rw_assert "const struct rwlock *rw" "int what"
+.In sys/kernel.h
+.Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
+.Sh DESCRIPTION
+Reader/writer locks allow shared access to protected data by multiple threads,
+or exclusive access by a single thread.
+The threads with shared access are known as
+.Em readers
+since they only read the protected data.
+A thread with exclusive access is known as a
+.Em writer
+since it can modify protected data.
+.Pp
+Although reader/writer locks look very similar to
+.Xr sx 9
+locks, their usage pattern is different.
+Reader/writer locks can be treated as mutexes (see
+.Xr mutex 9 )
+with shared/exclusive semantics.
+Unlike
+.Xr sx 9 ,
+an
+.Nm
+can be locked while holding a non-spin mutex, and an
+.Nm
+cannot be held while sleeping.
+The
+.Nm
+locks have priority propagation like mutexes, but priority
+can be propagated only to an exclusive holder.
+This limitation comes from the fact that shared owners
+are anonymous.
+Another important property is that shared holders of
+.Nm
+can recurse,
+and exclusive locks can be made recursive selectively.
+.Ss Macros and Functions
+.Bl -tag -width indent
+.It Fn rw_init "struct rwlock *rw" "const char *name"
+Initialize structure located at
+.Fa rw
+as reader/writer lock, described by name
+.Fa name .
+The description is used solely for debugging purposes.
+This function must be called before any other operations
+on the lock.
+.It Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts"
+Initialize the rw lock just like the
+.Fn rw_init
+function, but specifying a set of optional flags to alter the
+behaviour of
+.Fa rw ,
+through the
+.Fa opts
+argument.
+It contains one or more of the following flags:
+.Bl -tag -width ".Dv RW_NOPROFILE"
+.It Dv RW_DUPOK
+Witness should not log messages about duplicate locks being acquired.
+.It Dv RW_NOPROFILE
+Do not profile this lock.
+.It Dv RW_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv RW_QUIET
+Do not log any operations for this lock via
+.Xr ktr 4 .
+.It Dv RW_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa rw .
+.El
+.It Fn rw_rlock "struct rwlock *rw"
+Lock
+.Fa rw
+as a reader.
+If any thread holds this lock exclusively, the current thread blocks,
+and its priority is propagated to the exclusive holder.
+The
+.Fn rw_rlock
+function can be called when the thread has already acquired reader
+access on
+.Fa rw .
+This is called
+.Dq "recursing on a lock" .
+.It Fn rw_wlock "struct rwlock *rw"
+Lock
+.Fa rw
+as a writer.
+If there are any shared owners of the lock, the current thread blocks.
+The
+.Fn rw_wlock
+function can be called recursively only if
+.Fa rw
+has been initialized with the
+.Dv RW_RECURSE
+option enabled.
+.It Fn rw_try_rlock "struct rwlock *rw"
+Try to lock
+.Fa rw
+as a reader.
+This function will return true if the operation succeeds, otherwise 0
+will be returned.
+.It Fn rw_try_wlock "struct rwlock *rw"
+Try to lock
+.Fa rw
+as a writer.
+This function will return true if the operation succeeds, otherwise 0
+will be returned.
+.It Fn rw_runlock "struct rwlock *rw"
+This function releases a shared lock previously acquired by
+.Fn rw_rlock .
+.It Fn rw_wunlock "struct rwlock *rw"
+This function releases an exclusive lock previously acquired by
+.Fn rw_wlock .
+.It Fn rw_unlock "struct rwlock *rw"
+This function releases a shared lock previously acquired by
+.Fn rw_rlock
+or an exclusive lock previously acquired by
+.Fn rw_wlock .
+.It Fn rw_try_upgrade "struct rwlock *rw"
+Attempt to upgrade a single shared lock to an exclusive lock.
+The current thread must hold a shared lock of
+.Fa rw .
+This will only succeed if the current thread holds the only shared lock on
+.Fa rw ,
+and it only holds a single shared lock.
+If the attempt succeeds
+.Fn rw_try_upgrade
+will return a non-zero value,
+and the current thread will hold an exclusive lock.
+If the attempt fails
+.Fn rw_try_upgrade
+will return zero,
+and the current thread will still hold a shared lock.
+.It Fn rw_downgrade "struct rwlock *rw"
+Convert an exclusive lock into a single shared lock.
+The current thread must hold an exclusive lock of
+.Fa rw .
+.It Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
+Atomically release
+.Fa rw
+while waiting for an event.
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.It Fn rw_initialized "const struct rwlock *rw"
+This function returns non-zero if
+.Fa rw
+has been initialized, and zero otherwise.
+.It Fn rw_destroy "struct rwlock *rw"
+This functions destroys a lock previously initialized with
+.Fn rw_init .
+The
+.Fa rw
+lock must be unlocked.
+.It Fn rw_wowned "const struct rwlock *rw"
+This function returns a non-zero value if the current thread owns an
+exclusive lock on
+.Fa rw .
+.It Fn rw_assert "const struct rwlock *rw" "int what"
+This function allows assertions specified in
+.Fa what
+to be made about
+.Fa rw .
+If the assertions are not true and the kernel is compiled
+with
+.Cd "options INVARIANTS"
+and
+.Cd "options INVARIANT_SUPPORT" ,
+the kernel will panic.
+Currently the following assertions are supported:
+.Bl -tag -width ".Dv RA_UNLOCKED"
+.It Dv RA_LOCKED
+Assert that current thread holds either a shared or exclusive lock
+of
+.Fa rw .
+.It Dv RA_RLOCKED
+Assert that current thread holds a shared lock of
+.Fa rw .
+.It Dv RA_WLOCKED
+Assert that current thread holds an exclusive lock of
+.Fa rw .
+.It Dv RA_UNLOCKED
+Assert that current thread holds neither a shared nor exclusive lock of
+.Fa rw .
+.El
+.El
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr mutex 9 ,
+.Xr panic 9 ,
+.Xr sema 9 ,
+.Xr sx 9
+.Sh HISTORY
+These
+functions appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An "John Baldwin" .
+This manual page was written by
+.An "Gleb Smirnoff" .
+.Sh BUGS
+If
+.Dv WITNESS
+is not included in the kernel,
+then it is impossible to assert that the current thread does or does not
+hold a read lock.
+In the
+.Pf non- Dv WITNESS
+case, the
+.Dv RA_LOCKED
+and
+.Dv RA_RLOCKED
+assertions merely check that some thread holds a read lock.
+.Pp
+Reader/writer is a bit of an awkward name.
+An
+.Nm
+can also be called a
+.Dq Robert Watson
+lock if desired.
diff --git a/share/man/man9/sbuf.9 b/share/man/man9/sbuf.9
new file mode 100644
index 000000000000..7336c42d80e3
--- /dev/null
+++ b/share/man/man9/sbuf.9
@@ -0,0 +1,531 @@
+.\"-
+.\" Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 21, 2011
+.Dt SBUF 9
+.Os
+.Sh NAME
+.Nm sbuf ,
+.Nm sbuf_new ,
+.Nm sbuf_new_auto ,
+.Nm sbuf_new_for_sysctl ,
+.Nm sbuf_clear ,
+.Nm sbuf_setpos ,
+.Nm sbuf_bcat ,
+.Nm sbuf_bcopyin ,
+.Nm sbuf_bcpy ,
+.Nm sbuf_cat ,
+.Nm sbuf_copyin ,
+.Nm sbuf_cpy ,
+.Nm sbuf_printf ,
+.Nm sbuf_vprintf ,
+.Nm sbuf_putc ,
+.Nm sbuf_set_drain ,
+.Nm sbuf_trim ,
+.Nm sbuf_error ,
+.Nm sbuf_finish ,
+.Nm sbuf_data ,
+.Nm sbuf_len ,
+.Nm sbuf_done ,
+.Nm sbuf_delete
+.Nd safe string composition
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sbuf.h
+.Ft typedef\ int ( sbuf_drain_func ) ( void\ *arg, const\ char\ *data, int\ len ) ;
+.Pp
+.Ft struct sbuf *
+.Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags"
+.Ft struct sbuf *
+.Fn sbuf_new_auto
+.Ft void
+.Fn sbuf_clear "struct sbuf *s"
+.Ft int
+.Fn sbuf_setpos "struct sbuf *s" "int pos"
+.Ft int
+.Fn sbuf_bcat "struct sbuf *s" "const void *buf" "size_t len"
+.Ft int
+.Fn sbuf_bcopyin "struct sbuf *s" "const void *uaddr" "size_t len"
+.Ft int
+.Fn sbuf_bcpy "struct sbuf *s" "const void *buf" "size_t len"
+.Ft int
+.Fn sbuf_cat "struct sbuf *s" "const char *str"
+.Ft int
+.Fn sbuf_copyin "struct sbuf *s" "const void *uaddr" "size_t len"
+.Ft int
+.Fn sbuf_cpy "struct sbuf *s" "const char *str"
+.Ft int
+.Fn sbuf_printf "struct sbuf *s" "const char *fmt" "..."
+.Ft int
+.Fn sbuf_vprintf "struct sbuf *s" "const char *fmt" "va_list ap"
+.Ft int
+.Fn sbuf_putc "struct sbuf *s" "int c"
+.Ft void
+.Fn sbuf_set_drain "struct sbuf *s" "sbuf_drain_func *func" "void *arg"
+.Ft int
+.Fn sbuf_trim "struct sbuf *s"
+.Ft int
+.Fn sbuf_error "struct sbuf *s"
+.Ft int
+.Fn sbuf_finish "struct sbuf *s"
+.Ft char *
+.Fn sbuf_data "struct sbuf *s"
+.Ft int
+.Fn sbuf_len "struct sbuf *s"
+.Ft int
+.Fn sbuf_done "struct sbuf *s"
+.Ft void
+.Fn sbuf_delete "struct sbuf *s"
+.In sys/sysctl.h
+.Ft struct sbuf *
+.Fn sbuf_new_for_sysctl "struct sbuf *s" "char *buf" "int length" "struct sysctl_req *req"
+.Sh DESCRIPTION
+The
+.Nm
+family of functions allows one to safely allocate, compose and
+release strings in kernel or user space.
+.Pp
+Instead of arrays of characters, these functions operate on structures
+called
+.Fa sbufs ,
+defined in
+.In sys/sbuf.h .
+.Pp
+Any errors encountered during the allocation or composition of the
+string will be latched in the data structure,
+making a single error test at the end of the composition
+sufficient to determine success or failure of the entire process.
+.Pp
+The
+.Fn sbuf_new
+function initializes the
+.Fa sbuf
+pointed to by its first argument.
+If that pointer is
+.Dv NULL ,
+.Fn sbuf_new
+allocates a
+.Vt struct sbuf
+using
+.Xr malloc 9 .
+The
+.Fa buf
+argument is a pointer to a buffer in which to store the actual string;
+if it is
+.Dv NULL ,
+.Fn sbuf_new
+will allocate one using
+.Xr malloc 9 .
+The
+.Fa length
+is the initial size of the storage buffer.
+The fourth argument,
+.Fa flags ,
+may be comprised of the following flags:
+.Bl -tag -width ".Dv SBUF_AUTOEXTEND"
+.It Dv SBUF_FIXEDLEN
+The storage buffer is fixed at its initial size.
+Attempting to extend the sbuf beyond this size results in an overflow condition.
+.It Dv SBUF_AUTOEXTEND
+This indicates that the storage buffer may be extended as necessary, so long
+as resources allow, to hold additional data.
+.El
+.Pp
+Note that if
+.Fa buf
+is not
+.Dv NULL ,
+it must point to an array of at least
+.Fa length
+characters.
+The result of accessing that array directly while it is in use by the
+sbuf is undefined.
+.Pp
+The
+.Fn sbuf_new_auto
+function is a shortcut for creating a completely dynamic
+.Nm .
+It is the equivalent of calling
+.Fn sbuf_new
+with values
+.Dv NULL ,
+.Dv NULL ,
+.Dv 0 ,
+and
+.Dv SBUF_AUTOEXTEND .
+.Pp
+The
+.Fn sbuf_new_for_sysctl
+function will set up an sbuf with a drain function to use
+.Fn SYSCTL_OUT
+when the internal buffer fills.
+Note that if the various functions which append to an sbuf are used while
+a non-sleepable lock is held, the user buffer should be wired using
+.Fn sysctl_wire_old_buffer .
+.Pp
+The
+.Fn sbuf_delete
+function clears the
+.Fa sbuf
+and frees any memory allocated for it.
+There must be a call to
+.Fn sbuf_delete
+for every call to
+.Fn sbuf_new .
+Any attempt to access the sbuf after it has been deleted will fail.
+.Pp
+The
+.Fn sbuf_clear
+function invalidates the contents of the
+.Fa sbuf
+and resets its position to zero.
+.Pp
+The
+.Fn sbuf_setpos
+function sets the
+.Fa sbuf Ns 's
+end position to
+.Fa pos ,
+which is a value between zero and one less than the size of the
+storage buffer.
+This effectively truncates the sbuf at the new position.
+.Pp
+The
+.Fn sbuf_bcat
+function appends the first
+.Fa len
+bytes from the buffer
+.Fa buf
+to the
+.Fa sbuf .
+.Pp
+The
+.Fn sbuf_bcopyin
+function copies
+.Fa len
+bytes from the specified userland address into the
+.Fa sbuf .
+.Pp
+The
+.Fn sbuf_bcpy
+function replaces the contents of the
+.Fa sbuf
+with the first
+.Fa len
+bytes from the buffer
+.Fa buf .
+.Pp
+The
+.Fn sbuf_cat
+function appends the NUL-terminated string
+.Fa str
+to the
+.Fa sbuf
+at the current position.
+.Pp
+The
+.Fn sbuf_set_drain
+function sets a drain function
+.Fa func
+for the
+.Fa sbuf ,
+and records a pointer
+.Fa arg
+to be passed to the drain on callback.
+The drain function cannot be changed while
+.Fa sbuf_len
+is non-zero.
+.Pp
+The registered drain function
+.Vt sbuf_drain_func
+will be called with the argument
+.Fa arg
+provided to
+.Fn sbuf_set_drain ,
+a pointer
+.Fa data
+to a byte string that is the contents of the sbuf, and the length
+.Fa len
+of the data.
+If the drain function exists, it will be called when the sbuf internal
+buffer is full, or on behalf of
+.Fn sbuf_finish .
+The drain function may drain some or all of the data, but must drain
+at least 1 byte.
+The return value from the drain function, if positive, indicates how
+many bytes were drained.
+If negative, the return value indicates the negative error code which
+will be returned from this or a later call to
+.Fn sbuf_finish .
+The returned drained length cannot be zero.
+To do unbuffered draining, initialize the sbuf with a two-byte buffer.
+The drain will be called for every byte added to the sbuf.
+The
+.Fn sbuf_bcopyin ,
+.Fn sbuf_copyin ,
+.Fn sbuf_trim ,
+and
+.Fn sbuf_data
+functions cannot be used on an sbuf with a drain.
+.Pp
+The
+.Fn sbuf_copyin
+function copies a NUL-terminated string from the specified userland
+address into the
+.Fa sbuf .
+If the
+.Fa len
+argument is non-zero, no more than
+.Fa len
+characters (not counting the terminating NUL) are copied; otherwise
+the entire string, or as much of it as can fit in the
+.Fa sbuf ,
+is copied.
+.Pp
+The
+.Fn sbuf_cpy
+function replaces the contents of the
+.Fa sbuf
+with those of the NUL-terminated string
+.Fa str .
+This is equivalent to calling
+.Fn sbuf_cat
+with a fresh
+.Fa sbuf
+or one which position has been reset to zero with
+.Fn sbuf_clear
+or
+.Fn sbuf_setpos .
+.Pp
+The
+.Fn sbuf_printf
+function formats its arguments according to the format string pointed
+to by
+.Fa fmt
+and appends the resulting string to the
+.Fa sbuf
+at the current position.
+.Pp
+The
+.Fn sbuf_vprintf
+function behaves the same as
+.Fn sbuf_printf
+except that the arguments are obtained from the variable-length argument list
+.Fa ap .
+.Pp
+The
+.Fn sbuf_putc
+function appends the character
+.Fa c
+to the
+.Fa sbuf
+at the current position.
+.Pp
+The
+.Fn sbuf_trim
+function removes trailing whitespace from the
+.Fa sbuf .
+.Pp
+The
+.Fn sbuf_error
+function returns any error value that the
+.Fa sbuf
+may have accumulated, either from the drain function, or ENOMEM if the
+.Fa sbuf
+overflowed.
+This function is generally not needed and instead the error code from
+.Fn sbuf_finish
+is the preferred way to discover whether an sbuf had an error.
+.Pp
+The
+.Fn sbuf_finish
+function will call the attached drain function if one exists until all
+the data in the
+.Fa sbuf
+is flushed.
+If there is no attached drain,
+.Fn sbuf_finish
+NUL-terminates the
+.Fa sbuf .
+In either case it marks the
+.Fa sbuf
+as finished, which means that it may no longer be modified using
+.Fn sbuf_setpos ,
+.Fn sbuf_cat ,
+.Fn sbuf_cpy ,
+.Fn sbuf_printf
+or
+.Fn sbuf_putc ,
+until
+.Fn sbuf_clear
+is used to reset the sbuf.
+.Pp
+The
+.Fn sbuf_data
+function returns the actual string;
+.Fn sbuf_data
+only works on a finished
+.Fa sbuf .
+The
+.Fn sbuf_len
+function returns the length of the string.
+For an
+.Fa sbuf
+with an attached drain,
+.Fn sbuf_len
+returns the length of the un-drained data.
+.Fn sbuf_done
+returns non-zero if the
+.Fa sbuf
+is finished.
+.Sh NOTES
+If an operation caused an
+.Fa sbuf
+to overflow, most subsequent operations on it will fail until the
+.Fa sbuf
+is finished using
+.Fn sbuf_finish
+or reset using
+.Fn sbuf_clear ,
+or its position is reset to a value between 0 and one less than the
+size of its storage buffer using
+.Fn sbuf_setpos ,
+or it is reinitialized to a sufficiently short string using
+.Fn sbuf_cpy .
+.Pp
+Drains in user-space will not always function as indicated.
+While the drain function will be called immediately on overflow from
+the
+.Fa sbuf_putc ,
+.Fa sbuf_bcat ,
+.Fa sbuf_cat
+functions,
+.Fa sbuf_printf
+and
+.Fa sbuf_vprintf
+currently have no way to determine whether there will be an overflow
+until after it occurs, and cannot do a partial expansion of the format
+string.
+Thus when using libsbuf the buffer may be extended to allow completion
+of a single printf call, even though a drain is attached.
+.Sh RETURN VALUES
+The
+.Fn sbuf_new
+function returns
+.Dv NULL
+if it failed to allocate a storage buffer, and a pointer to the new
+.Fa sbuf
+otherwise.
+.Pp
+The
+.Fn sbuf_setpos
+function returns \-1 if
+.Fa pos
+was invalid, and zero otherwise.
+.Pp
+The
+.Fn sbuf_cat ,
+.Fn sbuf_cpy ,
+.Fn sbuf_printf ,
+.Fn sbuf_putc ,
+and
+.Fn sbuf_trim
+functions
+all return \-1 if the buffer overflowed, and zero otherwise.
+.Pp
+The
+.Fn sbuf_error
+function returns a non-zero value if the buffer has an overflow or
+drain error, and zero otherwise.
+.Pp
+The
+.Fn sbuf_len
+function returns \-1 if the buffer overflowed.
+.Pp
+The
+.Fn sbuf_copyin
+function
+returns \-1 if copying string from userland failed, and number of bytes
+copied otherwise.
+.Pp
+The
+.Fn sbuf_finish 9
+function (the kernel version) returns ENOMEM if the sbuf overflowed before
+being finished,
+or returns the error code from the drain if one is attached.
+.Pp
+The
+.Fn sbuf_finish 3
+function (the userland version)
+will return zero for success and \-1 and set errno on error.
+.Sh EXAMPLES
+.Bd -literal -compact
+#include <sys/sbuf.h>
+
+struct sbuf *sb;
+
+sb = sbuf_new_auto();
+sbuf_cat(sb, "Customers found:\en");
+TAILQ_FOREACH(foo, &foolist, list) {
+ sbuf_printf(sb, " %4d %s\en", foo->index, foo->name);
+ sbuf_printf(sb, " Address: %s\en", foo->address);
+ sbuf_printf(sb, " Zip: %s\en", foo->zipcode);
+}
+if (sbuf_finish(sb) != 0) /* Check for any and all errors */
+ err(1, "Could not generate message");
+transmit_msg(sbuf_data(sb), sbuf_len(sb));
+sbuf_delete(sb);
+.Ed
+.Sh SEE ALSO
+.Xr printf 3 ,
+.Xr strcat 3 ,
+.Xr strcpy 3 ,
+.Xr copyin 9 ,
+.Xr copyinstr 9 ,
+.Xr printf 9
+.Sh HISTORY
+The
+.Nm
+family of functions first appeared in
+.Fx 4.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+family of functions was designed by
+.An Poul-Henning Kamp Aq phk@FreeBSD.org
+and implemented by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+Additional improvements were suggested by
+.An Justin T. Gibbs Aq gibbs@FreeBSD.org .
+Auto-extend support added by
+.An Kelly Yancey Aq kbyanc@FreeBSD.org .
+Drain functionality added by
+.An Matthew Fleming Aq mdf@FreeBSD.org .
+.Pp
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
diff --git a/share/man/man9/scheduler.9 b/share/man/man9/scheduler.9
new file mode 100644
index 000000000000..c56fd0b6c653
--- /dev/null
+++ b/share/man/man9/scheduler.9
@@ -0,0 +1,276 @@
+.\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 3, 2000
+.Dt SCHEDULER 9
+.Os
+.Sh NAME
+.Nm curpriority_cmp ,
+.Nm maybe_resched ,
+.Nm resetpriority ,
+.Nm roundrobin ,
+.Nm roundrobin_interval ,
+.Nm sched_setup ,
+.Nm schedclock ,
+.Nm schedcpu ,
+.Nm setrunnable ,
+.Nm updatepri
+.Nd perform round-robin scheduling of runnable processes
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft int
+.Fn curpriority_cmp "struct proc *p"
+.Ft void
+.Fn maybe_resched "struct thread *td"
+.Ft void
+.Fn propagate_priority "struct proc *p"
+.Ft void
+.Fn resetpriority "struct ksegrp *kg"
+.Ft void
+.Fn roundrobin "void *arg"
+.Ft int
+.Fn roundrobin_interval "void"
+.Ft void
+.Fn sched_setup "void *dummy"
+.Ft void
+.Fn schedclock "struct thread *td"
+.Ft void
+.Fn schedcpu "void *arg"
+.Ft void
+.Fn setrunnable "struct thread *td"
+.Ft void
+.Fn updatepri "struct thread *td"
+.Sh DESCRIPTION
+Each process has three different priorities stored in
+.Vt "struct proc" :
+.Va p_usrpri ,
+.Va p_nativepri ,
+and
+.Va p_priority .
+.Pp
+The
+.Va p_usrpri
+member is the user priority of the process calculated from a process'
+estimated CPU time and nice level.
+.Pp
+The
+.Va p_nativepri
+member is the saved priority used by
+.Fn propagate_priority .
+When a process obtains a mutex, its priority is saved in
+.Va p_nativepri .
+While it holds the mutex, the process's priority may be bumped by another
+process that blocks on the mutex.
+When the process releases the mutex, then its priority is restored to the
+priority saved in
+.Va p_nativepri .
+.Pp
+The
+.Va p_priority
+member is the actual priority of the process and is used to determine what
+.Xr runqueue 9
+it runs on, for example.
+.Pp
+The
+.Fn curpriority_cmp
+function compares the cached priority of the currently running process with
+process
+.Fa p .
+If the currently running process has a higher priority, then it will return
+a value less than zero.
+If the current process has a lower priority, then it will return a value
+greater than zero.
+If the current process has the same priority as
+.Fa p ,
+then
+.Fn curpriority_cmp
+will return zero.
+The cached priority of the currently running process is updated when a process
+resumes from
+.Xr tsleep 9
+or returns to userland in
+.Fn userret
+and is stored in the private variable
+.Va curpriority .
+.Pp
+The
+.Fn maybe_resched
+function compares the priorities of the current thread and
+.Fa td .
+If
+.Fa td
+has a higher priority than the current thread, then a context switch is
+needed, and
+.Dv KEF_NEEDRESCHED
+is set.
+.Pp
+The
+.Fn propagate_priority
+looks at the process that owns the mutex
+.Fa p
+is blocked on.
+That process's priority is bumped to the priority of
+.Fa p
+if needed.
+If the process is currently running, then the function returns.
+If the process is on a
+.Xr runqueue 9 ,
+then the process is moved to the appropriate
+.Xr runqueue 9
+for its new priority.
+If the process is blocked on a mutex, its position in the list of
+processes blocked on the mutex in question is updated to reflect its new
+priority.
+Then, the function repeats the procedure using the process that owns the
+mutex just encountered.
+Note that a process's priorities are only bumped to the priority of the
+original process
+.Fa p ,
+not to the priority of the previously encountered process.
+.Pp
+The
+.Fn resetpriority
+function recomputes the user priority of the ksegrp
+.Fa kg
+(stored in
+.Va kg_user_pri )
+and calls
+.Fn maybe_resched
+to force a reschedule of each thread in the group if needed.
+.Pp
+The
+.Fn roundrobin
+function is used as a
+.Xr timeout 9
+function to force a reschedule every
+.Va sched_quantum
+ticks.
+.Pp
+The
+.Fn roundrobin_interval
+function simply returns the number of clock ticks in between reschedules
+triggered by
+.Fn roundrobin .
+Thus, all it does is return the current value of
+.Va sched_quantum .
+.Pp
+The
+.Fn sched_setup
+function is a
+.Xr SYSINIT 9
+that is called to start the callout driven scheduler functions.
+It just calls the
+.Fn roundrobin
+and
+.Fn schedcpu
+functions for the first time.
+After the initial call, the two functions will propagate themselves by
+registering their callout event again at the completion of the respective
+function.
+.Pp
+The
+.Fn schedclock
+function is called by
+.Fn statclock
+to adjust the priority of the currently running thread's ksegrp.
+It updates the group's estimated CPU time and then adjusts the priority via
+.Fn resetpriority .
+.Pp
+The
+.Fn schedcpu
+function updates all process priorities.
+First, it updates statistics that track how long processes have been in various
+process states.
+Secondly, it updates the estimated CPU time for the current process such
+that about 90% of the CPU usage is forgotten in 5 * load average seconds.
+For example, if the load average is 2.00,
+then at least 90% of the estimated CPU time for the process should be based
+on the amount of CPU time the process has had in the last 10 seconds.
+It then recomputes the priority of the process and moves it to the
+appropriate
+.Xr runqueue 9
+if necessary.
+Thirdly, it updates the %CPU estimate used by utilities such as
+.Xr ps 1
+and
+.Xr top 1
+so that 95% of the CPU usage is forgotten in 60 seconds.
+Once all process priorities have been updated,
+.Fn schedcpu
+calls
+.Fn vmmeter
+to update various other statistics including the load average.
+Finally, it schedules itself to run again in
+.Va hz
+clock ticks.
+.Pp
+The
+.Fn setrunnable
+function is used to change a process's state to be runnable.
+The process is placed on a
+.Xr runqueue 9
+if needed, and the swapper process is woken up and told to swap the process in
+if the process is swapped out.
+If the process has been asleep for at least one run of
+.Fn schedcpu ,
+then
+.Fn updatepri
+is used to adjust the priority of the process.
+.Pp
+The
+.Fn updatepri
+function is used to adjust the priority of a process that has been asleep.
+It retroactively decays the estimated CPU time of the process for each
+.Fn schedcpu
+event that the process was asleep.
+Finally, it calls
+.Fn resetpriority
+to adjust the priority of the process.
+.Sh SEE ALSO
+.Xr mi_switch 9 ,
+.Xr runqueue 9 ,
+.Xr sleepqueue 9 ,
+.Xr tsleep 9
+.Sh BUGS
+The
+.Va curpriority
+variable really should be per-CPU.
+In addition,
+.Fn maybe_resched
+should compare the priority of
+.Fa chk
+with that of each CPU, and then send an IPI to the processor with the lowest
+priority to trigger a reschedule if needed.
+.Pp
+Priority propagation is broken and is thus disabled by default.
+The
+.Va p_nativepri
+variable is only updated if a process does not obtain a sleep mutex on the
+first try.
+Also, if a process obtains more than one sleep mutex in this manner, and
+had its priority bumped in between, then
+.Va p_nativepri
+will be clobbered.
diff --git a/share/man/man9/securelevel_gt.9 b/share/man/man9/securelevel_gt.9
new file mode 100644
index 000000000000..b2706948eb83
--- /dev/null
+++ b/share/man/man9/securelevel_gt.9
@@ -0,0 +1,71 @@
+.\"
+.\" Copyright (c) 2000 Christian S.J. Peron <maneo@bsdpro.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\" $FreeBSD$
+.\"
+.Dd June 2, 2007
+.Dt SECURELEVEL_GT 9
+.Os
+.Sh NAME
+.Nm securelevel_gt , securelevel_ge
+.Nd test active securelevel
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/proc.h
+.Ft int
+.Fn securelevel_gt "struct ucred *cr" "int level"
+.Ft int
+.Fn securelevel_ge "struct ucred *cr" "int level"
+.Sh DESCRIPTION
+These functions test the active security level against the given
+.Fa level .
+If the calling credential
+.Fa cr
+was imprisoned by the
+.Xr jail 2
+system call, and has a
+different security level set than the host environment,
+the security level with the highest value is used.
+.Pp
+The
+.Fn securelevel_gt
+function
+will evaluate whether or not the active security
+level is greater than the supplied
+.Fa level .
+.Pp
+The
+.Fn securelevel_ge
+function
+will evaluate whether or not the active security
+level is greater than or equal to the supplied
+.Fa level .
+.Sh RETURN VALUES
+These functions return
+.Er EPERM
+if condition evaluated to true, and 0 otherwise.
+.Sh SEE ALSO
+.Xr securelevel 7
diff --git a/share/man/man9/selrecord.9 b/share/man/man9/selrecord.9
new file mode 100644
index 000000000000..f7a0113fc413
--- /dev/null
+++ b/share/man/man9/selrecord.9
@@ -0,0 +1,126 @@
+.\"
+.\" Copyright (C) 2002 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 25, 2011
+.Dt SELRECORD 9
+.Os
+.Sh NAME
+.Nm seldrain ,
+.Nm selrecord ,
+.Nm selwakeup
+.Nd "record and wakeup select requests"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/selinfo.h
+.Ft void
+.Fn seldrain "struct selinfo *sip"
+.Ft void
+.Fn selrecord "struct thread *td" "struct selinfo *sip"
+.Ft void
+.Fn selwakeup "struct selinfo *sip"
+.Sh DESCRIPTION
+.Fn seldrain ,
+.Fn selrecord
+and
+.Fn selwakeup
+are the three central functions used by
+.Xr select 2 ,
+.Xr poll 2
+and the objects that are being selected on.
+They handle the task of recording which threads are waiting on which objects
+and the waking of the proper threads when an event of interest occurs on an
+object.
+.Pp
+.Fn selrecord
+records that the calling thread is interested in events related to a given
+object.
+If another thread is already waiting on the object a collision will be flagged
+in
+.Fa sip
+which will be later dealt with by
+.Fn selwakeup .
+.Pp
+.Fn selrecord
+acquires and releases
+.Va sellock .
+.Pp
+.Fn selwakeup
+is called by the underlying object handling code in order to notify any waiting
+threads that an event of interest has occurred.
+If a collision has occurred,
+.Fn selwakeup
+will increment
+.Va nselcoll ,
+and broadcast on the global cv in order to wake all waiting threads so that
+they can handle it.
+If the thread waiting on the object is not currently sleeping or the wait
+channel is not
+.Va selwait ,
+.Fn selwakeup
+will clear the
+.Dv TDF_SELECT
+flag which should be noted by
+.Xr select 2
+and
+.Xr poll 2
+when they wake up.
+.Pp
+.Fn seldrain
+will flush the waiters queue on a specified object before its
+destruction.
+The object handling code must ensure that
+.Fa *sip
+cannot be used once
+.Fn seldrain
+has been called.
+.Pp
+The contents of
+.Fa *sip
+must be zeroed, such as by softc initialization, before any call to
+.Fn selrecord
+or
+.Fn selwakeup ,
+otherwise a panic may occur.
+.Fn selwakeup
+acquires and releases
+.Va sellock
+and may acquire and release
+.Va sched_lock .
+.Fn seldrain
+could usually be just a wrapper for
+.Fn selwakeup ,
+but consumers should not generally rely on this feature.
+.Sh SEE ALSO
+.Xr poll 2 ,
+.Xr select 2
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Chad David Aq davidc@FreeBSD.org
+and
+.An Alfred Perlstein Aq alfred@FreeBSD.org .
diff --git a/share/man/man9/sema.9 b/share/man/man9/sema.9
new file mode 100644
index 000000000000..1f6e3b54eb24
--- /dev/null
+++ b/share/man/man9/sema.9
@@ -0,0 +1,132 @@
+.\"
+.\" Copyright (C) 2001 Jason Evans <jasone@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 1, 2006
+.Dt SEMA 9
+.Os
+.Sh NAME
+.Nm sema ,
+.Nm sema_init ,
+.Nm sema_destroy ,
+.Nm sema_post ,
+.Nm sema_wait ,
+.Nm sema_timedwait ,
+.Nm sema_trywait ,
+.Nm sema_value
+.Nd kernel counting semaphore
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/lock.h
+.In sys/sema.h
+.Ft void
+.Fn sema_init "struct sema *sema" "int value" "const char *description"
+.Ft void
+.Fn sema_destroy "struct sema *sema"
+.Ft void
+.Fn sema_post "struct sema *sema"
+.Ft void
+.Fn sema_wait "struct sema *sema"
+.Ft int
+.Fn sema_timedwait "struct sema *sema" "int timo"
+.Ft int
+.Fn sema_trywait "struct sema *sema"
+.Ft int
+.Fn sema_value "struct sema *sema"
+.Sh DESCRIPTION
+Counting semaphores provide a mechanism for synchronizing access to a pool of
+resources.
+Unlike mutexes, semaphores do not have the concept of an owner, so they can also
+be useful in situations where one thread needs to acquire a resource, and
+another thread needs to release it.
+Each semaphore has an integer value associated with it.
+Posting (incrementing) always succeeds, but waiting (decrementing) can only
+successfully complete if the resulting value of the semaphore is greater than or
+equal to zero.
+.Pp
+Semaphores should not be used where mutexes and condition variables
+will suffice.
+Semaphores are a more complex synchronization mechanism than mutexes and
+condition variables, and are not as efficient.
+.Pp
+Semaphores are created with
+.Fn sema_init ,
+where
+.Fa sema
+is a pointer to space for a
+.Vt "struct sema" ,
+.Fa value
+is the initial value of the semaphore, and
+.Fa description
+is a pointer to a null-terminated character string that describes the semaphore.
+Semaphores are destroyed with
+.Fn sema_destroy .
+A semaphore is posted (incremented) with
+.Fn sema_post .
+A semaphore is waited on (decremented) with
+.Fn sema_wait ,
+.Fn sema_timedwait ,
+or
+.Fn sema_trywait .
+The
+.Fa timo
+argument to
+.Fn sema_timedwait
+specifies the minimum time in ticks to wait before returning with failure.
+.Fn sema_value
+is used to read the current value of the semaphore.
+.Sh RETURN VALUES
+The
+.Fn sema_value
+function
+returns the current value of the semaphore.
+.Pp
+If decrementing the semaphore would result in its value being negative,
+.Fn sema_trywait
+returns 0 to indicate failure.
+Otherwise, a non-zero value is returned to indicate success.
+.Pp
+The
+.Fn sema_timedwait
+function
+returns 0 if waiting on the semaphore succeeded; otherwise a
+non-zero error code is returned.
+.Sh ERRORS
+The
+.Fn sema_timedwait
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EWOULDBLOCK
+Timeout expired.
+.El
+.Sh SEE ALSO
+.Xr condvar 9 ,
+.Xr locking 9 ,
+.Xr mtx_pool 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sx 9
diff --git a/share/man/man9/sf_buf.9 b/share/man/man9/sf_buf.9
new file mode 100644
index 000000000000..8d73937c2878
--- /dev/null
+++ b/share/man/man9/sf_buf.9
@@ -0,0 +1,142 @@
+.\"
+.\" Copyright (c) 2007 Seccuris Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Robert N. M. Watson under contract to
+.\" Seccuris Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 28, 2007
+.Dt SF_BUF 9
+.Os
+.Sh NAME
+.Nm sf_buf
+.Nd manage temporary kernel address space mapping for memory pages
+.Sh SYNOPSIS
+.In sys/sf_buf.h
+.Ft struct sf_buf *
+.Fn sf_buf_alloc "struct vm_page *m" "int flags"
+.Ft void
+.Fn sf_buf_free "struct sf_buf *sf"
+.Ft vm_offset_t
+.Fn sf_buf_kva "struct sf_buf *sf"
+.Ft struct vm_page *
+.Fn sf_buf_page "struct sf_buf *sf"
+.Sh DESCRIPTION
+The
+.Nm
+interface, historically the
+.Xr sendfile 2
+buffer interface, allows kernel subsystems to manage temporary kernel address
+space mappings for physical memory pages.
+On systems with a direct memory map region (allowing all physical pages to be
+visible in the kernel address space at all times), the
+.Vt "struct sf_buf"
+will point to an address in the direct map region; on systems without a
+direct memory map region, the
+.Vt "struct sf_buf"
+will manage a temporary kernel address space mapping valid for the lifetime
+of the
+.Vt "struct sf_buf".
+.Pp
+Call
+.Fn sf_buf_alloc
+to allocate a
+.Vt "struct sf_buf"
+for a physical memory page.
+.Fn sf_buf_alloc
+is not responsible for arranging for the page to be present in physical
+memory; the caller should already have arranged for the page to be wired,
+i.e., by calling
+.Xr vm_page_wire 9 .
+Several flags may be passed to
+.Fn sf_buf_alloc :
+.Bl -tag -width SFB_CPUPRIVATE
+.It Dv SFB_CATCH
+Cause
+.Fn sf_buf_alloc
+to abort and return
+.Dv NULL
+if a signal is received waiting for a
+.Vt "struct sf_buf"
+to become available.
+.It Dv SFB_NOWAIT
+Cause
+.Fn sf_buf_alloc
+to return
+.Dv NULL
+rather than sleeping if a
+.Vt "struct sf_buf"
+is not immediately available.
+.It Dv SFB_CPUPRIVATE
+Cause
+.Fn sf_buf_alloc
+to only arrange that the temporary mapping be valid on the current CPU,
+avoiding unnecessary TLB shootdowns for mappings that will only be accessed
+on a single CPU at a time.
+The caller must ensure that accesses to the virtual address occur only on the
+CPU from which
+.Fn sf_buf_alloc
+was invoked, perhaps by using
+.Fn sched_pin .
+.El
+.Pp
+Call
+.Fn sf_buf_kva
+to return a kernel mapped address for the page.
+.Pp
+Call
+.Fn sf_buf_page
+to return a pointer to the page originally passed into
+.Fn sf_buf_alloc .
+.Pp
+Call
+.Fn sf_buf_free
+to release the
+.Vt "struct sf_buf"
+reference.
+The caller is responsible for releasing any wiring they have previously
+acquired on the physical page;
+.Fn sf_buf_free
+releases only the temporary kernel address space mapping, not the page
+itself.
+.Pp
+Uses of this interface include managing mappings of borrowed pages from user
+memory, such as in zero-copy socket I/O, or pages of memory from the buffer
+cache referenced by mbuf external storage for
+.Xr sendfile 2 .
+.Sh SEE ALSO
+.Xr sendfile 2 ,
+.Xr vm_page_wire 9
+.Sh AUTHORS
+.An -nosplit
+The
+.Vt "struct sf_buf"
+API was designed and implemented by
+.An Alan L. Cox .
+This manual page was written by
+.An Robert N. M. Watson .
diff --git a/share/man/man9/sglist.9 b/share/man/man9/sglist.9
new file mode 100644
index 000000000000..64f8935473da
--- /dev/null
+++ b/share/man/man9/sglist.9
@@ -0,0 +1,507 @@
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 15, 2009
+.Dt SGLIST 9
+.Os
+.Sh NAME
+.Nm sglist ,
+.Nm sglist_alloc ,
+.Nm sglist_append ,
+.Nm sglist_append_mbuf ,
+.Nm sglist_append_phys ,
+.Nm sglist_append_uio ,
+.Nm sglist_append_user ,
+.Nm sglist_build ,
+.Nm sglist_clone ,
+.Nm sglist_consume_uio ,
+.Nm sglist_count ,
+.Nm sglist_free ,
+.Nm sglist_hold ,
+.Nm sglist_init ,
+.Nm sglist_join ,
+.Nm sglist_length ,
+.Nm sglist_reset ,
+.Nm sglist_slice ,
+.Nm sglist_split
+.Nd manage a scatter/gather list of physical memory addresses
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sglist.h
+.Ft struct sglist *
+.Fn sglist_alloc "int nsegs" "int mflags"
+.Ft int
+.Fn sglist_append "struct sglist *sg" "void *buf" "size_t len"
+.Ft int
+.Fn sglist_append_mbuf "struct sglist *sg" "struct mbuf *m"
+.Ft int
+.Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len"
+.Ft int
+.Fn sglist_append_uio "struct sglist *sg" "struct uio *uio"
+.Ft int
+.Fn sglist_append_user "struct sglist *sg" "void *buf" "size_t len" "struct thread *td"
+.Ft struct sglist *
+.Fn sglist_build "void *buf" "size_t len" "int mflags"
+.Ft struct sglist *
+.Fn sglist_clone "struct sglist *sg" "int mflags"
+.Ft int
+.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "size_t resid"
+.Ft int
+.Fn sglist_count "void *buf" "size_t len"
+.Ft void
+.Fn sglist_free "struct sglist *sg"
+.Ft struct sglist *
+.Fn sglist_hold "struct sglist *sg"
+.Ft void
+.Fn sglist_init "struct sglist *sg" "int maxsegs" "struct sglist_seg *segs"
+.Ft int
+.Fn sglist_join "struct sglist *first" "struct sglist *second"
+.Ft size_t
+.Fn sglist_length "struct sglist *sg"
+.Ft void
+.Fn sglist_reset "struct sglist *sg"
+.Ft int
+.Fn sglist_slice "struct sglist *original" "struct sglist **slice" "size_t offset" "size_t length" "int mflags"
+.Ft int
+.Fn sglist_split "struct sglist *original" "struct sglist **head" "size_t length" "int mflags"
+.Sh DESCRIPTION
+The
+.Nm
+API manages physical address ranges.
+Each list contains one or more elements.
+Each element contains a starting physical address and a length.
+Scatter/gather lists are read-only while they are shared.
+If one wishes to alter an existing scatter/gather list and does not hold the
+sole reference to the list,
+then one should create a new list instead of modifying the existing list.
+.Pp
+Each scatter/gather list object contains a reference count.
+New lists are created with a single reference.
+New references are obtained by calling
+.Nm sglist_hold
+and are released by calling
+.Nm sglist_free .
+.Ss Allocating and Initializing Lists
+Each
+.Nm
+object consists of a header structure and a variable-length array of
+scatter/gather list elements.
+The
+.Nm sglist_alloc
+function allocates a new list that contains a header and
+.Fa nsegs
+scatter/gather list elements.
+The
+.Fa mflags
+argument can be set to either
+.Dv M_NOWAIT
+or
+.Dv M_WAITOK .
+.Pp
+The
+.Nm sglist_count
+function returns the number of scatter/gather list elements needed to describe
+the physical address ranges mapped by a single kernel virtual address range.
+The kernel virtual address range starts at
+.Fa buf
+and is
+.Fa len
+bytes long.
+.Pp
+The
+.Nm sglist_build
+function allocates a new scatter/gather list object that describes the physical
+address ranges mapped by a single kernel virtual address range.
+The kernel virtual address range starts at
+.Fa buf
+and is
+.Fa len
+bytes long.
+The
+.Fa mflags
+argument can be set to either
+.Dv M_NOWAIT
+or
+.Dv M_WAITOK .
+.Pp
+The
+.Nm sglist_clone
+function returns a copy of an existing scatter/gather list object
+.Fa sg .
+The
+.Fa mflags
+argument can be set to either
+.Dv M_NOWAIT
+or
+.Dv M_WAITOK .
+This can be used to obtain a private copy of a scatter/gather list before
+modifying it.
+.Pp
+The
+.Nm sglist_init
+function initializes a scatter/gather list header.
+The header is pointed to by
+.Fa sg
+and is initialized to manage an array of
+.Fa maxsegs
+scatter/gather list elements pointed to by
+.Fa segs .
+This can be used to initialize a scatter/gather list header whose storage
+is not provided by
+.Nm sglist_alloc .
+In that case, the caller should not call
+.Nm sglist_free
+to release its own reference and is responsible for ensuring all other
+references to the list are dropped before it releases the storage for
+.Fa sg
+and
+.Fa segs .
+.Ss Constructing Scatter/Gather Lists
+The
+.Nm
+API provides several routines for building a scatter/gather list to describe
+one or more objects.
+Specifically, the
+.Nm sglist_append
+family of routines can be used to append the physical address ranges described
+by an object to the end of a scatter/gather list.
+All of these routines return 0 on success or an error on failure.
+If a request to append an address range to a scatter/gather list fails,
+the scatter/gather list will remain unchanged.
+.Pp
+The
+.Nm sglist_append
+function appends the physical address ranges described by a single kernel
+virtual address range to the scatter/gather list
+.Fa sg .
+The kernel virtual address range starts at
+.Fa buf
+and is
+.Fa len
+bytes long.
+.Pp
+The
+.Nm sglist_append_mbuf
+function appends the physical address ranges described by an entire mbuf
+chain
+.Fa m
+to the scatter/gather list
+.Fa sg .
+.Pp
+The
+.Nm sglist_append_phys
+function appends a single physical address range to the scatter/gather list
+.Fa sg .
+The physical address range starts at
+.Fa paddr
+and is
+.Fa len
+bytes long.
+.Pp
+The
+.Nm sglist_append_uio
+function appends the physical address ranges described by a
+.Xr uio 9
+object to the scatter/gather list
+.Fa sg .
+Note that it is the caller's responsibility to ensure that the pages backing
+the I/O request are wired for the lifetime of
+.Fa sg .
+Note also that this routine does not modify
+.Fa uio .
+.Pp
+The
+.Nm sglist_append_user
+function appends the physical address ranges described by a single user
+virtual address range to the scatter/gather list
+.Fa sg .
+The user virtual address range is relative to the address space of the thread
+.Fa td .
+It starts at
+.Fa buf
+and is
+.Fa len
+bytes long.
+Note that it is the caller's responsibility to ensure that the pages backing
+the user buffer are wired for the lifetime of
+.Fa sg .
+.Pp
+The
+.Nm sglist_consume_uio
+function is a variation of
+.Nm sglist_append_uio .
+As with
+.Nm sglist_append_uio ,
+it appends the physical address ranges described by
+.Fa uio
+to the scatter/gather list
+.Fa sg .
+Unlike
+.Nm sglist_append_uio ,
+however,
+.Nm sglist_consume_uio
+modifies the I/O request to indicate that the appended address ranges have
+been processed similar to calling
+.Xr uiomove 9 .
+This routine will only append ranges that describe up to
+.Fa resid
+total bytes in length.
+If the available segments in the scatter/gather list are exhausted before
+.Fa resid
+bytes are processed,
+then the
+.Fa uio
+structure will be updated to reflect the actual number of bytes processed,
+and
+.Nm sglist_consume_io
+will return zero to indicate success.
+In effect, this function will perform partial reads or writes.
+The caller can compare the
+.Fa uio_resid
+member of
+.Fa uio
+before and after calling
+.Nm sglist_consume_uio
+to determine the actual number of bytes processed.
+.Ss Manipulating Scatter/Gather Lists
+The
+.Nm sglist_join
+function appends physical address ranges from the scatter/gather list
+.Fa second
+onto
+.Fa first
+and then resets
+.Fa second
+to an empty list.
+It returns zero on success or an error on failure.
+.Pp
+The
+.Nm sglist_split
+function splits an existing scatter/gather list into two lists.
+The first
+.Fa length
+bytes described by the list
+.Fa original
+are moved to a new list
+.Fa *head .
+If
+.Fa original
+describes a total address range that is smaller than
+.Fa length
+bytes,
+then all of the address ranges will be moved to the new list at
+.Fa *head
+and
+.Fa original
+will be an empty list.
+The caller may supply an existing scatter/gather list in
+.Fa *head .
+If so, the list must be empty.
+Otherwise, the caller may set
+.Fa *head
+to
+.Dv NULL
+in which case a new scatter/gather list will be allocated.
+In that case,
+.Fa mflags
+may be set to either
+.Dv M_NOWAIT
+or
+.Dv M_WAITOK .
+Note that since the
+.Fa original
+list is modified by this call, it must be a private list with no other
+references.
+The
+.Nm sglist_split
+function returns zero on success or an error on failure.
+.Pp
+The
+.Nm sglist_slice
+function generates a new scatter/gather list from a sub-range of an existing
+scatter/gather list
+.Fa original .
+The sub-range to extract is specified by the
+.Fa offset
+and
+.Fa length
+parameters.
+The new scatter/gather list is stored in
+.Fa *slice .
+As with
+.Fa head
+for
+.Nm sglist_join ,
+the caller may either provide an empty scatter/gather list,
+or it may set
+.Fa *slice
+to
+.Dv NULL
+in which case
+.Nm sglist_slice
+will allocate a new list subject to
+.Fa mflags .
+Unlike
+.Nm sglist_split ,
+.Nm sglist_slice
+does not modify
+.Fa original
+and does not require it to be a private list.
+The
+.Nm sglist_split
+function returns zero on success or an error on failure.
+.Ss Miscellaneous Routines
+The
+.Nm sglist_reset
+function clears the scatter/gather list
+.Fa sg
+so that it no longer maps any address ranges.
+This can allow reuse of a single scatter/gather list object for multiple
+requests.
+.Pp
+The
+.Nm sglist_length
+function returns the total length of the physical address ranges described
+by the scatter/gather list
+.Fa sg .
+.Sh RETURN VALUES
+The
+.Nm sglist_alloc ,
+.Nm sglist_build ,
+and
+.Nm sglist_clone
+functions return a new scatter/gather list on success or
+.Dv NULL
+on failure.
+.Pp
+The
+.Nm sglist_append
+family of functions and the
+.Nm sglist_consume_uio ,
+.Nm sglist_join ,
+.Nm sglist_slice ,
+and
+.Nm sglist_split
+functions return zero on success or an error on failure.
+.Pp
+The
+.Nm sglist_count
+function returns a count of scatter/gather list elements.
+.Pp
+The
+.Nm sglist_length
+function returns a count of address space described by a scatter/gather list
+in bytes.
+.Sh ERRORS
+The
+.Nm sglist_append
+functions return the following errors on failure:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The scatter/gather list has zero segments.
+.It Bq Er EFBIG
+There are not enough available segments in the scatter/gather list to append
+the specified physical address ranges.
+.El
+.Pp
+The
+.Nm sglist_consume_uio
+function returns the following error on failure:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The scatter/gather list has zero segments.
+.El
+.Pp
+The
+.Nm sglist_join
+function returns the following error on failure:
+.Bl -tag -width Er
+.It Bq Er EFBIG
+There are not enough available segments in the scatter/gather list
+.Fa first
+to append the physical address ranges from
+.Fa second .
+.El
+.Pp
+The
+.Nm sglist_slice
+function returns the following errors on failure:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa original
+scatter/gather list does not describe enough address space to cover the
+requested sub-range.
+.It Bq Er EINVAL
+The caller-supplied scatter/gather list in
+.Fa *slice
+is not empty.
+.It Bq Er ENOMEM
+An attempt to allocate a new scatter/gather list with
+.Dv M_NOWAIT
+set in
+.Fa mflags
+failed.
+.It Bq Er EFBIG
+There are not enough available segments in the caller-supplied scatter/gather
+list in
+.Fa *slice
+to describe the requested physical address ranges.
+.El
+.Pp
+The
+.Nm sglist_split
+function returns the following errors on failure:
+.Bl -tag -width Er
+.It Bq Er EDOOFUS
+The
+.Fa original
+scatter/gather list has more than one reference.
+.It Bq Er EINVAL
+The caller-supplied scatter/gather list in
+.Fa *head
+is not empty.
+.It Bq Er ENOMEM
+An attempt to allocate a new scatter/gather list with
+.Dv M_NOWAIT
+set in
+.Fa mflags
+failed.
+.It Bq Er EFBIG
+There are not enough available segments in the caller-supplied scatter/gather
+list in
+.Fa *head
+to describe the requested physical address ranges.
+.El
+.Sh SEE ALSO
+.Xr malloc 9 ,
+.Xr mbuf 9 ,
+.Xr uio 9
+.Sh HISTORY
+This API was first introduced in
+.Fx 8.0 .
diff --git a/share/man/man9/shm_map.9 b/share/man/man9/shm_map.9
new file mode 100644
index 000000000000..4ba822260f95
--- /dev/null
+++ b/share/man/man9/shm_map.9
@@ -0,0 +1,186 @@
+.\"
+.\" Copyright (c) 2011 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2011
+.Dt SHM_MAP 9
+.Os
+.Sh NAME
+.Nm shm_map , shm_unmap
+.Nd "map shared memory objects into the kernel's address space"
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/mman.h
+.Ft int
+.Fn shm_map "struct file *fp" "size_t size" "off_t offset" "void **memp"
+.Ft int
+.Fn shm_unmap "struct file *fp" "void *mem" "size_t size"
+.Sh DESCRIPTION
+The
+.Fn shm_map
+and
+.Fn shm_unmap
+functions provide an API for mapping shared memory objects into the kernel.
+Shared memory objects are created by
+.Xr shm_open 2 .
+These objects can then be passed into the kernel via file descriptors.
+.Pp
+A shared memory object cannot be shrunk while it is mapped into the kernel.
+This is to avoid invalidating any pages that may be wired into the kernel's
+address space.
+Shared memory objects can still be grown while mapped into the kernel.
+.Pp
+To simplify the accounting needed to enforce the above requirement,
+callers of this API are required to unmap the entire region mapped by
+.Fn shm_map
+when calling
+.Fn shm_unmap .
+Unmapping only a portion of the region is not permitted.
+.Pp
+The
+.Fn shm_map
+function locates the shared memory object associated with the open file
+.Fa fp .
+It maps the region of that object described by
+.Fa offset
+and
+.Fa size
+into the kernel's address space.
+If it succeeds,
+.Fa *memp
+will be set to the start of the mapping.
+All pages for the range will be wired into memory upon successful return.
+.Pp
+The
+.Fn shm_unmap
+function unmaps a region previously mapped by
+.Fn shm_map .
+The
+.Fa mem
+argument should match the value previously returned in
+.Fa *memp ,
+and the
+.Fa size
+argument should match the value passed to
+.Fn shm_map .
+.Pp
+Note that
+.Fn shm_map
+will not hold an extra reference on the open file
+.Fa fp
+for the lifetime of the mapping.
+Instead,
+the calling code is required to do this if it wishes to use
+.Fn shm_unmap
+on the region in the future.
+.Sh RETURN VALUES
+The
+.Fn shm_map
+and
+.Fn shm_unmap
+functions return zero on success or an error on failure.
+.Sh EXAMPLES
+The following function accepts a file descriptor for a shared memory
+object.
+It maps the first sixteen kilobytes of the object into the kernel,
+performs some work on that address,
+and then unmaps the address before returning.
+.Bd -literal -offset indent
+int
+shm_example(int fd)
+{
+ struct file *fp;
+ void *mem;
+ int error;
+
+ error = fget(curthread, fd, CAP_MMAP, &fp);
+ if (error)
+ return (error);
+ error = shm_map(fp, 16384, 0, &mem);
+ if (error) {
+ fdrop(fp, curthread);
+ return (error);
+ }
+
+ /* Do something with 'mem'. */
+
+ error = shm_unmap(fp, mem, 16384);
+ fdrop(fp, curthread);
+ return (error);
+}
+.Ed
+.Sh ERRORS
+The
+.Fn shm_map
+function returns the following errors on failure:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The open file
+.Fa fp
+is not a shared memory object.
+.It Bq Er EINVAL
+The requested region described by
+.Fa offset
+and
+.Fa size
+extends beyond the end of the shared memory object.
+.It Bq Er ENOMEM
+Insufficient address space was available.
+.It Bq Er EACCES
+The shared memory object could not be mapped due to a protection error.
+.It Bq Er EINVAL
+The shared memory object could not be mapped due to some other VM error.
+.El
+.Pp
+The
+.Fn shm_unmap
+function returns the following errors on failure:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The open file
+.Fa fp
+is not a shared memory object.
+.It Bq Er EINVAL
+The address range described by
+.Fa mem
+and
+.Fa size
+is not a valid address range.
+.It Bq Er EINVAL
+The address range described by
+.Fa mem
+and
+.Fa size
+is not backed by the shared memory object associated with the open file
+.Fa fp ,
+or the address range does not cover the entire mapping of the object.
+.El
+.Sh SEE ALSO
+.Xr shm_open 2
+.Sh HISTORY
+This API was first introduced in
+.Fx 10.0 .
diff --git a/share/man/man9/signal.9 b/share/man/man9/signal.9
new file mode 100644
index 000000000000..6f377eeb346b
--- /dev/null
+++ b/share/man/man9/signal.9
@@ -0,0 +1,446 @@
+.\"
+.\" Copyright (C) 2002 Chad David <davidc@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2004
+.Dt SIGNAL 9
+.Os
+.Sh NAME
+.Nm signal ,
+.Nm SIGADDSET ,
+.Nm SIGDELSET ,
+.Nm SETEMPTYSET ,
+.Nm SIGFILLSET ,
+.Nm SIGISMEMBER ,
+.Nm SIGISEMPTY ,
+.Nm SIGNOTEMPTY ,
+.Nm SIGSETEQ ,
+.Nm SIGSETNEQ ,
+.Nm SIGSETOR ,
+.Nm SIGSETAND ,
+.Nm SIGSETNAND ,
+.Nm SIGSETCANTMASK ,
+.Nm SIG_STOPSIGMASK ,
+.Nm SIG_CONTSIGMASK ,
+.Nm SIGPENDING ,
+.Nm cursig ,
+.Nm execsigs ,
+.Nm issignal ,
+.Nm killproc ,
+.Nm pgsigio ,
+.Nm postsig ,
+.Nm sigexit ,
+.Nm siginit ,
+.Nm signotify ,
+.Nm trapsignal
+.Nd "kernel signal functions"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.In sys/signalvar.h
+.Ft void
+.Fn SIGADDSET "sigset_t set" "int signo"
+.Ft void
+.Fn SIGDELSET "sigset_t set" "int signo"
+.Ft void
+.Fn SIGEMPTYSET "sigset_t set"
+.Ft void
+.Fn SIGFILLSET "sigset_t set"
+.Ft int
+.Fn SIGISMEMBER "sigset_t set" "int signo"
+.Ft int
+.Fn SIGISEMPTY "sigset_t set"
+.Ft int
+.Fn SIGNOTEMPTY "sigset_t set"
+.Ft int
+.Fn SIGSETEQ "sigset_t set1" "sigset_t set2"
+.Ft int
+.Fn SIGSETNEQ "sigset_t set1" "sigset_t set2"
+.Ft void
+.Fn SIGSETOR "sigset_t set1" "sigset_t set2"
+.Ft void
+.Fn SIGSETAND "sigset_t set1" "sigset_t set2"
+.Ft void
+.Fn SIGSETNAND "sigset_t set1" "sigset_t set2"
+.Ft void
+.Fn SIG_CANTMASK "sigset_t set"
+.Ft void
+.Fn SIG_STOPSIGMASK "sigset_t set"
+.Ft void
+.Fn SIG_CONTSIGMASK "sigset_t set"
+.Ft int
+.Fn SIGPENDING "struct proc *p"
+.Ft int
+.Fn cursig "struct thread *td"
+.Ft void
+.Fn execsigs "struct proc *p"
+.Ft int
+.Fn issignal "struct thread *td"
+.Ft void
+.Fn killproc "struct proc *p" "char *why"
+.Ft void
+.Fn pgsigio "struct sigio **sigiop" "int sig" "int checkctty"
+.Ft void
+.Fn postsig "int sig"
+.Ft void
+.Fn sigexit "struct thread *td" "int signum"
+.Ft void
+.Fn siginit "struct proc *p"
+.Ft void
+.Fn signotify "struct thread *td"
+.Ft void
+.Fn trapsignal "struct thread *td" "int sig" "u_long code"
+.Sh DESCRIPTION
+The
+.Fn SIGADDSET
+macro adds
+.Fa signo
+to
+.Fa set .
+No effort is made to ensure that
+.Fa signo
+is a valid signal number.
+.Pp
+The
+.Fn SIGDELSET
+macro removes
+.Fa signo
+from
+.Fa set .
+No effort is made to ensure that
+.Fa signo
+is a valid signal number.
+.Pp
+The
+.Fn SIGEMPTYSET
+macro clears all signals in
+.Fa set .
+.Pp
+The
+.Fn SIGFILLSET
+macro sets all signals in
+.Fa set .
+.Pp
+The
+.Fn SIGISMEMBER
+macro determines if
+.Fa signo
+is set in
+.Fa set .
+.Pp
+The
+.Fn SIGISEMPTY
+macro determines if
+.Fa set
+does not have any signals set.
+.Pp
+The
+.Fn SIGNOTEMPTY
+macro determines if
+.Fa set
+has any signals set.
+.Pp
+The
+.Fn SIGSETEQ
+macro determines if two signal sets are equal; that is, the same signals
+are set in both.
+.Pp
+The
+.Fn SIGSETNEQ
+macro determines if two signal sets differ; that is, if any signal set in
+one is not set in the other.
+.Pp
+The
+.Fn SIGSETOR
+macro ORs the signals set in
+.Fa set2
+into
+.Fa set1 .
+.Pp
+The
+.Fn SIGSETAND
+macro ANDs the signals set in
+.Fa set2
+into
+.Fa set1 .
+.Pp
+The
+.Fn SIGSETNAND
+macro NANDs the signals set in
+.Fa set2
+into
+.Fa set1 .
+.Pp
+The
+.Fn SIG_CANTMASK
+macro clears the
+.Dv SIGKILL
+and
+.Dv SIGSTOP
+signals from
+.Fa set .
+These two signals cannot be blocked or caught and
+.Fn SIG_CANTMASK
+is used in code where signals are manipulated to ensure this policy
+is enforced.
+.Pp
+The
+.Fn SIG_STOPSIGMASK
+macro clears the
+.Dv SIGSTOP ,
+.Dv SIGTSTP ,
+.Dv SIGTTIN ,
+and
+.Dv SIGTTOU
+signals from
+.Fa set .
+.Fn SIG_STOPSIGMASK
+is used to clear stop signals when a process is waiting for a child to
+exit or exec, and when a process is continuing after having been
+suspended.
+.Pp
+The
+.Fn SIG_CONTSIGMASK
+macro clears the
+.Dv SIGCONT
+signal from
+.Fa set .
+.Fn SIG_CONTSIGMASK
+is called when a process is stopped.
+.Pp
+The
+.Fn SIGPENDING
+macro determines if the given process has any pending signals that are
+not masked.
+If the process has a pending signal and the process is currently being
+traced,
+.Fn SIGPENDING
+will return true even if the signal is masked.
+.Pp
+The
+.Fn cursig
+function returns the signal number that should be delivered to process
+.Fa td->td_proc .
+If there are no signals pending, zero is returned.
+.Pp
+The
+.Fn execsigs
+function resets the signal set and signal stack of a process in preparation
+for an
+.Xr execve 2 .
+The lock for
+.Fa p
+must be held before
+.Fn execsigs
+is called.
+.Pp
+The
+.Fn issignal
+function determines if there are any pending signals for process
+.Fa td->td_proc
+that should be caught, or cause this process to terminate or interrupt its
+current system call.
+If process
+.Fa td->td_proc
+is currently being traced, ignored signals will be handled and the process
+is always stopped.
+Stop signals are handled and cleared right away by
+.Fn issignal
+unless the process is a member of an orphaned process group and the stop
+signal originated from a TTY.
+The
+.Va sched_lock
+lock may be acquired and released, and if
+.Va Giant
+is held, it may be released and reacquired.
+The
+.Vt sigacts
+structure
+.Fa td->td_proc->p_sigacts
+must be locked before calling
+.Fn issignal
+and may be released and reacquired during the call.
+The process lock for
+.Fa td->td_proc
+must be acquired before calling
+.Fn issignal
+and may be released and reacquired during the call.
+The lock for the parent of
+.Fa td->td_proc
+may also be acquired and released.
+Default signal actions are not taken for system processes and init.
+.Pp
+The
+.Fn killproc
+function delivers
+.Dv SIGKILL
+to
+.Fa p .
+.Fa why
+is logged as the reason
+.Em why
+the process was killed.
+.Pp
+The
+.Fn pgsigio
+function sends the signal
+.Fa sig
+to the process or process group
+.Fa sigiop->sio_pgid .
+If
+.Fa checkctty
+is non-zero, the signal is only delivered to processes in the process group
+that have a controlling terminal.
+If
+.Fa sigiop->sio_pgid
+is for a process (> 0), the lock for
+.Fa sigiop->sio_proc
+is acquired and released.
+If
+.Fa sigiop->sio_pgid
+is for a process group (< 0), the process group lock for
+.Fa sigiop->sio_pgrp
+is acquired and released.
+The lock
+.Va sigio_lock
+is acquired and released.
+.Pp
+The
+.Fn postsig
+function handles the actual delivery of the signal
+.Fa sig .
+.Fn postsig
+is called from
+.Fn ast
+after the kernel has been notified that a signal should be delivered
+(via a call to
+.Fn signotify ,
+which causes the flag
+.Dv PS_NEEDSIGCHK
+to be set).
+The lock for process that owns
+.Va curthread
+must be held before
+.Fn postsig
+is called, and the current process cannot be 0.
+The lock for the
+.Va p_sigacts
+field of the current process must be held before
+.Fn postsig
+is called, and may be released and reacquired.
+.Pp
+The
+.Fn sigexit
+function causes the process that owns
+.Fa td
+to exit with a return value of signal number
+.Fa sig .
+If required, the process will dump core.
+The lock for the process that owns
+.Fa td
+must be held before
+.Fn sigexit
+is called.
+.Pp
+The
+.Fn siginit
+function is called during system initialization to cause every signal with
+a default property of
+.Dv SA_IGNORE
+(except
+.Dv SIGCONT )
+to be ignored by
+.Fa p .
+The process lock for
+.Fa p
+is acquired and released by
+.Fn siginit .
+The only process that
+.Fn siginit
+is ever called for
+is
+.Va proc0 .
+.Pp
+The
+.Fn signotify
+function flags that there are unmasked signals pending that
+.Fn ast
+should handle.
+The lock for process
+.Fa td->td_proc
+must be held before
+.Fn signotify
+is called, and
+.Va sched_lock
+is acquired and released.
+.Pp
+The
+.Fn trapsignal
+function sends a signal that is the result of a trap to process
+.Fa td->td_proc .
+If the process is not being traced and the signal can be delivered
+immediately,
+.Fn trapsignal
+will deliver it directly; otherwise,
+.Fn trapsignal
+will call
+.Xr psignal 9
+to cause the signal to be delivered.
+The
+.Va sched_lock
+lock is acquired and released, as is the lock for
+.Fa td->td_proc .
+The lock for the
+.Va p_sigacts
+field of
+.Fa td->td_proc
+is acquired and released.
+.Sh RETURN VALUES
+The
+.Fn SIGISMEMBER ,
+.Fn SIGISEMPTY ,
+.Fn SIGNOTEMPTY ,
+.Fn SIGSETEQ ,
+.Fn SIGSETNEQ ,
+and
+.Fn SIGPENDING
+macros all return non-zero (true) if the condition they are checking
+is found to be true; otherwise, zero (false) is returned.
+.Pp
+The
+.Fn cursig
+function returns either a valid signal number or zero.
+.Pp
+.Fn issignal
+returns either a valid signal number or zero.
+.Sh SEE ALSO
+.Xr gsignal 9 ,
+.Xr pgsignal 9 ,
+.Xr psignal 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@FreeBSD.org .
diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9
new file mode 100644
index 000000000000..91417620aee5
--- /dev/null
+++ b/share/man/man9/sleep.9
@@ -0,0 +1,346 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 12, 2009
+.Dt SLEEP 9
+.Os
+.Sh NAME
+.Nm msleep ,
+.Nm msleep_spin ,
+.Nm pause ,
+.Nm tsleep ,
+.Nm wakeup
+.Nd wait for events
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/proc.h
+.Ft int
+.Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo"
+.Ft void
+.Fn pause "const char *wmesg" "int timo"
+.Ft int
+.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
+.Ft void
+.Fn wakeup "void *chan"
+.Ft void
+.Fn wakeup_one "void *chan"
+.Sh DESCRIPTION
+The functions
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn pause ,
+.Fn wakeup ,
+and
+.Fn wakeup_one
+handle event-based thread blocking.
+If a thread must wait for an
+external event, it is put to sleep by
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+or
+.Fn pause .
+Threads may also wait using one of the locking primitive sleep routines
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+or
+.Xr sx_sleep 9 .
+.Pp
+The parameter
+.Fa chan
+is an arbitrary address that uniquely identifies the event on which
+the thread is being put to sleep.
+All threads sleeping on a single
+.Fa chan
+are woken up later by
+.Fn wakeup ,
+often called from inside an interrupt routine, to indicate that the
+resource the thread was blocking on is available now.
+.Pp
+The parameter
+.Fa priority
+specifies a new priority for the thread as well as some optional flags.
+If the new priority is not 0,
+then the thread will be made
+runnable with the specified
+.Fa priority
+when it resumes.
+.Dv PZERO
+should never be used, as it is for compatibility only.
+A new priority of 0 means to use the thread's current priority when
+it is made runnable again.
+.Pp
+If
+.Fa priority
+includes the
+.Dv PCATCH
+flag, signals are checked before and after sleeping, otherwise signals are
+not checked.
+If
+.Dv PCATCH
+is set and a signal needs to be delivered,
+.Er ERESTART
+is returned if the current system call should be restarted if
+possible, and
+.Er EINTR
+is returned if the system call should be interrupted by the signal
+(return
+.Er EINTR ) .
+If
+.Dv PBDRY
+flag is specified in addition to
+.Dv PCATCH ,
+then the sleeping thread is not stopped while sleeping upon delivery of
+.Dv SIGSTOP
+or other stop action.
+Instead, it is waken up, assuming that stop occurs on reaching a stop
+point when returning to usermode.
+The flag should be used when sleeping thread owns resources, for instance
+vnode locks, that should be freed timely.
+.Pp
+The parameter
+.Fa wmesg
+is a string describing the sleep condition for tools like
+.Xr ps 1 .
+Due to the limited space of those programs to display arbitrary strings,
+this message should not be longer than 6 characters.
+.Pp
+The parameter
+.Fa timo
+specifies a timeout for the sleep.
+If
+.Fa timo
+is not 0,
+then the thread will sleep for at most
+.Fa timo No / Va hz
+seconds.
+If the timeout expires,
+then the sleep function will return
+.Er EWOULDBLOCK .
+.Pp
+Several of the sleep functions including
+.Fn msleep ,
+.Fn msleep_spin ,
+and the locking primitive sleep routines specify an additional lock
+parameter.
+The lock will be released before sleeping and reacquired
+before the sleep routine returns.
+If
+.Fa priority
+includes the
+.Dv PDROP
+flag, then
+the lock will not be reacquired before returning.
+The lock is used to ensure that a condition can be checked atomically,
+and that the current thread can be suspended without missing a
+change to the condition, or an associated wakeup.
+In addition, all of the sleep routines will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the thread is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
+Note that the
+.Va Giant
+mutex may be specified as the lock to drop.
+In that case, however, the
+.Dv PDROP
+flag is not allowed.
+.Pp
+To avoid lost wakeups,
+either a lock should be used to protect against races,
+or a timeout should be specified to place an upper bound on the delay due
+to a lost wakeup.
+As a result,
+the
+.Fn tsleep
+function should only be invoked with a timeout of 0 when the
+.Va Giant
+mutex is held.
+.Pp
+The
+.Fn msleep
+function requires that
+.Fa mtx
+reference a default, i.e. non-spin, mutex.
+Its use is deprecated in favor of
+.Xr mtx_sleep 9
+which provides identical behavior.
+.Pp
+The
+.Fn msleep_spin
+function requires that
+.Fa mtx
+reference a spin mutex.
+The
+.Fn msleep_spin
+function does not accept a
+.Fa priority
+parameter and thus does not support changing the current thread's priority,
+the
+.Dv PDROP
+flag,
+or catching signals via the
+.Dv PCATCH
+flag.
+.Pp
+The
+.Fn pause
+function is a wrapper around
+.Fn tsleep
+that suspends execution of the current thread for the indicated timeout.
+The thread can not be awakened early by signals or calls to
+.Fn wakeup
+or
+.Fn wakeup_one .
+.Pp
+The
+.Fn wakeup_one
+function makes the first thread in the queue that is sleeping on the
+parameter
+.Fa chan
+runnable.
+This reduces the load when a large number of threads are sleeping on
+the same address, but only one of them can actually do any useful work
+when made runnable.
+.Pp
+Due to the way it works, the
+.Fn wakeup_one
+function requires that only related threads sleep on a specific
+.Fa chan
+address.
+It is the programmer's responsibility to choose a unique
+.Fa chan
+value.
+The older
+.Fn wakeup
+function did not require this, though it was never good practice
+for threads to share a
+.Fa chan
+value.
+When converting from
+.Fn wakeup
+to
+.Fn wakeup_one ,
+pay particular attention to ensure that no other threads wait on the
+same
+.Fa chan .
+.Sh RETURN VALUES
+When awakened by a call to
+.Fn wakeup
+or
+.Fn wakeup_one ,
+if a signal is pending and
+.Dv PCATCH
+is specified,
+a non-zero error code is returned.
+If the thread is awakened by a call to
+.Fn wakeup
+or
+.Fn wakeup_one ,
+the
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn tsleep ,
+and locking primitive sleep functions return 0.
+Otherwise, a non-zero error code is returned.
+.Sh ERRORS
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn tsleep ,
+and the locking primitive sleep functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINTR
+The
+.Dv PCATCH
+flag was specified, a signal was caught, and the system call should be
+interrupted.
+.It Bq Er ERESTART
+The
+.Dv PCATCH
+flag was specified, a signal was caught, and the system call should be
+restarted.
+.It Bq Er EWOULDBLOCK
+A non-zero timeout was specified and the timeout expired.
+.El
+.Sh SEE ALSO
+.Xr ps 1 ,
+.Xr locking 9 ,
+.Xr malloc 9 ,
+.Xr mi_switch 9 ,
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+.Xr sx_sleep 9
+.Sh HISTORY
+The functions
+.Fn sleep
+and
+.Fn wakeup
+were present in
+.At v1 .
+They were probably also present in the preceding
+PDP-7 version of
+.Ux .
+They were the basic process synchronization model.
+.Pp
+The
+.Fn tsleep
+function appeared in
+.Bx 4.4
+and added the parameters
+.Fa wmesg
+and
+.Fa timo .
+The
+.Fn sleep
+function was removed in
+.Fx 2.2 .
+The
+.Fn wakeup_one
+function appeared in
+.Fx 2.2 .
+The
+.Fn msleep
+function appeared in
+.Fx 5.0 ,
+and the
+.Fn msleep_spin
+function appeared in
+.Fx 6.2 .
+The
+.Fn pause
+function appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An J\(:org Wunsch Aq joerg@FreeBSD.org .
diff --git a/share/man/man9/sleepqueue.9 b/share/man/man9/sleepqueue.9
new file mode 100644
index 000000000000..22971d801787
--- /dev/null
+++ b/share/man/man9/sleepqueue.9
@@ -0,0 +1,403 @@
+.\" Copyright (c) 2000-2004 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 8, 2010
+.Dt SLEEPQUEUE 9
+.Os
+.Sh NAME
+.Nm init_sleepqueues ,
+.Nm sleepq_abort ,
+.Nm sleepq_add ,
+.Nm sleepq_alloc ,
+.Nm sleepq_broadcast ,
+.Nm sleepq_calc_signal_retval ,
+.Nm sleepq_catch_signals ,
+.Nm sleepq_free ,
+.Nm sleepq_lock ,
+.Nm sleepq_lookup ,
+.Nm sleepq_release ,
+.Nm sleepq_remove ,
+.Nm sleepq_signal ,
+.Nm sleepq_set_timeout ,
+.Nm sleepq_sleepcnt ,
+.Nm sleepq_timedwait ,
+.Nm sleepq_timedwait_sig ,
+.Nm sleepq_type ,
+.Nm sleepq_wait ,
+.Nm sleepq_wait_sig
+.Nd manage the queues of sleeping threads
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/sleepqueue.h
+.Ft void
+.Fn init_sleepqueues "void"
+.Ft int
+.Fn sleepq_abort "struct thread *td"
+.Ft void
+.Fn sleepq_add "void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue"
+.Ft struct sleepqueue *
+.Fn sleepq_alloc "void"
+.Ft int
+.Fn sleepq_broadcast "void *wchan" "int flags" "int pri" "int queue"
+.Ft int
+.Fn sleepq_calc_signal_retval "int sig"
+.Ft int
+.Fn sleepq_catch_signals "void *wchan"
+.Ft void
+.Fn sleepq_free "struct sleepqueue *sq"
+.Ft struct sleepqueue *
+.Fn sleepq_lookup "void *wchan"
+.Ft void
+.Fn sleepq_lock "void *wchan"
+.Ft void
+.Fn sleepq_release "void *wchan"
+.Ft void
+.Fn sleepq_remove "struct thread *td" "void *wchan"
+.Ft int
+.Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue"
+.Ft void
+.Fn sleepq_set_timeout "void *wchan" "int timo"
+.Ft u_int
+.Fn sleepq_sleepcnt "void *wchan" "int queue"
+.Ft int
+.Fn sleepq_timedwait "void *wchan"
+.Ft int
+.Fn sleepq_timedwait_sig "void *wchan" "int signal_caught"
+.Ft int
+.Fn sleepq_type "void *wchan"
+.Ft void
+.Fn sleepq_wait "void *wchan"
+.Ft int
+.Fn sleepq_wait_sig "void *wchan"
+.Sh DESCRIPTION
+Sleep queues provide a mechanism for suspending execution of a thread until
+some condition is met.
+Each queue is associated with a specific wait channel when it is active,
+and only one queue may be associated with a wait channel at any given point
+in time.
+The implementation of each wait channel splits its sleepqueue into 2 sub-queues
+in order to enable some optimizations on threads' wakeups.
+An active queue holds a list of threads that are blocked on the associated
+wait channel.
+Threads that are not blocked on a wait channel have an associated inactive
+sleep queue.
+When a thread blocks on a wait channel it donates its inactive sleep queue
+to the wait channel.
+When a thread is resumed,
+the wait channel that it was blocked on gives it an inactive sleep queue for
+later use.
+.Pp
+The
+.Fn sleepq_alloc
+function allocates an inactive sleep queue and is used to assign a
+sleep queue to a thread during thread creation.
+The
+.Fn sleepq_free
+function frees the resources associated with an inactive sleep queue and is
+used to free a queue during thread destruction.
+.Pp
+Active sleep queues are stored in a hash table hashed on the addresses pointed
+to by wait channels.
+Each bucket in the hash table contains a sleep queue chain.
+A sleep queue chain contains a spin mutex and a list of sleep queues that hash
+to that specific chain.
+Active sleep queues are protected by their chain's spin mutex.
+The
+.Fn init_sleepqueues
+function initializes the hash table of sleep queue chains.
+.Pp
+The
+.Fn sleepq_lock
+function locks the sleep queue chain associated with wait channel
+.Fa wchan .
+.Pp
+The
+.Fn sleepq_lookup
+returns a pointer to the currently active sleep queue for that wait
+channel associated with
+.Fa wchan
+or
+.Dv NULL
+if there is no active sleep queue associated with
+argument
+.Fa wchan .
+It requires the sleep queue chain associated with
+.Fa wchan
+to have been locked by a prior call to
+.Fn sleepq_lock .
+.Pp
+The
+.Fn sleepq_release
+function unlocks the sleep queue chain associated with
+.Fn wchan
+and is primarily useful when aborting a pending sleep request before one of
+the wait functions is called.
+.Pp
+The
+.Fn sleepq_add
+function places the current thread on the sleep queue associated with the
+wait channel
+.Fa wchan .
+The sleep queue chain associated with argument
+.Fa wchan
+must be locked by a prior call to
+.Fn sleepq_lock
+when this function is called.
+If a lock is specified via the
+.Fa lock
+argument, and if the kernel was compiled with
+.Cd "options INVARIANTS" ,
+then the sleep queue code will perform extra checks to ensure that
+the lock is used by all threads sleeping on
+.Fa wchan .
+The
+.Fa wmesg
+parameter should be a short description of
+.Fa wchan .
+The
+.Fa flags
+parameter is a bitmask consisting of the type of sleep queue being slept on
+and zero or more optional flags.
+The
+.Fa queue
+parameter specifies the sub-queue, in which the contending thread will be
+inserted.
+.Pp
+There are currently three types of sleep queues:
+.Pp
+.Bl -tag -width ".Dv SLEEPQ_CONDVAR" -compact
+.It Dv SLEEPQ_CONDVAR
+A sleep queue used to implement condition variables.
+.It Dv SLEEPQ_SLEEP
+A sleep queue used to implement
+.Xr sleep 9 ,
+.Xr wakeup 9
+and
+.Xr wakeup_one 9 .
+.It Dv SLEEPQ_PAUSE
+A sleep queue used to implement
+.Xr pause 9 .
+.El
+.Pp
+There are currently two optional flag:
+.Pp
+.Bl -tag -width ".Dv SLEEPQ_INTERRUPTIBLE" -compact
+.It Dv SLEEPQ_INTERRUPTIBLE
+The current thread is entering an interruptible sleep.
+.El
+.Bl -tag -width ".Dv SLEEPQ_STOP_ON_BDRY" -compact
+.It Dv SLEEPQ_STOP_ON_BDRY
+When thread is entering an interruptible sleep, do not stop it upon
+arrival of stop action, like
+.Dv SIGSTOP .
+Wake it up instead.
+.El
+.Pp
+A timeout on the sleep may be specified by calling
+.Fn sleepq_set_timeout
+after
+.Fn sleepq_add .
+The
+.Fa wchan
+parameter should be the same value from the preceding call to
+.Fn sleepq_add ,
+and the sleep queue chain associated with
+.Fa wchan
+must have been locked by a prior call to
+.Fn sleepq_lock .
+The
+.Fa timo
+parameter should specify the timeout value in ticks.
+.Pp
+The current thread may be marked interruptible by calling
+.Fn sleepq_catch_signals
+with
+.Fa wchan
+set to the wait channel.
+This function returns a signal number if there are any pending signals for
+the current thread and 0 if there is not a pending signal.
+The sleep queue chain associated with argument
+.Fa wchan
+should have been locked by a prior call to
+.Fn sleepq_lock .
+.Pp
+Once the thread is ready to suspend,
+one of the wait functions is called to put the current thread to sleep
+until it is awakened and to context switch to another thread.
+The
+.Fn sleepq_wait
+function is used for non-interruptible sleeps that do not have a timeout.
+The
+.Fn sleepq_timedwait
+function is used for non-interruptible sleeps that have had a timeout set via
+.Fn sleepq_set_timeout .
+The
+.Fn sleepq_wait_sig
+function is used for interruptible sleeps that do not have a timeout.
+The
+.Fn sleepq_timedwait_sig
+function is used for interruptible sleeps that do have a timeout set.
+The
+.Fa wchan
+argument to all of the wait functions is the wait channel being slept
+on.
+The sleep queue chain associated with argument
+.Fa wchan
+needs to have been locked with a prior call to
+.Fn sleepq_lock .
+The
+.Fa signal_caught
+parameter to
+.Fn sleepq_timedwait_sig
+specifies if a previous call to
+.Fn sleepq_catch_signals
+found a pending signal.
+.Pp
+When the thread is resumed,
+the wait functions return a non-zero value if the thread was awakened due to
+an interrupt other than a signal or a timeout.
+If the sleep timed out, then
+.Er EWOULDBLOCK
+is returned.
+If the sleep was interrupted by something other than a signal,
+then some other return value will be returned.
+If zero is returned after resuming from an interruptible sleep,
+then
+.Fn sleepq_calc_signal_retval
+should be called to determine if the sleep was interrupted by a signal.
+If so,
+.Fn sleepq_calc_signal_retval
+returns
+.Er ERESTART
+if the interrupting signal is restartable and
+.Er EINTR
+otherwise.
+If the sleep was not interrupted by a signal,
+.Fn sleepq_calc_signal_retval
+will return 0.
+.Pp
+A sleeping thread is normally resumed by the
+.Fn sleepq_broadcast
+and
+.Fn sleepq_signal
+functions.
+The
+.Fn sleepq_signal
+function awakens the highest priority thread sleeping on a wait channel while
+.Fn sleepq_broadcast
+awakens all of the threads sleeping on a wait channel.
+The
+.Fa wchan
+argument specifics which wait channel to awaken.
+The
+.Fa flags
+argument must match the sleep queue type contained in the
+.Fa flags
+argument passed to
+.Fn sleepq_add
+by the threads sleeping on the wait channel.
+If the
+.Fa pri
+argument does not equal \-1,
+then each thread that is awakened will have its priority raised to
+.Fa pri
+if it has a lower priority.
+The sleep queue chain associated with argument
+.Fa wchan
+must be locked by a prior call to
+.Fn sleepq_lock
+before calling any of these functions.
+The
+.Fa queue
+argument specifies the sub-queue, from which threads need to be woken up.
+.Pp
+A thread in an interruptible sleep can be interrupted by another thread via
+the
+.Fn sleepq_abort
+function.
+The
+.Fa td
+argument specifies the thread to interrupt.
+An individual thread can also be awakened from sleeping on a specific wait
+channel via the
+.Fn sleepq_remove
+function.
+The
+.Fa td
+argument specifies the thread to awaken and the
+.Fa wchan
+argument specifies the wait channel to awaken it from.
+If the thread
+.Fa td
+is not blocked on the wait channel
+.Fa wchan
+then this function will not do anything,
+even if the thread is asleep on a different wait channel.
+This function should only be used if one of the other functions above is not
+sufficient.
+One possible use is waking up a specific thread from a widely shared sleep
+channel.
+.Pp
+The
+.Fn sleepq_sleepcnt
+function offer a simple way to retrieve the number of threads sleeping for
+the specified
+.Fa queue ,
+given a
+.Fa wchan .
+.Pp
+The
+.Fn sleepq_type
+function returns the type of
+.Fa wchan
+associated to a sleepqueue.
+.Pp
+The
+.Fn sleepq_abort ,
+.Fn sleepq_broadcast ,
+and
+.Fn sleepq_signal
+functions all return a boolean value.
+If the return value is true,
+then at least one thread was resumed that is currently swapped out.
+The caller is responsible for awakening the scheduler process so that the
+resumed thread will be swapped back in.
+This is done by calling the
+.Fn kick_proc0
+function after releasing the sleep queue chain lock via a call to
+.Fn sleepq_release .
+.Pp
+The sleep queue interface is currently used to implement the
+.Xr sleep 9
+and
+.Xr condvar 9
+interfaces.
+Almost all other code in the kernel should use one of those interfaces rather
+than manipulating sleep queues directly.
+.Sh SEE ALSO
+.Xr condvar 9 ,
+.Xr runqueue 9 ,
+.Xr scheduler 9 ,
+.Xr sleep 9
diff --git a/share/man/man9/socket.9 b/share/man/man9/socket.9
new file mode 100644
index 000000000000..8320d84914c2
--- /dev/null
+++ b/share/man/man9/socket.9
@@ -0,0 +1,338 @@
+.\"-
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2006
+.Dt SOCKET 9
+.Os
+.Sh NAME
+.Nm socket
+.Nd "kernel socket interface"
+.Sh SYNOPSIS
+.In sys/socket.h
+.In sys/socketvar.h
+.Ft int
+.Fn sobind "struct socket *so" "struct sockaddr *nam" "struct thread *td"
+.Ft void
+.Fn soclose "struct socket *so"
+.Ft int
+.Fn soconnect "struct socket *so" "struct sockaddr *nam" "struct thread *td"
+.Ft int
+.Fo socreate
+.Fa "int dom" "struct socket **aso" "int type" "int proto"
+.Fa "struct ucred *cred" "struct thread *td"
+.Fc
+.Ft int
+.Fn sogetopt "struct socket *so" "struct sockopt *sopt"
+.Ft int
+.Fo soreceive
+.Fa "struct socket *so" "struct sockaddr **psa" "struct uio *uio"
+.Fa "struct mbuf **mp0" "struct mbuf **controlp" "int *flagsp"
+.Fc
+.Ft int
+.Fn sosetopt "struct socket *so" "struct sockopt *sopt"
+.Ft int
+.Fo sosend
+.Fa "struct socket *so" "struct sockaddr *addr" "struct uio *uio"
+.Fa "struct mbuf *top" "struct mbuf *control" "int flags" "struct thread *td"
+.Fc
+.Ft int
+.Fn soshutdown "struct socket *so" "int how"
+.Sh DESCRIPTION
+The kernel
+.Nm
+programming interface permits in-kernel consumers to interact with
+local and network socket objects in a manner similar to that permitted using
+the
+.Xr socket 2
+user API.
+These interfaces are appropriate for use by distributed file systems and
+other network-aware kernel services.
+While the user API operates on file descriptors, the kernel interfaces
+operate directly on
+.Vt "struct socket"
+pointers.
+.Pp
+Except where otherwise indicated,
+.Nm
+functions may sleep, and are not appropriate for use in an
+.Xr ithread 9
+context or while holding non-sleepable kernel locks.
+.Ss Creating and Destroying Sockets
+A new socket may be created using
+.Fn socreate .
+As with
+.Xr socket 2 ,
+arguments specify the requested domain, type, and protocol via
+.Fa dom , type ,
+and
+.Fa proto .
+The socket is returned via
+.Fa aso
+on success.
+In addition, the credential used to authorize operations associated with the
+socket will be passed via
+.Fa cred
+(and will be cached for the lifetime of the socket), and the thread
+performing the operation via
+.Fa td .
+.Em Warning :
+authorization of the socket creation operation will be performed
+using the thread credential for some protocols (such as raw sockets).
+.Pp
+Sockets may be closed and freed using
+.Fn soclose ,
+which has similar semantics to
+.Xr close 2 .
+.Ss Connections and Addresses
+The
+.Fn sobind
+function is equivalent to the
+.Xr bind 2
+system call, and binds the socket
+.Fa so
+to the address
+.Fa nam .
+The operation would be authorized using the credential on thread
+.Fa td .
+.Pp
+The
+.Fn soconnect
+function is equivalent to the
+.Xr connect 2
+system call, and initiates a connection on the socket
+.Fa so
+to the address
+.Fa nam .
+The operation will be authorized using the credential on thread
+.Fa td .
+Unlike the user system call,
+.Fn soconnect
+returns immediately; the caller may
+.Xr msleep 9
+on
+.Fa so->so_timeo
+while holding the socket mutex and waiting for the
+.Dv SS_ISCONNECTING
+flag to clear or
+.Fa so->so_error
+to become non-zero.
+If
+.Fn soconnect
+fails, the caller must manually clear the
+.Dv SS_ISCONNECTING
+flag.
+.Pp
+The
+.Fn soshutdown
+function is equivalent to the
+.Xr shutdown 2
+system call, and causes part or all of a connection on a socket to be closed
+down.
+.Ss Socket Options
+The
+.Fn sogetopt
+function is equivalent to the
+.Xr getsockopt 2
+system call, and retrieves a socket option on socket
+.Fa so .
+The
+.Fn sosetopt
+function is equivalent to the
+.Xr setsockopt 2
+system call, and sets a socket option on socket
+.Fa so .
+.Pp
+The second argument in both
+.Fn sogetopt
+and
+.Fn sosetopt
+is the
+.Fa sopt
+pointer to a
+.Vt "struct sopt"
+describing the socket option operation.
+The caller-allocated structure must be zeroed, and then have its fields
+initialized to specify socket option operation arguments:
+.Bl -tag -width ".Va sopt_valsize"
+.It Va sopt_dir
+Set to
+.Dv SOPT_SET
+or
+.Dv SOPT_GET
+depending on whether this is a get or set operation.
+.It Va sopt_level
+Specify the level in the network stack the operation is targeted at; for
+example,
+.Dv SOL_SOCKET .
+.It Va sopt_name
+Specify the name of the socket option to set.
+.It Va sopt_val
+Kernel space pointer to the argument value for the socket option.
+.It Va sopt_valsize
+Size of the argument value in bytes.
+.El
+.Ss Socket I/O
+The
+.Fn soreceive
+function is equivalent to the
+.Xr recvmsg 2
+system call, and attempts to receive bytes of data from the socket
+.Fa so ,
+optionally blocking awaiting for data if none is ready to read.
+Data may be retrieved directly to kernel or user memory via the
+.Fa uio
+argument, or as an mbuf chain returned to the caller via
+.Fa mp0 ,
+avoiding a data copy.
+Only one of the
+.Fa uio
+or
+.Fa mp0
+pointers may be
+.Pf non- Dv NULL .
+The caller may optionally retrieve a socket address on a protocol with the
+.Dv PR_ADDR
+capability by providing storage via
+.Pf non- Dv NULL
+.Fa psa
+argument.
+The caller may optionally retrieve control data mbufs via a
+.Pf non- Dv NULL
+.Fa controlp
+argument.
+Optional flags may be passed to
+.Fn soreceive
+via a
+.Pf non- Dv NULL
+.Fa flagsp
+argument, and use the same flag name space as the
+.Xr recvmsg 2
+system call.
+.Pp
+The
+.Fn sosend
+function is equivalent to the
+.Xr sendmsg 2
+system call, and attempts to send bytes of data via the socket
+.Fa so ,
+optionally blocking if data cannot be immediately sent.
+Data may be sent directly from kernel or user memory via the
+.Fa uio
+argument, or as an mbuf chain via
+.Fa top ,
+avoiding a data copy.
+Only one of the
+.Fa uio
+or
+.Fa top
+pointers may be
+.Pf non- Dv NULL .
+An optional destination address may be specified via a
+.Pf non- Dv NULL
+.Fa addr
+argument, which may result in an implicit connect if supported by the
+protocol.
+The caller may optionally send control data mbufs via a
+.Pf non- Dv NULL
+.Fa control
+argument.
+Flags may be passed to
+.Fn sosend
+using the
+.Fa flags
+argument, and use the same flag name space as the
+.Xr sendmsg 2
+system call.
+.Pp
+Kernel callers running in
+.Xr ithread 9
+context, or with a mutex held, will wish to use non-blocking sockets and pass
+the
+.Dv MSG_DONTWAIT
+flag in order to prevent these functions from sleeping.
+.Sh SEE ALSO
+.Xr bind 2 ,
+.Xr close 2 ,
+.Xr connect 2 ,
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr setsockopt 2 ,
+.Xr shutdown 2 ,
+.Xr socket 2 ,
+.Xr ng_ksocket 4 ,
+.Xr ithread 9 ,
+.Xr msleep 9 ,
+.Xr ucred 9
+.Sh HISTORY
+The
+.Xr socket 2
+system call appeared in
+.Bx 4.2 .
+This manual page was introduced in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
+.Sh BUGS
+The use of explicitly passed credentials, credentials hung from explicitly
+passed threads, the credential on
+.Dv curthread ,
+and the cached credential from
+socket creation time is inconsistent, and may lead to unexpected behaviour.
+It is possible that several of the
+.Fa td
+arguments should be
+.Fa cred
+arguments, or simply not be present at all.
+.Pp
+The caller may need to manually clear
+.Dv SS_ISCONNECTING
+if
+.Fn soconnect
+returns an error.
+.Pp
+The
+.Dv MSG_DONTWAIT
+flag is not implemented for
+.Fn sosend ,
+and may not always work with
+.Fn soreceive
+when zero copy sockets are enabled.
+.Pp
+This manual page does not describe how to register socket upcalls or monitor
+a socket for readability/writability without using blocking I/O.
+.Pp
+The
+.Fn soref
+and
+.Fn sorele
+functions are not described, and in most cases should not be used, due to
+confusing and potentially incorrect interactions when
+.Fn sorele
+is last called after
+.Fn soclose .
diff --git a/share/man/man9/spl.9 b/share/man/man9/spl.9
new file mode 100644
index 000000000000..08fd4d466075
--- /dev/null
+++ b/share/man/man9/spl.9
@@ -0,0 +1,228 @@
+.\"
+.\" Copyright (c) 1996 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 1996
+.Dt SPL 9
+.Os
+.Sh NAME
+.Nm splbio ,
+.Nm splclock ,
+.Nm splhigh ,
+.Nm splimp ,
+.Nm splnet ,
+.Nm splsoftclock ,
+.Nm splsofttty ,
+.Nm splstatclock ,
+.Nm spltty ,
+.Nm splvm ,
+.Nm spl0 ,
+.Nm splx
+.Nd manipulate interrupt priorities
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Ft intrmask_t
+.Fn splbio "void"
+.Ft intrmask_t
+.Fn splclock "void"
+.Ft intrmask_t
+.Fn splhigh "void"
+.Ft intrmask_t
+.Fn splimp "void"
+.Ft intrmask_t
+.Fn splnet "void"
+.Ft intrmask_t
+.Fn splsoftclock "void"
+.Ft intrmask_t
+.Fn splsofttty "void"
+.Ft intrmask_t
+.Fn splstatclock "void"
+.Ft intrmask_t
+.Fn spltty "void"
+.Ft void
+.Fn spl0 "void"
+.Ft void
+.Fn splx "intrmask_t ipl"
+.Sh DESCRIPTION
+.Bf -symbolic
+This API is deprecated.
+Use mutexes to protect data structures instead.
+See
+.Xr mutex 9
+for more information.
+The API is now a complete NOP.
+This man page documents historical behavior so you can understand the
+code locking that the spl did when converting code from versions of the
+kernel prior to
+.Fx 5.0 .
+The examples in this man page are also obsolete and should not be viewed
+as documenting
+.Fx 5.0
+and newer.
+.Ef
+.Pp
+The
+.Fn spl
+function family sets the interrupt priority
+.Dq level
+of the CPU.
+This prevents interrupt handlers of the blocked priority level from
+being run.
+This is used in the
+.Dq synchronous
+part of a driver (the part that runs on behalf of the user process) to
+examine or modify data areas that might be examined or modified by
+interrupt handlers.
+.Pp
+Each driver that uses interrupts is normally assigned to an interrupt
+priority group by a keyword in its config line.
+For example:
+.Bd -literal -offset indent
+device foo0 at isa? port 0x0815 irq 12 tty
+.Ed
+.Pp
+assigns interrupt 12 to the
+.Dq tty
+priority group.
+The system automatically arranges for interrupts in
+the
+.Em xxx
+group to be called at a priority >=
+.Ns spl Ns Em xxx
+\&().
+.Pp
+The function
+.Fn splx
+sets the interrupt priority to an absolute value.
+The intent is that
+the value returned by the other functions should be saved in a local
+variable, and later passed to
+.Fn splx
+in order to restore the previous priority.
+.Pp
+The function
+.Fn spl0
+lowers the priority to a value where all interrupt handlers are
+unblocked, but ASTs (asynchronous system traps) remain blocked until
+the system is about to return to user mode.
+.Pp
+The traditional assignment of the various device drivers to the
+interrupt priority groups can be roughly classified as:
+.Bl -tag -width Fn
+.It Fn splnet
+Software part of the network interface drivers.
+.It Fn splimp
+All network interface drivers.
+.It Fn splbio
+All
+.Em buffered IO
+(i.e., disk and the like) drivers.
+.It Fn spltty
+Basically, all non-network communications devices, but effectively
+used for all drivers that are neither network nor disks.
+.El
+.Sh RETURN VALUES
+All functions except
+.Fn splx
+and
+.Fn spl0
+return the previous priority value.
+.Sh EXAMPLES
+This is a typical example demonstrating the usage:
+.Bd -literal
+struct foo_softc {
+ ...
+ int flags;
+#define FOO_ASLEEP 1
+#define FOO_READY 2
+
+} foo_softc[NFOO];
+
+int
+foowrite(...)
+{
+ struct foo_softc *sc;
+ int s, error;
+
+ ...
+ s = spltty();
+ if (!(sc->flags & FOO_READY)) {
+ /* Not ready, must sleep on resource. */
+ sc->flags |= FOO_ASLEEP;
+ error = tsleep(sc, PZERO, "foordy", 0);
+ sc->flags &= ~FOO_ASLEEP;
+ }
+ sc->flags &= ~FOO_READY;
+ splx(s);
+
+ ...
+}
+
+void
+foointr(...)
+{
+ struct foo_softc *sc;
+
+ ...
+ sc->flags |= FOO_READY;
+ if (sc->flags & FOO_ASLEEP)
+ /* Somebody was waiting for us, awake him. */
+ wakeup(sc);
+ ...
+}
+
+.Ed
+Note that the interrupt handler should
+.Em never
+reduce the priority level.
+It is automatically called as it had
+raised the interrupt priority to its own level, i.e., further interrupts
+of the same group are being blocked.
+.Sh HISTORY
+The interrupt priority levels appeared in a very early version of
+.Ux .
+They have been traditionally known by number instead of by
+names, and were inclusive up to higher priority levels (i.e., priority
+5 has been blocking everything up to level 5).
+This is no longer the case in
+.Fx .
+The traditional name
+.Ql level
+for them is still reflected in the letter
+.Ql l
+of the respective functions and variables, although they are not
+really levels anymore, but rather different (partially inclusive)
+sets of functions to be blocked during some periods of the life of
+the system.
+The historical number scheme can be considered as a
+simple linearly ordered set of interrupt priority groups.
+.Pp
+.Fx 5.0 eliminated spl entirely in favor of locking primitives which scale
+to more than one processor.
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .
diff --git a/share/man/man9/stack.9 b/share/man/man9/stack.9
new file mode 100644
index 000000000000..fee6b8fb0767
--- /dev/null
+++ b/share/man/man9/stack.9
@@ -0,0 +1,148 @@
+.\"
+.\" Copyright (c) 2007-2009 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 16, 2011
+.Dt STACK 9
+.Os
+.Sh NAME
+.Nm stack
+.Nd kernel thread stack tracing routines
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/stack.h
+In the kernel configuration file:
+.Cd "options DDB"
+.Cd "options STACK"
+.Ft struct stack *
+.Fn stack_create "void"
+.Ft void
+.Fn stack_destroy "struct stack *st"
+.Ft int
+.Fn stack_put "struct stack *st" "vm_offset_t pc"
+.Ft void
+.Fn stack_copy "const struct stack *src" "struct stack dst"
+.Ft void
+.Fn stack_zero "struct stack *st"
+.Ft void
+.Fn stack_print "const struct stack *st"
+.Ft void
+.Fn stack_print_ddb "const struct stack *st"
+.Ft void
+.Fn stack_print_short "const struct stack *st"
+.Ft void
+.Fn stack_print_short_ddb "const struct stack *st"
+.Ft void
+.Fn stack_sbuf_print "struct sbuf sb*" "const struct stack *st"
+.Ft void
+.Fn stack_sbuf_print_ddb "struct sbuf sb*" "const struct stack *st"
+.Ft void
+.Fn stack_save "struct stack *st"
+.Sh DESCRIPTION
+The
+.Nm
+KPI allows querying of kernel stack trace information and the automated
+generation of kernel stack trace strings for the purposes of debugging and
+tracing.
+To use the KPI, at least one of
+.Cd "options DDB"
+and
+.Cd "options STACK"
+must be compiled into the kernel.
+.Pp
+Each stack trace is described by a
+.Vt "struct stack" .
+Before a trace may be created or otherwise manipulated, storage for the trace
+must be allocated with
+.Fn stack_create ,
+which may sleep.
+Memory associated with a trace is freed by calling
+.Fn stack_destroy .
+.Pp
+A trace of the current kernel thread's call stack may be captured using
+.Fn stack_save .
+.Pp
+.Fn stack_print
+and
+.Fn stack_print_short
+may be used to print a stack trace using the kernel
+.Xr printf 9 ,
+and may sleep as a result of acquiring
+.Xr sx 9
+locks in the kernel linker while looking up symbol names.
+In locking-sensitive environments, the unsynchronized
+.Fn stack_print_ddb
+and
+.Fn stack_print_short_ddb
+variants may be invoked.
+This function bypasses kernel linker locking, making it usable in
+.Xr ddb 4 ,
+but not in a live system where linker data structures may change.
+.Pp
+.Fn stack_sbuf_print
+may be used to construct a human-readable string, including conversion (where
+possible) from a simple kernel instruction pointer to a named symbol and
+offset.
+The argument
+.Ar sb
+must be an initialized
+.Dv struct sbuf
+as described in
+.Xr sbuf 9 .
+This function may sleep if an auto-extending
+.Dv struct sbuf
+is used, or due to kernel linker locking.
+In locking-sensitive environments, such as
+.Xr ddb 4 ,
+the unsynchronized
+.Fn stack_sbuf_print_ddb
+variant may be invoked to avoid kernel linker locking; it should be used with
+a fixed-length sbuf.
+.Pp
+The utility functions
+.Nm stack_zero ,
+.Nm stack_copy ,
+and
+.Nm stack_put
+may be used to manipulate stack data structures directly.
+.Sh SEE ALSO
+.Xr ddb 4 ,
+.Xr printf 9 ,
+.Xr sbuf 9 ,
+.Xr sx 9
+.Sh AUTHORS
+.An -nosplit
+The
+.Xr stack 9
+function suite was created by
+.An Antoine Brodin .
+.Xr stack 9
+was extended by
+.An Robert Watson
+for general-purpose use outside of
+.Xr ddb 4 .
diff --git a/share/man/man9/store.9 b/share/man/man9/store.9
new file mode 100644
index 000000000000..e3297e1fb134
--- /dev/null
+++ b/share/man/man9/store.9
@@ -0,0 +1,98 @@
+.\" $NetBSD: store.9,v 1.2 1996/01/09 21:59:27 perry Exp $
+.\"
+.\" Copyright (c) 1996 Jason R. Thorpe.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed by Kenneth Stailey.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed for the NetBSD Project
+.\" by Jason R. Thorpe.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 5, 2009
+.Dt STORE 9
+.Os
+.Sh NAME
+.Nm store ,
+.Nm subyte ,
+.Nm suswintr ,
+.Nm suword
+.Nd store data to user-space
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/time.h
+.In sys/systm.h
+.Ft int
+.Fn subyte "void *base" "int byte"
+.Ft int
+.Fn suword "void *base" "long word"
+.Ft int
+.Fn suword16 "void *base" "int word"
+.Ft int
+.Fn suword32 "void *base" "int32_t word"
+.Ft int
+.Fn suword64 "void *base" "int64_t word"
+.In sys/resourcevar.h
+.Ft int
+.Fn suswintr "void *base" "int word"
+.Sh DESCRIPTION
+The
+.Nm
+functions are designed to copy small amounts of data to user-space.
+.Pp
+The
+.Nm
+routines provide the following functionality:
+.Bl -tag -width "suswintr()"
+.It Fn subyte
+Stores a byte of data to the user-space address
+.Pa base .
+.It Fn suword
+Stores a word of data to the user-space address
+.Pa base .
+.It Fn suword16
+Stores 16 bits of of data to the user-space address
+.Pa base .
+.It Fn suword32
+Stores 32 bits of of data to the user-space address
+.Pa base .
+.It Fn suword64
+Stores 64 bits of of data to the user-space address
+.Pa base .
+.It Fn suswintr
+Stores a short word of data to the user-space address
+.Pa base .
+This function is safe to call during an interrupt context.
+.El
+.Sh RETURN VALUES
+The
+.Nm
+functions return 0 on success or -1 on failure.
+.Sh SEE ALSO
+.Xr copy 9 ,
+.Xr fetch 9
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
new file mode 100644
index 000000000000..ed65ac67b0ad
--- /dev/null
+++ b/share/man/man9/style.9
@@ -0,0 +1,856 @@
+.\"-
+.\" Copyright (c) 1995-2005 The FreeBSD Project
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" From: @(#)style 1.14 (Berkeley) 4/28/95
+.\" $FreeBSD$
+.\"
+.Dd January 7, 2010
+.Dt STYLE 9
+.Os
+.Sh NAME
+.Nm style
+.Nd "kernel source file style guide"
+.Sh DESCRIPTION
+This file specifies the preferred style for kernel source files in the
+.Fx
+source tree.
+It is also a guide for the preferred userland code style.
+Many of the style rules are implicit in the examples.
+Be careful to check the examples before assuming that
+.Nm
+is silent on an issue.
+.Bd -literal
+/*
+ * Style guide for FreeBSD. Based on the CSRG's KNF (Kernel Normal Form).
+ *
+ * @(#)style 1.14 (Berkeley) 4/28/95
+ * $FreeBSD$
+ */
+
+/*
+ * VERY important single-line comments look like this.
+ */
+
+/* Most single-line comments look like this. */
+
+/*
+ * Multi-line comments look like this. Make them real sentences. Fill
+ * them so they look like real paragraphs.
+ */
+.Ed
+.Pp
+The copyright header should be a multi-line comment, with the first
+line of the comment having a dash after the star like so:
+.Bd -literal
+/*-
+ * Copyright (c) 1984-2025 John Q. Public
+ * All rights reserved.
+ *
+ * Long, boring license goes here, but trimmed for brevity
+ */
+.Ed
+.Pp
+An automatic script collects license information from the tree for
+all comments that start in the first column with
+.Dq Li "/*-" .
+If you desire to flag
+.Xr indent 1
+to not reformat a comment that starts in the first column which is not a
+license or copyright notice, change the dash to a star for those
+comments.
+Comments starting in columns other than the first are never
+considered license statements.
+.Pp
+After any copyright header, there is a blank line, and the
+.Li $\&FreeBSD$
+for non C/C++ language source files.
+Version control system ID tags should only exist once in a file
+(unlike in this one).
+Non-C/C++ source files follow the example above, while C/C++ source files
+follow the one below.
+All VCS (version control system) revision identification in files obtained
+from elsewhere should be maintained, including, where applicable, multiple IDs
+showing a file's history.
+In general, do not edit foreign IDs or their infrastructure.
+Unless otherwise wrapped (such as
+.Dq Li "#if defined(LIBC_SCCS)" ) ,
+enclose both in
+.Dq Li "#if 0 ... #endif"
+to hide any uncompilable bits
+and to keep the IDs out of object files.
+Only add
+.Dq Li "From: "
+in front of foreign VCS IDs if the file is renamed.
+.Bd -literal
+#if 0
+#ifndef lint
+static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95";
+#endif /* not lint */
+#endif
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+.Ed
+.Pp
+Leave another blank line before the header files.
+.Pp
+Kernel include files (i.e.\&
+.Pa sys/*.h )
+come first; normally, include
+.In sys/types.h
+OR
+.In sys/param.h ,
+but not both.
+.In sys/types.h
+includes
+.In sys/cdefs.h ,
+and it is okay to depend on that.
+.Bd -literal
+#include <sys/types.h> /* Non-local includes in angle brackets. */
+.Ed
+.Pp
+For a network program, put the network include files next.
+.Bd -literal
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <protocols/rwhod.h>
+.Ed
+.Pp
+Do not use files in
+.Pa /usr/include
+for files in the kernel.
+.Pp
+Leave a blank line before the next group, the
+.Pa /usr/include
+files,
+which should be sorted alphabetically by name.
+.Bd -literal
+#include <stdio.h>
+.Ed
+.Pp
+Global pathnames are defined in
+.In paths.h .
+Pathnames local
+to the program go in
+.Qq Pa pathnames.h
+in the local directory.
+.Bd -literal
+#include <paths.h>
+.Ed
+.Pp
+Leave another blank line before the user include files.
+.Bd -literal
+#include "pathnames.h" /* Local includes in double quotes. */
+.Ed
+.Pp
+Do not
+.Ic #define
+or declare names in the implementation namespace except
+for implementing application interfaces.
+.Pp
+The names of
+.Dq unsafe
+macros (ones that have side effects), and the names of macros for
+manifest constants, are all in uppercase.
+The expansions of expression-like macros are either a single token
+or have outer parentheses.
+Put a single tab character between the
+.Ic #define
+and the macro name.
+If a macro is an inline expansion of a function, the function name is
+all in lowercase and the macro has the same name all in uppercase.
+.\" XXX the above conflicts with ANSI style where the names are the
+.\" same and you #undef the macro (if any) to get the function.
+.\" It is not followed for MALLOC(), and not very common if inline
+.\" functions are used.
+Right-justify the
+backslashes; it makes it easier to read.
+If the macro encapsulates a compound statement, enclose it in a
+.Ic do
+loop,
+so that it can safely be used in
+.Ic if
+statements.
+Any final statement-terminating semicolon should be
+supplied by the macro invocation rather than the macro, to make parsing easier
+for pretty-printers and editors.
+.Bd -literal
+#define MACRO(x, y) do { \e
+ variable = (x) + (y); \e
+ (y) += 2; \e
+} while (0)
+.Ed
+.Pp
+When code is conditionally compiled using
+.Ic #ifdef
+or
+.Ic #if ,
+a comment may be added following the matching
+.Ic #endif
+or
+.Ic #else
+to permit the reader to easily discern where conditionally compiled code
+regions end.
+This comment should be used only for (subjectively) long regions, regions
+greater than 20 lines, or where a series of nested
+.Ic #ifdef 's
+may be confusing to the reader.
+Exceptions may be made for cases where code is conditionally not compiled for
+the purposes of
+.Xr lint 1 ,
+even though the uncompiled region may be small.
+The comment should be separated from the
+.Ic #endif
+or
+.Ic #else
+by a single space.
+For short conditionally compiled regions, a closing comment should not be
+used.
+.Pp
+The comment for
+.Ic #endif
+should match the expression used in the corresponding
+.Ic #if
+or
+.Ic #ifdef .
+The comment for
+.Ic #else
+and
+.Ic #elif
+should match the inverse of the expression(s) used in the preceding
+.Ic #if
+and/or
+.Ic #elif
+statements.
+In the comments, the subexpression
+.Dq Li defined(FOO)
+is abbreviated as
+.Dq Li FOO .
+For the purposes of comments,
+.Dq Ic #ifndef Li FOO
+is treated as
+.Dq Ic #if Li !defined(FOO) .
+.Bd -literal
+#ifdef KTRACE
+#include <sys/ktrace.h>
+#endif
+
+#ifdef COMPAT_43
+/* A large region here, or other conditional code. */
+#else /* !COMPAT_43 */
+/* Or here. */
+#endif /* COMPAT_43 */
+
+#ifndef COMPAT_43
+/* Yet another large region here, or other conditional code. */
+#else /* COMPAT_43 */
+/* Or here. */
+#endif /* !COMPAT_43 */
+.Ed
+.Pp
+The project is slowly moving to use the
+.St -isoC-99
+unsigned integer identifiers of the form
+.Vt uintXX_t
+in preference to the older
+.Bx Ns -style
+integer identifiers of the form
+.Vt u_intXX_t .
+New code should use the former, and old code should be converted to
+the new form if other major work is being done in that area and
+there is no overriding reason to prefer the older
+.Bx Ns -style .
+Like white-space commits, care should be taken in making
+.Vt uintXX_t
+only commits.
+.Pp
+Enumeration values are all uppercase.
+.Bd -literal
+enum enumtype { ONE, TWO } et;
+.Ed
+.Pp
+The use of internal_underscores in identifiers is preferred over
+camelCase or TitleCase.
+.Pp
+In declarations, do not put any whitespace between asterisks and
+adjacent tokens, except for tokens that are identifiers related to
+types.
+(These identifiers are the names of basic types, type
+qualifiers, and
+.Ic typedef Ns -names
+other than the one being declared.)
+Separate these identifiers from asterisks using a single space.
+.Pp
+When declaring variables in structures, declare them sorted by use, then
+by size (largest to smallest), and then in alphabetical order.
+The first category normally does not apply, but there are exceptions.
+Each one gets its own line.
+Try to make the structure
+readable by aligning the member names using either one or two tabs
+depending upon your judgment.
+You should use one tab only if it suffices to align at least 90% of
+the member names.
+Names following extremely long types
+should be separated by a single space.
+.Pp
+Major structures should be declared at the top of the file in which they
+are used, or in separate header files if they are used in multiple
+source files.
+Use of the structures should be by separate declarations
+and should be
+.Ic extern
+if they are declared in a header file.
+.Bd -literal
+struct foo {
+ struct foo *next; /* List of active foo. */
+ struct mumble amumble; /* Comment for mumble. */
+ int bar; /* Try to align the comments. */
+ struct verylongtypename *baz; /* Won't fit in 2 tabs. */
+};
+struct foo *foohead; /* Head of global foo list. */
+.Ed
+.Pp
+Use
+.Xr queue 3
+macros rather than rolling your own lists, whenever possible.
+Thus,
+the previous example would be better written:
+.Bd -literal
+#include <sys/queue.h>
+
+struct foo {
+ LIST_ENTRY(foo) link; /* Use queue macros for foo lists. */
+ struct mumble amumble; /* Comment for mumble. */
+ int bar; /* Try to align the comments. */
+ struct verylongtypename *baz; /* Won't fit in 2 tabs. */
+};
+LIST_HEAD(, foo) foohead; /* Head of global foo list. */
+.Ed
+.Pp
+Avoid using typedefs for structure types.
+Typedefs are problematic because they do not properly hide their
+underlying type; for example you need to know if the typedef is
+the structure itself or a pointer to the structure.
+In addition they must be declared exactly once, whereas an
+incomplete structure type can be mentioned as many times as
+necessary.
+Typedefs are difficult to use in stand-alone header files:
+the header that defines the typedef must be included
+before the header that uses it, or by the header that uses
+it (which causes namespace pollution), or there must be a
+back-door mechanism for obtaining the typedef.
+.Pp
+When convention requires a
+.Ic typedef ,
+make its name match the struct tag.
+Avoid typedefs ending in
+.Dq Li _t ,
+except as specified in Standard C or by
+.Tn POSIX .
+.Bd -literal
+/* Make the structure name match the typedef. */
+typedef struct bar {
+ int level;
+} BAR;
+typedef int foo; /* This is foo. */
+typedef const long baz; /* This is baz. */
+.Ed
+.Pp
+All functions are prototyped somewhere.
+.Pp
+Function prototypes for private functions (i.e., functions not used
+elsewhere) go at the top of the first source module.
+Functions
+local to one source module should be declared
+.Ic static .
+.Pp
+Functions used from other parts of the kernel are prototyped in the
+relevant include file.
+Function prototypes should be listed in a logical order, preferably
+alphabetical unless there is a compelling reason to use a different
+ordering.
+.Pp
+Functions that are used locally in more than one module go into a
+separate header file, e.g.\&
+.Qq Pa extern.h .
+.Pp
+Do not use the
+.Dv __P
+macro.
+.Pp
+In general code can be considered
+.Dq "new code"
+when it makes up about 50% or more of the file(s) involved.
+This is enough
+to break precedents in the existing code and use the current
+.Nm
+guidelines.
+.Pp
+The kernel has a name associated with parameter types, e.g., in the kernel
+use:
+.Bd -literal
+void function(int fd);
+.Ed
+.Pp
+In header files visible to userland applications, prototypes that are
+visible must use either
+.Dq protected
+names (ones beginning with an underscore)
+or no names with the types.
+It is preferable to use protected names.
+E.g., use:
+.Bd -literal
+void function(int);
+.Ed
+.Pp
+or:
+.Bd -literal
+void function(int _fd);
+.Ed
+.Pp
+Prototypes may have an extra space after a tab to enable function names
+to line up:
+.Bd -literal
+static char *function(int _arg, const char *_arg2, struct foo *_arg3,
+ struct bar *_arg4);
+static void usage(void);
+
+/*
+ * All major routines should have a comment briefly describing what
+ * they do. The comment before the "main" routine should describe
+ * what the program does.
+ */
+int
+main(int argc, char *argv[])
+{
+ char *ep;
+ long num;
+ int ch;
+.Ed
+.Pp
+For consistency,
+.Xr getopt 3
+should be used to parse options.
+Options
+should be sorted in the
+.Xr getopt 3
+call and the
+.Ic switch
+statement, unless
+parts of the
+.Ic switch
+cascade.
+Elements in a
+.Ic switch
+statement that cascade should have a
+.Li FALLTHROUGH
+comment.
+Numerical arguments should be checked for accuracy.
+Code which is unreachable for non-obvious reasons may be marked /*
+.Li NOTREACHED
+*/.
+.Bd -literal
+ while ((ch = getopt(argc, argv, "abNn:")) != -1)
+ switch (ch) { /* Indent the switch. */
+ case 'a': /* Don't indent the case. */
+ aflag = 1; /* Indent case body one tab. */
+ /* FALLTHROUGH */
+ case 'b':
+ bflag = 1;
+ break;
+ case 'N':
+ Nflag = 1;
+ break;
+ case 'n':
+ num = strtol(optarg, &ep, 10);
+ if (num <= 0 || *ep != '\e0') {
+ warnx("illegal number, -n argument -- %s",
+ optarg);
+ usage();
+ }
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+.Ed
+.Pp
+Space after keywords
+.Pq Ic if , while , for , return , switch .
+No braces
+.Ql ( \&{
+and
+.Ql \&} )
+are
+used for control statements with zero or only a single statement unless that
+statement is more than a single line in which case they are permitted.
+Forever loops are done with
+.Ic for Ns 's ,
+not
+.Ic while Ns 's .
+.Bd -literal
+ for (p = buf; *p != '\e0'; ++p)
+ ; /* nothing */
+ for (;;)
+ stmt;
+ for (;;) {
+ z = a + really + long + statement + that + needs +
+ two + lines + gets + indented + four + spaces +
+ on + the + second + and + subsequent + lines;
+ }
+ for (;;) {
+ if (cond)
+ stmt;
+ }
+ if (val != NULL)
+ val = realloc(val, newsize);
+.Ed
+.Pp
+Parts of a
+.Ic for
+loop may be left empty.
+Do not put declarations
+inside blocks unless the routine is unusually complicated.
+.Bd -literal
+ for (; cnt < 15; cnt++) {
+ stmt1;
+ stmt2;
+ }
+.Ed
+.Pp
+Indentation is an 8 character tab.
+Second level indents are four spaces.
+If you have to wrap a long statement, put the operator at the end of the
+line.
+.Bd -literal
+ while (cnt < 20 && this_variable_name_is_too_long &&
+ ep != NULL)
+ z = a + really + long + statement + that + needs +
+ two + lines + gets + indented + four + spaces +
+ on + the + second + and + subsequent + lines;
+.Ed
+.Pp
+Do not add whitespace at the end of a line, and only use tabs
+followed by spaces
+to form the indentation.
+Do not use more spaces than a tab will produce
+and do not use spaces in front of tabs.
+.Pp
+Closing and opening braces go on the same line as the
+.Ic else .
+Braces that are not necessary may be left out.
+.Bd -literal
+ if (test)
+ stmt;
+ else if (bar) {
+ stmt;
+ stmt;
+ } else
+ stmt;
+.Ed
+.Pp
+No spaces after function names.
+Commas have a space after them.
+No spaces
+after
+.Ql \&(
+or
+.Ql \&[
+or preceding
+.Ql \&]
+or
+.Ql \&)
+characters.
+.Bd -literal
+ error = function(a1, a2);
+ if (error != 0)
+ exit(error);
+.Ed
+.Pp
+Unary operators do not require spaces, binary operators do.
+Do not use parentheses unless they are required for precedence or unless the
+statement is confusing without them.
+Remember that other people may
+confuse easier than you.
+Do YOU understand the following?
+.Bd -literal
+ a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
+ k = !(l & FLAGS);
+.Ed
+.Pp
+Exits should be 0 on success, or 1 on failure.
+.Bd -literal
+ exit(0); /*
+ * Avoid obvious comments such as
+ * "Exit 0 on success."
+ */
+}
+.Ed
+.Pp
+The function type should be on a line by itself
+preceding the function.
+The opening brace of the function body should be
+on a line by itself.
+.Bd -literal
+static char *
+function(int a1, int a2, float fl, int a4)
+{
+.Ed
+.Pp
+When declaring variables in functions declare them sorted by size,
+then in alphabetical order; multiple ones per line are okay.
+If a line overflows reuse the type keyword.
+.Pp
+Be careful to not obfuscate the code by initializing variables in
+the declarations.
+Use this feature only thoughtfully.
+DO NOT use function calls in initializers.
+.Bd -literal
+ struct foo one, *two;
+ double three;
+ int *four, five;
+ char *six, seven, eight, nine, ten, eleven, twelve;
+
+ four = myfunction();
+.Ed
+.Pp
+Do not declare functions inside other functions; ANSI C says that
+such declarations have file scope regardless of the nesting of the
+declaration.
+Hiding file declarations in what appears to be a local
+scope is undesirable and will elicit complaints from a good compiler.
+.Pp
+Casts and
+.Ic sizeof Ns 's
+are not followed by a space.
+Note that
+.Xr indent 1
+does not understand this rule.
+.Ic sizeof Ns 's
+are written with parenthesis always.
+The redundant parenthesis rules do not apply to
+.Fn sizeof var
+instances.
+.Pp
+.Dv NULL
+is the preferred null pointer constant.
+Use
+.Dv NULL
+instead of
+.Vt ( "type *" ) Ns 0
+or
+.Vt ( "type *" ) Ns Dv NULL
+in contexts where the compiler knows the
+type, e.g., in assignments.
+Use
+.Vt ( "type *" ) Ns Dv NULL
+in other contexts,
+in particular for all function args.
+(Casting is essential for
+variadic args and is necessary for other args if the function prototype
+might not be in scope.)
+Test pointers against
+.Dv NULL ,
+e.g., use:
+.Bd -literal
+(p = f()) == NULL
+.Ed
+.Pp
+not:
+.Bd -literal
+!(p = f())
+.Ed
+.Pp
+Do not use
+.Ic \&!
+for tests unless it is a boolean, e.g.\& use:
+.Bd -literal
+if (*p == '\e0')
+.Ed
+.Pp
+not:
+.Bd -literal
+if (!*p)
+.Ed
+.Pp
+Routines returning
+.Vt "void *"
+should not have their return values cast
+to any pointer type.
+.Pp
+Values in
+.Ic return
+statements should be enclosed in parentheses.
+.Pp
+Use
+.Xr err 3
+or
+.Xr warn 3 ,
+do not roll your own.
+.Bd -literal
+ if ((four = malloc(sizeof(struct foo))) == NULL)
+ err(1, (char *)NULL);
+ if ((six = (int *)overflow()) == NULL)
+ errx(1, "number overflowed");
+ return (eight);
+}
+.Ed
+.Pp
+Old-style function declarations look like this:
+.Bd -literal
+static char *
+function(a1, a2, fl, a4)
+ int a1, a2; /* Declare ints, too, don't default them. */
+ float fl; /* Beware double vs. float prototype differences. */
+ int a4; /* List in order declared. */
+{
+.Ed
+.Pp
+Use ANSI function declarations unless you explicitly need K&R compatibility.
+Long parameter lists are wrapped with a normal four space indent.
+.Pp
+Variable numbers of arguments should look like this:
+.Bd -literal
+#include <stdarg.h>
+
+void
+vaf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ STUFF;
+ va_end(ap);
+ /* No return needed for void functions. */
+}
+
+static void
+usage()
+{
+ /* Insert an empty line if the function has no local variables. */
+.Ed
+.Pp
+Use
+.Xr printf 3 ,
+not
+.Xr fputs 3 ,
+.Xr puts 3 ,
+.Xr putchar 3 ,
+whatever; it is faster and usually cleaner, not
+to mention avoiding stupid bugs.
+.Pp
+Usage statements should look like the manual pages
+.Sx SYNOPSIS .
+The usage statement should be structured in the following order:
+.Bl -enum
+.It
+Options without operands come first,
+in alphabetical order,
+inside a single set of brackets
+.Ql ( \&[
+and
+.Ql \&] ) .
+.It
+Options with operands come next,
+also in alphabetical order,
+with each option and its argument inside its own pair of brackets.
+.It
+Required arguments
+(if any)
+are next,
+listed in the order they should be specified on the command line.
+.It
+Finally,
+any optional arguments should be listed,
+listed in the order they should be specified,
+and all inside brackets.
+.El
+.Pp
+A bar
+.Pq Ql \&|
+separates
+.Dq either-or
+options/arguments,
+and multiple options/arguments which are specified together are
+placed in a single set of brackets.
+.Bd -literal -offset 4n
+"usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\en"
+"usage: f [-a | -b] [-c [-dEe] [-n number]]\en"
+.Ed
+.Bd -literal
+ (void)fprintf(stderr, "usage: f [-ab]\en");
+ exit(1);
+}
+.Ed
+.Pp
+Note that the manual page options description should list the options in
+pure alphabetical order.
+That is, without regard to whether an option takes arguments or not.
+The alphabetical ordering should take into account the case ordering
+shown above.
+.Pp
+New core kernel code should be reasonably compliant with the
+.Nm
+guides.
+The guidelines for third-party maintained modules and device drivers are more
+relaxed but at a minimum should be internally consistent with their style.
+.Pp
+Stylistic changes (including whitespace changes) are hard on the source
+repository and are to be avoided without good reason.
+Code that is approximately
+.Fx
+KNF
+.Nm
+compliant in the repository must not diverge from compliance.
+.Pp
+Whenever possible, code should be run through a code checker
+(e.g.,
+.Xr lint 1
+or
+.Nm gcc Fl Wall )
+and produce minimal warnings.
+.Sh SEE ALSO
+.Xr indent 1 ,
+.Xr lint 1 ,
+.Xr err 3 ,
+.Xr warn 3 ,
+.Xr style.Makefile 5
+.Sh HISTORY
+This manual page is largely based on the
+.Pa src/admin/style/style
+file from the
+.Bx 4.4 Lite2
+release, with occasional updates to reflect the current practice and
+desire of the
+.Fx
+project.
+.Pa src/admin/style/style
+is a codification by the CSRG of the programming style of Ken Thompson and
+Dennis Ritchie in
+.At v6 .
diff --git a/share/man/man9/swi.9 b/share/man/man9/swi.9
new file mode 100644
index 000000000000..ec2c3d6fefe6
--- /dev/null
+++ b/share/man/man9/swi.9
@@ -0,0 +1,226 @@
+.\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 30, 2000
+.Dt SWI 9
+.Os
+.Sh NAME
+.Nm swi_add ,
+.Nm swi_sched
+.Nd register and schedule software interrupt handlers
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.In sys/interrupt.h
+.Vt "extern struct ithd *tty_ithd" ;
+.Vt "extern struct ithd *clk_ithd" ;
+.Vt "extern void *net_ih" ;
+.Vt "extern void *softclock_ih" ;
+.Vt "extern void *vm_ih" ;
+.Ft int
+.Fo swi_add
+.Fa "struct ithd **ithdp"
+.Fa "const char *name"
+.Fa "driver_intr_t handler"
+.Fa "void *arg"
+.Fa "int pri"
+.Fa "enum intr_type flags"
+.Fa "void **cookiep"
+.Fc
+.Ft void
+.Fn swi_sched "void *cookie" "int flags"
+.Sh DESCRIPTION
+These functions are used to register and schedule software interrupt handlers.
+Software interrupt handlers are attached to a software interrupt thread, just
+as hardware interrupt handlers are attached to a hardware interrupt thread.
+Multiple handlers can be attached to the same thread.
+Software interrupt handlers can be used to queue up less critical processing
+inside of hardware interrupt handlers so that the work can be done at a later
+time.
+Software interrupt threads are different from other kernel threads in that they
+are treated as an interrupt thread.
+This means that time spent executing these threads is counted as interrupt
+time, and that they can be run via a lightweight context switch.
+.Pp
+The
+.Fn swi_add
+function is used to register a new software interrupt handler.
+The
+.Fa ithdp
+argument is an optional pointer to a
+.Vt struct ithd
+pointer.
+If this argument points to an existing software interrupt thread, then this
+handler will be attached to that thread.
+Otherwise a new thread will be created, and if
+.Fa ithdp
+is not
+.Dv NULL ,
+then the pointer at that address to will be modified to point to the
+newly created thread.
+The
+.Fa name
+argument is used to associate a name with a specific handler.
+This name is appended to the name of the software interrupt thread that this
+handler is attached to.
+The
+.Fa handler
+argument is the function that will be executed when the handler is scheduled
+to run.
+The
+.Fa arg
+parameter will be passed in as the only parameter to
+.Fa handler
+when the function is executed.
+The
+.Fa pri
+value specifies the priority of this interrupt handler relative to other
+software interrupt handlers.
+If an interrupt thread is created, then this value is used as the vector,
+and the
+.Fa flags
+argument is used to specify the attributes of a handler such as
+.Dv INTR_MPSAFE .
+The
+.Fa cookiep
+argument points to a
+.Vt void *
+cookie.
+This cookie will be set to a value that uniquely identifies this handler,
+and is used to schedule the handler for execution later on.
+.Pp
+The
+.Fn swi_sched
+function is used to schedule an interrupt handler and its associated thread to
+run.
+The
+.Fa cookie
+argument specifies which software interrupt handler should be scheduled to run.
+The
+.Fa flags
+argument specifies how and when the handler should be run and is a mask of one
+or more of the following flags:
+.Bl -tag -width SWI_DELAY
+.It Dv SWI_DELAY
+Specifies that the kernel should mark the specified handler as needing to run,
+but the kernel should not schedule the software interrupt thread to run.
+Instead,
+.Fa handler
+will be executed the next time that the software interrupt thread runs after
+being scheduled by another event.
+Attaching a handler to the clock software interrupt thread and using this flag
+when scheduling a software interrupt handler can be used to implement the
+functionality performed by
+.Fn setdelayed
+in earlier versions of
+.Fx .
+.El
+.Pp
+The
+.Va tty_ithd
+and
+.Va clk_ithd
+variables contain pointers to the software interrupt threads for the tty and
+clock software interrupts, respectively.
+.Va tty_ithd
+is used to hang tty software interrupt handlers off of the same thread.
+.Va clk_ithd
+is used to hang delayed handlers off of the clock software interrupt thread so
+that the functionality of
+.Fn setdelayed
+can be obtained in conjunction with
+.Dv SWI_DELAY .
+The
+.Va net_ih ,
+.Va softclock_ih ,
+and
+.Va vm_ih
+handler cookies are used to schedule software interrupt threads to run for the
+networking stack, clock interrupt, and VM subsystem respectively.
+.Sh RETURN VALUES
+The
+.Fn swi_add
+function returns zero on success and non-zero on failure.
+.Sh ERRORS
+The
+.Fn swi_add
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The system-imposed limit on the total
+number of processes under execution would be exceeded.
+The limit is given by the
+.Xr sysctl 3
+MIB variable
+.Dv KERN_MAXPROC .
+.It Bq Er EINVAL
+The
+.Fa flags
+argument specifies
+.Dv INTR_ENTROPY .
+.It Bq Er EINVAL
+The
+.Fa ithdp
+argument points to a hardware interrupt thread.
+.It Bq Er EINVAL
+Either of the
+.Fa name
+or
+.Fa handler
+arguments are
+.Dv NULL .
+.It Bq Er EINVAL
+The
+.Dv INTR_EXCL
+flag is specified and the interrupt thread pointed to by
+.Fa ithdp
+already has at least one handler, or the interrupt thread already has an
+exclusive handler.
+.El
+.Sh SEE ALSO
+.Xr ithread 9 ,
+.Xr taskqueue 9
+.Sh HISTORY
+The
+.Fn swi_add
+and
+.Fn swi_sched
+functions first appeared in
+.Fx 5.0 .
+They replaced the
+.Fn register_swi
+function which appeared in
+.Fx 3.0
+and the
+.Fn setsoft* ,
+and
+.Fn schedsoft*
+functions which date back to at least
+.Bx 4.4 .
+.Sh BUGS
+Most of the global variables described in this manual page should not be
+global, or at the very least should not be declared in
+.In sys/interrupt.h .
diff --git a/share/man/man9/sx.9 b/share/man/man9/sx.9
new file mode 100644
index 000000000000..b9987497ba40
--- /dev/null
+++ b/share/man/man9/sx.9
@@ -0,0 +1,328 @@
+.\"
+.\" Copyright (C) 2001 Jason Evans <jasone@FreeBSD.org>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 16, 2011
+.Dt SX 9
+.Os
+.Sh NAME
+.Nm sx ,
+.Nm sx_init ,
+.Nm sx_init_flags ,
+.Nm sx_destroy ,
+.Nm sx_slock ,
+.Nm sx_xlock ,
+.Nm sx_slock_sig ,
+.Nm sx_xlock_sig ,
+.Nm sx_try_slock ,
+.Nm sx_try_xlock ,
+.Nm sx_sunlock ,
+.Nm sx_xunlock ,
+.Nm sx_unlock ,
+.Nm sx_try_upgrade ,
+.Nm sx_downgrade ,
+.Nm sx_sleep ,
+.Nm sx_xholder ,
+.Nm sx_xlocked ,
+.Nm sx_assert ,
+.Nm SX_SYSINIT
+.Nd kernel shared/exclusive lock
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/sx.h
+.Ft void
+.Fn sx_init "struct sx *sx" "const char *description"
+.Ft void
+.Fn sx_init_flags "struct sx *sx" "const char *description" "int opts"
+.Ft void
+.Fn sx_destroy "struct sx *sx"
+.Ft void
+.Fn sx_slock "struct sx *sx"
+.Ft void
+.Fn sx_xlock "struct sx *sx"
+.Ft int
+.Fn sx_slock_sig "struct sx *sx"
+.Ft int
+.Fn sx_xlock_sig "struct sx *sx"
+.Ft int
+.Fn sx_try_slock "struct sx *sx"
+.Ft int
+.Fn sx_try_xlock "struct sx *sx"
+.Ft void
+.Fn sx_sunlock "struct sx *sx"
+.Ft void
+.Fn sx_xunlock "struct sx *sx"
+.Ft void
+.Fn sx_unlock "struct sx *sx"
+.Ft int
+.Fn sx_try_upgrade "struct sx *sx"
+.Ft void
+.Fn sx_downgrade "struct sx *sx"
+.Ft int
+.Fn sx_sleep "void *chan" "struct sx *sx" "int priority" "const char *wmesg" "int timo"
+.Ft "struct thread *"
+.Fn sx_xholder "struct sx *sx"
+.Ft int
+.Fn sx_xlocked "const struct sx *sx"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
+.Ft void
+.Fn sx_assert "const struct sx *sx" "int what"
+.In sys/kernel.h
+.Fn SX_SYSINIT "name" "struct sx *sx" "const char *description"
+.Sh DESCRIPTION
+Shared/exclusive locks are used to protect data that are read far more often
+than they are written.
+Shared/exclusive locks do not implement priority propagation like mutexes and
+reader/writer locks to prevent priority inversions, so
+shared/exclusive locks should be used prudently.
+.Pp
+Shared/exclusive locks are created with either
+.Fn sx_init
+or
+.Fn sx_init_flags
+where
+.Fa sx
+is a pointer to space for a
+.Vt struct sx ,
+and
+.Fa description
+is a pointer to a null-terminated character string that describes the
+shared/exclusive lock.
+The
+.Fa opts
+argument to
+.Fn sx_init_flags
+specifies a set of optional flags to alter the behavior of
+.Fa sx .
+It contains one or more of the following flags:
+.Bl -tag -width SX_NOADAPTIVE
+.It Dv SX_NOADAPTIVE
+If the kernel is not compiled with
+.Cd "options NO_ADAPTIVE_SX" ,
+then lock operations for
+.Fa sx
+will spin instead of sleeping while an exclusive lock holder is executing on
+another CPU.
+.It Dv SX_DUPOK
+Witness should not log messages about duplicate locks being acquired.
+.It Dv SX_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv SX_NOPROFILE
+Do not profile this lock.
+.It Dv SX_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa sx .
+.It Dv SX_QUIET
+Do not log any operations for this lock via
+.Xr ktr 4 .
+.El
+.Pp
+Shared/exclusive locks are destroyed with
+.Fn sx_destroy .
+The lock
+.Fa sx
+must not be locked by any thread when it is destroyed.
+.Pp
+Threads acquire and release a shared lock by calling
+.Fn sx_slock ,
+.Fn sx_slock_sig
+or
+.Fn sx_try_slock
+and
+.Fn sx_sunlock
+or
+.Fn sx_unlock .
+Threads acquire and release an exclusive lock by calling
+.Fn sx_xlock ,
+.Fn sx_xlock_sig
+or
+.Fn sx_try_xlock
+and
+.Fn sx_xunlock
+or
+.Fn sx_unlock .
+A thread can attempt to upgrade a currently held shared lock to an exclusive
+lock by calling
+.Fn sx_try_upgrade .
+A thread that has an exclusive lock can downgrade it to a shared lock by
+calling
+.Fn sx_downgrade .
+.Pp
+.Fn sx_try_slock
+and
+.Fn sx_try_xlock
+will return 0 if the shared/exclusive lock cannot be acquired immediately;
+otherwise the shared/exclusive lock will be acquired and a non-zero value will
+be returned.
+.Pp
+.Fn sx_try_upgrade
+will return 0 if the shared lock cannot be upgraded to an exclusive lock
+immediately; otherwise the exclusive lock will be acquired and a non-zero value
+will be returned.
+.Pp
+.Fn sx_slock_sig
+and
+.Fn sx_xlock_sig
+do the same as their normal versions but performing an interruptible sleep.
+They return a non-zero value if the sleep has been interrupted by a signal
+or an interrupt, otherwise 0.
+.Pp
+A thread can atomically release a shared/exclusive lock while waiting for an
+event by calling
+.Fn sx_sleep .
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.Pp
+When compiled with
+.Cd "options INVARIANTS"
+and
+.Cd "options INVARIANT_SUPPORT" ,
+the
+.Fn sx_assert
+function tests
+.Fa sx
+for the assertions specified in
+.Fa what ,
+and panics if they are not met.
+One of the following assertions must be specified:
+.Bl -tag -width ".Dv SA_UNLOCKED"
+.It Dv SA_LOCKED
+Assert that the current thread has either a shared or an exclusive lock on the
+.Vt sx
+lock pointed to by the first argument.
+.It Dv SA_SLOCKED
+Assert that the current thread has a shared lock on the
+.Vt sx
+lock pointed to by
+the first argument.
+.It Dv SA_XLOCKED
+Assert that the current thread has an exclusive lock on the
+.Vt sx
+lock pointed to
+by the first argument.
+.It Dv SA_UNLOCKED
+Assert that the current thread has no lock on the
+.Vt sx
+lock pointed to
+by the first argument.
+.El
+.Pp
+In addition, one of the following optional assertions may be included with
+either an
+.Dv SA_LOCKED ,
+.Dv SA_SLOCKED ,
+or
+.Dv SA_XLOCKED
+assertion:
+.Bl -tag -width ".Dv SA_NOTRECURSED"
+.It Dv SA_RECURSED
+Assert that the current thread has a recursed lock on
+.Fa sx .
+.It Dv SA_NOTRECURSED
+Assert that the current thread does not have a recursed lock on
+.Fa sx .
+.El
+.Pp
+.Fn sx_xholder
+will return a pointer to the thread which currently holds an exclusive lock on
+.Fa sx .
+If no thread holds an exclusive lock on
+.Fa sx ,
+then
+.Dv NULL
+is returned instead.
+.Pp
+.Fn sx_xlocked
+will return non-zero if the current thread holds the exclusive lock;
+otherwise, it will return zero.
+.Pp
+For ease of programming,
+.Fn sx_unlock
+is provided as a macro frontend to the respective functions,
+.Fn sx_sunlock
+and
+.Fn sx_xunlock .
+Algorithms that are aware of what state the lock is in should use either
+of the two specific functions for a minor performance benefit.
+.Pp
+The
+.Fn SX_SYSINIT
+macro is used to generate a call to the
+.Fn sx_sysinit
+routine at system startup in order to initialize a given
+.Fa sx
+lock.
+The parameters are the same as
+.Fn sx_init
+but with an additional argument,
+.Fa name ,
+that is used in generating unique variable names for the related
+structures associated with the lock and the sysinit routine.
+.Pp
+A thread may not hold both a shared lock and an exclusive lock on the same
+lock simultaneously;
+attempting to do so will result in deadlock.
+.Sh CONTEXT
+A thread may hold a shared or exclusive lock on an
+.Nm
+lock while sleeping.
+As a result, an
+.Nm
+lock may not be acquired while holding a mutex.
+Otherwise, if one thread slept while holding an
+.Nm
+lock while another thread blocked on the same
+.Nm
+lock after acquiring a mutex, then the second thread would effectively
+end up sleeping while holding a mutex, which is not allowed.
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr lock 9 ,
+.Xr mutex 9 ,
+.Xr panic 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9
+.Sh BUGS
+Currently there is no way to assert that a lock is not held.
+This is not possible in the
+.No non- Ns Dv WITNESS
+case for asserting that this thread
+does not hold a shared lock.
+In the
+.No non- Ns Dv WITNESS
+case, the
+.Dv SA_LOCKED
+and
+.Dv SA_SLOCKED
+assertions merely check that some thread holds a shared lock.
+They do not ensure that the current thread holds a shared lock.
diff --git a/share/man/man9/sysctl.9 b/share/man/man9/sysctl.9
new file mode 100644
index 000000000000..d58573b247a2
--- /dev/null
+++ b/share/man/man9/sysctl.9
@@ -0,0 +1,303 @@
+.\"
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 16, 2010
+.Dt SYSCTL 9
+.Os
+.Sh NAME
+.Nm SYSCTL_DECL ,
+.Nm SYSCTL_INT ,
+.Nm SYSCTL_LONG ,
+.Nm SYSCTL_NODE ,
+.Nm SYSCTL_OPAQUE ,
+.Nm SYSCTL_PROC ,
+.Nm SYSCTL_STRING ,
+.Nm SYSCTL_STRUCT ,
+.Nm SYSCTL_UINT ,
+.Nm SYSCTL_ULONG ,
+.Nm SYSCTL_QUAD
+.Nd Static sysctl declaration functions
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sysctl.h
+.Fn SYSCTL_DECL name
+.Fn SYSCTL_INT parent nbr name access ptr val descr
+.Fn SYSCTL_LONG parent nbr name access ptr val descr
+.Fn SYSCTL_NODE parent nbr name access handler descr
+.Fn SYSCTL_OPAQUE parent nbr name access ptr len fmt descr
+.Fn SYSCTL_PROC parent nbr name access ptr arg handler fmt descr
+.Fn SYSCTL_STRING parent nbr name access arg len descr
+.Fn SYSCTL_STRUCT parent nbr name access ptr type descr
+.Fn SYSCTL_UINT parent nbr name access ptr val descr
+.Fn SYSCTL_ULONG parent nbr name access ptr val descr
+.Fn SYSCTL_QUAD parent nbr name access ptr val descr
+.Sh DESCRIPTION
+The
+.Nm SYSCTL
+kernel interfaces allow code to statically declare
+.Xr sysctl 8
+MIB entries, which will be initialized when the kernel module containing the
+declaration is initialized.
+When the module is unloaded, the sysctl will be automatically destroyed.
+.Pp
+Sysctl nodes are created in a hierarchical tree, with all static nodes being
+represented by named C data structures; in order to create a new node under
+an existing node in the tree, the structure representing the desired parent
+node must be declared in the current context using
+.Fn SYSCTL_DECL .
+.Pp
+New nodes are declared using one of
+.Fn SYSCTL_INT ,
+.Fn SYSCTL_LONG ,
+.Fn SYSCTL_NODE ,
+.Fn SYSCTL_OPAQUE ,
+.Fn SYSCTL_PROC ,
+.Fn SYSCTL_STRING ,
+.Fn SYSCTL_STRUCT ,
+.Fn SYSCTL_UINT ,
+.Fn SYSCTL_ULONG ,
+and
+.Fn SYSCTL_QUAD .
+Each macro accepts a parent name, as declared using
+.Fn SYSCTL_DECL ,
+an OID number, typically
+.Dv OID_AUTO ,
+a node name, a set of control and access flags, and a description.
+Depending on the macro, a pointer to a variable supporting the MIB entry, a
+size, a value, and a function pointer implementing the MIB entry may also be
+present.
+.Pp
+For most of the above macros, declaring a type as part of the access flags is
+not necessary \[em] however, when declaring a sysctl implemented by a function,
+including a type in the access mask is required:
+.Bl -tag -width ".Dv CTLTYPE_STRING"
+.It Dv CTLTYPE_NODE
+This is a node intended to be a parent for other nodes.
+.It Dv CTLTYPE_INT
+This is a signed integer.
+.It Dv CTLTYPE_STRING
+This is a nul-terminated string stored in a character array.
+.It Dv CTLTYPE_S64
+This is a 64-bit signed integer.
+.It Dv CTLTYPE_OPAQUE
+This is an opaque data structure.
+.It Dv CTLTYPE_STRUCT
+Alias for
+.Dv CTLTYPE_OPAQUE.
+.It Dv CTLTYPE_UINT
+This is an unsigned integer.
+.It Dv CTLTYPE_LONG
+This is a signed long.
+.It Dv CTLTYPE_ULONG
+This is an unsigned long.
+.It Dv CTLTYPE_U64
+This is a 64-bit unsigned integer.
+.El
+.Pp
+All sysctl types except for new node declarations require one or more flags
+to be set indicating the read and write disposition of the sysctl:
+.Bl -tag -width ".Dv CTLFLAG_ANYBODY"
+.It Dv CTLFLAG_RD
+This is a read-only sysctl.
+.It Dv CTLFLAG_WR
+This is a writable sysctl.
+.It Dv CTLFLAG_RW
+This sysctl is readable and writable.
+.It Dv CTLFLAG_ANYBODY
+Any user or process can write to this sysctl.
+.It Dv CTLFLAG_SECURE
+This sysctl can be written to only if the effective securelevel of the
+process is \[<=] 0.
+.It Dv CTLFLAG_PRISON
+This sysctl can be written to by processes in
+.Xr jail 2 .
+.It Dv CTLFLAG_SKIP
+When iterating the sysctl name space, do not list this sysctl.
+.It Dv CTLFLAG_TUN
+Advisory flag that a system tunable also exists for this variable.
+.It Dv CTLFLAG_RDTUN
+Advisory flag that a system tunable also exists for this variable;
+however, the run-time variable is read-only.
+.El
+.Pp
+When creating new sysctls, careful attention should be paid to the security
+implications of the monitoring or management interface being created.
+Most sysctls present in the kernel are read-only or writable only by the
+superuser.
+Sysctls exporting extensive information on system data structures and
+operation, especially those implemented using procedures, will wish to
+implement access control to limit the undesired exposure of information about
+other processes, network connections, etc.
+.Pp
+The following top level sysctl name spaces are commonly used:
+.Bl -tag -width ".Va regression"
+.It Va compat
+Compatibility layer information.
+.It Va debug
+Debugging information.
+Various name spaces exist under
+.Va debug .
+.It Va hw
+Hardware and device driver information.
+.It Va kern
+Kernel behavior tuning; generally deprecated in favor of more specific
+name spaces.
+.It Va machdep
+Machine-dependent configuration parameters.
+.It Va net
+Network subsystem.
+Various protocols have name spaces under
+.Va net .
+.It Va regression
+Regression test configuration and information.
+.It Va security
+Security and security-policy configuration and information.
+.It Va sysctl
+Reserved name space for the implementation of sysctl.
+.It Va user
+Configuration settings relating to user application behavior.
+Generally, configuring applications using kernel sysctls is discouraged.
+.It Va vfs
+Virtual file system configuration and information.
+.It Va vm
+Virtual memory subsystem configuration and information.
+.El
+.Sh EXAMPLES
+Sample use of
+.Fn SYSCTL_DECL
+to declare the
+.Va security
+sysctl tree for use by new nodes:
+.Bd -literal -offset indent
+SYSCTL_DECL(_security);
+.Ed
+.Pp
+Examples of integer, opaque, string, and procedure sysctls follow:
+.Bd -literal -offset indent
+/*
+ * Example of a constant integer value. Notice that the control
+ * flags are CTLFLAG_RD, the variable pointer is NULL, and the
+ * value is declared.
+ */
+SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, NULL,
+ sizeof(struct bio), "sizeof(struct bio)");
+
+/*
+ * Example of a variable integer value. Notice that the control
+ * flags are CTLFLAG_RW, the variable pointer is set, and the
+ * value is 0.
+ */
+static int doingcache = 1; /* 1 => enable the cache */
+SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0,
+ "Enable name cache");
+
+/*
+ * Example of a variable string value. Notice that the control
+ * flags are CTLFLAG_RW, that the variable pointer and string
+ * size are set. Unlike newer sysctls, this older sysctl uses a
+ * static oid number.
+ */
+char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
+ kernelname, sizeof(kernelname), "Name of kernel file booted");
+
+/*
+ * Example of an opaque data type exported by sysctl. Notice that
+ * the variable pointer and size are provided, as well as a format
+ * string for sysctl(8).
+ */
+static l_fp pps_freq; /* scaled frequence offset (ns/s) */
+SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD,
+ &pps_freq, sizeof(pps_freq), "I", "");
+
+/*
+ * Example of a procedure based sysctl exporting string
+ * information. Notice that the data type is declared, the NULL
+ * variable pointer and 0 size, the function pointer, and the
+ * format string for sysctl(8).
+ */
+SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING |
+ CTLFLAG_RW, NULL, 0, sysctl_kern_timecounter_hardware, "A",
+ "");
+.Ed
+.Sh SYSCTL NAMING
+When adding, modifying, or removing sysctl names, it is important to be
+aware that these interfaces may be used by users, libraries, applications,
+or documentation (such as published books), and are implicitly published application interfaces.
+As with other application interfaces, caution must be taken not to break
+existing applications, and to think about future use of new name spaces so as
+to avoid the need to rename or remove interfaces that might be depended on in
+the future.
+.Pp
+The semantics chosen for a new sysctl should be as clear as possible,
+and the name of the sysctl must closely reflect its semantics.
+Therefore the sysctl name deserves a fair amount of consideration.
+It should be short but yet representative of the sysctl meaning.
+If the name consists of several words, they should be separated by
+underscore characters, as in
+.Va compute_summary_at_mount .
+Underscore characters may be omitted only if the name consists of not more
+than two words, each being not longer than four characters, as in
+.Va bootfile .
+For boolean sysctls, negative logic should be totally avoided.
+That is, do not use names like
+.Va no_foobar
+or
+.Va foobar_disable .
+They are confusing and lead to configuration errors.
+Use positive logic instead:
+.Va foobar ,
+.Va foobar_enable .
+.Pp
+A temporary sysctl node that should not be relied upon must be designated
+as such by a leading underscore character in its name. For example:
+.Va _dirty_hack .
+.Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr sysctl 8 ,
+.Xr sysctl_add_oid 9 ,
+.Xr sysctl_ctx_free 9 ,
+.Xr sysctl_ctx_init 9 ,
+.Xr sysctl_remove_oid 9
+.Sh HISTORY
+The
+.Xr sysctl 8
+utility first appeared in
+.Bx 4.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm sysctl
+implementation originally found in
+.Bx
+has been extensively rewritten by
+.An Poul-Henning Kamp
+in order to add support for name lookups, name space iteration, and dynamic
+addition of MIB nodes.
+.Pp
+This man page was written by
+.An Robert N. M. Watson .
diff --git a/share/man/man9/sysctl_add_oid.9 b/share/man/man9/sysctl_add_oid.9
new file mode 100644
index 000000000000..74e76d7f5be5
--- /dev/null
+++ b/share/man/man9/sysctl_add_oid.9
@@ -0,0 +1,530 @@
+.\"
+.\" Copyright (c) 2000, Andrzej Bialecki <abial@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 15, 2000
+.Dt SYSCTL_ADD_OID 9
+.Os
+.Sh NAME
+.Nm sysctl_add_oid ,
+.Nm sysctl_move_oid ,
+.Nm sysctl_remove_oid
+.Nd runtime sysctl tree manipulation
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sysctl.h
+.Ft struct sysctl_oid *
+.Fo sysctl_add_oid
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int kind"
+.Fa "void *arg1"
+.Fa "int arg2"
+.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
+.Fa "const char *format"
+.Fa "const char *descr"
+.Fc
+.Ft int
+.Fo sysctl_move_oid
+.Fa "struct sysctl_oid *oidp"
+.Fa "struct sysctl_oid_list *parent"
+.Fc
+.Ft int
+.Fo sysctl_remove_oid
+.Fa "struct sysctl_oid *oidp"
+.Fa "int del"
+.Fa "int recurse"
+.Fc
+.Ft struct sysctl_oid_list *
+.Fo SYSCTL_CHILDREN
+.Fa "struct sysctl_oid *oidp"
+.Fc
+.Ft struct sysctl_oid_list *
+.Fo SYSCTL_STATIC_CHILDREN
+.Fa "struct sysctl_oid_list OID_NAME"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_OID
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int kind"
+.Fa "void *arg1"
+.Fa "int arg2"
+.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
+.Fa "const char *format"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_NODE
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_STRING
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "char *arg"
+.Fa "int len"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_INT
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "int *arg"
+.Fa "int len"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_UINT
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "unsigned int *arg"
+.Fa "int len"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_LONG
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "long *arg"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_ULONG
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "unsigned long *arg"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_QUAD
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "int64_t *arg"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_OPAQUE
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "void *arg"
+.Fa "int len"
+.Fa "const char *format"
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_STRUCT
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "void *arg"
+.Fa STRUCT_NAME
+.Fa "const char *descr"
+.Fc
+.Ft struct sysctl_oid *
+.Fo SYSCTL_ADD_PROC
+.Fa "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *parent"
+.Fa "int number"
+.Fa "const char *name"
+.Fa "int access"
+.Fa "void *arg1"
+.Fa "int arg2"
+.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)"
+.Fa "const char *format"
+.Fa "const char *descr"
+.Fc
+.Sh DESCRIPTION
+These functions and macros provide an interface
+for creating and deleting sysctl oids at runtime
+(e.g.\& during lifetime of a module).
+The alternative method,
+based on linker sets (see
+.In sys/linker_set.h
+and
+.\" XXX Manual pages should avoid referencing source files
+.Pa src/sys/kern/kern_sysctl.c
+for details), only allows creation and deletion
+on module load and unload respectively.
+.Pp
+Dynamic oids of type
+.Dv CTLTYPE_NODE
+are reusable
+so that several code sections can create and delete them,
+but in reality they are allocated and freed
+based on their reference count.
+As a consequence,
+it is possible for two or more code sections
+to create partially overlapping trees that they both can use.
+It is not possible to create overlapping leaves,
+nor to create different child types with the same name and parent.
+.Pp
+Newly created oids are connected to their parent nodes.
+In all these functions and macros
+(with the exception of
+.Fn sysctl_remove_oid ) ,
+one of the required parameters is
+.Fa parent ,
+which points to the head of the parent's list of children.
+.Pp
+Most top level categories are created statically.
+When connecting to existing static oids,
+this pointer can be obtained with the
+.Fn SYSCTL_STATIC_CHILDREN
+macro, where the
+.Fa OID_NAME
+argument is name of the parent oid of type
+.Dv CTLTYPE_NODE
+(i.e., the name displayed by
+.Xr sysctl 8 ,
+preceded by underscore, and with all dots replaced with underscores).
+.Pp
+When connecting to an existing dynamic oid, this pointer
+can be obtained with the
+.Fn SYSCTL_CHILDREN
+macro, where the
+.Fa oidp
+argument points to the parent oid of type
+.Dv CTLTYPE_NODE .
+.Pp
+The
+.Fn sysctl_add_oid
+function creates raw oids of any type.
+If the oid is successfully created,
+the function returns a pointer to it;
+otherwise it returns
+.Dv NULL .
+Many of the arguments for
+.Fn sysctl_add_oid
+are common to the macros.
+The arguments are as follows:
+.Bl -tag -width handler
+.It Fa ctx
+A pointer to an optional sysctl context, or
+.Dv NULL .
+See
+.Xr sysctl_ctx_init 9
+for details.
+Programmers are strongly advised to use contexts
+to organize the dynamic oids which they create,
+unless special creation and deletion sequences are required.
+If
+.Fa ctx
+is not
+.Dv NULL ,
+the newly created oid will be added to this context
+as its first entry.
+.It Fa parent
+A pointer to a
+.Li struct sysctl_oid_list ,
+which is the head of the parent's list of children.
+.It Fa number
+The oid number that will be assigned to this oid.
+In almost all cases this should be set to
+.Dv OID_AUTO ,
+which will result in the assignment of the next available oid number.
+.It Fa name
+The name of the oid.
+The newly created oid will contain a copy of the name.
+.It Fa kind
+The kind of oid,
+specified as a bit mask of the type and access values defined in the
+.In sys/sysctl.h
+header file.
+Oids created dynamically always have the
+.Dv CTLFLAG_DYN
+flag set.
+Access flags specify whether this oid is read-only or read-write,
+and whether it may be modified by all users
+or by the superuser only.
+.It Fa arg1
+A pointer to any data that the oid should reference, or
+.Dv NULL .
+.It Fa arg2
+The size of
+.Fa arg1 ,
+or 0 if
+.Fa arg1
+is
+.Dv NULL .
+.It Fa handler
+A pointer to the function
+that is responsible for handling read and write requests
+to this oid.
+There are several standard handlers
+that support operations on nodes,
+integers, strings and opaque objects.
+It is possible also to define new handlers using the
+.Fn SYSCTL_ADD_PROC
+macro.
+.It Fa format
+A pointer to a string
+which specifies the format of the oid symbolically.
+This format is used as a hint by
+.Xr sysctl 8
+to apply proper data formatting for display purposes.
+Currently used format names are:
+.Dq N
+for node,
+.Dq A
+for
+.Li "char *" ,
+.Dq I
+for
+.Li "int" ,
+.Dq IU
+for
+.Li "unsigned int" ,
+.Dq L
+for
+.Li "long" ,
+.Dq LU
+for
+.Li "unsigned long"
+and
+.Dq S,TYPE
+for
+.Li "struct TYPE"
+structures.
+.It Fa descr
+A pointer to a textual description of the oid.
+.El
+.Pp
+The
+.Fn sysctl_move_oid
+function reparents an existing oid.
+The oid is assigned a new number as if it had been created with
+.Fa number
+set to
+.Dv OID_AUTO .
+.Pp
+The
+.Fn sysctl_remove_oid
+function removes a dynamically created oid from the tree,
+optionally freeing its resources.
+It takes the following arguments:
+.Bl -tag -width recurse
+.It Fa oidp
+A pointer to the dynamic oid to be removed.
+If the oid is not dynamic, or the pointer is
+.Dv NULL ,
+the function returns
+.Er EINVAL .
+.It Fa del
+If non-zero,
+.Fn sysctl_remove_oid
+will try to free the oid's resources
+when the reference count of the oid becomes zero.
+However, if
+.Fa del
+is set to 0,
+the routine will only deregister the oid from the tree,
+without freeing its resources.
+This behaviour is useful when the caller expects to rollback
+(possibly partially failed)
+deletion of many oids later.
+.It Fa recurse
+If non-zero, attempt to remove the node and all its children.
+If
+.Pa recurse
+is set to 0,
+any attempt to remove a node that contains any children
+will result in a
+.Er ENOTEMPTY
+error.
+.Em WARNING : "use recursive deletion with extreme caution" !
+Normally it should not be needed if contexts are used.
+Contexts take care of tracking inter-dependencies
+between users of the tree.
+However, in some extreme cases it might be necessary
+to remove part of the subtree no matter how it was created,
+in order to free some other resources.
+Be aware, though, that this may result in a system
+.Xr panic 9
+if other code sections continue to use removed subtrees.
+.El
+.Pp
+.\" XXX sheldonh finished up to here
+Again, in most cases the programmer should use contexts,
+as described in
+.Xr sysctl_ctx_init 9 ,
+to keep track of created oids,
+and to delete them later in orderly fashion.
+.Pp
+There is a set of macros defined
+that helps to create oids of given type.
+They are as follows:
+.Bl -tag -width SYSCTL_ADD_STRINGXX
+.It Fn SYSCTL_ADD_OID
+creates a raw oid.
+This macro is functionally equivalent to the
+.Fn sysctl_add_oid
+function.
+.It Fn SYSCTL_ADD_NODE
+creates an oid of type
+.Dv CTLTYPE_NODE ,
+to which child oids may be added.
+.It Fn SYSCTL_ADD_STRING
+creates an oid that handles a zero-terminated character string.
+.It Fn SYSCTL_ADD_INT
+creates an oid that handles an
+.Li int
+variable.
+.It Fn SYSCTL_ADD_UINT
+creates an oid that handles an
+.Li unsigned int
+variable.
+.It Fn SYSCTL_ADD_LONG
+creates an oid that handles a
+.Li long
+variable.
+.It Fn SYSCTL_ADD_ULONG
+creates an oid that handles an
+.Li unsigned long
+variable.
+.It Fn SYSCTL_ADD_QUAD
+creates an oid that handles an
+.Li int64_t
+variable.
+.It Fn SYSCTL_ADD_OPAQUE
+creates an oid that handles any chunk of opaque data
+of the size specified by the
+.Fa len
+argument,
+which is a pointer to a
+.Li "size_t *" .
+.It Fn SYSCTL_ADD_STRUCT
+creates an oid that handles a
+.Li "struct TYPE"
+structure.
+The
+.Fa format
+parameter will be set to
+.Dq S,TYPE
+to provide proper hints to the
+.Xr sysctl 8
+utility.
+.It Fn SYSCTL_ADD_PROC
+creates an oid with the specified
+.Pa handler
+function.
+The handler is responsible for handling read and write requests
+to the oid.
+This oid type is especially useful
+if the kernel data is not easily accessible,
+or needs to be processed before exporting.
+.El
+.Sh EXAMPLES
+The following is an example of
+how to create a new top-level category
+and how to hook up another subtree to an existing static node.
+This example does not use contexts,
+which results in tedious management of all intermediate oids,
+as they need to be freed later on:
+.Bd -literal
+#include <sys/sysctl.h>
+ ...
+/* Need to preserve pointers to newly created subtrees, to be able
+ * to free them later.
+ */
+struct sysctl_oid *root1, *root2, *oidp;
+int a_int;
+char *string = "dynamic sysctl";
+ ...
+
+root1 = SYSCTL_ADD_NODE( NULL, SYSCTL_STATIC_CHILDREN(/* tree top */),
+ OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree");
+oidp = SYSCTL_ADD_INT( NULL, SYSCTL_CHILDREN(root1),
+ OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf");
+ ...
+root2 = SYSCTL_ADD_NODE( NULL, SYSCTL_STATIC_CHILDREN(_debug),
+ OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug");
+oidp = SYSCTL_ADD_STRING( NULL, SYSCTL_CHILDREN(root2),
+ OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf");
+.Ed
+.Pp
+This example creates the following subtrees:
+.Bd -literal -offset indent
+debug.newtree.newstring
+newtree.newint
+.Ed
+.Pp
+.Em "Care should be taken to free all oids once they are no longer needed!"
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr sysctl 9 ,
+.Xr sysctl_ctx_free 9 ,
+.Xr sysctl_ctx_init 9
+.Sh HISTORY
+These functions first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+.An Andrzej Bialecki Aq abial@FreeBSD.org
+.Sh BUGS
+Sharing nodes between many code sections
+causes interdependencies that sometimes may lock the resources.
+For example,
+if module A hooks up a subtree to an oid created by module B,
+module B will be unable to delete that oid.
+These issues are handled properly by sysctl contexts.
+.Pp
+Many operations on the tree involve traversing linked lists.
+For this reason, oid creation and removal is relatively costly.
diff --git a/share/man/man9/sysctl_ctx_init.9 b/share/man/man9/sysctl_ctx_init.9
new file mode 100644
index 000000000000..cbca5c619327
--- /dev/null
+++ b/share/man/man9/sysctl_ctx_init.9
@@ -0,0 +1,247 @@
+.\"
+.\" Copyright (c) 2000, Andrzej Bialecki <abial@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 15, 2000
+.Dt SYSCTL_CTX_INIT 9
+.Os
+.Sh NAME
+.Nm sysctl_ctx_init ,
+.Nm sysctl_ctx_free ,
+.Nm sysctl_ctx_entry_add ,
+.Nm sysctl_ctx_entry_find ,
+.Nm sysctl_ctx_entry_del
+.Nd "sysctl context for managing dynamically created sysctl oids"
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sysctl.h
+.Ft int
+.Fo sysctl_ctx_init
+.Fa "struct sysctl_ctx_list *clist"
+.Fc
+.Ft int
+.Fo sysctl_ctx_free
+.Fa "struct sysctl_ctx_list *clist"
+.Fc
+.Ft struct sysctl_ctx_entry *
+.Fo sysctl_ctx_entry_add
+.Fa "struct sysctl_ctx_list *clist"
+.Fa "struct sysctl_oid *oidp"
+.Fc
+.Ft struct sysctl_ctx_entry *
+.Fo sysctl_ctx_entry_find
+.Fa "struct sysctl_ctx_list *clist"
+.Fa "struct sysctl_oid *oidp"
+.Fc
+.Ft int
+.Fo sysctl_ctx_entry_del
+.Fa "struct sysctl_ctx_list *clist"
+.Fa "struct sysctl_oid *oidp"
+.Fc
+.Sh DESCRIPTION
+These functions provide an interface
+for managing dynamically created oids.
+The sysctl context is responsible for keeping track of created oids,
+as well as their proper removal when needed.
+It adds a simple transactional aspect to oid removal operations;
+i.e., if a removal operation fails part way,
+it is possible to roll back the sysctl tree
+to its previous state.
+.Pp
+The
+.Fn sysctl_ctx_init
+function initializes a sysctl context.
+The
+.Fa clist
+argument must point to an already allocated variable.
+A context
+.Em must
+be initialized before use.
+Once it is initialized,
+a pointer to the context can be passed as an argument to all the
+.Fa SYSCTL_ADD_*
+macros (see
+.Xr sysctl_add_oid 9 ) ,
+and it will be updated with entries pointing to newly created oids.
+.Pp
+Internally, the context is represented as a
+.Xr queue 3
+TAILQ linked list.
+The list consists of
+.Li struct sysctl_ctx_entry
+entries:
+.Bd -literal -offset indent
+struct sysctl_ctx_entry {
+ struct sysctl_oid *entry;
+ TAILQ_ENTRY(sysctl_ctx_entry) link;
+};
+
+TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
+.Ed
+.Pp
+Each context entry points to one dynamic oid that it manages.
+Newly created oids are always inserted in the front of the list.
+.Pp
+The
+.Fn sysctl_ctx_free
+function removes the context and associated oids it manages.
+If the function completes successfully,
+all managed oids have been unregistered
+(removed from the tree)
+and freed,
+together with all their allocated memory,
+and the entries of the context have been freed as well.
+.Pp
+The removal operation is performed in two steps.
+First, for each context entry, the function
+.Xr sysctl_remove_oid 9
+is executed, with parameter
+.Fa del
+set to 0, which inhibits the freeing of resources.
+If there are no errors during this step,
+.Fn sysctl_ctx_free
+proceeds to the next step.
+If the first step fails,
+all unregistered oids associated with the context are registered again.
+.Pp
+.Em Note :
+in most cases, the programmer specifies
+.Dv OID_AUTO
+as the oid number when creating an oid.
+However, during registration of the oid in the tree,
+this number is changed to the first available number
+greater than or equal to
+.Dv CTL_AUTO_START .
+If the first step of context deletion fails,
+re-registration of the oid does not change the already assigned oid number
+(which is different from OID_AUTO).
+This ensures that re-registered entries
+maintain their original positions in the tree.
+.Pp
+The second step actually performs the deletion of the dynamic oids.
+.Xr sysctl_remove_oid 9
+iterates through the context list,
+starting from beginning (i.e., the newest entries).
+.Em Important :
+this time, the function not only deletes the oids from the tree,
+but also frees their memory (provided that oid_refcnt == 0),
+as well as the memory of all context entries.
+.Pp
+The
+.Fn sysctl_ctx_entry_add
+function allows the addition of an existing dynamic oid to a context.
+.Pp
+The
+.Fn sysctl_ctx_entry_del
+function removes an entry from the context.
+.Em Important :
+in this case, only the corresponding
+.Li struct sysctl_ctx_entry
+is freed, but the
+.Fa oidp
+pointer remains intact.
+Thereafter, the programmer is responsible for managing the resources
+allocated to this oid.
+.Pp
+The
+.Fn sysctl_ctx_entry_find
+function searches for a given
+.Fa oidp
+within a context list,
+either returning a pointer to the
+.Fa struct sysctl_ctx_entry
+found,
+or
+.Dv NULL .
+.Sh EXAMPLES
+The following is an example of how to create a new top-level category
+and how to hook up another subtree to an existing static node.
+This example uses contexts to keep track of the oids.
+.Bd -literal
+#include <sys/sysctl.h>
+ ...
+struct sysctl_ctx_list clist;
+struct sysctl_oid *oidp;
+int a_int;
+const char *string = "dynamic sysctl";
+ ...
+
+sysctl_ctx_init(&clist);
+oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(/* tree top */),
+ OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree");
+oidp = SYSCTL_ADD_INT(&clist, SYSCTL_CHILDREN(oidp),
+ OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf");
+ ...
+oidp = SYSCTL_ADD_NODE(&clist, SYSCTL_STATIC_CHILDREN(_debug),
+ OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug");
+oidp = SYSCTL_ADD_STRING(&clist, SYSCTL_CHILDREN(oidp),
+ OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf");
+ ...
+/* Now we can free up the oids */
+if (sysctl_ctx_free(&clist)) {
+ printf("can't free this context - other oids depend on it");
+ return (ENOTEMPTY);
+} else {
+ printf("Success!\\n");
+ return (0);
+}
+.Ed
+.Pp
+This example creates the following subtrees:
+.Bd -literal -offset indent
+debug.newtree.newstring
+newtree.newint
+.Ed
+.Pp
+Note that both trees are removed, and their resources freed,
+through one
+.Fn sysctl_ctx_free
+call, which starts by freeing the newest entries (leaves)
+and then proceeds to free the older entries (in this case the nodes).
+.Sh SEE ALSO
+.Xr queue 3 ,
+.Xr sysctl 8 ,
+.Xr sysctl 9 ,
+.Xr sysctl_add_oid 9 ,
+.Xr sysctl_remove_oid 9
+.Sh HISTORY
+These functions first appeared in
+.Fx 4.2 .
+.Sh AUTHORS
+.An Andrzej Bialecki Aq abial@FreeBSD.org
+.Sh BUGS
+The current removal algorithm is somewhat heavy.
+In the worst case,
+all oids need to be unregistered, registered again,
+and then unregistered and deleted.
+However, the algorithm does guarantee transactional properties
+for removal operations.
+.Pp
+All operations on contexts involve linked list traversal.
+For this reason,
+creation and removal of entries is relatively costly.
diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9
new file mode 100644
index 000000000000..319aa2f23bfe
--- /dev/null
+++ b/share/man/man9/taskqueue.9
@@ -0,0 +1,382 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 26, 2011
+.Dt TASKQUEUE 9
+.Os
+.Sh NAME
+.Nm taskqueue
+.Nd asynchronous task execution
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/kernel.h
+.In sys/malloc.h
+.In sys/queue.h
+.In sys/taskqueue.h
+.Bd -literal
+typedef void (*task_fn_t)(void *context, int pending);
+
+typedef void (*taskqueue_enqueue_fn)(void *context);
+
+struct task {
+ STAILQ_ENTRY(task) ta_link; /* link for queue */
+ u_short ta_pending; /* count times queued */
+ u_short ta_priority; /* priority of task in queue */
+ task_fn_t ta_func; /* task handler */
+ void *ta_context; /* argument for handler */
+};
+
+struct timeout_task;
+.Ed
+.Ft struct taskqueue *
+.Fn taskqueue_create "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
+.Ft struct taskqueue *
+.Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
+.Ft void
+.Fn taskqueue_free "struct taskqueue *queue"
+.Ft int
+.Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
+.Ft int
+.Fn taskqueue_enqueue_fast "struct taskqueue *queue" "struct task *task"
+.Ft int
+.Fn taskqueue_enqueue_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" "int ticks"
+.Ft int
+.Fn taskqueue_cancel "struct taskqueue *queue" "struct task *task" "u_int *pendp"
+.Ft int
+.Fn taskqueue_cancel_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" "u_int *pendp"
+.Ft void
+.Fn taskqueue_drain "struct taskqueue *queue" "struct task *task"
+.Ft void
+.Fn taskqueue_drain_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task"
+.Ft int
+.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td"
+.Ft void
+.Fn taskqueue_run "struct taskqueue *queue"
+.Fn TASK_INIT "struct task *task" "int priority" "task_fn_t func" "void *context"
+.Fn TASK_INITIALIZER "int priority" "task_fn_t func" "void *context"
+.Fn TASKQUEUE_DECLARE "name"
+.Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init"
+.Fn TASKQUEUE_FAST_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init"
+.Fn TASKQUEUE_DEFINE_THREAD "name"
+.Fn TASKQUEUE_FAST_DEFINE_THREAD "name"
+.Fn TIMEOUT_TASK_INIT "struct taskqueue *queue" "struct timeout_task *timeout_task" "int priority" "task_fn_t func" "void *context"
+.Sh DESCRIPTION
+These functions provide a simple interface for asynchronous execution
+of code.
+.Pp
+The function
+.Fn taskqueue_create
+is used to create new queues.
+The arguments to
+.Fn taskqueue_create
+include a name that should be unique,
+a set of
+.Xr malloc 9
+flags that specify whether the call to
+.Fn malloc
+is allowed to sleep,
+a function that is called from
+.Fn taskqueue_enqueue
+when a task is added to the queue,
+and a pointer to the memory location where the identity of the
+thread that services the queue is recorded.
+.\" XXX The rest of the sentence gets lots in relation to the first part.
+The function called from
+.Fn taskqueue_enqueue
+must arrange for the queue to be processed
+(for instance by scheduling a software interrupt or waking a kernel
+thread).
+The memory location where the thread identity is recorded is used
+to signal the service thread(s) to terminate--when this value is set to
+zero and the thread is signaled it will terminate.
+If the queue is intended for use in fast interrupt handlers
+.Fn taskqueue_create_fast
+should be used in place of
+.Fn taskqueue_create .
+.Pp
+The function
+.Fn taskqueue_free
+should be used to free the memory used by the queue.
+Any tasks that are on the queue will be executed at this time after
+which the thread servicing the queue will be signaled that it should exit.
+.Pp
+To add a task to the list of tasks queued on a taskqueue, call
+.Fn taskqueue_enqueue
+with pointers to the queue and task.
+If the task's
+.Va ta_pending
+field is non-zero,
+then it is simply incremented to reflect the number of times the task
+was enqueued, up to a cap of USHRT_MAX.
+Otherwise,
+the task is added to the list before the first task which has a lower
+.Va ta_priority
+value or at the end of the list if no tasks have a lower priority.
+Enqueueing a task does not perform any memory allocation which makes
+it suitable for calling from an interrupt handler.
+This function will return
+.Er EPIPE
+if the queue is being freed.
+.Pp
+The function
+.Fn taskqueue_enqueue_fast
+should be used in place of
+.Fn taskqueue_enqueue
+when the enqueuing must happen from a fast interrupt handler.
+This method uses spin locks to avoid the possibility of sleeping in the fast
+interrupt context.
+.Pp
+When a task is executed,
+first it is removed from the queue,
+the value of
+.Va ta_pending
+is recorded and then the field is zeroed.
+The function
+.Va ta_func
+from the task structure is called with the value of the field
+.Va ta_context
+as its first argument
+and the value of
+.Va ta_pending
+as its second argument.
+After the function
+.Va ta_func
+returns,
+.Xr wakeup 9
+is called on the task pointer passed to
+.Fn taskqueue_enqueue .
+.Pp
+The
+.Fn taskqueue_enqueue_timeout
+is used to schedule the enqueue after the specified amount of
+.Va ticks .
+Only non-fast task queues can be used for
+.Va timeout_task
+scheduling.
+.Pp
+The
+.Fn taskqueue_cancel
+function is used to cancel a task.
+The
+.Va ta_pending
+count is cleared, and the old value returned in the reference
+parameter
+.Fa pendp ,
+if it is non-
+.Dv NULL .
+If the task is currently running,
+.Dv EBUSY
+is returned, otherwise 0.
+To implement a blocking
+.Fn taskqueue_cancel
+that waits for a running task to finish, it could look like:
+.Bd -literal -offset indent
+while (taskqueue_cancel(tq, task, NULL) != 0)
+ taskqueue_drain(tq, task);
+.Ed
+.Pp
+Note that, as with
+.Fn taskqueue_drain ,
+the caller is responsible for ensuring that the task is not re-enqueued
+after being canceled.
+.Pp
+Similarly, the
+.Fn taskqueue_cancel_timeout
+function is used to cancel the scheduled task execution.
+.Pp
+The
+.Fn taskqueue_drain
+function is used to wait for the task to finish, and
+the
+.Fn taskqueue_drain_timeout
+function is used to wait for the scheduled task to finish.
+There is no guarantee that the task will not be
+enqueued after call to
+.Fn taskqueue_drain .
+.Pp
+The
+.Fn taskqueue_member
+function returns
+.No 1
+if the given thread
+.Fa td
+is part of the given taskqueue
+.Fa queue
+and
+.No 0
+otherwise.
+.Pp
+The
+.Fn taskqueue_run
+function will run all pending tasks in the specified
+.Fa queue .
+Normally this function is only used internally.
+.Pp
+A convenience macro,
+.Fn TASK_INIT "task" "priority" "func" "context"
+is provided to initialise a
+.Va task
+structure.
+The
+.Fn TASK_INITIALIZER
+macro generates an initializer for a task structure.
+A macro
+.Fn TIMEOUT_TASK_INIT "queue" "timeout_task" "priority" "func" "context"
+initializes the
+.Va timeout_task
+structure.
+The values of
+.Va priority ,
+.Va func ,
+and
+.Va context
+are simply copied into the task structure fields and the
+.Va ta_pending
+field is cleared.
+.Pp
+Five macros
+.Fn TASKQUEUE_DECLARE "name" ,
+.Fn TASKQUEUE_DEFINE "name" "enqueue" "context" "init" ,
+.Fn TASKQUEUE_FAST_DEFINE "name" "enqueue" "context" "init" ,
+and
+.Fn TASKQUEUE_DEFINE_THREAD "name"
+.Fn TASKQUEUE_FAST_DEFINE_THREAD "name"
+are used to declare a reference to a global queue, to define the
+implementation of the queue, and declare a queue that uses its own thread.
+The
+.Fn TASKQUEUE_DEFINE
+macro arranges to call
+.Fn taskqueue_create
+with the values of its
+.Va name ,
+.Va enqueue
+and
+.Va context
+arguments during system initialisation.
+After calling
+.Fn taskqueue_create ,
+the
+.Va init
+argument to the macro is executed as a C statement,
+allowing any further initialisation to be performed
+(such as registering an interrupt handler etc.)
+.Pp
+The
+.Fn TASKQUEUE_DEFINE_THREAD
+macro defines a new taskqueue with its own kernel thread to serve tasks.
+The variable
+.Vt struct taskqueue *taskqueue_name
+is used to enqueue tasks onto the queue.
+.Pp
+.Fn TASKQUEUE_FAST_DEFINE
+and
+.Fn TASKQUEUE_FAST_DEFINE_THREAD
+act just like
+.Fn TASKQUEUE_DEFINE
+and
+.Fn TASKQUEUE_DEFINE_THREAD
+respectively but taskqueue is created with
+.Fn taskqueue_create_fast .
+.Ss Predefined Task Queues
+The system provides four global taskqueues,
+.Va taskqueue_fast ,
+.Va taskqueue_swi ,
+.Va taskqueue_swi_giant ,
+and
+.Va taskqueue_thread .
+The
+.Va taskqueue_fast
+queue is for swi handlers dispatched from fast interrupt handlers,
+where sleep mutexes cannot be used.
+The swi taskqueues are run via a software interrupt mechanism.
+The
+.Va taskqueue_swi
+queue runs without the protection of the
+.Va Giant
+kernel lock, and the
+.Va taskqueue_swi_giant
+queue runs with the protection of the
+.Va Giant
+kernel lock.
+The thread taskqueue
+.Va taskqueue_thread
+runs in a kernel thread context, and tasks run from this thread do
+not run under the
+.Va Giant
+kernel lock.
+If the caller wants to run under
+.Va Giant ,
+he should explicitly acquire and release
+.Va Giant
+in his taskqueue handler routine.
+.Pp
+To use these queues,
+call
+.Fn taskqueue_enqueue
+with the value of the global taskqueue variable for the queue you wish to
+use
+.Va ( taskqueue_swi ,
+.Va taskqueue_swi_giant ,
+or
+.Va taskqueue_thread ) .
+Use
+.Fn taskqueue_enqueue_fast
+for the global taskqueue variable
+.Va taskqueue_fast .
+.Pp
+The software interrupt queues can be used,
+for instance, for implementing interrupt handlers which must perform a
+significant amount of processing in the handler.
+The hardware interrupt handler would perform minimal processing of the
+interrupt and then enqueue a task to finish the work.
+This reduces to a minimum
+the amount of time spent with interrupts disabled.
+.Pp
+The thread queue can be used, for instance, by interrupt level routines
+that need to call kernel functions that do things that can only be done
+from a thread context.
+(e.g., call malloc with the M_WAITOK flag.)
+.Pp
+Note that tasks queued on shared taskqueues such as
+.Va taskqueue_swi
+may be delayed an indeterminate amount of time before execution.
+If queueing delays cannot be tolerated then a private taskqueue should
+be created with a dedicated processing thread.
+.Sh SEE ALSO
+.Xr ithread 9 ,
+.Xr kthread 9 ,
+.Xr swi 9
+.Sh HISTORY
+This interface first appeared in
+.Fx 5.0 .
+There is a similar facility called work_queue in the Linux kernel.
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/thread_exit.9 b/share/man/man9/thread_exit.9
new file mode 100644
index 000000000000..6a06433acebd
--- /dev/null
+++ b/share/man/man9/thread_exit.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (c) 2002 Julian Elischer
+.\" All rights reserved.
+.\"
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 5, 2002
+.Dt THREAD_EXIT 9
+.Os
+.Sh NAME
+.Nm thread_exit
+.Nd abandon current thread context
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft void
+.Fn thread_exit "void"
+.Sh DESCRIPTION
+The
+.Fn thread_exit
+function implements the machine independent prelude to a thread
+shutdown.
+It will not return, and will result in a call to
+.Xr mi_switch 9
+to schedule some other thread.
+.Pp
+.Fn thread_exit
+arranges to free all the resources of the thread, specifically the kernel
+stack.
+.Pp
+To protect the
+.Xr runqueue 9 ,
+.Fn thread_exit
+must be called with the
+.Va sched_lock
+mutex held.
+.Sh SEE ALSO
+.Xr mi_switch 9 ,
+.Xr mutex 9 ,
+.Xr runqueue 9 ,
+.Xr sleep 9
diff --git a/share/man/man9/time.9 b/share/man/man9/time.9
new file mode 100644
index 000000000000..4a2b2f7240e1
--- /dev/null
+++ b/share/man/man9/time.9
@@ -0,0 +1,115 @@
+.\" $NetBSD: time.9,v 1.1 1995/11/25 21:24:53 perry Exp $
+.\"
+.\" Copyright (c) 1994 Christopher G. Demetriou
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christopher G. Demetriou
+.\" for the NetBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 17, 2004
+.Dt TIME 9
+.Os
+.Sh NAME
+.Nm boottime ,
+.Nm time_second ,
+.Nm time_uptime
+.Nd system time variables
+.Sh SYNOPSIS
+.In sys/time.h
+.Pp
+.Vt extern struct timeval boottime ;
+.Vt extern time_t time_second ;
+.Vt extern time_t time_uptime ;
+.Sh DESCRIPTION
+The
+.Va boottime
+variable holds the system boot time.
+.Pp
+The
+.Va time_second
+variable is the system's
+.Dq wall time
+clock to the second.
+.Pp
+The
+.Va time_uptime
+variable is the number of seconds since boot.
+.Pp
+The
+.Xr bintime 9 ,
+.Xr getbintime 9 ,
+.Xr microtime 9 ,
+.Xr getmicrotime 9 ,
+.Xr nanotime 9 ,
+and
+.Xr getnanotime 9
+functions can be used to get the current time more accurately and in an
+atomic manner.
+Similarly, the
+.Xr binuptime 9 ,
+.Xr getbinuptime 9 ,
+.Xr microuptime 9 ,
+.Xr getmicrouptime 9 ,
+.Xr nanouptime 9 ,
+and
+.Xr getnanouptime 9
+functions can be used to get the time elapse since boot more accurately
+and in an atomic manner.
+The
+.Va boottime
+variable may be read and written without special precautions.
+.Sh SEE ALSO
+.Xr clock_settime 2 ,
+.Xr ntp_adjtime 2 ,
+.Xr settimeofday 2 ,
+.Xr bintime 9 ,
+.Xr binuptime 9 ,
+.Xr getbintime 9 ,
+.Xr getbinuptime 9 ,
+.Xr getmicrotime 9 ,
+.Xr getmicrouptime 9 ,
+.Xr getnanotime 9 ,
+.Xr getnanouptime 9 ,
+.Xr microtime 9 ,
+.Xr microuptime 9 ,
+.Xr nanotime 9 ,
+.Xr nanouptime 9
+.Rs
+.%A "Poul-Henning Kamp"
+.%T "Timecounters: Efficient and precise timekeeping in SMP kernels"
+.%J "Proceedings of EuroBSDCon 2002, Amsterdam"
+.%O /usr/share/doc/papers/timecounter.ascii.gz
+.Re
+.Rs
+.%A "Marshall Kirk McKusick"
+.%A "George V. Neville-Neil"
+.%B "The Design and Implementation of the FreeBSD Operating System"
+.%D "July 2004"
+.%I "Addison-Wesley"
+.%P "57-61,65-66"
+.Re
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9
new file mode 100644
index 000000000000..ddc66b573cbd
--- /dev/null
+++ b/share/man/man9/timeout.9
@@ -0,0 +1,561 @@
+.\" $NetBSD: timeout.9,v 1.2 1996/06/23 22:32:34 pk Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 2, 2008
+.Dt TIMEOUT 9
+.Os
+.Sh NAME
+.Nm timeout ,
+.Nm untimeout ,
+.Nm callout_handle_init ,
+.Nm callout_init ,
+.Nm callout_init_mtx ,
+.Nm callout_init_rw ,
+.Nm callout_stop ,
+.Nm callout_drain ,
+.Nm callout_reset ,
+.Nm callout_schedule ,
+.Nm callout_pending ,
+.Nm callout_active ,
+.Nm callout_deactivate
+.Nd execute a function after a specified length of time
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/systm.h
+.Bd -literal
+typedef void timeout_t (void *);
+.Ed
+.Ft struct callout_handle
+.Fn timeout "timeout_t *func" "void *arg" "int ticks"
+.Ft void
+.Fn callout_handle_init "struct callout_handle *handle"
+.Bd -literal
+struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle)
+.Ed
+.Ft void
+.Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle"
+.Ft void
+.Fn callout_init "struct callout *c" "int mpsafe"
+.Ft void
+.Fn callout_init_mtx "struct callout *c" "struct mtx *mtx" "int flags"
+.Ft void
+.Fn callout_init_rw "struct callout *c" "struct rwlock *rw" "int flags"
+.Ft int
+.Fn callout_stop "struct callout *c"
+.Ft int
+.Fn callout_drain "struct callout *c"
+.Ft int
+.Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg"
+.Ft int
+.Fn callout_schedule "struct callout *c" "int ticks"
+.Ft int
+.Fn callout_pending "struct callout *c"
+.Ft int
+.Fn callout_active "struct callout *c"
+.Fn callout_deactivate "struct callout *c"
+.Sh DESCRIPTION
+The function
+.Fn timeout
+schedules a call to the function given by the argument
+.Fa func
+to take place after
+.Fa ticks Ns No /hz
+seconds.
+Non-positive values of
+.Fa ticks
+are silently converted to the value
+.Sq 1 .
+.Fa func
+should be a pointer to a function that takes a
+.Fa void *
+argument.
+Upon invocation,
+.Fa func
+will receive
+.Fa arg
+as its only argument.
+The return value from
+.Fn timeout
+is a
+.Ft struct callout_handle
+which can be used in conjunction with the
+.Fn untimeout
+function to request that a scheduled timeout be canceled.
+The
+.Fn timeout
+call is the old style and new code should use the
+.Fn callout_*
+functions.
+.Pp
+The function
+.Fn callout_handle_init
+can be used to initialize a handle to a state which will cause
+any calls to
+.Fn untimeout
+with that handle to return with no side
+effects.
+.Pp
+Assigning a callout handle the value of
+.Fn CALLOUT_HANDLE_INITIALIZER
+performs the same function as
+.Fn callout_handle_init
+and is provided for use on statically declared or global callout handles.
+.Pp
+The function
+.Fn untimeout
+cancels the timeout associated with
+.Fa handle
+using the
+.Fa func
+and
+.Fa arg
+arguments to validate the handle.
+If the handle does not correspond to a timeout with
+the function
+.Fa func
+taking the argument
+.Fa arg
+no action is taken.
+.Fa handle
+must be initialized by a previous call to
+.Fn timeout ,
+.Fn callout_handle_init ,
+or assigned the value of
+.Fn CALLOUT_HANDLE_INITIALIZER "&handle"
+before being passed to
+.Fn untimeout .
+The behavior of calling
+.Fn untimeout
+with an uninitialized handle
+is undefined.
+The
+.Fn untimeout
+call is the old style and new code should use the
+.Fn callout_*
+functions.
+.Pp
+As handles are recycled by the system, it is possible (although unlikely)
+that a handle from one invocation of
+.Fn timeout
+may match the handle of another invocation of
+.Fn timeout
+if both calls used the same function pointer and argument, and the first
+timeout is expired or canceled before the second call.
+The timeout facility offers O(1) running time for
+.Fn timeout
+and
+.Fn untimeout .
+Timeouts are executed from
+.Fn softclock
+with the
+.Va Giant
+lock held.
+Thus they are protected from re-entrancy.
+.Pp
+The functions
+.Fn callout_init ,
+.Fn callout_init_mtx ,
+.Fn callout_init_rw ,
+.Fn callout_stop ,
+.Fn callout_drain ,
+.Fn callout_reset
+and
+.Fn callout_schedule
+are low-level routines for clients who wish to allocate their own
+callout structures.
+.Pp
+The function
+.Fn callout_init
+initializes a callout so it can be passed to
+.Fn callout_stop ,
+.Fn callout_drain ,
+.Fn callout_reset
+or
+.Fn callout_schedule
+without any side effects.
+If the
+.Fa mpsafe
+argument is zero,
+the callout structure is not considered to be
+.Dq multi-processor safe ;
+that is,
+the Giant lock will be acquired before calling the callout function,
+and released when the callout function returns.
+.Pp
+The
+.Fn callout_init_mtx
+function may be used as an alternative to
+.Fn callout_init .
+The parameter
+.Fa mtx
+specifies a mutex that is to be acquired by the callout subsystem
+before calling the callout function, and released when the callout
+function returns.
+The following
+.Fa flags
+may be specified:
+.Bl -tag -width ".Dv CALLOUT_RETURNUNLOCKED"
+.It Dv CALLOUT_RETURNUNLOCKED
+The callout function will release
+.Fa mtx
+itself, so the callout subsystem should not attempt to unlock it
+after the callout function returns.
+.El
+.Pp
+The
+.Fn callout_init_rw
+function serves the need of using rwlocks in conjunction with callouts.
+The function does basically the same as
+.Fn callout_init_mtx
+with the possibility of specifying an extra
+.Fa rw
+argument.
+The usable lock classes are currently limited to mutexes and rwlocks,
+because callout handlers run in softclock swi, so they cannot sleep nor
+acquire sleepable locks like sx or lockmgr.
+The following
+.Fa flags
+may be specified:
+.Bl -tag -width ".Dv CALLOUT_SHAREDLOCK"
+.It Dv CALLOUT_SHAREDLOCK
+The lock is only acquired in read mode when running the callout handler.
+It has no effects when used in conjunction with
+.Fa mtx .
+.El
+.Pp
+The function
+.Fn callout_stop
+cancels a callout if it is currently pending.
+If the callout is pending, then
+.Fn callout_stop
+will return a non-zero value.
+If the callout is not set, has already been serviced or is currently
+being serviced, then zero will be returned.
+If the callout has an associated mutex, then that mutex must be
+held when this function is called.
+.Pp
+The function
+.Fn callout_drain
+is identical to
+.Fn callout_stop
+except that it will wait for the callout to be completed if it is
+already in progress.
+This function MUST NOT be called while holding any
+locks on which the callout might block, or deadlock will result.
+Note that if the callout subsystem has already begun processing this
+callout, then the callout function may be invoked during the execution of
+.Fn callout_drain .
+However, the callout subsystem does guarantee that the callout will be
+fully stopped before
+.Fn callout_drain
+returns.
+.Pp
+The function
+.Fn callout_reset
+first performs the equivalent of
+.Fn callout_stop
+to disestablish the callout, and then establishes a new callout in the
+same manner as
+.Fn timeout .
+If there was already a pending callout and it was rescheduled, then
+.Fn callout_reset
+will return a non-zero value.
+If the callout has an associated mutex, then that mutex must be
+held when this function is called.
+The function
+.Fn callout_schedule
+(re)schedules an existing callout for a new period of time;
+it is equivalent to calling
+.Fn callout_reset
+with the
+.Fa func
+and
+.Fa arg
+parameters extracted from the callout structure (though possibly with
+lower overhead).
+.Pp
+The macros
+.Fn callout_pending ,
+.Fn callout_active
+and
+.Fn callout_deactivate
+provide access to the current state of the callout.
+Careful use of these macros can avoid many of the race conditions
+that are inherent in asynchronous timer facilities; see
+.Sx "Avoiding Race Conditions"
+below for further details.
+The
+.Fn callout_pending
+macro checks whether a callout is
+.Em pending ;
+a callout is considered
+.Em pending
+when a timeout has been set but the time has not yet arrived.
+Note that once the timeout time arrives and the callout subsystem
+starts to process this callout,
+.Fn callout_pending
+will return
+.Dv FALSE
+even though the callout function may not have finished (or even begun)
+executing.
+The
+.Fn callout_active
+macro checks whether a callout is marked as
+.Em active ,
+and the
+.Fn callout_deactivate
+macro clears the callout's
+.Em active
+flag.
+The callout subsystem marks a callout as
+.Em active
+when a timeout is set and it clears the
+.Em active
+flag in
+.Fn callout_stop
+and
+.Fn callout_drain ,
+but it
+.Em does not
+clear it when a callout expires normally via the execution of the
+callout function.
+.Ss "Avoiding Race Conditions"
+The callout subsystem invokes callout functions from its own timer
+context.
+Without some kind of synchronization it is possible that a callout
+function will be invoked concurrently with an attempt to stop or reset
+the callout by another thread.
+In particular, since callout functions typically acquire a mutex as
+their first action, the callout function may have already been invoked,
+but be blocked waiting for that mutex at the time that another thread
+tries to reset or stop the callout.
+.Pp
+The callout subsystem provides a number of mechanisms to address these
+synchronization concerns:
+.Bl -enum -offset indent
+.It
+If the callout has an associated mutex that was specified using the
+.Fn callout_init_mtx
+function (or implicitly specified as the
+.Va Giant
+mutex using
+.Fn callout_init
+with
+.Fa mpsafe
+set to
+.Dv FALSE ) ,
+then this mutex is used to avoid the race conditions.
+The associated mutex must be acquired by the caller before calling
+.Fn callout_stop
+or
+.Fn callout_reset
+and it is guaranteed that the callout will be correctly stopped
+or reset as expected.
+Note that it is still necessary to use
+.Fn callout_drain
+before destroying the callout or its associated mutex.
+.It
+The return value from
+.Fn callout_stop
+and
+.Fn callout_reset
+indicates whether or not the callout was removed.
+If it is known that the callout was set and the callout function has
+not yet executed, then a return value of
+.Dv FALSE
+indicates that the callout function is about to be called.
+For example:
+.Bd -literal -offset indent
+if (sc->sc_flags & SCFLG_CALLOUT_RUNNING) {
+ if (callout_stop(&sc->sc_callout)) {
+ sc->sc_flags &= ~SCFLG_CALLOUT_RUNNING;
+ /* successfully stopped */
+ } else {
+ /*
+ * callout has expired and callout
+ * function is about to be executed
+ */
+ }
+}
+.Ed
+.It
+The
+.Fn callout_pending ,
+.Fn callout_active
+and
+.Fn callout_deactivate
+macros can be used together to work around the race conditions.
+When a callout's timeout is set, the callout subsystem marks the
+callout as both
+.Em active
+and
+.Em pending .
+When the timeout time arrives, the callout subsystem begins processing
+the callout by first clearing the
+.Em pending
+flag.
+It then invokes the callout function without changing the
+.Em active
+flag, and does not clear the
+.Em active
+flag even after the callout function returns.
+The mechanism described here requires the callout function itself to
+clear the
+.Em active
+flag using the
+.Fn callout_deactivate
+macro.
+The
+.Fn callout_stop
+and
+.Fn callout_drain
+functions always clear both the
+.Em active
+and
+.Em pending
+flags before returning.
+.Pp
+The callout function should first check the
+.Em pending
+flag and return without action if
+.Fn callout_pending
+returns
+.Dv TRUE .
+This indicates that the callout was rescheduled using
+.Fn callout_reset
+just before the callout function was invoked.
+If
+.Fn callout_active
+returns
+.Dv FALSE
+then the callout function should also return without action.
+This indicates that the callout has been stopped.
+Finally, the callout function should call
+.Fn callout_deactivate
+to clear the
+.Em active
+flag.
+For example:
+.Bd -literal -offset indent
+mtx_lock(&sc->sc_mtx);
+if (callout_pending(&sc->sc_callout)) {
+ /* callout was reset */
+ mtx_unlock(&sc->sc_mtx);
+ return;
+}
+if (!callout_active(&sc->sc_callout)) {
+ /* callout was stopped */
+ mtx_unlock(&sc->sc_mtx);
+ return;
+}
+callout_deactivate(&sc->sc_callout);
+/* rest of callout function */
+.Ed
+.Pp
+Together with appropriate synchronization, such as the mutex used above,
+this approach permits the
+.Fn callout_stop
+and
+.Fn callout_reset
+functions to be used at any time without races.
+For example:
+.Bd -literal -offset indent
+mtx_lock(&sc->sc_mtx);
+callout_stop(&sc->sc_callout);
+/* The callout is effectively stopped now. */
+.Ed
+.Pp
+If the callout is still pending then these functions operate normally,
+but if processing of the callout has already begun then the tests in
+the callout function cause it to return without further action.
+Synchronization between the callout function and other code ensures that
+stopping or resetting the callout will never be attempted while the
+callout function is past the
+.Fn callout_deactivate
+call.
+.Pp
+The above technique additionally ensures that the
+.Em active
+flag always reflects whether the callout is effectively enabled or
+disabled.
+If
+.Fn callout_active
+returns false, then the callout is effectively disabled, since even if
+the callout subsystem is actually just about to invoke the callout
+function, the callout function will return without action.
+.El
+.Pp
+There is one final race condition that must be considered when a
+callout is being stopped for the last time.
+In this case it may not be safe to let the callout function itself
+detect that the callout was stopped, since it may need to access
+data objects that have already been destroyed or recycled.
+To ensure that the callout is completely finished, a call to
+.Fn callout_drain
+should be used.
+.Sh RETURN VALUES
+The
+.Fn timeout
+function returns a
+.Ft struct callout_handle
+that can be passed to
+.Fn untimeout .
+The
+.Fn callout_stop
+and
+.Fn callout_drain
+functions return non-zero if the callout was still pending when it was
+called or zero otherwise.
+.Sh HISTORY
+The current timeout and untimeout routines are based on the work of
+.An Adam M. Costello
+and
+.An George Varghese ,
+published in a technical report entitled
+.%T "Redesigning the BSD Callout and Timer Facilities"
+and modified slightly for inclusion in
+.Fx
+by
+.An Justin T. Gibbs .
+The original work on the data structures used in this implementation
+was published by
+.An G. Varghese
+and
+.An A. Lauck
+in the paper
+.%T "Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient Implementation of a Timer Facility"
+in the
+.%B "Proceedings of the 11th ACM Annual Symposium on Operating Systems Principles" .
+The current implementation replaces the long standing
+.Bx
+linked list
+callout mechanism which offered O(n) insertion and removal running time
+but did not generate or require handles for untimeout operations.
diff --git a/share/man/man9/tvtohz.9 b/share/man/man9/tvtohz.9
new file mode 100644
index 000000000000..672aaf9dbbe7
--- /dev/null
+++ b/share/man/man9/tvtohz.9
@@ -0,0 +1,58 @@
+.\" Copyright (c) 2000 Kelly Yancey
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 3, 2000
+.Dt TVTOHZ 9
+.Os
+.Sh NAME
+.Nm tvtohz
+.Nd convert time interval to tick count
+.Sh SYNOPSIS
+.In sys/time.h
+.Ft int
+.Fn tvtohz "struct timeval *tv"
+.Sh DESCRIPTION
+The
+.Fn tvtohz
+function accepts a single argument
+.Fa tv
+which specifies the time interval over which to calculate the number
+of system ticks that would elapse.
+.Sh RETURN VALUES
+Returns the integral number of system ticks expected to elapse in the given
+interval, including the current tick.
+.Sh SEE ALSO
+.Xr microtime 9 ,
+.Xr microuptime 9 ,
+.Xr timeout 9
+.Sh HISTORY
+The
+.Nm
+function first appeared in
+.Fx 3.0
+.Sh AUTHORS
+This manual page was written by
+.An Kelly Yancey Aq kbyanc@posi.net .
diff --git a/share/man/man9/ucred.9 b/share/man/man9/ucred.9
new file mode 100644
index 000000000000..a44e0d77d78b
--- /dev/null
+++ b/share/man/man9/ucred.9
@@ -0,0 +1,236 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 19, 2009
+.Dt UCRED 9
+.Os
+.Sh NAME
+.Nm ucred ,
+.Nm crget ,
+.Nm crhold ,
+.Nm crfree ,
+.Nm crshared ,
+.Nm crcopy ,
+.Nm crdup ,
+.Nm cru2x ,
+.Nm cred_update_thread
+.Nd "functions related to user credentials"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/ucred.h
+.Ft "struct ucred *"
+.Fn crget void
+.Ft "struct ucred *"
+.Fn crhold "struct ucred *cr"
+.Ft void
+.Fn crfree "struct ucred *cr"
+.Ft int
+.Fn crshared "struct ucred *cr"
+.Ft void
+.Fn crcopy "struct ucred *dest" "struct ucred *src"
+.Ft "struct ucred *"
+.Fn crcopysafe "struct proc *p" "struct ucred *cr"
+.Ft "struct ucred *"
+.Fn crdup "struct ucred *cr"
+.Ft void
+.Fn crsetgroups "struct ucred *cr" "int ngrp" "gid_t *groups"
+.Ft void
+.Fn cru2x "struct ucred *cr" "struct xucred *xcr"
+.Ft void
+.Fn cred_update_thread "struct thread *td"
+.Sh DESCRIPTION
+The
+.Nm
+family of functions is used to manage user credential structures
+.Pq Vt "struct ucred"
+within the kernel.
+.Pp
+The
+.Fn crget
+function allocates memory
+for a new structure, sets its reference count to 1, and
+initializes its lock.
+.Pp
+The
+.Fn crhold
+function increases the reference count on the credential.
+.Pp
+The
+.Fn crfree
+function decreases the reference count on the credential.
+If the count drops to 0, the storage for the structure is freed.
+.Pp
+The
+.Fn crshared
+function returns true if the credential is shared.
+A credential is considered to be shared if its reference
+count is greater than one.
+.Pp
+The
+.Fn crcopy
+function copies the contents of the source (template)
+credential into the destination template.
+The
+.Vt uidinfo
+structure within the destination is referenced
+by calling
+.Xr uihold 9 .
+.Pp
+The
+.Fn crcopysafe
+function copies the current credential associated with the process
+.Fa p
+into the newly allocated credential
+.Fa cr .
+The process lock on
+.Fa p
+must be held and will be dropped and reacquired as needed to allocate
+group storage space in
+.Fa cr .
+.Pp
+The
+.Fn crdup
+function allocates memory for a new structure and copies the
+contents of
+.Fa cr
+into it.
+The actual copying is performed by
+.Fn crcopy .
+.Pp
+The
+.Fn crsetgroups
+function sets the
+.Va cr_groups
+and
+.Va cr_ngroups
+variables and allocates space as needed.
+It also truncates the group list to the current maximum number of
+groups.
+No other mechanism should be used to modify the
+.Va cr_groups
+array except for updating the primary group via assignment to
+.Va cr_groups[0] .
+.Pp
+The
+.Fn cru2x
+function converts a
+.Vt ucred
+structure to an
+.Vt xucred
+structure.
+That is,
+it copies data from
+.Fa cr
+to
+.Fa xcr ;
+it ignores fields in the former that are not present in the latter
+(e.g.,
+.Va cr_uidinfo ) ,
+and appropriately sets fields in the latter that are not present in
+the former
+(e.g.,
+.Va cr_version ) .
+.Pp
+The
+.Fn cred_update_thread
+function sets the credentials of
+.Fa td
+to that of its process, freeing its old credential if required.
+.Sh RETURN VALUES
+.Fn crget ,
+.Fn crhold ,
+.Fn crdup ,
+and
+.Fn crcopysafe
+all return a pointer to a
+.Vt ucred
+structure.
+.Pp
+.Fn crshared
+returns 0 if the credential has a reference count greater than 1;
+otherwise, 1 is returned.
+.Sh USAGE NOTES
+As of
+.Fx 5.0 ,
+the
+.Vt ucred
+structure contains extensible fields.
+This means that the correct protocol must always be followed to create
+a fresh and writable credential structure: new credentials must always
+be derived from existing credentials using
+.Fn crget ,
+.Fn crcopy ,
+and
+.Fn crcopysafe .
+.Pp
+In the common case, credentials required for access control decisions are
+used in a read-only manner.
+In these circumstances, the thread credential
+.Va td_ucred
+should be used, as it requires no locking to access safely, and remains stable
+for the duration of the call even in the face of a multi-threaded
+application changing the process credentials from another thread.
+.Pp
+During a process credential update, the process lock must be held across
+check and update, to prevent race conditions.
+The process credential,
+.Va td->td_proc->p_ucred ,
+must be used both for check and update.
+If a process credential is updated during a system call and checks against
+the thread credential are to be made later during the same system call,
+the thread credential must also be refreshed from the process credential
+so as to prevent use of a stale value.
+To avoid this scenario, it is recommended that system calls updating the
+process credential be designed to avoid other authorization functions.
+.Pp
+If temporarily elevated privileges are required for a thread, the thread
+credential can by replaced for the duration of an activity, or for
+the remainder of the system call.
+However, as a thread credential is often shared, appropriate care should be
+taken to make sure modifications are made to a writable credential
+through the use of
+.Fn crget
+and
+.Fn crcopy .
+.Pp
+Caution should be exercised when checking authorization for a thread or
+process perform an operation on another thread or process.
+As a result of temporary elevation, the target thread credential should
+.Em never
+be used as the target credential in an access control decision: the process
+credential associated with the thread,
+.Va td->td_proc->p_ucred ,
+should be used instead.
+For example,
+.Xr p_candebug 9
+accepts a target process, not a target thread, for access control purposes.
+.Sh SEE ALSO
+.Xr uihold 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/uidinfo.9 b/share/man/man9/uidinfo.9
new file mode 100644
index 000000000000..8a3d708bc466
--- /dev/null
+++ b/share/man/man9/uidinfo.9
@@ -0,0 +1,109 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2001
+.Dt UIDINFO 9
+.Os
+.Sh NAME
+.Nm uidinfo ,
+.Nm uihashinit ,
+.Nm uifind ,
+.Nm uihold ,
+.Nm uifree
+.Nd "functions for managing UID information"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.In sys/resourcevar.h
+.Ft void
+.Fn uihashinit void
+.Ft "struct uidinfo *"
+.Fn uifind "uid_t uid"
+.Ft void
+.Fn uihold "struct uidinfo *uip"
+.Ft void
+.Fn uifree "struct uidinfo *uip"
+.Sh DESCRIPTION
+The
+.Nm
+family of functions
+is used to manage
+.Vt uidinfo
+structures.
+Each
+.Vt uidinfo
+structure maintains per uid resource consumption counts, including the
+process count and socket buffer space usage.
+.Pp
+The
+.Fn uihashinit
+function initializes the
+.Vt uidinfo
+hash table and its mutex.
+This function should only be called during system initialization.
+.Pp
+The
+.Fn uifind
+function looks up and returns the
+.Vt uidinfo
+structure for
+.Fa uid .
+If no
+.Vt uidinfo
+structure exists for
+.Fa uid ,
+a new structure will be allocated and initialized.
+The
+.Nm
+hash mutex is acquired and released.
+.Pp
+The
+.Fn uihold
+function increases the reference count on
+.Fa uip .
+.Fa uip Ns 's
+lock is acquired and released.
+.Pp
+The
+.Fn uifree
+function decreases the reference count on
+.Fa uip ,
+and if the count reaches 0
+.Fa uip
+is freed.
+.Fa uip Ns 's
+lock is acquired and release and the uidinfo hash mutex may be
+acquired and released.
+.Sh RETURN VALUES
+.Fn uifind
+returns a pointer to an initialized
+.Vt uidinfo
+structure, and should not fail.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/uio.9 b/share/man/man9/uio.9
new file mode 100644
index 000000000000..fd66e3dae55c
--- /dev/null
+++ b/share/man/man9/uio.9
@@ -0,0 +1,215 @@
+.\"
+.\" Copyright (c) 1997 Joerg Wunsch
+.\"
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 19, 2012
+.Dt UIO 9
+.Os
+.Sh NAME
+.Nm uio ,
+.Nm uiomove ,
+.Nm uiomove_nofault
+.Nd device driver I/O routines
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/uio.h
+.Bd -literal
+struct uio {
+ struct iovec *uio_iov; /* scatter/gather list */
+ int uio_iovcnt; /* length of scatter/gather list */
+ off_t uio_offset; /* offset in target object */
+ ssize_t uio_resid; /* remaining bytes to copy */
+ enum uio_seg uio_segflg; /* address space */
+ enum uio_rw uio_rw; /* operation */
+ struct thread *uio_td; /* owner */
+};
+.Ed
+.Ft int
+.Fn uiomove "void *buf" "int howmuch" "struct uio *uiop"
+.Ft int
+.Fn uiomove_nofault "void *buf" "int howmuch" "struct uio *uiop"
+.Sh DESCRIPTION
+The functions
+.Fn uiomove
+and
+.Fn uiomove_nofault
+are used to transfer data between buffers and I/O vectors that might
+possibly cross the user/kernel space boundary.
+.Pp
+As a result of any
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr readv 2 ,
+or
+.Xr writev 2
+system call that is being passed to a character-device driver, the
+appropriate driver
+.Va d_read
+or
+.Va d_write
+entry will be called with a pointer to a
+.Vt "struct uio"
+being passed.
+The transfer request is encoded in this structure.
+The driver itself should use
+.Fn uiomove
+or
+.Fn uiomove_nofault
+to get at the data in this structure.
+.Pp
+The fields in the
+.Vt uio
+structure are:
+.Bl -tag -width ".Va uio_iovcnt"
+.It Va uio_iov
+The array of I/O vectors to be processed.
+In the case of scatter/gather
+I/O, this will be more than one vector.
+.It Va uio_iovcnt
+The number of I/O vectors present.
+.It Va uio_offset
+The offset into the device.
+.It Va uio_resid
+The remaining number of bytes to process, updated after transfer.
+.It Va uio_segflg
+One of the following flags:
+.Bl -tag -width ".Dv UIO_USERSPACE"
+.It Dv UIO_USERSPACE
+The I/O vector points into a process's address space.
+.It Dv UIO_SYSSPACE
+The I/O vector points into the kernel address space.
+.It Dv UIO_NOCOPY
+Do not copy, already in object.
+.El
+.It Va uio_rw
+The direction of the desired transfer, either
+.Dv UIO_READ
+or
+.Dv UIO_WRITE .
+.It Va uio_td
+The pointer to a
+.Vt "struct thread"
+for the associated thread; used if
+.Va uio_segflg
+indicates that the transfer is to be made from/to a process's address
+space.
+.El
+.Pp
+The function
+.Fn uiomove_nofault
+requires that the buffer and I/O vectors be accessible without
+incurring a page fault.
+The source and destination addresses must be physically mapped for
+read and write access, respectively, and neither the source nor
+destination addresses may be pageable.
+Thus, the function
+.Fn uiomove_nofault
+can be called from contexts where acquiring virtual memory system
+locks or sleeping are prohibited.
+.Sh RETURN VALUES
+On success
+.Fn uiomove
+and
+.Fn uiomove_nofault
+will return 0; on error they will return an appropriate error code.
+.Sh EXAMPLES
+The idea is that the driver maintains a private buffer for its data,
+and processes the request in chunks of maximal the size of this
+buffer.
+Note that the buffer handling below is very simplified and
+will not work (the buffer pointer is not being advanced in case of a
+partial read), it is just here to demonstrate the
+.Nm
+handling.
+.Bd -literal
+/* MIN() can be found there: */
+#include <sys/param.h>
+
+#define BUFSIZE 512
+static char buffer[BUFSIZE];
+
+static int data_available; /* amount of data that can be read */
+
+static int
+fooread(struct cdev *dev, struct uio *uio, int flag)
+{
+ int rv, amnt;
+
+ rv = 0;
+ while (uio->uio_resid > 0) {
+ if (data_available > 0) {
+ amnt = MIN(uio->uio_resid, data_available);
+ rv = uiomove(buffer, amnt, uio);
+ if (rv != 0)
+ break;
+ data_available -= amnt;
+ } else
+ tsleep(...); /* wait for a better time */
+ }
+ if (rv != 0) {
+ /* do error cleanup here */
+ }
+ return (rv);
+}
+.Ed
+.Sh ERRORS
+.Fn uiomove
+and
+.Fn uiomove_nofault
+will fail and return the following error code if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The invoked
+.Xr copyin 9
+or
+.Xr copyout 9
+returned
+.Er EFAULT
+.El
+.Pp
+In addition,
+.Fn uiomove_nofault
+will fail and return the following error code if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+A page fault occurs.
+.El
+.Sh SEE ALSO
+.Xr read 2 ,
+.Xr readv 2 ,
+.Xr write 2 ,
+.Xr writev 2 ,
+.Xr copyin 9 ,
+.Xr copyout 9 ,
+.Xr sleep 9
+.Sh HISTORY
+The
+.Nm
+mechanism appeared in some early version of
+.Ux .
+.Sh AUTHORS
+This manual page was written by
+.An J\(:org Wunsch .
diff --git a/share/man/man9/unr.9 b/share/man/man9/unr.9
new file mode 100644
index 000000000000..d8b9d9585352
--- /dev/null
+++ b/share/man/man9/unr.9
@@ -0,0 +1,110 @@
+.\" Copyright (c) 2005 Gleb Smirnoff <glebius@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 5, 2010
+.Dt UNR 9
+.Os
+.Sh NAME
+.Nm new_unrhdr ,
+.Nm delete_unrhdr ,
+.Nm alloc_unr ,
+.Nm alloc_unr_specific ,
+.Nm free_unr
+.Nd "kernel unit number allocator"
+.Sh SYNOPSIS
+.In sys/systm.h
+.Ft "struct unrhdr *"
+.Fn new_unrhdr "int low" "int high" "struct mtx *mutex"
+.Ft void
+.Fn delete_unrhdr "struct unrhdr *uh"
+.Ft int
+.Fn alloc_unr "struct unrhdr *uh"
+.Ft int
+.Fn alloc_unrl "struct unrhdr *uh"
+.Ft int
+.Fn alloc_unr_specific "struct unrhdr *uh" "u_int item"
+.Ft void
+.Fn free_unr "struct unrhdr *uh" "u_int item"
+.Sh DESCRIPTION
+The kernel unit number allocator is a generic facility, which allows to allocate
+unit numbers within a specified range.
+.Bl -tag -width indent
+.It Fn new_unrhdr low high mutex
+Initialize a new unit number allocator entity.
+The
+.Fa low
+and
+.Fa high
+arguments
+specify minimum and maximum number of unit numbers.
+There is no cost associated with the range of unit numbers, so unless the resource
+really is finite,
+.Dv INT_MAX
+can be used.
+If
+.Fa mutex
+is not
+.Dv NULL ,
+it is used for locking when allocating and freeing units.
+Otherwise, internal mutex is used.
+.It Fn delete_unrhdr uh
+Destroy specified unit number allocator entity.
+.It Fn alloc_unr uh
+Return a new unit number.
+The lowest free number is always allocated.
+This function does not allocate memory and never sleeps, however it may
+block on a mutex.
+If no free unit numbers are left,
+.Li \-1
+is returned.
+.It Fn alloc_unrl uh
+Same as
+.Fn alloc_unr
+except that mutex is assumed to be already locked and thus is not used.
+.It Fn alloc_unr_specific uh item
+Allocate a specific unit number.
+This function allocates memory and thus may sleep.
+The allocated unit number is returned on success.
+If the specified number is already allocated or out of the range,
+.Li \-1
+is returned.
+.It Fn free_unr uh item
+Free a previously allocated unit number.
+This function may require allocating memory, and thus it can sleep.
+There is no pre-locked variant.
+.El
+.Sh CODE REFERENCES
+The above functions are implemented in
+.Pa sys/kern/subr_unit.c .
+.Sh HISTORY
+Kernel unit number allocator first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+Kernel unit number allocator was written by
+.An Poul-Henning Kamp .
+This manpage was written by
+.An Gleb Smirnoff .
diff --git a/share/man/man9/usbdi.9 b/share/man/man9/usbdi.9
new file mode 100644
index 000000000000..c04c946e3109
--- /dev/null
+++ b/share/man/man9/usbdi.9
@@ -0,0 +1,641 @@
+.\"
+.\" Copyright (c) 2005 Ian Dowse <iedowse@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd June 24, 2009
+.Dt USBDI 9
+.Os
+.Sh NAME
+.Nm usb_fifo_alloc_buffer ,
+.Nm usb_fifo_attach ,
+.Nm usb_fifo_detach ,
+.Nm usb_fifo_free_buffer ,
+.Nm usb_fifo_get_data ,
+.Nm usb_fifo_get_data_buffer ,
+.Nm usb_fifo_get_data_error ,
+.Nm usb_fifo_get_data_linear ,
+.Nm usb_fifo_put_bytes_max ,
+.Nm usb_fifo_put_data ,
+.Nm usb_fifo_put_data_buffer ,
+.Nm usb_fifo_put_data_error ,
+.Nm usb_fifo_put_data_linear ,
+.Nm usb_fifo_reset ,
+.Nm usb_fifo_softc ,
+.Nm usb_fifo_wakeup ,
+.Nm usbd_do_request ,
+.Nm usbd_do_request_flags ,
+.Nm usbd_errstr ,
+.Nm usbd_lookup_id_by_info ,
+.Nm usbd_lookup_id_by_uaa ,
+.Nm usbd_transfer_clear_stall ,
+.Nm usbd_transfer_drain ,
+.Nm usbd_transfer_pending ,
+.Nm usbd_transfer_poll ,
+.Nm usbd_transfer_setup ,
+.Nm usbd_transfer_start ,
+.Nm usbd_transfer_stop ,
+.Nm usbd_transfer_submit ,
+.Nm usbd_transfer_unsetup ,
+.Nm usbd_xfer_clr_flag ,
+.Nm usbd_xfer_frame_data ,
+.Nm usbd_xfer_frame_len ,
+.Nm usbd_xfer_get_frame ,
+.Nm usbd_xfer_get_priv ,
+.Nm usbd_xfer_is_stalled ,
+.Nm usbd_xfer_max_framelen ,
+.Nm usbd_xfer_max_frames ,
+.Nm usbd_xfer_max_len ,
+.Nm usbd_xfer_set_flag ,
+.Nm usbd_xfer_set_frame_data ,
+.Nm usbd_xfer_set_frame_len ,
+.Nm usbd_xfer_set_frame_offset ,
+.Nm usbd_xfer_set_frames ,
+.Nm usbd_xfer_set_interval ,
+.Nm usbd_xfer_set_priv ,
+.Nm usbd_xfer_set_stall ,
+.Nm usbd_xfer_set_timeout ,
+.Nm usbd_xfer_softc ,
+.Nm usbd_xfer_state ,
+.Nm usbd_xfer_status
+.Nd Universal Serial Bus driver programming interface
+.Sh SYNOPSIS
+.In dev/usb/usb.h
+.In dev/usb/usbdi.h
+.In dev/usb/usbdi_util.h
+.Sh DESCRIPTION
+The Universal Serial Bus (USB) driver programming interface provides
+USB peripheral drivers with a host controller independent API for
+controlling and communicating with USB peripherals.
+The
+.Nm usb
+module supports both USB Host and USB Device side mode.
+.
+.Sh USB KERNEL PROGRAMMING
+Here is a list of commonly used functions:
+.Pp
+.
+.Ft "usb_error_t"
+.Fo "usbd_transfer_setup"
+.Fa "udev"
+.Fa "ifaces"
+.Fa "pxfer"
+.Fa "setup_start"
+.Fa "n_setup"
+.Fa "priv_sc"
+.Fa "priv_mtx"
+.Fc
+.
+.Pp
+.
+.Ft "void"
+.Fo "usbd_transfer_unsetup"
+.Fa "pxfer"
+.Fa "n_setup"
+.Fc
+.
+.Pp
+.
+.Ft "void"
+.Fo "usbd_transfer_start"
+.Fa "xfer"
+.Fc
+.
+.Pp
+.
+.Ft "void"
+.Fo "usbd_transfer_stop"
+.Fa "xfer"
+.Fc
+.
+.Pp
+.
+.Ft "void"
+.Fo "usbd_transfer_drain"
+.Fa "xfer"
+.Fc
+.
+.
+.
+.Sh USB TRANSFER MANAGEMENT FUNCTIONS
+The USB standard defines four types of USB transfers.
+.
+Control transfers, Bulk transfers, Interrupt transfers and Isochronous
+transfers.
+.
+All the transfer types are managed using the following five functions:
+.
+.Pp
+.
+.Fn usbd_transfer_setup
+This function will allocate memory for and initialise an array of USB
+transfers and all required DMA memory.
+.
+This function can sleep or block waiting for resources to become
+available.
+.Fa udev
+is a pointer to "struct usb_device".
+.Fa ifaces
+is an array of interface index numbers to use. See "if_index".
+.Fa pxfer
+is a pointer to an array of USB transfer pointers that are initialized
+to NULL, and then pointed to allocated USB transfers.
+.Fa setup_start
+is a pointer to an array of USB config structures.
+.Fa n_setup
+is a number telling the USB system how many USB transfers should be
+setup.
+.Fa priv_sc
+is the private softc pointer, which will be used to initialize
+"xfer->priv_sc".
+.Fa priv_mtx
+is the private mutex protecting the transfer structure and the
+softc. This pointer is used to initialize "xfer->priv_mtx".
+This function returns
+zero upon success. A non-zero return value indicates failure.
+.
+.Pp
+.
+.Fn usbd_transfer_unsetup
+This function will release the given USB transfers and all allocated
+resources associated with these USB transfers.
+.Fa pxfer
+is a pointer to an array of USB transfer pointers, that may be NULL,
+that should be freed by the USB system.
+.Fa n_setup
+is a number telling the USB system how many USB transfers should be
+unsetup.
+.
+This function can sleep waiting for USB transfers to complete.
+.
+This function is NULL safe with regard to the USB transfer structure
+pointer.
+.
+It is not allowed to call this function from the USB transfer
+callback.
+.
+.Pp
+.
+.Fn usbd_transfer_start
+This function will start the USB transfer pointed to by
+.Fa xfer,
+if not already started.
+.
+This function is always non-blocking and must be called with the
+so-called private USB mutex locked.
+.
+This function is NULL safe with regard to the USB transfer structure
+pointer.
+.
+.Pp
+.
+.Fn usbd_transfer_stop
+This function will stop the USB transfer pointed to by
+.Fa xfer,
+if not already stopped.
+.
+This function is always non-blocking and must be called with the
+so-called private USB mutex locked.
+.
+This function can return before the USB callback has been called.
+.
+This function is NULL safe with regard to the USB transfer structure
+pointer.
+.
+If the transfer was in progress, the callback will called with
+"USB_ST_ERROR" and "error = USB_ERR_CANCELLED".
+.
+.Pp
+.
+.Fn usbd_transfer_drain
+This function will stop an USB transfer, if not already stopped and
+wait for any additional USB hardware operations to complete.
+.
+Buffers that are loaded into DMA using "usbd_xfer_set_frame_data()" can
+safely be freed after that this function has returned.
+.
+This function can block the caller and will not return before the USB
+callback has been called.
+.
+This function is NULL safe with regard to the USB transfer structure
+pointer.
+.
+.Sh USB TRANSFER CALLBACK
+.
+The USB callback has three states.
+.
+USB_ST_SETUP, USB_ST_TRANSFERRED and USB_ST_ERROR. USB_ST_SETUP is the
+initial state.
+.
+After the callback has been called with this state it will always be
+called back at a later stage in one of the other two states.
+.
+The USB callback should not restart the USB transfer in case the error
+cause is USB_ERR_CANCELLED.
+.
+The USB callback is protected from recursion.
+.
+That means one can start and stop whatever transfer from the callback
+of another transfer one desires.
+.
+Also the transfer that is currently called back.
+.
+Recursion is handled like this that when the callback that wants to
+recurse returns it is called one more time.
+.
+.
+.Pp
+.
+.Fn usbd_transfer_submit
+This function should only be called from within the USB callback and
+is used to start the USB hardware.
+.
+An USB transfer can have multiple frames consisting of one or more USB
+packets making up an I/O vector for all USB transfer types.
+.
+.Bd -literal -offset indent
+void
+usb_default_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+ int actlen;
+
+ usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
+
+ switch (USB_GET_STATE(xfer)) {
+ case USB_ST_SETUP:
+ /*
+ * Setup xfer frame lengths/count and data
+ */
+ usbd_transfer_submit(xfer);
+ break;
+
+ case USB_ST_TRANSFERRED:
+ /*
+ * Read usb frame data, if any.
+ * "actlen" has the total length for all frames
+ * transferred.
+ */
+ break;
+
+ default: /* Error */
+ /*
+ * Print error message and clear stall
+ * for example.
+ */
+ break;
+ }
+ /*
+ * Here it is safe to do something without the private
+ * USB mutex locked.
+ */
+ return;
+}
+.Ed
+.
+.Sh USB CONTROL TRANSFERS
+An USB control transfer has three parts.
+.
+First the SETUP packet, then DATA packet(s) and then a STATUS
+packet.
+.
+The SETUP packet is always pointed to by frame 0 and the
+length is set by
+.Fn usbd_xfer_frame_len
+also if there should not be
+sent any SETUP packet! If an USB control transfer has no DATA stage,
+then the number of frames should be set to 1.
+.
+Else the default number of frames is 2.
+.
+.Bd -literal -offset indent
+
+Example1: SETUP + STATUS
+ usbd_xfer_set_frames(xfer, 1);
+ usbd_xfer_set_frame_len(xfer, 0, 8);
+ usbd_transfer_submit(xfer);
+
+Example2: SETUP + DATA + STATUS
+ usbd_xfer_set_frames(xfer, 2);
+ usbd_xfer_set_frame_len(xfer, 0, 8);
+ usbd_xfer_set_frame_len(xfer, 1, 1);
+ usbd_transfer_submit(xfer);
+
+Example3: SETUP + DATA + STATUS - split
+1st callback:
+ usbd_xfer_set_frames(xfer, 1);
+ usbd_xfer_set_frame_len(xfer, 0, 8);
+ usbd_transfer_submit(xfer);
+
+2nd callback:
+ /* IMPORTANT: frbuffers[0] must still point at the setup packet! */
+ usbd_xfer_set_frames(xfer, 2);
+ usbd_xfer_set_frame_len(xfer, 0, 0);
+ usbd_xfer_set_frame_len(xfer, 1, 1);
+ usbd_transfer_submit(xfer);
+
+Example4: SETUP + STATUS - split
+1st callback:
+ usbd_xfer_set_frames(xfer, 1);
+ usbd_xfer_set_frame_len(xfer, 0, 8);
+ usbd_xfer_set_flag(xfer, USB_MANUAL_STATUS);
+ usbd_transfer_submit(xfer);
+
+2nd callback:
+ usbd_xfer_set_frames(xfer, 1);
+ usbd_xfer_set_frame_len(xfer, 0, 0);
+ usbd_xfer_clr_flag(xfer, USB_MANUAL_STATUS);
+ usbd_transfer_submit(xfer);
+
+.Ed
+.Sh USB TRANSFER CONFIG
+To simply the search for endpoints the
+.Nm usb
+module defines a USB config structure where it is possible to specify
+the characteristics of the wanted endpoint.
+.Bd -literal -offset indent
+
+struct usb_config {
+ bufsize,
+ callback
+ direction,
+ endpoint,
+ frames,
+ index flags,
+ interval,
+ timeout,
+ type,
+};
+
+.Ed
+.
+.Pp
+.Fa type
+field selects the USB pipe type.
+.
+Valid values are: UE_INTERRUPT, UE_CONTROL, UE_BULK,
+UE_ISOCHRONOUS.
+.
+The special value UE_BULK_INTR will select BULK and INTERRUPT pipes.
+.
+This field is mandatory.
+.
+.Pp
+.Fa endpoint
+field selects the USB endpoint number.
+.
+A value of 0xFF, "-1" or "UE_ADDR_ANY" will select the first matching
+endpoint.
+.
+This field is mandatory.
+.
+.Pp
+.Fa direction
+field selects the USB endpoint direction.
+.
+A value of "UE_DIR_ANY" will select the first matching endpoint.
+.
+Else valid values are: "UE_DIR_IN" and "UE_DIR_OUT".
+.
+"UE_DIR_IN" and "UE_DIR_OUT" can be binary OR'ed by "UE_DIR_SID" which
+means that the direction will be swapped in case of
+USB_MODE_DEVICE.
+.
+Note that "UE_DIR_IN" refers to the data transfer direction of the
+"IN" tokens and "UE_DIR_OUT" refers to the data transfer direction of
+the "OUT" tokens.
+.
+This field is mandatory.
+.
+.Pp
+.Fa interval
+field selects the interrupt interval.
+.
+The value of this field is given in milliseconds and is independent of
+device speed.
+.
+Depending on the endpoint type, this field has different meaning:
+.Bl -tag
+.It UE_INTERRUPT
+"0" use the default interrupt interval based on endpoint descriptor.
+"Else" use the given value for polling rate.
+.It UE_ISOCHRONOUS
+"0" use default. "Else" the value is ignored.
+.It UE_BULK
+.It UE_CONTROL
+"0" no transfer pre-delay. "Else" a delay as given by this field in
+milliseconds is inserted before the hardware is started when
+"usbd_transfer_submit()" is called.
+.Pp
+NOTE: The transfer timeout, if any, is started after that the
+pre-delay has elapsed!
+.El
+.
+.Pp
+.Fa timeout
+field, if non-zero, will set the transfer timeout in milliseconds. If
+the "timeout" field is zero and the transfer type is ISOCHRONOUS a
+timeout of 250ms will be used.
+.
+.Pp
+.Fa frames
+field sets the maximum number of frames. If zero is specified it will
+yield the following results:
+.Bl -tag
+.It UE_BULK
+xfer->nframes = 1;
+.It UE_INTERRUPT
+xfer->nframes = 1;
+.It UE_CONTROL
+xfer->nframes = 2;
+.It UE_ISOCHRONOUS
+Not allowed. Will cause an error.
+.El
+.
+.Pp
+.Fa ep_index
+field allows you to give a number, in case more endpoints match the
+description, that selects which matching "ep_index" should be used.
+.
+.Pp
+.Fa if_index
+field allows you to select which of the interface numbers in the
+"ifaces" array parameter passed to "usbd_transfer_setup" that should
+be used when setting up the given USB transfer.
+.
+.Pp
+.Fa flags
+field has type "struct usb_xfer_flags" and allows one to set initial
+flags an USB transfer. Valid flags are:
+.Bl -tag
+.It force_short_xfer
+This flag forces the last transmitted USB packet to be short. A short
+packet has a length of less than "xfer->max_packet_size", which
+derives from "wMaxPacketSize". This flag can be changed during
+operation.
+.It short_xfer_ok
+This flag allows the received transfer length, "xfer->actlen" to be
+less than "xfer->sumlen" upon completion of a transfer. This flag can
+be changed during operation.
+.It short_frames_ok
+This flag allows the reception of multiple short USB frames. This flag
+only has effect for BULK and INTERRUPT endpoints and if the number of
+frames received is greater than 1. This flag can be changed during
+operation.
+.It pipe_bof
+This flag causes a failing USB transfer to remain first in the PIPE
+queue except in the case of "xfer->error" equal to
+"USB_ERR_CANCELLED". No other USB transfers in the affected PIPE queue
+will be started until either:
+.Bl -tag
+.It 1
+The failing USB transfer is stopped using "usbd_transfer_stop()".
+.It 2
+The failing USB transfer performs a successful transfer.
+.El
+The purpose of this flag is to avoid races when multiple transfers are
+queued for execution on an USB endpoint, and the first executing
+transfer fails leading to the need for clearing of stall for
+example.
+.
+In this case this flag is used to prevent the following USB transfers
+from being executed at the same time the clear-stall command is
+executed on the USB control endpoint.
+.
+This flag can be changed during operation.
+.Pp
+"BOF" is short for "Block On Failure"
+.Pp
+NOTE: This flag should be set on all BULK and INTERRUPT USB transfers
+which use an endpoint that can be shared between userland and kernel.
+.
+.
+.It proxy_buffer
+Setting this flag will cause that the total buffer size will be
+rounded up to the nearest atomic hardware transfer size.
+.
+The maximum data length of any USB transfer is always stored in the
+"xfer->max_data_length".
+.
+For control transfers the USB kernel will allocate additional space
+for the 8-bytes of SETUP header.
+.
+These 8-bytes are not counted by the "xfer->max_data_length"
+variable.
+.
+This flag can not be changed during operation.
+.
+.
+.It ext_buffer
+Setting this flag will cause that no data buffer will be
+allocated.
+.
+Instead the USB client must supply a data buffer.
+.
+This flag can not be changed during operation.
+.
+.
+.It manual_status
+Setting this flag prevents an USB STATUS stage to be appended to the
+end of the USB control transfer.
+.
+If no control data is transferred this flag must be cleared.
+.
+Else an error will be returned to the USB callback.
+.
+This flag is mostly useful for the USB device side.
+.
+This flag can be changed during operation.
+.
+.
+.It no_pipe_ok
+Setting this flag causes the USB_ERR_NO_PIPE error to be ignored. This
+flag can not be changed during operation.
+.
+.
+.It stall_pipe
+.Bl -tag
+.It Device Side Mode
+Setting this flag will cause STALL pids to be sent to the endpoint
+belonging to this transfer before the transfer is started.
+.
+The transfer is started at the moment the host issues a clear-stall
+command on the STALL'ed endpoint.
+.
+This flag can be changed during operation.
+.It Host Side Mode
+Setting this flag will cause a clear-stall control request to be
+executed on the endpoint before the USB transfer is started.
+.El
+.Pp
+If this flag is changed outside the USB callback function you have to
+use the "usbd_xfer_set_stall()" and "usbd_transfer_clear_stall()"
+functions! This flag is automatically cleared after that the stall or
+clear stall has been executed.
+.
+.It pre_scale_frames
+If this flag is set the number of frames specified is assumed to give the buffering time in milliseconds instead of frames.
+During transfer setup the frames field is pre scaled with the corresponding value for the endpoint and rounded to the nearest number of frames greater than zero.
+This option only has effect for ISOCHRONOUS transfers.
+.El
+.Pp
+.Fa bufsize
+field sets the total buffer size in bytes.
+.
+If this field is zero, "wMaxPacketSize" will be used, multiplied by
+the "frames" field if the transfer type is ISOCHRONOUS.
+.
+This is useful for setting up interrupt pipes.
+.
+This field is mandatory.
+.Pp
+NOTE: For control transfers "bufsize" includes the length of the
+request structure.
+.
+.Pp
+.Fa callback
+pointer sets the USB callback. This field is mandatory.
+.
+.
+.Sh USB LINUX COMPAT LAYER
+The
+.Nm usb
+module supports the Linux USB API.
+.
+.
+.Sh SEE ALSO
+.Xr libusb 3 ,
+.Xr usb 4 ,
+.Xr usbconfig 8
+.Sh STANDARDS
+The
+.Nm usb
+module complies with the USB 2.0 standard.
+.Sh HISTORY
+The
+.Nm usb
+module has been inspired by the NetBSD USB stack initially written by
+Lennart Augustsson. The
+.Nm usb
+module was written by
+.An Hans Petter Selasky Aq hselasky@FreeBSD.org .
diff --git a/share/man/man9/utopia.9 b/share/man/man9/utopia.9
new file mode 100644
index 000000000000..a7d02c19bee2
--- /dev/null
+++ b/share/man/man9/utopia.9
@@ -0,0 +1,353 @@
+.\" Copyright (c) 2003
+.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Author: Hartmut Brandt <harti@FreeBSD.org>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 8, 2003
+.Dt UTOPIA 9
+.Os
+.Sh NAME
+.Nm utopia
+.Nd "driver module for ATM PHY chips"
+.Sh SYNOPSIS
+.In dev/utopia/utopia.h
+.Ft int
+.Fo utopia_attach
+.Fa "struct utopia *utp" "struct ifatm *ifatm" "struct ifmedia *media"
+.Fa "struct mtx *lock" "struct sysctl_ctx_list *ctx"
+.Fa "struct sysctl_oid_list *tree" "const struct utopia_methods *vtab"
+.Fc
+.Ft void
+.Fn utopia_detach "struct utopia *utp"
+.Ft int
+.Fn utopia_start "struct utopia *utp"
+.Ft void
+.Fn utopia_stop "struct utopia *utp"
+.Ft void
+.Fn utopia_init_media "struct utopia *utp"
+.Ft void
+.Fn utopia_reset_media "struct utopia *utp"
+.Ft int
+.Fn utopia_reset "struct utopia *utp"
+.Ft int
+.Fn utopia_set_sdh "struct utopia *utp" "int sdh"
+.Ft int
+.Fn utopia_set_unass "struct utopia *utp" "int unass"
+.Ft int
+.Fn utopia_set_noscramb "struct utopia *utp" "int noscramb"
+.Ft int
+.Fn utopia_update_carrier "struct utopia *utp"
+.Ft int
+.Fn utopia_set_loopback "struct utopia *utp" "u_int mode"
+.Ft void
+.Fn utopia_intr "struct utopia *utp"
+.Ft void
+.Fn utopia_update_stats "struct utopia *utp"
+.Sh DESCRIPTION
+This module is used by all ATM drivers for cards that use a number of known
+PHY chips to provide uniform functionality.
+The module implements status monitoring in either interrupt or polling mode,
+media option handling and application access to PHY registers.
+.Pp
+To use this interface, a driver must implement two functions for reading and
+writing PHY registers, and initialize the following structure with pointers
+to these functions:
+.Bd -literal -offset indent
+struct utopia_methods {
+ int (*readregs)(struct ifatm *, u_int reg,
+ uint8_t *val, u_int *n);
+ int (*writereg)(struct ifatm *, u_int reg,
+ u_int mask, u_int val);
+};
+.Ed
+.Pp
+The
+.Fn readregs
+function should read PHY registers starting at register
+.Fa reg .
+The maximum number of registers to read is given by the integer pointed
+to by
+.Fa n .
+The function should either return 0 on success, or an error code.
+In the first case,
+.Fa *n
+should be set to the actual number of registers read.
+The
+.Fn writereg
+function should write one register.
+It must change all bits for which the corresponding bit in
+.Fa mask
+is 1 to the value of the corresponding bit in
+.Fa val .
+It returns either 0 on success, or an error code.
+.Pp
+The ATM driver's private state block
+.Pq Va softc
+must begin with a
+.Vt "struct ifatm" .
+.Pp
+The
+.Vt "struct utopia"
+holds the current state of the PHY chip and contains the following fields:
+.Bd -literal -offset indent
+struct utopia {
+ struct ifatm *ifatm; /* driver data */
+ struct ifmedia *media; /* driver supplied */
+ struct mtx *lock; /* driver supplied */
+ const struct utopia_methods *methods;
+ LIST_ENTRY(utopia) link; /* list of these structures */
+ u_int flags; /* flags set by the driver */
+ u_int state; /* current state */
+ u_int carrier; /* carrier state */
+ u_int loopback; /* loopback mode */
+ const struct utopia_chip *chip; /* chip operations */
+ struct utopia_stats1 stats; /* statistics */
+};
+.Ed
+The public accessible fields have the following functions:
+.Bl -tag -width indent
+.It Va ifatm
+Pointer to the driver's private data
+.Pq Va softc .
+.It Va media
+Pointer to the driver's media structure.
+.It Va lock
+Pointer to a mutex provided by the driver.
+This mutex is used to synchronize
+with the kernel thread that handles device polling.
+It is locked in several
+places:
+.Bl -enum -offset indent
+.It
+In
+.Fn utopia_detach
+the mutex is locked to sleep and wait for the kernel thread to remove the
+.Vt "struct utopia"
+from the list of all
+.Nm
+devices.
+Before returning to the caller the mutex is unlocked.
+.It
+In the
+.Nm
+kernel thread the mutex is locked, and the
+.Fn utopia_carrier_update
+function is called with this mutex locked.
+This will result in the driver's
+.Fn readregs
+function being called with the mutex locked.
+.It
+In the sysctl handlers the mutex will be locked before calling into the driver's
+.Fn readreg
+or
+.Fn writereg
+functions.
+.El
+.It Va flags
+Flags set by either the driver or the
+.Nm
+module.
+The following flags are
+defined:
+.Bl -tag -width indent
+.It Dv UTP_FL_NORESET
+If this flag is set, the module will not try to write the
+SUNI master reset register.
+(Set by the driver.)
+.It Dv UTP_FL_POLL_CARRIER
+If this flag is set, the module will periodically poll the carrier state
+(as opposed to interrupt driven carrier state changes).
+(Set by the driver.)
+.El
+.It Va state
+Flags describing the current state of the PHY chip.
+These are managed
+by the module:
+.Bl -tag -width indent
+.It Dv UTP_ST_ACTIVE
+The driver is active and the PHY registers can be accessed.
+This is set by calling
+.Fn utopia_start ,
+which should be called either in the attach routine of the driver or
+in the network interface initialisation routine (depending on whether the
+registers are accessible all the time or only when the interface is up).
+.It Dv UTP_ST_SDH
+Interface is in SDH mode as opposed to SONET mode.
+.It Dv UTP_ST_UNASS
+Interface is producing unassigned cells instead of idle cells.
+.It Dv UTP_ST_NOSCRAMB
+Cell scrambling is switched off.
+.It Dv UTP_ST_DETACH
+(Internal use.)
+Interface is currently detaching.
+.It Dv UTP_ST_ATTACHED
+The attach routine has been run successfully.
+.El
+.It Va carrier
+The carrier state of the interface.
+This field can have one of three values:
+.Bl -tag -width indent
+.It Dv UTP_CARR_UNKNOWN
+Carrier state is still unknown.
+.It Dv UTP_CARR_OK
+Carrier has been detected.
+.It Dv UTP_CARR_LOST
+Carrier has been lost.
+.El
+.It Va loopback
+This is the current loopback mode of the interface.
+Note that not all
+chips support all loopback modes.
+Refer to the chip documentation.
+The
+following modes may be supported:
+.Bl -tag -width indent
+.It Dv UTP_LOOP_NONE
+No loopback, normal operation.
+.It Dv UTP_LOOP_TIME
+Timing source loopback.
+The transmitter clock is driven by the receive clock.
+.It Dv UTP_LOOP_DIAG
+Diagnostic loopback.
+.It Dv UTP_LOOP_LINE
+Serial line loopback.
+.It Dv UTP_LOOP_PARAL
+Parallel diagnostic loopback.
+.It Dv UTP_LOOP_TWIST
+Twisted pair diagnostic loopback.
+.It Dv UTP_LOOP_PATH
+Diagnostic path loopback.
+.El
+.It Va chip
+This points to a function vector for chip specific functions.
+Two fields
+in this vector are publicly available:
+.Bl -tag -width indent
+.It Va type
+This is the type of the detected PHY chip.
+One of:
+.Pp
+.Bl -tag -width indent -compact
+.It Dv UTP_TYPE_UNKNOWN Pq No 0
+.It Dv UTP_TYPE_SUNI_LITE Pq No 1
+.It Dv UTP_TYPE_SUNI_ULTRA Pq No 2
+.It Dv UTP_TYPE_SUNI_622 Pq No 3
+.It Dv UTP_TYPE_IDT77105 Pq No 4
+.El
+.It Va name
+This is a string with the name of the PHY chip.
+.El
+.El
+.Pp
+The following functions are used by the driver during attach/detach and/or
+initialisation/stopping the interface:
+.Bl -tag -width indent
+.It Fn utopia_attach
+Attach the PHY chip.
+This is called with a preallocated
+.Vt "struct utopia"
+(which may be part of the driver's
+.Va softc ) .
+The module initializes all fields of the
+.Nm
+state and the media field.
+User settable flags should be set after the call to
+.Fn utopia_attach .
+This function may fail due to the inability to install the sysctl handlers.
+In this case it will return \-1.
+On success, 0 is returned and the
+.Dv UTP_ST_ATTACHED
+flag is set.
+.It Fn utopia_detach
+Remove the
+.Nm
+attachment from the system.
+This cancels all outstanding polling
+timeouts.
+.It Fn utopia_start
+Start operation of that PHY.
+This should be called at a time
+when the PHY registers are known to be accessible.
+This may be either in
+the driver's attach function or when the interface is set running.
+.It Fn utopia_stop
+Stop operation of the PHY attachment.
+This may be called either in the detach
+function of the driver or when the interface is brought down.
+.It Fn utopia_init_media
+This must be called if the media field in the ATM MIB was changed.
+The function
+makes sure, that the ifmedia fields contain the same information as the
+ATM MIB.
+.It Fn utopia_reset_media
+This may be called to remove all media information from the ifmedia field.
+.El
+.Pp
+The following functions can be used to modify the PHY state while the interface
+is running:
+.Bl -tag -width indent
+.It Fn utopia_reset
+Reset the operational parameters to the default state (SONET, idle cells,
+scrambling enabled).
+Returns 0 on success, an error code otherwise, leaving
+the state undefined.
+.It Fn utopia_set_sdh
+If the argument is zero the chip is switched to Sonet mode, if it is non-zero
+the chip is switched to SDH mode.
+Returns 0 on success, an error code otherwise,
+leaving the previous state.
+.It Fn utopia_set_unass
+If the argument is zero the chip is switched to produce idle cells, if it is
+non-zero the chip is switched to produce unassigned cells.
+Returns 0 on success,
+an error code otherwise, leaving the previous state.
+.It Fn utopia_set_noscramb
+If the argument is zero enables scrambling, if it is
+non-zero disables scrambling.
+Returns 0 on success,
+an error code otherwise, leaving the previous state.
+.It Fn utopia_update_carrier
+Check the carrier state and update the carrier field in the state structure.
+This will generate a message to the Netgraph stack if the carrier state changes.
+For chips that are polled this is called automatically, for interrupt
+driven attachments this must be called on interrupts from the PHY chip.
+.It Fn utopia_set_loopback
+Set the loopback mode of the chip.
+Returns 0 on success, an error code
+otherwise, leaving the previous state.
+.It Fn utopia_intr
+Called when an interrupt from the PHY chip is detected.
+This resets the
+interrupt state by reading all registers and, if the interrupt was from the
+RSOP, checks the carrier state.
+.It Fn utopia_update_stats
+Update the statistics with counters read from the chip.
+.El
+.Sh SEE ALSO
+.Xr utopia 4
+.Sh AUTHORS
+.An Harti Brandt Aq harti@FreeBSD.org
diff --git a/share/man/man9/vaccess.9 b/share/man/man9/vaccess.9
new file mode 100644
index 000000000000..4bf377406903
--- /dev/null
+++ b/share/man/man9/vaccess.9
@@ -0,0 +1,128 @@
+.\"-
+.\" Copyright (c) 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2009
+.Dt VACCESS 9
+.Os
+.Sh NAME
+.Nm vaccess
+.Nd generate an access control decision using vnode parameters
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fo vaccess
+.Fa "enum vtype type"
+.Fa "mode_t file_mode"
+.Fa "uid_t file_uid"
+.Fa "gid_t file_gid"
+.Fa "accmode_t accmode"
+.Fa "struct ucred *cred"
+.Fa "int *privused"
+.Fc
+.Sh DESCRIPTION
+This call implements the logic for the
+.Ux
+discretionary file security model
+common to many file systems in
+.Fx .
+It accepts the vnodes type
+.Fa type ,
+permissions via
+.Fa file_mode ,
+owning UID
+.Fa file_uid ,
+owning GID
+.Fa file_gid ,
+desired access mode
+.Fa accmode ,
+requesting credential
+.Fa cred ,
+and an optional call-by-reference
+.Vt int
+pointer returning whether or not
+privilege was required for successful evaluation of the call; the
+.Fa privused
+pointer may be set to
+.Dv NULL
+by the caller in order not to be informed of
+privilege information, or it may point to an integer that will be set to
+1 if privilege is used, and 0 otherwise.
+.Pp
+This call is intended to support implementations of
+.Xr VOP_ACCESS 9 ,
+which will use their own access methods to retrieve the vnode properties,
+and then invoke
+.Fn vaccess
+in order to perform the actual check.
+Implementations of
+.Xr VOP_ACCESS 9
+may choose to implement additional security mechanisms whose results will
+be composed with the return value.
+.Pp
+The algorithm used by
+.Fn vaccess
+selects a component of the file permission bits based on comparing the
+passed credential, file owner, and file group.
+If the credential's effective UID matches the file owner, then the
+owner component of the permission bits is selected.
+If the UID does not match, then the credential's effective GID, followed
+by additional groups, are compared with the file group\[em]if there is
+a match, then the group component of the permission bits is selected.
+If neither the credential UID or GIDs match the passed file owner and
+group, then the other component of the permission bits is selected.
+.Pp
+Once appropriate protections are selected for the current credential,
+the requested access mode, in combination with the vnode type, will be
+compared with the discretionary rights available for the credential.
+If the rights granted by discretionary protections are insufficient,
+then super-user privilege, if available for the credential, will also be
+considered.
+.Sh RETURN VALUES
+.Fn vaccess
+will return 0 on success, or a non-zero error value on failure.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+Permission denied.
+An attempt was made to access a file in a way forbidden by its file access
+permissions.
+.It Bq Er EPERM
+Operation not permitted.
+An attempt was made to perform an operation limited to processes with
+appropriate privileges or to the owner of a file or other resource.
+.El
+.Sh SEE ALSO
+.Xr vaccess_acl_nfs4 9 ,
+.Xr vaccess_acl_posix1e 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9
+.Sh AUTHORS
+This manual page and the current implementation of
+.Fn vaccess
+were written by
+.An Robert Watson .
diff --git a/share/man/man9/vaccess_acl_nfs4.9 b/share/man/man9/vaccess_acl_nfs4.9
new file mode 100644
index 000000000000..27b4cfa644b3
--- /dev/null
+++ b/share/man/man9/vaccess_acl_nfs4.9
@@ -0,0 +1,129 @@
+.\"-
+.\" Copyright (c) 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 18, 2009
+.Dt VACCESS_ACL_NFS4 9
+.Os
+.Sh NAME
+.Nm vaccess_acl_nfs4
+.Nd generate a NFSv4 ACL access control decision using vnode parameters
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fo vaccess_acl_nfs4
+.Fa "enum vtype type"
+.Fa "uid_t file_uid"
+.Fa "gid_t file_gid"
+.Fa "struct acl *acl"
+.Fa "accmode_t accmode"
+.Fa "struct ucred *cred"
+.Fa "int *privused"
+.Fc
+.Sh DESCRIPTION
+This call implements the logic for the
+.Ux
+discretionary file security model
+with NFSv4 ACL extensions.
+It accepts the vnodes type
+.Fa type ,
+owning UID
+.Fa file_uid ,
+owning GID
+.Fa file_gid ,
+access ACL for the file
+.Fa acl ,
+desired access mode
+.Fa accmode ,
+requesting credential
+.Fa cred ,
+and an optional call-by-reference
+.Vt int
+pointer returning whether or not
+privilege was required for successful evaluation of the call; the
+.Fa privused
+pointer may be set to
+.Dv NULL
+by the caller in order not to be informed of
+privilege information, or it may point to an integer that will be set to
+1 if privilege is used, and 0 otherwise.
+.Pp
+This call is intended to support implementations of
+.Xr VOP_ACCESS 9 ,
+which will use their own access methods to retrieve the vnode properties,
+and then invoke
+.Fn vaccess_acl_nfs4
+in order to perform the actual check.
+Implementations of
+.Xr VOP_ACCESS 9
+may choose to implement additional security mechanisms whose results will
+be composed with the return value.
+.Pp
+The algorithm used by
+.Fn vaccess_acl_nfs4
+is based on the NFSv4 ACL evaluation algorithm, as described in
+NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-21.txt.
+The algorithm selects a
+.Em matching
+entry from the access ACL, which may
+then be composed with an available ACL mask entry, providing
+.Ux
+security compatibility.
+.Pp
+Once appropriate protections are selected for the current credential,
+the requested access mode, in combination with the vnode type, will be
+compared with the discretionary rights available for the credential.
+If the rights granted by discretionary protections are insufficient,
+then super-user privilege, if available for the credential, will also be
+considered.
+.Sh RETURN VALUES
+.Fn vaccess_acl_nfs4
+will return 0 on success, or a non-zero error value on failure.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+Permission denied.
+An attempt was made to access a file in a way forbidden by its file access
+permissions.
+.It Bq Er EPERM
+Operation not permitted.
+An attempt was made to perform an operation limited to processes with
+appropriate privileges or to the owner of a file or other resource.
+.El
+.Sh SEE ALSO
+.Xr vaccess 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9
+.Sh AUTHORS
+Current implementation of
+.Fn vaccess_acl_nfs4
+was written by
+.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
+.Sh BUGS
+This manual page should include a full description of the NFSv4 ACL
+evaluation algorithm, or cross reference another page that does.
diff --git a/share/man/man9/vaccess_acl_posix1e.9 b/share/man/man9/vaccess_acl_posix1e.9
new file mode 100644
index 000000000000..dc857a8ee61f
--- /dev/null
+++ b/share/man/man9/vaccess_acl_posix1e.9
@@ -0,0 +1,128 @@
+.\"-
+.\" Copyright (c) 2001 Robert N. M. Watson
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 22, 2001
+.Dt VACCESS_ACL_POSIX1E 9
+.Os
+.Sh NAME
+.Nm vaccess_acl_posix1e
+.Nd generate a POSIX.1e ACL access control decision using vnode parameters
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fo vaccess_acl_posix1e
+.Fa "enum vtype type"
+.Fa "uid_t file_uid"
+.Fa "gid_t file_gid"
+.Fa "struct acl *acl"
+.Fa "accmode_t accmode"
+.Fa "struct ucred *cred"
+.Fa "int *privused"
+.Fc
+.Sh DESCRIPTION
+This call implements the logic for the
+.Ux
+discretionary file security model
+with POSIX.1e ACL extensions.
+It accepts the vnodes type
+.Fa type ,
+owning UID
+.Fa file_uid ,
+owning GID
+.Fa file_gid ,
+access ACL for the file
+.Fa acl ,
+desired access mode
+.Fa accmode ,
+requesting credential
+.Fa cred ,
+and an optional call-by-reference
+.Vt int
+pointer returning whether or not
+privilege was required for successful evaluation of the call; the
+.Fa privused
+pointer may be set to
+.Dv NULL
+by the caller in order not to be informed of
+privilege information, or it may point to an integer that will be set to
+1 if privilege is used, and 0 otherwise.
+.Pp
+This call is intended to support implementations of
+.Xr VOP_ACCESS 9 ,
+which will use their own access methods to retrieve the vnode properties,
+and then invoke
+.Fn vaccess_acl_posix1e
+in order to perform the actual check.
+Implementations of
+.Xr VOP_ACCESS 9
+may choose to implement additional security mechanisms whose results will
+be composed with the return value.
+.Pp
+The algorithm used by
+.Fn vaccess_acl_posix1e
+is based on the POSIX.1e ACL evaluation algorithm.
+The algorithm selects a
+.Em matching
+entry from the access ACL, which may
+then be composed with an available ACL mask entry, providing
+.Ux
+security compatibility.
+.Pp
+Once appropriate protections are selected for the current credential,
+the requested access mode, in combination with the vnode type, will be
+compared with the discretionary rights available for the credential.
+If the rights granted by discretionary protections are insufficient,
+then super-user privilege, if available for the credential, will also be
+considered.
+.Sh RETURN VALUES
+.Fn vaccess_acl_posix1e
+will return 0 on success, or a non-zero error value on failure.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EACCES
+Permission denied.
+An attempt was made to access a file in a way forbidden by its file access
+permissions.
+.It Bq Er EPERM
+Operation not permitted.
+An attempt was made to perform an operation limited to processes with
+appropriate privileges or to the owner of a file or other resource.
+.El
+.Sh SEE ALSO
+.Xr vaccess 9 ,
+.Xr vnode 9 ,
+.Xr VOP_ACCESS 9
+.Sh AUTHORS
+This manual page and the current implementation of
+.Fn vaccess_acl_posix1e
+were written by
+.An Robert Watson .
+.Sh BUGS
+This manual page should include a full description of the POSIX.1e ACL
+evaluation algorithm, or cross reference another page that does.
diff --git a/share/man/man9/vcount.9 b/share/man/man9/vcount.9
new file mode 100644
index 000000000000..186a350ac56b
--- /dev/null
+++ b/share/man/man9/vcount.9
@@ -0,0 +1,73 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2000 Andrew Stevenson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" If this manual page travels to places exotic (like projects other than
+.\" FreeBSD) I would love to hear about it.
+.\" Andrew <andrew@ugh.net.au>
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 19, 2012
+.Dt VCOUNT 9
+.Os
+.Sh NAME
+.Nm vcount ,
+.Nm count_dev
+.Nd "get total number of references to a device"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/time.h
+.In sys/conf.h
+.In sys/vnode.h
+.Ft int
+.Fn vcount "struct vnode *vp"
+.Ft int
+.Fn count_dev "struct cdev *dev"
+.Sh DESCRIPTION
+.Fn vcount
+is used to get the number of references to a particular device.
+It allows for the fact that multiple vnodes may reference the same device.
+.Fn count_dev
+does the same thing as
+.Fn vcount ,
+but takes a
+.Vt "struct cdev"
+rather than a
+.Vt "struct vnode"
+pointer as an argument.
+.Sh RETURN VALUES
+.Fn vcount
+and
+.Fn count_dev
+both return the number of references to the device.
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Andrew Stevenson .
diff --git a/share/man/man9/vflush.9 b/share/man/man9/vflush.9
new file mode 100644
index 000000000000..94485f925797
--- /dev/null
+++ b/share/man/man9/vflush.9
@@ -0,0 +1,81 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFLUSH 9
+.Os
+.Sh NAME
+.Nm vflush
+.Nd "flush vnodes for a mount point"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn vflush "struct mount *mp" "int rootrefs" "int flags" "struct thread *td"
+.Sh DESCRIPTION
+The
+.Fn vflush
+function removes any vnodes in the vnode table that belong to the given
+.Vt mount
+structure.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa rootrefs"
+.It Fa mp
+The mount point whose vnodes should be removed.
+.It Fa rootrefs
+The number of references expected on the root vnode.
+.Xr vrele 9
+will be invoked on the root vnode
+.Fa rootrefs
+times.
+.It Fa flags
+The flags indicating how vnodes should be handled.
+.Bl -tag -width ".Dv WRITECLOSE"
+.It Dv FORCECLOSE
+If set, busy vnodes will be forcibly closed.
+.It Dv SKIPSYSTEM
+If set, vnodes with the
+.Dv VV_SYSTEM
+flag set will be skipped.
+.It Dv WRITECLOSE
+If set, only regular files currently opened for writing will be removed.
+.El
+.It Fa td
+The calling thread.
+.El
+.Sh RETURN VALUES
+A value of 0 is returned if the flush is successful; otherwise,
+.Er EBUSY
+will be returned.
+.Sh SEE ALSO
+.Xr vgone 9 ,
+.Xr vrele 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_busy.9 b/share/man/man9/vfs_busy.9
new file mode 100644
index 000000000000..c62ff3948291
--- /dev/null
+++ b/share/man/man9/vfs_busy.9
@@ -0,0 +1,89 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 14, 2010
+.Dt VFS_BUSY 9
+.Os
+.Sh NAME
+.Nm vfs_busy
+.Nd "marks a mount point as busy"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fn vfs_busy "struct mount *mp" "int flags"
+.Sh DESCRIPTION
+The
+.Fn vfs_busy
+function marks a mount point as busy by incrementing
+the reference count of a mount point.
+It also delays unmounting by sleeping on
+.Fa mp
+if the
+.Dv MNTK_UNMOUNT
+flag is set in
+.Fa mp->mnt_kern_flag
+and the
+.Dv MBF_NOWAIT
+flag is
+.Em not
+set.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa flags"
+.It Fa mp
+The mount point to busy.
+.It Fa flags
+Flags controlling how
+.Fn vfs_busy
+should act.
+.Bl -tag -width ".Dv MBF_MNTLSTLOCK"
+.It Dv MBF_NOWAIT
+do not sleep if
+.Dv MNTK_UNMOUNT
+is set.
+.It Dv MBF_MNTLSTLOCK
+drop the mountlist_mtx in the critical path.
+.El
+.El
+.Sh RETURN VALUES
+A 0 value is returned on success.
+If the mount point is being
+unmounted and MBF_NOWAIT flag is specified
+.Er ENOENT
+will be returned.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOENT
+The mount point is being unmounted
+.Dv ( MNTK_UNMOUNT
+is set).
+.El
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_getnewfsid.9 b/share/man/man9/vfs_getnewfsid.9
new file mode 100644
index 000000000000..b6f12382fe13
--- /dev/null
+++ b/share/man/man9/vfs_getnewfsid.9
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFS_GETNEWFSID 9
+.Os
+.Sh NAME
+.Nm vfs_getnewfsid
+.Nd "allocate a new file system identifier"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft void
+.Fn vfs_getnewfsid "struct mount *mp"
+.Sh DESCRIPTION
+The
+.Fn vfs_getnewfsid
+function allocates a new file system identifier for the mount point given.
+File systems typically call
+.Fn vfs_getnewfsid
+in their mount routine in order to acquire a unique ID within the system
+which can later be used to uniquely identify the file system via calls such as
+.Xr vfs_getvfs 9 .
+.Pp
+The actual
+.Vt fsid
+is made up of two 32 bit integers, that are stored in the
+.Vt statfs
+structure of
+.Fa mp .
+The first integer is unique in the set of mounted file systems,
+while the second holds the file system type.
+.Bd -literal
+typedef struct fsid {
+ int32_t val[2];
+} fsid_t;
+.Ed
+.Sh PSEUDOCODE
+.Bd -literal
+xxx_mount(struct mount *mp, char *path, caddr_t data,
+ struct nameidata *ndp, struct thread *td)
+{
+ ...
+ vfs_getnewfsid(mp);
+ ...
+}
+.Ed
+.Sh SEE ALSO
+.Xr vfs_getvfs 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_getopt.9 b/share/man/man9/vfs_getopt.9
new file mode 100644
index 000000000000..09db47c7929d
--- /dev/null
+++ b/share/man/man9/vfs_getopt.9
@@ -0,0 +1,245 @@
+.\"
+.\" Copyright (C) 2007 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 31, 2011
+.Dt VFS_GETOPT 9
+.Os
+.Sh NAME
+.Nm vfs_getopt ,
+.Nm vfs_getopts ,
+.Nm vfs_flagopt ,
+.Nm vfs_scanopt ,
+.Nm vfs_copyopt ,
+.Nm vfs_filteropt ,
+.Nm vfs_setopt ,
+.Nm vfs_setopt_part ,
+.Nm vfs_setopts
+.Nd "manipulate mount options and their values"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fo vfs_getopt
+.Fa "struct vfsoptlist *opts" "const char *name" "void **buf" "int *len"
+.Fc
+.Ft "char *"
+.Fn vfs_getops "struct vfsoptlist *opts" "const char *name" "int *error"
+.Ft int
+.Fo vfs_flagopt
+.Fa "struct vfsoptlist *opts" "const char *name" "uint64_t *flags" "uint64_t flag"
+.Fc
+.Ft int
+.Fo vfs_scanopt
+.Fa "struct vfsoptlist *opts" "const char *name" "const char *fmt" ...
+.Fc
+.Ft int
+.Fo vfs_copyopt
+.Fa "struct vfsoptlist *opts" "const char *name" "void *dest" "int len"
+.Fc
+.Ft int
+.Fo vfs_filteropt
+.Fa "struct vfsoptlist *opts" "const char **legal"
+.Fc
+.Ft int
+.Fo vfs_setopt
+.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len"
+.Fc
+.Ft int
+.Fo vfs_setopt_part
+.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len"
+.Fc
+.Ft int
+.Fo vfs_setopts
+.Fa "struct vfsoptlist *opts" "const char *name" "const char *value"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vfs_getopt
+function sets
+.Fa buf
+to point to the value of the named mount option, and sets
+.Fa len
+to the length of the value if it is not
+.Dv NULL .
+The
+.Fa buf
+argument
+will point to the actual value, and does not need to be freed or released
+(and probably should not be modified).
+.Pp
+The
+.Fn vfs_getopts
+function
+returns the value of the specified option if it is a string (i.e.,
+.Dv NUL
+terminated).
+.Pp
+The
+.Fn vfs_flagopt
+function determines if an option exists.
+If the option does exist, and
+.Fa flags
+is not
+.Dv NULL ,
+.Fa flag
+is added to those already set in
+.Fa flags .
+If the option does not exist, and
+.Fa flags
+is not
+.Dv NULL ,
+.Fa flag
+is removed from those already set in
+.Fa flags .
+An example of typical usage is:
+.Bd -literal
+if (vfs_flagopt(mp->mnt_optnew, "wormlike", NULL, 0))
+ vfs_flagopt(mp->mnt_optnew, "appendok", &(mp->flags), F_APPENDOK);
+.Ed
+.Pp
+The
+.Fn vfs_scanopt
+function performs a
+.Xr vsscanf 3
+with the option's value, using the given format,
+into the specified variable arguments.
+The value must be a string (i.e.,
+.Dv NUL
+terminated).
+.Pp
+The
+.Fn vfs_copyopt
+function creates a copy of the option's value.
+The
+.Fa len
+argument must match the length of the option's value exactly
+(i.e., a larger buffer will still cause
+.Fn vfs_copyout
+to fail with
+.Er EINVAL ) .
+.Pp
+The
+.Fn vfs_filteropt
+function ensures that no unknown options were specified.
+A option is valid if its name matches one of the names in the
+list of legal names.
+An option may be prefixed with 'no', and still be considered valid.
+.Pp
+The
+.Fn vfs_setopt
+and
+.Fn vfs_setopt_part
+functions copy new data into the option's value.
+In
+.Fn vfs_setopt ,
+the
+.Fa len
+argument must match the length of the option's value exactly
+(i.e., a larger buffer will still cause
+.Fn vfs_copyout
+to fail with
+.Er EINVAL ) .
+.Pp
+The
+.Fn vfs_setopts
+function copies a new string into the option's value.
+The string, including
+.Dv NUL
+byte, must be no longer than the option's length.
+.Sh RETURN VALUES
+The
+.Fn vfs_getopt
+function returns 0 if the option was found; otherwise,
+.Er ENOENT
+is returned.
+.Pp
+The
+.Fn vfs_getops
+function returns the specified option if it is found, and is
+.Dv NUL
+terminated.
+If the option was found, but is not
+.Dv NUL
+terminated,
+.Fa error
+is set to
+.Er EINVAL
+and
+.Dv NULL
+is returned.
+If the option was not found,
+.Fa error
+is set to 0, and
+.Dv NULL
+is returned.
+.Pp
+The
+.Fn vfs_flagopt
+function returns 1 if the option was found, and 0 if it was not.
+.Pp
+The
+.Fn vfs_scanopt
+function returns 0 if the option was not found, or was not
+.Dv NUL
+terminated; otherwise, the return value of
+.Xr vsscanf 3
+is returned.
+If
+.Xr vsscanf 3
+returns 0, it will be returned unchanged; therefore, a return value of 0 does
+not always mean the option does not exist, or is not a valid string.
+.Pp
+The
+.Fn vfs_copyopt
+and
+.Fn vfs_setopt
+functions return 0 if the copy was successful,
+.Er EINVAL
+if the option was found but the lengths did not match, and
+.Er ENOENT
+if the option was not found.
+.Pp
+The
+.Fn vfs_filteropt
+function returns 0 if all of the options are legal; otherwise,
+.Er EINVAL
+is returned.
+.Pp
+The
+.Fn vfs_setopts
+function returns 0 if the copy was successful,
+.Er EINVAL
+if the option was found but the string was too long, and
+.Er ENOENT
+if the option was not found.
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Chad David Aq davidc@FreeBSD.org
+and
+.An Ruslan Ermilov Aq ru@FreeBSD.org .
diff --git a/share/man/man9/vfs_getvfs.9 b/share/man/man9/vfs_getvfs.9
new file mode 100644
index 000000000000..c563adcddca3
--- /dev/null
+++ b/share/man/man9/vfs_getvfs.9
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFS_GETVFS 9
+.Os
+.Sh NAME
+.Nm vfs_getvfs
+.Nd "returns a mount point given its file system identifier"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft "struct mount *"
+.Fn vfs_getvfs "fsid_t *fsid"
+.Sh DESCRIPTION
+The
+.Fn vfs_getvfs
+function returns the mount point structure for a file system given its file system
+identifier.
+The file system ID should have been allocated by calling
+.Xr vfs_getnewfsid 9 ;
+otherwise, it will not be found.
+.Pp
+A major user of
+.Fn vfs_getvfs
+is NFS, which uses the
+.Vt fsid
+as part of file handles in order to determine the
+file system a given RPC is for.
+If
+.Fn vfs_getvfs
+fails to find the mount point related to
+.Fa fsid ,
+the file system is considered stale.
+.Sh RETURN VALUES
+If
+.Fa fsid
+is found, the mount point for the ID is returned; otherwise,
+.Dv NULL
+is returned.
+.Sh PSEUDOCODE
+.Bd -literal
+if ((mp = vfs_getvfs(&fhp->fh_fsid)) == NULL) {
+ error = ESTALE;
+ goto out;
+}
+.Ed
+.Sh SEE ALSO
+.Xr vfs_getnewfsid 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_mount.9 b/share/man/man9/vfs_mount.9
new file mode 100644
index 000000000000..47f60486d84e
--- /dev/null
+++ b/share/man/man9/vfs_mount.9
@@ -0,0 +1,135 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 26, 2004
+.Dt VFS_MOUNT 9
+.Os
+.Sh NAME
+.Nm vfs_mount
+.Nd "generic file system mount function"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fo vfs_mount
+.Fa "struct thread *td"
+.Fa "const char *fstype"
+.Fa "char *fspath"
+.Fa "int fsflags"
+.Fa "void *fsdata"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vfs_mount
+function handles the generic portion of mounting a file system,
+and calls the file system specific mount function after verifying
+its parameters and setting up the structures expected by the
+underlying mount code.
+.Pp
+.Fn vfs_mount
+is called directly by the
+.Xr mount 2
+system call.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa fsflags"
+.It Fa td
+The thread responsible for this call.
+.It Fa fstype
+The type of file system being mounted.
+.It Fa fspath
+The path to the mount point of the file system.
+.It Fa fsflags
+Flags controlling the mount.
+See
+.Xr mount 2
+for details.
+.Pp
+.Dv MNT_EXPORTED , MNT_NOSUID , MNT_UPDATE , MNT_RELOAD ,
+.Dv MNT_FORCE , MNT_ASYNC , MNT_SYNCHRONOUS , MNT_UNION , MNT_NOATIME ,
+.Dv MNT_SNAPSHOT , MNT_NOCLUSTERR , MNT_NOCLUSTERW , MNT_IGNORE ,
+.Dv MNT_UNION , MNT_NOSYMFOLLOW
+.It Fa fsdata
+File system specific data structure.
+It is in userspace
+when passed to
+.Fn vfs_mount
+and is left untouched when passed to file system's
+.Fn mount .
+.El
+.Sh RETURN VALUES
+A 0 value is returned on success.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENAMETOOLONG
+The fs type or the mount point path is too long or any individual
+path component is too long.
+.It Bq Er EPERM
+Permission denied.
+There are a number of reason this can occur
+ranging from the user not having permission to mount a file system
+to the securelevel being to high to load the
+.Fa fstype
+module.
+.It Bq Er EINVAL
+Invalid operation (ex: trying to update a non mount-point).
+.It Bq Er ENOENT
+The mount point does not exist (from
+.Fn namei ) .
+.It Bq Er ELOOP
+The mount point is a muddle of links (from
+.Fn namei ) .
+.It Bq Er EOPNOTSUPP
+The operation is not supported (ex: reloading a r/w file system).
+.It Bq Er EBUSY
+The mount point is busy or is not really a mount point (on update).
+.It Bq Er ENOTDIR
+The mount point is not a directory.
+.It Bq Er ENODEV
+The kernel linker was unable to load the specified
+.Fa fstype
+or was unable to find the specified
+.Fa fstype
+module.
+.El
+.Pp
+Other errors can be returned by the file system's
+.Fn mount
+and
+you should check the specific file system for details.
+Also
+this call relies on a large number of other kernel services
+whose errors it returns so this list may not be exhaustive.
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr mount 8
+.Pp
+.Va vfs.usermount
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_mountedfrom.9 b/share/man/man9/vfs_mountedfrom.9
new file mode 100644
index 000000000000..10ad32816f7b
--- /dev/null
+++ b/share/man/man9/vfs_mountedfrom.9
@@ -0,0 +1,55 @@
+.\" Copyright (C) 2008 Chad David <davidc@acns.ab.ca>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2008
+.Dt VFS_MOUNTEDFROM 9
+.Os
+.Sh NAME
+.Nm vfs_mountedfrom
+.Nd "sets the mounted from name for a mount"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft void
+.Fn vfs_mountedfrom "struct mount *mp" "const char *from"
+.Sh DESCRIPTION
+The
+.Fn vfs_mountedfrom
+function sets the mounted from name for a mount.
+This value is used by
+.Fn statfs 2
+to fill in
+.Va f_mntfromname .
+.Pp
+In most cases
+.Va from
+is the device that contains the file system, but in the case of a pseudo
+file system it could be a descriptive name like "devfs" or "procfs".
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_rootmountalloc.9 b/share/man/man9/vfs_rootmountalloc.9
new file mode 100644
index 000000000000..ecad73e3af20
--- /dev/null
+++ b/share/man/man9/vfs_rootmountalloc.9
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFS_ROOTMOUNTALLOC 9
+.Os
+.Sh NAME
+.Nm vfs_rootmountalloc
+.Nd "allocate a root"
+.Vt mount
+structure
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fn vfs_rootmountalloc "char *fstypename" "char *devname" "struct mount **mpp"
+.Sh DESCRIPTION
+.Fn vfs_rootmountalloc
+allocates a
+.Vt mount
+structure initialized from the
+.Vt vfsconf
+type that matches
+.Fa fstypename .
+.Sh RETURN VALUES
+If successful, 0 is returned and
+.Fa mpp
+points to the newly allocated
+.Vt mount
+structure.
+.Er ENODEV
+is returned if
+.Fa fstypename
+is
+.Dv NULL
+or invalid.
+.Sh SEE ALSO
+.Xr vfsconf 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_suser.9 b/share/man/man9/vfs_suser.9
new file mode 100644
index 000000000000..df68bc21efab
--- /dev/null
+++ b/share/man/man9/vfs_suser.9
@@ -0,0 +1,72 @@
+.\"
+.\" Copyright (c) 2004 Alfred Perlstein
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 2, 2004
+.Dt VFS_SUSER 9
+.Os
+.Sh NAME
+.Nm vfs_suser
+.Nd check if credentials have superuser privileges for a mount point
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/mount.h
+.Ft int
+.Fn vfs_suser "struct mount *mp" "struct thread *td"
+.Sh DESCRIPTION
+The
+.Fn vfs_suser
+function checks if the credentials given include superuser powers
+for the given mount point.
+It will check to see if the thread
+passed in has the same credentials as the user that mounted the
+file system.
+If so, it returns 0, otherwise it returns what
+.Xr priv_check 9
+would have returned.
+.Sh RETURN VALUES
+The
+.Fn vfs_suser
+function returns 0 if the user has superuser powers and
+.Er EPERM
+otherwise.
+This is the
+.Em reverse logic
+of some other implementations of
+.Fn suser
+in which a TRUE response indicates superuser powers.
+.Sh SEE ALSO
+.Xr chroot 2 ,
+.Xr jail 2
+.Sh HISTORY
+The
+.Fn vfs_suser
+function was introduced in
+.Fx 5.2 .
+.Sh AUTHORS
+This manual page was written by
+.An Alfred Perlstein .
diff --git a/share/man/man9/vfs_timestamp.9 b/share/man/man9/vfs_timestamp.9
new file mode 100644
index 000000000000..455d6f6ba427
--- /dev/null
+++ b/share/man/man9/vfs_timestamp.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFS_TIMESTAMP 9
+.Os
+.Sh NAME
+.Nm vfs_timestamp
+.Nd "generate current timestamp"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft void
+.Fn vfs_timestamp "struct timespec *tsp"
+.Sh DESCRIPTION
+The
+.Fn vfs_timestamp
+function fills in
+.Fa tsp
+with the current time.
+.Pp
+The precision is based on the value of the
+.Va vfs.timestamp_precision
+sysctl variable:
+.Pp
+.Bl -tag -width ".No \(>=3" -compact
+.It 0
+seconds only; nanoseconds are zeroed.
+.It 1
+seconds and nanoseconds, accurate within 1/HZ.
+.It 2
+seconds and nanoseconds, truncated to microseconds.
+.It \(>=3
+seconds and nanoseconds, maximum precision.
+.El
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_unbusy.9 b/share/man/man9/vfs_unbusy.9
new file mode 100644
index 000000000000..5d0b4e5d780b
--- /dev/null
+++ b/share/man/man9/vfs_unbusy.9
@@ -0,0 +1,58 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 14, 2010
+.Dt VFS_UNBUSY 9
+.Os
+.Sh NAME
+.Nm vfs_unbusy
+.Nd "unbusy a mount point"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft void
+.Fn vfs_unbusy "struct mount *mp"
+.Sh DESCRIPTION
+The
+.Fn vfs_unbusy
+function un-busies a mount point by decrementing
+the reference count of a mount point.
+The reference count is typically incremented by calling
+.Xr vfs_busy 9
+prior to this call.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa mp"
+.It Fa mp
+The mount point to unbusy.
+.El
+.Sh SEE ALSO
+.Xr vfs_busy 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vfs_unmountall.9 b/share/man/man9/vfs_unmountall.9
new file mode 100644
index 000000000000..e20020328153
--- /dev/null
+++ b/share/man/man9/vfs_unmountall.9
@@ -0,0 +1,47 @@
+.\" Copyright (c) 2001 Chris Costello <chris@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 26, 2001
+.Dt VFS_UNMOUNTALL 9
+.Os
+.Sh NAME
+.Nm vfs_unmountall
+.Nd unmount all file systems
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft void
+.Fn vfs_unmountall "void"
+.Sh DESCRIPTION
+The
+.Nm
+function,
+run only at system shutdown,
+unmounts all mounted file systems
+from most recent to oldest
+in order to avoid handling dependencies.
+.Sh SEE ALSO
+.Xr boot 9
diff --git a/share/man/man9/vfsconf.9 b/share/man/man9/vfsconf.9
new file mode 100644
index 000000000000..f7b160e21313
--- /dev/null
+++ b/share/man/man9/vfsconf.9
@@ -0,0 +1,151 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 21, 2001
+.Dt VFSCONF 9
+.Os
+.Sh NAME
+.Nm vfsconf
+.Nd "vfs configuration information"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fn vfs_register "struct vfsconf *vfc"
+.Ft int
+.Fn vfs_unregister "struct vfsconf *vfc"
+.Ft int
+.Fn vfs_modevent "module_t mod" "int type" "void *data"
+.Sh DESCRIPTION
+Each file system type known to the kernel has a
+.Vt vfsconf
+structure that contains the
+information required to create a new mount of that file systems type.
+.Bd -literal
+struct vfsconf {
+ struct vfsops *vfc_vfsops; /* file system operations vector */
+ char vfc_name[MFSNAMELEN]; /* file system type name */
+ int vfc_typenum; /* historic file system type number */
+ int vfc_refcount; /* number mounted of this type */
+ int vfc_flags; /* permanent flags */
+ struct vfsconf *vfc_next; /* next in list */
+};
+.Ed
+.Pp
+When a new file system is mounted,
+.Xr vfs_mount 9
+does a lookup of the
+.Vt vfsconf
+structure by its name, and if it is not already registered,
+attempts to load a kernel module for it.
+The file system operations for the new mount point are taken from
+.Va vfc_vfsops ,
+and
+.Va mnt_vfc
+in the
+.Vt mount
+structure is made to point directly at the
+.Vt vfsconf
+structure for the
+file system type.
+The file system type number is taken from
+.Va vfc_typenum
+which was assigned in
+.Fn vfs_register ,
+and the mount flags are taken from a mask of
+.Va vfc_flags .
+Each time a file system of a given type is mounted,
+.Va vfc_refcount
+is incremented.
+.Pp
+.Fn vfs_register
+takes a new
+.Vt vfsconf
+structure and adds it to the list of existing file systems.
+If the type has not already been registered, it is initialized by calling the
+.Fn vfs_init
+function in the file system operations vector.
+.Fn vfs_register
+also updates the oid's of any sysctl nodes for this file system type
+to be the same as the newly assigned type number.
+.Pp
+.Fn vfs_unregister
+unlinks
+.Fa vfc
+from the list of registered file system types if there are currently no mounted instances.
+If the
+.Fn vfs_uninit
+function in the file systems initialization vector is defined, it is called.
+.Pp
+.Fn vfs_modevent
+is registered by
+.Fn VFS_SET
+to handle the loading and unloading of file system kernel modules.
+In the case of
+.Dv MOD_LOAD ,
+.Fn vfs_register
+is called.
+In the case of
+.Dv MOD_UNLOAD ,
+.Fn vfs_unregister
+is called.
+.Sh RETURN VALUES
+.Fn vfs_register
+returns 0 if successful; otherwise,
+.Er EEXIST
+is returned indicating that the file system type has already been registered.
+.Pp
+.Fn vfs_unregister
+returns 0 if successful.
+If no
+.Vt vfsconf
+entry can be found matching the name in
+.Fa vfc ,
+.Er EINVAL
+is returned.
+If the reference count of mounted instances of the file system type is not zero,
+.Er EBUSY
+is returned.
+If
+.Fn vfs_uninit
+is called, any errors it returns will be returned by
+.Fn vfs_unregister .
+.Pp
+.Fn vfs_modevent
+returns the result of the call to
+.Fn vfs_register
+or
+.Fn vfs_unregister ,
+whatever the case.
+.Sh SEE ALSO
+.Xr vfs_mount 9 ,
+.Xr vfs_rootmountalloc 9 ,
+.Xr VFS_SET 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vget.9 b/share/man/man9/vget.9
new file mode 100644
index 000000000000..1a7d16cdc378
--- /dev/null
+++ b/share/man/man9/vget.9
@@ -0,0 +1,71 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VGET 9
+.Os
+.Sh NAME
+.Nm vget
+.Nd get a vnode from the free list
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn vget "struct vnode *vp" "int lockflag" "struct thread *td"
+.Sh DESCRIPTION
+Get a vnode from the free list and increment its reference count.
+.Bl -tag -width lockflag
+.It Fa vp
+The vnode to remove from the free list.
+.It Fa lockflag
+If non-zero, the vnode will also be locked.
+.El
+.Pp
+When not in use, vnodes are kept on a free list.
+The vnodes still
+reference valid files but may be reused to refer to a new file at any
+time.
+Often, these vnodes are also held in caches in the system, such
+as the name cache.
+.Pp
+When a vnode which is on the free list is used again, for instance if
+the vnode was found in the name cache as a result of a call to
+.Xr VOP_LOOKUP 9
+then the new user must call
+.Fn vget
+to increment the reference count and remove it from the free list.
+.Sh SEE ALSO
+.Xr vnode 9 ,
+.Xr vput 9 ,
+.Xr vref 9 ,
+.Xr vrele 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/vgone.9 b/share/man/man9/vgone.9
new file mode 100644
index 000000000000..12715e133ddd
--- /dev/null
+++ b/share/man/man9/vgone.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 12, 2010
+.Dt VGONE 9
+.Os
+.Sh NAME
+.Nm vgone
+.Nd "prepare a vnode for reuse"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft void
+.Fn vgone "struct vnode *vp"
+.Sh DESCRIPTION
+The
+.Fn vgone
+function prepares the vnode to be destroyed.
+The preparation includes the cleaning of all file system specific data and
+the removal from its mount point vnode list.
+.Pp
+If the vnode has a
+.Va v_usecount
+of zero, and its
+.Dv VI_DOOMED
+flag is not set, it is moved to the head of the free list
+as in most cases the vnode
+is about to be reused, or its file system is being unmounted.
+.Pp
+The
+.Fn vgone
+function takes an exclusively locked vnode, and returns with the vnode
+exclusively locked.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vhold.9 b/share/man/man9/vhold.9
new file mode 100644
index 000000000000..cb1f35d1df37
--- /dev/null
+++ b/share/man/man9/vhold.9
@@ -0,0 +1,83 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 1, 2007
+.Dt VHOLD 9
+.Os
+.Sh NAME
+.Nm vhold , vdrop , vdropl
+.Nd "acquire/release a hold on a vnode"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft void
+.Fn vhold "struct vnode *vp"
+.Ft void
+.Fn vholdl "struct vnode *vp"
+.Ft void
+.Fn vdrop "struct vnode *vp"
+.Ft void
+.Fn vdropl "struct vnode *vp"
+.Sh DESCRIPTION
+The
+.Fn vhold
+and
+.Fn vholdl
+functions increment the
+.Va v_holdcnt
+of the given vnode.
+If the vnode has already been added to the free list and is still referenced,
+it will be removed.
+.Pp
+The
+.Fn vdrop
+and
+.Fn vdropl
+functions decrement the
+.Va v_holdcnt
+of the vnode.
+If the holdcount is less than or equal to zero prior to calling
+.Fn vdrop
+or
+.Fn vdropl ,
+the system will panic.
+If the vnode is no longer referenced, it will be freed.
+.Pp
+.Fn vhold
+and
+.Fn vdrop
+lock the vnode interlock while
+.Fn vholdl
+and
+.Fn vdropl
+expect the interlock to already be held.
+.Sh SEE ALSO
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vinvalbuf.9 b/share/man/man9/vinvalbuf.9
new file mode 100644
index 000000000000..5180153d0d5b
--- /dev/null
+++ b/share/man/man9/vinvalbuf.9
@@ -0,0 +1,119 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 20, 2008
+.Dt VINVALBUF 9
+.Os
+.Sh NAME
+.Nm vinvalbuf
+.Nd "flushes and invalidates all buffers associated with a vnode"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" "int slpflag" "int slptimeo"
+.Sh DESCRIPTION
+The
+.Fn vinvalbuf
+function invalidates all of the buffers associated with the given vnode.
+This includes buffers on the clean list and the dirty list.
+If the
+.Dv V_SAVE
+flag is specified then the buffers on the dirty list are synced prior to being
+released.
+If there is a VM Object associated with the vnode, it is removed.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa spltimeo"
+.It Fa vp
+A pointer to the vnode whose buffers will be invalidated.
+.It Fa flags
+The only supported flag is
+.Dv V_SAVE
+and it indicates that dirty buffers should be synced with the disk.
+.It Fa cred
+The user credentials that are used to
+.Xr VOP_FSYNC 9
+buffers if
+.Dv V_SAVE
+is set.
+.It Fa slpflag
+The slp flag that will be used in the priority of any sleeps in the function.
+.It Fa slptimeo
+The timeout for any sleeps in the function.
+.El
+.Sh LOCKS
+The vnode is assumed to be locked prior to the call and remains locked upon return.
+.Pp
+.Va Giant
+must be held by prior to the call and remains locked upon return.
+.Sh RETURN VALUES
+A 0 value is returned on success.
+.Sh PSEUDOCODE
+.Bd -literal -offset indent
+vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+error = vinvalbuf(devvp, V_SAVE, cred, 0, 0);
+VOP_UNLOCK(devvp, 0);
+if (error)
+ return (error);
+.Ed
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ENOSPC
+The file system is full.
+(With
+.Dv V_SAVE )
+.It Bq Er EDQUOT
+Disc quota exceeded.
+(With
+.Dv V_SAVE )
+.It Bq Er EWOULDBLOCK
+Sleep operation timed out.
+(See
+.Fa slptimeo )
+.It Bq Er ERESTART
+A signal needs to be delivered and the system call should be restarted.
+(With
+.Dv PCATCH
+set in
+.Fa slpflag )
+.It Bq Er EINTR
+The system has been interrupted by a signal.
+(With
+.Dv PCATCH
+set in
+.Fa slpflag )
+.El
+.Sh SEE ALSO
+.Xr brelse 9 ,
+.Xr bremfree 9 ,
+.Xr tsleep 9 ,
+.Xr VOP_FSYNC 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_fault_prefault.9 b/share/man/man9/vm_fault_prefault.9
new file mode 100644
index 000000000000..dcc7e7abfa37
--- /dev/null
+++ b/share/man/man9/vm_fault_prefault.9
@@ -0,0 +1,72 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 21, 2003
+.Dt VM_FAULT_PREFAULT 9
+.Os
+.Sh NAME
+.Nm vm_fault_prefault
+.Nd cluster page faults into a process's address space
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/pmap.h
+.Ft void
+.Fn vm_fault_prefault "pmap_t pmap" "vm_offset_t addra" "vm_map_entry_t entry"
+.Sh DESCRIPTION
+The
+.Fn vm_fault_prefault
+function provides a means of clustering pagefaults into a process's
+address space.
+It operates upon the physical map
+.Fa pmap .
+The
+.Fa entry
+argument specifies the entry to be prefaulted; the
+.Fa addra
+argument specifies the beginning of the mapping in the process's virtual
+address space.
+.Pp
+It is typically called by
+.Fn vm_fault
+after the first page fault.
+It benefits the
+.Xr execve 2
+system call by eliminating repetitive calls to
+.Fn vm_fault ,
+which would otherwise be made to bring the process's executable pages
+into physical memory.
+.Sh IMPLEMENTATION NOTES
+This is a machine-independent function which calls the machine-dependent
+.Xr pmap_is_prefaultable 9
+helper function to determine if a page may be prefaulted into physical memory.
+.Sh SEE ALSO
+.Xr execve 2 ,
+.Xr pmap_is_prefaultable 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map.9 b/share/man/man9/vm_map.9
new file mode 100644
index 000000000000..f45be0b055e6
--- /dev/null
+++ b/share/man/man9/vm_map.9
@@ -0,0 +1,350 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2011
+.Dt VM_MAP 9
+.Os
+.Sh NAME
+.Nm vm_map
+.Nd virtual address space portion of virtual memory subsystem
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Sh DESCRIPTION
+The
+.Nm
+subsystem is used to manage virtual address spaces.
+This section describes the main data structures used within the code.
+.Pp
+The
+.Vt "struct vm_map"
+is a generic representation of an address space.
+This address space may belong to a user process or the kernel.
+The kernel actually uses several maps, which are maintained as
+subordinate maps, created using the
+.Xr vm_map_submap 9
+function.
+.Bd -literal -offset indent
+struct vm_map {
+ struct vm_map_entry header;
+ struct sx lock;
+ struct mtx system_mtx;
+ int nentries;
+ vm_size_t size;
+ u_int timestamp;
+ u_char needs_wakeup;
+ u_char system_map;
+ vm_flags_t flags;
+ vm_map_entry_t root;
+ pmap_t pmap;
+#define min_offset header.start
+#define max_offset header.end
+};
+.Ed
+.Pp
+The fields of
+.Vt struct vm_map
+are as follows:
+.Bl -tag -width ".Va needs_wakeup"
+.It Va header
+Head node of a circular, doubly linked list of
+.Vt struct vm_map_entry
+objects.
+Each object defines a particular region within this map's address space.
+.It Va lock
+Used to serialize access to the structure.
+.It Va system_mtx
+A mutex which is used if the map is a system map.
+.It Va nentries
+A count of the members in use within the circular map entry list.
+.It Va size
+Specifies the size of the virtual address space.
+.It Va timestamp
+Used to determine if the map has changed since its last access.
+.It Va needs_wakeup
+Indicates if a thread is waiting for an allocation within the map.
+Used only by system maps.
+.It Va system_map
+Set to TRUE to indicate that map is a system map; otherwise, it belongs
+to a user process.
+.It Va flags
+Map flags, described below.
+.It Va root
+Root node of a binary search tree used for fast lookup of map entries.
+.It Va pmap
+Pointer to the underlying physical map with which this virtual map
+is associated.
+.It Va min_offset
+The minimum
+.Vt vm_offset_t
+in this map.
+Programs should never use
+.Va header.start
+or
+.Va header.end
+directly, use
+.Va min_offset
+and
+.Va max_offset
+instead.
+.It Va max_offset
+The maximum
+.Vt vm_offset_t
+in this map.
+.El
+.Pp
+There is one possible map flag:
+.Bl -tag -width ".Dv MAP_PREFAULT_MADVISE"
+.It Dv MAP_WIREFUTURE
+Wire all future pages in this map.
+.El
+.Pp
+The following flags can be passed to
+.Xr vm_map_find 9
+and
+.Xr vm_map_insert 9
+to specify the copy-on-write properties of regions within the map:
+.Bl -tag -width ".Dv MAP_PREFAULT_MADVISE"
+.It Dv MAP_COPY_ON_WRITE
+The mapping is copy-on-write.
+.It Dv MAP_NOFAULT
+The mapping should not generate page faults.
+.It Dv MAP_PREFAULT
+The mapping should be prefaulted into physical memory.
+.It Dv MAP_PREFAULT_PARTIAL
+The mapping should be partially prefaulted into physical memory.
+.It Dv MAP_DISABLE_SYNCER
+Do not periodically flush dirty pages; only flush them when absolutely
+necessary.
+.It Dv MAP_DISABLE_COREDUMP
+Do not include the mapping in a core dump.
+.It Dv MAP_PREFAULT_MADVISE
+Specify that the request is from a user process calling
+.Xr madvise 2 .
+.It Dv MAP_ACC_CHARGED
+Region is already charged to the requestor by some means.
+.It Dv MAP_ACC_NO_CHARGE
+Do not charge for allocated region.
+.El
+.Pp
+The
+.Vt struct vm_map_entry
+is a generic representation of a region.
+The region managed by each entry is associated with a
+.Vt union vm_map_object ,
+described below.
+.Bd -literal -offset indent
+struct vm_map_entry {
+ struct vm_map_entry *prev;
+ struct vm_map_entry *next;
+ struct vm_map_entry *left;
+ struct vm_map_entry *right;
+ vm_offset_t start;
+ vm_offset_t end;
+ vm_offset_t avail_ssize;
+ vm_size_t adj_free;
+ vm_size_t max_free;
+ union vm_map_object object;
+ vm_ooffset_t offset;
+ vm_eflags_t eflags;
+ /* Only in task maps: */
+ vm_prot_t protection;
+ vm_prot_t max_protection;
+ vm_inherit_t inheritance;
+ int wired_count;
+ vm_pindex_t lastr;
+};
+.Ed
+.Pp
+The fields of
+.Vt struct vm_map_entry
+are as follows:
+.Bl -tag -width ".Va avail_ssize"
+.It Va prev
+Pointer to the previous node in a doubly-linked, circular list.
+.It Va next
+Pointer to the next node in a doubly-linked, circular list.
+.It Va left
+Pointer to the left node in a binary search tree.
+.It Va right
+Pointer to the right node in a binary search tree.
+.It Va start
+Lower address bound of this entry's region.
+.It Va end
+Upper address bound of this entry's region.
+.It Va avail_ssize
+If the entry is for a process stack, specifies how much the entry can grow.
+.It Va adj_free
+The amount of free, unmapped address space adjacent to and immediately
+following this map entry.
+.It Va max_free
+The maximum amount of contiguous free space in this map entry's subtree.
+.It Va object
+Pointer to the
+.Vt struct vm_map_object
+with which this entry is associated.
+.It Va offset
+Offset within the
+.Va object
+which is mapped from
+.Va start
+onwards.
+.It Va eflags
+Flags applied to this entry, described below.
+.El
+.Pp
+The following five members are only valid for entries forming part of
+a user process's address space:
+.Bl -tag -width ".Va max_protection"
+.It Va protection
+Memory protection bits applied to this region.
+.It Va max_protection
+Mask for the memory protection bits which may be actually be applied to
+this region.
+.It Va inheritance
+Contains flags which specify how this entry should be treated
+during fork processing.
+.It Va wired_count
+Count of how many times this entry has been wired into physical memory.
+.It Va lastr
+Contains the address of the last read which caused a page fault.
+.El
+.Pp
+The following flags may be applied to each entry, by specifying them
+as a mask within the
+.Va eflags
+member:
+.Bl -tag -width ".Dv MAP_ENTRY_BEHAV_SEQUENTIAL"
+.It Dv MAP_ENTRY_NOSYNC
+The system should not flush the data associated with this map
+periodically, but only when it needs to.
+.It Dv MAP_ENTRY_IS_SUB_MAP
+If set, then the
+.Va object
+member specifies a subordinate map.
+.It Dv MAP_ENTRY_COW
+Indicate that this is a copy-on-write region.
+.It Dv MAP_ENTRY_NEEDS_COPY
+Indicate that a copy-on-write region needs to be copied.
+.It Dv MAP_ENTRY_NOFAULT
+Specifies that accesses within this region should never cause a page fault.
+If a page fault occurs within this region, the system will panic.
+.It Dv MAP_ENTRY_USER_WIRED
+Indicate that this region was wired on behalf of a user process.
+.It Dv MAP_ENTRY_BEHAV_NORMAL
+The system should use the default paging behaviour for this region.
+.It Dv MAP_ENTRY_BEHAV_SEQUENTIAL
+The system should depress the priority of pages immediately preceding
+each page within this region when faulted in.
+.It Dv MAP_ENTRY_BEHAV_RANDOM
+Is a hint that pages within this region will be accessed randomly,
+and that prefetching is likely not advantageous.
+.It Dv MAP_ENTRY_IN_TRANSITION
+Indicate that wiring or unwiring of an entry is in progress, and that
+other kernel threads should not attempt to modify fields in the structure.
+.It Dv MAP_ENTRY_NEEDS_WAKEUP
+Indicate that there are kernel threads waiting for this region to become
+available.
+.It Dv MAP_ENTRY_NOCOREDUMP
+The region should not be included in a core dump.
+.El
+.Pp
+The
+.Va inheritance
+member has type
+.Vt vm_inherit_t .
+This governs the inheritance behaviour for a map entry during fork processing.
+The following values are defined for
+.Vt vm_inherit_t :
+.Bl -tag -width ".Dv VM_INHERIT_DEFAULT"
+.It Dv VM_INHERIT_SHARE
+The object associated with the entry should be cloned and shared
+with the new map.
+A new
+.Vt struct vm_object
+will be created if necessary.
+.It Dv VM_INHERIT_COPY
+The object associated with the entry should be copied to the new map.
+.It Dv VM_INHERIT_NONE
+The entry should not be copied to the new map.
+.It Dv VM_INHERIT_DEFAULT
+Specifies the default behaviour,
+.Dv VM_INHERIT_COPY .
+.El
+.Pp
+The
+.Vt union vm_map_object
+is used to specify the structure which a
+.Vt struct vm_map_entry
+is associated with.
+.Pp
+The fields of
+.Vt union vm_map_object
+are as follows:
+.Bd -literal -offset indent
+union vm_map_object {
+ struct vm_object *vm_object;
+ struct vm_map *sub_map;
+};
+.Ed
+.Pp
+Normally, the
+.Va sub_map
+member is only used by system maps to indicate that a memory range
+is managed by a subordinate system map.
+Within a user process map, each
+.Vt struct vm_map_entry
+is backed by a
+.Vt struct vm_object .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr vm_map_check_protection 9 ,
+.Xr vm_map_create 9 ,
+.Xr vm_map_delete 9 ,
+.Xr vm_map_entry_resize_free 9 ,
+.Xr vm_map_find 9 ,
+.Xr vm_map_findspace 9 ,
+.Xr vm_map_inherit 9 ,
+.Xr vm_map_init 9 ,
+.Xr vm_map_insert 9 ,
+.Xr vm_map_lock 9 ,
+.Xr vm_map_lookup 9 ,
+.Xr vm_map_madvise 9 ,
+.Xr vm_map_max 9 ,
+.Xr vm_map_min 9 ,
+.Xr vm_map_pmap 9 ,
+.Xr vm_map_protect 9 ,
+.Xr vm_map_remove 9 ,
+.Xr vm_map_simplify_entry 9 ,
+.Xr vm_map_stack 9 ,
+.Xr vm_map_submap 9 ,
+.Xr vm_map_sync 9 ,
+.Xr vm_map_wire 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_check_protection.9 b/share/man/man9/vm_map_check_protection.9
new file mode 100644
index 000000000000..abaf6d0301e6
--- /dev/null
+++ b/share/man/man9/vm_map_check_protection.9
@@ -0,0 +1,70 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_CHECK_PROTECTION 9
+.Os
+.Sh NAME
+.Nm vm_map_check_protection
+.Nd check memory protection for a vm_map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft boolean_t
+.Fo vm_map_check_protection
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "vm_prot_t protection"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_check_protection
+function asserts that the target
+.Fa map
+allows the specified privilege
+.Fa protection
+over the entire address range from
+.Fa start
+to
+.Fa end .
+The region MUST be contiguous; no holes are allowed.
+.Sh IMPLEMENTATION NOTES
+This code does not and SHOULD not check whether the contents of
+the region are accessible.
+For example, a small file may be mapped into an address space which
+is significantly larger in size.
+.Sh RETURN VALUES
+The
+.Fn vm_map_check_protection
+function returns TRUE if the privilege is allowed; if it is not allowed,
+or if any other error occurred, the value FALSE is returned.
+.Sh SEE ALSO
+.Xr munmap 2 ,
+.Xr vm_map 9 ,
+.Xr vm_map_protect 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_create.9 b/share/man/man9/vm_map_create.9
new file mode 100644
index 000000000000..0574f396f82b
--- /dev/null
+++ b/share/man/man9/vm_map_create.9
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_CREATE 9
+.Os
+.Sh NAME
+.Nm vm_map_create
+.Nd create a new vm_map structure
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft vm_map_t
+.Fn vm_map_create "pmap_t pmap" "vm_offset_t min" "vm_offset_t max"
+.Sh DESCRIPTION
+The
+.Fn vm_map_create
+function creates and returns a new, empty map structure, associated
+with the physical map
+.Fa pmap ,
+and with the
+upper and lower address bounds specified by
+.Fa max
+and
+.Fa min
+respectively.
+.Sh IMPLEMENTATION NOTES
+The kernel's zone allocator is used to allocate the map.
+.Sh RETURN VALUES
+The
+.Fn vm_map_create
+function returns a pointer to the newly allocated map if successful.
+Otherwise, it returns
+.Dv NULL .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr vm_map 9 ,
+.Xr vm_map_init 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_delete.9 b/share/man/man9/vm_map_delete.9
new file mode 100644
index 000000000000..e884f366aaaf
--- /dev/null
+++ b/share/man/man9/vm_map_delete.9
@@ -0,0 +1,68 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_DELETE 9
+.Os
+.Sh NAME
+.Nm vm_map_delete
+.Nd deallocate an address range from a map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fn vm_map_delete "vm_map_t map" "vm_offset_t start" "vm_offset_t end"
+.Sh DESCRIPTION
+The
+.Fn vm_map_delete
+function deallocates the address range bounded by
+.Fa start
+and
+.Fa end
+from the
+.Fa map .
+.Sh IMPLEMENTATION NOTES
+This function is for
+.Fx
+VM internal use only.
+The
+.Xr vm_map_remove 9
+function should be called by
+.Fx
+VM consumers instead.
+.Sh RETURN VALUES
+The
+.Fn vm_map_delete
+function always returns
+.Dv KERN_SUCCESS .
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_remove 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_entry_resize_free.9 b/share/man/man9/vm_map_entry_resize_free.9
new file mode 100644
index 000000000000..eaaec650fb60
--- /dev/null
+++ b/share/man/man9/vm_map_entry_resize_free.9
@@ -0,0 +1,244 @@
+.\"
+.\" Copyright (c) 2004 Mark W. Krentel <krentel@dreamscape.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 17, 2004
+.Dt VM_MAP_ENTRY_RESIZE_FREE 9
+.Os
+.Sh NAME
+.Nm vm_map_entry_resize_free
+.Nd "vm map free space algorithm"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft void
+.Fn vm_map_entry_resize_free "vm_map_t map" "vm_map_entry_t entry"
+.Sh DESCRIPTION
+This manual page describes the
+.Vt vm_map_entry
+fields used in the VM map free space algorithm, how to maintain
+consistency of these variables, and the
+.Fn vm_map_entry_resize_free
+function.
+.Pp
+VM map entries are organized as both a doubly-linked list
+.Va ( prev
+and
+.Va next
+pointers) and as a binary search tree
+.Va ( left
+and
+.Va right
+pointers).
+The search tree is organized as a Sleator and Tarjan splay tree,
+also known as a
+.Dq "self-adjusting tree" .
+.Bd -literal -offset indent
+struct vm_map_entry {
+ struct vm_map_entry *prev;
+ struct vm_map_entry *next;
+ struct vm_map_entry *left;
+ struct vm_map_entry *right;
+ vm_offset_t start;
+ vm_offset_t end;
+ vm_offset_t avail_ssize;
+ vm_size_t adj_free;
+ vm_size_t max_free;
+ ...
+};
+.Ed
+.Pp
+The free space algorithm adds two fields to
+.Vt "struct vm_map_entry" :
+.Va adj_free
+and
+.Va max_free .
+The
+.Va adj_free
+field
+is the amount of free address space adjacent to and immediately
+following (higher address) the map entry.
+This field is unused in the map header.
+Note that
+.Va adj_free
+depends on the linked list, not the splay tree and that
+.Va adj_free
+can be computed as:
+.Bd -literal -offset indent
+entry->adj_free = (entry->next == &map->header ?
+ map->max_offset : entry->next->start) - entry->end;
+.Ed
+.Pp
+The
+.Va max_free
+field
+is the maximum amount of contiguous free space in the entry's subtree.
+Note that
+.Va max_free
+depends on the splay tree, not the linked list and that
+.Va max_free
+is computed by taking the maximum of its own
+.Va adj_free
+and the
+.Va max_free
+of its left and right subtrees.
+Again,
+.Va max_free
+is unused in the map header.
+.Pp
+These fields allow for an
+.Fn O "log n"
+implementation of
+.Fn vm_map_findspace .
+Using
+.Va max_free ,
+we can immediately test for a sufficiently large free region
+in an entire subtree.
+This makes it possible to find a first-fit free region of a given size
+in one pass down the tree, so
+.Fn O "log n"
+amortized using splay trees.
+.Pp
+When a free region changes size, we must update
+.Va adj_free
+and
+.Va max_free
+in the preceding map entry and propagate
+.Va max_free
+up the tree.
+This is handled in
+.Fn vm_map_entry_link
+and
+.Fn vm_map_entry_unlink
+for the cases of inserting and deleting an entry.
+Note that
+.Fn vm_map_entry_link
+updates both the new entry and the previous entry, and that
+.Fn vm_map_entry_unlink
+updates the previous entry.
+Also note that
+.Va max_free
+is not actually propagated up the tree.
+Instead, that entry is first splayed to the root and
+then the change is made there.
+This is a common technique in splay trees and is also
+how map entries are linked and unlinked into the tree.
+.Pp
+The
+.Fn vm_map_entry_resize_free
+function updates the free space variables in the given
+.Fa entry
+and propagates those values up the tree.
+This function should be called whenever a map entry is resized
+in-place, that is, by modifying its
+.Va start
+or
+.Va end
+values.
+Note that if you change
+.Va end ,
+then you should resize that entry, but if you change
+.Va start ,
+then you should resize the previous entry.
+The map must be locked before calling this function,
+and again, propagating
+.Va max_free
+is performed by splaying that entry to the root.
+.Sh EXAMPLES
+Consider adding a map entry with
+.Fn vm_map_insert .
+.Bd -literal -offset indent
+ret = vm_map_insert(map, object, offset, start, end, prot,
+ max_prot, cow);
+.Ed
+.Pp
+In this case, no further action is required to maintain
+consistency of the free space variables.
+The
+.Fn vm_map_insert
+function calls
+.Fn vm_map_entry_link
+which updates both the new entry and the previous entry.
+The same would be true for
+.Fn vm_map_delete
+and for calling
+.Fn vm_map_entry_link
+or
+.Fn vm_map_entry_unlink
+directly.
+.Pp
+Now consider resizing an entry in-place without a call to
+.Fn vm_map_entry_link
+or
+.Fn vm_map_entry_unlink .
+.Bd -literal -offset indent
+entry->start = new_start;
+if (entry->prev != &map->header)
+ vm_map_entry_resize_free(map, entry->prev);
+.Ed
+.Pp
+In this case, resetting
+.Va start
+changes the amount of free space following the previous entry,
+so we use
+.Fn vm_map_entry_resize_free
+to update the previous entry.
+.Pp
+Finally, suppose we change an entry's
+.Va end
+address.
+.Bd -literal -offset indent
+entry->end = new_end;
+vm_map_entry_resize_free(map, entry);
+.Ed
+.Pp
+Here, we call
+.Fn vm_map_entry_resize_free
+on the entry itself.
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_findspace 9
+.Rs
+.%A Daniel D. Sleator
+.%A Robert E. Tarjan
+.%T Self-Adjusting Binary Search Trees
+.%J JACM
+.%V vol. 32(3)
+.%P pp. 652-686
+.%D July 1985
+.Re
+.Sh HISTORY
+Splay trees were added to the VM map in
+.Fx 5.0 ,
+and the
+.Fn O "log n"
+tree-based free space algorithm was added in
+.Fx 5.3 .
+.Sh AUTHORS
+The tree-based free space algorithm and this manual page were written by
+.An Mark W. Krentel
+.Aq krentel@dreamscape.com .
diff --git a/share/man/man9/vm_map_find.9 b/share/man/man9/vm_map_find.9
new file mode 100644
index 000000000000..1d21baee177e
--- /dev/null
+++ b/share/man/man9/vm_map_find.9
@@ -0,0 +1,127 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 10, 2008
+.Dt VM_MAP_FIND 9
+.Os
+.Sh NAME
+.Nm vm_map_find
+.Nd find a free region within a map, and optionally map a vm_object
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_find
+.Fa "vm_map_t map" "vm_object_t object" "vm_ooffset_t offset"
+.Fa "vm_offset_t *addr" "vm_size_t length" "int find_space"
+.Fa "vm_prot_t prot" "vm_prot_t max" "int cow"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_find
+function attempts to find a free region in the target
+.Fa map ,
+with the given
+.Fa length ,
+and will also optionally create a mapping of
+.Fa object .
+.Pp
+The arguments
+.Fa offset ,
+.Fa prot ,
+.Fa max ,
+and
+.Fa cow
+are passed unchanged to
+.Xr vm_map_insert 9
+when creating the mapping, if and only if a free region is found.
+.Pp
+If
+.Fa object
+is
+.Pf non- Dv NULL ,
+the reference count on the object must be incremented
+by the caller before calling this function to account for the new entry.
+.Pp
+If
+.Fa find_space
+is either
+.Dv VMFS_ALIGNED_SPACE
+or
+.Dv VMFS_ANY_SPACE ,
+the function will call
+.Xr vm_map_findspace 9
+to discover a free region.
+Moreover, if
+.Fa find_space
+is
+.Dv VMFS_ALIGNED_SPACE ,
+the address of the free region will be optimized for the use of superpages.
+Otherwise, if
+.Fa find_space
+is
+.Dv VMFS_NO_SPACE ,
+.Xr vm_map_insert 9
+is called with the given address,
+.Fa addr .
+.Sh IMPLEMENTATION NOTES
+This function acquires a lock on
+.Fa map
+by calling
+.Xr vm_map_lock 9 ,
+and holds it until the function returns.
+.Pp
+The search for a free region is defined to be first-fit, from the address
+.Fa addr
+onwards.
+.Sh RETURN VALUES
+The
+.Fn vm_map_find
+function returns
+.Dv KERN_SUCCESS
+if the mapping was successfully created.
+If space could not be found or
+.Fa find_space
+was
+.Dv VMFS_NO_SPACE
+and the given address,
+.Fa addr ,
+was already mapped,
+.Dv KERN_NO_SPACE
+will be returned.
+If the discovered range turned out to be bogus,
+.Dv KERN_INVALID_ADDRESS
+will be returned.
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_findspace 9 ,
+.Xr vm_map_insert 9 ,
+.Xr vm_map_lock 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_findspace.9 b/share/man/man9/vm_map_findspace.9
new file mode 100644
index 000000000000..a12e78961574
--- /dev/null
+++ b/share/man/man9/vm_map_findspace.9
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_FINDSPACE 9
+.Os
+.Sh NAME
+.Nm vm_map_findspace
+.Nd find a free region within a map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_findspace
+.Fa "vm_map_t map" "vm_offset_t start" "vm_size_t length" "vm_offset_t *addr"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_findspace
+function attempts to find a region with sufficient space in the
+.Fa map
+for an object of size
+.Fa length
+at the address
+.Fa addr .
+.Sh IMPLEMENTATION NOTES
+It is the caller's responsibility to obtain a lock on the
+.Fa map
+using
+.Xr vm_map_lock 9
+before calling this function.
+.Pp
+This routine may call
+.Xr pmap_growkernel 9
+to grow the kernel's address space, if and only if the mapping is being
+made within the kernel address space, and if insufficient space remains
+in the
+.Va kernel_map .
+.Sh RETURN VALUES
+The
+.Fn vm_map_findspace
+function returns the value 0 if successful, and
+.Fa *addr
+will contain the first virtual address in the found region;
+otherwise, the value 1 is returned.
+.Sh SEE ALSO
+.Xr pmap_growkernel 9 ,
+.Xr vm_map 9 ,
+.Xr vm_map_entry_resize_free 9 ,
+.Xr vm_map_lock 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_inherit.9 b/share/man/man9/vm_map_inherit.9
new file mode 100644
index 000000000000..fb5a9d5ff37b
--- /dev/null
+++ b/share/man/man9/vm_map_inherit.9
@@ -0,0 +1,85 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_INHERIT 9
+.Os
+.Sh NAME
+.Nm vm_map_inherit
+.Nd set fork inheritance flags for a range within a map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_inherit
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end"
+.Fa "vm_inherit_t new_inheritance"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_inherit
+function sets the inheritance flags for the range
+.Fa start
+to
+.Fa end
+within the target
+.Fa map
+to the value
+.Fa new_inheritance .
+.Pp
+The
+.Fa new_inheritance
+flag must have one of the values
+.Dv VM_INHERIT_NONE ,
+.Dv VM_INHERIT_COPY ,
+or
+.Dv VM_INHERIT_SHARE .
+This affects how the map will be shared with child maps when the
+associated process forks.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn vm_map_inherit
+function obtains a lock on the
+.Fa map
+using
+.Xr vm_map_lock 9
+for the duration of the function.
+.Sh RETURN VALUES
+The
+.Fn vm_map_inherit
+function returns
+.Dv KERN_SUCCESS
+if the inheritance flags could be set.
+Otherwise, if the provided flags were invalid,
+.Dv KERN_INVALID_ARGUMENT
+will be returned.
+.Sh SEE ALSO
+.Xr fork 2
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_init.9 b/share/man/man9/vm_map_init.9
new file mode 100644
index 000000000000..c65f611fbb8d
--- /dev/null
+++ b/share/man/man9/vm_map_init.9
@@ -0,0 +1,59 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_INIT 9
+.Os
+.Sh NAME
+.Nm vm_map_init
+.Nd initialize a vm_map structure for process zero
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft void
+.Fn vm_map_init "vm_map_t map" "vm_offset_t min" "vm_offset_t max"
+.Sh DESCRIPTION
+The
+.Fn vm_map_init
+function initializes the system map
+.Fa map
+by setting its upper and lower address bounds to
+.Fa max
+and
+.Fa min
+respectively.
+.Pp
+It also initializes the system map mutex.
+.Sh IMPLEMENTATION NOTES
+This routine is for internal use only.
+It is called during early system initialization.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_insert.9 b/share/man/man9/vm_map_insert.9
new file mode 100644
index 000000000000..3a6a51fd0784
--- /dev/null
+++ b/share/man/man9/vm_map_insert.9
@@ -0,0 +1,96 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_INSERT 9
+.Os
+.Sh NAME
+.Nm vm_map_insert
+.Nd insert an object into a map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_insert
+.Fa "vm_map_t map" "vm_object_t object" "vm_ooffset_t offset"
+.Fa "vm_offset_t start" "vm_offset_t end" "vm_prot_t prot"
+.Fa "vm_prot_t max" "int cow"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_insert
+function inserts a mapping for the entire vm_object
+.Fa object
+into the target map
+.Fa map .
+.Pp
+The
+.Fa offset
+argument specifies the offset into the
+.Fa object
+at which to begin mapping.
+The object's size should match that of the specified address range.
+.Pp
+The
+.Fa start
+and
+.Fa end
+arguments specify the bounds of the mapped object's window in the
+address space of
+.Fa map .
+.Pp
+The
+.Fa cow
+argument specifies the flags which should be propagated to the new entry,
+for example, to indicate that this is a copy-on-write mapping.
+.Sh IMPLEMENTATION NOTES
+This function implicitly creates a new
+.Vt vm_map_entry
+by calling the internal function
+.Fn vm_map_entry_create .
+This function may use the
+.Va Giant
+lock to ensure that only a single thread is present in the function.
+.Sh RETURN VALUES
+The
+.Fn vm_map_insert
+function returns
+.Dv KERN_SUCCESS
+if the mapping could be made successfully.
+.Pp
+Otherwise,
+.Dv KERN_INVALID_ADDRESS
+will be returned if the start of the range could not be found, or
+.Dv KERN_NO_SPACE
+if the range was found to be part of an existing entry or if it
+overlaps the end of the map.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_lock.9 b/share/man/man9/vm_map_lock.9
new file mode 100644
index 000000000000..709570926603
--- /dev/null
+++ b/share/man/man9/vm_map_lock.9
@@ -0,0 +1,113 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_LOCK 9
+.Os
+.Sh NAME
+.Nm vm_map_lock ,
+.Nm vm_map_unlock ,
+.Nm vm_map_lock_read ,
+.Nm vm_map_unlock_read ,
+.Nm vm_map_trylock ,
+.Nm vm_map_trylock_read ,
+.Nm vm_map_lock_upgrade ,
+.Nm vm_map_lock_downgrade
+.Nd vm_map locking macros
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft void
+.Fn vm_map_lock "vm_map_t map"
+.Ft void
+.Fn vm_map_unlock "vm_map_t map"
+.Ft void
+.Fn vm_map_lock_read "vm_map_t map"
+.Ft void
+.Fn vm_map_unlock_read "vm_map_t map"
+.Ft int
+.Fn vm_map_trylock "vm_map_t map"
+.Ft int
+.Fn vm_map_trylock_read "vm_map_t map"
+.Ft int
+.Fn vm_map_lock_upgrade "vm_map_t map"
+.Ft int
+.Fn vm_map_lock_downgrade "vm_map_t map"
+.Sh DESCRIPTION
+The
+.Fn vm_map_lock
+macro obtains an exclusive lock on
+.Fa map .
+.Pp
+The
+.Fn vm_map_unlock
+macro releases an exclusive lock on
+.Fa map .
+.Pp
+The
+.Fn vm_map_lock_read
+macro obtains a read-lock on
+.Fa map .
+.Pp
+The
+.Fn vm_map_unlock_read
+macro releases a read-lock on
+.Fa map .
+.Pp
+The
+.Fn vm_map_trylock
+macro attempts to obtain an exclusive lock on
+.Fa map .
+It returns FALSE if the lock cannot be immediately acquired;
+otherwise return TRUE with the lock acquired.
+.Pp
+The
+.Fn vm_map_trylock_read
+macro attempts to obtain a read-lock on
+.Fa map .
+It returns FALSE if the lock cannot be immediately acquired;
+otherwise return TRUE with the lock acquired.
+.Pp
+The
+.Fn vm_map_lock_upgrade
+macro attempts to atomically upgrade a read-lock on
+.Fa map
+to an exclusive lock.
+.Pp
+The
+.Fn vm_map_lock_downgrade
+macro attempts to downgrade an exclusive lock on
+.Fa map
+to a read-lock.
+.Sh IMPLEMENTATION NOTES
+Currently, all of the locking macros implement their locks as sleep locks.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_lookup.9 b/share/man/man9/vm_map_lookup.9
new file mode 100644
index 000000000000..759b5f6673fd
--- /dev/null
+++ b/share/man/man9/vm_map_lookup.9
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_LOOKUP 9
+.Os
+.Sh NAME
+.Nm vm_map_lookup ,
+.Nm vm_map_lookup_done
+.Nd lookup the vm_object backing a given virtual region
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_lookup
+.Fa "vm_map_t *var_map" "vm_offset_t vaddr" "vm_prot_t fault_type"
+.Fa "vm_map_entry_t *out_entry" "vm_object_t *object" "vm_pindex_t *pindex"
+.Fa "vm_prot_t *out_prot" "boolean_t *wired"
+.Fc
+.Ft void
+.Fn vm_map_lookup_done "vm_map_t map" "vm_map_entry_t entry"
+.Sh DESCRIPTION
+The
+.Fn vm_map_lookup
+function attempts to find the
+.Vt vm_object ,
+page index and protection, for the given virtual address
+.Fa vaddr ,
+in the map
+.Fa var_map ,
+assuming a page fault of the type
+.Fa fault_type
+had occurred.
+.Pp
+Return values are guaranteed until
+.Fn vm_map_lookup_done
+is called to release the lock.
+.Sh IMPLEMENTATION NOTES
+The function
+.Fn vm_map_lookup
+acquires a read-lock on the map
+.Fa *var_map ,
+but does not release it.
+The caller should invoke
+.Fn vm_map_lookup_done
+in order to release this lock.
+.Sh RETURN VALUES
+The
+.Fn vm_map_lookup
+function returns
+.Dv KERN_SUCCESS ,
+and sets the
+.Fa *object ,
+.Fa *pindex ,
+.Fa *out_prot ,
+and
+.Fa *out_entry
+arguments appropriately for the hypothetical page fault.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_madvise.9 b/share/man/man9/vm_map_madvise.9
new file mode 100644
index 000000000000..97ba6040de8d
--- /dev/null
+++ b/share/man/man9/vm_map_madvise.9
@@ -0,0 +1,77 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_MADVISE 9
+.Os
+.Sh NAME
+.Nm vm_map_madvise
+.Nd apply advice about use of memory to map entries
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_madvise
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int behav"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_madvise
+function applies the flags
+.Fa behav
+to the entries within
+.Fa map
+between
+.Fa start
+and
+.Fa end .
+.Pp
+Advisories are classified as either those affecting the
+.Vt vm_map_entry
+structure, or those affecting the underlying objects.
+.Pp
+The
+.Fn vm_map_madvise
+function is used by the
+.Xr madvise 2
+system call.
+.Sh RETURN VALUES
+The
+.Fn vm_map_madvise
+function returns 0 if successful.
+If the
+.Fa behav
+argument was not recognised,
+.Dv KERN_INVALID_ARGUMENT
+is returned.
+.Sh SEE ALSO
+.Xr madvise 2 ,
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_max.9 b/share/man/man9/vm_map_max.9
new file mode 100644
index 000000000000..e694983ba6aa
--- /dev/null
+++ b/share/man/man9/vm_map_max.9
@@ -0,0 +1,66 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_MAX 9
+.Os
+.Sh NAME
+.Nm vm_map_max ,
+.Nm vm_map_min ,
+.Nm vm_map_pmap
+.Nd return map properties
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft vm_offset_t
+.Fn vm_map_max "vm_map_t map"
+.Ft vm_offset_t
+.Fn vm_map_min "vm_map_t map"
+.Ft pmap_t
+.Fn vm_map_pmap "vm_map_t map"
+.Sh DESCRIPTION
+The function
+.Fn vm_map_max
+returns the upper address bound of the map
+.Fa map .
+.Pp
+The function
+.Fn vm_map_min
+returns the lower address bound of the map
+.Fa map .
+.Pp
+The function
+.Fn vm_map_pmap
+returns a pointer to the physical map associated with the virtual map
+.Fa map .
+.Sh SEE ALSO
+.Xr pmap 9 ,
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_protect.9 b/share/man/man9/vm_map_protect.9
new file mode 100644
index 000000000000..8976781297e5
--- /dev/null
+++ b/share/man/man9/vm_map_protect.9
@@ -0,0 +1,93 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_PROTECT 9
+.Os
+.Sh NAME
+.Nm vm_map_protect
+.Nd apply protection bits to a virtual memory region
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_protect
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "vm_prot_t new_prot"
+.Fa "boolean_t set_max"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_protect
+function sets the protection bits of the address region bounded by
+.Fa start
+and
+.Fa end
+within the map
+.Fa map
+to
+.Fa new_prot .
+.Pp
+If
+.Fa set_max
+is TRUE,
+.Fa new_prot
+is treated as the new
+.Va max_protection
+setting for each underlying entry.
+Otherwise, only the
+.Va protection
+field is affected.
+.Pp
+The range MUST be contiguous, and MUST NOT contain sub-maps.
+.Sh IMPLEMENTATION NOTES
+The function acquires a lock on the
+.Fa map
+for the duration, by calling
+.Xr vm_map_lock 9 .
+.Sh RETURN VALUES
+The
+.Fn vm_map_protect
+function returns
+.Dv KERN_SUCCESS
+if the protection bits could be set successfully.
+.Pp
+If a sub-map entry was encountered in the range,
+.Dv KERN_INVALID_ARGUMENT
+is returned.
+If the value of
+.Fa new_prot
+would exceed
+.Va max_protection
+for an entry within the range,
+.Dv KERN_PROTECTION_FAILURE
+is returned.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_remove.9 b/share/man/man9/vm_map_remove.9
new file mode 100644
index 000000000000..53da53349bb2
--- /dev/null
+++ b/share/man/man9/vm_map_remove.9
@@ -0,0 +1,69 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_REMOVE 9
+.Os
+.Sh NAME
+.Nm vm_map_remove
+.Nd remove a virtual address range from a map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fn vm_map_remove "vm_map_t map" "vm_offset_t start" "vm_offset_t end"
+.Sh DESCRIPTION
+The
+.Fn vm_map_remove
+function removes the given address range bounded by
+.Fa start
+and
+.Fa end
+from the target
+.Fa map .
+.Sh IMPLEMENTATION NOTES
+This is the exported form of
+.Xr vm_map_delete 9
+which may be called by consumers of the VM subsystem.
+.Pp
+The function calls
+.Xr vm_map_lock 9
+to hold a lock on
+.Fa map
+for the duration of the function call.
+.Sh RETURN VALUES
+The
+.Fn vm_map_remove
+always returns
+.Dv KERN_SUCCESS .
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_delete 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_simplify_entry.9 b/share/man/man9/vm_map_simplify_entry.9
new file mode 100644
index 000000000000..8bb5484b4cb7
--- /dev/null
+++ b/share/man/man9/vm_map_simplify_entry.9
@@ -0,0 +1,61 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_SIMPLIFY_ENTRY 9
+.Os
+.Sh NAME
+.Nm vm_map_simplify_entry
+.Nd simplify a
+.Vt vm_map_entry
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft void
+.Fn vm_map_simplify_entry "vm_map_t map" "vm_map_entry_t entry"
+.Sh DESCRIPTION
+The
+.Fn vm_map_simplify_entry
+function simplifies the given
+.Fa entry
+by merging with either neighbour.
+The
+.Fa map
+must be locked upon entry.
+.Pp
+This function also has the ability to merge with both neighbours.
+.Pp
+This function guarantees that the passed entry remains valid, although
+possibly extended.
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_insert 9 ,
+.Xr vm_map_remove 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_stack.9 b/share/man/man9/vm_map_stack.9
new file mode 100644
index 000000000000..dabe937cac2b
--- /dev/null
+++ b/share/man/man9/vm_map_stack.9
@@ -0,0 +1,132 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_STACK 9
+.Os
+.Sh NAME
+.Nm vm_map_stack ,
+.Nm vm_map_growstack
+.Nd manage process stacks
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_stack
+.Fa "vm_map_t map" "vm_offset_t addrbos" "vm_size_t max_ssize" "vm_prot_t prot"
+.Fa "vm_prot_t max" "int cow"
+.Fc
+.Ft int
+.Fn vm_map_growstack "struct proc *p" "vm_offset_t addr"
+.Sh DESCRIPTION
+The
+.Fn vm_map_stack
+function maps a process stack for a new process image.
+The stack is mapped
+.Fa addrbos
+in
+.Fa map ,
+with a maximum size of
+.Fa max_ssize .
+Copy-on-write flags passed in
+.Fa cow
+are also applied to the new mapping.
+Protection bits are supplied by
+.Fa prot
+and
+.Fa max .
+.Pp
+It is typically called by
+.Xr execve 2 .
+.Pp
+The
+.Fn vm_map_growstack
+function is responsible for growing a stack for the process
+.Fa p
+to the desired address
+.Fa addr ,
+similar to the legacy
+.Xr sbrk 2
+call.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn vm_map_stack
+function calls
+.Xr vm_map_insert 9
+to create its mappings.
+.Pp
+The
+.Fn vm_map_growstack
+function acquires the
+.Va Giant
+lock, and the process lock on
+.Fa p ,
+for the duration of the call.
+.Sh RETURN VALUES
+The
+.Fn vm_map_stack
+function returns
+.Dv KERN_SUCCESS
+if the mapping was allocated successfully.
+.Pp
+Otherwise,
+if mapping the stack would exceed the process's VMEM resource limit,
+or if the specified bottom-of-stack address is out of range for the map,
+or if there is already a mapping at the address which would result,
+or if
+.Fa max_ssize
+could not be accommodated within the current mapping,
+.Dv KERN_NO_SPACE
+is returned.
+.Pp
+Other possible return values for this function are documented in
+.Xr vm_map_insert 9 .
+.Pp
+The
+.Fn vm_map_growstack
+function returns
+.Dv KERN_SUCCESS
+if
+.Fa addr
+is already mapped, or if the stack was grown successfully.
+.Pp
+It also returns
+.Dv KERN_SUCCESS
+if
+.Fa addr
+is outside the stack range; this is done in order to preserve
+compatibility with the deprecated
+.Fn grow
+function previously located in the file
+.Pa vm_machdep.c .
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_insert 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_submap.9 b/share/man/man9/vm_map_submap.9
new file mode 100644
index 000000000000..704151aa5fc7
--- /dev/null
+++ b/share/man/man9/vm_map_submap.9
@@ -0,0 +1,95 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_SUBMAP 9
+.Os
+.Sh NAME
+.Nm vm_map_submap
+.Nd create a subordinate map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_submap
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "vm_map_t submap"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_submap
+function marks the range bounded by
+.Fa start
+and
+.Fa end
+within the map
+.Fa map
+as being handled by a subordinate map
+.Fa sub_map .
+.Pp
+It is generally called by the kernel memory allocator.
+.Sh IMPLEMENTATION NOTES
+This function is for internal use only.
+.Pp
+Both maps must exist.
+The range must have been created with
+.Xr vm_map_find 9
+previously.
+.Pp
+No other operations may have been performed on this range
+before calling this function.
+Only the
+.Fn vm_fault
+operation may be performed within this range after calling
+this function.
+.Pp
+To remove a submapping, one must first remove the range from
+the parent
+.Fa map ,
+and then destroy the
+.Fa sub_map .
+This procedure is not recommended.
+.Sh RETURN VALUES
+The
+.Fn vm_map_submap
+function returns
+.Dv KERN_SUCCESS
+if successful.
+.Pp
+Otherwise, it returns
+.Dv KERN_INVALID_ARGUMENT
+if the caller requested copy-on-write flags,
+or if the range specified for the sub-map was out of range for the parent map,
+or if a
+.Dv NULL
+backing object was specified.
+.Sh SEE ALSO
+.Xr vm_map 9 ,
+.Xr vm_map_find 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_sync.9 b/share/man/man9/vm_map_sync.9
new file mode 100644
index 000000000000..0ee12193d12e
--- /dev/null
+++ b/share/man/man9/vm_map_sync.9
@@ -0,0 +1,81 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2011
+.Dt VM_MAP_SYNC 9
+.Os
+.Sh NAME
+.Nm vm_map_sync
+.Nd push dirty pages to their pager
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fo vm_map_sync
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "boolean_t syncio"
+.Fa "boolean_t invalidate"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_sync
+function forces any dirty cached pages in the range
+.Fa start
+to
+.Fa end
+within the
+.Fa map
+to be pushed to their underlying pager.
+.Pp
+If
+.Fa syncio
+is TRUE, dirty pages are written synchronously.
+.Pp
+If
+.Fa invalidate
+is TRUE, any cached pages are also freed.
+.Pp
+The range provided must be contiguous, it MUST NOT contain holes.
+The range provided MUST NOT contain any sub-map entries.
+.Sh RETURN VALUES
+The
+.Fn vm_map_sync
+function returns
+.Dv KERN_SUCCESS
+if successful.
+.Pp
+Otherwise,
+.Dv KERN_INVALID_ADDRESS
+will be returned if the function encountered a sub-map entry;
+.Dv KERN_INVALID_ARGUMENT
+will be returned if the function encountered a hole in the region provided,
+or if an entry could not be found for the given start address.
+.Sh SEE ALSO
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_map_wire.9 b/share/man/man9/vm_map_wire.9
new file mode 100644
index 000000000000..12bb3f675aed
--- /dev/null
+++ b/share/man/man9/vm_map_wire.9
@@ -0,0 +1,114 @@
+.\"
+.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 19, 2003
+.Dt VM_MAP_WIRE 9
+.Os
+.Sh NAME
+.Nm vm_map_wire ,
+.Nm vm_map_unwire
+.Nd manage page wiring within a virtual memory map
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_map.h
+.Ft int
+.Fn vm_map_wire "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
+.Ft int
+.Fo vm_map_unwire
+.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_map_wire
+function is responsible for wiring pages in the range between
+.Fa start
+and
+.Fa end
+within the map
+.Fa map .
+Wired pages are locked into physical memory, and may not be paged out
+as long as their wire count remains above zero.
+.Pp
+The
+.Fn vm_map_unwire
+function performs the corresponding unwire operation.
+.Pp
+The
+.Fa flags
+argument is a bit mask, consisting of the following flags:
+.Pp
+If the
+.Dv VM_MAP_WIRE_USER
+flag is set, the function operates within user address space.
+.Pp
+If the
+.Dv VM_MAP_WIRE_HOLESOK
+flag is set, it may operate upon an arbitrary range within the
+address space of
+.Fa map .
+.Pp
+If a contiguous range is desired, callers should explicitly express
+their intent by specifying the
+.Dv VM_MAP_WIRE_NOHOLES
+flag.
+.Sh IMPLEMENTATION NOTES
+Both functions will attempt to acquire a lock on the map using
+.Xr vm_map_lock 9
+and hold it for the duration of the call.
+If they detect
+.Dv MAP_ENTRY_IN_TRANSITION ,
+they will call
+.Xr vm_map_unlock_and_wait 9
+until the map becomes available again.
+.Pp
+The map could have changed during this window as it was held by another
+consumer, therefore consumers of this interface should check for this
+condition using the return values below.
+.Sh RETURN VALUES
+The
+.Fn vm_map_wire
+and
+.Fn vm_map_unwire
+functions have identical return values.
+The functions return
+.Dv KERN_SUCCESS
+if all pages within the range were [un]wired successfully.
+.Pp
+Otherwise, if the specified range was not valid,
+or if the map changed while the
+.Dv MAP_ENTRY_IN_TRANSITION
+flag was set,
+.Dv KERN_INVALID_ADDRESS
+is returned.
+.Sh SEE ALSO
+.Xr mlockall 2 ,
+.Xr munlockall 2 ,
+.Xr vm_map 9
+.Sh AUTHORS
+This manual page was written by
+.An Bruce M Simpson Aq bms@spc.org .
diff --git a/share/man/man9/vm_page_aflag.9 b/share/man/man9/vm_page_aflag.9
new file mode 100644
index 000000000000..8ef5d8703c9f
--- /dev/null
+++ b/share/man/man9/vm_page_aflag.9
@@ -0,0 +1,100 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 31, 2011
+.Dt VM_PAGE_FLAG 9
+.Os
+.Sh NAME
+.Nm vm_page_aflag_clear , vm_page_aflag_set , vm_page_reference
+.Nd "change page atomic flags"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_aflag_clear "vm_page_t m" "uint8_t bits"
+.Ft void
+.Fn vm_page_aflag_set "vm_page_t m" "uint8_t bits"
+.Ft void
+.Fn vm_page_reference "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_aflag_clear
+atomically clears the specified bits on the page's
+.Va aflags .
+.Pp
+The
+.Fn vm_page_aflag_set
+atomically sets the specified bits on the page's
+.Va aflags .
+.Pp
+The
+.Fn vm_page_reference m
+call is the same as
+.Bd -literal -offset indent
+vm_page_aflag_set(m, PGA_REFERENCED);
+.Ed
+.Lp
+and is the recommended way to mark the page as referenced from
+third-party kernel modules.
+.Pp
+These functions neither block nor require any locks to be held
+around the calls for correctness.
+.Pp
+The functions arguments are:
+.Bl -tag -width ".Fa bits"
+.It Fa m
+The page whose
+.Va aflags
+are updated.
+.It Fa bits
+The bits that are set or cleared on the page's flags.
+.El
+.Pp
+The following
+.Va aflags
+can be set or cleared:
+.Bl -tag -width ".Fa PGA_REFERENCED"
+.It Fa PGA_REFERENCED
+The bit may be set to indicate that the page has been recently accessed.
+For instance,
+.Xr pmap 9
+sets this bit to reflect the accessed attribute of the page mapping
+typically updated by processor's memory management unit on the page access.
+.It Fa PGA_WRITEABLE
+A writeable mapping for the page may exist.
+.El
+.Pp
+Both
+.Dv PGA_REFERENCED
+and
+.Dv PGA_WRITEABLE
+bits are only valid for the managed pages.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_alloc.9 b/share/man/man9/vm_page_alloc.9
new file mode 100644
index 000000000000..9397d2153c27
--- /dev/null
+++ b/share/man/man9/vm_page_alloc.9
@@ -0,0 +1,139 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd January 28, 2012
+.Dt VM_PAGE_ALLOC 9
+.Os
+.Sh NAME
+.Nm vm_page_alloc
+.Nd "allocate a page for a"
+.Vt vm_object
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft vm_page_t
+.Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int req"
+.Sh DESCRIPTION
+The
+.Fn vm_page_alloc
+function allocates a page at
+.Fa pindex
+within
+.Fa object .
+It is assumed that a page has not already been allocated at
+.Fa pindex .
+The page returned is inserted into the object, unless
+.Dv VM_ALLOC_NOOBJ
+is specified in the
+.Fa req .
+The page may exist in the vm object cache, in which case it will
+be reactivated instead, moving from the cache into the object page list.
+.Pp
+.Fn vm_page_alloc
+will not sleep.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa object"
+.It Fa object
+The VM object to allocate the page for.
+The
+.Fa object
+must be locked if
+.Dv VM_ALLOC_NOOBJ
+is not specified.
+.It Fa pindex
+The index into the object at which the page should be inserted.
+.It Fa req
+The bitwise-inclusive OR of a class and any optional flags indicating
+how the page should be allocated.
+.Pp
+Exactly one of the following classes must be specified:
+.Bl -tag -width ".Dv VM_ALLOC_INTERRUPT"
+.It Dv VM_ALLOC_NORMAL
+The page should be allocated with no special treatment.
+.It Dv VM_ALLOC_SYSTEM
+The page can be allocated if the cache is empty and the free
+page count is above the interrupt reserved water mark.
+This flag should be used only when the system really needs the page.
+.It Dv VM_ALLOC_INTERRUPT
+.Fn vm_page_alloc
+is being called during an interrupt.
+A page will be returned successfully if the free page count is greater
+than zero.
+.El
+.Pp
+The optional flags are:
+.Bl -tag -width ".Dv VM_ALLOC_IFNOTCACHED"
+.It Dv VM_ALLOC_NOBUSY
+The returned page will not have the
+.Dv VPO_BUSY
+flag set.
+.It Dv VM_ALLOC_NODUMP
+The returned page will not be included in any kernel core dumps
+regardless of whether or not it is mapped in to KVA.
+.It Dv VM_ALLOC_NOOBJ
+Do not associate the allocated page with a vm object.
+The
+.Fa object
+argument is ignored.
+.It Dv VM_ALLOC_IFCACHED
+Allocate the page only if it is cached.
+Otherwise, return
+.Dv NULL .
+.It Dv VM_ALLOC_IFNOTCACHED
+Only allocate the page if it is not cached in the
+.Fa object .
+If the page at the specified
+.Fa pindex
+is cached, NULL is returned instead.
+.It Dv VM_ALLOC_WIRED
+The returned page will be wired.
+.It Dv VM_ALLOC_ZERO
+Indicate a preference for a pre-zeroed page.
+There is no guarantee that the returned page will be zeroed, but it
+will have the
+.Dv PG_ZERO
+flag set if it is zeroed.
+.El
+.El
+.Sh RETURN VALUES
+The
+.Vt vm_page_t
+that was allocated is returned if successful; otherwise,
+.Dv NULL
+is returned.
+.Sh NOTES
+The pager process is always upgraded to
+.Dv VM_ALLOC_SYSTEM
+unless
+.Dv VM_ALLOC_INTERRUPT
+is set.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_bits.9 b/share/man/man9/vm_page_bits.9
new file mode 100644
index 000000000000..79d568552cc5
--- /dev/null
+++ b/share/man/man9/vm_page_bits.9
@@ -0,0 +1,167 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 1, 2001
+.Dt VM_PAGE_BITS 9
+.Os
+.Sh NAME
+.Nm vm_page_bits ,
+.Nm vm_page_set_validclean ,
+.Nm vm_page_clear_dirty ,
+.Nm vm_page_set_invalid ,
+.Nm vm_page_zero_invalid ,
+.Nm vm_page_is_valid ,
+.Nm vm_page_test_dirty ,
+.Nm vm_page_dirty ,
+.Nm vm_page_undirty
+.Nd "manage page clean and dirty bits"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft int
+.Fn vm_page_bits "int base" "int size"
+.Ft void
+.Fn vm_page_set_validclean "vm_page_t m" "int base" "int size"
+.Ft void
+.Fn vm_page_clear_dirty "vm_page_t m" "int base" "int size"
+.Ft void
+.Fn vm_page_set_invalid "vm_page_t m" "int base" "int size"
+.Ft void
+.Fn vm_page_zero_invalid "vm_page_t m" "boolean_t setvalid"
+.Ft int
+.Fn vm_page_is_valid "vm_page_t m" "int base" "int size"
+.Ft void
+.Fn vm_page_test_dirty "vm_page_t m"
+.Ft void
+.Fn vm_page_dirty "vm_page_t m"
+.Ft void
+.Fn vm_page_undirty "vm_page_t m"
+.Sh DESCRIPTION
+.Fn vm_page_bits
+calculates the bits representing the
+.Dv DEV_BSIZE
+range of bytes between
+.Fa base
+and
+.Fa size .
+The byte range is expected to be within a single page, and if
+.Fa size
+is zero, no bits will be set.
+.Pp
+.Fn vm_page_set_validclean
+flags the byte range between
+.Fa base
+and
+.Fa size
+as valid and clean.
+The range is expected to be
+.Dv DEV_BSIZE
+aligned and no larger than
+.Dv PAGE_SIZE .
+If it is not properly aligned, any unaligned chunks of the
+.Dv DEV_BSIZE
+blocks at the beginning and end of the range will be zeroed.
+.Pp
+If
+.Fa base
+is zero and
+.Fa size
+is one page, the modified bit in the page map is cleared; as well,
+the
+.Dv VPO_NOSYNC
+flag is cleared.
+.Pp
+.Fn vm_page_clear_dirty
+clears the dirty bits within a page in the range between
+.Fa base
+and
+.Fa size .
+The bits representing the range are calculated by calling
+.Fn vm_page_bits .
+.Pp
+.Fn vm_page_set_invalid
+clears the bits in both the valid and dirty flags representing
+the
+.Dv DEV_BSIZE
+blocks between
+.Fa base
+and
+.Fa size
+in the page.
+The bits are calculated by calling
+.Fn vm_page_bits .
+As well as clearing the bits within the page, the generation
+number within the object holding the page is incremented.
+.Pp
+.Fn vm_page_zero_invalid
+zeroes all of the blocks within the page that are currently
+flagged as invalid.
+If
+.Fa setvalid
+is
+.Dv TRUE ,
+all of the valid bits within the page are set.
+.Pp
+In some cases, such as NFS, the valid bits cannot be set
+in order to maintain cache consistency.
+.Pp
+.Fn vm_page_is_valid
+checks to determine if the all of the
+.Dv DEV_BSIZE
+blocks between
+.Fa base
+and
+.Fa size
+of the page are valid.
+If
+.Fa size
+is zero and the page is entirely invalid
+.Fn vm_page_is_valid
+will return
+.Dv TRUE ,
+in all other cases a size of zero will return
+.Dv FALSE .
+.Pp
+.Fn vm_page_test_dirty
+checks if a page has been modified via any of its physical maps,
+and if so, flags the entire page as dirty.
+.Fn vm_page_dirty
+is called to modify the dirty bits.
+.Pp
+.Fn vm_page_dirty
+flags the entire page as dirty.
+It is expected that the page is not currently on the cache queue.
+.Pp
+.Fn vm_page_undirty
+clears all of the dirty bits in a page.
+.Sh NOTES
+None of these functions are allowed to block.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_cache.9 b/share/man/man9/vm_page_cache.9
new file mode 100644
index 000000000000..0379e8c7a9c1
--- /dev/null
+++ b/share/man/man9/vm_page_cache.9
@@ -0,0 +1,51 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 2001
+.Dt VM_PAGE_CACHE 9
+.Os
+.Sh NAME
+.Nm vm_page_cache
+.Nd "move a page onto the cache queue"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_cache "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_cache
+function moves a page onto the cache queue,
+and removes any protection that may be set on the page.
+If the page is busy, wired or unmanaged then the move
+to the cache queue will fail.
+If the page is dirty the system will panic.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_deactivate.9 b/share/man/man9/vm_page_deactivate.9
new file mode 100644
index 000000000000..30bb7fa11ace
--- /dev/null
+++ b/share/man/man9/vm_page_deactivate.9
@@ -0,0 +1,50 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 2001
+.Dt VM_PAGE_DEACTIVATE 9
+.Os
+.Sh NAME
+.Nm vm_page_deactivate
+.Nd "deactivate a page"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_deactivate "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_deactivate
+function moves the given page to the inactive queue as long as it is
+unmanaged and is not wired.
+.Sh SEE ALSO
+.Xr vm_page_wire 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_dontneed.9 b/share/man/man9/vm_page_dontneed.9
new file mode 100644
index 000000000000..99baa330816d
--- /dev/null
+++ b/share/man/man9/vm_page_dontneed.9
@@ -0,0 +1,59 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 30, 2001
+.Dt VM_PAGE_DONTNEED 9
+.Os
+.Sh NAME
+.Nm vm_page_dontneed
+.Nd "indicate that a page is not needed anymore"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_dontneed "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_dontneed
+function advises the VM system that the given page is no longer
+required.
+If the page is already in the inactive queue or in the cache queue, this
+function does nothing; otherwise the page is deactivated.
+.Pp
+Note that
+.Fn vm_page_dontneed
+does not necessarily deactivate a page, but instead implements an
+algorithm that attempts to prevent small objects from having their
+pages reused too quickly, and large objects from flushing smaller
+ones from the queues as their pages are released.
+.Sh SEE ALSO
+.Xr vm_page_deactivate 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_free.9 b/share/man/man9/vm_page_free.9
new file mode 100644
index 000000000000..a78e577adbd4
--- /dev/null
+++ b/share/man/man9/vm_page_free.9
@@ -0,0 +1,98 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 2001
+.Dt VM_PAGE_FREE 9
+.Os
+.Sh NAME
+.Nm vm_page_free ,
+.Nm vm_page_free_toq ,
+.Nm vm_page_free_zero ,
+.Nm vm_page_try_to_free
+.Nd "free a page"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_free "vm_page_t m"
+.Ft void
+.Fn vm_page_free_toq "vm_page_t m"
+.Ft void
+.Fn vm_page_free_zero "vm_page_t m"
+.Ft int
+.Fn vm_page_try_to_free "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_free_toq
+function moves a page into the free queue, and disassociates it from
+its object.
+If the page is held, wired, already free, or its busy count is not
+zero, the system will panic.
+If the
+.Dv PG_ZERO
+flag is set on the page, it is placed at the end of the free queue;
+otherwise, it is placed at the front.
+.Pp
+If the page's object is of type
+.Dv OBJT_VNODE
+and it is the last page associated with the object, the underlying
+vnode may be freed.
+.Pp
+The
+.Fn vm_page_free
+and
+.Fn vm_page_free_zero
+functions both call
+.Fn vm_page_free_toq
+to actually free the page, but
+.Fn vm_page_free_zero
+sets the
+.Dv PG_ZERO
+flag and
+.Fn vm_page_free
+clears the
+.Dv PG_ZERO
+flag prior to the call to
+.Fn vm_page_free_toq .
+.Pp
+The
+.Fn vm_page_try_to_free
+function verifies that the page is not held, wired, busy or dirty, and
+if so, marks the page as busy, drops any protection that may be set on
+the page, and frees it.
+.Sh RETURN VALUES
+.Fn vm_page_try_to_free
+returns 1 if it is able to free the page; otherwise, 0 is returned.
+.Sh SEE ALSO
+.Xr vm_page_busy 9 ,
+.Xr vm_page_hold 9 ,
+.Xr vm_page_wire 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_grab.9 b/share/man/man9/vm_page_grab.9
new file mode 100644
index 000000000000..d0d3a321be5a
--- /dev/null
+++ b/share/man/man9/vm_page_grab.9
@@ -0,0 +1,70 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 7, 2001
+.Dt VM_PAGE_GRAB 9
+.Os
+.Sh NAME
+.Nm vm_page_grab
+.Nd "returns a page from an object"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft vm_page_t
+.Fn vm_page_grab "vm_object_t object" "vm_pindex_t pindex" "int allocflags"
+.Sh DESCRIPTION
+The
+.Fn vm_page_grab
+function returns the page at
+.Fa pindex
+from the given object.
+If the page exists and is busy,
+.Fn vm_page_grab
+will sleep while waiting for it.
+If the page does not exist, it is allocated.
+.Pp
+If
+.Dv VM_ALLOC_RETRY
+is not set in
+.Fa allocflags
+and the function sleeps, either getting the page from the object
+or while allocating it,
+.Dv NULL
+is returned.
+.Sh RETURN VALUES
+If successful,
+.Fn vm_page_grab
+returns the page; otherwise,
+.Dv NULL
+is returned.
+.Sh SEE ALSO
+.Xr vm_page_alloc 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_hold.9 b/share/man/man9/vm_page_hold.9
new file mode 100644
index 000000000000..183fa4020d56
--- /dev/null
+++ b/share/man/man9/vm_page_hold.9
@@ -0,0 +1,75 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2001
+.Dt VM_PAGE_HOLD 9
+.Os
+.Sh NAME
+.Nm vm_page_hold ,
+.Nm vm_page_unhold
+.Nd "update a page's hold count"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_hold "vm_page_t m"
+.Ft void
+.Fn vm_page_unhold "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_hold
+function increases the hold count on a page.
+This prevents the page daemon from freeing the page.
+.Pp
+.Fn vm_page_hold
+should only be used for very temporary wiring of a page,
+as that page will not be considered for paging or
+reallocation for as long as its hold count is greater
+than zero.
+Also note that while wired pages are removed from whatever
+queue they are on,
+.Fn vm_page_hold
+does not affect the location of the page.
+If it is on a queue prior to the call, it will still
+be there afterward.
+.Pp
+If the page needs to be held for a long period of time,
+.Xr vm_page_wire 9
+should be used.
+.Pp
+.Fn vm_page_unhold
+function reduces the hold count on a page.
+If the hold count is zero it is possible that the page will be freed by the
+page daemon.
+.Sh SEE ALSO
+.Xr vm_page_unwire 9 ,
+.Xr vm_page_wire 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_insert.9 b/share/man/man9/vm_page_insert.9
new file mode 100644
index 000000000000..53f1eba82933
--- /dev/null
+++ b/share/man/man9/vm_page_insert.9
@@ -0,0 +1,96 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 17, 2001
+.Dt VM_PAGE_INSERT 9
+.Os
+.Sh NAME
+.Nm vm_page_insert ,
+.Nm vm_page_remove
+.Nd "add/remove page from an object"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_insert "vm_page_t m" "vm_object_t object" "vm_pindex_t pindex"
+.Ft void
+.Fn vm_page_remove "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_insert
+function adds a page to the given object at the given index.
+The page is added to both the VM page hash table and to the
+object's list of pages, but the hardware page tables are not updated.
+In the case of a user page, it will be faulted in when it is
+accessed.
+If the page is a kernel page, the caller is expected to
+handle adding the page to the kernel's pmap.
+.Pp
+If
+.Dv PG_WRITEABLE
+is set in the page's flags,
+.Dv OBJ_WRITEABLE
+and
+.Dv OBJ_MIGHTBEDIRTY
+are set in the object's flags.
+.Pp
+The
+.Fn vm_page_remove
+function removes the given page from its object, and from the
+VM page hash table.
+The page must be busy prior to this call, or the system will panic.
+The pmap entry for the page is not removed by this function.
+.Pp
+The arguments to
+.Fn vm_page_insert
+are:
+.Bl -tag -width ".Fa object"
+.It Fa m
+The page to add to the object.
+.It Fa object
+The object the page should be added to.
+.It Fa pindex
+The index into the object the page should be at.
+.El
+.Pp
+The arguments to
+.Fn vm_page_remove
+are:
+.Bl -tag -width ".Fa m"
+.It Fa m
+The page to remove.
+.El
+.Sh IMPLEMENTATION NOTES
+The index of a page in a VM object is the byte index into the
+same object truncated to a page boundary.
+For example, if the page size is 4096 bytes, and the address
+in the object is 81944, the page index is 20.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_io.9 b/share/man/man9/vm_page_io.9
new file mode 100644
index 000000000000..bddb82b8ea7a
--- /dev/null
+++ b/share/man/man9/vm_page_io.9
@@ -0,0 +1,65 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 17, 2001
+.Dt VM_PAGE_IO_START 9
+.Os
+.Sh NAME
+.Nm vm_page_io_start ,
+.Nm vm_page_io_finish
+.Nd "ready or unready a page for I/O"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_io_start "vm_page_t m"
+.Ft void
+.Fn vm_page_io_finish "vm_page_t m"
+.Sh DESCRIPTION
+The
+.Fn vm_page_io_start
+function prepares the page for I/O by incrementing its busy flag by one.
+.Pp
+The
+.Fn vm_page_io_finish
+function lowers the busy count on the page by one, if the resulting busy
+count is zero, a
+.Xr wakeup 9
+will be issued if the page has been marked
+.Dv VPO_WANTED .
+A page is typically marked
+.Dv VPO_WANTED
+by a thread to register its interest in
+the page to either complete I/O or becoming available for general use.
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca
+and
+.An Alfred Perlstein Aq alfred@FreeBSD.org .
diff --git a/share/man/man9/vm_page_lookup.9 b/share/man/man9/vm_page_lookup.9
new file mode 100644
index 000000000000..7f8cd5e1dd77
--- /dev/null
+++ b/share/man/man9/vm_page_lookup.9
@@ -0,0 +1,63 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2001
+.Dt VM_PAGE_LOOKUP 9
+.Os
+.Sh NAME
+.Nm vm_page_lookup
+.Nd "lookup a vm page"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft vm_page_t
+.Fn vm_page_lookup "vm_object_t object" "vm_pindex_t pindex"
+.Sh DESCRIPTION
+The
+.Fn vm_page_lookup
+function searches for a VM page given its VM object and index.
+If the page is not found,
+.Dv NULL
+is returned.
+Its arguments are:
+.Bl -tag -width ".Fa object"
+.It Fa object
+The VM object to search on.
+.It Fa pindex
+The page index to search on.
+.El
+.Sh RETURN VALUES
+A
+.Vt vm_page_t
+is returned if successful; otherwise,
+.Dv NULL
+is returned.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_rename.9 b/share/man/man9/vm_page_rename.9
new file mode 100644
index 000000000000..bb8591fae3ab
--- /dev/null
+++ b/share/man/man9/vm_page_rename.9
@@ -0,0 +1,72 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 17, 2001
+.Dt VM_PAGE_RENAME 9
+.Os
+.Sh NAME
+.Nm vm_page_rename
+.Nd "move a page"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fo vm_page_rename
+.Fa "vm_page_t m"
+.Fa "vm_object_t new_object"
+.Fa "vm_pindex_t new_pindex"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vm_page_rename
+function removes a page from one object, and adds it to another
+at the given page index.
+The page is added to the given object, and is removed from the
+object that is currently associated with.
+If the page is currently on the cache queue it will be deactivated
+unless it is wired or unmanaged, in which case the deactivation will
+fail.
+The entire page is marked as dirty after the move.
+.Pp
+The arguments to
+.Fn vm_page_rename
+are:
+.Bl -tag -width ".Fa new_object"
+.It Fa m
+The page to move.
+.It Fa new_object
+The object the page should be inserted into.
+.It Fa new_pindex
+The page index into
+.Fa new_object
+at which the new page should be inserted.
+.El
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_sleep_if_busy.9 b/share/man/man9/vm_page_sleep_if_busy.9
new file mode 100644
index 000000000000..850979f2db81
--- /dev/null
+++ b/share/man/man9/vm_page_sleep_if_busy.9
@@ -0,0 +1,68 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2001
+.Dt VM_PAGE_SLEEP_IF_BUSY 9
+.Os
+.Sh NAME
+.Nm vm_page_sleep_if_busy
+.Nd "wait for a busy page to become unbusy"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft int
+.Fn vm_page_sleep_if_busy "vm_page_t m" "int also_m_busy" "const char *wmesg"
+.Sh DESCRIPTION
+The
+.Fn vm_page_sleep_if_busy
+function waits until the
+.Dv VPO_BUSY
+flag is cleared.
+If
+.Fa also_m_busy
+is non-zero, it also waits for
+.Fa m->busy
+to become zero.
+.Sh RETURN VALUES
+If
+.Fn vm_page_sleep_if_busy
+finds the page busy it returns
+.Dv TRUE .
+If not, it returns
+.Dv FALSE .
+Returning
+.Dv TRUE
+does not necessary mean that
+.Fn vm_page_sleep_if_busy
+slept, but only that
+.Fn splvm
+was called.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_wakeup.9 b/share/man/man9/vm_page_wakeup.9
new file mode 100644
index 000000000000..5908b62001bc
--- /dev/null
+++ b/share/man/man9/vm_page_wakeup.9
@@ -0,0 +1,75 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 14, 2001
+.Dt VM_PAGE_BUSY 9
+.Os
+.Sh NAME
+.Nm vm_page_busy ,
+.Nm vm_page_flash ,
+.Nm vm_page_wakeup
+.Nd "handle the busying and unbusying of a page"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_busy "vm_page_t m"
+.Ft void
+.Fn vm_page_flash "vm_page_t m"
+.Ft void
+.Fn vm_page_wakeup "vm_page_t m"
+.Sh DESCRIPTION
+These functions handle the busying, unbusying and notification of the unbusying
+of a page.
+.Pp
+.Fn vm_page_busy
+sets the
+.Dv VPO_BUSY
+flag in the page.
+.Pp
+.Fn vm_page_flash
+checks to see if there is anybody waiting on the page
+.Dv ( VPO_WANTED
+will be set), and if so, clears the
+.Dv VPO_WANTED
+flag and notifies whoever is waiting via
+.Fn wakeup .
+.Pp
+.Fn vm_page_wakeup
+clears the
+.Dv VPO_BUSY
+flag on the page, and calls
+.Fn vm_page_flash
+in case somebody has been waiting for it.
+.Sh SEE ALSO
+.Xr vm_page_sleep_if_busy 9 ,
+.Xr wakeup 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_page_wire.9 b/share/man/man9/vm_page_wire.9
new file mode 100644
index 000000000000..f988dd96e467
--- /dev/null
+++ b/share/man/man9/vm_page_wire.9
@@ -0,0 +1,67 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 13, 2001
+.Dt VM_PAGE_WIRE 9
+.Os
+.Sh NAME
+.Nm vm_page_wire ,
+.Nm vm_page_unwire
+.Nd "wire and unwire pages"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_page_wire "vm_page_t m"
+.Ft void
+.Fn vm_page_unwire "vm_page_t m" "int activate"
+.Sh DESCRIPTION
+The
+.Fn vm_page_wire
+function increments the wire count on a page, and removes it from
+whatever queue it is on.
+.Pp
+The
+.Fn vm_page_unwire
+function releases one of the wirings on the page.
+When
+.Va write_count
+reaches zero the page is placed back onto either the active queue
+(if
+.Fa activate
+is non-zero) or onto the inactive queue (if
+.Fa activate
+is zero).
+If the page is unmanaged
+.Dv ( PG_UNMANAGED
+is set) then the page is left on
+.Dv PQ_NONE .
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vm_set_page_size.9 b/share/man/man9/vm_set_page_size.9
new file mode 100644
index 000000000000..d37dee819f3d
--- /dev/null
+++ b/share/man/man9/vm_set_page_size.9
@@ -0,0 +1,62 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 17, 2001
+.Dt VM_SET_PAGE_SIZE 9
+.Os
+.Sh NAME
+.Nm vm_set_page_size
+.Nd "initialize the system page size"
+.Sh SYNOPSIS
+.In sys/param.h
+.In vm/vm.h
+.In vm/vm_page.h
+.Ft void
+.Fn vm_set_page_size void
+.Sh DESCRIPTION
+The
+.Fn vm_set_page_size
+function initializes the system page size.
+If
+.Va cnt.v_page_size
+(see
+.In sys/vmmeter.h )
+equals 0,
+.Dv PAGE_SIZE
+is used; otherwise, the value stored in
+.Va cnt.v_page_size
+is used.
+If
+.Va cnt.v_page_size
+is not a power of two, the system will panic.
+.Pp
+.Fn vm_set_page_size
+must be called prior to any page size dependent functions.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vn_fullpath.9 b/share/man/man9/vn_fullpath.9
new file mode 100644
index 000000000000..eff2105f83a4
--- /dev/null
+++ b/share/man/man9/vn_fullpath.9
@@ -0,0 +1,125 @@
+.\"
+.\" Copyright (c) 2003 Robert N. M. Watson.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 23, 2008
+.Dt VN_FULLPATH 9
+.Os
+.Sh NAME
+.Nm vn_fullpath
+.Nd "convert a vnode reference to a full pathname, given a process context"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fo vn_fullpath
+.Fa "struct thread *td" "struct vnode *vp" "char **retbuf" "char **freebuf"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vn_fullpath
+function makes a
+.Dq "best effort"
+attempt to generate a string pathname for
+the passed vnode; the resulting path, if any, will be relative to
+the root directory of the process associated with the passed thread pointer.
+The
+.Fn vn_fullpath
+function
+is implemented by inspecting the VFS name cache, and attempting to
+reconstruct a path from the process root to the object.
+.Pp
+This process is necessarily unreliable for several reasons: intermediate
+entries in the path may not be found in the cache; files may have more
+than one name (hard links), not all file systems use the name cache
+(specifically, most synthetic file systems do not); a single name may
+be used for more than one file (in the context of file systems covering
+other file systems); a file may have no name (if deleted but still
+open or referenced).
+However, the resulting string may still be more useable to a user than
+a vnode pointer value, or a device number and inode number.
+Code consuming the results of this function should anticipate (and
+properly handle) failure.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa freebuf"
+.It Fa td
+The thread performing the call; this pointer will be dereferenced to find
+the process and its file descriptor structure, in order to identify the
+root vnode to use.
+.It Fa vp
+The vnode to search for. No need to be locked by the caller.
+.It Fa retbuf
+Pointer to a
+.Vt "char *"
+that
+.Fn vn_fullpath
+may (on success) point at a newly
+allocated buffer containing the resulting pathname.
+.It Fa freebuf
+Pointer to a
+.Vt "char *"
+that
+.Fn vn_fullpath
+may (on success) point at a buffer
+to be freed, when the caller is done with
+.Fa retbuf .
+.El
+.Pp
+Typical consumers will declare two character pointers:
+.Va fullpath
+and
+.Va freepath ;
+they will set
+.Va freepath
+to
+.Dv NULL ,
+and
+.Va fullpath
+to a name to use
+in the event that the call to
+.Fn vn_fullpath
+fails.
+After done with the value of
+.Va fullpath ,
+the caller will check if
+.Va freepath
+is
+.Pf non- Dv NULL ,
+and if so, invoke
+.Xr free 9
+with a pool type of
+.Dv M_TEMP .
+.Sh RETURN VALUES
+If the vnode is successfully converted to a pathname, 0 is returned;
+otherwise, an error number is returned.
+.Sh SEE ALSO
+.Xr free 9
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson Aq rwatson@FreeBSD.org .
diff --git a/share/man/man9/vn_isdisk.9 b/share/man/man9/vn_isdisk.9
new file mode 100644
index 000000000000..59096347526e
--- /dev/null
+++ b/share/man/man9/vn_isdisk.9
@@ -0,0 +1,73 @@
+.\"
+.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 9, 2001
+.Dt VN_ISDISK 9
+.Os
+.Sh NAME
+.Nm vn_isdisk
+.Nd "checks if a vnode represents a disk"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn vn_isdisk "struct vnode *vp" "int *errp"
+.Sh DESCRIPTION
+The
+.Fn vn_isdisk
+function checks to see if
+.Fa vp
+represents a disk.
+In order for
+.Fa vp
+to be a disk,
+it must be a character device,
+.Va v_rdev
+must be valid, and the
+.Vt cdevsw
+entry's
+.Va flags
+must have
+.Dv D_DISK
+set.
+.Pp
+Its arguments are:
+.Bl -tag -width ".Fa errp"
+.It Fa vp
+The vnode to check.
+.It Fa errp
+An integer pointer to store the error number in if the call fails.
+.El
+.Sh RETURN VALUES
+If the vnode represents a disk, 1 is returned; otherwise, 0
+is returned and
+.Fa errp
+will contain the error number.
+.Sh AUTHORS
+This manual page was written by
+.An Chad David Aq davidc@acns.ab.ca .
diff --git a/share/man/man9/vnode.9 b/share/man/man9/vnode.9
new file mode 100644
index 000000000000..eba208f06387
--- /dev/null
+++ b/share/man/man9/vnode.9
@@ -0,0 +1,199 @@
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 13, 2010
+.Dt VNODE 9
+.Os
+.Sh NAME
+.Nm vnode
+.Nd internal representation of a file or directory
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Sh DESCRIPTION
+The vnode is the focus of all file activity in
+.Ux .
+A vnode is described by
+.Vt "struct vnode" .
+There is a
+unique vnode allocated for each active file, each current directory,
+each mounted-on file, text file, and the root.
+.Pp
+Each vnode has three reference counts,
+.Va v_usecount ,
+.Va v_holdcnt
+and
+.Va v_writecount .
+The first is the number of clients within the kernel which are
+using this vnode.
+This count is maintained by
+.Xr vref 9 ,
+.Xr vrele 9
+and
+.Xr vput 9 .
+The second is the number of clients within the kernel who veto
+the recycling of this vnode.
+This count is
+maintained by
+.Xr vhold 9
+and
+.Xr vdrop 9 .
+When both the
+.Va v_usecount
+and the
+.Va v_holdcnt
+of a vnode reaches zero then the vnode will be put on the freelist
+and may be reused for another file, possibly in another file system.
+The transition to and from the freelist is handled by
+.Xr getnewvnode 9 ,
+.Xr vfree 9
+and
+.Xr vbusy 9 .
+The third is a count of the number of clients which are writing into
+the file.
+It is maintained by the
+.Xr open 2
+and
+.Xr close 2
+system calls.
+.Pp
+Any call which returns a vnode (e.g.\&
+.Xr vget 9 ,
+.Xr VOP_LOOKUP 9
+etc.)
+will increase the
+.Va v_usecount
+of the vnode by one.
+When the caller is finished with the vnode, it
+should release this reference by calling
+.Xr vrele 9
+(or
+.Xr vput 9
+if the vnode is locked).
+.Pp
+Other commonly used members of the vnode structure are
+.Va v_id
+which is used to maintain consistency in the name cache,
+.Va v_mount
+which points at the file system which owns the vnode,
+.Va v_type
+which contains the type of object the vnode represents and
+.Va v_data
+which is used by file systems to store file system specific data with
+the vnode.
+The
+.Va v_op
+field is used by the
+.Dv VOP_*
+macros to call functions in the file system which implement the vnode's
+functionality.
+.Sh VNODE TYPES
+.Bl -tag -width VSOCK
+.It Dv VNON
+No type.
+.It Dv VREG
+A regular file; may be with or without VM object backing.
+If you want to make sure this get a backing object, call
+.Fn vnode_create_vobject .
+.It Dv VDIR
+A directory.
+.It Dv VBLK
+A block device; may be with or without VM object backing.
+If you want to make sure this get a backing object, call
+.Fn vnode_create_vobject .
+.It Dv VCHR
+A character device.
+.It Dv VLNK
+A symbolic link.
+.It Dv VSOCK
+A socket.
+Advisory locking will not work on this.
+.It Dv VFIFO
+A FIFO (named pipe).
+Advisory locking will not work on this.
+.It Dv VBAD
+Indicates that the vnode has been reclaimed.
+.El
+.Sh IMPLEMENTATION NOTES
+VFIFO uses the "struct fileops" from
+.Pa /sys/kern/sys_pipe.c .
+VSOCK uses the "struct fileops" from
+.Pa /sys/kern/sys_socket.c .
+Everything else uses the one from
+.Pa /sys/kern/vfs_vnops.c .
+.Pp
+The VFIFO/VSOCK code, which is why "struct fileops" is used at all, is
+an artifact of an incomplete integration of the VFS code into the
+kernel.
+.Pp
+Calls to
+.Xr malloc 9
+or
+.Xr free 9
+when holding a
+.Nm
+interlock, will cause a LOR (Lock Order Reversal) due to the
+intertwining of VM Objects and Vnodes.
+.Sh SEE ALSO
+.Xr malloc 9 ,
+.Xr VOP_ACCESS 9 ,
+.Xr VOP_ACLCHECK 9 ,
+.Xr VOP_ADVLOCK 9 ,
+.Xr VOP_ATTRIB 9 ,
+.Xr VOP_BWRITE 9 ,
+.Xr VOP_CREATE 9 ,
+.Xr VOP_FSYNC 9 ,
+.Xr VOP_GETACL 9 ,
+.Xr VOP_GETEXTATTR 9 ,
+.Xr VOP_GETPAGES 9 ,
+.Xr VOP_GETVOBJECT 9 ,
+.Xr VOP_INACTIVE 9 ,
+.Xr VOP_IOCTL 9 ,
+.Xr VOP_LINK 9 ,
+.Xr VOP_LISTEXTATTR 9 ,
+.Xr VOP_LOCK 9 ,
+.Xr VOP_LOOKUP 9 ,
+.Xr VOP_OPENCLOSE 9 ,
+.Xr VOP_PATHCONF 9 ,
+.Xr VOP_PRINT 9 ,
+.Xr VOP_RDWR 9 ,
+.Xr VOP_READDIR 9 ,
+.Xr VOP_READLINK 9 ,
+.Xr VOP_REALLOCBLKS 9 ,
+.Xr VOP_REMOVE 9 ,
+.Xr VOP_RENAME 9 ,
+.Xr VOP_REVOKE 9 ,
+.Xr VOP_SETACL 9 ,
+.Xr VOP_SETEXTATTR 9 ,
+.Xr VOP_STRATEGY 9 ,
+.Xr VOP_VPTOCNP 9 ,
+.Xr VOP_VPTOFH 9 ,
+.Xr VFS 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/vref.9 b/share/man/man9/vref.9
new file mode 100644
index 000000000000..f21b9f269f33
--- /dev/null
+++ b/share/man/man9/vref.9
@@ -0,0 +1,68 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 24, 1996
+.Dt VREF 9
+.Os
+.Sh NAME
+.Nm vref
+.Nd increment the use count for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft void
+.Fn vref "struct vnode *vp"
+.Sh DESCRIPTION
+Increment the
+.Va v_usecount
+field of a vnode.
+.Bl -tag -width 2n
+.It Fa vp
+the vnode to increment
+.El
+.Pp
+Each vnode maintains a reference count of how many parts of the system
+are using the vnode.
+This allows the system to detect when a vnode is
+no longer being used and can be safely recycled for a different file.
+.Pp
+Any code in the system which is using a vnode (e.g.\& during the
+operation of some algorithm or to store in a data structure) should
+call
+.Fn vref .
+.Sh SEE ALSO
+.Xr vget 9 ,
+.Xr vnode 9 ,
+.Xr vput 9 ,
+.Xr vrefcnt 9 ,
+.Xr vrele 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
diff --git a/share/man/man9/vrefcnt.9 b/share/man/man9/vrefcnt.9
new file mode 100644
index 000000000000..de7af26fb9c0
--- /dev/null
+++ b/share/man/man9/vrefcnt.9
@@ -0,0 +1,53 @@
+.\" Copyright (C) 2007 Chad David <davidc@acns.ab.ca>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
+.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+.\" DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 10, 2008
+.Dt VREFCNT 9
+.Os
+.Sh NAME
+.Nm vrefcnt
+.Nd returns the use count of a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn vrefcnt "struct vnode *vp"
+.Sh DESCRIPTION
+Returns the use count of a vnode.
+.Pp
+See
+.Xr vnode 9
+for a detailed description of the vnode reference counts.
+.Sh SEE ALSO
+.Xr vget 9 ,
+.Xr vnode 9 ,
+.Xr vput 9 ,
+.Xr vrele 9
+.Sh AUTHORS
+This manual page was written by
+.An Chad David .
diff --git a/share/man/man9/vrele.9 b/share/man/man9/vrele.9
new file mode 100644
index 000000000000..d29ca5b079b0
--- /dev/null
+++ b/share/man/man9/vrele.9
@@ -0,0 +1,101 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\" Copyright (c) 2010 Konstantin Belousov <kib@FreeBSD.org>
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2010
+.Dt VRELE 9
+.Os
+.Sh NAME
+.Nm vput ,
+.Nm vrele ,
+.Nm vunref
+.Nd decrement the use count for a vnode
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft void
+.Fn vput "struct vnode *vp"
+.Ft void
+.Fn vrele "struct vnode *vp"
+.Ft void
+.Fn vunref "struct vnode *vp"
+.Sh DESCRIPTION
+Decrement the
+.Va v_usecount
+field of a vnode.
+.Bl -tag -width 2n
+.It Fa vp
+the vnode to decrement
+.El
+.Pp
+The
+.Fn vrele
+function takes an unlocked vnode and returns with the vnode unlocked.
+.Pp
+The
+.Fn vput
+function should be given a locked vnode as argument, the vnode is unlocked
+after the function returned.
+The
+.Fn vput
+is operationally equivalent to calling
+.Xr VOP_UNLOCK 9
+followed by
+.Xr vrele 9 ,
+with less overhead.
+.Pp
+The
+.Fn vunref
+function takes a locked vnode as argument, and returns with the vnode locked.
+.Pp
+Any code in the system which signified its use of a vnode by usecount
+should call one of the listed function to decrement use counter.
+If the
+.Va v_usecount
+field of the non-doomed vnode reaches zero, then it will be inactivated
+and placed on the free list.
+Since the functions might need to call VOPs for the vnode, the
+.Va Giant
+mutex should be conditionally locked around the call.
+.Pp
+The hold count for the vnode is always greater or equal to the usecount.
+Non-forced unmount fails when mount point owns a vnode that has non-zero
+usecount, see
+.Xr vflush 9 .
+.Sh SEE ALSO
+.Xr vget 9 ,
+.Xr vnode 9 ,
+.Xr vref 9 ,
+.Xr vrefcnt 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson
+and
+.An Konstantin Belousov .
diff --git a/share/man/man9/vslock.9 b/share/man/man9/vslock.9
new file mode 100644
index 000000000000..23c412725515
--- /dev/null
+++ b/share/man/man9/vslock.9
@@ -0,0 +1,91 @@
+.\" $NetBSD: vslock.9,v 1.1 1996/06/15 20:47:29 pk Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 10, 2004
+.Dt VSLOCK 9
+.Os
+.Sh NAME
+.Nm vslock ,
+.Nm vsunlock
+.Nd lock/unlock user space addresses in memory
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.In vm/vm.h
+.In vm/vm_extern.h
+.Ft int
+.Fn vslock "void *addr" "size_t len"
+.Ft void
+.Fn vsunlock "void *addr" "size_t len"
+.Sh DESCRIPTION
+The
+.Fn vslock
+and
+.Fn vsunlock
+functions respectively lock and unlock a range of
+addresses belonging to the currently running process into memory.
+The actual amount of memory locked is a multiple of the machine's page size.
+The starting page number is computed by truncating
+.Fa addr
+to the nearest preceding page boundary, and by rounding up
+.Fa addr +
+.Fa len
+to the next page boundary.
+The process context to use for this operation is taken from the
+global variable
+.Va curproc .
+.Sh RETURN VALUES
+The
+.Fn vslock
+function will return 0 on success, otherwise it will return
+one of the errors listed below.
+.Sh ERRORS
+The
+.Fn vslock
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa addr
+and
+.Fa len
+parameters specify a memory range that wraps around the end of the
+machine address space.
+.It Bq Er ENOMEM
+The size of the specified address range exceeds the system
+limit on locked memory.
+.It Bq Er ENOMEM
+Locking the requested address range would cause the process to exceed
+its per-process locked memory limit.
+.It Bq Er EFAULT
+Some portion of the indicated address range is not allocated.
+There was an error faulting/mapping a page.
+.El
diff --git a/share/man/man9/watchdog.9 b/share/man/man9/watchdog.9
new file mode 100644
index 000000000000..2df9fd6e450f
--- /dev/null
+++ b/share/man/man9/watchdog.9
@@ -0,0 +1,81 @@
+.\"
+.\" Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 28, 2004
+.Dt WATCHDOG 9
+.Os
+.Sh NAME
+.Nm watchdog
+.Nd "software and hardware watchdog facility"
+.Sh SYNOPSIS
+.In sys/watchdog.h
+.Ft void
+.Fn watchdog_fn "void *private" "u_int cmd" "int *error"
+.Fn EVENTHANDLER_REGISTER watchdog_list watchdog_fn private 0
+.Fn EVENTHANDLER_DEREGISTER watchdog_list eventhandler_tag
+.Sh DESCRIPTION
+To implement a watchdog in software or hardware, only a single
+function needs to be written and registered on the global
+.Va watchdog_list .
+.Pp
+The function must examine the
+.Fa cmd
+argument and act on it as
+follows:
+.Pp
+If
+.Fa cmd
+is zero, the watchdog must be disabled and the
+.Fa error
+argument left untouched.
+If the watchdog cannot be disabled, the
+.Fa error
+argument must be set to
+.Dv EOPNOTSUPP .
+.Pp
+Else the watchdog should be reset and configured to a timeout of
+.Pq 1 << Pq Fa cmd No & Dv WD_INTERVAL
+nanoseconds or larger and the
+.Fa error
+argument be set to zero to signal arming of a watchdog.
+.Pp
+If the watchdog cannot be configured to the proposed timeout, it
+must be disabled and the
+.Fa error
+argument left as is (to avoid hiding the arming of another watchdog).
+.Pp
+There is no specification of what the watchdog should do when it
+times out, but a hardware reset or similar
+.Dq "drastic but certain"
+behaviour is recommended.
+.Sh SEE ALSO
+.Xr watchdog 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility and this manual page was written
+.An Poul-Henning Kamp Aq phk@FreeBSD.org .
diff --git a/share/man/man9/zero_copy.9 b/share/man/man9/zero_copy.9
new file mode 100644
index 000000000000..50488d35ab04
--- /dev/null
+++ b/share/man/man9/zero_copy.9
@@ -0,0 +1,168 @@
+.\"
+.\" Copyright (c) 2002 Kenneth D. Merry.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions, and the following disclaimer,
+.\" without modification, immediately at the beginning of the file.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 5, 2004
+.Dt ZERO_COPY 9
+.Os
+.Sh NAME
+.Nm zero_copy ,
+.Nm zero_copy_sockets
+.Nd "zero copy sockets code"
+.Sh SYNOPSIS
+.Cd "options ZERO_COPY_SOCKETS"
+.Sh DESCRIPTION
+The
+.Fx
+kernel includes a facility for eliminating data copies on
+socket reads and writes.
+.Pp
+This code is collectively known as the zero copy sockets code, because during
+normal network I/O, data will not be copied by the CPU at all.
+Rather it
+will be DMAed from the user's buffer to the NIC (for sends), or DMAed from
+the NIC to a buffer that will then be given to the user (receives).
+.Pp
+The zero copy sockets code uses the standard socket read and write
+semantics, and therefore has some limitations and restrictions that
+programmers should be aware of when trying to take advantage of this
+functionality.
+.Pp
+For sending data, there are no special requirements or capabilities that
+the sending NIC must have.
+The data written to the socket, though, must be
+at least a page in size and page aligned in order to be mapped into the
+kernel.
+If it does not meet the page size and alignment constraints, it
+will be copied into the kernel, as is normally the case with socket I/O.
+.Pp
+The user should be careful not to overwrite buffers that have been written
+to the socket before the data has been freed by the kernel, and the
+copy-on-write mapping cleared.
+If a buffer is overwritten before it has
+been given up by the kernel, the data will be copied, and no savings in CPU
+utilization and memory bandwidth utilization will be realized.
+.Pp
+The
+.Xr socket 2
+API does not really give the user any indication of when his data has
+actually been sent over the wire, or when the data has been freed from
+kernel buffers.
+For protocols like TCP, the data will be kept around in
+the kernel until it has been acknowledged by the other side; it must be
+kept until the acknowledgement is received in case retransmission is required.
+.Pp
+From an application standpoint, the best way to guarantee that the data has
+been sent out over the wire and freed by the kernel (for TCP-based sockets)
+is to set a socket buffer size (see the
+.Dv SO_SNDBUF
+socket option in the
+.Xr setsockopt 2
+manual page) appropriate for the application and network environment and then
+make sure you have sent out twice as much data as the socket buffer size
+before reusing a buffer.
+For TCP, the send and receive socket buffer sizes
+generally directly correspond to the TCP window size.
+.Pp
+For receiving data, in order to take advantage of the zero copy receive
+code, the user must have a NIC that is configured for an MTU greater than
+the architecture page size.
+(E.g., for i386 it would be 4KB.)
+Additionally, in order for zero copy receive to work,
+packet payloads must be at least a page in size and page aligned.
+.Pp
+Achieving page aligned payloads requires a NIC that can split an incoming
+packet into multiple buffers.
+It also generally requires some sort of
+intelligence on the NIC to make sure that the payload starts in its own
+buffer.
+This is called
+.Dq "header splitting" .
+Currently the only NICs with
+support for header splitting are Alteon Tigon 2 based boards running
+slightly modified firmware.
+The
+.Fx
+.Xr ti 4
+driver includes modified firmware for Tigon 2 boards only.
+Header
+splitting code can be written, however, for any NIC that allows putting
+received packets into multiple buffers and that has enough programmability
+to determine that the header should go into one buffer and the payload into
+another.
+.Pp
+You can also do a form of header splitting that does not require any NIC
+modifications if your NIC is at least capable of splitting packets into
+multiple buffers.
+This requires that you optimize the NIC driver for your
+most common packet header size.
+If that size (ethernet + IP + TCP headers)
+is generally 66 bytes, for instance, you would set the first buffer in a
+set for a particular packet to be 66 bytes long, and then subsequent
+buffers would be a page in size.
+For packets that have headers that are
+exactly 66 bytes long, your payload will be page aligned.
+.Pp
+The other requirement for zero copy receive to work is that the buffer that
+is the destination for the data read from a socket must be at least a page
+in size and page aligned.
+.Pp
+Obviously the requirements for receive side zero copy are impossible to
+meet without NIC hardware that is programmable enough to do header
+splitting of some sort.
+Since most NICs are not that programmable, or their
+manufacturers will not share the source code to their firmware, this approach
+to zero copy receive is not widely useful.
+.Pp
+There are other approaches, such as RDMA and TCP Offload, that may
+potentially help alleviate the CPU overhead associated with copying data
+out of the kernel.
+Most known techniques require some sort of support at
+the NIC level to work, and describing such techniques is beyond the scope
+of this manual page.
+.Pp
+The zero copy send and zero copy receive code can be individually turned
+off via the
+.Va kern.ipc.zero_copy.send
+and
+.Va kern.ipc.zero_copy.receive
+.Nm sysctl
+variables respectively.
+.Sh SEE ALSO
+.Xr sendfile 2 ,
+.Xr socket 2 ,
+.Xr ti 4
+.Sh HISTORY
+The zero copy sockets code first appeared in
+.Fx 5.0 ,
+although it has
+been in existence in patch form since at least mid-1999.
+.Sh AUTHORS
+.An -nosplit
+The zero copy sockets code was originally written by
+.An Andrew Gallatin Aq gallatin@FreeBSD.org
+and substantially modified and updated by
+.An Kenneth Merry Aq ken@FreeBSD.org .
diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9
new file mode 100644
index 000000000000..a77fd5bc9d36
--- /dev/null
+++ b/share/man/man9/zone.9
@@ -0,0 +1,242 @@
+.\"-
+.\" Copyright (c) 2001 Dag-Erling Coïdan Smørgrav
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 25, 2012
+.Dt ZONE 9
+.Os
+.Sh NAME
+.Nm uma_zcreate ,
+.Nm uma_zalloc ,
+.Nm uma_zalloc_arg ,
+.Nm uma_zfree ,
+.Nm uma_zfree_arg ,
+.Nm uma_zdestroy ,
+.Nm uma_zone_set_max,
+.Nm uma_zone_get_max,
+.Nm uma_zone_get_cur
+.Nd zone allocator
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/queue.h
+.In vm/uma.h
+.Ft uma_zone_t
+.Fo uma_zcreate
+.Fa "char *name" "int size"
+.Fa "uma_ctor ctor" "uma_dtor dtor" "uma_init uminit" "uma_fini fini"
+.Fa "int align" "uint16_t flags"
+.Fc
+.Ft "void *"
+.Fn uma_zalloc "uma_zone_t zone" "int flags"
+.Ft "void *"
+.Fn uma_zalloc_arg "uma_zone_t zone" "void *arg" "int flags"
+.Ft void
+.Fn uma_zfree "uma_zone_t zone" "void *item"
+.Ft void
+.Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg"
+.Ft void
+.Fn uma_zdestroy "uma_zone_t zone"
+.Ft int
+.Fn uma_zone_set_max "uma_zone_t zone" "int nitems"
+.Ft int
+.Fn uma_zone_get_max "uma_zone_t zone"
+.Ft int
+.Fn uma_zone_get_cur "uma_zone_t zone"
+.Sh DESCRIPTION
+The zone allocator provides an efficient interface for managing
+dynamically-sized collections of items of similar size.
+The zone allocator can work with preallocated zones as well as with
+runtime-allocated ones, and is therefore available much earlier in the
+boot process than other memory management routines.
+.Pp
+A zone is an extensible collection of items of identical size.
+The zone allocator keeps track of which items are in use and which
+are not, and provides functions for allocating items from the zone and
+for releasing them back (which makes them available for later use).
+.Pp
+After the first allocation of an item,
+it will have been cleared to zeroes, however subsequent allocations
+will retain the contents as of the last free.
+.Pp
+The
+.Fn uma_zcreate
+function creates a new zone from which items may then be allocated from.
+The
+.Fa name
+argument is a text name of the zone for debugging and stats; this memory
+should not be freed until the zone has been deallocated.
+.Pp
+The
+.Fa ctor
+and
+.Fa dtor
+arguments are callback functions that are called by
+the uma subsystem at the time of the call to
+.Fn uma_zalloc
+and
+.Fn uma_zfree
+respectively.
+Their purpose is to provide hooks for initializing or
+destroying things that need to be done at the time of the allocation
+or release of a resource.
+A good usage for the
+.Fa ctor
+and
+.Fa dtor
+callbacks
+might be to adjust a global count of the number of objects allocated.
+.Pp
+The
+.Fa uminit
+and
+.Fa fini
+arguments are used to optimize the allocation of
+objects from the zone.
+They are called by the uma subsystem whenever
+it needs to allocate or free several items to satisfy requests or memory
+pressure.
+A good use for the
+.Fa uminit
+and
+.Fa fini
+callbacks might be to
+initialize and destroy mutexes contained within the object.
+This would
+allow one to re-use already initialized mutexes when an object is returned
+from the uma subsystem's object cache.
+They are not called on each call to
+.Fn uma_zalloc
+and
+.Fn uma_zfree
+but rather in a batch mode on several objects.
+.Pp
+To allocate an item from a zone, simply call
+.Fn uma_zalloc
+with a pointer to that zone
+and set the
+.Fa flags
+argument to selected flags as documented in
+.Xr malloc 9 .
+It will return a pointer to an item if successful,
+or
+.Dv NULL
+in the rare case where all items in the zone are in use and the
+allocator is unable to grow the zone
+or when
+.Dv M_NOWAIT
+is specified.
+.Pp
+Items are released back to the zone from which they were allocated by
+calling
+.Fn uma_zfree
+with a pointer to the zone and a pointer to the item.
+If
+.Fa item
+is
+.Dv NULL ,
+then
+.Fn uma_zfree
+does nothing.
+.Pp
+The variations
+.Fn uma_zalloc_arg
+and
+.Fn uma_zfree_arg
+allow to
+specify an argument for the
+.Dv ctor
+and
+.Dv dtor
+functions, respectively.
+.Pp
+Created zones,
+which are empty,
+can be destroyed using
+.Fn uma_zdestroy ,
+freeing all memory that was allocated for the zone.
+All items allocated from the zone with
+.Fn uma_zalloc
+must have been freed with
+.Fn uma_zfree
+before.
+.Pp
+The
+.Fn uma_zone_set_max
+function limits the number of items
+.Pq and therefore memory
+that can be allocated to
+.Fa zone .
+The
+.Fa nitems
+argument specifies the requested upper limit number of items.
+The effective limit is returned to the caller, as it may end up being higher
+than requested due to the implementation rounding up to ensure all memory pages
+allocated to the zone are utilised to capacity.
+The limit applies to the total number of items in the zone, which includes
+allocated items, free items and free items in the per-cpu caches.
+On systems with more than one CPU it may not be possible to allocate
+the specified number of items even when there is no shortage of memory,
+because all of the remaining free items may be in the caches of the
+other CPUs when the limit is hit.
+.Pp
+The
+.Fn uma_zone_get_max
+function returns the effective upper limit number of items for a zone.
+.Pp
+The
+.Fn uma_zone_get_cur
+function returns the approximate current occupancy of the zone.
+The returned value is approximate because appropriate synchronisation to
+determine an exact value is not performed by the implementation.
+This ensures low overhead at the expense of potentially stale data being used
+in the calculation.
+.Sh RETURN VALUES
+The
+.Fn uma_zalloc
+function returns a pointer to an item, or
+.Dv NULL
+if the zone ran out of unused items and the allocator was unable to
+enlarge it.
+.Sh SEE ALSO
+.Xr malloc 9
+.Sh HISTORY
+The zone allocator first appeared in
+.Fx 3.0 .
+It was radically changed in
+.Fx 5.0
+to function as a slab allocator.
+.Sh AUTHORS
+.An -nosplit
+The zone allocator was written by
+.An John S. Dyson .
+The zone allocator was rewritten in large parts by
+.An Jeff Roberson Aq jeff@FreeBSD.org
+to function as a slab allocator.
+.Pp
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
+Changes for UMA by
+.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org .